From xen-changelog-bounces@lists.xenproject.org Tue Jun 02 11:44:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 02 Jun 2020 11:44: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 1jg5Kw-0002u9-VV; Tue, 02 Jun 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=dZT+=7P=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jg5Kv-0002u1-Sx
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 2020 11:44:05 +0000
X-Inumbo-ID: 5c6cd082-a4c6-11ea-9dbe-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 5c6cd082-a4c6-11ea-9dbe-bc764e2007e4;
 Tue, 02 Jun 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=xqQHx3WYZrJCJXN/4cEmlD/pYRUFEaNNPY4+uIluB0Y=; b=pSpirdE3HYEJxeiGveF4XXuTZy
 by2/KzKKYo9i9LtDpT4R/n4fB0MDOw5otKlRDXR26EymYKhksX8wddkhlBoYk3KO+s1lmxboo0SR9
 +O5p7maVrUMPN+/RPrKtNnJNkqf81swAnTIvawbTNckEPp8LUK5/KhDqxfHHcs79CxXw=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jg5Ku-0002WX-Qo
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 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 1jg5Ku-0003No-Pp
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 2020 11:44:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/mm: do not attempt to convert _PAGE_GNTTAB to a
 boolean
Message-Id: <E1jg5Ku-0003No-Pp@xenbits.xenproject.org>
Date: Tue, 02 Jun 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 6eb61b1a9dfe23ca443f977799cafb22770708a0
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Jun 2 13:36:41 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jun 2 13:36:41 2020 +0200

    x86/mm: do not attempt to convert _PAGE_GNTTAB to a boolean
    
    Clang 10 complains with:
    
    mm.c:1239:10: error: converting the result of '<<' to a boolean always evaluates to true
          [-Werror,-Wtautological-constant-compare]
        if ( _PAGE_GNTTAB && (l1e_get_flags(l1e) & _PAGE_GNTTAB) &&
             ^
    xen/include/asm/x86_64/page.h:161:25: note: expanded from macro '_PAGE_GNTTAB'
    #define _PAGE_GNTTAB (1U<<22)
                            ^
    
    Remove the conversion of _PAGE_GNTTAB to a boolean and instead use a
    preprocessor conditional to check if _PAGE_GNTTAB is defined.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/arch/x86/mm.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 53e3dcb2d4..e376fc7e8f 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -1235,8 +1235,14 @@ void put_page_from_l1e(l1_pgentry_t l1e, struct domain *l1e_owner)
      *
      * (Note that the undestroyable active grants are not a security hole in
      * Xen. All active grants can safely be cleaned up when the domain dies.)
+     *
+     * NB: the preprocessor conditional is required in order to prevent clang's
+     * -Wtautological-constant-compare complaining about converting the result
+     * of a << into a bool is always true if it's evaluated directly in the if
+     * condition.
      */
-    if ( _PAGE_GNTTAB && (l1e_get_flags(l1e) & _PAGE_GNTTAB) &&
+#if _PAGE_GNTTAB
+    if ( (l1e_get_flags(l1e) & _PAGE_GNTTAB) &&
          !l1e_owner->is_shutting_down && !l1e_owner->is_dying )
     {
         gdprintk(XENLOG_WARNING,
@@ -1244,6 +1250,7 @@ void put_page_from_l1e(l1_pgentry_t l1e, struct domain *l1e_owner)
                  l1e_get_intpte(l1e));
         domain_crash(l1e_owner);
     }
+#endif
 
     /*
      * Remember we didn't take a type-count of foreign writable mappings
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jun 02 11:44:17 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 02 Jun 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 1jg5L7-0002vK-0l; Tue, 02 Jun 2020 11: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=dZT+=7P=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jg5L5-0002v8-Ti
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 2020 11:44:15 +0000
X-Inumbo-ID: 626d9d5e-a4c6-11ea-abe2-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 626d9d5e-a4c6-11ea-abe2-12813bfff9fa;
 Tue, 02 Jun 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=cNbLCWy4Tnt1uUam9WjmQxbv0OSi1xfK32HbSe5x/i8=; b=QtqrWVWI39X9r5YyXYgvCZ6uSZ
 O4PCd36oA+qy9Az9dCDGGtHm7yYfL+2lNoEuK7xMnLFEehFxvPDbEINaVY6LXX9/HvzVYW5+TZUe/
 Z4+dUjw7Onb8FiRkfr7evfyip31ULIpuJ32iHqSNameKqFNOrnqB5RlNm7Q9kksB7fak=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jg5L4-0002Wd-Ts
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 2020 11:44:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jg5L4-0003On-Sw
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 2020 11:44:14 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] build32: don't discard .shstrtab in linker script
Message-Id: <E1jg5L4-0003On-Sw@xenbits.xenproject.org>
Date: Tue, 02 Jun 2020 11: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 10d27b48b5b4dfbead2d9bf03290984bba4806e4
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Jun 2 13:37:53 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jun 2 13:37:53 2020 +0200

    build32: don't discard .shstrtab in linker script
    
    LLVM linker doesn't support discarding .shstrtab, and complains with:
    
    ld -melf_i386_fbsd -N -T build32.lds -o reloc.lnk reloc.o
    ld: error: discarding .shstrtab section is not allowed
    
    Add an explicit .shstrtab, .strtab and .symtab sections to the linker
    script after the text section in order to make LLVM LD happy and match
    the behavior of GNU LD.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/arch/x86/boot/build32.lds | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/xen/arch/x86/boot/build32.lds b/xen/arch/x86/boot/build32.lds
index 97454b40ff..1ab9418793 100644
--- a/xen/arch/x86/boot/build32.lds
+++ b/xen/arch/x86/boot/build32.lds
@@ -50,6 +50,20 @@ SECTIONS
         *(.got.plt)
   }
 
+  /*
+   * Discarding .shstrtab is not supported by LLD (LLVM LD) and will trigger an
+   * error. Also keep the rest of the control sections to match GNU LD behavior.
+   */
+  .shstrtab : {
+        *(.shstrtab)
+  }
+  .strtab : {
+        *(.strtab)
+  }
+  .symtab : {
+        *(.symtab)
+  }
+
   /DISCARD/ : {
         /*
          * Discard everything else, to prevent linkers from putting
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jun 02 11:44:27 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 02 Jun 2020 11:44:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jg5LH-0002xJ-2T; Tue, 02 Jun 2020 11:44:27 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=dZT+=7P=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jg5LF-0002x2-OQ
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 2020 11:44:25 +0000
X-Inumbo-ID: 686f6f52-a4c6-11ea-abe2-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 686f6f52-a4c6-11ea-abe2-12813bfff9fa;
 Tue, 02 Jun 2020 11: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=O36McoE+IGboEQFQEhARGWp2FfaHQrF0FaWH/zcDTBE=; b=z0bIjOt/m7xDFfWNELx2uBlm7x
 sZzTV8intI12awai+RiZMXy+m66t4+Dq8PeXdndtdZhXPJRB5NYBjI0R4f4gGBze6uxrpyrokcIcE
 +aJX8TSmTY9LTH7WmX0XUjOusGJWboasEnJGTuj1arUDBB0YoUok7LczlVQY4CxoZgy4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jg5LF-0002Wn-0m
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 2020 11:44:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jg5LE-0003Pa-W4
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 2020 11:44:24 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] ﻿x86/cpu: fix build with clang 3.5
Message-Id: <E1jg5LE-0003Pa-W4@xenbits.xenproject.org>
Date: Tue, 02 Jun 2020 11: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 51461114e2639596fce174fcdd2fab608883ab3e
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Jun 2 13:38:32 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jun 2 13:38:32 2020 +0200

    ﻿x86/cpu: fix build with clang 3.5
    
    Clang 3.5 complains with:
    
    common.c:794:24: error: statement expression not allowed at file scope
                          i < ARRAY_SIZE(this_cpu(tss_page).ist_ssp); ++i )
                                         ^
    /build/xen/include/asm/percpu.h:14:7: note: expanded from macro 'this_cpu'
        (*RELOC_HIDE(&per_cpu__##var, get_cpu_info()->per_cpu_offset))
          ^
    /build/xen/include/xen/compiler.h:104:3: note: expanded from macro 'RELOC_HIDE'
      ({ unsigned long __ptr;                       \
      ^
    /build/xen/include/xen/lib.h:68:69: note: expanded from macro 'ARRAY_SIZE'
    #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]) + __must_be_array(x))
                                                                        ^
    /build/xen/include/xen/compiler.h:85:57: note: expanded from macro '__must_be_array'
      BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0])))
                                                            ^
    /build/xen/include/xen/lib.h:39:57: note: expanded from macro 'BUILD_BUG_ON_ZERO'
    #define BUILD_BUG_ON_ZERO(cond) sizeof(struct { int:-!!(cond); })
                                                            ^
    
    Workaround this by defining the tss_page as a local variable. Adjust
    other users of the per-cpu tss_page to also use the newly introduced
    local variable.
    
    No functional change expected.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Wei Liu <wl@xen.org>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/arch/x86/cpu/common.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 58f0876180..da74172776 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -738,9 +738,14 @@ void load_system_tables(void)
 	unsigned int i, cpu = smp_processor_id();
 	unsigned long stack_bottom = get_stack_bottom(),
 		stack_top = stack_bottom & ~(STACK_SIZE - 1);
+	/*
+	 * NB: define tss_page as a local variable because clang 3.5 doesn't
+	 * support using ARRAY_SIZE against per-cpu variables.
+	 */
+	struct tss_page *tss_page = &this_cpu(tss_page);
 
 	/* The TSS may be live.	 Disuade any clever optimisations. */
-	volatile struct tss64 *tss = &this_cpu(tss_page).tss;
+	volatile struct tss64 *tss = &tss_page->tss;
 	seg_desc_t *gdt =
 		this_cpu(gdt) - FIRST_RESERVED_GDT_ENTRY;
 
@@ -783,15 +788,14 @@ void load_system_tables(void)
 	 * volatile qualifier.
 	 */
 	if (cpu_has_xen_shstk) {
-		volatile uint64_t *ist_ssp = this_cpu(tss_page).ist_ssp;
+		volatile uint64_t *ist_ssp = tss_page->ist_ssp;
 
 		ist_ssp[0] = 0x8600111111111111ul;
 		ist_ssp[IST_MCE] = stack_top + (IST_MCE * IST_SHSTK_SIZE) - 8;
 		ist_ssp[IST_NMI] = stack_top + (IST_NMI * IST_SHSTK_SIZE) - 8;
 		ist_ssp[IST_DB]	 = stack_top + (IST_DB	* IST_SHSTK_SIZE) - 8;
 		ist_ssp[IST_DF]	 = stack_top + (IST_DF	* IST_SHSTK_SIZE) - 8;
-		for ( i = IST_DF + 1;
-		      i < ARRAY_SIZE(this_cpu(tss_page).ist_ssp); ++i )
+		for ( i = IST_DF + 1; i < ARRAY_SIZE(tss_page->ist_ssp); ++i )
 			ist_ssp[i] = 0x8600111111111111ul;
 
 		wrmsrl(MSR_INTERRUPT_SSP_TABLE, (unsigned long)ist_ssp);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jun 02 11:44:37 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 02 Jun 2020 11: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 1jg5LR-0002yx-40; Tue, 02 Jun 2020 11: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=dZT+=7P=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jg5LP-0002yj-Ot
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 2020 11:44:35 +0000
X-Inumbo-ID: 6e740822-a4c6-11ea-abe2-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 6e740822-a4c6-11ea-abe2-12813bfff9fa;
 Tue, 02 Jun 2020 11: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=HTSwlqT/NIxh5GbIgE9qv5eH/dAvCVqsNhUASJC2Thc=; b=vsLOhlLFlyHM7ltLYYX2xD5bE0
 JUtum0ZgNTUiP/GgIi+KNij4IOlbXy2EIjLqswfJ1b/fpNMm00n18zxvA75RL0Y3QogwCSes3Qnr5
 1vNUA6pvZ+N0ArQUNb2JegdTLrOJOaVnKBq6OvmwMwsIJSU/aQRH3e7nmoKxOf7rRl+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 1jg5LP-0002XT-3w
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 2020 11:44:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jg5LP-0003QK-2t
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 2020 11:44:35 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] compilers: always use _Static_assert with clang
Message-Id: <E1jg5LP-0003QK-2t@xenbits.xenproject.org>
Date: Tue, 02 Jun 2020 11: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 3d5a836379e5064d563322de095d0775607ff185
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Jun 2 13:39:02 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jun 2 13:39:02 2020 +0200

    compilers: always use _Static_assert with clang
    
    All versions of clang used by Xen support _Static_assert, so use it
    unconditionally when building Xen with clang.
    
    No functional change expected.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Wei Liu <wl@xen.org>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/include/xen/lib.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/include/xen/lib.h b/xen/include/xen/lib.h
index e5b0a007b8..076bcfb67d 100644
--- a/xen/include/xen/lib.h
+++ b/xen/include/xen/lib.h
@@ -25,7 +25,9 @@
 #define BUG_ON(p)  do { if (unlikely(p)) BUG();  } while (0)
 #define WARN_ON(p) do { if (unlikely(p)) WARN(); } while (0)
 
-#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
+/* All clang versions supported by Xen have _Static_assert. */
+#if defined(__clang__) || \
+    (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
 /* Force a compilation error if condition is true */
 #define BUILD_BUG_ON(cond) ({ _Static_assert(!(cond), "!(" #cond ")"); })
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jun 02 13:11:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 02 Jun 2020 13: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 1jg6h8-0005BZ-BU; Tue, 02 Jun 2020 13:11:06 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=dZT+=7P=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jg6h8-0005BU-3a
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 2020 13:11:06 +0000
X-Inumbo-ID: 8403f27c-a4d2-11ea-abf2-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 8403f27c-a4d2-11ea-abf2-12813bfff9fa;
 Tue, 02 Jun 2020 13: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=FKwqsNE3+YndpWkU4fAF+1Pm/UOfOUCCF2q6Otm0hYw=; b=bAkUWucKphiE/7dH49RKctCkde
 u8vwnMveger5IBpEDkDFVmFWnxkw19UPYjcnlg3P+0LuA8KPC9c83QccNJi2mUAQldsmi7JlZAsVz
 hj6TvsMQh14UQF/wfftYtEYfcgF6n3GwrSJOkCAWq07BGO86yRGx8J7mxv0XF9GOtgAY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jg6h7-0004VS-8M
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 2020 13:11:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jg6h7-0001fa-7O
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 2020 13:11:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] INSTALL: remove TODO section
Message-Id: <E1jg6h7-0001fa-7O@xenbits.xenproject.org>
Date: Tue, 02 Jun 2020 13:11: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 adb93c591af87549639894391f6827805cdf8ced
Author:     Olaf Hering <olaf@aepfle.de>
AuthorDate: Fri May 29 15:53:03 2020 +0200
Commit:     Wei Liu <wl@xen.org>
CommitDate: Tue Jun 2 11:55:38 2020 +0000

    INSTALL: remove TODO section
    
    The default value '/' for DESTDIR is unusual, but does probably not hurt.
    
    Fixes commit f2b40dababedcd8355bf3e85d00baf17f9827131
    Fixes commit 8e986e5a61efeca92b9b268e77957d45d8316ee4
    
    Signed-off-by: Olaf Hering <olaf@aepfle.de>
    Acked-by: Wei Liu <wl@xen.org>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 INSTALL | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/INSTALL b/INSTALL
index 72dc4b67dd..0d3eb89f02 100644
--- a/INSTALL
+++ b/INSTALL
@@ -365,12 +365,5 @@ make XEN_TARGET_ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- \
         DESTDIR=/some/path install
 
 
-TODO
-====
-
- - DESTDIR should be empty, not "/"
- - add make uninstall targets
- - replace private path variables as needed (SBINDIR/sbindir)
- - ...
 
 # vim: tw=72 et
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jun 02 13:11:17 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 02 Jun 2020 13:11:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jg6hJ-0005Cw-DA; Tue, 02 Jun 2020 13:11:17 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=dZT+=7P=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jg6hI-0005Cl-6k
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 2020 13:11:16 +0000
X-Inumbo-ID: 8a0ffe40-a4d2-11ea-abf2-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 8a0ffe40-a4d2-11ea-abf2-12813bfff9fa;
 Tue, 02 Jun 2020 13: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=4nlmxk5qkFx5l8/T2eqazlHv1I7Dv4VNZhm9tlIkAdo=; b=OyTWPThpiim7+MsTUtSxos05Yr
 JL+0Fh3Tppil2Otu0OKyA80t1b4uIZtv8GEADHz6ygBe/nMId846RkXld8/tkkruVlDbqiISsvfsj
 11D6kVNNRpwILQ8+U6jNG/f1ZGs4FR3a7qhR9UEesxgtnOvojPTz+V9G7rNod3JXXSBo=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jg6hH-0004Vb-Be
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 2020 13:11:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jg6hH-0001i8-Aa
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 2020 13:11:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] libxl: stop libxl_domain_info() consuming massive
 amounts of stack
Message-Id: <E1jg6hH-0001i8-Aa@xenbits.xenproject.org>
Date: Tue, 02 Jun 2020 13: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 2c4b1a7efb15292c0360f305b64581ac135ab8f2
Author:     Paul Durrant <pdurrant@amazon.com>
AuthorDate: Thu May 28 16:13:30 2020 +0100
Commit:     Wei Liu <wl@xen.org>
CommitDate: Tue Jun 2 11:57:01 2020 +0000

    libxl: stop libxl_domain_info() consuming massive amounts of stack
    
    Currently an array of 1024 xc_domaininfo_t is declared on stack. That alone
    consumes ~112k. Since libxl_domain_info() creates a new gc this patch simply
    uses it to allocate the array instead.
    
    Signed-off-by: Paul Durrant <pdurrant@amazon.com>
    Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 tools/libxl/libxl_domain.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/libxl/libxl_domain.c b/tools/libxl/libxl_domain.c
index c08af308fa..39f08a6519 100644
--- a/tools/libxl/libxl_domain.c
+++ b/tools/libxl/libxl_domain.c
@@ -314,11 +314,13 @@ libxl_dominfo * libxl_list_domain(libxl_ctx *ctx, int *nb_domain_out)
 {
     libxl_dominfo *ptr = NULL;
     int i, ret;
-    xc_domaininfo_t info[1024];
+    xc_domaininfo_t *info;
     int size = 0;
     uint32_t domid = 0;
     GC_INIT(ctx);
 
+    GCNEW_ARRAY(info, 1024);
+
     while ((ret = xc_domain_getinfolist(ctx->xch, domid, 1024, info)) > 0) {
         ptr = libxl__realloc(NOGC, ptr, (size + ret) * sizeof(libxl_dominfo));
         for (i = 0; i < ret; i++) {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jun 02 13:11:27 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 02 Jun 2020 13:11:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jg6hT-0005Fj-Nc; Tue, 02 Jun 2020 13:11: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=dZT+=7P=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jg6hS-0005FU-Ru
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 2020 13:11:26 +0000
X-Inumbo-ID: 900e52ce-a4d2-11ea-81bc-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 900e52ce-a4d2-11ea-81bc-bc764e2007e4;
 Tue, 02 Jun 2020 13: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=HerEhFYXUc/Xivni/TTLIKE88ku56K3imBoaPQmtPNM=; b=Hh8Rs9epZA5t7GkRix0FRaZeyG
 f8Osalx1vNjgrpM7xKGY2775Ti4/+RwYDCYdWvz7WKD8mcYW849qmtB/NOE2V5hhZLHKy6lqChQMP
 2pX5Rx54x32OAxGKX5QBxUn7hhOl+mVu0V1bgLlfq+ftxGVk3laX+B2/h189t+aFNQTk=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jg6hR-0004Vp-Ei
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 2020 13:11:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jg6hR-0001jI-Dj
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 2020 13:11:25 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] automation: update openSUSE Tumbleweed building
 dependencies
Message-Id: <E1jg6hR-0001jI-Dj@xenbits.xenproject.org>
Date: Tue, 02 Jun 2020 13: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 92076f0994268196f595b166e5ed3701551e9954
Author:     Dario Faggioli <dfaggioli@suse.com>
AuthorDate: Thu Apr 30 20:27:28 2020 +0200
Commit:     Wei Liu <wl@xen.org>
CommitDate: Tue Jun 2 12:01:47 2020 +0000

    automation: update openSUSE Tumbleweed building dependencies
    
    We need python3 (and the respective -devel package), these days.
    
    Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
    Acked-by: Wei Liu <wl@xen.org>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 automation/build/suse/opensuse-tumbleweed.dockerfile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/automation/build/suse/opensuse-tumbleweed.dockerfile b/automation/build/suse/opensuse-tumbleweed.dockerfile
index 2676a87c85..084cce0921 100644
--- a/automation/build/suse/opensuse-tumbleweed.dockerfile
+++ b/automation/build/suse/opensuse-tumbleweed.dockerfile
@@ -56,6 +56,8 @@ RUN zypper install -y --no-recommends \
         pkg-config \
         python \
         python-devel \
+        python3 \
+        python3-devel \
         systemd-devel \
         tar \
         transfig \
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jun 02 13:11:36 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 02 Jun 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 1jg6hc-0005IE-PG; Tue, 02 Jun 2020 13: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=dZT+=7P=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jg6hc-0005Hx-1y
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 2020 13:11:36 +0000
X-Inumbo-ID: 96164b9a-a4d2-11ea-8993-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 96164b9a-a4d2-11ea-8993-bc764e2007e4;
 Tue, 02 Jun 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=Y9jYCNHFbxRhBLgRMXU5eP/rWH04ueMaVuFDt636ClA=; b=JGlK8sDap+5fCFNxqrxKe2+E/W
 GZ8F2xCzvOQNrh4NkjZtGLEwqJoCRN1XnwYfWrBZVfSRd2STOspF7gv/wcUR6i1TshQIE5XIN6ZNR
 RF2CkRRcA9mxuumb++tSjhbsjb7jLWww7fvyNxiE+ZLZ099G+Ow6KqLWkCd0nM/Eb6CM=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jg6hb-0004YK-IR
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 2020 13:11:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jg6hb-0001kU-Go
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 2020 13:11:35 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] automation: openSUSE distro names helpers for
 containerize
Message-Id: <E1jg6hb-0001kU-Go@xenbits.xenproject.org>
Date: Tue, 02 Jun 2020 13: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 177b81e4649ca21fe6261e8cfbb4f135e3049029
Author:     Dario Faggioli <dfaggioli@suse.com>
AuthorDate: Tue Jun 2 12:01:05 2020 +0000
Commit:     Wei Liu <wl@xen.org>
CommitDate: Tue Jun 2 12:01:51 2020 +0000

    automation: openSUSE distro names helpers for containerize
    
    Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
    Acked-by: Wei Liu <wl@xen.org>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 automation/scripts/containerize | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/automation/scripts/containerize b/automation/scripts/containerize
index b71edd736c..22da711ace 100755
--- a/automation/scripts/containerize
+++ b/automation/scripts/containerize
@@ -25,6 +25,8 @@ case "_${CONTAINER}" in
     _unstable|_) CONTAINER="${BASE}/debian:unstable" ;;
     _trusty) CONTAINER="${BASE}/ubuntu:trusty" ;;
     _xenial) CONTAINER="${BASE}/ubuntu:xenial" ;;
+    _opensuse-leap|_leap) CONTAINER="${BASE}/suse:opensuse-leap" ;;
+    _opensuse-tumbleweed|_tumbleweed) CONTAINER="${BASE}/suse:opensuse-tumbleweed" ;;
 esac
 
 # Use this variable to control whether root should be used
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jun 02 13:11:47 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 02 Jun 2020 13: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 1jg6hn-0005KY-Qz; Tue, 02 Jun 2020 13:11: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=dZT+=7P=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jg6hm-0005KM-Ji
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 2020 13:11:46 +0000
X-Inumbo-ID: 9c1d88e6-a4d2-11ea-abf2-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 9c1d88e6-a4d2-11ea-abf2-12813bfff9fa;
 Tue, 02 Jun 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=A2bRIQlk9ZE585YMDHmjBi012fLHpAm8vb9+lLfpDUQ=; b=3Cxv4D/fsRWWui4nRhOC1Xw2q4
 OpCD8VAVqrpBo0ZsVEzlS2Y/YRoGs+3I7lFXaLI+Vr1LNlgymDHNxex1Jm34z4+AzpzAl5OSmba5m
 hCKFwtkSd3MGfe3zDVZ0siQM5t6dQmmvTl5zK9uxj/hM0pISmzNT+i0K5h6lULHXBstQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jg6hl-0004YZ-MG
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 2020 13:11:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jg6hl-0001lR-Kb
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 2020 13:11:45 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] automation: implement (rootless) podman support in
 containerize
Message-Id: <E1jg6hl-0001lR-Kb@xenbits.xenproject.org>
Date: Tue, 02 Jun 2020 13: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 753ba5b37d6b547a7aa5f54fd498b56e02c80e2f
Author:     Dario Faggioli <dfaggioli@suse.com>
AuthorDate: Thu Apr 30 20:27:39 2020 +0200
Commit:     Wei Liu <wl@xen.org>
CommitDate: Tue Jun 2 12:01:51 2020 +0000

    automation: implement (rootless) podman support in containerize
    
    Right now only docker is supported, when using the containerize script
    for building inside containers. Enable podman as well.
    
    Note that podman can be use in rootless mode too, but for that to work
    the files /etc/subuid and /etc/subgid must be properly configured.
    
    For instance:
    
    dario@localhost> cat /etc/subuid
    dario:100000:65536
    
    dario@localhost:> cat /etc/subgid
    dario:100000:65536
    
    Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
    Acked-by: Wei Liu <wl@xen.org>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 automation/build/README.md      | 10 ++++++++++
 automation/scripts/containerize | 17 +++++++++++++----
 2 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/automation/build/README.md b/automation/build/README.md
index 8cda2b65a5..e1fb3124de 100644
--- a/automation/build/README.md
+++ b/automation/build/README.md
@@ -34,6 +34,16 @@ the default shell.
 There are several environment variables which the containerize script
 understands.
 
+- DOCKED_CMD: Whether to use docker or podman for running the containers.
+  podman can be used as a regular user (rootless podman), but for that
+  to work, /etc/subuid and /etc/subgid needs to containe the proper
+  entries, for such user.
+  docker is the default, for running with podman, do:
+
+  ```
+  DOCKER_CMD=podman ./automation/scripts/containerize make
+  ```
+
 - CONTAINER: This overrides the container to use. For CentOS 7.2, use:
 
   ```
diff --git a/automation/scripts/containerize b/automation/scripts/containerize
index 22da711ace..a75d54566c 100755
--- a/automation/scripts/containerize
+++ b/automation/scripts/containerize
@@ -1,5 +1,14 @@
 #!/bin/bash
 
+#
+# DOCKER_CMD should be either `docker` or `podman`.
+#
+# if using (rootless) podman, remember to set /etc/subuid
+# and /etc/subgid.
+#
+docker_cmd=${DOCKER_CMD:-"docker"}
+[ "$DOCKER_CMD" = "podman" ] && userns_podman="--userns=keep-id"
+
 einfo() {
     echo "$*" >&2
 }
@@ -32,7 +41,7 @@ esac
 # Use this variable to control whether root should be used
 case "_${CONTAINER_UID0}" in
     _1)   userarg= ;;
-    _0|_) userarg="-u $(id -u)" ;;
+    _0|_) userarg="-u $(id -u) $userns_podman" ;;
 esac
 
 # Save the commands for future use
@@ -50,8 +59,8 @@ tty -s && termint=t
 #
 if [[ "_${CONTAINER_NO_PULL}" != "_1" ]]; then
     einfo "*** Ensuring ${CONTAINER} is up to date"
-    docker pull ${CONTAINER} > /dev/null ||     \
-        die "Failed to update docker container"
+    ${docker_cmd} pull ${CONTAINER} > /dev/null ||     \
+        die "Failed to update container"
 fi
 
 if hash greadlink > /dev/null 2>&1; then
@@ -83,7 +92,7 @@ fi
 
 # Kick off Docker
 einfo "*** Launching container ..."
-exec docker run \
+exec ${docker_cmd} run \
     ${userarg} \
     ${SSH_AUTH_SOCK:+-e SSH_AUTH_SOCK="/tmp/ssh-agent/${SSH_AUTH_NAME}"} \
     -v "${CONTAINER_PATH}":/build:rw \
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jun 02 13:11:57 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 02 Jun 2020 13:11:57 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jg6hx-0005MU-Se; Tue, 02 Jun 2020 13:11: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=dZT+=7P=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jg6hw-0005MC-A1
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 2020 13:11:56 +0000
X-Inumbo-ID: a222e4a2-a4d2-11ea-9dbe-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id a222e4a2-a4d2-11ea-9dbe-bc764e2007e4;
 Tue, 02 Jun 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=N/H3dntQU29IAOcaDJ05a5MBSQTQwIekoHjzI7kidQI=; b=ApA+PmFERMvOzjLvgFNF5ZHRpk
 XAqqVp/W+i8FuBrrBniX+3Qy+0TK/gSVd4tAf3MRFnbDpro1NeNJShT5e8IIQC4Ycgyu+s984xbti
 ph7ge8sy0LEGSQc/cpG+nWgpFH1LafSXQXTGiiFJxJ05gXUeNfHoAcx1BPqtLzKbmSh8=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jg6hv-0004Yi-PJ
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 2020 13:11:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jg6hv-0001m4-ON
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 2020 13:11:55 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] CHANGELOG: Add qemu-xen linux device model stubdomains
Message-Id: <E1jg6hv-0001m4-ON@xenbits.xenproject.org>
Date: Tue, 02 Jun 2020 13:11: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 52a9022fe95a417097ceb71bb59639201f7b1966
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Tue Jun 2 12:03:56 2020 +0000
Commit:     Wei Liu <wl@xen.org>
CommitDate: Tue Jun 2 12:03:56 2020 +0000

    CHANGELOG: Add qemu-xen linux device model stubdomains
    
    Add qemu-xen linux device model stubdomain.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: Paul Durrant <paul@xen.org>
---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 75b7582447..8786c51cb4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,6 +17,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Hypervisor framework to ease porting Xen to run on hypervisors.
  - Initial support to run on Hyper-V.
  - Initial hypervisor file system (hypfs) support.
+ - libxl support for running qemu-xen device model in a linux stubdomain.
 
 ## [4.13.0](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.13.0) - 2019-12-17
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jun 02 13:12:08 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 02 Jun 2020 13:12: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 1jg6i7-0005OZ-UF; Tue, 02 Jun 2020 13:12:07 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=dZT+=7P=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jg6i6-0005OH-HU
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 2020 13:12:06 +0000
X-Inumbo-ID: a825b262-a4d2-11ea-abf2-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id a825b262-a4d2-11ea-abf2-12813bfff9fa;
 Tue, 02 Jun 2020 13:12: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=0EzxGeh1iWyO5/hxY4Ot84v3saehHdt+KphBpY72Avc=; b=uztcabVIbVmpnpt3xuNhuuxnBP
 nin4Sx26kgYUDVL80usDS7iUVyMUfJM29JU3l4bi3VtCgIvQMbeZCR8LifTiIEj4q/pKumZKoWyZ7
 PGwXGrSDkhkbXZUcJ9wUSLawQskAiKP/HPwqcC+oNWEJft2Gks342fZ9GoxJKr/pOugU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jg6i5-0004ZA-SI
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 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 1jg6i5-0001nD-RV
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 2020 13:12:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] tools: check return value of asprintf() in xenhypfs
Message-Id: <E1jg6i5-0001nD-RV@xenbits.xenproject.org>
Date: Tue, 02 Jun 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 370b41113eaed780f109d708e4478a6bfb794459
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Jun 2 08:00:20 2020 +0200
Commit:     Wei Liu <wl@xen.org>
CommitDate: Tue Jun 2 12:05:13 2020 +0000

    tools: check return value of asprintf() in xenhypfs
    
    asprintf() can fail, so check its return value. Additionally fix a
    memory leak in xenhypfs.
    
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Wei Liu <wl@xen.org>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/misc/xenhypfs.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tools/misc/xenhypfs.c b/tools/misc/xenhypfs.c
index 158b901f42..5145b8969f 100644
--- a/tools/misc/xenhypfs.c
+++ b/tools/misc/xenhypfs.c
@@ -148,9 +148,14 @@ static int xenhypfs_tree_sub(char *path, unsigned int depth)
         printf("%*s%s%s\n", depth * 2, "", ent[i].name,
                ent[i].type == xenhypfs_type_dir ? "/" : "");
         if (ent[i].type == xenhypfs_type_dir) {
-            asprintf(&p, "%s%s%s", path, (depth == 1) ? "" : "/", ent[i].name);
+            if (asprintf(&p, "%s%s%s", path, (depth == 1) ? "" : "/",
+                         ent[i].name) < 0) {
+                ret = 2;
+                break;
+            }
             if (xenhypfs_tree_sub(p, depth + 1))
                 ret = 2;
+            free(p);
         }
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jun 02 13:12:18 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 02 Jun 2020 13:12: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 1jg6iH-0005QH-Vp; Tue, 02 Jun 2020 13:12:17 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=dZT+=7P=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jg6iG-0005Q3-Qm
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 2020 13:12:16 +0000
X-Inumbo-ID: ae2b5acc-a4d2-11ea-8993-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id ae2b5acc-a4d2-11ea-8993-bc764e2007e4;
 Tue, 02 Jun 2020 13:12: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=xrBR/24IyDw+XQ2v4Uu9M9HTrygKX2dtYTz8D6q9NSs=; b=4N7WMcJrNNjWd2FRUB7C+cS83O
 rQpoWtAcosY8uWevhk1bZTz4pe77RDIOzHi41ClnPkWzVSpTvD+bixBjPR3zfXR7F08EG6Mhd38jx
 tVVRJ3lqFzmxmNfW/1gmapvntBRTAjxy/+IkFMfTsvfYymGENLjTaYKGnsI/bRfg1BZM=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jg6iF-0004ZJ-Vo
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 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 1jg6iF-0001nw-UN
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 2020 13:12:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] tools: make libxenhypfs interface more future proof
Message-Id: <E1jg6iF-0001nw-UN@xenbits.xenproject.org>
Date: Tue, 02 Jun 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 dde6174ada5280cd9a6396e3b12606360a0d29a3
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Jun 2 08:00:21 2020 +0200
Commit:     Wei Liu <wl@xen.org>
CommitDate: Tue Jun 2 12:05:30 2020 +0000

    tools: make libxenhypfs interface more future proof
    
    As compilers are free to choose the width of an enum they should be
    avoided in stable interfaces when declaring a variable. So the
    struct xenhypfs_dirent definition should be modified to have explicitly
    sized members for type and encoding and the related enums should be
    defined separately.
    
    Additionally it is better to have a larger flags member in that struct
    with the "writable" indicator occupying only a single bit. This will
    make future additions easier.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Wei Liu <wl@xen.org>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/libs/hypfs/core.c             |  2 +-
 tools/libs/hypfs/include/xenhypfs.h | 31 ++++++++++++++++++-------------
 tools/misc/xenhypfs.c               |  3 ++-
 3 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/tools/libs/hypfs/core.c b/tools/libs/hypfs/core.c
index d4309b5ae2..c91e165705 100644
--- a/tools/libs/hypfs/core.c
+++ b/tools/libs/hypfs/core.c
@@ -204,7 +204,7 @@ static void xenhypfs_set_attrs(struct xen_hypfs_direntry *entry,
         dirent->type = xenhypfs_type_blob;
     }
 
-    dirent->is_writable = entry->max_write_len;
+    dirent->flags = entry->max_write_len ? XENHYPFS_FLAG_WRITABLE : 0;
 }
 
 void *xenhypfs_read_raw(xenhypfs_handle *fshdl, const char *path,
diff --git a/tools/libs/hypfs/include/xenhypfs.h b/tools/libs/hypfs/include/xenhypfs.h
index ab157edceb..25432d2a16 100644
--- a/tools/libs/hypfs/include/xenhypfs.h
+++ b/tools/libs/hypfs/include/xenhypfs.h
@@ -26,22 +26,27 @@ struct xentoollog_logger;
 
 typedef struct xenhypfs_handle xenhypfs_handle;
 
+enum xenhypfs_type {
+    xenhypfs_type_dir,
+    xenhypfs_type_blob,
+    xenhypfs_type_string,
+    xenhypfs_type_uint,
+    xenhypfs_type_int,
+    xenhypfs_type_bool,
+};
+
+enum xenhypfs_encoding {
+    xenhypfs_enc_plain,
+    xenhypfs_enc_gzip
+};
+
 struct xenhypfs_dirent {
     char *name;
     size_t size;
-    enum {
-        xenhypfs_type_dir,
-        xenhypfs_type_blob,
-        xenhypfs_type_string,
-        xenhypfs_type_uint,
-        xenhypfs_type_int,
-        xenhypfs_type_bool
-    } type;
-    enum {
-        xenhypfs_enc_plain,
-        xenhypfs_enc_gzip
-    } encoding;
-    bool is_writable;
+    unsigned short type;
+    unsigned short encoding;
+    unsigned int flags;
+#define XENHYPFS_FLAG_WRITABLE  0x00000001
 };
 
 xenhypfs_handle *xenhypfs_open(struct xentoollog_logger *logger,
diff --git a/tools/misc/xenhypfs.c b/tools/misc/xenhypfs.c
index 5145b8969f..5da24aed90 100644
--- a/tools/misc/xenhypfs.c
+++ b/tools/misc/xenhypfs.c
@@ -125,7 +125,8 @@ static int xenhypfs_ls(char *path)
     } else {
         for (i = 0; i < n; i++)
             printf("%s r%c %s\n", xenhypfs_type(ent + i),
-                   ent[i].is_writable ? 'w' : '-', ent[i].name);
+                   (ent[i].flags & XENHYPFS_FLAG_WRITABLE) ? 'w' : '-',
+                   ent[i].name);
 
         free(ent);
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jun 02 16:55:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 02 Jun 2020 16: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 1jgABu-0001Gl-Hs; Tue, 02 Jun 2020 16: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=dZT+=7P=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jgABt-0001G2-7w
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 2020 16:55:05 +0000
X-Inumbo-ID: ce378c72-a4f1-11ea-8993-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id ce378c72-a4f1-11ea-8993-bc764e2007e4;
 Tue, 02 Jun 2020 16: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=N4LeONiFCd1xbx0zd9hqlaSm/cPWgmjfok15ft+l3Ns=; b=y46W1hrV8UHn19kIa/5ELGuC4L
 6wflJKI+FTCl1D0yb94UyhWWtrqbd1Myw/uRyx9R8TsNXWNSjZuMJQ04IIvmGeQW7cTuvHrIraoWo
 oRADBdRnMcA/TW0ThMUm8M1nIQvhyJ6ABZcBwmlODwH4St8SLVM8T1EIyFbvgFRGJS3I=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jgABs-0001Ja-3g
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 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 1jgABs-0000BL-2d
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 2020 16:55:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] ] m4: use test instead of []
Message-Id: <E1jgABs-0000BL-2d@xenbits.xenproject.org>
Date: Tue, 02 Jun 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 e181db8ba4e0797b8f9b55996adfa71ffb5b4081
Author:     Wei Liu <wl@xen.org>
AuthorDate: Tue Jun 2 10:01:38 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Tue Jun 2 17:46:32 2020 +0100

    ] m4: use test instead of []
    
    It is reported that [] was removed by autoconf, which caused the
    following error:
    
      ./configure: line 4681: -z: command not found
    
    Switch to test. That's what is used throughout our configure scripts.
    Also put the variable expansion in quotes.
    
    Signed-off-by: Wei Liu <wl@xen.org>
    Reported-by: Bertrand Marquis <Bertrand.Marquis@arm.com>
    Fixes: 8a6b1665d987 ("configure: also add EXTRA_PREFIX to {CPP/LD}FLAGS")
    Signed-off-by: Wei Liu <wl@xen.org>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 m4/set_cflags_ldflags.m4 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/m4/set_cflags_ldflags.m4 b/m4/set_cflags_ldflags.m4
index 08f5c983cc..23706e256b 100644
--- a/m4/set_cflags_ldflags.m4
+++ b/m4/set_cflags_ldflags.m4
@@ -15,7 +15,7 @@ for ldflag in $APPEND_LIB
 do
     APPEND_LDFLAGS="$APPEND_LDFLAGS -L$ldflag"
 done
-if [ ! -z $EXTRA_PREFIX ]; then
+if test ! -z "$EXTRA_PREFIX" ; then
     CPPFLAGS="$CPPFLAGS -I$EXTRA_PREFIX/include"
     LDFLAGS="$LDFLAGS -L$EXTRA_PREFIX/lib"
 fi
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jun 02 18:00:13 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 02 Jun 2020 18: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 1jgBCp-0007R1-Gk; Tue, 02 Jun 2020 18:00:07 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=dZT+=7P=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jgBCn-0007QV-Lj
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 2020 18:00:05 +0000
X-Inumbo-ID: e3468f1a-a4fa-11ea-9947-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id e3468f1a-a4fa-11ea-9947-bc764e2007e4;
 Tue, 02 Jun 2020 18:00:05 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=r/6YqGgiTel4xyHbgKbM6mSB0jDNabC2QZ17O0tvv2w=; b=vMNz8Qhza5WPJxFJRHLeOWwx2k
 ds3W4x871SaQz0PlBATBKS/KzM1AFszdB72fE+XWe7fNOJXX5J1/EaR2aIMCTUCS//qjhysRuq3+j
 X5zh/Pi//gLQFWznUJbN+ucBQj8x530gNwo1AbS1iy9bnPHvJlvBC+4h9OTOOGOA0mgE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jgBCm-0002jj-UC
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 2020 18:00:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jgBCm-0004uh-T5
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 2020 18:00:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] tools: update configure
Message-Id: <E1jgBCm-0004uh-T5@xenbits.xenproject.org>
Date: Tue, 02 Jun 2020 18: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 b1e3a3c874b9bab32cc56820ae3e3d568c120181
Author:     Wei Liu <wl@xen.org>
AuthorDate: Tue Jun 2 17:32:02 2020 +0000
Commit:     Wei Liu <wl@xen.org>
CommitDate: Tue Jun 2 17:55:42 2020 +0000

    tools: update configure
    
    Fixes: e181db8ba4e0 ("m4: use test instead of []")
    Signed-off-by: Wei Liu <wl@xen.org>
---
 tools/configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/configure b/tools/configure
index 35036dc1db..3df1a01ff9 100755
--- a/tools/configure
+++ b/tools/configure
@@ -4688,7 +4688,7 @@ for ldflag in $APPEND_LIB
 do
     APPEND_LDFLAGS="$APPEND_LDFLAGS -L$ldflag"
 done
-if  ! -z $EXTRA_PREFIX ; then
+if test ! -z "$EXTRA_PREFIX" ; then
     CPPFLAGS="$CPPFLAGS -I$EXTRA_PREFIX/include"
     LDFLAGS="$LDFLAGS -L$EXTRA_PREFIX/lib"
 fi
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jun 02 18:22:10 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 02 Jun 2020 18: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 1jgBY7-0000s7-77; Tue, 02 Jun 2020 18: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=dZT+=7P=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jgBY6-0000s2-Cx
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 2020 18:22:06 +0000
X-Inumbo-ID: f629e4da-a4fd-11ea-81bc-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id f629e4da-a4fd-11ea-81bc-bc764e2007e4;
 Tue, 02 Jun 2020 18: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=6Ek16zquUsSYy7RZXcv64I+hY9ctBm6WUbQFseOiMNQ=; b=pqwq5on9IDVkwUKpAb1OtOQcxG
 LsjPmR8IUYY46i0A+h0g/wCsj8kd456Uv4xM/B2BCEHKeg14xOrSQomZ3OHsFPAMbUabWRsn48wCi
 PSmlP5y1cNrjIWDzXItcIH4kltepbaUj9IiKS48va1wM2LeslNP7c8Lk1DDqmQYCWzWo=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jgBY5-0003BM-2N
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 2020 18:22:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jgBY5-0006Lv-16
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 2020 18:22:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/ucode: Fix errors with start/end_update()
Message-Id: <E1jgBY5-0006Lv-16@xenbits.xenproject.org>
Date: Tue, 02 Jun 2020 18: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 3659f54e9bd31f0f59268402fd67fb4b4118e184
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Jun 1 15:37:20 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jun 2 19:18:44 2020 +0100

    x86/ucode: Fix errors with start/end_update()
    
    c/s 9267a439c "x86/ucode: Document the behaviour of the microcode_ops hooks"
    identified several poor behaviours of the start_update()/end_update_percpu()
    hooks.
    
    AMD have subsequently confirmed that OSVW don't, and are not expected to,
    change across a microcode load, rendering all of this complexity unecessary.
    
    Instead of fixing up the logic to not leave the OSVW state reset in a number
    of corner cases, delete the logic entirely.
    
    This in turn allows for the removal of the poorly-named 'start_update'
    parameter to microcode_update_one(), and for svm_host_osvw_{init,reset}() to
    become static.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/arch/x86/acpi/power.c            |  2 +-
 xen/arch/x86/cpu/microcode/amd.c     | 18 ------------------
 xen/arch/x86/cpu/microcode/core.c    | 33 +++------------------------------
 xen/arch/x86/cpu/microcode/private.h | 14 --------------
 xen/arch/x86/hvm/svm/svm.c           |  4 ++--
 xen/arch/x86/smpboot.c               |  2 +-
 xen/include/asm-x86/hvm/svm/svm.h    |  3 ---
 xen/include/asm-x86/microcode.h      |  2 +-
 8 files changed, 8 insertions(+), 70 deletions(-)

diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
index 0cda362045..dfffe08e18 100644
--- a/xen/arch/x86/acpi/power.c
+++ b/xen/arch/x86/acpi/power.c
@@ -287,7 +287,7 @@ static int enter_state(u32 state)
     console_end_sync();
     watchdog_enable();
 
-    microcode_update_one(true);
+    microcode_update_one();
 
     if ( !recheck_cpu_features(0) )
         panic("Missing previously available feature(s)\n");
diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c
index 3f0969e70d..cd532321e8 100644
--- a/xen/arch/x86/cpu/microcode/amd.c
+++ b/xen/arch/x86/cpu/microcode/amd.c
@@ -18,7 +18,6 @@
 #include <xen/init.h>
 #include <xen/mm.h> /* TODO: Fix asm/tlbflush.h breakage */
 
-#include <asm/hvm/svm/svm.h>
 #include <asm/msr.h>
 
 #include "private.h"
@@ -395,26 +394,9 @@ static struct microcode_patch *cpu_request_microcode(const void *buf, size_t siz
     return patch;
 }
 
-#ifdef CONFIG_HVM
-static int start_update(void)
-{
-    /*
-     * svm_host_osvw_init() will be called on each cpu by calling '.end_update'
-     * in common code.
-     */
-    svm_host_osvw_reset();
-
-    return 0;
-}
-#endif
-
 const struct microcode_ops amd_ucode_ops = {
     .cpu_request_microcode            = cpu_request_microcode,
     .collect_cpu_info                 = collect_cpu_info,
     .apply_microcode                  = apply_microcode,
-#ifdef CONFIG_HVM
-    .start_update                     = start_update,
-    .end_update_percpu                = svm_host_osvw_init,
-#endif
     .compare_patch                    = compare_patch,
 };
diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode/core.c
index d879d28787..18ebc07b13 100644
--- a/xen/arch/x86/cpu/microcode/core.c
+++ b/xen/arch/x86/cpu/microcode/core.c
@@ -546,9 +546,6 @@ static int do_microcode_update(void *patch)
     else
         ret = secondary_thread_fn();
 
-    if ( microcode_ops->end_update_percpu )
-        microcode_ops->end_update_percpu();
-
     return ret;
 }
 
@@ -620,16 +617,6 @@ static long microcode_update_helper(void *data)
     }
     spin_unlock(&microcode_mutex);
 
-    if ( microcode_ops->start_update )
-    {
-        ret = microcode_ops->start_update();
-        if ( ret )
-        {
-            microcode_free_patch(patch);
-            goto put;
-        }
-    }
-
     cpumask_clear(&cpu_callin_map);
     atomic_set(&cpu_out, 0);
     atomic_set(&cpu_updated, 0);
@@ -728,28 +715,14 @@ static int __init microcode_init(void)
 __initcall(microcode_init);
 
 /* Load a cached update to current cpu */
-int microcode_update_one(bool start_update)
+int microcode_update_one(void)
 {
-    int err;
-
     if ( !microcode_ops )
         return -EOPNOTSUPP;
 
     microcode_ops->collect_cpu_info();
 
-    if ( start_update && microcode_ops->start_update )
-    {
-        err = microcode_ops->start_update();
-        if ( err )
-            return err;
-    }
-
-    err = microcode_update_cpu(NULL);
-
-    if ( microcode_ops->end_update_percpu )
-        microcode_ops->end_update_percpu();
-
-    return err;
+    return microcode_update_cpu(NULL);
 }
 
 /* BSP calls this function to parse ucode blob and then apply an update. */
@@ -790,7 +763,7 @@ static int __init early_microcode_update_cpu(void)
     spin_unlock(&microcode_mutex);
     ASSERT(rc);
 
-    return microcode_update_one(true);
+    return microcode_update_one();
 }
 
 int __init early_microcode_init(void)
diff --git a/xen/arch/x86/cpu/microcode/private.h b/xen/arch/x86/cpu/microcode/private.h
index dc5c7a81ae..c00ba590d1 100644
--- a/xen/arch/x86/cpu/microcode/private.h
+++ b/xen/arch/x86/cpu/microcode/private.h
@@ -45,20 +45,6 @@ struct microcode_ops {
      */
     int (*apply_microcode)(const struct microcode_patch *patch);
 
-    /*
-     * Optional.  If provided and applicable to the specific update attempt,
-     * is run once by the initiating CPU.  Returning an error will abort the
-     * load attempt.
-     */
-    int (*start_update)(void);
-
-    /*
-     * Optional.  If provided, called on every CPU which completes a microcode
-     * load.  May be called in the case of some errors, and not others.  May
-     * be called even if start_update() wasn't.
-     */
-    void (*end_update_percpu)(void);
-
     /*
      * Given two patches, are they both applicable to the current CPU, and is
      * new a higher revision than old?
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 46a1aac949..44ff9d0c6b 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -1084,7 +1084,7 @@ static void svm_guest_osvw_init(struct domain *d)
     spin_unlock(&osvw_lock);
 }
 
-void svm_host_osvw_reset()
+static void svm_host_osvw_reset(void)
 {
     spin_lock(&osvw_lock);
 
@@ -1094,7 +1094,7 @@ void svm_host_osvw_reset()
     spin_unlock(&osvw_lock);
 }
 
-void svm_host_osvw_init()
+static void svm_host_osvw_init(void)
 {
     spin_lock(&osvw_lock);
 
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index 13b3dade9c..f878a00760 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -369,7 +369,7 @@ void start_secondary(void *unused)
 
     initialize_cpu_data(cpu);
 
-    microcode_update_one(false);
+    microcode_update_one();
 
     /*
      * If MSR_SPEC_CTRL is available, apply Xen's default setting and discard
diff --git a/xen/include/asm-x86/hvm/svm/svm.h b/xen/include/asm-x86/hvm/svm/svm.h
index cd71402cbb..d568e86db9 100644
--- a/xen/include/asm-x86/hvm/svm/svm.h
+++ b/xen/include/asm-x86/hvm/svm/svm.h
@@ -94,9 +94,6 @@ extern u32 svm_feature_flags;
 #define DEFAULT_TSC_RATIO       0x0000000100000000ULL
 #define TSC_RATIO_RSVD_BITS     0xffffff0000000000ULL
 
-extern void svm_host_osvw_reset(void);
-extern void svm_host_osvw_init(void);
-
 /* EXITINFO1 fields on NPT faults */
 #define _NPT_PFEC_with_gla     32
 #define NPT_PFEC_with_gla      (1UL<<_NPT_PFEC_with_gla)
diff --git a/xen/include/asm-x86/microcode.h b/xen/include/asm-x86/microcode.h
index 9da63f992e..3b0234e9fa 100644
--- a/xen/include/asm-x86/microcode.h
+++ b/xen/include/asm-x86/microcode.h
@@ -22,6 +22,6 @@ DECLARE_PER_CPU(struct cpu_signature, cpu_sig);
 void microcode_set_module(unsigned int idx);
 int microcode_update(XEN_GUEST_HANDLE(const_void), unsigned long len);
 int early_microcode_init(void);
-int microcode_update_one(bool start_update);
+int microcode_update_one(void);
 
 #endif /* ASM_X86__MICROCODE_H */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jun 02 18:22:17 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 02 Jun 2020 18: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 1jgBYH-0000tI-8d; Tue, 02 Jun 2020 18: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=dZT+=7P=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jgBYG-0000tB-3q
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 2020 18:22:16 +0000
X-Inumbo-ID: fc2b4090-a4fd-11ea-ac5e-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id fc2b4090-a4fd-11ea-ac5e-12813bfff9fa;
 Tue, 02 Jun 2020 18: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=/8hAdCVsgk80uqYYFLen29Tad6+chUmyGoTxnheuv3U=; b=yziNAQMhEV6ATJ7eXOLb9Li67H
 ZKZ4jrl9wPe138NTDlOkIBJwFpcsSmdbRWhk4k1+uhrDYhmrKfMdIKRKjW3bqG6IuhgOooD+6PBpp
 7X26zdHkbXsnBbT7FUfL+AOJqhgtIhVfXjVPhuaJ0bIVfbMWu6C7mfwmTxEJcaoq6bNA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jgBYF-0003BS-5s
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 2020 18:22:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jgBYF-0006MT-4a
 for xen-changelog@lists.xenproject.org; Tue, 02 Jun 2020 18:22:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] docs/ucode: Extend runtime microcode loading
 documentation
Message-Id: <E1jgBYF-0006MT-4a@xenbits.xenproject.org>
Date: Tue, 02 Jun 2020 18: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 99a76a88d5e7f4693bb6b286e366006e1da1c954
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Jun 1 14:36:28 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jun 2 19:18:44 2020 +0100

    docs/ucode: Extend runtime microcode loading documentation
    
    Extend the disclaimer about runtime loading.  While we've done our best to
    make the mechaism reliable, the safety of late loading does ultimately depend
    on the contents of the blobs.
    
    Extend the xen-ucode portion with examples of how to use it.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
    ---
    CC: George Dunlap <George.Dunlap@eu.citrix.com>
    CC: Ian Jackson <ian.jackson@citrix.com>
    CC: Jan Beulich <JBeulich@suse.com>
    CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
    CC: Stefano Stabellini <sstabellini@kernel.org>
    CC: Wei Liu <wl@xen.org>
    CC: Julien Grall <julien@xen.org>
    CC: Paul Durrant <paul@xen.org>
---
 docs/admin-guide/microcode-loading.rst | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/docs/admin-guide/microcode-loading.rst b/docs/admin-guide/microcode-loading.rst
index e83cadd2c2..a07e25802f 100644
--- a/docs/admin-guide/microcode-loading.rst
+++ b/docs/admin-guide/microcode-loading.rst
@@ -105,8 +105,8 @@ modules to find any CPIO archives, and search the archive for the applicable
 file.  Xen will stop searching at the first match.
 
 
-Run time microcode loading
---------------------------
+Runtime microcode loading
+-------------------------
 
 .. warning::
 
@@ -114,7 +114,25 @@ Run time microcode loading
    or at boot time.  Not all microcode updates (or parts thereof) can be
    applied at runtime.
 
-The ``xen-ucode`` utility can be used to initiate a runtime microcode load.
+   Given the proprietary nature of microcode, we are unable to make any claim
+   that runtime microcode loading is risk-free.  Any runtime microcode loading
+   needs adequate testing on a development instance before being rolled out to
+   production systems.
+
+The ``xen-ucode`` utility can be used to initiate a runtime microcode load::
+
+  [root@host ~]# xen-ucode
+  xen-ucode: Xen microcode updating tool
+  Usage: xen-ucode <microcode blob>
+  [root@host ~]#
+
+The details of microcode blobs (if even packaged to begin with) are specific
+to the dom0 distribution.  Consult your dom0 OS documentation for details.
+One example with a Linux dom0 on a Haswell system might look like::
+
+  [root@host ~]# xen-ucode /lib/firmware/intel-ucode/06-3c-03
+  [root@host ~]#
+
 It will pass the blob to Xen, which will check to see whether the blob is
 correct for the processor, and newer than the running microcode.
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jun 03 11:33:12 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Jun 2020 11:33:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jgRds-00013G-7o; Wed, 03 Jun 2020 11:33: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=cdqV=7Q=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jgRdq-00012z-N2
 for xen-changelog@lists.xenproject.org; Wed, 03 Jun 2020 11:33:06 +0000
X-Inumbo-ID: fd8917ec-a58d-11ea-ace8-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id fd8917ec-a58d-11ea-ace8-12813bfff9fa;
 Wed, 03 Jun 2020 11: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=S2bZkZbSG7I3hXa1PMO7tj6VchpEyCTO40yDlA0z/sA=; b=AFAwPooGtaTTFnEofArWQ13zHx
 5sCaqlKl+JoF7ZHh5DvXB7dzQtvJgw9LVOiJyGJjV5Xi8N/InwcPICtnZNK5SAwPnMjio+3nwbGOY
 VgPLIFIU6rSxpbrraApTgY+mXKNAG5HCXXecDsG3ojYGAz/jZ/HPATtL7k2hGDRUrWoU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jgRdo-0002l6-VX
 for xen-changelog@lists.xenproject.org; Wed, 03 Jun 2020 11:33:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jgRdo-0000Dx-U8
 for xen-changelog@lists.xenproject.org; Wed, 03 Jun 2020 11:33:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] fix build with CONFIG_HYPFS_CONFIG enabled
Message-Id: <E1jgRdo-0000Dx-U8@xenbits.xenproject.org>
Date: Wed, 03 Jun 2020 11: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 1c5db7cc7a7080056d2876cd00344eb8b94bb7d2
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Jun 3 13:28:07 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 3 13:28:07 2020 +0200

    fix build with CONFIG_HYPFS_CONFIG enabled
    
    Commit 58263ed7713e ("xen: add /buildinfo/config entry to hypervisor
    filesystem") added a dependency to .config, but the hypervisor's build
    config could be have another name via setting KCONFIG_CONFIG.
    
    Fix that by using $(KCONFIG_CONFIG) instead. Additionally reference
    the config file via $(XEN_ROOT) instead of a relative path.
    
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/common/Makefile b/xen/common/Makefile
index 91581e1815..06881d023c 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -75,7 +75,8 @@ obj-$(CONFIG_UBSAN) += ubsan/
 obj-$(CONFIG_NEEDS_LIBELF) += libelf/
 obj-$(CONFIG_HAS_DEVICE_TREE) += libfdt/
 
-config.gz: ../.config
+CONF_FILE := $(if $(patsubst /%,,$(KCONFIG_CONFIG)),$(XEN_ROOT)/xen/)$(KCONFIG_CONFIG)
+config.gz: $(CONF_FILE)
 	gzip -c $< >$@
 
 config_data.o: config.gz
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jun 03 11:33:17 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Jun 2020 11: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 1jgRe1-00014I-9K; Wed, 03 Jun 2020 11: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=cdqV=7Q=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jgRdz-000146-Kb
 for xen-changelog@lists.xenproject.org; Wed, 03 Jun 2020 11:33:15 +0000
X-Inumbo-ID: 03879e7a-a58e-11ea-9dbe-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 03879e7a-a58e-11ea-9dbe-bc764e2007e4;
 Wed, 03 Jun 2020 11: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=0EFZMyiO3GP6b8TkIHQ2t0SPVTHG5Mc9233i1xQZUnc=; b=gDY97liNG5w/JeHoHd74CF2rSu
 ptStPooAxxJpjYA4ERht6BVYUVQxKUbgiuLCjSNjU6nn70xKlhy9mjgFpkwxj6pxt5XkeIJfudGVu
 BbFlxM9uDVOWv6KrJtXc93n4qomYqxP2r7VpFX0iMwRL1MWJLpCvDdozuKuU+ImA1dVA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jgRdz-0002le-2l
 for xen-changelog@lists.xenproject.org; Wed, 03 Jun 2020 11:33:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jgRdz-0000Ep-1e
 for xen-changelog@lists.xenproject.org; Wed, 03 Jun 2020 11:33:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] config: disable hypervisor filesystem for pv-shim
Message-Id: <E1jgRdz-0000Ep-1e@xenbits.xenproject.org>
Date: Wed, 03 Jun 2020 11: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 d9f58cd54fe2f05e1f05e2fe254684bd1840de8e
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Jun 3 13:28:52 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 3 13:28:52 2020 +0200

    config: disable hypervisor filesystem for pv-shim
    
    The pv-shim doesn't need the hypervisor filesystem, so disable it.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/configs/pvshim_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/configs/pvshim_defconfig b/xen/arch/x86/configs/pvshim_defconfig
index 9710aa6238..830660e022 100644
--- a/xen/arch/x86/configs/pvshim_defconfig
+++ b/xen/arch/x86/configs/pvshim_defconfig
@@ -6,6 +6,7 @@ CONFIG_PV_SHIM=y
 CONFIG_PV_SHIM_EXCLUSIVE=y
 CONFIG_NR_CPUS=32
 # Disable features not used by the PV shim
+# CONFIG_HYPFS is not set
 # CONFIG_SHADOW_PAGING is not set
 # CONFIG_BIGMEM is not set
 # CONFIG_HVM_FEP is not set
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jun 04 18:55:23 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Jun 2020 18:55:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jgv19-000185-NN; Thu, 04 Jun 2020 18: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=Fopn=7R=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jgv18-00017y-Dz
 for xen-changelog@lists.xenproject.org; Thu, 04 Jun 2020 18:55:06 +0000
X-Inumbo-ID: e6ff7bbc-a694-11ea-af00-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id e6ff7bbc-a694-11ea-af00-12813bfff9fa;
 Thu, 04 Jun 2020 18: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=uDpGpPgYFa03bxWh4lMpB72XQ46CTpfYmw/MgOkqPZs=; b=qeht38irXi7K+kRzVkPP3Jhl4M
 HuaNN7ddC3Kp2grXWcuyUXwU5usP4Tlbu2romhA4A3uIkmF8C5uJ8yM9ttb/lVKHcKYTHR1yWTPKs
 Bv8dsex/GYYvZVTZr7a6weh8v2X4w2szFh/E63LWZdysU56zpRwrUQsWabA9LkvvIA7Q=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jgv16-0004Qa-QB
 for xen-changelog@lists.xenproject.org; Thu, 04 Jun 2020 18:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jgv16-00034q-P0
 for xen-changelog@lists.xenproject.org; Thu, 04 Jun 2020 18:55:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/shim: Fix defconfig selection and trim the build
 further
Message-Id: <E1jgv16-00034q-P0@xenbits.xenproject.org>
Date: Thu, 04 Jun 2020 18: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 780aba2779b834f19b2a6f0dcdea0e7e0b5e1622
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 3 16:56:03 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jun 4 19:52:36 2020 +0100

    x86/shim: Fix defconfig selection and trim the build further
    
    Several options (TBOOT, XENOPROF, Scheduler) depend on EXPERT to be able to
    deselect/configure.
    
    Enabling EXPERT now causes the request of the Credit1 scheduler to be honoured
    (rather than giving us Credit2), but take this opportunity to switch to Null,
    as the previously problematic issues are now believed to be fixed.
    
    Enabling EXPERT also allows XEN_SHSTK to be selected, and we don't want this
    being built for shim.  We also don't want TRACEBUFFER or GDBSX either.
    
    Take this oppotunity to swap the disable of HVM_FEP for a general disable of
    HVM (likely to have wider impliciations in the future), and disable ARGO (will
    necesserily need plumbing work to function in shim).
    
    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/configs/pvshim_defconfig | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/configs/pvshim_defconfig b/xen/arch/x86/configs/pvshim_defconfig
index 830660e022..3af48d6c06 100644
--- a/xen/arch/x86/configs/pvshim_defconfig
+++ b/xen/arch/x86/configs/pvshim_defconfig
@@ -5,19 +5,25 @@ CONFIG_PVH_GUEST=y
 CONFIG_PV_SHIM=y
 CONFIG_PV_SHIM_EXCLUSIVE=y
 CONFIG_NR_CPUS=32
+CONFIG_EXPERT=y
+CONFIG_SCHED_NULL=y
 # Disable features not used by the PV shim
+# CONFIG_HVM is not set
+# CONFIG_XEN_SHSTK is not set
 # CONFIG_HYPFS is not set
 # CONFIG_SHADOW_PAGING is not set
 # CONFIG_BIGMEM is not set
-# CONFIG_HVM_FEP is not set
 # CONFIG_TBOOT is not set
 # CONFIG_KEXEC is not set
 # CONFIG_XENOPROF is not set
 # CONFIG_XSM is not set
+# CONFIG_ARGO is not set
+# CONFIG_SCHED_CREDIT is not set
 # CONFIG_SCHED_CREDIT2 is not set
 # CONFIG_SCHED_RTDS is not set
 # CONFIG_SCHED_ARINC653 is not set
-# CONFIG_SCHED_NULL is not set
 # CONFIG_LIVEPATCH is not set
 # CONFIG_SUPPRESS_DUPLICATE_SYMBOL_WARNINGS is not set
+# CONFIG_TRACEBUFFER is not set
 # CONFIG_DEBUG is not set
+# CONFIG_GDBSX is not set
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jun 05 14:55:10 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Jun 2020 14: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 1jhDkQ-0004C6-6d; Fri, 05 Jun 2020 14: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=PBLw=7S=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhDkO-0004Bx-QS
 for xen-changelog@lists.xenproject.org; Fri, 05 Jun 2020 14:55:04 +0000
X-Inumbo-ID: 89ebcb26-a73c-11ea-9b55-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 89ebcb26-a73c-11ea-9b55-bc764e2007e4;
 Fri, 05 Jun 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=Ghu5jRxY1qHyoIvDi4Nxx+PlJEGqpESE8reMNm+5F8Y=; b=qjA9LscK7ak+TIAinZCc+sBgwL
 B8ZrJ7BiipLCpwsuBRy0yyqA2w6GwrTYbf2ghndKcmmkm2XrgTLlTyq1wJ0xCQ63jWtFRnrAByn7+
 FOs1wvlHrYw5FJm37JF0myEBx9pflxidiEUc0jVgiXnZZ++DhvI0t1JCqbtymoZDkzus=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhDkO-0007iE-3t
 for xen-changelog@lists.xenproject.org; Fri, 05 Jun 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 1jhDkO-0001nU-2w
 for xen-changelog@lists.xenproject.org; Fri, 05 Jun 2020 14:55:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] libs/hypfs: use correct zlib name in pc file
Message-Id: <E1jhDkO-0001nU-2w@xenbits.xenproject.org>
Date: Fri, 05 Jun 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 81da3f2b4fa9ccbbdcd135275ee62f0817bcab26
Author:     Wei Liu <wl@xen.org>
AuthorDate: Fri Jun 5 12:37:25 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Fri Jun 5 15:52:47 2020 +0100

    libs/hypfs: use correct zlib name in pc file
    
    Its name is "zlib" not "z".
    
    Reported-by: Olaf Hering <olaf@aepfle.de>
    Fixes: 86234eafb952 ("libs: add libxenhypfs")
    Signed-off-by: Wei Liu <wl@xen.org>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/libs/hypfs/xenhypfs.pc.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libs/hypfs/xenhypfs.pc.in b/tools/libs/hypfs/xenhypfs.pc.in
index 92a262c7a2..ef9fcc87bf 100644
--- a/tools/libs/hypfs/xenhypfs.pc.in
+++ b/tools/libs/hypfs/xenhypfs.pc.in
@@ -7,4 +7,4 @@ Description: The Xenhypfs library for Xen hypervisor
 Version: @@version@@
 Cflags: -I${includedir} @@cflagslocal@@
 Libs: @@libsflag@@${libdir} -lxenhypfs
-Requires.private: xentoolcore,xentoollog,xencall,z
+Requires.private: xentoolcore,xentoollog,xencall,zlib
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jun 05 15:22:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Jun 2020 15: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 1jhEAa-0007Nj-2T; Fri, 05 Jun 2020 15: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=PBLw=7S=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhEAY-0007Nb-KK
 for xen-changelog@lists.xenproject.org; Fri, 05 Jun 2020 15:22:06 +0000
X-Inumbo-ID: 4fd27530-a740-11ea-afdb-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 4fd27530-a740-11ea-afdb-12813bfff9fa;
 Fri, 05 Jun 2020 15: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=uucJotd50mtGi3xNt38JifF6qMrppAT0DFtQAZEc5So=; b=w8K9Ff49RoA0QE2vIxKkHrvFkv
 eKvYiTupL1kViinsr+N9bb67D9l9tk+9l5JBkKdSqbuzruOvwSnSiHbylpKtGvnhvCkdBpgaOC0kY
 SUrNVuMBeMcfa0T3VIGzsL5X1ww6DEWlreUHplXBJyWe+SH0NaoXWn6WiFSZOCqZ10SY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhEAW-0008JT-LC
 for xen-changelog@lists.xenproject.org; Fri, 05 Jun 2020 15:22:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhEAW-00047r-K2
 for xen-changelog@lists.xenproject.org; Fri, 05 Jun 2020 15:22:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/svm: do not try to handle recalc NPT faults
 immediately
Message-Id: <E1jhEAW-00047r-K2@xenbits.xenproject.org>
Date: Fri, 05 Jun 2020 15: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 51ca66c37371b10b378513af126646de22eddb17
Author:     Igor Druzhinin <igor.druzhinin@citrix.com>
AuthorDate: Fri Jun 5 17:12:11 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jun 5 17:12:11 2020 +0200

    x86/svm: do not try to handle recalc NPT faults immediately
    
    A recalculation NPT fault doesn't always require additional handling
    in hvm_hap_nested_page_fault(), moreover in general case if there is no
    explicit handling done there - the fault is wrongly considered fatal.
    
    This covers a specific case of migration with vGPU assigned which
    uses direct MMIO mappings made by XEN_DOMCTL_memory_mapping hypercall:
    at a moment log-dirty is enabled globally, recalculation is requested
    for the whole guest memory including those mapped MMIO regions
    which causes a page fault being raised at the first access to them;
    but due to MMIO P2M type not having any explicit handling in
    hvm_hap_nested_page_fault() a domain is erroneously crashed with unhandled
    SVM violation.
    
    Instead of trying to be opportunistic - use safer approach and handle
    P2M recalculation in a separate NPT fault by attempting to retry after
    making the necessary adjustments. This is aligned with Intel behavior
    where there are separate VMEXITs for recalculation and EPT violations
    (faults) and only faults are handled in hvm_hap_nested_page_fault().
    Do it by also unifying do_recalc return code with Intel implementation
    where returning 1 means P2M was actually changed.
    
    Since there was no case previously where p2m_pt_handle_deferred_changes()
    could return a positive value - it's safe to replace ">= 0" with just "== 0"
    in VMEXIT_NPF handler. finish_type_change() is also not affected by the
    change as being able to deal with >0 return value of p2m->recalc from
    EPT implementation.
    
    Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/arch/x86/hvm/svm/svm.c | 5 +++--
 xen/arch/x86/mm/p2m-pt.c   | 7 ++++++-
 xen/arch/x86/mm/p2m.c      | 2 +-
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 44ff9d0c6b..4eb41792e2 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -2923,9 +2923,10 @@ void svm_vmexit_handler(struct cpu_user_regs *regs)
             v->arch.hvm.svm.cached_insn_len = vmcb->guest_ins_len & 0xf;
         rc = vmcb->exitinfo1 & PFEC_page_present
              ? p2m_pt_handle_deferred_changes(vmcb->exitinfo2) : 0;
-        if ( rc >= 0 )
+        if ( rc == 0 )
+            /* If no recal adjustments were being made - handle this fault */
             svm_do_nested_pgfault(v, regs, vmcb->exitinfo1, vmcb->exitinfo2);
-        else
+        else if ( rc < 0 )
         {
             printk(XENLOG_G_ERR
                    "%pv: Error %d handling NPF (gpa=%08lx ec=%04lx)\n",
diff --git a/xen/arch/x86/mm/p2m-pt.c b/xen/arch/x86/mm/p2m-pt.c
index 5c0501794e..badb26bc34 100644
--- a/xen/arch/x86/mm/p2m-pt.c
+++ b/xen/arch/x86/mm/p2m-pt.c
@@ -341,6 +341,7 @@ static int do_recalc(struct p2m_domain *p2m, unsigned long gfn)
     unsigned int level = 4;
     l1_pgentry_t *pent;
     int err = 0;
+    bool recalc_done = false;
 
     table = map_domain_page(pagetable_get_mfn(p2m_get_pagetable(p2m)));
     while ( --level )
@@ -402,6 +403,8 @@ static int do_recalc(struct p2m_domain *p2m, unsigned long gfn)
                 clear_recalc(l1, e);
                 err = p2m->write_p2m_entry(p2m, gfn, pent, e, level + 1);
                 ASSERT(!err);
+
+                recalc_done = true;
             }
         }
         unmap_domain_page((void *)((unsigned long)pent & PAGE_MASK));
@@ -448,12 +451,14 @@ static int do_recalc(struct p2m_domain *p2m, unsigned long gfn)
             clear_recalc(l1, e);
         err = p2m->write_p2m_entry(p2m, gfn, pent, e, level + 1);
         ASSERT(!err);
+
+        recalc_done = true;
     }
 
  out:
     unmap_domain_page(table);
 
-    return err;
+    return err ?: recalc_done;
 }
 
 int p2m_pt_handle_deferred_changes(uint64_t gpa)
diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 17f320b624..db7bde0230 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -1197,7 +1197,7 @@ static int finish_type_change(struct p2m_domain *p2m,
         rc = p2m->recalc(p2m, gfn);
         /*
          * ept->recalc could return 0/1/-ENOMEM. pt->recalc could return
-         * 0/-ENOMEM/-ENOENT, -ENOENT isn't an error as we are looping
+         * 0/1/-ENOMEM/-ENOENT, -ENOENT isn't an error as we are looping
          * gfn here. If rc is 1 we need to have it 0 for success.
          */
         if ( rc == -ENOENT || rc > 0 )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sat Jun 06 23:55:15 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Jun 2020 23: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 1jhiea-0005ZH-8a; Sat, 06 Jun 2020 23:55: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=x7q/=7T=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhieY-0005ZA-Lj
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:55:06 +0000
X-Inumbo-ID: 23e20d34-a851-11ea-b15a-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 23e20d34-a851-11ea-b15a-12813bfff9fa;
 Sat, 06 Jun 2020 23: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=NHz9G6Th1Qz1SjziA1w7BjZvMdC86Eaxj1MigUS5eIM=; b=et9lYu5xFo8Zvh4tfSItu5w6D7
 obJ6m6mN1Wfld9GAdjC/6iG92AGoBLiu9WfKY0FGQjYiNdlDsoDnQI835eqXOAihXpqaJYe5Pi83e
 zRYPepQ8b9xQd9Yilr3VzL4R8zQBL79hIT0n3oYLugUKjs2LPteF0CvjsQkyXWDCA9Bk=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhieV-0002QH-Bw
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:55:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhieV-0006Zh-Ay
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:55:03 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] xen: add a generic way to include binary files as
 variables
Message-Id: <E1jhieV-0006Zh-Ay@xenbits.xenproject.org>
Date: Sat, 06 Jun 2020 23:55: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 c48a9956e334a5dd99e846d04ad56185b07aab64
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri May 29 10:15:08 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri May 29 10:15:08 2020 +0200

    xen: add a generic way to include binary files as variables
    
    Add a new script xen/tools/binfile for including a binary file at build
    time being usable via a pointer and a size variable in the hypervisor.
    
    Make use of that generic tool in xsm.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Wei Liu <wl@xen.org>
---
 .gitignore                   |  1 +
 xen/tools/binfile            | 43 +++++++++++++++++++++++++++++++++++++++++++
 xen/xsm/flask/Makefile       |  5 ++++-
 xen/xsm/flask/flask-policy.S | 16 ----------------
 4 files changed, 48 insertions(+), 17 deletions(-)

diff --git a/.gitignore b/.gitignore
index 7418ce9829..15a089b887 100644
--- a/.gitignore
+++ b/.gitignore
@@ -314,6 +314,7 @@ xen/test/livepatch/*.livepatch
 xen/tools/kconfig/.tmp_gtkcheck
 xen/tools/kconfig/.tmp_qtcheck
 xen/tools/symbols
+xen/xsm/flask/flask-policy.S
 xen/xsm/flask/include/av_perm_to_string.h
 xen/xsm/flask/include/av_permissions.h
 xen/xsm/flask/include/class_to_string.h
diff --git a/xen/tools/binfile b/xen/tools/binfile
new file mode 100755
index 0000000000..df0301183f
--- /dev/null
+++ b/xen/tools/binfile
@@ -0,0 +1,43 @@
+#!/bin/sh
+# usage: binfile [-i] [-a <align>] <target-src.S> <binary-file> <varname>
+# -a <align>  align data at 2^<align> boundary (default: byte alignment)
+# -i          add to .init.rodata (default: .rodata) section
+
+section=""
+align=0
+
+OPTIND=1
+while getopts "ia:" opt; do
+    case "$opt" in
+    i)
+        section=".init"
+        ;;
+    a)
+        align=$OPTARG
+        ;;
+    esac
+done
+let "SHIFT=$OPTIND-1"
+shift $SHIFT
+
+target=$1
+binsource=$2
+varname=$3
+
+cat <<EOF >$target
+#include <asm/asm_defns.h>
+
+        .section $section.rodata, "a", %progbits
+
+        .p2align $align
+        .global $varname
+$varname:
+        .incbin "$binsource"
+.Lend:
+
+        .type $varname, %object
+        .size $varname, .Lend - $varname
+
+        .global ${varname}_size
+        ASM_INT(${varname}_size, .Lend - $varname)
+EOF
diff --git a/xen/xsm/flask/Makefile b/xen/xsm/flask/Makefile
index eebfceecc5..07f36d075d 100644
--- a/xen/xsm/flask/Makefile
+++ b/xen/xsm/flask/Makefile
@@ -39,6 +39,9 @@ $(subst include/,%/,$(AV_H_FILES)): $(AV_H_DEPEND) $(mkaccess) FORCE
 obj-bin-$(CONFIG_XSM_FLASK_POLICY) += flask-policy.o
 flask-policy.o: policy.bin
 
+flask-policy.S: $(XEN_ROOT)/xen/tools/binfile
+	$(SHELL) $(XEN_ROOT)/xen/tools/binfile -i $@ policy.bin xsm_flask_init_policy
+
 FLASK_BUILD_DIR := $(CURDIR)
 POLICY_SRC := $(FLASK_BUILD_DIR)/xenpolicy-$(XEN_FULLVERSION)
 
@@ -48,4 +51,4 @@ policy.bin: FORCE
 
 .PHONY: clean
 clean::
-	rm -f $(ALL_H_FILES) *.o $(DEPS_RM) policy.* $(POLICY_SRC)
+	rm -f $(ALL_H_FILES) *.o $(DEPS_RM) policy.* $(POLICY_SRC) flask-policy.S
diff --git a/xen/xsm/flask/flask-policy.S b/xen/xsm/flask/flask-policy.S
deleted file mode 100644
index d38aa39964..0000000000
--- a/xen/xsm/flask/flask-policy.S
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <asm/asm_defns.h>
-
-        .section .init.rodata, "a", %progbits
-
-/* const unsigned char xsm_flask_init_policy[] __initconst */
-        .global xsm_flask_init_policy
-xsm_flask_init_policy:
-        .incbin "policy.bin"
-.Lend:
-
-        .type xsm_flask_init_policy, %object
-        .size xsm_flask_init_policy, . - xsm_flask_init_policy
-
-/* const unsigned int __initconst xsm_flask_init_policy_size */
-        .global xsm_flask_init_policy_size
-        ASM_INT(xsm_flask_init_policy_size, .Lend - xsm_flask_init_policy)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jun 06 23:55:15 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Jun 2020 23: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 1jhieh-0005ZS-AF; Sat, 06 Jun 2020 23: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=x7q/=7T=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhieg-0005ZN-Eu
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:55:14 +0000
X-Inumbo-ID: 29d50138-a851-11ea-b15a-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 29d50138-a851-11ea-b15a-12813bfff9fa;
 Sat, 06 Jun 2020 23:55: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=bIX05xIPO8VgC6WziN4mJA2NncCV9kqcV2liiMP8OpI=; b=TzGm3YIjYvy/xx8cfy1MsQzME5
 vy2khUZtwFpejPihREZmW61ryWq0XNy5lz460Ojo2j7pwBLZGblieRtYlfn66CN/hZFUEhnB34UT8
 5l7b7Dvt83rKRqNI68iCBmnQhOCaaT1orlEywLt/0mh10I6y10ie5ETkWCscbmwIORf0=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhief-0002QK-FC
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:55:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhief-0006aL-EC
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:55:13 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] docs: add feature document for Xen hypervisor sysfs-like
 support
Message-Id: <E1jhief-0006aL-EC@xenbits.xenproject.org>
Date: Sat, 06 Jun 2020 23:55: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 0e9dcd0159c671608e154da5b8b7e0edd2905067
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri May 29 10:15:35 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri May 29 10:15:35 2020 +0200

    docs: add feature document for Xen hypervisor sysfs-like support
    
    On the 2019 Xen developer summit there was agreement that the Xen
    hypervisor should gain support for a hierarchical name-value store
    similar to the Linux kernel's sysfs.
    
    In the beginning there should only be basic support: entries can be
    added from the hypervisor itself only, there is a simple hypercall
    interface to read the data.
    
    Add a feature document for setting the base of a discussion regarding
    the desired functionality and the entries to add.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 docs/features/hypervisorfs.pandoc |  92 ++++++++++++++++++++++++++++++++
 docs/misc/hypfs-paths.pandoc      | 107 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 199 insertions(+)

diff --git a/docs/features/hypervisorfs.pandoc b/docs/features/hypervisorfs.pandoc
new file mode 100644
index 0000000000..a0a0ead057
--- /dev/null
+++ b/docs/features/hypervisorfs.pandoc
@@ -0,0 +1,92 @@
+% Hypervisor FS
+% Revision 1
+
+\clearpage
+
+# Basics
+---------------- ---------------------
+         Status: **Supported**
+
+  Architectures: all
+
+     Components: Hypervisor, toolstack
+---------------- ---------------------
+
+# Overview
+
+The Hypervisor FS is a hierarchical name-value store for reporting
+information to guests, especially dom0. It is similar to the Linux
+kernel's sysfs. Entries and directories are created by the hypervisor,
+while the toolstack is able to use a hypercall to query the entry
+values or (if allowed by the hypervisor) to modify them.
+
+# User details
+
+With:
+
+    xenhypfs ls <path>
+
+the user can list the entries of a specific path of the FS. Using:
+
+    xenhypfs cat <path>
+
+the content of an entry can be retrieved. Using:
+
+    xenhypfs write <path> <string>
+
+a writable entry can be modified. With:
+
+    xenhypfs tree
+
+the complete Hypervisor FS entry tree can be printed.
+
+The FS paths are documented in `docs/misc/hypfs-paths.pandoc`.
+
+# Technical details
+
+Access to the hypervisor filesystem is done via the stable new hypercall
+__HYPERVISOR_filesystem_op. This hypercall supports a sub-command
+XEN_HYPFS_OP_get_version which will return the highest version of the
+interface supported by the hypervisor. Additions to the interface need
+to bump the interface version. The hypervisor is required to support the
+previous interface versions, too (this implies that additions will always
+require new sub-commands in order to allow the hypervisor to decide which
+version of the interface to use).
+
+* hypercall interface specification
+    * `xen/include/public/hypfs.h`
+* hypervisor internal files
+    * `xen/include/xen/hypfs.h`
+    * `xen/common/hypfs.c`
+* `libxenhypfs`
+    * `tools/libs/libxenhypfs/*`
+* `xenhypfs`
+    * `tools/misc/xenhypfs.c`
+* path documentation
+    * `docs/misc/hypfs-paths.pandoc`
+
+# Testing
+
+Any new parameters or hardware mitigations should be verified to show up
+correctly in the filesystem.
+
+# Areas for improvement
+
+* More detailed access rights
+* Entries per domain and/or per cpupool
+
+# Known issues
+
+* None
+
+# References
+
+* None
+
+# History
+
+------------------------------------------------------------------------
+Date       Revision Version  Notes
+---------- -------- -------- -------------------------------------------
+2020-01-23 1        Xen 4.14 Document written
+---------- -------- -------- -------------------------------------------
diff --git a/docs/misc/hypfs-paths.pandoc b/docs/misc/hypfs-paths.pandoc
new file mode 100644
index 0000000000..39539fa1b5
--- /dev/null
+++ b/docs/misc/hypfs-paths.pandoc
@@ -0,0 +1,107 @@
+# Xenhypfs Paths
+
+This document attempts to define all the paths which are available
+in the Xen hypervisor file system (hypfs).
+
+The hypervisor file system can be accessed via the xenhypfs tool.
+
+## Notation
+
+The hypervisor file system is similar to the Linux kernel's sysfs.
+In this document directories are always specified with a trailing "/".
+
+The following notation conventions apply:
+
+        DIRECTORY/
+
+        PATH = VALUES [TAGS]
+
+The first syntax defines a directory. It normally contains related
+entries and the general scope of the directory is described.
+
+The second syntax defines a file entry containing values which are
+either set by the hypervisor or, if the file is writable, can be set
+by the user.
+
+PATH can contain simple regex constructs following the Perl compatible
+regexp syntax described in pcre(3) or perlre(1).
+
+A hypervisor file system entry name can be any 0-delimited byte string
+not containing any '/' character. The names "." and ".." are reserved
+for file system internal use.
+
+VALUES are strings and can take the following forms (note that this represents
+only the syntax used in this document):
+
+* STRING -- an arbitrary 0-delimited byte string.
+* INTEGER -- An integer, in decimal representation unless otherwise
+  noted.
+* "a literal string" -- literal strings are contained within quotes.
+* (VALUE | VALUE | ... ) -- a set of alternatives. Alternatives are
+  separated by a "|" and all the alternatives are enclosed in "(" and
+  ")".
+* {VALUE, VALUE, ... } -- a list of possible values separated by "," and
+  enclosed in "{" and "}".
+
+Additional TAGS may follow as a comma separated set of the following
+tags enclosed in square brackets.
+
+* w -- Path is writable by the user. This capability is usually
+  limited to the control domain (e.g. dom0).
+* ARM | ARM32 | ARM64 | X86: the path is available for the respective
+  architecture only.
+* PV --  Path is valid for PV capable hypervisors only.
+* HVM -- Path is valid for HVM capable hypervisors only.
+* CONFIG_* -- Path is valid only in case the hypervisor was built with
+  the respective config option.
+
+So an entry could look like this:
+
+    /cpu-bugs/active-pv/xpti = ("No"|{"dom0", "domU", "PCID-on"}) [w,X86,PV]
+
+Possible values would be "No" or a list of "dom0", "domU", and "PCID-on" with
+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.
+
+## Example
+
+A populated Xen hypervisor file system might look like the following example:
+
+    /
+        buildinfo/           directory containing build-time data
+            config           contents of .config file used to build Xen
+        cpu-bugs/            x86: directory of cpu bug information
+            l1tf             "Vulnerable" or "Not vulnerable"
+            mds              "Vulnerable" or "Not vulnerable"
+            meltdown         "Vulnerable" or "Not vulnerable"
+            spec-store-bypass "Vulnerable" or "Not vulnerable"
+            spectre-v1       "Vulnerable" or "Not vulnerable"
+            spectre-v2       "Vulnerable" or "Not vulnerable"
+            mitigations/     directory of mitigation settings
+                bti-thunk    "N/A", "RETPOLINE", "LFENCE" or "JMP"
+                spec-ctrl    "No", "IBRS+" or "IBRS-"
+                ibpb         "No" or "Yes"
+                l1d-flush    "No" or "Yes"
+                md-clear     "No" or "VERW"
+                l1tf-barrier "No" or "Yes"
+            active-hvm/      directory for mitigations active in hvm doamins
+                msr-spec-ctrl "No" or "Yes"
+                rsb          "No" or "Yes"
+                eager-fpu    "No" or "Yes"
+                md-clear     "No" or "Yes"
+            active-pv/       directory for mitigations active in pv doamins
+                msr-spec-ctrl "No" or "Yes"
+                rsb          "No" or "Yes"
+                eager-fpu    "No" or "Yes"
+                md-clear     "No" or "Yes"
+                xpti         "No" or list of "dom0", "domU", "PCID-on"
+                l1tf-shadow  "No" or list of "dom0", "domU"
+        params/              directory with hypervisor parameter values
+                             (boot/runtime parameters)
+
+## General Paths
+
+#### /
+
+The root of the hypervisor file system.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jun 06 23:55:26 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Jun 2020 23: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 1jhies-0005au-Cd; Sat, 06 Jun 2020 23: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=x7q/=7T=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhier-0005aa-DG
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:55:25 +0000
X-Inumbo-ID: 2fddf134-a851-11ea-b15a-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 2fddf134-a851-11ea-b15a-12813bfff9fa;
 Sat, 06 Jun 2020 23:55: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=8r+jgDZgCEj3I+S61v38jG8ezQA/DbEBzQZmDRRH7WI=; b=4gGyHgnF8gDQ8y/9CARYo0177n
 50ydjegqBVkmRw05CjUvHWeoElvOEeLXiNlCqnEFLRc2j/xtKTERm+ynBI4XbJTaiPKSSNQiTJigc
 9V3bH7GM5fBf5wHZBhIUjlQUMU5J1UMvZSND5w0BVqondJll+vhbP0I42lMw5Elu41zs=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhiep-0002Qa-JO
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:55:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhiep-0006ar-IN
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:55:23 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] xen: add basic hypervisor filesystem support
Message-Id: <E1jhiep-0006ar-IN@xenbits.xenproject.org>
Date: Sat, 06 Jun 2020 23:55: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 5b5ccafb0c425b85a60fd4f241d5f6951d0e4928
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri May 29 10:15:50 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri May 29 10:15:50 2020 +0200

    xen: add basic hypervisor filesystem support
    
    Add the infrastructure for the hypervisor filesystem.
    
    This includes the hypercall interface and the base functions for
    entry creation, deletion and modification.
    
    In order not to have to repeat the same pattern multiple times in case
    adding a new node should BUG_ON() failure, the helpers for adding a
    node (hypfs_add_dir() and hypfs_add_leaf()) get a nofault parameter
    causing the BUG() in case of a failure.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 tools/flask/policy/modules/dom0.te  |   2 +-
 xen/arch/arm/traps.c                |   3 +
 xen/arch/x86/hvm/hypercall.c        |   3 +
 xen/arch/x86/hypercall.c            |   3 +
 xen/arch/x86/pv/hypercall.c         |   3 +
 xen/common/Kconfig                  |  11 +
 xen/common/Makefile                 |   1 +
 xen/common/hypfs.c                  | 422 ++++++++++++++++++++++++++++++++++++
 xen/include/Makefile                |   1 +
 xen/include/public/hypfs.h          | 129 +++++++++++
 xen/include/public/xen.h            |   1 +
 xen/include/xen/hypercall.h         |  10 +
 xen/include/xen/hypfs.h             | 121 +++++++++++
 xen/include/xlat.lst                |   2 +
 xen/include/xsm/dummy.h             |   6 +
 xen/include/xsm/xsm.h               |   6 +
 xen/xsm/dummy.c                     |   1 +
 xen/xsm/flask/hooks.c               |   6 +
 xen/xsm/flask/policy/access_vectors |   2 +
 19 files changed, 732 insertions(+), 1 deletion(-)

diff --git a/tools/flask/policy/modules/dom0.te b/tools/flask/policy/modules/dom0.te
index 272f6a4f75..20925e38a2 100644
--- a/tools/flask/policy/modules/dom0.te
+++ b/tools/flask/policy/modules/dom0.te
@@ -11,7 +11,7 @@ allow dom0_t xen_t:xen {
 	mtrr_del mtrr_read microcode physinfo quirk writeconsole readapic
 	writeapic privprofile nonprivprofile kexec firmware sleep frequency
 	getidle debug getcpuinfo heap pm_op mca_op lockprof cpupool_op
-	getscheduler setscheduler
+	getscheduler setscheduler hypfs_op
 };
 allow dom0_t xen_t:xen2 {
 	resource_op psr_cmt_op psr_alloc pmu_ctrl get_symbol
diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 30c4c1830b..8f40d0e0b6 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -1381,6 +1381,9 @@ static arm_hypercall_t arm_hypercall_table[] = {
 #ifdef CONFIG_ARGO
     HYPERCALL(argo_op, 5),
 #endif
+#ifdef CONFIG_HYPFS
+    HYPERCALL(hypfs_op, 5),
+#endif
 };
 
 #ifndef NDEBUG
diff --git a/xen/arch/x86/hvm/hypercall.c b/xen/arch/x86/hvm/hypercall.c
index c41c2179c9..b6ccaf4457 100644
--- a/xen/arch/x86/hvm/hypercall.c
+++ b/xen/arch/x86/hvm/hypercall.c
@@ -150,6 +150,9 @@ static const hypercall_table_t hvm_hypercall_table[] = {
 #endif
     HYPERCALL(xenpmu_op),
     COMPAT_CALL(dm_op),
+#ifdef CONFIG_HYPFS
+    HYPERCALL(hypfs_op),
+#endif
     HYPERCALL(arch_1)
 };
 
diff --git a/xen/arch/x86/hypercall.c b/xen/arch/x86/hypercall.c
index 7f299d45c6..dd00983005 100644
--- a/xen/arch/x86/hypercall.c
+++ b/xen/arch/x86/hypercall.c
@@ -72,6 +72,9 @@ const hypercall_args_t hypercall_args_table[NR_hypercalls] =
 #ifdef CONFIG_HVM
     ARGS(hvm_op, 2),
     ARGS(dm_op, 3),
+#endif
+#ifdef CONFIG_HYPFS
+    ARGS(hypfs_op, 5),
 #endif
     ARGS(mca, 1),
     ARGS(arch_1, 1),
diff --git a/xen/arch/x86/pv/hypercall.c b/xen/arch/x86/pv/hypercall.c
index b0d1d0ed77..53a52360fa 100644
--- a/xen/arch/x86/pv/hypercall.c
+++ b/xen/arch/x86/pv/hypercall.c
@@ -84,6 +84,9 @@ const hypercall_table_t pv_hypercall_table[] = {
 #ifdef CONFIG_HVM
     HYPERCALL(hvm_op),
     COMPAT_CALL(dm_op),
+#endif
+#ifdef CONFIG_HYPFS
+    HYPERCALL(hypfs_op),
 #endif
     HYPERCALL(mca),
     HYPERCALL(arch_1),
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index fe9b41f721..e768ea36b2 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -116,6 +116,17 @@ config SPECULATIVE_HARDEN_BRANCH
 
 endmenu
 
+config HYPFS
+	bool "Hypervisor file system support"
+	default y
+	---help---
+	  Support Xen hypervisor file system. This file system is used to
+	  present various hypervisor internal data to dom0 and in some
+	  cases to allow modifying settings. Disabling the support might
+	  result in some features not being available.
+
+	  If unsure, say Y.
+
 config KEXEC
 	bool "kexec support"
 	default y
diff --git a/xen/common/Makefile b/xen/common/Makefile
index e8cde65370..bf7d0e25a3 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -14,6 +14,7 @@ obj-$(CONFIG_CRASH_DEBUG) += gdbstub.o
 obj-$(CONFIG_GRANT_TABLE) += grant_table.o
 obj-y += guestcopy.o
 obj-bin-y += gunzip.init.o
+obj-$(CONFIG_HYPFS) += hypfs.o
 obj-y += irq.o
 obj-y += kernel.o
 obj-y += keyhandler.o
diff --git a/xen/common/hypfs.c b/xen/common/hypfs.c
new file mode 100644
index 0000000000..9c2213a068
--- /dev/null
+++ b/xen/common/hypfs.c
@@ -0,0 +1,422 @@
+/******************************************************************************
+ *
+ * hypfs.c
+ *
+ * Simple sysfs-like file system for the hypervisor.
+ */
+
+#include <xen/err.h>
+#include <xen/guest_access.h>
+#include <xen/hypercall.h>
+#include <xen/hypfs.h>
+#include <xen/lib.h>
+#include <xen/rwlock.h>
+#include <public/hypfs.h>
+
+#ifdef CONFIG_COMPAT
+#include <compat/hypfs.h>
+CHECK_hypfs_dirlistentry;
+#endif
+
+#define DIRENTRY_NAME_OFF offsetof(struct xen_hypfs_dirlistentry, name)
+#define DIRENTRY_SIZE(name_len) \
+    (DIRENTRY_NAME_OFF +        \
+     ROUNDUP((name_len) + 1, alignof(struct xen_hypfs_direntry)))
+
+static DEFINE_RWLOCK(hypfs_lock);
+enum hypfs_lock_state {
+    hypfs_unlocked,
+    hypfs_read_locked,
+    hypfs_write_locked
+};
+static DEFINE_PER_CPU(enum hypfs_lock_state, hypfs_locked);
+
+HYPFS_DIR_INIT(hypfs_root, "");
+
+static void hypfs_read_lock(void)
+{
+    ASSERT(this_cpu(hypfs_locked) != hypfs_write_locked);
+
+    read_lock(&hypfs_lock);
+    this_cpu(hypfs_locked) = hypfs_read_locked;
+}
+
+static void hypfs_write_lock(void)
+{
+    ASSERT(this_cpu(hypfs_locked) == hypfs_unlocked);
+
+    write_lock(&hypfs_lock);
+    this_cpu(hypfs_locked) = hypfs_write_locked;
+}
+
+static void hypfs_unlock(void)
+{
+    enum hypfs_lock_state locked = this_cpu(hypfs_locked);
+
+    this_cpu(hypfs_locked) = hypfs_unlocked;
+
+    switch ( locked )
+    {
+    case hypfs_read_locked:
+        read_unlock(&hypfs_lock);
+        break;
+    case hypfs_write_locked:
+        write_unlock(&hypfs_lock);
+        break;
+    default:
+        BUG();
+    }
+}
+
+static int add_entry(struct hypfs_entry_dir *parent, struct hypfs_entry *new)
+{
+    int ret = -ENOENT;
+    struct hypfs_entry *e;
+
+    hypfs_write_lock();
+
+    list_for_each_entry ( e, &parent->dirlist, list )
+    {
+        int cmp = strcmp(e->name, new->name);
+
+        if ( cmp > 0 )
+        {
+            ret = 0;
+            list_add_tail(&new->list, &e->list);
+            break;
+        }
+        if ( cmp == 0 )
+        {
+            ret = -EEXIST;
+            break;
+        }
+    }
+
+    if ( ret == -ENOENT )
+    {
+        ret = 0;
+        list_add_tail(&new->list, &parent->dirlist);
+    }
+
+    if ( !ret )
+    {
+        unsigned int sz = strlen(new->name);
+
+        parent->e.size += DIRENTRY_SIZE(sz);
+    }
+
+    hypfs_unlock();
+
+    return ret;
+}
+
+int hypfs_add_dir(struct hypfs_entry_dir *parent,
+                  struct hypfs_entry_dir *dir, bool nofault)
+{
+    int ret;
+
+    ret = add_entry(parent, &dir->e);
+    BUG_ON(nofault && ret);
+
+    return ret;
+}
+
+int hypfs_add_leaf(struct hypfs_entry_dir *parent,
+                   struct hypfs_entry_leaf *leaf, bool nofault)
+{
+    int ret;
+
+    if ( !leaf->content )
+        ret = -EINVAL;
+    else
+        ret = add_entry(parent, &leaf->e);
+    BUG_ON(nofault && ret);
+
+    return ret;
+}
+
+static int hypfs_get_path_user(char *buf,
+                               XEN_GUEST_HANDLE_PARAM(const_char) uaddr,
+                               unsigned long ulen)
+{
+    if ( ulen > XEN_HYPFS_MAX_PATHLEN )
+        return -EINVAL;
+
+    if ( copy_from_guest(buf, uaddr, ulen) )
+        return -EFAULT;
+
+    if ( memchr(buf, 0, ulen) != buf + ulen - 1 )
+        return -EINVAL;
+
+    return 0;
+}
+
+static struct hypfs_entry *hypfs_get_entry_rel(struct hypfs_entry_dir *dir,
+                                               const char *path)
+{
+    const char *end;
+    struct hypfs_entry *entry;
+    unsigned int name_len;
+    bool again = true;
+
+    while ( again )
+    {
+        if ( dir->e.type != XEN_HYPFS_TYPE_DIR )
+            return NULL;
+
+        if ( !*path )
+            return &dir->e;
+
+        end = strchr(path, '/');
+        if ( !end )
+            end = strchr(path, '\0');
+        name_len = end - path;
+
+        again = false;
+
+        list_for_each_entry ( entry, &dir->dirlist, list )
+        {
+            int cmp = strncmp(path, entry->name, name_len);
+            struct hypfs_entry_dir *d = container_of(entry,
+                                                     struct hypfs_entry_dir, e);
+
+            if ( cmp < 0 )
+                return NULL;
+            if ( !cmp && strlen(entry->name) == name_len )
+            {
+                if ( !*end )
+                    return entry;
+
+                again = true;
+                dir = d;
+                path = end + 1;
+
+                break;
+            }
+        }
+    }
+
+    return NULL;
+}
+
+static struct hypfs_entry *hypfs_get_entry(const char *path)
+{
+    if ( path[0] != '/' )
+        return NULL;
+
+    return hypfs_get_entry_rel(&hypfs_root, path + 1);
+}
+
+int hypfs_read_dir(const struct hypfs_entry *entry,
+                   XEN_GUEST_HANDLE_PARAM(void) uaddr)
+{
+    const struct hypfs_entry_dir *d;
+    const struct hypfs_entry *e;
+    unsigned int size = entry->size;
+
+    ASSERT(this_cpu(hypfs_locked) != hypfs_unlocked);
+
+    d = container_of(entry, const struct hypfs_entry_dir, e);
+
+    list_for_each_entry ( e, &d->dirlist, list )
+    {
+        struct xen_hypfs_dirlistentry direntry;
+        unsigned int e_namelen = strlen(e->name);
+        unsigned int e_len = DIRENTRY_SIZE(e_namelen);
+
+        direntry.e.pad = 0;
+        direntry.e.type = e->type;
+        direntry.e.encoding = e->encoding;
+        direntry.e.content_len = e->size;
+        direntry.e.max_write_len = e->max_size;
+        direntry.off_next = list_is_last(&e->list, &d->dirlist) ? 0 : e_len;
+        if ( copy_to_guest(uaddr, &direntry, 1) )
+            return -EFAULT;
+
+        if ( copy_to_guest_offset(uaddr, DIRENTRY_NAME_OFF,
+                                  e->name, e_namelen + 1) )
+            return -EFAULT;
+
+        guest_handle_add_offset(uaddr, e_len);
+
+        ASSERT(e_len <= size);
+        size -= e_len;
+    }
+
+    return 0;
+}
+
+int hypfs_read_leaf(const struct hypfs_entry *entry,
+                    XEN_GUEST_HANDLE_PARAM(void) uaddr)
+{
+    const struct hypfs_entry_leaf *l;
+
+    ASSERT(this_cpu(hypfs_locked) != hypfs_unlocked);
+
+    l = container_of(entry, const struct hypfs_entry_leaf, e);
+
+    return copy_to_guest(uaddr, l->content, entry->size) ? -EFAULT: 0;
+}
+
+static int hypfs_read(const struct hypfs_entry *entry,
+                      XEN_GUEST_HANDLE_PARAM(void) uaddr, unsigned long ulen)
+{
+    struct xen_hypfs_direntry e;
+    long ret = -EINVAL;
+
+    if ( ulen < sizeof(e) )
+        goto out;
+
+    e.pad = 0;
+    e.type = entry->type;
+    e.encoding = entry->encoding;
+    e.content_len = entry->size;
+    e.max_write_len = entry->max_size;
+
+    ret = -EFAULT;
+    if ( copy_to_guest(uaddr, &e, 1) )
+        goto out;
+
+    ret = -ENOBUFS;
+    if ( ulen < entry->size + sizeof(e) )
+        goto out;
+
+    guest_handle_add_offset(uaddr, sizeof(e));
+
+    ret = entry->read(entry, uaddr);
+
+ out:
+    return ret;
+}
+
+int hypfs_write_leaf(struct hypfs_entry_leaf *leaf,
+                     XEN_GUEST_HANDLE_PARAM(void) uaddr, unsigned int ulen)
+{
+    char *buf;
+    int ret;
+
+    ASSERT(this_cpu(hypfs_locked) == hypfs_write_locked);
+    ASSERT(ulen <= leaf->e.max_size);
+
+    if ( leaf->e.type != XEN_HYPFS_TYPE_STRING &&
+         leaf->e.type != XEN_HYPFS_TYPE_BLOB && ulen != leaf->e.size )
+        return -EDOM;
+
+    buf = xmalloc_array(char, ulen);
+    if ( !buf )
+        return -ENOMEM;
+
+    ret = -EFAULT;
+    if ( copy_from_guest(buf, uaddr, ulen) )
+        goto out;
+
+    ret = -EINVAL;
+    if ( leaf->e.type == XEN_HYPFS_TYPE_STRING &&
+         leaf->e.encoding == XEN_HYPFS_ENC_PLAIN &&
+         memchr(buf, 0, ulen) != (buf + ulen - 1) )
+        goto out;
+
+    ret = 0;
+    memcpy(leaf->write_ptr, buf, ulen);
+    leaf->e.size = ulen;
+
+ out:
+    xfree(buf);
+    return ret;
+}
+
+int hypfs_write_bool(struct hypfs_entry_leaf *leaf,
+                     XEN_GUEST_HANDLE_PARAM(void) uaddr, unsigned int ulen)
+{
+    bool buf;
+
+    ASSERT(this_cpu(hypfs_locked) == hypfs_write_locked);
+    ASSERT(leaf->e.type == XEN_HYPFS_TYPE_BOOL &&
+           leaf->e.size == sizeof(bool) &&
+           leaf->e.max_size == sizeof(bool) );
+
+    if ( ulen != leaf->e.max_size )
+        return -EDOM;
+
+    if ( copy_from_guest(&buf, uaddr, ulen) )
+        return -EFAULT;
+
+    *(bool *)leaf->write_ptr = buf;
+
+    return 0;
+}
+
+static int hypfs_write(struct hypfs_entry *entry,
+                       XEN_GUEST_HANDLE_PARAM(void) uaddr, unsigned long ulen)
+{
+    struct hypfs_entry_leaf *l;
+
+    if ( !entry->write )
+        return -EACCES;
+
+    ASSERT(entry->max_size);
+
+    if ( ulen > entry->max_size )
+        return -ENOSPC;
+
+    l = container_of(entry, struct hypfs_entry_leaf, e);
+
+    return entry->write(l, uaddr, ulen);
+}
+
+long do_hypfs_op(unsigned int cmd,
+                 XEN_GUEST_HANDLE_PARAM(const_char) arg1, unsigned long arg2,
+                 XEN_GUEST_HANDLE_PARAM(void) arg3, unsigned long arg4)
+{
+    int ret;
+    struct hypfs_entry *entry;
+    static char path[XEN_HYPFS_MAX_PATHLEN];
+
+    if ( xsm_hypfs_op(XSM_PRIV) )
+        return -EPERM;
+
+    if ( cmd == XEN_HYPFS_OP_get_version )
+    {
+        if ( !guest_handle_is_null(arg1) || arg2 ||
+             !guest_handle_is_null(arg3) || arg4 )
+            return -EINVAL;
+
+        return XEN_HYPFS_VERSION;
+    }
+
+    if ( cmd == XEN_HYPFS_OP_write_contents )
+        hypfs_write_lock();
+    else
+        hypfs_read_lock();
+
+    ret = hypfs_get_path_user(path, arg1, arg2);
+    if ( ret )
+        goto out;
+
+    entry = hypfs_get_entry(path);
+    if ( !entry )
+    {
+        ret = -ENOENT;
+        goto out;
+    }
+
+    switch ( cmd )
+    {
+    case XEN_HYPFS_OP_read:
+        ret = hypfs_read(entry, arg3, arg4);
+        break;
+
+    case XEN_HYPFS_OP_write_contents:
+        ret = hypfs_write(entry, arg3, arg4);
+        break;
+
+    default:
+        ret = -EOPNOTSUPP;
+        break;
+    }
+
+ out:
+    hypfs_unlock();
+
+    return ret;
+}
diff --git a/xen/include/Makefile b/xen/include/Makefile
index 2a10725d68..089314dc72 100644
--- a/xen/include/Makefile
+++ b/xen/include/Makefile
@@ -9,6 +9,7 @@ headers-y := \
     compat/event_channel.h \
     compat/features.h \
     compat/grant_table.h \
+    compat/hypfs.h \
     compat/kexec.h \
     compat/memory.h \
     compat/nmi.h \
diff --git a/xen/include/public/hypfs.h b/xen/include/public/hypfs.h
new file mode 100644
index 0000000000..63a5df1629
--- /dev/null
+++ b/xen/include/public/hypfs.h
@@ -0,0 +1,129 @@
+/******************************************************************************
+ * Xen Hypervisor Filesystem
+ *
+ * Copyright (c) 2019, SUSE Software Solutions Germany GmbH
+ *
+ * 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
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#ifndef __XEN_PUBLIC_HYPFS_H__
+#define __XEN_PUBLIC_HYPFS_H__
+
+#include "xen.h"
+
+/*
+ * Definitions for the __HYPERVISOR_hypfs_op hypercall.
+ */
+
+/* Highest version number of the hypfs interface currently defined. */
+#define XEN_HYPFS_VERSION      1
+
+/* Maximum length of a path in the filesystem. */
+#define XEN_HYPFS_MAX_PATHLEN  1024
+
+struct xen_hypfs_direntry {
+    uint8_t type;
+#define XEN_HYPFS_TYPE_DIR     0
+#define XEN_HYPFS_TYPE_BLOB    1
+#define XEN_HYPFS_TYPE_STRING  2
+#define XEN_HYPFS_TYPE_UINT    3
+#define XEN_HYPFS_TYPE_INT     4
+#define XEN_HYPFS_TYPE_BOOL    5
+    uint8_t encoding;
+#define XEN_HYPFS_ENC_PLAIN    0
+#define XEN_HYPFS_ENC_GZIP     1
+    uint16_t pad;              /* Returned as 0. */
+    uint32_t content_len;      /* Current length of data. */
+    uint32_t max_write_len;    /* Max. length for writes (0 if read-only). */
+};
+
+struct xen_hypfs_dirlistentry {
+    struct xen_hypfs_direntry e;
+    /* Offset in bytes to next entry (0 == this is the last entry). */
+    uint16_t off_next;
+    /* Zero terminated entry name, possibly with some padding for alignment. */
+    char name[XEN_FLEX_ARRAY_DIM];
+};
+
+/*
+ * Hypercall operations.
+ */
+
+/*
+ * XEN_HYPFS_OP_get_version
+ *
+ * Read highest interface version supported by the hypervisor.
+ *
+ * arg1 - arg4: all 0/NULL
+ *
+ * Possible return values:
+ * >0: highest supported interface version
+ * <0: negative Xen errno value
+ */
+#define XEN_HYPFS_OP_get_version     0
+
+/*
+ * XEN_HYPFS_OP_read
+ *
+ * Read a filesystem entry.
+ *
+ * Returns the direntry and contents of an entry in the buffer supplied by the
+ * caller (struct xen_hypfs_direntry with the contents following directly
+ * after it).
+ * The data buffer must be at least the size of the direntry returned. If the
+ * data buffer was not large enough for all the data -ENOBUFS and no entry
+ * data is returned, but the direntry will contain the needed size for the
+ * returned data.
+ * The format of the contents is according to its entry type and encoding.
+ * The contents of a directory are multiple struct xen_hypfs_dirlistentry
+ * items.
+ *
+ * arg1: XEN_GUEST_HANDLE(path name)
+ * arg2: length of path name (including trailing zero byte)
+ * arg3: XEN_GUEST_HANDLE(data buffer written by hypervisor)
+ * arg4: data buffer size
+ *
+ * Possible return values:
+ * 0: success
+ * <0 : negative Xen errno value
+ */
+#define XEN_HYPFS_OP_read              1
+
+/*
+ * XEN_HYPFS_OP_write_contents
+ *
+ * Write contents of a filesystem entry.
+ *
+ * Writes an entry with the contents of a buffer supplied by the caller.
+ * The data type and encoding can't be changed. The size can be changed only
+ * for blobs and strings.
+ *
+ * arg1: XEN_GUEST_HANDLE(path name)
+ * arg2: length of path name (including trailing zero byte)
+ * arg3: XEN_GUEST_HANDLE(content buffer read by hypervisor)
+ * arg4: content buffer size
+ *
+ * Possible return values:
+ * 0: success
+ * <0 : negative Xen errno value
+ */
+#define XEN_HYPFS_OP_write_contents    2
+
+#endif /* __XEN_PUBLIC_HYPFS_H__ */
diff --git a/xen/include/public/xen.h b/xen/include/public/xen.h
index 75b1619d0d..945ef30273 100644
--- a/xen/include/public/xen.h
+++ b/xen/include/public/xen.h
@@ -130,6 +130,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_ulong_t);
 #define __HYPERVISOR_argo_op              39
 #define __HYPERVISOR_xenpmu_op            40
 #define __HYPERVISOR_dm_op                41
+#define __HYPERVISOR_hypfs_op             42
 
 /* Architecture-specific hypercall definitions. */
 #define __HYPERVISOR_arch_0               48
diff --git a/xen/include/xen/hypercall.h b/xen/include/xen/hypercall.h
index d82a293377..655acc7f47 100644
--- a/xen/include/xen/hypercall.h
+++ b/xen/include/xen/hypercall.h
@@ -150,6 +150,16 @@ do_dm_op(
     unsigned int nr_bufs,
     XEN_GUEST_HANDLE_PARAM(xen_dm_op_buf_t) bufs);
 
+#ifdef CONFIG_HYPFS
+extern long
+do_hypfs_op(
+    unsigned int cmd,
+    XEN_GUEST_HANDLE_PARAM(const_char) arg1,
+    unsigned long arg2,
+    XEN_GUEST_HANDLE_PARAM(void) arg3,
+    unsigned long arg4);
+#endif
+
 #ifdef CONFIG_COMPAT
 
 extern int
diff --git a/xen/include/xen/hypfs.h b/xen/include/xen/hypfs.h
new file mode 100644
index 0000000000..5c6a0ccece
--- /dev/null
+++ b/xen/include/xen/hypfs.h
@@ -0,0 +1,121 @@
+#ifndef __XEN_HYPFS_H__
+#define __XEN_HYPFS_H__
+
+#ifdef CONFIG_HYPFS
+#include <xen/list.h>
+#include <xen/string.h>
+#include <public/hypfs.h>
+
+struct hypfs_entry_leaf;
+
+struct hypfs_entry {
+    unsigned short type;
+    unsigned short encoding;
+    unsigned int size;
+    unsigned int max_size;
+    const char *name;
+    struct list_head list;
+    int (*read)(const struct hypfs_entry *entry,
+                XEN_GUEST_HANDLE_PARAM(void) uaddr);
+    int (*write)(struct hypfs_entry_leaf *leaf,
+                 XEN_GUEST_HANDLE_PARAM(void) uaddr, unsigned int ulen);
+};
+
+struct hypfs_entry_leaf {
+    struct hypfs_entry e;
+    union {
+        const void *content;
+        void *write_ptr;
+    };
+};
+
+struct hypfs_entry_dir {
+    struct hypfs_entry e;
+    struct list_head dirlist;
+};
+
+#define HYPFS_DIR_INIT(var, nam)                  \
+    struct hypfs_entry_dir __read_mostly var = {  \
+        .e.type = XEN_HYPFS_TYPE_DIR,             \
+        .e.encoding = XEN_HYPFS_ENC_PLAIN,        \
+        .e.name = (nam),                          \
+        .e.size = 0,                              \
+        .e.max_size = 0,                          \
+        .e.list = LIST_HEAD_INIT(var.e.list),     \
+        .e.read = hypfs_read_dir,                 \
+        .dirlist = LIST_HEAD_INIT(var.dirlist),   \
+    }
+
+#define HYPFS_VARSIZE_INIT(var, typ, nam, msz)    \
+    struct hypfs_entry_leaf __read_mostly var = { \
+        .e.type = (typ),                          \
+        .e.encoding = XEN_HYPFS_ENC_PLAIN,        \
+        .e.name = (nam),                          \
+        .e.max_size = (msz),                      \
+        .e.read = hypfs_read_leaf,                \
+    }
+
+/* Content and size need to be set via hypfs_string_set_reference(). */
+#define HYPFS_STRING_INIT(var, nam)               \
+    HYPFS_VARSIZE_INIT(var, XEN_HYPFS_TYPE_STRING, nam, 0)
+
+/*
+ * Set content and size of a XEN_HYPFS_TYPE_STRING node. The node will point
+ * to str, so any later modification of *str should be followed by a call
+ * to hypfs_string_set_reference() in order to update the size of the node
+ * data.
+ */
+static inline void hypfs_string_set_reference(struct hypfs_entry_leaf *leaf,
+                                              const char *str)
+{
+    leaf->content = str;
+    leaf->e.size = strlen(str) + 1;
+}
+
+#define HYPFS_FIXEDSIZE_INIT(var, typ, nam, contvar, wr) \
+    struct hypfs_entry_leaf __read_mostly var = {        \
+        .e.type = (typ),                                 \
+        .e.encoding = XEN_HYPFS_ENC_PLAIN,               \
+        .e.name = (nam),                                 \
+        .e.size = sizeof(contvar),                       \
+        .e.max_size = (wr) ? sizeof(contvar) : 0,        \
+        .e.read = hypfs_read_leaf,                       \
+        .e.write = (wr),                                 \
+        .content = &(contvar),                           \
+    }
+
+#define HYPFS_UINT_INIT(var, nam, contvar)                       \
+    HYPFS_FIXEDSIZE_INIT(var, XEN_HYPFS_TYPE_UINT, nam, contvar, NULL)
+#define HYPFS_UINT_INIT_WRITABLE(var, nam, contvar)              \
+    HYPFS_FIXEDSIZE_INIT(var, XEN_HYPFS_TYPE_UINT, nam, contvar, \
+                         hypfs_write_leaf)
+
+#define HYPFS_INT_INIT(var, nam, contvar)                        \
+    HYPFS_FIXEDSIZE_INIT(var, XEN_HYPFS_TYPE_INT, nam, contvar, NULL)
+#define HYPFS_INT_INIT_WRITABLE(var, nam, contvar)               \
+    HYPFS_FIXEDSIZE_INIT(var, XEN_HYPFS_TYPE_INT, nam, contvar, \
+                         hypfs_write_leaf)
+
+#define HYPFS_BOOL_INIT(var, nam, contvar)                       \
+    HYPFS_FIXEDSIZE_INIT(var, XEN_HYPFS_TYPE_BOOL, nam, contvar, NULL)
+#define HYPFS_BOOL_INIT_WRITABLE(var, nam, contvar)              \
+    HYPFS_FIXEDSIZE_INIT(var, XEN_HYPFS_TYPE_BOOL, nam, contvar, \
+                         hypfs_write_bool)
+
+extern struct hypfs_entry_dir hypfs_root;
+
+int hypfs_add_dir(struct hypfs_entry_dir *parent,
+                  struct hypfs_entry_dir *dir, bool nofault);
+int hypfs_add_leaf(struct hypfs_entry_dir *parent,
+                   struct hypfs_entry_leaf *leaf, bool nofault);
+int hypfs_read_dir(const struct hypfs_entry *entry,
+                   XEN_GUEST_HANDLE_PARAM(void) uaddr);
+int hypfs_read_leaf(const struct hypfs_entry *entry,
+                    XEN_GUEST_HANDLE_PARAM(void) uaddr);
+int hypfs_write_leaf(struct hypfs_entry_leaf *leaf,
+                     XEN_GUEST_HANDLE_PARAM(void) uaddr, unsigned int ulen);
+int hypfs_write_bool(struct hypfs_entry_leaf *leaf,
+                     XEN_GUEST_HANDLE_PARAM(void) uaddr, unsigned int ulen);
+#endif
+
+#endif /* __XEN_HYPFS_H__ */
diff --git a/xen/include/xlat.lst b/xen/include/xlat.lst
index 95f5e5592b..0921d4a8d0 100644
--- a/xen/include/xlat.lst
+++ b/xen/include/xlat.lst
@@ -86,6 +86,8 @@
 ?	vcpu_hvm_context		hvm/hvm_vcpu.h
 ?	vcpu_hvm_x86_32			hvm/hvm_vcpu.h
 ?	vcpu_hvm_x86_64			hvm/hvm_vcpu.h
+?	hypfs_direntry			hypfs.h
+?	hypfs_dirlistentry		hypfs.h
 ?	kexec_exec			kexec.h
 !	kexec_image			kexec.h
 !	kexec_range			kexec.h
diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h
index 295dd67c48..2368acebed 100644
--- a/xen/include/xsm/dummy.h
+++ b/xen/include/xsm/dummy.h
@@ -434,6 +434,12 @@ static XSM_INLINE int xsm_page_offline(XSM_DEFAULT_ARG uint32_t cmd)
     return xsm_default_action(action, current->domain, NULL);
 }
 
+static XSM_INLINE int xsm_hypfs_op(XSM_DEFAULT_VOID)
+{
+    XSM_ASSERT_ACTION(XSM_PRIV);
+    return xsm_default_action(action, current->domain, NULL);
+}
+
 static XSM_INLINE long xsm_do_xsm_op(XEN_GUEST_HANDLE_PARAM(xsm_op_t) op)
 {
     return -ENOSYS;
diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h
index e22d6160b5..a80bcf3e42 100644
--- a/xen/include/xsm/xsm.h
+++ b/xen/include/xsm/xsm.h
@@ -127,6 +127,7 @@ struct xsm_operations {
     int (*resource_setup_misc) (void);
 
     int (*page_offline)(uint32_t cmd);
+    int (*hypfs_op)(void);
 
     long (*do_xsm_op) (XEN_GUEST_HANDLE_PARAM(xsm_op_t) op);
 #ifdef CONFIG_COMPAT
@@ -536,6 +537,11 @@ static inline int xsm_page_offline(xsm_default_t def, uint32_t cmd)
     return xsm_ops->page_offline(cmd);
 }
 
+static inline int xsm_hypfs_op(xsm_default_t def)
+{
+    return xsm_ops->hypfs_op();
+}
+
 static inline long xsm_do_xsm_op (XEN_GUEST_HANDLE_PARAM(xsm_op_t) op)
 {
     return xsm_ops->do_xsm_op(op);
diff --git a/xen/xsm/dummy.c b/xen/xsm/dummy.c
index 5705e52791..d4cce68089 100644
--- a/xen/xsm/dummy.c
+++ b/xen/xsm/dummy.c
@@ -103,6 +103,7 @@ void __init xsm_fixup_ops (struct xsm_operations *ops)
     set_to_dummy_if_null(ops, resource_setup_misc);
 
     set_to_dummy_if_null(ops, page_offline);
+    set_to_dummy_if_null(ops, hypfs_op);
     set_to_dummy_if_null(ops, hvm_param);
     set_to_dummy_if_null(ops, hvm_control);
     set_to_dummy_if_null(ops, hvm_param_nested);
diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
index 4649e6fd95..a2c78e445c 100644
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -1173,6 +1173,11 @@ static inline int flask_page_offline(uint32_t cmd)
     }
 }
 
+static inline int flask_hypfs_op(void)
+{
+    return domain_has_xen(current->domain, XEN__HYPFS_OP);
+}
+
 static int flask_add_to_physmap(struct domain *d1, struct domain *d2)
 {
     return domain_has_perm(d1, d2, SECCLASS_MMU, MMU__PHYSMAP);
@@ -1812,6 +1817,7 @@ static struct xsm_operations flask_ops = {
     .resource_setup_misc = flask_resource_setup_misc,
 
     .page_offline = flask_page_offline,
+    .hypfs_op = flask_hypfs_op,
     .hvm_param = flask_hvm_param,
     .hvm_control = flask_hvm_param,
     .hvm_param_nested = flask_hvm_param_nested,
diff --git a/xen/xsm/flask/policy/access_vectors b/xen/xsm/flask/policy/access_vectors
index c055c14c26..c9e385fb9b 100644
--- a/xen/xsm/flask/policy/access_vectors
+++ b/xen/xsm/flask/policy/access_vectors
@@ -67,6 +67,8 @@ class xen
     lockprof
 # XEN_SYSCTL_cpupool_op
     cpupool_op
+# hypfs hypercall
+    hypfs_op
 # XEN_SYSCTL_scheduler_op with XEN_DOMCTL_SCHEDOP_getinfo, XEN_SYSCTL_sched_id, XEN_DOMCTL_SCHEDOP_getvcpuinfo
     getscheduler
 # XEN_SYSCTL_scheduler_op with XEN_DOMCTL_SCHEDOP_putinfo, XEN_DOMCTL_SCHEDOP_putvcpuinfo
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jun 06 23:55:35 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Jun 2020 23: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 1jhif1-0005cj-Ua; Sat, 06 Jun 2020 23: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=x7q/=7T=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhif1-0005cX-5b
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:55:35 +0000
X-Inumbo-ID: 35de629e-a851-11ea-b15a-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 35de629e-a851-11ea-b15a-12813bfff9fa;
 Sat, 06 Jun 2020 23:55: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=DH28euQ2zXxxW+BbAjGh5FPRm28/jH0FZ6AjUt5Qaiw=; b=eAXrnXuGJ6o3Qk9QzM4IckNAZ+
 gOPRm05lA/ditPsmzp1huAeM2nqAwP9t6LvjKANQBkTJa+k2jFt9jwuTER4mcdToxzag450jD9npA
 BiWfIwFfnPO6hs/n1zyBOLVXd/LjLoDnTmyAmitksEDna7WVolSafk11USpQPbbLFBfc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhiez-0002RG-Mb
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:55:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhiez-0006bN-Lj
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:55:33 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] libs: add libxenhypfs
Message-Id: <E1jhiez-0006bN-Lj@xenbits.xenproject.org>
Date: Sat, 06 Jun 2020 23:55: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 86234eafb95295621aef6c618e4c22c10d8e4138
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri May 29 10:20:21 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri May 29 10:20:21 2020 +0200

    libs: add libxenhypfs
    
    Add the new library libxenhypfs for access to the hypervisor filesystem.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Wei Liu <wl@xen.org>
---
 .gitignore                          |   2 +
 tools/Rules.mk                      |   6 +
 tools/libs/Makefile                 |   1 +
 tools/libs/hypfs/Makefile           |  16 ++
 tools/libs/hypfs/core.c             | 536 ++++++++++++++++++++++++++++++++++++
 tools/libs/hypfs/include/xenhypfs.h |  90 ++++++
 tools/libs/hypfs/libxenhypfs.map    |  10 +
 tools/libs/hypfs/xenhypfs.pc.in     |  10 +
 8 files changed, 671 insertions(+)

diff --git a/.gitignore b/.gitignore
index 15a089b887..abf13df5ec 100644
--- a/.gitignore
+++ b/.gitignore
@@ -110,6 +110,8 @@ tools/libs/evtchn/headers.chk
 tools/libs/evtchn/xenevtchn.pc
 tools/libs/gnttab/headers.chk
 tools/libs/gnttab/xengnttab.pc
+tools/libs/hypfs/headers.chk
+tools/libs/hypfs/xenhypfs.pc
 tools/libs/call/headers.chk
 tools/libs/call/xencall.pc
 tools/libs/foreignmemory/headers.chk
diff --git a/tools/Rules.mk b/tools/Rules.mk
index 76acaef988..518bb5660a 100644
--- a/tools/Rules.mk
+++ b/tools/Rules.mk
@@ -19,6 +19,7 @@ XEN_LIBXENGNTTAB   = $(XEN_ROOT)/tools/libs/gnttab
 XEN_LIBXENCALL     = $(XEN_ROOT)/tools/libs/call
 XEN_LIBXENFOREIGNMEMORY = $(XEN_ROOT)/tools/libs/foreignmemory
 XEN_LIBXENDEVICEMODEL = $(XEN_ROOT)/tools/libs/devicemodel
+XEN_LIBXENHYPFS    = $(XEN_ROOT)/tools/libs/hypfs
 XEN_LIBXC          = $(XEN_ROOT)/tools/libxc
 XEN_XENLIGHT       = $(XEN_ROOT)/tools/libxl
 # Currently libxlutil lives in the same directory as libxenlight
@@ -131,6 +132,11 @@ SHDEPS_libxendevicemodel = $(SHLIB_libxentoollog) $(SHLIB_libxentoolcore) $(SHLI
 LDLIBS_libxendevicemodel = $(SHDEPS_libxendevicemodel) $(XEN_LIBXENDEVICEMODEL)/libxendevicemodel$(libextension)
 SHLIB_libxendevicemodel  = $(SHDEPS_libxendevicemodel) -Wl,-rpath-link=$(XEN_LIBXENDEVICEMODEL)
 
+CFLAGS_libxenhypfs = -I$(XEN_LIBXENHYPFS)/include $(CFLAGS_xeninclude)
+SHDEPS_libxenhypfs = $(SHLIB_libxentoollog) $(SHLIB_libxentoolcore) $(SHLIB_xencall)
+LDLIBS_libxenhypfs = $(SHDEPS_libxenhypfs) $(XEN_LIBXENHYPFS)/libxenhypfs$(libextension)
+SHLIB_libxenhypfs  = $(SHDEPS_libxenhypfs) -Wl,-rpath-link=$(XEN_LIBXENHYPFS)
+
 # code which compiles against libxenctrl get __XEN_TOOLS__ and
 # therefore sees the unstable hypercall interfaces.
 CFLAGS_libxenctrl = -I$(XEN_LIBXC)/include $(CFLAGS_libxentoollog) $(CFLAGS_libxenforeignmemory) $(CFLAGS_libxendevicemodel) $(CFLAGS_xeninclude) -D__XEN_TOOLS__
diff --git a/tools/libs/Makefile b/tools/libs/Makefile
index 88901e7341..69cdfb5975 100644
--- a/tools/libs/Makefile
+++ b/tools/libs/Makefile
@@ -9,6 +9,7 @@ SUBDIRS-y += gnttab
 SUBDIRS-y += call
 SUBDIRS-y += foreignmemory
 SUBDIRS-y += devicemodel
+SUBDIRS-y += hypfs
 
 ifeq ($(CONFIG_RUMP),y)
 SUBDIRS-y := toolcore
diff --git a/tools/libs/hypfs/Makefile b/tools/libs/hypfs/Makefile
new file mode 100644
index 0000000000..06dd449929
--- /dev/null
+++ b/tools/libs/hypfs/Makefile
@@ -0,0 +1,16 @@
+XEN_ROOT = $(CURDIR)/../../..
+include $(XEN_ROOT)/tools/Rules.mk
+
+MAJOR    = 1
+MINOR    = 0
+LIBNAME  := hypfs
+USELIBS  := toollog toolcore call
+
+APPEND_LDFLAGS += -lz
+
+SRCS-y                 += core.c
+
+include ../libs.mk
+
+$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_LIBXENHYPFS)/include
+$(PKG_CONFIG_LOCAL): PKG_CONFIG_CFLAGS_LOCAL = $(CFLAGS_xeninclude)
diff --git a/tools/libs/hypfs/core.c b/tools/libs/hypfs/core.c
new file mode 100644
index 0000000000..d4309b5ae2
--- /dev/null
+++ b/tools/libs/hypfs/core.c
@@ -0,0 +1,536 @@
+/*
+ * Copyright (c) 2019 SUSE Software Solutions Germany GmbH
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define __XEN_TOOLS__ 1
+
+#define _GNU_SOURCE
+
+#include <errno.h>
+#include <inttypes.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <string.h>
+#include <zlib.h>
+
+#include <xentoollog.h>
+#include <xenhypfs.h>
+#include <xencall.h>
+#include <xentoolcore_internal.h>
+
+#include <xen/xen.h>
+#include <xen/hypfs.h>
+
+#define BUF_SIZE 4096
+
+struct xenhypfs_handle {
+    xentoollog_logger *logger, *logger_tofree;
+    unsigned int flags;
+    xencall_handle *xcall;
+};
+
+xenhypfs_handle *xenhypfs_open(xentoollog_logger *logger,
+                               unsigned open_flags)
+{
+    xenhypfs_handle *fshdl = calloc(1, sizeof(*fshdl));
+
+    if (!fshdl)
+        return NULL;
+
+    fshdl->flags = open_flags;
+    fshdl->logger = logger;
+    fshdl->logger_tofree = NULL;
+
+    if (!fshdl->logger) {
+        fshdl->logger = fshdl->logger_tofree =
+            (xentoollog_logger*)
+            xtl_createlogger_stdiostream(stderr, XTL_PROGRESS, 0);
+        if (!fshdl->logger)
+            goto err;
+    }
+
+    fshdl->xcall = xencall_open(fshdl->logger, 0);
+    if (!fshdl->xcall)
+        goto err;
+
+    /* No need to remember supported version, we only support V1. */
+    if (xencall5(fshdl->xcall, __HYPERVISOR_hypfs_op,
+                 XEN_HYPFS_OP_get_version, 0, 0, 0, 0) < 0)
+        goto err;
+
+    return fshdl;
+
+err:
+    xtl_logger_destroy(fshdl->logger_tofree);
+    xencall_close(fshdl->xcall);
+    free(fshdl);
+    return NULL;
+}
+
+int xenhypfs_close(xenhypfs_handle *fshdl)
+{
+    if (!fshdl)
+        return 0;
+
+    xencall_close(fshdl->xcall);
+    xtl_logger_destroy(fshdl->logger_tofree);
+    free(fshdl);
+    return 0;
+}
+
+static int xenhypfs_get_pathbuf(xenhypfs_handle *fshdl, const char *path,
+                                char **path_buf)
+{
+    int ret = -1;
+    int path_sz;
+
+    if (!fshdl) {
+        errno = EBADF;
+        goto out;
+    }
+
+    path_sz = strlen(path) + 1;
+    if (path_sz > XEN_HYPFS_MAX_PATHLEN)
+    {
+        errno = ENAMETOOLONG;
+        goto out;
+    }
+
+    *path_buf = xencall_alloc_buffer(fshdl->xcall, path_sz);
+    if (!*path_buf) {
+        errno = ENOMEM;
+        goto out;
+    }
+    strcpy(*path_buf, path);
+
+    ret = path_sz;
+
+ out:
+    return ret;
+}
+
+static void *xenhypfs_inflate(void *in_data, size_t *sz)
+{
+    unsigned char *workbuf;
+    void *content = NULL;
+    unsigned int out_sz;
+    z_stream z = { .opaque = NULL };
+    int ret;
+
+    workbuf = malloc(BUF_SIZE);
+    if (!workbuf)
+        return NULL;
+
+    z.next_in = in_data;
+    z.avail_in = *sz;
+    ret = inflateInit2(&z, MAX_WBITS + 32); /* 32 == gzip */
+
+    for (*sz = 0; ret == Z_OK; *sz += out_sz) {
+        z.next_out = workbuf;
+        z.avail_out = BUF_SIZE;
+        ret = inflate(&z, Z_SYNC_FLUSH);
+        if (ret != Z_OK && ret != Z_STREAM_END)
+            break;
+
+        out_sz = z.next_out - workbuf;
+        content = realloc(content, *sz + out_sz);
+        if (!content) {
+            ret = Z_MEM_ERROR;
+            break;
+        }
+        memcpy(content + *sz, workbuf, out_sz);
+    }
+
+    inflateEnd(&z);
+    if (ret != Z_STREAM_END) {
+        free(content);
+        content = NULL;
+        errno = EIO;
+    }
+    free(workbuf);
+    return content;
+}
+
+static void xenhypfs_set_attrs(struct xen_hypfs_direntry *entry,
+                               struct xenhypfs_dirent *dirent)
+{
+    dirent->size = entry->content_len;
+
+    switch(entry->type) {
+    case XEN_HYPFS_TYPE_DIR:
+        dirent->type = xenhypfs_type_dir;
+        break;
+    case XEN_HYPFS_TYPE_BLOB:
+        dirent->type = xenhypfs_type_blob;
+        break;
+    case XEN_HYPFS_TYPE_STRING:
+        dirent->type = xenhypfs_type_string;
+        break;
+    case XEN_HYPFS_TYPE_UINT:
+        dirent->type = xenhypfs_type_uint;
+        break;
+    case XEN_HYPFS_TYPE_INT:
+        dirent->type = xenhypfs_type_int;
+        break;
+    case XEN_HYPFS_TYPE_BOOL:
+        dirent->type = xenhypfs_type_bool;
+        break;
+    default:
+        dirent->type = xenhypfs_type_blob;
+    }
+
+    switch (entry->encoding) {
+    case XEN_HYPFS_ENC_PLAIN:
+        dirent->encoding = xenhypfs_enc_plain;
+        break;
+    case XEN_HYPFS_ENC_GZIP:
+        dirent->encoding = xenhypfs_enc_gzip;
+        break;
+    default:
+        dirent->encoding = xenhypfs_enc_plain;
+        dirent->type = xenhypfs_type_blob;
+    }
+
+    dirent->is_writable = entry->max_write_len;
+}
+
+void *xenhypfs_read_raw(xenhypfs_handle *fshdl, const char *path,
+                        struct xenhypfs_dirent **dirent)
+{
+    void *retbuf = NULL, *content = NULL;
+    char *path_buf = NULL;
+    const char *name;
+    struct xen_hypfs_direntry *entry;
+    int ret;
+    int sz, path_sz;
+
+    *dirent = NULL;
+    ret = xenhypfs_get_pathbuf(fshdl, path, &path_buf);
+    if (ret < 0)
+        goto out;
+
+    path_sz = ret;
+
+    for (sz = BUF_SIZE;; sz = sizeof(*entry) + entry->content_len) {
+        if (retbuf)
+            xencall_free_buffer(fshdl->xcall, retbuf);
+
+        retbuf = xencall_alloc_buffer(fshdl->xcall, sz);
+        if (!retbuf) {
+            errno = ENOMEM;
+            goto out;
+        }
+        entry = retbuf;
+
+        ret = xencall5(fshdl->xcall, __HYPERVISOR_hypfs_op, XEN_HYPFS_OP_read,
+                       (unsigned long)path_buf, path_sz,
+                       (unsigned long)retbuf, sz);
+        if (!ret)
+            break;
+
+        if (ret != ENOBUFS) {
+            errno = -ret;
+            goto out;
+        }
+    }
+
+    content = malloc(entry->content_len);
+    if (!content)
+        goto out;
+    memcpy(content, entry + 1, entry->content_len);
+
+    name = strrchr(path, '/');
+    if (!name)
+        name = path;
+    else {
+        name++;
+        if (!*name)
+            name--;
+    }
+    *dirent = calloc(1, sizeof(struct xenhypfs_dirent) + strlen(name) + 1);
+    if (!*dirent) {
+        free(content);
+        content = NULL;
+        errno = ENOMEM;
+        goto out;
+    }
+    (*dirent)->name = (char *)(*dirent + 1);
+    strcpy((*dirent)->name, name);
+    xenhypfs_set_attrs(entry, *dirent);
+
+ out:
+    ret = errno;
+    xencall_free_buffer(fshdl->xcall, path_buf);
+    xencall_free_buffer(fshdl->xcall, retbuf);
+    errno = ret;
+
+    return content;
+}
+
+char *xenhypfs_read(xenhypfs_handle *fshdl, const char *path)
+{
+    char *buf, *ret_buf = NULL;
+    struct xenhypfs_dirent *dirent;
+    int ret;
+
+    buf = xenhypfs_read_raw(fshdl, path, &dirent);
+    if (!buf)
+        goto out;
+
+    switch (dirent->encoding) {
+    case xenhypfs_enc_plain:
+        break;
+    case xenhypfs_enc_gzip:
+        ret_buf = xenhypfs_inflate(buf, &dirent->size);
+        if (!ret_buf)
+            goto out;
+        free(buf);
+        buf = ret_buf;
+        ret_buf = NULL;
+        break;
+    }
+
+    switch (dirent->type) {
+    case xenhypfs_type_dir:
+        errno = EISDIR;
+        break;
+    case xenhypfs_type_blob:
+        errno = EDOM;
+        break;
+    case xenhypfs_type_string:
+        ret_buf = buf;
+        buf = NULL;
+        break;
+    case xenhypfs_type_uint:
+    case xenhypfs_type_bool:
+        switch (dirent->size) {
+        case 1:
+            ret = asprintf(&ret_buf, "%"PRIu8, *(uint8_t *)buf);
+            break;
+        case 2:
+            ret = asprintf(&ret_buf, "%"PRIu16, *(uint16_t *)buf);
+            break;
+        case 4:
+            ret = asprintf(&ret_buf, "%"PRIu32, *(uint32_t *)buf);
+            break;
+        case 8:
+            ret = asprintf(&ret_buf, "%"PRIu64, *(uint64_t *)buf);
+            break;
+        default:
+            ret = -1;
+            errno = EDOM;
+        }
+        if (ret < 0)
+            ret_buf = NULL;
+        break;
+    case xenhypfs_type_int:
+        switch (dirent->size) {
+        case 1:
+            ret = asprintf(&ret_buf, "%"PRId8, *(int8_t *)buf);
+            break;
+        case 2:
+            ret = asprintf(&ret_buf, "%"PRId16, *(int16_t *)buf);
+            break;
+        case 4:
+            ret = asprintf(&ret_buf, "%"PRId32, *(int32_t *)buf);
+            break;
+        case 8:
+            ret = asprintf(&ret_buf, "%"PRId64, *(int64_t *)buf);
+            break;
+        default:
+            ret = -1;
+            errno = EDOM;
+        }
+        if (ret < 0)
+            ret_buf = NULL;
+        break;
+    }
+
+ out:
+    ret = errno;
+    free(buf);
+    free(dirent);
+    errno = ret;
+
+    return ret_buf;
+}
+
+struct xenhypfs_dirent *xenhypfs_readdir(xenhypfs_handle *fshdl,
+                                         const char *path,
+                                         unsigned int *num_entries)
+{
+    void *buf, *curr;
+    int ret;
+    char *names;
+    struct xenhypfs_dirent *ret_buf = NULL, *dirent;
+    unsigned int n = 0, name_sz = 0;
+    struct xen_hypfs_dirlistentry *entry;
+
+    buf = xenhypfs_read_raw(fshdl, path, &dirent);
+    if (!buf)
+        goto out;
+
+    if (dirent->type != xenhypfs_type_dir ||
+        dirent->encoding != xenhypfs_enc_plain) {
+        errno = ENOTDIR;
+        goto out;
+    }
+
+    if (dirent->size) {
+        curr = buf;
+        for (n = 1;; n++) {
+            entry = curr;
+            name_sz += strlen(entry->name) + 1;
+            if (!entry->off_next)
+                break;
+
+            curr += entry->off_next;
+        }
+    }
+
+    ret_buf = malloc(n * sizeof(*ret_buf) + name_sz);
+    if (!ret_buf)
+        goto out;
+
+    *num_entries = n;
+    names = (char *)(ret_buf + n);
+    curr = buf;
+    for (n = 0; n < *num_entries; n++) {
+        entry = curr;
+        xenhypfs_set_attrs(&entry->e, ret_buf + n);
+        ret_buf[n].name = names;
+        strcpy(names, entry->name);
+        names += strlen(entry->name) + 1;
+        curr += entry->off_next;
+    }
+
+ out:
+    ret = errno;
+    free(buf);
+    free(dirent);
+    errno = ret;
+
+    return ret_buf;
+}
+
+int xenhypfs_write(xenhypfs_handle *fshdl, const char *path, const char *val)
+{
+    void *buf = NULL;
+    char *path_buf = NULL, *val_end;
+    int ret, saved_errno;
+    int sz, path_sz;
+    struct xen_hypfs_direntry *entry;
+    uint64_t mask;
+
+    ret = xenhypfs_get_pathbuf(fshdl, path, &path_buf);
+    if (ret < 0)
+        goto out;
+
+    path_sz = ret;
+    ret = -1;
+
+    sz = BUF_SIZE;
+    buf = xencall_alloc_buffer(fshdl->xcall, sz);
+    if (!buf) {
+        errno = ENOMEM;
+        goto out;
+    }
+
+    ret = xencall5(fshdl->xcall, __HYPERVISOR_hypfs_op, XEN_HYPFS_OP_read,
+                   (unsigned long)path_buf, path_sz,
+                   (unsigned long)buf, sizeof(*entry));
+    if (ret && errno != ENOBUFS)
+        goto out;
+    ret = -1;
+    entry = buf;
+    if (!entry->max_write_len) {
+        errno = EACCES;
+        goto out;
+    }
+    if (entry->encoding != XEN_HYPFS_ENC_PLAIN) {
+        /* Writing compressed data currently not supported. */
+        errno = EDOM;
+        goto out;
+    }
+
+    switch (entry->type) {
+    case XEN_HYPFS_TYPE_STRING:
+        if (sz < strlen(val) + 1) {
+            sz = strlen(val) + 1;
+            xencall_free_buffer(fshdl->xcall, buf);
+            buf = xencall_alloc_buffer(fshdl->xcall, sz);
+            if (!buf) {
+                errno = ENOMEM;
+                goto out;
+            }
+        }
+        sz = strlen(val) + 1;
+        strcpy(buf, val);
+        break;
+    case XEN_HYPFS_TYPE_UINT:
+        sz = entry->content_len;
+        errno = 0;
+        *(unsigned long long *)buf = strtoull(val, &val_end, 0);
+        if (errno || !*val || *val_end)
+            goto out;
+        mask = ~0ULL << (8 * sz);
+        if ((*(uint64_t *)buf & mask) && ((*(uint64_t *)buf & mask) != mask)) {
+            errno = ERANGE;
+            goto out;
+        }
+        break;
+    case XEN_HYPFS_TYPE_INT:
+        sz = entry->content_len;
+        errno = 0;
+        *(unsigned long long *)buf = strtoll(val, &val_end, 0);
+        if (errno || !*val || *val_end)
+            goto out;
+        mask = (sz == 8) ? 0 : ~0ULL << (8 * sz);
+        if ((*(uint64_t *)buf & mask) && ((*(uint64_t *)buf & mask) != mask)) {
+            errno = ERANGE;
+            goto out;
+        }
+        break;
+    case XEN_HYPFS_TYPE_BOOL:
+        sz = entry->content_len;
+        *(unsigned long long *)buf = 0;
+        if (!strcmp(val, "1") || !strcmp(val, "on") || !strcmp(val, "yes") ||
+            !strcmp(val, "true") || !strcmp(val, "enable"))
+            *(unsigned long long *)buf = 1;
+        else if (strcmp(val, "0") && strcmp(val, "no") && strcmp(val, "off") &&
+                 strcmp(val, "false") && strcmp(val, "disable")) {
+            errno = EDOM;
+            goto out;
+        }
+        break;
+    default:
+        /* No support for other types (yet). */
+        errno = EDOM;
+        goto out;
+    }
+
+    ret = xencall5(fshdl->xcall, __HYPERVISOR_hypfs_op,
+                   XEN_HYPFS_OP_write_contents,
+                   (unsigned long)path_buf, path_sz,
+                   (unsigned long)buf, sz);
+
+ out:
+    saved_errno = errno;
+    xencall_free_buffer(fshdl->xcall, path_buf);
+    xencall_free_buffer(fshdl->xcall, buf);
+    errno = saved_errno;
+    return ret;
+}
diff --git a/tools/libs/hypfs/include/xenhypfs.h b/tools/libs/hypfs/include/xenhypfs.h
new file mode 100644
index 0000000000..ab157edceb
--- /dev/null
+++ b/tools/libs/hypfs/include/xenhypfs.h
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2019 SUSE Software Solutions Germany GmbH
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef XENHYPFS_H
+#define XENHYPFS_H
+
+#include <stdbool.h>
+#include <stdint.h>
+#include <sys/types.h>
+
+/* Callers who don't care don't need to #include <xentoollog.h> */
+struct xentoollog_logger;
+
+typedef struct xenhypfs_handle xenhypfs_handle;
+
+struct xenhypfs_dirent {
+    char *name;
+    size_t size;
+    enum {
+        xenhypfs_type_dir,
+        xenhypfs_type_blob,
+        xenhypfs_type_string,
+        xenhypfs_type_uint,
+        xenhypfs_type_int,
+        xenhypfs_type_bool
+    } type;
+    enum {
+        xenhypfs_enc_plain,
+        xenhypfs_enc_gzip
+    } encoding;
+    bool is_writable;
+};
+
+xenhypfs_handle *xenhypfs_open(struct xentoollog_logger *logger,
+                               unsigned int open_flags);
+int xenhypfs_close(xenhypfs_handle *fshdl);
+
+/*
+ * Return the raw contents of a Xen hypfs entry and its dirent containing
+ * the size, type and encoding.
+ * Returned buffer and dirent should be freed via free().
+ */
+void *xenhypfs_read_raw(xenhypfs_handle *fshdl, const char *path,
+                        struct xenhypfs_dirent **dirent);
+
+/*
+ * Return the contents of a Xen hypfs entry as a string.
+ * Returned buffer should be freed via free().
+ */
+char *xenhypfs_read(xenhypfs_handle *fshdl, const char *path);
+
+/*
+ * Return the contents of a Xen hypfs directory in form of an array of
+ * dirents.
+ * Returned buffer should be freed via free().
+ */
+struct xenhypfs_dirent *xenhypfs_readdir(xenhypfs_handle *fshdl,
+                                         const char *path,
+                                         unsigned int *num_entries);
+
+/*
+ * Write a Xen hypfs entry with a value. The value is converted from a string
+ * to the appropriate type.
+ */
+int xenhypfs_write(xenhypfs_handle *fshdl, const char *path, const char *val);
+
+#endif /* XENHYPFS_H */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/tools/libs/hypfs/libxenhypfs.map b/tools/libs/hypfs/libxenhypfs.map
new file mode 100644
index 0000000000..47f1edda3e
--- /dev/null
+++ b/tools/libs/hypfs/libxenhypfs.map
@@ -0,0 +1,10 @@
+VERS_1.0 {
+	global:
+		xenhypfs_open;
+		xenhypfs_close;
+		xenhypfs_read_raw;
+		xenhypfs_read;
+		xenhypfs_readdir;
+		xenhypfs_write;
+	local: *; /* Do not expose anything by default */
+};
diff --git a/tools/libs/hypfs/xenhypfs.pc.in b/tools/libs/hypfs/xenhypfs.pc.in
new file mode 100644
index 0000000000..92a262c7a2
--- /dev/null
+++ b/tools/libs/hypfs/xenhypfs.pc.in
@@ -0,0 +1,10 @@
+prefix=@@prefix@@
+includedir=@@incdir@@
+libdir=@@libdir@@
+
+Name: Xenhypfs
+Description: The Xenhypfs library for Xen hypervisor
+Version: @@version@@
+Cflags: -I${includedir} @@cflagslocal@@
+Libs: @@libsflag@@${libdir} -lxenhypfs
+Requires.private: xentoolcore,xentoollog,xencall,z
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jun 06 23:55:46 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Jun 2020 23: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 1jhifC-0005fB-04; Sat, 06 Jun 2020 23: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=x7q/=7T=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhifB-0005ez-IG
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:55:45 +0000
X-Inumbo-ID: 3be739ae-a851-11ea-b15a-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 3be739ae-a851-11ea-b15a-12813bfff9fa;
 Sat, 06 Jun 2020 23: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=rwk0qiTFnO7QwDtlBSyd2AYFzNBQUdfOkfJk03UerHw=; b=GZ68jFrOS7Grp5IM6w2DoLHDrI
 UOVhEopgzYOZQqVHvaka4odHVAVl4xQQxjtpQfyZ4s8JmFOFg1BbPDU47W9Gz3mF+ZtuMzC+3774C
 YRhIrpdccRoWBKlZMWXDRVCtzBy0kHvf3AEbrsfTH+uNNPU3is7Uw4gKp2GT8nZMLRwg=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhif9-0002RP-Pl
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:55:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhif9-0006bt-Ow
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:55:43 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] tools: add xenfs tool
Message-Id: <E1jhif9-0006bt-Ow@xenbits.xenproject.org>
Date: Sat, 06 Jun 2020 23:55: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 ef716e1dc6206adc5e2a181fe0e20dfd6072bf4c
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri May 29 10:20:32 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri May 29 10:25:02 2020 +0200

    tools: add xenfs tool
    
    Add the xenfs tool for accessing the hypervisor filesystem.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Wei Liu <wl@xen.org>
---
 .gitignore              |   1 +
 docs/man/xenhypfs.1.pod |  60 +++++++++++++++
 tools/misc/Makefile     |   6 ++
 tools/misc/xenhypfs.c   | 192 ++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 259 insertions(+)

diff --git a/.gitignore b/.gitignore
index abf13df5ec..f5f9770de9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -368,6 +368,7 @@ tools/libxl/test_timedereg
 tools/libxl/test_fdderegrace
 tools/firmware/etherboot/eb-roms.h
 tools/firmware/etherboot/gpxe-git-snapshot.tar.gz
+tools/misc/xenhypfs
 tools/misc/xenwatchdogd
 tools/misc/xen-hvmcrash
 tools/misc/xen-lowmemd
diff --git a/docs/man/xenhypfs.1.pod b/docs/man/xenhypfs.1.pod
new file mode 100644
index 0000000000..d5553b1150
--- /dev/null
+++ b/docs/man/xenhypfs.1.pod
@@ -0,0 +1,60 @@
+=head1 NAME
+
+xenhypfs - Xen tool to access Xen hypervisor file system
+
+=head1 SYNOPSIS
+
+B<xenhypfs> I<subcommand> [I<options>] [I<args>]
+
+=head1 DESCRIPTION
+
+The B<xenhypfs> program is used to access the Xen hypervisor file system.
+It can be used to show the available entries, to show their contents and
+(if allowed) to modify their contents.
+
+=head1 SUBCOMMANDS
+
+=over 4
+
+=item B<ls> I<path>
+
+List the available entries below I<path>.
+
+=item B<cat> [I<-b>] I<path>
+
+Show the contents of the entry specified by I<path>. Non-printable characters
+other than white space characters (like tab, new line) will be shown as
+B<\xnn> (B<nn> being a two digit hex number) unless the option B<-b> is
+specified.
+
+=item B<write> I<path> I<value>
+
+Set the contents of the entry specified by I<path> to I<value>.
+
+=item B<tree>
+
+Show all the entries of the file system as a tree.
+
+=back
+
+=head1 RETURN CODES
+
+=over 4
+
+=item B<0>
+
+Success
+
+=item B<1>
+
+Invalid usage (e.g. unknown subcommand, unknown option, missing parameter).
+
+=item B<2>
+
+Entry not found while traversing the tree.
+
+=item B<3>
+
+Access right violation.
+
+=back
diff --git a/tools/misc/Makefile b/tools/misc/Makefile
index 63947bfadc..9fdb13597f 100644
--- a/tools/misc/Makefile
+++ b/tools/misc/Makefile
@@ -24,6 +24,7 @@ INSTALL_SBIN-$(CONFIG_X86)     += xen-lowmemd
 INSTALL_SBIN-$(CONFIG_X86)     += xen-mfndump
 INSTALL_SBIN-$(CONFIG_X86)     += xen-ucode
 INSTALL_SBIN                   += xencov
+INSTALL_SBIN                   += xenhypfs
 INSTALL_SBIN                   += xenlockprof
 INSTALL_SBIN                   += xenperf
 INSTALL_SBIN                   += xenpm
@@ -86,6 +87,9 @@ xenperf: xenperf.o
 xenpm: xenpm.o
 	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
 
+xenhypfs: xenhypfs.o
+	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenhypfs) $(APPEND_LDFLAGS)
+
 xenlockprof: xenlockprof.o
 	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
 
@@ -94,6 +98,8 @@ xen-hptool.o: CFLAGS += -I$(XEN_ROOT)/tools/libxc $(CFLAGS_libxencall)
 xen-hptool: xen-hptool.o
 	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenevtchn) $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore) $(APPEND_LDFLAGS)
 
+xenhypfs.o: CFLAGS += $(CFLAGS_libxenhypfs)
+
 # xen-mfndump incorrectly uses libxc internals
 xen-mfndump.o: CFLAGS += -I$(XEN_ROOT)/tools/libxc $(CFLAGS_libxencall)
 xen-mfndump: xen-mfndump.o
diff --git a/tools/misc/xenhypfs.c b/tools/misc/xenhypfs.c
new file mode 100644
index 0000000000..158b901f42
--- /dev/null
+++ b/tools/misc/xenhypfs.c
@@ -0,0 +1,192 @@
+#define _GNU_SOURCE
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <xenhypfs.h>
+
+static struct xenhypfs_handle *hdl;
+
+static int usage(void)
+{
+    fprintf(stderr, "usage: xenhypfs ls <path>\n");
+    fprintf(stderr, "       xenhypfs cat [-b] <path>\n");
+    fprintf(stderr, "       xenhypfs write <path> <val>\n");
+    fprintf(stderr, "       xenhypfs tree\n");
+
+    return 1;
+}
+
+static void xenhypfs_print_escaped(char *string)
+{
+    char *c;
+
+    for (c = string; *c; c++) {
+        if (isgraph(*c) || isspace(*c))
+            printf("%c", *c);
+        else
+            printf("\\x%02x", *c);
+    }
+    printf("\n");
+}
+
+static int xenhypfs_cat(int argc, char *argv[])
+{
+    int ret = 0;
+    char *result;
+    char *path;
+    bool bin = false;
+
+    switch (argc) {
+    case 1:
+        path = argv[0];
+        break;
+
+    case 2:
+        if (strcmp(argv[0], "-b"))
+            return usage();
+        bin = true;
+        path = argv[1];
+        break;
+
+    default:
+        return usage();
+    }
+
+    result = xenhypfs_read(hdl, path);
+    if (!result) {
+        perror("could not read");
+        ret = 3;
+    } else {
+        if (!bin)
+            printf("%s\n", result);
+        else
+            xenhypfs_print_escaped(result);
+        free(result);
+    }
+
+    return ret;
+}
+
+static int xenhypfs_wr(char *path, char *val)
+{
+    int ret;
+
+    ret = xenhypfs_write(hdl, path, val);
+    if (ret) {
+        perror("could not write");
+        ret = 3;
+    }
+
+    return ret;
+}
+
+static char *xenhypfs_type(struct xenhypfs_dirent *ent)
+{
+    char *res;
+
+    switch (ent->type) {
+    case xenhypfs_type_dir:
+        res = "<dir>   ";
+        break;
+    case xenhypfs_type_blob:
+        res = "<blob>  ";
+        break;
+    case xenhypfs_type_string:
+        res = "<string>";
+        break;
+    case xenhypfs_type_uint:
+        res = "<uint>  ";
+        break;
+    case xenhypfs_type_int:
+        res = "<int>   ";
+        break;
+    case xenhypfs_type_bool:
+        res = "<bool>  ";
+        break;
+    default:
+        res = "<\?\?\?>   ";
+        break;
+    }
+
+    return res;
+}
+
+static int xenhypfs_ls(char *path)
+{
+    struct xenhypfs_dirent *ent;
+    unsigned int n, i;
+    int ret = 0;
+
+    ent = xenhypfs_readdir(hdl, path, &n);
+    if (!ent) {
+        perror("could not read dir");
+        ret = 3;
+    } else {
+        for (i = 0; i < n; i++)
+            printf("%s r%c %s\n", xenhypfs_type(ent + i),
+                   ent[i].is_writable ? 'w' : '-', ent[i].name);
+
+        free(ent);
+    }
+
+    return ret;
+}
+
+static int xenhypfs_tree_sub(char *path, unsigned int depth)
+{
+    struct xenhypfs_dirent *ent;
+    unsigned int n, i;
+    int ret = 0;
+    char *p;
+
+    ent = xenhypfs_readdir(hdl, path, &n);
+    if (!ent)
+        return 2;
+
+    for (i = 0; i < n; i++) {
+        printf("%*s%s%s\n", depth * 2, "", ent[i].name,
+               ent[i].type == xenhypfs_type_dir ? "/" : "");
+        if (ent[i].type == xenhypfs_type_dir) {
+            asprintf(&p, "%s%s%s", path, (depth == 1) ? "" : "/", ent[i].name);
+            if (xenhypfs_tree_sub(p, depth + 1))
+                ret = 2;
+        }
+    }
+
+    free(ent);
+
+    return ret;
+}
+
+static int xenhypfs_tree(void)
+{
+    printf("/\n");
+
+    return xenhypfs_tree_sub("/", 1);
+}
+
+int main(int argc, char *argv[])
+{
+    int ret;
+
+    hdl = xenhypfs_open(NULL, 0);
+
+    if (!hdl) {
+        fprintf(stderr, "Could not open libxenhypfs\n");
+        ret = 2;
+    } else if (argc >= 3 && !strcmp(argv[1], "cat"))
+        ret = xenhypfs_cat(argc - 2, argv + 2);
+    else if (argc == 3 && !strcmp(argv[1], "ls"))
+        ret = xenhypfs_ls(argv[2]);
+    else if (argc == 4 && !strcmp(argv[1], "write"))
+        ret = xenhypfs_wr(argv[2], argv[3]);
+    else if (argc == 2 && !strcmp(argv[1], "tree"))
+        ret = xenhypfs_tree();
+    else
+        ret = usage();
+
+    xenhypfs_close(hdl);
+
+    return ret;
+}
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jun 06 23:55:55 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Jun 2020 23:55:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jhifL-0005gn-3S; Sat, 06 Jun 2020 23:55: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=x7q/=7T=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhifK-0005ge-Lf
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:55:54 +0000
X-Inumbo-ID: 41e856c6-a851-11ea-b15a-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 41e856c6-a851-11ea-b15a-12813bfff9fa;
 Sat, 06 Jun 2020 23:55: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=1Z9tduNVO/PMbJ1m/lrlogjIoz0jhd/kEbqUUDcIMvc=; b=FSVwgfzYVMegRUC4JBcmMiEd5Y
 uGZww7LKQki9dDiptQiOfRFFAGcdUvmrkEMEFjDxM1PGBkP0pi4oJWa9nyrcwJT3ZMA/AhZM0WSeU
 nC9iJwRN/R1RLmzMX6rkVcH85wrbqzP+KEYWU5zWXNOI4/ccoScaHNmaJYu0LyEBxxLM=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhifJ-0002Rb-T8
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:55:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhifJ-0006cS-S3
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:55:53 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] xen/hypfs: make struct hypfs_entry_leaf initializers
 work with gcc 4.1
Message-Id: <E1jhifJ-0006cS-S3@xenbits.xenproject.org>
Date: Sat, 06 Jun 2020 23:55: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 048f82ccd1b3dda511af25a7a8524c8ba5ca2786
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri May 29 12:14:24 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri May 29 12:14:24 2020 +0200

    xen/hypfs: make struct hypfs_entry_leaf initializers work with gcc 4.1
    
    gcc 4.1 has problems with static initializers for anonymous unions.
    Fix this by naming the union in struct hypfs_entry_leaf.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/hypfs.c      | 8 ++++----
 xen/include/xen/hypfs.h | 6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/xen/common/hypfs.c b/xen/common/hypfs.c
index 9c2213a068..a111c2f86d 100644
--- a/xen/common/hypfs.c
+++ b/xen/common/hypfs.c
@@ -126,7 +126,7 @@ int hypfs_add_leaf(struct hypfs_entry_dir *parent,
 {
     int ret;
 
-    if ( !leaf->content )
+    if ( !leaf->u.content )
         ret = -EINVAL;
     else
         ret = add_entry(parent, &leaf->e);
@@ -255,7 +255,7 @@ int hypfs_read_leaf(const struct hypfs_entry *entry,
 
     l = container_of(entry, const struct hypfs_entry_leaf, e);
 
-    return copy_to_guest(uaddr, l->content, entry->size) ? -EFAULT: 0;
+    return copy_to_guest(uaddr, l->u.content, entry->size) ? -EFAULT: 0;
 }
 
 static int hypfs_read(const struct hypfs_entry *entry,
@@ -317,7 +317,7 @@ int hypfs_write_leaf(struct hypfs_entry_leaf *leaf,
         goto out;
 
     ret = 0;
-    memcpy(leaf->write_ptr, buf, ulen);
+    memcpy(leaf->u.write_ptr, buf, ulen);
     leaf->e.size = ulen;
 
  out:
@@ -341,7 +341,7 @@ int hypfs_write_bool(struct hypfs_entry_leaf *leaf,
     if ( copy_from_guest(&buf, uaddr, ulen) )
         return -EFAULT;
 
-    *(bool *)leaf->write_ptr = buf;
+    *(bool *)leaf->u.write_ptr = buf;
 
     return 0;
 }
diff --git a/xen/include/xen/hypfs.h b/xen/include/xen/hypfs.h
index 5c6a0ccece..39845ec5ae 100644
--- a/xen/include/xen/hypfs.h
+++ b/xen/include/xen/hypfs.h
@@ -26,7 +26,7 @@ struct hypfs_entry_leaf {
     union {
         const void *content;
         void *write_ptr;
-    };
+    } u;
 };
 
 struct hypfs_entry_dir {
@@ -68,7 +68,7 @@ struct hypfs_entry_dir {
 static inline void hypfs_string_set_reference(struct hypfs_entry_leaf *leaf,
                                               const char *str)
 {
-    leaf->content = str;
+    leaf->u.content = str;
     leaf->e.size = strlen(str) + 1;
 }
 
@@ -81,7 +81,7 @@ static inline void hypfs_string_set_reference(struct hypfs_entry_leaf *leaf,
         .e.max_size = (wr) ? sizeof(contvar) : 0,        \
         .e.read = hypfs_read_leaf,                       \
         .e.write = (wr),                                 \
-        .content = &(contvar),                           \
+        .u.content = &(contvar),                         \
     }
 
 #define HYPFS_UINT_INIT(var, nam, contvar)                       \
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jun 06 23:56:06 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Jun 2020 23: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 1jhifW-0005in-53; Sat, 06 Jun 2020 23:56:06 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=x7q/=7T=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhifV-0005ib-E1
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:56:05 +0000
X-Inumbo-ID: 47ebaeb0-a851-11ea-96fb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 47ebaeb0-a851-11ea-96fb-bc764e2007e4;
 Sat, 06 Jun 2020 23:56: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=+INeAUYXxwXZ3t6IE3aHW9Nxzc2nLPArMyuCqUpNluc=; b=GEGbQZYeRp50g1AZ3lZToWxkVn
 xYUS27tzAP0Xs0rJq78NJxcGj8TOa7si12PPKuAM1EPGFRN4NT3fs9VPdZCUuRB+gTdwq9J2VpI/v
 b1YJjK6WI/qbah+OmT7mpYpvkQBJpq+mcWF/yiPO62r9IHtI3H4N6/9ZehglqP9d9BMo=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhifU-0002Rx-00
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:56:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhifT-0006dN-VP
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:56:03 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] xen: provide version information in hypfs
Message-Id: <E1jhifT-0006dN-VP@xenbits.xenproject.org>
Date: Sat, 06 Jun 2020 23:56: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 b5d4711d2b17753498a3f587585f11bf9ca5af85
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri May 29 12:14:51 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri May 29 12:14:51 2020 +0200

    xen: provide version information in hypfs
    
    Provide version and compile information in /buildinfo/ node of the
    Xen hypervisor file system. As this information is accessible by dom0
    only no additional security problem arises.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 docs/misc/hypfs-paths.pandoc | 45 ++++++++++++++++++++++++++++++++++++++++++
 xen/common/kernel.c          | 47 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 92 insertions(+)

diff --git a/docs/misc/hypfs-paths.pandoc b/docs/misc/hypfs-paths.pandoc
index 39539fa1b5..d730caf394 100644
--- a/docs/misc/hypfs-paths.pandoc
+++ b/docs/misc/hypfs-paths.pandoc
@@ -105,3 +105,48 @@ A populated Xen hypervisor file system might look like the following example:
 #### /
 
 The root of the hypervisor file system.
+
+#### /buildinfo/
+
+A directory containing static information generated while building the
+hypervisor.
+
+#### /buildinfo/changeset = STRING
+
+Git commit of the hypervisor.
+
+#### /buildinfo/compileinfo/
+
+A directory containing information about compilation of Xen.
+
+#### /buildinfo/compileinfo/compile_by = STRING
+
+Information who compiled the hypervisor.
+
+#### /buildinfo/compileinfo/compile_date = STRING
+
+Date of the hypervisor compilation.
+
+#### /buildinfo/compileinfo/compile_domain = STRING
+
+Information about the compile domain.
+
+#### /buildinfo/compileinfo/compiler = STRING
+
+The compiler used to build Xen.
+
+#### /buildinfo/version/
+
+A directory containing version information of the hypervisor.
+
+#### /buildinfo/version/extra = STRING
+
+Extra version information.
+
+#### /buildinfo/version/major = INTEGER
+
+The major version of Xen.
+
+#### /buildinfo/version/minor = INTEGER
+
+The minor version of Xen.
diff --git a/xen/common/kernel.c b/xen/common/kernel.c
index 572e3fc07d..db7bd23fcb 100644
--- a/xen/common/kernel.c
+++ b/xen/common/kernel.c
@@ -13,6 +13,7 @@
 #include <xen/paging.h>
 #include <xen/guest_access.h>
 #include <xen/hypercall.h>
+#include <xen/hypfs.h>
 #include <xsm/xsm.h>
 #include <asm/current.h>
 #include <public/version.h>
@@ -373,6 +374,52 @@ void __init do_initcalls(void)
         (*call)();
 }
 
+#ifdef CONFIG_HYPFS
+static unsigned int __read_mostly major_version;
+static unsigned int __read_mostly minor_version;
+
+static HYPFS_DIR_INIT(buildinfo, "buildinfo");
+static HYPFS_DIR_INIT(compileinfo, "compileinfo");
+static HYPFS_DIR_INIT(version, "version");
+static HYPFS_UINT_INIT(major, "major", major_version);
+static HYPFS_UINT_INIT(minor, "minor", minor_version);
+static HYPFS_STRING_INIT(changeset, "changeset");
+static HYPFS_STRING_INIT(compiler, "compiler");
+static HYPFS_STRING_INIT(compile_by, "compile_by");
+static HYPFS_STRING_INIT(compile_date, "compile_date");
+static HYPFS_STRING_INIT(compile_domain, "compile_domain");
+static HYPFS_STRING_INIT(extra, "extra");
+
+static int __init buildinfo_init(void)
+{
+    hypfs_add_dir(&hypfs_root, &buildinfo, true);
+
+    hypfs_string_set_reference(&changeset, xen_changeset());
+    hypfs_add_leaf(&buildinfo, &changeset, true);
+
+    hypfs_add_dir(&buildinfo, &compileinfo, true);
+    hypfs_string_set_reference(&compiler, xen_compiler());
+    hypfs_string_set_reference(&compile_by, xen_compile_by());
+    hypfs_string_set_reference(&compile_date, xen_compile_date());
+    hypfs_string_set_reference(&compile_domain, xen_compile_domain());
+    hypfs_add_leaf(&compileinfo, &compiler, true);
+    hypfs_add_leaf(&compileinfo, &compile_by, true);
+    hypfs_add_leaf(&compileinfo, &compile_date, true);
+    hypfs_add_leaf(&compileinfo, &compile_domain, true);
+
+    major_version = xen_major_version();
+    minor_version = xen_minor_version();
+    hypfs_add_dir(&buildinfo, &version, true);
+    hypfs_string_set_reference(&extra, xen_extra_version());
+    hypfs_add_leaf(&version, &extra, true);
+    hypfs_add_leaf(&version, &major, true);
+    hypfs_add_leaf(&version, &minor, true);
+
+    return 0;
+}
+__initcall(buildinfo_init);
+#endif
+
 # define DO(fn) long do_##fn
 
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jun 06 23:56:16 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Jun 2020 23:56: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 1jhifg-0005kV-6c; Sat, 06 Jun 2020 23:56:16 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=x7q/=7T=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhife-0005kC-Rh
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:56:14 +0000
X-Inumbo-ID: 4dee9e94-a851-11ea-96fb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 4dee9e94-a851-11ea-96fb-bc764e2007e4;
 Sat, 06 Jun 2020 23:56: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=U8qFuNAU60arTaPjpjHzl+bqhGi3qdHTsFuQRX9ofm8=; b=R9B2ZzwzvTz0l3tcjGWc/myZCs
 Mvu/IL1+PeQEMVwqnas2VO/85g0xydyeLMQ1pkK8SorDpI/+i1pi7zxOloJN1SaSEqU1sPkcrssE4
 OrAV9x3ZqsOB5lespuj8ijZNgWNtMjZbSUsmqNDHA8e6PXWO/nx6GIRswEiUNJ+gQBDQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhife-0002S6-3A
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:56:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhife-0006fR-2P
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:56:14 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] xen: add /buildinfo/config entry to hypervisor filesystem
Message-Id: <E1jhife-0006fR-2P@xenbits.xenproject.org>
Date: Sat, 06 Jun 2020 23:56: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 58263ed7713e8132c2bc00bc870399ea31bf2231
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri May 29 12:15:54 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri May 29 12:15:54 2020 +0200

    xen: add /buildinfo/config entry to hypervisor filesystem
    
    Add the /buildinfo/config entry to the hypervisor filesystem. This
    entry contains the .config file used to build the hypervisor.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 .gitignore                   |  2 ++
 docs/misc/hypfs-paths.pandoc |  4 ++++
 xen/common/Kconfig           | 11 +++++++++++
 xen/common/Makefile          | 12 ++++++++++++
 xen/common/kernel.c          | 11 +++++++++++
 xen/include/xen/kernel.h     |  3 +++
 6 files changed, 43 insertions(+)

diff --git a/.gitignore b/.gitignore
index f5f9770de9..36ce2ea104 100644
--- a/.gitignore
+++ b/.gitignore
@@ -298,6 +298,8 @@ xen/arch/*/efi/boot.c
 xen/arch/*/efi/compat.c
 xen/arch/*/efi/efi.h
 xen/arch/*/efi/runtime.c
+xen/common/config_data.S
+xen/common/config.gz
 xen/include/headers*.chk
 xen/include/asm
 xen/include/asm-*/asm-offsets.h
diff --git a/docs/misc/hypfs-paths.pandoc b/docs/misc/hypfs-paths.pandoc
index d730caf394..9a76bc383b 100644
--- a/docs/misc/hypfs-paths.pandoc
+++ b/docs/misc/hypfs-paths.pandoc
@@ -135,6 +135,10 @@ Information about the compile domain.
 
 The compiler used to build Xen.
 
+#### /buildinfo/config = STRING [CONFIG_HYPFS_CONFIG]
+
+The contents of the `xen/.config` file at the time of the hypervisor build.
+
 #### /buildinfo/version/
 
 A directory containing version information of the hypervisor.
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index e768ea36b2..065f2ee454 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -127,6 +127,17 @@ config HYPFS
 
 	  If unsure, say Y.
 
+config HYPFS_CONFIG
+	bool "Provide hypervisor .config via hypfs entry"
+	default y
+	depends on HYPFS
+	---help---
+	  When enabled the contents of the .config file used to build the
+	  hypervisor are provided via the hypfs entry /buildinfo/config.
+
+	  Disable this option in case you want to spare some memory or you
+	  want to hide the .config contents from dom0.
+
 config KEXEC
 	bool "kexec support"
 	default y
diff --git a/xen/common/Makefile b/xen/common/Makefile
index bf7d0e25a3..91581e1815 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -1,6 +1,7 @@
 obj-$(CONFIG_ARGO) += argo.o
 obj-y += bitmap.o
 obj-y += bsearch.o
+obj-$(CONFIG_HYPFS_CONFIG) += config_data.o
 obj-$(CONFIG_CORE_PARKING) += core_parking.o
 obj-y += cpu.o
 obj-$(CONFIG_DEBUG_TRACE) += debugtrace.o
@@ -73,3 +74,14 @@ obj-$(CONFIG_UBSAN) += ubsan/
 
 obj-$(CONFIG_NEEDS_LIBELF) += libelf/
 obj-$(CONFIG_HAS_DEVICE_TREE) += libfdt/
+
+config.gz: ../.config
+	gzip -c $< >$@
+
+config_data.o: config.gz
+
+config_data.S: $(XEN_ROOT)/xen/tools/binfile
+	$(SHELL) $(XEN_ROOT)/xen/tools/binfile $@ config.gz xen_config_data
+
+clean::
+	rm -f config_data.S config.gz 2>/dev/null
diff --git a/xen/common/kernel.c b/xen/common/kernel.c
index db7bd23fcb..0fb5b50b45 100644
--- a/xen/common/kernel.c
+++ b/xen/common/kernel.c
@@ -390,6 +390,10 @@ static HYPFS_STRING_INIT(compile_date, "compile_date");
 static HYPFS_STRING_INIT(compile_domain, "compile_domain");
 static HYPFS_STRING_INIT(extra, "extra");
 
+#ifdef CONFIG_HYPFS_CONFIG
+static HYPFS_STRING_INIT(config, "config");
+#endif
+
 static int __init buildinfo_init(void)
 {
     hypfs_add_dir(&hypfs_root, &buildinfo, true);
@@ -415,6 +419,13 @@ static int __init buildinfo_init(void)
     hypfs_add_leaf(&version, &major, true);
     hypfs_add_leaf(&version, &minor, true);
 
+#ifdef CONFIG_HYPFS_CONFIG
+    config.e.encoding = XEN_HYPFS_ENC_GZIP;
+    config.e.size = xen_config_data_size;
+    config.u.content = xen_config_data;
+    hypfs_add_leaf(&buildinfo, &config, true);
+#endif
+
     return 0;
 }
 __initcall(buildinfo_init);
diff --git a/xen/include/xen/kernel.h b/xen/include/xen/kernel.h
index 548b64da9f..8cd142032d 100644
--- a/xen/include/xen/kernel.h
+++ b/xen/include/xen/kernel.h
@@ -100,5 +100,8 @@ extern enum system_state {
 
 bool_t is_active_kernel_text(unsigned long addr);
 
+extern const char xen_config_data[];
+extern const unsigned int xen_config_data_size;
+
 #endif /* _LINUX_KERNEL_H */
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jun 06 23:56:27 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Jun 2020 23:56:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jhifr-0005m6-8H; Sat, 06 Jun 2020 23:56: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=x7q/=7T=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhifp-0005ls-Ul
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:56:26 +0000
X-Inumbo-ID: 53f6b7cc-a851-11ea-9ad7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 53f6b7cc-a851-11ea-9ad7-bc764e2007e4;
 Sat, 06 Jun 2020 23:56: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=8858u5uTRZqnJiyy0/AqbgDgf2nN43DGjnqBD96zOwc=; b=dTG9mvHeGe2KJiHjd1D4kPubhl
 j8o1fraIDtzg3khDhZukIP/THZVmb9Zer9qVnm6xSRG3PHTOkH2wNbTOV36uGAxchzUJ9ubCn/72+
 LkoqqpqjXzhWM0jRAzn/BeZQa0SNKAtFO6AecJlZNBs1PTnzi0B3VdUhqyJ4yxPRdhHU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhifo-0002SF-6z
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:56:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhifo-000777-64
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:56:24 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] xen: add runtime parameter access support to hypfs
Message-Id: <E1jhifo-000777-64@xenbits.xenproject.org>
Date: Sat, 06 Jun 2020 23:56: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 a659d7cab9afcba337cb60225738fd85ff7aa3da
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri May 29 12:18:36 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri May 29 12:18:36 2020 +0200

    xen: add runtime parameter access support to hypfs
    
    Add support to read and modify values of hypervisor runtime parameters
    via the hypervisor file system.
    
    As runtime parameters can be modified via a sysctl, too, this path has
    to take the hypfs rw_lock as writer.
    
    For custom runtime parameters the connection between the parameter
    value and the file system is done via an init function which will set
    the initial value (if needed) and the leaf properties.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 docs/misc/hypfs-paths.pandoc |   9 ++++
 xen/arch/arm/xen.lds.S       |   8 +++
 xen/arch/x86/hvm/vmx/vmcs.c  |  29 ++++++++++-
 xen/arch/x86/pv/domain.c     |  21 +++++++-
 xen/arch/x86/xen.lds.S       |   7 +++
 xen/common/grant_table.c     |  62 ++++++++++++++++++----
 xen/common/hypfs.c           |  34 ++++++++++++-
 xen/common/kernel.c          |  29 ++++++++++-
 xen/drivers/char/console.c   |  72 +++++++++++++++++++++++---
 xen/include/xen/hypfs.h      |   7 +++
 xen/include/xen/param.h      | 119 +++++++++++++++++++++++++++++++++++++++++--
 11 files changed, 372 insertions(+), 25 deletions(-)

diff --git a/docs/misc/hypfs-paths.pandoc b/docs/misc/hypfs-paths.pandoc
index 9a76bc383b..a111c6f25c 100644
--- a/docs/misc/hypfs-paths.pandoc
+++ b/docs/misc/hypfs-paths.pandoc
@@ -154,3 +154,12 @@ The major version of Xen.
 #### /buildinfo/version/minor = INTEGER
 
 The minor version of Xen.
+
+#### /params/
+
+A directory of runtime parameters.
+
+#### /params/*
+
+The individual parameters. The description of the different parameters can be
+found in `docs/misc/xen-command-line.pandoc`.
diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S
index a497f6a48d..549ceb9749 100644
--- a/xen/arch/arm/xen.lds.S
+++ b/xen/arch/arm/xen.lds.S
@@ -89,6 +89,14 @@ SECTIONS
        __start_schedulers_array = .;
        *(.data.schedulers)
        __end_schedulers_array = .;
+
+#ifdef CONFIG_HYPFS
+       . = ALIGN(8);
+       __paramhypfs_start = .;
+       *(.data.paramhypfs)
+       __paramhypfs_end = .;
+#endif
+
        *(.data.rel)
        *(.data.rel.*)
        CONSTRUCTORS
diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index 221af9737a..3410bc5f6d 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -97,6 +97,30 @@ static int __init parse_ept_param(const char *s)
 }
 custom_param("ept", parse_ept_param);
 
+#ifdef CONFIG_HYPFS
+static char opt_ept_setting[10];
+
+static void update_ept_param(void)
+{
+    if ( opt_ept_exec_sp >= 0 )
+        snprintf(opt_ept_setting, sizeof(opt_ept_setting), "exec-sp=%d",
+                 opt_ept_exec_sp);
+}
+
+static void __init init_ept_param(struct param_hypfs *par)
+{
+    update_ept_param();
+    custom_runtime_set_var(par, opt_ept_setting);
+}
+#else
+static void update_ept_param(void)
+{
+}
+#endif
+
+static int parse_ept_param_runtime(const char *s);
+custom_runtime_only_param("ept", parse_ept_param_runtime, init_ept_param);
+
 static int parse_ept_param_runtime(const char *s)
 {
     struct domain *d;
@@ -115,6 +139,10 @@ static int parse_ept_param_runtime(const char *s)
 
     opt_ept_exec_sp = val;
 
+    update_ept_param();
+    custom_runtime_set_var(param_2_parfs(parse_ept_param_runtime),
+                           opt_ept_setting);
+
     rcu_read_lock(&domlist_read_lock);
     for_each_domain ( d )
     {
@@ -144,7 +172,6 @@ static int parse_ept_param_runtime(const char *s)
 
     return 0;
 }
-custom_runtime_only_param("ept", parse_ept_param_runtime);
 
 /* Dynamic (run-time adjusted) execution control flags. */
 u32 vmx_pin_based_exec_control __read_mostly;
diff --git a/xen/arch/x86/pv/domain.c b/xen/arch/x86/pv/domain.c
index 0a4a5bd001..f4e863a410 100644
--- a/xen/arch/x86/pv/domain.c
+++ b/xen/arch/x86/pv/domain.c
@@ -55,6 +55,23 @@ static __read_mostly enum {
     PCID_NOXPTI
 } opt_pcid = PCID_XPTI;
 
+#ifdef CONFIG_HYPFS
+static const char opt_pcid_2_string[][7] = {
+    [PCID_OFF] = "off",
+    [PCID_ALL] = "on",
+    [PCID_XPTI] = "xpti",
+    [PCID_NOXPTI] = "noxpti",
+};
+
+static void __init opt_pcid_init(struct param_hypfs *par)
+{
+    custom_runtime_set_var(par, opt_pcid_2_string[opt_pcid]);
+}
+#endif
+
+static int parse_pcid(const char *s);
+custom_runtime_param("pcid", parse_pcid, opt_pcid_init);
+
 static int parse_pcid(const char *s)
 {
     int rc = 0;
@@ -87,9 +104,11 @@ static int parse_pcid(const char *s)
         break;
     }
 
+    custom_runtime_set_var(param_2_parfs(parse_pcid),
+                           opt_pcid_2_string[opt_pcid]);
+
     return rc;
 }
-custom_runtime_param("pcid", parse_pcid);
 
 static void noreturn continue_nonidle_domain(struct vcpu *v)
 {
diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
index 0e3a733cab..3ed020e26b 100644
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -279,6 +279,13 @@ SECTIONS
        __start_schedulers_array = .;
        *(.data.schedulers)
        __end_schedulers_array = .;
+
+#ifdef CONFIG_HYPFS
+       . = ALIGN(8);
+       __paramhypfs_start = .;
+       *(.data.paramhypfs)
+       __paramhypfs_end = .;
+#endif
   } :text
 
   DECL_SECTION(.data) {
diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index 5ef7ff940d..ece670e484 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -85,8 +85,43 @@ struct grant_table {
     struct grant_table_arch arch;
 };
 
-static int parse_gnttab_limit(const char *param, const char *arg,
-                              unsigned int *valp)
+unsigned int __read_mostly opt_max_grant_frames = 64;
+static unsigned int __read_mostly opt_max_maptrack_frames = 1024;
+
+#ifdef CONFIG_HYPFS
+#define GRANT_CUSTOM_VAL_SZ  12
+static char __read_mostly opt_max_grant_frames_val[GRANT_CUSTOM_VAL_SZ];
+static char __read_mostly opt_max_maptrack_frames_val[GRANT_CUSTOM_VAL_SZ];
+
+static void update_gnttab_par(unsigned int val, struct param_hypfs *par,
+                              char *parval)
+{
+    snprintf(parval, GRANT_CUSTOM_VAL_SZ, "%u", val);
+    custom_runtime_set_var_sz(par, parval, GRANT_CUSTOM_VAL_SZ);
+}
+
+static void __init gnttab_max_frames_init(struct param_hypfs *par)
+{
+    update_gnttab_par(opt_max_grant_frames, par, opt_max_grant_frames_val);
+}
+
+static void __init max_maptrack_frames_init(struct param_hypfs *par)
+{
+    update_gnttab_par(opt_max_maptrack_frames, par,
+                      opt_max_maptrack_frames_val);
+}
+#else
+#define update_gnttab_par(v, unused1, unused2)     update_gnttab_par(v)
+#define parse_gnttab_limit(a, v, unused1, unused2) parse_gnttab_limit(a, v)
+
+static void update_gnttab_par(unsigned int val, struct param_hypfs *par,
+                              char *parval)
+{
+}
+#endif
+
+static int parse_gnttab_limit(const char *arg, unsigned int *valp,
+                              struct param_hypfs *par, char *parval)
 {
     const char *e;
     unsigned long val;
@@ -99,28 +134,33 @@ static int parse_gnttab_limit(const char *param, const char *arg,
         return -ERANGE;
 
     *valp = val;
+    update_gnttab_par(val, par, parval);
 
     return 0;
 }
 
-unsigned int __read_mostly opt_max_grant_frames = 64;
+static int parse_gnttab_max_frames(const char *arg);
+custom_runtime_param("gnttab_max_frames", parse_gnttab_max_frames,
+                     gnttab_max_frames_init);
 
 static int parse_gnttab_max_frames(const char *arg)
 {
-    return parse_gnttab_limit("gnttab_max_frames", arg,
-                              &opt_max_grant_frames);
+    return parse_gnttab_limit(arg, &opt_max_grant_frames,
+                              param_2_parfs(parse_gnttab_max_frames),
+                              opt_max_grant_frames_val);
 }
-custom_runtime_param("gnttab_max_frames", parse_gnttab_max_frames);
 
-static unsigned int __read_mostly opt_max_maptrack_frames = 1024;
+static int parse_gnttab_max_maptrack_frames(const char *arg);
+custom_runtime_param("gnttab_max_maptrack_frames",
+                     parse_gnttab_max_maptrack_frames,
+                     max_maptrack_frames_init);
 
 static int parse_gnttab_max_maptrack_frames(const char *arg)
 {
-    return parse_gnttab_limit("gnttab_max_maptrack_frames", arg,
-                              &opt_max_maptrack_frames);
+    return parse_gnttab_limit(arg, &opt_max_maptrack_frames,
+                              param_2_parfs(parse_gnttab_max_maptrack_frames),
+                              opt_max_maptrack_frames_val);
 }
-custom_runtime_param("gnttab_max_maptrack_frames",
-                     parse_gnttab_max_maptrack_frames);
 
 #ifndef GNTTAB_MAX_VERSION
 #define GNTTAB_MAX_VERSION 2
diff --git a/xen/common/hypfs.c b/xen/common/hypfs.c
index a111c2f86d..b982c74fba 100644
--- a/xen/common/hypfs.c
+++ b/xen/common/hypfs.c
@@ -10,6 +10,7 @@
 #include <xen/hypercall.h>
 #include <xen/hypfs.h>
 #include <xen/lib.h>
+#include <xen/param.h>
 #include <xen/rwlock.h>
 #include <public/hypfs.h>
 
@@ -41,7 +42,7 @@ static void hypfs_read_lock(void)
     this_cpu(hypfs_locked) = hypfs_read_locked;
 }
 
-static void hypfs_write_lock(void)
+void hypfs_write_lock(void)
 {
     ASSERT(this_cpu(hypfs_locked) == hypfs_unlocked);
 
@@ -49,7 +50,7 @@ static void hypfs_write_lock(void)
     this_cpu(hypfs_locked) = hypfs_write_locked;
 }
 
-static void hypfs_unlock(void)
+void hypfs_unlock(void)
 {
     enum hypfs_lock_state locked = this_cpu(hypfs_locked);
 
@@ -346,6 +347,35 @@ int hypfs_write_bool(struct hypfs_entry_leaf *leaf,
     return 0;
 }
 
+int hypfs_write_custom(struct hypfs_entry_leaf *leaf,
+                       XEN_GUEST_HANDLE_PARAM(void) uaddr, unsigned int ulen)
+{
+    struct param_hypfs *p;
+    char *buf;
+    int ret;
+
+    ASSERT(this_cpu(hypfs_locked) == hypfs_write_locked);
+
+    buf = xzalloc_array(char, ulen);
+    if ( !buf )
+        return -ENOMEM;
+
+    ret = -EFAULT;
+    if ( copy_from_guest(buf, uaddr, ulen) )
+        goto out;
+
+    ret = -EDOM;
+    if ( memchr(buf, 0, ulen) != (buf + ulen - 1) )
+        goto out;
+
+    p = container_of(leaf, struct param_hypfs, hypfs);
+    ret = p->param->par.func(buf);
+
+ out:
+    xfree(buf);
+    return ret;
+}
+
 static int hypfs_write(struct hypfs_entry *entry,
                        XEN_GUEST_HANDLE_PARAM(void) uaddr, unsigned long ulen)
 {
diff --git a/xen/common/kernel.c b/xen/common/kernel.c
index 0fb5b50b45..952fab59e4 100644
--- a/xen/common/kernel.c
+++ b/xen/common/kernel.c
@@ -198,7 +198,13 @@ static void __init _cmdline_parse(const char *cmdline)
 
 int runtime_parse(const char *line)
 {
-    return parse_params(line, __param_start, __param_end);
+    int ret;
+
+    hypfs_write_lock();
+    ret = parse_params(line, __param_start, __param_end);
+    hypfs_unlock();
+
+    return ret;
 }
 
 /**
@@ -429,6 +435,27 @@ static int __init buildinfo_init(void)
     return 0;
 }
 __initcall(buildinfo_init);
+
+static HYPFS_DIR_INIT(params, "params");
+
+static int __init param_init(void)
+{
+    struct param_hypfs *param;
+
+    hypfs_add_dir(&hypfs_root, &params, true);
+
+    for ( param = __paramhypfs_start; param < __paramhypfs_end; param++ )
+    {
+        if ( param->init_leaf )
+            param->init_leaf(param);
+        else if ( param->hypfs.e.type == XEN_HYPFS_TYPE_STRING )
+            param->hypfs.e.size = strlen(param->hypfs.u.content) + 1;
+        hypfs_add_leaf(&params, &param->hypfs, true);
+    }
+
+    return 0;
+}
+__initcall(param_init);
 #endif
 
 # define DO(fn) long do_##fn
diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index 913ae1b66a..56e24821b2 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -79,8 +79,28 @@ enum con_timestamp_mode
 
 static enum con_timestamp_mode __read_mostly opt_con_timestamp_mode = TSM_NONE;
 
+#ifdef CONFIG_HYPFS
+static const char con_timestamp_mode_2_string[][7] = {
+    [TSM_NONE] = "none",
+    [TSM_DATE] = "date",
+    [TSM_DATE_MS] = "datems",
+    [TSM_BOOT] = "boot",
+    [TSM_RAW] = "raw",
+};
+
+static void con_timestamp_mode_upd(struct param_hypfs *par)
+{
+    const char *val = con_timestamp_mode_2_string[opt_con_timestamp_mode];
+
+    custom_runtime_set_var_sz(par, val, 7);
+}
+#else
+#define con_timestamp_mode_upd(par)
+#endif
+
 static int parse_console_timestamps(const char *s);
-custom_runtime_param("console_timestamps", parse_console_timestamps);
+custom_runtime_param("console_timestamps", parse_console_timestamps,
+                     con_timestamp_mode_upd);
 
 /* conring_size: allows a large console ring than default (16kB). */
 static uint32_t __initdata opt_conring_size;
@@ -143,6 +163,39 @@ static int __read_mostly xenlog_guest_lower_thresh =
 static int parse_loglvl(const char *s);
 static int parse_guest_loglvl(const char *s);
 
+#ifdef CONFIG_HYPFS
+#define LOGLVL_VAL_SZ 16
+static char xenlog_val[LOGLVL_VAL_SZ];
+static char xenlog_guest_val[LOGLVL_VAL_SZ];
+
+static char *lvl2opt[] = { "none", "error", "warning", "info", "all" };
+
+static void xenlog_update_val(int lower, int upper, char *val)
+{
+    snprintf(val, LOGLVL_VAL_SZ, "%s/%s", lvl2opt[lower], lvl2opt[upper]);
+}
+
+static void __init xenlog_init(struct param_hypfs *par)
+{
+    xenlog_update_val(xenlog_lower_thresh, xenlog_upper_thresh, xenlog_val);
+    custom_runtime_set_var(par, xenlog_val);
+}
+
+static void __init xenlog_guest_init(struct param_hypfs *par)
+{
+    xenlog_update_val(xenlog_guest_lower_thresh, xenlog_guest_upper_thresh,
+                      xenlog_guest_val);
+    custom_runtime_set_var(par, xenlog_guest_val);
+}
+#else
+#define xenlog_val       NULL
+#define xenlog_guest_val NULL
+
+static void xenlog_update_val(int lower, int upper, char *val)
+{
+}
+#endif
+
 /*
  * <lvl> := none|error|warning|info|debug|all
  * loglvl=<lvl_print_always>[/<lvl_print_ratelimit>]
@@ -151,8 +204,8 @@ static int parse_guest_loglvl(const char *s);
  * Similar definitions for guest_loglvl, but applies to guest tracing.
  * Defaults: loglvl=warning ; guest_loglvl=none/warning
  */
-custom_runtime_param("loglvl", parse_loglvl);
-custom_runtime_param("guest_loglvl", parse_guest_loglvl);
+custom_runtime_param("loglvl", parse_loglvl, xenlog_init);
+custom_runtime_param("guest_loglvl", parse_guest_loglvl, xenlog_guest_init);
 
 static atomic_t print_everything = ATOMIC_INIT(0);
 
@@ -173,7 +226,7 @@ static int __parse_loglvl(const char *s, const char **ps)
     return 2; /* sane fallback */
 }
 
-static int _parse_loglvl(const char *s, int *lower, int *upper)
+static int _parse_loglvl(const char *s, int *lower, int *upper, char *val)
 {
     *lower = *upper = __parse_loglvl(s, &s);
     if ( *s == '/' )
@@ -181,18 +234,21 @@ static int _parse_loglvl(const char *s, int *lower, int *upper)
     if ( *upper < *lower )
         *upper = *lower;
 
+    xenlog_update_val(*lower, *upper, val);
+
     return *s ? -EINVAL : 0;
 }
 
 static int parse_loglvl(const char *s)
 {
-    return _parse_loglvl(s, &xenlog_lower_thresh, &xenlog_upper_thresh);
+    return _parse_loglvl(s, &xenlog_lower_thresh, &xenlog_upper_thresh,
+                         xenlog_val);
 }
 
 static int parse_guest_loglvl(const char *s)
 {
     return _parse_loglvl(s, &xenlog_guest_lower_thresh,
-                         &xenlog_guest_upper_thresh);
+                         &xenlog_guest_upper_thresh, xenlog_guest_val);
 }
 
 static char *loglvl_str(int lvl)
@@ -731,9 +787,11 @@ static int parse_console_timestamps(const char *s)
     {
     case 0:
         opt_con_timestamp_mode = TSM_NONE;
+        con_timestamp_mode_upd(param_2_parfs(parse_console_timestamps));
         return 0;
     case 1:
         opt_con_timestamp_mode = TSM_DATE;
+        con_timestamp_mode_upd(param_2_parfs(parse_console_timestamps));
         return 0;
     }
     if ( *s == '\0' || /* Compat for old booleanparam() */
@@ -750,6 +808,8 @@ static int parse_console_timestamps(const char *s)
     else
         return -EINVAL;
 
+    con_timestamp_mode_upd(param_2_parfs(parse_console_timestamps));
+
     return 0;
 }
 
diff --git a/xen/include/xen/hypfs.h b/xen/include/xen/hypfs.h
index 39845ec5ae..c3947eb2b3 100644
--- a/xen/include/xen/hypfs.h
+++ b/xen/include/xen/hypfs.h
@@ -116,6 +116,13 @@ int hypfs_write_leaf(struct hypfs_entry_leaf *leaf,
                      XEN_GUEST_HANDLE_PARAM(void) uaddr, unsigned int ulen);
 int hypfs_write_bool(struct hypfs_entry_leaf *leaf,
                      XEN_GUEST_HANDLE_PARAM(void) uaddr, unsigned int ulen);
+int hypfs_write_custom(struct hypfs_entry_leaf *leaf,
+                       XEN_GUEST_HANDLE_PARAM(void) uaddr, unsigned int ulen);
+void hypfs_write_lock(void);
+void hypfs_unlock(void);
+#else
+static inline void hypfs_write_lock(void) {}
+static inline void hypfs_unlock(void) {}
 #endif
 
 #endif /* __XEN_HYPFS_H__ */
diff --git a/xen/include/xen/param.h b/xen/include/xen/param.h
index a1dc3ba8f0..26831e9304 100644
--- a/xen/include/xen/param.h
+++ b/xen/include/xen/param.h
@@ -1,6 +1,7 @@
 #ifndef _XEN_PARAM_H
 #define _XEN_PARAM_H
 
+#include <xen/hypfs.h>
 #include <xen/init.h>
 #include <xen/lib.h>
 #include <xen/stdbool.h>
@@ -80,7 +81,115 @@ extern const struct kernel_param __param_start[], __param_end[];
 
 #define __rtparam         __param(__dataparam)
 
-#define custom_runtime_only_param(_name, _var) \
+#ifdef CONFIG_HYPFS
+
+struct param_hypfs {
+    const struct kernel_param *param;
+    struct hypfs_entry_leaf hypfs;
+    void (*init_leaf)(struct param_hypfs *par);
+};
+
+extern struct param_hypfs __paramhypfs_start[], __paramhypfs_end[];
+
+#define __paramhypfs      __used_section(".data.paramhypfs")
+
+#define __paramfs         static __paramhypfs  \
+    __attribute__((__aligned__(sizeof(void *)))) struct param_hypfs
+
+#define custom_runtime_set_var_sz(parfs, var, sz) \
+    { \
+        (parfs)->hypfs.u.content = var; \
+        (parfs)->hypfs.e.max_size = sz; \
+        (parfs)->hypfs.e.size = strlen(var) + 1; \
+    }
+#define custom_runtime_set_var(parfs, var) \
+    custom_runtime_set_var_sz(parfs, var, sizeof(var))
+
+#define param_2_parfs(par) &__parfs_##par
+
+/* initfunc needs to set size and content, e.g. via custom_runtime_set_var(). */
+#define custom_runtime_only_param(nam, variable, initfunc) \
+    __rtparam __rtpar_##variable = \
+      { .name = (nam), \
+          .type = OPT_CUSTOM, \
+          .par.func = (variable) }; \
+    __paramfs __parfs_##variable = \
+        { .param = &__rtpar_##variable, \
+          .init_leaf = (initfunc), \
+          .hypfs.e.type = XEN_HYPFS_TYPE_STRING, \
+          .hypfs.e.encoding = XEN_HYPFS_ENC_PLAIN, \
+          .hypfs.e.name = (nam), \
+          .hypfs.e.read = hypfs_read_leaf, \
+          .hypfs.e.write = hypfs_write_custom }
+#define boolean_runtime_only_param(nam, variable) \
+    __rtparam __rtpar_##variable = \
+        { .name = (nam), \
+          .type = OPT_BOOL, \
+          .len = sizeof(variable) + \
+                 BUILD_BUG_ON_ZERO(sizeof(variable) != sizeof(bool)), \
+          .par.var = &(variable) }; \
+    __paramfs __parfs_##variable = \
+        { .param = &__rtpar_##variable, \
+          .hypfs.e.type = XEN_HYPFS_TYPE_BOOL, \
+          .hypfs.e.encoding = XEN_HYPFS_ENC_PLAIN, \
+          .hypfs.e.name = (nam), \
+          .hypfs.e.size = sizeof(variable), \
+          .hypfs.e.max_size = sizeof(variable), \
+          .hypfs.e.read = hypfs_read_leaf, \
+          .hypfs.e.write = hypfs_write_bool, \
+          .hypfs.u.content = &(variable) }
+#define integer_runtime_only_param(nam, variable) \
+    __rtparam __rtpar_##variable = \
+        { .name = (nam), \
+          .type = OPT_UINT, \
+          .len = sizeof(variable), \
+          .par.var = &(variable) }; \
+    __paramfs __parfs_##variable = \
+        { .param = &__rtpar_##variable, \
+          .hypfs.e.type = XEN_HYPFS_TYPE_UINT, \
+          .hypfs.e.encoding = XEN_HYPFS_ENC_PLAIN, \
+          .hypfs.e.name = (nam), \
+          .hypfs.e.size = sizeof(variable), \
+          .hypfs.e.max_size = sizeof(variable), \
+          .hypfs.e.read = hypfs_read_leaf, \
+          .hypfs.e.write = hypfs_write_leaf, \
+          .hypfs.u.content = &(variable) }
+#define size_runtime_only_param(nam, variable) \
+    __rtparam __rtpar_##variable = \
+        { .name = (nam), \
+          .type = OPT_SIZE, \
+          .len = sizeof(variable), \
+          .par.var = &(variable) }; \
+    __paramfs __parfs_##variable = \
+        { .param = &__rtpar_##variable, \
+          .hypfs.e.type = XEN_HYPFS_TYPE_UINT, \
+          .hypfs.e.encoding = XEN_HYPFS_ENC_PLAIN, \
+          .hypfs.e.name = (nam), \
+          .hypfs.e.size = sizeof(variable), \
+          .hypfs.e.max_size = sizeof(variable), \
+          .hypfs.e.read = hypfs_read_leaf, \
+          .hypfs.e.write = hypfs_write_leaf, \
+          .hypfs.u.content = &(variable) }
+#define string_runtime_only_param(nam, variable) \
+    __rtparam __rtpar_##variable = \
+        { .name = (nam), \
+          .type = OPT_STR, \
+          .len = sizeof(variable), \
+          .par.var = &(variable) }; \
+    __paramfs __parfs_##variable = \
+        { .param = &__rtpar_##variable, \
+          .hypfs.e.type = XEN_HYPFS_TYPE_STRING, \
+          .hypfs.e.encoding = XEN_HYPFS_ENC_PLAIN, \
+          .hypfs.e.name = (nam), \
+          .hypfs.e.size = 0, \
+          .hypfs.e.max_size = sizeof(variable), \
+          .hypfs.e.read = hypfs_read_leaf, \
+          .hypfs.e.write = hypfs_write_leaf, \
+          .hypfs.u.content = &(variable) }
+
+#else
+
+#define custom_runtime_only_param(_name, _var, unused) \
     __rtparam __rtpar_##_var = \
       { .name = _name, \
           .type = OPT_CUSTOM, \
@@ -111,9 +220,13 @@ extern const struct kernel_param __param_start[], __param_end[];
           .len = sizeof(_var), \
           .par.var = &_var }
 
-#define custom_runtime_param(_name, _var) \
+#define custom_runtime_set_var(parfs, var)
+
+#endif
+
+#define custom_runtime_param(_name, _var, initfunc) \
     custom_param(_name, _var); \
-    custom_runtime_only_param(_name, _var)
+    custom_runtime_only_param(_name, _var, initfunc)
 #define boolean_runtime_param(_name, _var) \
     boolean_param(_name, _var); \
     boolean_runtime_only_param(_name, _var)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jun 06 23:56:36 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Jun 2020 23:56: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 1jhig0-0005nU-BJ; Sat, 06 Jun 2020 23:56: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=x7q/=7T=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhifz-0005nI-3T
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:56:35 +0000
X-Inumbo-ID: 59fb79a0-a851-11ea-96fb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 59fb79a0-a851-11ea-96fb-bc764e2007e4;
 Sat, 06 Jun 2020 23:56: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=FOwxbxmgff/dcB+w8fBH+rWnL9x/FPjdioAgsDx+0vA=; b=fYeTFk6Rq7FO/sC96U9XnwXqUB
 oY53A8SZ88qgghT2e4XXPL+LT+2rnn4XfBnfH0DgslWrgZP8p1wDnYAtG/LpXoghXqRWHVHxhfepz
 Os0aV4exp2gDcmzGp0WqyQvJKNwG3C04swH+ACQnQ5cTsvCqhJ7JcNFsVEAcpB+N86PQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhify-0002US-AB
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:56:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhify-00077m-9d
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:56:34 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] tools/libxl: use libxenhypfs for setting xen runtime
 parameters
Message-Id: <E1jhify-00077m-9d@xenbits.xenproject.org>
Date: Sat, 06 Jun 2020 23:56: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 2ea4b9829cf95b59f75f0c70543f2368d702305e
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri May 29 12:20:08 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri May 29 12:20:08 2020 +0200

    tools/libxl: use libxenhypfs for setting xen runtime parameters
    
    Instead of xc_set_parameters() use xenhypfs_write() for setting
    parameters of the hypervisor.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Wei Liu <wl@xen.org>
---
 tools/Rules.mk               |  2 +-
 tools/libxl/Makefile         |  3 ++-
 tools/libxl/libxl.c          | 53 +++++++++++++++++++++++++++++++++++++++-----
 tools/libxl/libxl_internal.h |  1 +
 tools/libxl/xenlight.pc.in   |  2 +-
 tools/xl/xl_misc.c           |  1 -
 6 files changed, 52 insertions(+), 10 deletions(-)

diff --git a/tools/Rules.mk b/tools/Rules.mk
index 518bb5660a..ac2b0115ec 100644
--- a/tools/Rules.mk
+++ b/tools/Rules.mk
@@ -177,7 +177,7 @@ CFLAGS += -O2 -fomit-frame-pointer
 endif
 
 CFLAGS_libxenlight = -I$(XEN_XENLIGHT) $(CFLAGS_libxenctrl) $(CFLAGS_xeninclude)
-SHDEPS_libxenlight = $(SHLIB_libxenctrl) $(SHLIB_libxenstore)
+SHDEPS_libxenlight = $(SHLIB_libxenctrl) $(SHLIB_libxenstore) $(SHLIB_libxenhypfs)
 LDLIBS_libxenlight = $(SHDEPS_libxenlight) $(XEN_XENLIGHT)/libxenlight$(libextension)
 SHLIB_libxenlight  = $(SHDEPS_libxenlight) -Wl,-rpath-link=$(XEN_XENLIGHT)
 
diff --git a/tools/libxl/Makefile b/tools/libxl/Makefile
index 947eb6036e..38cd43abae 100644
--- a/tools/libxl/Makefile
+++ b/tools/libxl/Makefile
@@ -20,7 +20,7 @@ LIBUUID_LIBS += -luuid
 endif
 
 LIBXL_LIBS =
-LIBXL_LIBS = $(LDLIBS_libxentoollog) $(LDLIBS_libxenevtchn) $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore) $(LDLIBS_libxentoolcore) $(PTYFUNCS_LIBS) $(LIBUUID_LIBS)
+LIBXL_LIBS = $(LDLIBS_libxentoollog) $(LDLIBS_libxenevtchn) $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenhypfs) $(LDLIBS_libxenstore) $(LDLIBS_libxentoolcore) $(PTYFUNCS_LIBS) $(LIBUUID_LIBS)
 ifeq ($(CONFIG_LIBNL),y)
 LIBXL_LIBS += $(LIBNL3_LIBS)
 endif
@@ -33,6 +33,7 @@ CFLAGS_LIBXL += $(CFLAGS_libxentoolcore)
 CFLAGS_LIBXL += $(CFLAGS_libxenevtchn)
 CFLAGS_LIBXL += $(CFLAGS_libxenctrl)
 CFLAGS_LIBXL += $(CFLAGS_libxenguest)
+CFLAGS_LIBXL += $(CFLAGS_libxenhypfs)
 CFLAGS_LIBXL += $(CFLAGS_libxenstore)
 ifeq ($(CONFIG_LIBNL),y)
 CFLAGS_LIBXL += $(LIBNL3_CFLAGS)
diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index f60fd3e4fd..621acc88f3 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -663,15 +663,56 @@ int libxl_set_parameters(libxl_ctx *ctx, char *params)
 {
     int ret;
     GC_INIT(ctx);
+    char *par, *val, *end, *path;
+    xenhypfs_handle *hypfs;
 
-    ret = xc_set_parameters(ctx->xch, params);
-    if (ret < 0) {
-        LOGEV(ERROR, ret, "setting parameters");
-        GC_FREE;
-        return ERROR_FAIL;
+    hypfs = xenhypfs_open(ctx->lg, 0);
+    if (!hypfs) {
+        LOGE(ERROR, "opening Xen hypfs");
+        ret = ERROR_FAIL;
+        goto out;
     }
+
+    while (isblank(*params))
+        params++;
+
+    for (par = params; *par; par = end) {
+        end = strchr(par, ' ');
+        if (!end)
+            end = par + strlen(par);
+
+        val = strchr(par, '=');
+        if (val > end)
+            val = NULL;
+        if (!val && !strncmp(par, "no", 2)) {
+            path = libxl__sprintf(gc, "/params/%s", par + 2);
+            path[end - par - 2 + 8] = 0;
+            val = "no";
+            par += 2;
+        } else {
+            path = libxl__sprintf(gc, "/params/%s", par);
+            path[val - par + 8] = 0;
+            val = libxl__strndup(gc, val + 1, end - val - 1);
+        }
+
+	LOG(DEBUG, "setting node \"%s\" to value \"%s\"", path, val);
+        ret = xenhypfs_write(hypfs, path, val);
+        if (ret < 0) {
+            LOGE(ERROR, "setting parameters");
+            ret = ERROR_FAIL;
+            goto out;
+        }
+
+        while (isblank(*end))
+            end++;
+    }
+
+    ret = 0;
+
+out:
+    xenhypfs_close(hypfs);
     GC_FREE;
-    return 0;
+    return ret;
 }
 
 static int fd_set_flags(libxl_ctx *ctx, int fd,
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 41b51b07cd..c7ece066c4 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -56,6 +56,7 @@
 #define XC_WANT_COMPAT_MAP_FOREIGN_API
 #include <xenctrl.h>
 #include <xenguest.h>
+#include <xenhypfs.h>
 #include <xc_dom.h>
 
 #include <xen-tools/libs.h>
diff --git a/tools/libxl/xenlight.pc.in b/tools/libxl/xenlight.pc.in
index c0f769fd20..6b351ba096 100644
--- a/tools/libxl/xenlight.pc.in
+++ b/tools/libxl/xenlight.pc.in
@@ -9,4 +9,4 @@ Description: The Xenlight library for Xen hypervisor
 Version: @@version@@
 Cflags: -I${includedir}
 Libs: @@libsflag@@${libdir} -lxenlight
-Requires.private: xentoollog,xenevtchn,xencontrol,xenguest,xenstore
+Requires.private: xentoollog,xenevtchn,xencontrol,xenguest,xenstore,xenhypfs
diff --git a/tools/xl/xl_misc.c b/tools/xl/xl_misc.c
index 20ed605f4f..08f0fb6dc9 100644
--- a/tools/xl/xl_misc.c
+++ b/tools/xl/xl_misc.c
@@ -168,7 +168,6 @@ int main_set_parameters(int argc, char **argv)
 
     if (libxl_set_parameters(ctx, params)) {
         fprintf(stderr, "cannot set parameters: %s\n", params);
-        fprintf(stderr, "Use \"xl dmesg\" to look for possible reason.\n");
         return EXIT_FAILURE;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jun 06 23:56:46 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Jun 2020 23:56: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 1jhigA-0005pM-Cp; Sat, 06 Jun 2020 23:56: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=x7q/=7T=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhig8-0005pA-Vq
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:56:45 +0000
X-Inumbo-ID: 6000e100-a851-11ea-9ad7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 6000e100-a851-11ea-9ad7-bc764e2007e4;
 Sat, 06 Jun 2020 23:56: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=n1zAhuHlbDxn86Q3NAdWVEHPvpRxwqN1t7WnaQQNGgU=; b=zpETUEW1GaoI1oarVXIzlp++ny
 jdo6u7hBctA1q7TeefOUxHESjOBIYVYaNhJpmVzJbNjOP/amUGmTdfGVHPxk1uFKnmAbkPZyqNA7f
 U/MSeKEThXp55Uktz2nryPRCrY/dKgO8cVz5zWs9zv/6W49BY7e40dl/OT+dIA/l32ho=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhig8-0002Uv-DX
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:56:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhig8-00078K-Cn
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:56:44 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] tools/libxc: remove xc_set_parameters()
Message-Id: <E1jhig8-00078K-Cn@xenbits.xenproject.org>
Date: Sat, 06 Jun 2020 23:56: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 a2486890689713116351e5bbfb8f104c797479cc
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri May 29 12:20:16 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri May 29 12:20:16 2020 +0200

    tools/libxc: remove xc_set_parameters()
    
    There is no user of xc_set_parameters() left, so remove it.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Wei Liu <wl@xen.org>
---
 tools/libxc/include/xenctrl.h |  1 -
 tools/libxc/xc_misc.c         | 21 ---------------------
 2 files changed, 22 deletions(-)

diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h
index 45ff7db1e8..f9e17ae424 100644
--- a/tools/libxc/include/xenctrl.h
+++ b/tools/libxc/include/xenctrl.h
@@ -1226,7 +1226,6 @@ int xc_readconsolering(xc_interface *xch,
                        int clear, int incremental, uint32_t *pindex);
 
 int xc_send_debug_keys(xc_interface *xch, const char *keys);
-int xc_set_parameters(xc_interface *xch, const char *params);
 
 typedef struct xen_sysctl_physinfo xc_physinfo_t;
 typedef struct xen_sysctl_cputopo xc_cputopo_t;
diff --git a/tools/libxc/xc_misc.c b/tools/libxc/xc_misc.c
index fe477bf344..3820394413 100644
--- a/tools/libxc/xc_misc.c
+++ b/tools/libxc/xc_misc.c
@@ -187,27 +187,6 @@ int xc_send_debug_keys(xc_interface *xch, const char *keys)
     return ret;
 }
 
-int xc_set_parameters(xc_interface *xch, const char *params)
-{
-    int ret, len = strlen(params);
-    DECLARE_SYSCTL;
-    DECLARE_HYPERCALL_BOUNCE_IN(params, len);
-
-    if ( xc_hypercall_bounce_pre(xch, params) )
-        return -1;
-
-    sysctl.cmd = XEN_SYSCTL_set_parameter;
-    set_xen_guest_handle(sysctl.u.set_parameter.params, params);
-    sysctl.u.set_parameter.size = len;
-    memset(sysctl.u.set_parameter.pad, 0, sizeof(sysctl.u.set_parameter.pad));
-
-    ret = do_sysctl(xch, &sysctl);
-
-    xc_hypercall_bounce_post(xch, params);
-
-    return ret;
-}
-
 int xc_physinfo(xc_interface *xch,
                 xc_physinfo_t *put_info)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jun 06 23:56:58 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Jun 2020 23:56:58 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jhigM-0005qh-Ef; Sat, 06 Jun 2020 23:56: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=x7q/=7T=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhigK-0005qY-SX
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:56:56 +0000
X-Inumbo-ID: 660833b4-a851-11ea-b15a-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 660833b4-a851-11ea-b15a-12813bfff9fa;
 Sat, 06 Jun 2020 23:56: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=dakmqI/LoO+w8lUi6lulP3nsM87AfuUVFCTpzyXzCZ4=; b=uEkbag/+//GWG4vEAbHouLQ02D
 8Qm+G7qrd7v+vnLdTz7us8vEx+5IcAyE8whAHACtMOhk6A5aXmIbRgu5t6zzuCmVFebyj8AdJV6gt
 Tbl++fH/dhh86IE7H5nB19fz87AYMkZ3xxWnKdUWtani7DEbacfb7AEXEdpIZEX9d2s4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhigI-0002V4-H4
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:56:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhigI-00078w-GO
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:56:54 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] xen: remove XEN_SYSCTL_set_parameter support
Message-Id: <E1jhigI-00078w-GO@xenbits.xenproject.org>
Date: Sat, 06 Jun 2020 23:56: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 02e9a9cf20950e78c816987415ed920d72444f94
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri May 29 12:20:31 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri May 29 12:20:31 2020 +0200

    xen: remove XEN_SYSCTL_set_parameter support
    
    The functionality of XEN_SYSCTL_set_parameter is available via hypfs
    now, so it can be removed.
    
    This allows to remove the kernel_param structure for runtime parameters
    by putting the now only used structure element into the hypfs node
    structure of the runtime parameters.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 tools/flask/policy/modules/dom0.te  |  2 +-
 xen/arch/arm/xen.lds.S              |  5 ---
 xen/arch/x86/hvm/vmx/vmcs.c         |  6 +--
 xen/arch/x86/xen.lds.S              |  5 ---
 xen/common/Kconfig                  |  5 ++-
 xen/common/hypfs.c                  |  6 +--
 xen/common/kernel.c                 | 11 -----
 xen/common/sysctl.c                 | 36 ---------------
 xen/include/public/sysctl.h         | 19 +-------
 xen/include/xen/hypfs.h             |  5 ---
 xen/include/xen/lib.h               |  1 -
 xen/include/xen/param.h             | 87 ++++++-------------------------------
 xen/xsm/flask/hooks.c               |  3 --
 xen/xsm/flask/policy/access_vectors |  2 -
 14 files changed, 23 insertions(+), 170 deletions(-)

diff --git a/tools/flask/policy/modules/dom0.te b/tools/flask/policy/modules/dom0.te
index 20925e38a2..0a63ce15b6 100644
--- a/tools/flask/policy/modules/dom0.te
+++ b/tools/flask/policy/modules/dom0.te
@@ -16,7 +16,7 @@ allow dom0_t xen_t:xen {
 allow dom0_t xen_t:xen2 {
 	resource_op psr_cmt_op psr_alloc pmu_ctrl get_symbol
 	get_cpu_levelling_caps get_cpu_featureset livepatch_op
-	coverage_op set_parameter
+	coverage_op
 };
 
 # Allow dom0 to use all XENVER_ subops that have checks.
diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S
index 549ceb9749..6342ac4ead 100644
--- a/xen/arch/arm/xen.lds.S
+++ b/xen/arch/arm/xen.lds.S
@@ -54,11 +54,6 @@ SECTIONS
        *(.data.rel.ro)
        *(.data.rel.ro.*)
 
-       . = ALIGN(POINTER_ALIGN);
-       __param_start = .;
-       *(.data.param)
-       __param_end = .;
-
        __proc_info_start = .;
        *(.proc.info)
        __proc_info_end = .;
diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index 3410bc5f6d..ca94c2bedc 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -112,11 +112,6 @@ static void __init init_ept_param(struct param_hypfs *par)
     update_ept_param();
     custom_runtime_set_var(par, opt_ept_setting);
 }
-#else
-static void update_ept_param(void)
-{
-}
-#endif
 
 static int parse_ept_param_runtime(const char *s);
 custom_runtime_only_param("ept", parse_ept_param_runtime, init_ept_param);
@@ -172,6 +167,7 @@ static int parse_ept_param_runtime(const char *s)
 
     return 0;
 }
+#endif
 
 /* Dynamic (run-time adjusted) execution control flags. */
 u32 vmx_pin_based_exec_control __read_mostly;
diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
index 3ed020e26b..0273f79152 100644
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -128,11 +128,6 @@ SECTIONS
        *(.ex_table.pre)
        __stop___pre_ex_table = .;
 
-       . = ALIGN(POINTER_ALIGN);
-       __param_start = .;
-       *(.data.param)
-       __param_end = .;
-
 #if defined(CONFIG_HAS_VPCI) && defined(CONFIG_LATE_HWDOM)
        . = ALIGN(POINTER_ALIGN);
        __start_vpci_array = .;
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index 065f2ee454..15e3b79ff5 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -122,8 +122,9 @@ config HYPFS
 	---help---
 	  Support Xen hypervisor file system. This file system is used to
 	  present various hypervisor internal data to dom0 and in some
-	  cases to allow modifying settings. Disabling the support might
-	  result in some features not being available.
+	  cases to allow modifying settings. Disabling the support will
+	  result in some features not being available, e.g. runtime parameter
+	  setting.
 
 	  If unsure, say Y.
 
diff --git a/xen/common/hypfs.c b/xen/common/hypfs.c
index b982c74fba..b74c228191 100644
--- a/xen/common/hypfs.c
+++ b/xen/common/hypfs.c
@@ -42,7 +42,7 @@ static void hypfs_read_lock(void)
     this_cpu(hypfs_locked) = hypfs_read_locked;
 }
 
-void hypfs_write_lock(void)
+static void hypfs_write_lock(void)
 {
     ASSERT(this_cpu(hypfs_locked) == hypfs_unlocked);
 
@@ -50,7 +50,7 @@ void hypfs_write_lock(void)
     this_cpu(hypfs_locked) = hypfs_write_locked;
 }
 
-void hypfs_unlock(void)
+static void hypfs_unlock(void)
 {
     enum hypfs_lock_state locked = this_cpu(hypfs_locked);
 
@@ -369,7 +369,7 @@ int hypfs_write_custom(struct hypfs_entry_leaf *leaf,
         goto out;
 
     p = container_of(leaf, struct param_hypfs, hypfs);
-    ret = p->param->par.func(buf);
+    ret = p->func(buf);
 
  out:
     xfree(buf);
diff --git a/xen/common/kernel.c b/xen/common/kernel.c
index 952fab59e4..9de07b7ac5 100644
--- a/xen/common/kernel.c
+++ b/xen/common/kernel.c
@@ -196,17 +196,6 @@ static void __init _cmdline_parse(const char *cmdline)
     parse_params(cmdline, __setup_start, __setup_end);
 }
 
-int runtime_parse(const char *line)
-{
-    int ret;
-
-    hypfs_write_lock();
-    ret = parse_params(line, __param_start, __param_end);
-    hypfs_unlock();
-
-    return ret;
-}
-
 /**
  *    cmdline_parse -- parses the xen command line.
  * If CONFIG_CMDLINE is set, it would be parsed prior to @cmdline.
diff --git a/xen/common/sysctl.c b/xen/common/sysctl.c
index 1c6a817476..ec916424e5 100644
--- a/xen/common/sysctl.c
+++ b/xen/common/sysctl.c
@@ -471,42 +471,6 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl)
             copyback = 1;
         break;
 
-    case XEN_SYSCTL_set_parameter:
-    {
-#define XEN_SET_PARAMETER_MAX_SIZE 1023
-        char *params;
-
-        if ( op->u.set_parameter.pad[0] || op->u.set_parameter.pad[1] ||
-             op->u.set_parameter.pad[2] )
-        {
-            ret = -EINVAL;
-            break;
-        }
-        if ( op->u.set_parameter.size > XEN_SET_PARAMETER_MAX_SIZE )
-        {
-            ret = -E2BIG;
-            break;
-        }
-        params = xmalloc_bytes(op->u.set_parameter.size + 1);
-        if ( !params )
-        {
-            ret = -ENOMEM;
-            break;
-        }
-        if ( copy_from_guest(params, op->u.set_parameter.params,
-                             op->u.set_parameter.size) )
-            ret = -EFAULT;
-        else
-        {
-            params[op->u.set_parameter.size] = 0;
-            ret = runtime_parse(params);
-        }
-
-        xfree(params);
-
-        break;
-    }
-
     default:
         ret = arch_do_sysctl(op, u_sysctl);
         copyback = 0;
diff --git a/xen/include/public/sysctl.h b/xen/include/public/sysctl.h
index 3a08c512e8..a073647117 100644
--- a/xen/include/public/sysctl.h
+++ b/xen/include/public/sysctl.h
@@ -1026,22 +1026,6 @@ struct xen_sysctl_livepatch_op {
     } u;
 };
 
-/*
- * XEN_SYSCTL_set_parameter
- *
- * Change hypervisor parameters at runtime.
- * The input string is parsed similar to the boot parameters.
- * Parameters are a single string terminated by a NUL byte of max. size
- * characters. Multiple settings can be specified by separating them
- * with blanks.
- */
-
-struct xen_sysctl_set_parameter {
-    XEN_GUEST_HANDLE_64(const_char) params; /* IN: pointer to parameters. */
-    uint16_t size;                          /* IN: size of parameters. */
-    uint16_t pad[3];                        /* IN: MUST be zero. */
-};
-
 #if defined(__i386__) || defined(__x86_64__)
 /*
  * XEN_SYSCTL_get_cpu_policy (x86 specific)
@@ -1106,7 +1090,7 @@ struct xen_sysctl {
 #define XEN_SYSCTL_get_cpu_levelling_caps        25
 #define XEN_SYSCTL_get_cpu_featureset            26
 #define XEN_SYSCTL_livepatch_op                  27
-#define XEN_SYSCTL_set_parameter                 28
+/* #define XEN_SYSCTL_set_parameter              28 */
 #define XEN_SYSCTL_get_cpu_policy                29
     uint32_t interface_version; /* XEN_SYSCTL_INTERFACE_VERSION */
     union {
@@ -1135,7 +1119,6 @@ struct xen_sysctl {
         struct xen_sysctl_cpu_levelling_caps cpu_levelling_caps;
         struct xen_sysctl_cpu_featureset    cpu_featureset;
         struct xen_sysctl_livepatch_op      livepatch;
-        struct xen_sysctl_set_parameter     set_parameter;
 #if defined(__i386__) || defined(__x86_64__)
         struct xen_sysctl_cpu_policy        cpu_policy;
 #endif
diff --git a/xen/include/xen/hypfs.h b/xen/include/xen/hypfs.h
index c3947eb2b3..5ad99cb558 100644
--- a/xen/include/xen/hypfs.h
+++ b/xen/include/xen/hypfs.h
@@ -118,11 +118,6 @@ int hypfs_write_bool(struct hypfs_entry_leaf *leaf,
                      XEN_GUEST_HANDLE_PARAM(void) uaddr, unsigned int ulen);
 int hypfs_write_custom(struct hypfs_entry_leaf *leaf,
                        XEN_GUEST_HANDLE_PARAM(void) uaddr, unsigned int ulen);
-void hypfs_write_lock(void);
-void hypfs_unlock(void);
-#else
-static inline void hypfs_write_lock(void) {}
-static inline void hypfs_unlock(void) {}
 #endif
 
 #endif /* __XEN_HYPFS_H__ */
diff --git a/xen/include/xen/lib.h b/xen/include/xen/lib.h
index 2d7a054931..e5b0a007b8 100644
--- a/xen/include/xen/lib.h
+++ b/xen/include/xen/lib.h
@@ -75,7 +75,6 @@
 struct domain;
 
 void cmdline_parse(const char *cmdline);
-int runtime_parse(const char *line);
 int parse_bool(const char *s, const char *e);
 
 /**
diff --git a/xen/include/xen/param.h b/xen/include/xen/param.h
index 26831e9304..c2fd075dd0 100644
--- a/xen/include/xen/param.h
+++ b/xen/include/xen/param.h
@@ -27,9 +27,6 @@ struct kernel_param {
 };
 
 extern const struct kernel_param __setup_start[], __setup_end[];
-extern const struct kernel_param __param_start[], __param_end[];
-
-#define __dataparam       __used_section(".data.param")
 
 #define __param(att)      static const att \
     __attribute__((__aligned__(sizeof(void *)))) struct kernel_param
@@ -79,14 +76,12 @@ extern const struct kernel_param __param_start[], __param_end[];
         { .name = setup_str_ign,            \
           .type = OPT_IGNORE }
 
-#define __rtparam         __param(__dataparam)
-
 #ifdef CONFIG_HYPFS
 
 struct param_hypfs {
-    const struct kernel_param *param;
     struct hypfs_entry_leaf hypfs;
     void (*init_leaf)(struct param_hypfs *par);
+    int (*func)(const char *);
 };
 
 extern struct param_hypfs __paramhypfs_start[], __paramhypfs_end[];
@@ -109,28 +104,17 @@ extern struct param_hypfs __paramhypfs_start[], __paramhypfs_end[];
 
 /* initfunc needs to set size and content, e.g. via custom_runtime_set_var(). */
 #define custom_runtime_only_param(nam, variable, initfunc) \
-    __rtparam __rtpar_##variable = \
-      { .name = (nam), \
-          .type = OPT_CUSTOM, \
-          .par.func = (variable) }; \
     __paramfs __parfs_##variable = \
-        { .param = &__rtpar_##variable, \
-          .init_leaf = (initfunc), \
-          .hypfs.e.type = XEN_HYPFS_TYPE_STRING, \
+        { .hypfs.e.type = XEN_HYPFS_TYPE_STRING, \
           .hypfs.e.encoding = XEN_HYPFS_ENC_PLAIN, \
           .hypfs.e.name = (nam), \
           .hypfs.e.read = hypfs_read_leaf, \
-          .hypfs.e.write = hypfs_write_custom }
+          .hypfs.e.write = hypfs_write_custom, \
+          .init_leaf = (initfunc), \
+          .func = (variable) }
 #define boolean_runtime_only_param(nam, variable) \
-    __rtparam __rtpar_##variable = \
-        { .name = (nam), \
-          .type = OPT_BOOL, \
-          .len = sizeof(variable) + \
-                 BUILD_BUG_ON_ZERO(sizeof(variable) != sizeof(bool)), \
-          .par.var = &(variable) }; \
     __paramfs __parfs_##variable = \
-        { .param = &__rtpar_##variable, \
-          .hypfs.e.type = XEN_HYPFS_TYPE_BOOL, \
+        { .hypfs.e.type = XEN_HYPFS_TYPE_BOOL, \
           .hypfs.e.encoding = XEN_HYPFS_ENC_PLAIN, \
           .hypfs.e.name = (nam), \
           .hypfs.e.size = sizeof(variable), \
@@ -139,14 +123,8 @@ extern struct param_hypfs __paramhypfs_start[], __paramhypfs_end[];
           .hypfs.e.write = hypfs_write_bool, \
           .hypfs.u.content = &(variable) }
 #define integer_runtime_only_param(nam, variable) \
-    __rtparam __rtpar_##variable = \
-        { .name = (nam), \
-          .type = OPT_UINT, \
-          .len = sizeof(variable), \
-          .par.var = &(variable) }; \
     __paramfs __parfs_##variable = \
-        { .param = &__rtpar_##variable, \
-          .hypfs.e.type = XEN_HYPFS_TYPE_UINT, \
+        { .hypfs.e.type = XEN_HYPFS_TYPE_UINT, \
           .hypfs.e.encoding = XEN_HYPFS_ENC_PLAIN, \
           .hypfs.e.name = (nam), \
           .hypfs.e.size = sizeof(variable), \
@@ -155,14 +133,8 @@ extern struct param_hypfs __paramhypfs_start[], __paramhypfs_end[];
           .hypfs.e.write = hypfs_write_leaf, \
           .hypfs.u.content = &(variable) }
 #define size_runtime_only_param(nam, variable) \
-    __rtparam __rtpar_##variable = \
-        { .name = (nam), \
-          .type = OPT_SIZE, \
-          .len = sizeof(variable), \
-          .par.var = &(variable) }; \
     __paramfs __parfs_##variable = \
-        { .param = &__rtpar_##variable, \
-          .hypfs.e.type = XEN_HYPFS_TYPE_UINT, \
+        { .hypfs.e.type = XEN_HYPFS_TYPE_UINT, \
           .hypfs.e.encoding = XEN_HYPFS_ENC_PLAIN, \
           .hypfs.e.name = (nam), \
           .hypfs.e.size = sizeof(variable), \
@@ -171,14 +143,8 @@ extern struct param_hypfs __paramhypfs_start[], __paramhypfs_end[];
           .hypfs.e.write = hypfs_write_leaf, \
           .hypfs.u.content = &(variable) }
 #define string_runtime_only_param(nam, variable) \
-    __rtparam __rtpar_##variable = \
-        { .name = (nam), \
-          .type = OPT_STR, \
-          .len = sizeof(variable), \
-          .par.var = &(variable) }; \
     __paramfs __parfs_##variable = \
-        { .param = &__rtpar_##variable, \
-          .hypfs.e.type = XEN_HYPFS_TYPE_STRING, \
+        { .hypfs.e.type = XEN_HYPFS_TYPE_STRING, \
           .hypfs.e.encoding = XEN_HYPFS_ENC_PLAIN, \
           .hypfs.e.name = (nam), \
           .hypfs.e.size = 0, \
@@ -189,36 +155,11 @@ extern struct param_hypfs __paramhypfs_start[], __paramhypfs_end[];
 
 #else
 
-#define custom_runtime_only_param(_name, _var, unused) \
-    __rtparam __rtpar_##_var = \
-      { .name = _name, \
-          .type = OPT_CUSTOM, \
-          .par.func = _var }
-#define boolean_runtime_only_param(_name, _var) \
-    __rtparam __rtpar_##_var = \
-        { .name = _name, \
-          .type = OPT_BOOL, \
-          .len = sizeof(_var) + \
-                 BUILD_BUG_ON_ZERO(sizeof(_var) != sizeof(bool)), \
-          .par.var = &_var }
-#define integer_runtime_only_param(_name, _var) \
-    __rtparam __rtpar_##_var = \
-        { .name = _name, \
-          .type = OPT_UINT, \
-          .len = sizeof(_var), \
-          .par.var = &_var }
-#define size_runtime_only_param(_name, _var) \
-    __rtparam __rtpar_##_var = \
-        { .name = _name, \
-          .type = OPT_SIZE, \
-          .len = sizeof(_var), \
-          .par.var = &_var }
-#define string_runtime_only_param(_name, _var) \
-    __rtparam __rtpar_##_var = \
-        { .name = _name, \
-          .type = OPT_STR, \
-          .len = sizeof(_var), \
-          .par.var = &_var }
+#define custom_runtime_only_param(nam, var, initfunc)
+#define boolean_runtime_only_param(nam, var)
+#define integer_runtime_only_param(nam, var)
+#define size_runtime_only_param(nam, var)
+#define string_runtime_only_param(nam, var)
 
 #define custom_runtime_set_var(parfs, var)
 
diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
index a2c78e445c..a314bf85ce 100644
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -822,9 +822,6 @@ static int flask_sysctl(int cmd)
     case XEN_SYSCTL_coverage_op:
         return avc_current_has_perm(SECINITSID_XEN, SECCLASS_XEN2,
                                     XEN2__COVERAGE_OP, NULL);
-    case XEN_SYSCTL_set_parameter:
-        return avc_current_has_perm(SECINITSID_XEN, SECCLASS_XEN2,
-                                    XEN2__SET_PARAMETER, NULL);
 
     default:
         return avc_unknown_permission("sysctl", cmd);
diff --git a/xen/xsm/flask/policy/access_vectors b/xen/xsm/flask/policy/access_vectors
index c9e385fb9b..b87c99ea98 100644
--- a/xen/xsm/flask/policy/access_vectors
+++ b/xen/xsm/flask/policy/access_vectors
@@ -99,8 +99,6 @@ class xen2
     livepatch_op
 # XEN_SYSCTL_coverage_op
     coverage_op
-# XEN_SYSCTL_set_parameter
-    set_parameter
 }
 
 # Classes domain and domain2 consist of operations that a domain performs on
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jun 06 23:57:06 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Jun 2020 23:57: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 1jhigU-0005ro-Hc; Sat, 06 Jun 2020 23:57: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=x7q/=7T=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhigT-0005rf-Dg
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:57:05 +0000
X-Inumbo-ID: 6c104756-a851-11ea-b15a-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 6c104756-a851-11ea-b15a-12813bfff9fa;
 Sat, 06 Jun 2020 23:57: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=0XNAR96IqWucTfhVa2JWpLCD37EyZI++/qVhnH3kHzI=; b=qxQ/kx8Q+J0puQdOpoKH9hj6ey
 e+OMVlKyJCuFm/5tB/f2v+3d9rOg4fRuXMGZDPEd8HLOkL434PK4FsP8HsYozBZY0ZFfppFI6Aex5
 jl1lG1SAOHbM1Iq6dGPkN2Eqz/UMPtRZ89UvgsUNxh7woyr2lX6dbzVwKQyaB9npbKVw=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhigS-0002VN-Kx
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:57:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhigS-00079f-JN
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:57:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] CHANGELOG: add hypervisor file system support
Message-Id: <E1jhigS-00079f-JN@xenbits.xenproject.org>
Date: Sat, 06 Jun 2020 23:57: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 7f8d2dc29ea5a51f88ec253be93970768ec9fac2
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri May 29 12:22:42 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri May 29 12:22:42 2020 +0200

    CHANGELOG: add hypervisor file system support
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index ccb5055c87..75b7582447 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -16,6 +16,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
    fixes.
  - Hypervisor framework to ease porting Xen to run on hypervisors.
  - Initial support to run on Hyper-V.
+ - Initial hypervisor file system (hypfs) support.
 
 ## [4.13.0](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.13.0) - 2019-12-17
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jun 06 23:57:16 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Jun 2020 23:57: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 1jhige-0005t8-JI; Sat, 06 Jun 2020 23:57: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=x7q/=7T=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhigd-0005sx-8S
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:57:15 +0000
X-Inumbo-ID: 72132df8-a851-11ea-9ad7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 72132df8-a851-11ea-9ad7-bc764e2007e4;
 Sat, 06 Jun 2020 23:57: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=wnP3P5oo/1jFNPwaTYxbMj3B+iL1uGlUFtPUwNdkdR0=; b=cVdAVw+hCAUXp1DprsWa3gnmUj
 ZPLhkkPidaer2GScJmnY5EIdETIMsforY/hSoJ7zRb8eN+NmyWBBEdHvst7t84tG+/sPFpCJ2AoXM
 E1zi8uqNbctbk/wbb34cH8YTYChehpe6+hmdCn56VP1Dm5ceZyo7DDu2XMdhP/8cFM+8=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhigc-0002VZ-Nq
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:57:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhigc-0007A8-NF
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:57:14 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] SUPPORT.md: add hypervisor file system
Message-Id: <E1jhigc-0007A8-NF@xenbits.xenproject.org>
Date: Sat, 06 Jun 2020 23:57: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 9b9a83e43598b231111487378d6037fa8fa473d5
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri May 29 12:22:50 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri May 29 12:22:50 2020 +0200

    SUPPORT.md: add hypervisor file system
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 SUPPORT.md | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/SUPPORT.md b/SUPPORT.md
index e3a366fd56..a1f7eb6434 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -109,6 +109,20 @@ ARM only has one guest type at the moment
 
     Status: Supported
 
+## Hypervisor file system
+
+### Build info
+
+    Status: Supported
+
+### Hypervisor config
+
+    Status: Supported
+
+### Runtime parameters
+
+    Status: Supported
+
 ## Toolstack
 
 ### xl
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jun 06 23:57:26 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Jun 2020 23:57: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 1jhigo-0005uM-LD; Sat, 06 Jun 2020 23:57: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=x7q/=7T=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhign-0005uC-N9
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:57:25 +0000
X-Inumbo-ID: 781a645a-a851-11ea-b15a-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 781a645a-a851-11ea-b15a-12813bfff9fa;
 Sat, 06 Jun 2020 23:57: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=9dIt3fyaeTuukIOpztoZm5ADefWqEBk0Fp4+z/yzVOA=; b=qMjf+cs993mNkp7RbZ8GDra0F9
 umJnMqh44tikKk0zBlgm3S4mv19y8EsS4X3+XOQ1p+jeFYpGQGRTMef/UJcXp4dXSMuRZbnFqDNbo
 WYl7xZ1VBsy0UwVI1/SM6eondIVM39xa9v+3yrDSgo3hKCK4UmKcQac9gszN9CQL7YYs=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhigm-0002Vi-RF
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:57:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhigm-0007Aq-QV
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:57:24 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86emul: address x86_insn_is_mem_{access,
 write}() omissions
Message-Id: <E1jhigm-0007Aq-QV@xenbits.xenproject.org>
Date: Sat, 06 Jun 2020 23:57: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 e28d13eeb65c25c0bd56e8bfa83c7473047d778d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri May 29 17:28:04 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri May 29 17:28:04 2020 +0200

    x86emul: address x86_insn_is_mem_{access,write}() omissions
    
    First of all explain in comments what the functions' purposes are. Then
    make them actually match their comments.
    
    Note that fc6fa977be54 ("x86emul: extend x86_insn_is_mem_write()
    coverage") didn't actually fix the function's behavior for {,V}STMXCSR:
    Both are covered by generic code higher up in the function, due to
    x86_decode_twobyte() already doing suitable adjustments. And VSTMXCSR
    wouldn't have been covered anyway without a further X86EMUL_OPC_VEX()
    case label. Keep the inner case label in a comment for reference.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 126 ++++++++++++++++++++++++++++++---
 1 file changed, 118 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index fa24b1d725..080732b75b 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -11474,25 +11474,87 @@ x86_insn_operand_ea(const struct x86_emulate_state *state,
     return state->ea.mem.off;
 }
 
+/*
+ * This function means to return 'true' for all supported insns with explicit
+ * accesses to memory.  This means also insns which don't have an explicit
+ * memory operand (like POP), but it does not mean e.g. segment selector
+ * loads, where the descriptor table access is considered an implicit one.
+ */
 bool
 x86_insn_is_mem_access(const struct x86_emulate_state *state,
                        const struct x86_emulate_ctxt *ctxt)
 {
+    if ( mode_64bit() && state->not_64bit )
+        return false;
+
     if ( state->ea.type == OP_MEM )
-        return ctxt->opcode != 0x8d /* LEA */ &&
-               (ctxt->opcode != X86EMUL_OPC(0x0f, 0x01) ||
-                (state->modrm_reg & 7) != 7) /* INVLPG */;
+    {
+        switch ( ctxt->opcode )
+        {
+        case 0x8d: /* LEA */
+        case X86EMUL_OPC(0x0f, 0x0d): /* PREFETCH */
+        case X86EMUL_OPC(0x0f, 0x18)
+         ... X86EMUL_OPC(0x0f, 0x1f): /* NOP space */
+        case X86EMUL_OPC_66(0x0f, 0x18)
+         ... X86EMUL_OPC_66(0x0f, 0x1f): /* NOP space */
+        case X86EMUL_OPC_F3(0x0f, 0x18)
+         ... X86EMUL_OPC_F3(0x0f, 0x1f): /* NOP space */
+        case X86EMUL_OPC_F2(0x0f, 0x18)
+         ... X86EMUL_OPC_F2(0x0f, 0x1f): /* NOP space */
+        case X86EMUL_OPC(0x0f, 0xb9): /* UD1 */
+        case X86EMUL_OPC(0x0f, 0xff): /* UD0 */
+            return false;
+
+        case X86EMUL_OPC(0x0f, 0x01):
+            return (state->modrm_reg & 7) != 7; /* INVLPG */
+
+        case X86EMUL_OPC(0x0f, 0xae):
+            return (state->modrm_reg & 7) != 7; /* CLFLUSH */
+
+        case X86EMUL_OPC_66(0x0f, 0xae):
+            return (state->modrm_reg & 7) < 6; /* CLWB, CLFLUSHOPT */
+        }
+
+        return true;
+    }
 
     switch ( ctxt->opcode )
     {
+    case 0x06 ... 0x07: /* PUSH / POP %es */
+    case 0x0e:          /* PUSH %cs */
+    case 0x16 ... 0x17: /* PUSH / POP %ss */
+    case 0x1e ... 0x1f: /* PUSH / POP %ds */
+    case 0x50 ... 0x5f: /* PUSH / POP reg */
+    case 0x60 ... 0x61: /* PUSHA / POPA */
+    case 0x68: case 0x6a: /* PUSH imm */
     case 0x6c ... 0x6f: /* INS / OUTS */
+    case 0x8f:          /* POP r/m */
+    case 0x9a:          /* CALL (far, direct) */
+    case 0x9c ... 0x9d: /* PUSHF / POPF */
     case 0xa4 ... 0xa7: /* MOVS / CMPS */
     case 0xaa ... 0xaf: /* STOS / LODS / SCAS */
+    case 0xc2 ... 0xc3: /* RET (near) */
+    case 0xc8 ... 0xc9: /* ENTER / LEAVE */
+    case 0xca ... 0xcb: /* RET (far) */
     case 0xd7:          /* XLAT */
+    case 0xe8:          /* CALL (near, direct) */
+    case X86EMUL_OPC(0x0f, 0xa0):         /* PUSH %fs */
+    case X86EMUL_OPC(0x0f, 0xa1):         /* POP %fs */
+    case X86EMUL_OPC(0x0f, 0xa8):         /* PUSH %gs */
+    case X86EMUL_OPC(0x0f, 0xa9):         /* POP %gs */
     CASE_SIMD_PACKED_INT_VEX(0x0f, 0xf7): /* MASKMOV{Q,DQU} */
                                           /* VMASKMOVDQU */
         return true;
 
+    case 0xff:
+        switch ( state->modrm_reg & 7 )
+        {
+        case 2: /* CALL (near, indirect) */
+        case 6: /* PUSH r/m */
+            return true;
+        }
+        break;
+
     case X86EMUL_OPC(0x0f, 0x01):
         /* Cover CLZERO. */
         return (state->modrm_rm & 7) == 4 && (state->modrm_reg & 7) == 7;
@@ -11501,10 +11563,20 @@ x86_insn_is_mem_access(const struct x86_emulate_state *state,
     return false;
 }
 
+/*
+ * This function means to return 'true' for all supported insns with explicit
+ * writes to memory.  This means also insns which don't have an explicit
+ * memory operand (like PUSH), but it does not mean e.g. segment selector
+ * loads, where the (possible) descriptor table write is considered an
+ * implicit access.
+ */
 bool
 x86_insn_is_mem_write(const struct x86_emulate_state *state,
                       const struct x86_emulate_ctxt *ctxt)
 {
+    if ( mode_64bit() && state->not_64bit )
+        return false;
+
     switch ( state->desc & DstMask )
     {
     case DstMem:
@@ -11516,19 +11588,48 @@ x86_insn_is_mem_write(const struct x86_emulate_state *state,
         break;
 
     default:
+        switch ( ctxt->opcode )
+        {
+        case 0x63:                         /* ARPL */
+            return !mode_64bit();
+        }
+
         return false;
     }
 
     if ( state->modrm_mod == 3 )
-        /* CLZERO is the odd one. */
-        return ctxt->opcode == X86EMUL_OPC(0x0f, 0x01) &&
-               (state->modrm_rm & 7) == 4 && (state->modrm_reg & 7) == 7;
+    {
+        switch ( ctxt->opcode )
+        {
+        case 0xff: /* Grp5 */
+            break;
+
+        case X86EMUL_OPC(0x0f, 0x01): /* CLZERO is the odd one. */
+            return (state->modrm_rm & 7) == 4 && (state->modrm_reg & 7) == 7;
+
+        default:
+            return false;
+        }
+    }
 
     switch ( ctxt->opcode )
     {
+    case 0x06:                           /* PUSH %es */
+    case 0x0e:                           /* PUSH %cs */
+    case 0x16:                           /* PUSH %ss */
+    case 0x1e:                           /* PUSH %ds */
+    case 0x50 ... 0x57:                  /* PUSH reg */
+    case 0x60:                           /* PUSHA */
+    case 0x68: case 0x6a:                /* PUSH imm */
     case 0x6c: case 0x6d:                /* INS */
+    case 0x9a:                           /* CALL (far, direct) */
+    case 0x9c:                           /* PUSHF */
     case 0xa4: case 0xa5:                /* MOVS */
     case 0xaa: case 0xab:                /* STOS */
+    case 0xc8:                           /* ENTER */
+    case 0xe8:                           /* CALL (near, direct) */
+    case X86EMUL_OPC(0x0f, 0xa0):        /* PUSH %fs */
+    case X86EMUL_OPC(0x0f, 0xa8):        /* PUSH %gs */
     case X86EMUL_OPC(0x0f, 0xab):        /* BTS */
     case X86EMUL_OPC(0x0f, 0xb3):        /* BTR */
     case X86EMUL_OPC(0x0f, 0xbb):        /* BTC */
@@ -11586,6 +11687,16 @@ x86_insn_is_mem_write(const struct x86_emulate_state *state,
         }
         break;
 
+    case 0xff:
+        switch ( state->modrm_reg & 7 )
+        {
+        case 2: /* CALL (near, indirect) */
+        case 3: /* CALL (far, indirect) */
+        case 6: /* PUSH r/m */
+            return true;
+        }
+        break;
+
     case X86EMUL_OPC(0x0f, 0x01):
         switch ( state->modrm_reg & 7 )
         {
@@ -11600,7 +11711,7 @@ x86_insn_is_mem_write(const struct x86_emulate_state *state,
         switch ( state->modrm_reg & 7 )
         {
         case 0: /* FXSAVE */
-        case 3: /* {,V}STMXCSR */
+        /* case 3: STMXCSR - handled above */
         case 4: /* XSAVE */
         case 6: /* XSAVEOPT */
             return true;
@@ -11616,7 +11727,6 @@ x86_insn_is_mem_write(const struct x86_emulate_state *state,
         case 1: /* CMPXCHG{8,16}B */
         case 4: /* XSAVEC */
         case 5: /* XSAVES */
-        case 7: /* VMPTRST */
             return true;
         }
         break;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jun 06 23:57:36 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Jun 2020 23:57: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 1jhigy-0005vc-Mk; Sat, 06 Jun 2020 23:57: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=x7q/=7T=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhigx-0005vL-Lt
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:57:35 +0000
X-Inumbo-ID: 7e1ef488-a851-11ea-96fb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 7e1ef488-a851-11ea-96fb-bc764e2007e4;
 Sat, 06 Jun 2020 23:57: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=FTmEFqjU1sbUdGNX3YIVwAg7AYHqAOins/PlQr/ZjeY=; b=pkWSYuavVoIHXOF+e/bhsAEhLb
 G0aexarfvB2Zpn9JD4ABbr0Roi+TKiBfB0Ti/KHzuqtR0pmMzYZZFpGKh4e/F9Eoj2y6mED9omWf/
 ocZxovlPuoS8S3Qb6OGNyXRxcFbimq50Covv1bfEqPMNuIhhpkGCMynneGEYCdhOxApM=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhigw-0002WJ-Ub
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:57:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhigw-0007BO-U2
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:57:34 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86emul: rework CMP and TEST emulation
Message-Id: <E1jhigw-0007BO-U2@xenbits.xenproject.org>
Date: Sat, 06 Jun 2020 23:57: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 20bc1b9cc99b70b17757e1903f629c7a26584790
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri May 29 17:28:45 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri May 29 17:28:45 2020 +0200

    x86emul: rework CMP and TEST emulation
    
    Unlike similarly encoded insns these don't write their memory operands,
    and hence x86_is_mem_write() should return false for them. However,
    rather than adding special logic there, rework how their emulation gets
    done, by making decoding attributes properly describe the r/o nature of
    their memory operands:
    -  change the table entries for opcodes 0x38 and 0x39, with no other
       adjustments to the attributes later on,
    -  for the other opcodes, leave the table entries as they are, and
       override the attributes for the specific sub-cases (identified by
       ModRM.reg).
    
    For opcodes 0x38 and 0x39 the change of the table entries implies
    changing the order of operands as passed to emulate_2op_SrcV(), hence
    the splitting of the cases in the main switch().
    
    Note how this also allows dropping custom LOCK prefix checks.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 37 +++++++++++++++++++++-------------
 1 file changed, 23 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 080732b75b..1d44653007 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -84,7 +84,7 @@ static const opcode_desc_t opcode_table[256] = {
     ByteOp|DstReg|SrcMem|ModRM, DstReg|SrcMem|ModRM,
     ByteOp|DstEax|SrcImm, DstEax|SrcImm, 0, ImplicitOps,
     /* 0x38 - 0x3F */
-    ByteOp|DstMem|SrcReg|ModRM, DstMem|SrcReg|ModRM,
+    ByteOp|DstReg|SrcMem|ModRM, DstReg|SrcMem|ModRM,
     ByteOp|DstReg|SrcMem|ModRM, DstReg|SrcMem|ModRM,
     ByteOp|DstEax|SrcImm, DstEax|SrcImm, 0, ImplicitOps,
     /* 0x40 - 0x4F */
@@ -2481,7 +2481,6 @@ x86_decode_onebyte(
     case 0x60: /* pusha */
     case 0x61: /* popa */
     case 0x62: /* bound */
-    case 0x82: /* Grp1 (x86/32 only) */
     case 0xc4: /* les */
     case 0xc5: /* lds */
     case 0xce: /* into */
@@ -2491,6 +2490,14 @@ x86_decode_onebyte(
         state->not_64bit = true;
         break;
 
+    case 0x82: /* Grp1 (x86/32 only) */
+        state->not_64bit = true;
+        /* fall through */
+    case 0x80: case 0x81: case 0x83: /* Grp1 */
+        if ( (modrm_reg & 7) == 7 ) /* cmp */
+            state->desc = (state->desc & ByteOp) | DstNone | SrcMem;
+        break;
+
     case 0x90: /* nop / pause */
         if ( repe_prefix() )
             ctxt->opcode |= X86EMUL_OPC_F3(0, 0);
@@ -2521,6 +2528,11 @@ x86_decode_onebyte(
         imm2 = insn_fetch_type(uint8_t);
         break;
 
+    case 0xf6: case 0xf7: /* Grp3 */
+        if ( !(modrm_reg & 6) ) /* test */
+            state->desc = (state->desc & ByteOp) | DstNone | SrcMem;
+        break;
+
     case 0xff: /* Grp5 */
         switch ( modrm_reg & 7 )
         {
@@ -3928,13 +3940,11 @@ x86_emulate(
         break;
 
     case 0x38: case 0x39: cmp: /* cmp reg,mem */
-        if ( ops->rmw && dst.type == OP_MEM &&
-             (rc = read_ulong(dst.mem.seg, dst.mem.off, &dst.val,
-                              dst.bytes, ctxt, ops)) != X86EMUL_OKAY )
-            goto done;
-        /* fall through */
+        emulate_2op_SrcV("cmp", dst, src, _regs.eflags);
+        dst.type = OP_NONE;
+        break;
+
     case 0x3a ... 0x3d: /* cmp */
-        generate_exception_if(lock_prefix, EXC_UD);
         emulate_2op_SrcV("cmp", src, dst, _regs.eflags);
         dst.type = OP_NONE;
         break;
@@ -4239,7 +4249,9 @@ x86_emulate(
         case 4: goto and;
         case 5: goto sub;
         case 6: goto xor;
-        case 7: goto cmp;
+        case 7:
+            dst.val = imm1;
+            goto cmp;
         }
         break;
 
@@ -5233,11 +5245,8 @@ x86_emulate(
             unsigned long u[2], v;
 
         case 0 ... 1: /* test */
-            generate_exception_if(lock_prefix, EXC_UD);
-            if ( ops->rmw && dst.type == OP_MEM &&
-                 (rc = read_ulong(dst.mem.seg, dst.mem.off, &dst.val,
-                                  dst.bytes, ctxt, ops)) != X86EMUL_OKAY )
-                goto done;
+            dst.val = imm1;
+            dst.bytes = src.bytes;
             goto test;
         case 2: /* not */
             if ( ops->rmw && dst.type == OP_MEM )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jun 06 23:57:49 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Jun 2020 23:57: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 1jhihB-0005xt-OR; Sat, 06 Jun 2020 23:57: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=x7q/=7T=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhihA-0005xi-1g
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:57:48 +0000
X-Inumbo-ID: 8427ba04-a851-11ea-b15a-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 8427ba04-a851-11ea-b15a-12813bfff9fa;
 Sat, 06 Jun 2020 23:57: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=uLNPXnv9AB4MtdMJ9olAq7wHfePJaIzBHLBJXGtYejg=; b=DrLY0KI815sIaIraZPkogEauQS
 axNOWMP8No84dHQQEUO4kihbFk9dYqBWrLBK6OtU03TW4DPr98Vlbp4z4mw/D7RbzvcDjZgsU3Ek3
 wGYy7bTTYay1QYKiBy6fxnoDdH3PdMW4d6i30htf4MKVoGBjQY5lRxSUw+rR5uFKla/U=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhih7-0002WW-28
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:57:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhih7-0007CB-1P
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:57:45 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86emul: also test decoding and mem access / write logic
Message-Id: <E1jhih7-0007CB-1P@xenbits.xenproject.org>
Date: Sat, 06 Jun 2020 23:57: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 3351acaee706b8e238b031a456bf181f97f167c3
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri May 29 17:29:59 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri May 29 17:29:59 2020 +0200

    x86emul: also test decoding and mem access / write logic
    
    x86emul_is_mem_{access,write}() (and their interaction with
    x86_decode()) have become sufficiently complex that we should have a way
    to test this logic. Start by covering legacy encoded GPR insns, with the
    exception of a few the main emulator doesn't support yet (left as
    comments in the respective tables, or about to be added by subsequent
    patches). This has already helped spot a few flaws in said logic,
    addressed by (revised) earlier patches.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/tests/x86_emulator/Makefile            |   4 +-
 tools/tests/x86_emulator/predicates.c        | 671 +++++++++++++++++++++++++++
 tools/tests/x86_emulator/test_x86_emulator.c |   2 +
 tools/tests/x86_emulator/x86-emulate.c       |   6 +
 tools/tests/x86_emulator/x86-emulate.h       |   6 +
 xen/arch/x86/x86_emulate.c                   |   1 +
 xen/arch/x86/x86_emulate/x86_emulate.c       |  12 +-
 xen/arch/x86/x86_emulate/x86_emulate.h       |   6 +-
 8 files changed, 694 insertions(+), 14 deletions(-)

diff --git a/tools/tests/x86_emulator/Makefile b/tools/tests/x86_emulator/Makefile
index b414773810..48b3e6dce1 100644
--- a/tools/tests/x86_emulator/Makefile
+++ b/tools/tests/x86_emulator/Makefile
@@ -250,7 +250,7 @@ xop.h avx512f.h: simd-fma.c
 
 endif # 32-bit override
 
-$(TARGET): x86-emulate.o cpuid.o test_x86_emulator.o evex-disp8.o wrappers.o
+$(TARGET): x86-emulate.o cpuid.o test_x86_emulator.o evex-disp8.o predicates.o wrappers.o
 	$(HOSTCC) $(HOSTCFLAGS) -o $@ $^
 
 .PHONY: clean
@@ -289,7 +289,7 @@ x86.h := $(addprefix $(XEN_ROOT)/tools/include/xen/asm/,\
                      cpuid.h cpuid-autogen.h)
 x86_emulate.h := x86-emulate.h x86_emulate/x86_emulate.h $(x86.h)
 
-x86-emulate.o cpuid.o test_x86_emulator.o evex-disp8.o wrappers.o: %.o: %.c $(x86_emulate.h)
+x86-emulate.o cpuid.o test_x86_emulator.o evex-disp8.o predicates.o wrappers.o: %.o: %.c $(x86_emulate.h)
 	$(HOSTCC) $(HOSTCFLAGS) -c -g -o $@ $<
 
 x86-emulate.o: x86_emulate/x86_emulate.c
diff --git a/tools/tests/x86_emulator/predicates.c b/tools/tests/x86_emulator/predicates.c
new file mode 100644
index 0000000000..404e03c30d
--- /dev/null
+++ b/tools/tests/x86_emulator/predicates.c
@@ -0,0 +1,671 @@
+#include "x86-emulate.h"
+
+#include <stdio.h>
+
+enum mem_access { mem_none, mem_read, mem_write };
+enum pfx { pfx_none, pfx_66, pfx_f3, pfx_f2 };
+static const uint8_t prefixes[] = { 0x66, 0xf3, 0xf2 };
+
+#define F false
+#define T true
+
+#define N mem_none
+#define R mem_read
+#define W mem_write
+
+/*
+ * ModR/M bytes and immediates don't need spelling out in the opcodes,
+ * unless the implied zeros aren't good enough.
+ */
+static const struct {
+    uint8_t opc[8];
+    uint8_t len[2]; /* 32- and 64-bit mode */
+    bool modrm:1; /* Should register form (also) be tested? */
+    unsigned int mem:2;
+    unsigned int pfx:2;
+#define REG(opc, more...) \
+    { { (opc) | 0 }, more }, /* %?ax */ \
+    { { (opc) | 1 }, more }, /* %?cx */ \
+    { { (opc) | 2 }, more }, /* %?dx */ \
+    { { (opc) | 3 }, more }, /* %?bx */ \
+    { { (opc) | 4 }, more }, /* %?sp */ \
+    { { (opc) | 5 }, more }, /* %?bp */ \
+    { { (opc) | 6 }, more }, /* %?si */ \
+    { { (opc) | 7 }, more }  /* %?di */
+#define CND(opc, more...) \
+    { { (opc) | 0x0 }, more }, /* ..o */ \
+    { { (opc) | 0x1 }, more }, /* ..no */ \
+    { { (opc) | 0x2 }, more }, /* ..c / ..b */ \
+    { { (opc) | 0x3 }, more }, /* ..nc / ..nb */ \
+    { { (opc) | 0x4 }, more }, /* ..z / ..e */ \
+    { { (opc) | 0x5 }, more }, /* ..nz / ..ne */ \
+    { { (opc) | 0x6 }, more }, /* ..be / ..na */ \
+    { { (opc) | 0x7 }, more }, /* ..a / ..nbe */ \
+    { { (opc) | 0x8 }, more }, /* ..s */ \
+    { { (opc) | 0x9 }, more }, /* ..ns */ \
+    { { (opc) | 0xa }, more }, /* ..pe / ..p */ \
+    { { (opc) | 0xb }, more }, /* ..po / ..np */ \
+    { { (opc) | 0xc }, more }, /* ..l / ..nge */ \
+    { { (opc) | 0xd }, more }, /* ..ge / ..nl */ \
+    { { (opc) | 0xe }, more }, /* ..le / ..ng */ \
+    { { (opc) | 0xf }, more }  /* ..g / .. nle */
+} legacy[] = {
+    { { 0x00 }, { 2, 2 }, T, W }, /* add */
+    { { 0x01 }, { 2, 2 }, T, W }, /* add */
+    { { 0x02 }, { 2, 2 }, T, R }, /* add */
+    { { 0x03 }, { 2, 2 }, T, R }, /* add */
+    { { 0x04 }, { 2, 2 }, F, N }, /* add */
+    { { 0x05 }, { 5, 5 }, F, N }, /* add */
+    { { 0x06 }, { 1, 0 }, F, W }, /* push %es */
+    { { 0x07 }, { 1, 0 }, F, R }, /* pop %es */
+    { { 0x08 }, { 2, 2 }, T, W }, /* or */
+    { { 0x09 }, { 2, 2 }, T, W }, /* or */
+    { { 0x0a }, { 2, 2 }, T, R }, /* or */
+    { { 0x0b }, { 2, 2 }, T, R }, /* or */
+    { { 0x0c }, { 2, 2 }, F, N }, /* or */
+    { { 0x0d }, { 5, 5 }, F, N }, /* or */
+    { { 0x0e }, { 1, 0 }, F, W }, /* push %cs */
+    { { 0x10 }, { 2, 2 }, T, W }, /* adc */
+    { { 0x11 }, { 2, 2 }, T, W }, /* adc */
+    { { 0x12 }, { 2, 2 }, T, R }, /* adc */
+    { { 0x13 }, { 2, 2 }, T, R }, /* adc */
+    { { 0x14 }, { 2, 2 }, F, N }, /* adc */
+    { { 0x15 }, { 5, 5 }, F, N }, /* adc */
+    { { 0x16 }, { 1, 0 }, F, W }, /* push %ss */
+    { { 0x17 }, { 1, 0 }, F, R }, /* pop %ss */
+    { { 0x18 }, { 2, 2 }, T, W }, /* adc */
+    { { 0x19 }, { 2, 2 }, T, W }, /* adc */
+    { { 0x1a }, { 2, 2 }, T, R }, /* adc */
+    { { 0x1b }, { 2, 2 }, T, R }, /* adc */
+    { { 0x1c }, { 2, 2 }, F, N }, /* adc */
+    { { 0x1d }, { 5, 5 }, F, N }, /* adc */
+    { { 0x1e }, { 1, 0 }, F, W }, /* push %ds */
+    { { 0x1f }, { 1, 0 }, F, R }, /* pop %ds */
+    { { 0x20 }, { 2, 2 }, T, W }, /* and */
+    { { 0x21 }, { 2, 2 }, T, W }, /* and */
+    { { 0x22 }, { 2, 2 }, T, R }, /* and */
+    { { 0x23 }, { 2, 2 }, T, R }, /* and */
+    { { 0x24 }, { 2, 2 }, F, N }, /* and */
+    { { 0x25 }, { 5, 5 }, F, N }, /* and */
+    { { 0x27 }, { 1, 0 }, F, N }, /* daa */
+    { { 0x28 }, { 2, 2 }, T, W }, /* sub */
+    { { 0x29 }, { 2, 2 }, T, W }, /* sub */
+    { { 0x2a }, { 2, 2 }, T, R }, /* sub */
+    { { 0x2b }, { 2, 2 }, T, R }, /* sub */
+    { { 0x2c }, { 2, 2 }, F, N }, /* sub */
+    { { 0x2d }, { 5, 5 }, F, N }, /* sub */
+    { { 0x2f }, { 1, 0 }, F, N }, /* das */
+    { { 0x30 }, { 2, 2 }, T, W }, /* xor */
+    { { 0x31 }, { 2, 2 }, T, W }, /* xor */
+    { { 0x32 }, { 2, 2 }, T, R }, /* xor */
+    { { 0x33 }, { 2, 2 }, T, R }, /* xor */
+    { { 0x34 }, { 2, 2 }, F, N }, /* xor */
+    { { 0x35 }, { 5, 5 }, F, N }, /* xor */
+    { { 0x37 }, { 1, 0 }, F, N }, /* aaa */
+    { { 0x38 }, { 2, 2 }, T, R }, /* cmp */
+    { { 0x39 }, { 2, 2 }, T, R }, /* cmp */
+    { { 0x3a }, { 2, 2 }, T, R }, /* cmp */
+    { { 0x3b }, { 2, 2 }, T, R }, /* cmp */
+    { { 0x3c }, { 2, 2 }, F, N }, /* cmp */
+    { { 0x3d }, { 5, 5 }, F, N }, /* cmp */
+    { { 0x3f }, { 1, 0 }, F, N }, /* aas */
+    REG(0x40,   { 1, 0 }, F, N ), /* inc */
+    REG(0x48,   { 1, 0 }, F, N ), /* dec */
+    REG(0x50,   { 1, 0 }, F, W ), /* push */
+    REG(0x58,   { 1, 0 }, F, R ), /* pop */
+    { { 0x60 }, { 1, 0 }, F, W }, /* pusha */
+    { { 0x61 }, { 1, 0 }, F, R }, /* popa */
+    { { 0x62 }, { 2, 0 }, F, R }, /* bound */
+    { { 0x63 }, { 2, 0 }, F, W }, /* arpl */
+    { { 0x63 }, { 0, 2 }, F, R }, /* movsxd */
+    { { 0x68 }, { 5, 5 }, F, W }, /* push */
+    { { 0x69 }, { 6, 6 }, T, R }, /* imul */
+    { { 0x6a }, { 2, 2 }, F, W }, /* push */
+    { { 0x6b }, { 3, 3 }, T, R }, /* imul */
+    { { 0x6c }, { 1, 1 }, F, W }, /* ins */
+    { { 0x6d }, { 1, 1 }, F, W }, /* ins */
+    { { 0x6e }, { 1, 1 }, F, R }, /* outs */
+    { { 0x6f }, { 1, 1 }, F, R }, /* outs */
+    CND(0x70,   { 2, 2 }, F, N ), /* j<cc> */
+    { { 0x80, 0x00 }, { 3, 3 }, T, W }, /* add */
+    { { 0x80, 0x08 }, { 3, 3 }, T, W }, /* or */
+    { { 0x80, 0x10 }, { 3, 3 }, T, W }, /* adc */
+    { { 0x80, 0x18 }, { 3, 3 }, T, W }, /* sbb */
+    { { 0x80, 0x20 }, { 3, 3 }, T, W }, /* and */
+    { { 0x80, 0x28 }, { 3, 3 }, T, W }, /* sub */
+    { { 0x80, 0x30 }, { 3, 3 }, T, W }, /* xor */
+    { { 0x80, 0x38 }, { 3, 3 }, T, R }, /* cmp */
+    { { 0x81, 0x00 }, { 6, 6 }, T, W }, /* add */
+    { { 0x81, 0x08 }, { 6, 6 }, T, W }, /* or */
+    { { 0x81, 0x10 }, { 6, 6 }, T, W }, /* adc */
+    { { 0x81, 0x18 }, { 6, 6 }, T, W }, /* sbb */
+    { { 0x81, 0x20 }, { 6, 6 }, T, W }, /* and */
+    { { 0x81, 0x28 }, { 6, 6 }, T, W }, /* sub */
+    { { 0x81, 0x30 }, { 6, 6 }, T, W }, /* add */
+    { { 0x81, 0x38 }, { 6, 6 }, T, R }, /* cmp */
+    { { 0x82, 0x00 }, { 3, 0 }, T, W }, /* xor */
+    { { 0x82, 0x08 }, { 3, 0 }, T, W }, /* or */
+    { { 0x82, 0x10 }, { 3, 0 }, T, W }, /* adc */
+    { { 0x82, 0x18 }, { 3, 0 }, T, W }, /* sbb */
+    { { 0x82, 0x20 }, { 3, 0 }, T, W }, /* and */
+    { { 0x82, 0x28 }, { 3, 0 }, T, W }, /* sub */
+    { { 0x82, 0x30 }, { 3, 0 }, T, W }, /* xor */
+    { { 0x82, 0x38 }, { 3, 0 }, T, R }, /* cmp */
+    { { 0x83, 0x00 }, { 3, 3 }, T, W }, /* add */
+    { { 0x83, 0x08 }, { 3, 3 }, T, W }, /* or */
+    { { 0x83, 0x10 }, { 3, 3 }, T, W }, /* adc */
+    { { 0x83, 0x18 }, { 3, 3 }, T, W }, /* sbb */
+    { { 0x83, 0x20 }, { 3, 3 }, T, W }, /* and */
+    { { 0x83, 0x28 }, { 3, 3 }, T, W }, /* sub */
+    { { 0x83, 0x30 }, { 3, 3 }, T, W }, /* xor */
+    { { 0x83, 0x38 }, { 3, 3 }, T, R }, /* cmp */
+    { { 0x84 }, { 2, 2 }, T, R }, /* test */
+    { { 0x85 }, { 2, 2 }, T, R }, /* test */
+    { { 0x86 }, { 2, 2 }, T, W }, /* xchg */
+    { { 0x87 }, { 2, 2 }, T, W }, /* xchg */
+    { { 0x88 }, { 2, 2 }, T, W }, /* mov */
+    { { 0x89 }, { 2, 2 }, T, W }, /* mov */
+    { { 0x8a }, { 2, 2 }, T, R }, /* mov */
+    { { 0x8b }, { 2, 2 }, T, R }, /* mov */
+    { { 0x8c }, { 2, 2 }, T, W }, /* mov */
+    { { 0x8d }, { 2, 2 }, F, N }, /* lea */
+    { { 0x8e }, { 2, 2 }, T, R }, /* mov */
+    { { 0x8f, 0x00 }, { 2, 2 }, F, W }, /* pop */
+    { { 0x8f, 0xc0 }, { 2, 2 }, F, R }, /* pop */
+    REG(0x90,   { 1, 0 }, F, N ), /* xchg */
+    { { 0x98 }, { 1, 1 }, F, N }, /* cbw */
+    { { 0x99 }, { 1, 1 }, F, N }, /* cwd */
+    { { 0x9a }, { 7, 0 }, F, W }, /* lcall */
+    { { 0x9b }, { 1, 1 }, F, N }, /* wait */
+    { { 0x9c }, { 1, 1 }, F, W }, /* pushf */
+    { { 0x9d }, { 1, 1 }, F, R }, /* popf */
+    { { 0x9e }, { 1, 1 }, F, N }, /* sahf */
+    { { 0x9f }, { 1, 1 }, F, N }, /* lahf */
+    { { 0xa0 }, { 5, 9 }, F, R }, /* mov */
+    { { 0xa1 }, { 5, 9 }, F, R }, /* mov */
+    { { 0xa2 }, { 5, 9 }, F, W }, /* mov */
+    { { 0xa3 }, { 5, 9 }, F, W }, /* mov */
+    { { 0xa4 }, { 1, 1 }, F, W }, /* movs */
+    { { 0xa5 }, { 1, 1 }, F, W }, /* movs */
+    { { 0xa6 }, { 1, 1 }, F, R }, /* cmps */
+    { { 0xa7 }, { 1, 1 }, F, R }, /* cmps */
+    { { 0xa8 }, { 2, 2 }, F, N }, /* test */
+    { { 0xa9 }, { 5, 5 }, F, N }, /* test */
+    { { 0xaa }, { 1, 1 }, F, W }, /* stos */
+    { { 0xab }, { 1, 1 }, F, W }, /* stos */
+    { { 0xac }, { 1, 1 }, F, R }, /* lods */
+    { { 0xad }, { 1, 1 }, F, R }, /* lods */
+    { { 0xae }, { 1, 1 }, F, R }, /* scas */
+    { { 0xaf }, { 1, 1 }, F, R }, /* scas */
+    REG(0xb0,   { 2, 2 }, F, N ), /* mov */
+    REG(0xb8,   { 5, 5 }, F, N ), /* mov */
+    { { 0xc0, 0x00 }, { 3, 3 }, T, W }, /* rol */
+    { { 0xc0, 0x08 }, { 3, 3 }, T, W }, /* ror */
+    { { 0xc0, 0x10 }, { 3, 3 }, T, W }, /* rcl */
+    { { 0xc0, 0x18 }, { 3, 3 }, T, W }, /* rcr */
+    { { 0xc0, 0x20 }, { 3, 3 }, T, W }, /* shl */
+    { { 0xc0, 0x28 }, { 3, 3 }, T, W }, /* shr */
+    { { 0xc0, 0x30 }, { 3, 3 }, T, W }, /* sal */
+    { { 0xc0, 0x38 }, { 3, 3 }, T, W }, /* sar */
+    { { 0xc1, 0x00 }, { 3, 3 }, T, W }, /* rol */
+    { { 0xc1, 0x08 }, { 3, 3 }, T, W }, /* ror */
+    { { 0xc1, 0x10 }, { 3, 3 }, T, W }, /* rcl */
+    { { 0xc1, 0x18 }, { 3, 3 }, T, W }, /* rcr */
+    { { 0xc1, 0x20 }, { 3, 3 }, T, W }, /* shl */
+    { { 0xc1, 0x28 }, { 3, 3 }, T, W }, /* shr */
+    { { 0xc1, 0x30 }, { 3, 3 }, T, W }, /* sal */
+    { { 0xc1, 0x38 }, { 3, 3 }, T, W }, /* sar */
+    { { 0xc2 }, { 3, 3 }, F, R }, /* ret */
+    { { 0xc3 }, { 1, 1 }, F, R }, /* ret */
+    { { 0xc4 }, { 2, 0 }, F, R }, /* les */
+    { { 0xc5 }, { 2, 0 }, F, R }, /* lds */
+    { { 0xc6, 0x00 }, { 3, 3 }, T, W }, /* mov */
+    { { 0xc6, 0xf8 }, { 3, 3 }, F, N }, /* xabort */
+    { { 0xc7, 0x00 }, { 6, 6 }, T, W }, /* mov */
+    { { 0xc7, 0xf8 }, { 6, 6 }, F, N }, /* xbegin */
+    { { 0xc8 }, { 4, 4 }, F, W }, /* enter */
+    { { 0xc9 }, { 1, 1 }, F, R }, /* leave */
+    { { 0xca }, { 3, 3 }, F, R }, /* lret */
+    { { 0xcb }, { 1, 1 }, F, R }, /* lret */
+    { { 0xcc }, { 1, 1 }, F, N }, /* int3 */
+    { { 0xcd }, { 2, 2 }, F, N }, /* int */
+    { { 0xce }, { 1, 0 }, F, N }, /* into */
+    { { 0xcf }, { 1, 1 }, F, N }, /* iret */
+    { { 0xd0, 0x00 }, { 2, 2 }, T, W }, /* rol */
+    { { 0xd0, 0x08 }, { 2, 2 }, T, W }, /* ror */
+    { { 0xd0, 0x10 }, { 2, 2 }, T, W }, /* rcl */
+    { { 0xd0, 0x18 }, { 2, 2 }, T, W }, /* rcr */
+    { { 0xd0, 0x20 }, { 2, 2 }, T, W }, /* shl */
+    { { 0xd0, 0x28 }, { 2, 2 }, T, W }, /* shr */
+    { { 0xd0, 0x30 }, { 2, 2 }, T, W }, /* sal */
+    { { 0xd0, 0x38 }, { 2, 2 }, T, W }, /* sar */
+    { { 0xd1, 0x00 }, { 2, 2 }, T, W }, /* rol */
+    { { 0xd1, 0x08 }, { 2, 2 }, T, W }, /* ror */
+    { { 0xd1, 0x10 }, { 2, 2 }, T, W }, /* rcl */
+    { { 0xd1, 0x18 }, { 2, 2 }, T, W }, /* rcr */
+    { { 0xd1, 0x20 }, { 2, 2 }, T, W }, /* shl */
+    { { 0xd1, 0x28 }, { 2, 2 }, T, W }, /* shr */
+    { { 0xd1, 0x30 }, { 2, 2 }, T, W }, /* sal */
+    { { 0xd1, 0x38 }, { 2, 2 }, T, W }, /* sar */
+    { { 0xd2, 0x00 }, { 2, 2 }, T, W }, /* rol */
+    { { 0xd2, 0x08 }, { 2, 2 }, T, W }, /* ror */
+    { { 0xd2, 0x10 }, { 2, 2 }, T, W }, /* rcl */
+    { { 0xd2, 0x18 }, { 2, 2 }, T, W }, /* rcr */
+    { { 0xd2, 0x20 }, { 2, 2 }, T, W }, /* shl */
+    { { 0xd2, 0x28 }, { 2, 2 }, T, W }, /* shr */
+    { { 0xd2, 0x30 }, { 2, 2 }, T, W }, /* sal */
+    { { 0xd2, 0x38 }, { 2, 2 }, T, W }, /* sar */
+    { { 0xd3, 0x00 }, { 2, 2 }, T, W }, /* rol */
+    { { 0xd3, 0x08 }, { 2, 2 }, T, W }, /* ror */
+    { { 0xd3, 0x10 }, { 2, 2 }, T, W }, /* rcl */
+    { { 0xd3, 0x18 }, { 2, 2 }, T, W }, /* rcr */
+    { { 0xd3, 0x20 }, { 2, 2 }, T, W }, /* shl */
+    { { 0xd3, 0x28 }, { 2, 2 }, T, W }, /* shr */
+    { { 0xd3, 0x30 }, { 2, 2 }, T, W }, /* sal */
+    { { 0xd3, 0x38 }, { 2, 2 }, T, W }, /* sar */
+    { { 0xd4 }, { 2, 0 }, F, N }, /* aam */
+    { { 0xd5 }, { 2, 0 }, F, N }, /* aad */
+    { { 0xd6 }, { 1, 0 }, F, N }, /* salc */
+    { { 0xd7 }, { 1, 1 }, F, R }, /* xlat */
+    { { 0xe0 }, { 2, 2 }, F, N }, /* loopne */
+    { { 0xe1 }, { 2, 2 }, F, N }, /* loope */
+    { { 0xe2 }, { 2, 2 }, F, N }, /* loop */
+    { { 0xe3 }, { 2, 2 }, F, N }, /* j?cxz */
+    { { 0xe4 }, { 2, 2 }, F, N }, /* in */
+    { { 0xe5 }, { 2, 2 }, F, N }, /* in */
+    { { 0xe6 }, { 2, 2 }, F, N }, /* out */
+    { { 0xe7 }, { 2, 2 }, F, N }, /* out */
+    { { 0xe8 }, { 5, 5 }, F, W }, /* call */
+    { { 0xe9 }, { 5, 5 }, F, N }, /* jmp */
+    { { 0xea }, { 7, 0 }, F, N }, /* ljmp */
+    { { 0xeb }, { 2, 2 }, F, N }, /* jmp */
+    { { 0xec }, { 1, 1 }, F, N }, /* in */
+    { { 0xed }, { 1, 1 }, F, N }, /* in */
+    { { 0xee }, { 1, 1 }, F, N }, /* out */
+    { { 0xef }, { 1, 1 }, F, N }, /* out */
+    { { 0xf1 }, { 1, 1 }, F, N }, /* icebp */
+    { { 0xf4 }, { 1, 1 }, F, N }, /* hlt */
+    { { 0xf5 }, { 1, 1 }, F, N }, /* cmc */
+    { { 0xf6, 0x00 }, { 3, 3 }, T, R }, /* test */
+    { { 0xf6, 0x08 }, { 3, 3 }, T, R }, /* test */
+    { { 0xf6, 0x10 }, { 2, 2 }, T, W }, /* not */
+    { { 0xf6, 0x18 }, { 2, 2 }, T, W }, /* neg */
+    { { 0xf6, 0x20 }, { 2, 2 }, T, R }, /* mul */
+    { { 0xf6, 0x28 }, { 2, 2 }, T, R }, /* imul */
+    { { 0xf6, 0x30 }, { 2, 2 }, T, R }, /* div */
+    { { 0xf6, 0x38 }, { 2, 2 }, T, R }, /* idiv */
+    { { 0xf7, 0x00 }, { 6, 6 }, T, R }, /* test */
+    { { 0xf7, 0x08 }, { 6, 6 }, T, R }, /* test */
+    { { 0xf7, 0x10 }, { 2, 2 }, T, W }, /* not */
+    { { 0xf7, 0x18 }, { 2, 2 }, T, W }, /* neg */
+    { { 0xf7, 0x20 }, { 2, 2 }, T, R }, /* mul */
+    { { 0xf7, 0x28 }, { 2, 2 }, T, R }, /* imul */
+    { { 0xf7, 0x30 }, { 2, 2 }, T, R }, /* div */
+    { { 0xf7, 0x38 }, { 2, 2 }, T, R }, /* idiv */
+    { { 0xf8 }, { 1, 1 }, F, N }, /* clc */
+    { { 0xf9 }, { 1, 1 }, F, N }, /* stc */
+    { { 0xfa }, { 1, 1 }, F, N }, /* cli */
+    { { 0xfb }, { 1, 1 }, F, N }, /* sti */
+    { { 0xfc }, { 1, 1 }, F, N }, /* cld */
+    { { 0xfd }, { 1, 1 }, F, N }, /* std */
+    { { 0xfe, 0x00 }, { 2, 2 }, T, W }, /* inc */
+    { { 0xfe, 0x08 }, { 2, 2 }, T, W }, /* dec */
+    { { 0xff, 0x00 }, { 2, 2 }, T, W }, /* inc */
+    { { 0xff, 0x08 }, { 2, 2 }, T, W }, /* dec */
+    { { 0xff, 0x10 }, { 2, 2 }, F, W }, /* call */
+    { { 0xff, 0x18 }, { 2, 2 }, F, W }, /* lcall */
+    { { 0xff, 0x20 }, { 2, 2 }, T, R }, /* jmp */
+    { { 0xff, 0x28 }, { 2, 2 }, F, R }, /* ljmp */
+    { { 0xff, 0x30 }, { 2, 2 }, F, W }, /* push */
+    { { 0xff, 0xd0 }, { 2, 2 }, F, W }, /* call */
+    { { 0xff, 0xf0 }, { 2, 2 }, F, W }, /* push */
+}, legacy_0f[] = {
+    { { 0x00, 0x00 }, { 2, 2 }, T, W }, /* sldt */
+    { { 0x00, 0x08 }, { 2, 2 }, T, W }, /* str */
+    { { 0x00, 0x10 }, { 2, 2 }, T, R }, /* lldt */
+    { { 0x00, 0x18 }, { 2, 2 }, T, R }, /* ltr */
+    { { 0x00, 0x20 }, { 2, 2 }, T, R }, /* verr */
+    { { 0x00, 0x28 }, { 2, 2 }, T, R }, /* verw */
+    { { 0x01, 0x00 }, { 2, 2 }, F, W }, /* sgdt */
+    { { 0x01, 0x08 }, { 2, 2 }, F, W }, /* sidt */
+    { { 0x01, 0x10 }, { 2, 2 }, F, R }, /* lgdt */
+    { { 0x01, 0x18 }, { 2, 2 }, F, R }, /* lidt */
+    { { 0x01, 0x20 }, { 2, 2 }, T, W }, /* smsw */
+    /*{ 0x01, 0x28 }, { 2, 2 }, F, W, pfx_f3 }, rstorssp */
+    { { 0x01, 0x30 }, { 2, 2 }, T, R }, /* lmsw */
+    { { 0x01, 0x38 }, { 2, 2 }, F, N }, /* invlpg */
+    { { 0x01, 0xc0 }, { 2, 2 }, T, N }, /* enclv */
+    { { 0x01, 0xc1 }, { 2, 2 }, T, N }, /* vmcall */
+    /*{ 0x01, 0xc2 }, { 2, 2 }, F, R }, vmlaunch */
+    /*{ 0x01, 0xc3 }, { 2, 2 }, F, R }, vmresume */
+    { { 0x01, 0xc4 }, { 2, 2 }, T, N }, /* vmxoff */
+    { { 0x01, 0xc5 }, { 2, 2 }, T, N }, /* pconfig */
+    { { 0x01, 0xc8 }, { 2, 2 }, T, N }, /* monitor */
+    { { 0x01, 0xc9 }, { 2, 2 }, T, N }, /* mwait */
+    { { 0x01, 0xca }, { 2, 2 }, T, N }, /* clac */
+    { { 0x01, 0xcb }, { 2, 2 }, T, N }, /* stac */
+    { { 0x01, 0xcf }, { 2, 2 }, T, N }, /* encls */
+    { { 0x01, 0xd0 }, { 2, 2 }, T, N }, /* xgetbv */
+    { { 0x01, 0xd1 }, { 2, 2 }, T, N }, /* xsetbv */
+    { { 0x01, 0xd4 }, { 2, 2 }, T, N }, /* vmfunc */
+    { { 0x01, 0xd5 }, { 2, 2 }, T, N }, /* xend */
+    { { 0x01, 0xd6 }, { 2, 2 }, T, N }, /* xtest */
+    { { 0x01, 0xd7 }, { 2, 2 }, T, N }, /* enclu */
+    /*{ 0x01, 0xd8 }, { 2, 2 }, F, R }, vmrun */
+    { { 0x01, 0xd9 }, { 2, 2 }, T, N }, /* vmcall */
+    { { 0x01, 0xd9 }, { 2, 2 }, T, N, pfx_f3 }, /* vmgexit */
+    { { 0x01, 0xd9 }, { 2, 2 }, T, N, pfx_f2 }, /* vmgexit */
+    /*{ 0x01, 0xda }, { 2, 2 }, F, R }, vmload */
+    /*{ 0x01, 0xdb }, { 2, 2 }, F, W }, vmsave */
+    { { 0x01, 0xdc }, { 2, 2 }, T, N }, /* stgi */
+    { { 0x01, 0xdd }, { 2, 2 }, T, N }, /* clgi */
+    /*{ 0x01, 0xde }, { 2, 2 }, F, R }, skinit */
+    { { 0x01, 0xdf }, { 2, 2 }, T, N }, /* invlpga */
+    { { 0x01, 0xe8 }, { 2, 2 }, T, N }, /* serialize */
+    /*{ 0x01, 0xe8 }, { 2, 2 }, F, W, pfx_f3 }, setssbsy */
+    { { 0x01, 0xe8 }, { 2, 2 }, T, N, pfx_f2 }, /* xsusldtrk */
+    { { 0x01, 0xe9 }, { 2, 2 }, T, N, pfx_f2 }, /* xresldtrk */
+    /*{ 0x01, 0xea }, { 2, 2 }, F, W, pfx_f3 }, saveprevssp */
+    { { 0x01, 0xee }, { 2, 2 }, T, N }, /* rdpkru */
+    { { 0x01, 0xef }, { 2, 2 }, T, N }, /* wrpkru */
+    { { 0x01, 0xf8 }, { 0, 2 }, T, N }, /* swapgs */
+    { { 0x01, 0xf9 }, { 2, 2 }, T, N }, /* rdtscp */
+    { { 0x01, 0xfa }, { 2, 2 }, T, N }, /* monitorx */
+    { { 0x01, 0xfa }, { 2, 2 }, T, N, pfx_f3 }, /* mcommit */
+    { { 0x01, 0xfb }, { 2, 2 }, T, N }, /* mwaitx */
+    { { 0x01, 0xfc }, { 2, 2 }, F, W }, /* clzero */
+    { { 0x01, 0xfd }, { 2, 2 }, T, N }, /* rdpru */
+    { { 0x01, 0xfe }, { 2, 2 }, T, N }, /* invlpgb */
+    { { 0x01, 0xfe }, { 0, 2 }, T, N, pfx_f3 }, /* rmpadjust */
+    { { 0x01, 0xfe }, { 0, 2 }, T, N, pfx_f2 }, /* rmpupdate */
+    { { 0x01, 0xff }, { 2, 2 }, T, N }, /* tlbsync */
+    { { 0x01, 0xff }, { 0, 2 }, T, N, pfx_f3 }, /* psmash */
+    { { 0x01, 0xff }, { 0, 2 }, T, N, pfx_f2 }, /* pvalidate */
+    { { 0x02 }, { 2, 2 }, T, R }, /* lar */
+    { { 0x03 }, { 2, 2 }, T, R }, /* lsl */
+    { { 0x05 }, { 1, 1 }, F, N }, /* syscall */
+    { { 0x06 }, { 1, 1 }, F, N }, /* clts */
+    { { 0x07 }, { 1, 1 }, F, N }, /* sysret */
+    { { 0x08 }, { 1, 1 }, F, N }, /* invd */
+    { { 0x09 }, { 1, 1 }, F, N }, /* wbinvd */
+    { { 0x09 }, { 1, 1 }, F, N, pfx_f3 }, /* wbnoinvd */
+    { { 0x0b }, { 1, 1 }, F, N }, /* ud2 */
+    { { 0x0d, 0x00 }, { 2, 2 }, F, N }, /* prefetch */
+    { { 0x0d, 0x08 }, { 2, 2 }, F, N }, /* prefetchw */
+    { { 0x0e }, { 1, 1 }, F, N }, /* femms */
+    { { 0x18, 0x00 }, { 2, 2 }, F, N }, /* prefetchnta */
+    { { 0x18, 0x08 }, { 2, 2 }, F, N }, /* prefetch0 */
+    { { 0x18, 0x10 }, { 2, 2 }, F, N }, /* prefetch1 */
+    { { 0x18, 0x18 }, { 2, 2 }, F, N }, /* prefetch2 */
+    /*{ 0x1a }, { 2, 2 }, F, R }, bndldx */
+    /*{ 0x1a }, { 2, 2 }, T, R, pfx_66 }, bndmov */
+    { { 0x1a }, { 2, 2 }, T, N, pfx_f3 }, /* bndcl */
+    { { 0x1a }, { 2, 2 }, T, N, pfx_f2 }, /* bndcu */
+    /*{ 0x1b }, { 2, 2 }, F, W }, bndstx */
+    /*{ 0x1b }, { 2, 2 }, T, W, pfx_66 }, bndmov */
+    { { 0x1b }, { 2, 2 }, F, N, pfx_f3 }, /* bndmk */
+    { { 0x1b }, { 2, 2 }, T, N, pfx_f2 }, /* bndcn */
+    { { 0x1c, 0x00 }, { 2, 2 }, F, N }, /* cldemote */
+    { { 0x1e, 0xc8 }, { 2, 2 }, F, N, pfx_f3 }, /* rdssp */
+    { { 0x1e, 0xfa }, { 2, 2 }, F, N, pfx_f3 }, /* endbr64 */
+    { { 0x1e, 0xfb }, { 2, 2 }, F, N, pfx_f3 }, /* endbr32 */
+    { { 0x1f, 0x00 }, { 2, 2 }, T, N }, /* nop */
+    { { 0x20 }, { 2, 2 }, T, N }, /* mov */
+    { { 0x21 }, { 2, 2 }, T, N }, /* mov */
+    { { 0x22 }, { 2, 2 }, T, N }, /* mov */
+    { { 0x23 }, { 2, 2 }, T, N }, /* mov */
+    { { 0x30 }, { 1, 1 }, F, N }, /* wrmsr */
+    { { 0x31 }, { 1, 1 }, F, N }, /* rdtsc */
+    { { 0x32 }, { 1, 1 }, F, N }, /* rdmsr */
+    { { 0x33 }, { 1, 1 }, F, N }, /* rdpmc */
+    { { 0x34 }, { 1, 1 }, F, N }, /* sysenter */
+    { { 0x35 }, { 1, 1 }, F, N }, /* sysexit */
+    CND(0x40,   { 2, 2 }, T, R ), /* cmov<cc> */
+    /*{ 0x78 }, { 2, 2 }, T, W }, vmread */
+    { { 0x79 }, { 2, 2 }, T, R }, /* vmwrite */
+    CND(0x80,   { 5, 5 }, F, N ), /* j<cc> */
+    CND(0x90,   { 2, 2 }, T, W ), /* set<cc> */
+    { { 0xa0 }, { 1, 1 }, F, W }, /* push %fs */
+    { { 0xa1 }, { 1, 1 }, F, R }, /* pop %fs */
+    { { 0xa2 }, { 1, 1 }, F, N }, /* cpuid */
+    { { 0xa3 }, { 2, 2 }, T, R }, /* bt */
+    { { 0xa4 }, { 3, 3 }, T, W }, /* shld */
+    { { 0xa5 }, { 2, 2 }, T, W }, /* shld */
+    { { 0xa8 }, { 1, 1 }, F, W }, /* push %gs */
+    { { 0xa9 }, { 1, 1 }, F, R }, /* pop %gs */
+    { { 0xaa }, { 1, 1 }, F, N }, /* rsm */
+    { { 0xab }, { 2, 2 }, T, W }, /* bts */
+    { { 0xac }, { 3, 3 }, T, W }, /* shrd */
+    { { 0xad }, { 2, 2 }, T, W }, /* shrd */
+    { { 0xae, 0x00 }, { 2, 2 }, F, W }, /* fxsave */
+    { { 0xae, 0x08 }, { 2, 2 }, F, R }, /* fxrstor */
+    { { 0xae, 0x10 }, { 2, 2 }, F, R }, /* ldmxcsr */
+    { { 0xae, 0x18 }, { 2, 2 }, F, W }, /* stmxcsr */
+    { { 0xae, 0x20 }, { 2, 2 }, F, W }, /* xsave */
+    { { 0xae, 0x20 }, { 2, 2 }, F, R, pfx_f3 }, /* ptwrite */
+    { { 0xae, 0x28 }, { 2, 2 }, F, R }, /* xrstor */
+    { { 0xae, 0x30 }, { 2, 2 }, F, W }, /* xsaveopt */
+    { { 0xae, 0x30 }, { 2, 2 }, F, N, pfx_66 }, /* clwb */
+    /*{ 0xae, 0x30 }, { 2, 2 }, F, W, pfx_f3 }, clrssbsy */
+    { { 0xae, 0x38 }, { 2, 2 }, F, N }, /* clflush */
+    { { 0xae, 0x38 }, { 2, 2 }, F, N, pfx_66 }, /* clflushopt */
+    { { 0xae, 0xc0 }, { 0, 2 }, F, N, pfx_f3 }, /* rdfsbase */
+    { { 0xae, 0xc8 }, { 0, 2 }, F, N, pfx_f3 }, /* rdgsbase */
+    { { 0xae, 0xd0 }, { 0, 2 }, F, N, pfx_f3 }, /* wrfsbase */
+    { { 0xae, 0xd8 }, { 0, 2 }, F, N, pfx_f3 }, /* wrgsbase */
+    { { 0xae, 0xe8 }, { 2, 2 }, F, N }, /* lfence */
+    /*{ 0xae, 0xe8 }, { 2, 2 }, F, R, pfx_f3 }, incssp */
+    { { 0xae, 0xf0 }, { 2, 2 }, F, N }, /* mfence */
+    { { 0xae, 0xf0 }, { 2, 2 }, F, N, pfx_66 }, /* tpause */
+    { { 0xae, 0xf0 }, { 2, 2 }, F, N, pfx_f3 }, /* umonitor */
+    { { 0xae, 0xf0 }, { 2, 2 }, F, N, pfx_f2 }, /* umwait */
+    { { 0xae, 0xf8 }, { 2, 2 }, F, N }, /* sfence */
+    { { 0xaf }, { 2, 2 }, T, R }, /* imul */
+    { { 0xb0 }, { 2, 2 }, F, W }, /* cmpxchg */
+    { { 0xb1 }, { 2, 2 }, F, W }, /* cmpxchg */
+    { { 0xb2 }, { 2, 2 }, F, R }, /* lss */
+    { { 0xb3 }, { 2, 2 }, T, W }, /* btr */
+    { { 0xb4 }, { 2, 2 }, F, R }, /* lfs */
+    { { 0xb5 }, { 2, 2 }, F, R }, /* lgs */
+    { { 0xb6 }, { 2, 2 }, F, R }, /* movzx */
+    { { 0xb7 }, { 2, 2 }, F, R }, /* movzx */
+    { { 0xb8 }, { 2, 2 }, F, R }, /* popcnt */
+    { { 0xb9 }, { 2, 2 }, F, N }, /* ud1 */
+    { { 0xba, 0x20 }, { 3, 3 }, T, R }, /* bt */
+    { { 0xba, 0x28 }, { 3, 3 }, T, W }, /* bts */
+    { { 0xba, 0x30 }, { 3, 3 }, T, W }, /* btr */
+    { { 0xba, 0x38 }, { 3, 3 }, T, W }, /* btc */
+    { { 0xbb }, { 2, 2 }, T, W }, /* btc */
+    { { 0xbc }, { 2, 2 }, T, R }, /* bsf */
+    { { 0xbc }, { 2, 2 }, T, R, pfx_f3 }, /* tzcnt */
+    { { 0xbd }, { 2, 2 }, T, R }, /* bsr */
+    { { 0xbd }, { 2, 2 }, T, R, pfx_f3 }, /* lzcnt */
+    { { 0xbe }, { 2, 2 }, F, R }, /* movsx */
+    { { 0xbf }, { 2, 2 }, F, R }, /* movsx */
+    { { 0xc0 }, { 2, 2 }, F, W }, /* xadd */
+    { { 0xc1 }, { 2, 2 }, F, W }, /* xadd */
+    { { 0xc3 }, { 2, 2 }, F, W }, /* movnti */
+    { { 0xc7, 0x08 }, { 2, 2 }, F, W }, /* cmpxchg8b */
+    { { 0xc7, 0x18 }, { 2, 2 }, F, R }, /* xrstors */
+    { { 0xc7, 0x20 }, { 2, 2 }, F, W }, /* xsavec */
+    { { 0xc7, 0x28 }, { 2, 2 }, F, W }, /* xsaves */
+    { { 0xc7, 0x30 }, { 2, 2 }, F, R }, /* vmptrld */
+    { { 0xc7, 0x30 }, { 2, 2 }, F, R, pfx_66 }, /* vmclear */
+    { { 0xc7, 0x30 }, { 2, 2 }, F, R, pfx_f3 }, /* vmxon */
+    { { 0xc7, 0x38 }, { 2, 2 }, F, R }, /* vmptrst */
+    { { 0xc7, 0xf0 }, { 2, 2 }, F, N }, /* rdrand */
+    { { 0xc7, 0xf8 }, { 2, 2 }, F, N }, /* rdseed */
+    { { 0xc7, 0xf8 }, { 2, 2 }, F, N, pfx_f3 }, /* rdpid */
+    REG(0xc8,   { 1, 1 }, F, N ), /* bswap */
+    { { 0xff }, { 2, 2 }, F, N }, /* ud0 */
+}, legacy_0f38[] = {
+    { { 0x80 }, { 2, 2 }, T, R, pfx_66 }, /* invept */
+    { { 0x81 }, { 2, 2 }, T, R, pfx_66 }, /* invvpid */
+    { { 0x82 }, { 2, 2 }, T, R, pfx_66 }, /* invpcid */
+    { { 0xf0 }, { 2, 2 }, T, R }, /* movbe */
+    { { 0xf0 }, { 2, 2 }, T, R, pfx_f2 }, /* crc32 */
+    { { 0xf1 }, { 2, 2 }, T, W }, /* movbe */
+    { { 0xf1 }, { 2, 2 }, T, R, pfx_f2 }, /* crc32 */
+    /*{ 0xf5 }, { 2, 2 }, F, W, pfx_66 }, wruss */
+    /*{ 0xf6 }, { 2, 2 }, F, W }, wrss */
+    { { 0xf6 }, { 2, 2 }, T, R, pfx_66 }, /* adcx */
+    { { 0xf6 }, { 2, 2 }, T, R, pfx_f3 }, /* adox */
+};
+#undef CND
+#undef REG
+#undef F
+#undef N
+#undef R
+#undef T
+#undef W
+
+static unsigned int errors;
+
+static void print_insn(const uint8_t *instr, unsigned int len)
+{
+    if ( !errors++ )
+        puts("");
+    while ( len--)
+        printf("%02x%c", *instr++, len ? ' ' : ':');
+}
+
+void do_test(uint8_t *instr, unsigned int len, unsigned int modrm,
+             enum mem_access mem, struct x86_emulate_ctxt *ctxt,
+             int (*fetch)(enum x86_segment seg,
+                          unsigned long offset,
+                          void *p_data,
+                          unsigned int bytes,
+                          struct x86_emulate_ctxt *ctxt))
+{
+    struct x86_emulate_state *s;
+
+    if ( !modrm || mem != mem_none )
+    {
+        s = x86_decode_insn(ctxt, fetch);
+
+        if ( x86_insn_length(s, ctxt) != len )
+        {
+            print_insn(instr, len);
+            printf(" length %u (expected %u)\n", x86_insn_length(s, ctxt), len);
+        }
+
+        if ( x86_insn_is_mem_access(s, ctxt) != (mem != mem_none) )
+        {
+            print_insn(instr, len);
+            printf(" mem access %d (expected %d)\n",
+                   x86_insn_is_mem_access(s, ctxt), mem != mem_none);
+        }
+
+        if ( x86_insn_is_mem_write(s, ctxt) != (mem == mem_write) )
+        {
+            print_insn(instr, len);
+            printf(" mem write %d (expected %d)\n",
+                   x86_insn_is_mem_write(s, ctxt), mem == mem_write);
+        }
+
+        x86_emulate_free_state(s);
+    }
+
+    if ( modrm )
+    {
+        instr[modrm] |= 0xc0;
+
+        s = x86_decode_insn(ctxt, fetch);
+
+        if ( x86_insn_length(s, ctxt) != len )
+        {
+            print_insn(instr, len);
+            printf(" length %u (expected %u)\n", x86_insn_length(s, ctxt), len);
+        }
+
+        if ( x86_insn_is_mem_access(s, ctxt) ||
+             x86_insn_is_mem_write(s, ctxt) )
+        {
+            print_insn(instr, len);
+            printf(" mem access %d / write %d unexpected\n",
+                   x86_insn_is_mem_access(s, ctxt),
+                   x86_insn_is_mem_write(s, ctxt));
+        }
+
+        x86_emulate_free_state(s);
+    }
+}
+
+void predicates_test(void *instr, struct x86_emulate_ctxt *ctxt,
+                     int (*fetch)(enum x86_segment seg,
+                                  unsigned long offset,
+                                  void *p_data,
+                                  unsigned int bytes,
+                                  struct x86_emulate_ctxt *ctxt))
+{
+    unsigned int m;
+
+    ctxt->regs->eip = (unsigned long)instr;
+
+    for ( m = 0; m < sizeof(long) / sizeof(int); ++m )
+    {
+        unsigned int t;
+
+        ctxt->addr_size = 32 << m;
+        ctxt->sp_size = 32 << m;
+        ctxt->lma = ctxt->sp_size == 64;
+
+        printf("Testing %u-bit decoding / predicates...", ctxt->sp_size);
+
+        for ( t = 0; t < ARRAY_SIZE(legacy); ++t )
+        {
+            if ( !legacy[t].len[m] )
+                continue;
+
+            assert(!legacy[t].pfx);
+
+            memset(instr + 1, 0xcc, 14);
+            memcpy(instr, legacy[t].opc, legacy[t].len[m]);
+
+            do_test(instr, legacy[t].len[m], legacy[t].modrm, legacy[t].mem,
+                    ctxt, fetch);
+        }
+
+        for ( t = 0; t < ARRAY_SIZE(legacy_0f); ++t )
+        {
+            uint8_t *ptr = instr;
+
+            if ( !legacy_0f[t].len[m] )
+                continue;
+
+            memset(instr + 2, 0xcc, 13);
+            if ( legacy_0f[t].pfx )
+                *ptr++ = prefixes[legacy_0f[t].pfx - 1];
+            *ptr++ = 0x0f;
+            memcpy(ptr, legacy_0f[t].opc, legacy_0f[t].len[m]);
+
+            do_test(instr, legacy_0f[t].len[m] + ((void *)ptr - instr),
+                    legacy_0f[t].modrm ? (void *)ptr - instr + 1 : 0,
+                    legacy_0f[t].mem, ctxt, fetch);
+        }
+
+        for ( t = 0; t < ARRAY_SIZE(legacy_0f38); ++t )
+        {
+            uint8_t *ptr = instr;
+
+            if ( !legacy_0f38[t].len[m] )
+                continue;
+
+            memset(instr + 3, 0xcc, 12);
+            if ( legacy_0f38[t].pfx )
+                *ptr++ = prefixes[legacy_0f38[t].pfx - 1];
+            *ptr++ = 0x0f;
+            *ptr++ = 0x38;
+            memcpy(ptr, legacy_0f38[t].opc, legacy_0f38[t].len[m]);
+
+            do_test(instr, legacy_0f38[t].len[m] + ((void *)ptr - instr),
+                    legacy_0f38[t].modrm ? (void *)ptr - instr + 1 : 0,
+                    legacy_0f38[t].mem, ctxt, fetch);
+        }
+
+        if ( errors )
+            exit(1);
+
+        puts(" okay");
+    }
+}
diff --git a/tools/tests/x86_emulator/test_x86_emulator.c b/tools/tests/x86_emulator/test_x86_emulator.c
index 6aa2d5129b..ec89368050 100644
--- a/tools/tests/x86_emulator/test_x86_emulator.c
+++ b/tools/tests/x86_emulator/test_x86_emulator.c
@@ -4810,6 +4810,8 @@ int main(int argc, char **argv)
     if ( stack_exec )
         evex_disp8_test(instr, &ctxt, &emulops);
 
+    predicates_test(instr, &ctxt, fetch);
+
     for ( j = 0; j < ARRAY_SIZE(blobs); j++ )
     {
         if ( blobs[j].check_cpu && !blobs[j].check_cpu() )
diff --git a/tools/tests/x86_emulator/x86-emulate.c b/tools/tests/x86_emulator/x86-emulate.c
index 23dcbe4247..82c7db4651 100644
--- a/tools/tests/x86_emulator/x86-emulate.c
+++ b/tools/tests/x86_emulator/x86-emulate.c
@@ -1,7 +1,13 @@
 #include "x86-emulate.h"
 
+#include <errno.h>
 #include <sys/mman.h>
 
+#define DEFINE_PER_CPU(type, var) type per_cpu_##var
+#define this_cpu(var) per_cpu_##var
+
+#define ERR_PTR(val) NULL
+
 #define cpu_has_amd_erratum(nr) 0
 #define cpu_has_mpx false
 #define read_bndcfgu() 0
diff --git a/tools/tests/x86_emulator/x86-emulate.h b/tools/tests/x86_emulator/x86-emulate.h
index dfb0a19394..b7f428b9e1 100644
--- a/tools/tests/x86_emulator/x86-emulate.h
+++ b/tools/tests/x86_emulator/x86-emulate.h
@@ -101,6 +101,12 @@ WRAP(puts);
 
 void evex_disp8_test(void *instr, struct x86_emulate_ctxt *ctxt,
                      const struct x86_emulate_ops *ops);
+void predicates_test(void *instr, struct x86_emulate_ctxt *ctxt,
+                     int (*fetch)(enum x86_segment seg,
+                                  unsigned long offset,
+                                  void *p_data,
+                                  unsigned int bytes,
+                                  struct x86_emulate_ctxt *ctxt));
 
 static inline uint64_t xgetbv(uint32_t xcr)
 {
diff --git a/xen/arch/x86/x86_emulate.c b/xen/arch/x86/x86_emulate.c
index e763278012..1e21e069cb 100644
--- a/xen/arch/x86/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate.c
@@ -10,6 +10,7 @@
  */
 
 #include <xen/domain_page.h>
+#include <xen/err.h>
 #include <xen/event.h>
 #include <asm/x86_emulate.h>
 #include <asm/processor.h> /* current_cpu_info */
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 1d44653007..34dfca259e 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -11382,10 +11382,6 @@ int x86_emulate_wrapper(
 }
 #endif
 
-#ifdef __XEN__
-
-#include <xen/err.h>
-
 struct x86_emulate_state *
 x86_decode_insn(
     struct x86_emulate_ctxt *ctxt,
@@ -11408,7 +11404,7 @@ x86_decode_insn(
     if ( unlikely(rc != X86EMUL_OKAY) )
         return ERR_PTR(-rc);
 
-#ifndef NDEBUG
+#if defined(__XEN__) && !defined(NDEBUG)
     /*
      * While we avoid memory allocation (by use of per-CPU data) above,
      * nevertheless make sure callers properly release the state structure
@@ -11428,12 +11424,12 @@ x86_decode_insn(
 
 static inline void check_state(const struct x86_emulate_state *state)
 {
-#ifndef NDEBUG
+#if defined(__XEN__) && !defined(NDEBUG)
     ASSERT(state->caller);
 #endif
 }
 
-#ifndef NDEBUG
+#if defined(__XEN__) && !defined(NDEBUG)
 void x86_emulate_free_state(struct x86_emulate_state *state)
 {
     check_state(state);
@@ -11806,5 +11802,3 @@ x86_insn_length(const struct x86_emulate_state *state,
 
     return state->ip - ctxt->regs->r(ip);
 }
-
-#endif
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.h b/xen/arch/x86/x86_emulate/x86_emulate.h
index 90d6329962..2ac788c008 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.h
+++ b/xen/arch/x86/x86_emulate/x86_emulate.h
@@ -730,8 +730,6 @@ x86emul_unhandleable_rw(
     unsigned int bytes,
     struct x86_emulate_ctxt *ctxt);
 
-#ifdef __XEN__
-
 struct x86_emulate_state *
 x86_decode_insn(
     struct x86_emulate_ctxt *ctxt,
@@ -767,12 +765,14 @@ bool
 x86_insn_is_cr_access(const struct x86_emulate_state *state,
                       const struct x86_emulate_ctxt *ctxt);
 
-#ifdef NDEBUG
+#if !defined(__XEN__) || defined(NDEBUG)
 static inline void x86_emulate_free_state(struct x86_emulate_state *state) {}
 #else
 void x86_emulate_free_state(struct x86_emulate_state *state);
 #endif
 
+#ifdef __XEN__
+
 int x86emul_read_xcr(unsigned int reg, uint64_t *val,
                      struct x86_emulate_ctxt *ctxt);
 int x86emul_write_xcr(unsigned int reg, uint64_t val,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jun 06 23:57:56 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Jun 2020 23:57: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 1jhihI-0005yz-Rh; Sat, 06 Jun 2020 23:57: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=x7q/=7T=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhihH-0005yr-Ue
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:57:55 +0000
X-Inumbo-ID: 8a44fbb8-a851-11ea-b15a-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 8a44fbb8-a851-11ea-b15a-12813bfff9fa;
 Sat, 06 Jun 2020 23:57: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=tqS+XprOIKjFqZTZ58xuOrQw2ZIkPwgeb0fXp2QeeH4=; b=N37D84vMIe8GQQlt4zDV0TmAJt
 UamZQY6t30lGcK6nrCLPQteXHvrX9lUwMyXymSUAp1jLGuoO/qP1xEuSOemHrPZzitKRfp2rSkJ0b
 K39PTqUmXXz5XoztxNUI5r5O3s6CBQd7Ksx+wBRXXsXK303UWBIzbFJ5Wj55t3mShW2w=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhihH-0002Wf-AW
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:57:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhihH-0007Cy-9u
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:57:55 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/hvm: Improve error information in handle_pio()
Message-Id: <E1jhihH-0007Cy-9u@xenbits.xenproject.org>
Date: Sat, 06 Jun 2020 23:57: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 4609fc8eb04e6af531d86923c9d057f32a96b7d8
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu May 28 14:03:22 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri May 29 16:25:05 2020 +0100

    x86/hvm: Improve error information in handle_pio()
    
    domain_crash() should always have a message which is emitted even in release
    builds, so something more useful than this is presented to the user.
    
      (XEN) domain_crash called from io.c:171
      (XEN) domain_crash called from io.c:171
      (XEN) domain_crash called from io.c:171
      ...
    
    To avoid possibly printing stack rubble, initialise data to ~0 right away.
    Furthermore, the maximum access size is 4, so drop data from long to int.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/io.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/hvm/io.c b/xen/arch/x86/hvm/io.c
index a5b0a23f06..724ab44a76 100644
--- a/xen/arch/x86/hvm/io.c
+++ b/xen/arch/x86/hvm/io.c
@@ -132,13 +132,15 @@ bool handle_pio(uint16_t port, unsigned int size, int dir)
 {
     struct vcpu *curr = current;
     struct hvm_vcpu_io *vio = &curr->arch.hvm.hvm_io;
-    unsigned long data;
+    unsigned int data;
     int rc;
 
     ASSERT((size - 1) < 4 && size != 3);
 
     if ( dir == IOREQ_WRITE )
         data = guest_cpu_user_regs()->eax;
+    else
+        data = ~0; /* Avoid any risk of stack rubble. */
 
     rc = hvmemul_do_pio_buffer(port, size, dir, &data);
 
@@ -151,7 +153,7 @@ bool handle_pio(uint16_t port, unsigned int size, int dir)
         if ( dir == IOREQ_READ )
         {
             if ( size == 4 ) /* Needs zero extension. */
-                guest_cpu_user_regs()->rax = (uint32_t)data;
+                guest_cpu_user_regs()->rax = data;
             else
                 memcpy(&guest_cpu_user_regs()->rax, &data, size);
         }
@@ -167,7 +169,9 @@ bool handle_pio(uint16_t port, unsigned int size, int dir)
         break;
 
     default:
-        gdprintk(XENLOG_ERR, "Weird HVM ioemulation status %d.\n", rc);
+        gprintk(XENLOG_ERR, "Unexpected PIO status %d, port %#x %s 0x%0*x\n",
+                rc, port, dir == IOREQ_WRITE ? "write" : "read",
+                size * 2, data & ((1u << (size * 8)) - 1));
         domain_crash(curr->domain);
         return false;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jun 06 23:58:06 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Jun 2020 23:58: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 1jhihS-00060J-TN; Sat, 06 Jun 2020 23:58: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=x7q/=7T=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhihR-000605-Ut
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:58:05 +0000
X-Inumbo-ID: 9049e172-a851-11ea-b15a-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 9049e172-a851-11ea-b15a-12813bfff9fa;
 Sat, 06 Jun 2020 23:58: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=+4lPMjPIwIQFLvB/zR2/jcXnE0r+xlqByuyhRG9qhDM=; b=M53r6NNhYMZNV5rD19hlo9szre
 jNj+ZCAWRnrLM4ANHyXtpSRYceUOlihw8Gh2X7y8OLPUtajWkueGbXDFpzI3fCNKAgmm0i3lQbM2Q
 vxQNg8glQ3ZUrFGMdcF/eoKPXadih/Sdaja4ADSNYpYvwRw6ggAiZmmiY2x7vci5L+OE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhihR-0002X3-DY
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:58:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhihR-0007Db-Cj
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:58:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] Merge branch 'staging' of
 xenbits.xen.org:/home/xen/git/xen into staging
Message-Id: <E1jhihR-0007Db-Cj@xenbits.xenproject.org>
Date: Sat, 06 Jun 2020 23:58: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 8c439e9ee4aa202306f5c0ca1391b6c8adf0f7e1
Merge: 3351acaee706b8e238b031a456bf181f97f167c3 4609fc8eb04e6af531d86923c9d057f32a96b7d8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri May 29 17:30:35 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri May 29 17:30:35 2020 +0200

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

 xen/arch/x86/hvm/io.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jun 06 23:58:18 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Jun 2020 23:58:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jhihe-00063G-V4; Sat, 06 Jun 2020 23:58: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=x7q/=7T=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhihd-000639-GC
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:58:17 +0000
X-Inumbo-ID: 964f94cc-a851-11ea-9b55-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 964f94cc-a851-11ea-9b55-bc764e2007e4;
 Sat, 06 Jun 2020 23:58: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=OkWzziOkokakHmnuQXdtz+J4dXJf7ifgrIHEyZqu0XM=; b=x/J7gHooyheyzblWBYWHnr3dH4
 9YGtBxIehjTl4h42I0pGgsOWrZGCRHMniqqaqEOiNlA8LTUFMzCM2OyTVc75UvkhL580xULgn8IlS
 qA6ZC/lH1vhz8Nqdc7mCHzKzqfRvzcy1zGP2hdHIqU17yL+gQ3OnRCKYUBa0KZM+HJyI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhihb-0002XE-H6
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:58:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhihb-0007E6-GQ
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:58:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86emul: disable FPU/MMX/SIMD insn emulation when !HVM
Message-Id: <E1jhihb-0007E6-GQ@xenbits.xenproject.org>
Date: Sat, 06 Jun 2020 23:58: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 fced27b002c73c47c6c24ece2fe32b78157ad6b6
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri May 29 17:31:13 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri May 29 17:31:13 2020 +0200

    x86emul: disable FPU/MMX/SIMD insn emulation when !HVM
    
    In a pure PV environment (the PV shim in particular) we don't really
    need emulation of all these. To limit #ifdef-ary utilize some of the
    CASE_*() macros we have, by providing variants expanding to
    (effectively) nothing (really a label, which in turn requires passing
    -Wno-unused-label to the compiler when build such configurations).
    
    Due to the mixture of macro and #ifdef use, the placement of some of
    the #ifdef-s is a little arbitrary.
    
    The resulting object file's .text is less than half the size of the
    original, and looks to also be compiling a little more quickly.
    
    This is meant as a first step; more parts can likely be disabled down
    the road.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Bregrudingly-acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/Makefile                  |   3 +
 xen/arch/x86/x86_emulate.c             |   6 ++
 xen/arch/x86/x86_emulate/x86_emulate.c | 182 +++++++++++++++++++++++++++++++--
 3 files changed, 181 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 44137d919b..07eeefbf82 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -73,6 +73,9 @@ obj-y += vm_event.o
 obj-y += xstate.o
 extra-y += asm-macros.i
 
+ifneq ($(CONFIG_HVM),y)
+x86_emulate.o: CFLAGS-y += -Wno-unused-label
+endif
 x86_emulate.o: x86_emulate/x86_emulate.c x86_emulate/x86_emulate.h
 
 efi-y := $(shell if [ ! -r $(BASEDIR)/include/xen/compile.h -o \
diff --git a/xen/arch/x86/x86_emulate.c b/xen/arch/x86/x86_emulate.c
index 1e21e069cb..33516f4e5d 100644
--- a/xen/arch/x86/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate.c
@@ -43,6 +43,12 @@
     }                                                      \
 })
 
+#ifndef CONFIG_HVM
+# define X86EMUL_NO_FPU
+# define X86EMUL_NO_MMX
+# define X86EMUL_NO_SIMD
+#endif
+
 #include "x86_emulate/x86_emulate.c"
 
 int x86emul_read_xcr(unsigned int reg, uint64_t *val,
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 34dfca259e..44bb3e59e9 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -3506,6 +3506,7 @@ x86_decode(
             op_bytes = 4;
         break;
 
+#ifndef X86EMUL_NO_SIMD
     case simd_packed_int:
         switch ( vex.pfx )
         {
@@ -3571,6 +3572,7 @@ x86_decode(
     case simd_256:
         op_bytes = 32;
         break;
+#endif /* !X86EMUL_NO_SIMD */
 
     default:
         op_bytes = 0;
@@ -3725,6 +3727,7 @@ x86_emulate(
         break;
     }
 
+#ifndef X86EMUL_NO_SIMD
     /* With a memory operand, fetch the mask register in use (if any). */
     if ( ea.type == OP_MEM && evex.opmsk &&
          _get_fpu(fpu_type = X86EMUL_FPU_opmask, ctxt, ops) == X86EMUL_OKAY )
@@ -3755,6 +3758,7 @@ x86_emulate(
         put_fpu(X86EMUL_FPU_opmask, false, state, ctxt, ops);
         fpu_type = X86EMUL_FPU_none;
     }
+#endif /* !X86EMUL_NO_SIMD */
 
     /* Decode (but don't fetch) the destination operand: register or memory. */
     switch ( d & DstMask )
@@ -4400,11 +4404,13 @@ x86_emulate(
         singlestep = _regs.eflags & X86_EFLAGS_TF;
         break;
 
+#ifndef X86EMUL_NO_FPU
     case 0x9b:  /* wait/fwait */
         host_and_vcpu_must_have(fpu);
         get_fpu(X86EMUL_FPU_wait);
         emulate_fpu_insn_stub(b);
         break;
+#endif
 
     case 0x9c: /* pushf */
         if ( (_regs.eflags & X86_EFLAGS_VM) &&
@@ -4814,6 +4820,7 @@ x86_emulate(
         break;
     }
 
+#ifndef X86EMUL_NO_FPU
     case 0xd8: /* FPU 0xd8 */
         host_and_vcpu_must_have(fpu);
         get_fpu(X86EMUL_FPU_fpu);
@@ -5148,6 +5155,7 @@ x86_emulate(
             }
         }
         break;
+#endif /* !X86EMUL_NO_FPU */
 
     case 0xe0 ... 0xe2: /* loop{,z,nz} */ {
         unsigned long count = get_loop_count(&_regs, ad_bytes);
@@ -6124,6 +6132,8 @@ x86_emulate(
     case X86EMUL_OPC(0x0f, 0x19) ... X86EMUL_OPC(0x0f, 0x1f): /* nop */
         break;
 
+#ifndef X86EMUL_NO_MMX
+
     case X86EMUL_OPC(0x0f, 0x0e): /* femms */
         host_and_vcpu_must_have(3dnow);
         asm volatile ( "femms" );
@@ -6144,39 +6154,71 @@ x86_emulate(
         state->simd_size = simd_other;
         goto simd_0f_imm8;
 
-#define CASE_SIMD_PACKED_INT(pfx, opc)       \
+#endif /* !X86EMUL_NO_MMX */
+
+#if !defined(X86EMUL_NO_SIMD) && !defined(X86EMUL_NO_MMX)
+# define CASE_SIMD_PACKED_INT(pfx, opc)      \
     case X86EMUL_OPC(pfx, opc):              \
     case X86EMUL_OPC_66(pfx, opc)
-#define CASE_SIMD_PACKED_INT_VEX(pfx, opc)   \
+#elif !defined(X86EMUL_NO_SIMD)
+# define CASE_SIMD_PACKED_INT(pfx, opc)      \
+    case X86EMUL_OPC_66(pfx, opc)
+#elif !defined(X86EMUL_NO_MMX)
+# define CASE_SIMD_PACKED_INT(pfx, opc)      \
+    case X86EMUL_OPC(pfx, opc)
+#else
+# define CASE_SIMD_PACKED_INT(pfx, opc) C##pfx##_##opc
+#endif
+
+#ifndef X86EMUL_NO_SIMD
+
+# define CASE_SIMD_PACKED_INT_VEX(pfx, opc)  \
     CASE_SIMD_PACKED_INT(pfx, opc):          \
     case X86EMUL_OPC_VEX_66(pfx, opc)
 
-#define CASE_SIMD_ALL_FP(kind, pfx, opc)     \
+# define CASE_SIMD_ALL_FP(kind, pfx, opc)    \
     CASE_SIMD_PACKED_FP(kind, pfx, opc):     \
     CASE_SIMD_SCALAR_FP(kind, pfx, opc)
-#define CASE_SIMD_PACKED_FP(kind, pfx, opc)  \
+# define CASE_SIMD_PACKED_FP(kind, pfx, opc) \
     case X86EMUL_OPC##kind(pfx, opc):        \
     case X86EMUL_OPC##kind##_66(pfx, opc)
-#define CASE_SIMD_SCALAR_FP(kind, pfx, opc)  \
+# define CASE_SIMD_SCALAR_FP(kind, pfx, opc) \
     case X86EMUL_OPC##kind##_F3(pfx, opc):   \
     case X86EMUL_OPC##kind##_F2(pfx, opc)
-#define CASE_SIMD_SINGLE_FP(kind, pfx, opc)  \
+# define CASE_SIMD_SINGLE_FP(kind, pfx, opc) \
     case X86EMUL_OPC##kind(pfx, opc):        \
     case X86EMUL_OPC##kind##_F3(pfx, opc)
 
-#define CASE_SIMD_ALL_FP_VEX(pfx, opc)       \
+# define CASE_SIMD_ALL_FP_VEX(pfx, opc)      \
     CASE_SIMD_ALL_FP(, pfx, opc):            \
     CASE_SIMD_ALL_FP(_VEX, pfx, opc)
-#define CASE_SIMD_PACKED_FP_VEX(pfx, opc)    \
+# define CASE_SIMD_PACKED_FP_VEX(pfx, opc)   \
     CASE_SIMD_PACKED_FP(, pfx, opc):         \
     CASE_SIMD_PACKED_FP(_VEX, pfx, opc)
-#define CASE_SIMD_SCALAR_FP_VEX(pfx, opc)    \
+# define CASE_SIMD_SCALAR_FP_VEX(pfx, opc)   \
     CASE_SIMD_SCALAR_FP(, pfx, opc):         \
     CASE_SIMD_SCALAR_FP(_VEX, pfx, opc)
-#define CASE_SIMD_SINGLE_FP_VEX(pfx, opc)    \
+# define CASE_SIMD_SINGLE_FP_VEX(pfx, opc)   \
     CASE_SIMD_SINGLE_FP(, pfx, opc):         \
     CASE_SIMD_SINGLE_FP(_VEX, pfx, opc)
 
+#else
+
+# define CASE_SIMD_PACKED_INT_VEX(pfx, opc)  \
+    CASE_SIMD_PACKED_INT(pfx, opc)
+
+# define CASE_SIMD_ALL_FP(kind, pfx, opc)    C##kind##pfx##_##opc
+# define CASE_SIMD_PACKED_FP(kind, pfx, opc) Cp##kind##pfx##_##opc
+# define CASE_SIMD_SCALAR_FP(kind, pfx, opc) Cs##kind##pfx##_##opc
+# define CASE_SIMD_SINGLE_FP(kind, pfx, opc) C##kind##pfx##_##opc
+
+# define CASE_SIMD_ALL_FP_VEX(pfx, opc)    CASE_SIMD_ALL_FP(, pfx, opc)
+# define CASE_SIMD_PACKED_FP_VEX(pfx, opc) CASE_SIMD_PACKED_FP(, pfx, opc)
+# define CASE_SIMD_SCALAR_FP_VEX(pfx, opc) CASE_SIMD_SCALAR_FP(, pfx, opc)
+# define CASE_SIMD_SINGLE_FP_VEX(pfx, opc) CASE_SIMD_SINGLE_FP(, pfx, opc)
+
+#endif
+
     CASE_SIMD_SCALAR_FP(, 0x0f, 0x2b):     /* movnts{s,d} xmm,mem */
         host_and_vcpu_must_have(sse4a);
         /* fall through */
@@ -6314,6 +6356,8 @@ x86_emulate(
         insn_bytes = EVEX_PFX_BYTES + 2;
         break;
 
+#ifndef X86EMUL_NO_SIMD
+
     case X86EMUL_OPC_66(0x0f, 0x12):       /* movlpd m64,xmm */
     case X86EMUL_OPC_VEX_66(0x0f, 0x12):   /* vmovlpd m64,xmm,xmm */
     CASE_SIMD_PACKED_FP_VEX(0x0f, 0x13):   /* movlp{s,d} xmm,m64 */
@@ -6420,6 +6464,8 @@ x86_emulate(
         avx512_vlen_check(false);
         goto simd_zmm;
 
+#endif /* !X86EMUL_NO_SIMD */
+
     case X86EMUL_OPC(0x0f, 0x20): /* mov cr,reg */
     case X86EMUL_OPC(0x0f, 0x21): /* mov dr,reg */
     case X86EMUL_OPC(0x0f, 0x22): /* mov reg,cr */
@@ -6446,6 +6492,8 @@ x86_emulate(
             goto done;
         break;
 
+#if !defined(X86EMUL_NO_MMX) && !defined(X86EMUL_NO_SIMD)
+
     case X86EMUL_OPC_66(0x0f, 0x2a):       /* cvtpi2pd mm/m64,xmm */
         if ( ea.type == OP_REG )
         {
@@ -6457,6 +6505,8 @@ x86_emulate(
         op_bytes = (b & 4) && (vex.pfx & VEX_PREFIX_DOUBLE_MASK) ? 16 : 8;
         goto simd_0f_fp;
 
+#endif /* !X86EMUL_NO_MMX && !X86EMUL_NO_SIMD */
+
     CASE_SIMD_SCALAR_FP_VEX(0x0f, 0x2a):   /* {,v}cvtsi2s{s,d} r/m,xmm */
         if ( vex.opcx == vex_none )
         {
@@ -6803,6 +6853,8 @@ x86_emulate(
             dst.val = src.val;
         break;
 
+#ifndef X86EMUL_NO_SIMD
+
     case X86EMUL_OPC_VEX(0x0f, 0x4a):    /* kadd{w,q} k,k,k */
         if ( !vex.w )
             host_and_vcpu_must_have(avx512dq);
@@ -6857,6 +6909,8 @@ x86_emulate(
         generate_exception_if(!vex.l || vex.w, EXC_UD);
         goto opmask_common;
 
+#endif /* X86EMUL_NO_SIMD */
+
     CASE_SIMD_PACKED_FP_VEX(0x0f, 0x50):   /* movmskp{s,d} xmm,reg */
                                            /* vmovmskp{s,d} {x,y}mm,reg */
     CASE_SIMD_PACKED_INT_VEX(0x0f, 0xd7):  /* pmovmskb {,x}mm,reg */
@@ -6940,6 +6994,8 @@ x86_emulate(
                          evex.w);
         goto avx512f_all_fp;
 
+#ifndef X86EMUL_NO_SIMD
+
     CASE_SIMD_PACKED_FP_VEX(0x0f, 0x5b):   /* cvt{ps,dq}2{dq,ps} xmm/mem,xmm */
                                            /* vcvt{ps,dq}2{dq,ps} {x,y}mm/mem,{x,y}mm */
     case X86EMUL_OPC_F3(0x0f, 0x5b):       /* cvttps2dq xmm/mem,xmm */
@@ -6970,6 +7026,8 @@ x86_emulate(
         op_bytes = 16 << evex.lr;
         goto simd_zmm;
 
+#endif /* !X86EMUL_NO_SIMD */
+
     CASE_SIMD_PACKED_INT_VEX(0x0f, 0x60): /* punpcklbw {,x}mm/mem,{,x}mm */
                                           /* vpunpcklbw {x,y}mm/mem,{x,y}mm,{x,y}mm */
     CASE_SIMD_PACKED_INT_VEX(0x0f, 0x61): /* punpcklwd {,x}mm/mem,{,x}mm */
@@ -6996,6 +7054,7 @@ x86_emulate(
                                           /* vpackusbw {x,y}mm/mem,{x,y}mm,{x,y}mm */
     CASE_SIMD_PACKED_INT_VEX(0x0f, 0x6b): /* packsswd {,x}mm/mem,{,x}mm */
                                           /* vpacksswd {x,y}mm/mem,{x,y}mm,{x,y}mm */
+#ifndef X86EMUL_NO_SIMD
     case X86EMUL_OPC_66(0x0f, 0x6c):     /* punpcklqdq xmm/m128,xmm */
     case X86EMUL_OPC_VEX_66(0x0f, 0x6c): /* vpunpcklqdq {x,y}mm/mem,{x,y}mm,{x,y}mm */
     case X86EMUL_OPC_66(0x0f, 0x6d):     /* punpckhqdq xmm/m128,xmm */
@@ -7080,6 +7139,7 @@ x86_emulate(
                                           /* vpsubd {x,y}mm/mem,{x,y}mm,{x,y}mm */
     case X86EMUL_OPC_66(0x0f, 0xfb):     /* psubq xmm/m128,xmm */
     case X86EMUL_OPC_VEX_66(0x0f, 0xfb): /* vpsubq {x,y}mm/mem,{x,y}mm,{x,y}mm */
+#endif /* !X86EMUL_NO_SIMD */
     CASE_SIMD_PACKED_INT_VEX(0x0f, 0xfc): /* paddb {,x}mm/mem,{,x}mm */
                                           /* vpaddb {x,y}mm/mem,{x,y}mm,{x,y}mm */
     CASE_SIMD_PACKED_INT_VEX(0x0f, 0xfd): /* paddw {,x}mm/mem,{,x}mm */
@@ -7087,6 +7147,7 @@ x86_emulate(
     CASE_SIMD_PACKED_INT_VEX(0x0f, 0xfe): /* paddd {,x}mm/mem,{,x}mm */
                                           /* vpaddd {x,y}mm/mem,{x,y}mm,{x,y}mm */
     simd_0f_int:
+#ifndef X86EMUL_NO_SIMD
         if ( vex.opcx != vex_none )
         {
     case X86EMUL_OPC_VEX_66(0x0f38, 0x00): /* vpshufb {x,y}mm/mem,{x,y}mm,{x,y}mm */
@@ -7128,11 +7189,14 @@ x86_emulate(
         }
         if ( vex.pfx )
             goto simd_0f_sse2;
+#endif /* !X86EMUL_NO_SIMD */
     simd_0f_mmx:
         host_and_vcpu_must_have(mmx);
         get_fpu(X86EMUL_FPU_mmx);
         goto simd_0f_common;
 
+#ifndef X86EMUL_NO_SIMD
+
     case X86EMUL_OPC_EVEX_66(0x0f, 0xf6): /* vpsadbw [xyz]mm/mem,[xyz]mm,[xyz]mm */
         generate_exception_if(evex.opmsk, EXC_UD);
         /* fall through */
@@ -7226,6 +7290,8 @@ x86_emulate(
         generate_exception_if(!evex.w, EXC_UD);
         goto avx512f_no_sae;
 
+#endif /* X86EMUL_NO_SIMD */
+
     CASE_SIMD_PACKED_INT_VEX(0x0f, 0x6e): /* mov{d,q} r/m,{,x}mm */
                                           /* vmov{d,q} r/m,xmm */
     CASE_SIMD_PACKED_INT_VEX(0x0f, 0x7e): /* mov{d,q} {,x}mm,r/m */
@@ -7267,6 +7333,8 @@ x86_emulate(
         ASSERT(!state->simd_size);
         break;
 
+#ifndef X86EMUL_NO_SIMD
+
     case X86EMUL_OPC_EVEX_66(0x0f, 0x6e): /* vmov{d,q} r/m,xmm */
     case X86EMUL_OPC_EVEX_66(0x0f, 0x7e): /* vmov{d,q} xmm,r/m */
         generate_exception_if((evex.lr || evex.opmsk || evex.brs ||
@@ -7339,11 +7407,15 @@ x86_emulate(
         d |= TwoOp;
         /* fall through */
     case X86EMUL_OPC_66(0x0f, 0xd6):     /* movq xmm,xmm/m64 */
+#endif /* !X86EMUL_NO_SIMD */
+#ifndef X86EMUL_NO_MMX
     case X86EMUL_OPC(0x0f, 0x6f):        /* movq mm/m64,mm */
     case X86EMUL_OPC(0x0f, 0x7f):        /* movq mm,mm/m64 */
+#endif
         op_bytes = 8;
         goto simd_0f_int;
 
+#ifndef X86EMUL_NO_SIMD
     CASE_SIMD_PACKED_INT_VEX(0x0f, 0x70):/* pshuf{w,d} $imm8,{,x}mm/mem,{,x}mm */
                                          /* vpshufd $imm8,{x,y}mm/mem,{x,y}mm */
     case X86EMUL_OPC_F3(0x0f, 0x70):     /* pshufhw $imm8,xmm/m128,xmm */
@@ -7352,12 +7424,15 @@ x86_emulate(
     case X86EMUL_OPC_VEX_F2(0x0f, 0x70): /* vpshuflw $imm8,{x,y}mm/mem,{x,y}mm */
         d = (d & ~SrcMask) | SrcMem | TwoOp;
         op_bytes = vex.pfx ? 16 << vex.l : 8;
+#endif
     simd_0f_int_imm8:
         if ( vex.opcx != vex_none )
         {
+#ifndef X86EMUL_NO_SIMD
     case X86EMUL_OPC_VEX_66(0x0f3a, 0x0e): /* vpblendw $imm8,{x,y}mm/mem,{x,y}mm,{x,y}mm */
     case X86EMUL_OPC_VEX_66(0x0f3a, 0x0f): /* vpalignr $imm8,{x,y}mm/mem,{x,y}mm,{x,y}mm */
     case X86EMUL_OPC_VEX_66(0x0f3a, 0x42): /* vmpsadbw $imm8,{x,y}mm/mem,{x,y}mm,{x,y}mm */
+#endif
             if ( vex.l )
             {
     simd_0f_imm8_avx2:
@@ -7365,6 +7440,7 @@ x86_emulate(
             }
             else
             {
+#ifndef X86EMUL_NO_SIMD
     case X86EMUL_OPC_VEX_66(0x0f3a, 0x08): /* vroundps $imm8,{x,y}mm/mem,{x,y}mm */
     case X86EMUL_OPC_VEX_66(0x0f3a, 0x09): /* vroundpd $imm8,{x,y}mm/mem,{x,y}mm */
     case X86EMUL_OPC_VEX_66(0x0f3a, 0x0a): /* vroundss $imm8,{x,y}mm/mem,{x,y}mm,{x,y}mm */
@@ -7372,6 +7448,7 @@ x86_emulate(
     case X86EMUL_OPC_VEX_66(0x0f3a, 0x0c): /* vblendps $imm8,{x,y}mm/mem,{x,y}mm,{x,y}mm */
     case X86EMUL_OPC_VEX_66(0x0f3a, 0x0d): /* vblendpd $imm8,{x,y}mm/mem,{x,y}mm,{x,y}mm */
     case X86EMUL_OPC_VEX_66(0x0f3a, 0x40): /* vdpps $imm8,{x,y}mm/mem,{x,y}mm,{x,y}mm */
+#endif
     simd_0f_imm8_avx:
                 host_and_vcpu_must_have(avx);
             }
@@ -7405,6 +7482,8 @@ x86_emulate(
         insn_bytes = PFX_BYTES + 3;
         break;
 
+#ifndef X86EMUL_NO_SIMD
+
     case X86EMUL_OPC_EVEX_66(0x0f, 0x70): /* vpshufd $imm8,[xyz]mm/mem,[xyz]mm{k} */
     case X86EMUL_OPC_EVEX_F3(0x0f, 0x70): /* vpshufhw $imm8,[xyz]mm/mem,[xyz]mm{k} */
     case X86EMUL_OPC_EVEX_F2(0x0f, 0x70): /* vpshuflw $imm8,[xyz]mm/mem,[xyz]mm{k} */
@@ -7463,6 +7542,9 @@ x86_emulate(
         opc[1] = modrm;
         opc[2] = imm1;
         insn_bytes = PFX_BYTES + 3;
+
+#endif /* X86EMUL_NO_SIMD */
+
     simd_0f_reg_only:
         opc[insn_bytes - PFX_BYTES] = 0xc3;
 
@@ -7473,6 +7555,8 @@ x86_emulate(
         ASSERT(!state->simd_size);
         break;
 
+#ifndef X86EMUL_NO_SIMD
+
     case X86EMUL_OPC_EVEX_66(0x0f, 0x71): /* Grp12 */
         switch ( modrm_reg & 7 )
         {
@@ -7504,6 +7588,9 @@ x86_emulate(
         }
         goto unrecognized_insn;
 
+#endif /* !X86EMUL_NO_SIMD */
+#ifndef X86EMUL_NO_MMX
+
     case X86EMUL_OPC(0x0f, 0x73):        /* Grp14 */
         switch ( modrm_reg & 7 )
         {
@@ -7513,6 +7600,9 @@ x86_emulate(
         }
         goto unrecognized_insn;
 
+#endif /* !X86EMUL_NO_MMX */
+#ifndef X86EMUL_NO_SIMD
+
     case X86EMUL_OPC_66(0x0f, 0x73):
     case X86EMUL_OPC_VEX_66(0x0f, 0x73):
         switch ( modrm_reg & 7 )
@@ -7543,7 +7633,12 @@ x86_emulate(
         }
         goto unrecognized_insn;
 
+#endif /* !X86EMUL_NO_SIMD */
+
+#ifndef X86EMUL_NO_MMX
     case X86EMUL_OPC(0x0f, 0x77):        /* emms */
+#endif
+#ifndef X86EMUL_NO_SIMD
     case X86EMUL_OPC_VEX(0x0f, 0x77):    /* vzero{all,upper} */
         if ( vex.opcx != vex_none )
         {
@@ -7589,6 +7684,7 @@ x86_emulate(
 #endif
         }
         else
+#endif /* !X86EMUL_NO_SIMD */
         {
             host_and_vcpu_must_have(mmx);
             get_fpu(X86EMUL_FPU_mmx);
@@ -7602,6 +7698,8 @@ x86_emulate(
         insn_bytes = PFX_BYTES + 1;
         goto simd_0f_reg_only;
 
+#ifndef X86EMUL_NO_SIMD
+
     case X86EMUL_OPC_66(0x0f, 0x78):     /* Grp17 */
         switch ( modrm_reg & 7 )
         {
@@ -7699,6 +7797,8 @@ x86_emulate(
         op_bytes = 8;
         goto simd_zmm;
 
+#endif /* !X86EMUL_NO_SIMD */
+
     case X86EMUL_OPC(0x0f, 0x80) ... X86EMUL_OPC(0x0f, 0x8f): /* jcc (near) */
         if ( test_cc(b, _regs.eflags) )
             jmp_rel((int32_t)src.val);
@@ -7709,6 +7809,8 @@ x86_emulate(
         dst.val = test_cc(b, _regs.eflags);
         break;
 
+#ifndef X86EMUL_NO_SIMD
+
     case X86EMUL_OPC_VEX(0x0f, 0x91):    /* kmov{w,q} k,mem */
     case X86EMUL_OPC_VEX_66(0x0f, 0x91): /* kmov{b,d} k,mem */
         generate_exception_if(ea.type != OP_MEM, EXC_UD);
@@ -7857,6 +7959,8 @@ x86_emulate(
         dst.type = OP_NONE;
         break;
 
+#endif /* !X86EMUL_NO_SIMD */
+
     case X86EMUL_OPC(0x0f, 0xa2): /* cpuid */
         msr_val = 0;
         fail_if(ops->cpuid == NULL);
@@ -7953,6 +8057,7 @@ x86_emulate(
     case X86EMUL_OPC(0x0f, 0xae): case X86EMUL_OPC_66(0x0f, 0xae): /* Grp15 */
         switch ( modrm_reg & 7 )
         {
+#ifndef X86EMUL_NO_SIMD
         case 2: /* ldmxcsr */
             generate_exception_if(vex.pfx, EXC_UD);
             vcpu_must_have(sse);
@@ -7971,6 +8076,7 @@ x86_emulate(
             get_fpu(vex.opcx ? X86EMUL_FPU_ymm : X86EMUL_FPU_xmm);
             asm volatile ( "stmxcsr %0" : "=m" (dst.val) );
             break;
+#endif /* X86EMUL_NO_SIMD */
 
         case 5: /* lfence */
             fail_if(modrm_mod != 3);
@@ -8019,6 +8125,8 @@ x86_emulate(
         }
         break;
 
+#ifndef X86EMUL_NO_SIMD
+
     case X86EMUL_OPC_VEX(0x0f, 0xae): /* Grp15 */
         switch ( modrm_reg & 7 )
         {
@@ -8033,6 +8141,8 @@ x86_emulate(
         }
         goto unrecognized_insn;
 
+#endif /* !X86EMUL_NO_SIMD */
+
     case X86EMUL_OPC_F3(0x0f, 0xae): /* Grp15 */
         fail_if(modrm_mod != 3);
         generate_exception_if((modrm_reg & 4) || !mode_64bit(), EXC_UD);
@@ -8272,6 +8382,8 @@ x86_emulate(
         }
         goto simd_0f_imm8_avx;
 
+#ifndef X86EMUL_NO_SIMD
+
     CASE_SIMD_ALL_FP(_EVEX, 0x0f, 0xc2): /* vcmp{p,s}{s,d} $imm8,[xyz]mm/mem,[xyz]mm,k{k} */
         generate_exception_if((evex.w != (evex.pfx & VEX_PREFIX_DOUBLE_MASK) ||
                                (ea.type != OP_REG && evex.brs &&
@@ -8298,6 +8410,8 @@ x86_emulate(
         insn_bytes = EVEX_PFX_BYTES + 3;
         break;
 
+#endif /* !X86EMUL_NO_SIMD */
+
     case X86EMUL_OPC(0x0f, 0xc3): /* movnti */
         /* Ignore the non-temporal hint for now. */
         vcpu_must_have(sse2);
@@ -8312,6 +8426,8 @@ x86_emulate(
         ea.type = OP_MEM;
         goto simd_0f_int_imm8;
 
+#ifndef X86EMUL_NO_SIMD
+
     case X86EMUL_OPC_EVEX_66(0x0f, 0xc4):   /* vpinsrw $imm8,r32/m16,xmm,xmm */
     case X86EMUL_OPC_EVEX_66(0x0f3a, 0x20): /* vpinsrb $imm8,r32/m8,xmm,xmm */
     case X86EMUL_OPC_EVEX_66(0x0f3a, 0x22): /* vpinsr{d,q} $imm8,r/m,xmm,xmm */
@@ -8329,6 +8445,8 @@ x86_emulate(
         state->simd_size = simd_other;
         goto avx512f_imm8_no_sae;
 
+#endif /* !X86EMUL_NO_SIMD */
+
     CASE_SIMD_PACKED_INT_VEX(0x0f, 0xc5):  /* pextrw $imm8,{,x}mm,reg */
                                            /* vpextrw $imm8,xmm,reg */
         generate_exception_if(vex.l, EXC_UD);
@@ -8344,6 +8462,8 @@ x86_emulate(
         insn_bytes = PFX_BYTES + 3;
         goto simd_0f_to_gpr;
 
+#ifndef X86EMUL_NO_SIMD
+
     CASE_SIMD_PACKED_FP(_EVEX, 0x0f, 0xc6): /* vshufp{s,d} $imm8,[xyz]mm/mem,[xyz]mm,[xyz]mm{k} */
         generate_exception_if(evex.w != (evex.pfx & VEX_PREFIX_DOUBLE_MASK),
                               EXC_UD);
@@ -8358,6 +8478,8 @@ x86_emulate(
         avx512_vlen_check(false);
         goto simd_imm8_zmm;
 
+#endif /* X86EMUL_NO_SIMD */
+
     case X86EMUL_OPC(0x0f, 0xc7): /* Grp9 */
     {
         union {
@@ -8548,6 +8670,8 @@ x86_emulate(
         }
         break;
 
+#ifndef X86EMUL_NO_SIMD
+
     case X86EMUL_OPC_EVEX_66(0x0f, 0xd2): /* vpsrld xmm/m128,[xyz]mm,[xyz]mm{k} */
     case X86EMUL_OPC_EVEX_66(0x0f, 0xd3): /* vpsrlq xmm/m128,[xyz]mm,[xyz]mm{k} */
     case X86EMUL_OPC_EVEX_66(0x0f, 0xe2): /* vpsra{d,q} xmm/m128,[xyz]mm,[xyz]mm{k} */
@@ -8569,12 +8693,18 @@ x86_emulate(
         generate_exception_if(evex.w != (b & 1), EXC_UD);
         goto avx512f_no_sae;
 
+#endif /* !X86EMUL_NO_SIMD */
+#ifndef X86EMUL_NO_MMX
+
     case X86EMUL_OPC(0x0f, 0xd4):        /* paddq mm/m64,mm */
     case X86EMUL_OPC(0x0f, 0xf4):        /* pmuludq mm/m64,mm */
     case X86EMUL_OPC(0x0f, 0xfb):        /* psubq mm/m64,mm */
         vcpu_must_have(sse2);
         goto simd_0f_mmx;
 
+#endif /* !X86EMUL_NO_MMX */
+#if !defined(X86EMUL_NO_MMX) && !defined(X86EMUL_NO_SIMD)
+
     case X86EMUL_OPC_F3(0x0f, 0xd6):     /* movq2dq mm,xmm */
     case X86EMUL_OPC_F2(0x0f, 0xd6):     /* movdq2q xmm,mm */
         generate_exception_if(ea.type != OP_REG, EXC_UD);
@@ -8582,6 +8712,9 @@ x86_emulate(
         host_and_vcpu_must_have(mmx);
         goto simd_0f_int;
 
+#endif /* !X86EMUL_NO_MMX && !X86EMUL_NO_SIMD */
+#ifndef X86EMUL_NO_MMX
+
     case X86EMUL_OPC(0x0f, 0xe7):        /* movntq mm,m64 */
         generate_exception_if(ea.type != OP_MEM, EXC_UD);
         sfence = true;
@@ -8597,6 +8730,9 @@ x86_emulate(
         vcpu_must_have(mmxext);
         goto simd_0f_mmx;
 
+#endif /* !X86EMUL_NO_MMX */
+#ifndef X86EMUL_NO_SIMD
+
     case X86EMUL_OPC_EVEX_66(0x0f, 0xda): /* vpminub [xyz]mm/mem,[xyz]mm,[xyz]mm{k} */
     case X86EMUL_OPC_EVEX_66(0x0f, 0xde): /* vpmaxub [xyz]mm/mem,[xyz]mm,[xyz]mm{k} */
     case X86EMUL_OPC_EVEX_66(0x0f, 0xe4): /* vpmulhuw [xyz]mm/mem,[xyz]mm,[xyz]mm{k} */
@@ -8617,6 +8753,8 @@ x86_emulate(
         op_bytes = 8 << (!!(vex.pfx & VEX_PREFIX_DOUBLE_MASK) + vex.l);
         goto simd_0f_cvt;
 
+#endif /* !X86EMUL_NO_SIMD */
+
     CASE_SIMD_PACKED_INT_VEX(0x0f, 0xf7): /* {,v}maskmov{q,dqu} {,x}mm,{,x}mm */
         generate_exception_if(ea.type != OP_REG, EXC_UD);
         if ( vex.opcx != vex_none )
@@ -8720,6 +8858,8 @@ x86_emulate(
         insn_bytes = PFX_BYTES + 3;
         break;
 
+#ifndef X86EMUL_NO_SIMD
+
     case X86EMUL_OPC_VEX_66(0x0f38, 0x19): /* vbroadcastsd xmm/m64,ymm */
     case X86EMUL_OPC_VEX_66(0x0f38, 0x1a): /* vbroadcastf128 m128,ymm */
         generate_exception_if(!vex.l, EXC_UD);
@@ -9302,6 +9442,8 @@ x86_emulate(
         ASSERT(!state->simd_size);
         break;
 
+#endif /* !X86EMUL_NO_SIMD */
+
     case X86EMUL_OPC_66(0x0f38, 0x82): /* invpcid reg,m128 */
         vcpu_must_have(invpcid);
         generate_exception_if(ea.type != OP_MEM, EXC_UD);
@@ -9344,6 +9486,8 @@ x86_emulate(
         state->simd_size = simd_none;
         break;
 
+#ifndef X86EMUL_NO_SIMD
+
     case X86EMUL_OPC_EVEX_66(0x0f38, 0x83): /* vpmultishiftqb [xyz]mm/mem,[xyz]mm,[xyz]mm{k} */
         generate_exception_if(!evex.w, EXC_UD);
         host_and_vcpu_must_have(avx512_vbmi);
@@ -9907,6 +10051,8 @@ x86_emulate(
         generate_exception_if(evex.brs || evex.opmsk, EXC_UD);
         goto avx512f_no_sae;
 
+#endif /* !X86EMUL_NO_SIMD */
+
     case X86EMUL_OPC(0x0f38, 0xf0): /* movbe m,r */
     case X86EMUL_OPC(0x0f38, 0xf1): /* movbe r,m */
         vcpu_must_have(movbe);
@@ -10072,6 +10218,8 @@ x86_emulate(
                             : "0" ((uint32_t)src.val), "rm" (_regs.edx) );
         break;
 
+#ifndef X86EMUL_NO_SIMD
+
     case X86EMUL_OPC_VEX_66(0x0f3a, 0x00): /* vpermq $imm8,ymm/m256,ymm */
     case X86EMUL_OPC_VEX_66(0x0f3a, 0x01): /* vpermpd $imm8,ymm/m256,ymm */
         generate_exception_if(!vex.l || !vex.w, EXC_UD);
@@ -10132,6 +10280,8 @@ x86_emulate(
         avx512_vlen_check(b & 2);
         goto simd_imm8_zmm;
 
+#endif /* X86EMUL_NO_SIMD */
+
     CASE_SIMD_PACKED_INT(0x0f3a, 0x0f): /* palignr $imm8,{,x}mm/mem,{,x}mm */
         host_and_vcpu_must_have(ssse3);
         if ( vex.pfx )
@@ -10159,6 +10309,8 @@ x86_emulate(
         insn_bytes = PFX_BYTES + 4;
         break;
 
+#ifndef X86EMUL_NO_SIMD
+
     case X86EMUL_OPC_EVEX_66(0x0f3a, 0x42): /* vdbpsadbw $imm8,[xyz]mm/mem,[xyz]mm,[xyz]mm{k} */
         generate_exception_if(evex.w, EXC_UD);
         /* fall through */
@@ -10657,6 +10809,8 @@ x86_emulate(
         generate_exception_if(vex.l, EXC_UD);
         goto simd_0f_imm8_avx;
 
+#endif /* X86EMUL_NO_SIMD */
+
     case X86EMUL_OPC_VEX_F2(0x0f3a, 0xf0): /* rorx imm,r/m,r */
         vcpu_must_have(bmi2);
         generate_exception_if(vex.l || vex.reg != 0xf, EXC_UD);
@@ -10671,6 +10825,8 @@ x86_emulate(
             asm ( "rorl %b1,%k0" : "=g" (dst.val) : "c" (imm1), "0" (src.val) );
         break;
 
+#ifndef X86EMUL_NO_SIMD
+
     case X86EMUL_OPC_XOP(08, 0x85): /* vpmacssww xmm,xmm/m128,xmm,xmm */
     case X86EMUL_OPC_XOP(08, 0x86): /* vpmacsswd xmm,xmm/m128,xmm,xmm */
     case X86EMUL_OPC_XOP(08, 0x87): /* vpmacssdql xmm,xmm/m128,xmm,xmm */
@@ -10706,6 +10862,8 @@ x86_emulate(
         host_and_vcpu_must_have(xop);
         goto simd_0f_imm8_ymm;
 
+#endif /* X86EMUL_NO_SIMD */
+
     case X86EMUL_OPC_XOP(09, 0x01): /* XOP Grp1 */
         switch ( modrm_reg & 7 )
         {
@@ -10765,6 +10923,8 @@ x86_emulate(
         }
         goto unrecognized_insn;
 
+#ifndef X86EMUL_NO_SIMD
+
     case X86EMUL_OPC_XOP(09, 0x82): /* vfrczss xmm/m128,xmm */
     case X86EMUL_OPC_XOP(09, 0x83): /* vfrczsd xmm/m128,xmm */
         generate_exception_if(vex.l, EXC_UD);
@@ -10820,6 +10980,8 @@ x86_emulate(
         host_and_vcpu_must_have(xop);
         goto simd_0f_ymm;
 
+#endif /* X86EMUL_NO_SIMD */
+
     case X86EMUL_OPC_XOP(0a, 0x10): /* bextr imm,r/m,r */
     {
         uint8_t *buf = get_stub(stub);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jun 06 23:58:28 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Jun 2020 23:58:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jhiho-00064G-2A; Sat, 06 Jun 2020 23:58: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=x7q/=7T=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhihn-000648-03
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:58:27 +0000
X-Inumbo-ID: 9c595a24-a851-11ea-b15a-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 9c595a24-a851-11ea-b15a-12813bfff9fa;
 Sat, 06 Jun 2020 23:58: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=KKuJqvmoWzdGS1eJ+uYPud+HznLi6B9HcuqoN5DB8yM=; b=EqgTRl9Wyaw7V83h5tVk1LEfSq
 zN/pQK7KMGE0zqb6UJDJtBGPC6UcOyeOn6lOdIC5Rz9Snf8UOtNyOhAuvceB0akVsY80Vw1fa2VfZ
 jCFcBBCrIY0x4wDaC0bjQZ1+NoUvYKzB1tHLDUjYG8HPXzYMBZiFIblb95GAAoF56K+U=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhihl-0002XO-LB
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:58:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhihl-0007Ef-KX
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:58:25 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86emul: support MOVDIR{I,64B} insns
Message-Id: <E1jhihl-0007Ef-KX@xenbits.xenproject.org>
Date: Sat, 06 Jun 2020 23:58: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 a9ecb9e780e2373c53b469f81ea54db19b9378dd
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri May 29 17:32:14 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri May 29 17:32:14 2020 +0200

    x86emul: support MOVDIR{I,64B} insns
    
    Introduce a new blk() hook, paralleling the rmw() one in a certain way,
    but being intended for larger data sizes, and hence its HVM intermediate
    handling function doesn't fall back to splitting the operation if the
    requested virtual address can't be mapped.
    
    Note that SDM revision 071 doesn't specify exception behavior for
    ModRM.mod == 0b11; assuming #UD here.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    Acked-by: Andrew Cooper <andrew.cooper@citrix.com>
---
 tools/tests/x86_emulator/predicates.c        |   2 +
 tools/tests/x86_emulator/test_x86_emulator.c |  57 ++++++++++++++
 tools/tests/x86_emulator/x86-emulate.h       |   2 +
 xen/arch/x86/arch.mk                         |   1 +
 xen/arch/x86/hvm/emulate.c                   |  42 ++++++++++
 xen/arch/x86/x86_emulate/x86_emulate.c       | 114 ++++++++++++++++++++++++++-
 xen/arch/x86/x86_emulate/x86_emulate.h       |  24 ++++++
 xen/include/asm-x86/cpufeature.h             |   2 +
 xen/include/public/arch-x86/cpufeatureset.h  |   2 +
 9 files changed, 245 insertions(+), 1 deletion(-)

diff --git a/tools/tests/x86_emulator/predicates.c b/tools/tests/x86_emulator/predicates.c
index 404e03c30d..7baf3dede9 100644
--- a/tools/tests/x86_emulator/predicates.c
+++ b/tools/tests/x86_emulator/predicates.c
@@ -510,6 +510,8 @@ static const struct {
     /*{ 0xf6 }, { 2, 2 }, F, W }, wrss */
     { { 0xf6 }, { 2, 2 }, T, R, pfx_66 }, /* adcx */
     { { 0xf6 }, { 2, 2 }, T, R, pfx_f3 }, /* adox */
+    { { 0xf8 }, { 2, 2 }, F, W, pfx_66 }, /* movdir64b */
+    { { 0xf9 }, { 2, 2 }, F, W }, /* movdiri */
 };
 #undef CND
 #undef REG
diff --git a/tools/tests/x86_emulator/test_x86_emulator.c b/tools/tests/x86_emulator/test_x86_emulator.c
index ec89368050..c80cb58d7d 100644
--- a/tools/tests/x86_emulator/test_x86_emulator.c
+++ b/tools/tests/x86_emulator/test_x86_emulator.c
@@ -652,6 +652,18 @@ static int cmpxchg(
     return X86EMUL_OKAY;
 }
 
+static int blk(
+    enum x86_segment seg,
+    unsigned long offset,
+    void *p_data,
+    unsigned int bytes,
+    uint32_t *eflags,
+    struct x86_emulate_state *state,
+    struct x86_emulate_ctxt *ctxt)
+{
+    return x86_emul_blk((void *)offset, p_data, bytes, eflags, state, ctxt);
+}
+
 static int read_segment(
     enum x86_segment seg,
     struct segment_register *reg,
@@ -721,6 +733,7 @@ static struct x86_emulate_ops emulops = {
     .insn_fetch = fetch,
     .write      = write,
     .cmpxchg    = cmpxchg,
+    .blk        = blk,
     .read_segment = read_segment,
     .cpuid      = emul_test_cpuid,
     .read_cr    = emul_test_read_cr,
@@ -2339,6 +2352,50 @@ int main(int argc, char **argv)
         goto fail;
     printf("okay\n");
 
+    printf("%-40s", "Testing movdiri %edx,(%ecx)...");
+    if ( stack_exec && cpu_has_movdiri )
+    {
+        instr[0] = 0x0f; instr[1] = 0x38; instr[2] = 0xf9; instr[3] = 0x11;
+
+        regs.eip = (unsigned long)&instr[0];
+        regs.ecx = (unsigned long)memset(res, -1, 16);
+        regs.edx = 0x44332211;
+
+        rc = x86_emulate(&ctxt, &emulops);
+        if ( (rc != X86EMUL_OKAY) ||
+             (regs.eip != (unsigned long)&instr[4]) ||
+             res[0] != 0x44332211 || ~res[1] )
+            goto fail;
+        printf("okay\n");
+    }
+    else
+        printf("skipped\n");
+
+    printf("%-40s", "Testing movdir64b 144(%edx),%ecx...");
+    if ( stack_exec && cpu_has_movdir64b )
+    {
+        instr[0] = 0x66; instr[1] = 0x0f; instr[2] = 0x38; instr[3] = 0xf8;
+        instr[4] = 0x8a; instr[5] = 0x90; instr[8] = instr[7] = instr[6] = 0;
+
+        regs.eip = (unsigned long)&instr[0];
+        for ( i = 0; i < 64; ++i )
+            res[i] = i - 20;
+        regs.edx = (unsigned long)res;
+        regs.ecx = (unsigned long)(res + 16);
+
+        rc = x86_emulate(&ctxt, &emulops);
+        if ( (rc != X86EMUL_OKAY) ||
+             (regs.eip != (unsigned long)&instr[9]) ||
+             res[15] != -5 || res[32] != 12 )
+            goto fail;
+        for ( i = 16; i < 32; ++i )
+            if ( res[i] != i )
+                goto fail;
+        printf("okay\n");
+    }
+    else
+        printf("skipped\n");
+
     printf("%-40s", "Testing movq %mm3,(%ecx)...");
     if ( stack_exec && cpu_has_mmx )
     {
diff --git a/tools/tests/x86_emulator/x86-emulate.h b/tools/tests/x86_emulator/x86-emulate.h
index b7f428b9e1..859f0c379b 100644
--- a/tools/tests/x86_emulator/x86-emulate.h
+++ b/tools/tests/x86_emulator/x86-emulate.h
@@ -160,6 +160,8 @@ static inline bool xcr0_mask(uint64_t mask)
 #define cpu_has_avx512_vnni (cp.feat.avx512_vnni && xcr0_mask(0xe6))
 #define cpu_has_avx512_bitalg (cp.feat.avx512_bitalg && xcr0_mask(0xe6))
 #define cpu_has_avx512_vpopcntdq (cp.feat.avx512_vpopcntdq && xcr0_mask(0xe6))
+#define cpu_has_movdiri    cp.feat.movdiri
+#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_serialize  cp.feat.serialize
diff --git a/xen/arch/x86/arch.mk b/xen/arch/x86/arch.mk
index 62b7c97007..19c0cc38f8 100644
--- a/xen/arch/x86/arch.mk
+++ b/xen/arch/x86/arch.mk
@@ -47,6 +47,7 @@ $(call as-option-add,CFLAGS,CC,"rdseed %eax",-DHAVE_AS_RDSEED)
 $(call as-option-add,CFLAGS,CC,"clwb (%rax)",-DHAVE_AS_CLWB)
 $(call as-option-add,CFLAGS,CC,".equ \"x\"$$(comma)1",-DHAVE_AS_QUOTED_SYM)
 $(call as-option-add,CFLAGS,CC,"invpcid (%rax)$$(comma)%rax",-DHAVE_AS_INVPCID)
+$(call as-option-add,CFLAGS,CC,"movdiri %rax$$(comma)(%rax)",-DHAVE_AS_MOVDIR)
 
 # GAS's idea of true is -1.  Clang's idea is 1
 $(call as-option-add,CFLAGS,CC,\
diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 57f36b7be9..8b4e73ab06 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -1441,6 +1441,47 @@ static int hvmemul_rmw(
     return rc;
 }
 
+static int hvmemul_blk(
+    enum x86_segment seg,
+    unsigned long offset,
+    void *p_data,
+    unsigned int bytes,
+    uint32_t *eflags,
+    struct x86_emulate_state *state,
+    struct x86_emulate_ctxt *ctxt)
+{
+    struct hvm_emulate_ctxt *hvmemul_ctxt =
+        container_of(ctxt, struct hvm_emulate_ctxt, ctxt);
+    unsigned long addr;
+    uint32_t pfec = PFEC_page_present;
+    int rc;
+    void *mapping = NULL;
+
+    rc = hvmemul_virtual_to_linear(
+        seg, offset, bytes, NULL, hvm_access_write, hvmemul_ctxt, &addr);
+    if ( rc != X86EMUL_OKAY || !bytes )
+        return rc;
+
+    if ( x86_insn_is_mem_write(state, ctxt) )
+        pfec |= PFEC_write_access;
+
+    if ( is_x86_system_segment(seg) )
+        pfec |= PFEC_implicit;
+    else if ( hvmemul_ctxt->seg_reg[x86_seg_ss].dpl == 3 )
+        pfec |= PFEC_user_mode;
+
+    mapping = hvmemul_map_linear_addr(addr, bytes, pfec, hvmemul_ctxt);
+    if ( IS_ERR(mapping) )
+        return ~PTR_ERR(mapping);
+    if ( !mapping )
+        return X86EMUL_UNHANDLEABLE;
+
+    rc = x86_emul_blk(mapping, p_data, bytes, eflags, state, ctxt);
+    hvmemul_unmap_linear_addr(mapping, addr, bytes, hvmemul_ctxt);
+
+    return rc;
+}
+
 static int hvmemul_write_discard(
     enum x86_segment seg,
     unsigned long offset,
@@ -2518,6 +2559,7 @@ static const struct x86_emulate_ops hvm_emulate_ops = {
     .write         = hvmemul_write,
     .rmw           = hvmemul_rmw,
     .cmpxchg       = hvmemul_cmpxchg,
+    .blk           = hvmemul_blk,
     .validate      = hvmemul_validate,
     .rep_ins       = hvmemul_rep_ins,
     .rep_outs      = hvmemul_rep_outs,
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 44bb3e59e9..da1f77e629 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -548,6 +548,8 @@ static const struct ext0f38_table {
     [0xf1] = { .to_mem = 1, .two_op = 1 },
     [0xf2 ... 0xf3] = {},
     [0xf5 ... 0xf7] = {},
+    [0xf8] = { .simd_size = simd_other },
+    [0xf9] = { .to_mem = 1, .two_op = 1 /* Mov */ },
 };
 
 /* Shift values between src and dst sizes of pmov{s,z}x{b,w,d}{w,d,q}. */
@@ -851,6 +853,10 @@ struct x86_emulate_state {
         rmw_xchg,
         rmw_xor,
     } rmw;
+    enum {
+        blk_NONE,
+        blk_movdir,
+    } blk;
     uint8_t modrm, modrm_mod, modrm_reg, modrm_rm;
     uint8_t sib_index, sib_scale;
     uint8_t rex_prefix;
@@ -1915,6 +1921,8 @@ amd_like(const struct x86_emulate_ctxt *ctxt)
 #define vcpu_has_avx512_vpopcntdq() (ctxt->cpuid->feat.avx512_vpopcntdq)
 #define vcpu_has_tsxldtrk()    (ctxt->cpuid->feat.tsxldtrk)
 #define vcpu_has_rdpid()       (ctxt->cpuid->feat.rdpid)
+#define vcpu_has_movdiri()     (ctxt->cpuid->feat.movdiri)
+#define vcpu_has_movdir64b()   (ctxt->cpuid->feat.movdir64b)
 #define vcpu_has_avx512_4vnniw() (ctxt->cpuid->feat.avx512_4vnniw)
 #define vcpu_has_avx512_4fmaps() (ctxt->cpuid->feat.avx512_4fmaps)
 #define vcpu_has_serialize()   (ctxt->cpuid->feat.serialize)
@@ -2736,10 +2744,12 @@ x86_decode_0f38(
     {
     case 0x00 ... 0xef:
     case 0xf2 ... 0xf5:
-    case 0xf7 ... 0xff:
+    case 0xf7 ... 0xf8:
+    case 0xfa ... 0xff:
         op_bytes = 0;
         /* fall through */
     case 0xf6: /* adcx / adox */
+    case 0xf9: /* movdiri */
         ctxt->opcode |= MASK_INSR(vex.pfx, X86EMUL_OPC_PFX_MASK);
         break;
 
@@ -10218,6 +10228,34 @@ x86_emulate(
                             : "0" ((uint32_t)src.val), "rm" (_regs.edx) );
         break;
 
+    case X86EMUL_OPC_66(0x0f38, 0xf8): /* movdir64b r,m512 */
+        host_and_vcpu_must_have(movdir64b);
+        generate_exception_if(ea.type != OP_MEM, EXC_UD);
+        src.val = truncate_ea(*dst.reg);
+        generate_exception_if(!is_aligned(x86_seg_es, src.val, 64, ctxt, ops),
+                              EXC_GP, 0);
+        fail_if(!ops->blk);
+        state->blk = blk_movdir;
+        BUILD_BUG_ON(sizeof(*mmvalp) < 64);
+        if ( (rc = ops->read(ea.mem.seg, ea.mem.off, mmvalp, 64,
+                             ctxt)) != X86EMUL_OKAY ||
+             (rc = ops->blk(x86_seg_es, src.val, mmvalp, 64, &_regs.eflags,
+                            state, ctxt)) != X86EMUL_OKAY )
+            goto done;
+        state->simd_size = simd_none;
+        break;
+
+    case X86EMUL_OPC(0x0f38, 0xf9): /* movdiri mem,r */
+        host_and_vcpu_must_have(movdiri);
+        generate_exception_if(dst.type != OP_MEM, EXC_UD);
+        fail_if(!ops->blk);
+        state->blk = blk_movdir;
+        if ( (rc = ops->blk(dst.mem.seg, dst.mem.off, &src.val, op_bytes,
+                            &_regs.eflags, state, ctxt)) != X86EMUL_OKAY )
+            goto done;
+        dst.type = OP_NONE;
+        break;
+
 #ifndef X86EMUL_NO_SIMD
 
     case X86EMUL_OPC_VEX_66(0x0f3a, 0x00): /* vpermq $imm8,ymm/m256,ymm */
@@ -11477,6 +11515,77 @@ int x86_emul_rmw(
     return X86EMUL_OKAY;
 }
 
+int x86_emul_blk(
+    void *ptr,
+    void *data,
+    unsigned int bytes,
+    uint32_t *eflags,
+    struct x86_emulate_state *state,
+    struct x86_emulate_ctxt *ctxt)
+{
+    switch ( state->blk )
+    {
+        /*
+         * Throughout this switch(), memory clobbers are used to compensate
+         * that other operands may not properly express the (full) memory
+         * ranges covered.
+         */
+    case blk_movdir:
+        switch ( bytes )
+        {
+#ifdef __x86_64__
+        case sizeof(uint32_t):
+# ifdef HAVE_AS_MOVDIR
+            asm ( "movdiri %0, (%1)"
+                  :: "r" (*(uint32_t *)data), "r" (ptr) : "memory" );
+# else
+            /* movdiri %esi, (%rdi) */
+            asm ( ".byte 0x0f, 0x38, 0xf9, 0x37"
+                  :: "S" (*(uint32_t *)data), "D" (ptr) : "memory" );
+# endif
+            break;
+#endif
+
+        case sizeof(unsigned long):
+#ifdef HAVE_AS_MOVDIR
+            asm ( "movdiri %0, (%1)"
+                  :: "r" (*(unsigned long *)data), "r" (ptr) : "memory" );
+#else
+            /* movdiri %rsi, (%rdi) */
+            asm ( ".byte 0x48, 0x0f, 0x38, 0xf9, 0x37"
+                  :: "S" (*(unsigned long *)data), "D" (ptr) : "memory" );
+#endif
+            break;
+
+        case 64:
+            if ( ((unsigned long)ptr & 0x3f) )
+            {
+                ASSERT_UNREACHABLE();
+                return X86EMUL_UNHANDLEABLE;
+            }
+#ifdef HAVE_AS_MOVDIR
+            asm ( "movdir64b (%0), %1" :: "r" (data), "r" (ptr) : "memory" );
+#else
+            /* movdir64b (%rsi), %rdi */
+            asm ( ".byte 0x66, 0x0f, 0x38, 0xf8, 0x3e"
+                  :: "S" (data), "D" (ptr) : "memory" );
+#endif
+            break;
+
+        default:
+            ASSERT_UNREACHABLE();
+            return X86EMUL_UNHANDLEABLE;
+        }
+        break;
+
+    default:
+        ASSERT_UNREACHABLE();
+        return X86EMUL_UNHANDLEABLE;
+    }
+
+    return X86EMUL_OKAY;
+}
+
 static void __init __maybe_unused build_assertions(void)
 {
     /* Check the values against SReg3 encoding in opcode/ModRM bytes. */
@@ -11759,6 +11868,9 @@ x86_insn_is_mem_write(const struct x86_emulate_state *state,
         {
         case 0x63:                         /* ARPL */
             return !mode_64bit();
+
+        case X86EMUL_OPC_66(0x0f38, 0xf8): /* MOVDIR64B */
+            return true;
         }
 
         return false;
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.h b/xen/arch/x86/x86_emulate/x86_emulate.h
index 2ac788c008..d8fb3a9909 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.h
+++ b/xen/arch/x86/x86_emulate/x86_emulate.h
@@ -309,6 +309,22 @@ struct x86_emulate_ops
         bool lock,
         struct x86_emulate_ctxt *ctxt);
 
+    /*
+     * blk: Emulate a large (block) memory access.
+     * @p_data: [IN/OUT] (optional) Pointer to source/destination buffer.
+     * @eflags: [IN/OUT] Pointer to EFLAGS to be updated according to
+     *                   instruction effects.
+     * @state:  [IN/OUT] Pointer to (opaque) emulator state.
+     */
+    int (*blk)(
+        enum x86_segment seg,
+        unsigned long offset,
+        void *p_data,
+        unsigned int bytes,
+        uint32_t *eflags,
+        struct x86_emulate_state *state,
+        struct x86_emulate_ctxt *ctxt);
+
     /*
      * validate: Post-decode, pre-emulate hook to allow caller controlled
      * filtering.
@@ -794,6 +810,14 @@ x86_emul_rmw(
     uint32_t *eflags,
     struct x86_emulate_state *state,
     struct x86_emulate_ctxt *ctxt);
+int
+x86_emul_blk(
+    void *ptr,
+    void *data,
+    unsigned int bytes,
+    uint32_t *eflags,
+    struct x86_emulate_state *state,
+    struct x86_emulate_ctxt *ctxt);
 
 static inline void x86_emul_hw_exception(
     unsigned int vector, int error_code, struct x86_emulate_ctxt *ctxt)
diff --git a/xen/include/asm-x86/cpufeature.h b/xen/include/asm-x86/cpufeature.h
index cadef4e824..0e772e39c1 100644
--- a/xen/include/asm-x86/cpufeature.h
+++ b/xen/include/asm-x86/cpufeature.h
@@ -118,6 +118,8 @@
 #define cpu_has_avx512_bitalg   boot_cpu_has(X86_FEATURE_AVX512_BITALG)
 #define cpu_has_avx512_vpopcntdq boot_cpu_has(X86_FEATURE_AVX512_VPOPCNTDQ)
 #define cpu_has_rdpid           boot_cpu_has(X86_FEATURE_RDPID)
+#define cpu_has_movdiri         boot_cpu_has(X86_FEATURE_MOVDIRI)
+#define cpu_has_movdir64b       boot_cpu_has(X86_FEATURE_MOVDIR64B)
 
 /* CPUID level 0x80000007.edx */
 #define cpu_has_itsc            boot_cpu_has(X86_FEATURE_ITSC)
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index c24eae948d..79f8ad3dd8 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -241,6 +241,8 @@ XEN_CPUFEATURE(AVX512_VPOPCNTDQ, 6*32+14) /*A  POPCNT for vectors of DW/QW */
 XEN_CPUFEATURE(TSXLDTRK,      6*32+16) /*a  TSX load tracking suspend/resume insns */
 XEN_CPUFEATURE(RDPID,         6*32+22) /*A  RDPID instruction */
 XEN_CPUFEATURE(CLDEMOTE,      6*32+25) /*A  CLDEMOTE instruction */
+XEN_CPUFEATURE(MOVDIRI,       6*32+27) /*a  MOVDIRI instruction */
+XEN_CPUFEATURE(MOVDIR64B,     6*32+28) /*a  MOVDIR64B instruction */
 
 /* AMD-defined CPU features, CPUID level 0x80000007.edx, word 7 */
 XEN_CPUFEATURE(ITSC,          7*32+ 8) /*   Invariant TSC */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jun 06 23:58:38 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Jun 2020 23:58: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 1jhihy-00065N-3y; Sat, 06 Jun 2020 23:58: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=x7q/=7T=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhihw-00065B-LC
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:58:36 +0000
X-Inumbo-ID: a2615ebc-a851-11ea-b15a-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id a2615ebc-a851-11ea-b15a-12813bfff9fa;
 Sat, 06 Jun 2020 23:58: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=v4Y5E0JFlh1Q7gCb07+1cB05mmYLkENC904kBvLo+cc=; b=rTBw4g/quRSnuNGeWVP34JEWfT
 cpth4iGldj3qdeMiOPSMjBt6cDzDCE3UUOHt1dRmlboyGgp2OfhlD6SwyI9XgEJR2uQyHio4YhM61
 27uejfqCw+CDoX2B/c27yEl3qnQQYoMc+SaBLK2thhH+O66MVNEfp6GXSipqPpd1CZJw=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhihv-0002YE-P7
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:58:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhihv-0007FG-OG
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:58:35 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86emul: support ENQCMD insns
Message-Id: <E1jhihv-0007FG-OG@xenbits.xenproject.org>
Date: Sat, 06 Jun 2020 23:58: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 d273859687415f5b36dde976d43e04162aeadfdc
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri May 29 17:32:55 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri May 29 17:32:55 2020 +0200

    x86emul: support ENQCMD insns
    
    Note that the ISA extensions document revision 038 doesn't specify
    exception behavior for ModRM.mod == 0b11; assuming #UD here.
    
    No tests are being added to the harness - this would be quite hard,
    we can't just issue the insns against RAM. Their similarity with
    MOVDIR64B should have the test case there be god enough to cover any
    fundamental flaws.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/tests/x86_emulator/predicates.c       |  2 +
 tools/tests/x86_emulator/x86-emulate.h      |  3 ++
 xen/arch/x86/arch.mk                        |  1 +
 xen/arch/x86/x86_emulate/x86_emulate.c      | 60 +++++++++++++++++++++++++++++
 xen/include/asm-x86/cpufeature.h            |  1 +
 xen/include/asm-x86/msr-index.h             |  4 ++
 xen/include/public/arch-x86/cpufeatureset.h |  1 +
 7 files changed, 72 insertions(+)

diff --git a/tools/tests/x86_emulator/predicates.c b/tools/tests/x86_emulator/predicates.c
index 7baf3dede9..80491ef3ed 100644
--- a/tools/tests/x86_emulator/predicates.c
+++ b/tools/tests/x86_emulator/predicates.c
@@ -511,6 +511,8 @@ static const struct {
     { { 0xf6 }, { 2, 2 }, T, R, pfx_66 }, /* adcx */
     { { 0xf6 }, { 2, 2 }, T, R, pfx_f3 }, /* adox */
     { { 0xf8 }, { 2, 2 }, F, W, pfx_66 }, /* movdir64b */
+    { { 0xf8 }, { 2, 2 }, F, W, pfx_f3 }, /* enqcmds */
+    { { 0xf8 }, { 2, 2 }, F, W, pfx_f2 }, /* enqcmd */
     { { 0xf9 }, { 2, 2 }, F, W }, /* movdiri */
 };
 #undef CND
diff --git a/tools/tests/x86_emulator/x86-emulate.h b/tools/tests/x86_emulator/x86-emulate.h
index 859f0c379b..978dc48b33 100644
--- a/tools/tests/x86_emulator/x86-emulate.h
+++ b/tools/tests/x86_emulator/x86-emulate.h
@@ -59,6 +59,9 @@
     (type *)((char *)mptr__ - offsetof(type, member)); \
 })
 
+#define AC_(n,t) (n##t)
+#define _AC(n,t) AC_(n,t)
+
 #define hweight32 __builtin_popcount
 #define hweight64 __builtin_popcountll
 
diff --git a/xen/arch/x86/arch.mk b/xen/arch/x86/arch.mk
index 19c0cc38f8..9927a42061 100644
--- a/xen/arch/x86/arch.mk
+++ b/xen/arch/x86/arch.mk
@@ -48,6 +48,7 @@ $(call as-option-add,CFLAGS,CC,"clwb (%rax)",-DHAVE_AS_CLWB)
 $(call as-option-add,CFLAGS,CC,".equ \"x\"$$(comma)1",-DHAVE_AS_QUOTED_SYM)
 $(call as-option-add,CFLAGS,CC,"invpcid (%rax)$$(comma)%rax",-DHAVE_AS_INVPCID)
 $(call as-option-add,CFLAGS,CC,"movdiri %rax$$(comma)(%rax)",-DHAVE_AS_MOVDIR)
+$(call as-option-add,CFLAGS,CC,"enqcmd (%rax)$$(comma)%rax",-DHAVE_AS_ENQCMD)
 
 # GAS's idea of true is -1.  Clang's idea is 1
 $(call as-option-add,CFLAGS,CC,\
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index da1f77e629..505ec09662 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -855,6 +855,7 @@ struct x86_emulate_state {
     } rmw;
     enum {
         blk_NONE,
+        blk_enqcmd,
         blk_movdir,
     } blk;
     uint8_t modrm, modrm_mod, modrm_reg, modrm_rm;
@@ -901,6 +902,7 @@ typedef union {
     uint64_t __attribute__ ((aligned(16))) xmm[2];
     uint64_t __attribute__ ((aligned(32))) ymm[4];
     uint64_t __attribute__ ((aligned(64))) zmm[8];
+    uint32_t data32[16];
 } mmval_t;
 
 /*
@@ -1923,6 +1925,7 @@ amd_like(const struct x86_emulate_ctxt *ctxt)
 #define vcpu_has_rdpid()       (ctxt->cpuid->feat.rdpid)
 #define vcpu_has_movdiri()     (ctxt->cpuid->feat.movdiri)
 #define vcpu_has_movdir64b()   (ctxt->cpuid->feat.movdir64b)
+#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_serialize()   (ctxt->cpuid->feat.serialize)
@@ -10245,6 +10248,36 @@ x86_emulate(
         state->simd_size = simd_none;
         break;
 
+    case X86EMUL_OPC_F2(0x0f38, 0xf8): /* enqcmd r,m512 */
+    case X86EMUL_OPC_F3(0x0f38, 0xf8): /* enqcmds r,m512 */
+        host_and_vcpu_must_have(enqcmd);
+        generate_exception_if(ea.type != OP_MEM, EXC_UD);
+        generate_exception_if(vex.pfx != vex_f2 && !mode_ring0(), EXC_GP, 0);
+        src.val = truncate_ea(*dst.reg);
+        generate_exception_if(!is_aligned(x86_seg_es, src.val, 64, ctxt, ops),
+                              EXC_GP, 0);
+        fail_if(!ops->blk);
+        BUILD_BUG_ON(sizeof(*mmvalp) < 64);
+        if ( (rc = ops->read(ea.mem.seg, ea.mem.off, mmvalp, 64,
+                             ctxt)) != X86EMUL_OKAY )
+            goto done;
+        if ( vex.pfx == vex_f2 ) /* enqcmd */
+        {
+            fail_if(!ops->read_msr);
+            if ( (rc = ops->read_msr(MSR_PASID, &msr_val,
+                                     ctxt)) != X86EMUL_OKAY )
+                goto done;
+            generate_exception_if(!(msr_val & PASID_VALID), EXC_GP, 0);
+            mmvalp->data32[0] = MASK_EXTR(msr_val, PASID_PASID_MASK);
+        }
+        mmvalp->data32[0] &= ~0x7ff00000;
+        state->blk = blk_enqcmd;
+        if ( (rc = ops->blk(x86_seg_es, src.val, mmvalp, 64, &_regs.eflags,
+                            state, ctxt)) != X86EMUL_OKAY )
+            goto done;
+        state->simd_size = simd_none;
+        break;
+
     case X86EMUL_OPC(0x0f38, 0xf9): /* movdiri mem,r */
         host_and_vcpu_must_have(movdiri);
         generate_exception_if(dst.type != OP_MEM, EXC_UD);
@@ -11525,11 +11558,36 @@ int x86_emul_blk(
 {
     switch ( state->blk )
     {
+        bool zf;
+
         /*
          * Throughout this switch(), memory clobbers are used to compensate
          * that other operands may not properly express the (full) memory
          * ranges covered.
          */
+    case blk_enqcmd:
+        ASSERT(bytes == 64);
+        if ( ((unsigned long)ptr & 0x3f) )
+        {
+            ASSERT_UNREACHABLE();
+            return X86EMUL_UNHANDLEABLE;
+        }
+        *eflags &= ~EFLAGS_MASK;
+#ifdef HAVE_AS_ENQCMD
+        asm ( "enqcmds (%[src]), %[dst]" ASM_FLAG_OUT(, "; setz %[zf]")
+              : [zf] ASM_FLAG_OUT("=@ccz", "=qm") (zf)
+              : [src] "r" (data), [dst] "r" (ptr) : "memory" );
+#else
+        /* enqcmds (%rsi), %rdi */
+        asm ( ".byte 0xf3, 0x0f, 0x38, 0xf8, 0x3e"
+              ASM_FLAG_OUT(, "; setz %[zf]")
+              : [zf] ASM_FLAG_OUT("=@ccz", "=qm") (zf)
+              : "S" (data), "D" (ptr) : "memory" );
+#endif
+        if ( zf )
+            *eflags |= X86_EFLAGS_ZF;
+        break;
+
     case blk_movdir:
         switch ( bytes )
         {
@@ -11870,6 +11928,8 @@ x86_insn_is_mem_write(const struct x86_emulate_state *state,
             return !mode_64bit();
 
         case X86EMUL_OPC_66(0x0f38, 0xf8): /* MOVDIR64B */
+        case X86EMUL_OPC_F2(0x0f38, 0xf8): /* ENQCMD */
+        case X86EMUL_OPC_F3(0x0f38, 0xf8): /* ENQCMDS */
             return true;
         }
 
diff --git a/xen/include/asm-x86/cpufeature.h b/xen/include/asm-x86/cpufeature.h
index 0e772e39c1..025f29e83e 100644
--- a/xen/include/asm-x86/cpufeature.h
+++ b/xen/include/asm-x86/cpufeature.h
@@ -120,6 +120,7 @@
 #define cpu_has_rdpid           boot_cpu_has(X86_FEATURE_RDPID)
 #define cpu_has_movdiri         boot_cpu_has(X86_FEATURE_MOVDIRI)
 #define cpu_has_movdir64b       boot_cpu_has(X86_FEATURE_MOVDIR64B)
+#define cpu_has_enqcmd          boot_cpu_has(X86_FEATURE_ENQCMD)
 
 /* CPUID level 0x80000007.edx */
 #define cpu_has_itsc            boot_cpu_has(X86_FEATURE_ITSC)
diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h
index 85c5f20b76..5fa14ca136 100644
--- a/xen/include/asm-x86/msr-index.h
+++ b/xen/include/asm-x86/msr-index.h
@@ -74,6 +74,10 @@
 #define MSR_PL3_SSP                         0x000006a7
 #define MSR_INTERRUPT_SSP_TABLE             0x000006a8
 
+#define MSR_PASID                           0x00000d93
+#define  PASID_PASID_MASK                   0x000fffff
+#define  PASID_VALID                        (_AC(1, ULL) << 31)
+
 /*
  * Legacy MSR constants in need of cleanup.  No new MSRs below this comment.
  */
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 79f8ad3dd8..8347a405ac 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -243,6 +243,7 @@ XEN_CPUFEATURE(RDPID,         6*32+22) /*A  RDPID instruction */
 XEN_CPUFEATURE(CLDEMOTE,      6*32+25) /*A  CLDEMOTE instruction */
 XEN_CPUFEATURE(MOVDIRI,       6*32+27) /*a  MOVDIRI instruction */
 XEN_CPUFEATURE(MOVDIR64B,     6*32+28) /*a  MOVDIR64B instruction */
+XEN_CPUFEATURE(ENQCMD,        6*32+29) /*   ENQCMD{,S} instructions */
 
 /* AMD-defined CPU features, CPUID level 0x80000007.edx, word 7 */
 XEN_CPUFEATURE(ITSC,          7*32+ 8) /*   Invariant TSC */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jun 06 23:58:48 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Jun 2020 23:58: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 1jhii8-00067O-6w; Sat, 06 Jun 2020 23:58: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=x7q/=7T=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhii7-000679-0c
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:58:47 +0000
X-Inumbo-ID: a867fe88-a851-11ea-9ad7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id a867fe88-a851-11ea-9ad7-bc764e2007e4;
 Sat, 06 Jun 2020 23:58: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=U2Z/BjS3Usq2hVL7N22j/QmM03lKORN09ACLo0Xe1A4=; b=muvo7RTyNZem2rfUDM+BjlBzfK
 KH6zfb2BJalVEPppCn+h8H3ybNBCd33GY8mqkCU2g3+D2105vdyU9acc6/2OTVVriu/NV2X340DPH
 WCkhtVY3TEQhWd2E9+3WOMEEbZ2/BKSkN9KbIPVyTcB87YOG5Mn7NG8sTR7b+MrQQRH0=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhii5-0002YU-Ss
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:58:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhii5-0007Fr-S9
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:58:45 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86emul: support FNSTENV and FNSAVE
Message-Id: <E1jhii5-0007Fr-S9@xenbits.xenproject.org>
Date: Sat, 06 Jun 2020 23:58: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 422a104ba3c84795a08fa107117d6d08e79ef106
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri May 29 17:33:54 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri May 29 17:33:54 2020 +0200

    x86emul: support FNSTENV and FNSAVE
    
    To avoid introducing another boolean into emulator state, the
    rex_prefix field gets (ab)used to convey the real/VM86 vs protected mode
    info (affecting structure layout, albeit not size) to x86_emul_blk().
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/tests/x86_emulator/test_x86_emulator.c |  75 +++++++++++
 tools/tests/x86_emulator/x86-emulate.h       |   1 +
 xen/arch/x86/x86_emulate/x86_emulate.c       | 181 ++++++++++++++++++++++++++-
 3 files changed, 254 insertions(+), 3 deletions(-)

diff --git a/tools/tests/x86_emulator/test_x86_emulator.c b/tools/tests/x86_emulator/test_x86_emulator.c
index c80cb58d7d..ae8f140aa8 100644
--- a/tools/tests/x86_emulator/test_x86_emulator.c
+++ b/tools/tests/x86_emulator/test_x86_emulator.c
@@ -748,6 +748,25 @@ static struct x86_emulate_ops emulops = {
 
 #define MMAP_ADDR 0x100000
 
+/*
+ * 64-bit OSes may not (be able to) properly restore the two selectors in
+ * the FPU environment. Zap them so that memcmp() on two saved images will
+ * work regardless of whether a context switch occurred in the middle.
+ */
+static void zap_fpsel(unsigned int *env, bool is_32bit)
+{
+    if ( is_32bit )
+    {
+        env[4] &= ~0xffff;
+        env[6] &= ~0xffff;
+    }
+    else
+    {
+        env[2] &= ~0xffff;
+        env[3] &= ~0xffff;
+    }
+}
+
 #ifdef __x86_64__
 # define STKVAL_DISP 64
 static const struct {
@@ -2396,6 +2415,62 @@ int main(int argc, char **argv)
     else
         printf("skipped\n");
 
+    printf("%-40s", "Testing fnstenv 4(%ecx)...");
+    if ( stack_exec && cpu_has_fpu )
+    {
+        const uint16_t three = 3;
+
+        asm volatile ( "fninit\n\t"
+                       "fld1\n\t"
+                       "fidivs %1\n\t"
+                       "fstenv %0"
+                       : "=m" (res[9]) : "m" (three) : "memory" );
+        zap_fpsel(&res[9], true);
+        instr[0] = 0xd9; instr[1] = 0x71; instr[2] = 0x04;
+        regs.eip = (unsigned long)&instr[0];
+        regs.ecx = (unsigned long)res;
+        res[8] = 0xaa55aa55;
+        rc = x86_emulate(&ctxt, &emulops);
+        zap_fpsel(&res[1], true);
+        if ( (rc != X86EMUL_OKAY) ||
+             memcmp(res + 1, res + 9, 28) ||
+             res[8] != 0xaa55aa55 ||
+             (regs.eip != (unsigned long)&instr[3]) )
+            goto fail;
+        printf("okay\n");
+    }
+    else
+        printf("skipped\n");
+
+    printf("%-40s", "Testing 16-bit fnsave (%ecx)...");
+    if ( stack_exec && cpu_has_fpu )
+    {
+        const uint16_t five = 5;
+
+        asm volatile ( "fninit\n\t"
+                       "fld1\n\t"
+                       "fidivs %1\n\t"
+                       "fsaves %0"
+                       : "=m" (res[25]) : "m" (five) : "memory" );
+        zap_fpsel(&res[25], false);
+        asm volatile ( "frstors %0" :: "m" (res[25]) : "memory" );
+        instr[0] = 0x66; instr[1] = 0xdd; instr[2] = 0x31;
+        regs.eip = (unsigned long)&instr[0];
+        regs.ecx = (unsigned long)res;
+        res[23] = 0xaa55aa55;
+        res[24] = 0xaa55aa55;
+        rc = x86_emulate(&ctxt, &emulops);
+        if ( (rc != X86EMUL_OKAY) ||
+             memcmp(res, res + 25, 94) ||
+             (res[23] >> 16) != 0xaa55 ||
+             res[24] != 0xaa55aa55 ||
+             (regs.eip != (unsigned long)&instr[3]) )
+            goto fail;
+        printf("okay\n");
+    }
+    else
+        printf("skipped\n");
+
     printf("%-40s", "Testing movq %mm3,(%ecx)...");
     if ( stack_exec && cpu_has_mmx )
     {
diff --git a/tools/tests/x86_emulator/x86-emulate.h b/tools/tests/x86_emulator/x86-emulate.h
index 978dc48b33..6ea6cbc658 100644
--- a/tools/tests/x86_emulator/x86-emulate.h
+++ b/tools/tests/x86_emulator/x86-emulate.h
@@ -129,6 +129,7 @@ static inline bool xcr0_mask(uint64_t mask)
 }
 
 #define cache_line_size() (cp.basic.clflush_size * 8)
+#define cpu_has_fpu        cp.basic.fpu
 #define cpu_has_mmx        cp.basic.mmx
 #define cpu_has_fxsr       cp.basic.fxsr
 #define cpu_has_sse        cp.basic.sse
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 505ec09662..5ecf5c6335 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -856,6 +856,9 @@ struct x86_emulate_state {
     enum {
         blk_NONE,
         blk_enqcmd,
+#ifndef X86EMUL_NO_FPU
+        blk_fst, /* FNSTENV, FNSAVE */
+#endif
         blk_movdir,
     } blk;
     uint8_t modrm, modrm_mod, modrm_reg, modrm_rm;
@@ -897,6 +900,50 @@ struct x86_emulate_state {
 #define PTR_POISON NULL /* 32-bit builds are for user-space, so NULL is OK. */
 #endif
 
+#ifndef X86EMUL_NO_FPU
+struct x87_env16 {
+    uint16_t fcw;
+    uint16_t fsw;
+    uint16_t ftw;
+    union {
+        struct {
+            uint16_t fip_lo;
+            uint16_t fop:11, :1, fip_hi:4;
+            uint16_t fdp_lo;
+            uint16_t :12, fdp_hi:4;
+        } real;
+        struct {
+            uint16_t fip;
+            uint16_t fcs;
+            uint16_t fdp;
+            uint16_t fds;
+        } prot;
+    } mode;
+};
+
+struct x87_env32 {
+    uint32_t fcw:16, :16;
+    uint32_t fsw:16, :16;
+    uint32_t ftw:16, :16;
+    union {
+        struct {
+            /* some CPUs/FPUs also store the full FIP here */
+            uint32_t fip_lo:16, :16;
+            uint32_t fop:11, :1, fip_hi:16, :4;
+            /* some CPUs/FPUs also store the full FDP here */
+            uint32_t fdp_lo:16, :16;
+            uint32_t :12, fdp_hi:16, :4;
+        } real;
+        struct {
+            uint32_t fip;
+            uint32_t fcs:16, fop:11, :5;
+            uint32_t fdp;
+            uint32_t fds:16, :16;
+        } prot;
+    } mode;
+};
+#endif
+
 typedef union {
     uint64_t mmx;
     uint64_t __attribute__ ((aligned(16))) xmm[2];
@@ -4924,9 +4971,22 @@ x86_emulate(
                     goto done;
                 emulate_fpu_insn_memsrc(b, modrm_reg & 7, src.val);
                 break;
-            case 6: /* fnstenv - TODO */
+            case 6: /* fnstenv */
+                fail_if(!ops->blk);
+                state->blk = blk_fst;
+                /*
+                 * REX is meaningless for this insn by this point - (ab)use
+                 * the field to communicate real vs protected mode to ->blk().
+                 */
+                /*state->*/rex_prefix = in_protmode(ctxt, ops);
+                if ( (rc = ops->blk(ea.mem.seg, ea.mem.off, NULL,
+                                    op_bytes > 2 ? sizeof(struct x87_env32)
+                                                 : sizeof(struct x87_env16),
+                                    &_regs.eflags,
+                                    state, ctxt)) != X86EMUL_OKAY )
+                    goto done;
                 state->fpu_ctrl = true;
-                goto unimplemented_insn;
+                break;
             case 7: /* fnstcw m2byte */
                 state->fpu_ctrl = true;
             fpu_memdst16:
@@ -5080,9 +5140,24 @@ x86_emulate(
                 emulate_fpu_insn_memdst(b, modrm_reg & 7, dst.val);
                 break;
             case 4: /* frstor - TODO */
-            case 6: /* fnsave - TODO */
                 state->fpu_ctrl = true;
                 goto unimplemented_insn;
+            case 6: /* fnsave */
+                fail_if(!ops->blk);
+                state->blk = blk_fst;
+                /*
+                 * REX is meaningless for this insn by this point - (ab)use
+                 * the field to communicate real vs protected mode to ->blk().
+                 */
+                /*state->*/rex_prefix = in_protmode(ctxt, ops);
+                if ( (rc = ops->blk(ea.mem.seg, ea.mem.off, NULL,
+                                    op_bytes > 2 ? sizeof(struct x87_env32) + 80
+                                                 : sizeof(struct x87_env16) + 80,
+                                    &_regs.eflags,
+                                    state, ctxt)) != X86EMUL_OKAY )
+                    goto done;
+                state->fpu_ctrl = true;
+                break;
             case 7: /* fnstsw m2byte */
                 state->fpu_ctrl = true;
                 goto fpu_memdst16;
@@ -11559,6 +11634,14 @@ int x86_emul_blk(
     switch ( state->blk )
     {
         bool zf;
+#ifndef X86EMUL_NO_FPU
+        struct {
+            struct x87_env32 env;
+            struct {
+               uint8_t bytes[10];
+            } freg[8];
+        } fpstate;
+#endif
 
         /*
          * Throughout this switch(), memory clobbers are used to compensate
@@ -11588,6 +11671,98 @@ int x86_emul_blk(
             *eflags |= X86_EFLAGS_ZF;
         break;
 
+#ifndef X86EMUL_NO_FPU
+
+    case blk_fst:
+        ASSERT(!data);
+
+        /* Don't chance consuming uninitialized data. */
+        memset(&fpstate, 0, sizeof(fpstate));
+        if ( bytes > sizeof(fpstate.env) )
+            asm ( "fnsave %0" : "+m" (fpstate) );
+        else
+            asm ( "fnstenv %0" : "+m" (fpstate.env) );
+
+        /* state->rex_prefix carries CR0.PE && !EFLAGS.VM setting */
+        switch ( bytes )
+        {
+        case sizeof(fpstate.env): /* 32-bit FNSTENV */
+        case sizeof(fpstate):     /* 32-bit FNSAVE */
+            if ( !state->rex_prefix )
+            {
+                /* Convert 32-bit prot to 32-bit real/vm86 format. */
+                unsigned int fip = fpstate.env.mode.prot.fip +
+                                   (fpstate.env.mode.prot.fcs << 4);
+                unsigned int fdp = fpstate.env.mode.prot.fdp +
+                                   (fpstate.env.mode.prot.fds << 4);
+                unsigned int fop = fpstate.env.mode.prot.fop;
+
+                memset(&fpstate.env.mode, 0, sizeof(fpstate.env.mode));
+                fpstate.env.mode.real.fip_lo = fip;
+                fpstate.env.mode.real.fip_hi = fip >> 16;
+                fpstate.env.mode.real.fop = fop;
+                fpstate.env.mode.real.fdp_lo = fdp;
+                fpstate.env.mode.real.fdp_hi = fdp >> 16;
+            }
+            memcpy(ptr, &fpstate.env, sizeof(fpstate.env));
+            if ( bytes == sizeof(fpstate.env) )
+                ptr = NULL;
+            else
+                ptr += sizeof(fpstate.env);
+            break;
+
+        case sizeof(struct x87_env16):                        /* 16-bit FNSTENV */
+        case sizeof(struct x87_env16) + sizeof(fpstate.freg): /* 16-bit FNSAVE */
+            if ( state->rex_prefix )
+            {
+                /* Convert 32-bit prot to 16-bit prot format. */
+                struct x87_env16 *env = ptr;
+
+                env->fcw = fpstate.env.fcw;
+                env->fsw = fpstate.env.fsw;
+                env->ftw = fpstate.env.ftw;
+                env->mode.prot.fip = fpstate.env.mode.prot.fip;
+                env->mode.prot.fcs = fpstate.env.mode.prot.fcs;
+                env->mode.prot.fdp = fpstate.env.mode.prot.fdp;
+                env->mode.prot.fds = fpstate.env.mode.prot.fds;
+            }
+            else
+            {
+                /* Convert 32-bit prot to 16-bit real/vm86 format. */
+                unsigned int fip = fpstate.env.mode.prot.fip +
+                                   (fpstate.env.mode.prot.fcs << 4);
+                unsigned int fdp = fpstate.env.mode.prot.fdp +
+                                   (fpstate.env.mode.prot.fds << 4);
+                struct x87_env16 env = {
+                    .fcw = fpstate.env.fcw,
+                    .fsw = fpstate.env.fsw,
+                    .ftw = fpstate.env.ftw,
+                    .mode.real.fip_lo = fip,
+                    .mode.real.fip_hi = fip >> 16,
+                    .mode.real.fop = fpstate.env.mode.prot.fop,
+                    .mode.real.fdp_lo = fdp,
+                    .mode.real.fdp_hi = fdp >> 16
+                };
+
+                memcpy(ptr, &env, sizeof(env));
+            }
+            if ( bytes == sizeof(struct x87_env16) )
+                ptr = NULL;
+            else
+                ptr += sizeof(struct x87_env16);
+            break;
+
+        default:
+            ASSERT_UNREACHABLE();
+            return X86EMUL_UNHANDLEABLE;
+        }
+
+        if ( ptr )
+            memcpy(ptr, fpstate.freg, sizeof(fpstate.freg));
+        break;
+
+#endif /* X86EMUL_NO_FPU */
+
     case blk_movdir:
         switch ( bytes )
         {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jun 06 23:58:59 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Jun 2020 23:58: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 1jhiiJ-00068b-8i; Sat, 06 Jun 2020 23:58:59 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=x7q/=7T=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhiiH-00068J-8n
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:58:57 +0000
X-Inumbo-ID: ae7201de-a851-11ea-b15a-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id ae7201de-a851-11ea-b15a-12813bfff9fa;
 Sat, 06 Jun 2020 23:58: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=XPQCIbmyCIPztJq+Bs7vsa9/m1vWvnuWv/vFFZYhz/g=; b=SXUXgVkEVJy5oMnkmrevLQ9PET
 tth9WBolOvQrKr+Xa785x+Ch1MSXqhT0tdRd0eg6tKuHDF7U2x7obC4sHiN+Me+nM+C9DV8zGHgc1
 fWt2g5wbbSs0VDTZdFEZoI0fRjmVh4MOCVcoX2suQfTYerVQQVD1wwXF5sdL/rFZm7iA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhiiG-0002Yl-0X
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:58:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhiiF-0007Gb-W1
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:58:55 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86emul: support FLDENV and FRSTOR
Message-Id: <E1jhiiF-0007Gb-W1@xenbits.xenproject.org>
Date: Sat, 06 Jun 2020 23:58: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 be55ed744ed81ffb114ce16abb4bfe2f22af5a1d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri May 29 17:34:31 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri May 29 17:34:31 2020 +0200

    x86emul: support FLDENV and FRSTOR
    
    While the Intel SDM claims that FRSTOR itself may raise #MF upon
    completion, this was confirmed by Intel to be a doc error which will be
    corrected in due course; behavior is like FLDENV, and like old hard copy
    manuals describe it.
    
    Re-arrange a switch() statement's case label order to allow for
    fall-through from FLDENV handling to FNSTENV's.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/tests/x86_emulator/test_x86_emulator.c |  46 ++++++++++
 xen/arch/x86/x86_emulate/x86_emulate.c       | 125 +++++++++++++++++++++++----
 2 files changed, 153 insertions(+), 18 deletions(-)

diff --git a/tools/tests/x86_emulator/test_x86_emulator.c b/tools/tests/x86_emulator/test_x86_emulator.c
index ae8f140aa8..a5011d6783 100644
--- a/tools/tests/x86_emulator/test_x86_emulator.c
+++ b/tools/tests/x86_emulator/test_x86_emulator.c
@@ -2442,6 +2442,27 @@ int main(int argc, char **argv)
     else
         printf("skipped\n");
 
+    printf("%-40s", "Testing fldenv 8(%edx)...");
+    if ( stack_exec && cpu_has_fpu )
+    {
+        asm volatile ( "fnstenv %0\n\t"
+                       "fninit"
+                       : "=m" (res[2]) :: "memory" );
+        zap_fpsel(&res[2], true);
+        instr[0] = 0xd9; instr[1] = 0x62; instr[2] = 0x08;
+        regs.eip = (unsigned long)&instr[0];
+        regs.edx = (unsigned long)res;
+        rc = x86_emulate(&ctxt, &emulops);
+        asm volatile ( "fnstenv %0" : "=m" (res[9]) :: "memory" );
+        if ( (rc != X86EMUL_OKAY) ||
+             memcmp(res + 2, res + 9, 28) ||
+             (regs.eip != (unsigned long)&instr[3]) )
+            goto fail;
+        printf("okay\n");
+    }
+    else
+        printf("skipped\n");
+
     printf("%-40s", "Testing 16-bit fnsave (%ecx)...");
     if ( stack_exec && cpu_has_fpu )
     {
@@ -2471,6 +2492,31 @@ int main(int argc, char **argv)
     else
         printf("skipped\n");
 
+    printf("%-40s", "Testing frstor (%edx)...");
+    if ( stack_exec && cpu_has_fpu )
+    {
+        const uint16_t seven = 7;
+
+        asm volatile ( "fninit\n\t"
+                       "fld1\n\t"
+                       "fidivs %1\n\t"
+                       "fnsave %0\n\t"
+                       : "=&m" (res[0]) : "m" (seven) : "memory" );
+        zap_fpsel(&res[0], true);
+        instr[0] = 0xdd; instr[1] = 0x22;
+        regs.eip = (unsigned long)&instr[0];
+        regs.edx = (unsigned long)res;
+        rc = x86_emulate(&ctxt, &emulops);
+        asm volatile ( "fnsave %0" : "=m" (res[27]) :: "memory" );
+        if ( (rc != X86EMUL_OKAY) ||
+             memcmp(res, res + 27, 108) ||
+             (regs.eip != (unsigned long)&instr[2]) )
+            goto fail;
+        printf("okay\n");
+    }
+    else
+        printf("skipped\n");
+
     printf("%-40s", "Testing movq %mm3,(%ecx)...");
     if ( stack_exec && cpu_has_mmx )
     {
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 5ecf5c6335..725f0b8b3e 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -857,6 +857,7 @@ struct x86_emulate_state {
         blk_NONE,
         blk_enqcmd,
 #ifndef X86EMUL_NO_FPU
+        blk_fld, /* FLDENV, FRSTOR */
         blk_fst, /* FNSTENV, FNSAVE */
 #endif
         blk_movdir,
@@ -4960,22 +4961,15 @@ x86_emulate(
                 dst.bytes = 4;
                 emulate_fpu_insn_memdst(b, modrm_reg & 7, dst.val);
                 break;
-            case 4: /* fldenv - TODO */
-                state->fpu_ctrl = true;
-                goto unimplemented_insn;
-            case 5: /* fldcw m2byte */
-                state->fpu_ctrl = true;
-            fpu_memsrc16:
-                if ( (rc = ops->read(ea.mem.seg, ea.mem.off, &src.val,
-                                     2, ctxt)) != X86EMUL_OKAY )
-                    goto done;
-                emulate_fpu_insn_memsrc(b, modrm_reg & 7, src.val);
-                break;
+            case 4: /* fldenv */
+                /* Raise #MF now if there are pending unmasked exceptions. */
+                emulate_fpu_insn_stub(0xd9, 0xd0 /* fnop */);
+                /* fall through */
             case 6: /* fnstenv */
                 fail_if(!ops->blk);
-                state->blk = blk_fst;
+                state->blk = modrm_reg & 2 ? blk_fst : blk_fld;
                 /*
-                 * REX is meaningless for this insn by this point - (ab)use
+                 * REX is meaningless for these insns by this point - (ab)use
                  * the field to communicate real vs protected mode to ->blk().
                  */
                 /*state->*/rex_prefix = in_protmode(ctxt, ops);
@@ -4987,6 +4981,14 @@ x86_emulate(
                     goto done;
                 state->fpu_ctrl = true;
                 break;
+            case 5: /* fldcw m2byte */
+                state->fpu_ctrl = true;
+            fpu_memsrc16:
+                if ( (rc = ops->read(ea.mem.seg, ea.mem.off, &src.val,
+                                     2, ctxt)) != X86EMUL_OKAY )
+                    goto done;
+                emulate_fpu_insn_memsrc(b, modrm_reg & 7, src.val);
+                break;
             case 7: /* fnstcw m2byte */
                 state->fpu_ctrl = true;
             fpu_memdst16:
@@ -5139,14 +5141,15 @@ x86_emulate(
                 dst.bytes = 8;
                 emulate_fpu_insn_memdst(b, modrm_reg & 7, dst.val);
                 break;
-            case 4: /* frstor - TODO */
-                state->fpu_ctrl = true;
-                goto unimplemented_insn;
+            case 4: /* frstor */
+                /* Raise #MF now if there are pending unmasked exceptions. */
+                emulate_fpu_insn_stub(0xd9, 0xd0 /* fnop */);
+                /* fall through */
             case 6: /* fnsave */
                 fail_if(!ops->blk);
-                state->blk = blk_fst;
+                state->blk = modrm_reg & 2 ? blk_fst : blk_fld;
                 /*
-                 * REX is meaningless for this insn by this point - (ab)use
+                 * REX is meaningless for these insns by this point - (ab)use
                  * the field to communicate real vs protected mode to ->blk().
                  */
                 /*state->*/rex_prefix = in_protmode(ctxt, ops);
@@ -11673,6 +11676,92 @@ int x86_emul_blk(
 
 #ifndef X86EMUL_NO_FPU
 
+    case blk_fld:
+        ASSERT(!data);
+
+        /* state->rex_prefix carries CR0.PE && !EFLAGS.VM setting */
+        switch ( bytes )
+        {
+        case sizeof(fpstate.env): /* 32-bit FLDENV */
+        case sizeof(fpstate):     /* 32-bit FRSTOR */
+            memcpy(&fpstate.env, ptr, sizeof(fpstate.env));
+            if ( !state->rex_prefix )
+            {
+                /* Convert 32-bit real/vm86 to 32-bit prot format. */
+                unsigned int fip = fpstate.env.mode.real.fip_lo +
+                                   (fpstate.env.mode.real.fip_hi << 16);
+                unsigned int fdp = fpstate.env.mode.real.fdp_lo +
+                                   (fpstate.env.mode.real.fdp_hi << 16);
+                unsigned int fop = fpstate.env.mode.real.fop;
+
+                fpstate.env.mode.prot.fip = fip & 0xf;
+                fpstate.env.mode.prot.fcs = fip >> 4;
+                fpstate.env.mode.prot.fop = fop;
+                fpstate.env.mode.prot.fdp = fdp & 0xf;
+                fpstate.env.mode.prot.fds = fdp >> 4;
+            }
+
+            if ( bytes == sizeof(fpstate.env) )
+                ptr = NULL;
+            else
+                ptr += sizeof(fpstate.env);
+            break;
+
+        case sizeof(struct x87_env16):                        /* 16-bit FLDENV */
+        case sizeof(struct x87_env16) + sizeof(fpstate.freg): /* 16-bit FRSTOR */
+        {
+            const struct x87_env16 *env = ptr;
+
+            fpstate.env.fcw = env->fcw;
+            fpstate.env.fsw = env->fsw;
+            fpstate.env.ftw = env->ftw;
+
+            if ( state->rex_prefix )
+            {
+                /* Convert 16-bit prot to 32-bit prot format. */
+                fpstate.env.mode.prot.fip = env->mode.prot.fip;
+                fpstate.env.mode.prot.fcs = env->mode.prot.fcs;
+                fpstate.env.mode.prot.fdp = env->mode.prot.fdp;
+                fpstate.env.mode.prot.fds = env->mode.prot.fds;
+                fpstate.env.mode.prot.fop = 0; /* unknown */
+            }
+            else
+            {
+                /* Convert 16-bit real/vm86 to 32-bit prot format. */
+                unsigned int fip = env->mode.real.fip_lo +
+                                   (env->mode.real.fip_hi << 16);
+                unsigned int fdp = env->mode.real.fdp_lo +
+                                   (env->mode.real.fdp_hi << 16);
+                unsigned int fop = env->mode.real.fop;
+
+                fpstate.env.mode.prot.fip = fip & 0xf;
+                fpstate.env.mode.prot.fcs = fip >> 4;
+                fpstate.env.mode.prot.fop = fop;
+                fpstate.env.mode.prot.fdp = fdp & 0xf;
+                fpstate.env.mode.prot.fds = fdp >> 4;
+            }
+
+            if ( bytes == sizeof(*env) )
+                ptr = NULL;
+            else
+                ptr += sizeof(*env);
+            break;
+        }
+
+        default:
+            ASSERT_UNREACHABLE();
+            return X86EMUL_UNHANDLEABLE;
+        }
+
+        if ( ptr )
+        {
+            memcpy(fpstate.freg, ptr, sizeof(fpstate.freg));
+            asm volatile ( "frstor %0" :: "m" (fpstate) );
+        }
+        else
+            asm volatile ( "fldenv %0" :: "m" (fpstate.env) );
+        break;
+
     case blk_fst:
         ASSERT(!data);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jun 06 23:59:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Jun 2020 23:59: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 1jhiiT-00069f-AI; Sat, 06 Jun 2020 23:59: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=x7q/=7T=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhiiR-00069P-B2
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:59:07 +0000
X-Inumbo-ID: b47a4b04-a851-11ea-b15a-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id b47a4b04-a851-11ea-b15a-12813bfff9fa;
 Sat, 06 Jun 2020 23:59: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=DnXpvnPqhWBLHX8W9Hmw+GgczzYM4NF4u8teLVCaJHk=; b=wGYosxu23OKqRE1t9OVJ9iOaZy
 jmDCGd4maRjsrm8ROVRcQWUoGd/ozzlWQpEb5zJhL/LCn75bJV877pYPA0UKpx56PTV97BUKk4AP+
 Tb99m6ZnekaRGxzismhLF103JvrUsg1MGSqJ/cktetzyIueDQGDQ57xyNezlbcgc5T3Y=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhiiQ-0002ZA-4X
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:59:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhiiQ-0007HP-3m
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:59:06 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86emul: support FXSAVE/FXRSTOR
Message-Id: <E1jhiiQ-0007HP-3m@xenbits.xenproject.org>
Date: Sat, 06 Jun 2020 23:59: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 beb164ea11da62237d723af098f9371f35fe0323
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri May 29 17:35:09 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri May 29 17:35:09 2020 +0200

    x86emul: support FXSAVE/FXRSTOR
    
    Note that FPU selector handling as well as MXCSR mask saving for now
    does not honor differences between host and guest visible featuresets.
    
    While for Intel operation of the insns with CR4.OSFXSR=0 is
    implementation dependent, use the easiest solution there: Simply don't
    look at the bit in the first place. For AMD and alike the behavior is
    well defined, so it gets handled together with FFXSR.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/tests/x86_emulator/test_x86_emulator.c |  91 ++++++++++++++++
 tools/tests/x86_emulator/x86-emulate.c       |   7 ++
 xen/arch/x86/x86_emulate.c                   |   2 +
 xen/arch/x86/x86_emulate/x86_emulate.c       | 157 ++++++++++++++++++++++++++-
 4 files changed, 256 insertions(+), 1 deletion(-)

diff --git a/tools/tests/x86_emulator/test_x86_emulator.c b/tools/tests/x86_emulator/test_x86_emulator.c
index a5011d6783..e7de37eaef 100644
--- a/tools/tests/x86_emulator/test_x86_emulator.c
+++ b/tools/tests/x86_emulator/test_x86_emulator.c
@@ -767,6 +767,12 @@ static void zap_fpsel(unsigned int *env, bool is_32bit)
     }
 }
 
+static void zap_xfpsel(unsigned int *env)
+{
+    env[3] &= ~0xffff;
+    env[5] &= ~0xffff;
+}
+
 #ifdef __x86_64__
 # define STKVAL_DISP 64
 static const struct {
@@ -2517,6 +2523,91 @@ int main(int argc, char **argv)
     else
         printf("skipped\n");
 
+    printf("%-40s", "Testing fxsave 4(%ecx)...");
+    if ( stack_exec && cpu_has_fxsr )
+    {
+        const uint16_t nine = 9;
+
+        memset(res + 0x80, 0xcc, 0x400);
+        if ( cpu_has_sse2 )
+            asm volatile ( "pcmpeqd %xmm7, %xmm7\n\t"
+                           "pxor %xmm6, %xmm6\n\t"
+                           "psubw %xmm7, %xmm6" );
+        asm volatile ( "fninit\n\t"
+                       "fld1\n\t"
+                       "fidivs %1\n\t"
+                       "fxsave %0"
+                       : "=m" (res[0x100]) : "m" (nine) : "memory" );
+        zap_xfpsel(&res[0x100]);
+        instr[0] = 0x0f; instr[1] = 0xae; instr[2] = 0x41; instr[3] = 0x04;
+        regs.eip = (unsigned long)&instr[0];
+        regs.ecx = (unsigned long)(res + 0x7f);
+        memset(res + 0x100 + 0x74, 0x33, 0x30);
+        memset(res + 0x80 + 0x74, 0x33, 0x30);
+        rc = x86_emulate(&ctxt, &emulops);
+        zap_xfpsel(&res[0x80]);
+        if ( (rc != X86EMUL_OKAY) ||
+             memcmp(res + 0x80, res + 0x100, 0x200) ||
+             (regs.eip != (unsigned long)&instr[4]) )
+            goto fail;
+        printf("okay\n");
+    }
+    else
+        printf("skipped\n");
+
+    printf("%-40s", "Testing fxrstor -4(%ecx)...");
+    if ( stack_exec && cpu_has_fxsr )
+    {
+        const uint16_t eleven = 11;
+
+        memset(res + 0x80, 0xcc, 0x400);
+        asm volatile ( "fxsave %0" : "=m" (res[0x80]) :: "memory" );
+        zap_xfpsel(&res[0x80]);
+        if ( cpu_has_sse2 )
+            asm volatile ( "pxor %xmm7, %xmm6\n\t"
+                           "pxor %xmm7, %xmm3\n\t"
+                           "pxor %xmm7, %xmm0\n\t"
+                           "pxor %xmm7, %xmm7" );
+        asm volatile ( "fninit\n\t"
+                       "fld1\n\t"
+                       "fidivs %0\n\t"
+                       :: "m" (eleven) );
+        instr[0] = 0x0f; instr[1] = 0xae; instr[2] = 0x49; instr[3] = 0xfc;
+        regs.eip = (unsigned long)&instr[0];
+        regs.ecx = (unsigned long)(res + 0x81);
+        rc = x86_emulate(&ctxt, &emulops);
+        asm volatile ( "fxsave %0" : "=m" (res[0x100]) :: "memory" );
+        if ( (rc != X86EMUL_OKAY) ||
+             memcmp(res + 0x100, res + 0x80, 0x200) ||
+             (regs.eip != (unsigned long)&instr[4]) )
+            goto fail;
+        printf("okay\n");
+    }
+    else
+        printf("skipped\n");
+
+#ifdef __x86_64__
+    printf("%-40s", "Testing fxsaveq 8(%edx)...");
+    if ( stack_exec && cpu_has_fxsr )
+    {
+        memset(res + 0x80, 0xcc, 0x400);
+        asm volatile ( "fxsaveq %0" : "=m" (res[0x100]) :: "memory" );
+        instr[0] = 0x48; instr[1] = 0x0f; instr[2] = 0xae; instr[3] = 0x42; instr[4] = 0x08;
+        regs.eip = (unsigned long)&instr[0];
+        regs.edx = (unsigned long)(res + 0x7e);
+        memset(res + 0x100 + 0x74, 0x33, 0x30);
+        memset(res + 0x80 + 0x74, 0x33, 0x30);
+        rc = x86_emulate(&ctxt, &emulops);
+        if ( (rc != X86EMUL_OKAY) ||
+             memcmp(res + 0x80, res + 0x100, 0x200) ||
+             (regs.eip != (unsigned long)&instr[5]) )
+            goto fail;
+        printf("okay\n");
+    }
+    else
+        printf("skipped\n");
+#endif
+
     printf("%-40s", "Testing movq %mm3,(%ecx)...");
     if ( stack_exec && cpu_has_mmx )
     {
diff --git a/tools/tests/x86_emulator/x86-emulate.c b/tools/tests/x86_emulator/x86-emulate.c
index 82c7db4651..572989078a 100644
--- a/tools/tests/x86_emulator/x86-emulate.c
+++ b/tools/tests/x86_emulator/x86-emulate.c
@@ -36,6 +36,13 @@ struct cpuid_policy cp;
 static char fpu_save_area[4096] __attribute__((__aligned__((64))));
 static bool use_xsave;
 
+/*
+ * Re-use the area above also as scratch space for the emulator itself.
+ * (When debugging the emulator, care needs to be taken when inserting
+ * printf() or alike function calls into regions using this.)
+ */
+#define FXSAVE_AREA ((struct x86_fxsr *)fpu_save_area)
+
 void emul_save_fpu_state(void)
 {
     if ( use_xsave )
diff --git a/xen/arch/x86/x86_emulate.c b/xen/arch/x86/x86_emulate.c
index 33516f4e5d..1e082e6f3b 100644
--- a/xen/arch/x86/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate.c
@@ -43,6 +43,8 @@
     }                                                      \
 })
 
+#define FXSAVE_AREA current->arch.fpu_ctxt
+
 #ifndef CONFIG_HVM
 # define X86EMUL_NO_FPU
 # define X86EMUL_NO_MMX
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 725f0b8b3e..84bb8e0c9b 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -859,6 +859,11 @@ struct x86_emulate_state {
 #ifndef X86EMUL_NO_FPU
         blk_fld, /* FLDENV, FRSTOR */
         blk_fst, /* FNSTENV, FNSAVE */
+#endif
+#if !defined(X86EMUL_NO_FPU) || !defined(X86EMUL_NO_MMX) || \
+    !defined(X86EMUL_NO_SIMD)
+        blk_fxrstor,
+        blk_fxsave,
 #endif
         blk_movdir,
     } blk;
@@ -953,6 +958,29 @@ typedef union {
     uint32_t data32[16];
 } mmval_t;
 
+struct x86_fxsr {
+    uint16_t fcw;
+    uint16_t fsw;
+    uint8_t ftw, :8;
+    uint16_t fop;
+    union {
+        struct {
+            uint32_t offs;
+            uint16_t sel, :16;
+        };
+        uint64_t addr;
+    } fip, fdp;
+    uint32_t mxcsr;
+    uint32_t mxcsr_mask;
+    struct {
+        uint8_t data[10];
+        uint16_t :16, :16, :16;
+    } fpreg[8];
+    uint64_t __attribute__ ((aligned(16))) xmm[16][2];
+    uint64_t rsvd[6];
+    uint64_t avl[6];
+};
+
 /*
  * While proper alignment gets specified above, this doesn't get honored by
  * the compiler for automatic variables. Use this helper to instantiate a
@@ -1910,6 +1938,7 @@ amd_like(const struct x86_emulate_ctxt *ctxt)
 #define vcpu_has_cmov()        (ctxt->cpuid->basic.cmov)
 #define vcpu_has_clflush()     (ctxt->cpuid->basic.clflush)
 #define vcpu_has_mmx()         (ctxt->cpuid->basic.mmx)
+#define vcpu_has_fxsr()        (ctxt->cpuid->basic.fxsr)
 #define vcpu_has_sse()         (ctxt->cpuid->basic.sse)
 #define vcpu_has_sse2()        (ctxt->cpuid->basic.sse2)
 #define vcpu_has_sse3()        (ctxt->cpuid->basic.sse3)
@@ -8148,6 +8177,49 @@ x86_emulate(
     case X86EMUL_OPC(0x0f, 0xae): case X86EMUL_OPC_66(0x0f, 0xae): /* Grp15 */
         switch ( modrm_reg & 7 )
         {
+#if !defined(X86EMUL_NO_FPU) || !defined(X86EMUL_NO_MMX) || \
+    !defined(X86EMUL_NO_SIMD)
+        case 0: /* fxsave */
+        case 1: /* fxrstor */
+            generate_exception_if(vex.pfx, EXC_UD);
+            vcpu_must_have(fxsr);
+            generate_exception_if(ea.type != OP_MEM, EXC_UD);
+            generate_exception_if(!is_aligned(ea.mem.seg, ea.mem.off, 16,
+                                              ctxt, ops),
+                                  EXC_GP, 0);
+            fail_if(!ops->blk);
+            op_bytes =
+#ifdef __x86_64__
+                !mode_64bit() ? offsetof(struct x86_fxsr, xmm[8]) :
+#endif
+                sizeof(struct x86_fxsr);
+            if ( amd_like(ctxt) )
+            {
+                /* Assume "normal" operation in case of missing hooks. */
+                if ( !ops->read_cr ||
+                     ops->read_cr(4, &cr4, ctxt) != X86EMUL_OKAY )
+                    cr4 = X86_CR4_OSFXSR;
+                if ( !ops->read_msr ||
+                     ops->read_msr(MSR_EFER, &msr_val, ctxt) != X86EMUL_OKAY )
+                    msr_val = 0;
+                if ( !(cr4 & X86_CR4_OSFXSR) ||
+                     (mode_64bit() && mode_ring0() && (msr_val & EFER_FFXSE)) )
+                    op_bytes = offsetof(struct x86_fxsr, xmm[0]);
+            }
+            /*
+             * This could also be X86EMUL_FPU_mmx, but it shouldn't be
+             * X86EMUL_FPU_xmm, as we don't want CR4.OSFXSR checked.
+             */
+            get_fpu(X86EMUL_FPU_fpu);
+            state->fpu_ctrl = true;
+            state->blk = modrm_reg & 1 ? blk_fxrstor : blk_fxsave;
+            if ( (rc = ops->blk(ea.mem.seg, ea.mem.off, NULL,
+                                sizeof(struct x86_fxsr), &_regs.eflags,
+                                state, ctxt)) != X86EMUL_OKAY )
+                goto done;
+            break;
+#endif /* X86EMUL_NO_{FPU,MMX,SIMD} */
+
 #ifndef X86EMUL_NO_SIMD
         case 2: /* ldmxcsr */
             generate_exception_if(vex.pfx, EXC_UD);
@@ -11634,6 +11706,8 @@ int x86_emul_blk(
     struct x86_emulate_state *state,
     struct x86_emulate_ctxt *ctxt)
 {
+    int rc = X86EMUL_OKAY;
+
     switch ( state->blk )
     {
         bool zf;
@@ -11852,6 +11926,86 @@ int x86_emul_blk(
 
 #endif /* X86EMUL_NO_FPU */
 
+#if !defined(X86EMUL_NO_FPU) || !defined(X86EMUL_NO_MMX) || \
+    !defined(X86EMUL_NO_SIMD)
+
+    case blk_fxrstor:
+    {
+        struct x86_fxsr *fxsr = FXSAVE_AREA;
+
+        ASSERT(!data);
+        ASSERT(bytes == sizeof(*fxsr));
+        ASSERT(state->op_bytes <= bytes);
+
+        if ( state->op_bytes < sizeof(*fxsr) )
+        {
+            if ( state->rex_prefix & REX_W )
+            {
+                /*
+                 * The only way to force fxsaveq on a wide range of gas
+                 * versions. On older versions the rex64 prefix works only if
+                 * we force an addressing mode that doesn't require extended
+                 * registers.
+                 */
+                asm volatile ( ".byte 0x48; fxsave (%1)"
+                               : "=m" (*fxsr) : "R" (fxsr) );
+            }
+            else
+                asm volatile ( "fxsave %0" : "=m" (*fxsr) );
+        }
+
+        /*
+         * Don't chance the reserved or available ranges to contain any
+         * data FXRSTOR may actually consume in some way: Copy only the
+         * defined portion, and zero the rest.
+         */
+        memcpy(fxsr, ptr, min(state->op_bytes,
+                              (unsigned int)offsetof(struct x86_fxsr, rsvd)));
+        memset(fxsr->rsvd, 0, sizeof(*fxsr) - offsetof(struct x86_fxsr, rsvd));
+
+        generate_exception_if(fxsr->mxcsr & ~mxcsr_mask, EXC_GP, 0);
+
+        if ( state->rex_prefix & REX_W )
+        {
+            /* See above for why operand/constraints are this way. */
+            asm volatile ( ".byte 0x48; fxrstor (%1)"
+                           :: "m" (*fxsr), "R" (fxsr) );
+        }
+        else
+            asm volatile ( "fxrstor %0" :: "m" (*fxsr) );
+        break;
+    }
+
+    case blk_fxsave:
+    {
+        struct x86_fxsr *fxsr = FXSAVE_AREA;
+
+        ASSERT(!data);
+        ASSERT(bytes == sizeof(*fxsr));
+        ASSERT(state->op_bytes <= bytes);
+
+        if ( state->op_bytes < sizeof(*fxsr) )
+            /* Don't chance consuming uninitialized data. */
+            memset(fxsr, 0, state->op_bytes);
+        else
+            fxsr = ptr;
+
+        if ( state->rex_prefix & REX_W )
+        {
+            /* See above for why operand/constraints are this way. */
+            asm volatile ( ".byte 0x48; fxsave (%1)"
+                           : "=m" (*fxsr) : "R" (fxsr) );
+        }
+        else
+            asm volatile ( "fxsave %0" : "=m" (*fxsr) );
+
+        if ( fxsr != ptr ) /* i.e. state->op_bytes < sizeof(*fxsr) */
+            memcpy(ptr, fxsr, state->op_bytes);
+        break;
+    }
+
+#endif /* X86EMUL_NO_{FPU,MMX,SIMD} */
+
     case blk_movdir:
         switch ( bytes )
         {
@@ -11905,7 +12059,8 @@ int x86_emul_blk(
         return X86EMUL_UNHANDLEABLE;
     }
 
-    return X86EMUL_OKAY;
+ done:
+    return rc;
 }
 
 static void __init __maybe_unused build_assertions(void)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jun 06 23:59:17 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Jun 2020 23:59: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 1jhiib-0006Am-DX; Sat, 06 Jun 2020 23:59: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=x7q/=7T=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhiia-0006Ag-Pj
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:59:16 +0000
X-Inumbo-ID: ba7d841c-a851-11ea-9b55-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id ba7d841c-a851-11ea-9b55-bc764e2007e4;
 Sat, 06 Jun 2020 23:59: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=0/wiRHqy0ls591YsqyumwhCZd/xvQ9gFtQw/fkVFLIY=; b=UAui9BJnlEJUGOYahpv+0AjiWr
 vL4FyKUUKWZ8MmOFzNVwdz753/oESmgYq7O9IwtRN58U0bKeMeuf1vJorExRe1YNknhoO67qRKp8t
 yeBQLAfb9vqdlSDKoLf4vsVnEGw0kpN75cWT1jB+O9nlAaJrwFiLsmC+ZczobxNHf0k4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhiia-0002ZJ-7W
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:59:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhiia-0007Hx-6r
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:59:16 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] tools: fix Rules.mk library make variables
Message-Id: <E1jhiia-0007Hx-6r@xenbits.xenproject.org>
Date: Sat, 06 Jun 2020 23:59: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 669d48afc4ec2215ea82e7174bf77aa8503ea20b
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri May 29 11:29:53 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Fri May 29 16:51:29 2020 +0100

    tools: fix Rules.mk library make variables
    
    Both SHDEPS_libxendevicemodel and SHDEPS_libxenhypfs have a bug by
    adding $(SHLIB_xencall) instead of $(SHLIB_libxencall).
    
    The former seems not to have any negative impact, probably because
    it is not used anywhere in Xen without the correct $(SHLIB_libxencall)
    being used, too.
    
    Fixes: 86234eafb95295 ("libs: add libxenhypfs")
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Juergen Gross <jgross@suse.com>
---
 tools/Rules.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/Rules.mk b/tools/Rules.mk
index ac2b0115ec..5ed5664bf7 100644
--- a/tools/Rules.mk
+++ b/tools/Rules.mk
@@ -128,12 +128,12 @@ LDLIBS_libxenforeignmemory = $(SHDEPS_libxenforeignmemory) $(XEN_LIBXENFOREIGNME
 SHLIB_libxenforeignmemory  = $(SHDEPS_libxenforeignmemory) -Wl,-rpath-link=$(XEN_LIBXENFOREIGNMEMORY)
 
 CFLAGS_libxendevicemodel = -I$(XEN_LIBXENDEVICEMODEL)/include $(CFLAGS_xeninclude)
-SHDEPS_libxendevicemodel = $(SHLIB_libxentoollog) $(SHLIB_libxentoolcore) $(SHLIB_xencall)
+SHDEPS_libxendevicemodel = $(SHLIB_libxentoollog) $(SHLIB_libxentoolcore) $(SHLIB_libxencall)
 LDLIBS_libxendevicemodel = $(SHDEPS_libxendevicemodel) $(XEN_LIBXENDEVICEMODEL)/libxendevicemodel$(libextension)
 SHLIB_libxendevicemodel  = $(SHDEPS_libxendevicemodel) -Wl,-rpath-link=$(XEN_LIBXENDEVICEMODEL)
 
 CFLAGS_libxenhypfs = -I$(XEN_LIBXENHYPFS)/include $(CFLAGS_xeninclude)
-SHDEPS_libxenhypfs = $(SHLIB_libxentoollog) $(SHLIB_libxentoolcore) $(SHLIB_xencall)
+SHDEPS_libxenhypfs = $(SHLIB_libxentoollog) $(SHLIB_libxentoolcore) $(SHLIB_libxencall)
 LDLIBS_libxenhypfs = $(SHDEPS_libxenhypfs) $(XEN_LIBXENHYPFS)/libxenhypfs$(libextension)
 SHLIB_libxenhypfs  = $(SHDEPS_libxenhypfs) -Wl,-rpath-link=$(XEN_LIBXENHYPFS)
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jun 06 23:59:27 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Jun 2020 23:59: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 1jhiil-0006C4-FC; Sat, 06 Jun 2020 23:59: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=x7q/=7T=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhiik-0006Bv-Ru
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:59:26 +0000
X-Inumbo-ID: c081477c-a851-11ea-ba62-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id c081477c-a851-11ea-ba62-bc764e2007e4;
 Sat, 06 Jun 2020 23:59: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=rIYtSaPFwc8bdvSOBmdrUysAdTgugDCg5ddQwmVjid8=; b=eBgGlj/wdl/fSY/JMa/pESoJyM
 QxZJQ1/IvlHLTA84HQWrxiFlDpxkKM4PYEb/rSQ0/qRBXMM6RvJj8UXmwLmz/vqaQYqICHV7bZnNE
 i7sfmidtMf5E3GA8RU+U4P2Pokc/k16QR6PNQUZrp80j4DBtMzfIN2DL8A+c+ZZKbbS4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhiik-0002ZT-AW
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:59:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhiik-0007IV-9r
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:59:26 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] clang: don't define nocall
Message-Id: <E1jhiik-0007IV-9r@xenbits.xenproject.org>
Date: Sat, 06 Jun 2020 23:59: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 9164e93203979755bfa8bf81a1e8e9f8125d4414
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Fri May 29 17:52:06 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri May 29 17:52:06 2020 +0200

    clang: don't define nocall
    
    Clang doesn't support attribute error, and the possible equivalents
    like diagnose_if don't seem to work well in this case as they trigger
    when when the function is not called (just by being used by the
    APPEND_CALL macro).
    
    Define nocall to a noop on clang until a proper solution can be found.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    [jb: error -> __error__]
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/xen/compiler.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/xen/include/xen/compiler.h b/xen/include/xen/compiler.h
index c22439b7a4..c0e0ee9f27 100644
--- a/xen/include/xen/compiler.h
+++ b/xen/include/xen/compiler.h
@@ -20,7 +20,11 @@
 
 #define __weak        __attribute__((__weak__))
 
-#define nocall        __attribute__((error("Nonstandard ABI")))
+#if !defined(__clang__)
+# define nocall       __attribute__((__error__("Nonstandard ABI")))
+#else
+# define nocall
+#endif
 
 #if (!defined(__clang__) && (__GNUC__ == 4) && (__GNUC_MINOR__ < 5))
 #define unreachable() do {} while (1)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jun 06 23:59:37 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Jun 2020 23:59: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 1jhiiv-0006D7-Gf; Sat, 06 Jun 2020 23:59: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=x7q/=7T=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhiiv-0006D1-6C
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:59:37 +0000
X-Inumbo-ID: c685193c-a851-11ea-96fb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id c685193c-a851-11ea-96fb-bc764e2007e4;
 Sat, 06 Jun 2020 23:59: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=zaJB4UY0ROOMGB8CTRZcqyWyz2ixcAHH884smWq/O5I=; b=0kM694Arhz7LYV81h+X3fsGyGD
 qYBGNvjP6tiV2P9ni/LmKCbFDoZGjYYldbIAokGXlcOinMmD13yrbGDNjAmpwXtycsvo3qp6a6poH
 mnSCm+g7hpKM0vRk16LO+v+q9m1kxF2hfeccR7WmqXaAIptyYup+/McaJsJS/h+lbeCw=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhiiu-0002a9-DV
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:59:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhiiu-0007J2-Cr
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:59:36 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] docs: update xenstore-migration.md
Message-Id: <E1jhiiu-0007J2-Cr@xenbits.xenproject.org>
Date: Sat, 06 Jun 2020 23:59: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 51f9df5c19f2b8a780aa2547cdf3d20736bfddcc
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri May 29 12:37:09 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Fri May 29 17:00:50 2020 +0100

    docs: update xenstore-migration.md
    
    Update connection record details:
    
    - make flags common for sockets and domains (makes it easier to have a
      C union for conn-spec)
    - add pending incoming data (needed for handling partially read
      requests when doing live update)
    - add partial response length (needed for proper split to individual
      responses after live update)
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
---
 docs/designs/xenstore-migration.md | 72 ++++++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 31 deletions(-)

diff --git a/docs/designs/xenstore-migration.md b/docs/designs/xenstore-migration.md
index 34a2afd17e..2ce2c836f5 100644
--- a/docs/designs/xenstore-migration.md
+++ b/docs/designs/xenstore-migration.md
@@ -147,43 +147,60 @@ the domain being migrated.
 ```
     0       1       2       3       4       5       6       7    octet
 +-------+-------+-------+-------+-------+-------+-------+-------+
-| conn-id                       | conn-type     | conn-spec
+| conn-id                       | conn-type     | flags         |
++-------------------------------+---------------+---------------+
+| conn-spec
 ...
-+-------------------------------+-------------------------------+
-| data-len                      | data
-+-------------------------------+
++---------------+---------------+-------------------------------+
+| in-data-len   | out-resp-len  | out-data-len                  |
++---------------+---------------+-------------------------------+
+| data
 ...
 ```
 
 
-| Field       | Description                                     |
-|-------------|-------------------------------------------------|
-| `conn-id`   | A non-zero number used to identify this         |
-|             | connection in subsequent connection-specific    |
-|             | records                                         |
-|             |                                                 |
-| `conn-type` | 0x0000: shared ring                             |
-|             | 0x0001: socket                                  |
-|             | 0x0002 - 0xFFFF: reserved for future use        |
-|             |                                                 |
-| `conn-spec` | See below                                       |
-|             |                                                 |
-| `data-len`  | The length (in octets) of any pending data not  |
-|             | yet written to the connection                   |
-|             |                                                 |
-| `data`      | Pending data (may be empty)                     |
+| Field          | Description                                  |
+|----------------|----------------------------------------------|
+| `conn-id`      | A non-zero number used to identify this      |
+|                | connection in subsequent connection-specific |
+|                | records                                      |
+|                |                                              |
+| `conn-type`    | 0x0000: shared ring                          |
+|                | 0x0001: socket                               |
+|                | 0x0002 - 0xFFFF: reserved for future use     |
+|                |                                              |
+| `flags`        | A bit-wise OR of:                            |
+|                | 0001: read-only                              |
+|                |                                              |
+| `conn-spec`    | See below                                    |
+|                |                                              |
+| `in-data-len`  | The length (in octets) of any data read      |
+|                | from the connection not yet processed        |
+|                |                                              |
+| `out-resp-len` | The length (in octets) of a partial response |
+|                | not yet written to the connection            |
+|                |                                              |
+| `out-data-len` | The length (in octets) of any pending data   |
+|                | not yet written to the connection, including |
+|                | a partial response (see `out-resp-len`)      |
+|                |                                              |
+| `data`         | Pending data: first in-data-len octets of    |
+|                | read data, then out-data-len octets of       |
+|                | written data (any of both may be empty)      |
 
-The format of `conn-spec` is dependent upon `conn-type`.
+In case of live update the connection record for the connection via which
+the live update command was issued will contain the response for the live
+update command in the pending not yet written data.
 
 \pagebreak
 
+The format of `conn-spec` is dependent upon `conn-type`.
+
 For `shared ring` connections it is as follows:
 
 
 ```
     0       1       2       3       4       5       6       7    octet
-                                                +-------+-------+
-                                                | flags         |
 +---------------+---------------+---------------+---------------+
 | domid         | tdomid        | evtchn                        |
 +-------------------------------+-------------------------------+
@@ -198,8 +215,6 @@ For `shared ring` connections it is as follows:
 |           | it has been subject to an SET_TARGET              |
 |           | operation [2] or DOMID_INVALID [3] otherwise      |
 |           |                                                   |
-| `flags`   | Must be zero                                      |
-|           |                                                   |
 | `evtchn`  | The port number of the interdomain channel used   |
 |           | by `domid` to communicate with xenstored          |
 |           |                                                   |
@@ -211,8 +226,6 @@ For `socket` connections it is as follows:
 
 
 ```
-                                                +-------+-------+
-                                                | flags         |
 +---------------+---------------+---------------+---------------+
 | socket-fd                     | pad                           |
 +-------------------------------+-------------------------------+
@@ -221,9 +234,6 @@ For `socket` connections it is as follows:
 
 | Field       | Description                                     |
 |-------------|-------------------------------------------------|
-| `flags`     | A bit-wise OR of:                               |
-|             | 0001: read-only                                 |
-|             |                                                 |
 | `socket-fd` | The file descriptor of the connected socket     |
 
 This type of connection is only relevant for live update, where the xenstored
@@ -398,4 +408,4 @@ explanation of node permissions.
 
 [3] See https://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=xen/include/public/xen.h;hb=HEAD#l612
 
-[4] https://wiki.xen.org/wiki/XenBus
\ No newline at end of file
+[4] https://wiki.xen.org/wiki/XenBus
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jun 06 23:59:47 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Jun 2020 23:59: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 1jhij5-0006Eo-I9; Sat, 06 Jun 2020 23:59: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=x7q/=7T=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhij5-0006Ei-5Q
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:59:47 +0000
X-Inumbo-ID: cc8dd1b6-a851-11ea-b15a-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id cc8dd1b6-a851-11ea-b15a-12813bfff9fa;
 Sat, 06 Jun 2020 23:59: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=a+9NIBQXRQNHVESCwbv2kTLsYz2q6kigvEVk8od60+c=; b=NP9ITV6hnfI2LTPZzVEiEJ+/14
 cxM6xaXFt4d2skPZ7oQrdqkZdOu73LdOg35vioeRhweWF9AMxZ9vVf+Iaa3fAFXX+uwut7nO9Af+f
 yFQ0z2Qdulaa6I4CKIKIttsAwluwmh983mF4AHFQUjSULvQ3mAGDXi8SC6cT00sI5jMg=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhij4-0002aI-GX
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:59:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhij4-0007Jf-Fp
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:59:46 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] tools/libxl: fix setting altp2m param broken by
 1e9bc407cf0
Message-Id: <E1jhij4-0007Jf-Fp@xenbits.xenproject.org>
Date: Sat, 06 Jun 2020 23:59: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 7582bbc14cbae56a732d83b916b60bf7c4d6d690
Author:     Tamas K Lengyel <tamas@tklengyel.com>
AuthorDate: Fri May 29 17:22:34 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Fri May 29 17:31:12 2020 +0100

    tools/libxl: fix setting altp2m param broken by 1e9bc407cf0
    
    The patch 1e9bc407cf0 mistakenly converted the altp2m config option to a
    boolean. This is incorrect and breaks external-only usecases of altp2m that
    is set with a value of 2.
    
    Signed-off-by: Tamas K Lengyel <tamas@tklengyel.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 tools/libxl/libxl_x86.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libxl/libxl_x86.c b/tools/libxl/libxl_x86.c
index f8bc828e62..e57f63282e 100644
--- a/tools/libxl/libxl_x86.c
+++ b/tools/libxl/libxl_x86.c
@@ -391,7 +391,7 @@ static int hvm_set_conf_params(libxl__gc *gc, uint32_t domid,
     libxl_ctx *ctx = libxl__gc_owner(gc);
     xc_interface *xch = ctx->xch;
     int ret = ERROR_FAIL;
-    bool altp2m = info->altp2m;
+    unsigned int altp2m = info->altp2m;
 
     switch(info->type) {
     case LIBXL_DOMAIN_TYPE_HVM:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jun 06 23:59:58 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Jun 2020 23:59: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 1jhijG-0006G0-Jg; Sat, 06 Jun 2020 23:59: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=x7q/=7T=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhijF-0006Fr-Bp
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:59:57 +0000
X-Inumbo-ID: d28fe3b0-a851-11ea-b15a-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id d28fe3b0-a851-11ea-b15a-12813bfff9fa;
 Sat, 06 Jun 2020 23:59: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=yfxvWk6LX14MKk+2F0Zy0VNaMoSWoWHOxc1yBK48EMM=; b=K5KxEzebZl+qTDUMS2zRHKXsmG
 s6Cs6Jv07/rSeWjKnpAsWCuUa9zJPkt2UxqO8ZBa0U1ivwPtueDuftnT0jF/StvouO/U/b4H4rah0
 SWsd4wkKFu4UelMMdtBkhwEIxBvmZBUEAMK+IBs9IqsrJUBvtROBMbZ8L7BR7BKMmHMU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhijE-0002aT-Ji
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:59:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhijE-0007KH-J7
 for xen-changelog@lists.xenproject.org; Sat, 06 Jun 2020 23:59:56 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] tools/migration: Drop IHDR_VERSION constant from libxc
 and python
Message-Id: <E1jhijE-0007KH-J7@xenbits.xenproject.org>
Date: Sat, 06 Jun 2020 23:59: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 7bac300b42a407cb9f4c07431997267c5264cbc1
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Dec 16 18:53:02 2019 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri May 29 17:33:03 2020 +0100

    tools/migration: Drop IHDR_VERSION constant from libxc and python
    
    Migration v3 is in the process of being introduced, meaning that the code has
    to cope with both versions.  Use an explicit 2 for now.
    
    For the verify-stream-v2 and convert-legacy-stream scripts, update text to say
    "v2 (or later)".  What matters is the distinction vs legacy streams.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 tools/libxc/xc_sr_restore.c                | 6 +++---
 tools/libxc/xc_sr_save.c                   | 2 +-
 tools/libxc/xc_sr_stream_format.h          | 1 -
 tools/python/scripts/convert-legacy-stream | 6 +++---
 tools/python/scripts/verify-stream-v2      | 2 +-
 tools/python/xen/migration/libxc.py        | 9 ++++-----
 6 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/tools/libxc/xc_sr_restore.c b/tools/libxc/xc_sr_restore.c
index 5e31908ca8..dc2ffcf855 100644
--- a/tools/libxc/xc_sr_restore.c
+++ b/tools/libxc/xc_sr_restore.c
@@ -35,10 +35,10 @@ static int read_headers(struct xc_sr_context *ctx)
         return -1;
     }
 
-    if ( ihdr.version != IHDR_VERSION )
+    if ( ihdr.version != 2 )
     {
-        ERROR("Invalid Version: Expected %d, Got %d",
-              IHDR_VERSION, ihdr.version);
+        ERROR("Invalid Version: Expected 2, Got %d",
+              ihdr.version);
         return -1;
     }
 
diff --git a/tools/libxc/xc_sr_save.c b/tools/libxc/xc_sr_save.c
index 6ba6623ff3..02e140b300 100644
--- a/tools/libxc/xc_sr_save.c
+++ b/tools/libxc/xc_sr_save.c
@@ -13,7 +13,7 @@ static int write_headers(struct xc_sr_context *ctx, uint16_t guest_type)
     struct xc_sr_ihdr ihdr = {
         .marker  = IHDR_MARKER,
         .id      = htonl(IHDR_ID),
-        .version = htonl(IHDR_VERSION),
+        .version = htonl(2),
         .options = htons(IHDR_OPT_LITTLE_ENDIAN),
     };
     struct xc_sr_dhdr dhdr = {
diff --git a/tools/libxc/xc_sr_stream_format.h b/tools/libxc/xc_sr_stream_format.h
index 37a7da6eab..ae7c0de393 100644
--- a/tools/libxc/xc_sr_stream_format.h
+++ b/tools/libxc/xc_sr_stream_format.h
@@ -23,7 +23,6 @@ struct xc_sr_ihdr
 
 #define IHDR_MARKER  0xffffffffffffffffULL
 #define IHDR_ID      0x58454E46U
-#define IHDR_VERSION 2
 
 #define _IHDR_OPT_ENDIAN 0
 #define IHDR_OPT_LITTLE_ENDIAN (0 << _IHDR_OPT_ENDIAN)
diff --git a/tools/python/scripts/convert-legacy-stream b/tools/python/scripts/convert-legacy-stream
index 2922fb3185..02a194178f 100755
--- a/tools/python/scripts/convert-legacy-stream
+++ b/tools/python/scripts/convert-legacy-stream
@@ -79,7 +79,7 @@ def write_libxc_ihdr():
     stream_write(pack(libxc.IHDR_FORMAT,
                       libxc.IHDR_MARKER,  # Marker
                       libxc.IHDR_IDENT,   # Ident
-                      libxc.IHDR_VERSION, # Version
+                      2,                  # Version
                       libxc.IHDR_OPT_LE,  # Options
                       0, 0))              # Reserved
 
@@ -632,13 +632,13 @@ def main():
                           usage = ("%prog [options] -i INPUT -o OUTPUT"
                                    " -w WIDTH -g GUEST"),
                           description =
-                          "Convert a legacy stream to a v2 stream")
+                          "Convert a legacy stream to a v2 (or later) stream")
 
     # Required options
     parser.add_option("-i", "--in", dest = "fin", metavar = "<FD or FILE>",
                       help = "Legacy input to convert")
     parser.add_option("-o", "--out", dest = "fout", metavar = "<FD or FILE>",
-                      help = "v2 format output")
+                      help = "v2 (or later) format output")
     parser.add_option("-w", "--width", dest = "twidth",
                       metavar = "<32/64>", choices = ["32", "64"],
                       help = "Legacy toolstack bitness")
diff --git a/tools/python/scripts/verify-stream-v2 b/tools/python/scripts/verify-stream-v2
index 8bac04d566..fe82b86c11 100755
--- a/tools/python/scripts/verify-stream-v2
+++ b/tools/python/scripts/verify-stream-v2
@@ -108,7 +108,7 @@ def main():
 
     parser = OptionParser(usage = "%prog [options]",
                           description =
-                          "Verify a stream according to the v2 spec")
+                          "Verify a stream according to the v2 (or later) spec")
 
     # Optional options
     parser.add_option("-i", "--in", dest = "fin", metavar = "<FD or FILE>",
diff --git a/tools/python/xen/migration/libxc.py b/tools/python/xen/migration/libxc.py
index 8a800df980..63b3558029 100644
--- a/tools/python/xen/migration/libxc.py
+++ b/tools/python/xen/migration/libxc.py
@@ -19,7 +19,6 @@ IHDR_FORMAT = "!QIIHHI"
 
 IHDR_MARKER  = 0xffffffffffffffff
 IHDR_IDENT   = 0x58454E46 # "XENF" in ASCII
-IHDR_VERSION = 2
 
 IHDR_OPT_BIT_ENDIAN = 0
 IHDR_OPT_LE = (0 << IHDR_OPT_BIT_ENDIAN)
@@ -113,7 +112,7 @@ HVM_PARAMS_ENTRY_FORMAT   = "QQ"
 HVM_PARAMS_FORMAT         = "II"
 
 class VerifyLibxc(VerifyBase):
-    """ Verify a Libxc v2 stream """
+    """ Verify a Libxc v2 (or later) stream """
 
     def __init__(self, info, read):
         VerifyBase.__init__(self, info, read)
@@ -144,9 +143,9 @@ class VerifyLibxc(VerifyBase):
             raise StreamError("Bad image id: Expected 0x%x, got 0x%x" %
                               (IHDR_IDENT, ident))
 
-        if version != IHDR_VERSION:
-            raise StreamError("Unknown image version: Expected %d, got %d" %
-                              (IHDR_VERSION, version))
+        if version != 2:
+            raise StreamError("Unknown image version: Expected 2, got %d" %
+                              (version, ))
 
         if options & IHDR_OPT_RESZ_MASK:
             raise StreamError("Reserved bits set in image options field: 0x%x" %
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:00:10 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:00: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 1jhijS-0007Ml-7x; Sun, 07 Jun 2020 00:00:10 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhijQ-0007ML-5w
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:00:08 +0000
X-Inumbo-ID: d89558d0-a851-11ea-b15b-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id d89558d0-a851-11ea-b15b-12813bfff9fa;
 Sun, 07 Jun 2020 00: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=AC6N5wXKRkz+UMkEStQIH4pgurYzH1u3pZOdzZoAH74=; b=HyD77eBe08E/VKdcEICAjcuIPR
 2CK8gAQ+tPb5BhE5XkJdQGevysk7fxJZO1mPQEhKLQ6k8iHSh3CuGMQgLldCMTPJpK1ZgsUhY9Me6
 3gpN4CI5rj4GtvymOLO7qZmEBq7DKSOQznE6Zq1TqjkIDEPVfmWpr6qLQVOqo3c6aKAk=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhijO-00036P-N9
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:00:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhijO-0007Xd-ML
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:00:06 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] docs/migration Specify migration v3 and STATIC_DATA_END
Message-Id: <E1jhijO-0007Xd-ML@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:00: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 6f71b5b150615ad97405605596af658697b05a00
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Dec 5 15:57:13 2019 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri May 29 17:33:03 2020 +0100

    docs/migration Specify migration v3 and STATIC_DATA_END
    
    Migration data can be split into two parts - that which is invariant of
    guest execution, and that which is not.  Separate these two with the
    STATIC_DATA_END record.
    
    The short term, we want to move the x86 CPU Policy data into the stream.
    In the longer term, we want to provisionally send the static data only
    to the destination as a more robust compatibility check.  In both cases,
    we will want a callback into the higher level toolstack.
    
    Mandate the presence of the STATIC_DATA_END record, and declare this v3,
    along with instructions for how to compatibly interpret a v2 stream.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 docs/specs/libxc-migration-stream.pandoc | 39 +++++++++++++++++++++++++++++---
 tools/libxc/xc_sr_common.c               |  1 +
 tools/libxc/xc_sr_stream_format.h        |  1 +
 tools/python/xen/migration/libxc.py      |  2 ++
 4 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/docs/specs/libxc-migration-stream.pandoc b/docs/specs/libxc-migration-stream.pandoc
index 89705c9207..346d243175 100644
--- a/docs/specs/libxc-migration-stream.pandoc
+++ b/docs/specs/libxc-migration-stream.pandoc
@@ -127,7 +127,7 @@ marker      0xFFFFFFFFFFFFFFFF.
 
 id          0x58454E46 ("XENF" in ASCII).
 
-version     0x00000002.  The version of this specification.
+version     0x00000003.  The version of this specification.
 
 options     bit 0: Endianness.  0 = little-endian, 1 = big-endian.
 
@@ -620,6 +620,21 @@ The count of pfns is: record->length/sizeof(uint64_t).
 
 \clearpage
 
+STATIC_DATA_END
+---------------
+
+A static data end record marks the end of the static state.  I.e. state which
+is invariant of guest execution.
+
+
+     0     1     2     3     4     5     6     7 octet
+    +-------------------------------------------------+
+
+The end record contains no fields; its body_length is 0.
+
+\clearpage
+
+
 Layout
 ======
 
@@ -639,7 +654,9 @@ A typical save record for an x86 PV guest image would look like:
 
 * Image header
 * Domain header
-* X86_PV_INFO record
+* Static data records:
+    * X86_PV_INFO record
+    * STATIC_DATA_END
 * X86_PV_P2M_FRAMES record
 * Many PAGE_DATA records
 * X86_TSC_INFO
@@ -667,6 +684,8 @@ A typical save record for an x86 HVM guest image would look like:
 
 * Image header
 * Domain header
+* Static data records:
+    * STATIC_DATA_END
 * Many PAGE_DATA records
 * X86_TSC_INFO
 * HVM_PARAMS
@@ -675,9 +694,23 @@ A typical save record for an x86 HVM guest image would look like:
 HVM_PARAMS must precede HVM_CONTEXT, as certain parameters can affect
 the validity of architectural state in the context.
 
+Compatibility with older versions
+=================================
+
+v3 compat with v2
+-----------------
+
+A v3 stream is compatible with a v2 stream, but mandates the presense of a
+STATIC_DATA_END record ahead of any memory/register content.  This is to ease
+the introduction of new static configuration records over time.
+
+A v3-compatible reciever interpreting a v2 stream should infer the position of
+STATIC_DATA_END based on finding the first X86_PV_P2M_FRAMES record (for PV
+guests), or PAGE_DATA record (for HVM guests) and behave as if STATIC_DATA_END
+had been sent.
 
 Legacy Images (x86 only)
-========================
+------------------------
 
 Restoring legacy images from older tools shall be handled by
 translating the legacy format image into this new format.
diff --git a/tools/libxc/xc_sr_common.c b/tools/libxc/xc_sr_common.c
index dd9a11b4b5..7f22cf0365 100644
--- a/tools/libxc/xc_sr_common.c
+++ b/tools/libxc/xc_sr_common.c
@@ -36,6 +36,7 @@ static const char *const mandatory_rec_types[] =
     [REC_TYPE_VERIFY]                       = "Verify",
     [REC_TYPE_CHECKPOINT]                   = "Checkpoint",
     [REC_TYPE_CHECKPOINT_DIRTY_PFN_LIST]    = "Checkpoint dirty pfn list",
+    [REC_TYPE_STATIC_DATA_END]              = "Static data end",
 };
 
 const char *rec_type_to_str(uint32_t type)
diff --git a/tools/libxc/xc_sr_stream_format.h b/tools/libxc/xc_sr_stream_format.h
index ae7c0de393..81c9765b0a 100644
--- a/tools/libxc/xc_sr_stream_format.h
+++ b/tools/libxc/xc_sr_stream_format.h
@@ -73,6 +73,7 @@ struct xc_sr_rhdr
 #define REC_TYPE_VERIFY                     0x0000000dU
 #define REC_TYPE_CHECKPOINT                 0x0000000eU
 #define REC_TYPE_CHECKPOINT_DIRTY_PFN_LIST  0x0000000fU
+#define REC_TYPE_STATIC_DATA_END            0x00000010U
 
 #define REC_TYPE_OPTIONAL             0x80000000U
 
diff --git a/tools/python/xen/migration/libxc.py b/tools/python/xen/migration/libxc.py
index 63b3558029..d0c4f3527d 100644
--- a/tools/python/xen/migration/libxc.py
+++ b/tools/python/xen/migration/libxc.py
@@ -56,6 +56,7 @@ REC_TYPE_x86_pv_vcpu_msrs           = 0x0000000c
 REC_TYPE_verify                     = 0x0000000d
 REC_TYPE_checkpoint                 = 0x0000000e
 REC_TYPE_checkpoint_dirty_pfn_list  = 0x0000000f
+REC_TYPE_static_data_end            = 0x00000010
 
 rec_type_to_str = {
     REC_TYPE_end                        : "End",
@@ -74,6 +75,7 @@ rec_type_to_str = {
     REC_TYPE_verify                     : "Verify",
     REC_TYPE_checkpoint                 : "Checkpoint",
     REC_TYPE_checkpoint_dirty_pfn_list  : "Checkpoint dirty pfn list",
+    REC_TYPE_static_data_end            : "Static data end",
 }
 
 # page_data
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:00:20 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:00:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jhija-0007YG-9h; Sun, 07 Jun 2020 00:00:18 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhijZ-0007Y8-GZ
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:00:17 +0000
X-Inumbo-ID: de9e2a22-a851-11ea-b15b-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id de9e2a22-a851-11ea-b15b-12813bfff9fa;
 Sun, 07 Jun 2020 00:00: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=qwRnZB7W1mo3K0LtbNI/9zAIZWpDvtNf+SeqSU8kHHc=; b=Khab6BRcj/5abneqKy90G9cd8V
 eElJplvW3JdhbfOD+Q87GeBegZuKUMoxBAfLoeDEOZzkDbULVnJEMOksJxjEM6aUizJoM12U9FrmD
 FYFjotY0sxyIsY+/ioVWcxpeJSdd+qQdJ4NDBNg+B5KWtrlRzPXtdM0dNgK2HzzKjOyk=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhijY-0003FU-QM
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:00:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhijY-0007ee-Pe
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:00:16 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] python/migration: Update validation logic to understand
 a v3 stream
Message-Id: <E1jhijY-0007ee-Pe@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:00: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 9a0749da8fdd62db1724fb855443dfcc8b6cbe6e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Dec 16 19:39:43 2019 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri May 29 17:33:03 2020 +0100

    python/migration: Update validation logic to understand a v3 stream
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 tools/python/xen/migration/libxc.py | 26 ++++++++++++++++++++++----
 1 file changed, 22 insertions(+), 4 deletions(-)

diff --git a/tools/python/xen/migration/libxc.py b/tools/python/xen/migration/libxc.py
index d0c4f3527d..5fb51b56ac 100644
--- a/tools/python/xen/migration/libxc.py
+++ b/tools/python/xen/migration/libxc.py
@@ -119,6 +119,7 @@ class VerifyLibxc(VerifyBase):
     def __init__(self, info, read):
         VerifyBase.__init__(self, info, read)
 
+        self.version = 0
         self.squashed_pagedata_records = 0
 
 
@@ -145,9 +146,12 @@ class VerifyLibxc(VerifyBase):
             raise StreamError("Bad image id: Expected 0x%x, got 0x%x" %
                               (IHDR_IDENT, ident))
 
-        if version != 2:
-            raise StreamError("Unknown image version: Expected 2, got %d" %
-                              (version, ))
+        if not (2 <= version <= 3):
+            raise StreamError(
+                "Unknown image version: Expected 2 <= ver <= 3, got %d" %
+                (version, ))
+
+        self.version = version
 
         if options & IHDR_OPT_RESZ_MASK:
             raise StreamError("Reserved bits set in image options field: 0x%x" %
@@ -164,7 +168,8 @@ class VerifyLibxc(VerifyBase):
                 "Stream is not native endianess - unable to validate")
 
         endian = ["little", "big"][options & IHDR_OPT_LE]
-        self.info("Libxc Image Header: %s endian" % (endian, ))
+        self.info("Libxc Image Header: Version %d, %s endian" %
+                  (version, endian))
 
 
     def verify_dhdr(self):
@@ -424,6 +429,16 @@ class VerifyLibxc(VerifyBase):
         raise RecordError("Found checkpoint dirty pfn list record in stream")
 
 
+    def verify_record_static_data_end(self, content):
+        """ static data end record """
+
+        if len(content) != 0:
+            raise RecordError("End record with non-zero length")
+
+        if self.version < 3:
+            raise RecordError("Static data end record found in v2 stream")
+
+
 record_verifiers = {
     REC_TYPE_end:
         VerifyLibxc.verify_record_end,
@@ -465,4 +480,7 @@ record_verifiers = {
         VerifyLibxc.verify_record_checkpoint,
     REC_TYPE_checkpoint_dirty_pfn_list:
         VerifyLibxc.verify_record_checkpoint_dirty_pfn_list,
+
+    REC_TYPE_static_data_end:
+        VerifyLibxc.verify_record_static_data_end,
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:00:28 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00: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 1jhijk-0007ZO-BO; Sun, 07 Jun 2020 00: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=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhijj-0007ZF-Ni
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:00:27 +0000
X-Inumbo-ID: e49f9e42-a851-11ea-9ad7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id e49f9e42-a851-11ea-9ad7-bc764e2007e4;
 Sun, 07 Jun 2020 00:00:27 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=3IJpLKsbnsmtEJdqnaVkIGMbrkDUBePSBG0P2QrBKmI=; b=lGD7nrS/dZjTev6mYClkieMMnP
 AW+uulb6HJLuHVyPr9hRWR9OTRDkwtBzFjz9OMAkUG56Y38t5icwKPKIW57YPrNPWhJuEY8+Vfzm1
 oIGFDUEoy2h9Q6v4/hjPs670Waovc5phZre9Py47bPwpytmUqbixIGurxNGpgzdnxsAs=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhiji-0003Fg-Tl
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:00:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhiji-0007fT-Sh
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:00:26 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] libxc/restore: Support v3 streams and handle
 STATIC_DATA_END
Message-Id: <E1jhiji-0007fT-Sh@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00: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 6501e46ca797d445253ee48974220d939ae9ec4f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Dec 16 19:03:14 2019 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri May 29 17:33:03 2020 +0100

    libxc/restore: Support v3 streams and handle STATIC_DATA_END
    
    Higher level toolstacks may wish to know when the static data is complete, so
    introduce a restore_callback for the purpose.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 tools/libxc/include/xenguest.h |  3 +++
 tools/libxc/xc_sr_common.h     |  3 +++
 tools/libxc/xc_sr_restore.c    | 29 +++++++++++++++++++++++++++--
 3 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/tools/libxc/include/xenguest.h b/tools/libxc/include/xenguest.h
index 19d828a7f2..efd90b0d42 100644
--- a/tools/libxc/include/xenguest.h
+++ b/tools/libxc/include/xenguest.h
@@ -139,6 +139,9 @@ int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom,
 
 /* callbacks provided by xc_domain_restore */
 struct restore_callbacks {
+    /* Called once the STATIC_DATA_END record has been received. */
+    int (*static_data_done)(void *data);
+
     /* Called after a new checkpoint to suspend the guest. */
     int (*suspend)(void *data);
 
diff --git a/tools/libxc/xc_sr_common.h b/tools/libxc/xc_sr_common.h
index 5dd51ccb15..ae0ab70f76 100644
--- a/tools/libxc/xc_sr_common.h
+++ b/tools/libxc/xc_sr_common.h
@@ -253,6 +253,9 @@ struct xc_sr_context
             /* Currently buffering records between a checkpoint */
             bool buffer_all_records;
 
+            /* Whether a STATIC_DATA_END record has been seen. */
+            bool seen_static_data_end;
+
 /*
  * With Remus/COLO, we buffer the records sent by the primary at checkpoint,
  * in case the primary will fail, we can recover from the last
diff --git a/tools/libxc/xc_sr_restore.c b/tools/libxc/xc_sr_restore.c
index dc2ffcf855..9c924387ae 100644
--- a/tools/libxc/xc_sr_restore.c
+++ b/tools/libxc/xc_sr_restore.c
@@ -35,9 +35,9 @@ static int read_headers(struct xc_sr_context *ctx)
         return -1;
     }
 
-    if ( ihdr.version != 2 )
+    if ( ihdr.version < 2 || ihdr.version > 3 )
     {
-        ERROR("Invalid Version: Expected 2, Got %d",
+        ERROR("Invalid Version: Expected 2 <= ver <= 3, Got %d",
               ihdr.version);
         return -1;
     }
@@ -631,6 +631,27 @@ static int buffer_record(struct xc_sr_context *ctx, struct xc_sr_record *rec)
     return 0;
 }
 
+static int handle_static_data_end(struct xc_sr_context *ctx)
+{
+    xc_interface *xch = ctx->xch;
+    int rc = 0;
+
+    if ( ctx->restore.seen_static_data_end )
+    {
+        ERROR("Multiple STATIC_DATA_END records found");
+        return -1;
+    }
+
+    ctx->restore.seen_static_data_end = true;
+
+    if ( ctx->restore.callbacks->static_data_done &&
+         (rc = ctx->restore.callbacks->static_data_done(
+             ctx->restore.callbacks->data) != 0) )
+        ERROR("static_data_done() callback failed: %d\n", rc);
+
+    return rc;
+}
+
 static int process_record(struct xc_sr_context *ctx, struct xc_sr_record *rec)
 {
     xc_interface *xch = ctx->xch;
@@ -654,6 +675,10 @@ static int process_record(struct xc_sr_context *ctx, struct xc_sr_record *rec)
         rc = handle_checkpoint(ctx);
         break;
 
+    case REC_TYPE_STATIC_DATA_END:
+        rc = handle_static_data_end(ctx);
+        break;
+
     default:
         rc = ctx->restore.ops.process_record(ctx, rec);
         break;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:00:38 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00: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 1jhiju-0007jf-DJ; Sun, 07 Jun 2020 00:00: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=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhijt-0007jX-OY
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:00:37 +0000
X-Inumbo-ID: eaa70cc6-a851-11ea-b15b-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id eaa70cc6-a851-11ea-b15b-12813bfff9fa;
 Sun, 07 Jun 2020 00:00:37 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=kiIuQj7QsWzdcfRa+52qKNr9svCR60ZUc52DT59oZ5I=; b=D8HvwvLm9j48peunk3C3MEhCoZ
 GIlb9r6J+QywTSxp6/WHTECMwUvk9+VpPrHkpXEs3q4g+Eo11s3MUUzcW6Cd1YL2tT5d1BklJ3rbv
 YgUcRLsuGOaMsFM8it1CFcC+TE0tok9Ric049Sr7bC6XZ8Q2BZ6CjfusUJs84sMsu4tU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhijt-0003GV-0V
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:00:37 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhijs-0007iQ-WA
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:00:36 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] libxc/restore: STATIC_DATA_END inference for v2
 compatibility
Message-Id: <E1jhijs-0007iQ-WA@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00: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 4f8b684117f7e6cc02dfbb21cde15aa431259d2c
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Dec 16 19:03:14 2019 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri May 29 17:33:03 2020 +0100

    libxc/restore: STATIC_DATA_END inference for v2 compatibility
    
    A v3 stream can compatibly read a v2 stream by inferring the position of the
    STATIC_DATA_END record.
    
    v2 compatibility is only needed for x86.  No other architectures exist yet,
    but they will have a minimum of v3 when introduced.
    
    The x86 HVM compatibility point being in handle_page_data() (which is common
    code) is a bit awkward.  However, as the two compatibility points are subtly
    different, and it is (intentionally) not possible to call into arch specific
    code from common code (except via the ops hooks), use some #ifdef-ary and
    opencode the check, rather than make handle_page_data() a per-arch helper.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 tools/libxc/include/xenguest.h     |  2 +-
 tools/libxc/xc_sr_common.h         |  5 ++++-
 tools/libxc/xc_sr_restore.c        | 27 ++++++++++++++++++++++++++-
 tools/libxc/xc_sr_restore_x86_pv.c | 17 +++++++++++++++++
 4 files changed, 48 insertions(+), 3 deletions(-)

diff --git a/tools/libxc/include/xenguest.h b/tools/libxc/include/xenguest.h
index efd90b0d42..b4df8d0ffe 100644
--- a/tools/libxc/include/xenguest.h
+++ b/tools/libxc/include/xenguest.h
@@ -139,7 +139,7 @@ int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom,
 
 /* callbacks provided by xc_domain_restore */
 struct restore_callbacks {
-    /* Called once the STATIC_DATA_END record has been received. */
+    /* Called once the STATIC_DATA_END record has been received/inferred. */
     int (*static_data_done)(void *data);
 
     /* Called after a new checkpoint to suspend the guest. */
diff --git a/tools/libxc/xc_sr_common.h b/tools/libxc/xc_sr_common.h
index ae0ab70f76..51e3d3ee3b 100644
--- a/tools/libxc/xc_sr_common.h
+++ b/tools/libxc/xc_sr_common.h
@@ -253,7 +253,7 @@ struct xc_sr_context
             /* Currently buffering records between a checkpoint */
             bool buffer_all_records;
 
-            /* Whether a STATIC_DATA_END record has been seen. */
+            /* Whether a STATIC_DATA_END record has been seen/inferred. */
             bool seen_static_data_end;
 
 /*
@@ -428,6 +428,9 @@ int read_record(struct xc_sr_context *ctx, int fd, struct xc_sr_record *rec);
 int populate_pfns(struct xc_sr_context *ctx, unsigned int count,
                   const xen_pfn_t *original_pfns, const uint32_t *types);
 
+/* Handle a STATIC_DATA_END record. */
+int handle_static_data_end(struct xc_sr_context *ctx);
+
 #endif
 /*
  * Local variables:
diff --git a/tools/libxc/xc_sr_restore.c b/tools/libxc/xc_sr_restore.c
index 9c924387ae..bb94cd879d 100644
--- a/tools/libxc/xc_sr_restore.c
+++ b/tools/libxc/xc_sr_restore.c
@@ -342,6 +342,31 @@ static int handle_page_data(struct xc_sr_context *ctx, struct xc_sr_record *rec)
     xen_pfn_t *pfns = NULL, pfn;
     uint32_t *types = NULL, type;
 
+    /*
+     * v2 compatibility only exists for x86 streams.  This is a bit of a
+     * bodge, but it is less bad than duplicating handle_page_data() between
+     * different architectures.
+     */
+#if defined(__i386__) || defined(__x86_64__)
+    /* v2 compat.  Infer the position of STATIC_DATA_END. */
+    if ( ctx->restore.format_version < 3 && !ctx->restore.seen_static_data_end )
+    {
+        rc = handle_static_data_end(ctx);
+        if ( rc )
+        {
+            ERROR("Inferred STATIC_DATA_END record failed");
+            goto err;
+        }
+        rc = -1;
+    }
+
+    if ( !ctx->restore.seen_static_data_end )
+    {
+        ERROR("No STATIC_DATA_END seen");
+        goto err;
+    }
+#endif
+
     if ( rec->length < sizeof(*pages) )
     {
         ERROR("PAGE_DATA record truncated: length %u, min %zu",
@@ -631,7 +656,7 @@ static int buffer_record(struct xc_sr_context *ctx, struct xc_sr_record *rec)
     return 0;
 }
 
-static int handle_static_data_end(struct xc_sr_context *ctx)
+int handle_static_data_end(struct xc_sr_context *ctx)
 {
     xc_interface *xch = ctx->xch;
     int rc = 0;
diff --git a/tools/libxc/xc_sr_restore_x86_pv.c b/tools/libxc/xc_sr_restore_x86_pv.c
index 904ccc462a..0adfcdcdda 100644
--- a/tools/libxc/xc_sr_restore_x86_pv.c
+++ b/tools/libxc/xc_sr_restore_x86_pv.c
@@ -679,6 +679,23 @@ static int handle_x86_pv_p2m_frames(struct xc_sr_context *ctx,
     unsigned int start, end, x, fpp = PAGE_SIZE / ctx->x86.pv.width;
     int rc;
 
+    /* v2 compat.  Infer the position of STATIC_DATA_END. */
+    if ( ctx->restore.format_version < 3 && !ctx->restore.seen_static_data_end )
+    {
+        rc = handle_static_data_end(ctx);
+        if ( rc )
+        {
+            ERROR("Inferred STATIC_DATA_END record failed");
+            return rc;
+        }
+    }
+
+    if ( !ctx->restore.seen_static_data_end )
+    {
+        ERROR("No STATIC_DATA_END seen");
+        return -1;
+    }
+
     if ( !ctx->x86.pv.restore.seen_pv_info )
     {
         ERROR("Not yet received X86_PV_INFO record");
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:00:48 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:00: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 1jhik4-0007lB-F6; Sun, 07 Jun 2020 00:00: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=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhik3-0007l2-Ti
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:00:47 +0000
X-Inumbo-ID: f0aa7d7e-a851-11ea-b15b-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id f0aa7d7e-a851-11ea-b15b-12813bfff9fa;
 Sun, 07 Jun 2020 00:00: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=xn2nqOzyx2+B3rArRxT20tczpDDagZcW4mbo70Fyx+8=; b=AXjq4Upbx8m+mr7yXEx3U6UZz+
 6uOY/nRTYuUEKHCW4d4BuhIAzCZPmId58ZCWKSOYzT1j8BxUJT6hWmuzmlhlxjMni/KBVb5+2Du77
 dXBA11oT2eHmYaJxOf4oiocXG9KSa6AJfB4SXSPvnILrn670vvL0DpG7+ZvlQ4BvhGIU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhik3-0003Ge-3n
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:00:47 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhik3-000819-31
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:00:47 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] libxc/save: Write a v3 stream
Message-Id: <E1jhik3-000819-31@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:00: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 a6a2b9d1eae3e18ee8d9be5da448655ac918a827
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Dec 17 12:29:42 2019 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri May 29 17:33:03 2020 +0100

    libxc/save: Write a v3 stream
    
    Introduce a new static_data() hook which is responsible for writing out
    any static data records.  The HVM side continues to be a no-op, while
    the PV side moves write_x86_pv_info() into this earlier hook.  The the
    common code writes out a STATIC_DATA_END record, and the stream version
    is bumped to 3.
    
    Update convert-legacy-stream to write a v3 stream, because this will
    bypass the compatibly logic in libxc.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 tools/libxc/xc_sr_common.h                 | 10 ++++++++--
 tools/libxc/xc_sr_save.c                   | 20 +++++++++++++++++++-
 tools/libxc/xc_sr_save_x86_hvm.c           |  6 ++++++
 tools/libxc/xc_sr_save_x86_pv.c            | 10 ++++++----
 tools/python/scripts/convert-legacy-stream |  9 ++++++++-
 5 files changed, 47 insertions(+), 8 deletions(-)

diff --git a/tools/libxc/xc_sr_common.h b/tools/libxc/xc_sr_common.h
index 51e3d3ee3b..fd7fb67305 100644
--- a/tools/libxc/xc_sr_common.h
+++ b/tools/libxc/xc_sr_common.h
@@ -63,8 +63,14 @@ struct xc_sr_save_ops
     int (*setup)(struct xc_sr_context *ctx);
 
     /**
-     * Send records which need to be at the start of the stream.  This is
-     * called once, after the Image and Domain headers are written.
+     * Send static records at the head of the stream.  This is called once,
+     * after the Image and Domain headers are written.
+     */
+    int (*static_data)(struct xc_sr_context *ctx);
+
+    /**
+     * Send dynamic records which need to be at the start of the stream.  This
+     * is called after the STATIC_DATA_END record is written.
      */
     int (*start_of_stream)(struct xc_sr_context *ctx);
 
diff --git a/tools/libxc/xc_sr_save.c b/tools/libxc/xc_sr_save.c
index 02e140b300..80b1d5de1f 100644
--- a/tools/libxc/xc_sr_save.c
+++ b/tools/libxc/xc_sr_save.c
@@ -13,7 +13,7 @@ static int write_headers(struct xc_sr_context *ctx, uint16_t guest_type)
     struct xc_sr_ihdr ihdr = {
         .marker  = IHDR_MARKER,
         .id      = htonl(IHDR_ID),
-        .version = htonl(2),
+        .version = htonl(3),
         .options = htons(IHDR_OPT_LITTLE_ENDIAN),
     };
     struct xc_sr_dhdr dhdr = {
@@ -54,6 +54,16 @@ static int write_end_record(struct xc_sr_context *ctx)
     return write_record(ctx, &end);
 }
 
+/*
+ * Writes a STATIC_DATA_END record into the stream.
+ */
+static int write_static_data_end_record(struct xc_sr_context *ctx)
+{
+    struct xc_sr_record end = { .type = REC_TYPE_STATIC_DATA_END };
+
+    return write_record(ctx, &end);
+}
+
 /*
  * Writes a CHECKPOINT record into the stream.
  */
@@ -856,6 +866,14 @@ static int save(struct xc_sr_context *ctx, uint16_t guest_type)
     if ( rc )
         goto err;
 
+    rc = ctx->save.ops.static_data(ctx);
+    if ( rc )
+        goto err;
+
+    rc = write_static_data_end_record(ctx);
+    if ( rc )
+        goto err;
+
     rc = ctx->save.ops.start_of_stream(ctx);
     if ( rc )
         goto err;
diff --git a/tools/libxc/xc_sr_save_x86_hvm.c b/tools/libxc/xc_sr_save_x86_hvm.c
index 7d3f3ddb8f..bab9bd2877 100644
--- a/tools/libxc/xc_sr_save_x86_hvm.c
+++ b/tools/libxc/xc_sr_save_x86_hvm.c
@@ -169,6 +169,11 @@ static int x86_hvm_setup(struct xc_sr_context *ctx)
     return 0;
 }
 
+static int x86_hvm_static_data(struct xc_sr_context *ctx)
+{
+    return 0;
+}
+
 static int x86_hvm_start_of_stream(struct xc_sr_context *ctx)
 {
     return 0;
@@ -227,6 +232,7 @@ struct xc_sr_save_ops save_ops_x86_hvm =
     .pfn_to_gfn          = x86_hvm_pfn_to_gfn,
     .normalise_page      = x86_hvm_normalise_page,
     .setup               = x86_hvm_setup,
+    .static_data         = x86_hvm_static_data,
     .start_of_stream     = x86_hvm_start_of_stream,
     .start_of_checkpoint = x86_hvm_start_of_checkpoint,
     .end_of_checkpoint   = x86_hvm_end_of_checkpoint,
diff --git a/tools/libxc/xc_sr_save_x86_pv.c b/tools/libxc/xc_sr_save_x86_pv.c
index f3ccf5bb4b..46019d962d 100644
--- a/tools/libxc/xc_sr_save_x86_pv.c
+++ b/tools/libxc/xc_sr_save_x86_pv.c
@@ -1052,14 +1052,15 @@ static int x86_pv_setup(struct xc_sr_context *ctx)
     return 0;
 }
 
+static int x86_pv_static_data(struct xc_sr_context *ctx)
+{
+    return write_x86_pv_info(ctx);
+}
+
 static int x86_pv_start_of_stream(struct xc_sr_context *ctx)
 {
     int rc;
 
-    rc = write_x86_pv_info(ctx);
-    if ( rc )
-        return rc;
-
     /*
      * Ideally should be able to change during migration.  Currently
      * corruption will occur if the contents or location of the P2M changes
@@ -1126,6 +1127,7 @@ struct xc_sr_save_ops save_ops_x86_pv =
     .pfn_to_gfn          = x86_pv_pfn_to_gfn,
     .normalise_page      = x86_pv_normalise_page,
     .setup               = x86_pv_setup,
+    .static_data         = x86_pv_static_data,
     .start_of_stream     = x86_pv_start_of_stream,
     .start_of_checkpoint = x86_pv_start_of_checkpoint,
     .end_of_checkpoint   = x86_pv_end_of_checkpoint,
diff --git a/tools/python/scripts/convert-legacy-stream b/tools/python/scripts/convert-legacy-stream
index 02a194178f..ca93a93848 100755
--- a/tools/python/scripts/convert-legacy-stream
+++ b/tools/python/scripts/convert-legacy-stream
@@ -79,7 +79,7 @@ def write_libxc_ihdr():
     stream_write(pack(libxc.IHDR_FORMAT,
                       libxc.IHDR_MARKER,  # Marker
                       libxc.IHDR_IDENT,   # Ident
-                      2,                  # Version
+                      3,                  # Version
                       libxc.IHDR_OPT_LE,  # Options
                       0, 0))              # Reserved
 
@@ -166,6 +166,9 @@ def write_libxc_hvm_params(params):
                  pack(libxc.HVM_PARAMS_FORMAT, len(params) / 2, 0),
                  pack("Q" * len(params), *params))
 
+def write_libxc_static_data_end():
+    write_record(libxc.REC_TYPE_static_data_end)
+
 def write_libxl_end():
     write_record(libxl.REC_TYPE_end)
 
@@ -590,6 +593,10 @@ def read_legacy_stream(vm):
 
         if pv:
             read_pv_extended_info(vm)
+
+        write_libxc_static_data_end()
+
+        if pv:
             read_pv_p2m_frames(vm)
 
         read_chunks(vm)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:00:58 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:00: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 1jhikE-0007mM-IJ; Sun, 07 Jun 2020 00:00: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=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhikD-0007mC-PS
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:00:57 +0000
X-Inumbo-ID: f6ae5d30-a851-11ea-9b55-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id f6ae5d30-a851-11ea-9b55-bc764e2007e4;
 Sun, 07 Jun 2020 00:00: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=JnvyCVCmT2v6nNLJkxX94YofPdXwgrNOksHV+zU/NfI=; b=S8xvZkOQnw2Obf00VQrGw4QPrk
 Y9Az6Mn9/q5nOdUnC8wlrEtCjprRaFOUkcwwt0FvGsIJTJoaU8L7PGkpzXRK0eR8c+FJIP/939ZGn
 yZ0OgSpm0ea8BCL8D50F9vtVZMzMYID2OfRbOwj6SOxuJEgWT+5XsS5JXFaducnNWv3U=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhikD-0003Gs-6t
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:00:57 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhikD-00081u-6D
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:00:57 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] tools/libxl: Provide a static_data_done callback for
 domain restore
Message-Id: <E1jhikD-00081u-6D@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:00: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 c1a552ec7fcd95a2c5af0da105c58a2773944cd7
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Dec 20 11:58:03 2019 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri May 29 17:33:03 2020 +0100

    tools/libxl: Provide a static_data_done callback for domain restore
    
    This will be needed shortly to provide backwards compatiblity for migration
    streams which do not have CPUID information contained within them.
    
    No functional change yet.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 tools/libxl/libxl_create.c         | 12 ++++++++++++
 tools/libxl/libxl_save_msgs_gen.pl |  1 +
 2 files changed, 13 insertions(+)

diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index 8614a2c241..baed817a96 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -1358,6 +1358,7 @@ static void domcreate_bootloader_done(libxl__egc *egc,
     dcs->srs.dcs = dcs;
 
     /* Restore */
+    callbacks->static_data_done = libxl__srm_callout_callback_static_data_done;
     callbacks->restore_results = libxl__srm_callout_callback_restore_results;
 
     /* COLO only supports HVM now because it does not work very
@@ -1427,6 +1428,17 @@ static void libxl__colo_restore_setup_done(libxl__egc *egc,
     libxl__stream_read_start(egc, &dcs->srs);
 }
 
+int libxl__srm_callout_callback_static_data_done(void *user)
+{
+    libxl__save_helper_state *shs = user;
+    libxl__domain_create_state *dcs = shs->caller_state;
+    STATE_AO_GC(dcs->ao);
+
+    /* Nothing to do (yet). */
+
+    return 0;
+}
+
 void libxl__srm_callout_callback_restore_results(xen_pfn_t store_mfn,
           xen_pfn_t console_mfn, void *user)
 {
diff --git a/tools/libxl/libxl_save_msgs_gen.pl b/tools/libxl/libxl_save_msgs_gen.pl
index 831a15e0bb..93dc252370 100755
--- a/tools/libxl/libxl_save_msgs_gen.pl
+++ b/tools/libxl/libxl_save_msgs_gen.pl
@@ -29,6 +29,7 @@ our @msgs = (
     [ 'srcxA',  "wait_checkpoint", [] ],
     [ 'scxA',   "switch_qemu_logdirty",  [qw(uint32_t domid
                                           unsigned enable)] ],
+    [ 'rcxW',   "static_data_done",      [] ],
     [ 'rcx',    "restore_results",       ['xen_pfn_t', 'store_gfn',
                                           'xen_pfn_t', 'console_gfn'] ],
     [ 'srW',    "complete",              [qw(int retval
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:01:08 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:01: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 1jhikO-0007nI-K0; Sun, 07 Jun 2020 00:01: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=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhikN-0007nB-Uo
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:01:07 +0000
X-Inumbo-ID: fcb72b1c-a851-11ea-ba62-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id fcb72b1c-a851-11ea-ba62-bc764e2007e4;
 Sun, 07 Jun 2020 00:01: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=GNKXuxV6jPJIzZf9097viTZK4l5K0BcHnKZgvn1XTFg=; b=mFjzPOZidq7W2zq9XSN4vocaFs
 0ycs4Oo0rZYyvNnCUzlRr/aJzvuDLl7WFWEr6/87ilR9qySsrwHSfXT3B3KMBeR1Fig9C+zkEh6tI
 RCB3M07VOcCLpPd8iqPzT5UUzjYLcBlCkziakJoRxc0k5u966nDmaJTh62CKMzqBTYuQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhikN-0003HE-AI
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:01:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhikN-00083i-9R
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:01:07 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] tools/libxl: Re-position CPUID handling during domain
 construction
Message-Id: <E1jhikN-00083i-9R@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:01: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 454239acc59cd067867f56e42f2ca910ec98cc56
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Jan 2 19:44:36 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri May 29 17:33:03 2020 +0100

    tools/libxl: Re-position CPUID handling during domain construction
    
    CPUID handling needs to be earlier in construction.  Move it from its current
    position in libxl__build_post() to libxl__build_pre() for fresh builds, and
    libxl__srm_callout_callback_static_data_done() for the migration/resume case.
    
    Later changes will make the migration/resume case conditional on whether CPUID
    data was present in the migration stream, and the libxc layer took care of
    restoring it.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 tools/libxl/libxl_create.c | 6 +++++-
 tools/libxl/libxl_dom.c    | 8 ++++++--
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index baed817a96..cc7340c48d 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -1433,8 +1433,12 @@ int libxl__srm_callout_callback_static_data_done(void *user)
     libxl__save_helper_state *shs = user;
     libxl__domain_create_state *dcs = shs->caller_state;
     STATE_AO_GC(dcs->ao);
+    libxl_ctx *ctx = libxl__gc_owner(gc);
+
+    libxl_domain_config *d_config = dcs->guest_config;
+    libxl_domain_build_info *info = &d_config->b_info;
 
-    /* Nothing to do (yet). */
+    libxl__cpuid_legacy(ctx, dcs->guest_domid, info);
 
     return 0;
 }
diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c
index 71cb578923..dd1aff89a3 100644
--- a/tools/libxl/libxl_dom.c
+++ b/tools/libxl/libxl_dom.c
@@ -387,6 +387,12 @@ int libxl__build_pre(libxl__gc *gc, uint32_t domid,
 
     rc = libxl__arch_domain_create(gc, d_config, domid);
 
+    /* Construct a CPUID policy, but only for brand new domains.  Domains
+     * being migrated-in/restored have CPUID handled during the
+     * static_data_done() callback. */
+    if (!state->restore)
+        libxl__cpuid_legacy(ctx, domid, info);
+
     return rc;
 }
 
@@ -454,8 +460,6 @@ int libxl__build_post(libxl__gc *gc, uint32_t domid,
     if (rc)
         return rc;
 
-    libxl__cpuid_legacy(ctx, domid, info);
-
     if (info->type == LIBXL_DOMAIN_TYPE_HVM
         && !libxl_ms_vm_genid_is_zero(&info->u.hvm.ms_vm_genid)) {
         rc = libxl__ms_vm_genid_set(gc, domid,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:01:18 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:01: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 1jhikY-0007oQ-Lk; Sun, 07 Jun 2020 00:01: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=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhikY-0007oJ-8V
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:01:18 +0000
X-Inumbo-ID: 02ba26b8-a852-11ea-9b55-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 02ba26b8-a852-11ea-9b55-bc764e2007e4;
 Sun, 07 Jun 2020 00:01: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=3DzfN3CY1ADKf1CQtdxZF7ljz3UPQARxfDwhuNETuyY=; b=LRNgjMUmkG1NuBiIE4LluKDRqR
 3MFcymAedVzo3hCyC/E+8KefE1Jm+MHYVmCZcql/sbjFkBfql/CUw0JU0Vh3RzTpYkG7e1MUmdMpq
 XRbpMcB/qPB1ZXtLFtyKc7E1Sc3ijtneC9QAqiMwgd3Wtksu/WgPOGHmwslfmZtCRlMI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhikX-0003HN-DP
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:01:17 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhikX-0008Ij-Cg
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:01:17 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] docs/migration: Specify X86_{CPUID,MSR}_POLICY records
Message-Id: <E1jhikX-0008Ij-Cg@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:01: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 ddd273d88632a0b20f80c20742d6759ed6b83c8b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Dec 17 13:10:04 2019 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri May 29 17:33:03 2020 +0100

    docs/migration: Specify X86_{CPUID,MSR}_POLICY records
    
    These two records move blobs from the XEN_DOMCTL_{get,set}_cpu_policy
    hypercall.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 docs/specs/libxc-migration-stream.pandoc | 42 +++++++++++++++++++++++++++++++
 tools/libxc/xc_sr_common.c               |  2 ++
 tools/libxc/xc_sr_stream_format.h        |  2 ++
 tools/python/xen/migration/libxc.py      | 43 ++++++++++++++++++++++++++++++++
 4 files changed, 89 insertions(+)

diff --git a/docs/specs/libxc-migration-stream.pandoc b/docs/specs/libxc-migration-stream.pandoc
index 346d243175..6b0c49e97a 100644
--- a/docs/specs/libxc-migration-stream.pandoc
+++ b/docs/specs/libxc-migration-stream.pandoc
@@ -634,6 +634,46 @@ The end record contains no fields; its body_length is 0.
 
 \clearpage
 
+X86_CPUID_POLICY
+----------------
+
+CPUID policy content, as accessed by the XEN_DOMCTL_{get,set}_cpu_policy
+hypercall sub-ops.
+
+     0     1     2     3     4     5     6     7 octet
+    +-------------------------------------------------+
+    | CPUID_policy                                    |
+    ...
+    +-------------------------------------------------+
+
+--------------------------------------------------------------------
+Field            Description
+------------     ---------------------------------------------------
+CPUID_policy     Array of xen_cpuid_leaf_t[]'s
+--------------------------------------------------------------------
+
+\clearpage
+
+X86_MSR_POLICY
+--------------
+
+MSR policy content, as accessed by the XEN_DOMCTL_{get,set}_cpu_policy
+hypercall sub-ops.
+
+     0     1     2     3     4     5     6     7 octet
+    +-------------------------------------------------+
+    | MSR_policy                                      |
+    ...
+    +-------------------------------------------------+
+
+--------------------------------------------------------------------
+Field            Description
+----------       ---------------------------------------------------
+MSR_policy       Array of xen_msr_entry_t[]'s
+--------------------------------------------------------------------
+
+\clearpage
+
 
 Layout
 ======
@@ -656,6 +696,7 @@ A typical save record for an x86 PV guest image would look like:
 * Domain header
 * Static data records:
     * X86_PV_INFO record
+    * X86_{CPUID,MSR}_POLICY
     * STATIC_DATA_END
 * X86_PV_P2M_FRAMES record
 * Many PAGE_DATA records
@@ -685,6 +726,7 @@ A typical save record for an x86 HVM guest image would look like:
 * Image header
 * Domain header
 * Static data records:
+    * X86_{CPUID,MSR}_POLICY
     * STATIC_DATA_END
 * Many PAGE_DATA records
 * X86_TSC_INFO
diff --git a/tools/libxc/xc_sr_common.c b/tools/libxc/xc_sr_common.c
index 7f22cf0365..7c54b03414 100644
--- a/tools/libxc/xc_sr_common.c
+++ b/tools/libxc/xc_sr_common.c
@@ -37,6 +37,8 @@ static const char *const mandatory_rec_types[] =
     [REC_TYPE_CHECKPOINT]                   = "Checkpoint",
     [REC_TYPE_CHECKPOINT_DIRTY_PFN_LIST]    = "Checkpoint dirty pfn list",
     [REC_TYPE_STATIC_DATA_END]              = "Static data end",
+    [REC_TYPE_X86_CPUID_POLICY]             = "x86 CPUID policy",
+    [REC_TYPE_X86_MSR_POLICY]               = "x86 MSR policy",
 };
 
 const char *rec_type_to_str(uint32_t type)
diff --git a/tools/libxc/xc_sr_stream_format.h b/tools/libxc/xc_sr_stream_format.h
index 81c9765b0a..8a0da26f75 100644
--- a/tools/libxc/xc_sr_stream_format.h
+++ b/tools/libxc/xc_sr_stream_format.h
@@ -74,6 +74,8 @@ struct xc_sr_rhdr
 #define REC_TYPE_CHECKPOINT                 0x0000000eU
 #define REC_TYPE_CHECKPOINT_DIRTY_PFN_LIST  0x0000000fU
 #define REC_TYPE_STATIC_DATA_END            0x00000010U
+#define REC_TYPE_X86_CPUID_POLICY           0x00000011U
+#define REC_TYPE_X86_MSR_POLICY             0x00000012U
 
 #define REC_TYPE_OPTIONAL             0x80000000U
 
diff --git a/tools/python/xen/migration/libxc.py b/tools/python/xen/migration/libxc.py
index 5fb51b56ac..9881f5ced4 100644
--- a/tools/python/xen/migration/libxc.py
+++ b/tools/python/xen/migration/libxc.py
@@ -57,6 +57,8 @@ REC_TYPE_verify                     = 0x0000000d
 REC_TYPE_checkpoint                 = 0x0000000e
 REC_TYPE_checkpoint_dirty_pfn_list  = 0x0000000f
 REC_TYPE_static_data_end            = 0x00000010
+REC_TYPE_x86_cpuid_policy           = 0x00000011
+REC_TYPE_x86_msr_policy             = 0x00000012
 
 rec_type_to_str = {
     REC_TYPE_end                        : "End",
@@ -76,6 +78,8 @@ rec_type_to_str = {
     REC_TYPE_checkpoint                 : "Checkpoint",
     REC_TYPE_checkpoint_dirty_pfn_list  : "Checkpoint dirty pfn list",
     REC_TYPE_static_data_end            : "Static data end",
+    REC_TYPE_x86_cpuid_policy           : "x86 CPUID policy",
+    REC_TYPE_x86_msr_policy             : "x86 MSR policy",
 }
 
 # page_data
@@ -113,6 +117,12 @@ X86_TSC_INFO_FORMAT       = "IIQII"
 HVM_PARAMS_ENTRY_FORMAT   = "QQ"
 HVM_PARAMS_FORMAT         = "II"
 
+# x86_cpuid_policy => xen_cpuid_leaf_t[]
+X86_CPUID_POLICY_FORMAT   = "IIIIII"
+
+# x86_msr_policy => xen_msr_entry_t[]
+X86_MSR_POLICY_FORMAT     = "QII"
+
 class VerifyLibxc(VerifyBase):
     """ Verify a Libxc v2 (or later) stream """
 
@@ -439,6 +449,34 @@ class VerifyLibxc(VerifyBase):
             raise RecordError("Static data end record found in v2 stream")
 
 
+    def verify_record_x86_cpuid_policy(self, content):
+        """ x86 CPUID policy record """
+
+        if self.version < 3:
+            raise RecordError("x86 CPUID policy record found in v2 stream")
+
+        sz = calcsize(X86_CPUID_POLICY_FORMAT)
+        contentsz = len(content)
+
+        if contentsz < sz or (contentsz % sz) != 0:
+            raise RecordError("Record length %u, expected multiple of %u" %
+                              (contentsz, sz))
+
+
+    def verify_record_x86_msr_policy(self, content):
+        """ x86 MSR policy record """
+
+        if self.version < 3:
+            raise RecordError("x86 MSR policy record found in v2 stream")
+
+        sz = calcsize(X86_MSR_POLICY_FORMAT)
+        contentsz = len(content)
+
+        if contentsz < sz or (contentsz % sz) != 0:
+            raise RecordError("Record length %u, expected multiple of %u" %
+                              (contentsz, sz))
+
+
 record_verifiers = {
     REC_TYPE_end:
         VerifyLibxc.verify_record_end,
@@ -483,4 +521,9 @@ record_verifiers = {
 
     REC_TYPE_static_data_end:
         VerifyLibxc.verify_record_static_data_end,
+
+    REC_TYPE_x86_cpuid_policy:
+        VerifyLibxc.verify_record_x86_cpuid_policy,
+    REC_TYPE_x86_msr_policy:
+        VerifyLibxc.verify_record_x86_msr_policy,
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:01:29 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:01: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 1jhikj-0007pN-NS; Sun, 07 Jun 2020 00:01: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=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhiki-0007pE-Dt
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:01:28 +0000
X-Inumbo-ID: 08c12282-a852-11ea-b15b-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 08c12282-a852-11ea-b15b-12813bfff9fa;
 Sun, 07 Jun 2020 00:01: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=U/8wj/mtAz9/Gl3uiG2E/yXXYhgK8VamaX9sTlwgF4w=; b=Z+BJFwBDlCQGJMAyr06WDUH3k/
 ix01lqtOd4RHZ+6tXnCut+k5gRc8ZVq5voflBS0rhZc1j63dYHuytAu33o6PKpHb/tLBhx7/K6cHH
 OwtskwLW4XQPxw85Vd1WKr+5jBqcKjY4GuUvvj2WppsxMWExynMsA8PUIEis0y01H3rU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhikh-0003HY-Gg
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:01:27 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhikh-0008Ud-Fh
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:01:27 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] libxc/restore: Handle X86_{CPUID,MSR}_DATA records
Message-Id: <E1jhikh-0008Ud-Fh@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:01: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 8baf4363e19c6f6e48b286b4643899564f98e620
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Dec 18 18:51:01 2019 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri May 29 17:33:03 2020 +0100

    libxc/restore: Handle X86_{CPUID,MSR}_DATA records
    
    For now, the data are just stashed, and discarded at the end.
    
    A future change will restore the data, once libxl has been adjusted to avoid
    clobbering the data.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 tools/libxc/xc_sr_common.h          | 10 ++++++++++
 tools/libxc/xc_sr_common_x86.c      | 40 +++++++++++++++++++++++++++++++++++++
 tools/libxc/xc_sr_common_x86.h      | 14 +++++++++++++
 tools/libxc/xc_sr_restore_x86_hvm.c |  9 +++++++++
 tools/libxc/xc_sr_restore_x86_pv.c  |  9 +++++++++
 5 files changed, 82 insertions(+)

diff --git a/tools/libxc/xc_sr_common.h b/tools/libxc/xc_sr_common.h
index fd7fb67305..7742260690 100644
--- a/tools/libxc/xc_sr_common.h
+++ b/tools/libxc/xc_sr_common.h
@@ -296,6 +296,16 @@ struct xc_sr_context
     {
         struct /* x86 */
         {
+            /* Common save/restore data. */
+            union
+            {
+                struct
+                {
+                    /* X86_{CPUID,MSR}_DATA blobs for CPU Policy. */
+                    struct xc_sr_blob cpuid, msr;
+                } restore;
+            };
+
             struct /* x86 PV guest. */
             {
                 /* 4 or 8; 32 or 64 bit domain */
diff --git a/tools/libxc/xc_sr_common_x86.c b/tools/libxc/xc_sr_common_x86.c
index 011684df97..8980299e9a 100644
--- a/tools/libxc/xc_sr_common_x86.c
+++ b/tools/libxc/xc_sr_common_x86.c
@@ -42,6 +42,46 @@ int handle_x86_tsc_info(struct xc_sr_context *ctx, struct xc_sr_record *rec)
     return 0;
 }
 
+int handle_x86_cpuid_policy(struct xc_sr_context *ctx, struct xc_sr_record *rec)
+{
+    xc_interface *xch = ctx->xch;
+    int rc;
+
+    if ( rec->length == 0 ||
+         rec->length % sizeof(xen_cpuid_leaf_t) != 0 )
+    {
+        ERROR("X86_CPUID_POLICY size %u should be multiple of %zu",
+              rec->length, sizeof(xen_cpuid_leaf_t));
+        return -1;
+    }
+
+    rc = update_blob(&ctx->x86.restore.cpuid, rec->data, rec->length);
+    if ( rc )
+        ERROR("Unable to allocate %u bytes for X86_CPUID_POLICY", rec->length);
+
+    return rc;
+}
+
+int handle_x86_msr_policy(struct xc_sr_context *ctx, struct xc_sr_record *rec)
+{
+    xc_interface *xch = ctx->xch;
+    int rc;
+
+    if ( rec->length == 0 ||
+         rec->length % sizeof(xen_msr_entry_t) != 0 )
+    {
+        ERROR("X86_MSR_POLICY size %u should be multiple of %zu",
+              rec->length, sizeof(xen_cpuid_leaf_t));
+        return -1;
+    }
+
+    rc = update_blob(&ctx->x86.restore.msr, rec->data, rec->length);
+    if ( rc )
+        ERROR("Unable to allocate %u bytes for X86_MSR_POLICY", rec->length);
+
+    return rc;
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/tools/libxc/xc_sr_common_x86.h b/tools/libxc/xc_sr_common_x86.h
index ebc4355bd1..c458c1aa37 100644
--- a/tools/libxc/xc_sr_common_x86.h
+++ b/tools/libxc/xc_sr_common_x86.h
@@ -14,6 +14,20 @@ int write_x86_tsc_info(struct xc_sr_context *ctx);
  */
 int handle_x86_tsc_info(struct xc_sr_context *ctx, struct xc_sr_record *rec);
 
+/*
+ * Parses an X86_CPUID_POLICY record and stashes the content for application
+ * when a STATIC_DATA_END record is encountered.
+ */
+int handle_x86_cpuid_policy(struct xc_sr_context *ctx,
+                            struct xc_sr_record *rec);
+
+/*
+ * Parses an X86_MSR_POLICY record and stashes the content for application
+ * when a STATIC_DATA_END record is encountered.
+ */
+int handle_x86_msr_policy(struct xc_sr_context *ctx,
+                          struct xc_sr_record *rec);
+
 #endif
 /*
  * Local variables:
diff --git a/tools/libxc/xc_sr_restore_x86_hvm.c b/tools/libxc/xc_sr_restore_x86_hvm.c
index adbdf1ae5f..1704d524b4 100644
--- a/tools/libxc/xc_sr_restore_x86_hvm.c
+++ b/tools/libxc/xc_sr_restore_x86_hvm.c
@@ -181,6 +181,12 @@ static int x86_hvm_process_record(struct xc_sr_context *ctx,
     case REC_TYPE_HVM_PARAMS:
         return handle_hvm_params(ctx, rec);
 
+    case REC_TYPE_X86_CPUID_POLICY:
+        return handle_x86_cpuid_policy(ctx, rec);
+
+    case REC_TYPE_X86_MSR_POLICY:
+        return handle_x86_msr_policy(ctx, rec);
+
     default:
         return RECORD_NOT_PROCESSED;
     }
@@ -237,6 +243,9 @@ static int x86_hvm_cleanup(struct xc_sr_context *ctx)
 {
     free(ctx->x86.hvm.restore.context.ptr);
 
+    free(ctx->x86.restore.cpuid.ptr);
+    free(ctx->x86.restore.msr.ptr);
+
     return 0;
 }
 
diff --git a/tools/libxc/xc_sr_restore_x86_pv.c b/tools/libxc/xc_sr_restore_x86_pv.c
index 0adfcdcdda..a3d85d517d 100644
--- a/tools/libxc/xc_sr_restore_x86_pv.c
+++ b/tools/libxc/xc_sr_restore_x86_pv.c
@@ -1102,6 +1102,12 @@ static int x86_pv_process_record(struct xc_sr_context *ctx,
     case REC_TYPE_X86_TSC_INFO:
         return handle_x86_tsc_info(ctx, rec);
 
+    case REC_TYPE_X86_CPUID_POLICY:
+        return handle_x86_cpuid_policy(ctx, rec);
+
+    case REC_TYPE_X86_MSR_POLICY:
+        return handle_x86_msr_policy(ctx, rec);
+
     default:
         return RECORD_NOT_PROCESSED;
     }
@@ -1173,6 +1179,9 @@ static int x86_pv_cleanup(struct xc_sr_context *ctx)
     if ( ctx->x86.pv.m2p )
         munmap(ctx->x86.pv.m2p, ctx->x86.pv.nr_m2p_frames * PAGE_SIZE);
 
+    free(ctx->x86.restore.cpuid.ptr);
+    free(ctx->x86.restore.msr.ptr);
+
     return 0;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:01:39 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:01: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 1jhikt-0007qR-P3; Sun, 07 Jun 2020 00:01:39 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhiks-0007qC-EW
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:01:38 +0000
X-Inumbo-ID: 0e00051b-a852-11ea-b15b-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 0e00051b-a852-11ea-b15b-12813bfff9fa;
 Sun, 07 Jun 2020 00:01: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=XSObMMggtu3dPmAdeGvbqTDL2CsRJFS5mUs6y45rA2o=; b=LTEB2eGDpd6v8iZE0qvXC/6DPS
 UkjLeiIrrd3wccha7CrAvwEsbBRJQQakkLBoGsvtWWLJ38iUeG1WEnEcxIWmCMogMJpLq8x7aRsXh
 9OBDEjcafysCVvMFkwwnXSUxrZhWABAImt66Jtavd14UzNvzFJU0nxLZieFjv5rUoZqI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhikr-0003Jl-K8
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:01:37 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhikr-0000EX-JB
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:01:37 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] libxc/save: Write X86_{CPUID,MSR}_DATA records
Message-Id: <E1jhikr-0000EX-JB@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:01: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 f6b2b8ec53de8a6f178e53b180e47b05d6d2ea72
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Dec 17 12:41:02 2019 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri May 29 17:33:03 2020 +0100

    libxc/save: Write X86_{CPUID,MSR}_DATA records
    
    With the destination side now able to understand X86_{CPUID,MSR}_DATA
    records (and compatibly handle their absense), update the sending logic to
    obtain and forward this data from Xen.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 tools/libxc/xc_sr_common_x86.c   | 50 ++++++++++++++++++++++++++++++++++++++++
 tools/libxc/xc_sr_common_x86.h   |  6 +++++
 tools/libxc/xc_sr_save_x86_hvm.c |  2 +-
 tools/libxc/xc_sr_save_x86_pv.c  | 12 +++++++++-
 4 files changed, 68 insertions(+), 2 deletions(-)

diff --git a/tools/libxc/xc_sr_common_x86.c b/tools/libxc/xc_sr_common_x86.c
index 8980299e9a..6267655dab 100644
--- a/tools/libxc/xc_sr_common_x86.c
+++ b/tools/libxc/xc_sr_common_x86.c
@@ -42,6 +42,56 @@ int handle_x86_tsc_info(struct xc_sr_context *ctx, struct xc_sr_record *rec)
     return 0;
 }
 
+int write_x86_cpu_policy_records(struct xc_sr_context *ctx)
+{
+    xc_interface *xch = ctx->xch;
+    struct xc_sr_record cpuid = { .type = REC_TYPE_X86_CPUID_POLICY, };
+    struct xc_sr_record msrs  = { .type = REC_TYPE_X86_MSR_POLICY, };
+    uint32_t nr_leaves = 0, nr_msrs = 0;
+    int rc;
+
+    if ( xc_get_cpu_policy_size(xch, &nr_leaves, &nr_msrs) < 0 )
+    {
+        PERROR("Unable to get CPU Policy size");
+        return -1;
+    }
+
+    cpuid.data = malloc(nr_leaves * sizeof(xen_cpuid_leaf_t));
+    msrs.data  = malloc(nr_msrs   * sizeof(xen_msr_entry_t));
+    if ( !cpuid.data || !msrs.data )
+    {
+        ERROR("Cannot allocate memory for CPU Policy");
+        rc = -1;
+        goto out;
+    }
+
+    if ( xc_get_domain_cpu_policy(xch, ctx->domid, &nr_leaves, cpuid.data,
+                                  &nr_msrs, msrs.data) )
+    {
+        PERROR("Unable to get d%d CPU Policy", ctx->domid);
+        rc = -1;
+        goto out;
+    }
+
+    cpuid.length = nr_leaves * sizeof(xen_cpuid_leaf_t);
+    if ( cpuid.length )
+    {
+        rc = write_record(ctx, &cpuid);
+        if ( rc )
+            goto out;
+    }
+
+    msrs.length = nr_msrs * sizeof(xen_msr_entry_t);
+    if ( msrs.length )
+        rc = write_record(ctx, &msrs);
+
+ out:
+    free(cpuid.data);
+    free(msrs.data);
+
+    return rc;
+}
+
 int handle_x86_cpuid_policy(struct xc_sr_context *ctx, struct xc_sr_record *rec)
 {
     xc_interface *xch = ctx->xch;
diff --git a/tools/libxc/xc_sr_common_x86.h b/tools/libxc/xc_sr_common_x86.h
index c458c1aa37..d1050981dd 100644
--- a/tools/libxc/xc_sr_common_x86.h
+++ b/tools/libxc/xc_sr_common_x86.h
@@ -14,6 +14,12 @@ int write_x86_tsc_info(struct xc_sr_context *ctx);
  */
 int handle_x86_tsc_info(struct xc_sr_context *ctx, struct xc_sr_record *rec);
 
+/*
+ * Obtains a domains CPU Policy from Xen, and writes X86_{CPUID,MSR}_POLICY
+ * records into the stream.
+ */
+int write_x86_cpu_policy_records(struct xc_sr_context *ctx);
+
 /*
  * Parses an X86_CPUID_POLICY record and stashes the content for application
  * when a STATIC_DATA_END record is encountered.
diff --git a/tools/libxc/xc_sr_save_x86_hvm.c b/tools/libxc/xc_sr_save_x86_hvm.c
index bab9bd2877..0b2abb26bd 100644
--- a/tools/libxc/xc_sr_save_x86_hvm.c
+++ b/tools/libxc/xc_sr_save_x86_hvm.c
@@ -171,7 +171,7 @@ static int x86_hvm_setup(struct xc_sr_context *ctx)
 
 static int x86_hvm_static_data(struct xc_sr_context *ctx)
 {
-    return 0;
+    return write_x86_cpu_policy_records(ctx);
 }
 
 static int x86_hvm_start_of_stream(struct xc_sr_context *ctx)
diff --git a/tools/libxc/xc_sr_save_x86_pv.c b/tools/libxc/xc_sr_save_x86_pv.c
index 46019d962d..c7e246ef4f 100644
--- a/tools/libxc/xc_sr_save_x86_pv.c
+++ b/tools/libxc/xc_sr_save_x86_pv.c
@@ -1054,7 +1054,17 @@ static int x86_pv_setup(struct xc_sr_context *ctx)
 
 static int x86_pv_static_data(struct xc_sr_context *ctx)
 {
-    return write_x86_pv_info(ctx);
+    int rc;
+
+    rc = write_x86_pv_info(ctx);
+    if ( rc )
+        return rc;
+
+    rc = write_x86_cpu_policy_records(ctx);
+    if ( rc )
+        return rc;
+
+    return 0;
 }
 
 static int x86_pv_start_of_stream(struct xc_sr_context *ctx)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:01:49 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:01: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 1jhil3-0007sA-SQ; Sun, 07 Jun 2020 00:01: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=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhil2-0007rz-N6
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:01:48 +0000
X-Inumbo-ID: 14cc62f8-a852-11ea-96fb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 14cc62f8-a852-11ea-96fb-bc764e2007e4;
 Sun, 07 Jun 2020 00:01:47 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=+Lr49CddJmH3wMYK2njZfmMTns42Kh3yu7LcU6lWpKE=; b=KkwHNNI0u6a7wFlGsLnRdIjNdH
 ItgVeG81tla+9cFmdkQGpc0V7+iwCO4lE/hHn+DptBiOMF4Ah3zRNKKQX1G4LKaG1+nl9tWGcBu08
 Pu4gUdn3TkdwD4BAqCJ3FvQdso0t8RiAbym7LwhG6UnxH0/6+RL0Up+9Mv9EZpPKy34A=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhil1-0003Jz-Ng
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:01:47 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhil1-0000H3-Mn
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:01:47 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] tools/libx[cl]: Plumb 'missing' through
 static_data_done() up into libxl
Message-Id: <E1jhil1-0000H3-Mn@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:01: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 63350b3fda28a6ee9073127aa368144b0eaa3e45
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Dec 16 19:03:14 2019 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri May 29 17:33:03 2020 +0100

    tools/libx[cl]: Plumb 'missing' through static_data_done() up into libxl
    
    Pre Xen-4.14 streams will not contain any CPUID/MSR information.  There is
    nothing libxc can do about this, and will have to rely on the higher level
    toolstack to provide backwards compatibility.
    
    To facilitate this, extend the static_data_done() callback, highlighting the
    missing information, and modify libxl to use it.  At the libxc level, this
    requires an arch-specific hook which, for now, always reports CPUID and MSR as
    missing.  This will be adjusted in a later change.
    
    No overall functional change - this is just plumbing.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 tools/libxc/include/xenguest.h      | 12 ++++++++++--
 tools/libxc/xc_sr_common.h          |  9 +++++++++
 tools/libxc/xc_sr_common_x86.c      |  8 ++++++++
 tools/libxc/xc_sr_common_x86.h      |  5 +++++
 tools/libxc/xc_sr_restore.c         |  7 ++++++-
 tools/libxc/xc_sr_restore_x86_hvm.c |  1 +
 tools/libxc/xc_sr_restore_x86_pv.c  |  1 +
 tools/libxl/libxl_create.c          | 13 +++++++++++--
 tools/libxl/libxl_save_msgs_gen.pl  |  2 +-
 9 files changed, 52 insertions(+), 6 deletions(-)

diff --git a/tools/libxc/include/xenguest.h b/tools/libxc/include/xenguest.h
index b4df8d0ffe..7a12d21ff2 100644
--- a/tools/libxc/include/xenguest.h
+++ b/tools/libxc/include/xenguest.h
@@ -139,8 +139,16 @@ int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom,
 
 /* callbacks provided by xc_domain_restore */
 struct restore_callbacks {
-    /* Called once the STATIC_DATA_END record has been received/inferred. */
-    int (*static_data_done)(void *data);
+    /*
+     * Called once the STATIC_DATA_END record has been received/inferred.
+     *
+     * For compatibility with older streams, provides a list of static data
+     * expected to be found in the stream, which was missing.  A higher level
+     * toolstack is responsible for providing any necessary compatibiltiy.
+     */
+#define XGR_SDD_MISSING_CPUID (1 << 0)
+#define XGR_SDD_MISSING_MSR   (1 << 1)
+    int (*static_data_done)(unsigned int missing, void *data);
 
     /* Called after a new checkpoint to suspend the guest. */
     int (*suspend)(void *data);
diff --git a/tools/libxc/xc_sr_common.h b/tools/libxc/xc_sr_common.h
index 7742260690..f3bdea8006 100644
--- a/tools/libxc/xc_sr_common.h
+++ b/tools/libxc/xc_sr_common.h
@@ -158,6 +158,15 @@ struct xc_sr_restore_ops
 #define BROKEN_CHANNEL 2
     int (*process_record)(struct xc_sr_context *ctx, struct xc_sr_record *rec);
 
+    /**
+     * Perform any actions required after the static data has arrived.  Called
+     * when the STATIC_DATA_COMPLETE record has been recieved/inferred.
+     * 'missing' should be filled in for any data item the higher level
+     * toolstack needs to provide compatiblity for.
+     */
+    int (*static_data_complete)(struct xc_sr_context *ctx,
+                                unsigned int *missing);
+
     /**
      * Perform any actions required after the stream has been finished. Called
      * after the END record has been received.
diff --git a/tools/libxc/xc_sr_common_x86.c b/tools/libxc/xc_sr_common_x86.c
index 6267655dab..a849891634 100644
--- a/tools/libxc/xc_sr_common_x86.c
+++ b/tools/libxc/xc_sr_common_x86.c
@@ -132,6 +132,14 @@ int handle_x86_msr_policy(struct xc_sr_context *ctx, struct xc_sr_record *rec)
     return rc;
 }
 
+int x86_static_data_complete(struct xc_sr_context *ctx, unsigned int *missing)
+{
+    /* TODO: Become conditional on there being no data in the stream. */
+    *missing = XGR_SDD_MISSING_MSR | XGR_SDD_MISSING_CPUID;
+
+    return 0;
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/tools/libxc/xc_sr_common_x86.h b/tools/libxc/xc_sr_common_x86.h
index d1050981dd..e08d81e0e7 100644
--- a/tools/libxc/xc_sr_common_x86.h
+++ b/tools/libxc/xc_sr_common_x86.h
@@ -34,6 +34,11 @@ int handle_x86_cpuid_policy(struct xc_sr_context *ctx,
 int handle_x86_msr_policy(struct xc_sr_context *ctx,
                           struct xc_sr_record *rec);
 
+/*
+ * Perform common x86 actions required after the static data has arrived.
+ */
+int x86_static_data_complete(struct xc_sr_context *ctx, unsigned int *missing);
+
 #endif
 /*
  * Local variables:
diff --git a/tools/libxc/xc_sr_restore.c b/tools/libxc/xc_sr_restore.c
index bb94cd879d..bc811e6e3a 100644
--- a/tools/libxc/xc_sr_restore.c
+++ b/tools/libxc/xc_sr_restore.c
@@ -659,6 +659,7 @@ static int buffer_record(struct xc_sr_context *ctx, struct xc_sr_record *rec)
 int handle_static_data_end(struct xc_sr_context *ctx)
 {
     xc_interface *xch = ctx->xch;
+    unsigned int missing = 0;
     int rc = 0;
 
     if ( ctx->restore.seen_static_data_end )
@@ -669,9 +670,13 @@ int handle_static_data_end(struct xc_sr_context *ctx)
 
     ctx->restore.seen_static_data_end = true;
 
+    rc = ctx->restore.ops.static_data_complete(ctx, &missing);
+    if ( rc )
+        return rc;
+
     if ( ctx->restore.callbacks->static_data_done &&
          (rc = ctx->restore.callbacks->static_data_done(
-             ctx->restore.callbacks->data) != 0) )
+             missing, ctx->restore.callbacks->data) != 0) )
         ERROR("static_data_done() callback failed: %d\n", rc);
 
     return rc;
diff --git a/tools/libxc/xc_sr_restore_x86_hvm.c b/tools/libxc/xc_sr_restore_x86_hvm.c
index 1704d524b4..a77624cc9d 100644
--- a/tools/libxc/xc_sr_restore_x86_hvm.c
+++ b/tools/libxc/xc_sr_restore_x86_hvm.c
@@ -258,6 +258,7 @@ struct xc_sr_restore_ops restore_ops_x86_hvm =
     .localise_page   = x86_hvm_localise_page,
     .setup           = x86_hvm_setup,
     .process_record  = x86_hvm_process_record,
+    .static_data_complete = x86_static_data_complete,
     .stream_complete = x86_hvm_stream_complete,
     .cleanup         = x86_hvm_cleanup,
 };
diff --git a/tools/libxc/xc_sr_restore_x86_pv.c b/tools/libxc/xc_sr_restore_x86_pv.c
index a3d85d517d..d086271efb 100644
--- a/tools/libxc/xc_sr_restore_x86_pv.c
+++ b/tools/libxc/xc_sr_restore_x86_pv.c
@@ -1194,6 +1194,7 @@ struct xc_sr_restore_ops restore_ops_x86_pv =
     .localise_page   = x86_pv_localise_page,
     .setup           = x86_pv_setup,
     .process_record  = x86_pv_process_record,
+    .static_data_complete = x86_static_data_complete,
     .stream_complete = x86_pv_stream_complete,
     .cleanup         = x86_pv_cleanup,
 };
diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index cc7340c48d..75862dc6ed 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -1428,7 +1428,8 @@ static void libxl__colo_restore_setup_done(libxl__egc *egc,
     libxl__stream_read_start(egc, &dcs->srs);
 }
 
-int libxl__srm_callout_callback_static_data_done(void *user)
+int libxl__srm_callout_callback_static_data_done(unsigned int missing,
+                                                 void *user)
 {
     libxl__save_helper_state *shs = user;
     libxl__domain_create_state *dcs = shs->caller_state;
@@ -1438,7 +1439,15 @@ int libxl__srm_callout_callback_static_data_done(void *user)
     libxl_domain_config *d_config = dcs->guest_config;
     libxl_domain_build_info *info = &d_config->b_info;
 
-    libxl__cpuid_legacy(ctx, dcs->guest_domid, info);
+    /*
+     * CPUID/MSR information is not present in pre Xen-4.14 streams.
+     *
+     * Libxl used to always regenerate the CPUID policy from first principles
+     * on migrate.  Continue to do so for backwards compatibility when the
+     * stream doesn't contain any CPUID data.
+     */
+    if (missing & XGR_SDD_MISSING_CPUID)
+        libxl__cpuid_legacy(ctx, dcs->guest_domid, info);
 
     return 0;
 }
diff --git a/tools/libxl/libxl_save_msgs_gen.pl b/tools/libxl/libxl_save_msgs_gen.pl
index 93dc252370..5bfbd4fd10 100755
--- a/tools/libxl/libxl_save_msgs_gen.pl
+++ b/tools/libxl/libxl_save_msgs_gen.pl
@@ -29,7 +29,7 @@ our @msgs = (
     [ 'srcxA',  "wait_checkpoint", [] ],
     [ 'scxA',   "switch_qemu_logdirty",  [qw(uint32_t domid
                                           unsigned enable)] ],
-    [ 'rcxW',   "static_data_done",      [] ],
+    [ 'rcxW',   "static_data_done",      [qw(unsigned missing)] ],
     [ 'rcx',    "restore_results",       ['xen_pfn_t', 'store_gfn',
                                           'xen_pfn_t', 'console_gfn'] ],
     [ 'srW',    "complete",              [qw(int retval
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:01:59 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:01: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 1jhilD-0007t9-U2; Sun, 07 Jun 2020 00:01:59 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhilC-0007sx-JM
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:01:58 +0000
X-Inumbo-ID: 1ad4596c-a852-11ea-b15b-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 1ad4596c-a852-11ea-b15b-12813bfff9fa;
 Sun, 07 Jun 2020 00:01: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=3/IMyDUx2ZKtE+E0PTT1kBCo4zPeocpOmZMcqjlHczc=; b=hRelIYcNJGjv8WYdJBJJ+E0bXP
 jqXQDqmH5TZ22R5UII/1NV+TYz/r31QBzTfh+/pbQqXHWTQ5YFqIxFRkX7rGFnkjY1OjRhQ4IGJcU
 3hlBFDMFQSjkEFiYUP3cK0WQJC8jzKvnpTLqigk2UZWfuInhAPOO3zIMDZ9jPVXO8mlk=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhilB-0003K8-R8
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:01:57 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhilB-0000Ta-QD
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:01:57 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] tools/libxc: Restore CPUID/MSR data found in the
 migration stream
Message-Id: <E1jhilB-0000Ta-QD@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:01: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 1a6be420e04441bbf5f03968ab43a7908167fcb5
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Dec 20 19:38:26 2019 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri May 29 17:33:03 2020 +0100

    tools/libxc: Restore CPUID/MSR data found in the migration stream
    
    With all other pieces in place, it is now safe to restore the CPUID and MSR
    data in the migration stream, rather than discarding them and using the higher
    level toolstacks compatibility logic.
    
    While this is a small patch, it has large implications for migrated/resumed
    domains.  Most obviously, the CPU family/model/stepping data,
    cache/tlb/etc. will no longer change behind the guests back.
    
    Another change is the interpretation of the Xend cpuid strings.  The 'k'
    option is not a sensible thing to have ever supported, and 's' is how how the
    stream will end up behaving.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 tools/libxc/xc_cpuid_x86.c     |  8 ++++----
 tools/libxc/xc_sr_common_x86.c | 26 ++++++++++++++++++++++++--
 2 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c
index f045b03223..89d2ecdad2 100644
--- a/tools/libxc/xc_cpuid_x86.c
+++ b/tools/libxc/xc_cpuid_x86.c
@@ -273,10 +273,9 @@ int xc_set_domain_cpu_policy(xc_interface *xch, uint32_t domid,
  *   '0' -> force to 0
  *   'x' -> we don't care (use default)
  *   'k' -> pass through host value
- *   's' -> pass through the first time and then keep the same value
- *          across save/restore and migration.
+ *   's' -> legacy alias for 'k'
  *
- * For 's' and 'x' the configuration is overwritten with the value applied.
+ * In all cases, the returned string consists of just '0' and '1'.
  */
 int xc_cpuid_set(
     xc_interface *xch, uint32_t domid, const unsigned int *input,
@@ -402,7 +401,8 @@ int xc_cpuid_set(
                 clear_feature(31 - j, regs[i]);
 
             config_transformed[i][j] = config[i][j];
-            if ( config[i][j] == 's' )
+            /* All non 0/1 values get overwritten. */
+            if ( (config[i][j] & ~1) != '0' )
                 config_transformed[i][j] = '0' + val;
         }
     }
diff --git a/tools/libxc/xc_sr_common_x86.c b/tools/libxc/xc_sr_common_x86.c
index a849891634..77ea044a74 100644
--- a/tools/libxc/xc_sr_common_x86.c
+++ b/tools/libxc/xc_sr_common_x86.c
@@ -134,8 +134,30 @@ int handle_x86_msr_policy(struct xc_sr_context *ctx, struct xc_sr_record *rec)
 
 int x86_static_data_complete(struct xc_sr_context *ctx, unsigned int *missing)
 {
-    /* TODO: Become conditional on there being no data in the stream. */
-    *missing = XGR_SDD_MISSING_MSR | XGR_SDD_MISSING_CPUID;
+    xc_interface *xch = ctx->xch;
+    uint32_t nr_leaves = 0, nr_msrs = 0;
+    uint32_t err_l = ~0, err_s = ~0, err_m = ~0;
+
+    if ( ctx->x86.restore.cpuid.ptr )
+        nr_leaves = ctx->x86.restore.cpuid.size / sizeof(xen_cpuid_leaf_t);
+    else
+        *missing |= XGR_SDD_MISSING_CPUID;
+
+    if ( ctx->x86.restore.msr.ptr )
+        nr_msrs = ctx->x86.restore.msr.size / sizeof(xen_msr_entry_t);
+    else
+        *missing |= XGR_SDD_MISSING_MSR;
+
+    if ( (nr_leaves || nr_msrs) &&
+         xc_set_domain_cpu_policy(xch, ctx->domid,
+                                  nr_leaves, ctx->x86.restore.cpuid.ptr,
+                                  nr_msrs,   ctx->x86.restore.msr.ptr,
+                                  &err_l, &err_s, &err_m) )
+    {
+        PERROR("Failed to set CPUID policy: leaf %08x, subleaf %08x, msr %08x",
+               err_l, err_s, err_m);
+        return -1;
+    }
 
     return 0;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:02:10 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:02: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 1jhilN-0007uM-Vb; Sun, 07 Jun 2020 00:02: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=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhilN-0007uD-4T
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:02:09 +0000
X-Inumbo-ID: 20d7eacc-a852-11ea-b15b-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 20d7eacc-a852-11ea-b15b-12813bfff9fa;
 Sun, 07 Jun 2020 00:02: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=+FjI2iYb/q06JRZf0h6InztiWK0o5309vTQatpjTsdU=; b=r09lsXSIMoP5EaHZ18AAOcrkVu
 WCT4+BsMuiiNktWXzDnVBHXYguiXAfs0Mcx2yUeRRyDeTj31KilAT+svn8atxu7bOiGtBS29ZTvvP
 PH4qR2CEZWinGWuSyTiY6tXC1aQY260982+O8XyZronuRlURcJC48A1/6vo6JOZOHGVo=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhilL-0003KU-Uc
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:02:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhilL-0000Ua-Th
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:02:07 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] docs/xl.cfg: Rewrite cpuid= section
Message-Id: <E1jhilL-0000Ua-Th@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:02: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 17a68b8a66d793738fd8ca1b4227325320476a07
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Sep 1 16:08:00 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri May 29 17:33:03 2020 +0100

    docs/xl.cfg: Rewrite cpuid= section
    
    This is partly to adjust the description of 'k' and 's' seeing as they have
    changed, but mostly restructuring the information for clarity.
    
    In particular, use indentation to clearly separate the areas discussing libxl
    format from xend format.  In addition, extend the xend format section to
    discuss subleaf notation.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 docs/man/xl.cfg.5.pod.in | 74 ++++++++++++++++++++++++++++++++++--------------
 1 file changed, 53 insertions(+), 21 deletions(-)

diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in
index c9bc181a95..0532739c1f 100644
--- a/docs/man/xl.cfg.5.pod.in
+++ b/docs/man/xl.cfg.5.pod.in
@@ -1977,26 +1977,42 @@ This option is disabled by default.
 Configure the value returned when a guest executes the CPUID instruction.
 Two versions of config syntax are recognized: libxl and xend.
 
-The libxl syntax is a comma separated list of key=value pairs, preceded by the
-word "host". A few keys take a numerical value, all others take a single
-character which describes what to do with the feature bit.
-
-Possible values for a single feature bit:
+Both formats use a common notation for specifying a single feature bit.
+Possible values are:
   '1' -> force the corresponding bit to 1
   '0' -> force to 0
   'x' -> Get a safe value (pass through and mask with the default policy)
-  'k' -> pass through the host bit value
-  's' -> as 'k' but preserve across save/restore and migration (not implemented)
+  'k' -> pass through the host bit value (at boot only - value preserved on migrate)
+  's' -> legacy alias for 'k'
 
-Note: when specifying B<cpuid> for hypervisor leaves (0x4000xxxx major group)
-only the lowest 8 bits of leaf's 0x4000xx00 EAX register are processed, the
-rest are ignored (these 8 bits signify maximum number of hypervisor leaves).
+B<Libxl format>:
+
+=over 4
+
+The libxl format is a single string, starting with the word "host", and
+followed by a comma separated list of key=value pairs.  A few keys take a
+numerical value, all others take a single character which describes what to do
+with the feature bit.  e.g.:
+
+=over 4
+
+cpuid="host,tm=0,sse3=0"
+
+=back
 
 List of keys taking a value:
+
+=over 4
+
 apicidsize brandid clflush family localapicid maxleaf maxhvleaf model nc
 proccount procpkg stepping
 
+=back
+
 List of keys taking a character:
+
+=over 4
+
 3dnow 3dnowext 3dnowprefetch abm acpi adx aes altmovcr8 apic arat avx avx2
 avx512-4fmaps avx512-4vnniw avx512bw avx512cd avx512dq avx512er avx512f
 avx512ifma avx512pf avx512vbmi avx512vl bmi1 bmi2 clflushopt clfsh clwb cmov
@@ -2010,21 +2026,37 @@ ssse3 svm svm_decode svm_lbrv svm_npt svm_nrips svm_pausefilt svm_tscrate
 svm_vmcbclean syscall sysenter tbm tm tm2 topoext tsc tsc-deadline tsc_adjust
 umip vme vmx wdt x2apic xop xsave xtpr
 
+=back
+
+=back
+
+B<Xend format>:
 
-The xend syntax is a list of values in the form of
-'leafnum:register=bitstring,register=bitstring'
-  "leafnum" is the requested function,
-  "register" is the response register to modify
-  "bitstring" represents all bits in the register, its length must be 32 chars.
-  Each successive character represent a lesser-significant bit, possible values
-  are listed above in the libxl section.
+=over 4
 
-Example to hide two features from the guest: 'tm', which is bit #29 in EDX, and
-'pni' (SSE3), which is bit #0 in ECX:
+Xend format consists of an array of one or more strings of the form
+"leaf:reg=bitstring,...".  e.g. (matching the libxl example above):
 
-xend: [ "1:ecx=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0,edx=xx0xxxxxxxxxxxxxxxxxxxxxxxxxxxxx" ]
+=over 4
 
-libxl: "host,tm=0,sse3=0"
+cpuid=["1:ecx=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0,edx=xx0xxxxxxxxxxxxxxxxxxxxxxxxxxxxx", ...]
+
+=back
+
+"leaf" is an integer, either decimal or hex with a "0x" prefix.  e.g. to
+specify something in the AMD feature leaves, use "0x80000001:ecx=...".
+
+Some leaves have subleaves which can be specified as "leaf,subleaf".  e.g. for
+the Intel structured feature leaf, use "7,0:ebx=..."
+
+The bitstring represents all bits in the register, its length must be 32
+chars.  Each successive character represent a lesser-significant bit.
+
+=back
+
+Note: when specifying B<cpuid> for hypervisor leaves (0x4000xxxx major group)
+only the lowest 8 bits of leaf's 0x4000xx00 EAX register are processed, the
+rest are ignored (these 8 bits signify maximum number of hypervisor leaves).
 
 More info about the CPUID instruction can be found in the processor manuals,
 and on Wikipedia: L<https://en.wikipedia.org/wiki/CPUID>
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:02:20 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:02:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jhilY-0007vL-0w; Sun, 07 Jun 2020 00:02:20 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhilW-0007v8-M5
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:02:18 +0000
X-Inumbo-ID: 26de98e4-a852-11ea-9b55-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 26de98e4-a852-11ea-9b55-bc764e2007e4;
 Sun, 07 Jun 2020 00:02: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=6V2lUQ/5tj97TelnvBmLKW9KDDN3baqBXcbaz6J3LIU=; b=U07vraaN9h8rVOFgsewm0/uVqh
 CKqDMSd/qdHlEaTefaqQBR6fVxCxH4mq1arGOJMfav5zPZj5X68fXmoc1SolfQqiHtXO6aqSZGlJ+
 VMU2YqRRfqJ24hpaLk20bISTWcHeBh5F/U4oqMQoifh9/rYrjEIjZHW5qLFqTJO5/HKc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhilW-0003Kd-1y
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:02:18 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhilW-0000hC-12
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:02:18 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] xen: credit2: factor cpu to runqueue matching in a
 function
Message-Id: <E1jhilW-0000hC-12@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:02:18 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 1a7eb22b3cb627b3d9604b32d362c5af43dbdc69
Author:     Dario Faggioli <dfaggioli@suse.com>
AuthorDate: Thu May 28 23:29:24 2020 +0200
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Fri May 29 18:53:53 2020 +0100

    xen: credit2: factor cpu to runqueue matching in a function
    
    Just move the big if() condition in an inline function.
    
    No functional change intended.
    
    Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 xen/common/sched/credit2.c | 28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/xen/common/sched/credit2.c b/xen/common/sched/credit2.c
index 34f05c3e2a..697c9f917d 100644
--- a/xen/common/sched/credit2.c
+++ b/xen/common/sched/credit2.c
@@ -838,6 +838,20 @@ static inline bool same_core(unsigned int cpua, unsigned int cpub)
            cpu_to_core(cpua) == cpu_to_core(cpub);
 }
 
+static inline bool
+cpu_runqueue_match(const struct csched2_runqueue_data *rqd, unsigned int cpu)
+{
+    unsigned int peer_cpu = rqd->pick_bias;
+
+    BUG_ON(cpu_to_socket(peer_cpu) == XEN_INVALID_SOCKET_ID);
+
+    /* OPT_RUNQUEUE_CPU will never find an existing runqueue. */
+    return opt_runqueue == OPT_RUNQUEUE_ALL ||
+           (opt_runqueue == OPT_RUNQUEUE_CORE && same_core(peer_cpu, cpu)) ||
+           (opt_runqueue == OPT_RUNQUEUE_SOCKET && same_socket(peer_cpu, cpu)) ||
+           (opt_runqueue == OPT_RUNQUEUE_NODE && same_node(peer_cpu, cpu));
+}
+
 static struct csched2_runqueue_data *
 cpu_add_to_runqueue(struct csched2_private *prv, unsigned int cpu)
 {
@@ -855,21 +869,11 @@ cpu_add_to_runqueue(struct csched2_private *prv, unsigned int cpu)
     rqd_ins = &prv->rql;
     list_for_each_entry ( rqd, &prv->rql, rql )
     {
-        unsigned int peer_cpu;
-
         /* Remember first unused queue index. */
         if ( !rqi_unused && rqd->id > rqi )
             rqi_unused = true;
 
-        peer_cpu = rqd->pick_bias;
-        BUG_ON(cpu_to_socket(cpu) == XEN_INVALID_SOCKET_ID ||
-               cpu_to_socket(peer_cpu) == XEN_INVALID_SOCKET_ID);
-
-        /* OPT_RUNQUEUE_CPU will never find an existing runqueue. */
-        if ( opt_runqueue == OPT_RUNQUEUE_ALL ||
-             (opt_runqueue == OPT_RUNQUEUE_CORE && same_core(peer_cpu, cpu)) ||
-             (opt_runqueue == OPT_RUNQUEUE_SOCKET && same_socket(peer_cpu, cpu)) ||
-             (opt_runqueue == OPT_RUNQUEUE_NODE && same_node(peer_cpu, cpu)) )
+        if ( cpu_runqueue_match(rqd, cpu) )
         {
             rqd_valid = true;
             break;
@@ -3744,6 +3748,8 @@ csched2_alloc_pdata(const struct scheduler *ops, int cpu)
     struct csched2_pcpu *spc;
     struct csched2_runqueue_data *rqd;
 
+    BUG_ON(cpu_to_socket(cpu) == XEN_INVALID_SOCKET_ID);
+
     spc = xzalloc(struct csched2_pcpu);
     if ( spc == NULL )
         return ERR_PTR(-ENOMEM);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:02:30 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:02: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 1jhili-0007wZ-45; Sun, 07 Jun 2020 00:02:30 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhilg-0007wO-VJ
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:02:28 +0000
X-Inumbo-ID: 2ce66582-a852-11ea-b15b-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 2ce66582-a852-11ea-b15b-12813bfff9fa;
 Sun, 07 Jun 2020 00:02: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=JHB8SrpYu3MB4RHLm5nVudg+0LQMknNPTdEb6lZxGL8=; b=SUSx+cZsZCDAUuaSv2OJGyt1Ci
 NZPBrwXKYIsDZybF61JWuBwpMTDRQrulTmykUrblz8he8S+qWEMYKfN6qlDL6Ppzuvdct6zUFHIsh
 dqABuzUsBeZ7Cw4naMU7/EqToC3EZeIBJLcne11gbR9m9wc6xTOQm4yTFg1D7NYX57+A=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhilg-0003Km-5d
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:02:28 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhilg-0000hx-4o
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:02:28 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] xen: credit2: factor runqueue initialization in its own
 function.
Message-Id: <E1jhilg-0000hx-4o@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:02:28 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit c963db8d18e6583d688693ed2e9ca4f15a24c7d9
Author:     Dario Faggioli <dfaggioli@suse.com>
AuthorDate: Thu May 28 23:29:30 2020 +0200
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Fri May 29 18:53:53 2020 +0100

    xen: credit2: factor runqueue initialization in its own function.
    
    As it will be useful in later changes. While there, fix
    the doc-comment.
    
    No functional change intended.
    
    Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 xen/common/sched/credit2.c | 35 +++++++++++++++++++++++------------
 1 file changed, 23 insertions(+), 12 deletions(-)

diff --git a/xen/common/sched/credit2.c b/xen/common/sched/credit2.c
index 697c9f917d..8a4f28b9f5 100644
--- a/xen/common/sched/credit2.c
+++ b/xen/common/sched/credit2.c
@@ -3766,21 +3766,16 @@ csched2_alloc_pdata(const struct scheduler *ops, int cpu)
     return spc;
 }
 
-/* Returns the ID of the runqueue the cpu is assigned to. */
-static struct csched2_runqueue_data *
-init_pdata(struct csched2_private *prv, struct csched2_pcpu *spc,
-           unsigned int cpu)
+/*
+ * Do what's necessary to add cpu to the rqd (including activating the
+ * runqueue, if this is the first CPU we put in it).
+ */
+static void
+init_cpu_runqueue(struct csched2_private *prv, struct csched2_pcpu *spc,
+                  unsigned int cpu, struct csched2_runqueue_data *rqd)
 {
-    struct csched2_runqueue_data *rqd;
     unsigned int rcpu;
 
-    ASSERT(rw_is_write_locked(&prv->lock));
-    ASSERT(!cpumask_test_cpu(cpu, &prv->initialized));
-    /* CPU data needs to be allocated, but still uninitialized. */
-    ASSERT(spc);
-
-    rqd = spc->rqd;
-
     ASSERT(rqd && !cpumask_test_cpu(cpu, &spc->rqd->active));
 
     printk(XENLOG_INFO "Adding cpu %d to runqueue %d\n", cpu, rqd->id);
@@ -3816,6 +3811,22 @@ init_pdata(struct csched2_private *prv, struct csched2_pcpu *spc,
 
     if ( rqd->nr_cpus == 1 )
         rqd->pick_bias = cpu;
+}
+
+/* Returns a pointer to the runqueue the cpu is assigned to. */
+static struct csched2_runqueue_data *
+init_pdata(struct csched2_private *prv, struct csched2_pcpu *spc,
+           unsigned int cpu)
+{
+    struct csched2_runqueue_data *rqd;
+
+    ASSERT(rw_is_write_locked(&prv->lock));
+    ASSERT(!cpumask_test_cpu(cpu, &prv->initialized));
+    /* CPU data needs to be allocated, but still uninitialized. */
+    ASSERT(spc);
+
+    rqd = spc->rqd;
+    init_cpu_runqueue(prv, spc, cpu, rqd);
 
     return rqd;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:02:40 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:02: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 1jhils-0007xY-5n; Sun, 07 Jun 2020 00:02:40 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhilr-0007xP-5Q
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:02:39 +0000
X-Inumbo-ID: 32ed8e10-a852-11ea-b15b-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 32ed8e10-a852-11ea-b15b-12813bfff9fa;
 Sun, 07 Jun 2020 00:02: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=C2DVXWYMkyOlunVEL1aGGWyXYH6N/aXgU1fhyUymGPg=; b=1lu+4ab8dtl655jkGI/L/iAUkh
 QOPs1sqwzH8msTGZLeLQQWWL1mtyD6caKQDZJYLOQzNebs3GByUUuFq4Zozk7rsD67Ru8IGqZ6wUo
 5osi1YF32q0OfVG6adpgHAO8RevnCjYRGlza9TsVFvVfdAAm5qGmaxQd1Lian3tTO80Q=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhilq-0003La-8o
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:02:38 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhilq-0000vQ-87
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:02:38 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] xen: cpupool: add a back-pointer from a scheduler to its
 pool
Message-Id: <E1jhilq-0000vQ-87@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:02: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 524cc89c288b9ec5ae94f3e9b28a9c460b997cc2
Author:     Dario Faggioli <dfaggioli@suse.com>
AuthorDate: Thu May 28 23:29:37 2020 +0200
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Fri May 29 18:53:54 2020 +0100

    xen: cpupool: add a back-pointer from a scheduler to its pool
    
    If we need to know within which pool a particular scheduler
    is working, we can do that by querying the cpupool pointer
    of any of the sched_resource-s (i.e., ~ any of the CPUs)
    assigned to the scheduler itself.
    
    Basically, we pick any sched_resource that we know uses that
    scheduler, and we check its *cpupool pointer. If we really
    know that the resource uses the scheduler, this is fine, as
    it also means the resource is inside the pool we are
    looking for.
    
    But, of course, we can't do that for a pool/scheduler that has
    not any been given any sched_resource yet (or if we do not
    know whether or not it has any sched_resource).
    
    To overcome such limitation, add a back pointer from the
    scheduler, to its own pool.
    
    Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 xen/common/sched/cpupool.c | 1 +
 xen/common/sched/private.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/xen/common/sched/cpupool.c b/xen/common/sched/cpupool.c
index 0664f7fa3d..7ea641ca26 100644
--- a/xen/common/sched/cpupool.c
+++ b/xen/common/sched/cpupool.c
@@ -287,6 +287,7 @@ static struct cpupool *cpupool_create(
         if ( c->sched == NULL )
             goto err;
     }
+    c->sched->cpupool = c;
     c->gran = opt_sched_granularity;
 
     *q = c;
diff --git a/xen/common/sched/private.h b/xen/common/sched/private.h
index b9a5b4c01c..df50976eb2 100644
--- a/xen/common/sched/private.h
+++ b/xen/common/sched/private.h
@@ -275,6 +275,7 @@ struct scheduler {
     char *opt_name;         /* option name for this scheduler    */
     unsigned int sched_id;  /* ID for this scheduler             */
     void *sched_data;       /* global data pointer               */
+    struct cpupool *cpupool;/* points to this scheduler's pool   */
 
     int          (*global_init)    (void);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:02:51 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:02:51 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jhim3-0007z5-7Q; Sun, 07 Jun 2020 00:02:51 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhim1-0007ys-J7
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:02:49 +0000
X-Inumbo-ID: 38f46090-a852-11ea-96fb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 38f46090-a852-11ea-96fb-bc764e2007e4;
 Sun, 07 Jun 2020 00:02: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=S7DRx1mdjV8lkksQc908+Xjpd9+HSIFlqyNgrgDh714=; b=xsT8426LtUlxTiJu2GiMRIVJfX
 6mPNOvd+iYKcB23VQcxZVlZj1FA5XWqEycjroDWsF44pt8PmR76x+/jsvbUGNLT4yp1zV2aZfcGEm
 xLPSjw32HBYpe7IGv3fdsKDBmLDbY0jE5L/aORS+owV6PcBfXJvlDUfVA+kSb4G15Rsc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhim0-0003Lp-CI
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:02:48 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhim0-0000yM-BV
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:02:48 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] xen: credit2: limit the max number of CPUs in a runqueue
Message-Id: <E1jhim0-0000yM-BV@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:02: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 8e2aa76dc1670e82eaa15683353853bc66bf54fc
Author:     Dario Faggioli <dfaggioli@suse.com>
AuthorDate: Thu May 28 23:29:44 2020 +0200
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Fri May 29 18:53:54 2020 +0100

    xen: credit2: limit the max number of CPUs in a runqueue
    
    In Credit2 CPUs (can) share runqueues, depending on the topology. For
    instance, with per-socket runqueues (the default) all the CPUs that are
    part of the same socket share a runqueue.
    
    On platform with a huge number of CPUs per socket, that could be a
    problem. An example is AMD EPYC2 servers, where we can have up to 128
    CPUs in a socket.
    
    It is of course possible to define other, still topology-based, runqueue
    arrangements (e.g., per-LLC, per-DIE, etc). But that may still result in
    runqueues with too many CPUs on other/future platforms. For instance, a
    system with 96 CPUs and 2 NUMA nodes will end up having 48 CPUs per
    runqueue. Not as bad, but still a lot!
    
    Therefore, let's set a limit to the max number of CPUs that can share a
    Credit2 runqueue. The actual value is configurable (at boot time), the
    default being 16. If, for instance,  there are more than 16 CPUs in a
    socket, they'll be split among two (or more) runqueues.
    
    Note: with core scheduling enabled, this parameter sets the max number
    of *scheduling resources* that can share a runqueue. Therefore, with
    granularity set to core (and assumint 2 threads per core), we will have
    at most 16 cores per runqueue, which corresponds to 32 threads. But that
    is fine, considering how core scheduling works.
    
    Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 docs/misc/xen-command-line.pandoc |  14 ++++
 xen/common/sched/credit2.c        | 144 ++++++++++++++++++++++++++++++++++++--
 xen/include/asm-arm/cpufeature.h  |   5 ++
 xen/include/asm-x86/processor.h   |   5 ++
 4 files changed, 162 insertions(+), 6 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index e16bb90184..1787f2c8fb 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -1840,6 +1840,20 @@ with read and write permissions.
 
 Choose the default scheduler.
 
+### sched_credit2_max_cpus_runqueue
+> `= <integer>`
+
+> Default: `16`
+
+Defines how many CPUs will be put, at most, in each Credit2 runqueue.
+
+Runqueues are still arranged according to the host topology (and following
+what indicated by the 'credit2_runqueue' parameter). But we also have a cap
+to the number of CPUs that share each runqueues.
+
+A value that is a submultiple of the number of online CPUs is recommended,
+as that would likely produce a perfectly balanced runqueue configuration.
+
 ### sched_credit2_migrate_resist
 > `= <integer>`
 
diff --git a/xen/common/sched/credit2.c b/xen/common/sched/credit2.c
index 8a4f28b9f5..f4d3f8ae6b 100644
--- a/xen/common/sched/credit2.c
+++ b/xen/common/sched/credit2.c
@@ -25,6 +25,7 @@
 #include <xen/trace.h>
 #include <xen/cpu.h>
 #include <xen/keyhandler.h>
+#include <asm/processor.h>
 
 #include "private.h"
 
@@ -471,6 +472,22 @@ static int __init parse_credit2_runqueue(const char *s)
 }
 custom_param("credit2_runqueue", parse_credit2_runqueue);
 
+/*
+ * How many CPUs will be put, at most, in each runqueue.
+ *
+ * Runqueues are still arranged according to the host topology (and according
+ * to the value of the 'credit2_runqueue' parameter). But we also have a cap
+ * to the number of CPUs that share runqueues.
+ *
+ * This should be considered an upper limit. In fact, we also try to balance
+ * the number of CPUs in each runqueue. And, when doing that, it is possible
+ * that fewer CPUs than what this parameters mandates will actually be put
+ * in each runqueue.
+ */
+#define MAX_CPUS_RUNQ 16
+static unsigned int __read_mostly opt_max_cpus_runqueue = MAX_CPUS_RUNQ;
+integer_param("sched_credit2_max_cpus_runqueue", opt_max_cpus_runqueue);
+
 /*
  * Per-runqueue data
  */
@@ -852,18 +869,83 @@ cpu_runqueue_match(const struct csched2_runqueue_data *rqd, unsigned int cpu)
            (opt_runqueue == OPT_RUNQUEUE_NODE && same_node(peer_cpu, cpu));
 }
 
+/*
+ * Additional checks, to avoid separating siblings in different runqueues.
+ * This deals with both Intel's HTs and AMD's CUs. An arch that does not have
+ * any similar concept will just have cpu_nr_siblings() always return 1, and
+ * setup the cpu_sibling_mask-s acordingly (as currently does ARM), and things
+ * will just work as well.
+ */
+static bool
+cpu_runqueue_siblings_match(const struct csched2_runqueue_data *rqd,
+                            unsigned int cpu, unsigned int max_cpus_runq)
+{
+    unsigned int nr_sibls = cpu_nr_siblings(cpu);
+    unsigned int rcpu, tot_sibls = 0;
+
+    /*
+     * If we put the CPU in this runqueue, we must be sure that there will
+     * be enough room for accepting its sibling(s) as well.
+     */
+    cpumask_clear(cpumask_scratch_cpu(cpu));
+    for_each_cpu ( rcpu, &rqd->active )
+    {
+        ASSERT(rcpu != cpu);
+        if ( !cpumask_intersects(per_cpu(cpu_sibling_mask, rcpu), cpumask_scratch_cpu(cpu)) )
+        {
+            /*
+             * For each CPU already in the runqueue, account for it and for
+             * its sibling(s), independently from whether they are in the
+             * runqueue or not. Of course, we do this only once, for each CPU
+             * that is already inside the runqueue and all its siblings!
+             *
+             * This way, even if there are CPUs in the runqueue with siblings
+             * in a different cpupools, we still count all of them here.
+             * The reason for this is that, if at some future point we will
+             * move those sibling CPUs to this cpupool, we want them to land
+             * in this runqueue. Hence we must be sure to leave space for them.
+             */
+            cpumask_or(cpumask_scratch_cpu(cpu), cpumask_scratch_cpu(cpu),
+                       per_cpu(cpu_sibling_mask, rcpu));
+            tot_sibls += cpu_nr_siblings(rcpu);
+        }
+    }
+    /*
+     * We know that neither the CPU, nor any of its sibling are here,
+     * or we wouldn't even have entered the function.
+     */
+    ASSERT(!cpumask_intersects(cpumask_scratch_cpu(cpu),
+                               per_cpu(cpu_sibling_mask, cpu)));
+
+    /* Try adding CPU and its sibling(s) to the count and check... */
+    return tot_sibls + nr_sibls <= max_cpus_runq;
+}
+
 static struct csched2_runqueue_data *
-cpu_add_to_runqueue(struct csched2_private *prv, unsigned int cpu)
+cpu_add_to_runqueue(const struct scheduler *ops, unsigned int cpu)
 {
+    struct csched2_private *prv = csched2_priv(ops);
     struct csched2_runqueue_data *rqd, *rqd_new;
+    struct csched2_runqueue_data *rqd_valid = NULL;
     struct list_head *rqd_ins;
     unsigned long flags;
     int rqi = 0;
-    bool rqi_unused = false, rqd_valid = false;
+    unsigned int min_rqs, max_cpus_runq;
+    bool rqi_unused = false;
 
     /* Prealloc in case we need it - not allowed with interrupts off. */
     rqd_new = xzalloc(struct csched2_runqueue_data);
 
+    /*
+     * While respecting the limit of not having more than the max number of
+     * CPUs per runqueue, let's also try to "spread" the CPU, as evenly as
+     * possible, among the runqueues. For doing that, we need to know upfront
+     * how many CPUs we have, so let's use the number of CPUs that are online
+     * for that.
+     */
+    min_rqs = ((num_online_cpus() - 1) / opt_max_cpus_runqueue) + 1;
+    max_cpus_runq = num_online_cpus() / min_rqs;
+
     write_lock_irqsave(&prv->lock, flags);
 
     rqd_ins = &prv->rql;
@@ -873,10 +955,59 @@ cpu_add_to_runqueue(struct csched2_private *prv, unsigned int cpu)
         if ( !rqi_unused && rqd->id > rqi )
             rqi_unused = true;
 
+        /*
+         * First of all, let's check whether, according to the system
+         * topology, this CPU belongs in this runqueue.
+         */
         if ( cpu_runqueue_match(rqd, cpu) )
         {
-            rqd_valid = true;
-            break;
+            /*
+             * If the CPU has any siblings, they are online and they are
+             * being added to this cpupool, always keep them together. Even
+             * if that means violating what the opt_max_cpus_runqueue param
+             * indicates. However, if this happens, chances are high that a
+             * too small value was used for the parameter, so warn the user
+             * about that.
+             *
+             * Note that we cannot check this once and for all, say, during
+             * scheduler initialization. In fact, at least in theory, the
+             * number of siblings a CPU has may not be the same for all the
+             * CPUs.
+             */
+            if ( cpumask_intersects(&rqd->active, per_cpu(cpu_sibling_mask, cpu)) )
+            {
+                if ( cpumask_weight(&rqd->active) >= opt_max_cpus_runqueue )
+                {
+                        printk("WARNING: %s: more than opt_max_cpus_runqueue "
+                               "in a runqueue (%u vs %u), due to topology constraints.\n"
+                               "Consider raising it!\n",
+                               __func__, opt_max_cpus_runqueue,
+                               cpumask_weight(&rqd->active));
+                }
+                rqd_valid = rqd;
+                break;
+            }
+
+            /*
+             * If we're using core (or socket) scheduling, no need to do any
+             * further checking beyond the number of CPUs already in this
+             * runqueue respecting our upper bound.
+             *
+             * Otherwise, let's try to make sure that siblings stay in the
+             * same runqueue, pretty much under any cinrcumnstances.
+             */
+            if ( rqd->refcnt < max_cpus_runq && (ops->cpupool->gran != SCHED_GRAN_cpu ||
+                  cpu_runqueue_siblings_match(rqd, cpu, max_cpus_runq)) )
+            {
+                /*
+                 * This runqueue is ok, but as we said, we also want an even
+                 * distribution of the CPUs. So, unless this is the very first
+                 * match, we go on, check all runqueues and actually add the
+                 * CPU into the one that is less full.
+                 */
+                if ( !rqd_valid || rqd->refcnt < rqd_valid->refcnt )
+                    rqd_valid = rqd;
+            }
         }
 
         if ( !rqi_unused )
@@ -900,6 +1031,8 @@ cpu_add_to_runqueue(struct csched2_private *prv, unsigned int cpu)
         rqd->pick_bias = cpu;
         rqd->id = rqi;
     }
+    else
+        rqd = rqd_valid;
 
     rqd->refcnt++;
 
@@ -3744,7 +3877,6 @@ csched2_dump(const struct scheduler *ops)
 static void *
 csched2_alloc_pdata(const struct scheduler *ops, int cpu)
 {
-    struct csched2_private *prv = csched2_priv(ops);
     struct csched2_pcpu *spc;
     struct csched2_runqueue_data *rqd;
 
@@ -3754,7 +3886,7 @@ csched2_alloc_pdata(const struct scheduler *ops, int cpu)
     if ( spc == NULL )
         return ERR_PTR(-ENOMEM);
 
-    rqd = cpu_add_to_runqueue(prv, cpu);
+    rqd = cpu_add_to_runqueue(ops, cpu);
     if ( IS_ERR(rqd) )
     {
         xfree(spc);
diff --git a/xen/include/asm-arm/cpufeature.h b/xen/include/asm-arm/cpufeature.h
index 9af5666628..8fdf9685d7 100644
--- a/xen/include/asm-arm/cpufeature.h
+++ b/xen/include/asm-arm/cpufeature.h
@@ -64,6 +64,11 @@ static inline bool cpus_have_cap(unsigned int num)
     return test_bit(num, cpu_hwcaps);
 }
 
+static inline cpu_nr_siblings(unsigned int)
+{
+    return 1;
+}
+
 /* System capability check for constant cap */
 #define cpus_have_const_cap(num) ({                 \
         register_t __ret;                           \
diff --git a/xen/include/asm-x86/processor.h b/xen/include/asm-x86/processor.h
index 070691882b..73017c3f4b 100644
--- a/xen/include/asm-x86/processor.h
+++ b/xen/include/asm-x86/processor.h
@@ -174,6 +174,11 @@ extern void init_intel_cacheinfo(struct cpuinfo_x86 *c);
 
 unsigned int apicid_to_socket(unsigned int);
 
+static inline int cpu_nr_siblings(unsigned int cpu)
+{
+    return cpu_data[cpu].x86_num_siblings;
+}
+
 /*
  * Generic CPUID function
  * clear %ecx since some cpus (Cyrix MII) do not set or clear %ecx
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:03:00 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:03: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 1jhimC-0007zt-8u; Sun, 07 Jun 2020 00:03:00 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhimB-0007zl-8g
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:02:59 +0000
X-Inumbo-ID: 3ef7469c-a852-11ea-ba62-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 3ef7469c-a852-11ea-ba62-bc764e2007e4;
 Sun, 07 Jun 2020 00:02: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=i37PHlpwPCSYljC8kdHKTDd9tTTDQ2+fil/RF8VVhQA=; b=AdXqyUUtP3++m8ELymoaCN7bDU
 fH+llY8az0KVhnwFyjdX4LHkkJMu5d+K7wS/wUAN3s0nhQeLaq2ZjF8+uFojZv+RwAODTug2KG2qV
 MooczCXDZcGQqGp2pzpUAW0f1frD/TzCdAStcAvt0Ooqv+glMPQpO0/SH0g4bemyyoKY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhimA-0003Lv-Fg
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:02:58 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhimA-00018O-Ec
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:02:58 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] xen/build: introduce CLANG_FLAGS for testing other CFLAGS
Message-Id: <E1jhimA-00018O-Ec@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:02: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 fa0854478d0b2b64680e558db760851f6f1c6d16
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Fri May 29 16:43:43 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri May 29 18:58:21 2020 +0100

    xen/build: introduce CLANG_FLAGS for testing other CFLAGS
    
    Commit 534519f0514f ("xen: Have Kconfig check $(CC)'s version")
    introduced the use of CLANG_FLAGS in Kconfig which is used when
    testing for other CFLAGS via $(cc-option ...) but CLANG_FLAGS doesn't
    exist in the Xen build system. (It's a Linux/Kbuild variable that
    haven't been added yet.)
    
    The missing CLANG_FLAGS isn't an issue for $(cc-option ..) but it
    would be when $(as-instr ..) gets imported from Kbuild to tests
    assembly instruction. We need to know if we are going to use clang's
    assembler or not.
    
    CLANG_FLAGS needs to be calculated before we call Kconfig.
    
    So, this patch adds CLANG_FLAGS which may contain two flags which are
    needed for further testing of $(CC)'s capabilities:
      -no-integrated-as
        This flags isn't new, but simply tested earlier so that it can be
        used in Kconfig. The flags is only added for x86 builds like
        before.
      -Werror=unknown-warning-option
        The one is new and is to make sure that the warning is enabled,
        even though it is by default but could be disabled in a particular
        build of clang, see Linux's commit e8de12fb7cde ("kbuild: Check
        for unknown options with cc-option usage in Kconfig and clang")
    
        It is present in clang 3.0.0, according Linux's commit
        589834b3a009 ("kbuild: Add -Werror=unknown-warning-option to
        CLANG_FLAGS").
    
    (The "note" that say that the flags was only added once wasn't true
    when tested on CentOS 6, so the patch uses $(or) and the flag will only
    be added once.)
    
    Fixes: 534519f0514f ("xen: Have Kconfig check $(CC)'s version")
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/Makefile         | 31 +++++++++++++++++++++++++++++--
 xen/arch/x86/arch.mk | 24 ------------------------
 2 files changed, 29 insertions(+), 26 deletions(-)

diff --git a/xen/Makefile b/xen/Makefile
index 286f374b54..d53d1f7b5e 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -48,6 +48,7 @@ default: build
 .PHONY: dist
 dist: install
 
+include scripts/Kbuild.include
 
 ifneq ($(root-make-done),y)
 # section to run before calling Rules.mk, but only once.
@@ -124,11 +125,37 @@ ifneq ($(filter %config,$(MAKECMDGOALS)),)
     config-build := y
 endif
 
+# CLANG_FLAGS needs to be calculated before calling Kconfig
+ifneq ($(shell $(CC) --version 2>&1 | head -n 1 | grep clang),)
+CLANG_FLAGS :=
+
+ifeq ($(TARGET_ARCH),x86)
+# The tests to select whether the integrated assembler is usable need to happen
+# before testing any assembler features, or else the result of the tests would
+# be stale if the integrated assembler is not used.
+
+# Older clang's built-in assembler doesn't understand .skip with labels:
+# https://bugs.llvm.org/show_bug.cgi?id=27369
+t1 = $(call as-insn,$(CC),".L0: .L1: .skip (.L1 - .L0)",,-no-integrated-as)
+
+# Check whether clang asm()-s support .include.
+t2 = $(call as-insn,$(CC) -I$(BASEDIR)/include,".include \"asm-x86/indirect_thunk_asm.h\"",,-no-integrated-as)
+
+# Check whether clang keeps .macro-s between asm()-s:
+# https://bugs.llvm.org/show_bug.cgi?id=36110
+t3 = $(call as-insn,$(CC),".macro FOO;.endm"$(close); asm volatile $(open)".macro FOO;.endm",-no-integrated-as)
+
+CLANG_FLAGS += $(call or,$(t1),$(t2),$(t3))
+endif
+
+CLANG_FLAGS += -Werror=unknown-warning-option
+CFLAGS += $(CLANG_FLAGS)
+export CLANG_FLAGS
+endif
+
 export root-make-done := y
 endif # root-make-done
 
-include scripts/Kbuild.include
-
 # Shorthand for kconfig
 kconfig = -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=$(ARCH) SRCARCH=$(SRCARCH) HOSTCC="$(HOSTCC)" HOSTCXX="$(HOSTCXX)"
 
diff --git a/xen/arch/x86/arch.mk b/xen/arch/x86/arch.mk
index 9927a42061..04e967436b 100644
--- a/xen/arch/x86/arch.mk
+++ b/xen/arch/x86/arch.mk
@@ -11,30 +11,6 @@ CFLAGS += -DXEN_IMG_OFFSET=$(XEN_IMG_OFFSET)
 # Prevent floating-point variables from creeping into Xen.
 CFLAGS += -msoft-float
 
-ifeq ($(CONFIG_CC_IS_CLANG),y)
-# Note: Any test which adds -no-integrated-as will cause subsequent tests to
-# succeed, and not trigger further additions.
-#
-# The tests to select whether the integrated assembler is usable need to happen
-# before testing any assembler features, or else the result of the tests would
-# be stale if the integrated assembler is not used.
-
-# Older clang's built-in assembler doesn't understand .skip with labels:
-# https://bugs.llvm.org/show_bug.cgi?id=27369
-$(call as-option-add,CFLAGS,CC,".L0: .L1: .skip (.L1 - .L0)",,\
-                     -no-integrated-as)
-
-# Check whether clang asm()-s support .include.
-$(call as-option-add,CFLAGS,CC,".include \"asm-x86/indirect_thunk_asm.h\"",,\
-                     -no-integrated-as)
-
-# Check whether clang keeps .macro-s between asm()-s:
-# https://bugs.llvm.org/show_bug.cgi?id=36110
-$(call as-option-add,CFLAGS,CC,\
-                     ".macro FOO;.endm"$$(close); asm volatile $$(open)".macro FOO;.endm",\
-                     -no-integrated-as)
-endif
-
 $(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
 $(call cc-option-add,CFLAGS,CC,-Wnested-externs)
 $(call as-option-add,CFLAGS,CC,"vmcall",-DHAVE_AS_VMX)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:03:10 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:03: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 1jhimM-00081C-Bu; Sun, 07 Jun 2020 00:03:10 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhimL-000812-8f
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:03:09 +0000
X-Inumbo-ID: 44fc4056-a852-11ea-9b55-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 44fc4056-a852-11ea-9b55-bc764e2007e4;
 Sun, 07 Jun 2020 00:03: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=6N7x8MMv09CnuPGEupgCm9AR+9C6Mjylstrbw/w1lqw=; b=wtR1U0+leYP7NKtT/8VTUUOEFE
 nwgBqSVhlSG4xUv4rtBN/c4FIlxXn5GKyHqj8HYoTA+0DtuXI8bFfWbZuNK29poBPufZZYeWJHHuX
 f3iRCFzlySlDgvDhbp1bkC/tTkSqKDx7i9nyzK9dDSBq5uJx3uGXaT8Ms6HghTVwnTmU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhimK-0003MH-Ip
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:03:08 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhimK-0001FT-Hx
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:03:08 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/pv: remove unnecessary toggle_guest_pt() overhead
Message-Id: <E1jhimK-0001FT-Hx@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:03:08 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 422ec8fcf34cf961e81fbccd7d236fa2c1e678a8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue May 5 08:16:03 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri May 29 18:58:21 2020 +0100

    x86/pv: remove unnecessary toggle_guest_pt() overhead
    
    toggle_guest_pt() is called in pairs, to read guest kernel data
    structures when emulating a guest userspace action. Hence this doesn't
    modify cr3 from the guest's point of view, and therefore doesn't need
    any resync on the exit-to-guest path. Therefore move the updating of
    ->pv_cr3 and ->root_pgt_changed into toggle_guest_mode(), since undoing
    the changes during the second of these invocations wouldn't be a safe
    thing to do.
    
    While at it, add a comment ahead of toggle_guest_pt() to clarify its
    intended usage.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/pv/domain.c | 37 +++++++++++++++++++++++--------------
 1 file changed, 23 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/pv/domain.c b/xen/arch/x86/pv/domain.c
index f4e863a410..ec5a7d2dca 100644
--- a/xen/arch/x86/pv/domain.c
+++ b/xen/arch/x86/pv/domain.c
@@ -412,18 +412,10 @@ bool __init xpti_pcid_enabled(void)
 
 static void _toggle_guest_pt(struct vcpu *v)
 {
-    const struct domain *d = v->domain;
-    struct cpu_info *cpu_info = get_cpu_info();
     unsigned long cr3;
 
     v->arch.flags ^= TF_kernel_mode;
     update_cr3(v);
-    if ( d->arch.pv.xpti )
-    {
-        cpu_info->root_pgt_changed = true;
-        cpu_info->pv_cr3 = __pa(this_cpu(root_pgt)) |
-                           (d->arch.pv.pcid ? get_pcid_bits(v, true) : 0);
-    }
 
     /*
      * Don't flush user global mappings from the TLB. Don't tick TLB clock.
@@ -431,15 +423,11 @@ static void _toggle_guest_pt(struct vcpu *v)
      * In shadow mode, though, update_cr3() may need to be accompanied by a
      * TLB flush (for just the incoming PCID), as the top level page table may
      * have changed behind our backs. To be on the safe side, suppress the
-     * no-flush unconditionally in this case. The XPTI CR3 write, if enabled,
-     * will then need to be a flushing one too.
+     * no-flush unconditionally in this case.
      */
     cr3 = v->arch.cr3;
-    if ( shadow_mode_enabled(d) )
-    {
+    if ( shadow_mode_enabled(v->domain) )
         cr3 &= ~X86_CR3_NOFLUSH;
-        cpu_info->pv_cr3 &= ~X86_CR3_NOFLUSH;
-    }
     write_cr3(cr3);
 
     if ( !(v->arch.flags & TF_kernel_mode) )
@@ -455,6 +443,8 @@ static void _toggle_guest_pt(struct vcpu *v)
 
 void toggle_guest_mode(struct vcpu *v)
 {
+    const struct domain *d = v->domain;
+
     ASSERT(!is_pv_32bit_vcpu(v));
 
     /* %fs/%gs bases can only be stale if WR{FS,GS}BASE are usable. */
@@ -468,8 +458,27 @@ void toggle_guest_mode(struct vcpu *v)
     asm volatile ( "swapgs" );
 
     _toggle_guest_pt(v);
+
+    if ( d->arch.pv.xpti )
+    {
+        struct cpu_info *cpu_info = get_cpu_info();
+
+        cpu_info->root_pgt_changed = true;
+        cpu_info->pv_cr3 = __pa(this_cpu(root_pgt)) |
+                           (d->arch.pv.pcid ? get_pcid_bits(v, true) : 0);
+        /*
+         * As in _toggle_guest_pt() the XPTI CR3 write needs to be a TLB-
+         * flushing one too for shadow mode guests.
+         */
+        if ( shadow_mode_enabled(d) )
+            cpu_info->pv_cr3 &= ~X86_CR3_NOFLUSH;
+    }
 }
 
+/*
+ * Must be called in matching pairs without returning to guest context
+ * inbetween.
+ */
 void toggle_guest_pt(struct vcpu *v)
 {
     if ( !is_pv_32bit_vcpu(v) )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:03:20 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:03:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jhimW-00083q-DQ; Sun, 07 Jun 2020 00:03:20 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhimV-00083h-9g
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:03:19 +0000
X-Inumbo-ID: 4b02cc9a-a852-11ea-b15b-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 4b02cc9a-a852-11ea-b15b-12813bfff9fa;
 Sun, 07 Jun 2020 00:03: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=ndsCH0cwgwW+QFWMJFpWgSmCAqNkYABdOKHQMAVkLLA=; b=UwowUQjEnaPN/bGBz210oeV/Qt
 HLDVoZek+Nav6SdgsI60v9wVeu+7ctLaAac9ujQ3GZPDLINdH2BEB0FtLzeLQEjaCE6emxgtBBijo
 pkyK4wziIONWnaDocQS1teWCVRS7B7/i+lJdhFBHRY4wxj25Cl1YCBoQ3ktriVzW2RrA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhimU-0003MU-MJ
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:03:18 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhimU-0001GP-LK
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:03:18 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] arm: Fix build following c/s 8e2aa76dc
Message-Id: <E1jhimU-0001GP-LK@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:03:18 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit cc07818e5e475c4ac0ee88130a2d4b329a53651e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri May 29 22:23:59 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri May 29 22:27:50 2020 +0100

    arm: Fix build following c/s 8e2aa76dc
    
    The ARM side of the cpu_nr_siblings() was missing a return type.  OSSTest
    reports:
    
      /home/osstest/build.150502.build-arm64-xsm/xen/xen/include/asm/cpufeature.h:67:15:
      error: return type defaults to 'int' [-Werror=implicit-int]
       static inline cpu_nr_siblings(unsigned int)
                     ^~~~~~~~~~~~~~~
    
    My local build test then reported:
    
      /local/xen.git/xen/include/asm/cpufeature.h: In function ‘cpu_nr_siblings’:
      /local/xen.git/xen/include/asm/cpufeature.h:67:1: error: parameter name omitted
       static inline int cpu_nr_siblings(unsigned int)
        ^
    
    Fix it up to match its x86 counterpart.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/include/asm-arm/cpufeature.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/include/asm-arm/cpufeature.h b/xen/include/asm-arm/cpufeature.h
index 8fdf9685d7..674beb0353 100644
--- a/xen/include/asm-arm/cpufeature.h
+++ b/xen/include/asm-arm/cpufeature.h
@@ -64,7 +64,7 @@ static inline bool cpus_have_cap(unsigned int num)
     return test_bit(num, cpu_hwcaps);
 }
 
-static inline cpu_nr_siblings(unsigned int)
+static inline int cpu_nr_siblings(unsigned int cpu)
 {
     return 1;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:03:30 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:03: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 1jhimg-00084x-F8; Sun, 07 Jun 2020 00:03:30 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhimf-00084m-Bf
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:03:29 +0000
X-Inumbo-ID: 51127bc6-a852-11ea-9ad7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 51127bc6-a852-11ea-9ad7-bc764e2007e4;
 Sun, 07 Jun 2020 00:03:29 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=ptBZg54E8Ptici59rO3HKJjSD99F8COQufyoGoWQ/L4=; b=oqCOwGGQivCO8mxzfTQEY7Y8sE
 cKwe5xHKFd1qLOdhZgsJC17GT8MeM444MQ2hua5CtG2rU5fiPKaffsyr6a3zrFV9n4xnkpRhiBC3I
 CybHpoj3NLSeZ5qaq2WU2LazwWJdjIahLWC0jjz74qPjt3VTflF/QG5xEgtFJkSDWCEo=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhime-0003N6-Ru
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:03:28 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhime-0001j0-Qt
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:03:28 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] xen/build: fix xen/tools/binfile
Message-Id: <E1jhime-0001j0-Qt@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:03:28 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 5e1783880d6948ea5c8fad6dd64af6e44a1e32ab
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri May 29 20:28:00 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri May 29 22:30:14 2020 +0100

    xen/build: fix xen/tools/binfile
    
    xen/tools/binfile contains a bash specific command (let). This leads
    to build failures on systems not using bash as /bin/sh.
    
    Replace "let SHIFT=$OPTIND-1" by "SHIFT=$((OPTIND-1))".
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Tested-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/tools/binfile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/tools/binfile b/xen/tools/binfile
index df0301183f..23099c49bf 100755
--- a/xen/tools/binfile
+++ b/xen/tools/binfile
@@ -17,7 +17,7 @@ while getopts "ia:" opt; do
         ;;
     esac
 done
-let "SHIFT=$OPTIND-1"
+SHIFT=$((OPTIND-1))
 shift $SHIFT
 
 target=$1
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:03:41 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:03:41 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jhimr-000863-Ge; Sun, 07 Jun 2020 00:03:41 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhimp-00085t-P9
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:03:39 +0000
X-Inumbo-ID: 571b3198-a852-11ea-9ad7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 571b3198-a852-11ea-9ad7-bc764e2007e4;
 Sun, 07 Jun 2020 00:03:39 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=nj1vuA6tKfml8MdN8akIK8FH4ioCsmCeLd4/Y13G99I=; b=Q3JOcU6gB6o7y5eOEKlwCpwwu0
 4/pkdfu/qtbuCVdhztsfStfKXBwU2fgqB3x6GF8RLWbWNvBgKKYNuik6fShlJ3GEhoq4J/D4s5No7
 zaXWTzUR8Aq+PrGKGT2Vucbttdxy3aGYIOJwczRg1ucGCkFhaFq/uHZUpEN8TyF7aq04=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhimo-0003NK-Vq
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:03:38 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhimo-0001rT-VF
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:03:38 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/traps: Clean up printing in {do_reserved,
 fatal}_trap()
Message-Id: <E1jhimo-0001rT-VF@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:03: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 d91c145e021a5a0eca774ee112ab8e79fef85f16
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Apr 30 15:05:24 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri May 29 23:09:46 2020 +0100

    x86/traps: Clean up printing in {do_reserved,fatal}_trap()
    
    For one, they render the vector in a different base.
    
    Introduce X86_EXC_* constants and vec_name() to refer to exceptions by their
    mnemonic, which starts bringing the code/diagnostics in line with the Intel
    and AMD manuals.
    
    Provide constants for every archtiecturally defined exception, even those not
    implemented by Xen yet, as do_reserved_trap() is a catch-all handler.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/traps.c            | 26 +++++++++++++++++++++-----
 xen/include/asm-x86/processor.h |  6 +-----
 xen/include/asm-x86/x86-defns.h | 34 ++++++++++++++++++++++++++++++++++
 3 files changed, 56 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index a8300c214d..427178e649 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -682,6 +682,22 @@ const char *trapstr(unsigned int trapnr)
     return trapnr < ARRAY_SIZE(strings) ? strings[trapnr] : "???";
 }
 
+static const char *vec_name(unsigned int vec)
+{
+    static const char names[][4] = {
+#define P(x) [X86_EXC_ ## x] = "#" #x
+#define N(x) [X86_EXC_ ## x] = #x
+        P(DE),  P(DB),  N(NMI), P(BP),  P(OF),  P(BR),  P(UD),  P(NM),
+        P(DF),  N(CSO), P(TS),  P(NP),  P(SS),  P(GP),  P(PF),  N(SPV),
+        P(MF),  P(AC),  P(MC),  P(XM),  P(VE),  P(CP),
+                                        P(HV),  P(VC),  P(SX),
+#undef N
+#undef P
+    };
+
+    return (vec < ARRAY_SIZE(names) && names[vec][0]) ? names[vec] : "???";
+}
+
 /*
  * This is called for faults at very unexpected times (e.g., when interrupts
  * are disabled). In such situations we can't do much that is safe. We try to
@@ -739,10 +755,9 @@ void fatal_trap(const struct cpu_user_regs *regs, bool show_remote)
         }
     }
 
-    panic("FATAL TRAP: vector = %d (%s)\n"
-          "[error_code=%04x] %s\n",
-          trapnr, trapstr(trapnr), regs->error_code,
-          (regs->eflags & X86_EFLAGS_IF) ? "" : ", IN INTERRUPT CONTEXT");
+    panic("FATAL TRAP: vec %u, %s[%04x]%s\n",
+          trapnr, vec_name(trapnr), regs->error_code,
+          (regs->eflags & X86_EFLAGS_IF) ? "" : " IN INTERRUPT CONTEXT");
 }
 
 static void do_reserved_trap(struct cpu_user_regs *regs)
@@ -753,7 +768,8 @@ static void do_reserved_trap(struct cpu_user_regs *regs)
         return;
 
     show_execution_state(regs);
-    panic("FATAL RESERVED TRAP %#x: %s\n", trapnr, trapstr(trapnr));
+    panic("FATAL RESERVED TRAP: vec %u, %s[%04x]\n",
+          trapnr, vec_name(trapnr), regs->error_code);
 }
 
 static void do_trap(struct cpu_user_regs *regs)
diff --git a/xen/include/asm-x86/processor.h b/xen/include/asm-x86/processor.h
index 73017c3f4b..a3d72b26ef 100644
--- a/xen/include/asm-x86/processor.h
+++ b/xen/include/asm-x86/processor.h
@@ -43,11 +43,7 @@
 #define TRAP_virtualisation   20
 #define TRAP_nr               32
 
-#define TRAP_HAVE_EC                                                    \
-    ((1u << TRAP_double_fault) | (1u << TRAP_invalid_tss) |             \
-     (1u << TRAP_no_segment) | (1u << TRAP_stack_error) |               \
-     (1u << TRAP_gp_fault) | (1u << TRAP_page_fault) |                  \
-     (1u << TRAP_alignment_check))
+#define TRAP_HAVE_EC X86_EXC_HAVE_EC
 
 /* Set for entry via SYSCALL. Informs return code to use SYSRETQ not IRETQ. */
 /* NB. Same as VGCF_in_syscall. No bits in common with any other TRAP_ defn. */
diff --git a/xen/include/asm-x86/x86-defns.h b/xen/include/asm-x86/x86-defns.h
index 8bf503220a..f0157e2311 100644
--- a/xen/include/asm-x86/x86-defns.h
+++ b/xen/include/asm-x86/x86-defns.h
@@ -118,4 +118,38 @@
 
 #define X86_NR_VECTORS 256
 
+/* Exception Vectors */
+#define X86_EXC_DE             0 /* Divide Error */
+#define X86_EXC_DB             1 /* Debug Exception */
+#define X86_EXC_NMI            2 /* NMI */
+#define X86_EXC_BP             3 /* Breakpoint */
+#define X86_EXC_OF             4 /* Overflow */
+#define X86_EXC_BR             5 /* BOUND Range */
+#define X86_EXC_UD             6 /* Invalid Opcode */
+#define X86_EXC_NM             7 /* Device Not Available */
+#define X86_EXC_DF             8 /* Double Fault */
+#define X86_EXC_CSO            9 /* Coprocessor Segment Overrun */
+#define X86_EXC_TS            10 /* Invalid TSS */
+#define X86_EXC_NP            11 /* Segment Not Present */
+#define X86_EXC_SS            12 /* Stack-Segment Fault */
+#define X86_EXC_GP            13 /* General Porection Fault */
+#define X86_EXC_PF            14 /* Page Fault */
+#define X86_EXC_SPV           15 /* PIC Spurious Interrupt Vector */
+#define X86_EXC_MF            16 /* Maths fault (x87 FPU) */
+#define X86_EXC_AC            17 /* Alignment Check */
+#define X86_EXC_MC            18 /* Machine Check */
+#define X86_EXC_XM            19 /* SIMD Exception */
+#define X86_EXC_VE            20 /* Virtualisation Exception */
+#define X86_EXC_CP            21 /* Control-flow Protection */
+#define X86_EXC_HV            28 /* Hypervisor Injection */
+#define X86_EXC_VC            29 /* VMM Communication */
+#define X86_EXC_SX            30 /* Security Exception */
+
+/* Bitmap of exceptions which have error codes. */
+#define X86_EXC_HAVE_EC                                             \
+    ((1u << X86_EXC_DF) | (1u << X86_EXC_TS) | (1u << X86_EXC_NP) | \
+     (1u << X86_EXC_SS) | (1u << X86_EXC_GP) | (1u << X86_EXC_PF) | \
+     (1u << X86_EXC_AC) | (1u << X86_EXC_CP) |                      \
+     (1u << X86_EXC_VC) | (1u << X86_EXC_SX))
+
 #endif	/* __XEN_X86_DEFNS_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:03:51 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:03:51 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jhin1-00087h-I4; Sun, 07 Jun 2020 00:03:51 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhimz-00087V-Ti
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:03:49 +0000
X-Inumbo-ID: 5d20b27a-a852-11ea-ba62-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 5d20b27a-a852-11ea-ba62-bc764e2007e4;
 Sun, 07 Jun 2020 00:03:49 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=K41zXCsPFdGWYILrzC1E5Z1abPHCH0sDZ8tOPcMe16s=; b=yosyylZ6hKxyPmR5gl+3203ukf
 BzezMvHxymf8Sy/4NRSM0KvD5+6i2Yv3Mtsw3tV+SxdoWt3qMLadFLJlB3waJjG5PDkrxkKZES+kd
 KMSpIhF9yWleoKFd+qGYjvzNNkTkMinTeB7/O0ZNuVhb0k6BZOi9NhF+JymKfgnTgwzw=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhimz-0003NT-2u
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:03:49 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhimz-0001rz-1s
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:03:49 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/traps: Factor out extable_fixup() and make printing
 consistent
Message-Id: <E1jhimz-0001rz-1s@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:03:49 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit c65da4f721efc54ea7fb35e3f7f05159f2243c61
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Apr 30 15:05:24 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri May 29 23:09:46 2020 +0100

    x86/traps: Factor out extable_fixup() and make printing consistent
    
    UD faults never had any diagnostics printed, and the others were inconsistent.
    
    Don't use dprintk() because identifying traps.c is actively unhelpful in the
    message, as it is the location of the fixup, not the fault.  Use the new
    vec_name() infrastructure, rather than leaving raw numbers for the log.
    
      (XEN) Running stub recovery selftests...
      (XEN) Fixup #UD[0000]: ffff82d07fffd040 [ffff82d07fffd040] -> ffff82d0403ac9d6
      (XEN) Fixup #GP[0000]: ffff82d07fffd041 [ffff82d07fffd041] -> ffff82d0403ac9d6
      (XEN) Fixup #SS[0000]: ffff82d07fffd040 [ffff82d07fffd040] -> ffff82d0403ac9d6
      (XEN) Fixup #BP[0000]: ffff82d07fffd041 [ffff82d07fffd041] -> ffff82d0403ac9d6
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/traps.c | 77 ++++++++++++++++++++++++----------------------------
 1 file changed, 35 insertions(+), 42 deletions(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 427178e649..eeb3e146ef 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -772,10 +772,31 @@ static void do_reserved_trap(struct cpu_user_regs *regs)
           trapnr, vec_name(trapnr), regs->error_code);
 }
 
+static bool extable_fixup(struct cpu_user_regs *regs, bool print)
+{
+    unsigned long fixup = search_exception_table(regs);
+
+    if ( unlikely(fixup == 0) )
+        return false;
+
+    /*
+     * Don't use dprintk() because the __FILE__ reference is unhelpful.
+     * Can currently be triggered by guests.  Make sure we ratelimit.
+     */
+    if ( IS_ENABLED(CONFIG_DEBUG) && print )
+        printk(XENLOG_GUEST XENLOG_WARNING "Fixup %s[%04x]: %p [%ps] -> %p\n",
+               vec_name(regs->entry_vector), regs->error_code,
+               _p(regs->rip), _p(regs->rip), _p(fixup));
+
+    regs->rip = fixup;
+    this_cpu(last_extable_addr) = regs->rip;
+
+    return true;
+}
+
 static void do_trap(struct cpu_user_regs *regs)
 {
     unsigned int trapnr = regs->entry_vector;
-    unsigned long fixup;
 
     if ( regs->error_code & X86_XEC_EXT )
         goto hardware_trap;
@@ -793,14 +814,8 @@ static void do_trap(struct cpu_user_regs *regs)
         return;
     }
 
-    if ( likely((fixup = search_exception_table(regs)) != 0) )
-    {
-        dprintk(XENLOG_ERR, "Trap %u: %p [%ps] -> %p\n",
-                trapnr, _p(regs->rip), _p(regs->rip), _p(fixup));
-        this_cpu(last_extable_addr) = regs->rip;
-        regs->rip = fixup;
+    if ( likely(extable_fixup(regs, true)) )
         return;
-    }
 
  hardware_trap:
     if ( debugger_trap_fatal(trapnr, regs) )
@@ -1108,12 +1123,8 @@ void do_invalid_op(struct cpu_user_regs *regs)
     }
 
  die:
-    if ( (fixup = search_exception_table(regs)) != 0 )
-    {
-        this_cpu(last_extable_addr) = regs->rip;
-        regs->rip = fixup;
+    if ( likely(extable_fixup(regs, true)) )
         return;
-    }
 
     if ( debugger_trap_fatal(TRAP_invalid_op, regs) )
         return;
@@ -1129,16 +1140,8 @@ void do_int3(struct cpu_user_regs *regs)
 
     if ( !guest_mode(regs) )
     {
-        unsigned long fixup;
-
-        if ( (fixup = search_exception_table(regs)) != 0 )
-        {
-            this_cpu(last_extable_addr) = regs->rip;
-            dprintk(XENLOG_DEBUG, "Trap %u: %p [%ps] -> %p\n",
-                    TRAP_int3, _p(regs->rip), _p(regs->rip), _p(fixup));
-            regs->rip = fixup;
+        if ( likely(extable_fixup(regs, true)) )
             return;
-        }
 
         if ( !debugger_trap_fatal(TRAP_int3, regs) )
             printk(XENLOG_DEBUG "Hit embedded breakpoint at %p [%ps]\n",
@@ -1415,7 +1418,7 @@ static int fixup_page_fault(unsigned long addr, struct cpu_user_regs *regs)
 
 void do_page_fault(struct cpu_user_regs *regs)
 {
-    unsigned long addr, fixup;
+    unsigned long addr;
     unsigned int error_code;
 
     addr = read_cr2();
@@ -1461,11 +1464,9 @@ void do_page_fault(struct cpu_user_regs *regs)
         if ( pf_type != real_fault )
             return;
 
-        if ( likely((fixup = search_exception_table(regs)) != 0) )
+        if ( likely(extable_fixup(regs, false)) )
         {
             perfc_incr(copy_user_faults);
-            this_cpu(last_extable_addr) = regs->rip;
-            regs->rip = fixup;
             return;
         }
 
@@ -1521,7 +1522,6 @@ void do_general_protection(struct cpu_user_regs *regs)
 #ifdef CONFIG_PV
     struct vcpu *v = current;
 #endif
-    unsigned long fixup;
 
     if ( debugger_trap_entry(TRAP_gp_fault, regs) )
         return;
@@ -1588,14 +1588,8 @@ void do_general_protection(struct cpu_user_regs *regs)
 
  gp_in_kernel:
 
-    if ( likely((fixup = search_exception_table(regs)) != 0) )
-    {
-        dprintk(XENLOG_INFO, "GPF (%04x): %p [%ps] -> %p\n",
-                regs->error_code, _p(regs->rip), _p(regs->rip), _p(fixup));
-        this_cpu(last_extable_addr) = regs->rip;
-        regs->rip = fixup;
+    if ( likely(extable_fixup(regs, true)) )
         return;
-    }
 
  hardware_gp:
     if ( debugger_trap_fatal(TRAP_gp_fault, regs) )
@@ -1754,18 +1748,17 @@ void do_device_not_available(struct cpu_user_regs *regs)
 
     if ( !guest_mode(regs) )
     {
-        unsigned long fixup = search_exception_table(regs);
-
-        gprintk(XENLOG_ERR, "#NM: %p [%ps] -> %p\n",
-                _p(regs->rip), _p(regs->rip), _p(fixup));
         /*
          * We shouldn't be able to reach here, but for release builds have
          * the recovery logic in place nevertheless.
          */
-        ASSERT_UNREACHABLE();
-        BUG_ON(!fixup);
-        regs->rip = fixup;
-        return;
+        if ( extable_fixup(regs, true) )
+        {
+            ASSERT_UNREACHABLE();
+            return;
+        }
+
+        fatal_trap(regs, false);
     }
 
 #ifdef CONFIG_PV
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:04:01 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:04: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 1jhinB-00088v-LF; Sun, 07 Jun 2020 00:04:01 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhinA-00088j-2S
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:04:00 +0000
X-Inumbo-ID: 63267074-a852-11ea-ba62-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 63267074-a852-11ea-ba62-bc764e2007e4;
 Sun, 07 Jun 2020 00:03:59 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=UUEPAEJ7JY+f5zeQqWuk49zJyTLMkb4OOf7kPvZ93s8=; b=CtxqTtnEO649MKQqLFOxYiYBgx
 0teAxPGxnS+2bAgccQztzMvuwbEwKBtb5ghpuBsWJES4l26PjaQQDgxbA0mVz3isCEVFwb78Tg5D2
 NoNYPYhw1SWblkBRnEcEcwpk906CQwXxs6X5oa+wdoyWFoulDwBSPB8q7jqyIlBB+tic=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhin9-0003Nc-69
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:03:59 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhin9-0001sk-5V
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:03:59 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/shstk: Introduce Supervisor Shadow Stack support
Message-Id: <E1jhin9-0001sk-5V@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:03:59 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit d3fb3ed32fc8ee4cb453058e54e7c317a9b93922
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 21 17:56:57 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri May 29 23:09:46 2020 +0100

    x86/shstk: Introduce Supervisor Shadow Stack support
    
    Introduce CONFIG_HAS_AS_CET_SS to determine whether CET Shadow Stack
    instructions are supported in the assembler, and CONFIG_XEN_SHSTK as the main
    build option.
    
    Introduce cet={no-,}shstk to for a user to select whether or not to use shadow
    stacks at runtime, and X86_FEATURE_XEN_SHSTK to determine Xen's overall
    enablement of shadow stacks.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 docs/misc/xen-command-line.pandoc | 17 +++++++++++++++++
 xen/arch/x86/Kconfig              | 18 ++++++++++++++++++
 xen/arch/x86/setup.c              | 30 ++++++++++++++++++++++++++++++
 xen/include/asm-x86/cpufeature.h  |  1 +
 xen/include/asm-x86/cpufeatures.h |  1 +
 xen/scripts/Kconfig.include       |  4 ++++
 6 files changed, 71 insertions(+)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 1787f2c8fb..ec1c12cbe0 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -270,6 +270,23 @@ and not running softirqs. Reduce this if softirqs are not being run frequently
 enough. Setting this to a high value may cause boot failure, particularly if
 the NMI watchdog is also enabled.
 
+### cet
+    = List of [ shstk=<bool> ]
+
+    Applicability: x86
+
+Controls for the use of Control-flow Enforcement Technology.  CET is group a
+of hardware features designed to combat Return-oriented Programming (ROP, also
+call/jmp COP/JOP) attacks.
+
+*   The `shstk=` boolean controls whether Xen uses Shadow Stacks for its own
+    protection.
+
+    The option is available when `CONFIG_XEN_SHSTK` is compiled in, and
+    defaults to `true` on hardware supporting CET-SS.  Specifying
+    `cet=no-shstk` will cause Xen not to use Shadow Stacks even when support
+    is available in hardware.
+
 ### clocksource (x86)
 > `= pit | hpet | acpi | tsc`
 
diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index b565f6831d..4a2ec87ff5 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -34,6 +34,10 @@ config ARCH_DEFCONFIG
 config INDIRECT_THUNK
 	def_bool $(cc-option,-mindirect-branch-register)
 
+config HAS_AS_CET_SS
+	# binutils >= 2.29 or LLVM >= 6
+	def_bool $(as-instr,wrssq %rax$(comma)0;setssbsy)
+
 menu "Architecture Features"
 
 source "arch/Kconfig"
@@ -97,6 +101,20 @@ config HVM
 
 	  If unsure, say Y.
 
+config XEN_SHSTK
+	bool "Supervisor Shadow Stacks"
+	depends on HAS_AS_CET_SS && EXPERT
+	default y
+	---help---
+	  Control-flow Enforcement Technology (CET) is a set of features in
+	  hardware designed to combat Return-oriented Programming (ROP, also
+	  call/jump COP/JOP) attacks.  Shadow Stacks are one CET feature
+	  designed to provide return address protection.
+
+	  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.
+
 config SHADOW_PAGING
         bool "Shadow Paging"
         default y
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 2dec7a3fc6..584589baff 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -95,6 +95,36 @@ unsigned long __initdata highmem_start;
 size_param("highmem-start", highmem_start);
 #endif
 
+static bool __initdata opt_xen_shstk = true;
+
+static int __init parse_cet(const char *s)
+{
+    const char *ss;
+    int val, rc = 0;
+
+    do {
+        ss = strchr(s, ',');
+        if ( !ss )
+            ss = strchr(s, '\0');
+
+        if ( (val = parse_boolean("shstk", s, ss)) >= 0 )
+        {
+#ifdef CONFIG_XEN_SHSTK
+            opt_xen_shstk = val;
+#else
+            no_config_param("XEN_SHSTK", "cet", s, ss);
+#endif
+        }
+        else
+            rc = -EINVAL;
+
+        s = ss + 1;
+    } while ( *ss );
+
+    return rc;
+}
+custom_param("cet", parse_cet);
+
 cpumask_t __read_mostly cpu_present_map;
 
 unsigned long __read_mostly xen_phys_start;
diff --git a/xen/include/asm-x86/cpufeature.h b/xen/include/asm-x86/cpufeature.h
index 025f29e83e..f790d5c1f8 100644
--- a/xen/include/asm-x86/cpufeature.h
+++ b/xen/include/asm-x86/cpufeature.h
@@ -140,6 +140,7 @@
 #define cpu_has_aperfmperf      boot_cpu_has(X86_FEATURE_APERFMPERF)
 #define cpu_has_lfence_dispatch boot_cpu_has(X86_FEATURE_LFENCE_DISPATCH)
 #define cpu_has_xen_lbr         boot_cpu_has(X86_FEATURE_XEN_LBR)
+#define cpu_has_xen_shstk       boot_cpu_has(X86_FEATURE_XEN_SHSTK)
 
 #define cpu_has_msr_tsc_aux     (cpu_has_rdtscp || cpu_has_rdpid)
 
diff --git a/xen/include/asm-x86/cpufeatures.h b/xen/include/asm-x86/cpufeatures.h
index b9d3cac975..d7e42d9bb6 100644
--- a/xen/include/asm-x86/cpufeatures.h
+++ b/xen/include/asm-x86/cpufeatures.h
@@ -38,6 +38,7 @@ XEN_CPUFEATURE(XEN_LBR,           X86_SYNTH(22)) /* Xen uses MSR_DEBUGCTL.LBR */
 XEN_CPUFEATURE(SC_VERW_PV,        X86_SYNTH(23)) /* VERW used by Xen for PV */
 XEN_CPUFEATURE(SC_VERW_HVM,       X86_SYNTH(24)) /* VERW used by Xen for HVM */
 XEN_CPUFEATURE(SC_VERW_IDLE,      X86_SYNTH(25)) /* VERW used by Xen for idle */
+XEN_CPUFEATURE(XEN_SHSTK,         X86_SYNTH(26)) /* Xen uses CET Shadow Stacks */
 
 /* Bug words follow the synthetic words. */
 #define X86_NR_BUG 1
diff --git a/xen/scripts/Kconfig.include b/xen/scripts/Kconfig.include
index 8221095ca3..e1f13e1720 100644
--- a/xen/scripts/Kconfig.include
+++ b/xen/scripts/Kconfig.include
@@ -31,6 +31,10 @@ cc-option = $(success,$(CC) -Werror $(CLANG_FLAGS) $(1) -E -x c /dev/null -o /de
 # Return y if the linker supports <flag>, n otherwise
 ld-option = $(success,$(LD) -v $(1))
 
+# $(as-instr,<instr>)
+# Return y if the assembler supports <instr>, n otherwise
+as-instr = $(success,printf "%b\n" "$(1)" | $(CC) $(CLANG_FLAGS) -c -x assembler -o /dev/null -)
+
 # check if $(CC) and $(LD) exist
 $(error-if,$(failure,command -v $(CC)),compiler '$(CC)' not found)
 $(error-if,$(failure,command -v $(LD)),linker '$(LD)' not found)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:04:11 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:04: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 1jhinL-0008A4-NG; Sun, 07 Jun 2020 00:04:11 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhinK-00089k-5J
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:04:10 +0000
X-Inumbo-ID: 692b348c-a852-11ea-b15b-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 692b348c-a852-11ea-b15b-12813bfff9fa;
 Sun, 07 Jun 2020 00:04:09 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=Sxvw6OnmZ9CDye4YuxBBax0BI8FRBM0lZWDELfdFGKE=; b=IEaY4+jfu0lCu0KZzzLHNg7wTu
 OMnnoPHuEJxMLQvec6DfEKyiL5q3BHkrfoezfpoJ71O+aNBER9SrbBYhkJcpFqFprADxNIXet48/a
 cW8oZX7yFCPxwk1nv1ZxD7l5DLI61QaN6RiSlEglQofAq8uUuC9KKMRztwNgRKVOEONs=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhinJ-0003O1-9H
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:04:09 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhinJ-0001tz-8h
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:04:09 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/traps: Implement #CP handler and extend #PF for
 shadow stacks
Message-Id: <E1jhinJ-0001tz-8h@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:04:09 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 5ad05b9c249060fb0f8e8afb9215b08f04579f17
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 21 17:56:57 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri May 29 23:09:46 2020 +0100

    x86/traps: Implement #CP handler and extend #PF for shadow stacks
    
    For now, any #CP exception or shadow stack #PF indicate a bug in Xen, but
    attempt to recover from #CP if taken in guest context.
    
    This will of course have to change as part of introducing CET-SS support for
    PV guests.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/traps.c            | 46 ++++++++++++++++++++++++++++++++++++++++-
 xen/arch/x86/x86_64/entry.S     |  7 ++++++-
 xen/include/asm-x86/processor.h |  2 ++
 3 files changed, 53 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index eeb3e146ef..7477bd93cc 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -156,7 +156,9 @@ void (* const exception_table[TRAP_nr])(struct cpu_user_regs *regs) = {
     [TRAP_alignment_check]              = do_trap,
     [TRAP_machine_check]                = (void *)do_machine_check,
     [TRAP_simd_error]                   = do_trap,
-    [TRAP_virtualisation ...
+    [TRAP_virtualisation]               = do_reserved_trap,
+    [X86_EXC_CP]                        = do_entry_CP,
+    [X86_EXC_CP + 1 ...
      (ARRAY_SIZE(exception_table) - 1)] = do_reserved_trap,
 };
 
@@ -1431,6 +1433,10 @@ void do_page_fault(struct cpu_user_regs *regs)
 
     perfc_incr(page_faults);
 
+    /* Any shadow stack access fault is a bug in Xen. */
+    if ( error_code & PFEC_shstk )
+        goto fatal;
+
     if ( unlikely(fixup_page_fault(addr, regs) != 0) )
         return;
 
@@ -1898,6 +1904,43 @@ void do_debug(struct cpu_user_regs *regs)
     pv_inject_hw_exception(TRAP_debug, X86_EVENT_NO_EC);
 }
 
+void do_entry_CP(struct cpu_user_regs *regs)
+{
+    static const char errors[][10] = {
+        [1] = "near ret",
+        [2] = "far/iret",
+        [3] = "endbranch",
+        [4] = "rstorssp",
+        [5] = "setssbsy",
+    };
+    const char *err = "??";
+    unsigned int ec = regs->error_code;
+
+    if ( debugger_trap_entry(TRAP_debug, regs) )
+        return;
+
+    /* Decode ec if possible */
+    if ( ec < ARRAY_SIZE(errors) && errors[ec][0] )
+        err = errors[ec];
+
+    /*
+     * For now, only supervisors shadow stacks should be active.  A #CP from
+     * guest context is probably a Xen bug, but kill the guest in an attempt
+     * to recover.
+     */
+    if ( guest_mode(regs) )
+    {
+        gprintk(XENLOG_ERR, "Hit #CP[%04x] in guest context %04x:%p\n",
+                ec, regs->cs, _p(regs->rip));
+        ASSERT_UNREACHABLE();
+        domain_crash(current->domain);
+        return;
+    }
+
+    show_execution_state(regs);
+    panic("CONTROL-FLOW PROTECTION FAULT: #CP[%04x] %s\n", ec, err);
+}
+
 static void __init noinline __set_intr_gate(unsigned int n,
                                             uint32_t dpl, void *addr)
 {
@@ -1987,6 +2030,7 @@ void __init init_idt_traps(void)
     set_intr_gate(TRAP_alignment_check,&alignment_check);
     set_intr_gate(TRAP_machine_check,&machine_check);
     set_intr_gate(TRAP_simd_error,&simd_coprocessor_error);
+    set_intr_gate(X86_EXC_CP, entry_CP);
 
     /* Specify dedicated interrupt stacks for NMI, #DF, and #MC. */
     enable_each_ist(idt_table);
diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index d55453f3f3..f7ee3dce91 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -795,6 +795,10 @@ ENTRY(alignment_check)
         movl  $TRAP_alignment_check,4(%rsp)
         jmp   handle_exception
 
+ENTRY(entry_CP)
+        movl  $X86_EXC_CP, 4(%rsp)
+        jmp   handle_exception
+
 ENTRY(double_fault)
         movl  $TRAP_double_fault,4(%rsp)
         /* Set AC to reduce chance of further SMAP faults */
@@ -940,7 +944,8 @@ autogen_stubs: /* Automatically generated stubs. */
         entrypoint 1b
 
         /* Reserved exceptions, heading towards do_reserved_trap(). */
-        .elseif vec == TRAP_copro_seg || vec == TRAP_spurious_int || (vec > TRAP_simd_error && vec < TRAP_nr)
+        .elseif vec == X86_EXC_CSO || vec == X86_EXC_SPV || \
+                vec == X86_EXC_VE  || (vec > X86_EXC_CP && vec < TRAP_nr)
 
 1:      test  $8,%spl        /* 64bit exception frames are 16 byte aligned, but the word */
         jz    2f             /* size is 8 bytes.  Check whether the processor gave us an */
diff --git a/xen/include/asm-x86/processor.h b/xen/include/asm-x86/processor.h
index a3d72b26ef..73354b10d2 100644
--- a/xen/include/asm-x86/processor.h
+++ b/xen/include/asm-x86/processor.h
@@ -68,6 +68,7 @@
 #define PFEC_reserved_bit   (_AC(1,U) << 3)
 #define PFEC_insn_fetch     (_AC(1,U) << 4)
 #define PFEC_prot_key       (_AC(1,U) << 5)
+#define PFEC_shstk          (_AC(1,U) << 6)
 #define PFEC_arch_mask      (_AC(0xffff,U)) /* Architectural PFEC values. */
 /* Internally used only flags. */
 #define PFEC_page_paged     (1U<<16)
@@ -535,6 +536,7 @@ DECLARE_TRAP_HANDLER(coprocessor_error);
 DECLARE_TRAP_HANDLER(simd_coprocessor_error);
 DECLARE_TRAP_HANDLER_CONST(machine_check);
 DECLARE_TRAP_HANDLER(alignment_check);
+DECLARE_TRAP_HANDLER(entry_CP);
 
 DECLARE_TRAP_HANDLER(entry_int82);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:04:21 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:04:21 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jhinV-0008B7-P5; Sun, 07 Jun 2020 00:04:21 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhinU-0008At-F7
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:04:20 +0000
X-Inumbo-ID: 6f322282-a852-11ea-96fb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 6f322282-a852-11ea-96fb-bc764e2007e4;
 Sun, 07 Jun 2020 00:04:19 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=1A0wUyt1AE1jBPPz4389vS3vBjCkqdUh4uw2HQ9Vagg=; b=Z2ORAJTixnAnBhVrZapEem3Z9W
 MJqqGOXalRQtdqtPfvS8pGYad9jh30J8jHkrTDYkGZqnCgVMjETx8yokdirndpgmoW602Xa2d4q6b
 +t5VgEu/sK7RS7VUZ+34m984ebkDcLgI7N9YaQTrCtNkxAJg7qqDATBvrzc29OVqZ9Vc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhinT-0003OA-Cu
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:04:19 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhinT-0001ux-CC
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:04:19 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/shstk: Rework the stack layout to support shadow
 stacks
Message-Id: <E1jhinT-0001ux-CC@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:04:19 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 60016604739be61faf7196637739763d01a88a48
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Apr 23 20:20:59 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri May 29 23:09:46 2020 +0100

    x86/shstk: Rework the stack layout to support shadow stacks
    
    We have two free pages in the current stack.  A useful property of shadow
    stacks and regular stacks is that they act as each others guard pages as far
    as OoB writes go.  As wild OoB stack reads aren't likely, we don't lose any
    meaningful protection from using read-only guard pages in general (rather than
    non-present guard pages), but result is far simpler for Xen as a whole by not
    having a feature/mode dependent stack configuration.
    
    Move the regular IST stacks up by one page, to allow their shadow stack page
    to be in slot 0.  The primary shadow stack uses slot 5.
    
    As the shadow IST stacks are only 1k large, shuffle the order of IST vectors
    to have #DF numerically highest, so there is no chance of a shadow stack
    overflow clobbering the supervisor token.
    
    The XPTI code already breaks the MEMORY_GUARD abstraction for stacks by
    forcing it to be in effect (i.e. guard page not present).  To avoid having too
    many configurations, do away with the concept entirely, and unconditionally
    map the pages in their read-only form.
    
    A later change will turn these properly into shadow stacks.  Some of the
    comments written here are the intended result, and will become true in the
    subsequent change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/cpu/common.c       | 10 +++++-----
 xen/arch/x86/mm.c               | 19 ++++++-------------
 xen/arch/x86/smpboot.c          |  3 +--
 xen/arch/x86/traps.c            | 23 ++++++-----------------
 xen/include/asm-x86/config.h    |  3 +++
 xen/include/asm-x86/current.h   | 12 ++++++------
 xen/include/asm-x86/mm.h        |  1 -
 xen/include/asm-x86/processor.h |  6 +++---
 8 files changed, 30 insertions(+), 47 deletions(-)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 09b911b3ba..690fd8baa8 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -753,14 +753,14 @@ void load_system_tables(void)
 	 * valid on every instruction boundary.  (Note: these are all
 	 * semantically ACCESS_ONCE() due to tss's volatile qualifier.)
 	 *
-	 * rsp0 refers to the primary stack.  #MC, #DF, NMI and #DB handlers
+	 * rsp0 refers to the primary stack.  #MC, NMI, #DB and #DF handlers
 	 * each get their own stacks.  No IO Bitmap.
 	 */
 	tss->rsp0 = stack_bottom;
-	tss->ist[IST_MCE - 1] = stack_top + IST_MCE * PAGE_SIZE;
-	tss->ist[IST_DF  - 1] = stack_top + IST_DF  * PAGE_SIZE;
-	tss->ist[IST_NMI - 1] = stack_top + IST_NMI * PAGE_SIZE;
-	tss->ist[IST_DB  - 1] = stack_top + IST_DB  * PAGE_SIZE;
+	tss->ist[IST_MCE - 1] = stack_top + (1 + IST_MCE) * PAGE_SIZE;
+	tss->ist[IST_NMI - 1] = stack_top + (1 + IST_NMI) * PAGE_SIZE;
+	tss->ist[IST_DB  - 1] = stack_top + (1 + IST_DB)  * PAGE_SIZE;
+	tss->ist[IST_DF  - 1] = stack_top + (1 + IST_DF)  * PAGE_SIZE;
 	tss->bitmap = IOBMP_INVALID_OFFSET;
 
 	/* All other stack pointers poisioned. */
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 54980b4eb1..5468651876 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -5997,25 +5997,18 @@ void memguard_unguard_range(void *p, unsigned long l)
 
 void memguard_guard_stack(void *p)
 {
-    /* IST_MAX IST pages + at least 1 guard page + primary stack. */
-    BUILD_BUG_ON((IST_MAX + 1) * PAGE_SIZE + PRIMARY_STACK_SIZE > STACK_SIZE);
+    map_pages_to_xen((unsigned long)p, virt_to_mfn(p), 1, _PAGE_NONE);
 
-    memguard_guard_range(p + IST_MAX * PAGE_SIZE,
-                         STACK_SIZE - PRIMARY_STACK_SIZE - IST_MAX * PAGE_SIZE);
+    p += PRIMARY_SHSTK_SLOT * PAGE_SIZE;
+    map_pages_to_xen((unsigned long)p, virt_to_mfn(p), 1, _PAGE_NONE);
 }
 
 void memguard_unguard_stack(void *p)
 {
-    memguard_unguard_range(p + IST_MAX * PAGE_SIZE,
-                           STACK_SIZE - PRIMARY_STACK_SIZE - IST_MAX * PAGE_SIZE);
-}
-
-bool memguard_is_stack_guard_page(unsigned long addr)
-{
-    addr &= STACK_SIZE - 1;
+    map_pages_to_xen((unsigned long)p, virt_to_mfn(p), 1, PAGE_HYPERVISOR_RW);
 
-    return addr >= IST_MAX * PAGE_SIZE &&
-           addr < STACK_SIZE - PRIMARY_STACK_SIZE;
+    p += PRIMARY_SHSTK_SLOT * PAGE_SIZE;
+    map_pages_to_xen((unsigned long)p, virt_to_mfn(p), 1, PAGE_HYPERVISOR_RW);
 }
 
 void arch_dump_shared_mem_info(void)
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index 170ab24e66..13b3dade9c 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -823,8 +823,7 @@ static int setup_cpu_root_pgt(unsigned int cpu)
 
     /* Install direct map page table entries for stack, IDT, and TSS. */
     for ( off = rc = 0; !rc && off < STACK_SIZE; off += PAGE_SIZE )
-        if ( !memguard_is_stack_guard_page(off) )
-            rc = clone_mapping(__va(__pa(stack_base[cpu])) + off, rpt);
+        rc = clone_mapping(__va(__pa(stack_base[cpu])) + off, rpt);
 
     if ( !rc )
         rc = clone_mapping(idt_tables[cpu], rpt);
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 7477bd93cc..39a1f35bc1 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -365,20 +365,15 @@ static void show_guest_stack(struct vcpu *v, const struct cpu_user_regs *regs)
 /*
  * Notes for get_stack_trace_bottom() and get_stack_dump_bottom()
  *
- * Stack pages 0 - 3:
+ * Stack pages 1 - 4:
  *   These are all 1-page IST stacks.  Each of these stacks have an exception
  *   frame and saved register state at the top.  The interesting bound for a
  *   trace is the word adjacent to this, while the bound for a dump is the
  *   very top, including the exception frame.
  *
- * Stack pages 4 and 5:
- *   None of these are particularly interesting.  With MEMORY_GUARD, page 5 is
- *   explicitly not present, so attempting to dump or trace it is
- *   counterproductive.  Without MEMORY_GUARD, it is possible for a call chain
- *   to use the entire primary stack and wander into page 5.  In this case,
- *   consider these pages an extension of the primary stack to aid debugging
- *   hopefully rare situations where the primary stack has effective been
- *   overflown.
+ * Stack pages 0 and 5:
+ *   Shadow stacks.  These are mapped read-only, and used by CET-SS capable
+ *   processors.  They will never contain regular stack data.
  *
  * Stack pages 6 and 7:
  *   These form the primary stack, and have a cpu_info at the top.  For a
@@ -392,13 +387,10 @@ unsigned long get_stack_trace_bottom(unsigned long sp)
 {
     switch ( get_stack_page(sp) )
     {
-    case 0 ... 3:
+    case 1 ... 4:
         return ROUNDUP(sp, PAGE_SIZE) -
             offsetof(struct cpu_user_regs, es) - sizeof(unsigned long);
 
-#ifndef MEMORY_GUARD
-    case 4 ... 5:
-#endif
     case 6 ... 7:
         return ROUNDUP(sp, STACK_SIZE) -
             sizeof(struct cpu_info) - sizeof(unsigned long);
@@ -412,12 +404,9 @@ unsigned long get_stack_dump_bottom(unsigned long sp)
 {
     switch ( get_stack_page(sp) )
     {
-    case 0 ... 3:
+    case 1 ... 4:
         return ROUNDUP(sp, PAGE_SIZE) - sizeof(unsigned long);
 
-#ifndef MEMORY_GUARD
-    case 4 ... 5:
-#endif
     case 6 ... 7:
         return ROUNDUP(sp, STACK_SIZE) - sizeof(unsigned long);
 
diff --git a/xen/include/asm-x86/config.h b/xen/include/asm-x86/config.h
index 266d281718..f3cf5df462 100644
--- a/xen/include/asm-x86/config.h
+++ b/xen/include/asm-x86/config.h
@@ -75,6 +75,9 @@
 /* Primary stack is restricted to 8kB by guard pages. */
 #define PRIMARY_STACK_SIZE 8192
 
+/* Primary shadow stack is slot 5 of 8, immediately under the primary stack. */
+#define PRIMARY_SHSTK_SLOT 5
+
 /* Total size of syscall and emulation stubs. */
 #define STUB_BUF_SHIFT (L1_CACHE_SHIFT > 7 ? L1_CACHE_SHIFT : 7)
 #define STUB_BUF_SIZE  (1 << STUB_BUF_SHIFT)
diff --git a/xen/include/asm-x86/current.h b/xen/include/asm-x86/current.h
index 5b8f4dbc79..99b66a0087 100644
--- a/xen/include/asm-x86/current.h
+++ b/xen/include/asm-x86/current.h
@@ -16,12 +16,12 @@
  *
  * 7 - Primary stack (with a struct cpu_info at the top)
  * 6 - Primary stack
- * 5 - Optionally not present (MEMORY_GUARD)
- * 4 - Unused; optionally not present (MEMORY_GUARD)
- * 3 - Unused; optionally not present (MEMORY_GUARD)
- * 2 - MCE IST stack
- * 1 - NMI IST stack
- * 0 - Double Fault IST stack
+ * 5 - Primay Shadow Stack (read-only)
+ * 4 - #DF IST stack
+ * 3 - #DB IST stack
+ * 2 - NMI IST stack
+ * 1 - #MC IST stack
+ * 0 - IST Shadow Stacks (4x 1k, read-only)
  */
 
 /*
diff --git a/xen/include/asm-x86/mm.h b/xen/include/asm-x86/mm.h
index 3d3f9d49ac..7e74996053 100644
--- a/xen/include/asm-x86/mm.h
+++ b/xen/include/asm-x86/mm.h
@@ -536,7 +536,6 @@ void memguard_unguard_range(void *p, unsigned long l);
 
 void memguard_guard_stack(void *p);
 void memguard_unguard_stack(void *p);
-bool __attribute_const__ memguard_is_stack_guard_page(unsigned long addr);
 
 struct mmio_ro_emulate_ctxt {
         unsigned long cr2;
diff --git a/xen/include/asm-x86/processor.h b/xen/include/asm-x86/processor.h
index 73354b10d2..67119fb5c5 100644
--- a/xen/include/asm-x86/processor.h
+++ b/xen/include/asm-x86/processor.h
@@ -445,10 +445,10 @@ struct tss_page {
 DECLARE_PER_CPU(struct tss_page, tss_page);
 
 #define IST_NONE 0UL
-#define IST_DF   1UL
+#define IST_MCE  1UL
 #define IST_NMI  2UL
-#define IST_MCE  3UL
-#define IST_DB   4UL
+#define IST_DB   3UL
+#define IST_DF   4UL
 #define IST_MAX  4UL
 
 /* Set the Interrupt Stack Table used by a particular IDT entry. */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:04:31 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:04:31 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jhinf-0008C5-Qs; Sun, 07 Jun 2020 00:04:31 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhine-0008Bs-BH
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:04:30 +0000
X-Inumbo-ID: 7537c3f8-a852-11ea-9ad7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 7537c3f8-a852-11ea-9ad7-bc764e2007e4;
 Sun, 07 Jun 2020 00:04:29 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To: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+4Dp2iG6A0Qi6oD8rOTR4ZL0qWlrnvNM8PqUuNAze0=; b=cWqRPJ1cDqvlBdt6Qh6JQoKZ7u
 u/X20z6x6E8UdcVqsd4dkHNxpjGF9Mi1imBy8wZQPqh8FETiajZe3YxbkVypMuujH0K/BBXx6S67x
 SzZ2U7Nh+U0dwfWFpc+aGYoyVY1YEaltAuP5nTMd+TLQjUpu+kLchJPztWNmes6HIRpg=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhind-0003Oy-GW
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:04:29 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhind-0001vx-Fd
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:04:29 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/shstk: Create shadow stacks
Message-Id: <E1jhind-0001vx-Fd@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:04:29 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 91d26ed304ff562f341824be12bf49bd78c39e39
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Apr 23 20:20:59 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri May 29 23:09:46 2020 +0100

    x86/shstk: Create shadow stacks
    
    Introduce HYPERVISOR_SHSTK pagetable constants, which are Read-Only + Dirty.
    Use these in place of _PAGE_RW for memguard_guard_stack(), to create real
    shadow stacks on capable hardware.
    
    Supervisor shadow stacks need a token written at the top, which is most easily
    done before making the frame read only.
    
    Allocate the shadow IST stack block in struct tss_page.  It doesn't strictly
    need to live here, but it is a convenient location (and XPTI-safe, for testing
    purposes), and placing it ahead of the TSS doesn't risk colliding with a bad
    IO Bitmap offset and turning into some IO port permissions.
    
    Have load_system_tables() set up the shadow IST stack table when setting up
    the regular IST in the TSS.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/cpu/common.c         | 23 +++++++++++++++++++++++
 xen/arch/x86/mm.c                 | 25 +++++++++++++++++++++++--
 xen/include/asm-x86/config.h      |  2 ++
 xen/include/asm-x86/page.h        |  1 +
 xen/include/asm-x86/processor.h   |  3 ++-
 xen/include/asm-x86/x86_64/page.h |  1 +
 6 files changed, 52 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 690fd8baa8..f483c81b7c 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -769,6 +769,29 @@ void load_system_tables(void)
 	tss->rsp1 = 0x8600111111111111ul;
 	tss->rsp2 = 0x8600111111111111ul;
 
+	/*
+	 * Set up the shadow stack IST.  Used entries must point at the
+	 * supervisor stack token.  Unused entries are poisoned.
+	 *
+	 * This IST Table may be live, and the NMI/#MC entries must
+	 * remain valid on every instruction boundary, hence the
+	 * volatile qualifier.
+	 */
+	if (cpu_has_xen_shstk) {
+		volatile uint64_t *ist_ssp = this_cpu(tss_page).ist_ssp;
+
+		ist_ssp[0] = 0x8600111111111111ul;
+		ist_ssp[IST_MCE] = stack_top + (IST_MCE * IST_SHSTK_SIZE) - 8;
+		ist_ssp[IST_NMI] = stack_top + (IST_NMI * IST_SHSTK_SIZE) - 8;
+		ist_ssp[IST_DB]	 = stack_top + (IST_DB	* IST_SHSTK_SIZE) - 8;
+		ist_ssp[IST_DF]	 = stack_top + (IST_DF	* IST_SHSTK_SIZE) - 8;
+		for ( i = IST_DF + 1;
+		      i < ARRAY_SIZE(this_cpu(tss_page).ist_ssp); ++i )
+			ist_ssp[i] = 0x8600111111111111ul;
+
+		wrmsrl(MSR_INTERRUPT_SSP_TABLE, (unsigned long)ist_ssp);
+	}
+
 	BUILD_BUG_ON(sizeof(*tss) <= 0x67); /* Mandated by the architecture. */
 
 	_set_tssldt_desc(gdt + TSS_ENTRY, (unsigned long)tss,
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 5468651876..c9847043db 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -5995,12 +5995,33 @@ void memguard_unguard_range(void *p, unsigned long l)
 
 #endif
 
+static void write_sss_token(unsigned long *ptr)
+{
+    /*
+     * A supervisor shadow stack token is its own linear address, with the
+     * busy bit (0) clear.
+     */
+    *ptr = (unsigned long)ptr;
+}
+
 void memguard_guard_stack(void *p)
 {
-    map_pages_to_xen((unsigned long)p, virt_to_mfn(p), 1, _PAGE_NONE);
+    /* IST Shadow stacks.  4x 1k in stack page 0. */
+    if ( IS_ENABLED(CONFIG_XEN_SHSTK) )
+    {
+        write_sss_token(p + (IST_MCE * IST_SHSTK_SIZE) - 8);
+        write_sss_token(p + (IST_NMI * IST_SHSTK_SIZE) - 8);
+        write_sss_token(p + (IST_DB  * IST_SHSTK_SIZE) - 8);
+        write_sss_token(p + (IST_DF  * IST_SHSTK_SIZE) - 8);
+    }
+    map_pages_to_xen((unsigned long)p, virt_to_mfn(p), 1, PAGE_HYPERVISOR_SHSTK);
 
+    /* Primary Shadow Stack.  1x 4k in stack page 5. */
     p += PRIMARY_SHSTK_SLOT * PAGE_SIZE;
-    map_pages_to_xen((unsigned long)p, virt_to_mfn(p), 1, _PAGE_NONE);
+    if ( IS_ENABLED(CONFIG_XEN_SHSTK) )
+        write_sss_token(p + PAGE_SIZE - 8);
+
+    map_pages_to_xen((unsigned long)p, virt_to_mfn(p), 1, PAGE_HYPERVISOR_SHSTK);
 }
 
 void memguard_unguard_stack(void *p)
diff --git a/xen/include/asm-x86/config.h b/xen/include/asm-x86/config.h
index f3cf5df462..2ba234383d 100644
--- a/xen/include/asm-x86/config.h
+++ b/xen/include/asm-x86/config.h
@@ -66,6 +66,8 @@
 #define STACK_ORDER 3
 #define STACK_SIZE  (PAGE_SIZE << STACK_ORDER)
 
+#define IST_SHSTK_SIZE 1024
+
 #define TRAMPOLINE_STACK_SPACE  PAGE_SIZE
 #define TRAMPOLINE_SPACE        (KB(64) - TRAMPOLINE_STACK_SPACE)
 #define WAKEUP_STACK_MIN        3072
diff --git a/xen/include/asm-x86/page.h b/xen/include/asm-x86/page.h
index 5acf3d3d5a..f632affaef 100644
--- a/xen/include/asm-x86/page.h
+++ b/xen/include/asm-x86/page.h
@@ -364,6 +364,7 @@ void efi_update_l4_pgtable(unsigned int l4idx, l4_pgentry_t);
                                    _PAGE_DIRTY | _PAGE_RW)
 #define __PAGE_HYPERVISOR_UCMINUS (__PAGE_HYPERVISOR | _PAGE_PCD)
 #define __PAGE_HYPERVISOR_UC      (__PAGE_HYPERVISOR | _PAGE_PCD | _PAGE_PWT)
+#define __PAGE_HYPERVISOR_SHSTK   (__PAGE_HYPERVISOR_RO | _PAGE_DIRTY)
 
 #define MAP_SMALL_PAGES _PAGE_AVAIL0 /* don't use superpages mappings */
 
diff --git a/xen/include/asm-x86/processor.h b/xen/include/asm-x86/processor.h
index 67119fb5c5..fcd0605786 100644
--- a/xen/include/asm-x86/processor.h
+++ b/xen/include/asm-x86/processor.h
@@ -440,7 +440,8 @@ struct __packed tss64 {
     uint16_t :16, bitmap;
 };
 struct tss_page {
-    struct tss64 __aligned(PAGE_SIZE) tss;
+    uint64_t __aligned(PAGE_SIZE) ist_ssp[8];
+    struct tss64 tss;
 };
 DECLARE_PER_CPU(struct tss_page, tss_page);
 
diff --git a/xen/include/asm-x86/x86_64/page.h b/xen/include/asm-x86/x86_64/page.h
index 9876634881..26621f9519 100644
--- a/xen/include/asm-x86/x86_64/page.h
+++ b/xen/include/asm-x86/x86_64/page.h
@@ -171,6 +171,7 @@ static inline intpte_t put_pte_flags(unsigned int x)
 #define PAGE_HYPERVISOR_RW      (__PAGE_HYPERVISOR_RW      | _PAGE_GLOBAL)
 #define PAGE_HYPERVISOR_RX      (__PAGE_HYPERVISOR_RX      | _PAGE_GLOBAL)
 #define PAGE_HYPERVISOR_RWX     (__PAGE_HYPERVISOR         | _PAGE_GLOBAL)
+#define PAGE_HYPERVISOR_SHSTK   (__PAGE_HYPERVISOR_SHSTK   | _PAGE_GLOBAL)
 
 #define PAGE_HYPERVISOR         PAGE_HYPERVISOR_RW
 #define PAGE_HYPERVISOR_UCMINUS (__PAGE_HYPERVISOR_UCMINUS | \
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:04:40 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:04: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 1jhino-0008DG-UB; Sun, 07 Jun 2020 00:04:40 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhino-0008D6-97
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:04:40 +0000
X-Inumbo-ID: 7b3d40fc-a852-11ea-b15b-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 7b3d40fc-a852-11ea-b15b-12813bfff9fa;
 Sun, 07 Jun 2020 00:04:39 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=RAapHVxLNSW/ri6rJ9fHR8qPxGMPwLD7s92+PPGRP/8=; b=bywtz3jOMitzB9qVsn4kRVxv6Z
 O6jWOHGexPhZlNAo9XWT/ynH+DpuIHgpeArhPwQTTUK+Op9HcYAlvrpDccKcfP2Bbr70ly0VSnkAq
 dBIl/JUAIVcYAFSQP9YcvgN95qLygXH+/bRS7L2TFibz7FDb46eJxgf4nqb2eywIo0SQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhinn-0003PD-JS
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:04:39 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhinn-0001wx-Ip
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:04:39 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/cpu: Adjust enable_nmis() to be shadow stack
 compatible
Message-Id: <E1jhinn-0001wx-Ip@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:04:39 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit e952f1d67b5641bb560fbff6b80555808faf7935
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 21 17:56:57 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri May 29 23:09:46 2020 +0100

    x86/cpu: Adjust enable_nmis() to be shadow stack compatible
    
    When executing an IRET-to-self, the shadow stack must agree with the regular
    stack.  We can't manipulate SSP directly, so have to fake a shadow IRET frame
    by executing 3 CALLs, then editing the result to look correct.
    
    This is not a fastpath, is called on the BSP long before CET can be set up,
    and may be called on the crash path after CET is disabled.  Use the fact that
    INCSSP is allocated from the hint nop space to construct a test for CET being
    active which is safe on all processors.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/asm-x86/processor.h | 43 +++++++++++++++++++++++++++++++----------
 1 file changed, 33 insertions(+), 10 deletions(-)

diff --git a/xen/include/asm-x86/processor.h b/xen/include/asm-x86/processor.h
index fcd0605786..9acb80fdcd 100644
--- a/xen/include/asm-x86/processor.h
+++ b/xen/include/asm-x86/processor.h
@@ -550,17 +550,40 @@ static inline void enable_nmis(void)
 {
     unsigned long tmp;
 
-    asm volatile ( "mov %%rsp, %[tmp]     \n\t"
-                   "push %[ss]            \n\t"
-                   "push %[tmp]           \n\t"
-                   "pushf                 \n\t"
-                   "push %[cs]            \n\t"
-                   "lea 1f(%%rip), %[tmp] \n\t"
-                   "push %[tmp]           \n\t"
-                   "iretq; 1:             \n\t"
-                   : [tmp] "=&r" (tmp)
+    asm volatile ( "mov     %%rsp, %[rsp]        \n\t"
+                   "lea    .Ldone(%%rip), %[rip] \n\t"
+#ifdef CONFIG_XEN_SHSTK
+                   /* Check for CET-SS being active. */
+                   "mov    $1, %k[ssp]           \n\t"
+                   "rdsspq %[ssp]                \n\t"
+                   "cmp    $1, %k[ssp]           \n\t"
+                   "je     .Lshstk_done          \n\t"
+
+                   /* Push 3 words on the shadow stack */
+                   ".rept 3                      \n\t"
+                   "call 1f; nop; 1:             \n\t"
+                   ".endr                        \n\t"
+
+                   /* Fixup to be an IRET shadow stack frame */
+                   "wrssq  %q[cs], -1*8(%[ssp])  \n\t"
+                   "wrssq  %[rip], -2*8(%[ssp])  \n\t"
+                   "wrssq  %[ssp], -3*8(%[ssp])  \n\t"
+
+                   ".Lshstk_done:"
+#endif
+                   /* Write an IRET regular frame */
+                   "push   %[ss]                 \n\t"
+                   "push   %[rsp]                \n\t"
+                   "pushf                        \n\t"
+                   "push   %q[cs]                \n\t"
+                   "push   %[rip]                \n\t"
+                   "iretq                        \n\t"
+                   ".Ldone:                      \n\t"
+                   : [rip] "=&r" (tmp),
+                     [rsp] "=&r" (tmp),
+                     [ssp] "=&r" (tmp)
                    : [ss] "i" (__HYPERVISOR_DS),
-                     [cs] "i" (__HYPERVISOR_CS) );
+                     [cs] "r" (__HYPERVISOR_CS) );
 }
 
 void sysenter_entry(void);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:04:51 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:04:51 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jhiny-0008Ep-Vh; Sun, 07 Jun 2020 00:04:50 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhiny-0008Ef-AQ
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:04:50 +0000
X-Inumbo-ID: 8140c1e0-a852-11ea-9ad7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 8140c1e0-a852-11ea-9ad7-bc764e2007e4;
 Sun, 07 Jun 2020 00:04:49 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=XYeBRuCsB5ZvGEKXvi0Ty7hxaY3ckJJ0U4WAwnAJHkA=; b=FkseztNpaKLS1uHsXkmTBM8EtX
 FINvwpNh8F/oVgEU/H4COBmTvEmvDO0v+gloOq5UFIXX/f/X/WQZAyvBqlMOMNKi2Ae51o0WxiUIN
 yAIqn08vwPrie7yH7NNal+Yj82khAiuvr5I9LDxU8n/KsoWnkphP3dlPKA8URTPFs7gE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhinx-0003PM-MM
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:04:49 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhinx-0001xy-Lg
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:04:49 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/cpu: Adjust reset_stack_and_jump() to be shadow
 stack compatible
Message-Id: <E1jhinx-0001xy-Lg@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:04:49 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 18533cfc919172d0df8ce387ffc8e495f7077ee5
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Apr 24 14:38:02 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri May 29 23:09:46 2020 +0100

    x86/cpu: Adjust reset_stack_and_jump() to be shadow stack compatible
    
    We need to unwind up to the supervisor token.  See the comment for details.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/asm-x86/current.h | 48 ++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 45 insertions(+), 3 deletions(-)

diff --git a/xen/include/asm-x86/current.h b/xen/include/asm-x86/current.h
index 99b66a0087..51a4cdbf7c 100644
--- a/xen/include/asm-x86/current.h
+++ b/xen/include/asm-x86/current.h
@@ -124,13 +124,55 @@ unsigned long get_stack_dump_bottom (unsigned long sp);
 # define CHECK_FOR_LIVEPATCH_WORK ""
 #endif
 
+#ifdef CONFIG_XEN_SHSTK
+/*
+ * We need to unwind the primary shadow stack to its supervisor token, located
+ * in the last word of the primary shadow stack.
+ *
+ * Read the shadow stack pointer, subtract it from supervisor token position,
+ * and divide by 8 to get the number of slots needing popping.
+ *
+ * INCSSPQ can't pop more than 255 entries.  We shouldn't ever need to pop
+ * that many entries, and getting this wrong will cause us to #DF later.  Turn
+ * it into a BUG() now for fractionally easier debugging.
+ */
+# define SHADOW_STACK_WORK                                      \
+    "mov $1, %[ssp];"                                           \
+    "rdsspd %[ssp];"                                            \
+    "cmp $1, %[ssp];"                                           \
+    "je .L_shstk_done.%=;" /* CET not active?  Skip. */         \
+    "mov $%c[skstk_base], %[val];"                              \
+    "and $%c[stack_mask], %[ssp];"                              \
+    "sub %[ssp], %[val];"                                       \
+    "shr $3, %[val];"                                           \
+    "cmp $255, %[val];" /* More than 255 entries?  Crash. */    \
+    UNLIKELY_START(a, shstk_adjust)                             \
+    _ASM_BUGFRAME_TEXT(0)                                       \
+    UNLIKELY_END_SECTION ";"                                    \
+    "incsspq %q[val];"                                          \
+    ".L_shstk_done.%=:"
+#else
+# define SHADOW_STACK_WORK ""
+#endif
+
 #define switch_stack_and_jump(fn, instr)                                \
     ({                                                                  \
+        unsigned int tmp;                                               \
         __asm__ __volatile__ (                                          \
-            "mov %0,%%"__OP"sp;"                                        \
+            SHADOW_STACK_WORK                                           \
+            "mov %[stk], %%rsp;"                                        \
             instr                                                       \
-             "jmp %c1"                                                  \
-            : : "r" (guest_cpu_user_regs()), "i" (fn) : "memory" );     \
+            "jmp %c[fun];"                                              \
+            : [val] "=&r" (tmp),                                        \
+              [ssp] "=&r" (tmp)                                         \
+            : [stk] "r" (guest_cpu_user_regs()),                        \
+              [fun] "i" (fn),                                           \
+              [skstk_base] "i"                                          \
+              ((PRIMARY_SHSTK_SLOT + 1) * PAGE_SIZE - 8),               \
+              [stack_mask] "i" (STACK_SIZE - 1),                        \
+              _ASM_BUGFRAME_INFO(BUGFRAME_bug, __LINE__,                \
+                                 __FILE__, NULL)                        \
+            : "memory" );                                               \
         unreachable();                                                  \
     })
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:05:02 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:05:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jhioA-0008Fr-12; Sun, 07 Jun 2020 00:05:02 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhio8-0008Fl-VN
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:05:00 +0000
X-Inumbo-ID: 874443c8-a852-11ea-b15b-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 874443c8-a852-11ea-b15b-12813bfff9fa;
 Sun, 07 Jun 2020 00:04:59 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=CDLyLtCo/JgNa/TWuFX5J07tVENfT2hQ07A8Vym+M9I=; b=sUtcV2MQM/bvb/BDl7gZwxjc7R
 3SUCqP2QF8FYhKJCGix0GwyZd8BGF2THBIgYfv3Rp0YZjLO644rJQTAhWpKC2ZcE63s3xLRwWQ9dk
 3vA/SLC8FzAFeU59r0k5NYnvT9vo1h4jY+IOqyt31ZXIew0tsWpbQOlk7fIJiGcS32nI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhio7-0003PX-PN
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:04:59 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhio7-0001ys-Ob
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:04:59 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/spec-ctrl: Adjust DO_OVERWRITE_RSB to be shadow
 stack compatible
Message-Id: <E1jhio7-0001ys-Ob@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:04:59 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 4648cba0a60a660e7ecb06bc552e785250b38b45
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Apr 24 14:19:52 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri May 29 23:09:46 2020 +0100

    x86/spec-ctrl: Adjust DO_OVERWRITE_RSB to be shadow stack compatible
    
    The 32 calls need dropping from the shadow stack as well as the regular stack.
    To shorten the code, we can use the 32bit forms of RDSSP/INCSSP, but need to
    double up the input to INCSSP to counter the operand size based multiplier.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/asm-x86/spec_ctrl_asm.h | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/xen/include/asm-x86/spec_ctrl_asm.h b/xen/include/asm-x86/spec_ctrl_asm.h
index c60093b090..cb34299a86 100644
--- a/xen/include/asm-x86/spec_ctrl_asm.h
+++ b/xen/include/asm-x86/spec_ctrl_asm.h
@@ -83,9 +83,9 @@
  * Requires nothing
  * Clobbers \tmp (%rax by default), %rcx
  *
- * Requires 256 bytes of stack space, but %rsp has no net change. Based on
- * Google's performance numbers, the loop is unrolled to 16 iterations and two
- * calls per iteration.
+ * Requires 256 bytes of {,shadow}stack space, but %rsp/SSP has no net
+ * change. Based on Google's performance numbers, the loop is unrolled to 16
+ * iterations and two calls per iteration.
  *
  * The call filling the RSB needs a nonzero displacement.  A nop would do, but
  * we use "1: pause; lfence; jmp 1b" to safely contains any ret-based
@@ -114,6 +114,16 @@
     sub $1, %ecx
     jnz .L\@_fill_rsb_loop
     mov %\tmp, %rsp                 /* Restore old %rsp */
+
+#ifdef CONFIG_XEN_SHSTK
+    mov $1, %ecx
+    rdsspd %ecx
+    cmp $1, %ecx
+    je .L\@_shstk_done
+    mov $64, %ecx                   /* 64 * 4 bytes, given incsspd */
+    incsspd %ecx                    /* Restore old SSP */
+.L\@_shstk_done:
+#endif
 .endm
 
 .macro DO_SPEC_CTRL_ENTRY_FROM_HVM
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:05:12 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:05: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 1jhioK-0008Gp-2t; Sun, 07 Jun 2020 00:05: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=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhioI-0008Ge-Vf
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:05:11 +0000
X-Inumbo-ID: 8d497a04-a852-11ea-b15b-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 8d497a04-a852-11ea-b15b-12813bfff9fa;
 Sun, 07 Jun 2020 00:05:10 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=3CiMyqzr8DHvLzF6V1VHB6h7ySvNHTgos8BHCdzHLEo=; b=HM6e2sGeJZoN6UBC5Rx3XFb5aU
 1EeSCKM3dxkEC9wnANl+RPVCEwsJobPHq2aWi2G8rK4iW2L1fUoUM4bc/hlA9Uxvd4TVSXI6CBDgH
 uPgEtFLpSBeFM1DDMTdv2vKUmpJajKCI98CALTbmtaw/bVj4ZFdyQk/uvGidlGBeWaHg=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhioH-0003Pt-SZ
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:05:09 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhioH-00020B-Rl
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:05:09 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/extable: Adjust extable handling to be shadow stack
 compatible
Message-Id: <E1jhioH-00020B-Rl@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:05:09 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 209fb9919b5085f97c7fcf339fa8535e025e8d78
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Apr 30 15:05:24 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri May 29 23:09:46 2020 +0100

    x86/extable: Adjust extable handling to be shadow stack compatible
    
    When adjusting an IRET frame to recover from a fault, and equivalent
    adjustment needs making in the shadow IRET frame.
    
    The adjustment in exception_with_ints_disabled() could in principle be an
    alternative block rather than an ifdef, as the only two current users of
    _PRE_EXTABLE() are IRET-to-guest instructions.  However, this is not a
    fastpath, and this form is more robust to future changes.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/traps.c        | 66 ++++++++++++++++++++++++++++++++++++++++++++-
 xen/arch/x86/x86_64/entry.S | 11 +++++++-
 2 files changed, 75 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 39a1f35bc1..bc5b8f8ea3 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -363,7 +363,7 @@ static void show_guest_stack(struct vcpu *v, const struct cpu_user_regs *regs)
 }
 
 /*
- * Notes for get_stack_trace_bottom() and get_stack_dump_bottom()
+ * Notes for get_{stack,shstk}*_bottom() helpers
  *
  * Stack pages 1 - 4:
  *   These are all 1-page IST stacks.  Each of these stacks have an exception
@@ -400,6 +400,18 @@ unsigned long get_stack_trace_bottom(unsigned long sp)
     }
 }
 
+static unsigned long get_shstk_bottom(unsigned long sp)
+{
+    switch ( get_stack_page(sp) )
+    {
+#ifdef CONFIG_XEN_SHSTK
+    case 0:  return ROUNDUP(sp, IST_SHSTK_SIZE) - sizeof(unsigned long);
+    case 5:  return ROUNDUP(sp, PAGE_SIZE)      - sizeof(unsigned long);
+#endif
+    default: return sp - sizeof(unsigned long);
+    }
+}
+
 unsigned long get_stack_dump_bottom(unsigned long sp)
 {
     switch ( get_stack_page(sp) )
@@ -763,6 +775,55 @@ static void do_reserved_trap(struct cpu_user_regs *regs)
           trapnr, vec_name(trapnr), regs->error_code);
 }
 
+static void extable_shstk_fixup(struct cpu_user_regs *regs, unsigned long fixup)
+{
+    unsigned long ssp, *ptr, *base;
+
+    asm ( "rdsspq %0" : "=r" (ssp) : "0" (1) );
+    if ( ssp == 1 )
+        return;
+
+    ptr = _p(ssp);
+    base = _p(get_shstk_bottom(ssp));
+
+    for ( ; ptr < base; ++ptr )
+    {
+        /*
+         * Search for %rip.  The shstk currently looks like this:
+         *
+         *   ...  [Likely pointed to by SSP]
+         *   %cs  [== regs->cs]
+         *   %rip [== regs->rip]
+         *   SSP  [Likely points to 3 slots higher, above %cs]
+         *   ...  [call tree to this function, likely 2/3 slots]
+         *
+         * and we want to overwrite %rip with fixup.  There are two
+         * complications:
+         *   1) We cant depend on SSP values, because they won't differ by 3
+         *      slots if the exception is taken on an IST stack.
+         *   2) There are synthetic (unrealistic but not impossible) scenarios
+         *      where %rip can end up in the call tree to this function, so we
+         *      can't check against regs->rip alone.
+         *
+         * Check for both regs->rip and regs->cs matching.
+         */
+        if ( ptr[0] == regs->rip && ptr[1] == regs->cs )
+        {
+            asm ( "wrssq %[fix], %[stk]"
+                  : [stk] "=m" (ptr[0])
+                  : [fix] "r" (fixup) );
+            return;
+        }
+    }
+
+    /*
+     * We failed to locate and fix up the shadow IRET frame.  This could be
+     * due to shadow stack corruption, or bad logic above.  We cannot continue
+     * executing the interrupted context.
+     */
+    BUG();
+}
+
 static bool extable_fixup(struct cpu_user_regs *regs, bool print)
 {
     unsigned long fixup = search_exception_table(regs);
@@ -779,6 +840,9 @@ static bool extable_fixup(struct cpu_user_regs *regs, bool print)
                vec_name(regs->entry_vector), regs->error_code,
                _p(regs->rip), _p(regs->rip), _p(fixup));
 
+    if ( IS_ENABLED(CONFIG_XEN_SHSTK) )
+        extable_shstk_fixup(regs, fixup);
+
     regs->rip = fixup;
     this_cpu(last_extable_addr) = regs->rip;
 
diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index f7ee3dce91..e68d680791 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -708,7 +708,16 @@ exception_with_ints_disabled:
         call  search_pre_exception_table
         testq %rax,%rax                 # no fixup code for faulting EIP?
         jz    1b
-        movq  %rax,UREGS_rip(%rsp)
+        movq  %rax,UREGS_rip(%rsp)      # fixup regular stack
+
+#ifdef CONFIG_XEN_SHSTK
+        mov    $1, %edi
+        rdsspq %rdi
+        cmp    $1, %edi
+        je     .L_exn_shstk_done
+        wrssq  %rax, 1*8(%rdi)          # fixup shadow stack
+.L_exn_shstk_done:
+#endif
         subq  $8,UREGS_rsp(%rsp)        # add ec/ev to previous stack frame
         testb $15,UREGS_rsp(%rsp)       # return %rsp is now aligned?
         jz    1f                        # then there is a pad quadword already
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:05:24 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:05: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 1jhioU-0008Hm-4O; Sun, 07 Jun 2020 00:05:22 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhioT-0008Hb-43
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:05:21 +0000
X-Inumbo-ID: 934e5064-a852-11ea-b15b-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 934e5064-a852-11ea-b15b-12813bfff9fa;
 Sun, 07 Jun 2020 00:05:20 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=kd/mbBHga9Fzim8zNxDWPs9sJZ7/CcHjbHUmIGSN6O8=; b=ttgpChkA7BatKa8ZKAcXaq4w5v
 OrN3i1AewEtPD5oIKFakxF+OtRs9fZMT4Gz3HZXmXlN2RF0iWGjtsdtZG7WOi7fUSCYuEIrrG1fvI
 uiZdasx4CVhkJ2uJENkP55vW9Spk8EoynIiK0GKjFGRZpaxzwEyoO72Ah/BQMNBTqq7k=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhioR-0003Q2-Vm
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:05:19 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhioR-00021D-V4
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:05:19 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/alt: Adjust _alternative_instructions() to not
 create shadow stacks
Message-Id: <E1jhioR-00021D-V4@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:05:19 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 97c7e7994fe217656c0af00696c3e6dd5582cdef
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri May 1 18:10:00 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri May 29 23:09:46 2020 +0100

    x86/alt: Adjust _alternative_instructions() to not create shadow stacks
    
    The current alternatives algorithm clears CR0.WP and writes into .text.  This
    has a side effect of the mappings becoming shadow stacks once CET is active.
    
    Adjust _alternative_instructions() to clean up after itself.  This involves
    extending the set of bits modify_xen_mappings() to include Dirty (and Accessed
    for good measure).
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/alternative.c | 14 ++++++++++++++
 xen/arch/x86/mm.c          |  6 +++---
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/alternative.c b/xen/arch/x86/alternative.c
index ce2b4302e6..004e9ede25 100644
--- a/xen/arch/x86/alternative.c
+++ b/xen/arch/x86/alternative.c
@@ -21,6 +21,7 @@
 #include <asm/processor.h>
 #include <asm/alternative.h>
 #include <xen/init.h>
+#include <asm/setup.h>
 #include <asm/system.h>
 #include <asm/traps.h>
 #include <asm/nmi.h>
@@ -398,6 +399,19 @@ static void __init _alternative_instructions(bool force)
         panic("Timed out waiting for alternatives self-NMI to hit\n");
 
     set_nmi_callback(saved_nmi_callback);
+
+    /*
+     * When Xen is using shadow stacks, the alternatives clearing CR0.WP and
+     * writing into the mappings set dirty bits, turning the mappings into
+     * shadow stack mappings.
+     *
+     * While we can execute from them, this would also permit them to be the
+     * target of WRSS instructions, so reset the dirty after patching.
+     */
+    if ( cpu_has_xen_shstk )
+        modify_xen_mappings(XEN_VIRT_START + MB(2),
+                            (unsigned long)&__2M_text_end,
+                            PAGE_HYPERVISOR_RX);
 }
 
 void __init alternative_instructions(void)
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index c9847043db..53e3dcb2d4 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -5443,8 +5443,8 @@ int populate_pt_range(unsigned long virt, unsigned long nr_mfns)
  * mappings, but will shatter superpages if necessary, and will destroy
  * mappings if not passed _PAGE_PRESENT.
  *
- * The only flags considered are NX, RW and PRESENT.  All other input flags
- * are ignored.
+ * The only flags considered are NX, D, A, RW and PRESENT.  All other input
+ * flags are ignored.
  *
  * It is an error to call with present flags over an unpopulated range.
  */
@@ -5457,7 +5457,7 @@ int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
     unsigned long v = s;
 
     /* Set of valid PTE bits which may be altered. */
-#define FLAGS_MASK (_PAGE_NX|_PAGE_RW|_PAGE_PRESENT)
+#define FLAGS_MASK (_PAGE_NX|_PAGE_DIRTY|_PAGE_ACCESSED|_PAGE_RW|_PAGE_PRESENT)
     nf &= FLAGS_MASK;
 
     ASSERT(IS_ALIGNED(s, PAGE_SIZE));
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:05:31 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:05:31 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jhiod-0008It-7E; Sun, 07 Jun 2020 00:05:31 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhioc-0008In-NG
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:05:30 +0000
X-Inumbo-ID: 99530df6-a852-11ea-b15b-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 99530df6-a852-11ea-b15b-12813bfff9fa;
 Sun, 07 Jun 2020 00:05:30 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=c+7rn75yhGDYJwyIoRj/+5rRgcPW27mbIuJF9uFliG4=; b=dGgeCPiD5drOaBNd9V7wTKAvNR
 OxpB9rqih00c5n7IPkMWhFxMQ7YTD45Zubwrc3O8qq/ir8ZHz0J8sPhAMF0NOicTe0AFuqhE4uf1T
 jybUZngJThm0gVoDB3CwCUuhd01JozVg27xIlhwKDIIzaJSPdbXNX6L4GjkCOgEn7lXg=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhioc-0003Qd-2Z
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:05:30 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhioc-00022G-1t
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:05:30 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/EFI: Avoid mapping EFI system memory as shadow stacks
Message-Id: <E1jhioc-00022G-1t@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:05:30 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 137d2d6310d31b4ace3df01832c37aa86b6173cc
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri May 29 21:49:13 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri May 29 23:09:46 2020 +0100

    x86/EFI: Avoid mapping EFI system memory as shadow stacks
    
    Ensure the dirty bit is clear when creating read-only EFI mappings.
    
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/common/efi/boot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index a6f84c945a..5a520bf21d 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -1554,7 +1554,7 @@ void __init efi_init_memory(void)
 
         if ( desc->Attribute & (efi_bs_revision < EFI_REVISION(2, 5)
                                 ? EFI_MEMORY_WP : EFI_MEMORY_RO) )
-            prot &= ~_PAGE_RW;
+            prot &= ~(_PAGE_DIRTY | _PAGE_RW);
         if ( desc->Attribute & EFI_MEMORY_XP )
             prot |= _PAGE_NX;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:05:42 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:05:42 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jhioo-0008K4-8t; Sun, 07 Jun 2020 00:05:42 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhion-0008Jx-2b
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:05:41 +0000
X-Inumbo-ID: 9f565ea6-a852-11ea-b15b-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 9f565ea6-a852-11ea-b15b-12813bfff9fa;
 Sun, 07 Jun 2020 00:05:40 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=U7EbUl+XTXOLdBjfqzqxPt0FukV5Si1VCgGGQdB63kg=; b=IfFahKy1NgzWe1Z3j/sOaPt18p
 cZPWcq/FcB6VSF7EsWg00JorG1gORecPkU3xpHcdRM8e2xjOWW2D/18KptjJJJcX2mzVIKaDW+7wr
 ubQ75Xwv94y2NVexASPuJEIoaQCoJSvTJHqmC4DtPZM5vTkNtBmCytWVj1w2FqRSWA5w=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhiom-0003Qm-5S
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:05:40 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhiom-00023C-4s
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:05:40 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/entry: Adjust guest paths to be shadow stack
 compatible
Message-Id: <E1jhiom-00023C-4s@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:05:40 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 43b98e71903845c727028d2e84b90e5905ff8d66
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Apr 24 14:34:44 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri May 29 23:09:46 2020 +0100

    x86/entry: Adjust guest paths to be shadow stack compatible
    
    The SYSCALL/SYSENTER/SYSRET paths need to use {SET,CLR}SSBSY.  The IRET to
    guest paths must not.  In the SYSRET path, re-position the mov which loads rip
    into %rcx so we can use %rcx for CLRSSBSY, rather than spilling another
    register to the stack.
    
    While we can in principle detect shadow stack corruption and a failure to
    clear the supervisor token busy bit in the SYSRET path (by inspecting the
    carry flag following CLRSSBSY), we cannot detect similar problems for the IRET
    path (IRET is specified not to fault in this case).
    
    We will double fault at some point later, when next trying to enter Xen, due
    to an already-set supervisor shadow stack busy bit.  As SYSRET is a uncommon
    path anyway, avoid the added complexity for no appreciable gain.
    
    The IST switch onto the primary stack is not great as we have an instruction
    boundary with no shadow stack.  This is the least bad option available.
    
    These paths are not used before shadow stacks are properly established, so can
    use alternatives to avoid extra runtime CET detection logic.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/x86_64/compat/entry.S |  1 +
 xen/arch/x86/x86_64/entry.S        | 36 ++++++++++++++++++++++++++++++++++--
 2 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/x86_64/compat/entry.S b/xen/arch/x86/x86_64/compat/entry.S
index 3cd375bd48..2ca81341a4 100644
--- a/xen/arch/x86/x86_64/compat/entry.S
+++ b/xen/arch/x86/x86_64/compat/entry.S
@@ -198,6 +198,7 @@ ENTRY(cr4_pv32_restore)
 
 /* See lstar_enter for entry register state. */
 ENTRY(cstar_enter)
+        ALTERNATIVE "", "setssbsy", X86_FEATURE_XEN_SHSTK
         /* sti could live here when we don't switch page tables below. */
         CR4_PV32_RESTORE
         movq  8(%rsp),%rax /* Restore %rax. */
diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index e68d680791..6470266d2f 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -191,9 +191,16 @@ restore_all_guest:
         sarq  $47,%rcx
         incl  %ecx
         cmpl  $1,%ecx
-        movq  8(%rsp),%rcx            # RIP
-        ja    iret_exit_to_guest
+        ja    .Lrestore_rcx_iret_exit_to_guest
 
+        /* Clear the supervisor shadow stack token busy bit. */
+.macro rag_clrssbsy
+        rdsspq %rcx
+        clrssbsy (%rcx)
+.endm
+        ALTERNATIVE "", rag_clrssbsy, X86_FEATURE_XEN_SHSTK
+
+        movq  8(%rsp), %rcx           # RIP
         cmpw  $FLAT_USER_CS32,16(%rsp)# CS
         movq  32(%rsp),%rsp           # RSP
         je    1f
@@ -201,6 +208,8 @@ restore_all_guest:
 1:      sysretl
 
         ALIGN
+.Lrestore_rcx_iret_exit_to_guest:
+        movq  8(%rsp), %rcx           # RIP
 /* No special register assumptions. */
 iret_exit_to_guest:
         andl  $~(X86_EFLAGS_IOPL|X86_EFLAGS_NT|X86_EFLAGS_VM),24(%rsp)
@@ -226,6 +235,7 @@ iret_exit_to_guest:
  * %ss must be saved into the space left by the trampoline.
  */
 ENTRY(lstar_enter)
+        ALTERNATIVE "", "setssbsy", X86_FEATURE_XEN_SHSTK
         /* sti could live here when we don't switch page tables below. */
         movq  8(%rsp),%rax /* Restore %rax. */
         movq  $FLAT_KERNEL_SS,8(%rsp)
@@ -259,6 +269,7 @@ ENTRY(lstar_enter)
         jmp   test_all_events
 
 ENTRY(sysenter_entry)
+        ALTERNATIVE "", "setssbsy", X86_FEATURE_XEN_SHSTK
         /* sti could live here when we don't switch page tables below. */
         pushq $FLAT_USER_SS
         pushq $0
@@ -877,6 +888,27 @@ handle_ist_exception:
         movl  $UREGS_kernel_sizeof/8,%ecx
         movq  %rdi,%rsp
         rep   movsq
+
+        /* Switch Shadow Stacks */
+.macro ist_switch_shstk
+        rdsspq %rdi
+        clrssbsy (%rdi)
+        /*
+         * Switching supervisor shadow stacks is specially hard, as supervisor
+         * and restore tokens are incompatible.
+         *
+         * For now, we only need to switch on to an unused primary shadow
+         * stack, so use SETSSBSY for the purpose, exactly like the
+         * SYSCALL/SYSENTER entry.
+         *
+         * Ideally, we'd want to CLRSSBSY after switching stacks, but that
+         * will leave SSP zeroed so it not an option.  Instead, we transiently
+         * have a zero SSP on this instruction boundary, and depend on IST for
+         * NMI/#MC protection.
+         */
+        setssbsy
+.endm
+        ALTERNATIVE "", ist_switch_shstk, X86_FEATURE_XEN_SHSTK
 1:
 #else
         ASSERT_CONTEXT_IS_XEN
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:05:52 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:05:52 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jhioy-0008Lo-Ad; Sun, 07 Jun 2020 00:05:52 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhiox-0008LZ-20
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:05:51 +0000
X-Inumbo-ID: a55c7dbc-a852-11ea-9b55-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id a55c7dbc-a852-11ea-9b55-bc764e2007e4;
 Sun, 07 Jun 2020 00:05:50 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=vX6UWID8lP5oScc0Mhm+Mo1t5za+XnenDd6oU8bImKQ=; b=Hw/0H8ChVPM51WNAuHTP7JpMFT
 RYXPNNTZpQkGqu8H/OkSUHvrQe2wbVKF0MCDovoTKjCoY11cTgACtOiaUnWnX3ZiCJpQcE9kbJWPx
 FS/QOVUxe++P2JQJKAIGPO4T8oP9eJFixRfy0E5V1bcbllr8/TKbKYOBtgJGOkDCC/LU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhiow-0003Qv-8H
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:05:50 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhiow-00023u-7g
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:05:50 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/S3: Save and restore Shadow Stack configuration
Message-Id: <E1jhiow-00023u-7g@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:05:50 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 633ecc4a7cb2d8d6d1903b39637c0d9a982b9693
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Apr 22 13:44:37 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri May 29 23:09:46 2020 +0100

    x86/S3: Save and restore Shadow Stack configuration
    
    See code for details.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/acpi/wakeup_prot.S | 58 +++++++++++++++++++++++++++++++++++++++++
 xen/include/asm-x86/msr-index.h |  3 +++
 xen/include/asm-x86/x86-defns.h |  1 +
 3 files changed, 62 insertions(+)

diff --git a/xen/arch/x86/acpi/wakeup_prot.S b/xen/arch/x86/acpi/wakeup_prot.S
index 4dba6020a7..dcc7e2327d 100644
--- a/xen/arch/x86/acpi/wakeup_prot.S
+++ b/xen/arch/x86/acpi/wakeup_prot.S
@@ -1,3 +1,7 @@
+#include <asm/msr-index.h>
+#include <asm/page.h>
+#include <asm/processor.h>
+
         .file __FILE__
         .text
         .code64
@@ -15,6 +19,12 @@ ENTRY(do_suspend_lowlevel)
         mov     %cr0, %rax
         mov     %rax, saved_cr0(%rip)
 
+#ifdef CONFIG_XEN_SHSTK
+        mov     $1, %eax
+        rdsspq  %rax
+        mov     %rax, saved_ssp(%rip)
+#endif
+
         /* enter sleep state physically */
         mov     $3, %edi
         call    acpi_enter_sleep_state
@@ -48,6 +58,51 @@ ENTRY(s3_resume)
         pushq   %rax
         lretq
 1:
+#ifdef CONFIG_XEN_SHSTK
+        /*
+         * Restoring SSP is a little complicated, because we are intercepting
+         * an in-use shadow stack.  Write a temporary token under the stack,
+         * so SETSSBSY will successfully load a value useful for us, then
+         * reset MSR_PL0_SSP to its usual value and pop the temporary token.
+         */
+        mov     saved_rsp(%rip), %rdi
+        cmpq    $1, %rdi
+        je      .L_shstk_done
+
+        /* Set up MSR_S_CET. */
+        mov     $MSR_S_CET, %ecx
+        xor     %edx, %edx
+        mov     $CET_SHSTK_EN | CET_WRSS_EN, %eax
+        wrmsr
+
+        /* Construct the temporary supervisor token under SSP. */
+        sub     $8, %rdi
+
+        /* Load it into MSR_PL0_SSP. */
+        mov     $MSR_PL0_SSP, %ecx
+        mov     %rdi, %rdx
+        shr     $32, %rdx
+        mov     %edi, %eax
+        wrmsr
+
+        /* Enable CET.  MSR_INTERRUPT_SSP_TABLE is set up later in load_system_tables(). */
+        mov     $XEN_MINIMAL_CR4 | X86_CR4_CET, %ebx
+        mov     %rbx, %cr4
+
+        /* Write the temporary token onto the shadow stack, and activate it. */
+        wrssq   %rdi, (%rdi)
+        setssbsy
+
+        /* Reset MSR_PL0_SSP back to its normal value. */
+        and     $~(STACK_SIZE - 1), %eax
+        or      $(PRIMARY_SHSTK_SLOT + 1) * PAGE_SIZE - 8, %eax
+        wrmsr
+
+        /* Pop the temporary token off the stack. */
+        mov     $2, %eax
+        incsspd %eax
+.L_shstk_done:
+#endif
 
         call    load_system_tables
 
@@ -65,6 +120,9 @@ ENTRY(s3_resume)
 
 saved_rsp:      .quad   0
 saved_cr0:      .quad   0
+#ifdef CONFIG_XEN_SHSTK
+saved_ssp:      .quad   0
+#endif
 
 GLOBAL(saved_magic)
         .long   0x9abcdef0
diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h
index 5fa14ca136..a4dc48f51f 100644
--- a/xen/include/asm-x86/msr-index.h
+++ b/xen/include/asm-x86/msr-index.h
@@ -68,6 +68,9 @@
 
 #define MSR_U_CET                           0x000006a0
 #define MSR_S_CET                           0x000006a2
+#define  CET_SHSTK_EN                       (_AC(1, ULL) <<  0)
+#define  CET_WRSS_EN                        (_AC(1, ULL) <<  1)
+
 #define MSR_PL0_SSP                         0x000006a4
 #define MSR_PL1_SSP                         0x000006a5
 #define MSR_PL2_SSP                         0x000006a6
diff --git a/xen/include/asm-x86/x86-defns.h b/xen/include/asm-x86/x86-defns.h
index f0157e2311..28628807cb 100644
--- a/xen/include/asm-x86/x86-defns.h
+++ b/xen/include/asm-x86/x86-defns.h
@@ -73,6 +73,7 @@
 #define X86_CR4_SMEP       0x00100000 /* enable SMEP */
 #define X86_CR4_SMAP       0x00200000 /* enable SMAP */
 #define X86_CR4_PKE        0x00400000 /* enable PKE */
+#define X86_CR4_CET        0x00800000 /* Control-flow Enforcement Technology */
 
 /*
  * XSTATE component flags in XCR0
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:06:03 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:06:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jhip9-0008Mp-CE; Sun, 07 Jun 2020 00:06: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=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhip7-0008Mg-UK
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:06:01 +0000
X-Inumbo-ID: ab617208-a852-11ea-b15b-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id ab617208-a852-11ea-b15b-12813bfff9fa;
 Sun, 07 Jun 2020 00:06:00 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=vi+K0x+HW/I2/e1OpilpT/pRag1lQPh852kKOBhq/8M=; b=oqysQ3cXS5w/tc9aLlNPhwa0/h
 BELcZcA/tVFuvsHVPaH0es0abfoV00DWntddRSftBig/n18+4GwX0KNoaK5Py3pS2lbgVz2UsbiNI
 iCuYQsLdPA1yvL7ArKJfI5E10qqM3q7yhy7x+SOA2IQq3UJX5WZGYIpyeh+LvDuT35uM=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhip6-0003R7-BZ
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:06:00 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhip6-00024l-Ar
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:06:00 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/shstk: Activate Supervisor Shadow Stacks
Message-Id: <E1jhip6-00024l-Ar@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:06:00 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit b60ab42db2f04dcf56ebbfedfb9b0c65a75e4bac
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Apr 22 13:44:37 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri May 29 23:09:46 2020 +0100

    x86/shstk: Activate Supervisor Shadow Stacks
    
    With all other plumbing in place, activate shadow stacks when possible.
    
    Note that CET shares the similar problems to SMEP/SMAP with Ring1 being
    supervisor to the processor, and that the layout of the shadow stack differs
    between an IRET to Ring 1 and Ring 3.  Therefore, we disable PV32 when CET is
    enabled.  Compatibility can be maintained if necessary via PV-Shim.
    
    The BSP needs to wait until alternatives have run (to avoid interaction with
    CR0.WP), and after the first reset_stack_and_jump() to avoid having a pristine
    shadow stack interact in problematic ways with an in-use regular stack.
    Activate shadow stack in reinit_bsp_stack().
    
    APs have all infrastructure set up by the booting CPU, so enable shadow stacks
    before entering C.  Adjust the logic to call start_secondary rather than jump
    to it, so stack traces make more sense.
    
    The crash path needs to turn CET off to avoid interfering with the crash
    kernel's environment.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 docs/misc/xen-command-line.pandoc |  8 ++++++++
 xen/arch/x86/boot/x86_64.S        | 35 +++++++++++++++++++++++++++++++++--
 xen/arch/x86/cpu/common.c         |  5 +++++
 xen/arch/x86/crash.c              |  7 +++++++
 xen/arch/x86/setup.c              | 27 +++++++++++++++++++++++++++
 xen/arch/x86/spec_ctrl.c          |  8 ++++++++
 6 files changed, 88 insertions(+), 2 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index ec1c12cbe0..2d4d9639d6 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -287,6 +287,10 @@ call/jmp COP/JOP) attacks.
     `cet=no-shstk` will cause Xen not to use Shadow Stacks even when support
     is available in hardware.
 
+    Shadow Stacks are incompatible with 32bit PV guests.  This option will
+    override the `pv=32` boolean to false.  Backwards compatibility can be
+    maintained with the `pv-shim` mechanism.
+
 ### clocksource (x86)
 > `= pit | hpet | acpi | tsc`
 
@@ -1726,6 +1730,10 @@ Controls for aspects of PV guest support.
 *   The `32` boolean controls whether 32bit PV guests can be created.  It
     defaults to `true`, and is ignored when `CONFIG_PV32` is compiled out.
 
+    32bit PV guests are incompatible with CET Shadow Stacks.  If Xen is using
+    shadow stacks, this option will be overridden to `false`.  Backwards
+    compatibility can be maintained with the `pv-shim` mechanism.
+
 ### pv-linear-pt (x86)
 > `= <boolean>`
 
diff --git a/xen/arch/x86/boot/x86_64.S b/xen/arch/x86/boot/x86_64.S
index 314a32a19f..551acd9e94 100644
--- a/xen/arch/x86/boot/x86_64.S
+++ b/xen/arch/x86/boot/x86_64.S
@@ -28,8 +28,39 @@ ENTRY(__high_start)
         lretq
 1:
         test    %ebx,%ebx
-        jnz     start_secondary
-
+        jz      .L_bsp
+
+        /* APs.  Set up shadow stacks before entering C. */
+
+        testl   $cpufeat_mask(X86_FEATURE_XEN_SHSTK), \
+                CPUINFO_FEATURE_OFFSET(X86_FEATURE_XEN_SHSTK) + boot_cpu_data(%rip)
+        je      .L_ap_shstk_done
+
+        /* Set up MSR_S_CET. */
+        mov     $MSR_S_CET, %ecx
+        xor     %edx, %edx
+        mov     $CET_SHSTK_EN | CET_WRSS_EN, %eax
+        wrmsr
+
+        /* Derive MSR_PL0_SSP from %rsp (token written when stack is allocated). */
+        mov     $MSR_PL0_SSP, %ecx
+        mov     %rsp, %rdx
+        shr     $32, %rdx
+        mov     %esp, %eax
+        and     $~(STACK_SIZE - 1), %eax
+        or      $(PRIMARY_SHSTK_SLOT + 1) * PAGE_SIZE - 8, %eax
+        wrmsr
+
+        /* Enable CET.  MSR_INTERRUPT_SSP_TABLE is set up later in load_system_tables(). */
+        mov     $XEN_MINIMAL_CR4 | X86_CR4_CET, %ecx
+        mov     %rcx, %cr4
+        setssbsy
+
+.L_ap_shstk_done:
+        call    start_secondary
+        BUG     /* start_secondary() shouldn't return. */
+
+.L_bsp:
         /* Pass off the Multiboot info structure to C land (if applicable). */
         mov     multiboot_ptr(%rip),%edi
         call    __start_xen
diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index f483c81b7c..58f0876180 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -329,6 +329,11 @@ void __init early_cpu_init(void)
 	       x86_cpuid_vendor_to_str(c->x86_vendor), c->x86, c->x86,
 	       c->x86_model, c->x86_model, c->x86_mask, eax);
 
+	if (c->cpuid_level >= 7) {
+		cpuid_count(7, 0, &eax, &ebx, &ecx, &edx);
+		c->x86_capability[cpufeat_word(X86_FEATURE_CET_SS)] = ecx;
+	}
+
 	eax = cpuid_eax(0x80000000);
 	if ((eax >> 16) == 0x8000 && eax >= 0x80000008) {
 		eax = cpuid_eax(0x80000008);
diff --git a/xen/arch/x86/crash.c b/xen/arch/x86/crash.c
index 450eecd46b..0611b4fb9b 100644
--- a/xen/arch/x86/crash.c
+++ b/xen/arch/x86/crash.c
@@ -200,6 +200,13 @@ void machine_crash_shutdown(void)
     /* Reset CPUID masking and faulting to the host's default. */
     ctxt_switch_levelling(NULL);
 
+    /* Disable shadow stacks. */
+    if ( cpu_has_xen_shstk )
+    {
+        wrmsrl(MSR_S_CET, 0);
+        write_cr4(read_cr4() & ~X86_CR4_CET);
+    }
+
     info = kexec_crash_save_info();
     info->xen_phys_start = xen_phys_start;
     info->dom0_pfn_to_mfn_frame_list_list =
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 584589baff..665274674d 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -664,6 +664,14 @@ static void __init noreturn reinit_bsp_stack(void)
     stack_base[0] = stack;
     memguard_guard_stack(stack);
 
+    if ( cpu_has_xen_shstk )
+    {
+        wrmsrl(MSR_PL0_SSP,
+               (unsigned long)stack + (PRIMARY_SHSTK_SLOT + 1) * PAGE_SIZE - 8);
+        wrmsrl(MSR_S_CET, CET_SHSTK_EN | CET_WRSS_EN);
+        asm volatile ("setssbsy" ::: "memory");
+    }
+
     reset_stack_and_jump_nolp(init_done);
 }
 
@@ -1065,6 +1073,21 @@ void __init noreturn __start_xen(unsigned long mbi_p)
     /* This must come before e820 code because it sets paddr_bits. */
     early_cpu_init();
 
+    /* Choose shadow stack early, to set infrastructure up appropriately. */
+    if ( opt_xen_shstk && boot_cpu_has(X86_FEATURE_CET_SS) )
+    {
+        printk("Enabling Supervisor Shadow Stacks\n");
+
+        setup_force_cpu_cap(X86_FEATURE_XEN_SHSTK);
+#ifdef CONFIG_PV32
+        if ( opt_pv32 )
+        {
+            opt_pv32 = 0;
+            printk("  - Disabling PV32 due to Shadow Stacks\n");
+        }
+#endif
+    }
+
     /* Sanitise the raw E820 map to produce a final clean version. */
     max_page = raw_max_page = init_e820(memmap_type, &e820_raw);
 
@@ -1801,6 +1824,10 @@ void __init noreturn __start_xen(unsigned long mbi_p)
 
     alternative_branches();
 
+    /* Defer CR4.CET until alternatives have finished playing with CR0.WP */
+    if ( cpu_has_xen_shstk )
+        set_in_cr4(X86_CR4_CET);
+
     /*
      * NB: when running as a PV shim VCPUOP_up/down is wired to the shim
      * physical cpu_add/remove functions, so launch the guest with only
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index c5d8e587a8..a94be2d594 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -881,6 +881,14 @@ void __init init_speculation_mitigations(void)
 
     hw_smt_enabled = check_smt_enabled();
 
+    /*
+     * First, disable the use of retpolines if Xen is using shadow stacks, as
+     * they are incompatible.
+     */
+    if ( cpu_has_xen_shstk &&
+         (opt_thunk == THUNK_DEFAULT || opt_thunk == THUNK_RETPOLINE) )
+        thunk = THUNK_JMP;
+
     /*
      * Has the user specified any custom BTI mitigations?  If so, follow their
      * instructions exactly and disable all heuristics.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:06:13 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:06: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 1jhipJ-0008Nm-Dl; Sun, 07 Jun 2020 00:06: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=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhipI-0008Na-27
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:06:12 +0000
X-Inumbo-ID: b1681788-a852-11ea-b15b-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id b1681788-a852-11ea-b15b-12813bfff9fa;
 Sun, 07 Jun 2020 00:06:10 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=1lh4NOUrXSCNWSAygD1XKERTG7AiGjxk0/cMoWpfpJ0=; b=X56WU1PWzxEsdyJ+T5SEqoHAmE
 Ir7jewtbY77YBrvl7Dn/oD8xi3fjTFooaxYu4CB4NWDuLd5FpgT0PQ0oy6U1FkPyyiPrrmTXeLGPq
 hkmuDmdP6+JrAfLjX3FNYCDJSqkMAhm/HzP9dghKUgeqmXdzEzJNNkyxS5zt2Li1TS/0=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhipG-0003RT-Eq
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:06:10 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhipG-00027b-E3
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:06:10 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/CET: Fix build following c/s 43b98e7190
Message-Id: <E1jhipG-00027b-E3@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:06:10 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit b586a81b7a90d424b54275c79e759b0294aa2fb6
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Sat May 30 01:41:26 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Sat May 30 01:56:01 2020 +0100

    x86/CET: Fix build following c/s 43b98e7190
    
    OSSTest reports:
    
      x86_64.S: Assembler messages:
      x86_64.S:57: Error: no such instruction: `setssbsy'
      /home/osstest/build.150510.build-amd64/xen/xen/Rules.mk:183: recipe for target 'head.o' failed
      make[4]: Leaving directory '/home/osstest/build.150510.build-amd64/xen/xen/arch/x86/boot'
      make[4]: *** [head.o] Error 1
    
    All use of CET instructions, even those inside alternative blocks, needs to be
    behind CONFIG_XEN_SHSTK, as it indicates suitable toolchain support.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/boot/x86_64.S         | 3 ++-
 xen/arch/x86/setup.c               | 2 +-
 xen/arch/x86/x86_64/compat/entry.S | 2 ++
 xen/arch/x86/x86_64/entry.S        | 8 ++++++++
 4 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/boot/x86_64.S b/xen/arch/x86/boot/x86_64.S
index 551acd9e94..d61048c583 100644
--- a/xen/arch/x86/boot/x86_64.S
+++ b/xen/arch/x86/boot/x86_64.S
@@ -31,7 +31,7 @@ ENTRY(__high_start)
         jz      .L_bsp
 
         /* APs.  Set up shadow stacks before entering C. */
-
+#ifdef CONFIG_XEN_SHSTK
         testl   $cpufeat_mask(X86_FEATURE_XEN_SHSTK), \
                 CPUINFO_FEATURE_OFFSET(X86_FEATURE_XEN_SHSTK) + boot_cpu_data(%rip)
         je      .L_ap_shstk_done
@@ -55,6 +55,7 @@ ENTRY(__high_start)
         mov     $XEN_MINIMAL_CR4 | X86_CR4_CET, %ecx
         mov     %rcx, %cr4
         setssbsy
+#endif
 
 .L_ap_shstk_done:
         call    start_secondary
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 665274674d..2aa1cd50b8 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -664,7 +664,7 @@ static void __init noreturn reinit_bsp_stack(void)
     stack_base[0] = stack;
     memguard_guard_stack(stack);
 
-    if ( cpu_has_xen_shstk )
+    if ( IS_ENABLED(CONFIG_XEN_SHSTK) && cpu_has_xen_shstk )
     {
         wrmsrl(MSR_PL0_SSP,
                (unsigned long)stack + (PRIMARY_SHSTK_SLOT + 1) * PAGE_SIZE - 8);
diff --git a/xen/arch/x86/x86_64/compat/entry.S b/xen/arch/x86/x86_64/compat/entry.S
index 2ca81341a4..c3e62f8734 100644
--- a/xen/arch/x86/x86_64/compat/entry.S
+++ b/xen/arch/x86/x86_64/compat/entry.S
@@ -198,7 +198,9 @@ ENTRY(cr4_pv32_restore)
 
 /* See lstar_enter for entry register state. */
 ENTRY(cstar_enter)
+#ifdef CONFIG_XEN_SHSTK
         ALTERNATIVE "", "setssbsy", X86_FEATURE_XEN_SHSTK
+#endif
         /* sti could live here when we don't switch page tables below. */
         CR4_PV32_RESTORE
         movq  8(%rsp),%rax /* Restore %rax. */
diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index 6470266d2f..8b57a00040 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -193,12 +193,14 @@ restore_all_guest:
         cmpl  $1,%ecx
         ja    .Lrestore_rcx_iret_exit_to_guest
 
+#ifdef CONFIG_XEN_SHSTK
         /* Clear the supervisor shadow stack token busy bit. */
 .macro rag_clrssbsy
         rdsspq %rcx
         clrssbsy (%rcx)
 .endm
         ALTERNATIVE "", rag_clrssbsy, X86_FEATURE_XEN_SHSTK
+#endif
 
         movq  8(%rsp), %rcx           # RIP
         cmpw  $FLAT_USER_CS32,16(%rsp)# CS
@@ -235,7 +237,9 @@ iret_exit_to_guest:
  * %ss must be saved into the space left by the trampoline.
  */
 ENTRY(lstar_enter)
+#ifdef CONFIG_XEN_SHSTK
         ALTERNATIVE "", "setssbsy", X86_FEATURE_XEN_SHSTK
+#endif
         /* sti could live here when we don't switch page tables below. */
         movq  8(%rsp),%rax /* Restore %rax. */
         movq  $FLAT_KERNEL_SS,8(%rsp)
@@ -269,7 +273,9 @@ ENTRY(lstar_enter)
         jmp   test_all_events
 
 ENTRY(sysenter_entry)
+#ifdef CONFIG_XEN_SHSTK
         ALTERNATIVE "", "setssbsy", X86_FEATURE_XEN_SHSTK
+#endif
         /* sti could live here when we don't switch page tables below. */
         pushq $FLAT_USER_SS
         pushq $0
@@ -889,6 +895,7 @@ handle_ist_exception:
         movq  %rdi,%rsp
         rep   movsq
 
+#ifdef CONFIG_XEN_SHSTK
         /* Switch Shadow Stacks */
 .macro ist_switch_shstk
         rdsspq %rdi
@@ -909,6 +916,7 @@ handle_ist_exception:
         setssbsy
 .endm
         ALTERNATIVE "", ist_switch_shstk, X86_FEATURE_XEN_SHSTK
+#endif
 1:
 #else
         ASSERT_CONTEXT_IS_XEN
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:06:22 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:06:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jhipS-0008Or-Gj; Sun, 07 Jun 2020 00:06:22 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhipR-0008Oi-30
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:06:21 +0000
X-Inumbo-ID: b76b0b9a-a852-11ea-9ad7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id b76b0b9a-a852-11ea-9ad7-bc764e2007e4;
 Sun, 07 Jun 2020 00:06:20 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=55HHd1s4ja1FgXhsa6DHbocNenwuTt628vp1SdvufNY=; b=mrjg/bB2MuG1eSzIK2zp+4FAap
 F2G0gJRbVPNi6muzZLuDrecmfsQ2BBKf00V8yno6tR3bWPsPqqWBazQu5sBz/Rug15LnpVOJDpQyp
 KA6enXgniqTj/mTXK4RjaFjMkmVO6GnM2Nio53PmWpMvP7oTlT3vVqQiZsMtZ1AtBhKg=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhipQ-0003Rc-Hy
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:06:20 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhipQ-00028o-HQ
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:06:20 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] xen/credit2: Fix build following c/s 8e2aa76dc (take 2)
Message-Id: <E1jhipQ-00028o-HQ@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:06:20 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit ad33a573c009d72466432b41ba0591c64e819c19
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Sat May 30 01:52:13 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Sat May 30 01:56:01 2020 +0100

    xen/credit2: Fix build following c/s 8e2aa76dc (take 2)
    
    OSSTest reports:
    
      credit2.c: In function 'cpu_runqueue_siblings_match':
      credit2.c:883:29: error: implicit declaration of function 'cpu_nr_siblings' [-Werror=implicit-function-declaration]
           unsigned int nr_sibls = cpu_nr_siblings(cpu);
                                   ^~~~~~~~~~~~~~~
      credit2.c:883:5: error: nested extern declaration of 'cpu_nr_siblings' [-Werror=nested-externs]
           unsigned int nr_sibls = cpu_nr_siblings(cpu);
           ^~~~~~~~
      cc1: all warnings being treated as errors
    
    For whatever reason, cpufeature.h's inclusion is conditional, and missing for
    arm32.  Inlcude it explicitly.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/common/sched/credit2.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/common/sched/credit2.c b/xen/common/sched/credit2.c
index f4d3f8ae6b..eb5e5a78c5 100644
--- a/xen/common/sched/credit2.c
+++ b/xen/common/sched/credit2.c
@@ -25,6 +25,7 @@
 #include <xen/trace.h>
 #include <xen/cpu.h>
 #include <xen/keyhandler.h>
+#include <asm/cpufeature.h>
 #include <asm/processor.h>
 
 #include "private.h"
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:06:32 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:06:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jhipc-0008Pp-IK; Sun, 07 Jun 2020 00:06:32 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhipb-0008Pf-As
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:06:31 +0000
X-Inumbo-ID: bd6fa24e-a852-11ea-b15b-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id bd6fa24e-a852-11ea-b15b-12813bfff9fa;
 Sun, 07 Jun 2020 00:06:30 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=LBd0CY8FjsUXlimqpO4G+chxlR3lRrHXpSLwiW1AHOc=; b=s7bg9/IG1bb0QVVZWRmIxDQWsO
 giVmCddXy15iwbGAO8cV2GR2RHD4/gftXmKyhRnjMS1gG/5KY//DlIAj4D4H7ChgsZ+Kiy3TVPV3d
 FGfOt2D8nnCFUl+uSToh0QTliEuP1vEEmi2+t3xx8QDR9bYduN8j7UMz/ucRZmA/IKnI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhipa-0003SR-LO
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:06:30 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhipa-00029k-KT
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:06:30 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/mm: do not attempt to convert _PAGE_GNTTAB to a
 boolean
Message-Id: <E1jhipa-00029k-KT@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:06:30 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 6eb61b1a9dfe23ca443f977799cafb22770708a0
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Jun 2 13:36:41 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jun 2 13:36:41 2020 +0200

    x86/mm: do not attempt to convert _PAGE_GNTTAB to a boolean
    
    Clang 10 complains with:
    
    mm.c:1239:10: error: converting the result of '<<' to a boolean always evaluates to true
          [-Werror,-Wtautological-constant-compare]
        if ( _PAGE_GNTTAB && (l1e_get_flags(l1e) & _PAGE_GNTTAB) &&
             ^
    xen/include/asm/x86_64/page.h:161:25: note: expanded from macro '_PAGE_GNTTAB'
    #define _PAGE_GNTTAB (1U<<22)
                            ^
    
    Remove the conversion of _PAGE_GNTTAB to a boolean and instead use a
    preprocessor conditional to check if _PAGE_GNTTAB is defined.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/arch/x86/mm.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 53e3dcb2d4..e376fc7e8f 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -1235,8 +1235,14 @@ void put_page_from_l1e(l1_pgentry_t l1e, struct domain *l1e_owner)
      *
      * (Note that the undestroyable active grants are not a security hole in
      * Xen. All active grants can safely be cleaned up when the domain dies.)
+     *
+     * NB: the preprocessor conditional is required in order to prevent clang's
+     * -Wtautological-constant-compare complaining about converting the result
+     * of a << into a bool is always true if it's evaluated directly in the if
+     * condition.
      */
-    if ( _PAGE_GNTTAB && (l1e_get_flags(l1e) & _PAGE_GNTTAB) &&
+#if _PAGE_GNTTAB
+    if ( (l1e_get_flags(l1e) & _PAGE_GNTTAB) &&
          !l1e_owner->is_shutting_down && !l1e_owner->is_dying )
     {
         gdprintk(XENLOG_WARNING,
@@ -1244,6 +1250,7 @@ void put_page_from_l1e(l1_pgentry_t l1e, struct domain *l1e_owner)
                  l1e_get_intpte(l1e));
         domain_crash(l1e_owner);
     }
+#endif
 
     /*
      * Remember we didn't take a type-count of foreign writable mappings
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:06:42 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:06:42 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jhipm-0008Qt-Jz; Sun, 07 Jun 2020 00:06:42 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhipl-0008Qh-B1
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:06:41 +0000
X-Inumbo-ID: c3744ad2-a852-11ea-b15b-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id c3744ad2-a852-11ea-b15b-12813bfff9fa;
 Sun, 07 Jun 2020 00:06:40 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=41O8sE3uyyI7cWyqIHMJ8D/O/EVe2W1p/APJHtzMAdY=; b=OKB+3+80ZgGOYsbpGxc7B0UBcQ
 6iKd9eE27GSesFXm8GMH4kUwxq7jvscn3YeuqsQW5MPpMth/1IAX/BXmbS+QbIgMUxqcm0AogXaVV
 /gIA7r7PHtiNDYrfV9/rqy6xR0N2w31qgUb7mSkiioqAllzl44oTnAwoXj1dMATIsaKc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhipk-0003UG-Ob
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:06:40 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhipk-0002Ag-Ny
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:06:40 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] build32: don't discard .shstrtab in linker script
Message-Id: <E1jhipk-0002Ag-Ny@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:06:40 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 10d27b48b5b4dfbead2d9bf03290984bba4806e4
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Jun 2 13:37:53 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jun 2 13:37:53 2020 +0200

    build32: don't discard .shstrtab in linker script
    
    LLVM linker doesn't support discarding .shstrtab, and complains with:
    
    ld -melf_i386_fbsd -N -T build32.lds -o reloc.lnk reloc.o
    ld: error: discarding .shstrtab section is not allowed
    
    Add an explicit .shstrtab, .strtab and .symtab sections to the linker
    script after the text section in order to make LLVM LD happy and match
    the behavior of GNU LD.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/arch/x86/boot/build32.lds | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/xen/arch/x86/boot/build32.lds b/xen/arch/x86/boot/build32.lds
index 97454b40ff..1ab9418793 100644
--- a/xen/arch/x86/boot/build32.lds
+++ b/xen/arch/x86/boot/build32.lds
@@ -50,6 +50,20 @@ SECTIONS
         *(.got.plt)
   }
 
+  /*
+   * Discarding .shstrtab is not supported by LLD (LLVM LD) and will trigger an
+   * error. Also keep the rest of the control sections to match GNU LD behavior.
+   */
+  .shstrtab : {
+        *(.shstrtab)
+  }
+  .strtab : {
+        *(.strtab)
+  }
+  .symtab : {
+        *(.symtab)
+  }
+
   /DISCARD/ : {
         /*
          * Discard everything else, to prevent linkers from putting
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:06:52 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:06:52 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jhipw-0008SK-Lh; Sun, 07 Jun 2020 00:06:52 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhipv-0008SB-HI
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:06:51 +0000
X-Inumbo-ID: c97811ca-a852-11ea-b15b-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id c97811ca-a852-11ea-b15b-12813bfff9fa;
 Sun, 07 Jun 2020 00:06:51 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=/SbuePN7FQOhCL1cjhbvHKReojIp6+1tDAvybR1/5JY=; b=pQkPXUbfV9Mh6jZK+3UAkXN0kh
 TD1rBrH/bQJ5P+KidCdjRp4vvmaeOFcs6RPbSZpkRTNRF923Fomj9gG8mrTicyBclx60PBGQa2cvT
 X63SCZwq3KMhRRnbUoQLBnytvc/S5xOwlo13ui89DLs14r+sWEC1wnqMDRGvDct1xTGQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhipu-0003UR-Re
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:06:50 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhipu-0002Bk-Qw
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:06:50 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] ﻿x86/cpu: fix build with clang 3.5
Message-Id: <E1jhipu-0002Bk-Qw@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:06:50 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 51461114e2639596fce174fcdd2fab608883ab3e
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Jun 2 13:38:32 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jun 2 13:38:32 2020 +0200

    ﻿x86/cpu: fix build with clang 3.5
    
    Clang 3.5 complains with:
    
    common.c:794:24: error: statement expression not allowed at file scope
                          i < ARRAY_SIZE(this_cpu(tss_page).ist_ssp); ++i )
                                         ^
    /build/xen/include/asm/percpu.h:14:7: note: expanded from macro 'this_cpu'
        (*RELOC_HIDE(&per_cpu__##var, get_cpu_info()->per_cpu_offset))
          ^
    /build/xen/include/xen/compiler.h:104:3: note: expanded from macro 'RELOC_HIDE'
      ({ unsigned long __ptr;                       \
      ^
    /build/xen/include/xen/lib.h:68:69: note: expanded from macro 'ARRAY_SIZE'
    #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]) + __must_be_array(x))
                                                                        ^
    /build/xen/include/xen/compiler.h:85:57: note: expanded from macro '__must_be_array'
      BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0])))
                                                            ^
    /build/xen/include/xen/lib.h:39:57: note: expanded from macro 'BUILD_BUG_ON_ZERO'
    #define BUILD_BUG_ON_ZERO(cond) sizeof(struct { int:-!!(cond); })
                                                            ^
    
    Workaround this by defining the tss_page as a local variable. Adjust
    other users of the per-cpu tss_page to also use the newly introduced
    local variable.
    
    No functional change expected.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Wei Liu <wl@xen.org>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/arch/x86/cpu/common.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 58f0876180..da74172776 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -738,9 +738,14 @@ void load_system_tables(void)
 	unsigned int i, cpu = smp_processor_id();
 	unsigned long stack_bottom = get_stack_bottom(),
 		stack_top = stack_bottom & ~(STACK_SIZE - 1);
+	/*
+	 * NB: define tss_page as a local variable because clang 3.5 doesn't
+	 * support using ARRAY_SIZE against per-cpu variables.
+	 */
+	struct tss_page *tss_page = &this_cpu(tss_page);
 
 	/* The TSS may be live.	 Disuade any clever optimisations. */
-	volatile struct tss64 *tss = &this_cpu(tss_page).tss;
+	volatile struct tss64 *tss = &tss_page->tss;
 	seg_desc_t *gdt =
 		this_cpu(gdt) - FIRST_RESERVED_GDT_ENTRY;
 
@@ -783,15 +788,14 @@ void load_system_tables(void)
 	 * volatile qualifier.
 	 */
 	if (cpu_has_xen_shstk) {
-		volatile uint64_t *ist_ssp = this_cpu(tss_page).ist_ssp;
+		volatile uint64_t *ist_ssp = tss_page->ist_ssp;
 
 		ist_ssp[0] = 0x8600111111111111ul;
 		ist_ssp[IST_MCE] = stack_top + (IST_MCE * IST_SHSTK_SIZE) - 8;
 		ist_ssp[IST_NMI] = stack_top + (IST_NMI * IST_SHSTK_SIZE) - 8;
 		ist_ssp[IST_DB]	 = stack_top + (IST_DB	* IST_SHSTK_SIZE) - 8;
 		ist_ssp[IST_DF]	 = stack_top + (IST_DF	* IST_SHSTK_SIZE) - 8;
-		for ( i = IST_DF + 1;
-		      i < ARRAY_SIZE(this_cpu(tss_page).ist_ssp); ++i )
+		for ( i = IST_DF + 1; i < ARRAY_SIZE(tss_page->ist_ssp); ++i )
 			ist_ssp[i] = 0x8600111111111111ul;
 
 		wrmsrl(MSR_INTERRUPT_SSP_TABLE, (unsigned long)ist_ssp);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:07:02 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:07:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jhiq6-0008TU-NH; Sun, 07 Jun 2020 00:07:02 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhiq5-0008TL-P3
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:07:01 +0000
X-Inumbo-ID: cf8580b6-a852-11ea-b15b-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id cf8580b6-a852-11ea-b15b-12813bfff9fa;
 Sun, 07 Jun 2020 00:07: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=bpTeErqJa80kY/96/WPdjC7ICqOSrx9KUtVZKWVrjiY=; b=UqUAL+2GcXjX4PihmFpHkhfQJW
 2p95P2E0amj6WfrL7e+ce94MlxfXWsKxkjmOD9RmNmaw7je+yyZq8Ox1saxSiRZVezNXT6xO3oOiV
 YDhKYKklqh90vngh3aVq7KN6ze3fm+iAvIZdDUnAvutyf31fYsV69ABX0tHJHtxALiJ8=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhiq4-0003Ua-UQ
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:07:00 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhiq4-0002Cg-Tk
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:07:00 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] compilers: always use _Static_assert with clang
Message-Id: <E1jhiq4-0002Cg-Tk@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:07:00 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 3d5a836379e5064d563322de095d0775607ff185
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Jun 2 13:39:02 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jun 2 13:39:02 2020 +0200

    compilers: always use _Static_assert with clang
    
    All versions of clang used by Xen support _Static_assert, so use it
    unconditionally when building Xen with clang.
    
    No functional change expected.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Wei Liu <wl@xen.org>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/include/xen/lib.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/include/xen/lib.h b/xen/include/xen/lib.h
index e5b0a007b8..076bcfb67d 100644
--- a/xen/include/xen/lib.h
+++ b/xen/include/xen/lib.h
@@ -25,7 +25,9 @@
 #define BUG_ON(p)  do { if (unlikely(p)) BUG();  } while (0)
 #define WARN_ON(p) do { if (unlikely(p)) WARN(); } while (0)
 
-#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
+/* All clang versions supported by Xen have _Static_assert. */
+#if defined(__clang__) || \
+    (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
 /* Force a compilation error if condition is true */
 #define BUILD_BUG_ON(cond) ({ _Static_assert(!(cond), "!(" #cond ")"); })
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:07:12 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:07: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 1jhiqG-0008Ub-Oz; Sun, 07 Jun 2020 00:07: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=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhiqF-0008UO-PF
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:07:11 +0000
X-Inumbo-ID: d57ed350-a852-11ea-b15b-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id d57ed350-a852-11ea-b15b-12813bfff9fa;
 Sun, 07 Jun 2020 00:07:11 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=A5+pzxjeSAYumxZ3T3D542JNtgl+xRWE1yhqGeQghX8=; b=dIO9n0J8Y5MGp/PEM6kYh23LWe
 qR+TQDoOriCJu4uOj3nc0UadICZGa8QBIWUU86gfX1UPL1vVU4cpKV57I76RDh1MC8CfO5emnSz0h
 daD1Nl+ym9UTyvc3yovBRI9tJRzgeTqY9GUuTeY9EsEEIBlkrjVcgtQuxFMsz+36DuQM=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhiqF-0003Uw-15
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:07:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhiqF-0002Dw-0I
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:07:11 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] INSTALL: remove TODO section
Message-Id: <E1jhiqF-0002Dw-0I@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:07: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 adb93c591af87549639894391f6827805cdf8ced
Author:     Olaf Hering <olaf@aepfle.de>
AuthorDate: Fri May 29 15:53:03 2020 +0200
Commit:     Wei Liu <wl@xen.org>
CommitDate: Tue Jun 2 11:55:38 2020 +0000

    INSTALL: remove TODO section
    
    The default value '/' for DESTDIR is unusual, but does probably not hurt.
    
    Fixes commit f2b40dababedcd8355bf3e85d00baf17f9827131
    Fixes commit 8e986e5a61efeca92b9b268e77957d45d8316ee4
    
    Signed-off-by: Olaf Hering <olaf@aepfle.de>
    Acked-by: Wei Liu <wl@xen.org>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 INSTALL | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/INSTALL b/INSTALL
index 72dc4b67dd..0d3eb89f02 100644
--- a/INSTALL
+++ b/INSTALL
@@ -365,12 +365,5 @@ make XEN_TARGET_ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- \
         DESTDIR=/some/path install
 
 
-TODO
-====
-
- - DESTDIR should be empty, not "/"
- - add make uninstall targets
- - replace private path variables as needed (SBINDIR/sbindir)
- - ...
 
 # vim: tw=72 et
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:07:22 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:07:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jhiqQ-0008Vb-QX; Sun, 07 Jun 2020 00:07:22 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhiqP-0008VS-UP
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:07:21 +0000
X-Inumbo-ID: db956006-a852-11ea-b15b-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id db956006-a852-11ea-b15b-12813bfff9fa;
 Sun, 07 Jun 2020 00:07:21 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=MvbJU8hIT76JzPnGwBxMX+2lkXX1x7kZexAVC5Z6kkI=; b=jFQbYcQ3yPpRcD0z3U3XzCFNcp
 o6IPTuciqJGmfdfLZvkudQ2dW7Uw9r//uPgc5wWleupfktd+8UYf6w7V1taRCIXZpg3QKQ0d6DSoe
 Oc/IKmDjVfngCzxVDu7tHRAi0mkgkEP17g5ssv2n6Ekg80/aa8bf/tuHiDjKmpmDm/98=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhiqP-0003V5-4A
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:07:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhiqP-0002F1-3T
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:07:21 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] libxl: stop libxl_domain_info() consuming massive
 amounts of stack
Message-Id: <E1jhiqP-0002F1-3T@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:07:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 2c4b1a7efb15292c0360f305b64581ac135ab8f2
Author:     Paul Durrant <pdurrant@amazon.com>
AuthorDate: Thu May 28 16:13:30 2020 +0100
Commit:     Wei Liu <wl@xen.org>
CommitDate: Tue Jun 2 11:57:01 2020 +0000

    libxl: stop libxl_domain_info() consuming massive amounts of stack
    
    Currently an array of 1024 xc_domaininfo_t is declared on stack. That alone
    consumes ~112k. Since libxl_domain_info() creates a new gc this patch simply
    uses it to allocate the array instead.
    
    Signed-off-by: Paul Durrant <pdurrant@amazon.com>
    Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 tools/libxl/libxl_domain.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/libxl/libxl_domain.c b/tools/libxl/libxl_domain.c
index c08af308fa..39f08a6519 100644
--- a/tools/libxl/libxl_domain.c
+++ b/tools/libxl/libxl_domain.c
@@ -314,11 +314,13 @@ libxl_dominfo * libxl_list_domain(libxl_ctx *ctx, int *nb_domain_out)
 {
     libxl_dominfo *ptr = NULL;
     int i, ret;
-    xc_domaininfo_t info[1024];
+    xc_domaininfo_t *info;
     int size = 0;
     uint32_t domid = 0;
     GC_INIT(ctx);
 
+    GCNEW_ARRAY(info, 1024);
+
     while ((ret = xc_domain_getinfolist(ctx->xch, domid, 1024, info)) > 0) {
         ptr = libxl__realloc(NOGC, ptr, (size + ret) * sizeof(libxl_dominfo));
         for (i = 0; i < ret; i++) {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:07:32 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:07:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jhiqa-00005E-TX; Sun, 07 Jun 2020 00:07:32 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhiqZ-00004y-QV
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:07:31 +0000
X-Inumbo-ID: e186fc7c-a852-11ea-b15b-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id e186fc7c-a852-11ea-b15b-12813bfff9fa;
 Sun, 07 Jun 2020 00:07:31 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=lkveFPVxToUz70QwZzuOJ8Ac4NpAxZPXOJTDzNkW8m8=; b=3OXq2OSqwlBRkHLqPIHe7Rbf3P
 pkUaCfW2v8/JBFw9/5/KeXGEWr5duBY5TlDNvUljB3X3fhMpqUap5Sq1WFu1Oz74zhD7wdgGui+e6
 u7CelgXoQiCFzB7bEafugLEUjWii3nxq7OSchk/a2+01kUUV/4A/DfjaSTZ74dkX2RtY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhiqZ-0003Vg-76
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:07:31 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhiqZ-0002Fp-6M
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:07:31 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] automation: update openSUSE Tumbleweed building
 dependencies
Message-Id: <E1jhiqZ-0002Fp-6M@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:07:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 92076f0994268196f595b166e5ed3701551e9954
Author:     Dario Faggioli <dfaggioli@suse.com>
AuthorDate: Thu Apr 30 20:27:28 2020 +0200
Commit:     Wei Liu <wl@xen.org>
CommitDate: Tue Jun 2 12:01:47 2020 +0000

    automation: update openSUSE Tumbleweed building dependencies
    
    We need python3 (and the respective -devel package), these days.
    
    Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
    Acked-by: Wei Liu <wl@xen.org>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 automation/build/suse/opensuse-tumbleweed.dockerfile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/automation/build/suse/opensuse-tumbleweed.dockerfile b/automation/build/suse/opensuse-tumbleweed.dockerfile
index 2676a87c85..084cce0921 100644
--- a/automation/build/suse/opensuse-tumbleweed.dockerfile
+++ b/automation/build/suse/opensuse-tumbleweed.dockerfile
@@ -56,6 +56,8 @@ RUN zypper install -y --no-recommends \
         pkg-config \
         python \
         python-devel \
+        python3 \
+        python3-devel \
         systemd-devel \
         tar \
         transfig \
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:07:42 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:07:42 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jhiqk-00006F-V9; Sun, 07 Jun 2020 00:07:42 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhiqj-000066-UM
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:07:41 +0000
X-Inumbo-ID: e78afc36-a852-11ea-b15b-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id e78afc36-a852-11ea-b15b-12813bfff9fa;
 Sun, 07 Jun 2020 00:07:41 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=yFqW16kQR1cqn1CMT0Qo2uW8qQoqfXmtD0wmws5h3p4=; b=JYQlAHIG/8w7kSdQwoGAZ8N/+4
 rEdGEz60rbm0U+RJhsdggwNGBt59oWm1pT1xLs5VSgkrYmBZV7EwTrZj0l7lFxHrmYmqrKh5qoJii
 U5cbtIKFXla3t87wl9QrwZclZGx+dyXuijhrttsZ4ZSek+pkGCx6aIsaUm6ghpIsIXB0=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhiqj-0003Vp-A5
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:07:41 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhiqj-0002Gb-9F
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:07:41 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] automation: openSUSE distro names helpers for
 containerize
Message-Id: <E1jhiqj-0002Gb-9F@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:07:41 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 177b81e4649ca21fe6261e8cfbb4f135e3049029
Author:     Dario Faggioli <dfaggioli@suse.com>
AuthorDate: Tue Jun 2 12:01:05 2020 +0000
Commit:     Wei Liu <wl@xen.org>
CommitDate: Tue Jun 2 12:01:51 2020 +0000

    automation: openSUSE distro names helpers for containerize
    
    Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
    Acked-by: Wei Liu <wl@xen.org>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 automation/scripts/containerize | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/automation/scripts/containerize b/automation/scripts/containerize
index b71edd736c..22da711ace 100755
--- a/automation/scripts/containerize
+++ b/automation/scripts/containerize
@@ -25,6 +25,8 @@ case "_${CONTAINER}" in
     _unstable|_) CONTAINER="${BASE}/debian:unstable" ;;
     _trusty) CONTAINER="${BASE}/ubuntu:trusty" ;;
     _xenial) CONTAINER="${BASE}/ubuntu:xenial" ;;
+    _opensuse-leap|_leap) CONTAINER="${BASE}/suse:opensuse-leap" ;;
+    _opensuse-tumbleweed|_tumbleweed) CONTAINER="${BASE}/suse:opensuse-tumbleweed" ;;
 esac
 
 # Use this variable to control whether root should be used
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:07:53 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:07:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jhiqv-000087-0T; Sun, 07 Jun 2020 00:07:53 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhiqu-00007w-3G
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:07:52 +0000
X-Inumbo-ID: ed8f2bc0-a852-11ea-ba62-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id ed8f2bc0-a852-11ea-ba62-bc764e2007e4;
 Sun, 07 Jun 2020 00:07:51 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=89YXi58FWM236CCAWXK2+2GSuP69POUmOyolSyPpP8I=; b=QdaXCHU5TMZu1NcxRxhOQYXd7+
 dWAbPIADdFmAb7FoKq62qYPR0AaKsic0ovX+4VbtZN0mNEgQU5djqBtRdiIR3i4K0eaqgQRpBpm/m
 bfc9TnqR8kqE0Z0ta7DteH1VNDkMn8wOkggBjw05VMMRRmw233MfzMDDjo/zmHRpHqrc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhiqt-0003W4-Cv
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:07:51 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhiqt-0002HW-CF
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:07:51 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] automation: implement (rootless) podman support in
 containerize
Message-Id: <E1jhiqt-0002HW-CF@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:07:51 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 753ba5b37d6b547a7aa5f54fd498b56e02c80e2f
Author:     Dario Faggioli <dfaggioli@suse.com>
AuthorDate: Thu Apr 30 20:27:39 2020 +0200
Commit:     Wei Liu <wl@xen.org>
CommitDate: Tue Jun 2 12:01:51 2020 +0000

    automation: implement (rootless) podman support in containerize
    
    Right now only docker is supported, when using the containerize script
    for building inside containers. Enable podman as well.
    
    Note that podman can be use in rootless mode too, but for that to work
    the files /etc/subuid and /etc/subgid must be properly configured.
    
    For instance:
    
    dario@localhost> cat /etc/subuid
    dario:100000:65536
    
    dario@localhost:> cat /etc/subgid
    dario:100000:65536
    
    Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
    Acked-by: Wei Liu <wl@xen.org>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 automation/build/README.md      | 10 ++++++++++
 automation/scripts/containerize | 17 +++++++++++++----
 2 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/automation/build/README.md b/automation/build/README.md
index 8cda2b65a5..e1fb3124de 100644
--- a/automation/build/README.md
+++ b/automation/build/README.md
@@ -34,6 +34,16 @@ the default shell.
 There are several environment variables which the containerize script
 understands.
 
+- DOCKED_CMD: Whether to use docker or podman for running the containers.
+  podman can be used as a regular user (rootless podman), but for that
+  to work, /etc/subuid and /etc/subgid needs to containe the proper
+  entries, for such user.
+  docker is the default, for running with podman, do:
+
+  ```
+  DOCKER_CMD=podman ./automation/scripts/containerize make
+  ```
+
 - CONTAINER: This overrides the container to use. For CentOS 7.2, use:
 
   ```
diff --git a/automation/scripts/containerize b/automation/scripts/containerize
index 22da711ace..a75d54566c 100755
--- a/automation/scripts/containerize
+++ b/automation/scripts/containerize
@@ -1,5 +1,14 @@
 #!/bin/bash
 
+#
+# DOCKER_CMD should be either `docker` or `podman`.
+#
+# if using (rootless) podman, remember to set /etc/subuid
+# and /etc/subgid.
+#
+docker_cmd=${DOCKER_CMD:-"docker"}
+[ "$DOCKER_CMD" = "podman" ] && userns_podman="--userns=keep-id"
+
 einfo() {
     echo "$*" >&2
 }
@@ -32,7 +41,7 @@ esac
 # Use this variable to control whether root should be used
 case "_${CONTAINER_UID0}" in
     _1)   userarg= ;;
-    _0|_) userarg="-u $(id -u)" ;;
+    _0|_) userarg="-u $(id -u) $userns_podman" ;;
 esac
 
 # Save the commands for future use
@@ -50,8 +59,8 @@ tty -s && termint=t
 #
 if [[ "_${CONTAINER_NO_PULL}" != "_1" ]]; then
     einfo "*** Ensuring ${CONTAINER} is up to date"
-    docker pull ${CONTAINER} > /dev/null ||     \
-        die "Failed to update docker container"
+    ${docker_cmd} pull ${CONTAINER} > /dev/null ||     \
+        die "Failed to update container"
 fi
 
 if hash greadlink > /dev/null 2>&1; then
@@ -83,7 +92,7 @@ fi
 
 # Kick off Docker
 einfo "*** Launching container ..."
-exec docker run \
+exec ${docker_cmd} run \
     ${userarg} \
     ${SSH_AUTH_SOCK:+-e SSH_AUTH_SOCK="/tmp/ssh-agent/${SSH_AUTH_NAME}"} \
     -v "${CONTAINER_PATH}":/build:rw \
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:08:04 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:08: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 1jhir6-000096-27; Sun, 07 Jun 2020 00:08: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=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhir4-00008u-Hy
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:08:02 +0000
X-Inumbo-ID: f392eb24-a852-11ea-b15b-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id f392eb24-a852-11ea-b15b-12813bfff9fa;
 Sun, 07 Jun 2020 00:08: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=XQn0rbTH+UuUJSddm3cnEABm4HnQGDYjV/3DaorTffk=; b=FrXEeatdhkApARQegfLBkiHSE1
 qh/CeulX0b14LPjdKrLo5nCilnBxSzhPuDJlCYJlbdynJCN53fvShUoqouIZ+5npdxa4h9dWMvFGG
 Gu3KgXYKKHwxml5Sp6Pp1/bXP8X2L9RA+5vjpdntzATL+DMSVY6wcY3fcGGO3z4F1MfA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhir3-0003WD-Fz
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:08:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhir3-0002IC-FB
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:08:01 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] CHANGELOG: Add qemu-xen linux device model stubdomains
Message-Id: <E1jhir3-0002IC-FB@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:08: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 52a9022fe95a417097ceb71bb59639201f7b1966
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Tue Jun 2 12:03:56 2020 +0000
Commit:     Wei Liu <wl@xen.org>
CommitDate: Tue Jun 2 12:03:56 2020 +0000

    CHANGELOG: Add qemu-xen linux device model stubdomains
    
    Add qemu-xen linux device model stubdomain.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: Paul Durrant <paul@xen.org>
---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 75b7582447..8786c51cb4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,6 +17,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Hypervisor framework to ease porting Xen to run on hypervisors.
  - Initial support to run on Hyper-V.
  - Initial hypervisor file system (hypfs) support.
+ - libxl support for running qemu-xen device model in a linux stubdomain.
 
 ## [4.13.0](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.13.0) - 2019-12-17
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:08:13 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:08: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 1jhirF-0000AE-3n; Sun, 07 Jun 2020 00:08: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=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhirE-0000A3-5F
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:08:12 +0000
X-Inumbo-ID: f997d1ce-a852-11ea-96fb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id f997d1ce-a852-11ea-96fb-bc764e2007e4;
 Sun, 07 Jun 2020 00:08:11 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=HC0gXCl4/02I+5L6g9Xkv+6S3WZX8wzKfKfhZuUzE9o=; b=YId1EZbazWQ2+fuyaCINMCOTgz
 CfJh8WWjGjH/QgaRlzzKbugQvbvrrK1qtvdZwsC1iw/W8us2cXlHxjLkDoSDVKVZIqaNCRPQw6Cy2
 V9Ltt+4L/rXJooRzJ45G45QL0XWNwLJXrauZ/xxE+X74RIfT7UjDMDoI719VV0UzUN+0=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhirD-0003WZ-J5
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:08:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhirD-0002Ir-IG
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:08:11 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] tools: check return value of asprintf() in xenhypfs
Message-Id: <E1jhirD-0002Ir-IG@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:08: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 370b41113eaed780f109d708e4478a6bfb794459
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Jun 2 08:00:20 2020 +0200
Commit:     Wei Liu <wl@xen.org>
CommitDate: Tue Jun 2 12:05:13 2020 +0000

    tools: check return value of asprintf() in xenhypfs
    
    asprintf() can fail, so check its return value. Additionally fix a
    memory leak in xenhypfs.
    
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Wei Liu <wl@xen.org>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/misc/xenhypfs.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tools/misc/xenhypfs.c b/tools/misc/xenhypfs.c
index 158b901f42..5145b8969f 100644
--- a/tools/misc/xenhypfs.c
+++ b/tools/misc/xenhypfs.c
@@ -148,9 +148,14 @@ static int xenhypfs_tree_sub(char *path, unsigned int depth)
         printf("%*s%s%s\n", depth * 2, "", ent[i].name,
                ent[i].type == xenhypfs_type_dir ? "/" : "");
         if (ent[i].type == xenhypfs_type_dir) {
-            asprintf(&p, "%s%s%s", path, (depth == 1) ? "" : "/", ent[i].name);
+            if (asprintf(&p, "%s%s%s", path, (depth == 1) ? "" : "/",
+                         ent[i].name) < 0) {
+                ret = 2;
+                break;
+            }
             if (xenhypfs_tree_sub(p, depth + 1))
                 ret = 2;
+            free(p);
         }
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:08:24 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:08: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 1jhirQ-0000DB-5h; Sun, 07 Jun 2020 00:08: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=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhirO-0000D2-D5
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:08:22 +0000
X-Inumbo-ID: ff9c226e-a852-11ea-b15b-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id ff9c226e-a852-11ea-b15b-12813bfff9fa;
 Sun, 07 Jun 2020 00:08:21 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=hatZbTwvMyd4T21IO2N/M8/+ZpZZdVejvifmwm9i294=; b=sppaFdWDaEL5YcACVrdxsqFo0Z
 Vbi5JQ1/7e4dPXswnaCxpFYn8UVlYutNr+p2yT1g0aKArc72qOciLeqidJi5sp3nqjDyIIREdobnd
 HqeArZLWLunig7PCfNSUCh8fmKXswl+ztmlVj4pNs9VuTnknko+WnRD6wo/SO+rbTW7o=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhirN-0003Wl-MC
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:08:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhirN-0002JQ-LK
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:08:21 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] tools: make libxenhypfs interface more future proof
Message-Id: <E1jhirN-0002JQ-LK@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:08:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit dde6174ada5280cd9a6396e3b12606360a0d29a3
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Jun 2 08:00:21 2020 +0200
Commit:     Wei Liu <wl@xen.org>
CommitDate: Tue Jun 2 12:05:30 2020 +0000

    tools: make libxenhypfs interface more future proof
    
    As compilers are free to choose the width of an enum they should be
    avoided in stable interfaces when declaring a variable. So the
    struct xenhypfs_dirent definition should be modified to have explicitly
    sized members for type and encoding and the related enums should be
    defined separately.
    
    Additionally it is better to have a larger flags member in that struct
    with the "writable" indicator occupying only a single bit. This will
    make future additions easier.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Wei Liu <wl@xen.org>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/libs/hypfs/core.c             |  2 +-
 tools/libs/hypfs/include/xenhypfs.h | 31 ++++++++++++++++++-------------
 tools/misc/xenhypfs.c               |  3 ++-
 3 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/tools/libs/hypfs/core.c b/tools/libs/hypfs/core.c
index d4309b5ae2..c91e165705 100644
--- a/tools/libs/hypfs/core.c
+++ b/tools/libs/hypfs/core.c
@@ -204,7 +204,7 @@ static void xenhypfs_set_attrs(struct xen_hypfs_direntry *entry,
         dirent->type = xenhypfs_type_blob;
     }
 
-    dirent->is_writable = entry->max_write_len;
+    dirent->flags = entry->max_write_len ? XENHYPFS_FLAG_WRITABLE : 0;
 }
 
 void *xenhypfs_read_raw(xenhypfs_handle *fshdl, const char *path,
diff --git a/tools/libs/hypfs/include/xenhypfs.h b/tools/libs/hypfs/include/xenhypfs.h
index ab157edceb..25432d2a16 100644
--- a/tools/libs/hypfs/include/xenhypfs.h
+++ b/tools/libs/hypfs/include/xenhypfs.h
@@ -26,22 +26,27 @@ struct xentoollog_logger;
 
 typedef struct xenhypfs_handle xenhypfs_handle;
 
+enum xenhypfs_type {
+    xenhypfs_type_dir,
+    xenhypfs_type_blob,
+    xenhypfs_type_string,
+    xenhypfs_type_uint,
+    xenhypfs_type_int,
+    xenhypfs_type_bool,
+};
+
+enum xenhypfs_encoding {
+    xenhypfs_enc_plain,
+    xenhypfs_enc_gzip
+};
+
 struct xenhypfs_dirent {
     char *name;
     size_t size;
-    enum {
-        xenhypfs_type_dir,
-        xenhypfs_type_blob,
-        xenhypfs_type_string,
-        xenhypfs_type_uint,
-        xenhypfs_type_int,
-        xenhypfs_type_bool
-    } type;
-    enum {
-        xenhypfs_enc_plain,
-        xenhypfs_enc_gzip
-    } encoding;
-    bool is_writable;
+    unsigned short type;
+    unsigned short encoding;
+    unsigned int flags;
+#define XENHYPFS_FLAG_WRITABLE  0x00000001
 };
 
 xenhypfs_handle *xenhypfs_open(struct xentoollog_logger *logger,
diff --git a/tools/misc/xenhypfs.c b/tools/misc/xenhypfs.c
index 5145b8969f..5da24aed90 100644
--- a/tools/misc/xenhypfs.c
+++ b/tools/misc/xenhypfs.c
@@ -125,7 +125,8 @@ static int xenhypfs_ls(char *path)
     } else {
         for (i = 0; i < n; i++)
             printf("%s r%c %s\n", xenhypfs_type(ent + i),
-                   ent[i].is_writable ? 'w' : '-', ent[i].name);
+                   (ent[i].flags & XENHYPFS_FLAG_WRITABLE) ? 'w' : '-',
+                   ent[i].name);
 
         free(ent);
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:08:34 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:08: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 1jhira-0000EC-7R; Sun, 07 Jun 2020 00:08: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=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhirY-0000Dw-AV
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:08:32 +0000
X-Inumbo-ID: 05a0048c-a853-11ea-9b55-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 05a0048c-a853-11ea-9b55-bc764e2007e4;
 Sun, 07 Jun 2020 00:08:31 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=Mh7IVB00iHCVSoYFbL8lMpbT478ezP0Uzc5dN83OGZ4=; b=5ZjgnsJ/Yz/M9H2+7bqcB30sb6
 DwzjYTR4gqPiO6pWiZQr3fGDsYGoXUEAw29tcFZ6AG1bFhPO8uU8wKu0Xn91InQW5UGDiHHz/rjGH
 0FOVPinPTZSZY0ArGuqa+u35OiqxtLKITlq8GXCWkJvSVuZI95d5jMc70AlYYjLDshRE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhirX-0003XY-P2
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:08:31 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhirX-0002K1-OJ
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:08:31 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] ] m4: use test instead of []
Message-Id: <E1jhirX-0002K1-OJ@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:08:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit e181db8ba4e0797b8f9b55996adfa71ffb5b4081
Author:     Wei Liu <wl@xen.org>
AuthorDate: Tue Jun 2 10:01:38 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Tue Jun 2 17:46:32 2020 +0100

    ] m4: use test instead of []
    
    It is reported that [] was removed by autoconf, which caused the
    following error:
    
      ./configure: line 4681: -z: command not found
    
    Switch to test. That's what is used throughout our configure scripts.
    Also put the variable expansion in quotes.
    
    Signed-off-by: Wei Liu <wl@xen.org>
    Reported-by: Bertrand Marquis <Bertrand.Marquis@arm.com>
    Fixes: 8a6b1665d987 ("configure: also add EXTRA_PREFIX to {CPP/LD}FLAGS")
    Signed-off-by: Wei Liu <wl@xen.org>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 m4/set_cflags_ldflags.m4 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/m4/set_cflags_ldflags.m4 b/m4/set_cflags_ldflags.m4
index 08f5c983cc..23706e256b 100644
--- a/m4/set_cflags_ldflags.m4
+++ b/m4/set_cflags_ldflags.m4
@@ -15,7 +15,7 @@ for ldflag in $APPEND_LIB
 do
     APPEND_LDFLAGS="$APPEND_LDFLAGS -L$ldflag"
 done
-if [ ! -z $EXTRA_PREFIX ]; then
+if test ! -z "$EXTRA_PREFIX" ; then
     CPPFLAGS="$CPPFLAGS -I$EXTRA_PREFIX/include"
     LDFLAGS="$LDFLAGS -L$EXTRA_PREFIX/lib"
 fi
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:08:44 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:08: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 1jhirk-0000G4-AO; Sun, 07 Jun 2020 00:08: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=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhiri-0000FQ-Aj
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:08:42 +0000
X-Inumbo-ID: 0ba48614-a853-11ea-9b55-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 0ba48614-a853-11ea-9b55-bc764e2007e4;
 Sun, 07 Jun 2020 00:08: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=s8VEhp+ikfvzbiF54wKCDb1XHoXzU/tJhxGdmXHFKf0=; b=NgOY0SET9BLg4Kk2ZzmXwy8UE8
 KUIrdTeihILALDcoTr4tCGKOBe0jG+TVTKtc5KQPStVoRi7M+DvGIGmrcu8dzDt8K70DXYkek5AHp
 v85uThmxPXFnnNF7/PiE9k8+/jQQ9gz/o03HQbWeaFlF0RsrQspdVkuAfEnPQTavTd6U=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhirh-0003Xh-SP
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:08:41 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhirh-0002Kv-Rn
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:08:41 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] tools: update configure
Message-Id: <E1jhirh-0002Kv-Rn@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:08:41 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit b1e3a3c874b9bab32cc56820ae3e3d568c120181
Author:     Wei Liu <wl@xen.org>
AuthorDate: Tue Jun 2 17:32:02 2020 +0000
Commit:     Wei Liu <wl@xen.org>
CommitDate: Tue Jun 2 17:55:42 2020 +0000

    tools: update configure
    
    Fixes: e181db8ba4e0 ("m4: use test instead of []")
    Signed-off-by: Wei Liu <wl@xen.org>
---
 tools/configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/configure b/tools/configure
index 35036dc1db..3df1a01ff9 100755
--- a/tools/configure
+++ b/tools/configure
@@ -4688,7 +4688,7 @@ for ldflag in $APPEND_LIB
 do
     APPEND_LDFLAGS="$APPEND_LDFLAGS -L$ldflag"
 done
-if  ! -z $EXTRA_PREFIX ; then
+if test ! -z "$EXTRA_PREFIX" ; then
     CPPFLAGS="$CPPFLAGS -I$EXTRA_PREFIX/include"
     LDFLAGS="$LDFLAGS -L$EXTRA_PREFIX/lib"
 fi
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:08:54 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:08: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 1jhiru-0000H8-Bs; Sun, 07 Jun 2020 00:08: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=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhirs-0000Gv-Tc
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:08:52 +0000
X-Inumbo-ID: 11adc872-a853-11ea-96fb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 11adc872-a853-11ea-96fb-bc764e2007e4;
 Sun, 07 Jun 2020 00:08: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=BhFw/YmJkAuPf7rioqq1rozUg7rQD6By5urHdObMAwI=; b=IPlLIv4JgWHmkVQTnWKOScuBas
 OtkB9Fk5KfKvrseX4r4BQ/PdBBkJvydBk6smYkbU9/iRFPlW4qDtcG58jU0fv26ZEqCnzHkrM1kdq
 jMzjVkZJc4TgQJKyp9dq6T2mD4SHzvBZLC0hTIiaUDGYWMsZjARx+C159G5gfNcK7cQg=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhirr-0003Xq-Vl
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:08:51 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhirr-0002Ll-Uy
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:08:51 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/ucode: Fix errors with start/end_update()
Message-Id: <E1jhirr-0002Ll-Uy@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:08:51 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 3659f54e9bd31f0f59268402fd67fb4b4118e184
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Jun 1 15:37:20 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jun 2 19:18:44 2020 +0100

    x86/ucode: Fix errors with start/end_update()
    
    c/s 9267a439c "x86/ucode: Document the behaviour of the microcode_ops hooks"
    identified several poor behaviours of the start_update()/end_update_percpu()
    hooks.
    
    AMD have subsequently confirmed that OSVW don't, and are not expected to,
    change across a microcode load, rendering all of this complexity unecessary.
    
    Instead of fixing up the logic to not leave the OSVW state reset in a number
    of corner cases, delete the logic entirely.
    
    This in turn allows for the removal of the poorly-named 'start_update'
    parameter to microcode_update_one(), and for svm_host_osvw_{init,reset}() to
    become static.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/arch/x86/acpi/power.c            |  2 +-
 xen/arch/x86/cpu/microcode/amd.c     | 18 ------------------
 xen/arch/x86/cpu/microcode/core.c    | 33 +++------------------------------
 xen/arch/x86/cpu/microcode/private.h | 14 --------------
 xen/arch/x86/hvm/svm/svm.c           |  4 ++--
 xen/arch/x86/smpboot.c               |  2 +-
 xen/include/asm-x86/hvm/svm/svm.h    |  3 ---
 xen/include/asm-x86/microcode.h      |  2 +-
 8 files changed, 8 insertions(+), 70 deletions(-)

diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
index 0cda362045..dfffe08e18 100644
--- a/xen/arch/x86/acpi/power.c
+++ b/xen/arch/x86/acpi/power.c
@@ -287,7 +287,7 @@ static int enter_state(u32 state)
     console_end_sync();
     watchdog_enable();
 
-    microcode_update_one(true);
+    microcode_update_one();
 
     if ( !recheck_cpu_features(0) )
         panic("Missing previously available feature(s)\n");
diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c
index 3f0969e70d..cd532321e8 100644
--- a/xen/arch/x86/cpu/microcode/amd.c
+++ b/xen/arch/x86/cpu/microcode/amd.c
@@ -18,7 +18,6 @@
 #include <xen/init.h>
 #include <xen/mm.h> /* TODO: Fix asm/tlbflush.h breakage */
 
-#include <asm/hvm/svm/svm.h>
 #include <asm/msr.h>
 
 #include "private.h"
@@ -395,26 +394,9 @@ static struct microcode_patch *cpu_request_microcode(const void *buf, size_t siz
     return patch;
 }
 
-#ifdef CONFIG_HVM
-static int start_update(void)
-{
-    /*
-     * svm_host_osvw_init() will be called on each cpu by calling '.end_update'
-     * in common code.
-     */
-    svm_host_osvw_reset();
-
-    return 0;
-}
-#endif
-
 const struct microcode_ops amd_ucode_ops = {
     .cpu_request_microcode            = cpu_request_microcode,
     .collect_cpu_info                 = collect_cpu_info,
     .apply_microcode                  = apply_microcode,
-#ifdef CONFIG_HVM
-    .start_update                     = start_update,
-    .end_update_percpu                = svm_host_osvw_init,
-#endif
     .compare_patch                    = compare_patch,
 };
diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode/core.c
index d879d28787..18ebc07b13 100644
--- a/xen/arch/x86/cpu/microcode/core.c
+++ b/xen/arch/x86/cpu/microcode/core.c
@@ -546,9 +546,6 @@ static int do_microcode_update(void *patch)
     else
         ret = secondary_thread_fn();
 
-    if ( microcode_ops->end_update_percpu )
-        microcode_ops->end_update_percpu();
-
     return ret;
 }
 
@@ -620,16 +617,6 @@ static long microcode_update_helper(void *data)
     }
     spin_unlock(&microcode_mutex);
 
-    if ( microcode_ops->start_update )
-    {
-        ret = microcode_ops->start_update();
-        if ( ret )
-        {
-            microcode_free_patch(patch);
-            goto put;
-        }
-    }
-
     cpumask_clear(&cpu_callin_map);
     atomic_set(&cpu_out, 0);
     atomic_set(&cpu_updated, 0);
@@ -728,28 +715,14 @@ static int __init microcode_init(void)
 __initcall(microcode_init);
 
 /* Load a cached update to current cpu */
-int microcode_update_one(bool start_update)
+int microcode_update_one(void)
 {
-    int err;
-
     if ( !microcode_ops )
         return -EOPNOTSUPP;
 
     microcode_ops->collect_cpu_info();
 
-    if ( start_update && microcode_ops->start_update )
-    {
-        err = microcode_ops->start_update();
-        if ( err )
-            return err;
-    }
-
-    err = microcode_update_cpu(NULL);
-
-    if ( microcode_ops->end_update_percpu )
-        microcode_ops->end_update_percpu();
-
-    return err;
+    return microcode_update_cpu(NULL);
 }
 
 /* BSP calls this function to parse ucode blob and then apply an update. */
@@ -790,7 +763,7 @@ static int __init early_microcode_update_cpu(void)
     spin_unlock(&microcode_mutex);
     ASSERT(rc);
 
-    return microcode_update_one(true);
+    return microcode_update_one();
 }
 
 int __init early_microcode_init(void)
diff --git a/xen/arch/x86/cpu/microcode/private.h b/xen/arch/x86/cpu/microcode/private.h
index dc5c7a81ae..c00ba590d1 100644
--- a/xen/arch/x86/cpu/microcode/private.h
+++ b/xen/arch/x86/cpu/microcode/private.h
@@ -45,20 +45,6 @@ struct microcode_ops {
      */
     int (*apply_microcode)(const struct microcode_patch *patch);
 
-    /*
-     * Optional.  If provided and applicable to the specific update attempt,
-     * is run once by the initiating CPU.  Returning an error will abort the
-     * load attempt.
-     */
-    int (*start_update)(void);
-
-    /*
-     * Optional.  If provided, called on every CPU which completes a microcode
-     * load.  May be called in the case of some errors, and not others.  May
-     * be called even if start_update() wasn't.
-     */
-    void (*end_update_percpu)(void);
-
     /*
      * Given two patches, are they both applicable to the current CPU, and is
      * new a higher revision than old?
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 46a1aac949..44ff9d0c6b 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -1084,7 +1084,7 @@ static void svm_guest_osvw_init(struct domain *d)
     spin_unlock(&osvw_lock);
 }
 
-void svm_host_osvw_reset()
+static void svm_host_osvw_reset(void)
 {
     spin_lock(&osvw_lock);
 
@@ -1094,7 +1094,7 @@ void svm_host_osvw_reset()
     spin_unlock(&osvw_lock);
 }
 
-void svm_host_osvw_init()
+static void svm_host_osvw_init(void)
 {
     spin_lock(&osvw_lock);
 
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index 13b3dade9c..f878a00760 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -369,7 +369,7 @@ void start_secondary(void *unused)
 
     initialize_cpu_data(cpu);
 
-    microcode_update_one(false);
+    microcode_update_one();
 
     /*
      * If MSR_SPEC_CTRL is available, apply Xen's default setting and discard
diff --git a/xen/include/asm-x86/hvm/svm/svm.h b/xen/include/asm-x86/hvm/svm/svm.h
index cd71402cbb..d568e86db9 100644
--- a/xen/include/asm-x86/hvm/svm/svm.h
+++ b/xen/include/asm-x86/hvm/svm/svm.h
@@ -94,9 +94,6 @@ extern u32 svm_feature_flags;
 #define DEFAULT_TSC_RATIO       0x0000000100000000ULL
 #define TSC_RATIO_RSVD_BITS     0xffffff0000000000ULL
 
-extern void svm_host_osvw_reset(void);
-extern void svm_host_osvw_init(void);
-
 /* EXITINFO1 fields on NPT faults */
 #define _NPT_PFEC_with_gla     32
 #define NPT_PFEC_with_gla      (1UL<<_NPT_PFEC_with_gla)
diff --git a/xen/include/asm-x86/microcode.h b/xen/include/asm-x86/microcode.h
index 9da63f992e..3b0234e9fa 100644
--- a/xen/include/asm-x86/microcode.h
+++ b/xen/include/asm-x86/microcode.h
@@ -22,6 +22,6 @@ DECLARE_PER_CPU(struct cpu_signature, cpu_sig);
 void microcode_set_module(unsigned int idx);
 int microcode_update(XEN_GUEST_HANDLE(const_void), unsigned long len);
 int early_microcode_init(void);
-int microcode_update_one(bool start_update);
+int microcode_update_one(void);
 
 #endif /* ASM_X86__MICROCODE_H */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:09:04 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:09: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 1jhis4-0000IE-Dc; Sun, 07 Jun 2020 00:09: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=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhis2-0000I1-On
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:09:02 +0000
X-Inumbo-ID: 17b2ceca-a853-11ea-b15b-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 17b2ceca-a853-11ea-b15b-12813bfff9fa;
 Sun, 07 Jun 2020 00:09: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=EhAUH/+FJTTohKBrMFtBRpw+mGElpGalt8YzwHMQ5bo=; b=D6Mlj3hr7Q6RhhQODp3dNq546n
 nnDcuSY1PPB4U6audrNxszPXhKWyKHxx7LmeuYB2Zv3UG5JWwhn5Z2dyEs66JyDICVxeMkAJgWy/C
 6XbduXGmj3/J+uT9mKbHzyEIOAiI41vnfm0VhP9jL94KU3q+///1vDf5EkjSPKtzAOB8=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhis2-0003YC-2Y
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:09:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhis2-0002NB-1t
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:09:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] docs/ucode: Extend runtime microcode loading
 documentation
Message-Id: <E1jhis2-0002NB-1t@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:09: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 99a76a88d5e7f4693bb6b286e366006e1da1c954
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Jun 1 14:36:28 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jun 2 19:18:44 2020 +0100

    docs/ucode: Extend runtime microcode loading documentation
    
    Extend the disclaimer about runtime loading.  While we've done our best to
    make the mechaism reliable, the safety of late loading does ultimately depend
    on the contents of the blobs.
    
    Extend the xen-ucode portion with examples of how to use it.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
    ---
    CC: George Dunlap <George.Dunlap@eu.citrix.com>
    CC: Ian Jackson <ian.jackson@citrix.com>
    CC: Jan Beulich <JBeulich@suse.com>
    CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
    CC: Stefano Stabellini <sstabellini@kernel.org>
    CC: Wei Liu <wl@xen.org>
    CC: Julien Grall <julien@xen.org>
    CC: Paul Durrant <paul@xen.org>
---
 docs/admin-guide/microcode-loading.rst | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/docs/admin-guide/microcode-loading.rst b/docs/admin-guide/microcode-loading.rst
index e83cadd2c2..a07e25802f 100644
--- a/docs/admin-guide/microcode-loading.rst
+++ b/docs/admin-guide/microcode-loading.rst
@@ -105,8 +105,8 @@ modules to find any CPIO archives, and search the archive for the applicable
 file.  Xen will stop searching at the first match.
 
 
-Run time microcode loading
---------------------------
+Runtime microcode loading
+-------------------------
 
 .. warning::
 
@@ -114,7 +114,25 @@ Run time microcode loading
    or at boot time.  Not all microcode updates (or parts thereof) can be
    applied at runtime.
 
-The ``xen-ucode`` utility can be used to initiate a runtime microcode load.
+   Given the proprietary nature of microcode, we are unable to make any claim
+   that runtime microcode loading is risk-free.  Any runtime microcode loading
+   needs adequate testing on a development instance before being rolled out to
+   production systems.
+
+The ``xen-ucode`` utility can be used to initiate a runtime microcode load::
+
+  [root@host ~]# xen-ucode
+  xen-ucode: Xen microcode updating tool
+  Usage: xen-ucode <microcode blob>
+  [root@host ~]#
+
+The details of microcode blobs (if even packaged to begin with) are specific
+to the dom0 distribution.  Consult your dom0 OS documentation for details.
+One example with a Linux dom0 on a Haswell system might look like::
+
+  [root@host ~]# xen-ucode /lib/firmware/intel-ucode/06-3c-03
+  [root@host ~]#
+
 It will pass the blob to Xen, which will check to see whether the blob is
 correct for the processor, and newer than the running microcode.
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:09:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:09: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 1jhisE-0000Jd-FM; Sun, 07 Jun 2020 00:09: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=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhisC-0000JN-Qj
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:09:12 +0000
X-Inumbo-ID: 1db30402-a853-11ea-b15b-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 1db30402-a853-11ea-b15b-12813bfff9fa;
 Sun, 07 Jun 2020 00:09: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=aOsaX3DAnKJD0H+oVu/48DMFIHGhZK3g49WZcdIMTXg=; b=SywH28mHGhkkMyy42ShJVOxGTs
 /1iBTucepU7K/HDMr2uPuyqVqtHrDUAoUzquFakx54k3161WQTLM35U/hb0Z+FUrcSJS9KYw1jKLt
 8NejhR8HZdABqYkIcOFZnc7H37JU2vZXqTbjqpKsPipzH7U3LpplD7REzTvygp6HonG8=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhisC-0003YO-5U
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:09:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhisC-0002O9-4n
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:09:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] fix build with CONFIG_HYPFS_CONFIG enabled
Message-Id: <E1jhisC-0002O9-4n@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:09: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 1c5db7cc7a7080056d2876cd00344eb8b94bb7d2
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Jun 3 13:28:07 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 3 13:28:07 2020 +0200

    fix build with CONFIG_HYPFS_CONFIG enabled
    
    Commit 58263ed7713e ("xen: add /buildinfo/config entry to hypervisor
    filesystem") added a dependency to .config, but the hypervisor's build
    config could be have another name via setting KCONFIG_CONFIG.
    
    Fix that by using $(KCONFIG_CONFIG) instead. Additionally reference
    the config file via $(XEN_ROOT) instead of a relative path.
    
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/common/Makefile b/xen/common/Makefile
index 91581e1815..06881d023c 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -75,7 +75,8 @@ obj-$(CONFIG_UBSAN) += ubsan/
 obj-$(CONFIG_NEEDS_LIBELF) += libelf/
 obj-$(CONFIG_HAS_DEVICE_TREE) += libfdt/
 
-config.gz: ../.config
+CONF_FILE := $(if $(patsubst /%,,$(KCONFIG_CONFIG)),$(XEN_ROOT)/xen/)$(KCONFIG_CONFIG)
+config.gz: $(CONF_FILE)
 	gzip -c $< >$@
 
 config_data.o: config.gz
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:09:24 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:09: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 1jhisO-0000Kc-H0; Sun, 07 Jun 2020 00:09: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=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhisM-0000KO-P1
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:09:22 +0000
X-Inumbo-ID: 23b62d66-a853-11ea-96fb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 23b62d66-a853-11ea-96fb-bc764e2007e4;
 Sun, 07 Jun 2020 00:09: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=Z76DrDNkH2s9oxfK2uRZFnyPkjeL2NwcVOq3dT+TcBM=; b=atnZILi12Xx8+zoWHvgzCd0W3q
 x61Ff2DC/+y2cVXBnMBMAIDD4h/d4R1Iod1TcgTwx5ah1oSgptffAE2ToV7Zu6JnBDW4p+UHCLQqe
 Aqwg/cxflGl89No73+r6du7r5fAH92QSDw6McgN0BY9xOfTJyA88HfBYYGAO6h5KTaCo=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhisM-0003YY-8S
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:09:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhisM-0002Ot-7d
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:09:22 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] config: disable hypervisor filesystem for pv-shim
Message-Id: <E1jhisM-0002Ot-7d@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:09: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 d9f58cd54fe2f05e1f05e2fe254684bd1840de8e
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Jun 3 13:28:52 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 3 13:28:52 2020 +0200

    config: disable hypervisor filesystem for pv-shim
    
    The pv-shim doesn't need the hypervisor filesystem, so disable it.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/configs/pvshim_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/configs/pvshim_defconfig b/xen/arch/x86/configs/pvshim_defconfig
index 9710aa6238..830660e022 100644
--- a/xen/arch/x86/configs/pvshim_defconfig
+++ b/xen/arch/x86/configs/pvshim_defconfig
@@ -6,6 +6,7 @@ CONFIG_PV_SHIM=y
 CONFIG_PV_SHIM_EXCLUSIVE=y
 CONFIG_NR_CPUS=32
 # Disable features not used by the PV shim
+# CONFIG_HYPFS is not set
 # CONFIG_SHADOW_PAGING is not set
 # CONFIG_BIGMEM is not set
 # CONFIG_HVM_FEP is not set
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:09:33 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:09: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 1jhisX-0000Lb-Ii; Sun, 07 Jun 2020 00:09: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=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhisW-0000LR-WA
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:09:33 +0000
X-Inumbo-ID: 29bc274c-a853-11ea-9ad7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 29bc274c-a853-11ea-9ad7-bc764e2007e4;
 Sun, 07 Jun 2020 00:09: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=YyNN4pmFwZeN3opajSE0ecp8VeVmEeRpkQHCugNcC4o=; b=VXkDLg6mGCCuHaJRujx21L5gYM
 4Tuu4iMIRifaeNGFDL8EpMHTuq79Jtvmszv+1YHRf7Whb8Ym2WjAripIoVdu4XCvOCNVMP+zz1guB
 Kt2E1NyhZMsOfTDzMZLnzkhmGfR9ZsZNForyti1f1RxXhx8XwxgY4rDdS1iIySZofrdo=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhisW-0003Z8-Be
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:09:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhisW-0002PX-Ar
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:09:32 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/shim: Fix defconfig selection and trim the build
 further
Message-Id: <E1jhisW-0002PX-Ar@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:09: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 780aba2779b834f19b2a6f0dcdea0e7e0b5e1622
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 3 16:56:03 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jun 4 19:52:36 2020 +0100

    x86/shim: Fix defconfig selection and trim the build further
    
    Several options (TBOOT, XENOPROF, Scheduler) depend on EXPERT to be able to
    deselect/configure.
    
    Enabling EXPERT now causes the request of the Credit1 scheduler to be honoured
    (rather than giving us Credit2), but take this opportunity to switch to Null,
    as the previously problematic issues are now believed to be fixed.
    
    Enabling EXPERT also allows XEN_SHSTK to be selected, and we don't want this
    being built for shim.  We also don't want TRACEBUFFER or GDBSX either.
    
    Take this oppotunity to swap the disable of HVM_FEP for a general disable of
    HVM (likely to have wider impliciations in the future), and disable ARGO (will
    necesserily need plumbing work to function in shim).
    
    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/configs/pvshim_defconfig | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/configs/pvshim_defconfig b/xen/arch/x86/configs/pvshim_defconfig
index 830660e022..3af48d6c06 100644
--- a/xen/arch/x86/configs/pvshim_defconfig
+++ b/xen/arch/x86/configs/pvshim_defconfig
@@ -5,19 +5,25 @@ CONFIG_PVH_GUEST=y
 CONFIG_PV_SHIM=y
 CONFIG_PV_SHIM_EXCLUSIVE=y
 CONFIG_NR_CPUS=32
+CONFIG_EXPERT=y
+CONFIG_SCHED_NULL=y
 # Disable features not used by the PV shim
+# CONFIG_HVM is not set
+# CONFIG_XEN_SHSTK is not set
 # CONFIG_HYPFS is not set
 # CONFIG_SHADOW_PAGING is not set
 # CONFIG_BIGMEM is not set
-# CONFIG_HVM_FEP is not set
 # CONFIG_TBOOT is not set
 # CONFIG_KEXEC is not set
 # CONFIG_XENOPROF is not set
 # CONFIG_XSM is not set
+# CONFIG_ARGO is not set
+# CONFIG_SCHED_CREDIT is not set
 # CONFIG_SCHED_CREDIT2 is not set
 # CONFIG_SCHED_RTDS is not set
 # CONFIG_SCHED_ARINC653 is not set
-# CONFIG_SCHED_NULL is not set
 # CONFIG_LIVEPATCH is not set
 # CONFIG_SUPPRESS_DUPLICATE_SYMBOL_WARNINGS is not set
+# CONFIG_TRACEBUFFER is not set
 # CONFIG_DEBUG is not set
+# CONFIG_GDBSX is not set
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:09:44 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:09: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 1jhisi-0000NZ-Ld; Sun, 07 Jun 2020 00:09: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=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhish-0000Ml-F9
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:09:43 +0000
X-Inumbo-ID: 2fbed176-a853-11ea-b15b-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 2fbed176-a853-11ea-b15b-12813bfff9fa;
 Sun, 07 Jun 2020 00:09: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=pp7OhBWkKsSK7cWYAnaPijtKdmL1S5Iku3bBk/KxfGA=; b=DyN+sSKRInZ7XoHuFwY1B4Eeyy
 GmFPpl8cTHxA+SkK4Jh/vx4rHD/cjQK/YFlVLpSxKcIW/szH/UoPIguIioc9GDp2x+NBSCBjoTfQc
 3akOVCRyQyhmM9X7i1HthoX9Cth6KUsMH4YXF4uReGQ+OTkAj3FJ60Ydgm97r95z6P+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 1jhisg-0003ZN-ET
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:09:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhisg-0002QP-Dn
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:09:42 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] libs/hypfs: use correct zlib name in pc file
Message-Id: <E1jhisg-0002QP-Dn@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:09: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 81da3f2b4fa9ccbbdcd135275ee62f0817bcab26
Author:     Wei Liu <wl@xen.org>
AuthorDate: Fri Jun 5 12:37:25 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Fri Jun 5 15:52:47 2020 +0100

    libs/hypfs: use correct zlib name in pc file
    
    Its name is "zlib" not "z".
    
    Reported-by: Olaf Hering <olaf@aepfle.de>
    Fixes: 86234eafb952 ("libs: add libxenhypfs")
    Signed-off-by: Wei Liu <wl@xen.org>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/libs/hypfs/xenhypfs.pc.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libs/hypfs/xenhypfs.pc.in b/tools/libs/hypfs/xenhypfs.pc.in
index 92a262c7a2..ef9fcc87bf 100644
--- a/tools/libs/hypfs/xenhypfs.pc.in
+++ b/tools/libs/hypfs/xenhypfs.pc.in
@@ -7,4 +7,4 @@ Description: The Xenhypfs library for Xen hypervisor
 Version: @@version@@
 Cflags: -I${includedir} @@cflagslocal@@
 Libs: @@libsflag@@${libdir} -lxenhypfs
-Requires.private: xentoolcore,xentoollog,xencall,z
+Requires.private: xentoolcore,xentoollog,xencall,zlib
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Jun 07 00:09:53 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 07 Jun 2020 00:09:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jhisr-0000OP-NB; Sun, 07 Jun 2020 00:09:53 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=vV5d=7U=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jhisr-0000OH-98
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:09:53 +0000
X-Inumbo-ID: 35c41978-a853-11ea-9ad7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 35c41978-a853-11ea-9ad7-bc764e2007e4;
 Sun, 07 Jun 2020 00:09: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=U/cdlrSpo9B28rounemvemit551IyqaT/PNNbhb+lyc=; b=p8hM0ep7apizR5C6GSDOwp3CsD
 8PepD+iwYuG2WQ/UOJ/J/0YLEO2ldNOP7BReYmDiWaarsDLdBQqOP3mYbEAIRBsdl7MvXtvuHLf4k
 vARoJLvYVbPEse/gobp5HGRQyLiod/ocLiKIte9oV794NsSmGFZQEDuB3Bp7YNAXlWOc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhisq-0003ZW-Hl
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:09:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jhisq-0002RO-Gx
 for xen-changelog@lists.xenproject.org; Sun, 07 Jun 2020 00:09:52 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/svm: do not try to handle recalc NPT faults
 immediately
Message-Id: <E1jhisq-0002RO-Gx@xenbits.xenproject.org>
Date: Sun, 07 Jun 2020 00:09: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 51ca66c37371b10b378513af126646de22eddb17
Author:     Igor Druzhinin <igor.druzhinin@citrix.com>
AuthorDate: Fri Jun 5 17:12:11 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jun 5 17:12:11 2020 +0200

    x86/svm: do not try to handle recalc NPT faults immediately
    
    A recalculation NPT fault doesn't always require additional handling
    in hvm_hap_nested_page_fault(), moreover in general case if there is no
    explicit handling done there - the fault is wrongly considered fatal.
    
    This covers a specific case of migration with vGPU assigned which
    uses direct MMIO mappings made by XEN_DOMCTL_memory_mapping hypercall:
    at a moment log-dirty is enabled globally, recalculation is requested
    for the whole guest memory including those mapped MMIO regions
    which causes a page fault being raised at the first access to them;
    but due to MMIO P2M type not having any explicit handling in
    hvm_hap_nested_page_fault() a domain is erroneously crashed with unhandled
    SVM violation.
    
    Instead of trying to be opportunistic - use safer approach and handle
    P2M recalculation in a separate NPT fault by attempting to retry after
    making the necessary adjustments. This is aligned with Intel behavior
    where there are separate VMEXITs for recalculation and EPT violations
    (faults) and only faults are handled in hvm_hap_nested_page_fault().
    Do it by also unifying do_recalc return code with Intel implementation
    where returning 1 means P2M was actually changed.
    
    Since there was no case previously where p2m_pt_handle_deferred_changes()
    could return a positive value - it's safe to replace ">= 0" with just "== 0"
    in VMEXIT_NPF handler. finish_type_change() is also not affected by the
    change as being able to deal with >0 return value of p2m->recalc from
    EPT implementation.
    
    Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/arch/x86/hvm/svm/svm.c | 5 +++--
 xen/arch/x86/mm/p2m-pt.c   | 7 ++++++-
 xen/arch/x86/mm/p2m.c      | 2 +-
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 44ff9d0c6b..4eb41792e2 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -2923,9 +2923,10 @@ void svm_vmexit_handler(struct cpu_user_regs *regs)
             v->arch.hvm.svm.cached_insn_len = vmcb->guest_ins_len & 0xf;
         rc = vmcb->exitinfo1 & PFEC_page_present
              ? p2m_pt_handle_deferred_changes(vmcb->exitinfo2) : 0;
-        if ( rc >= 0 )
+        if ( rc == 0 )
+            /* If no recal adjustments were being made - handle this fault */
             svm_do_nested_pgfault(v, regs, vmcb->exitinfo1, vmcb->exitinfo2);
-        else
+        else if ( rc < 0 )
         {
             printk(XENLOG_G_ERR
                    "%pv: Error %d handling NPF (gpa=%08lx ec=%04lx)\n",
diff --git a/xen/arch/x86/mm/p2m-pt.c b/xen/arch/x86/mm/p2m-pt.c
index 5c0501794e..badb26bc34 100644
--- a/xen/arch/x86/mm/p2m-pt.c
+++ b/xen/arch/x86/mm/p2m-pt.c
@@ -341,6 +341,7 @@ static int do_recalc(struct p2m_domain *p2m, unsigned long gfn)
     unsigned int level = 4;
     l1_pgentry_t *pent;
     int err = 0;
+    bool recalc_done = false;
 
     table = map_domain_page(pagetable_get_mfn(p2m_get_pagetable(p2m)));
     while ( --level )
@@ -402,6 +403,8 @@ static int do_recalc(struct p2m_domain *p2m, unsigned long gfn)
                 clear_recalc(l1, e);
                 err = p2m->write_p2m_entry(p2m, gfn, pent, e, level + 1);
                 ASSERT(!err);
+
+                recalc_done = true;
             }
         }
         unmap_domain_page((void *)((unsigned long)pent & PAGE_MASK));
@@ -448,12 +451,14 @@ static int do_recalc(struct p2m_domain *p2m, unsigned long gfn)
             clear_recalc(l1, e);
         err = p2m->write_p2m_entry(p2m, gfn, pent, e, level + 1);
         ASSERT(!err);
+
+        recalc_done = true;
     }
 
  out:
     unmap_domain_page(table);
 
-    return err;
+    return err ?: recalc_done;
 }
 
 int p2m_pt_handle_deferred_changes(uint64_t gpa)
diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 17f320b624..db7bde0230 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -1197,7 +1197,7 @@ static int finish_type_change(struct p2m_domain *p2m,
         rc = p2m->recalc(p2m, gfn);
         /*
          * ept->recalc could return 0/1/-ENOMEM. pt->recalc could return
-         * 0/-ENOMEM/-ENOENT, -ENOENT isn't an error as we are looping
+         * 0/1/-ENOMEM/-ENOENT, -ENOENT isn't an error as we are looping
          * gfn here. If rc is 1 we need to have it 0 for success.
          */
         if ( rc == -ENOENT || rc > 0 )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jun 08 08:33:10 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 08 Jun 2020 08: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 1jiDDO-00034U-ID; Mon, 08 Jun 2020 08: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=vPAR=7V=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jiDDN-00034P-Fx
 for xen-changelog@lists.xenproject.org; Mon, 08 Jun 2020 08:33:05 +0000
X-Inumbo-ID: abf18d6e-a962-11ea-ba62-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id abf18d6e-a962-11ea-ba62-bc764e2007e4;
 Mon, 08 Jun 2020 08: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=1gpCrCW5Yz4R08WNNZJldf9eealjZtGSjt8HAHjpEUk=; b=m3UH2EFTJ27YP+7ThsSIdajbGv
 TK8Xk1a7ls3ASinLRNxTRtlmczFgo0OV8CtjJND2x1br+np5sFNKTJTh7Jkcdofif3LxoX+MR5oLF
 +Z52KIxfm4RYLLLLGxkDQAt6vaSeQfO/8CdGfmYDyU24sLhk6vYh7pNBEQhlrb4YJcxA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jiDDM-0000q4-CW
 for xen-changelog@lists.xenproject.org; Mon, 08 Jun 2020 08:33:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jiDDM-0001Zn-BX
 for xen-changelog@lists.xenproject.org; Mon, 08 Jun 2020 08:33:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] build: fix dependency tracking for preprocessed files
Message-Id: <E1jiDDM-0001Zn-BX@xenbits.xenproject.org>
Date: Mon, 08 Jun 2020 08: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 75131ad75bb3c91717b5dfda6881e61c52bfd22e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Jun 8 10:25:40 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Jun 8 10:25:40 2020 +0200

    build: fix dependency tracking for preprocessed files
    
    While the issue is more general, I noticed that asm-macros.i not getting
    re-generated as needed. This was due to its .*.d file mentioning
    asm-macros.o instead of asm-macros.i. Use -MQ here as well, and while at
    it also use -MQ to avoid the somewhat fragile sed-ary on the *.lds
    dependency tracking files. While there, further avoid open-coding $(CPP)
    and drop the bogus (Arm) / stale (x86) -Ui386.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/Rules.mk          | 4 ++--
 xen/arch/arm/Makefile | 4 +---
 xen/arch/x86/Makefile | 4 +---
 3 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/xen/Rules.mk b/xen/Rules.mk
index 2e28c57230..ebfd40caff 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -201,13 +201,13 @@ $(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): %.init.o: %.o FORCE
 	$(call if_changed,obj_init_o)
 
 quiet_cmd_cpp_i_c = CPP     $@
-cmd_cpp_i_c = $(CPP) $(filter-out -Wa$(comma)%,$(c_flags)) $< -o $@
+cmd_cpp_i_c = $(CPP) $(filter-out -Wa$(comma)%,$(c_flags)) -MQ $@ -o $@ $<
 
 quiet_cmd_cc_s_c = CC      $@
 cmd_cc_s_c = $(CC) $(filter-out -Wa$(comma)%,$(c_flags)) -S $< -o $@
 
 quiet_cmd_s_S = CPP     $@
-cmd_s_S = $(CPP) $(filter-out -Wa$(comma)%,$(a_flags)) $< -o $@
+cmd_s_S = $(CPP) $(filter-out -Wa$(comma)%,$(a_flags)) -MQ $@ -o $@ $<
 
 %.i: %.c FORCE
 	$(call if_changed,cpp_i_c)
diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index c1a1b5e803..7e82b2178c 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -123,9 +123,7 @@ asm-offsets.s: $(TARGET_SUBARCH)/asm-offsets.c
 	$(CC) $(filter-out -flto,$(c_flags)) -S -o $@ $<
 
 xen.lds: xen.lds.S
-	$(CC) -P -E -Ui386 $(a_flags) -o $@ $<
-	sed -e 's/xen\.lds\.o:/xen\.lds:/g' <.xen.lds.d >.xen.lds.d.new
-	mv -f .xen.lds.d.new .xen.lds.d
+	$(CPP) -P $(a_flags) -MQ $@ -o $@ $<
 
 dtb.o: $(CONFIG_DTB_FILE)
 
diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 07eeefbf82..b388861679 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -244,9 +244,7 @@ $(BASEDIR)/include/asm-x86/asm-macros.h: asm-macros.i Makefile
 
 efi.lds: AFLAGS-y += -DEFI
 xen.lds efi.lds: xen.lds.S
-	$(CC) -P -E -Ui386 $(filter-out -Wa$(comma)%,$(a_flags)) -o $@ $<
-	sed -e 's/.*\.lds\.o:/$(@F):/g' <.$(@F).d >.$(@F).d.new
-	mv -f .$(@F).d.new .$(@F).d
+	$(CPP) -P $(filter-out -Wa$(comma)%,$(a_flags)) -MQ $@ -o $@ $<
 
 boot/mkelf32: boot/mkelf32.c
 	$(HOSTCC) $(HOSTCFLAGS) -o $@ $<
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Jun 08 14:33:10 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 08 Jun 2020 14: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 1jiIpn-00036z-Gg; Mon, 08 Jun 2020 14:33:07 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=vPAR=7V=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jiIpm-00035N-29
 for xen-changelog@lists.xenproject.org; Mon, 08 Jun 2020 14:33:06 +0000
X-Inumbo-ID: f6555891-a994-11ea-b284-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id f6555891-a994-11ea-b284-12813bfff9fa;
 Mon, 08 Jun 2020 14: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=dYuc0eEpTAwekwU8W95PGcCmb474QPP2E67biRsDOFI=; b=AO4+1vB6PQFF4eOFiBI2F4Ypp1
 zvWmtJw0OY0dqvTyYOJyg5YmpzsGh6L9bd77/jqz+8M+iVnt/zQj091u7vpMds3H1mF0sRQVgvN9u
 HX3GLCYsO5/rau8qWGKFbZot0OtKN+EBlAro6NzmFffNWKe8tPQrcO3vArlCBvCsSizs=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jiIpk-0008WL-Oe
 for xen-changelog@lists.xenproject.org; Mon, 08 Jun 2020 14:33:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jiIpk-0005Gq-Nk
 for xen-changelog@lists.xenproject.org; Mon, 08 Jun 2020 14:33:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] docs/support-matrix: unbreak docs rendering
Message-Id: <E1jiIpk-0005Gq-Nk@xenbits.xenproject.org>
Date: Mon, 08 Jun 2020 14: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 11ba5cdb8489e4dfc1e50c948dba23cece559e77
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Jun 4 21:39:37 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Jun 8 15:19:49 2020 +0100

    docs/support-matrix: unbreak docs rendering
    
    The cronjob which renders https://xenbits.xen.org/docs/ has been broken for a
    while.  commitish_version() pulls an old version of xen/Makefile out of
    history, and uses the xenversion rule.
    
    Currently, this fails with:
    
      tmp.support-matrix.xen.make:130: scripts/Kbuild.include: No such file or directory
    
    which is because the Makefile legitimately references Kbuild.include with a
    relative rather than absolute path.
    
    Rework support-matrix-generate to use sed to extract the major/minor version,
    rather than expecting xen/Makefile to be usable in a different tree.
    
    Fixes: 945e80a7301f ("docs: Provide support-matrix-generate, to generate a support matrix in HTML")
    Backport: 4.11+
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 docs/support-matrix-generate | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/docs/support-matrix-generate b/docs/support-matrix-generate
index a3d93321f1..8a27849cf6 100755
--- a/docs/support-matrix-generate
+++ b/docs/support-matrix-generate
@@ -27,8 +27,8 @@
 #
 # Then we try to find the next previous revision.  This is done by
 # extracting the current version number from xen/Makefile.  (We make
-# some slight assumption about how xen/Makefile's xenversion target
-# works, because we want to be able to do this without checking out
+# some slight assumption about how xen/Makefile's variables are
+# written, because we want to be able to do this without checking out
 # the whole tree for the version in question.)  Then we use git log on
 # xen/Makefile to try to find a commit where the version changed.
 # This gives us the previous version number, NN.
@@ -102,12 +102,16 @@ commitish_version () {
     esac
 
     git cat-file blob "$commitish:$versionfile" >"$tmp_versionfile"
-    version=$(make --no-print-directory -C docs \
-                   -f "${tmp_versionfile#docs/}" xenversion)
-    case "$version" in
-        *.*.*) version="${version%.*}" ;;
-    esac
-    printf "%s\n" "${version%%-*}"
+
+    local maj=$(sed -n 's/.*XEN_VERSION.*= \([0-9]\+\)/\1/p' < "$tmp_versionfile")
+    local min=$(sed -n 's/.*XEN_SUBVERSION.*= \([0-9]\+\)/\1/p' < "$tmp_versionfile")
+
+    if [ -z $maj ] || [ -z $min ];
+    then
+        fail "Unable to identify Xen version for $commitish";
+    fi
+
+    printf "%d.%d\n" "$maj" "$min"
 }
 
 exec 4>"$tmp_revisions"
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Jun 08 15:33:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 08 Jun 2020 15: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 1jiJlq-0000J3-I2; Mon, 08 Jun 2020 15: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=vPAR=7V=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jiJlp-0000Hs-Da
 for xen-changelog@lists.xenproject.org; Mon, 08 Jun 2020 15:33:05 +0000
X-Inumbo-ID: 5862808c-a99d-11ea-b290-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 5862808c-a99d-11ea-b290-12813bfff9fa;
 Mon, 08 Jun 2020 15: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=Mjo4VSQx/ifSw2G3bQWZEgmpAcfwOPoM5fKTj8YoaRc=; b=52jtUiTS1wOZ9FYlxF06kiHOJr
 fqhHyoztY7YsTMl680qbSYNRS2Sr0Cl2RLWtPUJnz5+dQ5hToucigEWGdMaGxg/veQ3EfTFswBGPH
 D2dQX818mWo/3u/1RmEKAZ7ViCVF8C7fnERi9tgiv20VSvyvQTBrliQbf7XpCx+p+Sbc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jiJlo-0001NX-Gl
 for xen-changelog@lists.xenproject.org; Mon, 08 Jun 2020 15:33:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jiJlo-0002fn-Fl
 for xen-changelog@lists.xenproject.org; Mon, 08 Jun 2020 15:33:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] Config.mk: Nail QEMU_UPSTREAM_REVISION
 MINIOS_UPSTREAM_REVISION
Message-Id: <E1jiJlo-0002fn-Fl@xenbits.xenproject.org>
Date: Mon, 08 Jun 2020 15: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 2e8f29e10a8caa62c4b1dca936e8de385407f21d
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Mon Jun 8 15:17:36 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Mon Jun 8 15:17:36 2020 +0100

    Config.mk: Nail QEMU_UPSTREAM_REVISION MINIOS_UPSTREAM_REVISION
    
    We freeze these during release prep, rather than tracking whatever
    osstest passed.
    
    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 7d556aed30..f7d10b7c4c 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 ?= master
-MINIOS_UPSTREAM_REVISION ?= master
+QEMU_UPSTREAM_REVISION ?= 410cc30fdc590417ae730d635bbc70257adf6750
+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 Jun 08 15:33:16 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 08 Jun 2020 15: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 1jiJm0-0000KR-JV; Mon, 08 Jun 2020 15: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=vPAR=7V=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jiJlz-0000KH-IG
 for xen-changelog@lists.xenproject.org; Mon, 08 Jun 2020 15:33:15 +0000
X-Inumbo-ID: 5e65b814-a99d-11ea-96fb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 5e65b814-a99d-11ea-96fb-bc764e2007e4;
 Mon, 08 Jun 2020 15: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=lZqW+wxdC+iKNiRe/6y1hai01Gn+BtJMBvFoiJRLjig=; b=z220/8XJ4z96MoocQa78ttfUm5
 9j3KLbfd/YvqRXNJ78ftJGIZI4Ouc6m57ucLFY8U+d5cTkU4gvjRhQe4kKMHLGTQflBQJGymBoJSp
 q09tbmi3ZmZYeRI09exCJPZWGKGNuJVjfFBHmWxAL2qsBsitgSXd/LsZhS2B/uwrnNp8=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jiJly-0001Nd-Jx
 for xen-changelog@lists.xenproject.org; Mon, 08 Jun 2020 15:33:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jiJly-0002gV-Iw
 for xen-changelog@lists.xenproject.org; Mon, 08 Jun 2020 15:33:14 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] Version changes for 4.14.0-rc
Message-Id: <E1jiJly-0002gV-Iw@xenbits.xenproject.org>
Date: Mon, 08 Jun 2020 15: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 726c78d14dfe6ec76f5e4c7756821a91f0a04b34
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Mon Jun 8 15:18:20 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Mon Jun 8 15:18:20 2020 +0100

    Version changes for 4.14.0-rc
    
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 README       | 10 +++++-----
 SUPPORT.md   |  2 +-
 xen/Makefile |  2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/README b/README
index d0c87a78f0..46c67d8906 100644
--- a/README
+++ b/README
@@ -1,9 +1,9 @@
 #################################
- _  _    _ _  _                         _        _     _      
-| || |  / | || |        _   _ _ __  ___| |_ __ _| |__ | | ___ 
-| || |_ | | || |_ _____| | | | '_ \/ __| __/ _` | '_ \| |/ _ \
-|__   _|| |__   _|_____| |_| | | | \__ \ || (_| | |_) | |  __/
-   |_|(_)_|  |_|        \__,_|_| |_|___/\__\__,_|_.__/|_|\___|
+ _  _    _ _  _
+| || |  / | || |        _ __ ___
+| || |_ | | || |_ _____| '__/ __|
+|__   _|| |__   _|_____| | | (__
+   |_|(_)_|  |_|       |_|  \___|
 
 #################################
 
diff --git a/SUPPORT.md b/SUPPORT.md
index a1f7eb6434..643879f0ea 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-unstable
+    Xen-Version: 4.14-rc
     Initial-Release: n/a
     Supported-Until: TBD
     Security-Support-Until: Unreleased - not yet security-supported
diff --git a/xen/Makefile b/xen/Makefile
index d53d1f7b5e..0ade7f9517 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 ?= -unstable$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .0-rc$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Jun 08 15:33:26 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 08 Jun 2020 15: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 1jiJmA-0000Lx-Ky; Mon, 08 Jun 2020 15:33: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=vPAR=7V=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jiJm9-0000Lj-7Z
 for xen-changelog@lists.xenproject.org; Mon, 08 Jun 2020 15:33:25 +0000
X-Inumbo-ID: 646ee24e-a99d-11ea-b290-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 646ee24e-a99d-11ea-b290-12813bfff9fa;
 Mon, 08 Jun 2020 15: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=9NlOOOi5WtIS4pHImPx9tpMNX+Ots/6SGrW4kXM2s3E=; b=nHQ+HH26eZ2UDShj/XR+mp+z2C
 viROSBRMkuQSMLI5ycDuwgFWv6aKecOjylv4B/6qCADKfKXnAutxhGpoEdqZyYkb3Po9ejSsj6xfX
 ZeaVCpynBG+YEHbOFPpF0ZTZg3rTvZ0Y5zVC/+Si32wcDxGe1DVJfBD/x3/Y9vAC1kOQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jiJm8-0001Np-NF
 for xen-changelog@lists.xenproject.org; Mon, 08 Jun 2020 15:33:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jiJm8-0002h9-MG
 for xen-changelog@lists.xenproject.org; Mon, 08 Jun 2020 15:33:24 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] Merge remote-tracking branch 'origin/staging' into
 staging
Message-Id: <E1jiJm8-0002h9-MG@xenbits.xenproject.org>
Date: Mon, 08 Jun 2020 15: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 03dc5f00f66e9c29afdfc9a72e4e6d70ea50b191
Merge: 726c78d14dfe6ec76f5e4c7756821a91f0a04b34 11ba5cdb8489e4dfc1e50c948dba23cece559e77
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Mon Jun 8 16:26:57 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Mon Jun 8 16:26:57 2020 +0100

    Merge remote-tracking branch 'origin/staging' into staging

 docs/support-matrix-generate | 20 ++++++++++++--------
 xen/Rules.mk                 |  4 ++--
 xen/arch/arm/Makefile        |  4 +---
 xen/arch/x86/Makefile        |  4 +---
 4 files changed, 16 insertions(+), 16 deletions(-)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Jun 08 16:33:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 08 Jun 2020 16: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 1jiKhu-0001hZ-Se; Mon, 08 Jun 2020 16: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=vPAR=7V=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jiKht-0001gi-TL
 for xen-changelog@lists.xenproject.org; Mon, 08 Jun 2020 16:33:06 +0000
X-Inumbo-ID: ba5a9c22-a9a5-11ea-b296-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id ba5a9c22-a9a5-11ea-b296-12813bfff9fa;
 Mon, 08 Jun 2020 16:33:05 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=lg9L9Kjx3aYxxTelhOV6mLaSGQc0j+YsyFLCJ7g4YJU=; b=TTDOLHOP1aUcIdugcpSdshRfoF
 13PMtcBYB9nMTT6aBfpFCvE/5eYakeBw7VyaPG8v5uMsN3/CKhXhHFlJGAXP+tHf2xPBFMgZyG2Zh
 OsTEDSmc9+EvFROUTdzKIq3LyfX+9MA1pGtX01Gt/xA8v1TIU1xzaJ5w7g3/eZOQyYcc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jiKhs-0003O3-RK
 for xen-changelog@lists.xenproject.org; Mon, 08 Jun 2020 16:33:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jiKhs-0002wP-QH
 for xen-changelog@lists.xenproject.org; Mon, 08 Jun 2020 16:33:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] golang/xenlight: remove call to go fmt in gengotypes.py
Message-Id: <E1jiKhs-0002wP-QH@xenbits.xenproject.org>
Date: Mon, 08 Jun 2020 16: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 16c36d27f2644737c34d4a0fc1de525d0ee185ad
Author:     Nick Rosbrook <rosbrookn@ainfosec.com>
AuthorDate: Mon Jun 8 17:10:39 2020 +0100
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Mon Jun 8 17:11:38 2020 +0100

    golang/xenlight: remove call to go fmt in gengotypes.py
    
    Since the golang bindings are now set to be re-generated whenever a
    change is made to tools/libxl/libxl_types.idl, the call to go fmt in
    gengotypes.py results in a dirty git tree for users without go
    installed.
    
    As an immediate fix, just remove the call to go fmt from gengotypes.py.
    While here, make sure the DO NOT EDIT comment and package declaration
    remain formatted correctly. All other generated code is left
    un-formatted for now.
    
    Signed-off-by: Nick Rosbrook <rosbrookn@ainfosec.com>
    Reviewed-by: George Dunlap <george.dunlap@citrix.com>
    
    Remove trailing whitespace.
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
---
 tools/golang/xenlight/gengotypes.py  |   34 +-
 tools/golang/xenlight/helpers.gen.go | 7647 ++++++++++++++++------------------
 tools/golang/xenlight/types.gen.go   | 1708 ++++----
 3 files changed, 4394 insertions(+), 4995 deletions(-)

diff --git a/tools/golang/xenlight/gengotypes.py b/tools/golang/xenlight/gengotypes.py
index 2b71aa1ea8..ecca59745f 100644
--- a/tools/golang/xenlight/gengotypes.py
+++ b/tools/golang/xenlight/gengotypes.py
@@ -39,7 +39,7 @@ def xenlight_golang_generate_types(path = None, types = None, comment = None):
     with open(path, 'w') as f:
         if comment is not None:
             f.write(comment)
-        f.write('package xenlight\n')
+        f.write('package xenlight\n\n')
 
         for ty in types:
             (tdef, extras) = xenlight_golang_type_define(ty)
@@ -52,8 +52,6 @@ def xenlight_golang_generate_types(path = None, types = None, comment = None):
                 f.write(extra)
                 f.write('\n')
 
-    go_fmt(path)
-
 def xenlight_golang_type_define(ty = None):
     """
     Generate the Go type definition of ty.
@@ -205,7 +203,7 @@ def xenlight_golang_generate_helpers(path = None, types = None, comment = None):
     with open(path, 'w') as f:
         if comment is not None:
             f.write(comment)
-        f.write('package xenlight\n')
+        f.write('package xenlight\n\n')
         f.write('import (\n"unsafe"\n"errors"\n"fmt"\n)\n')
 
         # Cgo preamble
@@ -240,14 +238,12 @@ def xenlight_golang_generate_helpers(path = None, types = None, comment = None):
             f.write(xenlight_golang_define_to_C(ty))
             f.write('\n')
 
-    go_fmt(path)
-
 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 *{}) fromC(xc *C.{}) error {{\n {}\n return nil}}\n'
 
     goname = xenlight_golang_fmt_name(ty.typename)
     cname  = ty.typename
@@ -317,7 +313,7 @@ def xenlight_golang_convert_from_C(ty = None, outer_name = None, cvarname = None
         # 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 += 'err != nil {{\nreturn fmt.Errorf("converting field {}: %v", err)\n}}\n'.format(goname)
 
     elif gotypename == 'string':
         # Use the cgo helper for converting C strings.
@@ -399,7 +395,7 @@ def xenlight_golang_union_from_C(ty = None, union_name = '', struct_name = ''):
 
         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 += 'err != nil {{\n return fmt.Errorf("converting field {}: %v", err)\n}}\n'.format(goname)
 
         s += 'x.{} = {}\n'.format(field_name, goname)
 
@@ -450,7 +446,7 @@ 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 *{}) toC(xc *C.{}) (err error){{{}\n return nil\n }}\n'
     body = ''
 
     if ty.dispose_fn is not None:
@@ -520,7 +516,7 @@ def xenlight_golang_convert_to_C(ty = None, outer_name = None,
     if not is_castable:
         s += 'if err := {}.{}.toC(&{}.{}); 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 {}: %v", err)\n}}\n'.format(goname)
 
     elif gotypename == 'string':
         # Use the cgo helper for converting C strings.
@@ -625,7 +621,7 @@ def xenlight_golang_array_to_C(ty = None):
                                                                          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 += 'return fmt.Errorf("converting field {}: %v", err)\n'.format(goname)
     s += '}\n}\n}\n'
 
     return s
@@ -719,10 +715,6 @@ def xenlight_golang_fmt_name(name, exported = True):
 
     return words[0] + ''.join(x.title() for x in words[1:])
 
-def go_fmt(path):
-    """ Call go fmt on the given path. """
-    os.system('go fmt {}'.format(path))
-
 if __name__ == '__main__':
     idlname = sys.argv[1]
 
@@ -733,12 +725,12 @@ if __name__ == '__main__':
         builtin_type_names[name] = xenlight_golang_fmt_name(name)
 
     header_comment="""// DO NOT EDIT.
-    //
-    // This file is generated by:
-    // {}
-    //
+//
+// This file is generated by:
+// {}
+//
 
-    """.format(' '.join(sys.argv))
+""".format(' '.join(sys.argv))
 
     xenlight_golang_generate_types(types=types,
                                    comment=header_comment)
diff --git a/tools/golang/xenlight/helpers.gen.go b/tools/golang/xenlight/helpers.gen.go
index 1e58ebbab2..935d3bc50a 100644
--- a/tools/golang/xenlight/helpers.gen.go
+++ b/tools/golang/xenlight/helpers.gen.go
@@ -7,11 +7,10 @@
 package xenlight
 
 import (
-	"errors"
-	"fmt"
-	"unsafe"
+"unsafe"
+"errors"
+"fmt"
 )
-
 /*
 #cgo LDFLAGS: -lxenlight
 #include <stdlib.h>
@@ -30,4710 +29,4154 @@ typedef typeof(((struct libxl_psr_hw_info *)NULL)->u.cat)libxl_psr_hw_info_type_
 typedef typeof(((struct libxl_psr_hw_info *)NULL)->u.mba)libxl_psr_hw_info_type_union_mba;
 */
 import "C"
-
 // NewIoportRange returns an instance of IoportRange initialized with defaults.
 func NewIoportRange() (*IoportRange, error) {
-	var (
-		x  IoportRange
-		xc C.libxl_ioport_range
-	)
+var (
+x IoportRange
+xc C.libxl_ioport_range)
 
-	C.libxl_ioport_range_init(&xc)
-	defer C.libxl_ioport_range_dispose(&xc)
+C.libxl_ioport_range_init(&xc)
+defer C.libxl_ioport_range_dispose(&xc)
 
-	if err := x.fromC(&xc); err != nil {
-		return nil, err
-	}
+if err := x.fromC(&xc); err != nil {
+return nil, err }
 
-	return &x, nil
-}
+return &x, nil}
 
 func (x *IoportRange) fromC(xc *C.libxl_ioport_range) error {
-	x.First = uint32(xc.first)
-	x.Number = uint32(xc.number)
+ x.First = uint32(xc.first)
+x.Number = uint32(xc.number)
 
-	return nil
-}
+ return nil}
 
-func (x *IoportRange) toC(xc *C.libxl_ioport_range) (err error) {
-	defer func() {
-		if err != nil {
-			C.libxl_ioport_range_dispose(xc)
-		}
-	}()
+func (x *IoportRange) toC(xc *C.libxl_ioport_range) (err error){defer func(){
+if err != nil{
+C.libxl_ioport_range_dispose(xc)}
+}()
 
-	xc.first = C.uint32_t(x.First)
-	xc.number = C.uint32_t(x.Number)
+xc.first = C.uint32_t(x.First)
+xc.number = C.uint32_t(x.Number)
 
-	return nil
-}
+ return nil
+ }
 
 // NewIomemRange returns an instance of IomemRange initialized with defaults.
 func NewIomemRange() (*IomemRange, error) {
-	var (
-		x  IomemRange
-		xc C.libxl_iomem_range
-	)
+var (
+x IomemRange
+xc C.libxl_iomem_range)
 
-	C.libxl_iomem_range_init(&xc)
-	defer C.libxl_iomem_range_dispose(&xc)
+C.libxl_iomem_range_init(&xc)
+defer C.libxl_iomem_range_dispose(&xc)
 
-	if err := x.fromC(&xc); err != nil {
-		return nil, err
-	}
+if err := x.fromC(&xc); err != nil {
+return nil, err }
 
-	return &x, nil
-}
+return &x, nil}
 
 func (x *IomemRange) fromC(xc *C.libxl_iomem_range) error {
-	x.Start = uint64(xc.start)
-	x.Number = uint64(xc.number)
-	x.Gfn = uint64(xc.gfn)
+ x.Start = uint64(xc.start)
+x.Number = uint64(xc.number)
+x.Gfn = uint64(xc.gfn)
 
-	return nil
-}
+ return nil}
 
-func (x *IomemRange) toC(xc *C.libxl_iomem_range) (err error) {
-	defer func() {
-		if err != nil {
-			C.libxl_iomem_range_dispose(xc)
-		}
-	}()
+func (x *IomemRange) toC(xc *C.libxl_iomem_range) (err error){defer func(){
+if err != nil{
+C.libxl_iomem_range_dispose(xc)}
+}()
 
-	xc.start = C.uint64_t(x.Start)
-	xc.number = C.uint64_t(x.Number)
-	xc.gfn = C.uint64_t(x.Gfn)
+xc.start = C.uint64_t(x.Start)
+xc.number = C.uint64_t(x.Number)
+xc.gfn = C.uint64_t(x.Gfn)
 
-	return nil
-}
+ return nil
+ }
 
 // NewVgaInterfaceInfo returns an instance of VgaInterfaceInfo initialized with defaults.
 func NewVgaInterfaceInfo() (*VgaInterfaceInfo, error) {
-	var (
-		x  VgaInterfaceInfo
-		xc C.libxl_vga_interface_info
-	)
+var (
+x VgaInterfaceInfo
+xc C.libxl_vga_interface_info)
 
-	C.libxl_vga_interface_info_init(&xc)
-	defer C.libxl_vga_interface_info_dispose(&xc)
+C.libxl_vga_interface_info_init(&xc)
+defer C.libxl_vga_interface_info_dispose(&xc)
 
-	if err := x.fromC(&xc); err != nil {
-		return nil, err
-	}
+if err := x.fromC(&xc); err != nil {
+return nil, err }
 
-	return &x, nil
-}
+return &x, nil}
 
 func (x *VgaInterfaceInfo) fromC(xc *C.libxl_vga_interface_info) error {
-	x.Kind = VgaInterfaceType(xc.kind)
+ x.Kind = VgaInterfaceType(xc.kind)
 
-	return nil
-}
+ return nil}
 
-func (x *VgaInterfaceInfo) toC(xc *C.libxl_vga_interface_info) (err error) {
-	defer func() {
-		if err != nil {
-			C.libxl_vga_interface_info_dispose(xc)
-		}
-	}()
+func (x *VgaInterfaceInfo) toC(xc *C.libxl_vga_interface_info) (err error){defer func(){
+if err != nil{
+C.libxl_vga_interface_info_dispose(xc)}
+}()
 
-	xc.kind = C.libxl_vga_interface_type(x.Kind)
+xc.kind = C.libxl_vga_interface_type(x.Kind)
 
-	return nil
-}
+ return nil
+ }
 
 // NewVncInfo returns an instance of VncInfo initialized with defaults.
 func NewVncInfo() (*VncInfo, error) {
-	var (
-		x  VncInfo
-		xc C.libxl_vnc_info
-	)
+var (
+x VncInfo
+xc C.libxl_vnc_info)
 
-	C.libxl_vnc_info_init(&xc)
-	defer C.libxl_vnc_info_dispose(&xc)
+C.libxl_vnc_info_init(&xc)
+defer C.libxl_vnc_info_dispose(&xc)
 
-	if err := x.fromC(&xc); err != nil {
-		return nil, err
-	}
+if err := x.fromC(&xc); err != nil {
+return nil, err }
 
-	return &x, nil
-}
+return &x, nil}
 
 func (x *VncInfo) fromC(xc *C.libxl_vnc_info) error {
-	if err := x.Enable.fromC(&xc.enable); err != nil {
-		return fmt.Errorf("converting field Enable: %v", err)
-	}
-	x.Listen = C.GoString(xc.listen)
-	x.Passwd = C.GoString(xc.passwd)
-	x.Display = int(xc.display)
-	if err := x.Findunused.fromC(&xc.findunused); err != nil {
-		return fmt.Errorf("converting field Findunused: %v", err)
-	}
-
-	return nil
-}
-
-func (x *VncInfo) toC(xc *C.libxl_vnc_info) (err error) {
-	defer func() {
-		if err != nil {
-			C.libxl_vnc_info_dispose(xc)
-		}
-	}()
-
-	if err := x.Enable.toC(&xc.enable); err != nil {
-		return fmt.Errorf("converting field Enable: %v", err)
-	}
-	if x.Listen != "" {
-		xc.listen = C.CString(x.Listen)
-	}
-	if x.Passwd != "" {
-		xc.passwd = C.CString(x.Passwd)
-	}
-	xc.display = C.int(x.Display)
-	if err := x.Findunused.toC(&xc.findunused); err != nil {
-		return fmt.Errorf("converting field Findunused: %v", err)
-	}
-
-	return nil
+ if err := x.Enable.fromC(&xc.enable);err != nil {
+return fmt.Errorf("converting field Enable: %v", err)
+}
+x.Listen = C.GoString(xc.listen)
+x.Passwd = C.GoString(xc.passwd)
+x.Display = int(xc.display)
+if err := x.Findunused.fromC(&xc.findunused);err != nil {
+return fmt.Errorf("converting field Findunused: %v", err)
 }
 
+ return nil}
+
+func (x *VncInfo) toC(xc *C.libxl_vnc_info) (err error){defer func(){
+if err != nil{
+C.libxl_vnc_info_dispose(xc)}
+}()
+
+if err := x.Enable.toC(&xc.enable); err != nil {
+return fmt.Errorf("converting field Enable: %v", err)
+}
+if x.Listen != "" {
+xc.listen = C.CString(x.Listen)}
+if x.Passwd != "" {
+xc.passwd = C.CString(x.Passwd)}
+xc.display = C.int(x.Display)
+if err := x.Findunused.toC(&xc.findunused); err != nil {
+return fmt.Errorf("converting field Findunused: %v", err)
+}
+
+ return nil
+ }
+
 // NewSpiceInfo returns an instance of SpiceInfo initialized with defaults.
 func NewSpiceInfo() (*SpiceInfo, error) {
-	var (
-		x  SpiceInfo
-		xc C.libxl_spice_info
-	)
+var (
+x SpiceInfo
+xc C.libxl_spice_info)
 
-	C.libxl_spice_info_init(&xc)
-	defer C.libxl_spice_info_dispose(&xc)
+C.libxl_spice_info_init(&xc)
+defer C.libxl_spice_info_dispose(&xc)
 
-	if err := x.fromC(&xc); err != nil {
-		return nil, err
-	}
+if err := x.fromC(&xc); err != nil {
+return nil, err }
 
-	return &x, nil
-}
+return &x, nil}
 
 func (x *SpiceInfo) fromC(xc *C.libxl_spice_info) error {
-	if err := x.Enable.fromC(&xc.enable); err != nil {
-		return fmt.Errorf("converting field Enable: %v", err)
-	}
-	x.Port = int(xc.port)
-	x.TlsPort = int(xc.tls_port)
-	x.Host = C.GoString(xc.host)
-	if err := x.DisableTicketing.fromC(&xc.disable_ticketing); err != nil {
-		return fmt.Errorf("converting field DisableTicketing: %v", err)
-	}
-	x.Passwd = C.GoString(xc.passwd)
-	if err := x.AgentMouse.fromC(&xc.agent_mouse); err != nil {
-		return fmt.Errorf("converting field AgentMouse: %v", err)
-	}
-	if err := x.Vdagent.fromC(&xc.vdagent); err != nil {
-		return fmt.Errorf("converting field Vdagent: %v", err)
-	}
-	if err := x.ClipboardSharing.fromC(&xc.clipboard_sharing); err != nil {
-		return fmt.Errorf("converting field ClipboardSharing: %v", err)
-	}
-	x.Usbredirection = int(xc.usbredirection)
-	x.ImageCompression = C.GoString(xc.image_compression)
-	x.StreamingVideo = C.GoString(xc.streaming_video)
-
-	return nil
-}
-
-func (x *SpiceInfo) toC(xc *C.libxl_spice_info) (err error) {
-	defer func() {
-		if err != nil {
-			C.libxl_spice_info_dispose(xc)
-		}
-	}()
-
-	if err := x.Enable.toC(&xc.enable); err != nil {
-		return fmt.Errorf("converting field Enable: %v", err)
-	}
-	xc.port = C.int(x.Port)
-	xc.tls_port = C.int(x.TlsPort)
-	if x.Host != "" {
-		xc.host = C.CString(x.Host)
-	}
-	if err := x.DisableTicketing.toC(&xc.disable_ticketing); err != nil {
-		return fmt.Errorf("converting field DisableTicketing: %v", err)
-	}
-	if x.Passwd != "" {
-		xc.passwd = C.CString(x.Passwd)
-	}
-	if err := x.AgentMouse.toC(&xc.agent_mouse); err != nil {
-		return fmt.Errorf("converting field AgentMouse: %v", err)
-	}
-	if err := x.Vdagent.toC(&xc.vdagent); err != nil {
-		return fmt.Errorf("converting field Vdagent: %v", err)
-	}
-	if err := x.ClipboardSharing.toC(&xc.clipboard_sharing); err != nil {
-		return fmt.Errorf("converting field ClipboardSharing: %v", err)
-	}
-	xc.usbredirection = C.int(x.Usbredirection)
-	if x.ImageCompression != "" {
-		xc.image_compression = C.CString(x.ImageCompression)
-	}
-	if x.StreamingVideo != "" {
-		xc.streaming_video = C.CString(x.StreamingVideo)
-	}
-
-	return nil
+ if err := x.Enable.fromC(&xc.enable);err != nil {
+return fmt.Errorf("converting field Enable: %v", err)
+}
+x.Port = int(xc.port)
+x.TlsPort = int(xc.tls_port)
+x.Host = C.GoString(xc.host)
+if err := x.DisableTicketing.fromC(&xc.disable_ticketing);err != nil {
+return fmt.Errorf("converting field DisableTicketing: %v", err)
+}
+x.Passwd = C.GoString(xc.passwd)
+if err := x.AgentMouse.fromC(&xc.agent_mouse);err != nil {
+return fmt.Errorf("converting field AgentMouse: %v", err)
+}
+if err := x.Vdagent.fromC(&xc.vdagent);err != nil {
+return fmt.Errorf("converting field Vdagent: %v", err)
+}
+if err := x.ClipboardSharing.fromC(&xc.clipboard_sharing);err != nil {
+return fmt.Errorf("converting field ClipboardSharing: %v", err)
+}
+x.Usbredirection = int(xc.usbredirection)
+x.ImageCompression = C.GoString(xc.image_compression)
+x.StreamingVideo = C.GoString(xc.streaming_video)
+
+ return nil}
+
+func (x *SpiceInfo) toC(xc *C.libxl_spice_info) (err error){defer func(){
+if err != nil{
+C.libxl_spice_info_dispose(xc)}
+}()
+
+if err := x.Enable.toC(&xc.enable); err != nil {
+return fmt.Errorf("converting field Enable: %v", err)
+}
+xc.port = C.int(x.Port)
+xc.tls_port = C.int(x.TlsPort)
+if x.Host != "" {
+xc.host = C.CString(x.Host)}
+if err := x.DisableTicketing.toC(&xc.disable_ticketing); err != nil {
+return fmt.Errorf("converting field DisableTicketing: %v", err)
+}
+if x.Passwd != "" {
+xc.passwd = C.CString(x.Passwd)}
+if err := x.AgentMouse.toC(&xc.agent_mouse); err != nil {
+return fmt.Errorf("converting field AgentMouse: %v", err)
+}
+if err := x.Vdagent.toC(&xc.vdagent); err != nil {
+return fmt.Errorf("converting field Vdagent: %v", err)
+}
+if err := x.ClipboardSharing.toC(&xc.clipboard_sharing); err != nil {
+return fmt.Errorf("converting field ClipboardSharing: %v", err)
 }
+xc.usbredirection = C.int(x.Usbredirection)
+if x.ImageCompression != "" {
+xc.image_compression = C.CString(x.ImageCompression)}
+if x.StreamingVideo != "" {
+xc.streaming_video = C.CString(x.StreamingVideo)}
+
+ return nil
+ }
 
 // NewSdlInfo returns an instance of SdlInfo initialized with defaults.
 func NewSdlInfo() (*SdlInfo, error) {
-	var (
-		x  SdlInfo
-		xc C.libxl_sdl_info
-	)
+var (
+x SdlInfo
+xc C.libxl_sdl_info)
 
-	C.libxl_sdl_info_init(&xc)
-	defer C.libxl_sdl_info_dispose(&xc)
+C.libxl_sdl_info_init(&xc)
+defer C.libxl_sdl_info_dispose(&xc)
 
-	if err := x.fromC(&xc); err != nil {
-		return nil, err
-	}
+if err := x.fromC(&xc); err != nil {
+return nil, err }
 
-	return &x, nil
-}
+return &x, nil}
 
 func (x *SdlInfo) fromC(xc *C.libxl_sdl_info) error {
-	if err := x.Enable.fromC(&xc.enable); err != nil {
-		return fmt.Errorf("converting field Enable: %v", err)
-	}
-	if err := x.Opengl.fromC(&xc.opengl); err != nil {
-		return fmt.Errorf("converting field Opengl: %v", err)
-	}
-	x.Display = C.GoString(xc.display)
-	x.Xauthority = C.GoString(xc.xauthority)
-
-	return nil
-}
-
-func (x *SdlInfo) toC(xc *C.libxl_sdl_info) (err error) {
-	defer func() {
-		if err != nil {
-			C.libxl_sdl_info_dispose(xc)
-		}
-	}()
-
-	if err := x.Enable.toC(&xc.enable); err != nil {
-		return fmt.Errorf("converting field Enable: %v", err)
-	}
-	if err := x.Opengl.toC(&xc.opengl); err != nil {
-		return fmt.Errorf("converting field Opengl: %v", err)
-	}
-	if x.Display != "" {
-		xc.display = C.CString(x.Display)
-	}
-	if x.Xauthority != "" {
-		xc.xauthority = C.CString(x.Xauthority)
-	}
-
-	return nil
+ if err := x.Enable.fromC(&xc.enable);err != nil {
+return fmt.Errorf("converting field Enable: %v", err)
+}
+if err := x.Opengl.fromC(&xc.opengl);err != nil {
+return fmt.Errorf("converting field Opengl: %v", err)
 }
+x.Display = C.GoString(xc.display)
+x.Xauthority = C.GoString(xc.xauthority)
+
+ return nil}
+
+func (x *SdlInfo) toC(xc *C.libxl_sdl_info) (err error){defer func(){
+if err != nil{
+C.libxl_sdl_info_dispose(xc)}
+}()
+
+if err := x.Enable.toC(&xc.enable); err != nil {
+return fmt.Errorf("converting field Enable: %v", err)
+}
+if err := x.Opengl.toC(&xc.opengl); err != nil {
+return fmt.Errorf("converting field Opengl: %v", err)
+}
+if x.Display != "" {
+xc.display = C.CString(x.Display)}
+if x.Xauthority != "" {
+xc.xauthority = C.CString(x.Xauthority)}
+
+ return nil
+ }
 
 // NewDominfo returns an instance of Dominfo initialized with defaults.
 func NewDominfo() (*Dominfo, error) {
-	var (
-		x  Dominfo
-		xc C.libxl_dominfo
-	)
+var (
+x Dominfo
+xc C.libxl_dominfo)
 
-	C.libxl_dominfo_init(&xc)
-	defer C.libxl_dominfo_dispose(&xc)
+C.libxl_dominfo_init(&xc)
+defer C.libxl_dominfo_dispose(&xc)
 
-	if err := x.fromC(&xc); err != nil {
-		return nil, err
-	}
+if err := x.fromC(&xc); err != nil {
+return nil, err }
 
-	return &x, nil
-}
+return &x, nil}
 
 func (x *Dominfo) fromC(xc *C.libxl_dominfo) error {
-	if err := x.Uuid.fromC(&xc.uuid); err != nil {
-		return fmt.Errorf("converting field Uuid: %v", err)
-	}
-	x.Domid = Domid(xc.domid)
-	x.Ssidref = uint32(xc.ssidref)
-	x.SsidLabel = C.GoString(xc.ssid_label)
-	x.Running = bool(xc.running)
-	x.Blocked = bool(xc.blocked)
-	x.Paused = bool(xc.paused)
-	x.Shutdown = bool(xc.shutdown)
-	x.Dying = bool(xc.dying)
-	x.NeverStop = bool(xc.never_stop)
-	x.ShutdownReason = ShutdownReason(xc.shutdown_reason)
-	x.OutstandingMemkb = uint64(xc.outstanding_memkb)
-	x.CurrentMemkb = uint64(xc.current_memkb)
-	x.SharedMemkb = uint64(xc.shared_memkb)
-	x.PagedMemkb = uint64(xc.paged_memkb)
-	x.MaxMemkb = uint64(xc.max_memkb)
-	x.CpuTime = uint64(xc.cpu_time)
-	x.VcpuMaxId = uint32(xc.vcpu_max_id)
-	x.VcpuOnline = uint32(xc.vcpu_online)
-	x.Cpupool = uint32(xc.cpupool)
-	x.DomainType = DomainType(xc.domain_type)
-
-	return nil
-}
-
-func (x *Dominfo) toC(xc *C.libxl_dominfo) (err error) {
-	defer func() {
-		if err != nil {
-			C.libxl_dominfo_dispose(xc)
-		}
-	}()
-
-	if err := x.Uuid.toC(&xc.uuid); err != nil {
-		return fmt.Errorf("converting field Uuid: %v", err)
-	}
-	xc.domid = C.libxl_domid(x.Domid)
-	xc.ssidref = C.uint32_t(x.Ssidref)
-	if x.SsidLabel != "" {
-		xc.ssid_label = C.CString(x.SsidLabel)
-	}
-	xc.running = C.bool(x.Running)
-	xc.blocked = C.bool(x.Blocked)
-	xc.paused = C.bool(x.Paused)
-	xc.shutdown = C.bool(x.Shutdown)
-	xc.dying = C.bool(x.Dying)
-	xc.never_stop = C.bool(x.NeverStop)
-	xc.shutdown_reason = C.libxl_shutdown_reason(x.ShutdownReason)
-	xc.outstanding_memkb = C.uint64_t(x.OutstandingMemkb)
-	xc.current_memkb = C.uint64_t(x.CurrentMemkb)
-	xc.shared_memkb = C.uint64_t(x.SharedMemkb)
-	xc.paged_memkb = C.uint64_t(x.PagedMemkb)
-	xc.max_memkb = C.uint64_t(x.MaxMemkb)
-	xc.cpu_time = C.uint64_t(x.CpuTime)
-	xc.vcpu_max_id = C.uint32_t(x.VcpuMaxId)
-	xc.vcpu_online = C.uint32_t(x.VcpuOnline)
-	xc.cpupool = C.uint32_t(x.Cpupool)
-	xc.domain_type = C.libxl_domain_type(x.DomainType)
-
-	return nil
-}
+ if err := x.Uuid.fromC(&xc.uuid);err != nil {
+return fmt.Errorf("converting field Uuid: %v", err)
+}
+x.Domid = Domid(xc.domid)
+x.Ssidref = uint32(xc.ssidref)
+x.SsidLabel = C.GoString(xc.ssid_label)
+x.Running = bool(xc.running)
+x.Blocked = bool(xc.blocked)
+x.Paused = bool(xc.paused)
+x.Shutdown = bool(xc.shutdown)
+x.Dying = bool(xc.dying)
+x.NeverStop = bool(xc.never_stop)
+x.ShutdownReason = ShutdownReason(xc.shutdown_reason)
+x.OutstandingMemkb = uint64(xc.outstanding_memkb)
+x.CurrentMemkb = uint64(xc.current_memkb)
+x.SharedMemkb = uint64(xc.shared_memkb)
+x.PagedMemkb = uint64(xc.paged_memkb)
+x.MaxMemkb = uint64(xc.max_memkb)
+x.CpuTime = uint64(xc.cpu_time)
+x.VcpuMaxId = uint32(xc.vcpu_max_id)
+x.VcpuOnline = uint32(xc.vcpu_online)
+x.Cpupool = uint32(xc.cpupool)
+x.DomainType = DomainType(xc.domain_type)
+
+ return nil}
+
+func (x *Dominfo) toC(xc *C.libxl_dominfo) (err error){defer func(){
+if err != nil{
+C.libxl_dominfo_dispose(xc)}
+}()
+
+if err := x.Uuid.toC(&xc.uuid); err != nil {
+return fmt.Errorf("converting field Uuid: %v", err)
+}
+xc.domid = C.libxl_domid(x.Domid)
+xc.ssidref = C.uint32_t(x.Ssidref)
+if x.SsidLabel != "" {
+xc.ssid_label = C.CString(x.SsidLabel)}
+xc.running = C.bool(x.Running)
+xc.blocked = C.bool(x.Blocked)
+xc.paused = C.bool(x.Paused)
+xc.shutdown = C.bool(x.Shutdown)
+xc.dying = C.bool(x.Dying)
+xc.never_stop = C.bool(x.NeverStop)
+xc.shutdown_reason = C.libxl_shutdown_reason(x.ShutdownReason)
+xc.outstanding_memkb = C.uint64_t(x.OutstandingMemkb)
+xc.current_memkb = C.uint64_t(x.CurrentMemkb)
+xc.shared_memkb = C.uint64_t(x.SharedMemkb)
+xc.paged_memkb = C.uint64_t(x.PagedMemkb)
+xc.max_memkb = C.uint64_t(x.MaxMemkb)
+xc.cpu_time = C.uint64_t(x.CpuTime)
+xc.vcpu_max_id = C.uint32_t(x.VcpuMaxId)
+xc.vcpu_online = C.uint32_t(x.VcpuOnline)
+xc.cpupool = C.uint32_t(x.Cpupool)
+xc.domain_type = C.libxl_domain_type(x.DomainType)
+
+ return nil
+ }
 
 // NewCpupoolinfo returns an instance of Cpupoolinfo initialized with defaults.
 func NewCpupoolinfo() (*Cpupoolinfo, error) {
-	var (
-		x  Cpupoolinfo
-		xc C.libxl_cpupoolinfo
-	)
+var (
+x Cpupoolinfo
+xc C.libxl_cpupoolinfo)
 
-	C.libxl_cpupoolinfo_init(&xc)
-	defer C.libxl_cpupoolinfo_dispose(&xc)
+C.libxl_cpupoolinfo_init(&xc)
+defer C.libxl_cpupoolinfo_dispose(&xc)
 
-	if err := x.fromC(&xc); err != nil {
-		return nil, err
-	}
+if err := x.fromC(&xc); err != nil {
+return nil, err }
 
-	return &x, nil
-}
+return &x, nil}
 
 func (x *Cpupoolinfo) fromC(xc *C.libxl_cpupoolinfo) error {
-	x.Poolid = uint32(xc.poolid)
-	x.PoolName = C.GoString(xc.pool_name)
-	x.Sched = Scheduler(xc.sched)
-	x.NDom = uint32(xc.n_dom)
-	if err := x.Cpumap.fromC(&xc.cpumap); err != nil {
-		return fmt.Errorf("converting field Cpumap: %v", err)
-	}
-
-	return nil
+ x.Poolid = uint32(xc.poolid)
+x.PoolName = C.GoString(xc.pool_name)
+x.Sched = Scheduler(xc.sched)
+x.NDom = uint32(xc.n_dom)
+if err := x.Cpumap.fromC(&xc.cpumap);err != nil {
+return fmt.Errorf("converting field Cpumap: %v", err)
 }
 
-func (x *Cpupoolinfo) toC(xc *C.libxl_cpupoolinfo) (err error) {
-	defer func() {
-		if err != nil {
-			C.libxl_cpupoolinfo_dispose(xc)
-		}
-	}()
+ return nil}
 
-	xc.poolid = C.uint32_t(x.Poolid)
-	if x.PoolName != "" {
-		xc.pool_name = C.CString(x.PoolName)
-	}
-	xc.sched = C.libxl_scheduler(x.Sched)
-	xc.n_dom = C.uint32_t(x.NDom)
-	if err := x.Cpumap.toC(&xc.cpumap); err != nil {
-		return fmt.Errorf("converting field Cpumap: %v", err)
-	}
+func (x *Cpupoolinfo) toC(xc *C.libxl_cpupoolinfo) (err error){defer func(){
+if err != nil{
+C.libxl_cpupoolinfo_dispose(xc)}
+}()
 
-	return nil
+xc.poolid = C.uint32_t(x.Poolid)
+if x.PoolName != "" {
+xc.pool_name = C.CString(x.PoolName)}
+xc.sched = C.libxl_scheduler(x.Sched)
+xc.n_dom = C.uint32_t(x.NDom)
+if err := x.Cpumap.toC(&xc.cpumap); err != nil {
+return fmt.Errorf("converting field Cpumap: %v", err)
 }
 
+ return nil
+ }
+
 // NewChannelinfo returns an instance of Channelinfo initialized with defaults.
 func NewChannelinfo(connection ChannelConnection) (*Channelinfo, error) {
-	var (
-		x  Channelinfo
-		xc C.libxl_channelinfo
-	)
+var (
+x Channelinfo
+xc C.libxl_channelinfo)
 
-	C.libxl_channelinfo_init(&xc)
-	C.libxl_channelinfo_init_connection(&xc, C.libxl_channel_connection(connection))
-	defer C.libxl_channelinfo_dispose(&xc)
+C.libxl_channelinfo_init(&xc)
+C.libxl_channelinfo_init_connection(&xc, C.libxl_channel_connection(connection))
+defer C.libxl_channelinfo_dispose(&xc)
 
-	if err := x.fromC(&xc); err != nil {
-		return nil, err
-	}
+if err := x.fromC(&xc); err != nil {
+return nil, err }
 
-	return &x, nil
-}
+return &x, nil}
 
 func (x *Channelinfo) fromC(xc *C.libxl_channelinfo) error {
-	x.Backend = C.GoString(xc.backend)
-	x.BackendId = uint32(xc.backend_id)
-	x.Frontend = C.GoString(xc.frontend)
-	x.FrontendId = uint32(xc.frontend_id)
-	x.Devid = Devid(xc.devid)
-	x.State = int(xc.state)
-	x.Evtch = int(xc.evtch)
-	x.Rref = int(xc.rref)
-	x.Connection = ChannelConnection(xc.connection)
-	switch x.Connection {
-	case ChannelConnectionUnknown:
-		x.ConnectionUnion = nil
-	case ChannelConnectionPty:
-		var connectionPty ChannelinfoConnectionUnionPty
-		if err := connectionPty.fromC(xc); err != nil {
-			return fmt.Errorf("converting field connectionPty: %v", err)
-		}
-		x.ConnectionUnion = connectionPty
-	case ChannelConnectionSocket:
-		x.ConnectionUnion = nil
-	default:
-		return fmt.Errorf("invalid union key '%v'", x.Connection)
-	}
-
-	return nil
-}
+ x.Backend = C.GoString(xc.backend)
+x.BackendId = uint32(xc.backend_id)
+x.Frontend = C.GoString(xc.frontend)
+x.FrontendId = uint32(xc.frontend_id)
+x.Devid = Devid(xc.devid)
+x.State = int(xc.state)
+x.Evtch = int(xc.evtch)
+x.Rref = int(xc.rref)
+x.Connection = ChannelConnection(xc.connection)
+switch x.Connection{
+case ChannelConnectionUnknown:
+x.ConnectionUnion = nil
+case ChannelConnectionPty:
+var connectionPty ChannelinfoConnectionUnionPty
+if err := connectionPty.fromC(xc);err != nil {
+ return fmt.Errorf("converting field connectionPty: %v", err)
+}
+x.ConnectionUnion = connectionPty
+case ChannelConnectionSocket:
+x.ConnectionUnion = nil
+default:
+return fmt.Errorf("invalid union key '%v'", x.Connection)}
+
+ return nil}
 
 func (x *ChannelinfoConnectionUnionPty) fromC(xc *C.libxl_channelinfo) error {
-	if ChannelConnection(xc.connection) != ChannelConnectionPty {
-		return errors.New("expected union key ChannelConnectionPty")
-	}
-
-	tmp := (*C.libxl_channelinfo_connection_union_pty)(unsafe.Pointer(&xc.u[0]))
-	x.Path = C.GoString(tmp.path)
-	return nil
-}
-
-func (x *Channelinfo) toC(xc *C.libxl_channelinfo) (err error) {
-	defer func() {
-		if err != nil {
-			C.libxl_channelinfo_dispose(xc)
-		}
-	}()
-
-	if x.Backend != "" {
-		xc.backend = C.CString(x.Backend)
-	}
-	xc.backend_id = C.uint32_t(x.BackendId)
-	if x.Frontend != "" {
-		xc.frontend = C.CString(x.Frontend)
-	}
-	xc.frontend_id = C.uint32_t(x.FrontendId)
-	xc.devid = C.libxl_devid(x.Devid)
-	xc.state = C.int(x.State)
-	xc.evtch = C.int(x.Evtch)
-	xc.rref = C.int(x.Rref)
-	xc.connection = C.libxl_channel_connection(x.Connection)
-	switch x.Connection {
-	case ChannelConnectionUnknown:
-		break
-	case ChannelConnectionPty:
-		tmp, ok := x.ConnectionUnion.(ChannelinfoConnectionUnionPty)
-		if !ok {
-			return errors.New("wrong type for union key connection")
-		}
-		var pty C.libxl_channelinfo_connection_union_pty
-		if tmp.Path != "" {
-			pty.path = C.CString(tmp.Path)
-		}
-		ptyBytes := C.GoBytes(unsafe.Pointer(&pty), C.sizeof_libxl_channelinfo_connection_union_pty)
-		copy(xc.u[:], ptyBytes)
-	case ChannelConnectionSocket:
-		break
-	default:
-		return fmt.Errorf("invalid union key '%v'", x.Connection)
-	}
-
-	return nil
-}
+if ChannelConnection(xc.connection) != ChannelConnectionPty {
+return errors.New("expected union key ChannelConnectionPty")
+}
+
+tmp := (*C.libxl_channelinfo_connection_union_pty)(unsafe.Pointer(&xc.u[0]))
+x.Path = C.GoString(tmp.path)
+return nil
+}
+
+func (x *Channelinfo) toC(xc *C.libxl_channelinfo) (err error){defer func(){
+if err != nil{
+C.libxl_channelinfo_dispose(xc)}
+}()
+
+if x.Backend != "" {
+xc.backend = C.CString(x.Backend)}
+xc.backend_id = C.uint32_t(x.BackendId)
+if x.Frontend != "" {
+xc.frontend = C.CString(x.Frontend)}
+xc.frontend_id = C.uint32_t(x.FrontendId)
+xc.devid = C.libxl_devid(x.Devid)
+xc.state = C.int(x.State)
+xc.evtch = C.int(x.Evtch)
+xc.rref = C.int(x.Rref)
+xc.connection = C.libxl_channel_connection(x.Connection)
+switch x.Connection{
+case ChannelConnectionUnknown:
+break
+case ChannelConnectionPty:
+tmp, ok := x.ConnectionUnion.(ChannelinfoConnectionUnionPty)
+if !ok {
+return errors.New("wrong type for union key connection")
+}
+var pty C.libxl_channelinfo_connection_union_pty
+if tmp.Path != "" {
+pty.path = C.CString(tmp.Path)}
+ptyBytes := C.GoBytes(unsafe.Pointer(&pty),C.sizeof_libxl_channelinfo_connection_union_pty)
+copy(xc.u[:],ptyBytes)
+case ChannelConnectionSocket:
+break
+default:
+return fmt.Errorf("invalid union key '%v'", x.Connection)}
+
+ return nil
+ }
 
 // NewVminfo returns an instance of Vminfo initialized with defaults.
 func NewVminfo() (*Vminfo, error) {
-	var (
-		x  Vminfo
-		xc C.libxl_vminfo
-	)
+var (
+x Vminfo
+xc C.libxl_vminfo)
 
-	C.libxl_vminfo_init(&xc)
-	defer C.libxl_vminfo_dispose(&xc)
+C.libxl_vminfo_init(&xc)
+defer C.libxl_vminfo_dispose(&xc)
 
-	if err := x.fromC(&xc); err != nil {
-		return nil, err
-	}
+if err := x.fromC(&xc); err != nil {
+return nil, err }
 
-	return &x, nil
-}
+return &x, nil}
 
 func (x *Vminfo) fromC(xc *C.libxl_vminfo) error {
-	if err := x.Uuid.fromC(&xc.uuid); err != nil {
-		return fmt.Errorf("converting field Uuid: %v", err)
-	}
-	x.Domid = Domid(xc.domid)
-
-	return nil
+ if err := x.Uuid.fromC(&xc.uuid);err != nil {
+return fmt.Errorf("converting field Uuid: %v", err)
 }
+x.Domid = Domid(xc.domid)
 
-func (x *Vminfo) toC(xc *C.libxl_vminfo) (err error) {
-	defer func() {
-		if err != nil {
-			C.libxl_vminfo_dispose(xc)
-		}
-	}()
+ return nil}
 
-	if err := x.Uuid.toC(&xc.uuid); err != nil {
-		return fmt.Errorf("converting field Uuid: %v", err)
-	}
-	xc.domid = C.libxl_domid(x.Domid)
+func (x *Vminfo) toC(xc *C.libxl_vminfo) (err error){defer func(){
+if err != nil{
+C.libxl_vminfo_dispose(xc)}
+}()
 
-	return nil
+if err := x.Uuid.toC(&xc.uuid); err != nil {
+return fmt.Errorf("converting field Uuid: %v", err)
 }
+xc.domid = C.libxl_domid(x.Domid)
+
+ return nil
+ }
 
 // NewVersionInfo returns an instance of VersionInfo initialized with defaults.
 func NewVersionInfo() (*VersionInfo, error) {
-	var (
-		x  VersionInfo
-		xc C.libxl_version_info
-	)
+var (
+x VersionInfo
+xc C.libxl_version_info)
 
-	C.libxl_version_info_init(&xc)
-	defer C.libxl_version_info_dispose(&xc)
+C.libxl_version_info_init(&xc)
+defer C.libxl_version_info_dispose(&xc)
 
-	if err := x.fromC(&xc); err != nil {
-		return nil, err
-	}
+if err := x.fromC(&xc); err != nil {
+return nil, err }
 
-	return &x, nil
-}
+return &x, nil}
 
 func (x *VersionInfo) fromC(xc *C.libxl_version_info) error {
-	x.XenVersionMajor = int(xc.xen_version_major)
-	x.XenVersionMinor = int(xc.xen_version_minor)
-	x.XenVersionExtra = C.GoString(xc.xen_version_extra)
-	x.Compiler = C.GoString(xc.compiler)
-	x.CompileBy = C.GoString(xc.compile_by)
-	x.CompileDomain = C.GoString(xc.compile_domain)
-	x.CompileDate = C.GoString(xc.compile_date)
-	x.Capabilities = C.GoString(xc.capabilities)
-	x.Changeset = C.GoString(xc.changeset)
-	x.VirtStart = uint64(xc.virt_start)
-	x.Pagesize = int(xc.pagesize)
-	x.Commandline = C.GoString(xc.commandline)
-	x.BuildId = C.GoString(xc.build_id)
-
-	return nil
-}
-
-func (x *VersionInfo) toC(xc *C.libxl_version_info) (err error) {
-	defer func() {
-		if err != nil {
-			C.libxl_version_info_dispose(xc)
-		}
-	}()
-
-	xc.xen_version_major = C.int(x.XenVersionMajor)
-	xc.xen_version_minor = C.int(x.XenVersionMinor)
-	if x.XenVersionExtra != "" {
-		xc.xen_version_extra = C.CString(x.XenVersionExtra)
-	}
-	if x.Compiler != "" {
-		xc.compiler = C.CString(x.Compiler)
-	}
-	if x.CompileBy != "" {
-		xc.compile_by = C.CString(x.CompileBy)
-	}
-	if x.CompileDomain != "" {
-		xc.compile_domain = C.CString(x.CompileDomain)
-	}
-	if x.CompileDate != "" {
-		xc.compile_date = C.CString(x.CompileDate)
-	}
-	if x.Capabilities != "" {
-		xc.capabilities = C.CString(x.Capabilities)
-	}
-	if x.Changeset != "" {
-		xc.changeset = C.CString(x.Changeset)
-	}
-	xc.virt_start = C.uint64_t(x.VirtStart)
-	xc.pagesize = C.int(x.Pagesize)
-	if x.Commandline != "" {
-		xc.commandline = C.CString(x.Commandline)
-	}
-	if x.BuildId != "" {
-		xc.build_id = C.CString(x.BuildId)
-	}
-
-	return nil
-}
+ x.XenVersionMajor = int(xc.xen_version_major)
+x.XenVersionMinor = int(xc.xen_version_minor)
+x.XenVersionExtra = C.GoString(xc.xen_version_extra)
+x.Compiler = C.GoString(xc.compiler)
+x.CompileBy = C.GoString(xc.compile_by)
+x.CompileDomain = C.GoString(xc.compile_domain)
+x.CompileDate = C.GoString(xc.compile_date)
+x.Capabilities = C.GoString(xc.capabilities)
+x.Changeset = C.GoString(xc.changeset)
+x.VirtStart = uint64(xc.virt_start)
+x.Pagesize = int(xc.pagesize)
+x.Commandline = C.GoString(xc.commandline)
+x.BuildId = C.GoString(xc.build_id)
+
+ return nil}
+
+func (x *VersionInfo) toC(xc *C.libxl_version_info) (err error){defer func(){
+if err != nil{
+C.libxl_version_info_dispose(xc)}
+}()
+
+xc.xen_version_major = C.int(x.XenVersionMajor)
+xc.xen_version_minor = C.int(x.XenVersionMinor)
+if x.XenVersionExtra != "" {
+xc.xen_version_extra = C.CString(x.XenVersionExtra)}
+if x.Compiler != "" {
+xc.compiler = C.CString(x.Compiler)}
+if x.CompileBy != "" {
+xc.compile_by = C.CString(x.CompileBy)}
+if x.CompileDomain != "" {
+xc.compile_domain = C.CString(x.CompileDomain)}
+if x.CompileDate != "" {
+xc.compile_date = C.CString(x.CompileDate)}
+if x.Capabilities != "" {
+xc.capabilities = C.CString(x.Capabilities)}
+if x.Changeset != "" {
+xc.changeset = C.CString(x.Changeset)}
+xc.virt_start = C.uint64_t(x.VirtStart)
+xc.pagesize = C.int(x.Pagesize)
+if x.Commandline != "" {
+xc.commandline = C.CString(x.Commandline)}
+if x.BuildId != "" {
+xc.build_id = C.CString(x.BuildId)}
+
+ return nil
+ }
 
 // NewDomainCreateInfo returns an instance of DomainCreateInfo initialized with defaults.
 func NewDomainCreateInfo() (*DomainCreateInfo, error) {
-	var (
-		x  DomainCreateInfo
-		xc C.libxl_domain_create_info
-	)
+var (
+x DomainCreateInfo
+xc C.libxl_domain_create_info)
 
-	C.libxl_domain_create_info_init(&xc)
-	defer C.libxl_domain_create_info_dispose(&xc)
+C.libxl_domain_create_info_init(&xc)
+defer C.libxl_domain_create_info_dispose(&xc)
 
-	if err := x.fromC(&xc); err != nil {
-		return nil, err
-	}
+if err := x.fromC(&xc); err != nil {
+return nil, err }
 
-	return &x, nil
-}
+return &x, nil}
 
 func (x *DomainCreateInfo) fromC(xc *C.libxl_domain_create_info) error {
-	x.Type = DomainType(xc._type)
-	if err := x.Hap.fromC(&xc.hap); err != nil {
-		return fmt.Errorf("converting field Hap: %v", err)
-	}
-	if err := x.Oos.fromC(&xc.oos); err != nil {
-		return fmt.Errorf("converting field Oos: %v", err)
-	}
-	x.Ssidref = uint32(xc.ssidref)
-	x.SsidLabel = C.GoString(xc.ssid_label)
-	x.Name = C.GoString(xc.name)
-	x.Domid = Domid(xc.domid)
-	if err := x.Uuid.fromC(&xc.uuid); err != nil {
-		return fmt.Errorf("converting field Uuid: %v", err)
-	}
-	if err := x.Xsdata.fromC(&xc.xsdata); err != nil {
-		return fmt.Errorf("converting field Xsdata: %v", err)
-	}
-	if err := x.Platformdata.fromC(&xc.platformdata); err != nil {
-		return fmt.Errorf("converting field Platformdata: %v", err)
-	}
-	x.Poolid = uint32(xc.poolid)
-	x.PoolName = C.GoString(xc.pool_name)
-	if err := x.RunHotplugScripts.fromC(&xc.run_hotplug_scripts); err != nil {
-		return fmt.Errorf("converting field RunHotplugScripts: %v", err)
-	}
-	if err := x.DriverDomain.fromC(&xc.driver_domain); err != nil {
-		return fmt.Errorf("converting field DriverDomain: %v", err)
-	}
-	x.Passthrough = Passthrough(xc.passthrough)
-	if err := x.XendSuspendEvtchnCompat.fromC(&xc.xend_suspend_evtchn_compat); err != nil {
-		return fmt.Errorf("converting field XendSuspendEvtchnCompat: %v", err)
-	}
-
-	return nil
-}
-
-func (x *DomainCreateInfo) toC(xc *C.libxl_domain_create_info) (err error) {
-	defer func() {
-		if err != nil {
-			C.libxl_domain_create_info_dispose(xc)
-		}
-	}()
-
-	xc._type = C.libxl_domain_type(x.Type)
-	if err := x.Hap.toC(&xc.hap); err != nil {
-		return fmt.Errorf("converting field Hap: %v", err)
-	}
-	if err := x.Oos.toC(&xc.oos); err != nil {
-		return fmt.Errorf("converting field Oos: %v", err)
-	}
-	xc.ssidref = C.uint32_t(x.Ssidref)
-	if x.SsidLabel != "" {
-		xc.ssid_label = C.CString(x.SsidLabel)
-	}
-	if x.Name != "" {
-		xc.name = C.CString(x.Name)
-	}
-	xc.domid = C.libxl_domid(x.Domid)
-	if err := x.Uuid.toC(&xc.uuid); err != nil {
-		return fmt.Errorf("converting field Uuid: %v", err)
-	}
-	if err := x.Xsdata.toC(&xc.xsdata); err != nil {
-		return fmt.Errorf("converting field Xsdata: %v", err)
-	}
-	if err := x.Platformdata.toC(&xc.platformdata); err != nil {
-		return fmt.Errorf("converting field Platformdata: %v", err)
-	}
-	xc.poolid = C.uint32_t(x.Poolid)
-	if x.PoolName != "" {
-		xc.pool_name = C.CString(x.PoolName)
-	}
-	if err := x.RunHotplugScripts.toC(&xc.run_hotplug_scripts); err != nil {
-		return fmt.Errorf("converting field RunHotplugScripts: %v", err)
-	}
-	if err := x.DriverDomain.toC(&xc.driver_domain); err != nil {
-		return fmt.Errorf("converting field DriverDomain: %v", err)
-	}
-	xc.passthrough = C.libxl_passthrough(x.Passthrough)
-	if err := x.XendSuspendEvtchnCompat.toC(&xc.xend_suspend_evtchn_compat); err != nil {
-		return fmt.Errorf("converting field XendSuspendEvtchnCompat: %v", err)
-	}
-
-	return nil
+ x.Type = DomainType(xc._type)
+if err := x.Hap.fromC(&xc.hap);err != nil {
+return fmt.Errorf("converting field Hap: %v", err)
+}
+if err := x.Oos.fromC(&xc.oos);err != nil {
+return fmt.Errorf("converting field Oos: %v", err)
+}
+x.Ssidref = uint32(xc.ssidref)
+x.SsidLabel = C.GoString(xc.ssid_label)
+x.Name = C.GoString(xc.name)
+x.Domid = Domid(xc.domid)
+if err := x.Uuid.fromC(&xc.uuid);err != nil {
+return fmt.Errorf("converting field Uuid: %v", err)
 }
+if err := x.Xsdata.fromC(&xc.xsdata);err != nil {
+return fmt.Errorf("converting field Xsdata: %v", err)
+}
+if err := x.Platformdata.fromC(&xc.platformdata);err != nil {
+return fmt.Errorf("converting field Platformdata: %v", err)
+}
+x.Poolid = uint32(xc.poolid)
+x.PoolName = C.GoString(xc.pool_name)
+if err := x.RunHotplugScripts.fromC(&xc.run_hotplug_scripts);err != nil {
+return fmt.Errorf("converting field RunHotplugScripts: %v", err)
+}
+if err := x.DriverDomain.fromC(&xc.driver_domain);err != nil {
+return fmt.Errorf("converting field DriverDomain: %v", err)
+}
+x.Passthrough = Passthrough(xc.passthrough)
+if err := x.XendSuspendEvtchnCompat.fromC(&xc.xend_suspend_evtchn_compat);err != nil {
+return fmt.Errorf("converting field XendSuspendEvtchnCompat: %v", err)
+}
+
+ return nil}
+
+func (x *DomainCreateInfo) toC(xc *C.libxl_domain_create_info) (err error){defer func(){
+if err != nil{
+C.libxl_domain_create_info_dispose(xc)}
+}()
+
+xc._type = C.libxl_domain_type(x.Type)
+if err := x.Hap.toC(&xc.hap); err != nil {
+return fmt.Errorf("converting field Hap: %v", err)
+}
+if err := x.Oos.toC(&xc.oos); err != nil {
+return fmt.Errorf("converting field Oos: %v", err)
+}
+xc.ssidref = C.uint32_t(x.Ssidref)
+if x.SsidLabel != "" {
+xc.ssid_label = C.CString(x.SsidLabel)}
+if x.Name != "" {
+xc.name = C.CString(x.Name)}
+xc.domid = C.libxl_domid(x.Domid)
+if err := x.Uuid.toC(&xc.uuid); err != nil {
+return fmt.Errorf("converting field Uuid: %v", err)
+}
+if err := x.Xsdata.toC(&xc.xsdata); err != nil {
+return fmt.Errorf("converting field Xsdata: %v", err)
+}
+if err := x.Platformdata.toC(&xc.platformdata); err != nil {
+return fmt.Errorf("converting field Platformdata: %v", err)
+}
+xc.poolid = C.uint32_t(x.Poolid)
+if x.PoolName != "" {
+xc.pool_name = C.CString(x.PoolName)}
+if err := x.RunHotplugScripts.toC(&xc.run_hotplug_scripts); err != nil {
+return fmt.Errorf("converting field RunHotplugScripts: %v", err)
+}
+if err := x.DriverDomain.toC(&xc.driver_domain); err != nil {
+return fmt.Errorf("converting field DriverDomain: %v", err)
+}
+xc.passthrough = C.libxl_passthrough(x.Passthrough)
+if err := x.XendSuspendEvtchnCompat.toC(&xc.xend_suspend_evtchn_compat); err != nil {
+return fmt.Errorf("converting field XendSuspendEvtchnCompat: %v", err)
+}
+
+ return nil
+ }
 
 // NewDomainRestoreParams returns an instance of DomainRestoreParams initialized with defaults.
 func NewDomainRestoreParams() (*DomainRestoreParams, error) {
-	var (
-		x  DomainRestoreParams
-		xc C.libxl_domain_restore_params
-	)
+var (
+x DomainRestoreParams
+xc C.libxl_domain_restore_params)
 
-	C.libxl_domain_restore_params_init(&xc)
-	defer C.libxl_domain_restore_params_dispose(&xc)
+C.libxl_domain_restore_params_init(&xc)
+defer C.libxl_domain_restore_params_dispose(&xc)
 
-	if err := x.fromC(&xc); err != nil {
-		return nil, err
-	}
+if err := x.fromC(&xc); err != nil {
+return nil, err }
 
-	return &x, nil
-}
+return &x, nil}
 
 func (x *DomainRestoreParams) fromC(xc *C.libxl_domain_restore_params) error {
-	x.CheckpointedStream = int(xc.checkpointed_stream)
-	x.StreamVersion = uint32(xc.stream_version)
-	x.ColoProxyScript = C.GoString(xc.colo_proxy_script)
-	if err := x.UserspaceColoProxy.fromC(&xc.userspace_colo_proxy); err != nil {
-		return fmt.Errorf("converting field UserspaceColoProxy: %v", err)
-	}
-
-	return nil
+ x.CheckpointedStream = int(xc.checkpointed_stream)
+x.StreamVersion = uint32(xc.stream_version)
+x.ColoProxyScript = C.GoString(xc.colo_proxy_script)
+if err := x.UserspaceColoProxy.fromC(&xc.userspace_colo_proxy);err != nil {
+return fmt.Errorf("converting field UserspaceColoProxy: %v", err)
 }
 
-func (x *DomainRestoreParams) toC(xc *C.libxl_domain_restore_params) (err error) {
-	defer func() {
-		if err != nil {
-			C.libxl_domain_restore_params_dispose(xc)
-		}
-	}()
+ return nil}
 
-	xc.checkpointed_stream = C.int(x.CheckpointedStream)
-	xc.stream_version = C.uint32_t(x.StreamVersion)
-	if x.ColoProxyScript != "" {
-		xc.colo_proxy_script = C.CString(x.ColoProxyScript)
-	}
-	if err := x.UserspaceColoProxy.toC(&xc.userspace_colo_proxy); err != nil {
-		return fmt.Errorf("converting field UserspaceColoProxy: %v", err)
-	}
+func (x *DomainRestoreParams) toC(xc *C.libxl_domain_restore_params) (err error){defer func(){
+if err != nil{
+C.libxl_domain_restore_params_dispose(xc)}
+}()
 
-	return nil
+xc.checkpointed_stream = C.int(x.CheckpointedStream)
+xc.stream_version = C.uint32_t(x.StreamVersion)
+if x.ColoProxyScript != "" {
+xc.colo_proxy_script = C.CString(x.ColoProxyScript)}
+if err := x.UserspaceColoProxy.toC(&xc.userspace_colo_proxy); err != nil {
+return fmt.Errorf("converting field UserspaceColoProxy: %v", err)
 }
 
+ return nil
+ }
+
 // NewSchedParams returns an instance of SchedParams initialized with defaults.
 func NewSchedParams() (*SchedParams, error) {
-	var (
-		x  SchedParams
-		xc C.libxl_sched_params
-	)
+var (
+x SchedParams
+xc C.libxl_sched_params)
 
-	C.libxl_sched_params_init(&xc)
-	defer C.libxl_sched_params_dispose(&xc)
+C.libxl_sched_params_init(&xc)
+defer C.libxl_sched_params_dispose(&xc)
 
-	if err := x.fromC(&xc); err != nil {
-		return nil, err
-	}
+if err := x.fromC(&xc); err != nil {
+return nil, err }
 
-	return &x, nil
-}
+return &x, nil}
 
 func (x *SchedParams) fromC(xc *C.libxl_sched_params) error {
-	x.Vcpuid = int(xc.vcpuid)
-	x.Weight = int(xc.weight)
-	x.Cap = int(xc.cap)
-	x.Period = int(xc.period)
-	x.Extratime = int(xc.extratime)
-	x.Budget = int(xc.budget)
+ x.Vcpuid = int(xc.vcpuid)
+x.Weight = int(xc.weight)
+x.Cap = int(xc.cap)
+x.Period = int(xc.period)
+x.Extratime = int(xc.extratime)
+x.Budget = int(xc.budget)
+
+ return nil}
+
+func (x *SchedParams) toC(xc *C.libxl_sched_params) (err error){defer func(){
+if err != nil{
+C.libxl_sched_params_dispose(xc)}
+}()
+
+xc.vcpuid = C.int(x.Vcpuid)
+xc.weight = C.int(x.Weight)
+xc.cap = C.int(x.Cap)
+xc.period = C.int(x.Period)
+xc.extratime = C.int(x.Extratime)
+xc.budget = C.int(x.Budget)
+
+ return nil
+ }
 
-	return nil
-}
+// NewVcpuSchedParams returns an instance of VcpuSchedParams initialized with defaults.
+func NewVcpuSchedParams() (*VcpuSchedParams, error) {
+var (
+x VcpuSchedParams
+xc C.libxl_vcpu_sched_params)
 
-func (x *SchedParams) toC(xc *C.libxl_sched_params) (err error) {
-	defer func() {
-		if err != nil {
-			C.libxl_sched_params_dispose(xc)
-		}
-	}()
+C.libxl_vcpu_sched_params_init(&xc)
+defer C.libxl_vcpu_sched_params_dispose(&xc)
 
-	xc.vcpuid = C.int(x.Vcpuid)
-	xc.weight = C.int(x.Weight)
-	xc.cap = C.int(x.Cap)
-	xc.period = C.int(x.Period)
-	xc.extratime = C.int(x.Extratime)
-	xc.budget = C.int(x.Budget)
+if err := x.fromC(&xc); err != nil {
+return nil, err }
 
-	return nil
-}
+return &x, nil}
 
-// NewVcpuSchedParams returns an instance of VcpuSchedParams initialized with defaults.
-func NewVcpuSchedParams() (*VcpuSchedParams, error) {
-	var (
-		x  VcpuSchedParams
-		xc C.libxl_vcpu_sched_params
-	)
+func (x *VcpuSchedParams) fromC(xc *C.libxl_vcpu_sched_params) error {
+ x.Sched = Scheduler(xc.sched)
+x.Vcpus = nil
+if n := int(xc.num_vcpus); n > 0 {
+cVcpus := (*[1<<28]C.libxl_sched_params)(unsafe.Pointer(xc.vcpus))[:n:n]
+x.Vcpus = make([]SchedParams, n)
+for i, v := range cVcpus {
+if err := x.Vcpus[i].fromC(&v); err != nil {
+return fmt.Errorf("converting field Vcpus: %v", err) }
+}
+}
 
-	C.libxl_vcpu_sched_params_init(&xc)
-	defer C.libxl_vcpu_sched_params_dispose(&xc)
+ return nil}
 
-	if err := x.fromC(&xc); err != nil {
-		return nil, err
-	}
+func (x *VcpuSchedParams) toC(xc *C.libxl_vcpu_sched_params) (err error){defer func(){
+if err != nil{
+C.libxl_vcpu_sched_params_dispose(xc)}
+}()
 
-	return &x, nil
+xc.sched = C.libxl_scheduler(x.Sched)
+if numVcpus := len(x.Vcpus); numVcpus > 0 {
+xc.vcpus = (*C.libxl_sched_params)(C.malloc(C.ulong(numVcpus)*C.sizeof_libxl_sched_params))
+xc.num_vcpus = C.int(numVcpus)
+cVcpus := (*[1<<28]C.libxl_sched_params)(unsafe.Pointer(xc.vcpus))[:numVcpus:numVcpus]
+for i,v := range x.Vcpus {
+if err := v.toC(&cVcpus[i]); err != nil {
+return fmt.Errorf("converting field Vcpus: %v", err)
+}
 }
-
-func (x *VcpuSchedParams) fromC(xc *C.libxl_vcpu_sched_params) error {
-	x.Sched = Scheduler(xc.sched)
-	x.Vcpus = nil
-	if n := int(xc.num_vcpus); n > 0 {
-		cVcpus := (*[1 << 28]C.libxl_sched_params)(unsafe.Pointer(xc.vcpus))[:n:n]
-		x.Vcpus = make([]SchedParams, n)
-		for i, v := range cVcpus {
-			if err := x.Vcpus[i].fromC(&v); err != nil {
-				return fmt.Errorf("converting field Vcpus: %v", err)
-			}
-		}
-	}
-
-	return nil
-}
-
-func (x *VcpuSchedParams) toC(xc *C.libxl_vcpu_sched_params) (err error) {
-	defer func() {
-		if err != nil {
-			C.libxl_vcpu_sched_params_dispose(xc)
-		}
-	}()
-
-	xc.sched = C.libxl_scheduler(x.Sched)
-	if numVcpus := len(x.Vcpus); numVcpus > 0 {
-		xc.vcpus = (*C.libxl_sched_params)(C.malloc(C.ulong(numVcpus) * C.sizeof_libxl_sched_params))
-		xc.num_vcpus = C.int(numVcpus)
-		cVcpus := (*[1 << 28]C.libxl_sched_params)(unsafe.Pointer(xc.vcpus))[:numVcpus:numVcpus]
-		for i, v := range x.Vcpus {
-			if err := v.toC(&cVcpus[i]); err != nil {
-				return fmt.Errorf("converting field Vcpus: %v", err)
-			}
-		}
-	}
-
-	return nil
 }
 
+ return nil
+ }
+
 // NewDomainSchedParams returns an instance of DomainSchedParams initialized with defaults.
 func NewDomainSchedParams() (*DomainSchedParams, error) {
-	var (
-		x  DomainSchedParams
-		xc C.libxl_domain_sched_params
-	)
+var (
+x DomainSchedParams
+xc C.libxl_domain_sched_params)
 
-	C.libxl_domain_sched_params_init(&xc)
-	defer C.libxl_domain_sched_params_dispose(&xc)
+C.libxl_domain_sched_params_init(&xc)
+defer C.libxl_domain_sched_params_dispose(&xc)
 
-	if err := x.fromC(&xc); err != nil {
-		return nil, err
-	}
+if err := x.fromC(&xc); err != nil {
+return nil, err }
 
-	return &x, nil
-}
+return &x, nil}
 
 func (x *DomainSchedParams) fromC(xc *C.libxl_domain_sched_params) error {
-	x.Sched = Scheduler(xc.sched)
-	x.Weight = int(xc.weight)
-	x.Cap = int(xc.cap)
-	x.Period = int(xc.period)
-	x.Budget = int(xc.budget)
-	x.Extratime = int(xc.extratime)
-	x.Slice = int(xc.slice)
-	x.Latency = int(xc.latency)
+ x.Sched = Scheduler(xc.sched)
+x.Weight = int(xc.weight)
+x.Cap = int(xc.cap)
+x.Period = int(xc.period)
+x.Budget = int(xc.budget)
+x.Extratime = int(xc.extratime)
+x.Slice = int(xc.slice)
+x.Latency = int(xc.latency)
+
+ return nil}
+
+func (x *DomainSchedParams) toC(xc *C.libxl_domain_sched_params) (err error){defer func(){
+if err != nil{
+C.libxl_domain_sched_params_dispose(xc)}
+}()
+
+xc.sched = C.libxl_scheduler(x.Sched)
+xc.weight = C.int(x.Weight)
+xc.cap = C.int(x.Cap)
+xc.period = C.int(x.Period)
+xc.budget = C.int(x.Budget)
+xc.extratime = C.int(x.Extratime)
+xc.slice = C.int(x.Slice)
+xc.latency = C.int(x.Latency)
+
+ return nil
+ }
 
-	return nil
-}
+// NewVnodeInfo returns an instance of VnodeInfo initialized with defaults.
+func NewVnodeInfo() (*VnodeInfo, error) {
+var (
+x VnodeInfo
+xc C.libxl_vnode_info)
 
-func (x *DomainSchedParams) toC(xc *C.libxl_domain_sched_params) (err error) {
-	defer func() {
-		if err != nil {
-			C.libxl_domain_sched_params_dispose(xc)
-		}
-	}()
+C.libxl_vnode_info_init(&xc)
+defer C.libxl_vnode_info_dispose(&xc)
 
-	xc.sched = C.libxl_scheduler(x.Sched)
-	xc.weight = C.int(x.Weight)
-	xc.cap = C.int(x.Cap)
-	xc.period = C.int(x.Period)
-	xc.budget = C.int(x.Budget)
-	xc.extratime = C.int(x.Extratime)
-	xc.slice = C.int(x.Slice)
-	xc.latency = C.int(x.Latency)
+if err := x.fromC(&xc); err != nil {
+return nil, err }
 
-	return nil
-}
+return &x, nil}
 
-// NewVnodeInfo returns an instance of VnodeInfo initialized with defaults.
-func NewVnodeInfo() (*VnodeInfo, error) {
-	var (
-		x  VnodeInfo
-		xc C.libxl_vnode_info
-	)
+func (x *VnodeInfo) fromC(xc *C.libxl_vnode_info) error {
+ x.Memkb = uint64(xc.memkb)
+x.Distances = nil
+if n := int(xc.num_distances); n > 0 {
+cDistances := (*[1<<28]C.uint32_t)(unsafe.Pointer(xc.distances))[:n:n]
+x.Distances = make([]uint32, n)
+for i, v := range cDistances {
+x.Distances[i] = uint32(v)
+}
+}
+x.Pnode = uint32(xc.pnode)
+if err := x.Vcpus.fromC(&xc.vcpus);err != nil {
+return fmt.Errorf("converting field Vcpus: %v", err)
+}
 
-	C.libxl_vnode_info_init(&xc)
-	defer C.libxl_vnode_info_dispose(&xc)
+ return nil}
 
-	if err := x.fromC(&xc); err != nil {
-		return nil, err
-	}
+func (x *VnodeInfo) toC(xc *C.libxl_vnode_info) (err error){defer func(){
+if err != nil{
+C.libxl_vnode_info_dispose(xc)}
+}()
 
-	return &x, nil
+xc.memkb = C.uint64_t(x.Memkb)
+if numDistances := len(x.Distances); numDistances > 0 {
+xc.distances = (*C.uint32_t)(C.malloc(C.size_t(numDistances*numDistances)))
+xc.num_distances = C.int(numDistances)
+cDistances := (*[1<<28]C.uint32_t)(unsafe.Pointer(xc.distances))[:numDistances:numDistances]
+for i,v := range x.Distances {
+cDistances[i] = C.uint32_t(v)
 }
-
-func (x *VnodeInfo) fromC(xc *C.libxl_vnode_info) error {
-	x.Memkb = uint64(xc.memkb)
-	x.Distances = nil
-	if n := int(xc.num_distances); n > 0 {
-		cDistances := (*[1 << 28]C.uint32_t)(unsafe.Pointer(xc.distances))[:n:n]
-		x.Distances = make([]uint32, n)
-		for i, v := range cDistances {
-			x.Distances[i] = uint32(v)
-		}
-	}
-	x.Pnode = uint32(xc.pnode)
-	if err := x.Vcpus.fromC(&xc.vcpus); err != nil {
-		return fmt.Errorf("converting field Vcpus: %v", err)
-	}
-
-	return nil
-}
-
-func (x *VnodeInfo) toC(xc *C.libxl_vnode_info) (err error) {
-	defer func() {
-		if err != nil {
-			C.libxl_vnode_info_dispose(xc)
-		}
-	}()
-
-	xc.memkb = C.uint64_t(x.Memkb)
-	if numDistances := len(x.Distances); numDistances > 0 {
-		xc.distances = (*C.uint32_t)(C.malloc(C.size_t(numDistances * numDistances)))
-		xc.num_distances = C.int(numDistances)
-		cDistances := (*[1 << 28]C.uint32_t)(unsafe.Pointer(xc.distances))[:numDistances:numDistances]
-		for i, v := range x.Distances {
-			cDistances[i] = C.uint32_t(v)
-		}
-	}
-	xc.pnode = C.uint32_t(x.Pnode)
-	if err := x.Vcpus.toC(&xc.vcpus); err != nil {
-		return fmt.Errorf("converting field Vcpus: %v", err)
-	}
-
-	return nil
 }
+xc.pnode = C.uint32_t(x.Pnode)
+if err := x.Vcpus.toC(&xc.vcpus); err != nil {
+return fmt.Errorf("converting field Vcpus: %v", err)
+}
+
+ return nil
+ }
 
 // NewRdmReserve returns an instance of RdmReserve initialized with defaults.
 func NewRdmReserve() (*RdmReserve, error) {
-	var (
-		x  RdmReserve
-		xc C.libxl_rdm_reserve
-	)
+var (
+x RdmReserve
+xc C.libxl_rdm_reserve)
 
-	C.libxl_rdm_reserve_init(&xc)
-	defer C.libxl_rdm_reserve_dispose(&xc)
+C.libxl_rdm_reserve_init(&xc)
+defer C.libxl_rdm_reserve_dispose(&xc)
 
-	if err := x.fromC(&xc); err != nil {
-		return nil, err
-	}
+if err := x.fromC(&xc); err != nil {
+return nil, err }
 
-	return &x, nil
-}
+return &x, nil}
 
 func (x *RdmReserve) fromC(xc *C.libxl_rdm_reserve) error {
-	x.Strategy = RdmReserveStrategy(xc.strategy)
-	x.Policy = RdmReservePolicy(xc.policy)
+ x.Strategy = RdmReserveStrategy(xc.strategy)
+x.Policy = RdmReservePolicy(xc.policy)
 
-	return nil
-}
+ return nil}
 
-func (x *RdmReserve) toC(xc *C.libxl_rdm_reserve) (err error) {
-	defer func() {
-		if err != nil {
-			C.libxl_rdm_reserve_dispose(xc)
-		}
-	}()
+func (x *RdmReserve) toC(xc *C.libxl_rdm_reserve) (err error){defer func(){
+if err != nil{
+C.libxl_rdm_reserve_dispose(xc)}
+}()
 
-	xc.strategy = C.libxl_rdm_reserve_strategy(x.Strategy)
-	xc.policy = C.libxl_rdm_reserve_policy(x.Policy)
+xc.strategy = C.libxl_rdm_reserve_strategy(x.Strategy)
+xc.policy = C.libxl_rdm_reserve_policy(x.Policy)
 
-	return nil
-}
+ return nil
+ }
 
 // NewDomainBuildInfo returns an instance of DomainBuildInfo initialized with defaults.
 func NewDomainBuildInfo(dtype DomainType) (*DomainBuildInfo, error) {
-	var (
-		x  DomainBuildInfo
-		xc C.libxl_domain_build_info
-	)
+var (
+x DomainBuildInfo
+xc C.libxl_domain_build_info)
 
-	C.libxl_domain_build_info_init(&xc)
-	C.libxl_domain_build_info_init_type(&xc, C.libxl_domain_type(dtype))
-	defer C.libxl_domain_build_info_dispose(&xc)
+C.libxl_domain_build_info_init(&xc)
+C.libxl_domain_build_info_init_type(&xc, C.libxl_domain_type(dtype))
+defer C.libxl_domain_build_info_dispose(&xc)
 
-	if err := x.fromC(&xc); err != nil {
-		return nil, err
-	}
+if err := x.fromC(&xc); err != nil {
+return nil, err }
 
-	return &x, nil
-}
+return &x, nil}
 
 func (x *DomainBuildInfo) fromC(xc *C.libxl_domain_build_info) error {
-	x.MaxVcpus = int(xc.max_vcpus)
-	if err := x.AvailVcpus.fromC(&xc.avail_vcpus); err != nil {
-		return fmt.Errorf("converting field AvailVcpus: %v", err)
-	}
-	if err := x.Cpumap.fromC(&xc.cpumap); err != nil {
-		return fmt.Errorf("converting field Cpumap: %v", err)
-	}
-	if err := x.Nodemap.fromC(&xc.nodemap); err != nil {
-		return fmt.Errorf("converting field Nodemap: %v", err)
-	}
-	x.VcpuHardAffinity = nil
-	if n := int(xc.num_vcpu_hard_affinity); n > 0 {
-		cVcpuHardAffinity := (*[1 << 28]C.libxl_bitmap)(unsafe.Pointer(xc.vcpu_hard_affinity))[:n:n]
-		x.VcpuHardAffinity = make([]Bitmap, n)
-		for i, v := range cVcpuHardAffinity {
-			if err := x.VcpuHardAffinity[i].fromC(&v); err != nil {
-				return fmt.Errorf("converting field VcpuHardAffinity: %v", err)
-			}
-		}
-	}
-	x.VcpuSoftAffinity = nil
-	if n := int(xc.num_vcpu_soft_affinity); n > 0 {
-		cVcpuSoftAffinity := (*[1 << 28]C.libxl_bitmap)(unsafe.Pointer(xc.vcpu_soft_affinity))[:n:n]
-		x.VcpuSoftAffinity = make([]Bitmap, n)
-		for i, v := range cVcpuSoftAffinity {
-			if err := x.VcpuSoftAffinity[i].fromC(&v); err != nil {
-				return fmt.Errorf("converting field VcpuSoftAffinity: %v", err)
-			}
-		}
-	}
-	if err := x.NumaPlacement.fromC(&xc.numa_placement); err != nil {
-		return fmt.Errorf("converting field NumaPlacement: %v", err)
-	}
-	x.TscMode = TscMode(xc.tsc_mode)
-	x.MaxMemkb = uint64(xc.max_memkb)
-	x.TargetMemkb = uint64(xc.target_memkb)
-	x.VideoMemkb = uint64(xc.video_memkb)
-	x.ShadowMemkb = uint64(xc.shadow_memkb)
-	x.IommuMemkb = uint64(xc.iommu_memkb)
-	x.RtcTimeoffset = uint32(xc.rtc_timeoffset)
-	x.ExecSsidref = uint32(xc.exec_ssidref)
-	x.ExecSsidLabel = C.GoString(xc.exec_ssid_label)
-	if err := x.Localtime.fromC(&xc.localtime); err != nil {
-		return fmt.Errorf("converting field Localtime: %v", err)
-	}
-	if err := x.DisableMigrate.fromC(&xc.disable_migrate); err != nil {
-		return fmt.Errorf("converting field DisableMigrate: %v", err)
-	}
-	if err := x.Cpuid.fromC(&xc.cpuid); err != nil {
-		return fmt.Errorf("converting field Cpuid: %v", err)
-	}
-	x.BlkdevStart = C.GoString(xc.blkdev_start)
-	x.VnumaNodes = nil
-	if n := int(xc.num_vnuma_nodes); n > 0 {
-		cVnumaNodes := (*[1 << 28]C.libxl_vnode_info)(unsafe.Pointer(xc.vnuma_nodes))[:n:n]
-		x.VnumaNodes = make([]VnodeInfo, n)
-		for i, v := range cVnumaNodes {
-			if err := x.VnumaNodes[i].fromC(&v); err != nil {
-				return fmt.Errorf("converting field VnumaNodes: %v", err)
-			}
-		}
-	}
-	x.MaxGrantFrames = uint32(xc.max_grant_frames)
-	x.MaxMaptrackFrames = uint32(xc.max_maptrack_frames)
-	x.DeviceModelVersion = DeviceModelVersion(xc.device_model_version)
-	if err := x.DeviceModelStubdomain.fromC(&xc.device_model_stubdomain); err != nil {
-		return fmt.Errorf("converting field DeviceModelStubdomain: %v", err)
-	}
-	x.StubdomainMemkb = uint64(xc.stubdomain_memkb)
-	x.StubdomainKernel = C.GoString(xc.stubdomain_kernel)
-	x.StubdomainRamdisk = C.GoString(xc.stubdomain_ramdisk)
-	x.DeviceModel = C.GoString(xc.device_model)
-	x.DeviceModelSsidref = uint32(xc.device_model_ssidref)
-	x.DeviceModelSsidLabel = C.GoString(xc.device_model_ssid_label)
-	x.DeviceModelUser = C.GoString(xc.device_model_user)
-	if err := x.Extra.fromC(&xc.extra); err != nil {
-		return fmt.Errorf("converting field Extra: %v", err)
-	}
-	if err := x.ExtraPv.fromC(&xc.extra_pv); err != nil {
-		return fmt.Errorf("converting field ExtraPv: %v", err)
-	}
-	if err := x.ExtraHvm.fromC(&xc.extra_hvm); err != nil {
-		return fmt.Errorf("converting field ExtraHvm: %v", err)
-	}
-	if err := x.SchedParams.fromC(&xc.sched_params); err != nil {
-		return fmt.Errorf("converting field SchedParams: %v", err)
-	}
-	x.Ioports = nil
-	if n := int(xc.num_ioports); n > 0 {
-		cIoports := (*[1 << 28]C.libxl_ioport_range)(unsafe.Pointer(xc.ioports))[:n:n]
-		x.Ioports = make([]IoportRange, n)
-		for i, v := range cIoports {
-			if err := x.Ioports[i].fromC(&v); err != nil {
-				return fmt.Errorf("converting field Ioports: %v", err)
-			}
-		}
-	}
-	x.Irqs = nil
-	if n := int(xc.num_irqs); n > 0 {
-		cIrqs := (*[1 << 28]C.uint32_t)(unsafe.Pointer(xc.irqs))[:n:n]
-		x.Irqs = make([]uint32, n)
-		for i, v := range cIrqs {
-			x.Irqs[i] = uint32(v)
-		}
-	}
-	x.Iomem = nil
-	if n := int(xc.num_iomem); n > 0 {
-		cIomem := (*[1 << 28]C.libxl_iomem_range)(unsafe.Pointer(xc.iomem))[:n:n]
-		x.Iomem = make([]IomemRange, n)
-		for i, v := range cIomem {
-			if err := x.Iomem[i].fromC(&v); err != nil {
-				return fmt.Errorf("converting field Iomem: %v", err)
-			}
-		}
-	}
-	if err := x.ClaimMode.fromC(&xc.claim_mode); err != nil {
-		return fmt.Errorf("converting field ClaimMode: %v", err)
-	}
-	x.EventChannels = uint32(xc.event_channels)
-	x.Kernel = C.GoString(xc.kernel)
-	x.Cmdline = C.GoString(xc.cmdline)
-	x.Ramdisk = C.GoString(xc.ramdisk)
-	x.DeviceTree = C.GoString(xc.device_tree)
-	if err := x.Acpi.fromC(&xc.acpi); err != nil {
-		return fmt.Errorf("converting field Acpi: %v", err)
-	}
-	x.Bootloader = C.GoString(xc.bootloader)
-	if err := x.BootloaderArgs.fromC(&xc.bootloader_args); err != nil {
-		return fmt.Errorf("converting field BootloaderArgs: %v", err)
-	}
-	x.TimerMode = TimerMode(xc.timer_mode)
-	if err := x.NestedHvm.fromC(&xc.nested_hvm); err != nil {
-		return fmt.Errorf("converting field NestedHvm: %v", err)
-	}
-	if err := x.Apic.fromC(&xc.apic); err != nil {
-		return fmt.Errorf("converting field Apic: %v", err)
-	}
-	if err := x.DmRestrict.fromC(&xc.dm_restrict); err != nil {
-		return fmt.Errorf("converting field DmRestrict: %v", err)
-	}
-	x.Tee = TeeType(xc.tee)
-	x.Type = DomainType(xc._type)
-	switch x.Type {
-	case DomainTypeHvm:
-		var typeHvm DomainBuildInfoTypeUnionHvm
-		if err := typeHvm.fromC(xc); err != nil {
-			return fmt.Errorf("converting field typeHvm: %v", err)
-		}
-		x.TypeUnion = typeHvm
-	case DomainTypePv:
-		var typePv DomainBuildInfoTypeUnionPv
-		if err := typePv.fromC(xc); err != nil {
-			return fmt.Errorf("converting field typePv: %v", err)
-		}
-		x.TypeUnion = typePv
-	case DomainTypePvh:
-		var typePvh DomainBuildInfoTypeUnionPvh
-		if err := typePvh.fromC(xc); err != nil {
-			return fmt.Errorf("converting field typePvh: %v", err)
-		}
-		x.TypeUnion = typePvh
-	case DomainTypeInvalid:
-		x.TypeUnion = nil
-	default:
-		return fmt.Errorf("invalid union key '%v'", x.Type)
-	}
-	x.ArchArm.GicVersion = GicVersion(xc.arch_arm.gic_version)
-	x.ArchArm.Vuart = VuartType(xc.arch_arm.vuart)
-	x.Altp2M = Altp2MMode(xc.altp2m)
-
-	return nil
-}
+ x.MaxVcpus = int(xc.max_vcpus)
+if err := x.AvailVcpus.fromC(&xc.avail_vcpus);err != nil {
+return fmt.Errorf("converting field AvailVcpus: %v", err)
+}
+if err := x.Cpumap.fromC(&xc.cpumap);err != nil {
+return fmt.Errorf("converting field Cpumap: %v", err)
+}
+if err := x.Nodemap.fromC(&xc.nodemap);err != nil {
+return fmt.Errorf("converting field Nodemap: %v", err)
+}
+x.VcpuHardAffinity = nil
+if n := int(xc.num_vcpu_hard_affinity); n > 0 {
+cVcpuHardAffinity := (*[1<<28]C.libxl_bitmap)(unsafe.Pointer(xc.vcpu_hard_affinity))[:n:n]
+x.VcpuHardAffinity = make([]Bitmap, n)
+for i, v := range cVcpuHardAffinity {
+if err := x.VcpuHardAffinity[i].fromC(&v); err != nil {
+return fmt.Errorf("converting field VcpuHardAffinity: %v", err) }
+}
+}
+x.VcpuSoftAffinity = nil
+if n := int(xc.num_vcpu_soft_affinity); n > 0 {
+cVcpuSoftAffinity := (*[1<<28]C.libxl_bitmap)(unsafe.Pointer(xc.vcpu_soft_affinity))[:n:n]
+x.VcpuSoftAffinity = make([]Bitmap, n)
+for i, v := range cVcpuSoftAffinity {
+if err := x.VcpuSoftAffinity[i].fromC(&v); err != nil {
+return fmt.Errorf("converting field VcpuSoftAffinity: %v", err) }
+}
+}
+if err := x.NumaPlacement.fromC(&xc.numa_placement);err != nil {
+return fmt.Errorf("converting field NumaPlacement: %v", err)
+}
+x.TscMode = TscMode(xc.tsc_mode)
+x.MaxMemkb = uint64(xc.max_memkb)
+x.TargetMemkb = uint64(xc.target_memkb)
+x.VideoMemkb = uint64(xc.video_memkb)
+x.ShadowMemkb = uint64(xc.shadow_memkb)
+x.IommuMemkb = uint64(xc.iommu_memkb)
+x.RtcTimeoffset = uint32(xc.rtc_timeoffset)
+x.ExecSsidref = uint32(xc.exec_ssidref)
+x.ExecSsidLabel = C.GoString(xc.exec_ssid_label)
+if err := x.Localtime.fromC(&xc.localtime);err != nil {
+return fmt.Errorf("converting field Localtime: %v", err)
+}
+if err := x.DisableMigrate.fromC(&xc.disable_migrate);err != nil {
+return fmt.Errorf("converting field DisableMigrate: %v", err)
+}
+if err := x.Cpuid.fromC(&xc.cpuid);err != nil {
+return fmt.Errorf("converting field Cpuid: %v", err)
+}
+x.BlkdevStart = C.GoString(xc.blkdev_start)
+x.VnumaNodes = nil
+if n := int(xc.num_vnuma_nodes); n > 0 {
+cVnumaNodes := (*[1<<28]C.libxl_vnode_info)(unsafe.Pointer(xc.vnuma_nodes))[:n:n]
+x.VnumaNodes = make([]VnodeInfo, n)
+for i, v := range cVnumaNodes {
+if err := x.VnumaNodes[i].fromC(&v); err != nil {
+return fmt.Errorf("converting field VnumaNodes: %v", err) }
+}
+}
+x.MaxGrantFrames = uint32(xc.max_grant_frames)
+x.MaxMaptrackFrames = uint32(xc.max_maptrack_frames)
+x.DeviceModelVersion = DeviceModelVersion(xc.device_model_version)
+if err := x.DeviceModelStubdomain.fromC(&xc.device_model_stubdomain);err != nil {
+return fmt.Errorf("converting field DeviceModelStubdomain: %v", err)
+}
+x.StubdomainMemkb = uint64(xc.stubdomain_memkb)
+x.StubdomainKernel = C.GoString(xc.stubdomain_kernel)
+x.StubdomainRamdisk = C.GoString(xc.stubdomain_ramdisk)
+x.DeviceModel = C.GoString(xc.device_model)
+x.DeviceModelSsidref = uint32(xc.device_model_ssidref)
+x.DeviceModelSsidLabel = C.GoString(xc.device_model_ssid_label)
+x.DeviceModelUser = C.GoString(xc.device_model_user)
+if err := x.Extra.fromC(&xc.extra);err != nil {
+return fmt.Errorf("converting field Extra: %v", err)
+}
+if err := x.ExtraPv.fromC(&xc.extra_pv);err != nil {
+return fmt.Errorf("converting field ExtraPv: %v", err)
+}
+if err := x.ExtraHvm.fromC(&xc.extra_hvm);err != nil {
+return fmt.Errorf("converting field ExtraHvm: %v", err)
+}
+if err := x.SchedParams.fromC(&xc.sched_params);err != nil {
+return fmt.Errorf("converting field SchedParams: %v", err)
+}
+x.Ioports = nil
+if n := int(xc.num_ioports); n > 0 {
+cIoports := (*[1<<28]C.libxl_ioport_range)(unsafe.Pointer(xc.ioports))[:n:n]
+x.Ioports = make([]IoportRange, n)
+for i, v := range cIoports {
+if err := x.Ioports[i].fromC(&v); err != nil {
+return fmt.Errorf("converting field Ioports: %v", err) }
+}
+}
+x.Irqs = nil
+if n := int(xc.num_irqs); n > 0 {
+cIrqs := (*[1<<28]C.uint32_t)(unsafe.Pointer(xc.irqs))[:n:n]
+x.Irqs = make([]uint32, n)
+for i, v := range cIrqs {
+x.Irqs[i] = uint32(v)
+}
+}
+x.Iomem = nil
+if n := int(xc.num_iomem); n > 0 {
+cIomem := (*[1<<28]C.libxl_iomem_range)(unsafe.Pointer(xc.iomem))[:n:n]
+x.Iomem = make([]IomemRange, n)
+for i, v := range cIomem {
+if err := x.Iomem[i].fromC(&v); err != nil {
+return fmt.Errorf("converting field Iomem: %v", err) }
+}
+}
+if err := x.ClaimMode.fromC(&xc.claim_mode);err != nil {
+return fmt.Errorf("converting field ClaimMode: %v", err)
+}
+x.EventChannels = uint32(xc.event_channels)
+x.Kernel = C.GoString(xc.kernel)
+x.Cmdline = C.GoString(xc.cmdline)
+x.Ramdisk = C.GoString(xc.ramdisk)
+x.DeviceTree = C.GoString(xc.device_tree)
+if err := x.Acpi.fromC(&xc.acpi);err != nil {
+return fmt.Errorf("converting field Acpi: %v", err)
+}
+x.Bootloader = C.GoString(xc.bootloader)
+if err := x.BootloaderArgs.fromC(&xc.bootloader_args);err != nil {
+return fmt.Errorf("converting field BootloaderArgs: %v", err)
+}
+x.TimerMode = TimerMode(xc.timer_mode)
+if err := x.NestedHvm.fromC(&xc.nested_hvm);err != nil {
+return fmt.Errorf("converting field NestedHvm: %v", err)
+}
+if err := x.Apic.fromC(&xc.apic);err != nil {
+return fmt.Errorf("converting field Apic: %v", err)
+}
+if err := x.DmRestrict.fromC(&xc.dm_restrict);err != nil {
+return fmt.Errorf("converting field DmRestrict: %v", err)
+}
+x.Tee = TeeType(xc.tee)
+x.Type = DomainType(xc._type)
+switch x.Type{
+case DomainTypeHvm:
+var typeHvm DomainBuildInfoTypeUnionHvm
+if err := typeHvm.fromC(xc);err != nil {
+ return fmt.Errorf("converting field typeHvm: %v", err)
+}
+x.TypeUnion = typeHvm
+case DomainTypePv:
+var typePv DomainBuildInfoTypeUnionPv
+if err := typePv.fromC(xc);err != nil {
+ return fmt.Errorf("converting field typePv: %v", err)
+}
+x.TypeUnion = typePv
+case DomainTypePvh:
+var typePvh DomainBuildInfoTypeUnionPvh
+if err := typePvh.fromC(xc);err != nil {
+ return fmt.Errorf("converting field typePvh: %v", err)
+}
+x.TypeUnion = typePvh
+case DomainTypeInvalid:
+x.TypeUnion = nil
+default:
+return fmt.Errorf("invalid union key '%v'", x.Type)}
+x.ArchArm.GicVersion = GicVersion(xc.arch_arm.gic_version)
+x.ArchArm.Vuart = VuartType(xc.arch_arm.vuart)
+x.Altp2M = Altp2MMode(xc.altp2m)
+
+ return nil}
 
 func (x *DomainBuildInfoTypeUnionHvm) fromC(xc *C.libxl_domain_build_info) error {
-	if DomainType(xc._type) != DomainTypeHvm {
-		return errors.New("expected union key DomainTypeHvm")
-	}
-
-	tmp := (*C.libxl_domain_build_info_type_union_hvm)(unsafe.Pointer(&xc.u[0]))
-	x.Firmware = C.GoString(tmp.firmware)
-	x.Bios = BiosType(tmp.bios)
-	if err := x.Pae.fromC(&tmp.pae); err != nil {
-		return fmt.Errorf("converting field Pae: %v", err)
-	}
-	if err := x.Apic.fromC(&tmp.apic); err != nil {
-		return fmt.Errorf("converting field Apic: %v", err)
-	}
-	if err := x.Acpi.fromC(&tmp.acpi); err != nil {
-		return fmt.Errorf("converting field Acpi: %v", err)
-	}
-	if err := x.AcpiS3.fromC(&tmp.acpi_s3); err != nil {
-		return fmt.Errorf("converting field AcpiS3: %v", err)
-	}
-	if err := x.AcpiS4.fromC(&tmp.acpi_s4); err != nil {
-		return fmt.Errorf("converting field AcpiS4: %v", err)
-	}
-	if err := x.AcpiLaptopSlate.fromC(&tmp.acpi_laptop_slate); err != nil {
-		return fmt.Errorf("converting field AcpiLaptopSlate: %v", err)
-	}
-	if err := x.Nx.fromC(&tmp.nx); err != nil {
-		return fmt.Errorf("converting field Nx: %v", err)
-	}
-	if err := x.Viridian.fromC(&tmp.viridian); err != nil {
-		return fmt.Errorf("converting field Viridian: %v", err)
-	}
-	if err := x.ViridianEnable.fromC(&tmp.viridian_enable); err != nil {
-		return fmt.Errorf("converting field ViridianEnable: %v", err)
-	}
-	if err := x.ViridianDisable.fromC(&tmp.viridian_disable); err != nil {
-		return fmt.Errorf("converting field ViridianDisable: %v", err)
-	}
-	x.Timeoffset = C.GoString(tmp.timeoffset)
-	if err := x.Hpet.fromC(&tmp.hpet); err != nil {
-		return fmt.Errorf("converting field Hpet: %v", err)
-	}
-	if err := x.VptAlign.fromC(&tmp.vpt_align); err != nil {
-		return fmt.Errorf("converting field VptAlign: %v", err)
-	}
-	x.MmioHoleMemkb = uint64(tmp.mmio_hole_memkb)
-	x.TimerMode = TimerMode(tmp.timer_mode)
-	if err := x.NestedHvm.fromC(&tmp.nested_hvm); err != nil {
-		return fmt.Errorf("converting field NestedHvm: %v", err)
-	}
-	if err := x.Altp2M.fromC(&tmp.altp2m); err != nil {
-		return fmt.Errorf("converting field Altp2M: %v", err)
-	}
-	x.SystemFirmware = C.GoString(tmp.system_firmware)
-	x.SmbiosFirmware = C.GoString(tmp.smbios_firmware)
-	x.AcpiFirmware = C.GoString(tmp.acpi_firmware)
-	x.Hdtype = Hdtype(tmp.hdtype)
-	if err := x.Nographic.fromC(&tmp.nographic); err != nil {
-		return fmt.Errorf("converting field Nographic: %v", err)
-	}
-	if err := x.Vga.fromC(&tmp.vga); err != nil {
-		return fmt.Errorf("converting field Vga: %v", err)
-	}
-	if err := x.Vnc.fromC(&tmp.vnc); err != nil {
-		return fmt.Errorf("converting field Vnc: %v", err)
-	}
-	x.Keymap = C.GoString(tmp.keymap)
-	if err := x.Sdl.fromC(&tmp.sdl); err != nil {
-		return fmt.Errorf("converting field Sdl: %v", err)
-	}
-	if err := x.Spice.fromC(&tmp.spice); err != nil {
-		return fmt.Errorf("converting field Spice: %v", err)
-	}
-	if err := x.GfxPassthru.fromC(&tmp.gfx_passthru); err != nil {
-		return fmt.Errorf("converting field GfxPassthru: %v", err)
-	}
-	x.GfxPassthruKind = GfxPassthruKind(tmp.gfx_passthru_kind)
-	x.Serial = C.GoString(tmp.serial)
-	x.Boot = C.GoString(tmp.boot)
-	if err := x.Usb.fromC(&tmp.usb); err != nil {
-		return fmt.Errorf("converting field Usb: %v", err)
-	}
-	x.Usbversion = int(tmp.usbversion)
-	x.Usbdevice = C.GoString(tmp.usbdevice)
-	if err := x.VkbDevice.fromC(&tmp.vkb_device); err != nil {
-		return fmt.Errorf("converting field VkbDevice: %v", err)
-	}
-	x.Soundhw = C.GoString(tmp.soundhw)
-	if err := x.XenPlatformPci.fromC(&tmp.xen_platform_pci); err != nil {
-		return fmt.Errorf("converting field XenPlatformPci: %v", err)
-	}
-	if err := x.UsbdeviceList.fromC(&tmp.usbdevice_list); err != nil {
-		return fmt.Errorf("converting field UsbdeviceList: %v", err)
-	}
-	x.VendorDevice = VendorDevice(tmp.vendor_device)
-	if err := x.MsVmGenid.fromC(&tmp.ms_vm_genid); err != nil {
-		return fmt.Errorf("converting field MsVmGenid: %v", err)
-	}
-	if err := x.SerialList.fromC(&tmp.serial_list); err != nil {
-		return fmt.Errorf("converting field SerialList: %v", err)
-	}
-	if err := x.Rdm.fromC(&tmp.rdm); err != nil {
-		return fmt.Errorf("converting field Rdm: %v", err)
-	}
-	x.RdmMemBoundaryMemkb = uint64(tmp.rdm_mem_boundary_memkb)
-	x.McaCaps = uint64(tmp.mca_caps)
-	return nil
+if DomainType(xc._type) != DomainTypeHvm {
+return errors.New("expected union key DomainTypeHvm")
+}
+
+tmp := (*C.libxl_domain_build_info_type_union_hvm)(unsafe.Pointer(&xc.u[0]))
+x.Firmware = C.GoString(tmp.firmware)
+x.Bios = BiosType(tmp.bios)
+if err := x.Pae.fromC(&tmp.pae);err != nil {
+return fmt.Errorf("converting field Pae: %v", err)
+}
+if err := x.Apic.fromC(&tmp.apic);err != nil {
+return fmt.Errorf("converting field Apic: %v", err)
+}
+if err := x.Acpi.fromC(&tmp.acpi);err != nil {
+return fmt.Errorf("converting field Acpi: %v", err)
+}
+if err := x.AcpiS3.fromC(&tmp.acpi_s3);err != nil {
+return fmt.Errorf("converting field AcpiS3: %v", err)
+}
+if err := x.AcpiS4.fromC(&tmp.acpi_s4);err != nil {
+return fmt.Errorf("converting field AcpiS4: %v", err)
+}
+if err := x.AcpiLaptopSlate.fromC(&tmp.acpi_laptop_slate);err != nil {
+return fmt.Errorf("converting field AcpiLaptopSlate: %v", err)
+}
+if err := x.Nx.fromC(&tmp.nx);err != nil {
+return fmt.Errorf("converting field Nx: %v", err)
+}
+if err := x.Viridian.fromC(&tmp.viridian);err != nil {
+return fmt.Errorf("converting field Viridian: %v", err)
+}
+if err := x.ViridianEnable.fromC(&tmp.viridian_enable);err != nil {
+return fmt.Errorf("converting field ViridianEnable: %v", err)
+}
+if err := x.ViridianDisable.fromC(&tmp.viridian_disable);err != nil {
+return fmt.Errorf("converting field ViridianDisable: %v", err)
+}
+x.Timeoffset = C.GoString(tmp.timeoffset)
+if err := x.Hpet.fromC(&tmp.hpet);err != nil {
+return fmt.Errorf("converting field Hpet: %v", err)
+}
+if err := x.VptAlign.fromC(&tmp.vpt_align);err != nil {
+return fmt.Errorf("converting field VptAlign: %v", err)
+}
+x.MmioHoleMemkb = uint64(tmp.mmio_hole_memkb)
+x.TimerMode = TimerMode(tmp.timer_mode)
+if err := x.NestedHvm.fromC(&tmp.nested_hvm);err != nil {
+return fmt.Errorf("converting field NestedHvm: %v", err)
+}
+if err := x.Altp2M.fromC(&tmp.altp2m);err != nil {
+return fmt.Errorf("converting field Altp2M: %v", err)
+}
+x.SystemFirmware = C.GoString(tmp.system_firmware)
+x.SmbiosFirmware = C.GoString(tmp.smbios_firmware)
+x.AcpiFirmware = C.GoString(tmp.acpi_firmware)
+x.Hdtype = Hdtype(tmp.hdtype)
+if err := x.Nographic.fromC(&tmp.nographic);err != nil {
+return fmt.Errorf("converting field Nographic: %v", err)
+}
+if err := x.Vga.fromC(&tmp.vga);err != nil {
+return fmt.Errorf("converting field Vga: %v", err)
+}
+if err := x.Vnc.fromC(&tmp.vnc);err != nil {
+return fmt.Errorf("converting field Vnc: %v", err)
+}
+x.Keymap = C.GoString(tmp.keymap)
+if err := x.Sdl.fromC(&tmp.sdl);err != nil {
+return fmt.Errorf("converting field Sdl: %v", err)
+}
+if err := x.Spice.fromC(&tmp.spice);err != nil {
+return fmt.Errorf("converting field Spice: %v", err)
+}
+if err := x.GfxPassthru.fromC(&tmp.gfx_passthru);err != nil {
+return fmt.Errorf("converting field GfxPassthru: %v", err)
+}
+x.GfxPassthruKind = GfxPassthruKind(tmp.gfx_passthru_kind)
+x.Serial = C.GoString(tmp.serial)
+x.Boot = C.GoString(tmp.boot)
+if err := x.Usb.fromC(&tmp.usb);err != nil {
+return fmt.Errorf("converting field Usb: %v", err)
+}
+x.Usbversion = int(tmp.usbversion)
+x.Usbdevice = C.GoString(tmp.usbdevice)
+if err := x.VkbDevice.fromC(&tmp.vkb_device);err != nil {
+return fmt.Errorf("converting field VkbDevice: %v", err)
+}
+x.Soundhw = C.GoString(tmp.soundhw)
+if err := x.XenPlatformPci.fromC(&tmp.xen_platform_pci);err != nil {
+return fmt.Errorf("converting field XenPlatformPci: %v", err)
+}
+if err := x.UsbdeviceList.fromC(&tmp.usbdevice_list);err != nil {
+return fmt.Errorf("converting field UsbdeviceList: %v", err)
+}
+x.VendorDevice = VendorDevice(tmp.vendor_device)
+if err := x.MsVmGenid.fromC(&tmp.ms_vm_genid);err != nil {
+return fmt.Errorf("converting field MsVmGenid: %v", err)
+}
+if err := x.SerialList.fromC(&tmp.serial_list);err != nil {
+return fmt.Errorf("converting field SerialList: %v", err)
+}
+if err := x.Rdm.fromC(&tmp.rdm);err != nil {
+return fmt.Errorf("converting field Rdm: %v", err)
+}
+x.RdmMemBoundaryMemkb = uint64(tmp.rdm_mem_boundary_memkb)
+x.McaCaps = uint64(tmp.mca_caps)
+return nil
 }
 
 func (x *DomainBuildInfoTypeUnionPv) fromC(xc *C.libxl_domain_build_info) error {
-	if DomainType(xc._type) != DomainTypePv {
-		return errors.New("expected union key DomainTypePv")
-	}
-
-	tmp := (*C.libxl_domain_build_info_type_union_pv)(unsafe.Pointer(&xc.u[0]))
-	x.Kernel = C.GoString(tmp.kernel)
-	x.SlackMemkb = uint64(tmp.slack_memkb)
-	x.Bootloader = C.GoString(tmp.bootloader)
-	if err := x.BootloaderArgs.fromC(&tmp.bootloader_args); err != nil {
-		return fmt.Errorf("converting field BootloaderArgs: %v", err)
-	}
-	x.Cmdline = C.GoString(tmp.cmdline)
-	x.Ramdisk = C.GoString(tmp.ramdisk)
-	x.Features = C.GoString(tmp.features)
-	if err := x.E820Host.fromC(&tmp.e820_host); err != nil {
-		return fmt.Errorf("converting field E820Host: %v", err)
-	}
-	return nil
+if DomainType(xc._type) != DomainTypePv {
+return errors.New("expected union key DomainTypePv")
+}
+
+tmp := (*C.libxl_domain_build_info_type_union_pv)(unsafe.Pointer(&xc.u[0]))
+x.Kernel = C.GoString(tmp.kernel)
+x.SlackMemkb = uint64(tmp.slack_memkb)
+x.Bootloader = C.GoString(tmp.bootloader)
+if err := x.BootloaderArgs.fromC(&tmp.bootloader_args);err != nil {
+return fmt.Errorf("converting field BootloaderArgs: %v", err)
+}
+x.Cmdline = C.GoString(tmp.cmdline)
+x.Ramdisk = C.GoString(tmp.ramdisk)
+x.Features = C.GoString(tmp.features)
+if err := x.E820Host.fromC(&tmp.e820_host);err != nil {
+return fmt.Errorf("converting field E820Host: %v", err)
+}
+return nil
 }
 
 func (x *DomainBuildInfoTypeUnionPvh) fromC(xc *C.libxl_domain_build_info) error {
-	if DomainType(xc._type) != DomainTypePvh {
-		return errors.New("expected union key DomainTypePvh")
-	}
-
-	tmp := (*C.libxl_domain_build_info_type_union_pvh)(unsafe.Pointer(&xc.u[0]))
-	if err := x.Pvshim.fromC(&tmp.pvshim); err != nil {
-		return fmt.Errorf("converting field Pvshim: %v", err)
-	}
-	x.PvshimPath = C.GoString(tmp.pvshim_path)
-	x.PvshimCmdline = C.GoString(tmp.pvshim_cmdline)
-	x.PvshimExtra = C.GoString(tmp.pvshim_extra)
-	return nil
-}
-
-func (x *DomainBuildInfo) toC(xc *C.libxl_domain_build_info) (err error) {
-	defer func() {
-		if err != nil {
-			C.libxl_domain_build_info_dispose(xc)
-		}
-	}()
-
-	xc.max_vcpus = C.int(x.MaxVcpus)
-	if err := x.AvailVcpus.toC(&xc.avail_vcpus); err != nil {
-		return fmt.Errorf("converting field AvailVcpus: %v", err)
-	}
-	if err := x.Cpumap.toC(&xc.cpumap); err != nil {
-		return fmt.Errorf("converting field Cpumap: %v", err)
-	}
-	if err := x.Nodemap.toC(&xc.nodemap); err != nil {
-		return fmt.Errorf("converting field Nodemap: %v", err)
-	}
-	if numVcpuHardAffinity := len(x.VcpuHardAffinity); numVcpuHardAffinity > 0 {
-		xc.vcpu_hard_affinity = (*C.libxl_bitmap)(C.malloc(C.ulong(numVcpuHardAffinity) * C.sizeof_libxl_bitmap))
-		xc.num_vcpu_hard_affinity = C.int(numVcpuHardAffinity)
-		cVcpuHardAffinity := (*[1 << 28]C.libxl_bitmap)(unsafe.Pointer(xc.vcpu_hard_affinity))[:numVcpuHardAffinity:numVcpuHardAffinity]
-		for i, v := range x.VcpuHardAffinity {
-			if err := v.toC(&cVcpuHardAffinity[i]); err != nil {
-				return fmt.Errorf("converting field VcpuHardAffinity: %v", err)
-			}
-		}
-	}
-	if numVcpuSoftAffinity := len(x.VcpuSoftAffinity); numVcpuSoftAffinity > 0 {
-		xc.vcpu_soft_affinity = (*C.libxl_bitmap)(C.malloc(C.ulong(numVcpuSoftAffinity) * C.sizeof_libxl_bitmap))
-		xc.num_vcpu_soft_affinity = C.int(numVcpuSoftAffinity)
-		cVcpuSoftAffinity := (*[1 << 28]C.libxl_bitmap)(unsafe.Pointer(xc.vcpu_soft_affinity))[:numVcpuSoftAffinity:numVcpuSoftAffinity]
-		for i, v := range x.VcpuSoftAffinity {
-			if err := v.toC(&cVcpuSoftAffinity[i]); err != nil {
-				return fmt.Errorf("converting field VcpuSoftAffinity: %v", err)
-			}
-		}
-	}
-	if err := x.NumaPlacement.toC(&xc.numa_placement); err != nil {
-		return fmt.Errorf("converting field NumaPlacement: %v", err)
-	}
-	xc.tsc_mode = C.libxl_tsc_mode(x.TscMode)
-	xc.max_memkb = C.uint64_t(x.MaxMemkb)
-	xc.target_memkb = C.uint64_t(x.TargetMemkb)
-	xc.video_memkb = C.uint64_t(x.VideoMemkb)
-	xc.shadow_memkb = C.uint64_t(x.ShadowMemkb)
-	xc.iommu_memkb = C.uint64_t(x.IommuMemkb)
-	xc.rtc_timeoffset = C.uint32_t(x.RtcTimeoffset)
-	xc.exec_ssidref = C.uint32_t(x.ExecSsidref)
-	if x.ExecSsidLabel != "" {
-		xc.exec_ssid_label = C.CString(x.ExecSsidLabel)
-	}
-	if err := x.Localtime.toC(&xc.localtime); err != nil {
-		return fmt.Errorf("converting field Localtime: %v", err)
-	}
-	if err := x.DisableMigrate.toC(&xc.disable_migrate); err != nil {
-		return fmt.Errorf("converting field DisableMigrate: %v", err)
-	}
-	if err := x.Cpuid.toC(&xc.cpuid); err != nil {
-		return fmt.Errorf("converting field Cpuid: %v", err)
-	}
-	if x.BlkdevStart != "" {
-		xc.blkdev_start = C.CString(x.BlkdevStart)
-	}
-	if numVnumaNodes := len(x.VnumaNodes); numVnumaNodes > 0 {
-		xc.vnuma_nodes = (*C.libxl_vnode_info)(C.malloc(C.ulong(numVnumaNodes) * C.sizeof_libxl_vnode_info))
-		xc.num_vnuma_nodes = C.int(numVnumaNodes)
-		cVnumaNodes := (*[1 << 28]C.libxl_vnode_info)(unsafe.Pointer(xc.vnuma_nodes))[:numVnumaNodes:numVnumaNodes]
-		for i, v := range x.VnumaNodes {
-			if err := v.toC(&cVnumaNodes[i]); err != nil {
-				return fmt.Errorf("converting field VnumaNodes: %v", err)
-			}
-		}
-	}
-	xc.max_grant_frames = C.uint32_t(x.MaxGrantFrames)
-	xc.max_maptrack_frames = C.uint32_t(x.MaxMaptrackFrames)
-	xc.device_model_version = C.libxl_device_model_version(x.DeviceModelVersion)
-	if err := x.DeviceModelStubdomain.toC(&xc.device_model_stubdomain); err != nil {
-		return fmt.Errorf("converting field DeviceModelStubdomain: %v", err)
-	}
-	xc.stubdomain_memkb = C.uint64_t(x.StubdomainMemkb)
-	if x.StubdomainKernel != "" {
-		xc.stubdomain_kernel = C.CString(x.StubdomainKernel)
-	}
-	if x.StubdomainRamdisk != "" {
-		xc.stubdomain_ramdisk = C.CString(x.StubdomainRamdisk)
-	}
-	if x.DeviceModel != "" {
-		xc.device_model = C.CString(x.DeviceModel)
-	}
-	xc.device_model_ssidref = C.uint32_t(x.DeviceModelSsidref)
-	if x.DeviceModelSsidLabel != "" {
-		xc.device_model_ssid_label = C.CString(x.DeviceModelSsidLabel)
-	}
-	if x.DeviceModelUser != "" {
-		xc.device_model_user = C.CString(x.DeviceModelUser)
-	}
-	if err := x.Extra.toC(&xc.extra); err != nil {
-		return fmt.Errorf("converting field Extra: %v", err)
-	}
-	if err := x.ExtraPv.toC(&xc.extra_pv); err != nil {
-		return fmt.Errorf("converting field ExtraPv: %v", err)
-	}
-	if err := x.ExtraHvm.toC(&xc.extra_hvm); err != nil {
-		return fmt.Errorf("converting field ExtraHvm: %v", err)
-	}
-	if err := x.SchedParams.toC(&xc.sched_params); err != nil {
-		return fmt.Errorf("converting field SchedParams: %v", err)
-	}
-	if numIoports := len(x.Ioports); numIoports > 0 {
-		xc.ioports = (*C.libxl_ioport_range)(C.malloc(C.ulong(numIoports) * C.sizeof_libxl_ioport_range))
-		xc.num_ioports = C.int(numIoports)
-		cIoports := (*[1 << 28]C.libxl_ioport_range)(unsafe.Pointer(xc.ioports))[:numIoports:numIoports]
-		for i, v := range x.Ioports {
-			if err := v.toC(&cIoports[i]); err != nil {
-				return fmt.Errorf("converting field Ioports: %v", err)
-			}
-		}
-	}
-	if numIrqs := len(x.Irqs); numIrqs > 0 {
-		xc.irqs = (*C.uint32_t)(C.malloc(C.size_t(numIrqs * numIrqs)))
-		xc.num_irqs = C.int(numIrqs)
-		cIrqs := (*[1 << 28]C.uint32_t)(unsafe.Pointer(xc.irqs))[:numIrqs:numIrqs]
-		for i, v := range x.Irqs {
-			cIrqs[i] = C.uint32_t(v)
-		}
-	}
-	if numIomem := len(x.Iomem); numIomem > 0 {
-		xc.iomem = (*C.libxl_iomem_range)(C.malloc(C.ulong(numIomem) * C.sizeof_libxl_iomem_range))
-		xc.num_iomem = C.int(numIomem)
-		cIomem := (*[1 << 28]C.libxl_iomem_range)(unsafe.Pointer(xc.iomem))[:numIomem:numIomem]
-		for i, v := range x.Iomem {
-			if err := v.toC(&cIomem[i]); err != nil {
-				return fmt.Errorf("converting field Iomem: %v", err)
-			}
-		}
-	}
-	if err := x.ClaimMode.toC(&xc.claim_mode); err != nil {
-		return fmt.Errorf("converting field ClaimMode: %v", err)
-	}
-	xc.event_channels = C.uint32_t(x.EventChannels)
-	if x.Kernel != "" {
-		xc.kernel = C.CString(x.Kernel)
-	}
-	if x.Cmdline != "" {
-		xc.cmdline = C.CString(x.Cmdline)
-	}
-	if x.Ramdisk != "" {
-		xc.ramdisk = C.CString(x.Ramdisk)
-	}
-	if x.DeviceTree != "" {
-		xc.device_tree = C.CString(x.DeviceTree)
-	}
-	if err := x.Acpi.toC(&xc.acpi); err != nil {
-		return fmt.Errorf("converting field Acpi: %v", err)
-	}
-	if x.Bootloader != "" {
-		xc.bootloader = C.CString(x.Bootloader)
-	}
-	if err := x.BootloaderArgs.toC(&xc.bootloader_args); err != nil {
-		return fmt.Errorf("converting field BootloaderArgs: %v", err)
-	}
-	xc.timer_mode = C.libxl_timer_mode(x.TimerMode)
-	if err := x.NestedHvm.toC(&xc.nested_hvm); err != nil {
-		return fmt.Errorf("converting field NestedHvm: %v", err)
-	}
-	if err := x.Apic.toC(&xc.apic); err != nil {
-		return fmt.Errorf("converting field Apic: %v", err)
-	}
-	if err := x.DmRestrict.toC(&xc.dm_restrict); err != nil {
-		return fmt.Errorf("converting field DmRestrict: %v", err)
-	}
-	xc.tee = C.libxl_tee_type(x.Tee)
-	xc._type = C.libxl_domain_type(x.Type)
-	switch x.Type {
-	case DomainTypeHvm:
-		tmp, ok := x.TypeUnion.(DomainBuildInfoTypeUnionHvm)
-		if !ok {
-			return errors.New("wrong type for union key type")
-		}
-		var hvm C.libxl_domain_build_info_type_union_hvm
-		if tmp.Firmware != "" {
-			hvm.firmware = C.CString(tmp.Firmware)
-		}
-		hvm.bios = C.libxl_bios_type(tmp.Bios)
-		if err := tmp.Pae.toC(&hvm.pae); err != nil {
-			return fmt.Errorf("converting field Pae: %v", err)
-		}
-		if err := tmp.Apic.toC(&hvm.apic); err != nil {
-			return fmt.Errorf("converting field Apic: %v", err)
-		}
-		if err := tmp.Acpi.toC(&hvm.acpi); err != nil {
-			return fmt.Errorf("converting field Acpi: %v", err)
-		}
-		if err := tmp.AcpiS3.toC(&hvm.acpi_s3); err != nil {
-			return fmt.Errorf("converting field AcpiS3: %v", err)
-		}
-		if err := tmp.AcpiS4.toC(&hvm.acpi_s4); err != nil {
-			return fmt.Errorf("converting field AcpiS4: %v", err)
-		}
-		if err := tmp.AcpiLaptopSlate.toC(&hvm.acpi_laptop_slate); err != nil {
-			return fmt.Errorf("converting field AcpiLaptopSlate: %v", err)
-		}
-		if err := tmp.Nx.toC(&hvm.nx); err != nil {
-			return fmt.Errorf("converting field Nx: %v", err)
-		}
-		if err := tmp.Viridian.toC(&hvm.viridian); err != nil {
-			return fmt.Errorf("converting field Viridian: %v", err)
-		}
-		if err := tmp.ViridianEnable.toC(&hvm.viridian_enable); err != nil {
-			return fmt.Errorf("converting field ViridianEnable: %v", err)
-		}
-		if err := tmp.ViridianDisable.toC(&hvm.viridian_disable); err != nil {
-			return fmt.Errorf("converting field ViridianDisable: %v", err)
-		}
-		if tmp.Timeoffset != "" {
-			hvm.timeoffset = C.CString(tmp.Timeoffset)
-		}
-		if err := tmp.Hpet.toC(&hvm.hpet); err != nil {
-			return fmt.Errorf("converting field Hpet: %v", err)
-		}
-		if err := tmp.VptAlign.toC(&hvm.vpt_align); err != nil {
-			return fmt.Errorf("converting field VptAlign: %v", err)
-		}
-		hvm.mmio_hole_memkb = C.uint64_t(tmp.MmioHoleMemkb)
-		hvm.timer_mode = C.libxl_timer_mode(tmp.TimerMode)
-		if err := tmp.NestedHvm.toC(&hvm.nested_hvm); err != nil {
-			return fmt.Errorf("converting field NestedHvm: %v", err)
-		}
-		if err := tmp.Altp2M.toC(&hvm.altp2m); err != nil {
-			return fmt.Errorf("converting field Altp2M: %v", err)
-		}
-		if tmp.SystemFirmware != "" {
-			hvm.system_firmware = C.CString(tmp.SystemFirmware)
-		}
-		if tmp.SmbiosFirmware != "" {
-			hvm.smbios_firmware = C.CString(tmp.SmbiosFirmware)
-		}
-		if tmp.AcpiFirmware != "" {
-			hvm.acpi_firmware = C.CString(tmp.AcpiFirmware)
-		}
-		hvm.hdtype = C.libxl_hdtype(tmp.Hdtype)
-		if err := tmp.Nographic.toC(&hvm.nographic); err != nil {
-			return fmt.Errorf("converting field Nographic: %v", err)
-		}
-		if err := tmp.Vga.toC(&hvm.vga); err != nil {
-			return fmt.Errorf("converting field Vga: %v", err)
-		}
-		if err := tmp.Vnc.toC(&hvm.vnc); err != nil {
-			return fmt.Errorf("converting field Vnc: %v", err)
-		}
-		if tmp.Keymap != "" {
-			hvm.keymap = C.CString(tmp.Keymap)
-		}
-		if err := tmp.Sdl.toC(&hvm.sdl); err != nil {
-			return fmt.Errorf("converting field Sdl: %v", err)
-		}
-		if err := tmp.Spice.toC(&hvm.spice); err != nil {
-			return fmt.Errorf("converting field Spice: %v", err)
-		}
-		if err := tmp.GfxPassthru.toC(&hvm.gfx_passthru); err != nil {
-			return fmt.Errorf("converting field GfxPassthru: %v", err)
-		}
-		hvm.gfx_passthru_kind = C.libxl_gfx_passthru_kind(tmp.GfxPassthruKind)
-		if tmp.Serial != "" {
-			hvm.serial = C.CString(tmp.Serial)
-		}
-		if tmp.Boot != "" {
-			hvm.boot = C.CString(tmp.Boot)
-		}
-		if err := tmp.Usb.toC(&hvm.usb); err != nil {
-			return fmt.Errorf("converting field Usb: %v", err)
-		}
-		hvm.usbversion = C.int(tmp.Usbversion)
-		if tmp.Usbdevice != "" {
-			hvm.usbdevice = C.CString(tmp.Usbdevice)
-		}
-		if err := tmp.VkbDevice.toC(&hvm.vkb_device); err != nil {
-			return fmt.Errorf("converting field VkbDevice: %v", err)
-		}
-		if tmp.Soundhw != "" {
-			hvm.soundhw = C.CString(tmp.Soundhw)
-		}
-		if err := tmp.XenPlatformPci.toC(&hvm.xen_platform_pci); err != nil {
-			return fmt.Errorf("converting field XenPlatformPci: %v", err)
-		}
-		if err := tmp.UsbdeviceList.toC(&hvm.usbdevice_list); err != nil {
-			return fmt.Errorf("converting field UsbdeviceList: %v", err)
-		}
-		hvm.vendor_device = C.libxl_vendor_device(tmp.VendorDevice)
-		if err := tmp.MsVmGenid.toC(&hvm.ms_vm_genid); err != nil {
-			return fmt.Errorf("converting field MsVmGenid: %v", err)
-		}
-		if err := tmp.SerialList.toC(&hvm.serial_list); err != nil {
-			return fmt.Errorf("converting field SerialList: %v", err)
-		}
-		if err := tmp.Rdm.toC(&hvm.rdm); err != nil {
-			return fmt.Errorf("converting field Rdm: %v", err)
-		}
-		hvm.rdm_mem_boundary_memkb = C.uint64_t(tmp.RdmMemBoundaryMemkb)
-		hvm.mca_caps = C.uint64_t(tmp.McaCaps)
-		hvmBytes := C.GoBytes(unsafe.Pointer(&hvm), C.sizeof_libxl_domain_build_info_type_union_hvm)
-		copy(xc.u[:], hvmBytes)
-	case DomainTypePv:
-		tmp, ok := x.TypeUnion.(DomainBuildInfoTypeUnionPv)
-		if !ok {
-			return errors.New("wrong type for union key type")
-		}
-		var pv C.libxl_domain_build_info_type_union_pv
-		if tmp.Kernel != "" {
-			pv.kernel = C.CString(tmp.Kernel)
-		}
-		pv.slack_memkb = C.uint64_t(tmp.SlackMemkb)
-		if tmp.Bootloader != "" {
-			pv.bootloader = C.CString(tmp.Bootloader)
-		}
-		if err := tmp.BootloaderArgs.toC(&pv.bootloader_args); err != nil {
-			return fmt.Errorf("converting field BootloaderArgs: %v", err)
-		}
-		if tmp.Cmdline != "" {
-			pv.cmdline = C.CString(tmp.Cmdline)
-		}
-		if tmp.Ramdisk != "" {
-			pv.ramdisk = C.CString(tmp.Ramdisk)
-		}
-		if tmp.Features != "" {
-			pv.features = C.CString(tmp.Features)
-		}
-		if err := tmp.E820Host.toC(&pv.e820_host); err != nil {
-			return fmt.Errorf("converting field E820Host: %v", err)
-		}
-		pvBytes := C.GoBytes(unsafe.Pointer(&pv), C.sizeof_libxl_domain_build_info_type_union_pv)
-		copy(xc.u[:], pvBytes)
-	case DomainTypePvh:
-		tmp, ok := x.TypeUnion.(DomainBuildInfoTypeUnionPvh)
-		if !ok {
-			return errors.New("wrong type for union key type")
-		}
-		var pvh C.libxl_domain_build_info_type_union_pvh
-		if err := tmp.Pvshim.toC(&pvh.pvshim); err != nil {
-			return fmt.Errorf("converting field Pvshim: %v", err)
-		}
-		if tmp.PvshimPath != "" {
-			pvh.pvshim_path = C.CString(tmp.PvshimPath)
-		}
-		if tmp.PvshimCmdline != "" {
-			pvh.pvshim_cmdline = C.CString(tmp.PvshimCmdline)
-		}
-		if tmp.PvshimExtra != "" {
-			pvh.pvshim_extra = C.CString(tmp.PvshimExtra)
-		}
-		pvhBytes := C.GoBytes(unsafe.Pointer(&pvh), C.sizeof_libxl_domain_build_info_type_union_pvh)
-		copy(xc.u[:], pvhBytes)
-	case DomainTypeInvalid:
-		break
-	default:
-		return fmt.Errorf("invalid union key '%v'", x.Type)
-	}
-	xc.arch_arm.gic_version = C.libxl_gic_version(x.ArchArm.GicVersion)
-	xc.arch_arm.vuart = C.libxl_vuart_type(x.ArchArm.Vuart)
-	xc.altp2m = C.libxl_altp2m_mode(x.Altp2M)
-
-	return nil
+if DomainType(xc._type) != DomainTypePvh {
+return errors.New("expected union key DomainTypePvh")
+}
+
+tmp := (*C.libxl_domain_build_info_type_union_pvh)(unsafe.Pointer(&xc.u[0]))
+if err := x.Pvshim.fromC(&tmp.pvshim);err != nil {
+return fmt.Errorf("converting field Pvshim: %v", err)
+}
+x.PvshimPath = C.GoString(tmp.pvshim_path)
+x.PvshimCmdline = C.GoString(tmp.pvshim_cmdline)
+x.PvshimExtra = C.GoString(tmp.pvshim_extra)
+return nil
+}
+
+func (x *DomainBuildInfo) toC(xc *C.libxl_domain_build_info) (err error){defer func(){
+if err != nil{
+C.libxl_domain_build_info_dispose(xc)}
+}()
+
+xc.max_vcpus = C.int(x.MaxVcpus)
+if err := x.AvailVcpus.toC(&xc.avail_vcpus); err != nil {
+return fmt.Errorf("converting field AvailVcpus: %v", err)
+}
+if err := x.Cpumap.toC(&xc.cpumap); err != nil {
+return fmt.Errorf("converting field Cpumap: %v", err)
+}
+if err := x.Nodemap.toC(&xc.nodemap); err != nil {
+return fmt.Errorf("converting field Nodemap: %v", err)
+}
+if numVcpuHardAffinity := len(x.VcpuHardAffinity); numVcpuHardAffinity > 0 {
+xc.vcpu_hard_affinity = (*C.libxl_bitmap)(C.malloc(C.ulong(numVcpuHardAffinity)*C.sizeof_libxl_bitmap))
+xc.num_vcpu_hard_affinity = C.int(numVcpuHardAffinity)
+cVcpuHardAffinity := (*[1<<28]C.libxl_bitmap)(unsafe.Pointer(xc.vcpu_hard_affinity))[:numVcpuHardAffinity:numVcpuHardAffinity]
+for i,v := range x.VcpuHardAffinity {
+if err := v.toC(&cVcpuHardAffinity[i]); err != nil {
+return fmt.Errorf("converting field VcpuHardAffinity: %v", err)
+}
+}
+}
+if numVcpuSoftAffinity := len(x.VcpuSoftAffinity); numVcpuSoftAffinity > 0 {
+xc.vcpu_soft_affinity = (*C.libxl_bitmap)(C.malloc(C.ulong(numVcpuSoftAffinity)*C.sizeof_libxl_bitmap))
+xc.num_vcpu_soft_affinity = C.int(numVcpuSoftAffinity)
+cVcpuSoftAffinity := (*[1<<28]C.libxl_bitmap)(unsafe.Pointer(xc.vcpu_soft_affinity))[:numVcpuSoftAffinity:numVcpuSoftAffinity]
+for i,v := range x.VcpuSoftAffinity {
+if err := v.toC(&cVcpuSoftAffinity[i]); err != nil {
+return fmt.Errorf("converting field VcpuSoftAffinity: %v", err)
 }
+}
+}
+if err := x.NumaPlacement.toC(&xc.numa_placement); err != nil {
+return fmt.Errorf("converting field NumaPlacement: %v", err)
+}
+xc.tsc_mode = C.libxl_tsc_mode(x.TscMode)


From xen-changelog-bounces@lists.xenproject.org Mon Jun 08 17:44:11 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 08 Jun 2020 17: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 1jiLod-0000Vz-BS; Mon, 08 Jun 2020 17:44: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=vPAR=7V=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jiLoc-0000Vu-6J
 for xen-changelog@lists.xenproject.org; Mon, 08 Jun 2020 17:44:06 +0000
X-Inumbo-ID: a58f9c52-a9af-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id a58f9c52-a9af-11ea-bca7-bc764e2007e4;
 Mon, 08 Jun 2020 17: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=b1r7/PEmwupwdDJBwYpNUS5BVd3xmdak+w3WcPqnEH0=; b=N6cQ5kXprUobKCHPspfcBV+Rqv
 ir7LjCeY1np3ch4i1Q3J7DxCeSG+XeQpmNxQF3xzmsOjFdmAtlnPi9ZZVv1aoFLws4O1gjJwE3Ns1
 597f6p5pShcqNpaquvHzRfgPHmf8PHOJQbD2GxTgvn1DTdTEvJNPT6c0egbnTsNbkTXQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jiLoa-0004rH-Tg
 for xen-changelog@lists.xenproject.org; Mon, 08 Jun 2020 17:44:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jiLoa-0002BI-SR
 for xen-changelog@lists.xenproject.org; Mon, 08 Jun 2020 17:44:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] xen/arm: mm: Access a PT entry before the table is
 unmapped
Message-Id: <E1jiLoa-0002BI-SR@xenbits.xenproject.org>
Date: Mon, 08 Jun 2020 17: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 63b4c9bfb788ebfd35d0172f7e8e2e41ef948f70
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Sun Jun 7 16:51:54 2020 +0100
Commit:     Stefano Stabellini <sstabellini@kernel.org>
CommitDate: Mon Jun 8 10:33:28 2020 -0700

    xen/arm: mm: Access a PT entry before the table is unmapped
    
    xen_pt_next_level() will retrieve the MFN from the entry right after the
    page-table has been unmapped.
    
    After calling xen_unmap_table(), there is no guarantee the mapping will
    still be valid. Depending on the implementation, this may result to a
    data abort in Xen.
    
    Re-order the code to retrieve the MFN before the table is unmapped.
    
    Fixes: 53abb9a1dcd9 ("xen/arm: mm: Rework Xen page-tables walk during update")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/arch/arm/mm.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 1b14f49345..9e2ff7c800 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -1036,6 +1036,7 @@ static int xen_pt_next_level(bool read_only, unsigned int level,
 {
     lpae_t *entry;
     int ret;
+    mfn_t mfn;
 
     entry = *table + offset;
 
@@ -1053,8 +1054,10 @@ static int xen_pt_next_level(bool read_only, unsigned int level,
     if ( lpae_is_mapping(*entry, level) )
         return XEN_TABLE_SUPER_PAGE;
 
+    mfn = lpae_get_mfn(*entry);
+
     xen_unmap_table(*table);
-    *table = xen_map_table(lpae_get_mfn(*entry));
+    *table = xen_map_table(mfn);
 
     return XEN_TABLE_NORMAL_PAGE;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Jun 08 17:44:16 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 08 Jun 2020 17:44:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jiLom-0000WY-DC; Mon, 08 Jun 2020 17:44:16 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=vPAR=7V=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jiLol-0000WS-Vu
 for xen-changelog@lists.xenproject.org; Mon, 08 Jun 2020 17:44:16 +0000
X-Inumbo-ID: ab9534b8-a9af-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id ab9534b8-a9af-11ea-bca7-bc764e2007e4;
 Mon, 08 Jun 2020 17: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=zADaR4bN8fwUU73TPNPvtxznwhqYgSSDVQwrkP12RFk=; b=o2gmk/79BMmLSbYSNdWFNCA/NY
 MrfZ9ljEQudiFZPdTFbKSsm9ni+P3mwt3KQyBzr9NEaAawptcolRkrj9lYsDKObvOwLwkGLlcR4Wp
 EHpZNU249S81nc27QcggnpiwRmbLXtiH0sQMsj5aR2hvEL/pT/l5sCdTq7w8uE/ov2vU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jiLol-0004rR-0m
 for xen-changelog@lists.xenproject.org; Mon, 08 Jun 2020 17:44:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jiLok-0002CL-Vz
 for xen-changelog@lists.xenproject.org; Mon, 08 Jun 2020 17:44:14 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/rtc: provide mediated access to RTC for PVH dom0
Message-Id: <E1jiLok-0002CL-Vz@xenbits.xenproject.org>
Date: Mon, 08 Jun 2020 17: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 835d8d69d96aa7feb52ef7b3dd8ecf43f0807578
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Jun 8 18:13:53 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Jun 8 18:40:05 2020 +0100

    x86/rtc: provide mediated access to RTC for PVH dom0
    
    Mediated access to the RTC was provided for PVHv1 dom0 using the PV
    code paths (guest_io_{write/read}), but those accesses where never
    implemented for PVHv2 dom0. This patch provides such mediated accesses
    to the RTC for PVH dom0, just like it's provided for a classic PV
    dom0.
    
    Pull out some of the RTC logic from guest_io_{read/write} into
    specific helpers that can be used by both PV and HVM guests. The
    setup of the handlers for PVH is done in rtc_init, which is already
    used to initialize the fully emulated RTC.
    
    Without this a Linux PVH dom0 will read garbage when trying to access
    the RTC, and one vCPU will be constantly looping in
    rtc_timer_do_work.
    
    Note that such issue doesn't happen on domUs because the ACPI
    NO_CMOS_RTC flag is set in FADT, which prevents the OS from accessing
    the RTC. Also the X86_EMU_RTC flag is not set for PVH dom0, as the
    accesses are not emulated but rather forwarded to the physical
    hardware.
    
    No functional change expected for classic PV dom0.
    
    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/arch/x86/hvm/rtc.c            | 26 ++++++++++++++++
 xen/arch/x86/pv/emul-priv-op.c    | 30 +++---------------
 xen/arch/x86/time.c               | 65 +++++++++++++++++++++++++++++++++++++++
 xen/include/asm-x86/mc146818rtc.h |  3 ++
 4 files changed, 98 insertions(+), 26 deletions(-)

diff --git a/xen/arch/x86/hvm/rtc.c b/xen/arch/x86/hvm/rtc.c
index 5bbbdc0e0f..3150f5f147 100644
--- a/xen/arch/x86/hvm/rtc.c
+++ b/xen/arch/x86/hvm/rtc.c
@@ -808,12 +808,38 @@ void rtc_reset(struct domain *d)
     s->pt.source = PTSRC_isa;
 }
 
+/* RTC mediator for HVM hardware domain. */
+static int hw_rtc_io(int dir, unsigned int port, unsigned int size,
+                     uint32_t *val)
+{
+    if ( dir == IOREQ_READ )
+        *val = ~0;
+
+    if ( size != 1 )
+    {
+        gdprintk(XENLOG_WARNING, "bad RTC access size (%u)\n", size);
+        return X86EMUL_OKAY;
+    }
+
+    if ( dir == IOREQ_WRITE )
+        rtc_guest_write(port, *val);
+    else
+        *val = rtc_guest_read(port);
+
+    return X86EMUL_OKAY;
+}
+
 void rtc_init(struct domain *d)
 {
     RTCState *s = domain_vrtc(d);
 
     if ( !has_vrtc(d) )
+    {
+        if ( is_hardware_domain(d) )
+            /* Hardware domain gets mediated access to the physical RTC. */
+            register_portio_handler(d, RTC_PORT(0), 2, hw_rtc_io);
         return;
+    }
 
     spin_lock_init(&s->lock);
 
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index fad6c754ad..254da2b849 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -280,19 +280,9 @@ static uint32_t guest_io_read(unsigned int port, unsigned int bytes,
         {
             sub_data = pv_pit_handler(port, 0, 0);
         }
-        else if ( port == RTC_PORT(0) )
+        else if ( port == RTC_PORT(0) || port == RTC_PORT(1) )
         {
-            sub_data = currd->arch.cmos_idx;
-        }
-        else if ( (port == RTC_PORT(1)) &&
-                  ioports_access_permitted(currd, RTC_PORT(0), RTC_PORT(1)) )
-        {
-            unsigned long flags;
-
-            spin_lock_irqsave(&rtc_lock, flags);
-            outb(currd->arch.cmos_idx & 0x7f, RTC_PORT(0));
-            sub_data = inb(RTC_PORT(1));
-            spin_unlock_irqrestore(&rtc_lock, flags);
+            sub_data = rtc_guest_read(port);
         }
         else if ( (port == 0xcf8) && (bytes == 4) )
         {
@@ -413,21 +403,9 @@ static void guest_io_write(unsigned int port, unsigned int bytes,
         {
             pv_pit_handler(port, (uint8_t)data, 1);
         }
-        else if ( port == RTC_PORT(0) )
-        {
-            currd->arch.cmos_idx = data;
-        }
-        else if ( (port == RTC_PORT(1)) &&
-                  ioports_access_permitted(currd, RTC_PORT(0), RTC_PORT(1)) )
+        else if ( port == RTC_PORT(0) || port == RTC_PORT(1) )
         {
-            unsigned long flags;
-
-            if ( pv_rtc_handler )
-                pv_rtc_handler(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));
-            spin_unlock_irqrestore(&rtc_lock, flags);
+            rtc_guest_write(port, data);
         }
         else if ( (port == 0xcf8) && (bytes == 4) )
         {
diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index bbaea3aa65..d643590c0a 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -27,6 +27,7 @@
 #include <xen/keyhandler.h>
 #include <xen/guest_access.h>
 #include <asm/io.h>
+#include <asm/iocap.h>
 #include <asm/msr.h>
 #include <asm/mpspec.h>
 #include <asm/processor.h>
@@ -1110,6 +1111,70 @@ static unsigned long get_cmos_time(void)
     return mktime(rtc.year, rtc.mon, rtc.day, rtc.hour, rtc.min, rtc.sec);
 }
 
+/* Helpers for guest accesses to the physical RTC. */
+unsigned int rtc_guest_read(unsigned int port)
+{
+    const struct domain *currd = current->domain;
+    unsigned long flags;
+    unsigned int data = ~0;
+
+    switch ( port )
+    {
+    case RTC_PORT(0):
+        /*
+         * All PV domains (and PVH dom0) are allowed to read the latched value
+         * of the first RTC port, as there's no access to the physical IO
+         * ports.
+         */
+        data = currd->arch.cmos_idx;
+        break;
+
+    case RTC_PORT(1):
+        if ( !ioports_access_permitted(currd, RTC_PORT(0), RTC_PORT(1)) )
+            break;
+        spin_lock_irqsave(&rtc_lock, flags);
+        outb(currd->arch.cmos_idx & 0x7f, RTC_PORT(0));
+        data = inb(RTC_PORT(1));
+        spin_unlock_irqrestore(&rtc_lock, flags);
+        break;
+
+    default:
+        ASSERT_UNREACHABLE();
+    }
+
+    return data;
+}
+
+void rtc_guest_write(unsigned int port, unsigned int data)
+{
+    struct domain *currd = current->domain;
+    unsigned long flags;
+
+    switch ( port )
+    {
+    case RTC_PORT(0):
+        /*
+         * All PV domains (and PVH dom0) are allowed to write to the latched
+         * value of the first RTC port, as there's no access to the physical IO
+         * ports.
+         */
+        currd->arch.cmos_idx = data;
+        break;
+
+    case RTC_PORT(1):
+        if ( !ioports_access_permitted(currd, RTC_PORT(0), RTC_PORT(1)) )
+            break;
+        spin_lock_irqsave(&rtc_lock, flags);
+        outb(currd->arch.cmos_idx & 0x7f, RTC_PORT(0));
+        outb(data, RTC_PORT(1));
+        spin_unlock_irqrestore(&rtc_lock, flags);
+        break;
+
+    default:
+        ASSERT_UNREACHABLE();
+    }
+}
+
 static unsigned long get_wallclock_time(void)
 {
 #ifdef CONFIG_XEN_GUEST
diff --git a/xen/include/asm-x86/mc146818rtc.h b/xen/include/asm-x86/mc146818rtc.h
index 8758528f7c..803b236c0a 100644
--- a/xen/include/asm-x86/mc146818rtc.h
+++ b/xen/include/asm-x86/mc146818rtc.h
@@ -110,4 +110,7 @@ outb_p((val),RTC_PORT(1)); \
 
 #define RTC_IRQ 8
 
+unsigned int rtc_guest_read(unsigned int port);
+void rtc_guest_write(unsigned int port, unsigned int data);
+
 #endif /* _ASM_MC146818RTC_H */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jun 09 11:00:11 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Jun 2020 11: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 1jibzC-0001v0-I9; Tue, 09 Jun 2020 11:00:06 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=1bQd=7W=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jibzB-0001nt-Ej
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 11:00:05 +0000
X-Inumbo-ID: 5f6537aa-aa40-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 5f6537aa-aa40-11ea-8496-bc764e2007e4;
 Tue, 09 Jun 2020 11: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=lEk2/kn81D3gkRR/NYTGphaiLgo7BtdFv0zDzEBAMg0=; b=df5FCptMuCiqY1lnZt9yIFY741
 ldpbJPJP87ZlH7YehCot7/1ixpYdISqGkND/2z7AVQ5w+JTy43aa+KIC+JTG9WGFuuxhGWEFGSHJH
 TsjCY3MiPyocafgydkERiPwiG4hhOs77D3ZnG2d50Av6U1XrcAGLVCE0WqWXPv/U4h3Q=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jibzA-0004UH-8J
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 11:00:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jibzA-0004rp-7F
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 11:00:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/monitor: revert default behavior when monitoring
 register write events
Message-Id: <E1jibzA-0004rp-7F@xenbits.xenproject.org>
Date: Tue, 09 Jun 2020 11: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 985ba41f66a5bd39897976beb14dc1f575bdd8c2
Author:     Tamas K Lengyel <tamas@tklengyel.com>
AuthorDate: Tue Jun 9 12:54:17 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jun 9 12:54:17 2020 +0200

    x86/monitor: revert default behavior when monitoring register write events
    
    For the last couple years we have received numerous reports from users of
    monitor vm_events of spurious guest crashes when using events. In particular,
    it has observed that the problem occurs when vm_events are being disabled. The
    nature of the guest crash varied widely and has only occured occasionally. This
    made debugging the issue particularly hard. We had discussions about this issue
    even here on the xen-devel mailinglist with no luck figuring it out.
    
    The bug has now been identified as a race-condition between register event
    handling and disabling the monitor vm_event interface. The default behavior
    regarding emulation of register write events is changed so that they get
    postponed until the corresponding vm_event handler decides whether to allow such
    write to take place. Unfortunately this can only be implemented by performing the
    deny/allow step when the vCPU gets scheduled.
    
    Due to that postponed emulation of the event if the user decides to pause the
    VM in the vm_event handler and then disable events, the entire emulation step
    is skipped the next time the vCPU is resumed. Even if the user doesn't pause
    during the vm_event handling but exits immediately and disables vm_event, the
    situation becomes racey as disabling vm_event may succeed before the guest's
    vCPUs get scheduled with the pending emulation task. This has been particularly
    the case with VMS that have several vCPUs as after the VM is unpaused it may
    actually take a long time before all vCPUs get scheduled.
    
    In this patch we are reverting the default behavior to always perform emulation
    of register write events when the event occurs. To postpone them can be turned
    on as an option. In that case the user of the interface still has to take care
    of only disabling the interface when its safe as it remains buggy.
    
    Fixes: 96760e2fba10 ('vm_event: deny register writes if refused by vm_event
    reply').
    
    Signed-off-by: Tamas K Lengyel <tamas@tklengyel.com>
    Reviewed-by: Roger Pau Monné <rogerpau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/arch/x86/hvm/hvm.c            | 14 ++++++++------
 xen/arch/x86/hvm/monitor.c        | 13 ++++++++-----
 xen/include/asm-x86/domain.h      |  1 +
 xen/include/asm-x86/hvm/monitor.h |  7 +++----
 xen/include/asm-x86/monitor.h     |  4 ++++
 xen/include/public/domctl.h       |  6 ++++++
 6 files changed, 30 insertions(+), 15 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 74c9f84462..5bb47583b3 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -3601,13 +3601,15 @@ int hvm_msr_write_intercept(unsigned int msr, uint64_t msr_content,
 
         ASSERT(v->arch.vm_event);
 
-        /* The actual write will occur in hvm_do_resume() (if permitted). */
-        v->arch.vm_event->write_data.do_write.msr = 1;
-        v->arch.vm_event->write_data.msr = msr;
-        v->arch.vm_event->write_data.value = msr_content;
+        if ( hvm_monitor_msr(msr, msr_content, msr_old_content) )
+        {
+            /* The actual write will occur in hvm_do_resume(), if permitted. */
+            v->arch.vm_event->write_data.do_write.msr = 1;
+            v->arch.vm_event->write_data.msr = msr;
+            v->arch.vm_event->write_data.value = msr_content;
 
-        hvm_monitor_msr(msr, msr_content, msr_old_content);
-        return X86EMUL_OKAY;
+            return X86EMUL_OKAY;
+        }
     }
 
     if ( (ret = guest_wrmsr(v, msr, msr_content)) != X86EMUL_UNHANDLEABLE )
diff --git a/xen/arch/x86/hvm/monitor.c b/xen/arch/x86/hvm/monitor.c
index 8aa14137e2..e4a09964a0 100644
--- a/xen/arch/x86/hvm/monitor.c
+++ b/xen/arch/x86/hvm/monitor.c
@@ -53,11 +53,11 @@ bool hvm_monitor_cr(unsigned int index, unsigned long value, unsigned long old)
             .u.write_ctrlreg.old_value = old
         };
 
-        if ( monitor_traps(curr, sync, &req) >= 0 )
-            return 1;
+        return monitor_traps(curr, sync, &req) >= 0 &&
+               curr->domain->arch.monitor.control_register_values;
     }
 
-    return 0;
+    return false;
 }
 
 bool hvm_monitor_emul_unimplemented(void)
@@ -77,7 +77,7 @@ bool hvm_monitor_emul_unimplemented(void)
         monitor_traps(curr, true, &req) == 1;
 }
 
-void hvm_monitor_msr(unsigned int msr, uint64_t new_value, uint64_t old_value)
+bool hvm_monitor_msr(unsigned int msr, uint64_t new_value, uint64_t old_value)
 {
     struct vcpu *curr = current;
 
@@ -92,8 +92,11 @@ void hvm_monitor_msr(unsigned int msr, uint64_t new_value, uint64_t old_value)
             .u.mov_to_msr.old_value = old_value
         };
 
-        monitor_traps(curr, 1, &req);
+        return monitor_traps(curr, 1, &req) >= 0 &&
+               curr->domain->arch.monitor.control_register_values;
     }
+
+    return false;
 }
 
 void hvm_monitor_descriptor_access(uint64_t exit_info,
diff --git a/xen/include/asm-x86/domain.h b/xen/include/asm-x86/domain.h
index e8cee3d5e5..6fd94c2e14 100644
--- a/xen/include/asm-x86/domain.h
+++ b/xen/include/asm-x86/domain.h
@@ -418,6 +418,7 @@ struct arch_domain
          * This is used to filter out pagefaults.
          */
         unsigned int inguest_pagefault_disabled                            : 1;
+        unsigned int control_register_values                               : 1;
         struct monitor_msr_bitmap *msr_bitmap;
         uint64_t write_ctrlreg_mask[4];
     } monitor;
diff --git a/xen/include/asm-x86/hvm/monitor.h b/xen/include/asm-x86/hvm/monitor.h
index 66de24cb75..a75cd8545c 100644
--- a/xen/include/asm-x86/hvm/monitor.h
+++ b/xen/include/asm-x86/hvm/monitor.h
@@ -29,15 +29,14 @@ enum hvm_monitor_debug_type
 };
 
 /*
- * Called for current VCPU on crX/MSR changes by guest.
- * The event might not fire if the client has subscribed to it in onchangeonly
- * mode, hence the bool return type for control register write events.
+ * Called for current VCPU on crX/MSR changes by guest. Bool return signals
+ * whether emulation should be postponed.
  */
 bool hvm_monitor_cr(unsigned int index, unsigned long value,
                     unsigned long old);
 #define hvm_monitor_crX(cr, new, old) \
                         hvm_monitor_cr(VM_EVENT_X86_##cr, new, old)
-void hvm_monitor_msr(unsigned int msr, uint64_t value, uint64_t old_value);
+bool hvm_monitor_msr(unsigned int msr, uint64_t value, uint64_t old_value);
 void hvm_monitor_descriptor_access(uint64_t exit_info,
                                    uint64_t vmx_exit_qualification,
                                    uint8_t descriptor, bool is_write);
diff --git a/xen/include/asm-x86/monitor.h b/xen/include/asm-x86/monitor.h
index 4afb0665e8..01c6d63bb9 100644
--- a/xen/include/asm-x86/monitor.h
+++ b/xen/include/asm-x86/monitor.h
@@ -59,6 +59,10 @@ int arch_monitor_domctl_op(struct domain *d, struct xen_domctl_monitor_op *mop)
         domain_unpause(d);
         break;
 
+    case XEN_DOMCTL_MONITOR_OP_CONTROL_REGISTERS:
+        d->arch.monitor.control_register_values = true;
+        break;
+
     default:
         rc = -EOPNOTSUPP;
     }
diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h
index 1ad34c35eb..59bdc28c89 100644
--- a/xen/include/public/domctl.h
+++ b/xen/include/public/domctl.h
@@ -1025,6 +1025,12 @@ struct xen_domctl_psr_cmt_op {
 #define XEN_DOMCTL_MONITOR_OP_DISABLE           1
 #define XEN_DOMCTL_MONITOR_OP_GET_CAPABILITIES  2
 #define XEN_DOMCTL_MONITOR_OP_EMULATE_EACH_REP  3
+/*
+ * Control register feature can result in guest-crashes when the monitor
+ * subsystem is being turned off. User has to take special precautions
+ * to ensure all vCPUs have resumed before it is safe to turn it off.
+ */
+#define XEN_DOMCTL_MONITOR_OP_CONTROL_REGISTERS 4
 
 #define XEN_DOMCTL_MONITOR_EVENT_WRITE_CTRLREG         0
 #define XEN_DOMCTL_MONITOR_EVENT_MOV_TO_MSR            1
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jun 09 11:00:16 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Jun 2020 11: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 1jibzM-0001vb-KL; Tue, 09 Jun 2020 11:00:16 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=1bQd=7W=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jibzL-0001vS-0P
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 11:00:15 +0000
X-Inumbo-ID: 656f13b4-aa40-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 656f13b4-aa40-11ea-bb8b-bc764e2007e4;
 Tue, 09 Jun 2020 11: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=HR4Z3fhhJYwymWrxs/HX89/rOc9INYdiReDH+Z6FDOQ=; b=JtetyTBNh28rjcbyQ2r6W4CXpu
 DHhMO6dKUrY9eq5CJaNeM7pyJXA6IwWFNOXBcd8hY3ES0Cdf8fFCUeKLoci3tbyEQw8tmUOaBK8Ix
 EcF2zkt6dzy0701WIHkJgSeJH4f3SFopPlnEYRgrvNMrrJs3Ob8YTdWfgT4DISpYfQkc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jibzK-0004Uo-Bb
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 11:00:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jibzK-0004tC-Af
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 11:00:14 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/Intel: insert Ice Lake and Comet Lake model numbers
Message-Id: <E1jibzK-0004tC-Af@xenbits.xenproject.org>
Date: Tue, 09 Jun 2020 11: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 1fe406685cb19e9544681c6243e7d376deb0297e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jun 9 12:55:53 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jun 9 12:55:53 2020 +0200

    x86/Intel: insert Ice Lake and Comet Lake model numbers
    
    Both match prior generation processors as far as LBR and C-state MSRs
    go (SDM rev 072) as well as applicability of the if_pschange_mc erratum
    (recent spec updates).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/arch/x86/acpi/cpu_idle.c | 6 ++++++
 xen/arch/x86/hvm/vmx/vmx.c   | 8 ++++++++
 2 files changed, 14 insertions(+)

diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c
index a2248ea11f..27e0b52621 100644
--- a/xen/arch/x86/acpi/cpu_idle.c
+++ b/xen/arch/x86/acpi/cpu_idle.c
@@ -180,9 +180,15 @@ static void do_get_hw_residencies(void *arg)
     case 0x4E:
     case 0x55:
     case 0x5E:
+    /* Ice Lake */
+    case 0x7D:
+    case 0x7E:
     /* Kaby Lake */
     case 0x8E:
     case 0x9E:
+    /* Comet Lake */
+    case 0xA5:
+    case 0xA6:
         GET_PC2_RES(hw_res->pc2);
         GET_CC7_RES(hw_res->cc7);
         /* fall through */
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index b7d0c58214..ab19d9424e 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2438,8 +2438,12 @@ static bool __init has_if_pschange_mc(void)
     case 0x4e: /* Skylake M */
     case 0x5e: /* Skylake D */
     case 0x55: /* Skylake-X / Cascade Lake */
+    case 0x7d: /* Ice Lake */
+    case 0x7e: /* Ice Lake */
     case 0x8e: /* Kaby / Coffee / Whiskey Lake M */
     case 0x9e: /* Kaby / Coffee / Whiskey Lake D */
+    case 0xa5: /* Comet Lake H/S */
+    case 0xa6: /* Comet Lake U */
         return true;
 
         /*
@@ -2781,10 +2785,14 @@ static const struct lbr_info *last_branch_msr_get(void)
         case 0x66:
         /* Goldmont Plus */
         case 0x7a:
+        /* Ice Lake */
+        case 0x7d: case 0x7e:
         /* Tremont */
         case 0x86:
         /* Kaby Lake */
         case 0x8e: case 0x9e:
+        /* Comet Lake */
+        case 0xa5: case 0xa6:
             return sk_lbr;
         /* Atom */
         case 0x1c: case 0x26: case 0x27: case 0x35: case 0x36:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jun 09 11:00:26 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Jun 2020 11: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 1jibzW-0001x1-O1; Tue, 09 Jun 2020 11:00:26 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=1bQd=7W=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jibzV-0001wo-2z
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 11:00:25 +0000
X-Inumbo-ID: 6b6daba4-aa40-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 6b6daba4-aa40-11ea-bca7-bc764e2007e4;
 Tue, 09 Jun 2020 11:00: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=kvB1xlqipLrp9VdAEaeOdZiWeqseu8dL+4OuhFkoOOs=; b=DWBrSAg905rP9+Trn8L+lwQp6K
 lMHhtoHC4jkUq58VMo2/WxPX1dgD2YV8Nal+0HMc5AZhsIz//NazTvXpuZiOxCAU9lau02MngRvmB
 FyUtmMpuxLVV/Q9lyYc6Z3GqIK/2Tq+RkUGvyYnGTcxg1/EL9JCDyh8NZTY4OoQxrSrc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jibzU-0004V1-Eo
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 11:00:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jibzU-0004tt-Dh
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 11:00:24 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] ioreq: handle pending emulation racing with ioreq
 server destruction
Message-Id: <E1jibzU-0004tt-Dh@xenbits.xenproject.org>
Date: Tue, 09 Jun 2020 11:00: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 f7039ee41b3d3448775a1623f230037fd0455104
Author:     Paul Durrant <pdurrant@amazon.com>
AuthorDate: Tue Jun 9 12:56:24 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jun 9 12:56:24 2020 +0200

    ioreq: handle pending emulation racing with ioreq server destruction
    
    When an emulation request is initiated in hvm_send_ioreq() the guest vcpu is
    blocked on an event channel until that request is completed. If, however,
    the emulator is killed whilst that emulation is pending then the ioreq
    server may be destroyed. Thus when the vcpu is awoken the code in
    handle_hvm_io_completion() will find no pending request to wait for, but will
    leave the internal vcpu io_req.state set to IOREQ_READY and the vcpu shutdown
    deferall flag in place (because hvm_io_assist() will never be called). The
    emulation request is then completed anyway. This means that any subsequent call
    to hvmemul_do_io() will find an unexpected value in io_req.state and will
    return X86EMUL_UNHANDLEABLE, which in some cases will result in continuous
    re-tries.
    
    This patch fixes the issue by moving the setting of io_req.state and clearing
    of shutdown deferral (as will as MSI-X write completion) out of hvm_io_assist()
    and directly into handle_hvm_io_completion().
    
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Paul Durrant <pdurrant@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/arch/x86/hvm/ioreq.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/hvm/ioreq.c b/xen/arch/x86/hvm/ioreq.c
index c55c4bc4bc..724007016d 100644
--- a/xen/arch/x86/hvm/ioreq.c
+++ b/xen/arch/x86/hvm/ioreq.c
@@ -109,15 +109,7 @@ static void hvm_io_assist(struct hvm_ioreq_vcpu *sv, uint64_t data)
     ioreq_t *ioreq = &v->arch.hvm.hvm_io.io_req;
 
     if ( hvm_ioreq_needs_completion(ioreq) )
-    {
-        ioreq->state = STATE_IORESP_READY;
         ioreq->data = data;
-    }
-    else
-        ioreq->state = STATE_IOREQ_NONE;
-
-    msix_write_completion(v);
-    vcpu_end_shutdown_deferral(v);
 
     sv->pending = false;
 }
@@ -209,6 +201,12 @@ bool handle_hvm_io_completion(struct vcpu *v)
         }
     }
 
+    vio->io_req.state = hvm_ioreq_needs_completion(&vio->io_req) ?
+        STATE_IORESP_READY : STATE_IOREQ_NONE;
+
+    msix_write_completion(v);
+    vcpu_end_shutdown_deferral(v);
+
     io_completion = vio->io_completion;
     vio->io_completion = HVMIO_no_completion;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jun 09 13:11:12 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Jun 2020 13: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 1jie1z-0007G2-88; Tue, 09 Jun 2020 13: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=1bQd=7W=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jie1x-0007Fx-RA
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 13:11:05 +0000
X-Inumbo-ID: ac976cd4-aa52-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id ac976cd4-aa52-11ea-bb8b-bc764e2007e4;
 Tue, 09 Jun 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=L77BYE91Vj/YQk7KzEQkiE3bM438mlflooJNk/SS8Dk=; b=LGoiGmKB3EVKEg2VNiuFGzBYwk
 Q/k/RBNQoo5zV4ExyFyhn/klpC8BZnZIfBk1rT3uPC+bUjQi2gQnjy3I52HlwXw37RG6K9hID4TLl
 chIcGnbyi+UCR3JPQspHVx9LaYAsnGeoR6lQ6wEESNkgINS4wAjmB/4q4QgvKWM9tTR0=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jie1w-0007F3-Mx
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 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 1jie1w-0004Mj-M0
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 13:11:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] docs-parse-support-md: Prepare for coping with pandoc
 versions
Message-Id: <E1jie1w-0004Mj-M0@xenbits.xenproject.org>
Date: Tue, 09 Jun 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 31a714d54f902aa89f8934593fe90771ef02b727
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Tue Jun 9 12:21:48 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Tue Jun 9 14:05:49 2020 +0100

    docs-parse-support-md: Prepare for coping with pandoc versions
    
    Different pandoc versions generate, and expect, a different toplevel
    structure for their json output and inpout.  Newer pandoc's toplevel
    is a hash.  We are going to want to support this.  We can tell what
    kind of output we should produce by looking at the input we got (which
    itself came from pandoc).  So:
    
     * Make space for code to read toplevel objects which are not arrays.
       Currently this code is absent and we just die explicitly (rather
       than dying because we tried to use a hashref as an array ref).
    
     * Move generation of the toplevel json structure out of
       pandoc2html_inline, and abstract it away through a subref which is
       set up when we read the input file.
    
    This is just prep work.  No functional change other than a change to
    an error message.
    
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 docs/parse-support-md | 28 +++++++++++++++++++++-------
 1 file changed, 21 insertions(+), 7 deletions(-)

diff --git a/docs/parse-support-md b/docs/parse-support-md
index 84f0a96a0f..b9978bfb4d 100755
--- a/docs/parse-support-md
+++ b/docs/parse-support-md
@@ -232,6 +232,8 @@ sub r_content ($) {
     }
 }
 
+our $pandoc_toplevel_constructor;
+
 sub r_toplevel ($) {
     my ($i) = @_;
 
@@ -241,9 +243,21 @@ sub r_toplevel ($) {
     $had_unknown = undef;
     $had_feature = undef;
 
-    foreach my $e (@$i) {
-        next unless ref $e eq 'ARRAY';
-        r_content $e;
+    my $blocks;
+    if (ref $i eq 'ARRAY') {
+	$pandoc_toplevel_constructor = sub {
+	    my ($blocks) = @_;
+	    return [
+		    { unMeta => { } },
+		    $blocks,
+		   ];
+	};
+	foreach my $e (@$i) {
+	    next unless ref $e eq 'ARRAY';
+	    r_content $e;
+	}
+    } else {
+	die;
     }
 }
 
@@ -274,10 +288,10 @@ sub pandoc2html_inline ($) {
     my ($content) = @_;
 
     my $json_fh = IO::File::new_tmpfile or die $!;
-    my $j = to_json([
-                     { unMeta => { } },
-                     [{ t => 'Para', c => $content }],
-                    ]) or die $!;
+
+    my $blocks = [{ t => 'Para', c => $content }];
+    my $data = $pandoc_toplevel_constructor->($blocks);
+    my $j = to_json($data) or die $!;
     print $json_fh $j;
     flush $json_fh or die $!;
     seek $json_fh,0,0 or die $!;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jun 09 13:11:16 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Jun 2020 13: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 1jie28-0007Gf-9l; Tue, 09 Jun 2020 13:11:16 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=1bQd=7W=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jie27-0007GW-EG
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 13:11:15 +0000
X-Inumbo-ID: b29c0130-aa52-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id b29c0130-aa52-11ea-8496-bc764e2007e4;
 Tue, 09 Jun 2020 13: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=+24oGeYPil2s3693IQIeXDfuqsMatKFmyFs1L4wCrxE=; b=ujmSgs1YzLuvf40oIumjnChE7D
 Ynh1jjHUCXPCvV2PWlLEgTTNen+sxVrcC2iu0lYJVVhnzEzZvZeRzTeet5+K2OF5q2zxd7m6e2RNY
 5CtinFPHGuvKGZMqH5Bn6eozJmJPkkn+wjE78cMw/gfdaREqtAWdjHYfSjvCWBxeRP+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 1jie26-0007Fn-Q1
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 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 1jie26-0004NS-P7
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 13:11:14 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] docs-parse-support-md: Cope with buster's pandoc
Message-Id: <E1jie26-0004NS-P7@xenbits.xenproject.org>
Date: Tue, 09 Jun 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 1a58d8dab52f241d52fec1d992d859b9632c4739
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Tue Jun 9 12:26:36 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Tue Jun 9 14:05:49 2020 +0100

    docs-parse-support-md: Cope with buster's pandoc
    
    Provide the implementation for newer pandoc json.
    
    I have done an adhoc test and this now works on both buster and
    stretch and seems to produce the expected support matrix when run
    using the example rune (which processes unstable and 4.11).
    
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 docs/parse-support-md | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/docs/parse-support-md b/docs/parse-support-md
index b9978bfb4d..a397637639 100755
--- a/docs/parse-support-md
+++ b/docs/parse-support-md
@@ -243,6 +243,15 @@ sub r_toplevel ($) {
     $had_unknown = undef;
     $had_feature = undef;
 
+    # Pandoc's JSON output changed some time between 1.17.2 (stretch)
+    # and 2.2.1 (buster).  I can find no documentation about this
+    # change or about the compatibility rules.  (It seems that
+    # processing the parse tree *is* supported upstream: they offer
+    # many libraries to do this inside the pandoc process.)
+    # Empirically, what has changed is just the top level structure.
+    # Also pandoc wants the same structure back that it spat out,
+    # when we ask it to format snippets.
+
     my $blocks;
     if (ref $i eq 'ARRAY') {
 	$pandoc_toplevel_constructor = sub {
@@ -256,6 +265,17 @@ sub r_toplevel ($) {
 	    next unless ref $e eq 'ARRAY';
 	    r_content $e;
 	}
+    } elsif (ref $i eq 'HASH') {
+	my $api_version = $i->{'pandoc-api-version'};
+	$pandoc_toplevel_constructor = sub {
+	    my ($blocks) = @_;
+	    return {
+		    blocks => $blocks,
+		    meta => { },
+		    'pandoc-api-version' => $api_version,
+		   };
+	};
+	r_content $i->{blocks};
     } else {
 	die;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jun 09 15:44:10 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Jun 2020 15:44: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 1jigQ3-0005DY-0p; Tue, 09 Jun 2020 15:44: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=1bQd=7W=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jigQ2-0005DT-4C
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 15:44:06 +0000
X-Inumbo-ID: 0c903f48-aa68-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 0c903f48-aa68-11ea-bb8b-bc764e2007e4;
 Tue, 09 Jun 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=2fyYE3Dty9IONcmcXBsUv7TwooZ/wK3B+2o2s1IG9lQ=; b=gvytQkucUbLfreCidauCo2jHMs
 K7rqnID86UHxZQC9asgv9X2gEyFXmOnrDItLZihQ0ukNOrT5qvjaIcSyUTqSymHF7B1juR68iuJJu
 xA73G9UW5QRQpHOZanuKhKz51iXarCZDjanSfz3xYJX9nbOiyvjdb+Jy7hmRDM+0DnCc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jigQ1-000234-55
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 15:44:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jigQ1-0005gC-41
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 15:44:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] tools: fix error path of xenhypfs_open()
Message-Id: <E1jigQ1-0005gC-41@xenbits.xenproject.org>
Date: Tue, 09 Jun 2020 15:44: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 30a72f028707d8cdc7951b50268e33818497596e
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Jun 9 16:48:49 2020 +0200
Commit:     Wei Liu <wl@xen.org>
CommitDate: Tue Jun 9 15:35:15 2020 +0000

    tools: fix error path of xenhypfs_open()
    
    In case of an error in xenhypfs_open() the error path will cause a
    segmentation fault due to a wrong sequence of closing calls.
    
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Fixes: 86234eafb9529 ("libs: add libxenhypfs")
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    Release-acked-by: Paul Durrant <paul@xen.org>
    Acked-by: Wei Liu <wl@xen.org>
---
 tools/libs/hypfs/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libs/hypfs/core.c b/tools/libs/hypfs/core.c
index c91e165705..fc23b02586 100644
--- a/tools/libs/hypfs/core.c
+++ b/tools/libs/hypfs/core.c
@@ -74,8 +74,8 @@ xenhypfs_handle *xenhypfs_open(xentoollog_logger *logger,
     return fshdl;
 
 err:
-    xtl_logger_destroy(fshdl->logger_tofree);
     xencall_close(fshdl->xcall);
+    xtl_logger_destroy(fshdl->logger_tofree);
     free(fshdl);
     return NULL;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jun 09 15:44:18 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Jun 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 1jigQE-0005ED-2S; Tue, 09 Jun 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=1bQd=7W=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jigQC-0005E6-K5
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 15:44:16 +0000
X-Inumbo-ID: 129859ac-aa68-11ea-b336-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 129859ac-aa68-11ea-b336-12813bfff9fa;
 Tue, 09 Jun 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=mLr7OND+lByOvqH9XHGabjtY0WJqkCZqoPO1EIJKgEU=; b=RC6qk5+69pdUvq24Ps+4y0fP1w
 kGF+xb0RcUEQDZigE/n7rv2x4q3QZp493kHj0seDbrE/5qM7E5uNrlRwikayya8/lLR0Scd5s33js
 eyTomN1fDqMIw88rsb0rvZ4enL4KGgK5/ISNOilhhCGaeVoEG9rTCPTxYIyvcx4vPz6w=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jigQB-00023E-8G
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 15:44:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jigQB-0005gj-7E
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 15:44:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] tools: fix setting of errno in xenhypfs_read_raw()
Message-Id: <E1jigQB-0005gj-7E@xenbits.xenproject.org>
Date: Tue, 09 Jun 2020 15: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 058023b343d4e366864831db46e9b438e9e3a178
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Jun 9 16:48:50 2020 +0200
Commit:     Wei Liu <wl@xen.org>
CommitDate: Tue Jun 9 15:36:44 2020 +0000

    tools: fix setting of errno in xenhypfs_read_raw()
    
    Setting of errno is wrong in xenhypfs_read_raw(), fix it.
    
    Reported-by: George Dunlap <george.dunlap@citrix.com>
    Fixes: 86234eafb9529 ("libs: add libxenhypfs")
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    Release-acked-by: Paul Durrant <paul@xen.org>
    Acked-by: Wei Liu <wl@xen.org>
---
 tools/libs/hypfs/core.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/tools/libs/hypfs/core.c b/tools/libs/hypfs/core.c
index fc23b02586..f94c5ea1e2 100644
--- a/tools/libs/hypfs/core.c
+++ b/tools/libs/hypfs/core.c
@@ -241,10 +241,8 @@ void *xenhypfs_read_raw(xenhypfs_handle *fshdl, const char *path,
         if (!ret)
             break;
 
-        if (ret != ENOBUFS) {
-            errno = -ret;
+        if (errno != ENOBUFS)
             goto out;
-        }
     }
 
     content = malloc(entry->content_len);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jun 09 17:11:11 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Jun 2020 17: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 1jihmF-00073d-W5; Tue, 09 Jun 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=1bQd=7W=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jihmE-00073X-Ip
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 17:11:06 +0000
X-Inumbo-ID: 341b9ccc-aa74-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 341b9ccc-aa74-11ea-bca7-bc764e2007e4;
 Tue, 09 Jun 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=fRodw3BIbUmKv6L4OOvhjP8r/t2emzfDF2tLs8ppkK0=; b=TFuv4ewD/17dGHGJha7vy86zwX
 z2q1c/csUWDAT7A7r8sJiovx+IEYJuXNqfh43TGWPk4vJIZMNlqPfM4o0IUJbhC+J01qRIeAWIZSB
 8VdqtBOfCxVoZ/StiDcdBC10HClmmOVHN7Vno82p497ebpcrFf4Rp9P5+MASG+cC4uIU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jihmD-0004RV-E9
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 17:11:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jihmD-0002gD-Cw
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 17:11:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/spec-ctrl: CPUID/MSR definitions for Special
 Register Buffer Data Sampling
Message-Id: <E1jihmD-0002gD-Cw@xenbits.xenproject.org>
Date: Tue, 09 Jun 2020 17:11: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 caab85ab58c0cdf74ab070a5de5c4df89f509ff3
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 8 19:47:46 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jun 9 17:42:18 2020 +0100

    x86/spec-ctrl: CPUID/MSR definitions for Special Register Buffer Data Sampling
    
    This is part of XSA-320 / CVE-2020-0543
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Wei Liu <wl@xen.org>
---
 docs/misc/xen-command-line.pandoc           | 8 ++++----
 tools/libxl/libxl_cpuid.c                   | 1 +
 tools/misc/xen-cpuid.c                      | 1 +
 xen/arch/x86/msr.c                          | 2 ++
 xen/arch/x86/spec_ctrl.c                    | 3 ++-
 xen/include/asm-x86/msr-index.h             | 3 +++
 xen/include/public/arch-x86/cpufeatureset.h | 1 +
 7 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 2d4d9639d6..b7c2b99298 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -504,10 +504,10 @@ accounting for hardware capabilities as enumerated via CPUID.
 
 Currently accepted:
 
-The Speculation Control hardware features `md-clear`, `ibrsb`, `stibp`, `ibpb`,
-`l1d-flush` and `ssbd` are used by default if available and applicable.  They can
-be ignored, e.g. `no-ibrsb`, at which point Xen won't use them itself, and
-won't offer them to guests.
+The Speculation Control hardware features `srbds-ctrl`, `md-clear`, `ibrsb`,
+`stibp`, `ibpb`, `l1d-flush` and `ssbd` are used by default if available and
+applicable.  They can be ignored, e.g. `no-ibrsb`, at which point Xen won't
+use them itself, and won't offer them to guests.
 
 `rdrand` can be used to override the default disabling of the feature on certain
 AMD systems.  Its negative form can of course also be used to suppress use and
diff --git a/tools/libxl/libxl_cpuid.c b/tools/libxl/libxl_cpuid.c
index c31dd1f304..4e4852ddeb 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},
+        {"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},
         {"cet-ibt",      0x00000007,  0, CPUID_REG_EDX, 20,  1},
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index 8578077545..8d8f3532a2 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -160,6 +160,7 @@ static const char *const str_7d0[32] =
     [ 2] = "avx512_4vnniw", [ 3] = "avx512_4fmaps",
     [ 4] = "fsrm",
 
+    /*  8 */                [ 9] = "srbds-ctrl",
     [10] = "md-clear",
     /* 12 */                [13] = "tsx-force-abort",
     [14] = "serialize",
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index dcacae58de..0bfb5839b2 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -167,6 +167,7 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
     case MSR_CORE_CAPABILITIES:
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
+    case MSR_MCU_OPT_CTRL:
     case MSR_U_CET:
     case MSR_S_CET:
     case MSR_PL0_SSP ... MSR_INTERRUPT_SSP_TABLE:
@@ -327,6 +328,7 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
     case MSR_TEST_CTRL:
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
+    case MSR_MCU_OPT_CTRL:
     case MSR_U_CET:
     case MSR_S_CET:
     case MSR_PL0_SSP ... MSR_INTERRUPT_SSP_TABLE:
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index a94be2d594..a5dfff80c5 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -312,12 +312,13 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
     printk("Speculative mitigation facilities:\n");
 
     /* Hardware features which pertain to speculative mitigations. */
-    printk("  Hardware features:%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
+    printk("  Hardware features:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
            (_7d0 & cpufeat_mask(X86_FEATURE_IBRSB)) ? " IBRS/IBPB" : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_STIBP)) ? " STIBP"     : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_L1D_FLUSH)) ? " L1D_FLUSH" : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_SSBD))  ? " SSBD"      : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_MD_CLEAR)) ? " MD_CLEAR" : "",
+           (_7d0 & cpufeat_mask(X86_FEATURE_SRBDS_CTRL)) ? " SRBDS_CTRL" : "",
            (e8b  & cpufeat_mask(X86_FEATURE_IBPB))  ? " IBPB"      : "",
            (caps & ARCH_CAPS_IBRS_ALL)              ? " IBRS_ALL"  : "",
            (caps & ARCH_CAPS_RDCL_NO)               ? " RDCL_NO"   : "",
diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h
index a4dc48f51f..b328a47ed8 100644
--- a/xen/include/asm-x86/msr-index.h
+++ b/xen/include/asm-x86/msr-index.h
@@ -66,6 +66,9 @@
 #define  TSX_CTRL_RTM_DISABLE               (_AC(1, ULL) <<  0)
 #define  TSX_CTRL_CPUID_CLEAR               (_AC(1, ULL) <<  1)
 
+#define MSR_MCU_OPT_CTRL                    0x00000123
+#define  MCU_OPT_CTRL_RNGDS_MITG_DIS        (_AC(1, ULL) <<  0)
+
 #define MSR_U_CET                           0x000006a0
 #define MSR_S_CET                           0x000006a2
 #define  CET_SHSTK_EN                       (_AC(1, ULL) <<  0)
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 8347a405ac..5ca35d9d97 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(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 */
 XEN_CPUFEATURE(SERIALIZE,     9*32+14) /*a  SERIALIZE insn */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jun 09 17:11:18 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Jun 2020 17: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 1jihmQ-00074O-1M; Tue, 09 Jun 2020 17: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=1bQd=7W=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jihmO-00074G-Hi
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 17:11:16 +0000
X-Inumbo-ID: 3a1e329c-aa74-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 3a1e329c-aa74-11ea-b7bb-bc764e2007e4;
 Tue, 09 Jun 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=Ec2YO7NqDtw21GSLl+/eNBR8H/WpHCxZwU4OjM7SuL4=; b=i1JG75SuxI15MvjiF6YBbnu/cm
 Uni/IfYdZ/lpVTFg4CpQ8pcjKAGBJHQVwVTsQcZIaVPM5buby0Zvuu7/33wKsw79BJlVTV5/vFzHV
 cRER5Y/tw/UyR7Ms7GEXNtBovwmgyJs9GDbl/jq8W6jTe5UffXqy5V/a/XchUeBPyqeE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jihmN-0004Rb-Hh
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 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 1jihmN-0002h1-Gj
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 17:11:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/spec-ctrl: Mitigate the Special Register Buffer
 Data Sampling sidechannel
Message-Id: <E1jihmN-0002h1-Gj@xenbits.xenproject.org>
Date: Tue, 09 Jun 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 6a49b9a7920c82015381740905582b666160d955
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 8 19:47:46 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jun 9 17:42:18 2020 +0100

    x86/spec-ctrl: Mitigate the Special Register Buffer Data Sampling sidechannel
    
    See patch documentation and comments.
    
    This is part of XSA-320 / CVE-2020-0543
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 docs/misc/xen-command-line.pandoc |  8 +++++++-
 xen/arch/x86/acpi/power.c         |  3 +++
 xen/arch/x86/smpboot.c            |  8 +++++---
 xen/arch/x86/spec_ctrl.c          | 41 ++++++++++++++++++++++++++++++++++++++-
 xen/include/asm-x86/spec_ctrl.h   |  2 ++
 5 files changed, 57 insertions(+), 5 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index b7c2b99298..1a69c60139 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -2048,7 +2048,7 @@ By default SSBD will be mitigated at runtime (i.e `ssbd=runtime`).
 ### spec-ctrl (x86)
 > `= List of [ <bool>, xen=<bool>, {pv,hvm,msr-sc,rsb,md-clear}=<bool>,
 >              bti-thunk=retpoline|lfence|jmp, {ibrs,ibpb,ssbd,eager-fpu,
->              l1d-flush,branch-harden}=<bool> ]`
+>              l1d-flush,branch-harden,srb-lock}=<bool> ]`
 
 Controls for speculative execution sidechannel mitigations.  By default, Xen
 will pick the most appropriate mitigations based on compiled in support,
@@ -2125,6 +2125,12 @@ If Xen is compiled with `CONFIG_SPECULATIVE_HARDEN_BRANCH`, the
 speculation barriers to protect selected conditional branches.  By default,
 Xen will enable this mitigation.
 
+On hardware supporting SRBDS_CTRL, the `srb-lock=` option can be used to force
+or prevent Xen from protect the Special Register Buffer from leaking stale
+data. By default, Xen will enable this mitigation, except on parts where MDS
+is fixed and TAA is fixed/mitigated (in which case, there is believed to be no
+way for an attacker to obtain the stale data).
+
 ### sync_console
 > `= <boolean>`
 
diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
index dfffe08e18..4fb1e7a148 100644
--- a/xen/arch/x86/acpi/power.c
+++ b/xen/arch/x86/acpi/power.c
@@ -296,6 +296,9 @@ static int enter_state(u32 state)
     ci->spec_ctrl_flags |= (default_spec_ctrl_flags & SCF_ist_wrmsr);
     spec_ctrl_exit_idle(ci);
 
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+        wrmsrl(MSR_MCU_OPT_CTRL, default_xen_mcu_opt_ctrl);
+
     /* (re)initialise SYSCALL/SYSENTER state, amongst other things. */
     percpu_traps_init();
 
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index f878a00760..5708573c41 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -372,12 +372,14 @@ void start_secondary(void *unused)
     microcode_update_one();
 
     /*
-     * If MSR_SPEC_CTRL is available, apply Xen's default setting and discard
-     * any firmware settings.  Note: MSR_SPEC_CTRL may only become available
-     * after loading microcode.
+     * If any speculative control MSRs are available, apply Xen's default
+     * settings.  Note: These MSRs may only become available after loading
+     * microcode.
      */
     if ( boot_cpu_has(X86_FEATURE_IBRSB) )
         wrmsrl(MSR_SPEC_CTRL, default_xen_spec_ctrl);
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+        wrmsrl(MSR_MCU_OPT_CTRL, default_xen_mcu_opt_ctrl);
 
     tsx_init(); /* Needs microcode.  May change HLE/RTM feature bits. */
 
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index a5dfff80c5..c9f78ead62 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -65,6 +65,9 @@ static unsigned int __initdata l1d_maxphysaddr;
 static bool __initdata cpu_has_bug_msbds_only; /* => minimal HT impact. */
 static bool __initdata cpu_has_bug_mds; /* Any other M{LP,SB,FB}DS combination. */
 
+static int8_t __initdata opt_srb_lock = -1;
+uint64_t __read_mostly default_xen_mcu_opt_ctrl;
+
 static int __init parse_spec_ctrl(const char *s)
 {
     const char *ss;
@@ -112,6 +115,7 @@ static int __init parse_spec_ctrl(const char *s)
             opt_ssbd = false;
             opt_l1d_flush = 0;
             opt_branch_harden = false;
+            opt_srb_lock = 0;
         }
         else if ( val > 0 )
             rc = -EINVAL;
@@ -178,6 +182,8 @@ static int __init parse_spec_ctrl(const char *s)
             opt_l1d_flush = val;
         else if ( (val = parse_boolean("branch-harden", s, ss)) >= 0 )
             opt_branch_harden = val;
+        else if ( (val = parse_boolean("srb-lock", s, ss)) >= 0 )
+            opt_srb_lock = val;
         else
             rc = -EINVAL;
 
@@ -341,7 +347,7 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
                "\n");
 
     /* Settings for Xen's protection, irrespective of guests. */
-    printk("  Xen settings: BTI-Thunk %s, SPEC_CTRL: %s%s%s, Other:%s%s%s%s\n",
+    printk("  Xen settings: BTI-Thunk %s, SPEC_CTRL: %s%s%s, Other:%s%s%s%s%s\n",
            thunk == THUNK_NONE      ? "N/A" :
            thunk == THUNK_RETPOLINE ? "RETPOLINE" :
            thunk == THUNK_LFENCE    ? "LFENCE" :
@@ -352,6 +358,8 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
            (default_xen_spec_ctrl & SPEC_CTRL_SSBD)  ? " SSBD+" : " SSBD-",
            !(caps & ARCH_CAPS_TSX_CTRL)              ? "" :
            (opt_tsx & 1)                             ? " TSX+" : " TSX-",
+           !boot_cpu_has(X86_FEATURE_SRBDS_CTRL)     ? "" :
+           opt_srb_lock                              ? " SRB_LOCK+" : " SRB_LOCK-",
            opt_ibpb                                  ? " IBPB"  : "",
            opt_l1d_flush                             ? " L1D_FLUSH" : "",
            opt_md_clear_pv || opt_md_clear_hvm       ? " VERW"  : "",
@@ -1157,6 +1165,34 @@ void __init init_speculation_mitigations(void)
         tsx_init();
     }
 
+    /* Calculate suitable defaults for MSR_MCU_OPT_CTRL */
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+    {
+        uint64_t val;
+
+        rdmsrl(MSR_MCU_OPT_CTRL, val);
+
+        /*
+         * On some SRBDS-affected hardware, it may be safe to relax srb-lock
+         * by default.
+         *
+         * On parts which enumerate MDS_NO and not TAA_NO, TSX is the only way
+         * to access the Fill Buffer.  If TSX isn't available (inc. SKU
+         * reasons on some models), or TSX is explicitly disabled, then there
+         * is no need for the extra overhead to protect RDRAND/RDSEED.
+         */
+        if ( opt_srb_lock == -1 &&
+             (caps & (ARCH_CAPS_MDS_NO|ARCH_CAPS_TAA_NO)) == ARCH_CAPS_MDS_NO &&
+             (!cpu_has_hle || ((caps & ARCH_CAPS_TSX_CTRL) && opt_tsx == 0)) )
+            opt_srb_lock = 0;
+
+        val &= ~MCU_OPT_CTRL_RNGDS_MITG_DIS;
+        if ( !opt_srb_lock )
+            val |= MCU_OPT_CTRL_RNGDS_MITG_DIS;
+
+        default_xen_mcu_opt_ctrl = val;
+    }
+
     print_details(thunk, caps);
 
     /*
@@ -1188,6 +1224,9 @@ void __init init_speculation_mitigations(void)
 
         wrmsrl(MSR_SPEC_CTRL, bsp_delay_spec_ctrl ? 0 : default_xen_spec_ctrl);
     }
+
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+        wrmsrl(MSR_MCU_OPT_CTRL, default_xen_mcu_opt_ctrl);
 }
 
 static void __init __maybe_unused build_assertions(void)
diff --git a/xen/include/asm-x86/spec_ctrl.h b/xen/include/asm-x86/spec_ctrl.h
index 9caecddfec..b252bb8631 100644
--- a/xen/include/asm-x86/spec_ctrl.h
+++ b/xen/include/asm-x86/spec_ctrl.h
@@ -54,6 +54,8 @@ extern int8_t opt_pv_l1tf_hwdom, opt_pv_l1tf_domu;
  */
 extern paddr_t l1tf_addr_mask, l1tf_safe_maddr;
 
+extern uint64_t default_xen_mcu_opt_ctrl;
+
 static inline void init_shadow_spec_ctrl_state(void)
 {
     struct cpu_info *info = get_cpu_info();
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jun 09 17:11:28 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Jun 2020 17:11: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 1jihma-00075k-4F; Tue, 09 Jun 2020 17:11: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=1bQd=7W=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jihmZ-00075b-6u
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 17:11:27 +0000
X-Inumbo-ID: 408d9a50-aa74-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 408d9a50-aa74-11ea-bca7-bc764e2007e4;
 Tue, 09 Jun 2020 17:11:26 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=iokLxBVtyUL1COzGWDVj8X51v7/gWdhNhantf7BiUFA=; b=cw48M6FlpdvAZCkJI4asOgq6C/
 fWUo0eSEGTx4li7u648JUmRM9+vSdL7v8fBfjcIz3QkpWrNs4Tlmpu0xKE1N5fQ1O1WgYwg5eBkO4
 h1trjK9HW1mYWUEObW5+51FcTQ+111T/pjwFXYgqSa6+ioNuiTtl2RCMct5EXzGIkKnw=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jihmY-0004SP-B5
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 17:11:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jihmY-0002ic-A6
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 17:11:26 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] x86/spec-ctrl: CPUID/MSR definitions for Special
 Register Buffer Data Sampling
Message-Id: <E1jihmY-0002ic-A6@xenbits.xenproject.org>
Date: Tue, 09 Jun 2020 17:11: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 9aefa01f458960fe9e2ccbdc79f8d9fba3d06611
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 8 19:47:46 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jun 9 17:44:54 2020 +0100

    x86/spec-ctrl: CPUID/MSR definitions for Special Register Buffer Data Sampling
    
    This is part of XSA-320 / CVE-2020-0543
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Wei Liu <wl@xen.org>
    (cherry picked from commit caab85ab58c0cdf74ab070a5de5c4df89f509ff3)
---
 docs/misc/xen-command-line.pandoc           | 8 ++++----
 tools/libxl/libxl_cpuid.c                   | 1 +
 tools/misc/xen-cpuid.c                      | 1 +
 xen/arch/x86/msr.c                          | 2 ++
 xen/arch/x86/spec_ctrl.c                    | 3 ++-
 xen/include/asm-x86/msr-index.h             | 3 +++
 xen/include/public/arch-x86/cpufeatureset.h | 1 +
 7 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 1d9d816622..9268454297 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -483,10 +483,10 @@ accounting for hardware capabilities as enumerated via CPUID.
 
 Currently accepted:
 
-The Speculation Control hardware features `md-clear`, `ibrsb`, `stibp`, `ibpb`,
-`l1d-flush` and `ssbd` are used by default if available and applicable.  They can
-be ignored, e.g. `no-ibrsb`, at which point Xen won't use them itself, and
-won't offer them to guests.
+The Speculation Control hardware features `srbds-ctrl`, `md-clear`, `ibrsb`,
+`stibp`, `ibpb`, `l1d-flush` and `ssbd` are used by default if available and
+applicable.  They can be ignored, e.g. `no-ibrsb`, at which point Xen won't
+use them itself, and won't offer them to guests.
 
 ### cpuid_mask_cpu
 > `= fam_0f_rev_[cdefg] | fam_10_rev_[bc] | fam_11_rev_b`
diff --git a/tools/libxl/libxl_cpuid.c b/tools/libxl/libxl_cpuid.c
index 6cea4227ba..a78f08b927 100644
--- a/tools/libxl/libxl_cpuid.c
+++ b/tools/libxl/libxl_cpuid.c
@@ -213,6 +213,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},
+        {"srbds-ctrl",   0x00000007,  0, CPUID_REG_EDX,  9,  1},
         {"md-clear",     0x00000007,  0, CPUID_REG_EDX, 10,  1},
         {"cet-ibt",      0x00000007,  0, CPUID_REG_EDX, 20,  1},
         {"ibrsb",        0x00000007,  0, CPUID_REG_EDX, 26,  1},
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index 603e1d65fd..a09440813b 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -157,6 +157,7 @@ static const char *const str_7d0[32] =
     [ 2] = "avx512_4vnniw", [ 3] = "avx512_4fmaps",
     [ 4] = "fsrm",
 
+    /*  8 */                [ 9] = "srbds-ctrl",
     [10] = "md-clear",
     /* 12 */                [13] = "tsx-force-abort",
 
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 4b12103482..0cded3c0ad 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -134,6 +134,7 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
         /* Write-only */
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
+    case MSR_MCU_OPT_CTRL:
     case MSR_U_CET:
     case MSR_S_CET:
     case MSR_PL0_SSP ... MSR_INTERRUPT_SSP_TABLE:
@@ -288,6 +289,7 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
         /* Read-only */
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
+    case MSR_MCU_OPT_CTRL:
     case MSR_U_CET:
     case MSR_S_CET:
     case MSR_PL0_SSP ... MSR_INTERRUPT_SSP_TABLE:
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index 6656c44aec..5fc1c6827e 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -312,12 +312,13 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
     printk("Speculative mitigation facilities:\n");
 
     /* Hardware features which pertain to speculative mitigations. */
-    printk("  Hardware features:%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
+    printk("  Hardware features:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
            (_7d0 & cpufeat_mask(X86_FEATURE_IBRSB)) ? " IBRS/IBPB" : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_STIBP)) ? " STIBP"     : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_L1D_FLUSH)) ? " L1D_FLUSH" : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_SSBD))  ? " SSBD"      : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_MD_CLEAR)) ? " MD_CLEAR" : "",
+           (_7d0 & cpufeat_mask(X86_FEATURE_SRBDS_CTRL)) ? " SRBDS_CTRL" : "",
            (e8b  & cpufeat_mask(X86_FEATURE_IBPB))  ? " IBPB"      : "",
            (caps & ARCH_CAPS_IBRS_ALL)              ? " IBRS_ALL"  : "",
            (caps & ARCH_CAPS_RDCL_NO)               ? " RDCL_NO"   : "",
diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h
index 7693c4a71a..91994669e1 100644
--- a/xen/include/asm-x86/msr-index.h
+++ b/xen/include/asm-x86/msr-index.h
@@ -179,6 +179,9 @@
 #define MSR_IA32_VMX_TRUE_ENTRY_CTLS            0x490
 #define MSR_IA32_VMX_VMFUNC                     0x491
 
+#define MSR_MCU_OPT_CTRL                    0x00000123
+#define  MCU_OPT_CTRL_RNGDS_MITG_DIS        (_AC(1, ULL) <<  0)
+
 #define MSR_U_CET                           0x000006a0
 #define MSR_S_CET                           0x000006a2
 #define MSR_PL0_SSP                         0x000006a4
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 2835688f1c..a2482c3627 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -252,6 +252,7 @@ XEN_CPUFEATURE(IBPB,          8*32+12) /*A  IBPB support only (no IBRS, used by
 /* 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(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 */
 XEN_CPUFEATURE(CET_IBT,       9*32+20) /*   CET - Indirect Branch Tracking */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Jun 09 17:11:39 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Jun 2020 17:11: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 1jihml-00076u-67; Tue, 09 Jun 2020 17:11:39 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=1bQd=7W=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jihmj-00076f-Lv
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 17:11:37 +0000
X-Inumbo-ID: 4694d666-aa74-11ea-b345-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 4694d666-aa74-11ea-b345-12813bfff9fa;
 Tue, 09 Jun 2020 17:11:36 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=ZL4+8LJiLXansjn7ZAfq8PwLO6BExpAxutQowwEP0SQ=; b=c+pUX6QOFDdFMfpc2A4mxDsu21
 d3TdETwHzmzVQXWXe8BXBnpEyRcj+KdVJiswuCxa8mni16JGSXTlBwOi9dp9+q0f4I/51TapZRtCM
 amry0Dll8adBy0Ihu8KmR77toP1UxR11nMd/ud3QSduj7vctj306n2QSUO3zfzoSjGF0=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jihmi-0004SX-EW
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 17:11:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jihmi-0002jJ-Db
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 17:11:36 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] x86/spec-ctrl: Mitigate the Special Register
 Buffer Data Sampling sidechannel
Message-Id: <E1jihmi-0002jJ-Db@xenbits.xenproject.org>
Date: Tue, 09 Jun 2020 17:11: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 67958a166f6b019e5ad8dcd60a96dcd262669092
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 8 19:47:46 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jun 9 17:45:02 2020 +0100

    x86/spec-ctrl: Mitigate the Special Register Buffer Data Sampling sidechannel
    
    See patch documentation and comments.
    
    This is part of XSA-320 / CVE-2020-0543
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 6a49b9a7920c82015381740905582b666160d955)
---
 docs/misc/xen-command-line.pandoc |  8 +++++++-
 xen/arch/x86/acpi/power.c         |  3 +++
 xen/arch/x86/smpboot.c            |  8 +++++---
 xen/arch/x86/spec_ctrl.c          | 41 ++++++++++++++++++++++++++++++++++++++-
 xen/include/asm-x86/spec_ctrl.h   |  2 ++
 5 files changed, 57 insertions(+), 5 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 9268454297..c780312531 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -1991,7 +1991,7 @@ By default SSBD will be mitigated at runtime (i.e `ssbd=runtime`).
 ### spec-ctrl (x86)
 > `= List of [ <bool>, xen=<bool>, {pv,hvm,msr-sc,rsb,md-clear}=<bool>,
 >              bti-thunk=retpoline|lfence|jmp, {ibrs,ibpb,ssbd,eager-fpu,
->              l1d-flush,branch-harden}=<bool> ]`
+>              l1d-flush,branch-harden,srb-lock}=<bool> ]`
 
 Controls for speculative execution sidechannel mitigations.  By default, Xen
 will pick the most appropriate mitigations based on compiled in support,
@@ -2068,6 +2068,12 @@ If Xen is compiled with `CONFIG_SPECULATIVE_HARDEN_BRANCH`, the
 speculation barriers to protect selected conditional branches.  By default,
 Xen will enable this mitigation.
 
+On hardware supporting SRBDS_CTRL, the `srb-lock=` option can be used to force
+or prevent Xen from protect the Special Register Buffer from leaking stale
+data. By default, Xen will enable this mitigation, except on parts where MDS
+is fixed and TAA is fixed/mitigated (in which case, there is believed to be no
+way for an attacker to obtain the stale data).
+
 ### sync_console
 > `= <boolean>`
 
diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
index feb0f6ce20..75c6e34164 100644
--- a/xen/arch/x86/acpi/power.c
+++ b/xen/arch/x86/acpi/power.c
@@ -295,6 +295,9 @@ static int enter_state(u32 state)
     ci->spec_ctrl_flags |= (default_spec_ctrl_flags & SCF_ist_wrmsr);
     spec_ctrl_exit_idle(ci);
 
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+        wrmsrl(MSR_MCU_OPT_CTRL, default_xen_mcu_opt_ctrl);
+
  done:
     spin_debug_enable();
     local_irq_restore(flags);
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index dc8fdac1a1..b1e51b3aff 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -361,12 +361,14 @@ void start_secondary(void *unused)
     microcode_update_one(false);
 
     /*
-     * If MSR_SPEC_CTRL is available, apply Xen's default setting and discard
-     * any firmware settings.  Note: MSR_SPEC_CTRL may only become available
-     * after loading microcode.
+     * If any speculative control MSRs are available, apply Xen's default
+     * settings.  Note: These MSRs may only become available after loading
+     * microcode.
      */
     if ( boot_cpu_has(X86_FEATURE_IBRSB) )
         wrmsrl(MSR_SPEC_CTRL, default_xen_spec_ctrl);
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+        wrmsrl(MSR_MCU_OPT_CTRL, default_xen_mcu_opt_ctrl);
 
     tsx_init(); /* Needs microcode.  May change HLE/RTM feature bits. */
 
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index 5fc1c6827e..33343062a7 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -65,6 +65,9 @@ static unsigned int __initdata l1d_maxphysaddr;
 static bool __initdata cpu_has_bug_msbds_only; /* => minimal HT impact. */
 static bool __initdata cpu_has_bug_mds; /* Any other M{LP,SB,FB}DS combination. */
 
+static int8_t __initdata opt_srb_lock = -1;
+uint64_t __read_mostly default_xen_mcu_opt_ctrl;
+
 static int __init parse_spec_ctrl(const char *s)
 {
     const char *ss;
@@ -112,6 +115,7 @@ static int __init parse_spec_ctrl(const char *s)
             opt_ssbd = false;
             opt_l1d_flush = 0;
             opt_branch_harden = false;
+            opt_srb_lock = 0;
         }
         else if ( val > 0 )
             rc = -EINVAL;
@@ -178,6 +182,8 @@ static int __init parse_spec_ctrl(const char *s)
             opt_l1d_flush = val;
         else if ( (val = parse_boolean("branch-harden", s, ss)) >= 0 )
             opt_branch_harden = val;
+        else if ( (val = parse_boolean("srb-lock", s, ss)) >= 0 )
+            opt_srb_lock = val;
         else
             rc = -EINVAL;
 
@@ -341,7 +347,7 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
                "\n");
 
     /* Settings for Xen's protection, irrespective of guests. */
-    printk("  Xen settings: BTI-Thunk %s, SPEC_CTRL: %s%s%s, Other:%s%s%s%s\n",
+    printk("  Xen settings: BTI-Thunk %s, SPEC_CTRL: %s%s%s, Other:%s%s%s%s%s\n",
            thunk == THUNK_NONE      ? "N/A" :
            thunk == THUNK_RETPOLINE ? "RETPOLINE" :
            thunk == THUNK_LFENCE    ? "LFENCE" :
@@ -352,6 +358,8 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
            (default_xen_spec_ctrl & SPEC_CTRL_SSBD)  ? " SSBD+" : " SSBD-",
            !(caps & ARCH_CAPS_TSX_CTRL)              ? "" :
            (opt_tsx & 1)                             ? " TSX+" : " TSX-",
+           !boot_cpu_has(X86_FEATURE_SRBDS_CTRL)     ? "" :
+           opt_srb_lock                              ? " SRB_LOCK+" : " SRB_LOCK-",
            opt_ibpb                                  ? " IBPB"  : "",
            opt_l1d_flush                             ? " L1D_FLUSH" : "",
            opt_md_clear_pv || opt_md_clear_hvm       ? " VERW"  : "",
@@ -1149,6 +1157,34 @@ void __init init_speculation_mitigations(void)
         tsx_init();
     }
 
+    /* Calculate suitable defaults for MSR_MCU_OPT_CTRL */
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+    {
+        uint64_t val;
+
+        rdmsrl(MSR_MCU_OPT_CTRL, val);
+
+        /*
+         * On some SRBDS-affected hardware, it may be safe to relax srb-lock
+         * by default.
+         *
+         * On parts which enumerate MDS_NO and not TAA_NO, TSX is the only way
+         * to access the Fill Buffer.  If TSX isn't available (inc. SKU
+         * reasons on some models), or TSX is explicitly disabled, then there
+         * is no need for the extra overhead to protect RDRAND/RDSEED.
+         */
+        if ( opt_srb_lock == -1 &&
+             (caps & (ARCH_CAPS_MDS_NO|ARCH_CAPS_TAA_NO)) == ARCH_CAPS_MDS_NO &&
+             (!cpu_has_hle || ((caps & ARCH_CAPS_TSX_CTRL) && opt_tsx == 0)) )
+            opt_srb_lock = 0;
+
+        val &= ~MCU_OPT_CTRL_RNGDS_MITG_DIS;
+        if ( !opt_srb_lock )
+            val |= MCU_OPT_CTRL_RNGDS_MITG_DIS;
+
+        default_xen_mcu_opt_ctrl = val;
+    }
+
     print_details(thunk, caps);
 
     /*
@@ -1180,6 +1216,9 @@ void __init init_speculation_mitigations(void)
 
         wrmsrl(MSR_SPEC_CTRL, bsp_delay_spec_ctrl ? 0 : default_xen_spec_ctrl);
     }
+
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+        wrmsrl(MSR_MCU_OPT_CTRL, default_xen_mcu_opt_ctrl);
 }
 
 static void __init __maybe_unused build_assertions(void)
diff --git a/xen/include/asm-x86/spec_ctrl.h b/xen/include/asm-x86/spec_ctrl.h
index 9caecddfec..b252bb8631 100644
--- a/xen/include/asm-x86/spec_ctrl.h
+++ b/xen/include/asm-x86/spec_ctrl.h
@@ -54,6 +54,8 @@ extern int8_t opt_pv_l1tf_hwdom, opt_pv_l1tf_domu;
  */
 extern paddr_t l1tf_addr_mask, l1tf_safe_maddr;
 
+extern uint64_t default_xen_mcu_opt_ctrl;
+
 static inline void init_shadow_spec_ctrl_state(void)
 {
     struct cpu_info *info = get_cpu_info();
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Jun 09 17:11:49 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Jun 2020 17:11: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 1jihmv-000789-7f; Tue, 09 Jun 2020 17:11: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=1bQd=7W=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jihmu-00077z-5I
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 17:11:48 +0000
X-Inumbo-ID: 4d07e498-aa74-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 4d07e498-aa74-11ea-8496-bc764e2007e4;
 Tue, 09 Jun 2020 17:11:47 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=SQc3l1my85TW33dnr89CvlPj4OOM8qTHc7FmBHpfe2I=; b=3kvhdowUw+PdalelzCOYK9HZpt
 jiSy1AHFPAapsvy/yOb/kzb14ASVz2ru18ZXGerGxGLpPAtT6rJM9RzLZ3oy4pOfbCwYuKoDA3XEP
 4OqsbylScwMjOV8KuVXsX3MvmcPsu5QXw2TbuClr/zvkd24n46/mVT/uvn5zqFqRqo8c=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jihmt-0004Sh-8C
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 17:11:47 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jihmt-0002kV-6m
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 17:11:47 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.12] x86/spec-ctrl: CPUID/MSR definitions for Special
 Register Buffer Data Sampling
Message-Id: <E1jihmt-0002kV-6m@xenbits.xenproject.org>
Date: Tue, 09 Jun 2020 17:11: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 9dc284294017c7206bd09223090d49003f6c71db
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 8 19:47:46 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jun 9 17:45:37 2020 +0100

    x86/spec-ctrl: CPUID/MSR definitions for Special Register Buffer Data Sampling
    
    This is part of XSA-320 / CVE-2020-0543
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Wei Liu <wl@xen.org>
    (cherry picked from commit caab85ab58c0cdf74ab070a5de5c4df89f509ff3)
---
 docs/misc/xen-command-line.pandoc           | 8 ++++----
 tools/libxl/libxl_cpuid.c                   | 1 +
 tools/misc/xen-cpuid.c                      | 1 +
 xen/arch/x86/cpuid.c                        | 5 +++++
 xen/arch/x86/msr.c                          | 2 ++
 xen/arch/x86/spec_ctrl.c                    | 3 ++-
 xen/include/asm-x86/msr-index.h             | 3 +++
 xen/include/public/arch-x86/cpufeatureset.h | 1 +
 8 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 3561d88b59..dbdaee92dc 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -483,10 +483,10 @@ accounting for hardware capabilities as enumerated via CPUID.
 
 Currently accepted:
 
-The Speculation Control hardware features `md-clear`, `ibrsb`, `stibp`, `ibpb`,
-`l1d-flush` and `ssbd` are used by default if available and applicable.  They can
-be ignored, e.g. `no-ibrsb`, at which point Xen won't use them itself, and
-won't offer them to guests.
+The Speculation Control hardware features `srbds-ctrl`, `md-clear`, `ibrsb`,
+`stibp`, `ibpb`, `l1d-flush` and `ssbd` are used by default if available and
+applicable.  They can be ignored, e.g. `no-ibrsb`, at which point Xen won't
+use them itself, and won't offer them to guests.
 
 ### cpuid_mask_cpu
 > `= fam_0f_rev_[cdefg] | fam_10_rev_[bc] | fam_11_rev_b`
diff --git a/tools/libxl/libxl_cpuid.c b/tools/libxl/libxl_cpuid.c
index 4cf0f0738d..88b5760c85 100644
--- a/tools/libxl/libxl_cpuid.c
+++ b/tools/libxl/libxl_cpuid.c
@@ -203,6 +203,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},
+        {"srbds-ctrl",   0x00000007,  0, CPUID_REG_EDX,  9,  1},
         {"md-clear",     0x00000007,  0, CPUID_REG_EDX, 10,  1},
         {"cet-ibt",      0x00000007,  0, CPUID_REG_EDX, 20,  1},
         {"ibrsb",        0x00000007,  0, CPUID_REG_EDX, 26,  1},
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index 2a00697643..b4c4dfcf19 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -154,6 +154,7 @@ static const char *str_7d0[32] =
     [ 2] = "avx512_4vnniw", [ 3] = "avx512_4fmaps",
     [ 4] = "fsrm",
 
+    /*  8 */                [ 9] = "srbds-ctrl",
     [10] = "md-clear",
     /* 12 */                [13] = "tsx-force-abort",
 
diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 1727497459..22d8c71a95 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -59,6 +59,11 @@ static int __init parse_xen_cpuid(const char *s)
             if ( !val )
                 setup_clear_cpu_cap(X86_FEATURE_SSBD);
         }
+        else if ( (val = parse_boolean("srbds-ctrl", s, ss)) >= 0 )
+        {
+            if ( !val )
+                setup_clear_cpu_cap(X86_FEATURE_SRBDS_CTRL);
+        }
         else
             rc = -EINVAL;
 
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 4888fff16c..9ff27b7007 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -133,6 +133,7 @@ int guest_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val)
         /* Write-only */
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
+    case MSR_MCU_OPT_CTRL:
     case MSR_U_CET:
     case MSR_S_CET:
     case MSR_PL0_SSP ... MSR_INTERRUPT_SSP_TABLE:
@@ -273,6 +274,7 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
         /* Read-only */
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
+    case MSR_MCU_OPT_CTRL:
     case MSR_U_CET:
     case MSR_S_CET:
     case MSR_PL0_SSP ... MSR_INTERRUPT_SSP_TABLE:
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index 800139d79c..5158e012ca 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -309,12 +309,13 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
     printk("Speculative mitigation facilities:\n");
 
     /* Hardware features which pertain to speculative mitigations. */
-    printk("  Hardware features:%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
+    printk("  Hardware features:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
            (_7d0 & cpufeat_mask(X86_FEATURE_IBRSB)) ? " IBRS/IBPB" : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_STIBP)) ? " STIBP"     : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_L1D_FLUSH)) ? " L1D_FLUSH" : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_SSBD))  ? " SSBD"      : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_MD_CLEAR)) ? " MD_CLEAR" : "",
+           (_7d0 & cpufeat_mask(X86_FEATURE_SRBDS_CTRL)) ? " SRBDS_CTRL" : "",
            (e8b  & cpufeat_mask(X86_FEATURE_IBPB))  ? " IBPB"      : "",
            (caps & ARCH_CAPS_IBRS_ALL)              ? " IBRS_ALL"  : "",
            (caps & ARCH_CAPS_RDCL_NO)               ? " RDCL_NO"   : "",
diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h
index 7693c4a71a..91994669e1 100644
--- a/xen/include/asm-x86/msr-index.h
+++ b/xen/include/asm-x86/msr-index.h
@@ -179,6 +179,9 @@
 #define MSR_IA32_VMX_TRUE_ENTRY_CTLS            0x490
 #define MSR_IA32_VMX_VMFUNC                     0x491
 
+#define MSR_MCU_OPT_CTRL                    0x00000123
+#define  MCU_OPT_CTRL_RNGDS_MITG_DIS        (_AC(1, ULL) <<  0)
+
 #define MSR_U_CET                           0x000006a0
 #define MSR_S_CET                           0x000006a2
 #define MSR_PL0_SSP                         0x000006a4
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 865a435d2c..31490a7c10 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -243,6 +243,7 @@ XEN_CPUFEATURE(IBPB,          8*32+12) /*A  IBPB support only (no IBRS, used by
 /* 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(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 */
 XEN_CPUFEATURE(CET_IBT,       9*32+20) /*   CET - Indirect Branch Tracking */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Tue Jun 09 17:11:59 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Jun 2020 17:11: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 1jihn5-000799-9I; Tue, 09 Jun 2020 17:11:59 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=1bQd=7W=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jihn4-00078z-7Q
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 17:11:58 +0000
X-Inumbo-ID: 5306cbca-aa74-11ea-b345-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 5306cbca-aa74-11ea-b345-12813bfff9fa;
 Tue, 09 Jun 2020 17:11:57 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=jZFCB8VnCbjeuPvC7ks0rFWQZqEhg7aZRRZwFLDEz8Q=; b=PaA4JVuXWaHiC7ckvDXIO6J/xq
 hDjs/f8ve2Nx2L8tsmb0bRzMGucXdATTNJT4L0YfY/3YM9tvLShKyh/MYGBYOCEg5qtvv9dyJY88j
 V1Lk7bZviXhMYKgMXGnEJMDwvQlSPwoGgay5kBGcMEo28WfBm3Px/l4pUDCBrqRYJO1M=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jihn3-0004Sx-BL
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 17:11:57 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jihn3-0002l1-AW
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 17:11:57 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.12] x86/spec-ctrl: Mitigate the Special Register
 Buffer Data Sampling sidechannel
Message-Id: <E1jihn3-0002l1-AW@xenbits.xenproject.org>
Date: Tue, 09 Jun 2020 17:11: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 199ae1f15894bd1bdefdf7c3e44688127be3ba19
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 8 19:47:46 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jun 9 17:45:49 2020 +0100

    x86/spec-ctrl: Mitigate the Special Register Buffer Data Sampling sidechannel
    
    See patch documentation and comments.
    
    This is part of XSA-320 / CVE-2020-0543
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 6a49b9a7920c82015381740905582b666160d955)
---
 docs/misc/xen-command-line.pandoc |  8 +++++++-
 xen/arch/x86/acpi/power.c         |  3 +++
 xen/arch/x86/smpboot.c            |  8 +++++---
 xen/arch/x86/spec_ctrl.c          | 41 ++++++++++++++++++++++++++++++++++++++-
 xen/include/asm-x86/spec_ctrl.h   |  2 ++
 5 files changed, 57 insertions(+), 5 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index dbdaee92dc..337fbf0492 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -1909,7 +1909,7 @@ By default SSBD will be mitigated at runtime (i.e `ssbd=runtime`).
 ### spec-ctrl (x86)
 > `= List of [ <bool>, xen=<bool>, {pv,hvm,msr-sc,rsb,md-clear}=<bool>,
 >              bti-thunk=retpoline|lfence|jmp, {ibrs,ibpb,ssbd,eager-fpu,
->              l1d-flush}=<bool> ]`
+>              l1d-flush,srb-lock}=<bool> ]`
 
 Controls for speculative execution sidechannel mitigations.  By default, Xen
 will pick the most appropriate mitigations based on compiled in support,
@@ -1981,6 +1981,12 @@ Irrespective of Xen's setting, the feature is virtualised for HVM guests to
 use.  By default, Xen will enable this mitigation on hardware believed to be
 vulnerable to L1TF.
 
+On hardware supporting SRBDS_CTRL, the `srb-lock=` option can be used to force
+or prevent Xen from protect the Special Register Buffer from leaking stale
+data. By default, Xen will enable this mitigation, except on parts where MDS
+is fixed and TAA is fixed/mitigated (in which case, there is believed to be no
+way for an attacker to obtain the stale data).
+
 ### sync_console
 > `= <boolean>`
 
diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
index c1d772f63f..a07aa3b9ed 100644
--- a/xen/arch/x86/acpi/power.c
+++ b/xen/arch/x86/acpi/power.c
@@ -266,6 +266,9 @@ static int enter_state(u32 state)
     ci->spec_ctrl_flags |= (default_spec_ctrl_flags & SCF_ist_wrmsr);
     spec_ctrl_exit_idle(ci);
 
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+        wrmsrl(MSR_MCU_OPT_CTRL, default_xen_mcu_opt_ctrl);
+
  done:
     spin_debug_enable();
     local_irq_restore(flags);
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index 699e21bfb7..b741d1354a 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -369,12 +369,14 @@ void start_secondary(void *unused)
         microcode_resume_cpu(cpu);
 
     /*
-     * If MSR_SPEC_CTRL is available, apply Xen's default setting and discard
-     * any firmware settings.  Note: MSR_SPEC_CTRL may only become available
-     * after loading microcode.
+     * If any speculative control MSRs are available, apply Xen's default
+     * settings.  Note: These MSRs may only become available after loading
+     * microcode.
      */
     if ( boot_cpu_has(X86_FEATURE_IBRSB) )
         wrmsrl(MSR_SPEC_CTRL, default_xen_spec_ctrl);
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+        wrmsrl(MSR_MCU_OPT_CTRL, default_xen_mcu_opt_ctrl);
 
     tsx_init(); /* Needs microcode.  May change HLE/RTM feature bits. */
 
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index 5158e012ca..e2fcefc86a 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -64,6 +64,9 @@ static unsigned int __initdata l1d_maxphysaddr;
 static bool __initdata cpu_has_bug_msbds_only; /* => minimal HT impact. */
 static bool __initdata cpu_has_bug_mds; /* Any other M{LP,SB,FB}DS combination. */
 
+static int8_t __initdata opt_srb_lock = -1;
+uint64_t __read_mostly default_xen_mcu_opt_ctrl;
+
 static int __init parse_spec_ctrl(const char *s)
 {
     const char *ss;
@@ -110,6 +113,7 @@ static int __init parse_spec_ctrl(const char *s)
             opt_ibpb = false;
             opt_ssbd = false;
             opt_l1d_flush = 0;
+            opt_srb_lock = 0;
         }
         else if ( val > 0 )
             rc = -EINVAL;
@@ -175,6 +179,8 @@ static int __init parse_spec_ctrl(const char *s)
             opt_eager_fpu = val;
         else if ( (val = parse_boolean("l1d-flush", s, ss)) >= 0 )
             opt_l1d_flush = val;
+        else if ( (val = parse_boolean("srb-lock", s, ss)) >= 0 )
+            opt_srb_lock = val;
         else
             rc = -EINVAL;
 
@@ -338,7 +344,7 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
                "\n");
 
     /* Settings for Xen's protection, irrespective of guests. */
-    printk("  Xen settings: BTI-Thunk %s, SPEC_CTRL: %s%s%s, Other:%s%s%s\n",
+    printk("  Xen settings: BTI-Thunk %s, SPEC_CTRL: %s%s%s, Other:%s%s%s%s\n",
            thunk == THUNK_NONE      ? "N/A" :
            thunk == THUNK_RETPOLINE ? "RETPOLINE" :
            thunk == THUNK_LFENCE    ? "LFENCE" :
@@ -349,6 +355,8 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
            (default_xen_spec_ctrl & SPEC_CTRL_SSBD)  ? " SSBD+" : " SSBD-",
            !(caps & ARCH_CAPS_TSX_CTRL)              ? "" :
            (opt_tsx & 1)                             ? " TSX+" : " TSX-",
+           !boot_cpu_has(X86_FEATURE_SRBDS_CTRL)     ? "" :
+           opt_srb_lock                              ? " SRB_LOCK+" : " SRB_LOCK-",
            opt_ibpb                                  ? " IBPB"  : "",
            opt_l1d_flush                             ? " L1D_FLUSH" : "",
            opt_md_clear_pv || opt_md_clear_hvm       ? " VERW"  : "");
@@ -1142,6 +1150,34 @@ void __init init_speculation_mitigations(void)
         tsx_init();
     }
 
+    /* Calculate suitable defaults for MSR_MCU_OPT_CTRL */
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+    {
+        uint64_t val;
+
+        rdmsrl(MSR_MCU_OPT_CTRL, val);
+
+        /*
+         * On some SRBDS-affected hardware, it may be safe to relax srb-lock
+         * by default.
+         *
+         * On parts which enumerate MDS_NO and not TAA_NO, TSX is the only way
+         * to access the Fill Buffer.  If TSX isn't available (inc. SKU
+         * reasons on some models), or TSX is explicitly disabled, then there
+         * is no need for the extra overhead to protect RDRAND/RDSEED.
+         */
+        if ( opt_srb_lock == -1 &&
+             (caps & (ARCH_CAPS_MDS_NO|ARCH_CAPS_TAA_NO)) == ARCH_CAPS_MDS_NO &&
+             (!cpu_has_hle || ((caps & ARCH_CAPS_TSX_CTRL) && opt_tsx == 0)) )
+            opt_srb_lock = 0;
+
+        val &= ~MCU_OPT_CTRL_RNGDS_MITG_DIS;
+        if ( !opt_srb_lock )
+            val |= MCU_OPT_CTRL_RNGDS_MITG_DIS;
+
+        default_xen_mcu_opt_ctrl = val;
+    }
+
     print_details(thunk, caps);
 
     /*
@@ -1173,6 +1209,9 @@ void __init init_speculation_mitigations(void)
 
         wrmsrl(MSR_SPEC_CTRL, bsp_delay_spec_ctrl ? 0 : default_xen_spec_ctrl);
     }
+
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+        wrmsrl(MSR_MCU_OPT_CTRL, default_xen_mcu_opt_ctrl);
 }
 
 static void __init __maybe_unused build_assertions(void)
diff --git a/xen/include/asm-x86/spec_ctrl.h b/xen/include/asm-x86/spec_ctrl.h
index ba03bb42e5..59bab1a41b 100644
--- a/xen/include/asm-x86/spec_ctrl.h
+++ b/xen/include/asm-x86/spec_ctrl.h
@@ -53,6 +53,8 @@ extern int8_t opt_pv_l1tf_hwdom, opt_pv_l1tf_domu;
  */
 extern paddr_t l1tf_addr_mask, l1tf_safe_maddr;
 
+extern uint64_t default_xen_mcu_opt_ctrl;
+
 static inline void init_shadow_spec_ctrl_state(void)
 {
     struct cpu_info *info = get_cpu_info();
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Tue Jun 09 17:12:10 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Jun 2020 17:12: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 1jihnG-0007B5-CD; Tue, 09 Jun 2020 17:12:10 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=1bQd=7W=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jihnF-0007Au-8n
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 17:12:09 +0000
X-Inumbo-ID: 59824a06-aa74-11ea-b345-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 59824a06-aa74-11ea-b345-12813bfff9fa;
 Tue, 09 Jun 2020 17:12: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=nh19se92YEN2c5dJFH469LRz2zXUcOcfY8T32tmXvgk=; b=MhUkpMiSAp+mENasH11M7vZO2Q
 E3fgFErBv/XujfsjMrJ/ftHSSPm5gEV1xzIMRm7PMpb6YRhZUmii1/IzhuGxE5uv0scDweT+9jaTi
 CTOVzw7PHzrJQXlP1gwzjCxzkJ/yFLoNVibYKlOsAqZIbP6723tETYeRh1jbJkcwDRag=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jihnE-0004TL-6d
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 17:12:08 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jihnE-0002mN-5o
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 17:12:08 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.11] x86/spec-ctrl: CPUID/MSR definitions for Special
 Register Buffer Data Sampling
Message-Id: <E1jihnE-0002mN-5o@xenbits.xenproject.org>
Date: Tue, 09 Jun 2020 17:12:08 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 1c751c4146b9e1d8dd9b61ee6a01caa1b07463cc
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 8 19:47:46 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jun 9 17:46:05 2020 +0100

    x86/spec-ctrl: CPUID/MSR definitions for Special Register Buffer Data Sampling
    
    This is part of XSA-320 / CVE-2020-0543
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Wei Liu <wl@xen.org>
    (cherry picked from commit caab85ab58c0cdf74ab070a5de5c4df89f509ff3)
---
 docs/misc/xen-command-line.markdown         | 8 ++++----
 tools/libxl/libxl_cpuid.c                   | 1 +
 tools/misc/xen-cpuid.c                      | 1 +
 xen/arch/x86/cpuid.c                        | 5 +++++
 xen/arch/x86/msr.c                          | 2 ++
 xen/arch/x86/spec_ctrl.c                    | 3 ++-
 xen/include/asm-x86/msr-index.h             | 3 +++
 xen/include/public/arch-x86/cpufeatureset.h | 1 +
 8 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown
index 194615bfc5..9be18ac99f 100644
--- a/docs/misc/xen-command-line.markdown
+++ b/docs/misc/xen-command-line.markdown
@@ -489,10 +489,10 @@ accounting for hardware capabilities as enumerated via CPUID.
 
 Currently accepted:
 
-The Speculation Control hardware features `md-clear`, `ibrsb`, `stibp`, `ibpb`,
-`l1d-flush` and `ssbd` are used by default if available and applicable.  They can
-be ignored, e.g. `no-ibrsb`, at which point Xen won't use them itself, and
-won't offer them to guests.
+The Speculation Control hardware features `srbds-ctrl`, `md-clear`, `ibrsb`,
+`stibp`, `ibpb`, `l1d-flush` and `ssbd` are used by default if available and
+applicable.  They can be ignored, e.g. `no-ibrsb`, at which point Xen won't
+use them itself, and won't offer them to guests.
 
 ### cpuid\_mask\_cpu (AMD only)
 > `= fam_0f_rev_c | fam_0f_rev_d | fam_0f_rev_e | fam_0f_rev_f | fam_0f_rev_g | fam_10_rev_b | fam_10_rev_c | fam_11_rev_b`
diff --git a/tools/libxl/libxl_cpuid.c b/tools/libxl/libxl_cpuid.c
index 5a1702d703..1235c8b91e 100644
--- a/tools/libxl/libxl_cpuid.c
+++ b/tools/libxl/libxl_cpuid.c
@@ -202,6 +202,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},
+        {"srbds-ctrl",   0x00000007,  0, CPUID_REG_EDX,  9,  1},
         {"md-clear",     0x00000007,  0, CPUID_REG_EDX, 10,  1},
         {"ibrsb",        0x00000007,  0, CPUID_REG_EDX, 26,  1},
         {"stibp",        0x00000007,  0, CPUID_REG_EDX, 27,  1},
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index 4c9af6b7f0..8fb54c3001 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -142,6 +142,7 @@ static const char *str_7d0[32] =
 {
     [ 2] = "avx512_4vnniw", [ 3] = "avx512_4fmaps",
 
+    /*  8 */                [ 9] = "srbds-ctrl",
     [10] = "md-clear",
     /* 12 */                [13] = "tsx-force-abort",
 
diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 04aefa555d..b8e5b6fe67 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -58,6 +58,11 @@ static int __init parse_xen_cpuid(const char *s)
             if ( !val )
                 setup_clear_cpu_cap(X86_FEATURE_SSBD);
         }
+        else if ( (val = parse_boolean("srbds-ctrl", s, ss)) >= 0 )
+        {
+            if ( !val )
+                setup_clear_cpu_cap(X86_FEATURE_SRBDS_CTRL);
+        }
         else
             rc = -EINVAL;
 
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index ccb316c547..256e58d82b 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -154,6 +154,7 @@ int guest_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val)
         /* Write-only */
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
+    case MSR_MCU_OPT_CTRL:
         /* Not offered to guests. */
         goto gp_fault;
 
@@ -243,6 +244,7 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
         /* Read-only */
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
+    case MSR_MCU_OPT_CTRL:
         /* Not offered to guests. */
         goto gp_fault;
 
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index ab196b156d..94ab8dd786 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -365,12 +365,13 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
     printk("Speculative mitigation facilities:\n");
 
     /* Hardware features which pertain to speculative mitigations. */
-    printk("  Hardware features:%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
+    printk("  Hardware features:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
            (_7d0 & cpufeat_mask(X86_FEATURE_IBRSB)) ? " IBRS/IBPB" : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_STIBP)) ? " STIBP"     : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_L1D_FLUSH)) ? " L1D_FLUSH" : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_SSBD))  ? " SSBD"      : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_MD_CLEAR)) ? " MD_CLEAR" : "",
+           (_7d0 & cpufeat_mask(X86_FEATURE_SRBDS_CTRL)) ? " SRBDS_CTRL" : "",
            (e8b  & cpufeat_mask(X86_FEATURE_IBPB))  ? " IBPB"      : "",
            (caps & ARCH_CAPS_IBRS_ALL)              ? " IBRS_ALL"  : "",
            (caps & ARCH_CAPS_RDCL_NO)               ? " RDCL_NO"   : "",
diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h
index 1761a01f1f..480d1d8102 100644
--- a/xen/include/asm-x86/msr-index.h
+++ b/xen/include/asm-x86/msr-index.h
@@ -177,6 +177,9 @@
 #define MSR_IA32_VMX_TRUE_ENTRY_CTLS            0x490
 #define MSR_IA32_VMX_VMFUNC                     0x491
 
+#define MSR_MCU_OPT_CTRL                    0x00000123
+#define  MCU_OPT_CTRL_RNGDS_MITG_DIS        (_AC(1, ULL) <<  0)
+
 /* K7/K8 MSRs. Not complete. See the architecture manual for a more
    complete list. */
 #define MSR_K7_EVNTSEL0			0xc0010000
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index a14d8a7013..9d210e74a0 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -242,6 +242,7 @@ XEN_CPUFEATURE(IBPB,          8*32+12) /*A  IBPB support only (no IBRS, used by
 /* 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(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 */
 XEN_CPUFEATURE(IBRSB,         9*32+26) /*A  IBRS and IBPB support (used by Intel) */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.11


From xen-changelog-bounces@lists.xenproject.org Tue Jun 09 17:12:20 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Jun 2020 17:12:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jihnQ-0007CK-De; Tue, 09 Jun 2020 17:12:20 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=1bQd=7W=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jihnP-0007C8-7Z
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 17:12:19 +0000
X-Inumbo-ID: 5f83298e-aa74-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 5f83298e-aa74-11ea-bca7-bc764e2007e4;
 Tue, 09 Jun 2020 17:12:18 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=Vy8xWk6BX4s8XjgP+8XRjUn3lcSJ/JquwWDy/hxCSm8=; b=onRlP7tNS9ORRxk7WW49jvCNBO
 jnoCf4bbG4v6hwLrLV/HzUB6XJkJD/BJdg1xw8BL9zSBQUkGjajLK80y+DR8fQJ2YDb0vXCHM7aFE
 cah5wTaUPYGlGvU8EB7o/VGHJCabwCc2O+RmInHVtzJKNly7QlKTM+Fn3MfaCmXs8AaU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jihnO-0004TU-9h
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 17:12:18 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jihnO-0002nB-92
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 17:12:18 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.11] x86/spec-ctrl: Mitigate the Special Register
 Buffer Data Sampling sidechannel
Message-Id: <E1jihnO-0002nB-92@xenbits.xenproject.org>
Date: Tue, 09 Jun 2020 17:12:18 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit b8d476a9eaee8877cd5ba2c9eb6dbc5412626d13
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 8 19:47:46 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jun 9 17:46:14 2020 +0100

    x86/spec-ctrl: Mitigate the Special Register Buffer Data Sampling sidechannel
    
    See patch documentation and comments.
    
    This is part of XSA-320 / CVE-2020-0543
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 6a49b9a7920c82015381740905582b666160d955)
---
 docs/misc/xen-command-line.markdown |  8 +++++++-
 xen/arch/x86/acpi/power.c           |  3 +++
 xen/arch/x86/smpboot.c              |  8 +++++---
 xen/arch/x86/spec_ctrl.c            | 41 ++++++++++++++++++++++++++++++++++++-
 xen/include/asm-x86/spec_ctrl.h     |  2 ++
 5 files changed, 57 insertions(+), 5 deletions(-)

diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown
index 9be18ac99f..3356e59fee 100644
--- a/docs/misc/xen-command-line.markdown
+++ b/docs/misc/xen-command-line.markdown
@@ -1858,7 +1858,7 @@ false disable the quirk workaround, which is also the default.
 ### spec-ctrl (x86)
 > `= List of [ <bool>, xen=<bool>, {pv,hvm,msr-sc,rsb,md-clear}=<bool>,
 >              bti-thunk=retpoline|lfence|jmp, {ibrs,ibpb,ssbd,eager-fpu,
->              l1d-flush}=<bool> ]`
+>              l1d-flush,srb-lock}=<bool> ]`
 
 Controls for speculative execution sidechannel mitigations.  By default, Xen
 will pick the most appropriate mitigations based on compiled in support,
@@ -1930,6 +1930,12 @@ Irrespective of Xen's setting, the feature is virtualised for HVM guests to
 use.  By default, Xen will enable this mitigation on hardware believed to be
 vulnerable to L1TF.
 
+On hardware supporting SRBDS_CTRL, the `srb-lock=` option can be used to force
+or prevent Xen from protect the Special Register Buffer from leaking stale
+data. By default, Xen will enable this mitigation, except on parts where MDS
+is fixed and TAA is fixed/mitigated (in which case, there is believed to be no
+way for an attacker to obtain the stale data).
+
 ### sync\_console
 > `= <boolean>`
 
diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
index 4c12794809..30e1bd5cd3 100644
--- a/xen/arch/x86/acpi/power.c
+++ b/xen/arch/x86/acpi/power.c
@@ -266,6 +266,9 @@ static int enter_state(u32 state)
     ci->spec_ctrl_flags |= (default_spec_ctrl_flags & SCF_ist_wrmsr);
     spec_ctrl_exit_idle(ci);
 
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+        wrmsrl(MSR_MCU_OPT_CTRL, default_xen_mcu_opt_ctrl);
+
  done:
     spin_debug_enable();
     local_irq_restore(flags);
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index 0887806e85..d24d215946 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -369,12 +369,14 @@ void start_secondary(void *unused)
         microcode_resume_cpu(cpu);
 
     /*
-     * If MSR_SPEC_CTRL is available, apply Xen's default setting and discard
-     * any firmware settings.  Note: MSR_SPEC_CTRL may only become available
-     * after loading microcode.
+     * If any speculative control MSRs are available, apply Xen's default
+     * settings.  Note: These MSRs may only become available after loading
+     * microcode.
      */
     if ( boot_cpu_has(X86_FEATURE_IBRSB) )
         wrmsrl(MSR_SPEC_CTRL, default_xen_spec_ctrl);
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+        wrmsrl(MSR_MCU_OPT_CTRL, default_xen_mcu_opt_ctrl);
 
     tsx_init(); /* Needs microcode.  May change HLE/RTM feature bits. */
 
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index 94ab8dd786..a306d10c34 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -63,6 +63,9 @@ static unsigned int __initdata l1d_maxphysaddr;
 static bool __initdata cpu_has_bug_msbds_only; /* => minimal HT impact. */
 static bool __initdata cpu_has_bug_mds; /* Any other M{LP,SB,FB}DS combination. */
 
+static int8_t __initdata opt_srb_lock = -1;
+uint64_t __read_mostly default_xen_mcu_opt_ctrl;
+
 static int __init parse_bti(const char *s)
 {
     const char *ss;
@@ -166,6 +169,7 @@ static int __init parse_spec_ctrl(const char *s)
             opt_ibpb = false;
             opt_ssbd = false;
             opt_l1d_flush = 0;
+            opt_srb_lock = 0;
         }
         else if ( val > 0 )
             rc = -EINVAL;
@@ -231,6 +235,8 @@ static int __init parse_spec_ctrl(const char *s)
             opt_eager_fpu = val;
         else if ( (val = parse_boolean("l1d-flush", s, ss)) >= 0 )
             opt_l1d_flush = val;
+        else if ( (val = parse_boolean("srb-lock", s, ss)) >= 0 )
+            opt_srb_lock = val;
         else
             rc = -EINVAL;
 
@@ -394,7 +400,7 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
                "\n");
 
     /* Settings for Xen's protection, irrespective of guests. */
-    printk("  Xen settings: BTI-Thunk %s, SPEC_CTRL: %s%s%s, Other:%s%s%s\n",
+    printk("  Xen settings: BTI-Thunk %s, SPEC_CTRL: %s%s%s, Other:%s%s%s%s\n",
            thunk == THUNK_NONE      ? "N/A" :
            thunk == THUNK_RETPOLINE ? "RETPOLINE" :
            thunk == THUNK_LFENCE    ? "LFENCE" :
@@ -405,6 +411,8 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
            (default_xen_spec_ctrl & SPEC_CTRL_SSBD)  ? " SSBD+" : " SSBD-",
            !(caps & ARCH_CAPS_TSX_CTRL)              ? "" :
            (opt_tsx & 1)                             ? " TSX+" : " TSX-",
+           !boot_cpu_has(X86_FEATURE_SRBDS_CTRL)     ? "" :
+           opt_srb_lock                              ? " SRB_LOCK+" : " SRB_LOCK-",
            opt_ibpb                                  ? " IBPB"  : "",
            opt_l1d_flush                             ? " L1D_FLUSH" : "",
            opt_md_clear_pv || opt_md_clear_hvm       ? " VERW"  : "");
@@ -1196,6 +1204,34 @@ void __init init_speculation_mitigations(void)
         tsx_init();
     }
 
+    /* Calculate suitable defaults for MSR_MCU_OPT_CTRL */
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+    {
+        uint64_t val;
+
+        rdmsrl(MSR_MCU_OPT_CTRL, val);
+
+        /*
+         * On some SRBDS-affected hardware, it may be safe to relax srb-lock
+         * by default.
+         *
+         * On parts which enumerate MDS_NO and not TAA_NO, TSX is the only way
+         * to access the Fill Buffer.  If TSX isn't available (inc. SKU
+         * reasons on some models), or TSX is explicitly disabled, then there
+         * is no need for the extra overhead to protect RDRAND/RDSEED.
+         */
+        if ( opt_srb_lock == -1 &&
+             (caps & (ARCH_CAPS_MDS_NO|ARCH_CAPS_TAA_NO)) == ARCH_CAPS_MDS_NO &&
+             (!cpu_has_hle || ((caps & ARCH_CAPS_TSX_CTRL) && opt_tsx == 0)) )
+            opt_srb_lock = 0;
+
+        val &= ~MCU_OPT_CTRL_RNGDS_MITG_DIS;
+        if ( !opt_srb_lock )
+            val |= MCU_OPT_CTRL_RNGDS_MITG_DIS;
+
+        default_xen_mcu_opt_ctrl = val;
+    }
+
     print_details(thunk, caps);
 
     /*
@@ -1227,6 +1263,9 @@ void __init init_speculation_mitigations(void)
 
         wrmsrl(MSR_SPEC_CTRL, bsp_delay_spec_ctrl ? 0 : default_xen_spec_ctrl);
     }
+
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+        wrmsrl(MSR_MCU_OPT_CTRL, default_xen_mcu_opt_ctrl);
 }
 
 static void __init __maybe_unused build_assertions(void)
diff --git a/xen/include/asm-x86/spec_ctrl.h b/xen/include/asm-x86/spec_ctrl.h
index 333d180b7e..bf10d2ce5c 100644
--- a/xen/include/asm-x86/spec_ctrl.h
+++ b/xen/include/asm-x86/spec_ctrl.h
@@ -46,6 +46,8 @@ extern int8_t opt_pv_l1tf_hwdom, opt_pv_l1tf_domu;
  */
 extern paddr_t l1tf_addr_mask, l1tf_safe_maddr;
 
+extern uint64_t default_xen_mcu_opt_ctrl;
+
 static inline void init_shadow_spec_ctrl_state(void)
 {
     struct cpu_info *info = get_cpu_info();
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.11


From xen-changelog-bounces@lists.xenproject.org Tue Jun 09 17:12:32 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Jun 2020 17:12:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jihnc-0007Df-FA; Tue, 09 Jun 2020 17:12:32 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=1bQd=7W=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jihna-0007DV-Nr
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 17:12:30 +0000
X-Inumbo-ID: 65f7eef8-aa74-11ea-b345-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 65f7eef8-aa74-11ea-b345-12813bfff9fa;
 Tue, 09 Jun 2020 17:12:29 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=fI65n/VppzJhJkwTBSLlZtsH4P0q3ri0QcuEqmJ1LB0=; b=2wB57ihXj+bicriPOhHBdr34SV
 bbpRlqLKzs1Kzq9kOngoifVMaZ4IAXz9brHkcw9fZ0ubfAzOaBBIwVtIvgyWbEBC/9C++hcn1q2k7
 UrmO/Ge+8mtWIXvSDv8bte4vLMxCPJyzz0HoKQ8fu9NLQBEUiiu19CXtQ2axfuRJrykM=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jihnZ-0004U4-4A
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 17:12:29 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jihnZ-0002oH-2J
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 17:12:29 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.10] x86/spec-ctrl: CPUID/MSR definitions for Special
 Register Buffer Data Sampling
Message-Id: <E1jihnZ-0002oH-2J@xenbits.xenproject.org>
Date: Tue, 09 Jun 2020 17:12:29 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit afca67fafde22033b9a967ae197a10af5c654f02
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 8 19:47:46 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jun 9 17:46:28 2020 +0100

    x86/spec-ctrl: CPUID/MSR definitions for Special Register Buffer Data Sampling
    
    This is part of XSA-320 / CVE-2020-0543
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Wei Liu <wl@xen.org>
    (cherry picked from commit caab85ab58c0cdf74ab070a5de5c4df89f509ff3)
---
 docs/misc/xen-command-line.markdown         | 8 ++++----
 tools/libxl/libxl_cpuid.c                   | 1 +
 tools/misc/xen-cpuid.c                      | 3 ++-
 xen/arch/x86/cpuid.c                        | 5 +++++
 xen/arch/x86/msr.c                          | 2 ++
 xen/arch/x86/spec_ctrl.c                    | 3 ++-
 xen/include/asm-x86/msr-index.h             | 3 +++
 xen/include/public/arch-x86/cpufeatureset.h | 1 +
 8 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown
index 1f08dde186..ab26a26381 100644
--- a/docs/misc/xen-command-line.markdown
+++ b/docs/misc/xen-command-line.markdown
@@ -496,10 +496,10 @@ accounting for hardware capabilities as enumerated via CPUID.
 
 Currently accepted:
 
-The Speculation Control hardware features `md-clear`, `ibrsb`, `stibp`, `ibpb`,
-`l1d-flush` and `ssbd` are used by default if available and applicable.  They can
-be ignored, e.g. `no-ibrsb`, at which point Xen won't use them itself, and
-won't offer them to guests.
+The Speculation Control hardware features `srbds-ctrl`, `md-clear`, `ibrsb`,
+`stibp`, `ibpb`, `l1d-flush` and `ssbd` are used by default if available and
+applicable.  They can be ignored, e.g. `no-ibrsb`, at which point Xen won't
+use them itself, and won't offer them to guests.
 
 ### cpuid\_mask\_cpu (AMD only)
 > `= fam_0f_rev_c | fam_0f_rev_d | fam_0f_rev_e | fam_0f_rev_f | fam_0f_rev_g | fam_10_rev_b | fam_10_rev_c | fam_11_rev_b`
diff --git a/tools/libxl/libxl_cpuid.c b/tools/libxl/libxl_cpuid.c
index 5a1702d703..1235c8b91e 100644
--- a/tools/libxl/libxl_cpuid.c
+++ b/tools/libxl/libxl_cpuid.c
@@ -202,6 +202,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},
+        {"srbds-ctrl",   0x00000007,  0, CPUID_REG_EDX,  9,  1},
         {"md-clear",     0x00000007,  0, CPUID_REG_EDX, 10,  1},
         {"ibrsb",        0x00000007,  0, CPUID_REG_EDX, 26,  1},
         {"stibp",        0x00000007,  0, CPUID_REG_EDX, 27,  1},
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index 89d50e048c..7f9612f0a9 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -162,8 +162,9 @@ static const char *str_7d0[32] =
 
     [ 2] = "avx512_4vnniw", [ 3] = "avx512_4fmaps",
 
-    [4 ... 9] = "REZ",
+    [4 ... 7] = "REZ",
 
+    [ 8] = "REZ",           [ 9] = "srbds-ctrl",
     [10] = "md-clear",      [11] = "REZ",
     [12] = "REZ",           [13] = "tsx-force-abort",
 
diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index e943d70bca..67a2a2e6a0 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -58,6 +58,11 @@ static int __init parse_xen_cpuid(const char *s)
             if ( !val )
                 setup_clear_cpu_cap(X86_FEATURE_SSBD);
         }
+        else if ( (val = parse_boolean("srbds-ctrl", s, ss)) >= 0 )
+        {
+            if ( !val )
+                setup_clear_cpu_cap(X86_FEATURE_SRBDS_CTRL);
+        }
         else
             rc = -EINVAL;
 
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 6ceea913fb..90561a5392 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -135,6 +135,7 @@ int guest_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val)
         /* Write-only */
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
+    case MSR_MCU_OPT_CTRL:
         /* Not offered to guests. */
         goto gp_fault;
 
@@ -194,6 +195,7 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
         /* Read-only */
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
+    case MSR_MCU_OPT_CTRL:
         /* Not offered to guests. */
         goto gp_fault;
 
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index 0f30362111..b7733b34f6 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -349,12 +349,13 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
     printk("Speculative mitigation facilities:\n");
 
     /* Hardware features which pertain to speculative mitigations. */
-    printk("  Hardware features:%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
+    printk("  Hardware features:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
            (_7d0 & cpufeat_mask(X86_FEATURE_IBRSB)) ? " IBRS/IBPB" : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_STIBP)) ? " STIBP"     : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_L1D_FLUSH)) ? " L1D_FLUSH" : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_SSBD))  ? " SSBD"      : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_MD_CLEAR)) ? " MD_CLEAR" : "",
+           (_7d0 & cpufeat_mask(X86_FEATURE_SRBDS_CTRL)) ? " SRBDS_CTRL" : "",
            (e8b  & cpufeat_mask(X86_FEATURE_IBPB))  ? " IBPB"      : "",
            (caps & ARCH_CAPS_IBRS_ALL)              ? " IBRS_ALL"  : "",
            (caps & ARCH_CAPS_RDCL_NO)               ? " RDCL_NO"   : "",
diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h
index 5ef80735b2..d1435db6a3 100644
--- a/xen/include/asm-x86/msr-index.h
+++ b/xen/include/asm-x86/msr-index.h
@@ -177,6 +177,9 @@
 #define MSR_IA32_VMX_TRUE_ENTRY_CTLS            0x490
 #define MSR_IA32_VMX_VMFUNC                     0x491
 
+#define MSR_MCU_OPT_CTRL                    0x00000123
+#define  MCU_OPT_CTRL_RNGDS_MITG_DIS        (_AC(1, ULL) <<  0)
+
 /* K7/K8 MSRs. Not complete. See the architecture manual for a more
    complete list. */
 #define MSR_K7_EVNTSEL0			0xc0010000
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index a14d8a7013..9d210e74a0 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -242,6 +242,7 @@ XEN_CPUFEATURE(IBPB,          8*32+12) /*A  IBPB support only (no IBRS, used by
 /* 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(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 */
 XEN_CPUFEATURE(IBRSB,         9*32+26) /*A  IBRS and IBPB support (used by Intel) */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.10


From xen-changelog-bounces@lists.xenproject.org Tue Jun 09 17:12:41 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Jun 2020 17:12:41 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jihnl-0007Ed-Gt; Tue, 09 Jun 2020 17:12:41 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=1bQd=7W=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jihnk-0007EU-5Z
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 17:12:40 +0000
X-Inumbo-ID: 6bfd6c2e-aa74-11ea-b345-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 6bfd6c2e-aa74-11ea-b345-12813bfff9fa;
 Tue, 09 Jun 2020 17:12:39 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=H9OB68aO8Ffa6xgWZstLTvK9WY4wjjrKUywXpbGa574=; b=cmyex+uAWdovTenobnEkHGUf7J
 rAJAsoHvypnPBzt3F2WeSZ7oFojsuvh3tBpIgtZXhdzUZsgqFLAF8QtkyuOB+0uuvFZiA1qugWpnv
 F7l6OkcWoOQTsuXLvAzaUn2EpUOcbsh//9j2wghkuNgt2/N9tqegEtsQJcMXUPGdbj+M=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jihnj-0004UE-7T
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 17:12:39 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jihnj-0002oy-6Z
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 17:12:39 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.10] x86/spec-ctrl: Mitigate the Special Register
 Buffer Data Sampling sidechannel
Message-Id: <E1jihnj-0002oy-6Z@xenbits.xenproject.org>
Date: Tue, 09 Jun 2020 17:12:39 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit a1a9b055a349748083665e42843f75d6db2c6a7b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 8 19:47:46 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jun 9 17:46:35 2020 +0100

    x86/spec-ctrl: Mitigate the Special Register Buffer Data Sampling sidechannel
    
    See patch documentation and comments.
    
    This is part of XSA-320 / CVE-2020-0543
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 6a49b9a7920c82015381740905582b666160d955)
---
 docs/misc/xen-command-line.markdown |  8 +++++++-
 xen/arch/x86/acpi/power.c           |  3 +++
 xen/arch/x86/smpboot.c              |  8 +++++---
 xen/arch/x86/spec_ctrl.c            | 41 ++++++++++++++++++++++++++++++++++++-
 xen/include/asm-x86/spec_ctrl.h     |  2 ++
 5 files changed, 57 insertions(+), 5 deletions(-)

diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown
index ab26a26381..b96f93c95e 100644
--- a/docs/misc/xen-command-line.markdown
+++ b/docs/misc/xen-command-line.markdown
@@ -1809,7 +1809,7 @@ false disable the quirk workaround, which is also the default.
 ### spec-ctrl (x86)
 > `= List of [ <bool>, xen=<bool>, {pv,hvm,msr-sc,rsb,md-clear}=<bool>,
 >              bti-thunk=retpoline|lfence|jmp, {ibrs,ibpb,ssbd,eager-fpu,
->              l1d-flush}=<bool> ]`
+>              l1d-flush,srb-lock}=<bool> ]`
 
 Controls for speculative execution sidechannel mitigations.  By default, Xen
 will pick the most appropriate mitigations based on compiled in support,
@@ -1881,6 +1881,12 @@ Irrespective of Xen's setting, the feature is virtualised for HVM guests to
 use.  By default, Xen will enable this mitigation on hardware believed to be
 vulnerable to L1TF.
 
+On hardware supporting SRBDS_CTRL, the `srb-lock=` option can be used to force
+or prevent Xen from protect the Special Register Buffer from leaking stale
+data. By default, Xen will enable this mitigation, except on parts where MDS
+is fixed and TAA is fixed/mitigated (in which case, there is believed to be no
+way for an attacker to obtain the stale data).
+
 ### sync\_console
 > `= <boolean>`
 
diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
index f3480aa800..4d72b6ce97 100644
--- a/xen/arch/x86/acpi/power.c
+++ b/xen/arch/x86/acpi/power.c
@@ -259,6 +259,9 @@ static int enter_state(u32 state)
     ci->spec_ctrl_flags |= (default_spec_ctrl_flags & SCF_ist_wrmsr);
     spec_ctrl_exit_idle(ci);
 
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+        wrmsrl(MSR_MCU_OPT_CTRL, default_xen_mcu_opt_ctrl);
+
  done:
     spin_debug_enable();
     local_irq_restore(flags);
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index cdf53afc1e..b4a09f2dc2 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -363,12 +363,14 @@ void start_secondary(void *unused)
         microcode_resume_cpu(cpu);
 
     /*
-     * If MSR_SPEC_CTRL is available, apply Xen's default setting and discard
-     * any firmware settings.  Note: MSR_SPEC_CTRL may only become available
-     * after loading microcode.
+     * If any speculative control MSRs are available, apply Xen's default
+     * settings.  Note: These MSRs may only become available after loading
+     * microcode.
      */
     if ( boot_cpu_has(X86_FEATURE_IBRSB) )
         wrmsrl(MSR_SPEC_CTRL, default_xen_spec_ctrl);
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+        wrmsrl(MSR_MCU_OPT_CTRL, default_xen_mcu_opt_ctrl);
 
     tsx_init(); /* Needs microcode.  May change HLE/RTM feature bits. */
 
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index b7733b34f6..cc0946b963 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -63,6 +63,9 @@ static unsigned int __initdata l1d_maxphysaddr;
 static bool __initdata cpu_has_bug_msbds_only; /* => minimal HT impact. */
 static bool __initdata cpu_has_bug_mds; /* Any other M{LP,SB,FB}DS combination. */
 
+static int8_t __initdata opt_srb_lock = -1;
+uint64_t __read_mostly default_xen_mcu_opt_ctrl;
+
 static int __init parse_bti(const char *s)
 {
     const char *ss;
@@ -150,6 +153,7 @@ static int __init parse_spec_ctrl(const char *s)
             opt_ibpb = false;
             opt_ssbd = false;
             opt_l1d_flush = 0;
+            opt_srb_lock = 0;
         }
         else if ( val > 0 )
             rc = -EINVAL;
@@ -215,6 +219,8 @@ static int __init parse_spec_ctrl(const char *s)
             opt_eager_fpu = val;
         else if ( (val = parse_boolean("l1d-flush", s, ss)) >= 0 )
             opt_l1d_flush = val;
+        else if ( (val = parse_boolean("srb-lock", s, ss)) >= 0 )
+            opt_srb_lock = val;
         else
             rc = -EINVAL;
 
@@ -378,7 +384,7 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
                "\n");
 
     /* Settings for Xen's protection, irrespective of guests. */
-    printk("  Xen settings: BTI-Thunk %s, SPEC_CTRL: %s%s%s, Other:%s%s%s\n",
+    printk("  Xen settings: BTI-Thunk %s, SPEC_CTRL: %s%s%s, Other:%s%s%s%s\n",
            thunk == THUNK_NONE      ? "N/A" :
            thunk == THUNK_RETPOLINE ? "RETPOLINE" :
            thunk == THUNK_LFENCE    ? "LFENCE" :
@@ -389,6 +395,8 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
            (default_xen_spec_ctrl & SPEC_CTRL_SSBD)  ? " SSBD+" : " SSBD-",
            !(caps & ARCH_CAPS_TSX_CTRL)              ? "" :
            (opt_tsx & 1)                             ? " TSX+" : " TSX-",
+           !boot_cpu_has(X86_FEATURE_SRBDS_CTRL)     ? "" :
+           opt_srb_lock                              ? " SRB_LOCK+" : " SRB_LOCK-",
            opt_ibpb                                  ? " IBPB"  : "",
            opt_l1d_flush                             ? " L1D_FLUSH" : "",
            opt_md_clear_pv || opt_md_clear_hvm       ? " VERW"  : "");
@@ -1176,6 +1184,34 @@ void __init init_speculation_mitigations(void)
         tsx_init();
     }
 
+    /* Calculate suitable defaults for MSR_MCU_OPT_CTRL */
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+    {
+        uint64_t val;
+
+        rdmsrl(MSR_MCU_OPT_CTRL, val);
+
+        /*
+         * On some SRBDS-affected hardware, it may be safe to relax srb-lock
+         * by default.
+         *
+         * On parts which enumerate MDS_NO and not TAA_NO, TSX is the only way
+         * to access the Fill Buffer.  If TSX isn't available (inc. SKU
+         * reasons on some models), or TSX is explicitly disabled, then there
+         * is no need for the extra overhead to protect RDRAND/RDSEED.
+         */
+        if ( opt_srb_lock == -1 &&
+             (caps & (ARCH_CAPS_MDS_NO|ARCH_CAPS_TAA_NO)) == ARCH_CAPS_MDS_NO &&
+             (!cpu_has_hle || ((caps & ARCH_CAPS_TSX_CTRL) && opt_tsx == 0)) )
+            opt_srb_lock = 0;
+
+        val &= ~MCU_OPT_CTRL_RNGDS_MITG_DIS;
+        if ( !opt_srb_lock )
+            val |= MCU_OPT_CTRL_RNGDS_MITG_DIS;
+
+        default_xen_mcu_opt_ctrl = val;
+    }
+
     print_details(thunk, caps);
 
     /*
@@ -1207,6 +1243,9 @@ void __init init_speculation_mitigations(void)
 
         wrmsrl(MSR_SPEC_CTRL, bsp_delay_spec_ctrl ? 0 : default_xen_spec_ctrl);
     }
+
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+        wrmsrl(MSR_MCU_OPT_CTRL, default_xen_mcu_opt_ctrl);
 }
 
 static void __init __maybe_unused build_assertions(void)
diff --git a/xen/include/asm-x86/spec_ctrl.h b/xen/include/asm-x86/spec_ctrl.h
index 98a0a504f6..df862ec4d0 100644
--- a/xen/include/asm-x86/spec_ctrl.h
+++ b/xen/include/asm-x86/spec_ctrl.h
@@ -46,6 +46,8 @@ extern int8_t opt_pv_l1tf_hwdom, opt_pv_l1tf_domu;
  */
 extern paddr_t l1tf_addr_mask, l1tf_safe_maddr;
 
+extern uint64_t default_xen_mcu_opt_ctrl;
+
 static inline void init_shadow_spec_ctrl_state(void)
 {
     struct cpu_info *info = get_cpu_info();
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.10


From xen-changelog-bounces@lists.xenproject.org Tue Jun 09 17:12:51 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Jun 2020 17:12:51 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jihnv-0007G9-K8; Tue, 09 Jun 2020 17:12:51 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=1bQd=7W=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jihnv-0007Fy-0L
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 17:12:51 +0000
X-Inumbo-ID: 727295de-aa74-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 727295de-aa74-11ea-bb8b-bc764e2007e4;
 Tue, 09 Jun 2020 17:12:50 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=d89C9b9ELQ3L/8e3kFwoqrl3m3ryO0MMqkrHXiDkv1w=; b=bKFOOAWU1dSIBIrsp/vq3wzp8z
 DFFfXsg86HaEyO8chFdGS5X/zgvR7M1nJvRl/j5repAmOc2PB+1LAxekWZP5qrDAAs+RSeO5a9wiR
 Bv4xtpk9AtIVg6AG/jcleLyahralHAzFSvKV7Ux2Kk2RIsh+1Na60pA5XyD5QPhQkNb8=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jihnu-0004UO-2I
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 17:12:50 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jihnu-0002q9-0o
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 17:12:50 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.9] x86/spec-ctrl: CPUID/MSR definitions for Special
 Register Buffer Data Sampling
Message-Id: <E1jihnu-0002q9-0o@xenbits.xenproject.org>
Date: Tue, 09 Jun 2020 17:12:50 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 04af886e1bc87bb321339417c5588d12f506003c
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 8 19:47:46 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jun 9 17:46:49 2020 +0100

    x86/spec-ctrl: CPUID/MSR definitions for Special Register Buffer Data Sampling
    
    This is part of XSA-320 / CVE-2020-0543
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Wei Liu <wl@xen.org>
    (cherry picked from commit caab85ab58c0cdf74ab070a5de5c4df89f509ff3)
---
 docs/misc/xen-command-line.markdown         | 8 ++++----
 tools/libxl/libxl_cpuid.c                   | 1 +
 tools/misc/xen-cpuid.c                      | 3 ++-
 xen/arch/x86/cpuid.c                        | 5 +++++
 xen/arch/x86/hvm/hvm.c                      | 2 ++
 xen/arch/x86/spec_ctrl.c                    | 3 ++-
 xen/arch/x86/traps.c                        | 2 ++
 xen/include/asm-x86/msr-index.h             | 3 +++
 xen/include/public/arch-x86/cpufeatureset.h | 1 +
 9 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown
index 80048d4230..177decaece 100644
--- a/docs/misc/xen-command-line.markdown
+++ b/docs/misc/xen-command-line.markdown
@@ -456,10 +456,10 @@ accounting for hardware capabilities as enumerated via CPUID.
 
 Currently accepted:
 
-The Speculation Control hardware features `md-clear`, `ibrsb`, `stibp`, `ibpb`,
-`l1d-flush` and `ssbd` are used by default if available and applicable.  They can
-be ignored, e.g. `no-ibrsb`, at which point Xen won't use them itself, and
-won't offer them to guests.
+The Speculation Control hardware features `srbds-ctrl`, `md-clear`, `ibrsb`,
+`stibp`, `ibpb`, `l1d-flush` and `ssbd` are used by default if available and
+applicable.  They can be ignored, e.g. `no-ibrsb`, at which point Xen won't
+use them itself, and won't offer them to guests.
 
 ### cpuid\_mask\_cpu (AMD only)
 > `= fam_0f_rev_c | fam_0f_rev_d | fam_0f_rev_e | fam_0f_rev_f | fam_0f_rev_g | fam_10_rev_b | fam_10_rev_c | fam_11_rev_b`
diff --git a/tools/libxl/libxl_cpuid.c b/tools/libxl/libxl_cpuid.c
index 20d060251a..5a2c67fcac 100644
--- a/tools/libxl/libxl_cpuid.c
+++ b/tools/libxl/libxl_cpuid.c
@@ -158,6 +158,7 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
         {"de",           0x00000001, NA, CPUID_REG_EDX,  2,  1},
         {"vme",          0x00000001, NA, CPUID_REG_EDX,  1,  1},
         {"fpu",          0x00000001, NA, CPUID_REG_EDX,  0,  1},
+        {"srbds-ctrl",   0x00000007,  0, CPUID_REG_EDX,  9,  1},
         {"md-clear",     0x00000007,  0, CPUID_REG_EDX, 10,  1},
         {"ibrsb",        0x00000007,  0, CPUID_REG_EDX, 26,  1},
         {"stibp",        0x00000007,  0, CPUID_REG_EDX, 27,  1},
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index 72c67d0e77..b853656404 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -157,8 +157,9 @@ static const char *str_7d0[32] =
 
     [ 2] = "avx512_4vnniw", [ 3] = "avx512_4fmaps",
 
-    [4 ... 9] = "REZ",
+    [4 ... 7] = "REZ",
 
+    [ 8] = "REZ",           [ 9] = "srbds-ctrl",
     [10] = "md-clear",      [11] = "REZ",
     [12] = "REZ",           [13] = "tsx-force-abort",
 
diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 9aaf8b8283..b4988ba527 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -58,6 +58,11 @@ static int __init parse_xen_cpuid(const char *s)
             if ( !val )
                 setup_clear_cpu_cap(X86_FEATURE_SSBD);
         }
+        else if ( (val = parse_boolean("srbds-ctrl", s, ss)) >= 0 )
+        {
+            if ( !val )
+                setup_clear_cpu_cap(X86_FEATURE_SRBDS_CTRL);
+        }
         else
             rc = -EINVAL;
 
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 2aa9ac06a4..e03c221f54 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -3445,6 +3445,7 @@ int hvm_msr_read_intercept(unsigned int msr, uint64_t *msr_content)
         /* Write-only */
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
+    case MSR_MCU_OPT_CTRL:
         /* Not offered to guests. */
         goto gp_fault;
 
@@ -3671,6 +3672,7 @@ int hvm_msr_write_intercept(unsigned int msr, uint64_t msr_content,
         /* Read-only */
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
+    case MSR_MCU_OPT_CTRL:
         /* Not offered to guests. */
         goto gp_fault;
 
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index f44df6ff43..e212a20127 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -348,12 +348,13 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
     printk("Speculative mitigation facilities:\n");
 
     /* Hardware features which pertain to speculative mitigations. */
-    printk("  Hardware features:%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
+    printk("  Hardware features:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
            (_7d0 & cpufeat_mask(X86_FEATURE_IBRSB)) ? " IBRS/IBPB" : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_STIBP)) ? " STIBP"     : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_L1D_FLUSH)) ? " L1D_FLUSH" : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_SSBD))  ? " SSBD"      : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_MD_CLEAR)) ? " MD_CLEAR" : "",
+           (_7d0 & cpufeat_mask(X86_FEATURE_SRBDS_CTRL)) ? " SRBDS_CTRL" : "",
            (e8b  & cpufeat_mask(X86_FEATURE_IBPB))  ? " IBPB"      : "",
            (caps & ARCH_CAPABILITIES_IBRS_ALL)      ? " IBRS_ALL"  : "",
            (caps & ARCH_CAPABILITIES_RDCL_NO)       ? " RDCL_NO"   : "",
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 9b4bb6a009..6ea582c393 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -2655,6 +2655,7 @@ static int priv_op_read_msr(unsigned int reg, uint64_t *val,
         /* Write-only */
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
+    case MSR_MCU_OPT_CTRL:
         /* Not offered to guests. */
         break;
 
@@ -2880,6 +2881,7 @@ static int priv_op_write_msr(unsigned int reg, uint64_t val,
         /* The MSR is read-only. */
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
+    case MSR_MCU_OPT_CTRL:
         /* Not offered to guests. */
         break;
 
diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h
index 5d636cc250..d77aeb9afa 100644
--- a/xen/include/asm-x86/msr-index.h
+++ b/xen/include/asm-x86/msr-index.h
@@ -176,6 +176,9 @@
 #define MSR_IA32_VMX_TRUE_ENTRY_CTLS            0x490
 #define MSR_IA32_VMX_VMFUNC                     0x491
 
+#define MSR_MCU_OPT_CTRL                    0x00000123
+#define  MCU_OPT_CTRL_RNGDS_MITG_DIS        (_AC(1, ULL) <<  0)
+
 /* K7/K8 MSRs. Not complete. See the architecture manual for a more
    complete list. */
 #define MSR_K7_EVNTSEL0			0xc0010000
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 000a941e50..c75014f4e3 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -241,6 +241,7 @@ XEN_CPUFEATURE(IBPB,          8*32+12) /*A  IBPB support only (no IBRS, used by
 /* 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(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 */
 XEN_CPUFEATURE(IBRSB,         9*32+26) /*A  IBRS and IBPB support (used by Intel) */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.9


From xen-changelog-bounces@lists.xenproject.org Tue Jun 09 17:13:02 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Jun 2020 17:13:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jiho6-0007HK-Lm; Tue, 09 Jun 2020 17:13:02 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=1bQd=7W=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jiho6-0007HD-B2
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 17:13:02 +0000
X-Inumbo-ID: 787816c0-aa74-11ea-b345-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 787816c0-aa74-11ea-b345-12813bfff9fa;
 Tue, 09 Jun 2020 17:13:00 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=HqctnY1rIN5EcdAwTbWdn9N8x95uIyA0un7yBt/SCcE=; b=BIKgHjTp7n8ARNeOu+6iq5gDUf
 oqzJrpGIslGb4163GIYomLoH9s0qN5z16aS7m9Gj1KFtSh3FQ6QKVDuFD8K8++Ke4geoM0HivlMte
 Seup8Ttst1R6QQQtN7JQOYTSTmngy6LfGjnMHqaQm8YmNCTD2SB5xwfsAQC/oc2vAGN4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jiho4-0004UY-5S
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 17:13:00 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jiho4-0002qx-4f
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 17:13:00 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.9] x86/spec-ctrl: Mitigate the Special Register Buffer
 Data Sampling sidechannel
Message-Id: <E1jiho4-0002qx-4f@xenbits.xenproject.org>
Date: Tue, 09 Jun 2020 17:13:00 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit ad0c1a0023077ee03d325a6f84bb654150539f49
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 8 19:47:46 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jun 9 17:46:56 2020 +0100

    x86/spec-ctrl: Mitigate the Special Register Buffer Data Sampling sidechannel
    
    See patch documentation and comments.
    
    This is part of XSA-320 / CVE-2020-0543
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 6a49b9a7920c82015381740905582b666160d955)
---
 docs/misc/xen-command-line.markdown |  8 +++++++-
 xen/arch/x86/acpi/power.c           |  3 +++
 xen/arch/x86/smpboot.c              |  8 +++++---
 xen/arch/x86/spec_ctrl.c            | 41 ++++++++++++++++++++++++++++++++++++-
 xen/include/asm-x86/spec_ctrl.h     |  2 ++
 5 files changed, 57 insertions(+), 5 deletions(-)

diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown
index 177decaece..4b34eefeb5 100644
--- a/docs/misc/xen-command-line.markdown
+++ b/docs/misc/xen-command-line.markdown
@@ -1704,7 +1704,7 @@ false disable the quirk workaround, which is also the default.
 ### spec-ctrl (x86)
 > `= List of [ <bool>, xen=<bool>, {pv,hvm,msr-sc,rsb,md-clear}=<bool>,
 >              bti-thunk=retpoline|lfence|jmp, {ibrs,ibpb,ssbd,eager-fpu,
->              l1d-flush}=<bool> ]`
+>              l1d-flush,srb-lock}=<bool> ]`
 
 Controls for speculative execution sidechannel mitigations.  By default, Xen
 will pick the most appropriate mitigations based on compiled in support,
@@ -1776,6 +1776,12 @@ Irrespective of Xen's setting, the feature is virtualised for HVM guests to
 use.  By default, Xen will enable this mitigation on hardware believed to be
 vulnerable to L1TF.
 
+On hardware supporting SRBDS_CTRL, the `srb-lock=` option can be used to force
+or prevent Xen from protect the Special Register Buffer from leaking stale
+data. By default, Xen will enable this mitigation, except on parts where MDS
+is fixed and TAA is fixed/mitigated (in which case, there is believed to be no
+way for an attacker to obtain the stale data).
+
 ### sync\_console
 > `= <boolean>`
 
diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
index f3480aa800..4d72b6ce97 100644
--- a/xen/arch/x86/acpi/power.c
+++ b/xen/arch/x86/acpi/power.c
@@ -259,6 +259,9 @@ static int enter_state(u32 state)
     ci->spec_ctrl_flags |= (default_spec_ctrl_flags & SCF_ist_wrmsr);
     spec_ctrl_exit_idle(ci);
 
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+        wrmsrl(MSR_MCU_OPT_CTRL, default_xen_mcu_opt_ctrl);
+
  done:
     spin_debug_enable();
     local_irq_restore(flags);
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index 641f830cd1..9db8ef0926 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -356,12 +356,14 @@ void start_secondary(void *unused)
         microcode_resume_cpu(cpu);
 
     /*
-     * If MSR_SPEC_CTRL is available, apply Xen's default setting and discard
-     * any firmware settings.  Note: MSR_SPEC_CTRL may only become available
-     * after loading microcode.
+     * If any speculative control MSRs are available, apply Xen's default
+     * settings.  Note: These MSRs may only become available after loading
+     * microcode.
      */
     if ( boot_cpu_has(X86_FEATURE_IBRSB) )
         wrmsrl(MSR_SPEC_CTRL, default_xen_spec_ctrl);
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+        wrmsrl(MSR_MCU_OPT_CTRL, default_xen_mcu_opt_ctrl);
 
     tsx_init(); /* Needs microcode.  May change HLE/RTM feature bits. */
 
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index e212a20127..289e91fb04 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -62,6 +62,9 @@ static unsigned int __initdata l1d_maxphysaddr;
 static bool __initdata cpu_has_bug_msbds_only; /* => minimal HT impact. */
 static bool __initdata cpu_has_bug_mds; /* Any other M{LP,SB,FB}DS combination. */
 
+static int8_t __initdata opt_srb_lock = -1;
+uint64_t __read_mostly default_xen_mcu_opt_ctrl;
+
 static int __init parse_bti(const char *s)
 {
     const char *ss;
@@ -149,6 +152,7 @@ static int __init parse_spec_ctrl(char *s)
             opt_ibpb = false;
             opt_ssbd = false;
             opt_l1d_flush = 0;
+            opt_srb_lock = 0;
         }
         else if ( val > 0 )
             rc = -EINVAL;
@@ -214,6 +218,8 @@ static int __init parse_spec_ctrl(char *s)
             opt_eager_fpu = val;
         else if ( (val = parse_boolean("l1d-flush", s, ss)) >= 0 )
             opt_l1d_flush = val;
+        else if ( (val = parse_boolean("srb-lock", s, ss)) >= 0 )
+            opt_srb_lock = val;
         else
             rc = -EINVAL;
 
@@ -377,7 +383,7 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
                "\n");
 
     /* Settings for Xen's protection, irrespective of guests. */
-    printk("  Xen settings: BTI-Thunk %s, SPEC_CTRL: %s%s%s, Other:%s%s%s\n",
+    printk("  Xen settings: BTI-Thunk %s, SPEC_CTRL: %s%s%s, Other:%s%s%s%s\n",
            thunk == THUNK_NONE      ? "N/A" :
            thunk == THUNK_RETPOLINE ? "RETPOLINE" :
            thunk == THUNK_LFENCE    ? "LFENCE" :
@@ -388,6 +394,8 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
            (default_xen_spec_ctrl & SPEC_CTRL_SSBD)  ? " SSBD+" : " SSBD-",
            !(caps & ARCH_CAPS_TSX_CTRL)              ? "" :
            (opt_tsx & 1)                             ? " TSX+" : " TSX-",
+           !boot_cpu_has(X86_FEATURE_SRBDS_CTRL)     ? "" :
+           opt_srb_lock                              ? " SRB_LOCK+" : " SRB_LOCK-",
            opt_ibpb                                  ? " IBPB"  : "",
            opt_l1d_flush                             ? " L1D_FLUSH" : "",
            opt_md_clear_pv || opt_md_clear_hvm       ? " VERW"  : "");
@@ -1152,6 +1160,34 @@ void __init init_speculation_mitigations(void)
         tsx_init();
     }
 
+    /* Calculate suitable defaults for MSR_MCU_OPT_CTRL */
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+    {
+        uint64_t val;
+
+        rdmsrl(MSR_MCU_OPT_CTRL, val);
+
+        /*
+         * On some SRBDS-affected hardware, it may be safe to relax srb-lock
+         * by default.
+         *
+         * On parts which enumerate MDS_NO and not TAA_NO, TSX is the only way
+         * to access the Fill Buffer.  If TSX isn't available (inc. SKU
+         * reasons on some models), or TSX is explicitly disabled, then there
+         * is no need for the extra overhead to protect RDRAND/RDSEED.
+         */
+        if ( opt_srb_lock == -1 &&
+             (caps & (ARCH_CAPS_MDS_NO|ARCH_CAPS_TAA_NO)) == ARCH_CAPS_MDS_NO &&
+             (!cpu_has_hle || ((caps & ARCH_CAPS_TSX_CTRL) && opt_tsx == 0)) )
+            opt_srb_lock = 0;
+
+        val &= ~MCU_OPT_CTRL_RNGDS_MITG_DIS;
+        if ( !opt_srb_lock )
+            val |= MCU_OPT_CTRL_RNGDS_MITG_DIS;
+
+        default_xen_mcu_opt_ctrl = val;
+    }
+
     print_details(thunk, caps);
 
     /*
@@ -1183,6 +1219,9 @@ void __init init_speculation_mitigations(void)
 
         wrmsrl(MSR_SPEC_CTRL, bsp_delay_spec_ctrl ? 0 : default_xen_spec_ctrl);
     }
+
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+        wrmsrl(MSR_MCU_OPT_CTRL, default_xen_mcu_opt_ctrl);
 }
 
 static void __init __maybe_unused build_assertions(void)
diff --git a/xen/include/asm-x86/spec_ctrl.h b/xen/include/asm-x86/spec_ctrl.h
index 98a0a504f6..df862ec4d0 100644
--- a/xen/include/asm-x86/spec_ctrl.h
+++ b/xen/include/asm-x86/spec_ctrl.h
@@ -46,6 +46,8 @@ extern int8_t opt_pv_l1tf_hwdom, opt_pv_l1tf_domu;
  */
 extern paddr_t l1tf_addr_mask, l1tf_safe_maddr;
 
+extern uint64_t default_xen_mcu_opt_ctrl;
+
 static inline void init_shadow_spec_ctrl_state(void)
 {
     struct cpu_info *info = get_cpu_info();
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.9


From xen-changelog-bounces@lists.xenproject.org Tue Jun 09 19:44:08 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Jun 2020 19: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 1jikAH-0004As-0s; Tue, 09 Jun 2020 19:44:05 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=1bQd=7W=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jikAF-0004An-Td
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 19:44:03 +0000
X-Inumbo-ID: 91fd45a6-aa89-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 91fd45a6-aa89-11ea-bca7-bc764e2007e4;
 Tue, 09 Jun 2020 19: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=Zlnk70lCrfF0GMKBTJq1x4s5OURkxJTkgpd1AgxRFwU=; b=4AoXSaqCofBcDFNXMJiHwnS7G2
 T9jybiR5/TwI/UdoVLn2KtkbBYRyzmIukAHUI+oTTpQh3shPvNSTcAYbHuWuDF60r8lsL14bZKJ1C
 r4KihQ7m9pN+SnVyI4eBubIrD9NsQGU73mh6ahR3fxYfCi+ys/84l3/Ilp4FktTQ8nEU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jikAE-0007ew-Bt
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 19:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jikAE-000445-An
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 19:44:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] Config.mk: Nail QEMU_UPSTREAM_REVISION
 MINIOS_UPSTREAM_REVISION
Message-Id: <E1jikAE-000445-An@xenbits.xenproject.org>
Date: Tue, 09 Jun 2020 19: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 2e8f29e10a8caa62c4b1dca936e8de385407f21d
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Mon Jun 8 15:17:36 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Mon Jun 8 15:17:36 2020 +0100

    Config.mk: Nail QEMU_UPSTREAM_REVISION MINIOS_UPSTREAM_REVISION
    
    We freeze these during release prep, rather than tracking whatever
    osstest passed.
    
    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 7d556aed30..f7d10b7c4c 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 ?= master
-MINIOS_UPSTREAM_REVISION ?= master
+QEMU_UPSTREAM_REVISION ?= 410cc30fdc590417ae730d635bbc70257adf6750
+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 Jun 09 19:44:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Jun 2020 19:44:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jikAQ-0004C2-2L; Tue, 09 Jun 2020 19:44: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=1bQd=7W=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jikAP-0004Bw-37
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 19:44:13 +0000
X-Inumbo-ID: 9801a65e-aa89-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 9801a65e-aa89-11ea-b7bb-bc764e2007e4;
 Tue, 09 Jun 2020 19:44:12 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=dsTWxDbkwltb36mmH+48IjS7POJLweV+RAY2ijBbCLc=; b=3tUvAOUO8rYO81QmkI87CQ0iPM
 +k32XuTReFd3Q64jJmSoTbINylzwgHVbu6uGxTrRobGpr3zNsLFNwhVXmSOwqS4pP8tqMVEDuXMO4
 vc+FY2U/pD5m//dO55fmTzPnKF1exCfnRa+uqHZ3oFxODTaLGxndcfcMDmUeFrOPmiMk=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jikAO-0007f2-FM
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 19:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jikAO-00044y-E9
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 19:44:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] Version changes for 4.14.0-rc
Message-Id: <E1jikAO-00044y-E9@xenbits.xenproject.org>
Date: Tue, 09 Jun 2020 19:44: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 726c78d14dfe6ec76f5e4c7756821a91f0a04b34
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Mon Jun 8 15:18:20 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Mon Jun 8 15:18:20 2020 +0100

    Version changes for 4.14.0-rc
    
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 README       | 10 +++++-----
 SUPPORT.md   |  2 +-
 xen/Makefile |  2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/README b/README
index d0c87a78f0..46c67d8906 100644
--- a/README
+++ b/README
@@ -1,9 +1,9 @@
 #################################
- _  _    _ _  _                         _        _     _      
-| || |  / | || |        _   _ _ __  ___| |_ __ _| |__ | | ___ 
-| || |_ | | || |_ _____| | | | '_ \/ __| __/ _` | '_ \| |/ _ \
-|__   _|| |__   _|_____| |_| | | | \__ \ || (_| | |_) | |  __/
-   |_|(_)_|  |_|        \__,_|_| |_|___/\__\__,_|_.__/|_|\___|
+ _  _    _ _  _
+| || |  / | || |        _ __ ___
+| || |_ | | || |_ _____| '__/ __|
+|__   _|| |__   _|_____| | | (__
+   |_|(_)_|  |_|       |_|  \___|
 
 #################################
 
diff --git a/SUPPORT.md b/SUPPORT.md
index a1f7eb6434..643879f0ea 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-unstable
+    Xen-Version: 4.14-rc
     Initial-Release: n/a
     Supported-Until: TBD
     Security-Support-Until: Unreleased - not yet security-supported
diff --git a/xen/Makefile b/xen/Makefile
index d53d1f7b5e..0ade7f9517 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 ?= -unstable$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .0-rc$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jun 09 19:44:24 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Jun 2020 19:44:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jikAa-0004DG-41; Tue, 09 Jun 2020 19:44: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=1bQd=7W=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jikAZ-0004D9-Eb
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 19:44:23 +0000
X-Inumbo-ID: 9e20887a-aa89-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 9e20887a-aa89-11ea-bb8b-bc764e2007e4;
 Tue, 09 Jun 2020 19:44:22 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=2xqQqWfyxa3Wc9hPvrAKLUKyWdLkFDHlZXKeXaKltjk=; b=d/YIsOSlvLqePBnaBjIDq4W1d/
 2JzZVuRE69e4adbvmLMvYQY0KzmhpOVpbtQi28U+38qGMT3U/0beekc497kVTIExji1Qa6SO4RhGo
 AtDIqS9cuPhngtkU2H1a40xWRvMzc2E5w19f41JvDXnmDYvyFdcRwjMykvMa3BtAASAQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jikAY-0007fD-O4
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 19:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jikAY-00047g-N4
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 19:44:22 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] build: fix dependency tracking for preprocessed files
Message-Id: <E1jikAY-00047g-N4@xenbits.xenproject.org>
Date: Tue, 09 Jun 2020 19:44: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 75131ad75bb3c91717b5dfda6881e61c52bfd22e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Jun 8 10:25:40 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Jun 8 10:25:40 2020 +0200

    build: fix dependency tracking for preprocessed files
    
    While the issue is more general, I noticed that asm-macros.i not getting
    re-generated as needed. This was due to its .*.d file mentioning
    asm-macros.o instead of asm-macros.i. Use -MQ here as well, and while at
    it also use -MQ to avoid the somewhat fragile sed-ary on the *.lds
    dependency tracking files. While there, further avoid open-coding $(CPP)
    and drop the bogus (Arm) / stale (x86) -Ui386.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/Rules.mk          | 4 ++--
 xen/arch/arm/Makefile | 4 +---
 xen/arch/x86/Makefile | 4 +---
 3 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/xen/Rules.mk b/xen/Rules.mk
index 2e28c57230..ebfd40caff 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -201,13 +201,13 @@ $(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): %.init.o: %.o FORCE
 	$(call if_changed,obj_init_o)
 
 quiet_cmd_cpp_i_c = CPP     $@
-cmd_cpp_i_c = $(CPP) $(filter-out -Wa$(comma)%,$(c_flags)) $< -o $@
+cmd_cpp_i_c = $(CPP) $(filter-out -Wa$(comma)%,$(c_flags)) -MQ $@ -o $@ $<
 
 quiet_cmd_cc_s_c = CC      $@
 cmd_cc_s_c = $(CC) $(filter-out -Wa$(comma)%,$(c_flags)) -S $< -o $@
 
 quiet_cmd_s_S = CPP     $@
-cmd_s_S = $(CPP) $(filter-out -Wa$(comma)%,$(a_flags)) $< -o $@
+cmd_s_S = $(CPP) $(filter-out -Wa$(comma)%,$(a_flags)) -MQ $@ -o $@ $<
 
 %.i: %.c FORCE
 	$(call if_changed,cpp_i_c)
diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index c1a1b5e803..7e82b2178c 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -123,9 +123,7 @@ asm-offsets.s: $(TARGET_SUBARCH)/asm-offsets.c
 	$(CC) $(filter-out -flto,$(c_flags)) -S -o $@ $<
 
 xen.lds: xen.lds.S
-	$(CC) -P -E -Ui386 $(a_flags) -o $@ $<
-	sed -e 's/xen\.lds\.o:/xen\.lds:/g' <.xen.lds.d >.xen.lds.d.new
-	mv -f .xen.lds.d.new .xen.lds.d
+	$(CPP) -P $(a_flags) -MQ $@ -o $@ $<
 
 dtb.o: $(CONFIG_DTB_FILE)
 
diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 07eeefbf82..b388861679 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -244,9 +244,7 @@ $(BASEDIR)/include/asm-x86/asm-macros.h: asm-macros.i Makefile
 
 efi.lds: AFLAGS-y += -DEFI
 xen.lds efi.lds: xen.lds.S
-	$(CC) -P -E -Ui386 $(filter-out -Wa$(comma)%,$(a_flags)) -o $@ $<
-	sed -e 's/.*\.lds\.o:/$(@F):/g' <.$(@F).d >.$(@F).d.new
-	mv -f .$(@F).d.new .$(@F).d
+	$(CPP) -P $(filter-out -Wa$(comma)%,$(a_flags)) -MQ $@ -o $@ $<
 
 boot/mkelf32: boot/mkelf32.c
 	$(HOSTCC) $(HOSTCFLAGS) -o $@ $<
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jun 09 19:44:35 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Jun 2020 19:44:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jikAl-0004El-71; Tue, 09 Jun 2020 19:44: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=1bQd=7W=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jikAk-0004Eb-0D
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 19:44:34 +0000
X-Inumbo-ID: a4214502-aa89-11ea-b366-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id a4214502-aa89-11ea-b366-12813bfff9fa;
 Tue, 09 Jun 2020 19:44:33 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=iIlMkTs/w2Ez0Ys3kGvXwbGlUq+VTxByYvC4AUpIirI=; b=aZsjvcdv3jM4DcTz6wk01uXp9w
 /HaTK+3MYmLT/RGlhJONVVPlzfHU0kdLbVyqcAiUMLZiXd1j0o6t0PenwPojbo25pDOekefmDaUJm
 pYVvQSDvLm2PF4NrkI2SWr9vwmNBeV0+4Lp+e6B+btiml2aZRuBRKdr0J3BMfS35zZN0=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jikAi-0007fl-R7
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 19:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jikAi-00048L-QF
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 19:44:32 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] docs/support-matrix: unbreak docs rendering
Message-Id: <E1jikAi-00048L-QF@xenbits.xenproject.org>
Date: Tue, 09 Jun 2020 19:44: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 11ba5cdb8489e4dfc1e50c948dba23cece559e77
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Jun 4 21:39:37 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Jun 8 15:19:49 2020 +0100

    docs/support-matrix: unbreak docs rendering
    
    The cronjob which renders https://xenbits.xen.org/docs/ has been broken for a
    while.  commitish_version() pulls an old version of xen/Makefile out of
    history, and uses the xenversion rule.
    
    Currently, this fails with:
    
      tmp.support-matrix.xen.make:130: scripts/Kbuild.include: No such file or directory
    
    which is because the Makefile legitimately references Kbuild.include with a
    relative rather than absolute path.
    
    Rework support-matrix-generate to use sed to extract the major/minor version,
    rather than expecting xen/Makefile to be usable in a different tree.
    
    Fixes: 945e80a7301f ("docs: Provide support-matrix-generate, to generate a support matrix in HTML")
    Backport: 4.11+
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 docs/support-matrix-generate | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/docs/support-matrix-generate b/docs/support-matrix-generate
index a3d93321f1..8a27849cf6 100755
--- a/docs/support-matrix-generate
+++ b/docs/support-matrix-generate
@@ -27,8 +27,8 @@
 #
 # Then we try to find the next previous revision.  This is done by
 # extracting the current version number from xen/Makefile.  (We make
-# some slight assumption about how xen/Makefile's xenversion target
-# works, because we want to be able to do this without checking out
+# some slight assumption about how xen/Makefile's variables are
+# written, because we want to be able to do this without checking out
 # the whole tree for the version in question.)  Then we use git log on
 # xen/Makefile to try to find a commit where the version changed.
 # This gives us the previous version number, NN.
@@ -102,12 +102,16 @@ commitish_version () {
     esac
 
     git cat-file blob "$commitish:$versionfile" >"$tmp_versionfile"
-    version=$(make --no-print-directory -C docs \
-                   -f "${tmp_versionfile#docs/}" xenversion)
-    case "$version" in
-        *.*.*) version="${version%.*}" ;;
-    esac
-    printf "%s\n" "${version%%-*}"
+
+    local maj=$(sed -n 's/.*XEN_VERSION.*= \([0-9]\+\)/\1/p' < "$tmp_versionfile")
+    local min=$(sed -n 's/.*XEN_SUBVERSION.*= \([0-9]\+\)/\1/p' < "$tmp_versionfile")
+
+    if [ -z $maj ] || [ -z $min ];
+    then
+        fail "Unable to identify Xen version for $commitish";
+    fi
+
+    printf "%d.%d\n" "$maj" "$min"
 }
 
 exec 4>"$tmp_revisions"
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jun 09 19:44:45 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Jun 2020 19:44:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jikAv-0004Ft-8S; Tue, 09 Jun 2020 19:44: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=1bQd=7W=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jikAu-0004Fd-1b
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 19:44:44 +0000
X-Inumbo-ID: aa263d4a-aa89-11ea-b366-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id aa263d4a-aa89-11ea-b366-12813bfff9fa;
 Tue, 09 Jun 2020 19:44:43 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=UbIRM1X/N4hAlgwrxvuI7M+ix1Kn4sAww43HHuaBNlE=; b=R1NXJGj9q9mIAJxi9GrDnoe5h+
 4aWO03AwnD7n+pwBOMladt1xf37uv1CN2yaCXXPtxBMNjPDX6VK/o6n9owBmjCNtErLkqWhMWGPX/
 6cYMBc0QauZYhi5FZJPRwklmYZiODsJEcV9tPpA2i4Grt73P4zfn26kIhVqWcdh+AvHM=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jikAs-0007fs-U6
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 19:44:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jikAs-00049H-TF
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 19:44:42 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] Merge remote-tracking branch 'origin/staging' into
 staging
Message-Id: <E1jikAs-00049H-TF@xenbits.xenproject.org>
Date: Tue, 09 Jun 2020 19:44: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 03dc5f00f66e9c29afdfc9a72e4e6d70ea50b191
Merge: 726c78d14dfe6ec76f5e4c7756821a91f0a04b34 11ba5cdb8489e4dfc1e50c948dba23cece559e77
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Mon Jun 8 16:26:57 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Mon Jun 8 16:26:57 2020 +0100

    Merge remote-tracking branch 'origin/staging' into staging

 docs/support-matrix-generate | 20 ++++++++++++--------
 xen/Rules.mk                 |  4 ++--
 xen/arch/arm/Makefile        |  4 +---
 xen/arch/x86/Makefile        |  4 +---
 4 files changed, 16 insertions(+), 16 deletions(-)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jun 09 19:44:59 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Jun 2020 19:44:59 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jikB9-0004H4-AP; Tue, 09 Jun 2020 19:44:59 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=1bQd=7W=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jikB8-0004Gz-F5
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 19:44:58 +0000
X-Inumbo-ID: b02aacd0-aa89-11ea-b366-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id b02aacd0-aa89-11ea-b366-12813bfff9fa;
 Tue, 09 Jun 2020 19:44:53 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=lg9L9Kjx3aYxxTelhOV6mLaSGQc0j+YsyFLCJ7g4YJU=; b=F0B6/XlKcN/WJLAIz7Xo140peQ
 ARPgNHGbAPwXaGqePf1jLIAL+tLK/p9yS/uL7+c/mlOj4MseBTGY3b9QxCNQZaVoZHL6lkbB+tUE7
 8GgjbksDCXdbgK29RPlCFNSvaBWsSqYrxp44Xo4ae4UaoOnwtw2R4U086QcaDwEmPVZk=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jikB3-0007g2-1Q
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 19:44:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jikB3-0004A6-0O
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 19:44:53 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] golang/xenlight: remove call to go fmt in gengotypes.py
Message-Id: <E1jikB3-0004A6-0O@xenbits.xenproject.org>
Date: Tue, 09 Jun 2020 19:44: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 16c36d27f2644737c34d4a0fc1de525d0ee185ad
Author:     Nick Rosbrook <rosbrookn@ainfosec.com>
AuthorDate: Mon Jun 8 17:10:39 2020 +0100
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Mon Jun 8 17:11:38 2020 +0100

    golang/xenlight: remove call to go fmt in gengotypes.py
    
    Since the golang bindings are now set to be re-generated whenever a
    change is made to tools/libxl/libxl_types.idl, the call to go fmt in
    gengotypes.py results in a dirty git tree for users without go
    installed.
    
    As an immediate fix, just remove the call to go fmt from gengotypes.py.
    While here, make sure the DO NOT EDIT comment and package declaration
    remain formatted correctly. All other generated code is left
    un-formatted for now.
    
    Signed-off-by: Nick Rosbrook <rosbrookn@ainfosec.com>
    Reviewed-by: George Dunlap <george.dunlap@citrix.com>
    
    Remove trailing whitespace.
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
---
 tools/golang/xenlight/gengotypes.py  |   34 +-
 tools/golang/xenlight/helpers.gen.go | 7647 ++++++++++++++++------------------
 tools/golang/xenlight/types.gen.go   | 1708 ++++----
 3 files changed, 4394 insertions(+), 4995 deletions(-)

diff --git a/tools/golang/xenlight/gengotypes.py b/tools/golang/xenlight/gengotypes.py
index 2b71aa1ea8..ecca59745f 100644
--- a/tools/golang/xenlight/gengotypes.py
+++ b/tools/golang/xenlight/gengotypes.py
@@ -39,7 +39,7 @@ def xenlight_golang_generate_types(path = None, types = None, comment = None):
     with open(path, 'w') as f:
         if comment is not None:
             f.write(comment)
-        f.write('package xenlight\n')
+        f.write('package xenlight\n\n')
 
         for ty in types:
             (tdef, extras) = xenlight_golang_type_define(ty)
@@ -52,8 +52,6 @@ def xenlight_golang_generate_types(path = None, types = None, comment = None):
                 f.write(extra)
                 f.write('\n')
 
-    go_fmt(path)
-
 def xenlight_golang_type_define(ty = None):
     """
     Generate the Go type definition of ty.
@@ -205,7 +203,7 @@ def xenlight_golang_generate_helpers(path = None, types = None, comment = None):
     with open(path, 'w') as f:
         if comment is not None:
             f.write(comment)
-        f.write('package xenlight\n')
+        f.write('package xenlight\n\n')
         f.write('import (\n"unsafe"\n"errors"\n"fmt"\n)\n')
 
         # Cgo preamble
@@ -240,14 +238,12 @@ def xenlight_golang_generate_helpers(path = None, types = None, comment = None):
             f.write(xenlight_golang_define_to_C(ty))
             f.write('\n')
 
-    go_fmt(path)
-
 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 *{}) fromC(xc *C.{}) error {{\n {}\n return nil}}\n'
 
     goname = xenlight_golang_fmt_name(ty.typename)
     cname  = ty.typename
@@ -317,7 +313,7 @@ def xenlight_golang_convert_from_C(ty = None, outer_name = None, cvarname = None
         # 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 += 'err != nil {{\nreturn fmt.Errorf("converting field {}: %v", err)\n}}\n'.format(goname)
 
     elif gotypename == 'string':
         # Use the cgo helper for converting C strings.
@@ -399,7 +395,7 @@ def xenlight_golang_union_from_C(ty = None, union_name = '', struct_name = ''):
 
         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 += 'err != nil {{\n return fmt.Errorf("converting field {}: %v", err)\n}}\n'.format(goname)
 
         s += 'x.{} = {}\n'.format(field_name, goname)
 
@@ -450,7 +446,7 @@ 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 *{}) toC(xc *C.{}) (err error){{{}\n return nil\n }}\n'
     body = ''
 
     if ty.dispose_fn is not None:
@@ -520,7 +516,7 @@ def xenlight_golang_convert_to_C(ty = None, outer_name = None,
     if not is_castable:
         s += 'if err := {}.{}.toC(&{}.{}); 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 {}: %v", err)\n}}\n'.format(goname)
 
     elif gotypename == 'string':
         # Use the cgo helper for converting C strings.
@@ -625,7 +621,7 @@ def xenlight_golang_array_to_C(ty = None):
                                                                          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 += 'return fmt.Errorf("converting field {}: %v", err)\n'.format(goname)
     s += '}\n}\n}\n'
 
     return s
@@ -719,10 +715,6 @@ def xenlight_golang_fmt_name(name, exported = True):
 
     return words[0] + ''.join(x.title() for x in words[1:])
 
-def go_fmt(path):
-    """ Call go fmt on the given path. """
-    os.system('go fmt {}'.format(path))
-
 if __name__ == '__main__':
     idlname = sys.argv[1]
 
@@ -733,12 +725,12 @@ if __name__ == '__main__':
         builtin_type_names[name] = xenlight_golang_fmt_name(name)
 
     header_comment="""// DO NOT EDIT.
-    //
-    // This file is generated by:
-    // {}
-    //
+//
+// This file is generated by:
+// {}
+//
 
-    """.format(' '.join(sys.argv))
+""".format(' '.join(sys.argv))
 
     xenlight_golang_generate_types(types=types,
                                    comment=header_comment)
diff --git a/tools/golang/xenlight/helpers.gen.go b/tools/golang/xenlight/helpers.gen.go
index 1e58ebbab2..935d3bc50a 100644
--- a/tools/golang/xenlight/helpers.gen.go
+++ b/tools/golang/xenlight/helpers.gen.go
@@ -7,11 +7,10 @@
 package xenlight
 
 import (
-	"errors"
-	"fmt"
-	"unsafe"
+"unsafe"
+"errors"
+"fmt"
 )
-
 /*
 #cgo LDFLAGS: -lxenlight
 #include <stdlib.h>
@@ -30,4710 +29,4154 @@ typedef typeof(((struct libxl_psr_hw_info *)NULL)->u.cat)libxl_psr_hw_info_type_
 typedef typeof(((struct libxl_psr_hw_info *)NULL)->u.mba)libxl_psr_hw_info_type_union_mba;
 */
 import "C"
-
 // NewIoportRange returns an instance of IoportRange initialized with defaults.
 func NewIoportRange() (*IoportRange, error) {
-	var (
-		x  IoportRange
-		xc C.libxl_ioport_range
-	)
+var (
+x IoportRange
+xc C.libxl_ioport_range)
 
-	C.libxl_ioport_range_init(&xc)
-	defer C.libxl_ioport_range_dispose(&xc)
+C.libxl_ioport_range_init(&xc)
+defer C.libxl_ioport_range_dispose(&xc)
 
-	if err := x.fromC(&xc); err != nil {
-		return nil, err
-	}
+if err := x.fromC(&xc); err != nil {
+return nil, err }
 
-	return &x, nil
-}
+return &x, nil}
 
 func (x *IoportRange) fromC(xc *C.libxl_ioport_range) error {
-	x.First = uint32(xc.first)
-	x.Number = uint32(xc.number)
+ x.First = uint32(xc.first)
+x.Number = uint32(xc.number)
 
-	return nil
-}
+ return nil}
 
-func (x *IoportRange) toC(xc *C.libxl_ioport_range) (err error) {
-	defer func() {
-		if err != nil {
-			C.libxl_ioport_range_dispose(xc)
-		}
-	}()
+func (x *IoportRange) toC(xc *C.libxl_ioport_range) (err error){defer func(){
+if err != nil{
+C.libxl_ioport_range_dispose(xc)}
+}()
 
-	xc.first = C.uint32_t(x.First)
-	xc.number = C.uint32_t(x.Number)
+xc.first = C.uint32_t(x.First)
+xc.number = C.uint32_t(x.Number)
 
-	return nil
-}
+ return nil
+ }
 
 // NewIomemRange returns an instance of IomemRange initialized with defaults.
 func NewIomemRange() (*IomemRange, error) {
-	var (
-		x  IomemRange
-		xc C.libxl_iomem_range
-	)
+var (
+x IomemRange
+xc C.libxl_iomem_range)
 
-	C.libxl_iomem_range_init(&xc)
-	defer C.libxl_iomem_range_dispose(&xc)
+C.libxl_iomem_range_init(&xc)
+defer C.libxl_iomem_range_dispose(&xc)
 
-	if err := x.fromC(&xc); err != nil {
-		return nil, err
-	}
+if err := x.fromC(&xc); err != nil {
+return nil, err }
 
-	return &x, nil
-}
+return &x, nil}
 
 func (x *IomemRange) fromC(xc *C.libxl_iomem_range) error {
-	x.Start = uint64(xc.start)
-	x.Number = uint64(xc.number)
-	x.Gfn = uint64(xc.gfn)
+ x.Start = uint64(xc.start)
+x.Number = uint64(xc.number)
+x.Gfn = uint64(xc.gfn)
 
-	return nil
-}
+ return nil}
 
-func (x *IomemRange) toC(xc *C.libxl_iomem_range) (err error) {
-	defer func() {
-		if err != nil {
-			C.libxl_iomem_range_dispose(xc)
-		}
-	}()
+func (x *IomemRange) toC(xc *C.libxl_iomem_range) (err error){defer func(){
+if err != nil{
+C.libxl_iomem_range_dispose(xc)}
+}()
 
-	xc.start = C.uint64_t(x.Start)
-	xc.number = C.uint64_t(x.Number)
-	xc.gfn = C.uint64_t(x.Gfn)
+xc.start = C.uint64_t(x.Start)
+xc.number = C.uint64_t(x.Number)
+xc.gfn = C.uint64_t(x.Gfn)
 
-	return nil
-}
+ return nil
+ }
 
 // NewVgaInterfaceInfo returns an instance of VgaInterfaceInfo initialized with defaults.
 func NewVgaInterfaceInfo() (*VgaInterfaceInfo, error) {
-	var (
-		x  VgaInterfaceInfo
-		xc C.libxl_vga_interface_info
-	)
+var (
+x VgaInterfaceInfo
+xc C.libxl_vga_interface_info)
 
-	C.libxl_vga_interface_info_init(&xc)
-	defer C.libxl_vga_interface_info_dispose(&xc)
+C.libxl_vga_interface_info_init(&xc)
+defer C.libxl_vga_interface_info_dispose(&xc)
 
-	if err := x.fromC(&xc); err != nil {
-		return nil, err
-	}
+if err := x.fromC(&xc); err != nil {
+return nil, err }
 
-	return &x, nil
-}
+return &x, nil}
 
 func (x *VgaInterfaceInfo) fromC(xc *C.libxl_vga_interface_info) error {
-	x.Kind = VgaInterfaceType(xc.kind)
+ x.Kind = VgaInterfaceType(xc.kind)
 
-	return nil
-}
+ return nil}
 
-func (x *VgaInterfaceInfo) toC(xc *C.libxl_vga_interface_info) (err error) {
-	defer func() {
-		if err != nil {
-			C.libxl_vga_interface_info_dispose(xc)
-		}
-	}()
+func (x *VgaInterfaceInfo) toC(xc *C.libxl_vga_interface_info) (err error){defer func(){
+if err != nil{
+C.libxl_vga_interface_info_dispose(xc)}
+}()
 
-	xc.kind = C.libxl_vga_interface_type(x.Kind)
+xc.kind = C.libxl_vga_interface_type(x.Kind)
 
-	return nil
-}
+ return nil
+ }
 
 // NewVncInfo returns an instance of VncInfo initialized with defaults.
 func NewVncInfo() (*VncInfo, error) {
-	var (
-		x  VncInfo
-		xc C.libxl_vnc_info
-	)
+var (
+x VncInfo
+xc C.libxl_vnc_info)
 
-	C.libxl_vnc_info_init(&xc)
-	defer C.libxl_vnc_info_dispose(&xc)
+C.libxl_vnc_info_init(&xc)
+defer C.libxl_vnc_info_dispose(&xc)
 
-	if err := x.fromC(&xc); err != nil {
-		return nil, err
-	}
+if err := x.fromC(&xc); err != nil {
+return nil, err }
 
-	return &x, nil
-}
+return &x, nil}
 
 func (x *VncInfo) fromC(xc *C.libxl_vnc_info) error {
-	if err := x.Enable.fromC(&xc.enable); err != nil {
-		return fmt.Errorf("converting field Enable: %v", err)
-	}
-	x.Listen = C.GoString(xc.listen)
-	x.Passwd = C.GoString(xc.passwd)
-	x.Display = int(xc.display)
-	if err := x.Findunused.fromC(&xc.findunused); err != nil {
-		return fmt.Errorf("converting field Findunused: %v", err)
-	}
-
-	return nil
-}
-
-func (x *VncInfo) toC(xc *C.libxl_vnc_info) (err error) {
-	defer func() {
-		if err != nil {
-			C.libxl_vnc_info_dispose(xc)
-		}
-	}()
-
-	if err := x.Enable.toC(&xc.enable); err != nil {
-		return fmt.Errorf("converting field Enable: %v", err)
-	}
-	if x.Listen != "" {
-		xc.listen = C.CString(x.Listen)
-	}
-	if x.Passwd != "" {
-		xc.passwd = C.CString(x.Passwd)
-	}
-	xc.display = C.int(x.Display)
-	if err := x.Findunused.toC(&xc.findunused); err != nil {
-		return fmt.Errorf("converting field Findunused: %v", err)
-	}
-
-	return nil
+ if err := x.Enable.fromC(&xc.enable);err != nil {
+return fmt.Errorf("converting field Enable: %v", err)
+}
+x.Listen = C.GoString(xc.listen)
+x.Passwd = C.GoString(xc.passwd)
+x.Display = int(xc.display)
+if err := x.Findunused.fromC(&xc.findunused);err != nil {
+return fmt.Errorf("converting field Findunused: %v", err)
 }
 
+ return nil}
+
+func (x *VncInfo) toC(xc *C.libxl_vnc_info) (err error){defer func(){
+if err != nil{
+C.libxl_vnc_info_dispose(xc)}
+}()
+
+if err := x.Enable.toC(&xc.enable); err != nil {
+return fmt.Errorf("converting field Enable: %v", err)
+}
+if x.Listen != "" {
+xc.listen = C.CString(x.Listen)}
+if x.Passwd != "" {
+xc.passwd = C.CString(x.Passwd)}
+xc.display = C.int(x.Display)
+if err := x.Findunused.toC(&xc.findunused); err != nil {
+return fmt.Errorf("converting field Findunused: %v", err)
+}
+
+ return nil
+ }
+
 // NewSpiceInfo returns an instance of SpiceInfo initialized with defaults.
 func NewSpiceInfo() (*SpiceInfo, error) {
-	var (
-		x  SpiceInfo
-		xc C.libxl_spice_info
-	)
+var (
+x SpiceInfo
+xc C.libxl_spice_info)
 
-	C.libxl_spice_info_init(&xc)
-	defer C.libxl_spice_info_dispose(&xc)
+C.libxl_spice_info_init(&xc)
+defer C.libxl_spice_info_dispose(&xc)
 
-	if err := x.fromC(&xc); err != nil {
-		return nil, err
-	}
+if err := x.fromC(&xc); err != nil {
+return nil, err }
 
-	return &x, nil
-}
+return &x, nil}
 
 func (x *SpiceInfo) fromC(xc *C.libxl_spice_info) error {
-	if err := x.Enable.fromC(&xc.enable); err != nil {
-		return fmt.Errorf("converting field Enable: %v", err)
-	}
-	x.Port = int(xc.port)
-	x.TlsPort = int(xc.tls_port)
-	x.Host = C.GoString(xc.host)
-	if err := x.DisableTicketing.fromC(&xc.disable_ticketing); err != nil {
-		return fmt.Errorf("converting field DisableTicketing: %v", err)
-	}
-	x.Passwd = C.GoString(xc.passwd)
-	if err := x.AgentMouse.fromC(&xc.agent_mouse); err != nil {
-		return fmt.Errorf("converting field AgentMouse: %v", err)
-	}
-	if err := x.Vdagent.fromC(&xc.vdagent); err != nil {
-		return fmt.Errorf("converting field Vdagent: %v", err)
-	}
-	if err := x.ClipboardSharing.fromC(&xc.clipboard_sharing); err != nil {
-		return fmt.Errorf("converting field ClipboardSharing: %v", err)
-	}
-	x.Usbredirection = int(xc.usbredirection)
-	x.ImageCompression = C.GoString(xc.image_compression)
-	x.StreamingVideo = C.GoString(xc.streaming_video)
-
-	return nil
-}
-
-func (x *SpiceInfo) toC(xc *C.libxl_spice_info) (err error) {
-	defer func() {
-		if err != nil {
-			C.libxl_spice_info_dispose(xc)
-		}
-	}()
-
-	if err := x.Enable.toC(&xc.enable); err != nil {
-		return fmt.Errorf("converting field Enable: %v", err)
-	}
-	xc.port = C.int(x.Port)
-	xc.tls_port = C.int(x.TlsPort)
-	if x.Host != "" {
-		xc.host = C.CString(x.Host)
-	}
-	if err := x.DisableTicketing.toC(&xc.disable_ticketing); err != nil {
-		return fmt.Errorf("converting field DisableTicketing: %v", err)
-	}
-	if x.Passwd != "" {
-		xc.passwd = C.CString(x.Passwd)
-	}
-	if err := x.AgentMouse.toC(&xc.agent_mouse); err != nil {
-		return fmt.Errorf("converting field AgentMouse: %v", err)
-	}
-	if err := x.Vdagent.toC(&xc.vdagent); err != nil {
-		return fmt.Errorf("converting field Vdagent: %v", err)
-	}
-	if err := x.ClipboardSharing.toC(&xc.clipboard_sharing); err != nil {
-		return fmt.Errorf("converting field ClipboardSharing: %v", err)
-	}
-	xc.usbredirection = C.int(x.Usbredirection)
-	if x.ImageCompression != "" {
-		xc.image_compression = C.CString(x.ImageCompression)
-	}
-	if x.StreamingVideo != "" {
-		xc.streaming_video = C.CString(x.StreamingVideo)
-	}
-
-	return nil
+ if err := x.Enable.fromC(&xc.enable);err != nil {
+return fmt.Errorf("converting field Enable: %v", err)
+}
+x.Port = int(xc.port)
+x.TlsPort = int(xc.tls_port)
+x.Host = C.GoString(xc.host)
+if err := x.DisableTicketing.fromC(&xc.disable_ticketing);err != nil {
+return fmt.Errorf("converting field DisableTicketing: %v", err)
+}
+x.Passwd = C.GoString(xc.passwd)
+if err := x.AgentMouse.fromC(&xc.agent_mouse);err != nil {
+return fmt.Errorf("converting field AgentMouse: %v", err)
+}
+if err := x.Vdagent.fromC(&xc.vdagent);err != nil {
+return fmt.Errorf("converting field Vdagent: %v", err)
+}
+if err := x.ClipboardSharing.fromC(&xc.clipboard_sharing);err != nil {
+return fmt.Errorf("converting field ClipboardSharing: %v", err)
+}
+x.Usbredirection = int(xc.usbredirection)
+x.ImageCompression = C.GoString(xc.image_compression)
+x.StreamingVideo = C.GoString(xc.streaming_video)
+
+ return nil}
+
+func (x *SpiceInfo) toC(xc *C.libxl_spice_info) (err error){defer func(){
+if err != nil{
+C.libxl_spice_info_dispose(xc)}
+}()
+
+if err := x.Enable.toC(&xc.enable); err != nil {
+return fmt.Errorf("converting field Enable: %v", err)
+}
+xc.port = C.int(x.Port)
+xc.tls_port = C.int(x.TlsPort)
+if x.Host != "" {
+xc.host = C.CString(x.Host)}
+if err := x.DisableTicketing.toC(&xc.disable_ticketing); err != nil {
+return fmt.Errorf("converting field DisableTicketing: %v", err)
+}
+if x.Passwd != "" {
+xc.passwd = C.CString(x.Passwd)}
+if err := x.AgentMouse.toC(&xc.agent_mouse); err != nil {
+return fmt.Errorf("converting field AgentMouse: %v", err)
+}
+if err := x.Vdagent.toC(&xc.vdagent); err != nil {
+return fmt.Errorf("converting field Vdagent: %v", err)
+}
+if err := x.ClipboardSharing.toC(&xc.clipboard_sharing); err != nil {
+return fmt.Errorf("converting field ClipboardSharing: %v", err)
 }
+xc.usbredirection = C.int(x.Usbredirection)
+if x.ImageCompression != "" {
+xc.image_compression = C.CString(x.ImageCompression)}
+if x.StreamingVideo != "" {
+xc.streaming_video = C.CString(x.StreamingVideo)}
+
+ return nil
+ }
 
 // NewSdlInfo returns an instance of SdlInfo initialized with defaults.
 func NewSdlInfo() (*SdlInfo, error) {
-	var (
-		x  SdlInfo
-		xc C.libxl_sdl_info
-	)
+var (
+x SdlInfo
+xc C.libxl_sdl_info)
 
-	C.libxl_sdl_info_init(&xc)
-	defer C.libxl_sdl_info_dispose(&xc)
+C.libxl_sdl_info_init(&xc)
+defer C.libxl_sdl_info_dispose(&xc)
 
-	if err := x.fromC(&xc); err != nil {
-		return nil, err
-	}
+if err := x.fromC(&xc); err != nil {
+return nil, err }
 
-	return &x, nil
-}
+return &x, nil}
 
 func (x *SdlInfo) fromC(xc *C.libxl_sdl_info) error {
-	if err := x.Enable.fromC(&xc.enable); err != nil {
-		return fmt.Errorf("converting field Enable: %v", err)
-	}
-	if err := x.Opengl.fromC(&xc.opengl); err != nil {
-		return fmt.Errorf("converting field Opengl: %v", err)
-	}
-	x.Display = C.GoString(xc.display)
-	x.Xauthority = C.GoString(xc.xauthority)
-
-	return nil
-}
-
-func (x *SdlInfo) toC(xc *C.libxl_sdl_info) (err error) {
-	defer func() {
-		if err != nil {
-			C.libxl_sdl_info_dispose(xc)
-		}
-	}()
-
-	if err := x.Enable.toC(&xc.enable); err != nil {
-		return fmt.Errorf("converting field Enable: %v", err)
-	}
-	if err := x.Opengl.toC(&xc.opengl); err != nil {
-		return fmt.Errorf("converting field Opengl: %v", err)
-	}
-	if x.Display != "" {
-		xc.display = C.CString(x.Display)
-	}
-	if x.Xauthority != "" {
-		xc.xauthority = C.CString(x.Xauthority)
-	}
-
-	return nil
+ if err := x.Enable.fromC(&xc.enable);err != nil {
+return fmt.Errorf("converting field Enable: %v", err)
+}
+if err := x.Opengl.fromC(&xc.opengl);err != nil {
+return fmt.Errorf("converting field Opengl: %v", err)
 }
+x.Display = C.GoString(xc.display)
+x.Xauthority = C.GoString(xc.xauthority)
+
+ return nil}
+
+func (x *SdlInfo) toC(xc *C.libxl_sdl_info) (err error){defer func(){
+if err != nil{
+C.libxl_sdl_info_dispose(xc)}
+}()
+
+if err := x.Enable.toC(&xc.enable); err != nil {
+return fmt.Errorf("converting field Enable: %v", err)
+}
+if err := x.Opengl.toC(&xc.opengl); err != nil {
+return fmt.Errorf("converting field Opengl: %v", err)
+}
+if x.Display != "" {
+xc.display = C.CString(x.Display)}
+if x.Xauthority != "" {
+xc.xauthority = C.CString(x.Xauthority)}
+
+ return nil
+ }
 
 // NewDominfo returns an instance of Dominfo initialized with defaults.
 func NewDominfo() (*Dominfo, error) {
-	var (
-		x  Dominfo
-		xc C.libxl_dominfo
-	)
+var (
+x Dominfo
+xc C.libxl_dominfo)
 
-	C.libxl_dominfo_init(&xc)
-	defer C.libxl_dominfo_dispose(&xc)
+C.libxl_dominfo_init(&xc)
+defer C.libxl_dominfo_dispose(&xc)
 
-	if err := x.fromC(&xc); err != nil {
-		return nil, err
-	}
+if err := x.fromC(&xc); err != nil {
+return nil, err }
 
-	return &x, nil
-}
+return &x, nil}
 
 func (x *Dominfo) fromC(xc *C.libxl_dominfo) error {
-	if err := x.Uuid.fromC(&xc.uuid); err != nil {
-		return fmt.Errorf("converting field Uuid: %v", err)
-	}
-	x.Domid = Domid(xc.domid)
-	x.Ssidref = uint32(xc.ssidref)
-	x.SsidLabel = C.GoString(xc.ssid_label)
-	x.Running = bool(xc.running)
-	x.Blocked = bool(xc.blocked)
-	x.Paused = bool(xc.paused)
-	x.Shutdown = bool(xc.shutdown)
-	x.Dying = bool(xc.dying)
-	x.NeverStop = bool(xc.never_stop)
-	x.ShutdownReason = ShutdownReason(xc.shutdown_reason)
-	x.OutstandingMemkb = uint64(xc.outstanding_memkb)
-	x.CurrentMemkb = uint64(xc.current_memkb)
-	x.SharedMemkb = uint64(xc.shared_memkb)
-	x.PagedMemkb = uint64(xc.paged_memkb)
-	x.MaxMemkb = uint64(xc.max_memkb)
-	x.CpuTime = uint64(xc.cpu_time)
-	x.VcpuMaxId = uint32(xc.vcpu_max_id)
-	x.VcpuOnline = uint32(xc.vcpu_online)
-	x.Cpupool = uint32(xc.cpupool)
-	x.DomainType = DomainType(xc.domain_type)
-
-	return nil
-}
-
-func (x *Dominfo) toC(xc *C.libxl_dominfo) (err error) {
-	defer func() {
-		if err != nil {
-			C.libxl_dominfo_dispose(xc)
-		}
-	}()
-
-	if err := x.Uuid.toC(&xc.uuid); err != nil {
-		return fmt.Errorf("converting field Uuid: %v", err)
-	}
-	xc.domid = C.libxl_domid(x.Domid)
-	xc.ssidref = C.uint32_t(x.Ssidref)
-	if x.SsidLabel != "" {
-		xc.ssid_label = C.CString(x.SsidLabel)
-	}
-	xc.running = C.bool(x.Running)
-	xc.blocked = C.bool(x.Blocked)
-	xc.paused = C.bool(x.Paused)
-	xc.shutdown = C.bool(x.Shutdown)
-	xc.dying = C.bool(x.Dying)
-	xc.never_stop = C.bool(x.NeverStop)
-	xc.shutdown_reason = C.libxl_shutdown_reason(x.ShutdownReason)
-	xc.outstanding_memkb = C.uint64_t(x.OutstandingMemkb)
-	xc.current_memkb = C.uint64_t(x.CurrentMemkb)
-	xc.shared_memkb = C.uint64_t(x.SharedMemkb)
-	xc.paged_memkb = C.uint64_t(x.PagedMemkb)
-	xc.max_memkb = C.uint64_t(x.MaxMemkb)
-	xc.cpu_time = C.uint64_t(x.CpuTime)
-	xc.vcpu_max_id = C.uint32_t(x.VcpuMaxId)
-	xc.vcpu_online = C.uint32_t(x.VcpuOnline)
-	xc.cpupool = C.uint32_t(x.Cpupool)
-	xc.domain_type = C.libxl_domain_type(x.DomainType)
-
-	return nil
-}
+ if err := x.Uuid.fromC(&xc.uuid);err != nil {
+return fmt.Errorf("converting field Uuid: %v", err)
+}
+x.Domid = Domid(xc.domid)
+x.Ssidref = uint32(xc.ssidref)
+x.SsidLabel = C.GoString(xc.ssid_label)
+x.Running = bool(xc.running)
+x.Blocked = bool(xc.blocked)
+x.Paused = bool(xc.paused)
+x.Shutdown = bool(xc.shutdown)
+x.Dying = bool(xc.dying)
+x.NeverStop = bool(xc.never_stop)
+x.ShutdownReason = ShutdownReason(xc.shutdown_reason)
+x.OutstandingMemkb = uint64(xc.outstanding_memkb)
+x.CurrentMemkb = uint64(xc.current_memkb)
+x.SharedMemkb = uint64(xc.shared_memkb)
+x.PagedMemkb = uint64(xc.paged_memkb)
+x.MaxMemkb = uint64(xc.max_memkb)
+x.CpuTime = uint64(xc.cpu_time)
+x.VcpuMaxId = uint32(xc.vcpu_max_id)
+x.VcpuOnline = uint32(xc.vcpu_online)
+x.Cpupool = uint32(xc.cpupool)
+x.DomainType = DomainType(xc.domain_type)
+
+ return nil}
+
+func (x *Dominfo) toC(xc *C.libxl_dominfo) (err error){defer func(){
+if err != nil{
+C.libxl_dominfo_dispose(xc)}
+}()
+
+if err := x.Uuid.toC(&xc.uuid); err != nil {
+return fmt.Errorf("converting field Uuid: %v", err)
+}
+xc.domid = C.libxl_domid(x.Domid)
+xc.ssidref = C.uint32_t(x.Ssidref)
+if x.SsidLabel != "" {
+xc.ssid_label = C.CString(x.SsidLabel)}
+xc.running = C.bool(x.Running)
+xc.blocked = C.bool(x.Blocked)
+xc.paused = C.bool(x.Paused)
+xc.shutdown = C.bool(x.Shutdown)
+xc.dying = C.bool(x.Dying)
+xc.never_stop = C.bool(x.NeverStop)
+xc.shutdown_reason = C.libxl_shutdown_reason(x.ShutdownReason)
+xc.outstanding_memkb = C.uint64_t(x.OutstandingMemkb)
+xc.current_memkb = C.uint64_t(x.CurrentMemkb)
+xc.shared_memkb = C.uint64_t(x.SharedMemkb)
+xc.paged_memkb = C.uint64_t(x.PagedMemkb)
+xc.max_memkb = C.uint64_t(x.MaxMemkb)
+xc.cpu_time = C.uint64_t(x.CpuTime)
+xc.vcpu_max_id = C.uint32_t(x.VcpuMaxId)
+xc.vcpu_online = C.uint32_t(x.VcpuOnline)
+xc.cpupool = C.uint32_t(x.Cpupool)
+xc.domain_type = C.libxl_domain_type(x.DomainType)
+
+ return nil
+ }
 
 // NewCpupoolinfo returns an instance of Cpupoolinfo initialized with defaults.
 func NewCpupoolinfo() (*Cpupoolinfo, error) {
-	var (
-		x  Cpupoolinfo
-		xc C.libxl_cpupoolinfo
-	)
+var (
+x Cpupoolinfo
+xc C.libxl_cpupoolinfo)
 
-	C.libxl_cpupoolinfo_init(&xc)
-	defer C.libxl_cpupoolinfo_dispose(&xc)
+C.libxl_cpupoolinfo_init(&xc)
+defer C.libxl_cpupoolinfo_dispose(&xc)
 
-	if err := x.fromC(&xc); err != nil {
-		return nil, err
-	}
+if err := x.fromC(&xc); err != nil {
+return nil, err }
 
-	return &x, nil
-}
+return &x, nil}
 
 func (x *Cpupoolinfo) fromC(xc *C.libxl_cpupoolinfo) error {
-	x.Poolid = uint32(xc.poolid)
-	x.PoolName = C.GoString(xc.pool_name)
-	x.Sched = Scheduler(xc.sched)
-	x.NDom = uint32(xc.n_dom)
-	if err := x.Cpumap.fromC(&xc.cpumap); err != nil {
-		return fmt.Errorf("converting field Cpumap: %v", err)
-	}
-
-	return nil
+ x.Poolid = uint32(xc.poolid)
+x.PoolName = C.GoString(xc.pool_name)
+x.Sched = Scheduler(xc.sched)
+x.NDom = uint32(xc.n_dom)
+if err := x.Cpumap.fromC(&xc.cpumap);err != nil {
+return fmt.Errorf("converting field Cpumap: %v", err)
 }
 
-func (x *Cpupoolinfo) toC(xc *C.libxl_cpupoolinfo) (err error) {
-	defer func() {
-		if err != nil {
-			C.libxl_cpupoolinfo_dispose(xc)
-		}
-	}()
+ return nil}
 
-	xc.poolid = C.uint32_t(x.Poolid)
-	if x.PoolName != "" {
-		xc.pool_name = C.CString(x.PoolName)
-	}
-	xc.sched = C.libxl_scheduler(x.Sched)
-	xc.n_dom = C.uint32_t(x.NDom)
-	if err := x.Cpumap.toC(&xc.cpumap); err != nil {
-		return fmt.Errorf("converting field Cpumap: %v", err)
-	}
+func (x *Cpupoolinfo) toC(xc *C.libxl_cpupoolinfo) (err error){defer func(){
+if err != nil{
+C.libxl_cpupoolinfo_dispose(xc)}
+}()
 
-	return nil
+xc.poolid = C.uint32_t(x.Poolid)
+if x.PoolName != "" {
+xc.pool_name = C.CString(x.PoolName)}
+xc.sched = C.libxl_scheduler(x.Sched)
+xc.n_dom = C.uint32_t(x.NDom)
+if err := x.Cpumap.toC(&xc.cpumap); err != nil {
+return fmt.Errorf("converting field Cpumap: %v", err)
 }
 
+ return nil
+ }
+
 // NewChannelinfo returns an instance of Channelinfo initialized with defaults.
 func NewChannelinfo(connection ChannelConnection) (*Channelinfo, error) {
-	var (
-		x  Channelinfo
-		xc C.libxl_channelinfo
-	)
+var (
+x Channelinfo
+xc C.libxl_channelinfo)
 
-	C.libxl_channelinfo_init(&xc)
-	C.libxl_channelinfo_init_connection(&xc, C.libxl_channel_connection(connection))
-	defer C.libxl_channelinfo_dispose(&xc)
+C.libxl_channelinfo_init(&xc)
+C.libxl_channelinfo_init_connection(&xc, C.libxl_channel_connection(connection))
+defer C.libxl_channelinfo_dispose(&xc)
 
-	if err := x.fromC(&xc); err != nil {
-		return nil, err
-	}
+if err := x.fromC(&xc); err != nil {
+return nil, err }
 
-	return &x, nil
-}
+return &x, nil}
 
 func (x *Channelinfo) fromC(xc *C.libxl_channelinfo) error {
-	x.Backend = C.GoString(xc.backend)
-	x.BackendId = uint32(xc.backend_id)
-	x.Frontend = C.GoString(xc.frontend)
-	x.FrontendId = uint32(xc.frontend_id)
-	x.Devid = Devid(xc.devid)
-	x.State = int(xc.state)
-	x.Evtch = int(xc.evtch)
-	x.Rref = int(xc.rref)
-	x.Connection = ChannelConnection(xc.connection)
-	switch x.Connection {
-	case ChannelConnectionUnknown:
-		x.ConnectionUnion = nil
-	case ChannelConnectionPty:
-		var connectionPty ChannelinfoConnectionUnionPty
-		if err := connectionPty.fromC(xc); err != nil {
-			return fmt.Errorf("converting field connectionPty: %v", err)
-		}
-		x.ConnectionUnion = connectionPty
-	case ChannelConnectionSocket:
-		x.ConnectionUnion = nil
-	default:
-		return fmt.Errorf("invalid union key '%v'", x.Connection)
-	}
-
-	return nil
-}
+ x.Backend = C.GoString(xc.backend)
+x.BackendId = uint32(xc.backend_id)
+x.Frontend = C.GoString(xc.frontend)
+x.FrontendId = uint32(xc.frontend_id)
+x.Devid = Devid(xc.devid)
+x.State = int(xc.state)
+x.Evtch = int(xc.evtch)
+x.Rref = int(xc.rref)
+x.Connection = ChannelConnection(xc.connection)
+switch x.Connection{
+case ChannelConnectionUnknown:
+x.ConnectionUnion = nil
+case ChannelConnectionPty:
+var connectionPty ChannelinfoConnectionUnionPty
+if err := connectionPty.fromC(xc);err != nil {
+ return fmt.Errorf("converting field connectionPty: %v", err)
+}
+x.ConnectionUnion = connectionPty
+case ChannelConnectionSocket:
+x.ConnectionUnion = nil
+default:
+return fmt.Errorf("invalid union key '%v'", x.Connection)}
+
+ return nil}
 
 func (x *ChannelinfoConnectionUnionPty) fromC(xc *C.libxl_channelinfo) error {
-	if ChannelConnection(xc.connection) != ChannelConnectionPty {
-		return errors.New("expected union key ChannelConnectionPty")
-	}
-
-	tmp := (*C.libxl_channelinfo_connection_union_pty)(unsafe.Pointer(&xc.u[0]))
-	x.Path = C.GoString(tmp.path)
-	return nil
-}
-
-func (x *Channelinfo) toC(xc *C.libxl_channelinfo) (err error) {
-	defer func() {
-		if err != nil {
-			C.libxl_channelinfo_dispose(xc)
-		}
-	}()
-
-	if x.Backend != "" {
-		xc.backend = C.CString(x.Backend)
-	}
-	xc.backend_id = C.uint32_t(x.BackendId)
-	if x.Frontend != "" {
-		xc.frontend = C.CString(x.Frontend)
-	}
-	xc.frontend_id = C.uint32_t(x.FrontendId)
-	xc.devid = C.libxl_devid(x.Devid)
-	xc.state = C.int(x.State)
-	xc.evtch = C.int(x.Evtch)
-	xc.rref = C.int(x.Rref)
-	xc.connection = C.libxl_channel_connection(x.Connection)
-	switch x.Connection {
-	case ChannelConnectionUnknown:
-		break
-	case ChannelConnectionPty:
-		tmp, ok := x.ConnectionUnion.(ChannelinfoConnectionUnionPty)
-		if !ok {
-			return errors.New("wrong type for union key connection")
-		}
-		var pty C.libxl_channelinfo_connection_union_pty
-		if tmp.Path != "" {
-			pty.path = C.CString(tmp.Path)
-		}
-		ptyBytes := C.GoBytes(unsafe.Pointer(&pty), C.sizeof_libxl_channelinfo_connection_union_pty)
-		copy(xc.u[:], ptyBytes)
-	case ChannelConnectionSocket:
-		break
-	default:
-		return fmt.Errorf("invalid union key '%v'", x.Connection)
-	}
-
-	return nil
-}
+if ChannelConnection(xc.connection) != ChannelConnectionPty {
+return errors.New("expected union key ChannelConnectionPty")
+}
+
+tmp := (*C.libxl_channelinfo_connection_union_pty)(unsafe.Pointer(&xc.u[0]))
+x.Path = C.GoString(tmp.path)
+return nil
+}
+
+func (x *Channelinfo) toC(xc *C.libxl_channelinfo) (err error){defer func(){
+if err != nil{
+C.libxl_channelinfo_dispose(xc)}
+}()
+
+if x.Backend != "" {
+xc.backend = C.CString(x.Backend)}
+xc.backend_id = C.uint32_t(x.BackendId)
+if x.Frontend != "" {
+xc.frontend = C.CString(x.Frontend)}
+xc.frontend_id = C.uint32_t(x.FrontendId)
+xc.devid = C.libxl_devid(x.Devid)
+xc.state = C.int(x.State)
+xc.evtch = C.int(x.Evtch)
+xc.rref = C.int(x.Rref)
+xc.connection = C.libxl_channel_connection(x.Connection)
+switch x.Connection{
+case ChannelConnectionUnknown:
+break
+case ChannelConnectionPty:
+tmp, ok := x.ConnectionUnion.(ChannelinfoConnectionUnionPty)
+if !ok {
+return errors.New("wrong type for union key connection")
+}
+var pty C.libxl_channelinfo_connection_union_pty
+if tmp.Path != "" {
+pty.path = C.CString(tmp.Path)}
+ptyBytes := C.GoBytes(unsafe.Pointer(&pty),C.sizeof_libxl_channelinfo_connection_union_pty)
+copy(xc.u[:],ptyBytes)
+case ChannelConnectionSocket:
+break
+default:
+return fmt.Errorf("invalid union key '%v'", x.Connection)}
+
+ return nil
+ }
 
 // NewVminfo returns an instance of Vminfo initialized with defaults.
 func NewVminfo() (*Vminfo, error) {
-	var (
-		x  Vminfo
-		xc C.libxl_vminfo
-	)
+var (
+x Vminfo
+xc C.libxl_vminfo)
 
-	C.libxl_vminfo_init(&xc)
-	defer C.libxl_vminfo_dispose(&xc)
+C.libxl_vminfo_init(&xc)
+defer C.libxl_vminfo_dispose(&xc)
 
-	if err := x.fromC(&xc); err != nil {
-		return nil, err
-	}
+if err := x.fromC(&xc); err != nil {
+return nil, err }
 
-	return &x, nil
-}
+return &x, nil}
 
 func (x *Vminfo) fromC(xc *C.libxl_vminfo) error {
-	if err := x.Uuid.fromC(&xc.uuid); err != nil {
-		return fmt.Errorf("converting field Uuid: %v", err)
-	}
-	x.Domid = Domid(xc.domid)
-
-	return nil
+ if err := x.Uuid.fromC(&xc.uuid);err != nil {
+return fmt.Errorf("converting field Uuid: %v", err)
 }
+x.Domid = Domid(xc.domid)
 
-func (x *Vminfo) toC(xc *C.libxl_vminfo) (err error) {
-	defer func() {
-		if err != nil {
-			C.libxl_vminfo_dispose(xc)
-		}
-	}()
+ return nil}
 
-	if err := x.Uuid.toC(&xc.uuid); err != nil {
-		return fmt.Errorf("converting field Uuid: %v", err)
-	}
-	xc.domid = C.libxl_domid(x.Domid)
+func (x *Vminfo) toC(xc *C.libxl_vminfo) (err error){defer func(){
+if err != nil{
+C.libxl_vminfo_dispose(xc)}
+}()
 
-	return nil
+if err := x.Uuid.toC(&xc.uuid); err != nil {
+return fmt.Errorf("converting field Uuid: %v", err)
 }
+xc.domid = C.libxl_domid(x.Domid)
+
+ return nil
+ }
 
 // NewVersionInfo returns an instance of VersionInfo initialized with defaults.
 func NewVersionInfo() (*VersionInfo, error) {
-	var (
-		x  VersionInfo
-		xc C.libxl_version_info
-	)
+var (
+x VersionInfo
+xc C.libxl_version_info)
 
-	C.libxl_version_info_init(&xc)
-	defer C.libxl_version_info_dispose(&xc)
+C.libxl_version_info_init(&xc)
+defer C.libxl_version_info_dispose(&xc)
 
-	if err := x.fromC(&xc); err != nil {
-		return nil, err
-	}
+if err := x.fromC(&xc); err != nil {
+return nil, err }
 
-	return &x, nil
-}
+return &x, nil}
 
 func (x *VersionInfo) fromC(xc *C.libxl_version_info) error {
-	x.XenVersionMajor = int(xc.xen_version_major)
-	x.XenVersionMinor = int(xc.xen_version_minor)
-	x.XenVersionExtra = C.GoString(xc.xen_version_extra)
-	x.Compiler = C.GoString(xc.compiler)
-	x.CompileBy = C.GoString(xc.compile_by)
-	x.CompileDomain = C.GoString(xc.compile_domain)
-	x.CompileDate = C.GoString(xc.compile_date)
-	x.Capabilities = C.GoString(xc.capabilities)
-	x.Changeset = C.GoString(xc.changeset)
-	x.VirtStart = uint64(xc.virt_start)
-	x.Pagesize = int(xc.pagesize)
-	x.Commandline = C.GoString(xc.commandline)
-	x.BuildId = C.GoString(xc.build_id)
-
-	return nil
-}
-
-func (x *VersionInfo) toC(xc *C.libxl_version_info) (err error) {
-	defer func() {
-		if err != nil {
-			C.libxl_version_info_dispose(xc)
-		}
-	}()
-
-	xc.xen_version_major = C.int(x.XenVersionMajor)
-	xc.xen_version_minor = C.int(x.XenVersionMinor)
-	if x.XenVersionExtra != "" {
-		xc.xen_version_extra = C.CString(x.XenVersionExtra)
-	}
-	if x.Compiler != "" {
-		xc.compiler = C.CString(x.Compiler)
-	}
-	if x.CompileBy != "" {
-		xc.compile_by = C.CString(x.CompileBy)
-	}
-	if x.CompileDomain != "" {
-		xc.compile_domain = C.CString(x.CompileDomain)
-	}
-	if x.CompileDate != "" {
-		xc.compile_date = C.CString(x.CompileDate)
-	}
-	if x.Capabilities != "" {
-		xc.capabilities = C.CString(x.Capabilities)
-	}
-	if x.Changeset != "" {
-		xc.changeset = C.CString(x.Changeset)
-	}
-	xc.virt_start = C.uint64_t(x.VirtStart)
-	xc.pagesize = C.int(x.Pagesize)
-	if x.Commandline != "" {
-		xc.commandline = C.CString(x.Commandline)
-	}
-	if x.BuildId != "" {
-		xc.build_id = C.CString(x.BuildId)
-	}
-
-	return nil
-}
+ x.XenVersionMajor = int(xc.xen_version_major)
+x.XenVersionMinor = int(xc.xen_version_minor)
+x.XenVersionExtra = C.GoString(xc.xen_version_extra)
+x.Compiler = C.GoString(xc.compiler)
+x.CompileBy = C.GoString(xc.compile_by)
+x.CompileDomain = C.GoString(xc.compile_domain)
+x.CompileDate = C.GoString(xc.compile_date)
+x.Capabilities = C.GoString(xc.capabilities)
+x.Changeset = C.GoString(xc.changeset)
+x.VirtStart = uint64(xc.virt_start)
+x.Pagesize = int(xc.pagesize)
+x.Commandline = C.GoString(xc.commandline)
+x.BuildId = C.GoString(xc.build_id)
+
+ return nil}
+
+func (x *VersionInfo) toC(xc *C.libxl_version_info) (err error){defer func(){
+if err != nil{
+C.libxl_version_info_dispose(xc)}
+}()
+
+xc.xen_version_major = C.int(x.XenVersionMajor)
+xc.xen_version_minor = C.int(x.XenVersionMinor)
+if x.XenVersionExtra != "" {
+xc.xen_version_extra = C.CString(x.XenVersionExtra)}
+if x.Compiler != "" {
+xc.compiler = C.CString(x.Compiler)}
+if x.CompileBy != "" {
+xc.compile_by = C.CString(x.CompileBy)}
+if x.CompileDomain != "" {
+xc.compile_domain = C.CString(x.CompileDomain)}
+if x.CompileDate != "" {
+xc.compile_date = C.CString(x.CompileDate)}
+if x.Capabilities != "" {
+xc.capabilities = C.CString(x.Capabilities)}
+if x.Changeset != "" {
+xc.changeset = C.CString(x.Changeset)}
+xc.virt_start = C.uint64_t(x.VirtStart)
+xc.pagesize = C.int(x.Pagesize)
+if x.Commandline != "" {
+xc.commandline = C.CString(x.Commandline)}
+if x.BuildId != "" {
+xc.build_id = C.CString(x.BuildId)}
+
+ return nil
+ }
 
 // NewDomainCreateInfo returns an instance of DomainCreateInfo initialized with defaults.
 func NewDomainCreateInfo() (*DomainCreateInfo, error) {
-	var (
-		x  DomainCreateInfo
-		xc C.libxl_domain_create_info
-	)
+var (
+x DomainCreateInfo
+xc C.libxl_domain_create_info)
 
-	C.libxl_domain_create_info_init(&xc)
-	defer C.libxl_domain_create_info_dispose(&xc)
+C.libxl_domain_create_info_init(&xc)
+defer C.libxl_domain_create_info_dispose(&xc)
 
-	if err := x.fromC(&xc); err != nil {
-		return nil, err
-	}
+if err := x.fromC(&xc); err != nil {
+return nil, err }
 
-	return &x, nil
-}
+return &x, nil}
 
 func (x *DomainCreateInfo) fromC(xc *C.libxl_domain_create_info) error {
-	x.Type = DomainType(xc._type)
-	if err := x.Hap.fromC(&xc.hap); err != nil {
-		return fmt.Errorf("converting field Hap: %v", err)
-	}
-	if err := x.Oos.fromC(&xc.oos); err != nil {
-		return fmt.Errorf("converting field Oos: %v", err)
-	}
-	x.Ssidref = uint32(xc.ssidref)
-	x.SsidLabel = C.GoString(xc.ssid_label)
-	x.Name = C.GoString(xc.name)
-	x.Domid = Domid(xc.domid)
-	if err := x.Uuid.fromC(&xc.uuid); err != nil {
-		return fmt.Errorf("converting field Uuid: %v", err)
-	}
-	if err := x.Xsdata.fromC(&xc.xsdata); err != nil {
-		return fmt.Errorf("converting field Xsdata: %v", err)
-	}
-	if err := x.Platformdata.fromC(&xc.platformdata); err != nil {
-		return fmt.Errorf("converting field Platformdata: %v", err)
-	}
-	x.Poolid = uint32(xc.poolid)
-	x.PoolName = C.GoString(xc.pool_name)
-	if err := x.RunHotplugScripts.fromC(&xc.run_hotplug_scripts); err != nil {
-		return fmt.Errorf("converting field RunHotplugScripts: %v", err)
-	}
-	if err := x.DriverDomain.fromC(&xc.driver_domain); err != nil {
-		return fmt.Errorf("converting field DriverDomain: %v", err)
-	}
-	x.Passthrough = Passthrough(xc.passthrough)
-	if err := x.XendSuspendEvtchnCompat.fromC(&xc.xend_suspend_evtchn_compat); err != nil {
-		return fmt.Errorf("converting field XendSuspendEvtchnCompat: %v", err)
-	}
-
-	return nil
-}
-
-func (x *DomainCreateInfo) toC(xc *C.libxl_domain_create_info) (err error) {
-	defer func() {
-		if err != nil {
-			C.libxl_domain_create_info_dispose(xc)
-		}
-	}()
-
-	xc._type = C.libxl_domain_type(x.Type)
-	if err := x.Hap.toC(&xc.hap); err != nil {
-		return fmt.Errorf("converting field Hap: %v", err)
-	}
-	if err := x.Oos.toC(&xc.oos); err != nil {
-		return fmt.Errorf("converting field Oos: %v", err)
-	}
-	xc.ssidref = C.uint32_t(x.Ssidref)
-	if x.SsidLabel != "" {
-		xc.ssid_label = C.CString(x.SsidLabel)
-	}
-	if x.Name != "" {
-		xc.name = C.CString(x.Name)
-	}
-	xc.domid = C.libxl_domid(x.Domid)
-	if err := x.Uuid.toC(&xc.uuid); err != nil {
-		return fmt.Errorf("converting field Uuid: %v", err)
-	}
-	if err := x.Xsdata.toC(&xc.xsdata); err != nil {
-		return fmt.Errorf("converting field Xsdata: %v", err)
-	}
-	if err := x.Platformdata.toC(&xc.platformdata); err != nil {
-		return fmt.Errorf("converting field Platformdata: %v", err)
-	}
-	xc.poolid = C.uint32_t(x.Poolid)
-	if x.PoolName != "" {
-		xc.pool_name = C.CString(x.PoolName)
-	}
-	if err := x.RunHotplugScripts.toC(&xc.run_hotplug_scripts); err != nil {
-		return fmt.Errorf("converting field RunHotplugScripts: %v", err)
-	}
-	if err := x.DriverDomain.toC(&xc.driver_domain); err != nil {
-		return fmt.Errorf("converting field DriverDomain: %v", err)
-	}
-	xc.passthrough = C.libxl_passthrough(x.Passthrough)
-	if err := x.XendSuspendEvtchnCompat.toC(&xc.xend_suspend_evtchn_compat); err != nil {
-		return fmt.Errorf("converting field XendSuspendEvtchnCompat: %v", err)
-	}
-
-	return nil
+ x.Type = DomainType(xc._type)
+if err := x.Hap.fromC(&xc.hap);err != nil {
+return fmt.Errorf("converting field Hap: %v", err)
+}
+if err := x.Oos.fromC(&xc.oos);err != nil {
+return fmt.Errorf("converting field Oos: %v", err)
+}
+x.Ssidref = uint32(xc.ssidref)
+x.SsidLabel = C.GoString(xc.ssid_label)
+x.Name = C.GoString(xc.name)
+x.Domid = Domid(xc.domid)
+if err := x.Uuid.fromC(&xc.uuid);err != nil {
+return fmt.Errorf("converting field Uuid: %v", err)
 }
+if err := x.Xsdata.fromC(&xc.xsdata);err != nil {
+return fmt.Errorf("converting field Xsdata: %v", err)
+}
+if err := x.Platformdata.fromC(&xc.platformdata);err != nil {
+return fmt.Errorf("converting field Platformdata: %v", err)
+}
+x.Poolid = uint32(xc.poolid)
+x.PoolName = C.GoString(xc.pool_name)
+if err := x.RunHotplugScripts.fromC(&xc.run_hotplug_scripts);err != nil {
+return fmt.Errorf("converting field RunHotplugScripts: %v", err)
+}
+if err := x.DriverDomain.fromC(&xc.driver_domain);err != nil {
+return fmt.Errorf("converting field DriverDomain: %v", err)
+}
+x.Passthrough = Passthrough(xc.passthrough)
+if err := x.XendSuspendEvtchnCompat.fromC(&xc.xend_suspend_evtchn_compat);err != nil {
+return fmt.Errorf("converting field XendSuspendEvtchnCompat: %v", err)
+}
+
+ return nil}
+
+func (x *DomainCreateInfo) toC(xc *C.libxl_domain_create_info) (err error){defer func(){
+if err != nil{
+C.libxl_domain_create_info_dispose(xc)}
+}()
+
+xc._type = C.libxl_domain_type(x.Type)
+if err := x.Hap.toC(&xc.hap); err != nil {
+return fmt.Errorf("converting field Hap: %v", err)
+}
+if err := x.Oos.toC(&xc.oos); err != nil {
+return fmt.Errorf("converting field Oos: %v", err)
+}
+xc.ssidref = C.uint32_t(x.Ssidref)
+if x.SsidLabel != "" {
+xc.ssid_label = C.CString(x.SsidLabel)}
+if x.Name != "" {
+xc.name = C.CString(x.Name)}
+xc.domid = C.libxl_domid(x.Domid)
+if err := x.Uuid.toC(&xc.uuid); err != nil {
+return fmt.Errorf("converting field Uuid: %v", err)
+}
+if err := x.Xsdata.toC(&xc.xsdata); err != nil {
+return fmt.Errorf("converting field Xsdata: %v", err)
+}
+if err := x.Platformdata.toC(&xc.platformdata); err != nil {
+return fmt.Errorf("converting field Platformdata: %v", err)
+}
+xc.poolid = C.uint32_t(x.Poolid)
+if x.PoolName != "" {
+xc.pool_name = C.CString(x.PoolName)}
+if err := x.RunHotplugScripts.toC(&xc.run_hotplug_scripts); err != nil {
+return fmt.Errorf("converting field RunHotplugScripts: %v", err)
+}
+if err := x.DriverDomain.toC(&xc.driver_domain); err != nil {
+return fmt.Errorf("converting field DriverDomain: %v", err)
+}
+xc.passthrough = C.libxl_passthrough(x.Passthrough)
+if err := x.XendSuspendEvtchnCompat.toC(&xc.xend_suspend_evtchn_compat); err != nil {
+return fmt.Errorf("converting field XendSuspendEvtchnCompat: %v", err)
+}
+
+ return nil
+ }
 
 // NewDomainRestoreParams returns an instance of DomainRestoreParams initialized with defaults.
 func NewDomainRestoreParams() (*DomainRestoreParams, error) {
-	var (
-		x  DomainRestoreParams
-		xc C.libxl_domain_restore_params
-	)
+var (
+x DomainRestoreParams
+xc C.libxl_domain_restore_params)
 
-	C.libxl_domain_restore_params_init(&xc)
-	defer C.libxl_domain_restore_params_dispose(&xc)
+C.libxl_domain_restore_params_init(&xc)
+defer C.libxl_domain_restore_params_dispose(&xc)
 
-	if err := x.fromC(&xc); err != nil {
-		return nil, err
-	}
+if err := x.fromC(&xc); err != nil {
+return nil, err }
 
-	return &x, nil
-}
+return &x, nil}
 
 func (x *DomainRestoreParams) fromC(xc *C.libxl_domain_restore_params) error {
-	x.CheckpointedStream = int(xc.checkpointed_stream)
-	x.StreamVersion = uint32(xc.stream_version)
-	x.ColoProxyScript = C.GoString(xc.colo_proxy_script)
-	if err := x.UserspaceColoProxy.fromC(&xc.userspace_colo_proxy); err != nil {
-		return fmt.Errorf("converting field UserspaceColoProxy: %v", err)
-	}
-
-	return nil
+ x.CheckpointedStream = int(xc.checkpointed_stream)
+x.StreamVersion = uint32(xc.stream_version)
+x.ColoProxyScript = C.GoString(xc.colo_proxy_script)
+if err := x.UserspaceColoProxy.fromC(&xc.userspace_colo_proxy);err != nil {
+return fmt.Errorf("converting field UserspaceColoProxy: %v", err)
 }
 
-func (x *DomainRestoreParams) toC(xc *C.libxl_domain_restore_params) (err error) {
-	defer func() {
-		if err != nil {
-			C.libxl_domain_restore_params_dispose(xc)
-		}
-	}()
+ return nil}
 
-	xc.checkpointed_stream = C.int(x.CheckpointedStream)
-	xc.stream_version = C.uint32_t(x.StreamVersion)
-	if x.ColoProxyScript != "" {
-		xc.colo_proxy_script = C.CString(x.ColoProxyScript)
-	}
-	if err := x.UserspaceColoProxy.toC(&xc.userspace_colo_proxy); err != nil {
-		return fmt.Errorf("converting field UserspaceColoProxy: %v", err)
-	}
+func (x *DomainRestoreParams) toC(xc *C.libxl_domain_restore_params) (err error){defer func(){
+if err != nil{
+C.libxl_domain_restore_params_dispose(xc)}
+}()
 
-	return nil
+xc.checkpointed_stream = C.int(x.CheckpointedStream)
+xc.stream_version = C.uint32_t(x.StreamVersion)
+if x.ColoProxyScript != "" {
+xc.colo_proxy_script = C.CString(x.ColoProxyScript)}
+if err := x.UserspaceColoProxy.toC(&xc.userspace_colo_proxy); err != nil {
+return fmt.Errorf("converting field UserspaceColoProxy: %v", err)
 }
 
+ return nil
+ }
+
 // NewSchedParams returns an instance of SchedParams initialized with defaults.
 func NewSchedParams() (*SchedParams, error) {
-	var (
-		x  SchedParams
-		xc C.libxl_sched_params
-	)
+var (
+x SchedParams
+xc C.libxl_sched_params)
 
-	C.libxl_sched_params_init(&xc)
-	defer C.libxl_sched_params_dispose(&xc)
+C.libxl_sched_params_init(&xc)
+defer C.libxl_sched_params_dispose(&xc)
 
-	if err := x.fromC(&xc); err != nil {
-		return nil, err
-	}
+if err := x.fromC(&xc); err != nil {
+return nil, err }
 
-	return &x, nil
-}
+return &x, nil}
 
 func (x *SchedParams) fromC(xc *C.libxl_sched_params) error {
-	x.Vcpuid = int(xc.vcpuid)
-	x.Weight = int(xc.weight)
-	x.Cap = int(xc.cap)
-	x.Period = int(xc.period)
-	x.Extratime = int(xc.extratime)
-	x.Budget = int(xc.budget)
+ x.Vcpuid = int(xc.vcpuid)
+x.Weight = int(xc.weight)
+x.Cap = int(xc.cap)
+x.Period = int(xc.period)
+x.Extratime = int(xc.extratime)
+x.Budget = int(xc.budget)
+
+ return nil}
+
+func (x *SchedParams) toC(xc *C.libxl_sched_params) (err error){defer func(){
+if err != nil{
+C.libxl_sched_params_dispose(xc)}
+}()
+
+xc.vcpuid = C.int(x.Vcpuid)
+xc.weight = C.int(x.Weight)
+xc.cap = C.int(x.Cap)
+xc.period = C.int(x.Period)
+xc.extratime = C.int(x.Extratime)
+xc.budget = C.int(x.Budget)
+
+ return nil
+ }
 
-	return nil
-}
+// NewVcpuSchedParams returns an instance of VcpuSchedParams initialized with defaults.
+func NewVcpuSchedParams() (*VcpuSchedParams, error) {
+var (
+x VcpuSchedParams
+xc C.libxl_vcpu_sched_params)
 
-func (x *SchedParams) toC(xc *C.libxl_sched_params) (err error) {
-	defer func() {
-		if err != nil {
-			C.libxl_sched_params_dispose(xc)
-		}
-	}()
+C.libxl_vcpu_sched_params_init(&xc)
+defer C.libxl_vcpu_sched_params_dispose(&xc)
 
-	xc.vcpuid = C.int(x.Vcpuid)
-	xc.weight = C.int(x.Weight)
-	xc.cap = C.int(x.Cap)
-	xc.period = C.int(x.Period)
-	xc.extratime = C.int(x.Extratime)
-	xc.budget = C.int(x.Budget)
+if err := x.fromC(&xc); err != nil {
+return nil, err }
 
-	return nil
-}
+return &x, nil}
 
-// NewVcpuSchedParams returns an instance of VcpuSchedParams initialized with defaults.
-func NewVcpuSchedParams() (*VcpuSchedParams, error) {
-	var (
-		x  VcpuSchedParams
-		xc C.libxl_vcpu_sched_params
-	)
+func (x *VcpuSchedParams) fromC(xc *C.libxl_vcpu_sched_params) error {
+ x.Sched = Scheduler(xc.sched)
+x.Vcpus = nil
+if n := int(xc.num_vcpus); n > 0 {
+cVcpus := (*[1<<28]C.libxl_sched_params)(unsafe.Pointer(xc.vcpus))[:n:n]
+x.Vcpus = make([]SchedParams, n)
+for i, v := range cVcpus {
+if err := x.Vcpus[i].fromC(&v); err != nil {
+return fmt.Errorf("converting field Vcpus: %v", err) }
+}
+}
 
-	C.libxl_vcpu_sched_params_init(&xc)
-	defer C.libxl_vcpu_sched_params_dispose(&xc)
+ return nil}
 
-	if err := x.fromC(&xc); err != nil {
-		return nil, err
-	}
+func (x *VcpuSchedParams) toC(xc *C.libxl_vcpu_sched_params) (err error){defer func(){
+if err != nil{
+C.libxl_vcpu_sched_params_dispose(xc)}
+}()
 
-	return &x, nil
+xc.sched = C.libxl_scheduler(x.Sched)
+if numVcpus := len(x.Vcpus); numVcpus > 0 {
+xc.vcpus = (*C.libxl_sched_params)(C.malloc(C.ulong(numVcpus)*C.sizeof_libxl_sched_params))
+xc.num_vcpus = C.int(numVcpus)
+cVcpus := (*[1<<28]C.libxl_sched_params)(unsafe.Pointer(xc.vcpus))[:numVcpus:numVcpus]
+for i,v := range x.Vcpus {
+if err := v.toC(&cVcpus[i]); err != nil {
+return fmt.Errorf("converting field Vcpus: %v", err)
+}
 }
-
-func (x *VcpuSchedParams) fromC(xc *C.libxl_vcpu_sched_params) error {
-	x.Sched = Scheduler(xc.sched)
-	x.Vcpus = nil
-	if n := int(xc.num_vcpus); n > 0 {
-		cVcpus := (*[1 << 28]C.libxl_sched_params)(unsafe.Pointer(xc.vcpus))[:n:n]
-		x.Vcpus = make([]SchedParams, n)
-		for i, v := range cVcpus {
-			if err := x.Vcpus[i].fromC(&v); err != nil {
-				return fmt.Errorf("converting field Vcpus: %v", err)
-			}
-		}
-	}
-
-	return nil
-}
-
-func (x *VcpuSchedParams) toC(xc *C.libxl_vcpu_sched_params) (err error) {
-	defer func() {
-		if err != nil {
-			C.libxl_vcpu_sched_params_dispose(xc)
-		}
-	}()
-
-	xc.sched = C.libxl_scheduler(x.Sched)
-	if numVcpus := len(x.Vcpus); numVcpus > 0 {
-		xc.vcpus = (*C.libxl_sched_params)(C.malloc(C.ulong(numVcpus) * C.sizeof_libxl_sched_params))
-		xc.num_vcpus = C.int(numVcpus)
-		cVcpus := (*[1 << 28]C.libxl_sched_params)(unsafe.Pointer(xc.vcpus))[:numVcpus:numVcpus]
-		for i, v := range x.Vcpus {
-			if err := v.toC(&cVcpus[i]); err != nil {
-				return fmt.Errorf("converting field Vcpus: %v", err)
-			}
-		}
-	}
-
-	return nil
 }
 
+ return nil
+ }
+
 // NewDomainSchedParams returns an instance of DomainSchedParams initialized with defaults.
 func NewDomainSchedParams() (*DomainSchedParams, error) {
-	var (
-		x  DomainSchedParams
-		xc C.libxl_domain_sched_params
-	)
+var (
+x DomainSchedParams
+xc C.libxl_domain_sched_params)
 
-	C.libxl_domain_sched_params_init(&xc)
-	defer C.libxl_domain_sched_params_dispose(&xc)
+C.libxl_domain_sched_params_init(&xc)
+defer C.libxl_domain_sched_params_dispose(&xc)
 
-	if err := x.fromC(&xc); err != nil {
-		return nil, err
-	}
+if err := x.fromC(&xc); err != nil {
+return nil, err }
 
-	return &x, nil
-}
+return &x, nil}
 
 func (x *DomainSchedParams) fromC(xc *C.libxl_domain_sched_params) error {
-	x.Sched = Scheduler(xc.sched)
-	x.Weight = int(xc.weight)
-	x.Cap = int(xc.cap)
-	x.Period = int(xc.period)
-	x.Budget = int(xc.budget)
-	x.Extratime = int(xc.extratime)
-	x.Slice = int(xc.slice)
-	x.Latency = int(xc.latency)
+ x.Sched = Scheduler(xc.sched)
+x.Weight = int(xc.weight)
+x.Cap = int(xc.cap)
+x.Period = int(xc.period)
+x.Budget = int(xc.budget)
+x.Extratime = int(xc.extratime)
+x.Slice = int(xc.slice)
+x.Latency = int(xc.latency)
+
+ return nil}
+
+func (x *DomainSchedParams) toC(xc *C.libxl_domain_sched_params) (err error){defer func(){
+if err != nil{
+C.libxl_domain_sched_params_dispose(xc)}
+}()
+
+xc.sched = C.libxl_scheduler(x.Sched)
+xc.weight = C.int(x.Weight)
+xc.cap = C.int(x.Cap)
+xc.period = C.int(x.Period)
+xc.budget = C.int(x.Budget)
+xc.extratime = C.int(x.Extratime)
+xc.slice = C.int(x.Slice)
+xc.latency = C.int(x.Latency)
+
+ return nil
+ }
 
-	return nil
-}
+// NewVnodeInfo returns an instance of VnodeInfo initialized with defaults.
+func NewVnodeInfo() (*VnodeInfo, error) {
+var (
+x VnodeInfo
+xc C.libxl_vnode_info)
 
-func (x *DomainSchedParams) toC(xc *C.libxl_domain_sched_params) (err error) {
-	defer func() {
-		if err != nil {
-			C.libxl_domain_sched_params_dispose(xc)
-		}
-	}()
+C.libxl_vnode_info_init(&xc)
+defer C.libxl_vnode_info_dispose(&xc)
 
-	xc.sched = C.libxl_scheduler(x.Sched)
-	xc.weight = C.int(x.Weight)
-	xc.cap = C.int(x.Cap)
-	xc.period = C.int(x.Period)
-	xc.budget = C.int(x.Budget)
-	xc.extratime = C.int(x.Extratime)
-	xc.slice = C.int(x.Slice)
-	xc.latency = C.int(x.Latency)
+if err := x.fromC(&xc); err != nil {
+return nil, err }
 
-	return nil
-}
+return &x, nil}
 
-// NewVnodeInfo returns an instance of VnodeInfo initialized with defaults.
-func NewVnodeInfo() (*VnodeInfo, error) {
-	var (
-		x  VnodeInfo
-		xc C.libxl_vnode_info
-	)
+func (x *VnodeInfo) fromC(xc *C.libxl_vnode_info) error {
+ x.Memkb = uint64(xc.memkb)
+x.Distances = nil
+if n := int(xc.num_distances); n > 0 {
+cDistances := (*[1<<28]C.uint32_t)(unsafe.Pointer(xc.distances))[:n:n]
+x.Distances = make([]uint32, n)
+for i, v := range cDistances {
+x.Distances[i] = uint32(v)
+}
+}
+x.Pnode = uint32(xc.pnode)
+if err := x.Vcpus.fromC(&xc.vcpus);err != nil {
+return fmt.Errorf("converting field Vcpus: %v", err)
+}
 
-	C.libxl_vnode_info_init(&xc)
-	defer C.libxl_vnode_info_dispose(&xc)
+ return nil}
 
-	if err := x.fromC(&xc); err != nil {
-		return nil, err
-	}
+func (x *VnodeInfo) toC(xc *C.libxl_vnode_info) (err error){defer func(){
+if err != nil{
+C.libxl_vnode_info_dispose(xc)}
+}()
 
-	return &x, nil
+xc.memkb = C.uint64_t(x.Memkb)
+if numDistances := len(x.Distances); numDistances > 0 {
+xc.distances = (*C.uint32_t)(C.malloc(C.size_t(numDistances*numDistances)))
+xc.num_distances = C.int(numDistances)
+cDistances := (*[1<<28]C.uint32_t)(unsafe.Pointer(xc.distances))[:numDistances:numDistances]
+for i,v := range x.Distances {
+cDistances[i] = C.uint32_t(v)
 }
-
-func (x *VnodeInfo) fromC(xc *C.libxl_vnode_info) error {
-	x.Memkb = uint64(xc.memkb)
-	x.Distances = nil
-	if n := int(xc.num_distances); n > 0 {
-		cDistances := (*[1 << 28]C.uint32_t)(unsafe.Pointer(xc.distances))[:n:n]
-		x.Distances = make([]uint32, n)
-		for i, v := range cDistances {
-			x.Distances[i] = uint32(v)
-		}
-	}
-	x.Pnode = uint32(xc.pnode)
-	if err := x.Vcpus.fromC(&xc.vcpus); err != nil {
-		return fmt.Errorf("converting field Vcpus: %v", err)
-	}
-
-	return nil
-}
-
-func (x *VnodeInfo) toC(xc *C.libxl_vnode_info) (err error) {
-	defer func() {
-		if err != nil {
-			C.libxl_vnode_info_dispose(xc)
-		}
-	}()
-
-	xc.memkb = C.uint64_t(x.Memkb)
-	if numDistances := len(x.Distances); numDistances > 0 {
-		xc.distances = (*C.uint32_t)(C.malloc(C.size_t(numDistances * numDistances)))
-		xc.num_distances = C.int(numDistances)
-		cDistances := (*[1 << 28]C.uint32_t)(unsafe.Pointer(xc.distances))[:numDistances:numDistances]
-		for i, v := range x.Distances {
-			cDistances[i] = C.uint32_t(v)
-		}
-	}
-	xc.pnode = C.uint32_t(x.Pnode)
-	if err := x.Vcpus.toC(&xc.vcpus); err != nil {
-		return fmt.Errorf("converting field Vcpus: %v", err)
-	}
-
-	return nil
 }
+xc.pnode = C.uint32_t(x.Pnode)
+if err := x.Vcpus.toC(&xc.vcpus); err != nil {
+return fmt.Errorf("converting field Vcpus: %v", err)
+}
+
+ return nil
+ }
 
 // NewRdmReserve returns an instance of RdmReserve initialized with defaults.
 func NewRdmReserve() (*RdmReserve, error) {
-	var (
-		x  RdmReserve
-		xc C.libxl_rdm_reserve
-	)
+var (
+x RdmReserve
+xc C.libxl_rdm_reserve)
 
-	C.libxl_rdm_reserve_init(&xc)
-	defer C.libxl_rdm_reserve_dispose(&xc)
+C.libxl_rdm_reserve_init(&xc)
+defer C.libxl_rdm_reserve_dispose(&xc)
 
-	if err := x.fromC(&xc); err != nil {
-		return nil, err
-	}
+if err := x.fromC(&xc); err != nil {
+return nil, err }
 
-	return &x, nil
-}
+return &x, nil}
 
 func (x *RdmReserve) fromC(xc *C.libxl_rdm_reserve) error {
-	x.Strategy = RdmReserveStrategy(xc.strategy)
-	x.Policy = RdmReservePolicy(xc.policy)
+ x.Strategy = RdmReserveStrategy(xc.strategy)
+x.Policy = RdmReservePolicy(xc.policy)
 
-	return nil
-}
+ return nil}
 
-func (x *RdmReserve) toC(xc *C.libxl_rdm_reserve) (err error) {
-	defer func() {
-		if err != nil {
-			C.libxl_rdm_reserve_dispose(xc)
-		}
-	}()
+func (x *RdmReserve) toC(xc *C.libxl_rdm_reserve) (err error){defer func(){
+if err != nil{
+C.libxl_rdm_reserve_dispose(xc)}
+}()
 
-	xc.strategy = C.libxl_rdm_reserve_strategy(x.Strategy)
-	xc.policy = C.libxl_rdm_reserve_policy(x.Policy)
+xc.strategy = C.libxl_rdm_reserve_strategy(x.Strategy)
+xc.policy = C.libxl_rdm_reserve_policy(x.Policy)
 
-	return nil
-}
+ return nil
+ }
 
 // NewDomainBuildInfo returns an instance of DomainBuildInfo initialized with defaults.
 func NewDomainBuildInfo(dtype DomainType) (*DomainBuildInfo, error) {
-	var (
-		x  DomainBuildInfo
-		xc C.libxl_domain_build_info
-	)
+var (
+x DomainBuildInfo
+xc C.libxl_domain_build_info)
 
-	C.libxl_domain_build_info_init(&xc)
-	C.libxl_domain_build_info_init_type(&xc, C.libxl_domain_type(dtype))
-	defer C.libxl_domain_build_info_dispose(&xc)
+C.libxl_domain_build_info_init(&xc)
+C.libxl_domain_build_info_init_type(&xc, C.libxl_domain_type(dtype))
+defer C.libxl_domain_build_info_dispose(&xc)
 
-	if err := x.fromC(&xc); err != nil {
-		return nil, err
-	}
+if err := x.fromC(&xc); err != nil {
+return nil, err }
 
-	return &x, nil
-}
+return &x, nil}
 
 func (x *DomainBuildInfo) fromC(xc *C.libxl_domain_build_info) error {
-	x.MaxVcpus = int(xc.max_vcpus)
-	if err := x.AvailVcpus.fromC(&xc.avail_vcpus); err != nil {
-		return fmt.Errorf("converting field AvailVcpus: %v", err)
-	}
-	if err := x.Cpumap.fromC(&xc.cpumap); err != nil {
-		return fmt.Errorf("converting field Cpumap: %v", err)
-	}
-	if err := x.Nodemap.fromC(&xc.nodemap); err != nil {
-		return fmt.Errorf("converting field Nodemap: %v", err)
-	}
-	x.VcpuHardAffinity = nil
-	if n := int(xc.num_vcpu_hard_affinity); n > 0 {
-		cVcpuHardAffinity := (*[1 << 28]C.libxl_bitmap)(unsafe.Pointer(xc.vcpu_hard_affinity))[:n:n]
-		x.VcpuHardAffinity = make([]Bitmap, n)
-		for i, v := range cVcpuHardAffinity {
-			if err := x.VcpuHardAffinity[i].fromC(&v); err != nil {
-				return fmt.Errorf("converting field VcpuHardAffinity: %v", err)
-			}
-		}
-	}
-	x.VcpuSoftAffinity = nil
-	if n := int(xc.num_vcpu_soft_affinity); n > 0 {
-		cVcpuSoftAffinity := (*[1 << 28]C.libxl_bitmap)(unsafe.Pointer(xc.vcpu_soft_affinity))[:n:n]
-		x.VcpuSoftAffinity = make([]Bitmap, n)
-		for i, v := range cVcpuSoftAffinity {
-			if err := x.VcpuSoftAffinity[i].fromC(&v); err != nil {
-				return fmt.Errorf("converting field VcpuSoftAffinity: %v", err)
-			}
-		}
-	}
-	if err := x.NumaPlacement.fromC(&xc.numa_placement); err != nil {
-		return fmt.Errorf("converting field NumaPlacement: %v", err)
-	}
-	x.TscMode = TscMode(xc.tsc_mode)
-	x.MaxMemkb = uint64(xc.max_memkb)
-	x.TargetMemkb = uint64(xc.target_memkb)
-	x.VideoMemkb = uint64(xc.video_memkb)
-	x.ShadowMemkb = uint64(xc.shadow_memkb)
-	x.IommuMemkb = uint64(xc.iommu_memkb)
-	x.RtcTimeoffset = uint32(xc.rtc_timeoffset)
-	x.ExecSsidref = uint32(xc.exec_ssidref)
-	x.ExecSsidLabel = C.GoString(xc.exec_ssid_label)
-	if err := x.Localtime.fromC(&xc.localtime); err != nil {
-		return fmt.Errorf("converting field Localtime: %v", err)
-	}
-	if err := x.DisableMigrate.fromC(&xc.disable_migrate); err != nil {
-		return fmt.Errorf("converting field DisableMigrate: %v", err)
-	}
-	if err := x.Cpuid.fromC(&xc.cpuid); err != nil {
-		return fmt.Errorf("converting field Cpuid: %v", err)
-	}
-	x.BlkdevStart = C.GoString(xc.blkdev_start)
-	x.VnumaNodes = nil
-	if n := int(xc.num_vnuma_nodes); n > 0 {
-		cVnumaNodes := (*[1 << 28]C.libxl_vnode_info)(unsafe.Pointer(xc.vnuma_nodes))[:n:n]
-		x.VnumaNodes = make([]VnodeInfo, n)
-		for i, v := range cVnumaNodes {
-			if err := x.VnumaNodes[i].fromC(&v); err != nil {
-				return fmt.Errorf("converting field VnumaNodes: %v", err)
-			}
-		}
-	}
-	x.MaxGrantFrames = uint32(xc.max_grant_frames)
-	x.MaxMaptrackFrames = uint32(xc.max_maptrack_frames)
-	x.DeviceModelVersion = DeviceModelVersion(xc.device_model_version)
-	if err := x.DeviceModelStubdomain.fromC(&xc.device_model_stubdomain); err != nil {
-		return fmt.Errorf("converting field DeviceModelStubdomain: %v", err)
-	}
-	x.StubdomainMemkb = uint64(xc.stubdomain_memkb)
-	x.StubdomainKernel = C.GoString(xc.stubdomain_kernel)
-	x.StubdomainRamdisk = C.GoString(xc.stubdomain_ramdisk)
-	x.DeviceModel = C.GoString(xc.device_model)
-	x.DeviceModelSsidref = uint32(xc.device_model_ssidref)
-	x.DeviceModelSsidLabel = C.GoString(xc.device_model_ssid_label)
-	x.DeviceModelUser = C.GoString(xc.device_model_user)
-	if err := x.Extra.fromC(&xc.extra); err != nil {
-		return fmt.Errorf("converting field Extra: %v", err)
-	}
-	if err := x.ExtraPv.fromC(&xc.extra_pv); err != nil {
-		return fmt.Errorf("converting field ExtraPv: %v", err)
-	}
-	if err := x.ExtraHvm.fromC(&xc.extra_hvm); err != nil {
-		return fmt.Errorf("converting field ExtraHvm: %v", err)
-	}
-	if err := x.SchedParams.fromC(&xc.sched_params); err != nil {
-		return fmt.Errorf("converting field SchedParams: %v", err)
-	}
-	x.Ioports = nil
-	if n := int(xc.num_ioports); n > 0 {
-		cIoports := (*[1 << 28]C.libxl_ioport_range)(unsafe.Pointer(xc.ioports))[:n:n]
-		x.Ioports = make([]IoportRange, n)
-		for i, v := range cIoports {
-			if err := x.Ioports[i].fromC(&v); err != nil {
-				return fmt.Errorf("converting field Ioports: %v", err)
-			}
-		}
-	}
-	x.Irqs = nil
-	if n := int(xc.num_irqs); n > 0 {
-		cIrqs := (*[1 << 28]C.uint32_t)(unsafe.Pointer(xc.irqs))[:n:n]
-		x.Irqs = make([]uint32, n)
-		for i, v := range cIrqs {
-			x.Irqs[i] = uint32(v)
-		}
-	}
-	x.Iomem = nil
-	if n := int(xc.num_iomem); n > 0 {
-		cIomem := (*[1 << 28]C.libxl_iomem_range)(unsafe.Pointer(xc.iomem))[:n:n]
-		x.Iomem = make([]IomemRange, n)
-		for i, v := range cIomem {
-			if err := x.Iomem[i].fromC(&v); err != nil {
-				return fmt.Errorf("converting field Iomem: %v", err)
-			}
-		}
-	}
-	if err := x.ClaimMode.fromC(&xc.claim_mode); err != nil {
-		return fmt.Errorf("converting field ClaimMode: %v", err)
-	}
-	x.EventChannels = uint32(xc.event_channels)
-	x.Kernel = C.GoString(xc.kernel)
-	x.Cmdline = C.GoString(xc.cmdline)
-	x.Ramdisk = C.GoString(xc.ramdisk)
-	x.DeviceTree = C.GoString(xc.device_tree)
-	if err := x.Acpi.fromC(&xc.acpi); err != nil {
-		return fmt.Errorf("converting field Acpi: %v", err)
-	}
-	x.Bootloader = C.GoString(xc.bootloader)
-	if err := x.BootloaderArgs.fromC(&xc.bootloader_args); err != nil {
-		return fmt.Errorf("converting field BootloaderArgs: %v", err)
-	}
-	x.TimerMode = TimerMode(xc.timer_mode)
-	if err := x.NestedHvm.fromC(&xc.nested_hvm); err != nil {
-		return fmt.Errorf("converting field NestedHvm: %v", err)
-	}
-	if err := x.Apic.fromC(&xc.apic); err != nil {
-		return fmt.Errorf("converting field Apic: %v", err)
-	}
-	if err := x.DmRestrict.fromC(&xc.dm_restrict); err != nil {
-		return fmt.Errorf("converting field DmRestrict: %v", err)
-	}
-	x.Tee = TeeType(xc.tee)
-	x.Type = DomainType(xc._type)
-	switch x.Type {
-	case DomainTypeHvm:
-		var typeHvm DomainBuildInfoTypeUnionHvm
-		if err := typeHvm.fromC(xc); err != nil {
-			return fmt.Errorf("converting field typeHvm: %v", err)
-		}
-		x.TypeUnion = typeHvm
-	case DomainTypePv:
-		var typePv DomainBuildInfoTypeUnionPv
-		if err := typePv.fromC(xc); err != nil {
-			return fmt.Errorf("converting field typePv: %v", err)
-		}
-		x.TypeUnion = typePv
-	case DomainTypePvh:
-		var typePvh DomainBuildInfoTypeUnionPvh
-		if err := typePvh.fromC(xc); err != nil {
-			return fmt.Errorf("converting field typePvh: %v", err)
-		}
-		x.TypeUnion = typePvh
-	case DomainTypeInvalid:
-		x.TypeUnion = nil
-	default:
-		return fmt.Errorf("invalid union key '%v'", x.Type)
-	}
-	x.ArchArm.GicVersion = GicVersion(xc.arch_arm.gic_version)
-	x.ArchArm.Vuart = VuartType(xc.arch_arm.vuart)
-	x.Altp2M = Altp2MMode(xc.altp2m)
-
-	return nil
-}
+ x.MaxVcpus = int(xc.max_vcpus)
+if err := x.AvailVcpus.fromC(&xc.avail_vcpus);err != nil {
+return fmt.Errorf("converting field AvailVcpus: %v", err)
+}
+if err := x.Cpumap.fromC(&xc.cpumap);err != nil {
+return fmt.Errorf("converting field Cpumap: %v", err)
+}
+if err := x.Nodemap.fromC(&xc.nodemap);err != nil {
+return fmt.Errorf("converting field Nodemap: %v", err)
+}
+x.VcpuHardAffinity = nil
+if n := int(xc.num_vcpu_hard_affinity); n > 0 {
+cVcpuHardAffinity := (*[1<<28]C.libxl_bitmap)(unsafe.Pointer(xc.vcpu_hard_affinity))[:n:n]
+x.VcpuHardAffinity = make([]Bitmap, n)
+for i, v := range cVcpuHardAffinity {
+if err := x.VcpuHardAffinity[i].fromC(&v); err != nil {
+return fmt.Errorf("converting field VcpuHardAffinity: %v", err) }
+}
+}
+x.VcpuSoftAffinity = nil
+if n := int(xc.num_vcpu_soft_affinity); n > 0 {
+cVcpuSoftAffinity := (*[1<<28]C.libxl_bitmap)(unsafe.Pointer(xc.vcpu_soft_affinity))[:n:n]
+x.VcpuSoftAffinity = make([]Bitmap, n)
+for i, v := range cVcpuSoftAffinity {
+if err := x.VcpuSoftAffinity[i].fromC(&v); err != nil {
+return fmt.Errorf("converting field VcpuSoftAffinity: %v", err) }
+}
+}
+if err := x.NumaPlacement.fromC(&xc.numa_placement);err != nil {
+return fmt.Errorf("converting field NumaPlacement: %v", err)
+}
+x.TscMode = TscMode(xc.tsc_mode)
+x.MaxMemkb = uint64(xc.max_memkb)
+x.TargetMemkb = uint64(xc.target_memkb)
+x.VideoMemkb = uint64(xc.video_memkb)
+x.ShadowMemkb = uint64(xc.shadow_memkb)
+x.IommuMemkb = uint64(xc.iommu_memkb)
+x.RtcTimeoffset = uint32(xc.rtc_timeoffset)
+x.ExecSsidref = uint32(xc.exec_ssidref)
+x.ExecSsidLabel = C.GoString(xc.exec_ssid_label)
+if err := x.Localtime.fromC(&xc.localtime);err != nil {
+return fmt.Errorf("converting field Localtime: %v", err)
+}
+if err := x.DisableMigrate.fromC(&xc.disable_migrate);err != nil {
+return fmt.Errorf("converting field DisableMigrate: %v", err)
+}
+if err := x.Cpuid.fromC(&xc.cpuid);err != nil {
+return fmt.Errorf("converting field Cpuid: %v", err)
+}
+x.BlkdevStart = C.GoString(xc.blkdev_start)
+x.VnumaNodes = nil
+if n := int(xc.num_vnuma_nodes); n > 0 {
+cVnumaNodes := (*[1<<28]C.libxl_vnode_info)(unsafe.Pointer(xc.vnuma_nodes))[:n:n]
+x.VnumaNodes = make([]VnodeInfo, n)
+for i, v := range cVnumaNodes {
+if err := x.VnumaNodes[i].fromC(&v); err != nil {
+return fmt.Errorf("converting field VnumaNodes: %v", err) }
+}
+}
+x.MaxGrantFrames = uint32(xc.max_grant_frames)
+x.MaxMaptrackFrames = uint32(xc.max_maptrack_frames)
+x.DeviceModelVersion = DeviceModelVersion(xc.device_model_version)
+if err := x.DeviceModelStubdomain.fromC(&xc.device_model_stubdomain);err != nil {
+return fmt.Errorf("converting field DeviceModelStubdomain: %v", err)
+}
+x.StubdomainMemkb = uint64(xc.stubdomain_memkb)
+x.StubdomainKernel = C.GoString(xc.stubdomain_kernel)
+x.StubdomainRamdisk = C.GoString(xc.stubdomain_ramdisk)
+x.DeviceModel = C.GoString(xc.device_model)
+x.DeviceModelSsidref = uint32(xc.device_model_ssidref)
+x.DeviceModelSsidLabel = C.GoString(xc.device_model_ssid_label)
+x.DeviceModelUser = C.GoString(xc.device_model_user)
+if err := x.Extra.fromC(&xc.extra);err != nil {
+return fmt.Errorf("converting field Extra: %v", err)
+}
+if err := x.ExtraPv.fromC(&xc.extra_pv);err != nil {
+return fmt.Errorf("converting field ExtraPv: %v", err)
+}
+if err := x.ExtraHvm.fromC(&xc.extra_hvm);err != nil {
+return fmt.Errorf("converting field ExtraHvm: %v", err)
+}
+if err := x.SchedParams.fromC(&xc.sched_params);err != nil {
+return fmt.Errorf("converting field SchedParams: %v", err)
+}
+x.Ioports = nil
+if n := int(xc.num_ioports); n > 0 {
+cIoports := (*[1<<28]C.libxl_ioport_range)(unsafe.Pointer(xc.ioports))[:n:n]
+x.Ioports = make([]IoportRange, n)
+for i, v := range cIoports {
+if err := x.Ioports[i].fromC(&v); err != nil {
+return fmt.Errorf("converting field Ioports: %v", err) }
+}
+}
+x.Irqs = nil
+if n := int(xc.num_irqs); n > 0 {
+cIrqs := (*[1<<28]C.uint32_t)(unsafe.Pointer(xc.irqs))[:n:n]
+x.Irqs = make([]uint32, n)
+for i, v := range cIrqs {
+x.Irqs[i] = uint32(v)
+}
+}
+x.Iomem = nil
+if n := int(xc.num_iomem); n > 0 {
+cIomem := (*[1<<28]C.libxl_iomem_range)(unsafe.Pointer(xc.iomem))[:n:n]
+x.Iomem = make([]IomemRange, n)
+for i, v := range cIomem {
+if err := x.Iomem[i].fromC(&v); err != nil {
+return fmt.Errorf("converting field Iomem: %v", err) }
+}
+}
+if err := x.ClaimMode.fromC(&xc.claim_mode);err != nil {
+return fmt.Errorf("converting field ClaimMode: %v", err)
+}
+x.EventChannels = uint32(xc.event_channels)
+x.Kernel = C.GoString(xc.kernel)
+x.Cmdline = C.GoString(xc.cmdline)
+x.Ramdisk = C.GoString(xc.ramdisk)
+x.DeviceTree = C.GoString(xc.device_tree)
+if err := x.Acpi.fromC(&xc.acpi);err != nil {
+return fmt.Errorf("converting field Acpi: %v", err)
+}
+x.Bootloader = C.GoString(xc.bootloader)
+if err := x.BootloaderArgs.fromC(&xc.bootloader_args);err != nil {
+return fmt.Errorf("converting field BootloaderArgs: %v", err)
+}
+x.TimerMode = TimerMode(xc.timer_mode)
+if err := x.NestedHvm.fromC(&xc.nested_hvm);err != nil {
+return fmt.Errorf("converting field NestedHvm: %v", err)
+}
+if err := x.Apic.fromC(&xc.apic);err != nil {
+return fmt.Errorf("converting field Apic: %v", err)
+}
+if err := x.DmRestrict.fromC(&xc.dm_restrict);err != nil {
+return fmt.Errorf("converting field DmRestrict: %v", err)
+}
+x.Tee = TeeType(xc.tee)
+x.Type = DomainType(xc._type)
+switch x.Type{
+case DomainTypeHvm:
+var typeHvm DomainBuildInfoTypeUnionHvm
+if err := typeHvm.fromC(xc);err != nil {
+ return fmt.Errorf("converting field typeHvm: %v", err)
+}
+x.TypeUnion = typeHvm
+case DomainTypePv:
+var typePv DomainBuildInfoTypeUnionPv
+if err := typePv.fromC(xc);err != nil {
+ return fmt.Errorf("converting field typePv: %v", err)
+}
+x.TypeUnion = typePv
+case DomainTypePvh:
+var typePvh DomainBuildInfoTypeUnionPvh
+if err := typePvh.fromC(xc);err != nil {
+ return fmt.Errorf("converting field typePvh: %v", err)
+}
+x.TypeUnion = typePvh
+case DomainTypeInvalid:
+x.TypeUnion = nil
+default:
+return fmt.Errorf("invalid union key '%v'", x.Type)}
+x.ArchArm.GicVersion = GicVersion(xc.arch_arm.gic_version)
+x.ArchArm.Vuart = VuartType(xc.arch_arm.vuart)
+x.Altp2M = Altp2MMode(xc.altp2m)
+
+ return nil}
 
 func (x *DomainBuildInfoTypeUnionHvm) fromC(xc *C.libxl_domain_build_info) error {
-	if DomainType(xc._type) != DomainTypeHvm {
-		return errors.New("expected union key DomainTypeHvm")
-	}
-
-	tmp := (*C.libxl_domain_build_info_type_union_hvm)(unsafe.Pointer(&xc.u[0]))
-	x.Firmware = C.GoString(tmp.firmware)
-	x.Bios = BiosType(tmp.bios)
-	if err := x.Pae.fromC(&tmp.pae); err != nil {
-		return fmt.Errorf("converting field Pae: %v", err)
-	}
-	if err := x.Apic.fromC(&tmp.apic); err != nil {
-		return fmt.Errorf("converting field Apic: %v", err)
-	}
-	if err := x.Acpi.fromC(&tmp.acpi); err != nil {
-		return fmt.Errorf("converting field Acpi: %v", err)
-	}
-	if err := x.AcpiS3.fromC(&tmp.acpi_s3); err != nil {
-		return fmt.Errorf("converting field AcpiS3: %v", err)
-	}
-	if err := x.AcpiS4.fromC(&tmp.acpi_s4); err != nil {
-		return fmt.Errorf("converting field AcpiS4: %v", err)
-	}
-	if err := x.AcpiLaptopSlate.fromC(&tmp.acpi_laptop_slate); err != nil {
-		return fmt.Errorf("converting field AcpiLaptopSlate: %v", err)
-	}
-	if err := x.Nx.fromC(&tmp.nx); err != nil {
-		return fmt.Errorf("converting field Nx: %v", err)
-	}
-	if err := x.Viridian.fromC(&tmp.viridian); err != nil {
-		return fmt.Errorf("converting field Viridian: %v", err)
-	}
-	if err := x.ViridianEnable.fromC(&tmp.viridian_enable); err != nil {
-		return fmt.Errorf("converting field ViridianEnable: %v", err)
-	}
-	if err := x.ViridianDisable.fromC(&tmp.viridian_disable); err != nil {
-		return fmt.Errorf("converting field ViridianDisable: %v", err)
-	}
-	x.Timeoffset = C.GoString(tmp.timeoffset)
-	if err := x.Hpet.fromC(&tmp.hpet); err != nil {
-		return fmt.Errorf("converting field Hpet: %v", err)
-	}
-	if err := x.VptAlign.fromC(&tmp.vpt_align); err != nil {
-		return fmt.Errorf("converting field VptAlign: %v", err)
-	}
-	x.MmioHoleMemkb = uint64(tmp.mmio_hole_memkb)
-	x.TimerMode = TimerMode(tmp.timer_mode)
-	if err := x.NestedHvm.fromC(&tmp.nested_hvm); err != nil {
-		return fmt.Errorf("converting field NestedHvm: %v", err)
-	}
-	if err := x.Altp2M.fromC(&tmp.altp2m); err != nil {
-		return fmt.Errorf("converting field Altp2M: %v", err)
-	}
-	x.SystemFirmware = C.GoString(tmp.system_firmware)
-	x.SmbiosFirmware = C.GoString(tmp.smbios_firmware)
-	x.AcpiFirmware = C.GoString(tmp.acpi_firmware)
-	x.Hdtype = Hdtype(tmp.hdtype)
-	if err := x.Nographic.fromC(&tmp.nographic); err != nil {
-		return fmt.Errorf("converting field Nographic: %v", err)
-	}
-	if err := x.Vga.fromC(&tmp.vga); err != nil {
-		return fmt.Errorf("converting field Vga: %v", err)
-	}
-	if err := x.Vnc.fromC(&tmp.vnc); err != nil {
-		return fmt.Errorf("converting field Vnc: %v", err)
-	}
-	x.Keymap = C.GoString(tmp.keymap)
-	if err := x.Sdl.fromC(&tmp.sdl); err != nil {
-		return fmt.Errorf("converting field Sdl: %v", err)
-	}
-	if err := x.Spice.fromC(&tmp.spice); err != nil {
-		return fmt.Errorf("converting field Spice: %v", err)
-	}
-	if err := x.GfxPassthru.fromC(&tmp.gfx_passthru); err != nil {
-		return fmt.Errorf("converting field GfxPassthru: %v", err)
-	}
-	x.GfxPassthruKind = GfxPassthruKind(tmp.gfx_passthru_kind)
-	x.Serial = C.GoString(tmp.serial)
-	x.Boot = C.GoString(tmp.boot)
-	if err := x.Usb.fromC(&tmp.usb); err != nil {
-		return fmt.Errorf("converting field Usb: %v", err)
-	}
-	x.Usbversion = int(tmp.usbversion)
-	x.Usbdevice = C.GoString(tmp.usbdevice)
-	if err := x.VkbDevice.fromC(&tmp.vkb_device); err != nil {
-		return fmt.Errorf("converting field VkbDevice: %v", err)
-	}
-	x.Soundhw = C.GoString(tmp.soundhw)
-	if err := x.XenPlatformPci.fromC(&tmp.xen_platform_pci); err != nil {
-		return fmt.Errorf("converting field XenPlatformPci: %v", err)
-	}
-	if err := x.UsbdeviceList.fromC(&tmp.usbdevice_list); err != nil {
-		return fmt.Errorf("converting field UsbdeviceList: %v", err)
-	}
-	x.VendorDevice = VendorDevice(tmp.vendor_device)
-	if err := x.MsVmGenid.fromC(&tmp.ms_vm_genid); err != nil {
-		return fmt.Errorf("converting field MsVmGenid: %v", err)
-	}
-	if err := x.SerialList.fromC(&tmp.serial_list); err != nil {
-		return fmt.Errorf("converting field SerialList: %v", err)
-	}
-	if err := x.Rdm.fromC(&tmp.rdm); err != nil {
-		return fmt.Errorf("converting field Rdm: %v", err)
-	}
-	x.RdmMemBoundaryMemkb = uint64(tmp.rdm_mem_boundary_memkb)
-	x.McaCaps = uint64(tmp.mca_caps)
-	return nil
+if DomainType(xc._type) != DomainTypeHvm {
+return errors.New("expected union key DomainTypeHvm")
+}
+
+tmp := (*C.libxl_domain_build_info_type_union_hvm)(unsafe.Pointer(&xc.u[0]))
+x.Firmware = C.GoString(tmp.firmware)
+x.Bios = BiosType(tmp.bios)
+if err := x.Pae.fromC(&tmp.pae);err != nil {
+return fmt.Errorf("converting field Pae: %v", err)
+}
+if err := x.Apic.fromC(&tmp.apic);err != nil {
+return fmt.Errorf("converting field Apic: %v", err)
+}
+if err := x.Acpi.fromC(&tmp.acpi);err != nil {
+return fmt.Errorf("converting field Acpi: %v", err)
+}
+if err := x.AcpiS3.fromC(&tmp.acpi_s3);err != nil {
+return fmt.Errorf("converting field AcpiS3: %v", err)
+}
+if err := x.AcpiS4.fromC(&tmp.acpi_s4);err != nil {
+return fmt.Errorf("converting field AcpiS4: %v", err)
+}
+if err := x.AcpiLaptopSlate.fromC(&tmp.acpi_laptop_slate);err != nil {
+return fmt.Errorf("converting field AcpiLaptopSlate: %v", err)
+}
+if err := x.Nx.fromC(&tmp.nx);err != nil {
+return fmt.Errorf("converting field Nx: %v", err)
+}
+if err := x.Viridian.fromC(&tmp.viridian);err != nil {
+return fmt.Errorf("converting field Viridian: %v", err)
+}
+if err := x.ViridianEnable.fromC(&tmp.viridian_enable);err != nil {
+return fmt.Errorf("converting field ViridianEnable: %v", err)
+}
+if err := x.ViridianDisable.fromC(&tmp.viridian_disable);err != nil {
+return fmt.Errorf("converting field ViridianDisable: %v", err)
+}
+x.Timeoffset = C.GoString(tmp.timeoffset)
+if err := x.Hpet.fromC(&tmp.hpet);err != nil {
+return fmt.Errorf("converting field Hpet: %v", err)
+}
+if err := x.VptAlign.fromC(&tmp.vpt_align);err != nil {
+return fmt.Errorf("converting field VptAlign: %v", err)
+}
+x.MmioHoleMemkb = uint64(tmp.mmio_hole_memkb)
+x.TimerMode = TimerMode(tmp.timer_mode)
+if err := x.NestedHvm.fromC(&tmp.nested_hvm);err != nil {
+return fmt.Errorf("converting field NestedHvm: %v", err)
+}
+if err := x.Altp2M.fromC(&tmp.altp2m);err != nil {
+return fmt.Errorf("converting field Altp2M: %v", err)
+}
+x.SystemFirmware = C.GoString(tmp.system_firmware)
+x.SmbiosFirmware = C.GoString(tmp.smbios_firmware)
+x.AcpiFirmware = C.GoString(tmp.acpi_firmware)
+x.Hdtype = Hdtype(tmp.hdtype)
+if err := x.Nographic.fromC(&tmp.nographic);err != nil {
+return fmt.Errorf("converting field Nographic: %v", err)
+}
+if err := x.Vga.fromC(&tmp.vga);err != nil {
+return fmt.Errorf("converting field Vga: %v", err)
+}
+if err := x.Vnc.fromC(&tmp.vnc);err != nil {
+return fmt.Errorf("converting field Vnc: %v", err)
+}
+x.Keymap = C.GoString(tmp.keymap)
+if err := x.Sdl.fromC(&tmp.sdl);err != nil {
+return fmt.Errorf("converting field Sdl: %v", err)
+}
+if err := x.Spice.fromC(&tmp.spice);err != nil {
+return fmt.Errorf("converting field Spice: %v", err)
+}
+if err := x.GfxPassthru.fromC(&tmp.gfx_passthru);err != nil {
+return fmt.Errorf("converting field GfxPassthru: %v", err)
+}
+x.GfxPassthruKind = GfxPassthruKind(tmp.gfx_passthru_kind)
+x.Serial = C.GoString(tmp.serial)
+x.Boot = C.GoString(tmp.boot)
+if err := x.Usb.fromC(&tmp.usb);err != nil {
+return fmt.Errorf("converting field Usb: %v", err)
+}
+x.Usbversion = int(tmp.usbversion)
+x.Usbdevice = C.GoString(tmp.usbdevice)
+if err := x.VkbDevice.fromC(&tmp.vkb_device);err != nil {
+return fmt.Errorf("converting field VkbDevice: %v", err)
+}
+x.Soundhw = C.GoString(tmp.soundhw)
+if err := x.XenPlatformPci.fromC(&tmp.xen_platform_pci);err != nil {
+return fmt.Errorf("converting field XenPlatformPci: %v", err)
+}
+if err := x.UsbdeviceList.fromC(&tmp.usbdevice_list);err != nil {
+return fmt.Errorf("converting field UsbdeviceList: %v", err)
+}
+x.VendorDevice = VendorDevice(tmp.vendor_device)
+if err := x.MsVmGenid.fromC(&tmp.ms_vm_genid);err != nil {
+return fmt.Errorf("converting field MsVmGenid: %v", err)
+}
+if err := x.SerialList.fromC(&tmp.serial_list);err != nil {
+return fmt.Errorf("converting field SerialList: %v", err)
+}
+if err := x.Rdm.fromC(&tmp.rdm);err != nil {
+return fmt.Errorf("converting field Rdm: %v", err)
+}
+x.RdmMemBoundaryMemkb = uint64(tmp.rdm_mem_boundary_memkb)
+x.McaCaps = uint64(tmp.mca_caps)
+return nil
 }
 
 func (x *DomainBuildInfoTypeUnionPv) fromC(xc *C.libxl_domain_build_info) error {
-	if DomainType(xc._type) != DomainTypePv {
-		return errors.New("expected union key DomainTypePv")
-	}
-
-	tmp := (*C.libxl_domain_build_info_type_union_pv)(unsafe.Pointer(&xc.u[0]))
-	x.Kernel = C.GoString(tmp.kernel)
-	x.SlackMemkb = uint64(tmp.slack_memkb)
-	x.Bootloader = C.GoString(tmp.bootloader)
-	if err := x.BootloaderArgs.fromC(&tmp.bootloader_args); err != nil {
-		return fmt.Errorf("converting field BootloaderArgs: %v", err)
-	}
-	x.Cmdline = C.GoString(tmp.cmdline)
-	x.Ramdisk = C.GoString(tmp.ramdisk)
-	x.Features = C.GoString(tmp.features)
-	if err := x.E820Host.fromC(&tmp.e820_host); err != nil {
-		return fmt.Errorf("converting field E820Host: %v", err)
-	}
-	return nil
+if DomainType(xc._type) != DomainTypePv {
+return errors.New("expected union key DomainTypePv")
+}
+
+tmp := (*C.libxl_domain_build_info_type_union_pv)(unsafe.Pointer(&xc.u[0]))
+x.Kernel = C.GoString(tmp.kernel)
+x.SlackMemkb = uint64(tmp.slack_memkb)
+x.Bootloader = C.GoString(tmp.bootloader)
+if err := x.BootloaderArgs.fromC(&tmp.bootloader_args);err != nil {
+return fmt.Errorf("converting field BootloaderArgs: %v", err)
+}
+x.Cmdline = C.GoString(tmp.cmdline)
+x.Ramdisk = C.GoString(tmp.ramdisk)
+x.Features = C.GoString(tmp.features)
+if err := x.E820Host.fromC(&tmp.e820_host);err != nil {
+return fmt.Errorf("converting field E820Host: %v", err)
+}
+return nil
 }
 
 func (x *DomainBuildInfoTypeUnionPvh) fromC(xc *C.libxl_domain_build_info) error {
-	if DomainType(xc._type) != DomainTypePvh {
-		return errors.New("expected union key DomainTypePvh")
-	}
-
-	tmp := (*C.libxl_domain_build_info_type_union_pvh)(unsafe.Pointer(&xc.u[0]))
-	if err := x.Pvshim.fromC(&tmp.pvshim); err != nil {
-		return fmt.Errorf("converting field Pvshim: %v", err)
-	}
-	x.PvshimPath = C.GoString(tmp.pvshim_path)
-	x.PvshimCmdline = C.GoString(tmp.pvshim_cmdline)
-	x.PvshimExtra = C.GoString(tmp.pvshim_extra)
-	return nil
-}
-
-func (x *DomainBuildInfo) toC(xc *C.libxl_domain_build_info) (err error) {
-	defer func() {
-		if err != nil {
-			C.libxl_domain_build_info_dispose(xc)
-		}
-	}()
-
-	xc.max_vcpus = C.int(x.MaxVcpus)
-	if err := x.AvailVcpus.toC(&xc.avail_vcpus); err != nil {
-		return fmt.Errorf("converting field AvailVcpus: %v", err)
-	}
-	if err := x.Cpumap.toC(&xc.cpumap); err != nil {
-		return fmt.Errorf("converting field Cpumap: %v", err)
-	}
-	if err := x.Nodemap.toC(&xc.nodemap); err != nil {
-		return fmt.Errorf("converting field Nodemap: %v", err)
-	}
-	if numVcpuHardAffinity := len(x.VcpuHardAffinity); numVcpuHardAffinity > 0 {
-		xc.vcpu_hard_affinity = (*C.libxl_bitmap)(C.malloc(C.ulong(numVcpuHardAffinity) * C.sizeof_libxl_bitmap))
-		xc.num_vcpu_hard_affinity = C.int(numVcpuHardAffinity)
-		cVcpuHardAffinity := (*[1 << 28]C.libxl_bitmap)(unsafe.Pointer(xc.vcpu_hard_affinity))[:numVcpuHardAffinity:numVcpuHardAffinity]
-		for i, v := range x.VcpuHardAffinity {
-			if err := v.toC(&cVcpuHardAffinity[i]); err != nil {
-				return fmt.Errorf("converting field VcpuHardAffinity: %v", err)
-			}
-		}
-	}
-	if numVcpuSoftAffinity := len(x.VcpuSoftAffinity); numVcpuSoftAffinity > 0 {
-		xc.vcpu_soft_affinity = (*C.libxl_bitmap)(C.malloc(C.ulong(numVcpuSoftAffinity) * C.sizeof_libxl_bitmap))
-		xc.num_vcpu_soft_affinity = C.int(numVcpuSoftAffinity)
-		cVcpuSoftAffinity := (*[1 << 28]C.libxl_bitmap)(unsafe.Pointer(xc.vcpu_soft_affinity))[:numVcpuSoftAffinity:numVcpuSoftAffinity]
-		for i, v := range x.VcpuSoftAffinity {
-			if err := v.toC(&cVcpuSoftAffinity[i]); err != nil {
-				return fmt.Errorf("converting field VcpuSoftAffinity: %v", err)
-			}
-		}
-	}
-	if err := x.NumaPlacement.toC(&xc.numa_placement); err != nil {
-		return fmt.Errorf("converting field NumaPlacement: %v", err)
-	}
-	xc.tsc_mode = C.libxl_tsc_mode(x.TscMode)
-	xc.max_memkb = C.uint64_t(x.MaxMemkb)
-	xc.target_memkb = C.uint64_t(x.TargetMemkb)
-	xc.video_memkb = C.uint64_t(x.VideoMemkb)
-	xc.shadow_memkb = C.uint64_t(x.ShadowMemkb)
-	xc.iommu_memkb = C.uint64_t(x.IommuMemkb)
-	xc.rtc_timeoffset = C.uint32_t(x.RtcTimeoffset)
-	xc.exec_ssidref = C.uint32_t(x.ExecSsidref)
-	if x.ExecSsidLabel != "" {
-		xc.exec_ssid_label = C.CString(x.ExecSsidLabel)
-	}
-	if err := x.Localtime.toC(&xc.localtime); err != nil {
-		return fmt.Errorf("converting field Localtime: %v", err)
-	}
-	if err := x.DisableMigrate.toC(&xc.disable_migrate); err != nil {
-		return fmt.Errorf("converting field DisableMigrate: %v", err)
-	}
-	if err := x.Cpuid.toC(&xc.cpuid); err != nil {
-		return fmt.Errorf("converting field Cpuid: %v", err)
-	}
-	if x.BlkdevStart != "" {
-		xc.blkdev_start = C.CString(x.BlkdevStart)
-	}
-	if numVnumaNodes := len(x.VnumaNodes); numVnumaNodes > 0 {
-		xc.vnuma_nodes = (*C.libxl_vnode_info)(C.malloc(C.ulong(numVnumaNodes) * C.sizeof_libxl_vnode_info))
-		xc.num_vnuma_nodes = C.int(numVnumaNodes)
-		cVnumaNodes := (*[1 << 28]C.libxl_vnode_info)(unsafe.Pointer(xc.vnuma_nodes))[:numVnumaNodes:numVnumaNodes]
-		for i, v := range x.VnumaNodes {
-			if err := v.toC(&cVnumaNodes[i]); err != nil {
-				return fmt.Errorf("converting field VnumaNodes: %v", err)
-			}
-		}
-	}
-	xc.max_grant_frames = C.uint32_t(x.MaxGrantFrames)
-	xc.max_maptrack_frames = C.uint32_t(x.MaxMaptrackFrames)
-	xc.device_model_version = C.libxl_device_model_version(x.DeviceModelVersion)
-	if err := x.DeviceModelStubdomain.toC(&xc.device_model_stubdomain); err != nil {
-		return fmt.Errorf("converting field DeviceModelStubdomain: %v", err)
-	}
-	xc.stubdomain_memkb = C.uint64_t(x.StubdomainMemkb)
-	if x.StubdomainKernel != "" {
-		xc.stubdomain_kernel = C.CString(x.StubdomainKernel)
-	}
-	if x.StubdomainRamdisk != "" {
-		xc.stubdomain_ramdisk = C.CString(x.StubdomainRamdisk)
-	}
-	if x.DeviceModel != "" {
-		xc.device_model = C.CString(x.DeviceModel)
-	}
-	xc.device_model_ssidref = C.uint32_t(x.DeviceModelSsidref)
-	if x.DeviceModelSsidLabel != "" {
-		xc.device_model_ssid_label = C.CString(x.DeviceModelSsidLabel)
-	}
-	if x.DeviceModelUser != "" {
-		xc.device_model_user = C.CString(x.DeviceModelUser)
-	}
-	if err := x.Extra.toC(&xc.extra); err != nil {
-		return fmt.Errorf("converting field Extra: %v", err)
-	}
-	if err := x.ExtraPv.toC(&xc.extra_pv); err != nil {
-		return fmt.Errorf("converting field ExtraPv: %v", err)
-	}
-	if err := x.ExtraHvm.toC(&xc.extra_hvm); err != nil {
-		return fmt.Errorf("converting field ExtraHvm: %v", err)
-	}
-	if err := x.SchedParams.toC(&xc.sched_params); err != nil {
-		return fmt.Errorf("converting field SchedParams: %v", err)
-	}
-	if numIoports := len(x.Ioports); numIoports > 0 {
-		xc.ioports = (*C.libxl_ioport_range)(C.malloc(C.ulong(numIoports) * C.sizeof_libxl_ioport_range))
-		xc.num_ioports = C.int(numIoports)
-		cIoports := (*[1 << 28]C.libxl_ioport_range)(unsafe.Pointer(xc.ioports))[:numIoports:numIoports]
-		for i, v := range x.Ioports {
-			if err := v.toC(&cIoports[i]); err != nil {
-				return fmt.Errorf("converting field Ioports: %v", err)
-			}
-		}
-	}
-	if numIrqs := len(x.Irqs); numIrqs > 0 {
-		xc.irqs = (*C.uint32_t)(C.malloc(C.size_t(numIrqs * numIrqs)))
-		xc.num_irqs = C.int(numIrqs)
-		cIrqs := (*[1 << 28]C.uint32_t)(unsafe.Pointer(xc.irqs))[:numIrqs:numIrqs]
-		for i, v := range x.Irqs {
-			cIrqs[i] = C.uint32_t(v)
-		}
-	}
-	if numIomem := len(x.Iomem); numIomem > 0 {
-		xc.iomem = (*C.libxl_iomem_range)(C.malloc(C.ulong(numIomem) * C.sizeof_libxl_iomem_range))
-		xc.num_iomem = C.int(numIomem)
-		cIomem := (*[1 << 28]C.libxl_iomem_range)(unsafe.Pointer(xc.iomem))[:numIomem:numIomem]
-		for i, v := range x.Iomem {
-			if err := v.toC(&cIomem[i]); err != nil {
-				return fmt.Errorf("converting field Iomem: %v", err)
-			}
-		}
-	}
-	if err := x.ClaimMode.toC(&xc.claim_mode); err != nil {
-		return fmt.Errorf("converting field ClaimMode: %v", err)
-	}
-	xc.event_channels = C.uint32_t(x.EventChannels)
-	if x.Kernel != "" {
-		xc.kernel = C.CString(x.Kernel)
-	}
-	if x.Cmdline != "" {
-		xc.cmdline = C.CString(x.Cmdline)
-	}
-	if x.Ramdisk != "" {
-		xc.ramdisk = C.CString(x.Ramdisk)
-	}
-	if x.DeviceTree != "" {
-		xc.device_tree = C.CString(x.DeviceTree)
-	}
-	if err := x.Acpi.toC(&xc.acpi); err != nil {
-		return fmt.Errorf("converting field Acpi: %v", err)
-	}
-	if x.Bootloader != "" {
-		xc.bootloader = C.CString(x.Bootloader)
-	}
-	if err := x.BootloaderArgs.toC(&xc.bootloader_args); err != nil {
-		return fmt.Errorf("converting field BootloaderArgs: %v", err)
-	}
-	xc.timer_mode = C.libxl_timer_mode(x.TimerMode)
-	if err := x.NestedHvm.toC(&xc.nested_hvm); err != nil {
-		return fmt.Errorf("converting field NestedHvm: %v", err)
-	}
-	if err := x.Apic.toC(&xc.apic); err != nil {
-		return fmt.Errorf("converting field Apic: %v", err)
-	}
-	if err := x.DmRestrict.toC(&xc.dm_restrict); err != nil {
-		return fmt.Errorf("converting field DmRestrict: %v", err)
-	}
-	xc.tee = C.libxl_tee_type(x.Tee)
-	xc._type = C.libxl_domain_type(x.Type)
-	switch x.Type {
-	case DomainTypeHvm:
-		tmp, ok := x.TypeUnion.(DomainBuildInfoTypeUnionHvm)
-		if !ok {
-			return errors.New("wrong type for union key type")
-		}
-		var hvm C.libxl_domain_build_info_type_union_hvm
-		if tmp.Firmware != "" {
-			hvm.firmware = C.CString(tmp.Firmware)
-		}
-		hvm.bios = C.libxl_bios_type(tmp.Bios)
-		if err := tmp.Pae.toC(&hvm.pae); err != nil {
-			return fmt.Errorf("converting field Pae: %v", err)
-		}
-		if err := tmp.Apic.toC(&hvm.apic); err != nil {
-			return fmt.Errorf("converting field Apic: %v", err)
-		}
-		if err := tmp.Acpi.toC(&hvm.acpi); err != nil {
-			return fmt.Errorf("converting field Acpi: %v", err)
-		}
-		if err := tmp.AcpiS3.toC(&hvm.acpi_s3); err != nil {
-			return fmt.Errorf("converting field AcpiS3: %v", err)
-		}
-		if err := tmp.AcpiS4.toC(&hvm.acpi_s4); err != nil {
-			return fmt.Errorf("converting field AcpiS4: %v", err)
-		}
-		if err := tmp.AcpiLaptopSlate.toC(&hvm.acpi_laptop_slate); err != nil {
-			return fmt.Errorf("converting field AcpiLaptopSlate: %v", err)
-		}
-		if err := tmp.Nx.toC(&hvm.nx); err != nil {
-			return fmt.Errorf("converting field Nx: %v", err)
-		}
-		if err := tmp.Viridian.toC(&hvm.viridian); err != nil {
-			return fmt.Errorf("converting field Viridian: %v", err)
-		}
-		if err := tmp.ViridianEnable.toC(&hvm.viridian_enable); err != nil {
-			return fmt.Errorf("converting field ViridianEnable: %v", err)
-		}
-		if err := tmp.ViridianDisable.toC(&hvm.viridian_disable); err != nil {
-			return fmt.Errorf("converting field ViridianDisable: %v", err)
-		}
-		if tmp.Timeoffset != "" {
-			hvm.timeoffset = C.CString(tmp.Timeoffset)
-		}
-		if err := tmp.Hpet.toC(&hvm.hpet); err != nil {
-			return fmt.Errorf("converting field Hpet: %v", err)
-		}
-		if err := tmp.VptAlign.toC(&hvm.vpt_align); err != nil {
-			return fmt.Errorf("converting field VptAlign: %v", err)
-		}
-		hvm.mmio_hole_memkb = C.uint64_t(tmp.MmioHoleMemkb)
-		hvm.timer_mode = C.libxl_timer_mode(tmp.TimerMode)
-		if err := tmp.NestedHvm.toC(&hvm.nested_hvm); err != nil {
-			return fmt.Errorf("converting field NestedHvm: %v", err)
-		}
-		if err := tmp.Altp2M.toC(&hvm.altp2m); err != nil {
-			return fmt.Errorf("converting field Altp2M: %v", err)
-		}
-		if tmp.SystemFirmware != "" {
-			hvm.system_firmware = C.CString(tmp.SystemFirmware)
-		}
-		if tmp.SmbiosFirmware != "" {
-			hvm.smbios_firmware = C.CString(tmp.SmbiosFirmware)
-		}
-		if tmp.AcpiFirmware != "" {
-			hvm.acpi_firmware = C.CString(tmp.AcpiFirmware)
-		}
-		hvm.hdtype = C.libxl_hdtype(tmp.Hdtype)
-		if err := tmp.Nographic.toC(&hvm.nographic); err != nil {
-			return fmt.Errorf("converting field Nographic: %v", err)
-		}
-		if err := tmp.Vga.toC(&hvm.vga); err != nil {
-			return fmt.Errorf("converting field Vga: %v", err)
-		}
-		if err := tmp.Vnc.toC(&hvm.vnc); err != nil {
-			return fmt.Errorf("converting field Vnc: %v", err)
-		}
-		if tmp.Keymap != "" {
-			hvm.keymap = C.CString(tmp.Keymap)
-		}
-		if err := tmp.Sdl.toC(&hvm.sdl); err != nil {
-			return fmt.Errorf("converting field Sdl: %v", err)
-		}
-		if err := tmp.Spice.toC(&hvm.spice); err != nil {
-			return fmt.Errorf("converting field Spice: %v", err)
-		}
-		if err := tmp.GfxPassthru.toC(&hvm.gfx_passthru); err != nil {
-			return fmt.Errorf("converting field GfxPassthru: %v", err)
-		}
-		hvm.gfx_passthru_kind = C.libxl_gfx_passthru_kind(tmp.GfxPassthruKind)
-		if tmp.Serial != "" {
-			hvm.serial = C.CString(tmp.Serial)
-		}
-		if tmp.Boot != "" {
-			hvm.boot = C.CString(tmp.Boot)
-		}
-		if err := tmp.Usb.toC(&hvm.usb); err != nil {
-			return fmt.Errorf("converting field Usb: %v", err)
-		}
-		hvm.usbversion = C.int(tmp.Usbversion)
-		if tmp.Usbdevice != "" {
-			hvm.usbdevice = C.CString(tmp.Usbdevice)
-		}
-		if err := tmp.VkbDevice.toC(&hvm.vkb_device); err != nil {
-			return fmt.Errorf("converting field VkbDevice: %v", err)
-		}
-		if tmp.Soundhw != "" {
-			hvm.soundhw = C.CString(tmp.Soundhw)
-		}
-		if err := tmp.XenPlatformPci.toC(&hvm.xen_platform_pci); err != nil {
-			return fmt.Errorf("converting field XenPlatformPci: %v", err)
-		}
-		if err := tmp.UsbdeviceList.toC(&hvm.usbdevice_list); err != nil {
-			return fmt.Errorf("converting field UsbdeviceList: %v", err)
-		}
-		hvm.vendor_device = C.libxl_vendor_device(tmp.VendorDevice)
-		if err := tmp.MsVmGenid.toC(&hvm.ms_vm_genid); err != nil {
-			return fmt.Errorf("converting field MsVmGenid: %v", err)
-		}
-		if err := tmp.SerialList.toC(&hvm.serial_list); err != nil {
-			return fmt.Errorf("converting field SerialList: %v", err)
-		}
-		if err := tmp.Rdm.toC(&hvm.rdm); err != nil {
-			return fmt.Errorf("converting field Rdm: %v", err)
-		}
-		hvm.rdm_mem_boundary_memkb = C.uint64_t(tmp.RdmMemBoundaryMemkb)
-		hvm.mca_caps = C.uint64_t(tmp.McaCaps)
-		hvmBytes := C.GoBytes(unsafe.Pointer(&hvm), C.sizeof_libxl_domain_build_info_type_union_hvm)
-		copy(xc.u[:], hvmBytes)
-	case DomainTypePv:
-		tmp, ok := x.TypeUnion.(DomainBuildInfoTypeUnionPv)
-		if !ok {
-			return errors.New("wrong type for union key type")
-		}
-		var pv C.libxl_domain_build_info_type_union_pv
-		if tmp.Kernel != "" {
-			pv.kernel = C.CString(tmp.Kernel)
-		}
-		pv.slack_memkb = C.uint64_t(tmp.SlackMemkb)
-		if tmp.Bootloader != "" {
-			pv.bootloader = C.CString(tmp.Bootloader)
-		}
-		if err := tmp.BootloaderArgs.toC(&pv.bootloader_args); err != nil {
-			return fmt.Errorf("converting field BootloaderArgs: %v", err)
-		}
-		if tmp.Cmdline != "" {
-			pv.cmdline = C.CString(tmp.Cmdline)
-		}
-		if tmp.Ramdisk != "" {
-			pv.ramdisk = C.CString(tmp.Ramdisk)
-		}
-		if tmp.Features != "" {
-			pv.features = C.CString(tmp.Features)
-		}
-		if err := tmp.E820Host.toC(&pv.e820_host); err != nil {
-			return fmt.Errorf("converting field E820Host: %v", err)
-		}
-		pvBytes := C.GoBytes(unsafe.Pointer(&pv), C.sizeof_libxl_domain_build_info_type_union_pv)
-		copy(xc.u[:], pvBytes)
-	case DomainTypePvh:
-		tmp, ok := x.TypeUnion.(DomainBuildInfoTypeUnionPvh)
-		if !ok {
-			return errors.New("wrong type for union key type")
-		}
-		var pvh C.libxl_domain_build_info_type_union_pvh
-		if err := tmp.Pvshim.toC(&pvh.pvshim); err != nil {
-			return fmt.Errorf("converting field Pvshim: %v", err)
-		}
-		if tmp.PvshimPath != "" {
-			pvh.pvshim_path = C.CString(tmp.PvshimPath)
-		}
-		if tmp.PvshimCmdline != "" {
-			pvh.pvshim_cmdline = C.CString(tmp.PvshimCmdline)
-		}
-		if tmp.PvshimExtra != "" {
-			pvh.pvshim_extra = C.CString(tmp.PvshimExtra)
-		}
-		pvhBytes := C.GoBytes(unsafe.Pointer(&pvh), C.sizeof_libxl_domain_build_info_type_union_pvh)
-		copy(xc.u[:], pvhBytes)
-	case DomainTypeInvalid:
-		break
-	default:
-		return fmt.Errorf("invalid union key '%v'", x.Type)
-	}
-	xc.arch_arm.gic_version = C.libxl_gic_version(x.ArchArm.GicVersion)
-	xc.arch_arm.vuart = C.libxl_vuart_type(x.ArchArm.Vuart)
-	xc.altp2m = C.libxl_altp2m_mode(x.Altp2M)
-
-	return nil
+if DomainType(xc._type) != DomainTypePvh {
+return errors.New("expected union key DomainTypePvh")
+}
+
+tmp := (*C.libxl_domain_build_info_type_union_pvh)(unsafe.Pointer(&xc.u[0]))
+if err := x.Pvshim.fromC(&tmp.pvshim);err != nil {
+return fmt.Errorf("converting field Pvshim: %v", err)
+}
+x.PvshimPath = C.GoString(tmp.pvshim_path)
+x.PvshimCmdline = C.GoString(tmp.pvshim_cmdline)
+x.PvshimExtra = C.GoString(tmp.pvshim_extra)
+return nil
+}
+
+func (x *DomainBuildInfo) toC(xc *C.libxl_domain_build_info) (err error){defer func(){
+if err != nil{
+C.libxl_domain_build_info_dispose(xc)}
+}()
+
+xc.max_vcpus = C.int(x.MaxVcpus)
+if err := x.AvailVcpus.toC(&xc.avail_vcpus); err != nil {
+return fmt.Errorf("converting field AvailVcpus: %v", err)
+}
+if err := x.Cpumap.toC(&xc.cpumap); err != nil {
+return fmt.Errorf("converting field Cpumap: %v", err)
+}
+if err := x.Nodemap.toC(&xc.nodemap); err != nil {
+return fmt.Errorf("converting field Nodemap: %v", err)
+}
+if numVcpuHardAffinity := len(x.VcpuHardAffinity); numVcpuHardAffinity > 0 {
+xc.vcpu_hard_affinity = (*C.libxl_bitmap)(C.malloc(C.ulong(numVcpuHardAffinity)*C.sizeof_libxl_bitmap))
+xc.num_vcpu_hard_affinity = C.int(numVcpuHardAffinity)
+cVcpuHardAffinity := (*[1<<28]C.libxl_bitmap)(unsafe.Pointer(xc.vcpu_hard_affinity))[:numVcpuHardAffinity:numVcpuHardAffinity]
+for i,v := range x.VcpuHardAffinity {
+if err := v.toC(&cVcpuHardAffinity[i]); err != nil {
+return fmt.Errorf("converting field VcpuHardAffinity: %v", err)
+}
+}
+}
+if numVcpuSoftAffinity := len(x.VcpuSoftAffinity); numVcpuSoftAffinity > 0 {
+xc.vcpu_soft_affinity = (*C.libxl_bitmap)(C.malloc(C.ulong(numVcpuSoftAffinity)*C.sizeof_libxl_bitmap))
+xc.num_vcpu_soft_affinity = C.int(numVcpuSoftAffinity)
+cVcpuSoftAffinity := (*[1<<28]C.libxl_bitmap)(unsafe.Pointer(xc.vcpu_soft_affinity))[:numVcpuSoftAffinity:numVcpuSoftAffinity]
+for i,v := range x.VcpuSoftAffinity {
+if err := v.toC(&cVcpuSoftAffinity[i]); err != nil {
+return fmt.Errorf("converting field VcpuSoftAffinity: %v", err)
 }
+}
+}
+if err := x.NumaPlacement.toC(&xc.numa_placement); err != nil {
+return fmt.Errorf("converting field NumaPlacement: %v", err)
+}
+xc.tsc_mode = C.libxl_tsc_mode(x.TscMode)


From xen-changelog-bounces@lists.xenproject.org Tue Jun 09 19:45:04 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Jun 2020 19:45:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jikBE-0004Hv-EF; Tue, 09 Jun 2020 19:45: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=1bQd=7W=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jikBD-0004Ho-Mg
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 19:45:03 +0000
X-Inumbo-ID: b62e6d06-aa89-11ea-b366-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id b62e6d06-aa89-11ea-b366-12813bfff9fa;
 Tue, 09 Jun 2020 19:45:03 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=ilNEhf3sL4ZNABxRXy8oEp7P+/0qfkxRV/jPUAOuChk=; b=mD5YFmaiNe2JXaBT/ZWvLCGLW9
 pxZyUk7wFI8DEG7xRs8TVgq1iLXqHnppb8N1tANxc3e/DalW7ZzdWl73dpdpO+ObNZDNpK1/s2/pD
 DzjYQjXuaF5qzwLX7lrdavGLnvpmDXWIASFMEJaDwc1ijy+FhiamD2Rg+NTp0CGNMkPA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jikBD-0007gX-4R
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 19:45:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jikBD-0004BA-3d
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 19:45:03 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] xen/arm: mm: Access a PT entry before the table is
 unmapped
Message-Id: <E1jikBD-0004BA-3d@xenbits.xenproject.org>
Date: Tue, 09 Jun 2020 19:45: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 63b4c9bfb788ebfd35d0172f7e8e2e41ef948f70
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Sun Jun 7 16:51:54 2020 +0100
Commit:     Stefano Stabellini <sstabellini@kernel.org>
CommitDate: Mon Jun 8 10:33:28 2020 -0700

    xen/arm: mm: Access a PT entry before the table is unmapped
    
    xen_pt_next_level() will retrieve the MFN from the entry right after the
    page-table has been unmapped.
    
    After calling xen_unmap_table(), there is no guarantee the mapping will
    still be valid. Depending on the implementation, this may result to a
    data abort in Xen.
    
    Re-order the code to retrieve the MFN before the table is unmapped.
    
    Fixes: 53abb9a1dcd9 ("xen/arm: mm: Rework Xen page-tables walk during update")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/arch/arm/mm.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 1b14f49345..9e2ff7c800 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -1036,6 +1036,7 @@ static int xen_pt_next_level(bool read_only, unsigned int level,
 {
     lpae_t *entry;
     int ret;
+    mfn_t mfn;
 
     entry = *table + offset;
 
@@ -1053,8 +1054,10 @@ static int xen_pt_next_level(bool read_only, unsigned int level,
     if ( lpae_is_mapping(*entry, level) )
         return XEN_TABLE_SUPER_PAGE;
 
+    mfn = lpae_get_mfn(*entry);
+
     xen_unmap_table(*table);
-    *table = xen_map_table(lpae_get_mfn(*entry));
+    *table = xen_map_table(mfn);
 
     return XEN_TABLE_NORMAL_PAGE;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jun 09 19:45:16 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Jun 2020 19:45:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jikBQ-0004Ji-G0; Tue, 09 Jun 2020 19:45: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=1bQd=7W=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jikBP-0004JZ-8R
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 19:45:15 +0000
X-Inumbo-ID: bc339000-aa89-11ea-b366-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id bc339000-aa89-11ea-b366-12813bfff9fa;
 Tue, 09 Jun 2020 19:45:13 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=uAascPU/0DUAaY/Ucmj1xktLRHow+niTC7X0eEcIVVA=; b=l4o8V+u0LPvGihtw29ir6Xy6t8
 h6scyn2AslW2N5hnyjD1OdSVbYM9pfGs6WgoWsP8L7sYqt4wdxME9rdq8CUDrdHAdJDmpjc6mEkOf
 22kkLxEgHfHcJ/7mfyF84/YmhJz7zV3QmxA9sKCPM+YbIXbgF9m/eHlGdDx7eRe0EIvA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jikBN-0007gf-7j
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 19:45:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jikBN-0004C1-6o
 for xen-changelog@lists.xenproject.org; Tue, 09 Jun 2020 19:45:13 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/rtc: provide mediated access to RTC for PVH dom0
Message-Id: <E1jikBN-0004C1-6o@xenbits.xenproject.org>
Date: Tue, 09 Jun 2020 19:45: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 835d8d69d96aa7feb52ef7b3dd8ecf43f0807578
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Jun 8 18:13:53 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Jun 8 18:40:05 2020 +0100

    x86/rtc: provide mediated access to RTC for PVH dom0
    
    Mediated access to the RTC was provided for PVHv1 dom0 using the PV
    code paths (guest_io_{write/read}), but those accesses where never
    implemented for PVHv2 dom0. This patch provides such mediated accesses
    to the RTC for PVH dom0, just like it's provided for a classic PV
    dom0.
    
    Pull out some of the RTC logic from guest_io_{read/write} into
    specific helpers that can be used by both PV and HVM guests. The
    setup of the handlers for PVH is done in rtc_init, which is already
    used to initialize the fully emulated RTC.
    
    Without this a Linux PVH dom0 will read garbage when trying to access
    the RTC, and one vCPU will be constantly looping in
    rtc_timer_do_work.
    
    Note that such issue doesn't happen on domUs because the ACPI
    NO_CMOS_RTC flag is set in FADT, which prevents the OS from accessing
    the RTC. Also the X86_EMU_RTC flag is not set for PVH dom0, as the
    accesses are not emulated but rather forwarded to the physical
    hardware.
    
    No functional change expected for classic PV dom0.
    
    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/arch/x86/hvm/rtc.c            | 26 ++++++++++++++++
 xen/arch/x86/pv/emul-priv-op.c    | 30 +++---------------
 xen/arch/x86/time.c               | 65 +++++++++++++++++++++++++++++++++++++++
 xen/include/asm-x86/mc146818rtc.h |  3 ++
 4 files changed, 98 insertions(+), 26 deletions(-)

diff --git a/xen/arch/x86/hvm/rtc.c b/xen/arch/x86/hvm/rtc.c
index 5bbbdc0e0f..3150f5f147 100644
--- a/xen/arch/x86/hvm/rtc.c
+++ b/xen/arch/x86/hvm/rtc.c
@@ -808,12 +808,38 @@ void rtc_reset(struct domain *d)
     s->pt.source = PTSRC_isa;
 }
 
+/* RTC mediator for HVM hardware domain. */
+static int hw_rtc_io(int dir, unsigned int port, unsigned int size,
+                     uint32_t *val)
+{
+    if ( dir == IOREQ_READ )
+        *val = ~0;
+
+    if ( size != 1 )
+    {
+        gdprintk(XENLOG_WARNING, "bad RTC access size (%u)\n", size);
+        return X86EMUL_OKAY;
+    }
+
+    if ( dir == IOREQ_WRITE )
+        rtc_guest_write(port, *val);
+    else
+        *val = rtc_guest_read(port);
+
+    return X86EMUL_OKAY;
+}
+
 void rtc_init(struct domain *d)
 {
     RTCState *s = domain_vrtc(d);
 
     if ( !has_vrtc(d) )
+    {
+        if ( is_hardware_domain(d) )
+            /* Hardware domain gets mediated access to the physical RTC. */
+            register_portio_handler(d, RTC_PORT(0), 2, hw_rtc_io);
         return;
+    }
 
     spin_lock_init(&s->lock);
 
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index fad6c754ad..254da2b849 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -280,19 +280,9 @@ static uint32_t guest_io_read(unsigned int port, unsigned int bytes,
         {
             sub_data = pv_pit_handler(port, 0, 0);
         }
-        else if ( port == RTC_PORT(0) )
+        else if ( port == RTC_PORT(0) || port == RTC_PORT(1) )
         {
-            sub_data = currd->arch.cmos_idx;
-        }
-        else if ( (port == RTC_PORT(1)) &&
-                  ioports_access_permitted(currd, RTC_PORT(0), RTC_PORT(1)) )
-        {
-            unsigned long flags;
-
-            spin_lock_irqsave(&rtc_lock, flags);
-            outb(currd->arch.cmos_idx & 0x7f, RTC_PORT(0));
-            sub_data = inb(RTC_PORT(1));
-            spin_unlock_irqrestore(&rtc_lock, flags);
+            sub_data = rtc_guest_read(port);
         }
         else if ( (port == 0xcf8) && (bytes == 4) )
         {
@@ -413,21 +403,9 @@ static void guest_io_write(unsigned int port, unsigned int bytes,
         {
             pv_pit_handler(port, (uint8_t)data, 1);
         }
-        else if ( port == RTC_PORT(0) )
-        {
-            currd->arch.cmos_idx = data;
-        }
-        else if ( (port == RTC_PORT(1)) &&
-                  ioports_access_permitted(currd, RTC_PORT(0), RTC_PORT(1)) )
+        else if ( port == RTC_PORT(0) || port == RTC_PORT(1) )
         {
-            unsigned long flags;
-
-            if ( pv_rtc_handler )
-                pv_rtc_handler(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));
-            spin_unlock_irqrestore(&rtc_lock, flags);
+            rtc_guest_write(port, data);
         }
         else if ( (port == 0xcf8) && (bytes == 4) )
         {
diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index bbaea3aa65..d643590c0a 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -27,6 +27,7 @@
 #include <xen/keyhandler.h>
 #include <xen/guest_access.h>
 #include <asm/io.h>
+#include <asm/iocap.h>
 #include <asm/msr.h>
 #include <asm/mpspec.h>
 #include <asm/processor.h>
@@ -1110,6 +1111,70 @@ static unsigned long get_cmos_time(void)
     return mktime(rtc.year, rtc.mon, rtc.day, rtc.hour, rtc.min, rtc.sec);
 }
 
+/* Helpers for guest accesses to the physical RTC. */
+unsigned int rtc_guest_read(unsigned int port)
+{
+    const struct domain *currd = current->domain;
+    unsigned long flags;
+    unsigned int data = ~0;
+
+    switch ( port )
+    {
+    case RTC_PORT(0):
+        /*
+         * All PV domains (and PVH dom0) are allowed to read the latched value
+         * of the first RTC port, as there's no access to the physical IO
+         * ports.
+         */
+        data = currd->arch.cmos_idx;
+        break;
+
+    case RTC_PORT(1):
+        if ( !ioports_access_permitted(currd, RTC_PORT(0), RTC_PORT(1)) )
+            break;
+        spin_lock_irqsave(&rtc_lock, flags);
+        outb(currd->arch.cmos_idx & 0x7f, RTC_PORT(0));
+        data = inb(RTC_PORT(1));
+        spin_unlock_irqrestore(&rtc_lock, flags);
+        break;
+
+    default:
+        ASSERT_UNREACHABLE();
+    }
+
+    return data;
+}
+
+void rtc_guest_write(unsigned int port, unsigned int data)
+{
+    struct domain *currd = current->domain;
+    unsigned long flags;
+
+    switch ( port )
+    {
+    case RTC_PORT(0):
+        /*
+         * All PV domains (and PVH dom0) are allowed to write to the latched
+         * value of the first RTC port, as there's no access to the physical IO
+         * ports.
+         */
+        currd->arch.cmos_idx = data;
+        break;
+
+    case RTC_PORT(1):
+        if ( !ioports_access_permitted(currd, RTC_PORT(0), RTC_PORT(1)) )
+            break;
+        spin_lock_irqsave(&rtc_lock, flags);
+        outb(currd->arch.cmos_idx & 0x7f, RTC_PORT(0));
+        outb(data, RTC_PORT(1));
+        spin_unlock_irqrestore(&rtc_lock, flags);
+        break;
+
+    default:
+        ASSERT_UNREACHABLE();
+    }
+}
+
 static unsigned long get_wallclock_time(void)
 {
 #ifdef CONFIG_XEN_GUEST
diff --git a/xen/include/asm-x86/mc146818rtc.h b/xen/include/asm-x86/mc146818rtc.h
index 8758528f7c..803b236c0a 100644
--- a/xen/include/asm-x86/mc146818rtc.h
+++ b/xen/include/asm-x86/mc146818rtc.h
@@ -110,4 +110,7 @@ outb_p((val),RTC_PORT(1)); \
 
 #define RTC_IRQ 8
 
+unsigned int rtc_guest_read(unsigned int port);
+void rtc_guest_write(unsigned int port, unsigned int data);
+
 #endif /* _ASM_MC146818RTC_H */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jun 10 05:33:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Jun 2020 05: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 1jitMG-0008Ij-Ta; Wed, 10 Jun 2020 05: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=/Mc5=7X=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jitMF-0008Id-Hh
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 05:33:03 +0000
X-Inumbo-ID: d9ed2a50-aadb-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id d9ed2a50-aadb-11ea-8496-bc764e2007e4;
 Wed, 10 Jun 2020 05: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=s0fV6q6+/lEoQlJ86wrmB0Jiy9Eb2sWndOKEA2PzCOQ=; b=at/bYwe/9Zkktvd1l8Q9yC5BZ+
 01Ye7NAWYqA996KIQtdLq7/aZLBwWl7k926kuLOM/hqoF5qiNmaR0N/lEWT7SlidR3x8O8u6/Dzf2
 uBldWhnJgQqt9Agb+m9mcoeB0C3fi+V6nAID7QnOpPCEjcEWvkFS8IW+aR/6uayEybNE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jitMD-0006sF-Qn
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 05:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jitMD-0005h3-Pm
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 05:33:01 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] x86/spec-ctrl: CPUID/MSR definitions for Special
 Register Buffer Data Sampling
Message-Id: <E1jitMD-0005h3-Pm@xenbits.xenproject.org>
Date: Wed, 10 Jun 2020 05: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 9aefa01f458960fe9e2ccbdc79f8d9fba3d06611
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 8 19:47:46 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jun 9 17:44:54 2020 +0100

    x86/spec-ctrl: CPUID/MSR definitions for Special Register Buffer Data Sampling
    
    This is part of XSA-320 / CVE-2020-0543
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Wei Liu <wl@xen.org>
    (cherry picked from commit caab85ab58c0cdf74ab070a5de5c4df89f509ff3)
---
 docs/misc/xen-command-line.pandoc           | 8 ++++----
 tools/libxl/libxl_cpuid.c                   | 1 +
 tools/misc/xen-cpuid.c                      | 1 +
 xen/arch/x86/msr.c                          | 2 ++
 xen/arch/x86/spec_ctrl.c                    | 3 ++-
 xen/include/asm-x86/msr-index.h             | 3 +++
 xen/include/public/arch-x86/cpufeatureset.h | 1 +
 7 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 1d9d816622..9268454297 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -483,10 +483,10 @@ accounting for hardware capabilities as enumerated via CPUID.
 
 Currently accepted:
 
-The Speculation Control hardware features `md-clear`, `ibrsb`, `stibp`, `ibpb`,
-`l1d-flush` and `ssbd` are used by default if available and applicable.  They can
-be ignored, e.g. `no-ibrsb`, at which point Xen won't use them itself, and
-won't offer them to guests.
+The Speculation Control hardware features `srbds-ctrl`, `md-clear`, `ibrsb`,
+`stibp`, `ibpb`, `l1d-flush` and `ssbd` are used by default if available and
+applicable.  They can be ignored, e.g. `no-ibrsb`, at which point Xen won't
+use them itself, and won't offer them to guests.
 
 ### cpuid_mask_cpu
 > `= fam_0f_rev_[cdefg] | fam_10_rev_[bc] | fam_11_rev_b`
diff --git a/tools/libxl/libxl_cpuid.c b/tools/libxl/libxl_cpuid.c
index 6cea4227ba..a78f08b927 100644
--- a/tools/libxl/libxl_cpuid.c
+++ b/tools/libxl/libxl_cpuid.c
@@ -213,6 +213,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},
+        {"srbds-ctrl",   0x00000007,  0, CPUID_REG_EDX,  9,  1},
         {"md-clear",     0x00000007,  0, CPUID_REG_EDX, 10,  1},
         {"cet-ibt",      0x00000007,  0, CPUID_REG_EDX, 20,  1},
         {"ibrsb",        0x00000007,  0, CPUID_REG_EDX, 26,  1},
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index 603e1d65fd..a09440813b 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -157,6 +157,7 @@ static const char *const str_7d0[32] =
     [ 2] = "avx512_4vnniw", [ 3] = "avx512_4fmaps",
     [ 4] = "fsrm",
 
+    /*  8 */                [ 9] = "srbds-ctrl",
     [10] = "md-clear",
     /* 12 */                [13] = "tsx-force-abort",
 
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 4b12103482..0cded3c0ad 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -134,6 +134,7 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
         /* Write-only */
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
+    case MSR_MCU_OPT_CTRL:
     case MSR_U_CET:
     case MSR_S_CET:
     case MSR_PL0_SSP ... MSR_INTERRUPT_SSP_TABLE:
@@ -288,6 +289,7 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
         /* Read-only */
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
+    case MSR_MCU_OPT_CTRL:
     case MSR_U_CET:
     case MSR_S_CET:
     case MSR_PL0_SSP ... MSR_INTERRUPT_SSP_TABLE:
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index 6656c44aec..5fc1c6827e 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -312,12 +312,13 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
     printk("Speculative mitigation facilities:\n");
 
     /* Hardware features which pertain to speculative mitigations. */
-    printk("  Hardware features:%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
+    printk("  Hardware features:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
            (_7d0 & cpufeat_mask(X86_FEATURE_IBRSB)) ? " IBRS/IBPB" : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_STIBP)) ? " STIBP"     : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_L1D_FLUSH)) ? " L1D_FLUSH" : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_SSBD))  ? " SSBD"      : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_MD_CLEAR)) ? " MD_CLEAR" : "",
+           (_7d0 & cpufeat_mask(X86_FEATURE_SRBDS_CTRL)) ? " SRBDS_CTRL" : "",
            (e8b  & cpufeat_mask(X86_FEATURE_IBPB))  ? " IBPB"      : "",
            (caps & ARCH_CAPS_IBRS_ALL)              ? " IBRS_ALL"  : "",
            (caps & ARCH_CAPS_RDCL_NO)               ? " RDCL_NO"   : "",
diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h
index 7693c4a71a..91994669e1 100644
--- a/xen/include/asm-x86/msr-index.h
+++ b/xen/include/asm-x86/msr-index.h
@@ -179,6 +179,9 @@
 #define MSR_IA32_VMX_TRUE_ENTRY_CTLS            0x490
 #define MSR_IA32_VMX_VMFUNC                     0x491
 
+#define MSR_MCU_OPT_CTRL                    0x00000123
+#define  MCU_OPT_CTRL_RNGDS_MITG_DIS        (_AC(1, ULL) <<  0)
+
 #define MSR_U_CET                           0x000006a0
 #define MSR_S_CET                           0x000006a2
 #define MSR_PL0_SSP                         0x000006a4
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 2835688f1c..a2482c3627 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -252,6 +252,7 @@ XEN_CPUFEATURE(IBPB,          8*32+12) /*A  IBPB support only (no IBRS, used by
 /* 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(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 */
 XEN_CPUFEATURE(CET_IBT,       9*32+20) /*   CET - Indirect Branch Tracking */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Jun 10 05:33:13 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Jun 2020 05:33:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jitMP-0008KK-VC; Wed, 10 Jun 2020 05:33:13 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=/Mc5=7X=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jitMO-0008KD-Ug
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 05:33:12 +0000
X-Inumbo-ID: dffd0960-aadb-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id dffd0960-aadb-11ea-b7bb-bc764e2007e4;
 Wed, 10 Jun 2020 05: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=i7eAn6/VcUl1qSefJw7IIJmaa6JV87l4TccezRS4CmA=; b=eR4vWnzN0t7HfjWF0L+076ULkM
 EJg9NdzyZuae748MGQZQT0kau2BnDzQNuFnNj6sJy3qLyz6SJ+DYEV0jnWH1NmeNzyf8CMC1E26Na
 AwbW1E05SxAzd8TM8OI/xYGJVQZvgDR6Ne4RHkLxrgLyKc/J1S2rDHpPq6101tk2zIjQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jitMN-0006sO-UP
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 05:33:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jitMN-0005hZ-TT
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 05:33:11 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] x86/spec-ctrl: Mitigate the Special Register Buffer
 Data Sampling sidechannel
Message-Id: <E1jitMN-0005hZ-TT@xenbits.xenproject.org>
Date: Wed, 10 Jun 2020 05: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 67958a166f6b019e5ad8dcd60a96dcd262669092
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 8 19:47:46 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jun 9 17:45:02 2020 +0100

    x86/spec-ctrl: Mitigate the Special Register Buffer Data Sampling sidechannel
    
    See patch documentation and comments.
    
    This is part of XSA-320 / CVE-2020-0543
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 6a49b9a7920c82015381740905582b666160d955)
---
 docs/misc/xen-command-line.pandoc |  8 +++++++-
 xen/arch/x86/acpi/power.c         |  3 +++
 xen/arch/x86/smpboot.c            |  8 +++++---
 xen/arch/x86/spec_ctrl.c          | 41 ++++++++++++++++++++++++++++++++++++++-
 xen/include/asm-x86/spec_ctrl.h   |  2 ++
 5 files changed, 57 insertions(+), 5 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 9268454297..c780312531 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -1991,7 +1991,7 @@ By default SSBD will be mitigated at runtime (i.e `ssbd=runtime`).
 ### spec-ctrl (x86)
 > `= List of [ <bool>, xen=<bool>, {pv,hvm,msr-sc,rsb,md-clear}=<bool>,
 >              bti-thunk=retpoline|lfence|jmp, {ibrs,ibpb,ssbd,eager-fpu,
->              l1d-flush,branch-harden}=<bool> ]`
+>              l1d-flush,branch-harden,srb-lock}=<bool> ]`
 
 Controls for speculative execution sidechannel mitigations.  By default, Xen
 will pick the most appropriate mitigations based on compiled in support,
@@ -2068,6 +2068,12 @@ If Xen is compiled with `CONFIG_SPECULATIVE_HARDEN_BRANCH`, the
 speculation barriers to protect selected conditional branches.  By default,
 Xen will enable this mitigation.
 
+On hardware supporting SRBDS_CTRL, the `srb-lock=` option can be used to force
+or prevent Xen from protect the Special Register Buffer from leaking stale
+data. By default, Xen will enable this mitigation, except on parts where MDS
+is fixed and TAA is fixed/mitigated (in which case, there is believed to be no
+way for an attacker to obtain the stale data).
+
 ### sync_console
 > `= <boolean>`
 
diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
index feb0f6ce20..75c6e34164 100644
--- a/xen/arch/x86/acpi/power.c
+++ b/xen/arch/x86/acpi/power.c
@@ -295,6 +295,9 @@ static int enter_state(u32 state)
     ci->spec_ctrl_flags |= (default_spec_ctrl_flags & SCF_ist_wrmsr);
     spec_ctrl_exit_idle(ci);
 
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+        wrmsrl(MSR_MCU_OPT_CTRL, default_xen_mcu_opt_ctrl);
+
  done:
     spin_debug_enable();
     local_irq_restore(flags);
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index dc8fdac1a1..b1e51b3aff 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -361,12 +361,14 @@ void start_secondary(void *unused)
     microcode_update_one(false);
 
     /*
-     * If MSR_SPEC_CTRL is available, apply Xen's default setting and discard
-     * any firmware settings.  Note: MSR_SPEC_CTRL may only become available
-     * after loading microcode.
+     * If any speculative control MSRs are available, apply Xen's default
+     * settings.  Note: These MSRs may only become available after loading
+     * microcode.
      */
     if ( boot_cpu_has(X86_FEATURE_IBRSB) )
         wrmsrl(MSR_SPEC_CTRL, default_xen_spec_ctrl);
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+        wrmsrl(MSR_MCU_OPT_CTRL, default_xen_mcu_opt_ctrl);
 
     tsx_init(); /* Needs microcode.  May change HLE/RTM feature bits. */
 
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index 5fc1c6827e..33343062a7 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -65,6 +65,9 @@ static unsigned int __initdata l1d_maxphysaddr;
 static bool __initdata cpu_has_bug_msbds_only; /* => minimal HT impact. */
 static bool __initdata cpu_has_bug_mds; /* Any other M{LP,SB,FB}DS combination. */
 
+static int8_t __initdata opt_srb_lock = -1;
+uint64_t __read_mostly default_xen_mcu_opt_ctrl;
+
 static int __init parse_spec_ctrl(const char *s)
 {
     const char *ss;
@@ -112,6 +115,7 @@ static int __init parse_spec_ctrl(const char *s)
             opt_ssbd = false;
             opt_l1d_flush = 0;
             opt_branch_harden = false;
+            opt_srb_lock = 0;
         }
         else if ( val > 0 )
             rc = -EINVAL;
@@ -178,6 +182,8 @@ static int __init parse_spec_ctrl(const char *s)
             opt_l1d_flush = val;
         else if ( (val = parse_boolean("branch-harden", s, ss)) >= 0 )
             opt_branch_harden = val;
+        else if ( (val = parse_boolean("srb-lock", s, ss)) >= 0 )
+            opt_srb_lock = val;
         else
             rc = -EINVAL;
 
@@ -341,7 +347,7 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
                "\n");
 
     /* Settings for Xen's protection, irrespective of guests. */
-    printk("  Xen settings: BTI-Thunk %s, SPEC_CTRL: %s%s%s, Other:%s%s%s%s\n",
+    printk("  Xen settings: BTI-Thunk %s, SPEC_CTRL: %s%s%s, Other:%s%s%s%s%s\n",
            thunk == THUNK_NONE      ? "N/A" :
            thunk == THUNK_RETPOLINE ? "RETPOLINE" :
            thunk == THUNK_LFENCE    ? "LFENCE" :
@@ -352,6 +358,8 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
            (default_xen_spec_ctrl & SPEC_CTRL_SSBD)  ? " SSBD+" : " SSBD-",
            !(caps & ARCH_CAPS_TSX_CTRL)              ? "" :
            (opt_tsx & 1)                             ? " TSX+" : " TSX-",
+           !boot_cpu_has(X86_FEATURE_SRBDS_CTRL)     ? "" :
+           opt_srb_lock                              ? " SRB_LOCK+" : " SRB_LOCK-",
            opt_ibpb                                  ? " IBPB"  : "",
            opt_l1d_flush                             ? " L1D_FLUSH" : "",
            opt_md_clear_pv || opt_md_clear_hvm       ? " VERW"  : "",
@@ -1149,6 +1157,34 @@ void __init init_speculation_mitigations(void)
         tsx_init();
     }
 
+    /* Calculate suitable defaults for MSR_MCU_OPT_CTRL */
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+    {
+        uint64_t val;
+
+        rdmsrl(MSR_MCU_OPT_CTRL, val);
+
+        /*
+         * On some SRBDS-affected hardware, it may be safe to relax srb-lock
+         * by default.
+         *
+         * On parts which enumerate MDS_NO and not TAA_NO, TSX is the only way
+         * to access the Fill Buffer.  If TSX isn't available (inc. SKU
+         * reasons on some models), or TSX is explicitly disabled, then there
+         * is no need for the extra overhead to protect RDRAND/RDSEED.
+         */
+        if ( opt_srb_lock == -1 &&
+             (caps & (ARCH_CAPS_MDS_NO|ARCH_CAPS_TAA_NO)) == ARCH_CAPS_MDS_NO &&
+             (!cpu_has_hle || ((caps & ARCH_CAPS_TSX_CTRL) && opt_tsx == 0)) )
+            opt_srb_lock = 0;
+
+        val &= ~MCU_OPT_CTRL_RNGDS_MITG_DIS;
+        if ( !opt_srb_lock )
+            val |= MCU_OPT_CTRL_RNGDS_MITG_DIS;
+
+        default_xen_mcu_opt_ctrl = val;
+    }
+
     print_details(thunk, caps);
 
     /*
@@ -1180,6 +1216,9 @@ void __init init_speculation_mitigations(void)
 
         wrmsrl(MSR_SPEC_CTRL, bsp_delay_spec_ctrl ? 0 : default_xen_spec_ctrl);
     }
+
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+        wrmsrl(MSR_MCU_OPT_CTRL, default_xen_mcu_opt_ctrl);
 }
 
 static void __init __maybe_unused build_assertions(void)
diff --git a/xen/include/asm-x86/spec_ctrl.h b/xen/include/asm-x86/spec_ctrl.h
index 9caecddfec..b252bb8631 100644
--- a/xen/include/asm-x86/spec_ctrl.h
+++ b/xen/include/asm-x86/spec_ctrl.h
@@ -54,6 +54,8 @@ extern int8_t opt_pv_l1tf_hwdom, opt_pv_l1tf_domu;
  */
 extern paddr_t l1tf_addr_mask, l1tf_safe_maddr;
 
+extern uint64_t default_xen_mcu_opt_ctrl;
+
 static inline void init_shadow_spec_ctrl_state(void)
 {
     struct cpu_info *info = get_cpu_info();
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Jun 10 11:22:12 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Jun 2020 11: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 1jiyo2-0005Ep-Ke; Wed, 10 Jun 2020 11: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=/Mc5=7X=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jiyo1-0005Ek-G7
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 11:22:05 +0000
X-Inumbo-ID: 9cd6571e-ab0c-11ea-b412-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 9cd6571e-ab0c-11ea-b412-12813bfff9fa;
 Wed, 10 Jun 2020 11: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=16DzJDoiALeZ3LUk0E/ULvKeB0UnPWtSSTjAJXDp+zU=; b=wFgeaQ5YJ7h6X8ReDJ0uBpsQO8
 8LoKf2cSKZv0ZZ5hjNb/ExazZGezvVFpAwfqGOwB+ts30uVR1QIBCVMd4GWqc4GvoTsbla5jqKlvS
 K1NHaABcf9WB2+W8vEziRNTgYRiYJWcGK5K/8Y896+Hor6P/dN3XZTs3eD0P+AHYyicE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jiyo0-0005T1-LY
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 11:22:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jiyo0-0001jH-JP
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 11:22:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.11] tools/xentop : replace use of deprecated vwprintw
Message-Id: <E1jiyo0-0001jH-JP@xenbits.xenproject.org>
Date: Wed, 10 Jun 2020 11: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 9be79927a6395f12c9e24afaccf6acbaf81d402e
Author:     Christopher Clark <christopher.w.clark@gmail.com>
AuthorDate: Wed Jul 18 15:22:17 2018 -0700
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Wed Jun 10 11:34:11 2020 +0100

    tools/xentop : replace use of deprecated vwprintw
    
    gcc-8.1 complains:
    
    | xentop.c: In function 'print':
    | xentop.c:304:4: error: 'vwprintw' is deprecated [-Werror=deprecated-declarations]
    |     vwprintw(stdscr, (curses_str_t)fmt, args);
    |     ^~~~~~~~
    
    vw_printw (note the underscore) is a non-deprecated alternative.
    
    Signed-off-by: Christopher Clark <christopher.clark6@baesystems.com>
    Acked-by: Wei Liu <wei.liu2@citrix.com>
    (cherry picked from commit 2b50cdbc444c637575580dcfa6c9525a84d5cc62)
---
 tools/xenstat/xentop/xentop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/xenstat/xentop/xentop.c b/tools/xenstat/xentop/xentop.c
index 2fd2b6742e..c46581062b 100644
--- a/tools/xenstat/xentop/xentop.c
+++ b/tools/xenstat/xentop/xentop.c
@@ -301,7 +301,7 @@ static void print(const char *fmt, ...)
 	if (!batch) {
 		if((current_row() < lines()-1)) {
 			va_start(args, fmt);
-			vwprintw(stdscr, (curses_str_t)fmt, args);
+			vw_printw(stdscr, (curses_str_t)fmt, args);
 			va_end(args);
 		}
 	} else {
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.11


From xen-changelog-bounces@lists.xenproject.org Wed Jun 10 11:44:08 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Jun 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 1jiz9K-0007As-QP; Wed, 10 Jun 2020 11:44: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=/Mc5=7X=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jiz9J-0007Am-MM
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 11:44:05 +0000
X-Inumbo-ID: afa4ffc8-ab0f-11ea-b41d-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id afa4ffc8-ab0f-11ea-b41d-12813bfff9fa;
 Wed, 10 Jun 2020 11: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=p3x29/ucwu0zaZYKpbhNCflyALrSixzhO7vu9GfNhs8=; b=PwH+X+sSuxACTDp8daiz8hhHhu
 cAd0jeD8dYcBWJXMjw95aptqHhlAD72zXB4clje3UhamaTpeOHlqaNvIbJt0LTFaiTh+ji0jenNw9
 w+eSmxYiIjbBlQ8ecRpiXGs59Qh4RMyy4KSH3qKpuY7JktP0YpZSFp9C2ASW1APe8e0Q=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jiz9I-0005tD-Mz
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 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 1jiz9I-0003HJ-Lr
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 11:44:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.10] tools/xentop : replace use of deprecated vwprintw
Message-Id: <E1jiz9I-0003HJ-Lr@xenbits.xenproject.org>
Date: Wed, 10 Jun 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 e20bb5818174e9d09389776cb14781b9c6436554
Author:     Christopher Clark <christopher.w.clark@gmail.com>
AuthorDate: Wed Jul 18 15:22:17 2018 -0700
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Wed Jun 10 11:34:31 2020 +0100

    tools/xentop : replace use of deprecated vwprintw
    
    gcc-8.1 complains:
    
    | xentop.c: In function 'print':
    | xentop.c:304:4: error: 'vwprintw' is deprecated [-Werror=deprecated-declarations]
    |     vwprintw(stdscr, (curses_str_t)fmt, args);
    |     ^~~~~~~~
    
    vw_printw (note the underscore) is a non-deprecated alternative.
    
    Signed-off-by: Christopher Clark <christopher.clark6@baesystems.com>
    Acked-by: Wei Liu <wei.liu2@citrix.com>
    (cherry picked from commit 2b50cdbc444c637575580dcfa6c9525a84d5cc62)
---
 tools/xenstat/xentop/xentop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/xenstat/xentop/xentop.c b/tools/xenstat/xentop/xentop.c
index 2fd2b6742e..c46581062b 100644
--- a/tools/xenstat/xentop/xentop.c
+++ b/tools/xenstat/xentop/xentop.c
@@ -301,7 +301,7 @@ static void print(const char *fmt, ...)
 	if (!batch) {
 		if((current_row() < lines()-1)) {
 			va_start(args, fmt);
-			vwprintw(stdscr, (curses_str_t)fmt, args);
+			vw_printw(stdscr, (curses_str_t)fmt, args);
 			va_end(args);
 		}
 	} else {
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.10


From xen-changelog-bounces@lists.xenproject.org Wed Jun 10 11:44:16 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Jun 2020 11:44:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jiz9U-0007Bd-Rs; Wed, 10 Jun 2020 11:44:16 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=/Mc5=7X=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jiz9T-0007BU-DB
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 11:44:15 +0000
X-Inumbo-ID: b5a715a0-ab0f-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id b5a715a0-ab0f-11ea-b7bb-bc764e2007e4;
 Wed, 10 Jun 2020 11:44: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=wMS+KrhxWC/9FOMREZ9HKfVikH+1bGhRp38LwmVL1CA=; b=nu5z4pbGJRYbScb3YVh6FBkCPi
 zn/0j1JrXt4RBq4vGocjkCvru6WhGkzyAl4LdmHPfHmbFZ14SVUMG8pPHGfRczdB8oFn52eF9cZbk
 l72e1/X/z4J/ssrIe5zmedC6aJ5bV5EBJVh82a3CaKrCBSPa4UAwJdQyMQLg/exfN2Wk=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jiz9S-0005tN-Q2
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 11:44:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jiz9S-0003Hu-PD
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 11:44:14 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.10] tools/libxc: fix strncpy size
Message-Id: <E1jiz9S-0003Hu-PD@xenbits.xenproject.org>
Date: Wed, 10 Jun 2020 11: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 6df4d40d846eb5151a89d26d1a63d632c6b9eb55
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Thu Apr 5 03:50:49 2018 +0200
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Wed Jun 10 11:50:16 2020 +0100

    tools/libxc: fix strncpy size
    
    gcc-8 warns about possible truncation of trailing '\0'.
    Final character is overridden by '\0' anyway, so don't bother to copy
    it.
    
    This fixes compile failure:
    
        xc_pm.c: In function 'xc_set_cpufreq_gov':
        xc_pm.c:308:5: error: 'strncpy' specified bound 16 equals destination size [-Werror=stringop-truncation]
             strncpy(scaling_governor, govname, CPUFREQ_NAME_LEN);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        cc1: all warnings being treated as errors
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Wei Liu <wei.liu2@citrix.com>
    Release-Acked-by: Juergen Gross <jgross@suse.com>
    (cherry picked from commit fa7789ef18bd2e716997937af71b2e4b5b00a159)
---
 tools/libxc/xc_pm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libxc/xc_pm.c b/tools/libxc/xc_pm.c
index ae917bc630..0fc47047ce 100644
--- a/tools/libxc/xc_pm.c
+++ b/tools/libxc/xc_pm.c
@@ -305,7 +305,7 @@ int xc_set_cpufreq_gov(xc_interface *xch, int cpuid, char *govname)
     sysctl.cmd = XEN_SYSCTL_pm_op;
     sysctl.u.pm_op.cmd = SET_CPUFREQ_GOV;
     sysctl.u.pm_op.cpuid = cpuid;
-    strncpy(scaling_governor, govname, CPUFREQ_NAME_LEN);
+    strncpy(scaling_governor, govname, CPUFREQ_NAME_LEN - 1);
     scaling_governor[CPUFREQ_NAME_LEN - 1] = '\0';
 
     return xc_sysctl(xch, &sysctl);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.10


From xen-changelog-bounces@lists.xenproject.org Wed Jun 10 11:44:26 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Jun 2020 11:44:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jiz9e-0007Cn-TP; Wed, 10 Jun 2020 11:44: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=/Mc5=7X=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jiz9d-0007CX-Hc
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 11:44:25 +0000
X-Inumbo-ID: bbad3a56-ab0f-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id bbad3a56-ab0f-11ea-bca7-bc764e2007e4;
 Wed, 10 Jun 2020 11: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=fksj3aWZTQYzz72SfA5C4eF6qK7sBudLo3thAm53At0=; b=BluSAZ39OABwqGLCD75apU/Kpb
 RIGqtHLaHJ7BpDi30EjPCowHcZB6diQAF23K+jFASWPA+AljDfuo5vxxkd7pmVponu/1QdbX+qPLO
 ECzjyAlnlnCp04ejc7Jzy9oH2oeOiz4Q9eWj8b1sfVqJAMM2mT6R/TxphLSqx9p5sCe4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jiz9c-0005tX-T0
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 11:44:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jiz9c-0003JJ-S2
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 11:44:24 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.10] tools/xenpmd: fix possible '\0' truncation
Message-Id: <E1jiz9c-0003JJ-S2@xenbits.xenproject.org>
Date: Wed, 10 Jun 2020 11: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 bf467cc828bde380e9201d8b49c7866a5b92d719
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Thu Apr 5 03:50:53 2018 +0200
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Wed Jun 10 11:51:09 2020 +0100

    tools/xenpmd: fix possible '\0' truncation
    
    gcc-8 complains:
        xenpmd.c:207:9: error: 'strncpy' specified bound 32 equals destination size [-Werror=stringop-truncation]
                 strncpy(info->oem_info, attrib_value, 32);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        xenpmd.c:201:9: error: 'strncpy' specified bound 32 equals destination size [-Werror=stringop-truncation]
                 strncpy(info->battery_type, attrib_value, 32);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        xenpmd.c:195:9: error: 'strncpy' specified bound 32 equals destination size [-Werror=stringop-truncation]
                 strncpy(info->serial_number, attrib_value, 32);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        xenpmd.c:189:9: error: 'strncpy' specified bound 32 equals destination size [-Werror=stringop-truncation]
                 strncpy(info->model_number, attrib_value, 32);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    Copy 31 chars, then make sure terminating '\0' is present. Those fields
    are passed to strlen and as '%s' for snprintf later.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Wei Liu <wei.liu2@citrix.com>
    Release-Acked-by: Juergen Gross <jgross@suse.com>
    (cherry picked from commit 938c8f53b1f80175c6f7a1399efdb984abb0cb8b)
---
 tools/xenpmd/xenpmd.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/tools/xenpmd/xenpmd.c b/tools/xenpmd/xenpmd.c
index 689c8fd670..56412a9a81 100644
--- a/tools/xenpmd/xenpmd.c
+++ b/tools/xenpmd/xenpmd.c
@@ -186,25 +186,29 @@ void set_attribute_battery_info(char *attrib_name,
 
     if ( strstr(attrib_name, "model number") ) 
     {
-        strncpy(info->model_number, attrib_value, 32);
+        strncpy(info->model_number, attrib_value, 31);
+        info->model_number[31] = '\0';
         return;
     }
 
     if ( strstr(attrib_name, "serial number") ) 
     {
-        strncpy(info->serial_number, attrib_value, 32);
+        strncpy(info->serial_number, attrib_value, 31);
+        info->serial_number[31] = '\0';
         return;
     }
 
     if ( strstr(attrib_name, "battery type") ) 
     {
-        strncpy(info->battery_type, attrib_value, 32);
+        strncpy(info->battery_type, attrib_value, 31);
+        info->battery_type[31] = '\0';
         return;
     }
 
     if ( strstr(attrib_name, "OEM info") ) 
     {
-        strncpy(info->oem_info, attrib_value, 32);
+        strncpy(info->oem_info, attrib_value, 31);
+        info->oem_info[31] = '\0';
         return;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.10


From xen-changelog-bounces@lists.xenproject.org Wed Jun 10 11:44:35 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Jun 2020 11:44:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jiz9n-0007EM-Uo; Wed, 10 Jun 2020 11:44: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=/Mc5=7X=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jiz9n-0007EE-IF
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 11:44:35 +0000
X-Inumbo-ID: c1ae1bc8-ab0f-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id c1ae1bc8-ab0f-11ea-bb8b-bc764e2007e4;
 Wed, 10 Jun 2020 11: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=MZV/FmT/HuJbM3Z8QlejzQEYpxtBDPdK0+QQR9WpugM=; b=vEqpC5LaV2zBUlKptfqSOo4MJ3
 YNpE37t6JyhZJdap9WW5utxknFMJiU11+CeWNxlZLO4X/7n7cqv8iJN785BljJs69bo7BGLsQOnuH
 GzMwch8lDQOcYZ4NNi3C/QCe7La2qYQAfy3VCcbF3FRwrfqdWcup1MivJG1pXxtGG92k=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jiz9m-0005th-Vt
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 11:44:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jiz9m-0003Jy-V7
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 11:44:34 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.10] tools/gdbsx: fix -Wstringop-truncation warning
Message-Id: <E1jiz9m-0003Jy-V7@xenbits.xenproject.org>
Date: Wed, 10 Jun 2020 11:44: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 2f83654fa3331d1ec79275072f8742f175f82bc5
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Thu Apr 5 03:50:54 2018 +0200
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Wed Jun 10 11:51:15 2020 +0100

    tools/gdbsx: fix -Wstringop-truncation warning
    
    gcc-8 complains:
    
        gx_main.c: In function 'prepare_stop_reply':
        gx_main.c:385:9: error: 'strncpy' output truncated before terminating nul copying 6 bytes from a string of the same length [-Werror=stringop-truncation]
                 strncpy(buf, "watch:", 6);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~
    
    Since terminating '\0' isn't needed here at all, switch to memcpy.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Wei Liu <wei.liu2@citrix.com>
    Release-Acked-by: Juergen Gross <jgross@suse.com>
    (cherry picked from commit 7f601f7c341c80d554615556d60e3b8ed1e5ad4f)
---
 tools/debugger/gdbsx/gx/gx_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/debugger/gdbsx/gx/gx_main.c b/tools/debugger/gdbsx/gx/gx_main.c
index a908c45e1d..6dfa501145 100644
--- a/tools/debugger/gdbsx/gx/gx_main.c
+++ b/tools/debugger/gdbsx/gx/gx_main.c
@@ -382,7 +382,7 @@ prepare_stop_reply(enum target_signal sig, char *buf, vcpuid_t vcpu)
 
     /* TBD: check if we stopped because of watchpoint */
     if (watchpoint_stop()) {
-        strncpy(buf, "watch:", 6);
+        memcpy(buf, "watch:", 6);
         buf += 6;
         /* TBD: **/
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.10


From xen-changelog-bounces@lists.xenproject.org Wed Jun 10 11:44:47 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Jun 2020 11: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 1jiz9z-0007FY-09; Wed, 10 Jun 2020 11:44:47 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=/Mc5=7X=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jiz9y-0007FS-Fm
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 11:44:46 +0000
X-Inumbo-ID: c7b42490-ab0f-11ea-b41d-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id c7b42490-ab0f-11ea-b41d-12813bfff9fa;
 Wed, 10 Jun 2020 11: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=3CVo3PsaqP2xnkEbKL24PJXqeXkpFWJ3tKl+vLKrd1Y=; b=1q+bW0V8/fY4GGpcYjS2O8v/sF
 TKQsarIHdZlCbAkY2fZrr6DTT8PIevRLEeeydUGT4otmrjDUmZY5OJeiZYSmYP/svIYb6Ruv4Xhis
 jasrJP551t/TVflCOMIxUdsQP5BzeG7+EwTWIKx6oQuUhkIkyBvXJyaFeBl1xmclJN0Y=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jiz9x-0005to-34
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 11:44:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jiz9x-0003Ki-1u
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 11:44:45 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.10] tools/blktap2: fix possible '\0' truncation
Message-Id: <E1jiz9x-0003Ki-1u@xenbits.xenproject.org>
Date: Wed, 10 Jun 2020 11: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 dfc0b23403a2f0069bc7b9c0c20dfe5513eb8fb5
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Thu Apr 5 03:50:52 2018 +0200
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Wed Jun 10 11:51:20 2020 +0100

    tools/blktap2: fix possible '\0' truncation
    
    gcc-8 complains:
    
        tapdisk-vbd.c: In function 'tapdisk_vbd_resume_ring':
        tapdisk-vbd.c:1671:53: error: 'snprintf' output may be truncated before the last format character [-Werror=format-truncation=]
           snprintf(params.name, sizeof(params.name) - 1, "%s", message);
                                                             ^
        tapdisk-vbd.c:1671:3: note: 'snprintf' output between 1 and 256 bytes into a destination of size 255
           snprintf(params.name, sizeof(params.name) - 1, "%s", message);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    The "- 1" in buffer size should be actually applied to message, to leave
    place for terminating '\0', not the other way around (truncate '\0' even
    if it would fit).
    
        In function 'tapdisk_control_open_image',
            inlined from 'tapdisk_control_handle_request' at tapdisk-control.c:660:10:
        tapdisk-control.c:465:2: error: 'strncpy' specified bound 256 equals destination size [-Werror=stringop-truncation]
          strncpy(params.name, vbd->name, BLKTAP2_MAX_MESSAGE_LEN);
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
        In function 'tapdisk_control_create_socket',
            inlined from 'tapdisk_control_open' at tapdisk-control.c:836:9:
        tapdisk-control.c:793:2: error: 'strncpy' specified bound 108 equals destination size [-Werror=stringop-truncation]
          strncpy(saddr.sun_path, td_control.path, sizeof(saddr.sun_path));
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
        block-qcow.c: In function 'qcow_create':
        block-qcow.c:1216:5: error: 'strncpy' specified bound 4096 equals destination size [-Werror=stringop-truncation]
             strncpy(backing_filename, backing_file,
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              sizeof(backing_filename));
              ~~~~~~~~~~~~~~~~~~~~~~~~~
    
    I those cases, reduce size of copied string and make sure final '\0' is
    added.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Wei Liu <wei.liu2@citrix.com>
    Release-Acked-by: Juergen Gross <jgross@suse.com>
    (cherry picked from commit 850e89b3ef1a7be6b71fa7ae22333c884e08431a)
---
 tools/blktap2/drivers/block-qcow.c      | 3 ++-
 tools/blktap2/drivers/tapdisk-control.c | 5 +++--
 tools/blktap2/drivers/tapdisk-vbd.c     | 3 ++-
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/tools/blktap2/drivers/block-qcow.c b/tools/blktap2/drivers/block-qcow.c
index b45bcaa077..ae439221ab 100644
--- a/tools/blktap2/drivers/block-qcow.c
+++ b/tools/blktap2/drivers/block-qcow.c
@@ -1214,7 +1214,8 @@ int qcow_create(const char *filename, uint64_t total_size,
 			if (p && (p - backing_file) >= 2) {
 				/* URL like but exclude "c:" like filenames */
 				strncpy(backing_filename, backing_file,
-					sizeof(backing_filename));
+					sizeof(backing_filename) - 1);
+				backing_filename[sizeof(backing_filename) - 1] = '\0';
 			} else {
 				if (realpath(backing_file, backing_filename) == NULL ||
 				    stat(backing_filename, &st) != 0) {
diff --git a/tools/blktap2/drivers/tapdisk-control.c b/tools/blktap2/drivers/tapdisk-control.c
index 0b5cf3cdd3..3ca5713063 100644
--- a/tools/blktap2/drivers/tapdisk-control.c
+++ b/tools/blktap2/drivers/tapdisk-control.c
@@ -462,7 +462,8 @@ tapdisk_control_open_image(struct tapdisk_control_connection *connection,
 
 	params.capacity = image.size;
 	params.sector_size = image.secsize;
-	strncpy(params.name, vbd->name, BLKTAP2_MAX_MESSAGE_LEN);
+	strncpy(params.name, vbd->name, BLKTAP2_MAX_MESSAGE_LEN - 1);
+	params.name[BLKTAP2_MAX_MESSAGE_LEN - 1] = '\0';
 
 	err = ioctl(vbd->ring.fd, BLKTAP2_IOCTL_CREATE_DEVICE, &params);
 	if (err && errno != EEXIST) {
@@ -790,7 +791,7 @@ tapdisk_control_create_socket(char **socket_path)
 	}
 
 	memset(&saddr, 0, sizeof(saddr));
-	strncpy(saddr.sun_path, td_control.path, sizeof(saddr.sun_path));
+	strncpy(saddr.sun_path, td_control.path, sizeof(saddr.sun_path) - 1);
 	saddr.sun_family = AF_UNIX;
 
 	err = bind(td_control.socket,
diff --git a/tools/blktap2/drivers/tapdisk-vbd.c b/tools/blktap2/drivers/tapdisk-vbd.c
index fd4999a5ec..842a427861 100644
--- a/tools/blktap2/drivers/tapdisk-vbd.c
+++ b/tools/blktap2/drivers/tapdisk-vbd.c
@@ -1668,7 +1668,8 @@ out:
 
 		params.sector_size = image.secsize;
 		params.capacity    = image.size;
-		snprintf(params.name, sizeof(params.name) - 1, "%s", message);
+		snprintf(params.name, sizeof(params.name),
+			 "%.*s", (int)sizeof(params.name) - 1, message);
 
 		ioctl(vbd->ring.fd, BLKTAP2_IOCTL_SET_PARAMS, &params);
 		td_flag_clear(vbd->state, TD_VBD_PAUSED);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.10


From xen-changelog-bounces@lists.xenproject.org Wed Jun 10 11:44:56 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Jun 2020 11:44:56 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jizA8-0007GM-1r; Wed, 10 Jun 2020 11:44: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=/Mc5=7X=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jizA7-0007GF-R1
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 11:44:55 +0000
X-Inumbo-ID: cdbb38f6-ab0f-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id cdbb38f6-ab0f-11ea-8496-bc764e2007e4;
 Wed, 10 Jun 2020 11: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=n39HGFO3FURuqMMpoAhJmvpO7RLKiGMN+bCZpuNzqYs=; b=ZfmO12BeshEBLGT+cqUkSwlZi+
 858AHbLmWPj1O7jAbnaEGo36xq8QIMwcf/ogBKKv1mMFPj2vCGi4i7pw9pZ6x3COzIJScYLueLiD9
 XLQfZMsyIMhmGnYwn5FjZvszRmq6atjEUOHKRm0213OWzJqQaLdyXeRpbrYF2fT66ELs=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jizA7-0005uN-5p
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 11:44:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jizA7-0003LI-53
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 11:44:55 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.10] tools/misc: fix hypothetical buffer overflow in
 xen-lowmemd
Message-Id: <E1jizA7-0003LI-53@xenbits.xenproject.org>
Date: Wed, 10 Jun 2020 11: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 6e636f297f12a52ce12db11ea0787dd541937ed6
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Thu Apr 5 03:50:50 2018 +0200
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Wed Jun 10 11:52:02 2020 +0100

    tools/misc: fix hypothetical buffer overflow in xen-lowmemd
    
    gcc-8 complains:
    
        xen-lowmemd.c: In function 'handle_low_mem':
        xen-lowmemd.c:80:55: error: '%s' directive output may be truncated writing up to 511 bytes into a region of size 489 [-Werror=format-truncation=]
                 snprintf(error, BUFSZ,"Failed to write target %s to xenstore", data);
                                                               ^~               ~~~~
        xen-lowmemd.c:80:9: note: 'snprintf' output between 36 and 547 bytes into a destination of size 512
                 snprintf(error, BUFSZ,"Failed to write target %s to xenstore", data);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    In practice it wouldn't happen, because 'data' contains string
    representation of 64-bit unsigned number (20 characters at most).
    But place a limit to mute gcc warning.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Wei Liu <wei.liu2@citrix.com>
    Release-Acked-by: Juergen Gross <jgross@suse.com>
    (cherry picked from commit 27751d89248c8c5eef6d8b56eb8f7d2084145080)
---
 tools/misc/xen-lowmemd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/misc/xen-lowmemd.c b/tools/misc/xen-lowmemd.c
index 865a54cec1..79ad34cb4a 100644
--- a/tools/misc/xen-lowmemd.c
+++ b/tools/misc/xen-lowmemd.c
@@ -77,7 +77,7 @@ void handle_low_mem(void)
     if (!xs_write(xs_handle, XBT_NULL, 
             "/local/domain/0/memory/target", data, strlen(data)))
     {
-        snprintf(error, BUFSZ,"Failed to write target %s to xenstore", data);
+        snprintf(error, BUFSZ,"Failed to write target %.24s to xenstore", data);
         perror(error);
     }
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.10


From xen-changelog-bounces@lists.xenproject.org Wed Jun 10 11:45:06 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Jun 2020 11:45:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jizAI-0007Hg-4e; Wed, 10 Jun 2020 11:45: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=/Mc5=7X=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jizAH-0007HY-SY
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 11:45:05 +0000
X-Inumbo-ID: d3bd0482-ab0f-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id d3bd0482-ab0f-11ea-b7bb-bc764e2007e4;
 Wed, 10 Jun 2020 11:45: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=dYnvLqFXKriwPjKeRgmxX3OC3h/MGlMHeH/doJ1NvCc=; b=RqPR7/vI5h/yJ6WpWUFe+h1QvX
 M8X90M6CVGoc9BbpGounln0AHeLtQRelfSdLfxVVEXP7Vqb8bXkWxxCwSQs/P1oLbThw6dr2ImMEL
 YZFU3ktS+AI1vvaJf8mZRgcm2LfME6cVu5oyVthIpj2uU384dSnwYoEvDW2N/Ypc//RI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jizAH-0005uu-9F
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 11:45:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jizAH-0003M6-7t
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 11:45:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.10] tools/ocaml/libs/xc fix gcc-8 format-truncation
 warning
Message-Id: <E1jizAH-0003M6-7t@xenbits.xenproject.org>
Date: Wed, 10 Jun 2020 11: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 934d6e1a77947662504cf4d5e36c9520e03aa731
Author:     John Thomson <git@johnthomson.fastmail.com.au>
AuthorDate: Tue May 15 11:48:43 2018 +1000
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Wed Jun 10 11:57:16 2020 +0100

    tools/ocaml/libs/xc fix gcc-8 format-truncation warning
    
     CC       xenctrl_stubs.o
    xenctrl_stubs.c: In function 'failwith_xc':
    xenctrl_stubs.c:65:17: error: 'snprintf' output may be truncated before the last format character [-Werror=format-truncation=]
          "%d: %s: %s", error->code,
                     ^
    xenctrl_stubs.c:64:4: note: 'snprintf' output 6 or more bytes (assuming 1029) into a destination of size 1028
        snprintf(error_str, sizeof(error_str),
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          "%d: %s: %s", error->code,
          ~~~~~~~~~~~~~~~~~~~~~~~~~~
          xc_error_code_to_desc(error->code),
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          error->message);
          ~~~~~~~~~~~~~~~
    cc1: all warnings being treated as errors
    make[8]: *** [/build/xen-git/src/xen/tools/ocaml/libs/xc/../../Makefile.rules:37: xenctrl_stubs.o] Error 1
    m
    
    Signed-off-by: John Thomson <git@johnthomson.fastmail.com.au>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    Release-acked-by: Juergen Gross <jgross@suse.com>
    (cherry picked from commit 2adc90908fbb1e614c477e29f2d45eda94570795)
---
 tools/ocaml/libs/xc/xenctrl_stubs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index dd6000caa3..c486e69086 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -54,7 +54,7 @@
 
 static void Noreturn failwith_xc(xc_interface *xch)
 {
-	char error_str[1028];
+	char error_str[XC_MAX_ERROR_MSG_LEN + 6];
 	if (xch) {
 		const xc_error *error = xc_get_last_error(xch);
 		if (error->code == XC_ERROR_NONE)
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.10


From xen-changelog-bounces@lists.xenproject.org Wed Jun 10 18:22:08 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Jun 2020 18:22:08 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jj5MS-0002LS-6N; Wed, 10 Jun 2020 18: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=/Mc5=7X=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jj5MR-0002LN-2G
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 18:22:03 +0000
X-Inumbo-ID: 478ba472-ab47-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 478ba472-ab47-11ea-8496-bc764e2007e4;
 Wed, 10 Jun 2020 18: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=7Gte1PuyOXI6Yqdp8PYPOu5E4bpvk52iRlXLxgbef1M=; b=K0FOdLYrH4yG2oHyK9eyjxerM2
 RzCJi8jvHxylJeHAYA+VDdjRF5gpPDwDm7v19PHiXZ5NfSyWq4AvvTUjOgMLRAUJnbMvu+g5TL3DJ
 p0NyjxsEszavK/zrNP/rnXOobwmOFtVwc8BQ75skp9UFCWI25LJuHQ2jA0jp3LfFl32M=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jj5MP-0005SJ-R7
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 18:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jj5MP-0001gV-Q4
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 18:22:01 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/monitor: revert default behavior when monitoring
 register write events
Message-Id: <E1jj5MP-0001gV-Q4@xenbits.xenproject.org>
Date: Wed, 10 Jun 2020 18: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 985ba41f66a5bd39897976beb14dc1f575bdd8c2
Author:     Tamas K Lengyel <tamas@tklengyel.com>
AuthorDate: Tue Jun 9 12:54:17 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jun 9 12:54:17 2020 +0200

    x86/monitor: revert default behavior when monitoring register write events
    
    For the last couple years we have received numerous reports from users of
    monitor vm_events of spurious guest crashes when using events. In particular,
    it has observed that the problem occurs when vm_events are being disabled. The
    nature of the guest crash varied widely and has only occured occasionally. This
    made debugging the issue particularly hard. We had discussions about this issue
    even here on the xen-devel mailinglist with no luck figuring it out.
    
    The bug has now been identified as a race-condition between register event
    handling and disabling the monitor vm_event interface. The default behavior
    regarding emulation of register write events is changed so that they get
    postponed until the corresponding vm_event handler decides whether to allow such
    write to take place. Unfortunately this can only be implemented by performing the
    deny/allow step when the vCPU gets scheduled.
    
    Due to that postponed emulation of the event if the user decides to pause the
    VM in the vm_event handler and then disable events, the entire emulation step
    is skipped the next time the vCPU is resumed. Even if the user doesn't pause
    during the vm_event handling but exits immediately and disables vm_event, the
    situation becomes racey as disabling vm_event may succeed before the guest's
    vCPUs get scheduled with the pending emulation task. This has been particularly
    the case with VMS that have several vCPUs as after the VM is unpaused it may
    actually take a long time before all vCPUs get scheduled.
    
    In this patch we are reverting the default behavior to always perform emulation
    of register write events when the event occurs. To postpone them can be turned
    on as an option. In that case the user of the interface still has to take care
    of only disabling the interface when its safe as it remains buggy.
    
    Fixes: 96760e2fba10 ('vm_event: deny register writes if refused by vm_event
    reply').
    
    Signed-off-by: Tamas K Lengyel <tamas@tklengyel.com>
    Reviewed-by: Roger Pau Monné <rogerpau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/arch/x86/hvm/hvm.c            | 14 ++++++++------
 xen/arch/x86/hvm/monitor.c        | 13 ++++++++-----
 xen/include/asm-x86/domain.h      |  1 +
 xen/include/asm-x86/hvm/monitor.h |  7 +++----
 xen/include/asm-x86/monitor.h     |  4 ++++
 xen/include/public/domctl.h       |  6 ++++++
 6 files changed, 30 insertions(+), 15 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 74c9f84462..5bb47583b3 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -3601,13 +3601,15 @@ int hvm_msr_write_intercept(unsigned int msr, uint64_t msr_content,
 
         ASSERT(v->arch.vm_event);
 
-        /* The actual write will occur in hvm_do_resume() (if permitted). */
-        v->arch.vm_event->write_data.do_write.msr = 1;
-        v->arch.vm_event->write_data.msr = msr;
-        v->arch.vm_event->write_data.value = msr_content;
+        if ( hvm_monitor_msr(msr, msr_content, msr_old_content) )
+        {
+            /* The actual write will occur in hvm_do_resume(), if permitted. */
+            v->arch.vm_event->write_data.do_write.msr = 1;
+            v->arch.vm_event->write_data.msr = msr;
+            v->arch.vm_event->write_data.value = msr_content;
 
-        hvm_monitor_msr(msr, msr_content, msr_old_content);
-        return X86EMUL_OKAY;
+            return X86EMUL_OKAY;
+        }
     }
 
     if ( (ret = guest_wrmsr(v, msr, msr_content)) != X86EMUL_UNHANDLEABLE )
diff --git a/xen/arch/x86/hvm/monitor.c b/xen/arch/x86/hvm/monitor.c
index 8aa14137e2..e4a09964a0 100644
--- a/xen/arch/x86/hvm/monitor.c
+++ b/xen/arch/x86/hvm/monitor.c
@@ -53,11 +53,11 @@ bool hvm_monitor_cr(unsigned int index, unsigned long value, unsigned long old)
             .u.write_ctrlreg.old_value = old
         };
 
-        if ( monitor_traps(curr, sync, &req) >= 0 )
-            return 1;
+        return monitor_traps(curr, sync, &req) >= 0 &&
+               curr->domain->arch.monitor.control_register_values;
     }
 
-    return 0;
+    return false;
 }
 
 bool hvm_monitor_emul_unimplemented(void)
@@ -77,7 +77,7 @@ bool hvm_monitor_emul_unimplemented(void)
         monitor_traps(curr, true, &req) == 1;
 }
 
-void hvm_monitor_msr(unsigned int msr, uint64_t new_value, uint64_t old_value)
+bool hvm_monitor_msr(unsigned int msr, uint64_t new_value, uint64_t old_value)
 {
     struct vcpu *curr = current;
 
@@ -92,8 +92,11 @@ void hvm_monitor_msr(unsigned int msr, uint64_t new_value, uint64_t old_value)
             .u.mov_to_msr.old_value = old_value
         };
 
-        monitor_traps(curr, 1, &req);
+        return monitor_traps(curr, 1, &req) >= 0 &&
+               curr->domain->arch.monitor.control_register_values;
     }
+
+    return false;
 }
 
 void hvm_monitor_descriptor_access(uint64_t exit_info,
diff --git a/xen/include/asm-x86/domain.h b/xen/include/asm-x86/domain.h
index e8cee3d5e5..6fd94c2e14 100644
--- a/xen/include/asm-x86/domain.h
+++ b/xen/include/asm-x86/domain.h
@@ -418,6 +418,7 @@ struct arch_domain
          * This is used to filter out pagefaults.
          */
         unsigned int inguest_pagefault_disabled                            : 1;
+        unsigned int control_register_values                               : 1;
         struct monitor_msr_bitmap *msr_bitmap;
         uint64_t write_ctrlreg_mask[4];
     } monitor;
diff --git a/xen/include/asm-x86/hvm/monitor.h b/xen/include/asm-x86/hvm/monitor.h
index 66de24cb75..a75cd8545c 100644
--- a/xen/include/asm-x86/hvm/monitor.h
+++ b/xen/include/asm-x86/hvm/monitor.h
@@ -29,15 +29,14 @@ enum hvm_monitor_debug_type
 };
 
 /*
- * Called for current VCPU on crX/MSR changes by guest.
- * The event might not fire if the client has subscribed to it in onchangeonly
- * mode, hence the bool return type for control register write events.
+ * Called for current VCPU on crX/MSR changes by guest. Bool return signals
+ * whether emulation should be postponed.
  */
 bool hvm_monitor_cr(unsigned int index, unsigned long value,
                     unsigned long old);
 #define hvm_monitor_crX(cr, new, old) \
                         hvm_monitor_cr(VM_EVENT_X86_##cr, new, old)
-void hvm_monitor_msr(unsigned int msr, uint64_t value, uint64_t old_value);
+bool hvm_monitor_msr(unsigned int msr, uint64_t value, uint64_t old_value);
 void hvm_monitor_descriptor_access(uint64_t exit_info,
                                    uint64_t vmx_exit_qualification,
                                    uint8_t descriptor, bool is_write);
diff --git a/xen/include/asm-x86/monitor.h b/xen/include/asm-x86/monitor.h
index 4afb0665e8..01c6d63bb9 100644
--- a/xen/include/asm-x86/monitor.h
+++ b/xen/include/asm-x86/monitor.h
@@ -59,6 +59,10 @@ int arch_monitor_domctl_op(struct domain *d, struct xen_domctl_monitor_op *mop)
         domain_unpause(d);
         break;
 
+    case XEN_DOMCTL_MONITOR_OP_CONTROL_REGISTERS:
+        d->arch.monitor.control_register_values = true;
+        break;
+
     default:
         rc = -EOPNOTSUPP;
     }
diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h
index 1ad34c35eb..59bdc28c89 100644
--- a/xen/include/public/domctl.h
+++ b/xen/include/public/domctl.h
@@ -1025,6 +1025,12 @@ struct xen_domctl_psr_cmt_op {
 #define XEN_DOMCTL_MONITOR_OP_DISABLE           1
 #define XEN_DOMCTL_MONITOR_OP_GET_CAPABILITIES  2
 #define XEN_DOMCTL_MONITOR_OP_EMULATE_EACH_REP  3
+/*
+ * Control register feature can result in guest-crashes when the monitor
+ * subsystem is being turned off. User has to take special precautions
+ * to ensure all vCPUs have resumed before it is safe to turn it off.
+ */
+#define XEN_DOMCTL_MONITOR_OP_CONTROL_REGISTERS 4
 
 #define XEN_DOMCTL_MONITOR_EVENT_WRITE_CTRLREG         0
 #define XEN_DOMCTL_MONITOR_EVENT_MOV_TO_MSR            1
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jun 10 18:22:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Jun 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 1jj5Mc-0002MT-9J; Wed, 10 Jun 2020 18: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=/Mc5=7X=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jj5Ma-0002MC-Ik
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 18:22:12 +0000
X-Inumbo-ID: 4d88c4ae-ab47-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 4d88c4ae-ab47-11ea-bca7-bc764e2007e4;
 Wed, 10 Jun 2020 18: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=Xp28MN5UC7QF9mTqDXdFKUmaFa5hku8JOijGuwxqbnE=; b=GaGhok6bd9wrXgAGw4iftioFOE
 NirJ3CuCMxmpF+6oVvQPP1E9saZ3i1QVqTh1pBYwC1lO04MYclV+f959FOPJgc9ygBC8suyBG5Bbo
 o9ooDhRgTRcbzGaiOmQsiypbSi9C4f5msOz+SpHs9hj5T/bURJYQdUg49TW9J5oeDGrI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jj5MZ-0005SY-UO
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 18:22:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jj5MZ-0001h1-TU
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 18:22:11 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/Intel: insert Ice Lake and Comet Lake model numbers
Message-Id: <E1jj5MZ-0001h1-TU@xenbits.xenproject.org>
Date: Wed, 10 Jun 2020 18:22: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 1fe406685cb19e9544681c6243e7d376deb0297e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jun 9 12:55:53 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jun 9 12:55:53 2020 +0200

    x86/Intel: insert Ice Lake and Comet Lake model numbers
    
    Both match prior generation processors as far as LBR and C-state MSRs
    go (SDM rev 072) as well as applicability of the if_pschange_mc erratum
    (recent spec updates).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/arch/x86/acpi/cpu_idle.c | 6 ++++++
 xen/arch/x86/hvm/vmx/vmx.c   | 8 ++++++++
 2 files changed, 14 insertions(+)

diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c
index a2248ea11f..27e0b52621 100644
--- a/xen/arch/x86/acpi/cpu_idle.c
+++ b/xen/arch/x86/acpi/cpu_idle.c
@@ -180,9 +180,15 @@ static void do_get_hw_residencies(void *arg)
     case 0x4E:
     case 0x55:
     case 0x5E:
+    /* Ice Lake */
+    case 0x7D:
+    case 0x7E:
     /* Kaby Lake */
     case 0x8E:
     case 0x9E:
+    /* Comet Lake */
+    case 0xA5:
+    case 0xA6:
         GET_PC2_RES(hw_res->pc2);
         GET_CC7_RES(hw_res->cc7);
         /* fall through */
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index b7d0c58214..ab19d9424e 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2438,8 +2438,12 @@ static bool __init has_if_pschange_mc(void)
     case 0x4e: /* Skylake M */
     case 0x5e: /* Skylake D */
     case 0x55: /* Skylake-X / Cascade Lake */
+    case 0x7d: /* Ice Lake */
+    case 0x7e: /* Ice Lake */
     case 0x8e: /* Kaby / Coffee / Whiskey Lake M */
     case 0x9e: /* Kaby / Coffee / Whiskey Lake D */
+    case 0xa5: /* Comet Lake H/S */
+    case 0xa6: /* Comet Lake U */
         return true;
 
         /*
@@ -2781,10 +2785,14 @@ static const struct lbr_info *last_branch_msr_get(void)
         case 0x66:
         /* Goldmont Plus */
         case 0x7a:
+        /* Ice Lake */
+        case 0x7d: case 0x7e:
         /* Tremont */
         case 0x86:
         /* Kaby Lake */
         case 0x8e: case 0x9e:
+        /* Comet Lake */
+        case 0xa5: case 0xa6:
             return sk_lbr;
         /* Atom */
         case 0x1c: case 0x26: case 0x27: case 0x35: case 0x36:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jun 10 18:22:23 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Jun 2020 18:22:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jj5Ml-0002OT-NN; Wed, 10 Jun 2020 18:22:23 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=/Mc5=7X=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jj5Ml-0002OG-1m
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 18:22:23 +0000
X-Inumbo-ID: 53939a7c-ab47-11ea-b48f-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 53939a7c-ab47-11ea-b48f-12813bfff9fa;
 Wed, 10 Jun 2020 18: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=qhdGBopElcqfc6rb8N7VOt8Phsd22eJKa2vBB4bSgVg=; b=N+l+cnfs65Jyyu1/I4IkdnpEhn
 /KBjEu7Bkok6MHKIYTy5T1hXHtAGJUqawLvxH76w9nDKDySWv5IzzCqJF15SEcfJtiaq1UREhjs4/
 5DauYqfZTl40bMUId5rO7c0Hr7ltG2GJE3rxxBNyCmncgD/2k7sdaaenWzHKyM1jda9Q=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jj5Mk-0005Sh-1K
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 18:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jj5Mk-0001hu-0N
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 18:22:22 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] ioreq: handle pending emulation racing with ioreq server
 destruction
Message-Id: <E1jj5Mk-0001hu-0N@xenbits.xenproject.org>
Date: Wed, 10 Jun 2020 18: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 f7039ee41b3d3448775a1623f230037fd0455104
Author:     Paul Durrant <pdurrant@amazon.com>
AuthorDate: Tue Jun 9 12:56:24 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jun 9 12:56:24 2020 +0200

    ioreq: handle pending emulation racing with ioreq server destruction
    
    When an emulation request is initiated in hvm_send_ioreq() the guest vcpu is
    blocked on an event channel until that request is completed. If, however,
    the emulator is killed whilst that emulation is pending then the ioreq
    server may be destroyed. Thus when the vcpu is awoken the code in
    handle_hvm_io_completion() will find no pending request to wait for, but will
    leave the internal vcpu io_req.state set to IOREQ_READY and the vcpu shutdown
    deferall flag in place (because hvm_io_assist() will never be called). The
    emulation request is then completed anyway. This means that any subsequent call
    to hvmemul_do_io() will find an unexpected value in io_req.state and will
    return X86EMUL_UNHANDLEABLE, which in some cases will result in continuous
    re-tries.
    
    This patch fixes the issue by moving the setting of io_req.state and clearing
    of shutdown deferral (as will as MSI-X write completion) out of hvm_io_assist()
    and directly into handle_hvm_io_completion().
    
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Paul Durrant <pdurrant@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/arch/x86/hvm/ioreq.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/hvm/ioreq.c b/xen/arch/x86/hvm/ioreq.c
index c55c4bc4bc..724007016d 100644
--- a/xen/arch/x86/hvm/ioreq.c
+++ b/xen/arch/x86/hvm/ioreq.c
@@ -109,15 +109,7 @@ static void hvm_io_assist(struct hvm_ioreq_vcpu *sv, uint64_t data)
     ioreq_t *ioreq = &v->arch.hvm.hvm_io.io_req;
 
     if ( hvm_ioreq_needs_completion(ioreq) )
-    {
-        ioreq->state = STATE_IORESP_READY;
         ioreq->data = data;
-    }
-    else
-        ioreq->state = STATE_IOREQ_NONE;
-
-    msix_write_completion(v);
-    vcpu_end_shutdown_deferral(v);
 
     sv->pending = false;
 }
@@ -209,6 +201,12 @@ bool handle_hvm_io_completion(struct vcpu *v)
         }
     }
 
+    vio->io_req.state = hvm_ioreq_needs_completion(&vio->io_req) ?
+        STATE_IORESP_READY : STATE_IOREQ_NONE;
+
+    msix_write_completion(v);
+    vcpu_end_shutdown_deferral(v);
+
     io_completion = vio->io_completion;
     vio->io_completion = HVMIO_no_completion;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jun 10 18:22:33 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Jun 2020 18: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 1jj5Mv-0002QW-Ou; Wed, 10 Jun 2020 18: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=/Mc5=7X=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jj5Mu-0002QM-Qi
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 18:22:32 +0000
X-Inumbo-ID: 59997e6e-ab47-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 59997e6e-ab47-11ea-b7bb-bc764e2007e4;
 Wed, 10 Jun 2020 18:22: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=c4J+OeXbxy1G68JAmYr5fo5TvQIP2pFGqQ7OJiPhJE8=; b=skCEVEXuUvxu1F7Jwh+k4dFOws
 C1VboWsrtDaZXUzV8v4WzTUvdODTwpSYF8qNIHcbqrm8US6h6cNUXetqJNldXt2+AAduRQrcCRMsX
 tJnxkyc/3KDwQX9Vb4bqT5v7BSZBRQCc+XFOYpfFPmEnXELMOLY/W0P2yU08iuN/knw0=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jj5Mu-0005Ss-4f
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 18:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jj5Mu-0001iW-3P
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 18:22:32 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] docs-parse-support-md: Prepare for coping with pandoc
 versions
Message-Id: <E1jj5Mu-0001iW-3P@xenbits.xenproject.org>
Date: Wed, 10 Jun 2020 18: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 31a714d54f902aa89f8934593fe90771ef02b727
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Tue Jun 9 12:21:48 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Tue Jun 9 14:05:49 2020 +0100

    docs-parse-support-md: Prepare for coping with pandoc versions
    
    Different pandoc versions generate, and expect, a different toplevel
    structure for their json output and inpout.  Newer pandoc's toplevel
    is a hash.  We are going to want to support this.  We can tell what
    kind of output we should produce by looking at the input we got (which
    itself came from pandoc).  So:
    
     * Make space for code to read toplevel objects which are not arrays.
       Currently this code is absent and we just die explicitly (rather
       than dying because we tried to use a hashref as an array ref).
    
     * Move generation of the toplevel json structure out of
       pandoc2html_inline, and abstract it away through a subref which is
       set up when we read the input file.
    
    This is just prep work.  No functional change other than a change to
    an error message.
    
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 docs/parse-support-md | 28 +++++++++++++++++++++-------
 1 file changed, 21 insertions(+), 7 deletions(-)

diff --git a/docs/parse-support-md b/docs/parse-support-md
index 84f0a96a0f..b9978bfb4d 100755
--- a/docs/parse-support-md
+++ b/docs/parse-support-md
@@ -232,6 +232,8 @@ sub r_content ($) {
     }
 }
 
+our $pandoc_toplevel_constructor;
+
 sub r_toplevel ($) {
     my ($i) = @_;
 
@@ -241,9 +243,21 @@ sub r_toplevel ($) {
     $had_unknown = undef;
     $had_feature = undef;
 
-    foreach my $e (@$i) {
-        next unless ref $e eq 'ARRAY';
-        r_content $e;
+    my $blocks;
+    if (ref $i eq 'ARRAY') {
+	$pandoc_toplevel_constructor = sub {
+	    my ($blocks) = @_;
+	    return [
+		    { unMeta => { } },
+		    $blocks,
+		   ];
+	};
+	foreach my $e (@$i) {
+	    next unless ref $e eq 'ARRAY';
+	    r_content $e;
+	}
+    } else {
+	die;
     }
 }
 
@@ -274,10 +288,10 @@ sub pandoc2html_inline ($) {
     my ($content) = @_;
 
     my $json_fh = IO::File::new_tmpfile or die $!;
-    my $j = to_json([
-                     { unMeta => { } },
-                     [{ t => 'Para', c => $content }],
-                    ]) or die $!;
+
+    my $blocks = [{ t => 'Para', c => $content }];
+    my $data = $pandoc_toplevel_constructor->($blocks);
+    my $j = to_json($data) or die $!;
     print $json_fh $j;
     flush $json_fh or die $!;
     seek $json_fh,0,0 or die $!;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jun 10 18:22:43 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Jun 2020 18:22:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jj5N5-0002Sd-QV; Wed, 10 Jun 2020 18:22:43 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=/Mc5=7X=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jj5N4-0002SO-SH
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 18:22:42 +0000
X-Inumbo-ID: 5f986e4c-ab47-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 5f986e4c-ab47-11ea-bb8b-bc764e2007e4;
 Wed, 10 Jun 2020 18:22: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=mEl0UQnzw5N2VIrBbcIdKuyNWCeAitSJDey0pbqRMlc=; b=zqTybKOkUecJNH79IDTW2FdKTU
 ySeLIJRylBaMEjrenK/WIDHKb/Z+yRLiqMAsJie2fNfskyFcte1BFc3GolhHbKOojYfwIGTHCr8oU
 mm/+TACUOBXwD8JsZEWKbsruncH9tuyGi7wT5L9n/JzKVC7MpzDxmWyK3PPlMH0Foc9E=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jj5N4-0005T1-7X
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 18:22:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jj5N4-0001j6-6n
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 18:22:42 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] docs-parse-support-md: Cope with buster's pandoc
Message-Id: <E1jj5N4-0001j6-6n@xenbits.xenproject.org>
Date: Wed, 10 Jun 2020 18: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 1a58d8dab52f241d52fec1d992d859b9632c4739
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Tue Jun 9 12:26:36 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Tue Jun 9 14:05:49 2020 +0100

    docs-parse-support-md: Cope with buster's pandoc
    
    Provide the implementation for newer pandoc json.
    
    I have done an adhoc test and this now works on both buster and
    stretch and seems to produce the expected support matrix when run
    using the example rune (which processes unstable and 4.11).
    
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 docs/parse-support-md | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/docs/parse-support-md b/docs/parse-support-md
index b9978bfb4d..a397637639 100755
--- a/docs/parse-support-md
+++ b/docs/parse-support-md
@@ -243,6 +243,15 @@ sub r_toplevel ($) {
     $had_unknown = undef;
     $had_feature = undef;
 
+    # Pandoc's JSON output changed some time between 1.17.2 (stretch)
+    # and 2.2.1 (buster).  I can find no documentation about this
+    # change or about the compatibility rules.  (It seems that
+    # processing the parse tree *is* supported upstream: they offer
+    # many libraries to do this inside the pandoc process.)
+    # Empirically, what has changed is just the top level structure.
+    # Also pandoc wants the same structure back that it spat out,
+    # when we ask it to format snippets.
+
     my $blocks;
     if (ref $i eq 'ARRAY') {
 	$pandoc_toplevel_constructor = sub {
@@ -256,6 +265,17 @@ sub r_toplevel ($) {
 	    next unless ref $e eq 'ARRAY';
 	    r_content $e;
 	}
+    } elsif (ref $i eq 'HASH') {
+	my $api_version = $i->{'pandoc-api-version'};
+	$pandoc_toplevel_constructor = sub {
+	    my ($blocks) = @_;
+	    return {
+		    blocks => $blocks,
+		    meta => { },
+		    'pandoc-api-version' => $api_version,
+		   };
+	};
+	r_content $i->{blocks};
     } else {
 	die;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jun 10 18:22:53 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Jun 2020 18:22:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jj5NF-0002Uf-TQ; Wed, 10 Jun 2020 18:22:53 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=/Mc5=7X=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jj5NE-0002US-SC
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 18:22:52 +0000
X-Inumbo-ID: 65997ffc-ab47-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 65997ffc-ab47-11ea-bb8b-bc764e2007e4;
 Wed, 10 Jun 2020 18:22: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=DL8YcBZ31SBY/Yjq/81QmmcId2lpT+/y9z9CJBWeRfI=; b=36B6fsJkTwFNrKm1iJOwKnjkOR
 Bf96rO1YVaoppZpSvsgqJlBITo2retoE88dCYPJS1oCKPcGKdfmSvvBIDdnneS9R1XKVlmYp4cVFg
 IeKRQ0AhyuW4zvF6fwotp7Pq+578sax050nN8TXkCLGDzHt3G/eELpwVGpJtsvw9PJso=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jj5NE-0005T9-AR
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 18:22:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jj5NE-0001jk-9c
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 18:22:52 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] tools: fix error path of xenhypfs_open()
Message-Id: <E1jj5NE-0001jk-9c@xenbits.xenproject.org>
Date: Wed, 10 Jun 2020 18:22: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 30a72f028707d8cdc7951b50268e33818497596e
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Jun 9 16:48:49 2020 +0200
Commit:     Wei Liu <wl@xen.org>
CommitDate: Tue Jun 9 15:35:15 2020 +0000

    tools: fix error path of xenhypfs_open()
    
    In case of an error in xenhypfs_open() the error path will cause a
    segmentation fault due to a wrong sequence of closing calls.
    
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Fixes: 86234eafb9529 ("libs: add libxenhypfs")
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    Release-acked-by: Paul Durrant <paul@xen.org>
    Acked-by: Wei Liu <wl@xen.org>
---
 tools/libs/hypfs/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libs/hypfs/core.c b/tools/libs/hypfs/core.c
index c91e165705..fc23b02586 100644
--- a/tools/libs/hypfs/core.c
+++ b/tools/libs/hypfs/core.c
@@ -74,8 +74,8 @@ xenhypfs_handle *xenhypfs_open(xentoollog_logger *logger,
     return fshdl;
 
 err:
-    xtl_logger_destroy(fshdl->logger_tofree);
     xencall_close(fshdl->xcall);
+    xtl_logger_destroy(fshdl->logger_tofree);
     free(fshdl);
     return NULL;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jun 10 18:23:03 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Jun 2020 18:23:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jj5NP-0002WG-V9; Wed, 10 Jun 2020 18:23: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=/Mc5=7X=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jj5NP-0002W4-2U
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 18:23:03 +0000
X-Inumbo-ID: 6b9e39d8-ab47-11ea-b48f-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 6b9e39d8-ab47-11ea-b48f-12813bfff9fa;
 Wed, 10 Jun 2020 18:23: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=/vkZ6cS6yuupUc5Cx+VNZsoSvoNwozyRJcvU/Tuz/b0=; b=vqaaAZvDMR/SsniO+Ah24qcmhx
 WvBtmSnbE8QmZ4kJhVUKYDEs/CuVKK0Li4gPr8LGV0h5vH7DuJ6BlbnE450SjYzOzzusJKuHIKQfG
 G6H29FIxpaTqtVn+i19n1UICa2Etwg5alLoJGIFdjoXI7+l+WnTYP2WC09UjlJ8zZsVg=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jj5NO-0005Tx-DU
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 18:23:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jj5NO-0001kc-CZ
 for xen-changelog@lists.xenproject.org; Wed, 10 Jun 2020 18:23:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] tools: fix setting of errno in xenhypfs_read_raw()
Message-Id: <E1jj5NO-0001kc-CZ@xenbits.xenproject.org>
Date: Wed, 10 Jun 2020 18:23: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 058023b343d4e366864831db46e9b438e9e3a178
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Jun 9 16:48:50 2020 +0200
Commit:     Wei Liu <wl@xen.org>
CommitDate: Tue Jun 9 15:36:44 2020 +0000

    tools: fix setting of errno in xenhypfs_read_raw()
    
    Setting of errno is wrong in xenhypfs_read_raw(), fix it.
    
    Reported-by: George Dunlap <george.dunlap@citrix.com>
    Fixes: 86234eafb9529 ("libs: add libxenhypfs")
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    Release-acked-by: Paul Durrant <paul@xen.org>
    Acked-by: Wei Liu <wl@xen.org>
---
 tools/libs/hypfs/core.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/tools/libs/hypfs/core.c b/tools/libs/hypfs/core.c
index fc23b02586..f94c5ea1e2 100644
--- a/tools/libs/hypfs/core.c
+++ b/tools/libs/hypfs/core.c
@@ -241,10 +241,8 @@ void *xenhypfs_read_raw(xenhypfs_handle *fshdl, const char *path,
         if (!ret)
             break;
 
-        if (ret != ENOBUFS) {
-            errno = -ret;
+        if (errno != ENOBUFS)
             goto out;
-        }
     }
 
     content = malloc(entry->content_len);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Jun 11 15:22:11 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 11 Jun 2020 15: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 1jjP1r-0002ke-8m; Thu, 11 Jun 2020 15: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=As6z=7Y=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jjP1q-0002kW-3r
 for xen-changelog@lists.xenproject.org; Thu, 11 Jun 2020 15:22:06 +0000
X-Inumbo-ID: 4e8fb172-abf7-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 4e8fb172-abf7-11ea-8496-bc764e2007e4;
 Thu, 11 Jun 2020 15: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=Pmcs+5px8krz1vQWCWdyCZ5GPya2VxyJDUsh/nqA0O8=; b=vwTW7Wsa5Mob1ytUYY6T+mbxlO
 75e/8EBVxFwCAKBPiE8vEYz1q/HCVbC3r0dsIN7cRAOvokFek+/PPnX6v5vViJzbcnFoP7baatvSF
 n3NWUCKn4FTjT6v6v+nKRxdFLFQhxBsksCECIYcSaD3HprlRjFnkat7eaz+txXNkModQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jjP1p-00071d-1I
 for xen-changelog@lists.xenproject.org; Thu, 11 Jun 2020 15:22:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jjP1p-0008R0-02
 for xen-changelog@lists.xenproject.org; Thu, 11 Jun 2020 15:22:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] xen/hypfs: fix loglvl parameter setting
Message-Id: <E1jjP1p-0008R0-02@xenbits.xenproject.org>
Date: Thu, 11 Jun 2020 15: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 ceaae74cedd2f7f8ae5c66b90da82f7ead206011
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Jun 9 17:45:46 2020 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Jun 11 16:15:15 2020 +0100

    xen/hypfs: fix loglvl parameter setting
    
    Writing the runtime parameters loglvl or guest_loglvl omits setting the
    new length of the resulting parameter value.
    
    Reported-by: George Dunlap <george.dunlap@citrix.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    Release-acked-by: Paul Durran <paul@xen.org>
---
 xen/drivers/char/console.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index 56e24821b2..861ad53a8f 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -241,14 +241,25 @@ static int _parse_loglvl(const char *s, int *lower, int *upper, char *val)
 
 static int parse_loglvl(const char *s)
 {
-    return _parse_loglvl(s, &xenlog_lower_thresh, &xenlog_upper_thresh,
-                         xenlog_val);
+    int ret;
+
+    ret = _parse_loglvl(s, &xenlog_lower_thresh, &xenlog_upper_thresh,
+                        xenlog_val);
+    custom_runtime_set_var(param_2_parfs(parse_loglvl), xenlog_val);
+
+    return ret;
 }
 
 static int parse_guest_loglvl(const char *s)
 {
-    return _parse_loglvl(s, &xenlog_guest_lower_thresh,
-                         &xenlog_guest_upper_thresh, xenlog_guest_val);
+    int ret;
+
+    ret = _parse_loglvl(s, &xenlog_guest_lower_thresh,
+                        &xenlog_guest_upper_thresh, xenlog_guest_val);
+    custom_runtime_set_var(param_2_parfs(parse_guest_loglvl),
+                           xenlog_guest_val);
+
+    return ret;
 }
 
 static char *loglvl_str(int lvl)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jun 11 15:33:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 11 Jun 2020 15: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 1jjPCU-0003oP-IA; Thu, 11 Jun 2020 15: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=As6z=7Y=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jjPCT-0003nZ-9Z
 for xen-changelog@lists.xenproject.org; Thu, 11 Jun 2020 15:33:05 +0000
X-Inumbo-ID: d78e043c-abf8-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id d78e043c-abf8-11ea-bca7-bc764e2007e4;
 Thu, 11 Jun 2020 15: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=ttUAWbSQqedsOJTcN8LcAyG+TTjjdCxBrCvLEw8h4/o=; b=b5v+U5c5fU1F6fCLLWRr8P1V8w
 wo6I1lg4ECMDQa+182kDiitpYQ/+cZfJHhIeBcjh/Y/YYvuzQYmx9G7Cp6BbIBFnmay+DwYvOfXQd
 HLpUaoXoTZzvUDX6PHkNg1rB9cBDdLrkTepzf/BSPdeM8IhkKHIQgM/HYCJf0Dp0dvuQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jjPCS-0007EX-Cf
 for xen-changelog@lists.xenproject.org; Thu, 11 Jun 2020 15:33:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jjPCS-0000gT-Bd
 for xen-changelog@lists.xenproject.org; Thu, 11 Jun 2020 15:33:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/spec-ctrl: Update docs with SRBDS workaround
Message-Id: <E1jjPCS-0000gT-Bd@xenbits.xenproject.org>
Date: Thu, 11 Jun 2020 15: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 7028534d8482d25860c4d1aa8e45f0b911abfc5a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 10 18:57:00 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jun 11 16:26:06 2020 +0100

    x86/spec-ctrl: Update docs with SRBDS workaround
    
    RDRAND/RDSEED can be hidden using cpuid= to mitigate SRBDS if microcode
    isn't available.
    
    This is part of XSA-320 / CVE-2020-0543.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 docs/misc/xen-command-line.pandoc | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 1a69c60139..fde749c669 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -502,16 +502,21 @@ choice of `dom0-kernel` is deprecated and not supported by all Dom0 kernels.
 This option allows for fine tuning of the facilities Xen will use, after
 accounting for hardware capabilities as enumerated via CPUID.
 
+Unless otherwise noted, options only have any effect in their negative form,
+to hide the named feature(s).  Ignoring a feature using this mechanism will
+cause Xen not to use the feature, nor offer them as usable to guests.
+
 Currently accepted:
 
 The Speculation Control hardware features `srbds-ctrl`, `md-clear`, `ibrsb`,
 `stibp`, `ibpb`, `l1d-flush` and `ssbd` are used by default if available and
-applicable.  They can be ignored, e.g. `no-ibrsb`, at which point Xen won't
-use them itself, and won't offer them to guests.
+applicable.  They can all be ignored.
 
-`rdrand` can be used to override the default disabling of the feature on certain
-AMD systems.  Its negative form can of course also be used to suppress use and
-exposure of the feature.
+`rdrand` and `rdseed` can be ignored, as a mitigation to XSA-320 /
+CVE-2020-0543.  The RDRAND feature is disabled by default on certain AMD
+systems, due to possible malfunctions after ACPI S3 suspend/resume.  `rdrand`
+may be used in its positive form to override Xen's default behaviour on these
+systems, and make the feature fully usable.
 
 ### cpuid_mask_cpu
 > `= fam_0f_rev_[cdefg] | fam_10_rev_[bc] | fam_11_rev_b`
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jun 11 15:33:16 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 11 Jun 2020 15: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 1jjPCe-0003pd-Jf; Thu, 11 Jun 2020 15: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=As6z=7Y=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jjPCd-0003pV-HB
 for xen-changelog@lists.xenproject.org; Thu, 11 Jun 2020 15:33:15 +0000
X-Inumbo-ID: ddce6404-abf8-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id ddce6404-abf8-11ea-bca7-bc764e2007e4;
 Thu, 11 Jun 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=y6lVphRm/sXK0EIJZzqBolzzX0eLISfgu00lHoE2+zE=; b=gfhk4Mk137EmKxFF05I1O7NhQL
 CBzJKWuJ2JkF+VzvEQEeN89bMHBAFX2yld4nMPMHOAwB8/wTJ4cwsG4D+sVqoSk5VeT7L9Gc5Ri6h
 BqRqnh638IXTDJJ6ubcLP1qJXmxMMKc1lH139DQ31ZzrFuuMbkCuBCboioo2R/EwQelQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jjPCc-0007Ed-TY
 for xen-changelog@lists.xenproject.org; Thu, 11 Jun 2020 15:33:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jjPCc-0000hL-Sa
 for xen-changelog@lists.xenproject.org; Thu, 11 Jun 2020 15:33:14 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] x86/spec-ctrl: Update docs with SRBDS workaround
Message-Id: <E1jjPCc-0000hL-Sa@xenbits.xenproject.org>
Date: Thu, 11 Jun 2020 15: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 d8e1053bfa2726d122109d137fc6c489948b1c36
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 10 18:57:00 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jun 11 16:28:08 2020 +0100

    x86/spec-ctrl: Update docs with SRBDS workaround
    
    RDRAND/RDSEED can be hidden using cpuid= to mitigate SRBDS if microcode
    isn't available.
    
    This is part of XSA-320 / CVE-2020-0543.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    (cherry picked from commit 7028534d8482d25860c4d1aa8e45f0b911abfc5a)
---
 docs/misc/xen-command-line.pandoc | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index c780312531..81e12d053c 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -481,12 +481,18 @@ choice of `dom0-kernel` is deprecated and not supported by all Dom0 kernels.
 This option allows for fine tuning of the facilities Xen will use, after
 accounting for hardware capabilities as enumerated via CPUID.
 
+Unless otherwise noted, options only have any effect in their negative form,
+to hide the named feature(s).  Ignoring a feature using this mechanism will
+cause Xen not to use the feature, nor offer them as usable to guests.
+
 Currently accepted:
 
 The Speculation Control hardware features `srbds-ctrl`, `md-clear`, `ibrsb`,
 `stibp`, `ibpb`, `l1d-flush` and `ssbd` are used by default if available and
-applicable.  They can be ignored, e.g. `no-ibrsb`, at which point Xen won't
-use them itself, and won't offer them to guests.
+applicable.  They can all be ignored.
+
+`rdrand` and `rdseed` can be ignored, as a mitigation to XSA-320 /
+CVE-2020-0543.
 
 ### cpuid_mask_cpu
 > `= fam_0f_rev_[cdefg] | fam_10_rev_[bc] | fam_11_rev_b`
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Thu Jun 11 15:33:27 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 11 Jun 2020 15:33:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jjPCp-0003ql-LK; Thu, 11 Jun 2020 15:33: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=As6z=7Y=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jjPCo-0003qc-K0
 for xen-changelog@lists.xenproject.org; Thu, 11 Jun 2020 15:33:26 +0000
X-Inumbo-ID: e4185cca-abf8-11ea-b542-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id e4185cca-abf8-11ea-b542-12813bfff9fa;
 Thu, 11 Jun 2020 15: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=vtZ+d9/jyj8leoVsTXi5j+HEVZHJnvZ+fY94abTKXh0=; b=dSRdbiFTUVbeQ1MUqhyeVCvzn3
 eO0EZxXblD6vxYO2AgxTNiNbLW14l2s8Hw00BwaEgX2fxqCrgp7ji0YnZ76kkKCvlU4gj0ZqnGx+u
 uk3AxpHTnfwJmxUD760qQrTYOYjR3D+jRGNrrnFZjv2IGBpxBo4RpevWogQ6NkMvrQQY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jjPCn-0007En-E3
 for xen-changelog@lists.xenproject.org; Thu, 11 Jun 2020 15:33:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jjPCn-0000iX-D4
 for xen-changelog@lists.xenproject.org; Thu, 11 Jun 2020 15:33:25 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.12] x86/spec-ctrl: Allow the RDRAND/RDSEED features to
 be hidden
Message-Id: <E1jjPCn-0000iX-D4@xenbits.xenproject.org>
Date: Thu, 11 Jun 2020 15: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 d58c48df8c6ca819f5e6e6f1740bb114f24f024f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 10 18:57:00 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jun 11 16:28:04 2020 +0100

    x86/spec-ctrl: Allow the RDRAND/RDSEED features to be hidden
    
    RDRAND/RDSEED can be hidden using cpuid= to mitigate SRBDS if microcode
    isn't available.
    
    This is part of XSA-320 / CVE-2020-0543.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    (cherry picked from commit 7028534d8482d25860c4d1aa8e45f0b911abfc5a)
---
 docs/misc/xen-command-line.pandoc | 10 ++++++++--
 xen/arch/x86/cpuid.c              | 10 ++++++++++
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 337fbf0492..7897da55ca 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -481,12 +481,18 @@ choice of `dom0-kernel` is deprecated and not supported by all Dom0 kernels.
 This option allows for fine tuning of the facilities Xen will use, after
 accounting for hardware capabilities as enumerated via CPUID.
 
+Unless otherwise noted, options only have any effect in their negative form,
+to hide the named feature(s).  Ignoring a feature using this mechanism will
+cause Xen not to use the feature, nor offer them as usable to guests.
+
 Currently accepted:
 
 The Speculation Control hardware features `srbds-ctrl`, `md-clear`, `ibrsb`,
 `stibp`, `ibpb`, `l1d-flush` and `ssbd` are used by default if available and
-applicable.  They can be ignored, e.g. `no-ibrsb`, at which point Xen won't
-use them itself, and won't offer them to guests.
+applicable.  They can all be ignored.
+
+`rdrand` and `rdseed` can be ignored, as a mitigation to XSA-320 /
+CVE-2020-0543.
 
 ### cpuid_mask_cpu
 > `= fam_0f_rev_[cdefg] | fam_10_rev_[bc] | fam_11_rev_b`
diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 22d8c71a95..d07567c901 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -64,6 +64,16 @@ static int __init parse_xen_cpuid(const char *s)
             if ( !val )
                 setup_clear_cpu_cap(X86_FEATURE_SRBDS_CTRL);
         }
+        else if ( (val = parse_boolean("rdrand", s, ss)) >= 0 )
+        {
+            if ( !val )
+                setup_clear_cpu_cap(X86_FEATURE_RDRAND);
+        }
+        else if ( (val = parse_boolean("rdseed", s, ss)) >= 0 )
+        {
+            if ( !val )
+                setup_clear_cpu_cap(X86_FEATURE_RDSEED);
+        }
         else
             rc = -EINVAL;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Thu Jun 11 15:33:37 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 11 Jun 2020 15:33:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jjPCz-0003rp-Mu; Thu, 11 Jun 2020 15:33: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=As6z=7Y=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jjPCy-0003rg-Kp
 for xen-changelog@lists.xenproject.org; Thu, 11 Jun 2020 15:33:36 +0000
X-Inumbo-ID: ea5d8aec-abf8-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id ea5d8aec-abf8-11ea-bca7-bc764e2007e4;
 Thu, 11 Jun 2020 15:33:36 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=boBtcs7fwq8pYx5I6EHmUUKmI5MTuJTKfNs6PuS5usk=; b=R9ehjt4fgZcPM1f5RyrvGPs/im
 eEq6MPumI6PHczjj1D8rd7diYJzI5+jqgxQ2K0Q+H4hqdGaNWI6VBi5sfifI6IBHsJe4RUhfLnwD7
 nSYaFxlCD2sRKLqGyAOwkTM7fUH33W7alxEjdgJAr7S1nOtH84Vbt7OzHI0En8iIGZY4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jjPCx-0007FN-Ui
 for xen-changelog@lists.xenproject.org; Thu, 11 Jun 2020 15:33:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jjPCx-0000jV-Tb
 for xen-changelog@lists.xenproject.org; Thu, 11 Jun 2020 15:33:35 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.11] x86/spec-ctrl: Allow the RDRAND/RDSEED features to
 be hidden
Message-Id: <E1jjPCx-0000jV-Tb@xenbits.xenproject.org>
Date: Thu, 11 Jun 2020 15: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 2b77729888fb851ab96e7f77bc854122626b4861
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 10 18:57:00 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jun 11 16:27:59 2020 +0100

    x86/spec-ctrl: Allow the RDRAND/RDSEED features to be hidden
    
    RDRAND/RDSEED can be hidden using cpuid= to mitigate SRBDS if microcode
    isn't available.
    
    This is part of XSA-320 / CVE-2020-0543.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    (cherry picked from commit 7028534d8482d25860c4d1aa8e45f0b911abfc5a)
---
 docs/misc/xen-command-line.markdown | 10 ++++++++--
 xen/arch/x86/cpuid.c                | 10 ++++++++++
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown
index 3356e59fee..ac397e7de0 100644
--- a/docs/misc/xen-command-line.markdown
+++ b/docs/misc/xen-command-line.markdown
@@ -487,12 +487,18 @@ choice of `dom0-kernel` is deprecated and not supported by all Dom0 kernels.
 This option allows for fine tuning of the facilities Xen will use, after
 accounting for hardware capabilities as enumerated via CPUID.
 
+Unless otherwise noted, options only have any effect in their negative form,
+to hide the named feature(s).  Ignoring a feature using this mechanism will
+cause Xen not to use the feature, nor offer them as usable to guests.
+
 Currently accepted:
 
 The Speculation Control hardware features `srbds-ctrl`, `md-clear`, `ibrsb`,
 `stibp`, `ibpb`, `l1d-flush` and `ssbd` are used by default if available and
-applicable.  They can be ignored, e.g. `no-ibrsb`, at which point Xen won't
-use them itself, and won't offer them to guests.
+applicable.  They can all be ignored.
+
+`rdrand` and `rdseed` can be ignored, as a mitigation to XSA-320 /
+CVE-2020-0543.
 
 ### cpuid\_mask\_cpu (AMD only)
 > `= fam_0f_rev_c | fam_0f_rev_d | fam_0f_rev_e | fam_0f_rev_f | fam_0f_rev_g | fam_10_rev_b | fam_10_rev_c | fam_11_rev_b`
diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index b8e5b6fe67..78d08dbb32 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -63,6 +63,16 @@ static int __init parse_xen_cpuid(const char *s)
             if ( !val )
                 setup_clear_cpu_cap(X86_FEATURE_SRBDS_CTRL);
         }
+        else if ( (val = parse_boolean("rdrand", s, ss)) >= 0 )
+        {
+            if ( !val )
+                setup_clear_cpu_cap(X86_FEATURE_RDRAND);
+        }
+        else if ( (val = parse_boolean("rdseed", s, ss)) >= 0 )
+        {
+            if ( !val )
+                setup_clear_cpu_cap(X86_FEATURE_RDSEED);
+        }
         else
             rc = -EINVAL;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.11


From xen-changelog-bounces@lists.xenproject.org Thu Jun 11 15:33:48 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 11 Jun 2020 15:33: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 1jjPDA-0003sw-OX; Thu, 11 Jun 2020 15:33: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=As6z=7Y=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jjPD9-0003sm-Aw
 for xen-changelog@lists.xenproject.org; Thu, 11 Jun 2020 15:33:47 +0000
X-Inumbo-ID: efbce975-abf8-11ea-b542-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id efbce975-abf8-11ea-b542-12813bfff9fa;
 Thu, 11 Jun 2020 15:33: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=PkiILRApeuVd5y6Vy4SzEW+CZhgkEQz+mVCWJnX1HOU=; b=rfCW2xNZJWu7GvtHLDMez8j7ME
 FkiXR5TTKk3k1qcsR0BOvMl3Z0vg3lboh0mzGDCdiK7kATEYhNjyplUze0NcMVWf10Pdmx9RYjskK
 kseUpF9UCQRtTxbUTim8Lq7vs8OJ8NVSsfJ2R709+qfAOncvkHA18WfLYYKdBDl1ngbs=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jjPD8-0007FX-Ey
 for xen-changelog@lists.xenproject.org; Thu, 11 Jun 2020 15:33:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jjPD8-0000ka-E2
 for xen-changelog@lists.xenproject.org; Thu, 11 Jun 2020 15:33:46 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.10] x86/spec-ctrl: Allow the RDRAND/RDSEED features to
 be hidden
Message-Id: <E1jjPD8-0000ka-E2@xenbits.xenproject.org>
Date: Thu, 11 Jun 2020 15:33: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 ce056837082da7b2759a069045e480638094adcd
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 10 18:57:00 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jun 11 16:27:53 2020 +0100

    x86/spec-ctrl: Allow the RDRAND/RDSEED features to be hidden
    
    RDRAND/RDSEED can be hidden using cpuid= to mitigate SRBDS if microcode
    isn't available.
    
    This is part of XSA-320 / CVE-2020-0543.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    (cherry picked from commit 7028534d8482d25860c4d1aa8e45f0b911abfc5a)
---
 docs/misc/xen-command-line.markdown | 10 ++++++++--
 xen/arch/x86/cpuid.c                | 10 ++++++++++
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown
index b96f93c95e..aae80e82b6 100644
--- a/docs/misc/xen-command-line.markdown
+++ b/docs/misc/xen-command-line.markdown
@@ -494,12 +494,18 @@ choice of `dom0-kernel` is deprecated and not supported by all Dom0 kernels.
 This option allows for fine tuning of the facilities Xen will use, after
 accounting for hardware capabilities as enumerated via CPUID.
 
+Unless otherwise noted, options only have any effect in their negative form,
+to hide the named feature(s).  Ignoring a feature using this mechanism will
+cause Xen not to use the feature, nor offer them as usable to guests.
+
 Currently accepted:
 
 The Speculation Control hardware features `srbds-ctrl`, `md-clear`, `ibrsb`,
 `stibp`, `ibpb`, `l1d-flush` and `ssbd` are used by default if available and
-applicable.  They can be ignored, e.g. `no-ibrsb`, at which point Xen won't
-use them itself, and won't offer them to guests.
+applicable.  They can all be ignored.
+
+`rdrand` and `rdseed` can be ignored, as a mitigation to XSA-320 /
+CVE-2020-0543.
 
 ### cpuid\_mask\_cpu (AMD only)
 > `= fam_0f_rev_c | fam_0f_rev_d | fam_0f_rev_e | fam_0f_rev_f | fam_0f_rev_g | fam_10_rev_b | fam_10_rev_c | fam_11_rev_b`
diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 67a2a2e6a0..b5bef83d70 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -63,6 +63,16 @@ static int __init parse_xen_cpuid(const char *s)
             if ( !val )
                 setup_clear_cpu_cap(X86_FEATURE_SRBDS_CTRL);
         }
+        else if ( (val = parse_boolean("rdrand", s, ss)) >= 0 )
+        {
+            if ( !val )
+                setup_clear_cpu_cap(X86_FEATURE_RDRAND);
+        }
+        else if ( (val = parse_boolean("rdseed", s, ss)) >= 0 )
+        {
+            if ( !val )
+                setup_clear_cpu_cap(X86_FEATURE_RDSEED);
+        }
         else
             rc = -EINVAL;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.10


From xen-changelog-bounces@lists.xenproject.org Thu Jun 11 15:33:58 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 11 Jun 2020 15:33: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 1jjPDK-0003tw-QF; Thu, 11 Jun 2020 15:33: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=As6z=7Y=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jjPDJ-0003tn-Ps
 for xen-changelog@lists.xenproject.org; Thu, 11 Jun 2020 15:33:57 +0000
X-Inumbo-ID: f6e652d0-abf8-11ea-b542-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id f6e652d0-abf8-11ea-b542-12813bfff9fa;
 Thu, 11 Jun 2020 15:33: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=YEgwXQxazq7WxyT5p0Cg5Wk3RAz57k70br8i7FL5XNE=; b=EPZgdPLsRTYMed5VjjJ7orsAtz
 mAmFqKIJN13j3XXFrbjUyAdsBdHDMUJtiQ5o07aeIcQvw0OtVw6tuxP6jTJreyDjujv/0xSQcg4tJ
 QR/qooic/OY81cqNnj9KY6RA08FsxMiLN+v/pMGqmYI+aiJZLdh5qw1EV1GbTxlbzJtM=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jjPDI-0007Ff-W8
 for xen-changelog@lists.xenproject.org; Thu, 11 Jun 2020 15:33:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jjPDI-0000lY-VJ
 for xen-changelog@lists.xenproject.org; Thu, 11 Jun 2020 15:33:56 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.9] x86/spec-ctrl: Allow the RDRAND/RDSEED features to
 be hidden
Message-Id: <E1jjPDI-0000lY-VJ@xenbits.xenproject.org>
Date: Thu, 11 Jun 2020 15:33: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 80d78acf9e60ae6a88d6cb6f3535eaf67c81f61c
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 10 18:57:00 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jun 11 16:27:47 2020 +0100

    x86/spec-ctrl: Allow the RDRAND/RDSEED features to be hidden
    
    RDRAND/RDSEED can be hidden using cpuid= to mitigate SRBDS if microcode
    isn't available.
    
    Extend libxl's table of named parameters to include RDRAND/RDSEED, and
    have the compiler construct it in .rodata, rather than on the stack at runtime
    each time it is called.
    
    This is part of XSA-320 / CVE-2020-0543.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    (cherry picked from commit 7028534d8482d25860c4d1aa8e45f0b911abfc5a)
---
 docs/misc/xen-command-line.markdown | 10 ++++++++--
 tools/libxl/libxl_cpuid.c           |  6 ++++--
 xen/arch/x86/cpuid.c                | 10 ++++++++++
 3 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown
index 4b34eefeb5..44a5a911c0 100644
--- a/docs/misc/xen-command-line.markdown
+++ b/docs/misc/xen-command-line.markdown
@@ -454,12 +454,18 @@ choice of `dom0-kernel` is deprecated and not supported by all Dom0 kernels.
 This option allows for fine tuning of the facilities Xen will use, after
 accounting for hardware capabilities as enumerated via CPUID.
 
+Unless otherwise noted, options only have any effect in their negative form,
+to hide the named feature(s).  Ignoring a feature using this mechanism will
+cause Xen not to use the feature, nor offer them as usable to guests.
+
 Currently accepted:
 
 The Speculation Control hardware features `srbds-ctrl`, `md-clear`, `ibrsb`,
 `stibp`, `ibpb`, `l1d-flush` and `ssbd` are used by default if available and
-applicable.  They can be ignored, e.g. `no-ibrsb`, at which point Xen won't
-use them itself, and won't offer them to guests.
+applicable.  They can all be ignored.
+
+`rdrand` and `rdseed` can be ignored, as a mitigation to XSA-320 /
+CVE-2020-0543.
 
 ### cpuid\_mask\_cpu (AMD only)
 > `= fam_0f_rev_c | fam_0f_rev_d | fam_0f_rev_e | fam_0f_rev_f | fam_0f_rev_g | fam_10_rev_b | fam_10_rev_c | fam_11_rev_b`
diff --git a/tools/libxl/libxl_cpuid.c b/tools/libxl/libxl_cpuid.c
index 5a2c67fcac..ea2e708c47 100644
--- a/tools/libxl/libxl_cpuid.c
+++ b/tools/libxl/libxl_cpuid.c
@@ -89,7 +89,7 @@ static libxl_cpuid_policy_list cpuid_find_match(libxl_cpuid_policy_list *list,
 int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
 {
 #define NA XEN_CPUID_INPUT_UNUSED
-    struct cpuid_flags cpuid_flags[] = {
+    static const struct cpuid_flags cpuid_flags[] = {
         {"maxleaf",      0x00000000, NA, CPUID_REG_EAX,  0, 32},
       /* the following two entries are subject to tweaking later in the code */
         {"family",       0x00000001, NA, CPUID_REG_EAX,  8,  8},
@@ -100,6 +100,7 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
         {"clflush",      0x00000001, NA, CPUID_REG_EBX,  8,  8},
         {"brandid",      0x00000001, NA, CPUID_REG_EBX,  0,  8},
         {"hypervisor",   0x00000001, NA, CPUID_REG_ECX, 31,  1},
+        {"rdrand",       0x00000001, NA, CPUID_REG_ECX, 30,  1},
         {"f16c",         0x00000001, NA, CPUID_REG_ECX, 29,  1},
         {"avx",          0x00000001, NA, CPUID_REG_ECX, 28,  1},
         {"osxsave",      0x00000001, NA, CPUID_REG_ECX, 27,  1},
@@ -160,6 +161,7 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
         {"fpu",          0x00000001, NA, CPUID_REG_EDX,  0,  1},
         {"srbds-ctrl",   0x00000007,  0, CPUID_REG_EDX,  9,  1},
         {"md-clear",     0x00000007,  0, CPUID_REG_EDX, 10,  1},
+        {"rdseed",       0x00000007,  0, CPUID_REG_EBX, 18,  1},
         {"ibrsb",        0x00000007,  0, CPUID_REG_EDX, 26,  1},
         {"stibp",        0x00000007,  0, CPUID_REG_EDX, 27,  1},
         {"l1d-flush",    0x00000007,  0, CPUID_REG_EDX, 28,  1},
@@ -211,7 +213,7 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
 #undef NA
     char *sep, *val, *endptr;
     int i;
-    struct cpuid_flags *flag;
+    const struct cpuid_flags *flag;
     struct libxl__cpuid_policy *entry;
     unsigned long num;
     char flags[33], *resstr;
diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index b4988ba527..8fb98c1dad 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -63,6 +63,16 @@ static int __init parse_xen_cpuid(const char *s)
             if ( !val )
                 setup_clear_cpu_cap(X86_FEATURE_SRBDS_CTRL);
         }
+        else if ( (val = parse_boolean("rdrand", s, ss)) >= 0 )
+        {
+            if ( !val )
+                setup_clear_cpu_cap(X86_FEATURE_RDRAND);
+        }
+        else if ( (val = parse_boolean("rdseed", s, ss)) >= 0 )
+        {
+            if ( !val )
+                setup_clear_cpu_cap(X86_FEATURE_RDSEED);
+        }
         else
             rc = -EINVAL;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.9


From xen-changelog-bounces@lists.xenproject.org Thu Jun 11 17:11:16 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 11 Jun 2020 17:11:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jjQjQ-0004XC-5c; Thu, 11 Jun 2020 17:11: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=As6z=7Y=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jjQjO-0004X7-Fc
 for xen-changelog@lists.xenproject.org; Thu, 11 Jun 2020 17:11:10 +0000
X-Inumbo-ID: 889352d4-ac06-11ea-b54c-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 889352d4-ac06-11ea-b54c-12813bfff9fa;
 Thu, 11 Jun 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=v29MDkdvji1ZEbcCtShhP5QxUobdjhv+Bw/dD6UZQLs=; b=hv9Ef0WeKMe1+qkLm/0+R4zxUt
 TU5JpReJ0unJ4QOaJZXCcXaaYIeXxGw9IKQ/BDLr9DTd/eLZv2aZ+J4WJTCncpEvEuN5km3Tt1znH
 Ii34x2uL7OD1tKZD9Zzu5C8o8qNHqxMisUNjaPAfaOqr5PiWBucDf7PJfN47h2ve4NVc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jjQjI-00019v-QF
 for xen-changelog@lists.xenproject.org; Thu, 11 Jun 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 1jjQjI-0002nz-P7
 for xen-changelog@lists.xenproject.org; Thu, 11 Jun 2020 17:11:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] tools/libxengnttab: correct size of allocated memory
Message-Id: <E1jjQjI-0002nz-P7@xenbits.xenproject.org>
Date: Thu, 11 Jun 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 aad20e538d7ba0e36f5ed8d2bebb74096e3a6d7f
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed May 20 10:35:01 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jun 11 17:13:20 2020 +0100

    tools/libxengnttab: correct size of allocated memory
    
    The size of the memory allocated for the IOCTL_GNTDEV_MAP_GRANT_REF
    ioctl() parameters is calculated wrong, which results in too much
    memory allocated.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/libs/gnttab/freebsd.c | 2 +-
 tools/libs/gnttab/linux.c   | 8 +++-----
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/tools/libs/gnttab/freebsd.c b/tools/libs/gnttab/freebsd.c
index 886b588303..0588501d0f 100644
--- a/tools/libs/gnttab/freebsd.c
+++ b/tools/libs/gnttab/freebsd.c
@@ -74,7 +74,7 @@ void *osdep_gnttab_grant_map(xengnttab_handle *xgt,
     void *addr = NULL;
     int domids_stride;
     unsigned int refs_size = ROUNDUP(count *
-                                     sizeof(struct ioctl_gntdev_map_grant_ref),
+                                     sizeof(struct ioctl_gntdev_grant_ref),
                                      PAGE_SHIFT);
 
     domids_stride = (flags & XENGNTTAB_GRANT_MAP_SINGLE_DOMAIN) ? 0 : 1;
diff --git a/tools/libs/gnttab/linux.c b/tools/libs/gnttab/linux.c
index a01bb6c698..74331a4c7b 100644
--- a/tools/libs/gnttab/linux.c
+++ b/tools/libs/gnttab/linux.c
@@ -91,9 +91,7 @@ void *osdep_gnttab_grant_map(xengnttab_handle *xgt,
 {
     int fd = xgt->fd;
     struct ioctl_gntdev_map_grant_ref *map;
-    unsigned int map_size = ROUNDUP((sizeof(*map) + (count - 1) *
-                                    sizeof(struct ioctl_gntdev_map_grant_ref)),
-                                    PAGE_SHIFT);
+    unsigned int map_size = sizeof(*map) + (count - 1) * sizeof(map->refs[0]);
     void *addr = NULL;
     int domids_stride = 1;
     int i;
@@ -102,10 +100,10 @@ void *osdep_gnttab_grant_map(xengnttab_handle *xgt,
         domids_stride = 0;
 
     if ( map_size <= PAGE_SIZE )
-        map = alloca(sizeof(*map) +
-                     (count - 1) * sizeof(struct ioctl_gntdev_map_grant_ref));
+        map = alloca(map_size);
     else
     {
+        map_size = ROUNDUP(map_size, PAGE_SHIFT);
         map = mmap(NULL, map_size, PROT_READ | PROT_WRITE,
                    MAP_PRIVATE | MAP_ANON | MAP_POPULATE, -1, 0);
         if ( map == MAP_FAILED )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jun 11 17:11:18 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 11 Jun 2020 17: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 1jjQjW-0004Y2-72; Thu, 11 Jun 2020 17: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=As6z=7Y=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jjQjU-0004XI-Dv
 for xen-changelog@lists.xenproject.org; Thu, 11 Jun 2020 17:11:16 +0000
X-Inumbo-ID: 8e95c414-ac06-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 8e95c414-ac06-11ea-bb8b-bc764e2007e4;
 Thu, 11 Jun 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=yHtBOSqoZ7nuw0P/WUv3PJbepzEXGa6EoTaGGQTxXkA=; b=3QbgboagzurCrwlrjO9uFcalyd
 q162sZbg2wKt6yJZiF94/VZXP6kfeXsZ+NOzKlSJmNdLcHJUix13F0d/fs3DyLcHy/pIuMnPg+zy9
 BCuvl6Gh//hyYc5OfPcH2pUpXTg6H8ITFHfjjXpl/IgpCiwOiB7Uh5sISFpBnu4AUbSM=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jjQjS-00019y-TZ
 for xen-changelog@lists.xenproject.org; Thu, 11 Jun 2020 17:11:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jjQjS-0002pO-SR
 for xen-changelog@lists.xenproject.org; Thu, 11 Jun 2020 17:11:14 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] docs: Minor build improvements
Message-Id: <E1jjQjS-0002pO-SR@xenbits.xenproject.org>
Date: Thu, 11 Jun 2020 17: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 10ea4e417b4655f3550b6e9645f7f2bad08dba13
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Jun 8 18:12:44 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jun 11 17:19:26 2020 +0100

    docs: Minor build improvements
    
    Don't use "set -x" for the figs rule.  It doesn't take effect in the recursive
    make environment.
    
    Turn the HTML manpage comments into makefile comments, not shell comments.
    This saves 3x shell invocations per manpage.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 docs/Makefile | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/docs/Makefile b/docs/Makefile
index 3eae2dae60..8de1efb6f5 100644
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -58,7 +58,7 @@ txt: $(DOC_TXT)
 .PHONY: figs
 figs:
 ifneq ($(FIG2DEV),)
-	set -x; $(MAKE) -C figs
+	$(MAKE) -C figs
 else
 	@echo "fig2dev (transfig) not installed; skipping figs."
 endif
@@ -105,12 +105,12 @@ else
 endif
 
 # HTML manpages
+# sed used to fix up links between man-pages
+# 1) L<xl(1)> -> L<xl(1)|relative:xl.1.html>
+# 2) <a href="relative:xl.1.html"> -> <a href="xl.1.html">
 html/man/%.$(1).html: man/%.$(1).pod Makefile
 ifneq ($(POD2HTML),)
 	@$(INSTALL_DIR) $$(@D)
-	# Fix up links between man-pages
-	# 1) L<xl(1)> -> L<xl(1)|relative:xl.1.html>
-	# 2) <a href="relative:xl.1.html"> -> <a href="xl.1.html">
 	sed -r -e 's%L<([^>]+)\(([1-9])\)>%L<\1(\2)|relative:\1.\2.html>%g' $$< | \
 		$(POD2HTML) | \
 		sed -r -e 's%( href=")relative:%\1%g' > $$@
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jun 11 17:22:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 11 Jun 2020 17: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 1jjQtz-0005TY-9f; Thu, 11 Jun 2020 17: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=As6z=7Y=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jjQtx-0005TT-TP
 for xen-changelog@lists.xenproject.org; Thu, 11 Jun 2020 17:22:06 +0000
X-Inumbo-ID: 11a262d0-ac08-11ea-b54c-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 11a262d0-ac08-11ea-b54c-12813bfff9fa;
 Thu, 11 Jun 2020 17: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=FsaA5Q+8V0Kk7Vl74HQ3CVHdTneTv4IWgQ1VT8q/szE=; b=XupSrWBzOt43m+2hM/vHMhoucT
 UVnGtgYddb49kjAmy2FiwOFwgaN48Qpqt0yCv3Pljp8VKRCSrTlWA7HfWR9iZiUcgsrgemF7Pa61k
 MyfnMe9TgX/B2wyDxXcCwBoXumWs4mGQ8OPCSjllIWEk4fU5un5tbFNLpBFqBgkibJFk=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jjQtw-0001M4-9Z
 for xen-changelog@lists.xenproject.org; Thu, 11 Jun 2020 17:22:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jjQtw-0003hf-8U
 for xen-changelog@lists.xenproject.org; Thu, 11 Jun 2020 17:22:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] CHANGELOG: add 'domid_policy' and domid preservation on
 migrate
Message-Id: <E1jjQtw-0003hf-8U@xenbits.xenproject.org>
Date: Thu, 11 Jun 2020 17: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 b87dd7bb3946c6a18f4c3f622ce7e77a3deb9f17
Author:     Paul Durrant <pdurrant@amazon.com>
AuthorDate: Tue Jun 9 17:29:21 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jun 11 18:12:22 2020 +0100

    CHANGELOG: add 'domid_policy' and domid preservation on migrate
    
    Signed-off-by: Paul Durrant <pdurrant@amazon.com>
    Acked-by: George Dunlap <george.dunlap@citrix.com>
---
 CHANGELOG.md | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8786c51cb4..cb1566ea5b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -18,6 +18,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Initial support to run on Hyper-V.
  - Initial hypervisor file system (hypfs) support.
  - libxl support for running qemu-xen device model in a linux stubdomain.
+ - New 'domid_policy', allowing domain-ids to be randomly chosen.
+ - Option to preserve domain-id across migrate or save+restore.
 
 ## [4.13.0](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.13.0) - 2019-12-17
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jun 11 17:22:15 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 11 Jun 2020 17: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 1jjQu7-0005UF-B4; Thu, 11 Jun 2020 17:22: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=As6z=7Y=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jjQu7-0005U9-1c
 for xen-changelog@lists.xenproject.org; Thu, 11 Jun 2020 17:22:15 +0000
X-Inumbo-ID: 17a6fa6a-ac08-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 17a6fa6a-ac08-11ea-b7bb-bc764e2007e4;
 Thu, 11 Jun 2020 17: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=z7qgs9Q+hVBgX0ow95q7VdW6/aQjLOuLYe7EI1FMvKc=; b=4EV4lbdRglvKe7Xu6rAc0hyzRC
 8/rg5iItk4M2Z81n+Nqh68zwygHMDWptVUZhEP/7sIgKsP+kFwE0UHKH2UH4e11NheFAXB8M234Ox
 9vu2Q2J1eoVXn4daF47eY2OWwpRG2vESR/TUG5Ab4sEA1Hi1WSZ2NwOg7srd7ly0+wCE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jjQu6-0001MA-Cb
 for xen-changelog@lists.xenproject.org; Thu, 11 Jun 2020 17:22:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jjQu6-0003iT-Bd
 for xen-changelog@lists.xenproject.org; Thu, 11 Jun 2020 17:22:14 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] CHANGELOG: add revised kdd handshake (supporting
 Windows 7, 8, and 10)
Message-Id: <E1jjQu6-0003iT-Bd@xenbits.xenproject.org>
Date: Thu, 11 Jun 2020 17: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 3664f7b7788b66bb802432e6748be0fb57993581
Author:     Paul Durrant <pdurrant@amazon.com>
AuthorDate: Tue Jun 9 17:29:22 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jun 11 18:12:22 2020 +0100

    CHANGELOG: add revised kdd handshake (supporting Windows 7, 8, and 10)
    
    Signed-off-by: Paul Durrant <pdurrant@amazon.com>
    Acked-by: George Dunlap <george.dunlap@citrix.com>
---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index cb1566ea5b..43fd260156 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -20,6 +20,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - libxl support for running qemu-xen device model in a linux stubdomain.
  - New 'domid_policy', allowing domain-ids to be randomly chosen.
  - Option to preserve domain-id across migrate or save+restore.
+ - Support in kdd for initial KD protocol handshake for Win 7, 8 and 10 (64 bit).
 
 ## [4.13.0](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.13.0) - 2019-12-17
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jun 11 21:22:12 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 11 Jun 2020 21: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 1jjUeG-0000M4-61; Thu, 11 Jun 2020 21: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=As6z=7Y=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jjUeF-0000Lz-20
 for xen-changelog@lists.xenproject.org; Thu, 11 Jun 2020 21:22:07 +0000
X-Inumbo-ID: 9945a38e-ac29-11ea-b57b-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 9945a38e-ac29-11ea-b57b-12813bfff9fa;
 Thu, 11 Jun 2020 21: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=XQkAAo89JeDk4E7rxyQOGd3apxnm68OXkgQGtMNSm38=; b=XK6NeSSODJzmftfAPtTnfoxc2g
 IJHfT5P+aITZromkpPIQ9p7QBNKwJVwlBFNBMLehP4mzUAnOhA/PWtn8h8fjUwRtVklp3tg9m3Awf
 HXpu/CgO3w2fU57P+oTFE1lSO1KMEziUhHOq0rY2LR3xT089t5HvGvwmHJ2/7kZWqe5U=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jjUeD-0005qq-71
 for xen-changelog@lists.xenproject.org; Thu, 11 Jun 2020 21:22:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jjUeD-0006j6-5w
 for xen-changelog@lists.xenproject.org; Thu, 11 Jun 2020 21:22:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/passthrough: do not assert edge triggered GSIs for
 PVH dom0
Message-Id: <E1jjUeD-0006j6-5w@xenbits.xenproject.org>
Date: Thu, 11 Jun 2020 21: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 6fa25d568f4e597b1940309d97cfd98f4f6eecd6
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Wed Jun 10 16:29:22 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jun 11 18:14:29 2020 +0100

    x86/passthrough: do not assert edge triggered GSIs for PVH dom0
    
    Edge triggered interrupts do not assert the line, so the handling done
    in Xen should also avoid asserting it. Asserting the line prevents
    further edge triggered interrupts on the same vIO-APIC pin from being
    delivered, since the line is not de-asserted.
    
    One case of such kind of interrupt is the RTC timer, which is edge
    triggered and available to a PVH dom0. Note this should not affect
    domUs, as it only modifies the behavior of IDENTITY_GSI kind of passed
    through interrupts.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/arch/x86/hvm/irq.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/hvm/irq.c b/xen/arch/x86/hvm/irq.c
index 9c8adbc495..fd02cf2e8d 100644
--- a/xen/arch/x86/hvm/irq.c
+++ b/xen/arch/x86/hvm/irq.c
@@ -169,9 +169,10 @@ void hvm_pci_intx_deassert(
 
 void hvm_gsi_assert(struct domain *d, unsigned int gsi)
 {
+    int trig = vioapic_get_trigger_mode(d, gsi);
     struct hvm_irq *hvm_irq = hvm_domain_irq(d);
 
-    if ( gsi >= hvm_irq->nr_gsis )
+    if ( gsi >= hvm_irq->nr_gsis || trig < 0 )
     {
         ASSERT_UNREACHABLE();
         return;
@@ -186,9 +187,10 @@ void hvm_gsi_assert(struct domain *d, unsigned int gsi)
      * to know if the GSI is pending or not.
      */
     spin_lock(&d->arch.hvm.irq_lock);
-    if ( !hvm_irq->gsi_assert_count[gsi] )
+    if ( trig == VIOAPIC_EDGE_TRIG || !hvm_irq->gsi_assert_count[gsi] )
     {
-        hvm_irq->gsi_assert_count[gsi] = 1;
+        if ( trig == VIOAPIC_LEVEL_TRIG )
+            hvm_irq->gsi_assert_count[gsi] = 1;
         assert_gsi(d, gsi);
     }
     spin_unlock(&d->arch.hvm.irq_lock);
@@ -196,11 +198,12 @@ void hvm_gsi_assert(struct domain *d, unsigned int gsi)
 
 void hvm_gsi_deassert(struct domain *d, unsigned int gsi)
 {
+    int trig = vioapic_get_trigger_mode(d, gsi);
     struct hvm_irq *hvm_irq = hvm_domain_irq(d);
 
-    if ( gsi >= hvm_irq->nr_gsis )
+    if ( trig <= VIOAPIC_EDGE_TRIG || gsi >= hvm_irq->nr_gsis )
     {
-        ASSERT_UNREACHABLE();
+        ASSERT(trig == VIOAPIC_EDGE_TRIG && gsi < hvm_irq->nr_gsis);
         return;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jun 11 21:22:21 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 11 Jun 2020 21:22:21 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jjUeT-0000N8-7n; Thu, 11 Jun 2020 21:22:21 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=As6z=7Y=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jjUeS-0000N1-9G
 for xen-changelog@lists.xenproject.org; Thu, 11 Jun 2020 21:22:20 +0000
X-Inumbo-ID: 9f468abe-ac29-11ea-b57b-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 9f468abe-ac29-11ea-b57b-12813bfff9fa;
 Thu, 11 Jun 2020 21: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=duhbTWtG+WMnxDUlk5Rd5a6i7viYxLvNM6Z0x2dHH28=; b=y7ijbrgvGzIQQNKedqODde9CAl
 dq2aNKNrPvXzBcnY85tb9IFApnU2QjevQPrMLe4mdgTqc+rRS5IuXzFQ7qVMajzhDt2rxOjYjgpZw
 YD+6o7uWVnWFIzDTUDTYuDL7q7eDutSTTufMKdwXdHjlbcbRbmGH8QjoY6QI2bf3dFvI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jjUeN-0005qw-AV
 for xen-changelog@lists.xenproject.org; Thu, 11 Jun 2020 21:22:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jjUeN-0006lF-9M
 for xen-changelog@lists.xenproject.org; Thu, 11 Jun 2020 21:22:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/passthrough: introduce a flag for GSIs not
 requiring an EOI or unmask
Message-Id: <E1jjUeN-0006lF-9M@xenbits.xenproject.org>
Date: Thu, 11 Jun 2020 21: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 2995d0afdf2d3fb44d07eada088db3613741db1e
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Wed Jun 10 16:29:23 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jun 11 18:14:29 2020 +0100

    x86/passthrough: introduce a flag for GSIs not requiring an EOI or unmask
    
    There's no need to setup a timer for GSIs that are edge triggered,
    since those don't require any EIO or unmask, and hence couldn't block
    other interrupts.
    
    Note this is only used by PVH dom0, that can setup the passthrough of
    edge triggered interrupts from the vIO-APIC. One example of such kind
    of interrupt that can be used by a PVH dom0 would be the RTC timer.
    
    While there introduce an out label to do the unlock and reduce code
    duplication.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/drivers/passthrough/io.c  | 24 +++++++++++++++---------
 xen/include/asm-x86/hvm/irq.h |  2 ++
 2 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/xen/drivers/passthrough/io.c b/xen/drivers/passthrough/io.c
index b292e79382..6b1305a3e5 100644
--- a/xen/drivers/passthrough/io.c
+++ b/xen/drivers/passthrough/io.c
@@ -138,7 +138,8 @@ static void pt_pirq_softirq_reset(struct hvm_pirq_dpci *pirq_dpci)
 
 bool pt_irq_need_timer(uint32_t flags)
 {
-    return !(flags & (HVM_IRQ_DPCI_GUEST_MSI | HVM_IRQ_DPCI_TRANSLATE));
+    return !(flags & (HVM_IRQ_DPCI_GUEST_MSI | HVM_IRQ_DPCI_TRANSLATE |
+                      HVM_IRQ_DPCI_NO_EOI));
 }
 
 static int pt_irq_guest_eoi(struct domain *d, struct hvm_pirq_dpci *pirq_dpci,
@@ -558,6 +559,12 @@ int pt_irq_create_bind(
                      */
                     ASSERT(!mask);
                     share = trigger_mode;
+                    if ( trigger_mode == VIOAPIC_EDGE_TRIG )
+                        /*
+                         * Edge IO-APIC interrupt, no EOI or unmask to perform
+                         * and hence no timer needed.
+                         */
+                        pirq_dpci->flags |= HVM_IRQ_DPCI_NO_EOI;
                 }
             }
 
@@ -897,17 +904,13 @@ static void hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci)
             send_guest_pirq(d, pirq);
 
             if ( pirq_dpci->flags & HVM_IRQ_DPCI_GUEST_MSI )
-            {
-                spin_unlock(&d->event_lock);
-                return;
-            }
+                goto out;
         }
 
         if ( pirq_dpci->flags & HVM_IRQ_DPCI_GUEST_MSI )
         {
             vmsi_deliver_pirq(d, pirq_dpci);
-            spin_unlock(&d->event_lock);
-            return;
+            goto out;
         }
 
         list_for_each_entry ( digl, &pirq_dpci->digl_list, list )
@@ -920,6 +923,8 @@ static void hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci)
         if ( pirq_dpci->flags & HVM_IRQ_DPCI_IDENTITY_GSI )
         {
             hvm_gsi_assert(d, pirq->pirq);
+            if ( pirq_dpci->flags & HVM_IRQ_DPCI_NO_EOI )
+                goto out;
             pirq_dpci->pending++;
         }
 
@@ -927,8 +932,7 @@ static void hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci)
         {
             /* for translated MSI to INTx interrupt, eoi as early as possible */
             __msi_pirq_eoi(pirq_dpci);
-            spin_unlock(&d->event_lock);
-            return;
+            goto out;
         }
 
         /*
@@ -941,6 +945,8 @@ static void hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci)
         ASSERT(pt_irq_need_timer(pirq_dpci->flags));
         set_timer(&pirq_dpci->timer, NOW() + PT_IRQ_TIME_OUT);
     }
+
+ out:
     spin_unlock(&d->event_lock);
 }
 
diff --git a/xen/include/asm-x86/hvm/irq.h b/xen/include/asm-x86/hvm/irq.h
index d306cfeade..532880d497 100644
--- a/xen/include/asm-x86/hvm/irq.h
+++ b/xen/include/asm-x86/hvm/irq.h
@@ -121,6 +121,7 @@ struct dev_intx_gsi_link {
 #define _HVM_IRQ_DPCI_GUEST_PCI_SHIFT           4
 #define _HVM_IRQ_DPCI_GUEST_MSI_SHIFT           5
 #define _HVM_IRQ_DPCI_IDENTITY_GSI_SHIFT        6
+#define _HVM_IRQ_DPCI_NO_EOI_SHIFT              7
 #define _HVM_IRQ_DPCI_TRANSLATE_SHIFT          15
 #define HVM_IRQ_DPCI_MACH_PCI        (1u << _HVM_IRQ_DPCI_MACH_PCI_SHIFT)
 #define HVM_IRQ_DPCI_MACH_MSI        (1u << _HVM_IRQ_DPCI_MACH_MSI_SHIFT)
@@ -129,6 +130,7 @@ struct dev_intx_gsi_link {
 #define HVM_IRQ_DPCI_GUEST_PCI       (1u << _HVM_IRQ_DPCI_GUEST_PCI_SHIFT)
 #define HVM_IRQ_DPCI_GUEST_MSI       (1u << _HVM_IRQ_DPCI_GUEST_MSI_SHIFT)
 #define HVM_IRQ_DPCI_IDENTITY_GSI    (1u << _HVM_IRQ_DPCI_IDENTITY_GSI_SHIFT)
+#define HVM_IRQ_DPCI_NO_EOI          (1u << _HVM_IRQ_DPCI_NO_EOI_SHIFT)
 #define HVM_IRQ_DPCI_TRANSLATE       (1u << _HVM_IRQ_DPCI_TRANSLATE_SHIFT)
 
 struct hvm_gmsi_info {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jun 12 15:55:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 12 Jun 2020 15: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 1jjm1J-0006Ei-Qi; Fri, 12 Jun 2020 15: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=/waf=7Z=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jjm1J-0006EZ-0W
 for xen-changelog@lists.xenproject.org; Fri, 12 Jun 2020 15:55:05 +0000
X-Inumbo-ID: 146f8553-acc5-11ea-b5e3-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 146f8553-acc5-11ea-b5e3-12813bfff9fa;
 Fri, 12 Jun 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=Gu/Ov5KOO6EoSHgmqZ5+RzsYk9i46EX6emRR3UJPc8Q=; b=hBIR7mcsGZdJdS8HWAZl/fTLWP
 93ZfjQEia5gXCi290iz9+nuaZjUrZdcqFQhwhewBc55BAaCJN424PPgogdOiR9Vkcg+V9PZ9xhfq/
 fIWtDS9mG3RHQoGdurBDhzCCiGQFF1JY+ivBvIDgSxOGjsRsweyIR28B2gyUvfllB+2o=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jjm1I-0004bj-6I
 for xen-changelog@lists.xenproject.org; Fri, 12 Jun 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 1jjm1I-00007z-59
 for xen-changelog@lists.xenproject.org; Fri, 12 Jun 2020 15:55:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] tools/libxc: Drop config_transformed parameter from
 xc_cpuid_set()
Message-Id: <E1jjm1I-00007z-59@xenbits.xenproject.org>
Date: Fri, 12 Jun 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 b91825f628c9a62cf2a3a0d972ea81484a8b7fce
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jun 12 11:55:19 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Fri Jun 12 16:54:25 2020 +0100

    tools/libxc: Drop config_transformed parameter from xc_cpuid_set()
    
    libxl is now the sole caller of xc_cpuid_set().  The config_transformed output
    is ignored, and this patch trivially highlights the resulting memory leak.
    
    "transformed" config is now properly forwarded on migrate as part of the
    general VM state, so delete the transformation logic completely, rather than
    trying to adjust just libxl to avoid leaking memory.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    Release-acked-by: Paul Durrant <paul@xen.org>
    Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 tools/libxc/include/xenctrl.h |  3 +--
 tools/libxc/xc_cpuid_x86.c    | 25 +------------------------
 tools/libxl/libxl_cpuid.c     |  3 +--
 3 files changed, 3 insertions(+), 28 deletions(-)

diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h
index f9e17ae424..113ddd935d 100644
--- a/tools/libxc/include/xenctrl.h
+++ b/tools/libxc/include/xenctrl.h
@@ -1795,8 +1795,7 @@ int xc_domain_debug_control(xc_interface *xch,
 int xc_cpuid_set(xc_interface *xch,
                  uint32_t domid,
                  const unsigned int *input,
-                 const char **config,
-                 char **config_transformed);
+                 const char **config);
 
 /*
  * Make adjustments to the CPUID settings for a domain.
diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c
index 89d2ecdad2..b42edd6457 100644
--- a/tools/libxc/xc_cpuid_x86.c
+++ b/tools/libxc/xc_cpuid_x86.c
@@ -279,7 +279,7 @@ int xc_set_domain_cpu_policy(xc_interface *xch, uint32_t domid,
  */
 int xc_cpuid_set(
     xc_interface *xch, uint32_t domid, const unsigned int *input,
-    const char **config, char **config_transformed)
+    const char **config)
 {
     int rc;
     unsigned int i, j, regs[4] = {}, polregs[4] = {};
@@ -288,9 +288,6 @@ int xc_cpuid_set(
     unsigned int nr_leaves, policy_leaves, nr_msrs;
     uint32_t err_leaf = -1, err_subleaf = -1, err_msr = -1;
 
-    for ( i = 0; i < 4; ++i )
-        config_transformed[i] = NULL;
-
     if ( xc_domain_getinfo(xch, domid, 1, &di) != 1 ||
          di.domid != domid )
     {
@@ -365,13 +362,6 @@ int xc_cpuid_set(
             continue;
         }
 
-        config_transformed[i] = calloc(33, 1); /* 32 bits, NUL terminator. */
-        if ( config_transformed[i] == NULL )
-        {
-            rc = -ENOMEM;
-            goto fail;
-        }
-
         /*
          * Notes for following this algorithm:
          *
@@ -399,11 +389,6 @@ int xc_cpuid_set(
                 set_feature(31 - j, regs[i]);
             else
                 clear_feature(31 - j, regs[i]);
-
-            config_transformed[i][j] = config[i][j];
-            /* All non 0/1 values get overwritten. */
-            if ( (config[i][j] & ~1) != '0' )
-                config_transformed[i][j] = '0' + val;
         }
     }
 
@@ -421,16 +406,8 @@ int xc_cpuid_set(
     }
 
     /* Success! */
-    goto out;
 
  fail:
-    for ( i = 0; i < 4; i++ )
-    {
-        free(config_transformed[i]);
-        config_transformed[i] = NULL;
-    }
-
- out:
     free(leaves);
 
     return rc;
diff --git a/tools/libxl/libxl_cpuid.c b/tools/libxl/libxl_cpuid.c
index 4e4852ddeb..796ec4f2d9 100644
--- a/tools/libxl/libxl_cpuid.c
+++ b/tools/libxl/libxl_cpuid.c
@@ -421,7 +421,6 @@ void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid,
 {
     libxl_cpuid_policy_list cpuid = info->cpuid;
     int i;
-    char *cpuid_res[4];
     bool pae = true;
 
     /*
@@ -444,7 +443,7 @@ void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid,
 
     for (i = 0; cpuid[i].input[0] != XEN_CPUID_INPUT_UNUSED; i++)
         xc_cpuid_set(ctx->xch, domid, cpuid[i].input,
-                     (const char**)(cpuid[i].policy), cpuid_res);
+                     (const char**)cpuid[i].policy);
 }
 
 static const char *input_names[2] = { "leaf", "subleaf" };
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jun 12 16:11:10 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 12 Jun 2020 16: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 1jjmGp-0000ki-Ot; Fri, 12 Jun 2020 16: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=/waf=7Z=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jjmGo-0000kd-8C
 for xen-changelog@lists.xenproject.org; Fri, 12 Jun 2020 16:11:06 +0000
X-Inumbo-ID: 516a39d2-acc7-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 516a39d2-acc7-11ea-bb8b-bc764e2007e4;
 Fri, 12 Jun 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=XbpncPGuLLwADIEhxobT9K6PseGk82CHvu6N4J3aW7s=; b=LI+OP7YSgkbhGyo1k4hA+Tbrqy
 fsuMRQ+FCScpF3UEVtXHJLHerfoD2zmtxBTDWFq3kNpfvsMGoLE44gsCAuojocqqksuwoMhKMxlnv
 +jd2zbA87EGD6ZQtVpd84S+Jkk0A6VBN2hAUHwUZgLHSTNRBRKsV+ryW3Rf65WN1OGjc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jjmGn-0005Uw-5J
 for xen-changelog@lists.xenproject.org; Fri, 12 Jun 2020 16:11:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jjmGn-0001Ah-4H
 for xen-changelog@lists.xenproject.org; Fri, 12 Jun 2020 16:11:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.9] tools/xentop : replace use of deprecated vwprintw
Message-Id: <E1jjmGn-0001Ah-4H@xenbits.xenproject.org>
Date: Fri, 12 Jun 2020 16:11: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 1dd64783024c5c9e600c3d33393b795c68a46f65
Author:     Christopher Clark <christopher.w.clark@gmail.com>
AuthorDate: Wed Jul 18 15:22:17 2018 -0700
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Fri Jun 12 17:01:39 2020 +0100

    tools/xentop : replace use of deprecated vwprintw
    
    gcc-8.1 complains:
    
    | xentop.c: In function 'print':
    | xentop.c:304:4: error: 'vwprintw' is deprecated [-Werror=deprecated-declarations]
    |     vwprintw(stdscr, (curses_str_t)fmt, args);
    |     ^~~~~~~~
    
    vw_printw (note the underscore) is a non-deprecated alternative.
    
    Signed-off-by: Christopher Clark <christopher.clark6@baesystems.com>
    Acked-by: Wei Liu <wei.liu2@citrix.com>
    (cherry picked from commit 2b50cdbc444c637575580dcfa6c9525a84d5cc62)
---
 tools/xenstat/xentop/xentop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/xenstat/xentop/xentop.c b/tools/xenstat/xentop/xentop.c
index 2fd2b6742e..c46581062b 100644
--- a/tools/xenstat/xentop/xentop.c
+++ b/tools/xenstat/xentop/xentop.c
@@ -301,7 +301,7 @@ static void print(const char *fmt, ...)
 	if (!batch) {
 		if((current_row() < lines()-1)) {
 			va_start(args, fmt);
-			vwprintw(stdscr, (curses_str_t)fmt, args);
+			vw_printw(stdscr, (curses_str_t)fmt, args);
 			va_end(args);
 		}
 	} else {
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.9


From xen-changelog-bounces@lists.xenproject.org Fri Jun 12 16:11:16 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 12 Jun 2020 16: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 1jjmGy-0000lH-QI; Fri, 12 Jun 2020 16:11:16 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=/waf=7Z=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jjmGx-0000lB-Ri
 for xen-changelog@lists.xenproject.org; Fri, 12 Jun 2020 16:11:15 +0000
X-Inumbo-ID: 576e6ccc-acc7-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 576e6ccc-acc7-11ea-bca7-bc764e2007e4;
 Fri, 12 Jun 2020 16: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=tZehvJ6ymNpsZUSRyStRb75/CWcZILStFHO3WQwHa+w=; b=XU65AkJfQr5vvOv50pvblxuPWc
 DP9CvYEe8I97fi9CHpzKbDrlZii1UEwytkZZCN32NwSjWcqNcN3D+nruPkZmYtg3YvAKXvmeQdv4Y
 wHzNT8NCnRqq72qYWIhQUqYsa0S/64SuCx2U/S+xxOIXd/myRxUtsSGDEy1XuYFrCSqU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jjmGx-0005V4-91
 for xen-changelog@lists.xenproject.org; Fri, 12 Jun 2020 16:11:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jjmGx-0001BI-7Q
 for xen-changelog@lists.xenproject.org; Fri, 12 Jun 2020 16:11:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.9] tools/libxc: fix strncpy size
Message-Id: <E1jjmGx-0001BI-7Q@xenbits.xenproject.org>
Date: Fri, 12 Jun 2020 16: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 9737f89b076ae4d05e6f974a7c21aced4459966e
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Thu Apr 5 03:50:49 2018 +0200
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Fri Jun 12 17:01:39 2020 +0100

    tools/libxc: fix strncpy size
    
    gcc-8 warns about possible truncation of trailing '\0'.
    Final character is overridden by '\0' anyway, so don't bother to copy
    it.
    
    This fixes compile failure:
    
        xc_pm.c: In function 'xc_set_cpufreq_gov':
        xc_pm.c:308:5: error: 'strncpy' specified bound 16 equals destination size [-Werror=stringop-truncation]
             strncpy(scaling_governor, govname, CPUFREQ_NAME_LEN);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        cc1: all warnings being treated as errors
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Wei Liu <wei.liu2@citrix.com>
    Release-Acked-by: Juergen Gross <jgross@suse.com>
    (cherry picked from commit fa7789ef18bd2e716997937af71b2e4b5b00a159)
---
 tools/libxc/xc_pm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libxc/xc_pm.c b/tools/libxc/xc_pm.c
index ae917bc630..0fc47047ce 100644
--- a/tools/libxc/xc_pm.c
+++ b/tools/libxc/xc_pm.c
@@ -305,7 +305,7 @@ int xc_set_cpufreq_gov(xc_interface *xch, int cpuid, char *govname)
     sysctl.cmd = XEN_SYSCTL_pm_op;
     sysctl.u.pm_op.cmd = SET_CPUFREQ_GOV;
     sysctl.u.pm_op.cpuid = cpuid;
-    strncpy(scaling_governor, govname, CPUFREQ_NAME_LEN);
+    strncpy(scaling_governor, govname, CPUFREQ_NAME_LEN - 1);
     scaling_governor[CPUFREQ_NAME_LEN - 1] = '\0';
 
     return xc_sysctl(xch, &sysctl);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.9


From xen-changelog-bounces@lists.xenproject.org Fri Jun 12 16:11:26 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 12 Jun 2020 16: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 1jjmH8-0000mM-Rs; Fri, 12 Jun 2020 16:11:26 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=/waf=7Z=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jjmH8-0000mD-3I
 for xen-changelog@lists.xenproject.org; Fri, 12 Jun 2020 16:11:26 +0000
X-Inumbo-ID: 5d73273e-acc7-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 5d73273e-acc7-11ea-b7bb-bc764e2007e4;
 Fri, 12 Jun 2020 16: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=rKZU6BG61P2A0LT+ETO5uQezUfB9gY99jqMre5FvPEs=; b=xcXswOlC4oOJ4vGSOSbicWWOAQ
 DubhlL+UJW473RrNLBFZXxkW0qk65Twi1eKkP3i07X7wTg9xfUxExb9fNiGkLS+T+ipxJNPHbSG/I
 WyvU3a1Te7yX+XK0c+JjKykSzbmwZPVGchDEDRl/gSS8hSfGBJ5yM5WTMOlo+Fis91zY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jjmH7-0005Vr-CE
 for xen-changelog@lists.xenproject.org; Fri, 12 Jun 2020 16:11:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jjmH7-0001C7-BA
 for xen-changelog@lists.xenproject.org; Fri, 12 Jun 2020 16:11:25 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.9] tools/xenpmd: fix possible '\0' truncation
Message-Id: <E1jjmH7-0001C7-BA@xenbits.xenproject.org>
Date: Fri, 12 Jun 2020 16: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 f034ab45c15aef9c784dbcdc5c893e268d4a094c
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Thu Apr 5 03:50:53 2018 +0200
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Fri Jun 12 17:01:39 2020 +0100

    tools/xenpmd: fix possible '\0' truncation
    
    gcc-8 complains:
        xenpmd.c:207:9: error: 'strncpy' specified bound 32 equals destination size [-Werror=stringop-truncation]
                 strncpy(info->oem_info, attrib_value, 32);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        xenpmd.c:201:9: error: 'strncpy' specified bound 32 equals destination size [-Werror=stringop-truncation]
                 strncpy(info->battery_type, attrib_value, 32);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        xenpmd.c:195:9: error: 'strncpy' specified bound 32 equals destination size [-Werror=stringop-truncation]
                 strncpy(info->serial_number, attrib_value, 32);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        xenpmd.c:189:9: error: 'strncpy' specified bound 32 equals destination size [-Werror=stringop-truncation]
                 strncpy(info->model_number, attrib_value, 32);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    Copy 31 chars, then make sure terminating '\0' is present. Those fields
    are passed to strlen and as '%s' for snprintf later.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Wei Liu <wei.liu2@citrix.com>
    Release-Acked-by: Juergen Gross <jgross@suse.com>
    (cherry picked from commit 938c8f53b1f80175c6f7a1399efdb984abb0cb8b)
---
 tools/xenpmd/xenpmd.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/tools/xenpmd/xenpmd.c b/tools/xenpmd/xenpmd.c
index 689c8fd670..56412a9a81 100644
--- a/tools/xenpmd/xenpmd.c
+++ b/tools/xenpmd/xenpmd.c
@@ -186,25 +186,29 @@ void set_attribute_battery_info(char *attrib_name,
 
     if ( strstr(attrib_name, "model number") ) 
     {
-        strncpy(info->model_number, attrib_value, 32);
+        strncpy(info->model_number, attrib_value, 31);
+        info->model_number[31] = '\0';
         return;
     }
 
     if ( strstr(attrib_name, "serial number") ) 
     {
-        strncpy(info->serial_number, attrib_value, 32);
+        strncpy(info->serial_number, attrib_value, 31);
+        info->serial_number[31] = '\0';
         return;
     }
 
     if ( strstr(attrib_name, "battery type") ) 
     {
-        strncpy(info->battery_type, attrib_value, 32);
+        strncpy(info->battery_type, attrib_value, 31);
+        info->battery_type[31] = '\0';
         return;
     }
 
     if ( strstr(attrib_name, "OEM info") ) 
     {
-        strncpy(info->oem_info, attrib_value, 32);
+        strncpy(info->oem_info, attrib_value, 31);
+        info->oem_info[31] = '\0';
         return;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.9


From xen-changelog-bounces@lists.xenproject.org Fri Jun 12 16:11:36 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 12 Jun 2020 16: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 1jjmHI-0000nV-TQ; Fri, 12 Jun 2020 16: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=/waf=7Z=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jjmHI-0000nO-2C
 for xen-changelog@lists.xenproject.org; Fri, 12 Jun 2020 16:11:36 +0000
X-Inumbo-ID: 63772f18-acc7-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 63772f18-acc7-11ea-bca7-bc764e2007e4;
 Fri, 12 Jun 2020 16: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=FJoUZtGqbe1m9aQ4Tg/qzpFbYIL1tfvURac44P4UY5w=; b=EmhzHgiV2qzGMhbMkwUP8Qk9d/
 NXu09+h3Fu0tt5Kv7kHQMvCp7YltYg7NgyxcFyiExTayvvTf2CmZv9bswruqk5S695MFOCf41OlE9
 TxH2JP/rIKpXwXbsFltW3u6kDC9ZoAD+SSqIpDasYkAfJYUOGIJdXBwiTNdZFHPTAqus=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jjmHH-0005W1-FJ
 for xen-changelog@lists.xenproject.org; Fri, 12 Jun 2020 16:11:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jjmHH-0001Cu-EK
 for xen-changelog@lists.xenproject.org; Fri, 12 Jun 2020 16:11:35 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.9] tools/gdbsx: fix -Wstringop-truncation warning
Message-Id: <E1jjmHH-0001Cu-EK@xenbits.xenproject.org>
Date: Fri, 12 Jun 2020 16: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 f1e75e5c7054d8cd7bdfe30c6a95af35cc24fbb2
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Thu Apr 5 03:50:54 2018 +0200
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Fri Jun 12 17:01:39 2020 +0100

    tools/gdbsx: fix -Wstringop-truncation warning
    
    gcc-8 complains:
    
        gx_main.c: In function 'prepare_stop_reply':
        gx_main.c:385:9: error: 'strncpy' output truncated before terminating nul copying 6 bytes from a string of the same length [-Werror=stringop-truncation]
                 strncpy(buf, "watch:", 6);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~
    
    Since terminating '\0' isn't needed here at all, switch to memcpy.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Wei Liu <wei.liu2@citrix.com>
    Release-Acked-by: Juergen Gross <jgross@suse.com>
    (cherry picked from commit 7f601f7c341c80d554615556d60e3b8ed1e5ad4f)
---
 tools/debugger/gdbsx/gx/gx_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/debugger/gdbsx/gx/gx_main.c b/tools/debugger/gdbsx/gx/gx_main.c
index a908c45e1d..6dfa501145 100644
--- a/tools/debugger/gdbsx/gx/gx_main.c
+++ b/tools/debugger/gdbsx/gx/gx_main.c
@@ -382,7 +382,7 @@ prepare_stop_reply(enum target_signal sig, char *buf, vcpuid_t vcpu)
 
     /* TBD: check if we stopped because of watchpoint */
     if (watchpoint_stop()) {
-        strncpy(buf, "watch:", 6);
+        memcpy(buf, "watch:", 6);
         buf += 6;
         /* TBD: **/
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.9


From xen-changelog-bounces@lists.xenproject.org Fri Jun 12 16:11:47 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 12 Jun 2020 16: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 1jjmHT-0000og-V0; Fri, 12 Jun 2020 16:11: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=/waf=7Z=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jjmHS-0000oX-RB
 for xen-changelog@lists.xenproject.org; Fri, 12 Jun 2020 16:11:46 +0000
X-Inumbo-ID: 697a048a-acc7-11ea-b5eb-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 697a048a-acc7-11ea-b5eb-12813bfff9fa;
 Fri, 12 Jun 2020 16: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=CyPqnt82JndPWfdfcZnrsKmbpa662QAZ8d34K1xCXDY=; b=NnV5WCIpobNGCOA1XKAW5fm58d
 jxoWvqO0LYPXxEyDrRZAEdiPxmzGJQQGjsqCkw+8gfRTfmjFu/AxQtKLdmY1YP5Xe8V+o2QXB/9wG
 95MZiIzDWfGMtvcKE4k2uNr+ycCCK02dskoM94/fJBk1ubNXIZcRLTqP0/wFdquN8eEQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jjmHR-0005WE-IP
 for xen-changelog@lists.xenproject.org; Fri, 12 Jun 2020 16:11:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jjmHR-0001Dj-HY
 for xen-changelog@lists.xenproject.org; Fri, 12 Jun 2020 16:11:45 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.9] tools/blktap2: fix possible '\0' truncation
Message-Id: <E1jjmHR-0001Dj-HY@xenbits.xenproject.org>
Date: Fri, 12 Jun 2020 16: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 1eae17268887bacbc598ef6e3290059dbeb4fd8f
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Thu Apr 5 03:50:52 2018 +0200
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Fri Jun 12 17:01:39 2020 +0100

    tools/blktap2: fix possible '\0' truncation
    
    gcc-8 complains:
    
        tapdisk-vbd.c: In function 'tapdisk_vbd_resume_ring':
        tapdisk-vbd.c:1671:53: error: 'snprintf' output may be truncated before the last format character [-Werror=format-truncation=]
           snprintf(params.name, sizeof(params.name) - 1, "%s", message);
                                                             ^
        tapdisk-vbd.c:1671:3: note: 'snprintf' output between 1 and 256 bytes into a destination of size 255
           snprintf(params.name, sizeof(params.name) - 1, "%s", message);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    The "- 1" in buffer size should be actually applied to message, to leave
    place for terminating '\0', not the other way around (truncate '\0' even
    if it would fit).
    
        In function 'tapdisk_control_open_image',
            inlined from 'tapdisk_control_handle_request' at tapdisk-control.c:660:10:
        tapdisk-control.c:465:2: error: 'strncpy' specified bound 256 equals destination size [-Werror=stringop-truncation]
          strncpy(params.name, vbd->name, BLKTAP2_MAX_MESSAGE_LEN);
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
        In function 'tapdisk_control_create_socket',
            inlined from 'tapdisk_control_open' at tapdisk-control.c:836:9:
        tapdisk-control.c:793:2: error: 'strncpy' specified bound 108 equals destination size [-Werror=stringop-truncation]
          strncpy(saddr.sun_path, td_control.path, sizeof(saddr.sun_path));
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
        block-qcow.c: In function 'qcow_create':
        block-qcow.c:1216:5: error: 'strncpy' specified bound 4096 equals destination size [-Werror=stringop-truncation]
             strncpy(backing_filename, backing_file,
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              sizeof(backing_filename));
              ~~~~~~~~~~~~~~~~~~~~~~~~~
    
    I those cases, reduce size of copied string and make sure final '\0' is
    added.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Wei Liu <wei.liu2@citrix.com>
    Release-Acked-by: Juergen Gross <jgross@suse.com>
    (cherry picked from commit 850e89b3ef1a7be6b71fa7ae22333c884e08431a)
---
 tools/blktap2/drivers/block-qcow.c      | 3 ++-
 tools/blktap2/drivers/tapdisk-control.c | 5 +++--
 tools/blktap2/drivers/tapdisk-vbd.c     | 3 ++-
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/tools/blktap2/drivers/block-qcow.c b/tools/blktap2/drivers/block-qcow.c
index b45bcaa077..ae439221ab 100644
--- a/tools/blktap2/drivers/block-qcow.c
+++ b/tools/blktap2/drivers/block-qcow.c
@@ -1214,7 +1214,8 @@ int qcow_create(const char *filename, uint64_t total_size,
 			if (p && (p - backing_file) >= 2) {
 				/* URL like but exclude "c:" like filenames */
 				strncpy(backing_filename, backing_file,
-					sizeof(backing_filename));
+					sizeof(backing_filename) - 1);
+				backing_filename[sizeof(backing_filename) - 1] = '\0';
 			} else {
 				if (realpath(backing_file, backing_filename) == NULL ||
 				    stat(backing_filename, &st) != 0) {
diff --git a/tools/blktap2/drivers/tapdisk-control.c b/tools/blktap2/drivers/tapdisk-control.c
index 0b5cf3cdd3..3ca5713063 100644
--- a/tools/blktap2/drivers/tapdisk-control.c
+++ b/tools/blktap2/drivers/tapdisk-control.c
@@ -462,7 +462,8 @@ tapdisk_control_open_image(struct tapdisk_control_connection *connection,
 
 	params.capacity = image.size;
 	params.sector_size = image.secsize;
-	strncpy(params.name, vbd->name, BLKTAP2_MAX_MESSAGE_LEN);
+	strncpy(params.name, vbd->name, BLKTAP2_MAX_MESSAGE_LEN - 1);
+	params.name[BLKTAP2_MAX_MESSAGE_LEN - 1] = '\0';
 
 	err = ioctl(vbd->ring.fd, BLKTAP2_IOCTL_CREATE_DEVICE, &params);
 	if (err && errno != EEXIST) {
@@ -790,7 +791,7 @@ tapdisk_control_create_socket(char **socket_path)
 	}
 
 	memset(&saddr, 0, sizeof(saddr));
-	strncpy(saddr.sun_path, td_control.path, sizeof(saddr.sun_path));
+	strncpy(saddr.sun_path, td_control.path, sizeof(saddr.sun_path) - 1);
 	saddr.sun_family = AF_UNIX;
 
 	err = bind(td_control.socket,
diff --git a/tools/blktap2/drivers/tapdisk-vbd.c b/tools/blktap2/drivers/tapdisk-vbd.c
index fd4999a5ec..842a427861 100644
--- a/tools/blktap2/drivers/tapdisk-vbd.c
+++ b/tools/blktap2/drivers/tapdisk-vbd.c
@@ -1668,7 +1668,8 @@ out:
 
 		params.sector_size = image.secsize;
 		params.capacity    = image.size;
-		snprintf(params.name, sizeof(params.name) - 1, "%s", message);
+		snprintf(params.name, sizeof(params.name),
+			 "%.*s", (int)sizeof(params.name) - 1, message);
 
 		ioctl(vbd->ring.fd, BLKTAP2_IOCTL_SET_PARAMS, &params);
 		td_flag_clear(vbd->state, TD_VBD_PAUSED);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.9


From xen-changelog-bounces@lists.xenproject.org Fri Jun 12 16:11:58 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 12 Jun 2020 16:11: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 1jjmHe-0000qF-1W; Fri, 12 Jun 2020 16:11: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=/waf=7Z=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jjmHc-0000q2-CQ
 for xen-changelog@lists.xenproject.org; Fri, 12 Jun 2020 16:11:56 +0000
X-Inumbo-ID: 6f810432-acc7-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 6f810432-acc7-11ea-bb8b-bc764e2007e4;
 Fri, 12 Jun 2020 16: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=LK+6hxGuu+OD0KtSayriezg9Sg1XV+/cmiFg7iLqt4s=; b=3ttxSbPE7fkc2VFMPzePXzEy2e
 RZ7QIp8jyM+7/GY079IVUOZDuyUFzukRLRmT0sRYpRJx7iAqSghkvvOm1jEnzUwlJN5vqsfU2dOt4
 nJsFv19dh7akV7yl4Aodqu+qlZo7jLqKaGNc9V2kWSbeGD9StJ4jSRJ6Et4g6UhR9d6s=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jjmHb-0005WS-LP
 for xen-changelog@lists.xenproject.org; Fri, 12 Jun 2020 16:11:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jjmHb-0001EI-KU
 for xen-changelog@lists.xenproject.org; Fri, 12 Jun 2020 16:11:55 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.9] tools/misc: fix hypothetical buffer overflow in
 xen-lowmemd
Message-Id: <E1jjmHb-0001EI-KU@xenbits.xenproject.org>
Date: Fri, 12 Jun 2020 16:11: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 41f597f5167c2e78a3c70d219710c8805d7fec8e
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Thu Apr 5 03:50:50 2018 +0200
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Fri Jun 12 17:01:39 2020 +0100

    tools/misc: fix hypothetical buffer overflow in xen-lowmemd
    
    gcc-8 complains:
    
        xen-lowmemd.c: In function 'handle_low_mem':
        xen-lowmemd.c:80:55: error: '%s' directive output may be truncated writing up to 511 bytes into a region of size 489 [-Werror=format-truncation=]
                 snprintf(error, BUFSZ,"Failed to write target %s to xenstore", data);
                                                               ^~               ~~~~
        xen-lowmemd.c:80:9: note: 'snprintf' output between 36 and 547 bytes into a destination of size 512
                 snprintf(error, BUFSZ,"Failed to write target %s to xenstore", data);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    In practice it wouldn't happen, because 'data' contains string
    representation of 64-bit unsigned number (20 characters at most).
    But place a limit to mute gcc warning.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Wei Liu <wei.liu2@citrix.com>
    Release-Acked-by: Juergen Gross <jgross@suse.com>
    (cherry picked from commit 27751d89248c8c5eef6d8b56eb8f7d2084145080)
---
 tools/misc/xen-lowmemd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/misc/xen-lowmemd.c b/tools/misc/xen-lowmemd.c
index 865a54cec1..79ad34cb4a 100644
--- a/tools/misc/xen-lowmemd.c
+++ b/tools/misc/xen-lowmemd.c
@@ -77,7 +77,7 @@ void handle_low_mem(void)
     if (!xs_write(xs_handle, XBT_NULL, 
             "/local/domain/0/memory/target", data, strlen(data)))
     {
-        snprintf(error, BUFSZ,"Failed to write target %s to xenstore", data);
+        snprintf(error, BUFSZ,"Failed to write target %.24s to xenstore", data);
         perror(error);
     }
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.9


From xen-changelog-bounces@lists.xenproject.org Fri Jun 12 16:12:08 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 12 Jun 2020 16:12: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 1jjmHo-0000rJ-2z; Fri, 12 Jun 2020 16:12: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=/waf=7Z=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jjmHm-0000r8-Nm
 for xen-changelog@lists.xenproject.org; Fri, 12 Jun 2020 16:12:06 +0000
X-Inumbo-ID: 75822118-acc7-11ea-b5eb-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 75822118-acc7-11ea-b5eb-12813bfff9fa;
 Fri, 12 Jun 2020 16: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=cesmk3WwCZKYbAK1ozbk6BZ1e41d7eY/Fwe6wnsKfcw=; b=O+xZQpDSUAZ1P85TkwI/itL0nj
 kloz+Ib7d5VKFTyMcjESAQCMmVJvDqVdI0jwezntphkw6WuNlJBp7INHFS/f8XfY17aCblKeXfhOk
 ZKP4EcYFEnrxP3wPl9SJLYkYChb67LqtqcFe/g554slPEpcpCZQ+h0+UCsI4Il8yWBRw=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jjmHl-0005Ws-OI
 for xen-changelog@lists.xenproject.org; Fri, 12 Jun 2020 16:12:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jjmHl-0001F4-Nc
 for xen-changelog@lists.xenproject.org; Fri, 12 Jun 2020 16:12:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.9] tools/ocaml/libs/xc fix gcc-8 format-truncation
 warning
Message-Id: <E1jjmHl-0001F4-Nc@xenbits.xenproject.org>
Date: Fri, 12 Jun 2020 16: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 6a1c431890599c701117bf9822898f60a18444a3
Author:     John Thomson <git@johnthomson.fastmail.com.au>
AuthorDate: Tue May 15 11:48:43 2018 +1000
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Fri Jun 12 17:01:39 2020 +0100

    tools/ocaml/libs/xc fix gcc-8 format-truncation warning
    
     CC       xenctrl_stubs.o
    xenctrl_stubs.c: In function 'failwith_xc':
    xenctrl_stubs.c:65:17: error: 'snprintf' output may be truncated before the last format character [-Werror=format-truncation=]
          "%d: %s: %s", error->code,
                     ^
    xenctrl_stubs.c:64:4: note: 'snprintf' output 6 or more bytes (assuming 1029) into a destination of size 1028
        snprintf(error_str, sizeof(error_str),
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          "%d: %s: %s", error->code,
          ~~~~~~~~~~~~~~~~~~~~~~~~~~
          xc_error_code_to_desc(error->code),
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          error->message);
          ~~~~~~~~~~~~~~~
    cc1: all warnings being treated as errors
    make[8]: *** [/build/xen-git/src/xen/tools/ocaml/libs/xc/../../Makefile.rules:37: xenctrl_stubs.o] Error 1
    m
    
    Signed-off-by: John Thomson <git@johnthomson.fastmail.com.au>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    Release-acked-by: Juergen Gross <jgross@suse.com>
    (cherry picked from commit 2adc90908fbb1e614c477e29f2d45eda94570795)
---
 tools/ocaml/libs/xc/xenctrl_stubs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index f1b28db53a..beefe6e8ad 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -54,7 +54,7 @@
 
 static void Noreturn failwith_xc(xc_interface *xch)
 {
-	char error_str[1028];
+	char error_str[XC_MAX_ERROR_MSG_LEN + 6];
 	if (xch) {
 		const xc_error *error = xc_get_last_error(xch);
 		if (error->code == XC_ERROR_NONE)
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.9


From xen-changelog-bounces@lists.xenproject.org Fri Jun 12 16:12:18 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 12 Jun 2020 16:12: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 1jjmHy-0000sN-4c; Fri, 12 Jun 2020 16:12:18 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=/waf=7Z=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jjmHw-0000s9-CF
 for xen-changelog@lists.xenproject.org; Fri, 12 Jun 2020 16:12:16 +0000
X-Inumbo-ID: 7b849a46-acc7-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 7b849a46-acc7-11ea-bca7-bc764e2007e4;
 Fri, 12 Jun 2020 16:12: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=DJd6Njm0TnJJdiYT9QkzaTAlrs3dEIuhnjVcWKl0TN8=; b=KFAnnClBgAwqE9vcnqGSZnqZkq
 qYLjYMzIkQ5WB1VyutDZmeTJgoAx/x0cfon17W6/T6AAz0abAOMXPfc9oYuH4z7rYolcHacuN7eq+
 1sh1H+dPMfp3LehOhnD/Y64Aho3PiEJx69MgwwECnG70wzrR84ILcxiL962Dj+YzbcRc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jjmHv-0005X0-RG
 for xen-changelog@lists.xenproject.org; Fri, 12 Jun 2020 16:12:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jjmHv-0001Fj-QV
 for xen-changelog@lists.xenproject.org; Fri, 12 Jun 2020 16:12:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.9] ipxe: update to newer commit
Message-Id: <E1jjmHv-0001Fj-QV@xenbits.xenproject.org>
Date: Fri, 12 Jun 2020 16: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 6e477c2ea4d5c26a7a7b2f850166aa79edc5225c
Author:     Wei Liu <wei.liu2@citrix.com>
AuthorDate: Mon Jun 12 16:04:17 2017 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Fri Jun 12 17:01:39 2020 +0100

    ipxe: update to newer commit
    
    To get 5f85cbb9ee1c00cec81a848a9e871ad5d1e7f53f to placate gcc 7.
    
    The only patch we have applies cleanly.
    
    Reported-by: Zhongze Liu <blackskygg@gmail.com>
    Signed-off-by: Wei Liu <wei.liu2@citrix.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
    (cherry picked from commit 461b2165346de236fff2d00d1c318062f1daab08)
---
 tools/firmware/etherboot/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/firmware/etherboot/Makefile b/tools/firmware/etherboot/Makefile
index 459a1e22e6..89d9ace8c8 100644
--- a/tools/firmware/etherboot/Makefile
+++ b/tools/firmware/etherboot/Makefile
@@ -10,7 +10,7 @@ else
 IPXE_GIT_URL ?= git://git.ipxe.org/ipxe.git
 endif
 
-IPXE_GIT_TAG := 827dd1bfee67daa683935ce65316f7e0f057fe1c
+IPXE_GIT_TAG := 356f6c1b64d7a97746d1816cef8ca22bdd8d0b5d
 
 IPXE_TARBALL_URL ?= $(XEN_EXTFILES_URL)/ipxe-git-$(IPXE_GIT_TAG).tar.gz
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.9


From xen-changelog-bounces@lists.xenproject.org Sat Jun 13 01:44:12 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 13 Jun 2020 01: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 1jjvDK-0007rZ-H5; Sat, 13 Jun 2020 01:44: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=xKhh=72=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jjvDI-0007rT-T3
 for xen-changelog@lists.xenproject.org; Sat, 13 Jun 2020 01:44:04 +0000
X-Inumbo-ID: 5ba64472-ad17-11ea-b62e-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 5ba64472-ad17-11ea-b62e-12813bfff9fa;
 Sat, 13 Jun 2020 01: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=yprkeehI/W9B/7/F7XWielXZppbnccYDvumMrXCAKHc=; b=pSHHr7LpoYVooJfcQkI44rF8G3
 f/txokdNZk4SqPnsioS7HrljVg2yIqW1j7hPbPgaAG7/vODtamrfV4HWjSjk/pUMbi491GfEig8Us
 SD6mie5BBkp8NwybJR5N+pRcBEomxLzs5BSOv1I/Eq0JBZX0qXdF4XdJQUjUuVHZ9aPM=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jjvDG-00019q-2t
 for xen-changelog@lists.xenproject.org; Sat, 13 Jun 2020 01:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jjvDG-00008y-1k
 for xen-changelog@lists.xenproject.org; Sat, 13 Jun 2020 01:44:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] x86/spec-ctrl: Update docs with SRBDS workaround
Message-Id: <E1jjvDG-00008y-1k@xenbits.xenproject.org>
Date: Sat, 13 Jun 2020 01: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 d8e1053bfa2726d122109d137fc6c489948b1c36
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 10 18:57:00 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jun 11 16:28:08 2020 +0100

    x86/spec-ctrl: Update docs with SRBDS workaround
    
    RDRAND/RDSEED can be hidden using cpuid= to mitigate SRBDS if microcode
    isn't available.
    
    This is part of XSA-320 / CVE-2020-0543.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    (cherry picked from commit 7028534d8482d25860c4d1aa8e45f0b911abfc5a)
---
 docs/misc/xen-command-line.pandoc | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index c780312531..81e12d053c 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -481,12 +481,18 @@ choice of `dom0-kernel` is deprecated and not supported by all Dom0 kernels.
 This option allows for fine tuning of the facilities Xen will use, after
 accounting for hardware capabilities as enumerated via CPUID.
 
+Unless otherwise noted, options only have any effect in their negative form,
+to hide the named feature(s).  Ignoring a feature using this mechanism will
+cause Xen not to use the feature, nor offer them as usable to guests.
+
 Currently accepted:
 
 The Speculation Control hardware features `srbds-ctrl`, `md-clear`, `ibrsb`,
 `stibp`, `ibpb`, `l1d-flush` and `ssbd` are used by default if available and
-applicable.  They can be ignored, e.g. `no-ibrsb`, at which point Xen won't
-use them itself, and won't offer them to guests.
+applicable.  They can all be ignored.
+
+`rdrand` and `rdseed` can be ignored, as a mitigation to XSA-320 /
+CVE-2020-0543.
 
 ### cpuid_mask_cpu
 > `= fam_0f_rev_[cdefg] | fam_10_rev_[bc] | fam_11_rev_b`
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Sat Jun 13 09:22:12 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 13 Jun 2020 09: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 1jk2MZ-0003qt-62; Sat, 13 Jun 2020 09: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=xKhh=72=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jk2MX-0003qo-NG
 for xen-changelog@lists.xenproject.org; Sat, 13 Jun 2020 09:22:05 +0000
X-Inumbo-ID: 5720d1de-ad57-11ea-b64e-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 5720d1de-ad57-11ea-b64e-12813bfff9fa;
 Sat, 13 Jun 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=6QL+a5Xl55ktCqND9H1YeHzJX8z67cxs9vozoHJX/vY=; b=4qwxWwOUhthLJ4lyC4Na7wB8NU
 GLb3Rv/zcTjebypn01flHv2XbJULdwf9mzHw7isq/a12nPWZ0MlqdvtQAxZiCQY5sKy3+kwWRZkpv
 YGAXmVnSd431VzR8ByRfNhDDZyno37syqdORfqdjc5p+qJMARSewnZ4kgK0OGkDmqJJ0=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jk2MU-0002Xx-97
 for xen-changelog@lists.xenproject.org; Sat, 13 Jun 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 1jk2MU-0005vb-7q
 for xen-changelog@lists.xenproject.org; Sat, 13 Jun 2020 09:22:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/spec-ctrl: CPUID/MSR definitions for Special
 Register Buffer Data Sampling
Message-Id: <E1jk2MU-0005vb-7q@xenbits.xenproject.org>
Date: Sat, 13 Jun 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 caab85ab58c0cdf74ab070a5de5c4df89f509ff3
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 8 19:47:46 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jun 9 17:42:18 2020 +0100

    x86/spec-ctrl: CPUID/MSR definitions for Special Register Buffer Data Sampling
    
    This is part of XSA-320 / CVE-2020-0543
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Wei Liu <wl@xen.org>
---
 docs/misc/xen-command-line.pandoc           | 8 ++++----
 tools/libxl/libxl_cpuid.c                   | 1 +
 tools/misc/xen-cpuid.c                      | 1 +
 xen/arch/x86/msr.c                          | 2 ++
 xen/arch/x86/spec_ctrl.c                    | 3 ++-
 xen/include/asm-x86/msr-index.h             | 3 +++
 xen/include/public/arch-x86/cpufeatureset.h | 1 +
 7 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 2d4d9639d6..b7c2b99298 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -504,10 +504,10 @@ accounting for hardware capabilities as enumerated via CPUID.
 
 Currently accepted:
 
-The Speculation Control hardware features `md-clear`, `ibrsb`, `stibp`, `ibpb`,
-`l1d-flush` and `ssbd` are used by default if available and applicable.  They can
-be ignored, e.g. `no-ibrsb`, at which point Xen won't use them itself, and
-won't offer them to guests.
+The Speculation Control hardware features `srbds-ctrl`, `md-clear`, `ibrsb`,
+`stibp`, `ibpb`, `l1d-flush` and `ssbd` are used by default if available and
+applicable.  They can be ignored, e.g. `no-ibrsb`, at which point Xen won't
+use them itself, and won't offer them to guests.
 
 `rdrand` can be used to override the default disabling of the feature on certain
 AMD systems.  Its negative form can of course also be used to suppress use and
diff --git a/tools/libxl/libxl_cpuid.c b/tools/libxl/libxl_cpuid.c
index c31dd1f304..4e4852ddeb 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},
+        {"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},
         {"cet-ibt",      0x00000007,  0, CPUID_REG_EDX, 20,  1},
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index 8578077545..8d8f3532a2 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -160,6 +160,7 @@ static const char *const str_7d0[32] =
     [ 2] = "avx512_4vnniw", [ 3] = "avx512_4fmaps",
     [ 4] = "fsrm",
 
+    /*  8 */                [ 9] = "srbds-ctrl",
     [10] = "md-clear",
     /* 12 */                [13] = "tsx-force-abort",
     [14] = "serialize",
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index dcacae58de..0bfb5839b2 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -167,6 +167,7 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
     case MSR_CORE_CAPABILITIES:
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
+    case MSR_MCU_OPT_CTRL:
     case MSR_U_CET:
     case MSR_S_CET:
     case MSR_PL0_SSP ... MSR_INTERRUPT_SSP_TABLE:
@@ -327,6 +328,7 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
     case MSR_TEST_CTRL:
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
+    case MSR_MCU_OPT_CTRL:
     case MSR_U_CET:
     case MSR_S_CET:
     case MSR_PL0_SSP ... MSR_INTERRUPT_SSP_TABLE:
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index a94be2d594..a5dfff80c5 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -312,12 +312,13 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
     printk("Speculative mitigation facilities:\n");
 
     /* Hardware features which pertain to speculative mitigations. */
-    printk("  Hardware features:%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
+    printk("  Hardware features:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
            (_7d0 & cpufeat_mask(X86_FEATURE_IBRSB)) ? " IBRS/IBPB" : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_STIBP)) ? " STIBP"     : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_L1D_FLUSH)) ? " L1D_FLUSH" : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_SSBD))  ? " SSBD"      : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_MD_CLEAR)) ? " MD_CLEAR" : "",
+           (_7d0 & cpufeat_mask(X86_FEATURE_SRBDS_CTRL)) ? " SRBDS_CTRL" : "",
            (e8b  & cpufeat_mask(X86_FEATURE_IBPB))  ? " IBPB"      : "",
            (caps & ARCH_CAPS_IBRS_ALL)              ? " IBRS_ALL"  : "",
            (caps & ARCH_CAPS_RDCL_NO)               ? " RDCL_NO"   : "",
diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h
index a4dc48f51f..b328a47ed8 100644
--- a/xen/include/asm-x86/msr-index.h
+++ b/xen/include/asm-x86/msr-index.h
@@ -66,6 +66,9 @@
 #define  TSX_CTRL_RTM_DISABLE               (_AC(1, ULL) <<  0)
 #define  TSX_CTRL_CPUID_CLEAR               (_AC(1, ULL) <<  1)
 
+#define MSR_MCU_OPT_CTRL                    0x00000123
+#define  MCU_OPT_CTRL_RNGDS_MITG_DIS        (_AC(1, ULL) <<  0)
+
 #define MSR_U_CET                           0x000006a0
 #define MSR_S_CET                           0x000006a2
 #define  CET_SHSTK_EN                       (_AC(1, ULL) <<  0)
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 8347a405ac..5ca35d9d97 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(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 */
 XEN_CPUFEATURE(SERIALIZE,     9*32+14) /*a  SERIALIZE insn */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jun 13 09:22:15 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 13 Jun 2020 09:22:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jk2Mh-0003rJ-7i; Sat, 13 Jun 2020 09:22: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=xKhh=72=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jk2Mf-0003rD-JI
 for xen-changelog@lists.xenproject.org; Sat, 13 Jun 2020 09:22:13 +0000
X-Inumbo-ID: 5d2516d0-ad57-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 5d2516d0-ad57-11ea-bb8b-bc764e2007e4;
 Sat, 13 Jun 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=lJb9Gta5CjaZcEI9UgGIwAiEgD1JdbMm0yxokBEQqDA=; b=6YmBvcKJS2HnYSoedRyCduOr7r
 3AupggON1gj+aT5kti1cjedI61RWg7VAS7AQMUnVWmAyrTt+8s1ySIdoow4/Hha9hUw4EpLwjN27v
 5GDGpP5x2x4REamqJX0QiZKALaO4iVbjyQLtIAMjxN2yU2mreRCwrm67QUB1uN8+U1eM=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jk2Me-0002Y3-Cb
 for xen-changelog@lists.xenproject.org; Sat, 13 Jun 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 1jk2Me-0005w7-BS
 for xen-changelog@lists.xenproject.org; Sat, 13 Jun 2020 09:22:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/spec-ctrl: Mitigate the Special Register Buffer Data
 Sampling sidechannel
Message-Id: <E1jk2Me-0005w7-BS@xenbits.xenproject.org>
Date: Sat, 13 Jun 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 6a49b9a7920c82015381740905582b666160d955
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 8 19:47:46 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jun 9 17:42:18 2020 +0100

    x86/spec-ctrl: Mitigate the Special Register Buffer Data Sampling sidechannel
    
    See patch documentation and comments.
    
    This is part of XSA-320 / CVE-2020-0543
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 docs/misc/xen-command-line.pandoc |  8 +++++++-
 xen/arch/x86/acpi/power.c         |  3 +++
 xen/arch/x86/smpboot.c            |  8 +++++---
 xen/arch/x86/spec_ctrl.c          | 41 ++++++++++++++++++++++++++++++++++++++-
 xen/include/asm-x86/spec_ctrl.h   |  2 ++
 5 files changed, 57 insertions(+), 5 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index b7c2b99298..1a69c60139 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -2048,7 +2048,7 @@ By default SSBD will be mitigated at runtime (i.e `ssbd=runtime`).
 ### spec-ctrl (x86)
 > `= List of [ <bool>, xen=<bool>, {pv,hvm,msr-sc,rsb,md-clear}=<bool>,
 >              bti-thunk=retpoline|lfence|jmp, {ibrs,ibpb,ssbd,eager-fpu,
->              l1d-flush,branch-harden}=<bool> ]`
+>              l1d-flush,branch-harden,srb-lock}=<bool> ]`
 
 Controls for speculative execution sidechannel mitigations.  By default, Xen
 will pick the most appropriate mitigations based on compiled in support,
@@ -2125,6 +2125,12 @@ If Xen is compiled with `CONFIG_SPECULATIVE_HARDEN_BRANCH`, the
 speculation barriers to protect selected conditional branches.  By default,
 Xen will enable this mitigation.
 
+On hardware supporting SRBDS_CTRL, the `srb-lock=` option can be used to force
+or prevent Xen from protect the Special Register Buffer from leaking stale
+data. By default, Xen will enable this mitigation, except on parts where MDS
+is fixed and TAA is fixed/mitigated (in which case, there is believed to be no
+way for an attacker to obtain the stale data).
+
 ### sync_console
 > `= <boolean>`
 
diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
index dfffe08e18..4fb1e7a148 100644
--- a/xen/arch/x86/acpi/power.c
+++ b/xen/arch/x86/acpi/power.c
@@ -296,6 +296,9 @@ static int enter_state(u32 state)
     ci->spec_ctrl_flags |= (default_spec_ctrl_flags & SCF_ist_wrmsr);
     spec_ctrl_exit_idle(ci);
 
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+        wrmsrl(MSR_MCU_OPT_CTRL, default_xen_mcu_opt_ctrl);
+
     /* (re)initialise SYSCALL/SYSENTER state, amongst other things. */
     percpu_traps_init();
 
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index f878a00760..5708573c41 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -372,12 +372,14 @@ void start_secondary(void *unused)
     microcode_update_one();
 
     /*
-     * If MSR_SPEC_CTRL is available, apply Xen's default setting and discard
-     * any firmware settings.  Note: MSR_SPEC_CTRL may only become available
-     * after loading microcode.
+     * If any speculative control MSRs are available, apply Xen's default
+     * settings.  Note: These MSRs may only become available after loading
+     * microcode.
      */
     if ( boot_cpu_has(X86_FEATURE_IBRSB) )
         wrmsrl(MSR_SPEC_CTRL, default_xen_spec_ctrl);
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+        wrmsrl(MSR_MCU_OPT_CTRL, default_xen_mcu_opt_ctrl);
 
     tsx_init(); /* Needs microcode.  May change HLE/RTM feature bits. */
 
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index a5dfff80c5..c9f78ead62 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -65,6 +65,9 @@ static unsigned int __initdata l1d_maxphysaddr;
 static bool __initdata cpu_has_bug_msbds_only; /* => minimal HT impact. */
 static bool __initdata cpu_has_bug_mds; /* Any other M{LP,SB,FB}DS combination. */
 
+static int8_t __initdata opt_srb_lock = -1;
+uint64_t __read_mostly default_xen_mcu_opt_ctrl;
+
 static int __init parse_spec_ctrl(const char *s)
 {
     const char *ss;
@@ -112,6 +115,7 @@ static int __init parse_spec_ctrl(const char *s)
             opt_ssbd = false;
             opt_l1d_flush = 0;
             opt_branch_harden = false;
+            opt_srb_lock = 0;
         }
         else if ( val > 0 )
             rc = -EINVAL;
@@ -178,6 +182,8 @@ static int __init parse_spec_ctrl(const char *s)
             opt_l1d_flush = val;
         else if ( (val = parse_boolean("branch-harden", s, ss)) >= 0 )
             opt_branch_harden = val;
+        else if ( (val = parse_boolean("srb-lock", s, ss)) >= 0 )
+            opt_srb_lock = val;
         else
             rc = -EINVAL;
 
@@ -341,7 +347,7 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
                "\n");
 
     /* Settings for Xen's protection, irrespective of guests. */
-    printk("  Xen settings: BTI-Thunk %s, SPEC_CTRL: %s%s%s, Other:%s%s%s%s\n",
+    printk("  Xen settings: BTI-Thunk %s, SPEC_CTRL: %s%s%s, Other:%s%s%s%s%s\n",
            thunk == THUNK_NONE      ? "N/A" :
            thunk == THUNK_RETPOLINE ? "RETPOLINE" :
            thunk == THUNK_LFENCE    ? "LFENCE" :
@@ -352,6 +358,8 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
            (default_xen_spec_ctrl & SPEC_CTRL_SSBD)  ? " SSBD+" : " SSBD-",
            !(caps & ARCH_CAPS_TSX_CTRL)              ? "" :
            (opt_tsx & 1)                             ? " TSX+" : " TSX-",
+           !boot_cpu_has(X86_FEATURE_SRBDS_CTRL)     ? "" :
+           opt_srb_lock                              ? " SRB_LOCK+" : " SRB_LOCK-",
            opt_ibpb                                  ? " IBPB"  : "",
            opt_l1d_flush                             ? " L1D_FLUSH" : "",
            opt_md_clear_pv || opt_md_clear_hvm       ? " VERW"  : "",
@@ -1157,6 +1165,34 @@ void __init init_speculation_mitigations(void)
         tsx_init();
     }
 
+    /* Calculate suitable defaults for MSR_MCU_OPT_CTRL */
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+    {
+        uint64_t val;
+
+        rdmsrl(MSR_MCU_OPT_CTRL, val);
+
+        /*
+         * On some SRBDS-affected hardware, it may be safe to relax srb-lock
+         * by default.
+         *
+         * On parts which enumerate MDS_NO and not TAA_NO, TSX is the only way
+         * to access the Fill Buffer.  If TSX isn't available (inc. SKU
+         * reasons on some models), or TSX is explicitly disabled, then there
+         * is no need for the extra overhead to protect RDRAND/RDSEED.
+         */
+        if ( opt_srb_lock == -1 &&
+             (caps & (ARCH_CAPS_MDS_NO|ARCH_CAPS_TAA_NO)) == ARCH_CAPS_MDS_NO &&
+             (!cpu_has_hle || ((caps & ARCH_CAPS_TSX_CTRL) && opt_tsx == 0)) )
+            opt_srb_lock = 0;
+
+        val &= ~MCU_OPT_CTRL_RNGDS_MITG_DIS;
+        if ( !opt_srb_lock )
+            val |= MCU_OPT_CTRL_RNGDS_MITG_DIS;
+
+        default_xen_mcu_opt_ctrl = val;
+    }
+
     print_details(thunk, caps);
 
     /*
@@ -1188,6 +1224,9 @@ void __init init_speculation_mitigations(void)
 
         wrmsrl(MSR_SPEC_CTRL, bsp_delay_spec_ctrl ? 0 : default_xen_spec_ctrl);
     }
+
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+        wrmsrl(MSR_MCU_OPT_CTRL, default_xen_mcu_opt_ctrl);
 }
 
 static void __init __maybe_unused build_assertions(void)
diff --git a/xen/include/asm-x86/spec_ctrl.h b/xen/include/asm-x86/spec_ctrl.h
index 9caecddfec..b252bb8631 100644
--- a/xen/include/asm-x86/spec_ctrl.h
+++ b/xen/include/asm-x86/spec_ctrl.h
@@ -54,6 +54,8 @@ extern int8_t opt_pv_l1tf_hwdom, opt_pv_l1tf_domu;
  */
 extern paddr_t l1tf_addr_mask, l1tf_safe_maddr;
 
+extern uint64_t default_xen_mcu_opt_ctrl;
+
 static inline void init_shadow_spec_ctrl_state(void)
 {
     struct cpu_info *info = get_cpu_info();
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jun 13 09:22:25 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 13 Jun 2020 09: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 1jk2Mr-0003tH-Bm; Sat, 13 Jun 2020 09: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=xKhh=72=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jk2Mp-0003rD-Gp
 for xen-changelog@lists.xenproject.org; Sat, 13 Jun 2020 09:22:23 +0000
X-Inumbo-ID: 63290672-ad57-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 63290672-ad57-11ea-8496-bc764e2007e4;
 Sat, 13 Jun 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=AR3dnMjBk9wqGMjjk3n2yQpaskP3ZpXtor6nSeAf8Bk=; b=LNKnWGDI8RsXXGZfIwsZ/0II0/
 yyZ5cnM66Yv7e0lv41wiNlLbrBFc6ln/CggEFEINQef6zt+ua5jlonkGeHdcvKH6L6Ss4MXbMgyyq
 QEheOsnuOczKeIxubZDDM71Xw1iQxvEvlLFNTROONyD22QTIkYbKVFDE6ZgsdEDM51ck=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jk2Mo-0002YH-Fa
 for xen-changelog@lists.xenproject.org; Sat, 13 Jun 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 1jk2Mo-0005we-Ej
 for xen-changelog@lists.xenproject.org; Sat, 13 Jun 2020 09:22:22 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] xen/hypfs: fix loglvl parameter setting
Message-Id: <E1jk2Mo-0005we-Ej@xenbits.xenproject.org>
Date: Sat, 13 Jun 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 ceaae74cedd2f7f8ae5c66b90da82f7ead206011
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Jun 9 17:45:46 2020 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Jun 11 16:15:15 2020 +0100

    xen/hypfs: fix loglvl parameter setting
    
    Writing the runtime parameters loglvl or guest_loglvl omits setting the
    new length of the resulting parameter value.
    
    Reported-by: George Dunlap <george.dunlap@citrix.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    Release-acked-by: Paul Durran <paul@xen.org>
---
 xen/drivers/char/console.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index 56e24821b2..861ad53a8f 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -241,14 +241,25 @@ static int _parse_loglvl(const char *s, int *lower, int *upper, char *val)
 
 static int parse_loglvl(const char *s)
 {
-    return _parse_loglvl(s, &xenlog_lower_thresh, &xenlog_upper_thresh,
-                         xenlog_val);
+    int ret;
+
+    ret = _parse_loglvl(s, &xenlog_lower_thresh, &xenlog_upper_thresh,
+                        xenlog_val);
+    custom_runtime_set_var(param_2_parfs(parse_loglvl), xenlog_val);
+
+    return ret;
 }
 
 static int parse_guest_loglvl(const char *s)
 {
-    return _parse_loglvl(s, &xenlog_guest_lower_thresh,
-                         &xenlog_guest_upper_thresh, xenlog_guest_val);
+    int ret;
+
+    ret = _parse_loglvl(s, &xenlog_guest_lower_thresh,
+                        &xenlog_guest_upper_thresh, xenlog_guest_val);
+    custom_runtime_set_var(param_2_parfs(parse_guest_loglvl),
+                           xenlog_guest_val);
+
+    return ret;
 }
 
 static char *loglvl_str(int lvl)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jun 13 09:22:34 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 13 Jun 2020 09:22: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 1jk2N0-0003uT-DI; Sat, 13 Jun 2020 09:22: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=xKhh=72=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jk2Mz-0003uI-8p
 for xen-changelog@lists.xenproject.org; Sat, 13 Jun 2020 09:22:33 +0000
X-Inumbo-ID: 692e5b9e-ad57-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 692e5b9e-ad57-11ea-bb8b-bc764e2007e4;
 Sat, 13 Jun 2020 09:22: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=sl+aEk3ul/wPJARrI1PWCKNhj4OI3sw/Q/9cx/ZjxU4=; b=JjENhDAMFSJRQr+/VEAjlvuZ6x
 0DF/LPucD4dS/ooV1+2YblHXxcI7njYP77qKOy9aorllnDbSKfMqH1SopGYCfZ9hSzCD9pSi5V+uS
 pGJDSHBKecu6tQvXK8/VPI13HcWYty0fZf9S7iiNFOTQVt2R4Q6hYqV/A15BEginVHHU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jk2My-0002YP-In
 for xen-changelog@lists.xenproject.org; Sat, 13 Jun 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 1jk2My-0005xC-Hg
 for xen-changelog@lists.xenproject.org; Sat, 13 Jun 2020 09:22:32 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/spec-ctrl: Update docs with SRBDS workaround
Message-Id: <E1jk2My-0005xC-Hg@xenbits.xenproject.org>
Date: Sat, 13 Jun 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 7028534d8482d25860c4d1aa8e45f0b911abfc5a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 10 18:57:00 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jun 11 16:26:06 2020 +0100

    x86/spec-ctrl: Update docs with SRBDS workaround
    
    RDRAND/RDSEED can be hidden using cpuid= to mitigate SRBDS if microcode
    isn't available.
    
    This is part of XSA-320 / CVE-2020-0543.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 docs/misc/xen-command-line.pandoc | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 1a69c60139..fde749c669 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -502,16 +502,21 @@ choice of `dom0-kernel` is deprecated and not supported by all Dom0 kernels.
 This option allows for fine tuning of the facilities Xen will use, after
 accounting for hardware capabilities as enumerated via CPUID.
 
+Unless otherwise noted, options only have any effect in their negative form,
+to hide the named feature(s).  Ignoring a feature using this mechanism will
+cause Xen not to use the feature, nor offer them as usable to guests.
+
 Currently accepted:
 
 The Speculation Control hardware features `srbds-ctrl`, `md-clear`, `ibrsb`,
 `stibp`, `ibpb`, `l1d-flush` and `ssbd` are used by default if available and
-applicable.  They can be ignored, e.g. `no-ibrsb`, at which point Xen won't
-use them itself, and won't offer them to guests.
+applicable.  They can all be ignored.
 
-`rdrand` can be used to override the default disabling of the feature on certain
-AMD systems.  Its negative form can of course also be used to suppress use and
-exposure of the feature.
+`rdrand` and `rdseed` can be ignored, as a mitigation to XSA-320 /
+CVE-2020-0543.  The RDRAND feature is disabled by default on certain AMD
+systems, due to possible malfunctions after ACPI S3 suspend/resume.  `rdrand`
+may be used in its positive form to override Xen's default behaviour on these
+systems, and make the feature fully usable.
 
 ### cpuid_mask_cpu
 > `= fam_0f_rev_[cdefg] | fam_10_rev_[bc] | fam_11_rev_b`
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jun 15 09:44:10 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Jun 2020 09:44: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 1jklev-0000fe-BQ; Mon, 15 Jun 2020 09:44:05 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=TbyT=74=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jklet-0000fZ-TZ
 for xen-changelog@lists.xenproject.org; Mon, 15 Jun 2020 09:44:03 +0000
X-Inumbo-ID: bea4d300-aeec-11ea-b7ea-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id bea4d300-aeec-11ea-b7ea-12813bfff9fa;
 Mon, 15 Jun 2020 09: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=Lp0n+ggCQ4fbcRoZeeZZGbh5+P2uijlYGB7jK38Arh0=; b=t0wRChPFom7wvh6U7DS8VZq2r/
 yMOupCqzfzBmkwhL+nq69KKPmOBOkCQ9iJep6Ds4TnJt88OfNdiR3rr3YSzUPvQd1d+WaNs/2gLpI
 AZBl4+c3gNXBlW3mN9k16i9A4Y8zNTQO2Xn7JKOW40CaT/YMoIjOd3R0JUQo/tPlYHuA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jkles-000582-4k
 for xen-changelog@lists.xenproject.org; Mon, 15 Jun 2020 09:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jkles-0007ox-3Z
 for xen-changelog@lists.xenproject.org; Mon, 15 Jun 2020 09:44:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] tools/libxengnttab: correct size of allocated memory
Message-Id: <E1jkles-0007ox-3Z@xenbits.xenproject.org>
Date: Mon, 15 Jun 2020 09: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 aad20e538d7ba0e36f5ed8d2bebb74096e3a6d7f
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed May 20 10:35:01 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jun 11 17:13:20 2020 +0100

    tools/libxengnttab: correct size of allocated memory
    
    The size of the memory allocated for the IOCTL_GNTDEV_MAP_GRANT_REF
    ioctl() parameters is calculated wrong, which results in too much
    memory allocated.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/libs/gnttab/freebsd.c | 2 +-
 tools/libs/gnttab/linux.c   | 8 +++-----
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/tools/libs/gnttab/freebsd.c b/tools/libs/gnttab/freebsd.c
index 886b588303..0588501d0f 100644
--- a/tools/libs/gnttab/freebsd.c
+++ b/tools/libs/gnttab/freebsd.c
@@ -74,7 +74,7 @@ void *osdep_gnttab_grant_map(xengnttab_handle *xgt,
     void *addr = NULL;
     int domids_stride;
     unsigned int refs_size = ROUNDUP(count *
-                                     sizeof(struct ioctl_gntdev_map_grant_ref),
+                                     sizeof(struct ioctl_gntdev_grant_ref),
                                      PAGE_SHIFT);
 
     domids_stride = (flags & XENGNTTAB_GRANT_MAP_SINGLE_DOMAIN) ? 0 : 1;
diff --git a/tools/libs/gnttab/linux.c b/tools/libs/gnttab/linux.c
index a01bb6c698..74331a4c7b 100644
--- a/tools/libs/gnttab/linux.c
+++ b/tools/libs/gnttab/linux.c
@@ -91,9 +91,7 @@ void *osdep_gnttab_grant_map(xengnttab_handle *xgt,
 {
     int fd = xgt->fd;
     struct ioctl_gntdev_map_grant_ref *map;
-    unsigned int map_size = ROUNDUP((sizeof(*map) + (count - 1) *
-                                    sizeof(struct ioctl_gntdev_map_grant_ref)),
-                                    PAGE_SHIFT);
+    unsigned int map_size = sizeof(*map) + (count - 1) * sizeof(map->refs[0]);
     void *addr = NULL;
     int domids_stride = 1;
     int i;
@@ -102,10 +100,10 @@ void *osdep_gnttab_grant_map(xengnttab_handle *xgt,
         domids_stride = 0;
 
     if ( map_size <= PAGE_SIZE )
-        map = alloca(sizeof(*map) +
-                     (count - 1) * sizeof(struct ioctl_gntdev_map_grant_ref));
+        map = alloca(map_size);
     else
     {
+        map_size = ROUNDUP(map_size, PAGE_SHIFT);
         map = mmap(NULL, map_size, PROT_READ | PROT_WRITE,
                    MAP_PRIVATE | MAP_ANON | MAP_POPULATE, -1, 0);
         if ( map == MAP_FAILED )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jun 15 09:44:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Jun 2020 09:44:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jklf4-0000g1-D2; Mon, 15 Jun 2020 09:44: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=TbyT=74=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jklf3-0000fw-I4
 for xen-changelog@lists.xenproject.org; Mon, 15 Jun 2020 09:44:13 +0000
X-Inumbo-ID: c4a91bda-aeec-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id c4a91bda-aeec-11ea-bca7-bc764e2007e4;
 Mon, 15 Jun 2020 09:44:12 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=NU72Q2MREwO0fyAlYGCMzllpJ9lrG4hCb6eUlwcnqJ0=; b=1aT3ouqp0PEgApTtqNx1SbX1fJ
 y4vN9IlqMidQDrYB6u47MiWViK9M20Z+tESUVKLm+pr/IyGfGJyhJdi9fQ++YP2OD4qTKAs0+qyyH
 RwA6ddkcsor1XZ9RXDXMNgkm1Y/tEIzoMmOHY/I9YOhQVnqL12okLbewI8PIP/1lQEYQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jklf2-000588-7x
 for xen-changelog@lists.xenproject.org; Mon, 15 Jun 2020 09:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jklf2-0007pU-6w
 for xen-changelog@lists.xenproject.org; Mon, 15 Jun 2020 09:44:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] docs: Minor build improvements
Message-Id: <E1jklf2-0007pU-6w@xenbits.xenproject.org>
Date: Mon, 15 Jun 2020 09:44: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 10ea4e417b4655f3550b6e9645f7f2bad08dba13
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Jun 8 18:12:44 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jun 11 17:19:26 2020 +0100

    docs: Minor build improvements
    
    Don't use "set -x" for the figs rule.  It doesn't take effect in the recursive
    make environment.
    
    Turn the HTML manpage comments into makefile comments, not shell comments.
    This saves 3x shell invocations per manpage.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 docs/Makefile | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/docs/Makefile b/docs/Makefile
index 3eae2dae60..8de1efb6f5 100644
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -58,7 +58,7 @@ txt: $(DOC_TXT)
 .PHONY: figs
 figs:
 ifneq ($(FIG2DEV),)
-	set -x; $(MAKE) -C figs
+	$(MAKE) -C figs
 else
 	@echo "fig2dev (transfig) not installed; skipping figs."
 endif
@@ -105,12 +105,12 @@ else
 endif
 
 # HTML manpages
+# sed used to fix up links between man-pages
+# 1) L<xl(1)> -> L<xl(1)|relative:xl.1.html>
+# 2) <a href="relative:xl.1.html"> -> <a href="xl.1.html">
 html/man/%.$(1).html: man/%.$(1).pod Makefile
 ifneq ($(POD2HTML),)
 	@$(INSTALL_DIR) $$(@D)
-	# Fix up links between man-pages
-	# 1) L<xl(1)> -> L<xl(1)|relative:xl.1.html>
-	# 2) <a href="relative:xl.1.html"> -> <a href="xl.1.html">
 	sed -r -e 's%L<([^>]+)\(([1-9])\)>%L<\1(\2)|relative:\1.\2.html>%g' $$< | \
 		$(POD2HTML) | \
 		sed -r -e 's%( href=")relative:%\1%g' > $$@
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jun 15 09:44:24 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Jun 2020 09:44:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jklfE-0000hC-EU; Mon, 15 Jun 2020 09:44:24 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=TbyT=74=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jklfD-0000gz-9L
 for xen-changelog@lists.xenproject.org; Mon, 15 Jun 2020 09:44:23 +0000
X-Inumbo-ID: cab140f2-aeec-11ea-b7ea-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id cab140f2-aeec-11ea-b7ea-12813bfff9fa;
 Mon, 15 Jun 2020 09:44:22 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=zhlynKsbS2cwYCM9/IlGiPUYdZawcFd8r/BbnFbgw5U=; b=027CIBlIqFJgqqMlp3DOWyOzEL
 96GQ/Fo0HsJVP62UyopqNm8I8SMjysQpQCcOQyaYp1u7P3u9/BkAT8z0oYiqRf15Es15C9NESSMgJ
 DcWqGEpDp7l44PUzcRDBAjaVCI8ynSLloLuSAFseoKInAIb2yErn4y5l4kvj9me6XZTo=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jklfC-00058J-Bc
 for xen-changelog@lists.xenproject.org; Mon, 15 Jun 2020 09:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jklfC-0007qy-9y
 for xen-changelog@lists.xenproject.org; Mon, 15 Jun 2020 09:44:22 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] CHANGELOG: add 'domid_policy' and domid preservation on
 migrate
Message-Id: <E1jklfC-0007qy-9y@xenbits.xenproject.org>
Date: Mon, 15 Jun 2020 09:44: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 b87dd7bb3946c6a18f4c3f622ce7e77a3deb9f17
Author:     Paul Durrant <pdurrant@amazon.com>
AuthorDate: Tue Jun 9 17:29:21 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jun 11 18:12:22 2020 +0100

    CHANGELOG: add 'domid_policy' and domid preservation on migrate
    
    Signed-off-by: Paul Durrant <pdurrant@amazon.com>
    Acked-by: George Dunlap <george.dunlap@citrix.com>
---
 CHANGELOG.md | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8786c51cb4..cb1566ea5b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -18,6 +18,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Initial support to run on Hyper-V.
  - Initial hypervisor file system (hypfs) support.
  - libxl support for running qemu-xen device model in a linux stubdomain.
+ - New 'domid_policy', allowing domain-ids to be randomly chosen.
+ - Option to preserve domain-id across migrate or save+restore.
 
 ## [4.13.0](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.13.0) - 2019-12-17
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jun 15 09:44:34 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Jun 2020 09:44:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jklfO-0000jG-G1; Mon, 15 Jun 2020 09:44:34 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=TbyT=74=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jklfN-0000iO-4T
 for xen-changelog@lists.xenproject.org; Mon, 15 Jun 2020 09:44:33 +0000
X-Inumbo-ID: d0b8f44a-aeec-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id d0b8f44a-aeec-11ea-bb8b-bc764e2007e4;
 Mon, 15 Jun 2020 09:44:32 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=CvA+G+a7QYbUGf0lOM21fV+IWQVZsVxyKaxKtA5tNAU=; b=HOno9h/Df8kxeKmOu/W4zNjv3y
 R7mRwtWIeXgT+0KRjCZoPSP3sTdo3X2D4P4uA5k64OtXwbDAfbL1Y/I3yfsHW6RwKzN9p+dWPBdcj
 L83ssMvTRC8MeSxOwylkt83avZAfOd/2CkdextuFS4ayuWuocH3InGydMuLcPpiaBbSU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jklfM-00058Q-En
 for xen-changelog@lists.xenproject.org; Mon, 15 Jun 2020 09:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jklfM-0007rh-Dq
 for xen-changelog@lists.xenproject.org; Mon, 15 Jun 2020 09:44:32 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] CHANGELOG: add revised kdd handshake (supporting Windows
 7, 8, and 10)
Message-Id: <E1jklfM-0007rh-Dq@xenbits.xenproject.org>
Date: Mon, 15 Jun 2020 09:44: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 3664f7b7788b66bb802432e6748be0fb57993581
Author:     Paul Durrant <pdurrant@amazon.com>
AuthorDate: Tue Jun 9 17:29:22 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jun 11 18:12:22 2020 +0100

    CHANGELOG: add revised kdd handshake (supporting Windows 7, 8, and 10)
    
    Signed-off-by: Paul Durrant <pdurrant@amazon.com>
    Acked-by: George Dunlap <george.dunlap@citrix.com>
---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index cb1566ea5b..43fd260156 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -20,6 +20,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - libxl support for running qemu-xen device model in a linux stubdomain.
  - New 'domid_policy', allowing domain-ids to be randomly chosen.
  - Option to preserve domain-id across migrate or save+restore.
+ - Support in kdd for initial KD protocol handshake for Win 7, 8 and 10 (64 bit).
 
 ## [4.13.0](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.13.0) - 2019-12-17
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jun 15 09:44:44 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Jun 2020 09:44:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jklfY-0000kQ-Hj; Mon, 15 Jun 2020 09:44:44 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=TbyT=74=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jklfX-0000kE-JX
 for xen-changelog@lists.xenproject.org; Mon, 15 Jun 2020 09:44:43 +0000
X-Inumbo-ID: d679ef89-aeec-11ea-b7ea-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id d679ef89-aeec-11ea-b7ea-12813bfff9fa;
 Mon, 15 Jun 2020 09:44: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=LavQMtpQqaCM69xLz4AjLCY+dhKbzsXsBlLD/mwgouM=; b=e6VFZv9LV+b6bAQeU83UUqEO9R
 5saIXBaRdEBQLHCFidv0Afi83/z6kJZnL13KQJiNmaiz1Cypg76qNWPZDneFfZMwGXdjiDL/zwuKG
 dsYbI8s2VNlTcq+BFtr9VjxatjSD/Abk/oNVPvyjYXJcsw4LTKmmwKk+7lCYZlJ1k/Hg=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jklfW-00058X-Hx
 for xen-changelog@lists.xenproject.org; Mon, 15 Jun 2020 09:44:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jklfW-0007sC-H0
 for xen-changelog@lists.xenproject.org; Mon, 15 Jun 2020 09:44:42 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/passthrough: do not assert edge triggered GSIs for
 PVH dom0
Message-Id: <E1jklfW-0007sC-H0@xenbits.xenproject.org>
Date: Mon, 15 Jun 2020 09:44: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 6fa25d568f4e597b1940309d97cfd98f4f6eecd6
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Wed Jun 10 16:29:22 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jun 11 18:14:29 2020 +0100

    x86/passthrough: do not assert edge triggered GSIs for PVH dom0
    
    Edge triggered interrupts do not assert the line, so the handling done
    in Xen should also avoid asserting it. Asserting the line prevents
    further edge triggered interrupts on the same vIO-APIC pin from being
    delivered, since the line is not de-asserted.
    
    One case of such kind of interrupt is the RTC timer, which is edge
    triggered and available to a PVH dom0. Note this should not affect
    domUs, as it only modifies the behavior of IDENTITY_GSI kind of passed
    through interrupts.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/arch/x86/hvm/irq.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/hvm/irq.c b/xen/arch/x86/hvm/irq.c
index 9c8adbc495..fd02cf2e8d 100644
--- a/xen/arch/x86/hvm/irq.c
+++ b/xen/arch/x86/hvm/irq.c
@@ -169,9 +169,10 @@ void hvm_pci_intx_deassert(
 
 void hvm_gsi_assert(struct domain *d, unsigned int gsi)
 {
+    int trig = vioapic_get_trigger_mode(d, gsi);
     struct hvm_irq *hvm_irq = hvm_domain_irq(d);
 
-    if ( gsi >= hvm_irq->nr_gsis )
+    if ( gsi >= hvm_irq->nr_gsis || trig < 0 )
     {
         ASSERT_UNREACHABLE();
         return;
@@ -186,9 +187,10 @@ void hvm_gsi_assert(struct domain *d, unsigned int gsi)
      * to know if the GSI is pending or not.
      */
     spin_lock(&d->arch.hvm.irq_lock);
-    if ( !hvm_irq->gsi_assert_count[gsi] )
+    if ( trig == VIOAPIC_EDGE_TRIG || !hvm_irq->gsi_assert_count[gsi] )
     {
-        hvm_irq->gsi_assert_count[gsi] = 1;
+        if ( trig == VIOAPIC_LEVEL_TRIG )
+            hvm_irq->gsi_assert_count[gsi] = 1;
         assert_gsi(d, gsi);
     }
     spin_unlock(&d->arch.hvm.irq_lock);
@@ -196,11 +198,12 @@ void hvm_gsi_assert(struct domain *d, unsigned int gsi)
 
 void hvm_gsi_deassert(struct domain *d, unsigned int gsi)
 {
+    int trig = vioapic_get_trigger_mode(d, gsi);
     struct hvm_irq *hvm_irq = hvm_domain_irq(d);
 
-    if ( gsi >= hvm_irq->nr_gsis )
+    if ( trig <= VIOAPIC_EDGE_TRIG || gsi >= hvm_irq->nr_gsis )
     {
-        ASSERT_UNREACHABLE();
+        ASSERT(trig == VIOAPIC_EDGE_TRIG && gsi < hvm_irq->nr_gsis);
         return;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jun 15 09:44:54 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Jun 2020 09:44:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jklfi-0000lS-JN; Mon, 15 Jun 2020 09:44: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=TbyT=74=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jklfh-0000kE-IH
 for xen-changelog@lists.xenproject.org; Mon, 15 Jun 2020 09:44:53 +0000
X-Inumbo-ID: dcbcf746-aeec-11ea-b7ea-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id dcbcf746-aeec-11ea-b7ea-12813bfff9fa;
 Mon, 15 Jun 2020 09:44: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=6bImQztFlP0t7X6ryJrA7Apz7uWTFJNku4a6s1F5q0A=; b=hkRsl7sylak8yJfXOG6FcwCyKC
 mhOYkXqXZRZbRPi5q7Kngb/zxYYupt/FXKLjIS1pXlWoFy89bJMIz58Gp1bsclFogUHBd5VuEQsmj
 tdlFVTcFghovijN8GBx5eO949FJrz+FABcUzFAb9vNd1C75vSjjCd+PK7OUCVaDYwdlQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jklfg-00058h-L3
 for xen-changelog@lists.xenproject.org; Mon, 15 Jun 2020 09:44:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jklfg-0007t0-K9
 for xen-changelog@lists.xenproject.org; Mon, 15 Jun 2020 09:44:52 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/passthrough: introduce a flag for GSIs not requiring
 an EOI or unmask
Message-Id: <E1jklfg-0007t0-K9@xenbits.xenproject.org>
Date: Mon, 15 Jun 2020 09:44: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 2995d0afdf2d3fb44d07eada088db3613741db1e
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Wed Jun 10 16:29:23 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jun 11 18:14:29 2020 +0100

    x86/passthrough: introduce a flag for GSIs not requiring an EOI or unmask
    
    There's no need to setup a timer for GSIs that are edge triggered,
    since those don't require any EIO or unmask, and hence couldn't block
    other interrupts.
    
    Note this is only used by PVH dom0, that can setup the passthrough of
    edge triggered interrupts from the vIO-APIC. One example of such kind
    of interrupt that can be used by a PVH dom0 would be the RTC timer.
    
    While there introduce an out label to do the unlock and reduce code
    duplication.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/drivers/passthrough/io.c  | 24 +++++++++++++++---------
 xen/include/asm-x86/hvm/irq.h |  2 ++
 2 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/xen/drivers/passthrough/io.c b/xen/drivers/passthrough/io.c
index b292e79382..6b1305a3e5 100644
--- a/xen/drivers/passthrough/io.c
+++ b/xen/drivers/passthrough/io.c
@@ -138,7 +138,8 @@ static void pt_pirq_softirq_reset(struct hvm_pirq_dpci *pirq_dpci)
 
 bool pt_irq_need_timer(uint32_t flags)
 {
-    return !(flags & (HVM_IRQ_DPCI_GUEST_MSI | HVM_IRQ_DPCI_TRANSLATE));
+    return !(flags & (HVM_IRQ_DPCI_GUEST_MSI | HVM_IRQ_DPCI_TRANSLATE |
+                      HVM_IRQ_DPCI_NO_EOI));
 }
 
 static int pt_irq_guest_eoi(struct domain *d, struct hvm_pirq_dpci *pirq_dpci,
@@ -558,6 +559,12 @@ int pt_irq_create_bind(
                      */
                     ASSERT(!mask);
                     share = trigger_mode;
+                    if ( trigger_mode == VIOAPIC_EDGE_TRIG )
+                        /*
+                         * Edge IO-APIC interrupt, no EOI or unmask to perform
+                         * and hence no timer needed.
+                         */
+                        pirq_dpci->flags |= HVM_IRQ_DPCI_NO_EOI;
                 }
             }
 
@@ -897,17 +904,13 @@ static void hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci)
             send_guest_pirq(d, pirq);
 
             if ( pirq_dpci->flags & HVM_IRQ_DPCI_GUEST_MSI )
-            {
-                spin_unlock(&d->event_lock);
-                return;
-            }
+                goto out;
         }
 
         if ( pirq_dpci->flags & HVM_IRQ_DPCI_GUEST_MSI )
         {
             vmsi_deliver_pirq(d, pirq_dpci);
-            spin_unlock(&d->event_lock);
-            return;
+            goto out;
         }
 
         list_for_each_entry ( digl, &pirq_dpci->digl_list, list )
@@ -920,6 +923,8 @@ static void hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci)
         if ( pirq_dpci->flags & HVM_IRQ_DPCI_IDENTITY_GSI )
         {
             hvm_gsi_assert(d, pirq->pirq);
+            if ( pirq_dpci->flags & HVM_IRQ_DPCI_NO_EOI )
+                goto out;
             pirq_dpci->pending++;
         }
 
@@ -927,8 +932,7 @@ static void hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci)
         {
             /* for translated MSI to INTx interrupt, eoi as early as possible */
             __msi_pirq_eoi(pirq_dpci);
-            spin_unlock(&d->event_lock);
-            return;
+            goto out;
         }
 
         /*
@@ -941,6 +945,8 @@ static void hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci)
         ASSERT(pt_irq_need_timer(pirq_dpci->flags));
         set_timer(&pirq_dpci->timer, NOW() + PT_IRQ_TIME_OUT);
     }
+
+ out:
     spin_unlock(&d->event_lock);
 }
 
diff --git a/xen/include/asm-x86/hvm/irq.h b/xen/include/asm-x86/hvm/irq.h
index d306cfeade..532880d497 100644
--- a/xen/include/asm-x86/hvm/irq.h
+++ b/xen/include/asm-x86/hvm/irq.h
@@ -121,6 +121,7 @@ struct dev_intx_gsi_link {
 #define _HVM_IRQ_DPCI_GUEST_PCI_SHIFT           4
 #define _HVM_IRQ_DPCI_GUEST_MSI_SHIFT           5
 #define _HVM_IRQ_DPCI_IDENTITY_GSI_SHIFT        6
+#define _HVM_IRQ_DPCI_NO_EOI_SHIFT              7
 #define _HVM_IRQ_DPCI_TRANSLATE_SHIFT          15
 #define HVM_IRQ_DPCI_MACH_PCI        (1u << _HVM_IRQ_DPCI_MACH_PCI_SHIFT)
 #define HVM_IRQ_DPCI_MACH_MSI        (1u << _HVM_IRQ_DPCI_MACH_MSI_SHIFT)
@@ -129,6 +130,7 @@ struct dev_intx_gsi_link {
 #define HVM_IRQ_DPCI_GUEST_PCI       (1u << _HVM_IRQ_DPCI_GUEST_PCI_SHIFT)
 #define HVM_IRQ_DPCI_GUEST_MSI       (1u << _HVM_IRQ_DPCI_GUEST_MSI_SHIFT)
 #define HVM_IRQ_DPCI_IDENTITY_GSI    (1u << _HVM_IRQ_DPCI_IDENTITY_GSI_SHIFT)
+#define HVM_IRQ_DPCI_NO_EOI          (1u << _HVM_IRQ_DPCI_NO_EOI_SHIFT)
 #define HVM_IRQ_DPCI_TRANSLATE       (1u << _HVM_IRQ_DPCI_TRANSLATE_SHIFT)
 
 struct hvm_gmsi_info {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jun 15 09:45:04 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Jun 2020 09:45:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jklfs-0000mS-L1; Mon, 15 Jun 2020 09:45: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=TbyT=74=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jklfr-0000mH-Df
 for xen-changelog@lists.xenproject.org; Mon, 15 Jun 2020 09:45:03 +0000
X-Inumbo-ID: e2c0b2ea-aeec-11ea-b7ea-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id e2c0b2ea-aeec-11ea-b7ea-12813bfff9fa;
 Mon, 15 Jun 2020 09:45: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=GnpBXXoWyqMstQIP8A0KC9OwOgmPYKIzez9NkhCvymU=; b=MNKURJRFY6wPGLQHfgFQgNptPr
 TRDYF6zBv0Ud0kvFtlcETwifsaZVHInG/bS0bqiFfqe7wIDQulrKBTuvRJdw1p29xlNuuUKJyUq2W
 qgvcTPUPuv/zmbJfLNPQJ9BexZnDNYRE3RIMz9jUo5UuP7GVOKmIF1KcUPjFC+ZYZ/ko=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jklfq-00059t-O1
 for xen-changelog@lists.xenproject.org; Mon, 15 Jun 2020 09:45:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jklfq-0007tj-NE
 for xen-changelog@lists.xenproject.org; Mon, 15 Jun 2020 09:45:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] tools/libxc: Drop config_transformed parameter from
 xc_cpuid_set()
Message-Id: <E1jklfq-0007tj-NE@xenbits.xenproject.org>
Date: Mon, 15 Jun 2020 09:45: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 b91825f628c9a62cf2a3a0d972ea81484a8b7fce
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jun 12 11:55:19 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Fri Jun 12 16:54:25 2020 +0100

    tools/libxc: Drop config_transformed parameter from xc_cpuid_set()
    
    libxl is now the sole caller of xc_cpuid_set().  The config_transformed output
    is ignored, and this patch trivially highlights the resulting memory leak.
    
    "transformed" config is now properly forwarded on migrate as part of the
    general VM state, so delete the transformation logic completely, rather than
    trying to adjust just libxl to avoid leaking memory.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    Release-acked-by: Paul Durrant <paul@xen.org>
    Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 tools/libxc/include/xenctrl.h |  3 +--
 tools/libxc/xc_cpuid_x86.c    | 25 +------------------------
 tools/libxl/libxl_cpuid.c     |  3 +--
 3 files changed, 3 insertions(+), 28 deletions(-)

diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h
index f9e17ae424..113ddd935d 100644
--- a/tools/libxc/include/xenctrl.h
+++ b/tools/libxc/include/xenctrl.h
@@ -1795,8 +1795,7 @@ int xc_domain_debug_control(xc_interface *xch,
 int xc_cpuid_set(xc_interface *xch,
                  uint32_t domid,
                  const unsigned int *input,
-                 const char **config,
-                 char **config_transformed);
+                 const char **config);
 
 /*
  * Make adjustments to the CPUID settings for a domain.
diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c
index 89d2ecdad2..b42edd6457 100644
--- a/tools/libxc/xc_cpuid_x86.c
+++ b/tools/libxc/xc_cpuid_x86.c
@@ -279,7 +279,7 @@ int xc_set_domain_cpu_policy(xc_interface *xch, uint32_t domid,
  */
 int xc_cpuid_set(
     xc_interface *xch, uint32_t domid, const unsigned int *input,
-    const char **config, char **config_transformed)
+    const char **config)
 {
     int rc;
     unsigned int i, j, regs[4] = {}, polregs[4] = {};
@@ -288,9 +288,6 @@ int xc_cpuid_set(
     unsigned int nr_leaves, policy_leaves, nr_msrs;
     uint32_t err_leaf = -1, err_subleaf = -1, err_msr = -1;
 
-    for ( i = 0; i < 4; ++i )
-        config_transformed[i] = NULL;
-
     if ( xc_domain_getinfo(xch, domid, 1, &di) != 1 ||
          di.domid != domid )
     {
@@ -365,13 +362,6 @@ int xc_cpuid_set(
             continue;
         }
 
-        config_transformed[i] = calloc(33, 1); /* 32 bits, NUL terminator. */
-        if ( config_transformed[i] == NULL )
-        {
-            rc = -ENOMEM;
-            goto fail;
-        }
-
         /*
          * Notes for following this algorithm:
          *
@@ -399,11 +389,6 @@ int xc_cpuid_set(
                 set_feature(31 - j, regs[i]);
             else
                 clear_feature(31 - j, regs[i]);
-
-            config_transformed[i][j] = config[i][j];
-            /* All non 0/1 values get overwritten. */
-            if ( (config[i][j] & ~1) != '0' )
-                config_transformed[i][j] = '0' + val;
         }
     }
 
@@ -421,16 +406,8 @@ int xc_cpuid_set(
     }
 
     /* Success! */
-    goto out;
 
  fail:
-    for ( i = 0; i < 4; i++ )
-    {
-        free(config_transformed[i]);
-        config_transformed[i] = NULL;
-    }
-
- out:
     free(leaves);
 
     return rc;
diff --git a/tools/libxl/libxl_cpuid.c b/tools/libxl/libxl_cpuid.c
index 4e4852ddeb..796ec4f2d9 100644
--- a/tools/libxl/libxl_cpuid.c
+++ b/tools/libxl/libxl_cpuid.c
@@ -421,7 +421,6 @@ void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid,
 {
     libxl_cpuid_policy_list cpuid = info->cpuid;
     int i;
-    char *cpuid_res[4];
     bool pae = true;
 
     /*
@@ -444,7 +443,7 @@ void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid,
 
     for (i = 0; cpuid[i].input[0] != XEN_CPUID_INPUT_UNUSED; i++)
         xc_cpuid_set(ctx->xch, domid, cpuid[i].input,
-                     (const char**)(cpuid[i].policy), cpuid_res);
+                     (const char**)cpuid[i].policy);
 }
 
 static const char *input_names[2] = { "leaf", "subleaf" };
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jun 15 13:44:12 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Jun 2020 13: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 1jkpPC-0004XJ-Ty; Mon, 15 Jun 2020 13:44: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=TbyT=74=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jkpPC-0004XE-At
 for xen-changelog@lists.xenproject.org; Mon, 15 Jun 2020 13:44:06 +0000
X-Inumbo-ID: 475f492a-af0e-11ea-b7fc-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 475f492a-af0e-11ea-b7fc-12813bfff9fa;
 Mon, 15 Jun 2020 13: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=9ZTvyJK/jCYLaug9twJFYqpHqto6aemMmXiUP/tFVhA=; b=7KHsn2HHUGPpnTIh2aefwHq3W5
 kEGQ+ZjsyJhZqdwLnC+uwYLnZdQrbt8p0tfkEptoDoTdvstia05MEpfviKf8R1eZMkpqCAqWomeP2
 BYc11kx9ZEOqn+3FEoGauCE0kyfTRl6ook4LnIVN9rdDzTWF+7CTHOg7fD9LNtGPi8qQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jkpPA-0001Bf-ST
 for xen-changelog@lists.xenproject.org; Mon, 15 Jun 2020 13:44:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jkpPA-0003nH-Qs
 for xen-changelog@lists.xenproject.org; Mon, 15 Jun 2020 13:44:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.10] lz4: refine commit 9143a6c55ef7 for the 64-bit case
Message-Id: <E1jkpPA-0003nH-Qs@xenbits.xenproject.org>
Date: Mon, 15 Jun 2020 13: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 bd20589e6d687bd768b4016ccda0727b409b08e6
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Dec 11 15:34:51 2019 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Mon Jun 15 14:41:49 2020 +0100

    lz4: refine commit 9143a6c55ef7 for the 64-bit case
    
    I clearly went too far there: While the LZ4_WILDCOPY() instances indeed
    need prior guarding, LZ4_SECURECOPY() needs this only in the 32-bit case
    (where it simply aliases LZ4_WILDCOPY()). "cpy" can validly point
    (slightly) below "op" in these cases, due to
    
                    cpy = op + length - (STEPSIZE - 4);
    
    where length can be as low as 0 and STEPSIZE is 8. However, instead of
    removing the check via "#if !LZ4_ARCH64", refine it such that it would
    also properly work in the 64-bit case, aborting decompression instead
    of continuing on bogus input.
    
    Reported-by: Mark Pryor <pryorm09@gmail.com>
    Reported-by: Jeremi Piotrowski <jeremi.piotrowski@gmail.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Mark Pryor <pryorm09@gmail.com>
    Tested-by: Jeremi Piotrowski <jeremi.piotrowski@gmail.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 2d7572cdfa4d481c1ca246aa1ce5239ccae7eb59
    master date: 2019-12-09 14:01:25 +0100
    
    (cherry picked from commit 6561994b87af3e9cd28ee99c42e8b2697621687d)
---
 xen/common/lz4/decompress.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/common/lz4/decompress.c b/xen/common/lz4/decompress.c
index 94ad591331..e8636e193a 100644
--- a/xen/common/lz4/decompress.c
+++ b/xen/common/lz4/decompress.c
@@ -147,7 +147,7 @@ static int INIT lz4_uncompress(const unsigned char *source, unsigned char *dest,
 				goto _output_error;
 			continue;
 		}
-		if (unlikely((unsigned long)cpy < (unsigned long)op))
+		if (unlikely((unsigned long)cpy < (unsigned long)op - (STEPSIZE - 4)))
 			goto _output_error;
 		LZ4_SECURECOPY(ref, op, cpy);
 		op = cpy; /* correction */
@@ -279,7 +279,7 @@ static int lz4_uncompress_unknownoutputsize(const unsigned char *source,
 				goto _output_error;
 			continue;
 		}
-		if (unlikely((unsigned long)cpy < (unsigned long)op))
+		if (unlikely((unsigned long)cpy < (unsigned long)op - (STEPSIZE - 4)))
 			goto _output_error;
 		LZ4_SECURECOPY(ref, op, cpy);
 		op = cpy; /* correction */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.10


From xen-changelog-bounces@lists.xenproject.org Mon Jun 15 13:44:17 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Jun 2020 13: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 1jkpPM-0004Xu-Vg; Mon, 15 Jun 2020 13:44:16 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=TbyT=74=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jkpPL-0004Xo-W4
 for xen-changelog@lists.xenproject.org; Mon, 15 Jun 2020 13:44:16 +0000
X-Inumbo-ID: 4d63ac9e-af0e-11ea-b7fc-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 4d63ac9e-af0e-11ea-b7fc-12813bfff9fa;
 Mon, 15 Jun 2020 13: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=XZK6WoDSPu2XZPCPqxzumIF5w9g7WeqjGaqja2NEQ2w=; b=sFCf9i1GD+UT42jzOBQr3DS+UT
 g7VoM2vjzFIUSuV/YXQogP3hdNg71sJbfNpqrhLCHDv2FSncT0jhyhsUV6jvVb1fEIP/NTGr78En5
 ROVjXoGnCmq3YAABQR/yaac6XoMVRpd0NwgIspwrQ12AmJknrtWT8OkXShXY5YEI61rA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jkpPK-0001CG-Vk
 for xen-changelog@lists.xenproject.org; Mon, 15 Jun 2020 13:44:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jkpPK-0003no-Ub
 for xen-changelog@lists.xenproject.org; Mon, 15 Jun 2020 13:44:14 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.10] lz4: fix system halt at boot kernel on x86_64
Message-Id: <E1jkpPK-0003no-Ub@xenbits.xenproject.org>
Date: Mon, 15 Jun 2020 13: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 fd6e49ecae03840610fdc6a416a638590c0b6535
Author:     Krzysztof Kolasa <kkolasa@winsoft.pl>
AuthorDate: Wed Dec 11 15:35:39 2019 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Mon Jun 15 14:41:57 2020 +0100

    lz4: fix system halt at boot kernel on x86_64
    
    Sometimes, on x86_64, decompression fails with the following
    error:
    
    Decompressing Linux...
    
    Decoding failed
    
     -- System halted
    
    This condition is not needed for a 64bit kernel(from commit d5e7caf):
    
    if( ... ||
        (op + COPYLENGTH) > oend)
        goto _output_error
    
    macro LZ4_SECURE_COPY() tests op and does not copy any data
    when op exceeds the value.
    
    added by analogy to lz4_uncompress_unknownoutputsize(...)
    
    Signed-off-by: Krzysztof Kolasa <kkolasa@winsoft.pl>
    [Linux commit 99b7e93c95c78952724a9783de6c78def8fbfc3f]
    
    The offending commit in our case is fcc17f96c277 ("LZ4 : fix the data
    abort issue").
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 5d90ff79542ab9c6eebe5c315c68c196bcf353b9
    master date: 2019-12-09 14:02:35 +0100
    
    (cherry picked from commit 14b62ab3e5a79816edfc6dd3afce1bb68c106ac5)
---
 xen/common/lz4/decompress.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/xen/common/lz4/decompress.c b/xen/common/lz4/decompress.c
index e8636e193a..bef3a9a99c 100644
--- a/xen/common/lz4/decompress.c
+++ b/xen/common/lz4/decompress.c
@@ -132,8 +132,12 @@ static int INIT lz4_uncompress(const unsigned char *source, unsigned char *dest,
 			/* Error: request to write beyond destination buffer */
 			if (cpy > oend)
 				goto _output_error;
+#if LZ4_ARCH64
+			if ((ref + COPYLENGTH) > oend)
+#else
 			if ((ref + COPYLENGTH) > oend ||
 					(op + COPYLENGTH) > oend)
+#endif
 				goto _output_error;
 			LZ4_SECURECOPY(ref, op, (oend - COPYLENGTH));
 			while (op < cpy)
@@ -266,7 +270,13 @@ static int lz4_uncompress_unknownoutputsize(const unsigned char *source,
 		if (cpy > oend - COPYLENGTH) {
 			if (cpy > oend)
 				goto _output_error; /* write outside of buf */
-
+#if LZ4_ARCH64
+			if ((ref + COPYLENGTH) > oend)
+#else
+			if ((ref + COPYLENGTH) > oend ||
+					(op + COPYLENGTH) > oend)
+#endif
+				goto _output_error;
 			LZ4_SECURECOPY(ref, op, (oend - COPYLENGTH));
 			while (op < cpy)
 				*op++ = *ref++;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.10


From xen-changelog-bounces@lists.xenproject.org Mon Jun 15 14:55:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Jun 2020 14: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 1jkqVu-0004HS-46; Mon, 15 Jun 2020 14: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=TbyT=74=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jkqVt-0004HN-3q
 for xen-changelog@lists.xenproject.org; Mon, 15 Jun 2020 14:55:05 +0000
X-Inumbo-ID: 322e63ba-af18-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 322e63ba-af18-11ea-b7bb-bc764e2007e4;
 Mon, 15 Jun 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=GRF91GY4/jHpG/yvtclfqFBKq4pZexhnUrs8Dd+I7vk=; b=p3oxv2Ht9frwCvyLiqNmhA2/rK
 vruALVh9y5ohjDNPP0xXEDY1oB7wVJNcxAulNrMeMSCSm64sFIqg8gSNmdCar/ML6BTISZTODAXSW
 5IviSSNRm3aWXOJ1Jdv37SiuNNOK/9Y3HbLQrYi1h8hzSNYwUy1zAZN1WUw6RQIqGJgE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jkqVs-0002eF-99
 for xen-changelog@lists.xenproject.org; Mon, 15 Jun 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 1jkqVs-0007zb-86
 for xen-changelog@lists.xenproject.org; Mon, 15 Jun 2020 14:55:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] tools: check go compiler version if present
Message-Id: <E1jkqVs-0007zb-86@xenbits.xenproject.org>
Date: Mon, 15 Jun 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 fec6a7af5c5760b9bccd9e7c3eaf29f0401af264
Author:     Nick Rosbrook <rosbrookn@gmail.com>
AuthorDate: Fri Jun 12 15:31:02 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Mon Jun 15 15:49:13 2020 +0100

    tools: check go compiler version if present
    
    Currently, no minimum go compiler version is required by the configure
    scripts. However, the go bindings actually will not build with some
    older versions of go. Add a check for a minimum go version of 1.11.1 in
    accordance with tools/golang/xenlight/go.mod.
    
    Signed-off-by: Nick Rosbrook <rosbrookn@ainfosec.com>
    Acked-by: George Dunlap <george.dunlap@citrix.com>
    Tested-by: Nick Rosbrook <rosbrookn@ainfosec.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 m4/golang.m4       |  4 ++++
 tools/configure    | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 tools/configure.ac |  7 +++++++
 3 files changed, 60 insertions(+)

diff --git a/m4/golang.m4 b/m4/golang.m4
index 0b4bd54ce0..9cfd7e00a5 100644
--- a/m4/golang.m4
+++ b/m4/golang.m4
@@ -1,4 +1,8 @@
 AC_DEFUN([AC_PROG_GO], [
     dnl Check for the go compiler
     AC_CHECK_TOOL([GO],[go],[no])
+
+    if test "$GO" != "no"; then
+        GOVERSION=`$GO version | cut -d " " -f 3 | sed "s/go//"`
+    fi
 ])
diff --git a/tools/configure b/tools/configure
index 3df1a01ff9..15ba28211a 100755
--- a/tools/configure
+++ b/tools/configure
@@ -6833,6 +6833,10 @@ else
 fi
 
 
+    if test "$GO" != "no"; then
+        GOVERSION=`$GO version | cut -d " " -f 3 | sed "s/go//"`
+    fi
+
     if test "x$GO" = "xno"; then :
 
         if test "x$enable_golang" =  "xyes"; then :
@@ -6842,6 +6846,51 @@ fi
 fi
         golang="n"
 
+else
+
+
+
+
+  # Used to indicate true or false condition
+  ax_compare_version=false
+
+  # Convert the two version strings to be compared into a format that
+  # allows a simple string comparison.  The end result is that a version
+  # string of the form 1.12.5-r617 will be converted to the form
+  # 0001001200050617.  In other words, each number is zero padded to four
+  # digits, and non digits are removed.
+
+  ax_compare_version_A=`echo "$GOVERSION" | sed -e 's/\([0-9]*\)/Z\1Z/g' \
+                     -e 's/Z\([0-9]\)Z/Z0\1Z/g' \
+                     -e 's/Z\([0-9][0-9]\)Z/Z0\1Z/g' \
+                     -e 's/Z\([0-9][0-9][0-9]\)Z/Z0\1Z/g' \
+                     -e 's/[^0-9]//g'`
+
+
+  ax_compare_version_B=`echo "1.11.1" | sed -e 's/\([0-9]*\)/Z\1Z/g' \
+                     -e 's/Z\([0-9]\)Z/Z0\1Z/g' \
+                     -e 's/Z\([0-9][0-9]\)Z/Z0\1Z/g' \
+                     -e 's/Z\([0-9][0-9][0-9]\)Z/Z0\1Z/g' \
+                     -e 's/[^0-9]//g'`
+
+
+    ax_compare_version=`echo "x$ax_compare_version_A
+x$ax_compare_version_B" | sed 's/^ *//' | sort -r | sed "s/x${ax_compare_version_A}/false/;s/x${ax_compare_version_B}/true/;1q"`
+
+
+
+    if test "$ax_compare_version" = "true" ; then
+
+            if test "x$enable_golang" = "xyes"; then :
+
+                as_fn_error $? "\"Your version of go: $GOVERSION is not supported\"" "$LINENO" 5
+
+fi
+            golang="n"
+
+      fi
+
+
 fi
 
 fi
diff --git a/tools/configure.ac b/tools/configure.ac
index a9af0a21c6..9d126b7a14 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -338,6 +338,13 @@ AS_IF([test "x$golang" = "xy"], [
             AC_MSG_ERROR([Go tools enabled, but missing go compiler])
         ])
         golang="n"
+    ], [
+        AX_COMPARE_VERSION([$GOVERSION], [lt], [1.11.1], [
+            AS_IF([test "x$enable_golang" = "xyes"], [
+                AC_MSG_ERROR(["Your version of go: $GOVERSION is not supported"])
+            ])
+            golang="n"
+        ])
     ])
 ])
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Jun 15 14:55:16 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Jun 2020 14: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 1jkqW4-0004J2-5a; Mon, 15 Jun 2020 14: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=TbyT=74=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jkqW3-0004Iq-CE
 for xen-changelog@lists.xenproject.org; Mon, 15 Jun 2020 14:55:15 +0000
X-Inumbo-ID: 386644e6-af18-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 386644e6-af18-11ea-b7bb-bc764e2007e4;
 Mon, 15 Jun 2020 14: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=9SjTD60c9+7Y2+5HyHRKnwuq/+W48X5AXBTDZ7npQSM=; b=P+Of/EbTvcPqEJERphJRNQt3FW
 VBhEs4voCYUMaDnYKxRP+owJH+qe0KME/FznKm7MTMvsOeZVNBpF9g3Jchr7i4D92r69OEUhFl0Pz
 rope7IS03SySs6SmR1naGCrTr1sOQX6FER//AT7FdS7RtTcbvKw9YticvUULmmiNzjIo=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jkqW2-0002ez-Pk
 for xen-changelog@lists.xenproject.org; Mon, 15 Jun 2020 14:55:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jkqW2-00080y-Oi
 for xen-changelog@lists.xenproject.org; Mon, 15 Jun 2020 14:55:14 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] tools/libxl: Fix memory leak in libxl_cpuid_set()
Message-Id: <E1jkqW2-00080y-Oi@xenbits.xenproject.org>
Date: Mon, 15 Jun 2020 14: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 c54de7d9df7718ea53bf21e1ff5bbd339602a704
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jun 12 18:32:27 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Mon Jun 15 15:44:37 2020 +0100

    tools/libxl: Fix memory leak in libxl_cpuid_set()
    
    xc_cpuid_set() returns allocated memory via cpuid_res, which libxl needs to
    free() seeing as it discards the results.
    
    This is logically a backport of c/s b91825f628 "tools/libxc: Drop
    config_transformed parameter from xc_cpuid_set()" but rewritten as one caller
    of xc_cpuid_set() does use returned values.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/libxl/libxl_cpuid.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tools/libxl/libxl_cpuid.c b/tools/libxl/libxl_cpuid.c
index a78f08b927..083869dcf4 100644
--- a/tools/libxl/libxl_cpuid.c
+++ b/tools/libxl/libxl_cpuid.c
@@ -420,12 +420,17 @@ void libxl_cpuid_apply_policy(libxl_ctx *ctx, uint32_t domid)
 void libxl_cpuid_set(libxl_ctx *ctx, uint32_t domid,
                      libxl_cpuid_policy_list cpuid)
 {
-    int i;
+    int i, j;
     char *cpuid_res[4];
 
     for (i = 0; cpuid[i].input[0] != XEN_CPUID_INPUT_UNUSED; i++)
+    {
         xc_cpuid_set(ctx->xch, domid, cpuid[i].input,
                      (const char**)(cpuid[i].policy), cpuid_res);
+
+        for (j = 0; j < ARRAY_SIZE(cpuid_res); ++j)
+            free(cpuid_res[j]);
+    }
 }
 
 static const char *input_names[2] = { "leaf", "subleaf" };
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Mon Jun 15 14:55:27 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Jun 2020 14:55:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jkqWF-0004LA-7D; Mon, 15 Jun 2020 14:55: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=TbyT=74=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jkqWE-0004Ko-0E
 for xen-changelog@lists.xenproject.org; Mon, 15 Jun 2020 14:55:26 +0000
X-Inumbo-ID: 3eacd3f6-af18-11ea-b807-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 3eacd3f6-af18-11ea-b807-12813bfff9fa;
 Mon, 15 Jun 2020 14: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=1dJpYXiNkqf47uhwJZJXTrylFkLrcAXYDv0CU/Q5e6M=; b=jXhBcr2xqFQozl9Zwro/Zdizxk
 LCEyl0K22zkid48uiOb/fPCfTYQrLE53VOgbyjP31+3qL/IGIEVZWiLBMh3uBzq+mgZ/vb8o1eODP
 BXuuIZgeZG51HFVw6UJhHAHlG9uXh2kEAJ4gjF2/cQvoUZbW0BFq5/ZMl0WxqBZuNuQ8=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jkqWD-0002fF-AL
 for xen-changelog@lists.xenproject.org; Mon, 15 Jun 2020 14:55:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jkqWD-00081u-9R
 for xen-changelog@lists.xenproject.org; Mon, 15 Jun 2020 14:55:25 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.12] tools/libxl: Fix memory leak in libxl_cpuid_set()
Message-Id: <E1jkqWD-00081u-9R@xenbits.xenproject.org>
Date: Mon, 15 Jun 2020 14: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 06760c2bf322cef4622b56bafee74fe93ae01630
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jun 12 18:32:27 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Mon Jun 15 15:46:17 2020 +0100

    tools/libxl: Fix memory leak in libxl_cpuid_set()
    
    xc_cpuid_set() returns allocated memory via cpuid_res, which libxl needs to
    free() seeing as it discards the results.
    
    This is logically a backport of c/s b91825f628 "tools/libxc: Drop
    config_transformed parameter from xc_cpuid_set()" but rewritten as one caller
    of xc_cpuid_set() does use returned values.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    (cherry picked from commit c54de7d9df7718ea53bf21e1ff5bbd339602a704)
---
 tools/libxl/libxl_cpuid.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tools/libxl/libxl_cpuid.c b/tools/libxl/libxl_cpuid.c
index 88b5760c85..07995c81d1 100644
--- a/tools/libxl/libxl_cpuid.c
+++ b/tools/libxl/libxl_cpuid.c
@@ -404,12 +404,17 @@ void libxl_cpuid_apply_policy(libxl_ctx *ctx, uint32_t domid)
 void libxl_cpuid_set(libxl_ctx *ctx, uint32_t domid,
                      libxl_cpuid_policy_list cpuid)
 {
-    int i;
+    int i, j;
     char *cpuid_res[4];
 
     for (i = 0; cpuid[i].input[0] != XEN_CPUID_INPUT_UNUSED; i++)
+    {
         xc_cpuid_set(ctx->xch, domid, cpuid[i].input,
                      (const char**)(cpuid[i].policy), cpuid_res);
+
+        for (j = 0; j < ARRAY_SIZE(cpuid_res); ++j)
+            free(cpuid_res[j]);
+    }
 }
 
 static const char *input_names[2] = { "leaf", "subleaf" };
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Mon Jun 15 16:11:12 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Jun 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 1jkrhT-0004hD-GQ; Mon, 15 Jun 2020 16: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=TbyT=74=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jkrhR-0004h8-Kt
 for xen-changelog@lists.xenproject.org; Mon, 15 Jun 2020 16:11:05 +0000
X-Inumbo-ID: d0698154-af22-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id d0698154-af22-11ea-bca7-bc764e2007e4;
 Mon, 15 Jun 2020 16: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=DHinRb10oqOlMjXOTsZygBOubv6zoAU9sMgBwP2VBOo=; b=DM6eiOlD/Z9yi3KbTRs1JMwimj
 iPwKKQoCPaNhuLpdK18mSxSretX1q8VTxnZ0RbCpG6u5zXvukdL5BO7ujeyW+mai90gt2K2DVqjkE
 VvSP2oPGjx/WjsVsTC9sqqHbgcH9mtZGL25jwyn6pyFhuMZFkjECzw+TMbsaF1NnAvHM=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jkrhQ-0004gb-PF
 for xen-changelog@lists.xenproject.org; Mon, 15 Jun 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 1jkrhQ-0004Z5-OA
 for xen-changelog@lists.xenproject.org; Mon, 15 Jun 2020 16:11:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] golang/xenlight: sort cases in switch statement
Message-Id: <E1jkrhQ-0004Z5-OA@xenbits.xenproject.org>
Date: Mon, 15 Jun 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 1251402caf8685f45d9d580f01583370f7e2d272
Author:     Nick Rosbrook <rosbrookn@gmail.com>
AuthorDate: Mon Jun 15 11:39:42 2020 -0400
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Mon Jun 15 16:47:59 2020 +0100

    golang/xenlight: sort cases in switch statement
    
    The xenlight_golang_union_from_C function iterates over a dict to
    construct a switch statement that marshals a C keyed union into a Go
    type. Because python does not guarantee dict ordering across all
    versions, this can result in the switch statement being generated in a
    different order depending on the version of python used. For example,
    running gengotypes.py with python2.7 and python3.6 will yield different
    orderings.
    
    Iterate over sorted(cases.items()) rather than cases.items() to fix
    this.
    
    This patch changes the ordering from what was previously checked-in, but
    running gengotypes.py with different versions of python will now yield
    the same result.
    
    Signed-off-by: Nick Rosbrook <rosbrookn@ainfosec.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Acked-by: George Dunlap <george.dunlap@citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/golang/xenlight/gengotypes.py  |  2 +-
 tools/golang/xenlight/helpers.gen.go | 32 ++++++++++++++++----------------
 2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/tools/golang/xenlight/gengotypes.py b/tools/golang/xenlight/gengotypes.py
index ecca59745f..557fecd07b 100644
--- a/tools/golang/xenlight/gengotypes.py
+++ b/tools/golang/xenlight/gengotypes.py
@@ -379,7 +379,7 @@ def xenlight_golang_union_from_C(ty = None, union_name = '', struct_name = ''):
 
     # Create switch statement to determine which 'union element'
     # to populate in the Go struct.
-    for case_name, case_tuple in cases.items():
+    for case_name, case_tuple in sorted(cases.items()):
         (case_val, case_type) = case_tuple
 
         s += 'case {}:\n'.format(case_val)
diff --git a/tools/golang/xenlight/helpers.gen.go b/tools/golang/xenlight/helpers.gen.go
index 935d3bc50a..152c7e8e6b 100644
--- a/tools/golang/xenlight/helpers.gen.go
+++ b/tools/golang/xenlight/helpers.gen.go
@@ -431,8 +431,6 @@ x.Evtch = int(xc.evtch)
 x.Rref = int(xc.rref)
 x.Connection = ChannelConnection(xc.connection)
 switch x.Connection{
-case ChannelConnectionUnknown:
-x.ConnectionUnion = nil
 case ChannelConnectionPty:
 var connectionPty ChannelinfoConnectionUnionPty
 if err := connectionPty.fromC(xc);err != nil {
@@ -441,6 +439,8 @@ if err := connectionPty.fromC(xc);err != nil {
 x.ConnectionUnion = connectionPty
 case ChannelConnectionSocket:
 x.ConnectionUnion = nil
+case ChannelConnectionUnknown:
+x.ConnectionUnion = nil
 default:
 return fmt.Errorf("invalid union key '%v'", x.Connection)}
 
@@ -1098,6 +1098,8 @@ if err := typeHvm.fromC(xc);err != nil {
  return fmt.Errorf("converting field typeHvm: %v", err)
 }
 x.TypeUnion = typeHvm
+case DomainTypeInvalid:
+x.TypeUnion = nil
 case DomainTypePv:
 var typePv DomainBuildInfoTypeUnionPv
 if err := typePv.fromC(xc);err != nil {
@@ -1110,8 +1112,6 @@ if err := typePvh.fromC(xc);err != nil {
  return fmt.Errorf("converting field typePvh: %v", err)
 }
 x.TypeUnion = typePvh
-case DomainTypeInvalid:
-x.TypeUnion = nil
 default:
 return fmt.Errorf("invalid union key '%v'", x.Type)}
 x.ArchArm.GicVersion = GicVersion(xc.arch_arm.gic_version)
@@ -2360,8 +2360,6 @@ x.Devid = Devid(xc.devid)
 x.Name = C.GoString(xc.name)
 x.Connection = ChannelConnection(xc.connection)
 switch x.Connection{
-case ChannelConnectionUnknown:
-x.ConnectionUnion = nil
 case ChannelConnectionPty:
 x.ConnectionUnion = nil
 case ChannelConnectionSocket:
@@ -2370,6 +2368,8 @@ if err := connectionSocket.fromC(xc);err != nil {
  return fmt.Errorf("converting field connectionSocket: %v", err)
 }
 x.ConnectionUnion = connectionSocket
+case ChannelConnectionUnknown:
+x.ConnectionUnion = nil
 default:
 return fmt.Errorf("invalid union key '%v'", x.Connection)}
 
@@ -3933,28 +3933,28 @@ return fmt.Errorf("converting field Domuuid: %v", err)
 x.ForUser = uint64(xc.for_user)
 x.Type = EventType(xc._type)
 switch x.Type{
-case EventTypeDomainShutdown:
-var typeDomainShutdown EventTypeUnionDomainShutdown
-if err := typeDomainShutdown.fromC(xc);err != nil {
- return fmt.Errorf("converting field typeDomainShutdown: %v", err)
-}
-x.TypeUnion = typeDomainShutdown
-case EventTypeDomainDeath:
-x.TypeUnion = nil
 case EventTypeDiskEject:
 var typeDiskEject EventTypeUnionDiskEject
 if err := typeDiskEject.fromC(xc);err != nil {
  return fmt.Errorf("converting field typeDiskEject: %v", err)
 }
 x.TypeUnion = typeDiskEject
+case EventTypeDomainCreateConsoleAvailable:
+x.TypeUnion = nil
+case EventTypeDomainDeath:
+x.TypeUnion = nil
+case EventTypeDomainShutdown:
+var typeDomainShutdown EventTypeUnionDomainShutdown
+if err := typeDomainShutdown.fromC(xc);err != nil {
+ return fmt.Errorf("converting field typeDomainShutdown: %v", err)
+}
+x.TypeUnion = typeDomainShutdown
 case EventTypeOperationComplete:
 var typeOperationComplete EventTypeUnionOperationComplete
 if err := typeOperationComplete.fromC(xc);err != nil {
  return fmt.Errorf("converting field typeOperationComplete: %v", err)
 }
 x.TypeUnion = typeOperationComplete
-case EventTypeDomainCreateConsoleAvailable:
-x.TypeUnion = nil
 default:
 return fmt.Errorf("invalid union key '%v'", x.Type)}
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jun 16 08:33:13 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 16 Jun 2020 08:33:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jl71o-0005ye-NY; Tue, 16 Jun 2020 08:33: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=5yMn=75=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jl71m-0005yM-Qk
 for xen-changelog@lists.xenproject.org; Tue, 16 Jun 2020 08:33:06 +0000
X-Inumbo-ID: ff70fe30-afab-11ea-b894-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id ff70fe30-afab-11ea-b894-12813bfff9fa;
 Tue, 16 Jun 2020 08: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=OGaIrDzidheqJajBiwGwg3L4cYwpGCbXONvByK5RjRE=; b=SMn/HNYIzyzRFyaP6LpvCM2LlG
 kcc0JlyPeYfUCvAbAp1//Os6Xqa93nZ59OnL/zp+TtZirw4UlyOc/Lfko3OaatEs9g60lU2eVW7Q3
 h2lCAE/ZvhkTEJBdw4rK6lcFDLgGTCrKdnl7Y62v3UreZU6u1/Bc6EWJ+2IrRAO/O2I8=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jl71k-0000xq-Nc
 for xen-changelog@lists.xenproject.org; Tue, 16 Jun 2020 08:33:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jl71k-00024j-MX
 for xen-changelog@lists.xenproject.org; Tue, 16 Jun 2020 08:33:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/mem_sharing: block interrupt injection for forks
Message-Id: <E1jl71k-00024j-MX@xenbits.xenproject.org>
Date: Tue, 16 Jun 2020 08: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 3371ced37ced359167b5a71abee2062854371323
Author:     Tamas K Lengyel <tamas.lengyel@intel.com>
AuthorDate: Tue Jun 16 10:29:16 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jun 16 10:29:16 2020 +0200

    x86/mem_sharing: block interrupt injection for forks
    
    When running VM forks without device models (QEMU), it may
    be undesirable for Xen to inject interrupts. When creating such forks from
    Windows VMs we have observed the kernel trying to process interrupts
    immediately after the fork is executed. However without QEMU running such
    interrupt handling may not be possible because it may attempt to interact with
    devices that are not emulated by a backend. In the best case scenario such
    interrupt handling would only present a detour in the VM forks' execution
    flow, but in the worst case as we actually observed can completely stall it.
    By disabling interrupt injection a fuzzer can exercise the target code without
    interference. For other use-cases this option probably doesn't make sense,
    that's why this is not enabled by default.
    
    Forks & memory sharing are only available on Intel CPUs so this only applies
    to vmx. Note that this is part of the experimental VM forking feature that's
    completely disabled by default and can only be enabled by using
    XEN_CONFIG_EXPERT during compile time.
    
    Signed-off-by: Tamas K Lengyel <tamas.lengyel@intel.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Wei Liu <wl@xen.org>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/arch/x86/hvm/vmx/intr.c      | 6 ++++++
 xen/arch/x86/mm/mem_sharing.c    | 6 +++++-
 xen/include/asm-x86/hvm/domain.h | 2 +-
 xen/include/public/memory.h      | 3 +++
 4 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/intr.c b/xen/arch/x86/hvm/vmx/intr.c
index 000e14af49..80bfbb4787 100644
--- a/xen/arch/x86/hvm/vmx/intr.c
+++ b/xen/arch/x86/hvm/vmx/intr.c
@@ -256,6 +256,12 @@ void vmx_intr_assist(void)
     if ( unlikely(v->arch.vm_event) && v->arch.vm_event->sync_event )
         return;
 
+#ifdef CONFIG_MEM_SHARING
+    /* Block event injection for VM fork if requested */
+    if ( unlikely(v->domain->arch.hvm.mem_sharing.block_interrupts) )
+        return;
+#endif
+
     /* Crank the handle on interrupt state. */
     pt_vector = pt_update_irq(v);
 
diff --git a/xen/arch/x86/mm/mem_sharing.c b/xen/arch/x86/mm/mem_sharing.c
index 19922ab5d1..c428fd16ce 100644
--- a/xen/arch/x86/mm/mem_sharing.c
+++ b/xen/arch/x86/mm/mem_sharing.c
@@ -2106,7 +2106,8 @@ int mem_sharing_memop(XEN_GUEST_HANDLE_PARAM(xen_mem_sharing_op_t) arg)
         rc = -EINVAL;
         if ( mso.u.fork.pad )
             goto out;
-        if ( mso.u.fork.flags & ~XENMEM_FORK_WITH_IOMMU_ALLOWED )
+        if ( mso.u.fork.flags &
+             ~(XENMEM_FORK_WITH_IOMMU_ALLOWED | XENMEM_FORK_BLOCK_INTERRUPTS) )
             goto out;
 
         rc = rcu_lock_live_remote_domain_by_id(mso.u.fork.parent_domain,
@@ -2134,6 +2135,9 @@ int mem_sharing_memop(XEN_GUEST_HANDLE_PARAM(xen_mem_sharing_op_t) arg)
             rc = hypercall_create_continuation(__HYPERVISOR_memory_op,
                                                "lh", XENMEM_sharing_op,
                                                arg);
+        else if ( !rc && (mso.u.fork.flags & XENMEM_FORK_BLOCK_INTERRUPTS) )
+            d->arch.hvm.mem_sharing.block_interrupts = true;
+
         rcu_unlock_domain(pd);
         break;
     }
diff --git a/xen/include/asm-x86/hvm/domain.h b/xen/include/asm-x86/hvm/domain.h
index 95fe18cddc..9d247baf4d 100644
--- a/xen/include/asm-x86/hvm/domain.h
+++ b/xen/include/asm-x86/hvm/domain.h
@@ -67,7 +67,7 @@ struct hvm_ioreq_server {
 #ifdef CONFIG_MEM_SHARING
 struct mem_sharing_domain
 {
-    bool enabled;
+    bool enabled, block_interrupts;
 
     /*
      * When releasing shared gfn's in a preemptible manner, recall where
diff --git a/xen/include/public/memory.h b/xen/include/public/memory.h
index dbd35305df..850bd72c52 100644
--- a/xen/include/public/memory.h
+++ b/xen/include/public/memory.h
@@ -536,7 +536,10 @@ struct xen_mem_sharing_op {
         } debug;
         struct mem_sharing_op_fork {      /* OP_FORK */
             domid_t parent_domain;        /* IN: parent's domain id */
+/* Only makes sense for short-lived forks */
 #define XENMEM_FORK_WITH_IOMMU_ALLOWED (1u << 0)
+/* Only makes sense for short-lived forks */
+#define XENMEM_FORK_BLOCK_INTERRUPTS   (1u << 1)
             uint16_t flags;               /* IN: optional settings */
             uint32_t pad;                 /* Must be set to 0 */
         } fork;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jun 16 08:33:16 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 16 Jun 2020 08: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 1jl71w-00060X-Ou; Tue, 16 Jun 2020 08:33:16 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=5yMn=75=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jl71v-00060N-Kt
 for xen-changelog@lists.xenproject.org; Tue, 16 Jun 2020 08:33:15 +0000
X-Inumbo-ID: 0578bee4-afac-11ea-b894-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 0578bee4-afac-11ea-b894-12813bfff9fa;
 Tue, 16 Jun 2020 08: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=TZVoKh7rZHRlIHDK2MoJIPm17m2f39aTpX5uOAFOjBs=; b=X4KRJJTxI3ODp5htoVr2LT50h/
 VVPjdX9Z7L/dfw2PufM/FhzwgjWJqkHhDCanTq/EspgVJKJHVGROL1XI9GICl+6l3ZTrjwyowSD8X
 a8DAURIFgzPWQC2mQAPRxvHn/frtAOQjQIYFJy1hag4siaT7AuFXvamuYDtfdcQHF/qA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jl71u-0000xt-Qo
 for xen-changelog@lists.xenproject.org; Tue, 16 Jun 2020 08:33:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jl71u-00025g-Pl
 for xen-changelog@lists.xenproject.org; Tue, 16 Jun 2020 08:33:14 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] libxc: xc_memshr_fork with interrupts blocked
Message-Id: <E1jl71u-00025g-Pl@xenbits.xenproject.org>
Date: Tue, 16 Jun 2020 08: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 05f488e418db0498dc2b7775874bd6957afd3a05
Author:     Tamas K Lengyel <tamas.lengyel@intel.com>
AuthorDate: Tue Jun 16 10:30:48 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jun 16 10:30:48 2020 +0200

    libxc: xc_memshr_fork with interrupts blocked
    
    Toolstack side for creating forks with interrupt injection blocked.
    
    Signed-off-by: Tamas K Lengyel <tamas.lengyel@intel.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Acked-by: Wei Liu <wl@xen.org>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/libxc/include/xenctrl.h | 3 ++-
 tools/libxc/xc_memshr.c       | 4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h
index 113ddd935d..7f15a61f29 100644
--- a/tools/libxc/include/xenctrl.h
+++ b/tools/libxc/include/xenctrl.h
@@ -2240,7 +2240,8 @@ int xc_memshr_range_share(xc_interface *xch,
 int xc_memshr_fork(xc_interface *xch,
                    uint32_t source_domain,
                    uint32_t client_domain,
-                   bool allow_with_iommu);
+                   bool allow_with_iommu,
+                   bool block_interrupts);
 
 /*
  * Note: this function is only intended to be used on short-lived forks that
diff --git a/tools/libxc/xc_memshr.c b/tools/libxc/xc_memshr.c
index 2300cc7075..a6cfd7dccf 100644
--- a/tools/libxc/xc_memshr.c
+++ b/tools/libxc/xc_memshr.c
@@ -240,7 +240,7 @@ int xc_memshr_debug_gref(xc_interface *xch,
 }
 
 int xc_memshr_fork(xc_interface *xch, uint32_t pdomid, uint32_t domid,
-                   bool allow_with_iommu)
+                   bool allow_with_iommu, bool block_interrupts)
 {
     xen_mem_sharing_op_t mso;
 
@@ -251,6 +251,8 @@ int xc_memshr_fork(xc_interface *xch, uint32_t pdomid, uint32_t domid,
 
     if ( allow_with_iommu )
         mso.u.fork.flags |= XENMEM_FORK_WITH_IOMMU_ALLOWED;
+    if ( block_interrupts )
+        mso.u.fork.flags |= XENMEM_FORK_BLOCK_INTERRUPTS;
 
     return xc_memshr_memop(xch, domid, &mso);
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jun 16 08:33:27 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 16 Jun 2020 08:33:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jl727-00062T-Qb; Tue, 16 Jun 2020 08:33:27 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=5yMn=75=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jl725-00062D-T7
 for xen-changelog@lists.xenproject.org; Tue, 16 Jun 2020 08:33:25 +0000
X-Inumbo-ID: 0b7eee08-afac-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 0b7eee08-afac-11ea-8496-bc764e2007e4;
 Tue, 16 Jun 2020 08: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=IMH3C+/dBvZIwCA0/ILaZE2jaDBnzcjG0lviOCp0DPI=; b=Y7fQggqvW+4s+hfXIifrhm2SBX
 UTzmSwR2u8XaYQz7qwWN/4f8foQgh2Pw7B7rwW4XhCLIv9vC0h0cfIlPDcTBcw4wVOVZ2irOQeHNx
 zQNSqmiWrb57ReoE0jbJwwFEsdGB+QmBInGBi8/2zBHhFuHrpYaAKNuJ17XDT/xcbzdA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jl724-0000y9-UK
 for xen-changelog@lists.xenproject.org; Tue, 16 Jun 2020 08:33:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jl724-00026e-Sp
 for xen-changelog@lists.xenproject.org; Tue, 16 Jun 2020 08:33:24 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] libacpi: widen TPM detection
Message-Id: <E1jl724-00026e-Sp@xenbits.xenproject.org>
Date: Tue, 16 Jun 2020 08: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 d3db7e043cddd7e939195e014241ce2c5d436179
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Tue Jun 16 10:31:08 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jun 16 10:31:08 2020 +0200

    libacpi: widen TPM detection
    
    The hardcoded tpm_signature is too restrictive to detect many TPMs.  For
    instance, it doesn't accept a QEMU emulated TPM (VID 0x1014 DID 0x0001).
    Make the TPM detection match that in rombios which accepts a wider
    range.
    
    With this change, the TPM's TCPA ACPI table is generated and the guest
    OS can automatically load the tpm_tis driver.  It also allows seabios to
    detect and use the TPM.  However, seabios skips some TPM initialization
    when running under Xen, so it will not populate any PCRs unless modified
    to run the initialization under Xen.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/libacpi/build.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/tools/libacpi/build.c b/tools/libacpi/build.c
index fa7d14e090..a61dd5583a 100644
--- a/tools/libacpi/build.c
+++ b/tools/libacpi/build.c
@@ -351,7 +351,6 @@ static int construct_secondary_tables(struct acpi_ctxt *ctxt,
     struct acpi_20_waet *waet;
     struct acpi_20_tcpa *tcpa;
     unsigned char *ssdt;
-    static const uint16_t tis_signature[] = {0x0001, 0x0001, 0x0001};
     void *lasa;
 
     /* MADT. */
@@ -413,9 +412,8 @@ static int construct_secondary_tables(struct acpi_ctxt *ctxt,
 
     /* TPM TCPA and SSDT. */
     if ( (config->table_flags & ACPI_HAS_TCPA) &&
-         (config->tis_hdr[0] == tis_signature[0]) &&
-         (config->tis_hdr[1] == tis_signature[1]) &&
-         (config->tis_hdr[2] == tis_signature[2]) )
+         (config->tis_hdr[0] != 0 && config->tis_hdr[0] != 0xffff) &&
+         (config->tis_hdr[1] != 0 && config->tis_hdr[1] != 0xffff) )
     {
         ssdt = ctxt->mem_ops.alloc(ctxt, sizeof(ssdt_tpm), 16);
         if (!ssdt) return -1;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jun 16 08:33:41 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 16 Jun 2020 08:33:41 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jl72L-000655-40; Tue, 16 Jun 2020 08:33:41 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=5yMn=75=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jl72K-00062D-Ny
 for xen-changelog@lists.xenproject.org; Tue, 16 Jun 2020 08:33:40 +0000
X-Inumbo-ID: 11800b66-afac-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 11800b66-afac-11ea-bb8b-bc764e2007e4;
 Tue, 16 Jun 2020 08: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=vEnb7cbPKE779rgJtYG65gurG5QM1VgIlk5ArxOBPtE=; b=41pdOeCacBt/JCSERaolIqVmYt
 yr5+Ki1T1UbFyd0xsAiucWYfUIT0SVPtPjPluaOAjotcyClZDRcGFDMKwdfkntzv9MXXZ+elqmSd+
 NMMlF9nuDEhh3o3x1uNUFLBQqblHAw68sX/ZQx3mQBtQn/7ryXiftoh/9QEqUksq/Sbo=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jl72F-0000yH-19
 for xen-changelog@lists.xenproject.org; Tue, 16 Jun 2020 08:33:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jl72F-00027E-08
 for xen-changelog@lists.xenproject.org; Tue, 16 Jun 2020 08:33:35 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/boot: use BASEDIR for include path
Message-Id: <E1jl72F-00027E-08@xenbits.xenproject.org>
Date: Tue, 16 Jun 2020 08: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 3625b04991b4d6affadd99d377ab84bac48dfff4
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Tue Jun 16 10:31:26 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jun 16 10:31:26 2020 +0200

    x86/boot: use BASEDIR for include path
    
    Use $(BASEDIR)/include instead of $(XEN_ROOT)/xen/include for the
    include path to be coherent with the rest of the Makefiles.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/arch/x86/boot/build32.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/boot/build32.mk b/xen/arch/x86/boot/build32.mk
index 5851ebff5f..8cd5403926 100644
--- a/xen/arch/x86/boot/build32.mk
+++ b/xen/arch/x86/boot/build32.mk
@@ -5,7 +5,7 @@ include $(XEN_ROOT)/Config.mk
 $(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
 
 CFLAGS += -Werror -fno-builtin -g0 -msoft-float
-CFLAGS += -I$(XEN_ROOT)/xen/include
+CFLAGS += -I$(BASEDIR)/include
 CFLAGS := $(filter-out -flto,$(CFLAGS)) 
 
 # NB. awk invocation is a portable alternative to 'head -n -1'
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jun 16 23:22:08 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 16 Jun 2020 23:22:08 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jlKu3-00036M-VD; Tue, 16 Jun 2020 23:22:03 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=5yMn=75=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jlKu2-00036H-KJ
 for xen-changelog@lists.xenproject.org; Tue, 16 Jun 2020 23:22:02 +0000
X-Inumbo-ID: 2ecadf30-b028-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 2ecadf30-b028-11ea-8496-bc764e2007e4;
 Tue, 16 Jun 2020 23: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=z87QWUAwimzBzdmctaOjFBZwbQ7XVQO/ZE6qTVecbGY=; b=E+63VkNdWdmtUX7taovbQXgmRd
 JLLXHQpUUqbTzSrxmp5AM8KoD8ejNumPHvSQA/nWhEfTYhsaFHIHEfhdZqDqkvBAK9ya3Dc2QxBII
 2+c52Tk2dLNl4jGKsTZgYkan2pxjQApz1th4k9wnG7O46qOScT7+u50S5HS3RD8vF+dI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jlKu1-0001Qi-NE
 for xen-changelog@lists.xenproject.org; Tue, 16 Jun 2020 23:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jlKu1-0002sN-ME
 for xen-changelog@lists.xenproject.org; Tue, 16 Jun 2020 23:22:01 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] tools/libxl: Fix memory leak in libxl_cpuid_set()
Message-Id: <E1jlKu1-0002sN-ME@xenbits.xenproject.org>
Date: Tue, 16 Jun 2020 23: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 c54de7d9df7718ea53bf21e1ff5bbd339602a704
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jun 12 18:32:27 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Mon Jun 15 15:44:37 2020 +0100

    tools/libxl: Fix memory leak in libxl_cpuid_set()
    
    xc_cpuid_set() returns allocated memory via cpuid_res, which libxl needs to
    free() seeing as it discards the results.
    
    This is logically a backport of c/s b91825f628 "tools/libxc: Drop
    config_transformed parameter from xc_cpuid_set()" but rewritten as one caller
    of xc_cpuid_set() does use returned values.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/libxl/libxl_cpuid.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tools/libxl/libxl_cpuid.c b/tools/libxl/libxl_cpuid.c
index a78f08b927..083869dcf4 100644
--- a/tools/libxl/libxl_cpuid.c
+++ b/tools/libxl/libxl_cpuid.c
@@ -420,12 +420,17 @@ void libxl_cpuid_apply_policy(libxl_ctx *ctx, uint32_t domid)
 void libxl_cpuid_set(libxl_ctx *ctx, uint32_t domid,
                      libxl_cpuid_policy_list cpuid)
 {
-    int i;
+    int i, j;
     char *cpuid_res[4];
 
     for (i = 0; cpuid[i].input[0] != XEN_CPUID_INPUT_UNUSED; i++)
+    {
         xc_cpuid_set(ctx->xch, domid, cpuid[i].input,
                      (const char**)(cpuid[i].policy), cpuid_res);
+
+        for (j = 0; j < ARRAY_SIZE(cpuid_res); ++j)
+            free(cpuid_res[j]);
+    }
 }
 
 static const char *input_names[2] = { "leaf", "subleaf" };
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Jun 17 13:33:12 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 17 Jun 2020 13:33:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jlYBf-0005gF-Uy; Wed, 17 Jun 2020 13:33:07 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=rp6Z=76=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jlYBf-0005g6-5O
 for xen-changelog@lists.xenproject.org; Wed, 17 Jun 2020 13:33:07 +0000
X-Inumbo-ID: 131d1a88-b09f-11ea-b9eb-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 131d1a88-b09f-11ea-b9eb-12813bfff9fa;
 Wed, 17 Jun 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=nz06+Wdqm1iht3WktmmRUiScH5GF1mbvWKxFhVH9DCs=; b=pYZXdZME4+Lv22rCrPaiVFtR7z
 Bqt5HOKouTWMKItB1Yko5vcwLCSDPqyqeUTxVKnWOH8V+Avmsu7BcJenhOlFH34vmuL8SZHN4QbPv
 NTnDmJwb/dtDGltWqvLlz8KHh9R7QS0vYYUs3IS5YPaeySTiwtjdHPfowNS3XDxSnwLo=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jlYBd-0003jN-EB
 for xen-changelog@lists.xenproject.org; Wed, 17 Jun 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 1jlYBd-0001vl-CW
 for xen-changelog@lists.xenproject.org; Wed, 17 Jun 2020 13:33:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] tools/libx[cl]: Introduce struct xc_xend_cpuid for
 xc_cpuid_set()
Message-Id: <E1jlYBd-0001vl-CW@xenbits.xenproject.org>
Date: Wed, 17 Jun 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 700738bf6a7a89a1b41cc783ae58f7c8ec1e9cfa
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jun 12 14:05:44 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jun 17 13:54:12 2020 +0100

    tools/libx[cl]: Introduce struct xc_xend_cpuid for xc_cpuid_set()
    
    In order to combine the functionality of xc_cpuid_set() with
    xc_cpuid_apply_policy(), arrange to pass the data in a single contained
    struct, rather than two arrays.
    
    libxl__cpuid_policy is the ideal structure to use, but that would introduce a
    reverse dependency between libxc and libxl.  Introduce xc_xend_cpuid (with a
    transparent union to provide more useful names for the inputs), and use this
    structure in libxl.
    
    The public API has libxl_cpuid_policy as an opaque type referencing
    libxl__cpuid_policy.  Drop the inappropriate comment about its internals, and
    use xc_xend_cpuid as a differently named opaque backing object.  Users of both
    libxl and libxc are not permitted to look at the internals.
    
    No change in behaviour.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/libxc/include/xenctrl.h | 30 ++++++++++++++++++++++++++++--
 tools/libxc/xc_cpuid_x86.c    | 39 +++++++++++----------------------------
 tools/libxl/libxl.h           |  8 ++++----
 tools/libxl/libxl_cpuid.c     |  7 +++----
 tools/libxl/libxl_internal.h  | 10 ----------
 5 files changed, 46 insertions(+), 48 deletions(-)

diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h
index 7f15a61f29..6e622fc8e4 100644
--- a/tools/libxc/include/xenctrl.h
+++ b/tools/libxc/include/xenctrl.h
@@ -1792,10 +1792,36 @@ int xc_domain_debug_control(xc_interface *xch,
                             uint32_t vcpu);
 
 #if defined(__i386__) || defined(__x86_64__)
+
+/*
+ * CPUID policy data, expressed in the legacy XEND format.
+ *
+ * Policy is an array of strings, 32 chars long:
+ *   policy[0] = eax
+ *   policy[1] = ebx
+ *   policy[2] = ecx
+ *   policy[3] = edx
+ *
+ * The format of the string is the following:
+ *   '1' -> force to 1
+ *   '0' -> force to 0
+ *   'x' -> we don't care (use default)
+ *   'k' -> pass through host value
+ *   's' -> legacy alias for 'k'
+ */
+struct xc_xend_cpuid {
+    union {
+        struct {
+            uint32_t leaf, subleaf;
+        };
+        uint32_t input[2];
+    };
+    char *policy[4];
+};
+
 int xc_cpuid_set(xc_interface *xch,
                  uint32_t domid,
-                 const unsigned int *input,
-                 const char **config);
+                 const struct xc_xend_cpuid *xend);
 
 /*
  * Make adjustments to the CPUID settings for a domain.
diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c
index b42edd6457..edc2ad9b47 100644
--- a/tools/libxc/xc_cpuid_x86.c
+++ b/tools/libxc/xc_cpuid_x86.c
@@ -259,27 +259,8 @@ int xc_set_domain_cpu_policy(xc_interface *xch, uint32_t domid,
     return ret;
 }
 
-/*
- * Configure a single input with the informatiom from config.
- *
- * Config is an array of strings:
- *   config[0] = eax
- *   config[1] = ebx
- *   config[2] = ecx
- *   config[3] = edx
- *
- * The format of the string is the following:
- *   '1' -> force to 1
- *   '0' -> force to 0
- *   'x' -> we don't care (use default)
- *   'k' -> pass through host value
- *   's' -> legacy alias for 'k'
- *
- * In all cases, the returned string consists of just '0' and '1'.
- */
 int xc_cpuid_set(
-    xc_interface *xch, uint32_t domid, const unsigned int *input,
-    const char **config)
+    xc_interface *xch, uint32_t domid, const struct xc_xend_cpuid *xend)
 {
     int rc;
     unsigned int i, j, regs[4] = {}, polregs[4] = {};
@@ -324,7 +305,8 @@ int xc_cpuid_set(
         goto fail;
     }
     for ( i = 0; i < policy_leaves; ++i )
-        if ( leaves[i].leaf == input[0] && leaves[i].subleaf == input[1] )
+        if ( leaves[i].leaf == xend->leaf &&
+             leaves[i].subleaf == xend->subleaf )
         {
             polregs[0] = leaves[i].a;
             polregs[1] = leaves[i].b;
@@ -345,7 +327,8 @@ int xc_cpuid_set(
         goto fail;
     }
     for ( i = 0; i < policy_leaves; ++i )
-        if ( leaves[i].leaf == input[0] && leaves[i].subleaf == input[1] )
+        if ( leaves[i].leaf == xend->leaf &&
+             leaves[i].subleaf == xend->subleaf )
         {
             regs[0] = leaves[i].a;
             regs[1] = leaves[i].b;
@@ -356,7 +339,7 @@ int xc_cpuid_set(
 
     for ( i = 0; i < 4; i++ )
     {
-        if ( config[i] == NULL )
+        if ( xend->policy[i] == NULL )
         {
             regs[i] = polregs[i];
             continue;
@@ -375,14 +358,14 @@ int xc_cpuid_set(
             unsigned char polval = !!((polregs[i] & (1U << (31 - j))));
 
             rc = -EINVAL;
-            if ( !strchr("10xks", config[i][j]) )
+            if ( !strchr("10xks", xend->policy[i][j]) )
                 goto fail;
 
-            if ( config[i][j] == '1' )
+            if ( xend->policy[i][j] == '1' )
                 val = 1;
-            else if ( config[i][j] == '0' )
+            else if ( xend->policy[i][j] == '0' )
                 val = 0;
-            else if ( config[i][j] == 'x' )
+            else if ( xend->policy[i][j] == 'x' )
                 val = polval;
 
             if ( val )
@@ -393,7 +376,7 @@ int xc_cpuid_set(
     }
 
     /* Feed the transformed leaf back up to Xen. */
-    leaves[0] = (xen_cpuid_leaf_t){ input[0], input[1],
+    leaves[0] = (xen_cpuid_leaf_t){ xend->leaf, xend->subleaf,
                                     regs[0], regs[1], regs[2], regs[3] };
     rc = xc_set_domain_cpu_policy(xch, domid, 1, leaves, 0, NULL,
                                   &err_leaf, &err_subleaf, &err_msr);
diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
index 71709dc585..1cd6c38e83 100644
--- a/tools/libxl/libxl.h
+++ b/tools/libxl/libxl.h
@@ -1310,11 +1310,11 @@ typedef struct {
 void libxl_bitmap_init(libxl_bitmap *map);
 void libxl_bitmap_dispose(libxl_bitmap *map);
 
-/* libxl_cpuid_policy_list is a dynamic array storing CPUID policies
- * for multiple leafs. It is terminated with an entry holding
- * XEN_CPUID_INPUT_UNUSED in input[0]
+/*
+ * libxl_cpuid_policy is opaque in the libxl ABI.  Users of both libxl and
+ * libxc may not make assumptions about xc_xend_cpuid.
  */
-typedef struct libxl__cpuid_policy libxl_cpuid_policy;
+typedef struct xc_xend_cpuid libxl_cpuid_policy;
 typedef libxl_cpuid_policy * libxl_cpuid_policy_list;
 void libxl_cpuid_dispose(libxl_cpuid_policy_list *cpuid_list);
 int libxl_cpuid_policy_list_length(const libxl_cpuid_policy_list *l);
diff --git a/tools/libxl/libxl_cpuid.c b/tools/libxl/libxl_cpuid.c
index 796ec4f2d9..e001cbcd4f 100644
--- a/tools/libxl/libxl_cpuid.c
+++ b/tools/libxl/libxl_cpuid.c
@@ -288,7 +288,7 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
     char *sep, *val, *endptr;
     int i;
     const struct cpuid_flags *flag;
-    struct libxl__cpuid_policy *entry;
+    struct xc_xend_cpuid *entry;
     unsigned long num;
     char flags[33], *resstr;
 
@@ -366,7 +366,7 @@ int libxl_cpuid_parse_config_xend(libxl_cpuid_policy_list *cpuid,
     char *endptr;
     unsigned long value;
     uint32_t leaf, subleaf = XEN_CPUID_INPUT_UNUSED;
-    struct libxl__cpuid_policy *entry;
+    struct xc_xend_cpuid *entry;
 
     /* parse the leaf number */
     value = strtoul(str, &endptr, 0);
@@ -442,8 +442,7 @@ void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid,
         return;
 
     for (i = 0; cpuid[i].input[0] != XEN_CPUID_INPUT_UNUSED; i++)
-        xc_cpuid_set(ctx->xch, domid, cpuid[i].input,
-                     (const char**)cpuid[i].policy);
+        xc_cpuid_set(ctx->xch, domid, &cpuid[i]);
 }
 
 static const char *input_names[2] = { "leaf", "subleaf" };
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index c7ece066c4..79c2bf5f5e 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -2056,16 +2056,6 @@ typedef yajl_gen_status (*libxl__gen_json_callback)(yajl_gen hand, void *);
 _hidden char *libxl__object_to_json(libxl_ctx *ctx, const char *type,
                                     libxl__gen_json_callback gen, void *p);
 
-  /* holds the CPUID response for a single CPUID leaf
-   * input contains the value of the EAX and ECX register,
-   * and each policy string contains a filter to apply to
-   * the host given values for that particular leaf.
-   */
-struct libxl__cpuid_policy {
-    uint32_t input[2];
-    char *policy[4];
-};
-
 _hidden void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid,
                                  libxl_domain_build_info *info);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jun 17 13:33:17 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 17 Jun 2020 13:33:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jlYBp-0005hF-0M; Wed, 17 Jun 2020 13: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=rp6Z=76=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jlYBo-0005h9-A2
 for xen-changelog@lists.xenproject.org; Wed, 17 Jun 2020 13:33:16 +0000
X-Inumbo-ID: 191ee1dc-b09f-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 191ee1dc-b09f-11ea-bca7-bc764e2007e4;
 Wed, 17 Jun 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=g7nhidC+MEqXLzavzomexgPmeyISieFdrmVC+wB8Rqs=; b=y+xdfyqZmZocLHNvBiaOumAR6u
 laHz4Zk14sfWI5jIXu5nrHqFJiHd65AuMbgZAIqCJh8VRxdcr7FAxiJYNicsyuIgz5i/aDB5l19xg
 P7eZZHGi7JFLTxh/OH1Lepoo7O8KqfpHngst3K8dmm5POcI7pHuXaOZClg6jYGpVxqQk=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jlYBn-0003jX-HG
 for xen-changelog@lists.xenproject.org; Wed, 17 Jun 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 1jlYBn-0001wP-GO
 for xen-changelog@lists.xenproject.org; Wed, 17 Jun 2020 13:33:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] tests/cpu-policy: Confirm that CPUID serialisation is
 sorted
Message-Id: <E1jlYBn-0001wP-GO@xenbits.xenproject.org>
Date: Wed, 17 Jun 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 c22ced93e167f56104111fcc414298c0cd2db3e9
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jun 12 16:48:02 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jun 17 13:54:12 2020 +0100

    tests/cpu-policy: Confirm that CPUID serialisation is sorted
    
    The existing x86_cpuid_copy_to_buffer() does produce sorted results, and we're
    about to start relying on this.  Extend the unit tests.
    
    As test_cpuid_serialise_success() is a fairly limited set of synthetic
    examples right now, introduce test_cpuid_current() to operate on the full
    policy for the current CPU.
    
    Tweak the fail() macro to allow for simplified control flow.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/tests/cpu-policy/test-cpu-policy.c | 49 +++++++++++++++++++++++++++++++-
 1 file changed, 48 insertions(+), 1 deletion(-)

diff --git a/tools/tests/cpu-policy/test-cpu-policy.c b/tools/tests/cpu-policy/test-cpu-policy.c
index fe8cdf6ea9..7ba9707236 100644
--- a/tools/tests/cpu-policy/test-cpu-policy.c
+++ b/tools/tests/cpu-policy/test-cpu-policy.c
@@ -16,7 +16,7 @@ static unsigned int nr_failures;
 #define fail(fmt, ...)                          \
 ({                                              \
     nr_failures++;                              \
-    printf(fmt, ##__VA_ARGS__);                 \
+    (void)printf(fmt, ##__VA_ARGS__);           \
 })
 
 #define memdup(ptr)                             \
@@ -66,6 +66,45 @@ static void test_vendor_identification(void)
     }
 }
 
+static bool leaves_are_sorted(const xen_cpuid_leaf_t *leaves, unsigned int nr)
+{
+    for ( unsigned int i = 1; i < nr; ++i )
+    {
+        /* leaf index went backwards => not sorted. */
+        if ( leaves[i - 1].leaf > leaves[i].leaf )
+            return false;
+
+        /* leaf index went forwards => ok */
+        if ( leaves[i - 1].leaf < leaves[i].leaf )
+            continue;
+
+        /* leave index the same, subleaf didn't increase => not sorted. */
+        if ( leaves[i - 1].subleaf >= leaves[i].subleaf )
+            return false;
+    }
+
+    return true;
+}
+
+static void test_cpuid_current(void)
+{
+    struct cpuid_policy p;
+    xen_cpuid_leaf_t leaves[CPUID_MAX_SERIALISED_LEAVES];
+    unsigned int nr = ARRAY_SIZE(leaves);
+    int rc;
+
+    printf("Testing CPUID on current CPU\n");
+
+    x86_cpuid_policy_fill_native(&p);
+
+    rc = x86_cpuid_copy_to_buffer(&p, leaves, &nr);
+    if ( rc != 0 )
+        return fail("  Serialise, expected rc 0, got %d\n", rc);
+
+    if ( !leaves_are_sorted(leaves, nr) )
+        return fail("  Leaves not sorted\n");
+}
+
 static void test_cpuid_serialise_success(void)
 {
     static const struct test {
@@ -178,6 +217,13 @@ static void test_cpuid_serialise_success(void)
             goto test_done;
         }
 
+        if ( !leaves_are_sorted(leaves, nr) )
+        {
+            fail("  Test %s, leaves not sorted\n",
+                 t->name);
+            goto test_done;
+        }
+
     test_done:
         free(leaves);
     }
@@ -613,6 +659,7 @@ int main(int argc, char **argv)
 
     test_vendor_identification();
 
+    test_cpuid_current();
     test_cpuid_serialise_success();
     test_cpuid_deserialise_failure();
     test_cpuid_out_of_range_clearing();
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jun 17 13:33:27 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 17 Jun 2020 13:33:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jlYBz-0005iU-1w; Wed, 17 Jun 2020 13:33:27 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=rp6Z=76=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jlYBy-0005iO-Kk
 for xen-changelog@lists.xenproject.org; Wed, 17 Jun 2020 13:33:26 +0000
X-Inumbo-ID: 1f252b7c-b09f-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 1f252b7c-b09f-11ea-8496-bc764e2007e4;
 Wed, 17 Jun 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=Hk6NcixIrL1LzqkygQi+bEXXpZLhFwcQouOmnGKwk0U=; b=EYFkqtQo9HtKa55xaXp2b8FvOS
 BGAQ6mDBVaXZrCSc39+AgVzj29VIC3CZ8dPAW3Y+aOQmP3Ypy1P0rwcSh2Y5b/CwZDYETvFWimx2R
 QapZo7J9vjhrFOLL4LAE899dEOorF40muCvEqQHHGPd28sJzATRTFb5ilD0FTsrO6jWE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jlYBx-0003kC-KL
 for xen-changelog@lists.xenproject.org; Wed, 17 Jun 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 1jlYBx-0001x4-JR
 for xen-changelog@lists.xenproject.org; Wed, 17 Jun 2020 13:33:25 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] tools/libx[cl]: Move processing loop down into
 xc_cpuid_set()
Message-Id: <E1jlYBx-0001x4-JR@xenbits.xenproject.org>
Date: Wed, 17 Jun 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 585c7f4317987b4e92a381d6178be238be4c9653
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jun 12 14:07:10 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jun 17 13:54:12 2020 +0100

    tools/libx[cl]: Move processing loop down into xc_cpuid_set()
    
    Currently, libxl__cpuid_legacy() passes each element of the policy list to
    xc_cpuid_set() individually.  This is wasteful both in terms of the number of
    hypercalls made, and the quantity of repeated merging/auditing work performed
    by Xen.
    
    Move the loop processing down into xc_cpuid_set(), which allows us to do one
    set of hypercalls, rather than one per list entry.
    
    In xc_cpuid_set(), obtain the full host, guest max and current policies to
    begin with, and loop over the xend array, processing one leaf at a time.
    Replace the linear search with a binary search, seeing as the serialised
    leaves are sorted.
    
    No change in behaviour from the guests point of view.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/libxc/xc_cpuid_x86.c | 159 +++++++++++++++++++++++++++------------------
 tools/libxl/libxl_cpuid.c  |   4 +-
 2 files changed, 95 insertions(+), 68 deletions(-)

diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c
index edc2ad9b47..548762e7b4 100644
--- a/tools/libxc/xc_cpuid_x86.c
+++ b/tools/libxc/xc_cpuid_x86.c
@@ -38,8 +38,6 @@ enum {
 
 #define bitmaskof(idx)      (1u << ((idx) & 31))
 #define featureword_of(idx) ((idx) >> 5)
-#define clear_feature(idx, dst) ((dst) &= ~bitmaskof(idx))
-#define set_feature(idx, dst)   ((dst) |=  bitmaskof(idx))
 
 int xc_get_cpu_levelling_caps(xc_interface *xch, uint32_t *caps)
 {
@@ -259,15 +257,42 @@ int xc_set_domain_cpu_policy(xc_interface *xch, uint32_t domid,
     return ret;
 }
 
+static int compare_leaves(const void *l, const void *r)
+{
+    const xen_cpuid_leaf_t *lhs = l;
+    const xen_cpuid_leaf_t *rhs = r;
+
+    if ( lhs->leaf != rhs->leaf )
+        return lhs->leaf < rhs->leaf ? -1 : 1;
+
+    if ( lhs->subleaf != rhs->subleaf )
+        return lhs->subleaf < rhs->subleaf ? -1 : 1;
+
+    return 0;
+}
+
+static xen_cpuid_leaf_t *find_leaf(
+    xen_cpuid_leaf_t *leaves, unsigned int nr_leaves,
+    const struct xc_xend_cpuid *xend)
+{
+    const xen_cpuid_leaf_t key = { xend->leaf, xend->subleaf };
+
+    return bsearch(&key, leaves, nr_leaves, sizeof(*leaves), compare_leaves);
+}
+
 int xc_cpuid_set(
     xc_interface *xch, uint32_t domid, const struct xc_xend_cpuid *xend)
 {
     int rc;
-    unsigned int i, j, regs[4] = {}, polregs[4] = {};
     xc_dominfo_t di;
-    xen_cpuid_leaf_t *leaves = NULL;
-    unsigned int nr_leaves, policy_leaves, nr_msrs;
+    unsigned int nr_leaves, nr_msrs;
     uint32_t err_leaf = -1, err_subleaf = -1, err_msr = -1;
+    /*
+     * Three full policies.  The host, domain max, and domain current for the
+     * domain type.
+     */
+    xen_cpuid_leaf_t *host = NULL, *max = NULL, *cur = NULL;
+    unsigned int nr_host, nr_max, nr_cur;
 
     if ( xc_domain_getinfo(xch, domid, 1, &di) != 1 ||
          di.domid != domid )
@@ -286,99 +311,101 @@ int xc_cpuid_set(
     }
 
     rc = -ENOMEM;
-    if ( (leaves = calloc(nr_leaves, sizeof(*leaves))) == NULL )
+    if ( (host = calloc(nr_leaves, sizeof(*host))) == NULL ||
+         (max  = calloc(nr_leaves, sizeof(*max)))  == NULL ||
+         (cur  = calloc(nr_leaves, sizeof(*cur)))  == NULL )
     {
         ERROR("Unable to allocate memory for %u CPUID leaves", nr_leaves);
         goto fail;
     }
 
+    /* Get the domain's current policy. */
+    nr_msrs = 0;
+    nr_cur = nr_leaves;
+    rc = xc_get_domain_cpu_policy(xch, domid, &nr_cur, cur, &nr_msrs, NULL);
+    if ( rc )
+    {
+        PERROR("Failed to obtain d%d current policy", domid);
+        rc = -errno;
+        goto fail;
+    }
+
     /* Get the domain's max policy. */
     nr_msrs = 0;
-    policy_leaves = nr_leaves;
+    nr_max = nr_leaves;
     rc = xc_get_system_cpu_policy(xch, di.hvm ? XEN_SYSCTL_cpu_policy_hvm_max
                                               : XEN_SYSCTL_cpu_policy_pv_max,
-                                  &policy_leaves, leaves, &nr_msrs, NULL);
+                                  &nr_max, max, &nr_msrs, NULL);
     if ( rc )
     {
         PERROR("Failed to obtain %s max policy", di.hvm ? "hvm" : "pv");
         rc = -errno;
         goto fail;
     }
-    for ( i = 0; i < policy_leaves; ++i )
-        if ( leaves[i].leaf == xend->leaf &&
-             leaves[i].subleaf == xend->subleaf )
-        {
-            polregs[0] = leaves[i].a;
-            polregs[1] = leaves[i].b;
-            polregs[2] = leaves[i].c;
-            polregs[3] = leaves[i].d;
-            break;
-        }
 
     /* Get the host policy. */
     nr_msrs = 0;
-    policy_leaves = nr_leaves;
+    nr_host = nr_leaves;
     rc = xc_get_system_cpu_policy(xch, XEN_SYSCTL_cpu_policy_host,
-                                  &policy_leaves, leaves, &nr_msrs, NULL);
+                                  &nr_host, host, &nr_msrs, NULL);
     if ( rc )
     {
         PERROR("Failed to obtain host policy");
         rc = -errno;
         goto fail;
     }
-    for ( i = 0; i < policy_leaves; ++i )
-        if ( leaves[i].leaf == xend->leaf &&
-             leaves[i].subleaf == xend->subleaf )
-        {
-            regs[0] = leaves[i].a;
-            regs[1] = leaves[i].b;
-            regs[2] = leaves[i].c;
-            regs[3] = leaves[i].d;
-            break;
-        }
 
-    for ( i = 0; i < 4; i++ )
+    rc = -EINVAL;
+    for ( ; xend->leaf != XEN_CPUID_INPUT_UNUSED; ++xend )
     {
-        if ( xend->policy[i] == NULL )
+        xen_cpuid_leaf_t *cur_leaf = find_leaf(cur, nr_cur, xend);
+        const xen_cpuid_leaf_t *max_leaf = find_leaf(max, nr_max, xend);
+        const xen_cpuid_leaf_t *host_leaf = find_leaf(host, nr_host, xend);
+
+        if ( cur_leaf == NULL || max_leaf == NULL || host_leaf == NULL )
         {
-            regs[i] = polregs[i];
-            continue;
+            ERROR("Missing leaf %#x, subleaf %#x", xend->leaf, xend->subleaf);
+            goto fail;
         }
 
-        /*
-         * Notes for following this algorithm:
-         *
-         * While it will accept any leaf data, it only makes sense to use on
-         * feature leaves.  regs[] initially contains the host values.  This,
-         * with the fall-through chain, is how the 's' and 'k' options work.
-         */
-        for ( j = 0; j < 32; j++ )
+        for ( unsigned int i = 0; i < ARRAY_SIZE(xend->policy); i++ )
         {
-            unsigned char val = !!((regs[i] & (1U << (31 - j))));
-            unsigned char polval = !!((polregs[i] & (1U << (31 - j))));
-
-            rc = -EINVAL;
-            if ( !strchr("10xks", xend->policy[i][j]) )
-                goto fail;
-
-            if ( xend->policy[i][j] == '1' )
-                val = 1;
-            else if ( xend->policy[i][j] == '0' )
-                val = 0;
-            else if ( xend->policy[i][j] == 'x' )
-                val = polval;
-
-            if ( val )
-                set_feature(31 - j, regs[i]);
-            else
-                clear_feature(31 - j, regs[i]);
+            uint32_t *cur_reg = &cur_leaf->a + i;
+            const uint32_t *max_reg = &max_leaf->a + i;
+            const uint32_t *host_reg = &host_leaf->a + i;
+
+            if ( xend->policy[i] == NULL )
+                continue;
+
+            for ( unsigned int j = 0; j < 32; j++ )
+            {
+                bool val;
+
+                if ( xend->policy[i][j] == '1' )
+                    val = true;
+                else if ( xend->policy[i][j] == '0' )
+                    val = false;
+                else if ( xend->policy[i][j] == 'x' )
+                    val = test_bit(31 - j, max_reg);
+                else if ( xend->policy[i][j] == 'k' ||
+                          xend->policy[i][j] == 's' )
+                    val = test_bit(31 - j, host_reg);
+                else
+                {
+                    ERROR("Bad character '%c' in policy[%d] string '%s'",
+                          xend->policy[i][j], i, xend->policy[i]);
+                    goto fail;
+                }
+
+                clear_bit(31 - j, cur_reg);
+                if ( val )
+                    set_bit(31 - j, cur_reg);
+            }
         }
     }
 
-    /* Feed the transformed leaf back up to Xen. */
-    leaves[0] = (xen_cpuid_leaf_t){ xend->leaf, xend->subleaf,
-                                    regs[0], regs[1], regs[2], regs[3] };
-    rc = xc_set_domain_cpu_policy(xch, domid, 1, leaves, 0, NULL,
+    /* Feed the transformed currrent policy back up to Xen. */
+    rc = xc_set_domain_cpu_policy(xch, domid, nr_cur, cur, 0, NULL,
                                   &err_leaf, &err_subleaf, &err_msr);
     if ( rc )
     {
@@ -391,7 +418,9 @@ int xc_cpuid_set(
     /* Success! */
 
  fail:
-    free(leaves);
+    free(cur);
+    free(max);
+    free(host);
 
     return rc;
 }
diff --git a/tools/libxl/libxl_cpuid.c b/tools/libxl/libxl_cpuid.c
index e001cbcd4f..6f7cf2054e 100644
--- a/tools/libxl/libxl_cpuid.c
+++ b/tools/libxl/libxl_cpuid.c
@@ -420,7 +420,6 @@ void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid,
                          libxl_domain_build_info *info)
 {
     libxl_cpuid_policy_list cpuid = info->cpuid;
-    int i;
     bool pae = true;
 
     /*
@@ -441,8 +440,7 @@ void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid,
     if (!cpuid)
         return;
 
-    for (i = 0; cpuid[i].input[0] != XEN_CPUID_INPUT_UNUSED; i++)
-        xc_cpuid_set(ctx->xch, domid, &cpuid[i]);
+    xc_cpuid_set(ctx->xch, domid, info->cpuid);
 }
 
 static const char *input_names[2] = { "leaf", "subleaf" };
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jun 17 13:33:37 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 17 Jun 2020 13:33:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jlYC9-0005kE-3X; Wed, 17 Jun 2020 13:33: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=rp6Z=76=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jlYC8-0005k0-EM
 for xen-changelog@lists.xenproject.org; Wed, 17 Jun 2020 13:33:36 +0000
X-Inumbo-ID: 2529557a-b09f-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 2529557a-b09f-11ea-8496-bc764e2007e4;
 Wed, 17 Jun 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=x7Ql1PWl8A58M8qx0PNPyVxBGUgMGq1mGsCm+mHUMwg=; b=2GWd8Ca33bgRq8zd0VYfDqgJZF
 e6/i7HBdjFv+mvuXtmI+hOAXA480BZ+E2A8soUl0E4t6YCGfHcIctB3tQ1KNnm01ze47HneKhkgFc
 mam+F7gNQmJGpCHfDiprD581qHlCa963tYiUlSiobvJL93EW78EXmdG7V3GL6eWvFtS8=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jlYC7-0003kM-No
 for xen-changelog@lists.xenproject.org; Wed, 17 Jun 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 1jlYC7-0001xa-Mi
 for xen-changelog@lists.xenproject.org; Wed, 17 Jun 2020 13:33:35 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] tools/libx[cl]: Merge xc_cpuid_set() into
 xc_cpuid_apply_policy()
Message-Id: <E1jlYC7-0001xa-Mi@xenbits.xenproject.org>
Date: Wed, 17 Jun 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 f79cd47cd7a2ea321a0fe7d46586bdbea4845cdd
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jun 12 14:07:10 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jun 17 13:54:12 2020 +0100

    tools/libx[cl]: Merge xc_cpuid_set() into xc_cpuid_apply_policy()
    
    This reduces the number of CPUID handling entry-points to just one.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/libxc/include/xenctrl.h | 9 ++++-----
 tools/libxc/xc_cpuid_x86.c    | 8 ++++++--
 tools/libxl/libxl_cpuid.c     | 8 +-------
 3 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h
index 6e622fc8e4..c1495553a5 100644
--- a/tools/libxc/include/xenctrl.h
+++ b/tools/libxc/include/xenctrl.h
@@ -1819,20 +1819,19 @@ struct xc_xend_cpuid {
     char *policy[4];
 };
 
-int xc_cpuid_set(xc_interface *xch,
-                 uint32_t domid,
-                 const struct xc_xend_cpuid *xend);
-
 /*
  * Make adjustments to the CPUID settings for a domain.
  *
  * Either pass a full new @featureset (and @nr_features), or adjust individual
  * features (@pae).
+ *
+ * Then (optionally) apply legacy XEND overrides (@xend) to the result.
  */
 int xc_cpuid_apply_policy(xc_interface *xch,
                           uint32_t domid,
                           const uint32_t *featureset,
-                          unsigned int nr_features, bool pae);
+                          unsigned int nr_features, bool pae,
+                          const struct xc_xend_cpuid *xend);
 int xc_mca_op(xc_interface *xch, struct xen_mc *mc);
 int xc_mca_op_inject_v2(xc_interface *xch, unsigned int flags,
                         xc_cpumap_t cpumap, unsigned int nr_cpus);
diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c
index 548762e7b4..77aab0854f 100644
--- a/tools/libxc/xc_cpuid_x86.c
+++ b/tools/libxc/xc_cpuid_x86.c
@@ -280,7 +280,7 @@ static xen_cpuid_leaf_t *find_leaf(
     return bsearch(&key, leaves, nr_leaves, sizeof(*leaves), compare_leaves);
 }
 
-int xc_cpuid_set(
+static int xc_cpuid_xend_policy(
     xc_interface *xch, uint32_t domid, const struct xc_xend_cpuid *xend)
 {
     int rc;
@@ -427,7 +427,8 @@ int xc_cpuid_set(
 
 int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid,
                           const uint32_t *featureset, unsigned int nr_features,
-                          bool pae)
+                          bool pae,
+                          const struct xc_xend_cpuid *xend)
 {
     int rc;
     xc_dominfo_t di;
@@ -637,6 +638,9 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid,
         goto out;
     }
 
+    if ( xend && (rc = xc_cpuid_xend_policy(xch, domid, xend)) )
+        goto out;
+
     rc = 0;
 
 out:
diff --git a/tools/libxl/libxl_cpuid.c b/tools/libxl/libxl_cpuid.c
index 6f7cf2054e..edfcf315ca 100644
--- a/tools/libxl/libxl_cpuid.c
+++ b/tools/libxl/libxl_cpuid.c
@@ -419,7 +419,6 @@ int libxl_cpuid_parse_config_xend(libxl_cpuid_policy_list *cpuid,
 void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid,
                          libxl_domain_build_info *info)
 {
-    libxl_cpuid_policy_list cpuid = info->cpuid;
     bool pae = true;
 
     /*
@@ -435,12 +434,7 @@ void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid,
     if (info->type == LIBXL_DOMAIN_TYPE_HVM)
         pae = libxl_defbool_val(info->u.hvm.pae);
 
-    xc_cpuid_apply_policy(ctx->xch, domid, NULL, 0, pae);
-
-    if (!cpuid)
-        return;
-
-    xc_cpuid_set(ctx->xch, domid, info->cpuid);
+    xc_cpuid_apply_policy(ctx->xch, domid, NULL, 0, pae, info->cpuid);
 }
 
 static const char *input_names[2] = { "leaf", "subleaf" };
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jun 17 13:33:48 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 17 Jun 2020 13:33: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 1jlYCK-0005lU-70; Wed, 17 Jun 2020 13:33: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=rp6Z=76=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jlYCI-0005lM-Ob
 for xen-changelog@lists.xenproject.org; Wed, 17 Jun 2020 13:33:46 +0000
X-Inumbo-ID: 2b3c039a-b09f-11ea-b9eb-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 2b3c039a-b09f-11ea-b9eb-12813bfff9fa;
 Wed, 17 Jun 2020 13:33: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=SwSwJG/BwSlBKEvxREYiYEjRSHVtwoeVrpeHzRlQbfo=; b=bH0/jNX3TdvC6dMeNEx0L8T1ds
 Ln+PWGYOO2OmBRYDS2IWrrZ8oe30OPoZAFpF+cSoP3FjYEG73KEXRvHo1E3whSXaj3LQfWlQUVmnx
 O/apJJZgG2izy0GccK/6VsNNWKxrWXuIfOidvFVycktS+50Brw2PsESe2yClBbJSy+FQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jlYCH-0003kT-SS
 for xen-changelog@lists.xenproject.org; Wed, 17 Jun 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 1jlYCH-0001yL-Qg
 for xen-changelog@lists.xenproject.org; Wed, 17 Jun 2020 13:33:45 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] tools/libx[cl]: Plumb bool restore down into
 xc_cpuid_apply_policy()
Message-Id: <E1jlYCH-0001yL-Qg@xenbits.xenproject.org>
Date: Wed, 17 Jun 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 057012d2899e4e71e274f77fcab136b0cad23099
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jun 12 14:07:10 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jun 17 13:54:12 2020 +0100

    tools/libx[cl]: Plumb bool restore down into xc_cpuid_apply_policy()
    
    In order to safely disable some features by default, without breaking
    migration from 4.13 or older, the CPUID logic needs to distinguish the two
    cases.
    
    Plumb a restore boolean down from the two callers of libxl__cpuid_legacy() all
    the way down into xc_cpuid_apply_policy().
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/libxc/include/xenctrl.h | 7 ++++++-
 tools/libxc/xc_cpuid_x86.c    | 2 +-
 tools/libxl/libxl_cpuid.c     | 4 ++--
 tools/libxl/libxl_create.c    | 2 +-
 tools/libxl/libxl_dom.c       | 2 +-
 tools/libxl/libxl_internal.h  | 2 +-
 tools/libxl/libxl_nocpuid.c   | 2 +-
 7 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h
index c1495553a5..4c89b7294c 100644
--- a/tools/libxc/include/xenctrl.h
+++ b/tools/libxc/include/xenctrl.h
@@ -1822,13 +1822,18 @@ struct xc_xend_cpuid {
 /*
  * Make adjustments to the CPUID settings for a domain.
  *
+ * This path is used in two cases.  First, for fresh boots of the domain, and
+ * secondly for migrate-in/restore of pre-4.14 guests (where CPUID data was
+ * missing from the stream).  The @restore parameter distinguishes these
+ * cases, and the generated policy must be compatible with a 4.13.
+ *
  * Either pass a full new @featureset (and @nr_features), or adjust individual
  * features (@pae).
  *
  * Then (optionally) apply legacy XEND overrides (@xend) to the result.
  */
 int xc_cpuid_apply_policy(xc_interface *xch,
-                          uint32_t domid,
+                          uint32_t domid, bool restore,
                           const uint32_t *featureset,
                           unsigned int nr_features, bool pae,
                           const struct xc_xend_cpuid *xend);
diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c
index 77aab0854f..b6b5dc88a2 100644
--- a/tools/libxc/xc_cpuid_x86.c
+++ b/tools/libxc/xc_cpuid_x86.c
@@ -425,7 +425,7 @@ static int xc_cpuid_xend_policy(
     return rc;
 }
 
-int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid,
+int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, bool restore,
                           const uint32_t *featureset, unsigned int nr_features,
                           bool pae,
                           const struct xc_xend_cpuid *xend)
diff --git a/tools/libxl/libxl_cpuid.c b/tools/libxl/libxl_cpuid.c
index edfcf315ca..db2f12d115 100644
--- a/tools/libxl/libxl_cpuid.c
+++ b/tools/libxl/libxl_cpuid.c
@@ -416,7 +416,7 @@ int libxl_cpuid_parse_config_xend(libxl_cpuid_policy_list *cpuid,
     return 0;
 }
 
-void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid,
+void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid, bool restore,
                          libxl_domain_build_info *info)
 {
     bool pae = true;
@@ -434,7 +434,7 @@ void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid,
     if (info->type == LIBXL_DOMAIN_TYPE_HVM)
         pae = libxl_defbool_val(info->u.hvm.pae);
 
-    xc_cpuid_apply_policy(ctx->xch, domid, NULL, 0, pae, info->cpuid);
+    xc_cpuid_apply_policy(ctx->xch, domid, restore, NULL, 0, pae, info->cpuid);
 }
 
 static const char *input_names[2] = { "leaf", "subleaf" };
diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index 75862dc6ed..2814818e34 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -1447,7 +1447,7 @@ int libxl__srm_callout_callback_static_data_done(unsigned int missing,
      * stream doesn't contain any CPUID data.
      */
     if (missing & XGR_SDD_MISSING_CPUID)
-        libxl__cpuid_legacy(ctx, dcs->guest_domid, info);
+        libxl__cpuid_legacy(ctx, dcs->guest_domid, true, info);
 
     return 0;
 }
diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c
index dd1aff89a3..f8661e90d4 100644
--- a/tools/libxl/libxl_dom.c
+++ b/tools/libxl/libxl_dom.c
@@ -391,7 +391,7 @@ int libxl__build_pre(libxl__gc *gc, uint32_t domid,
      * being migrated-in/restored have CPUID handled during the
      * static_data_done() callback. */
     if (!state->restore)
-        libxl__cpuid_legacy(ctx, domid, info);
+        libxl__cpuid_legacy(ctx, domid, false, info);
 
     return rc;
 }
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 79c2bf5f5e..94a23179d3 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -2056,7 +2056,7 @@ typedef yajl_gen_status (*libxl__gen_json_callback)(yajl_gen hand, void *);
 _hidden char *libxl__object_to_json(libxl_ctx *ctx, const char *type,
                                     libxl__gen_json_callback gen, void *p);
 
-_hidden void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid,
+_hidden void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid, bool retore,
                                  libxl_domain_build_info *info);
 
 /* Calls poll() again - useful to check whether a signaled condition
diff --git a/tools/libxl/libxl_nocpuid.c b/tools/libxl/libxl_nocpuid.c
index 3f30e148be..f47336565b 100644
--- a/tools/libxl/libxl_nocpuid.c
+++ b/tools/libxl/libxl_nocpuid.c
@@ -34,7 +34,7 @@ int libxl_cpuid_parse_config_xend(libxl_cpuid_policy_list *cpuid,
     return 0;
 }
 
-void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid,
+void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid, bool restore,
                          libxl_domain_build_info *info)
 {
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jun 17 13:33:57 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 17 Jun 2020 13:33:57 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jlYCT-0005n7-8Y; Wed, 17 Jun 2020 13:33: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=rp6Z=76=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jlYCS-0005mz-NA
 for xen-changelog@lists.xenproject.org; Wed, 17 Jun 2020 13:33:56 +0000
X-Inumbo-ID: 31397aca-b09f-11ea-b9eb-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 31397aca-b09f-11ea-b9eb-12813bfff9fa;
 Wed, 17 Jun 2020 13:33: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=s5B/U+UR2cvCA5xe9ZeU5nZT2ch4cYo7ZF7gvcpoN7M=; b=5s21zJVJBD3efxKu8odu078BW6
 pvazEEsyBc0K5Lw8ZSPAUfRGT2SA2Cmt95THrbbJwgxIZK8L4ZyEzUCy6nmyw0huHRjp+TdidmgEJ
 MJ/U3N71CJaNtNCIlMTvM51JQBl0AIePfIG1SKhp+NcDksri+GtBTRL7CUub1nsnF21U=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jlYCR-0003ka-Vh
 for xen-changelog@lists.xenproject.org; Wed, 17 Jun 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 1jlYCR-0001yx-Ug
 for xen-changelog@lists.xenproject.org; Wed, 17 Jun 2020 13:33:55 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/gen-cpuid: Distinguish default vs max in feature
 annotations
Message-Id: <E1jlYCR-0001yx-Ug@xenbits.xenproject.org>
Date: Wed, 17 Jun 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 1accd92514f286c44e76f198f1bba90ad2e9e83b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Feb 25 15:33:31 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jun 17 13:54:12 2020 +0100

    x86/gen-cpuid: Distinguish default vs max in feature annotations
    
    The toolstack logic can now correctly distinguish a clean boot from a
    migrate/restore.
    
    Allow lowercase a/s/h to be used to annotate a non-default feature.
    
    Due to the emulator work prepared earlier in 4.14, this now allows VMs to
    explicity opt in to the TSXLDTRK, MOVDIR{I,64B} and SERIALIZE instructions via
    their xl.cfg file, rather than getting them as a matter of default.
    
    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/tools/gen-cpuid.py | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/xen/tools/gen-cpuid.py b/xen/tools/gen-cpuid.py
index 037954cfb8..ffd9529fdf 100755
--- a/xen/tools/gen-cpuid.py
+++ b/xen/tools/gen-cpuid.py
@@ -130,17 +130,13 @@ def crunch_numbers(state):
                  MTRR, PGE, MCA, CMOV, PAT, PSE36, MMX, FXSR)
     state.common_1d = common_1d
 
-    state.pv_def = state.raw['A']
-    state.hvm_shadow_def = state.pv_def | state.raw['S']
-    state.hvm_hap_def = state.hvm_shadow_def | state.raw['H']
-
-    # TODO: Ignore def/max split until the toolstack migration logic is fixed
-    state.pv_max = state.pv_def
-    state.hvm_shadow_max = state.hvm_shadow_def
-    state.hvm_hap_max = state.hvm_hap_def
-    # state.pv_max =                                state.raw['A'] | state.raw['a']
-    # state.hvm_shadow_max = state.pv_max         | state.raw['S'] | state.raw['s']
-    # state.hvm_hap_max =    state.hvm_shadow_max | state.raw['H'] | state.raw['h']
+    state.pv_def =                                state.raw['A']
+    state.hvm_shadow_def = state.pv_def         | state.raw['S']
+    state.hvm_hap_def =    state.hvm_shadow_def | state.raw['H']
+
+    state.pv_max =                                state.raw['A'] | state.raw['a']
+    state.hvm_shadow_max = state.pv_max         | state.raw['S'] | state.raw['s']
+    state.hvm_hap_max =    state.hvm_shadow_max | state.raw['H'] | state.raw['h']
 
     #
     # Feature dependency information.
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jun 17 13:34:08 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 17 Jun 2020 13:34: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 1jlYCe-0005oT-A6; Wed, 17 Jun 2020 13:34: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=rp6Z=76=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jlYCd-0005oL-2G
 for xen-changelog@lists.xenproject.org; Wed, 17 Jun 2020 13:34:07 +0000
X-Inumbo-ID: 37422ce6-b09f-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 37422ce6-b09f-11ea-bca7-bc764e2007e4;
 Wed, 17 Jun 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=dWu/bQJdE/f0zp2XWL+uKGpNFplehS3MdVq3Qn7zExM=; b=R/ftdoqlFRJ2t8nNIK1WyqBD4W
 v7nCuel2Ri77jjgPl15wT41ypssQLHnmqwoZ97NtTba+zyWh8d/CscuH5SpnuRVvUTYSA9JkYu5Nt
 k0+dQQEQAp+knCe1YdfMnssILBpahTzAxUTbXsvCMx9YRLrZsTXfzt2AlNwpTWSdxXkI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jlYCc-0003ks-2N
 for xen-changelog@lists.xenproject.org; Wed, 17 Jun 2020 13:34:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jlYCc-0001zi-1d
 for xen-changelog@lists.xenproject.org; Wed, 17 Jun 2020 13:34:06 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/hvm: Disable MPX by default
Message-Id: <E1jlYCc-0001zi-1d@xenbits.xenproject.org>
Date: Wed, 17 Jun 2020 13:34: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 54463aa79dac70a9d92f55650c7b8fe3e9fcc967
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Feb 24 17:15:56 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jun 17 13:54:12 2020 +0100

    x86/hvm: Disable MPX by default
    
    Memory Protection eXtension support has been dropped from GCC and Linux, and
    will be dropped from future Intel CPUs.
    
    With all other default/max pieces in place, move MPX from default to max.
    This means that VMs won't be offered it by default, but can explicitly opt
    into using it via cpuid="host,mpx=1" in their vm.cfg file.
    
    The difference as visible to the guest is:
    
      diff --git a/default b/mpx
      index 0e91765d6b..c8c33cd584 100644
      --- a/default
      +++ b/mpx
      @@ -13,15 +13,17 @@ Native cpuid:
         00000004:00000004 -> 00000000:00000000:00000000:00000000
         00000005:ffffffff -> 00000000:00000000:00000000:00000000
         00000006:ffffffff -> 00000000:00000000:00000000:00000000
      -  00000007:00000000 -> 00000000:009c2fbb:00000000:9c000400
      +  00000007:00000000 -> 00000000:009c6fbb:00000000:9c000400
         00000008:ffffffff -> 00000000:00000000:00000000:00000000
         00000009:ffffffff -> 00000000:00000000:00000000:00000000
         0000000a:ffffffff -> 00000000:00000000:00000000:00000000
         0000000b:ffffffff -> 00000000:00000000:00000000:00000000
         0000000c:ffffffff -> 00000000:00000000:00000000:00000000
      -  0000000d:00000000 -> 00000007:00000240:00000340:00000000
      +  0000000d:00000000 -> 0000001f:00000240:00000440:00000000
         0000000d:00000001 -> 0000000f:00000240:00000000:00000000
         0000000d:00000002 -> 00000100:00000240:00000000:00000000
      +  0000000d:00000003 -> 00000040:000003c0:00000000:00000000
      +  0000000d:00000004 -> 00000040:00000400:00000000:00000000
         40000000:ffffffff -> 40000005:566e6558:65584d4d:4d4d566e
         40000001:ffffffff -> 0004000e:00000000:00000000:00000000
         40000002:ffffffff -> 00000001:40000000:00000000:00000000
    
    Adjust the legacy restore path in libxc to cope safely with pre-4.14 VMs.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/libxc/xc_cpuid_x86.c                  | 48 ++++++++++++++++++-----------
 xen/include/public/arch-x86/cpufeatureset.h |  2 +-
 2 files changed, 31 insertions(+), 19 deletions(-)

diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c
index b6b5dc88a2..6e80fcd1d2 100644
--- a/tools/libxc/xc_cpuid_x86.c
+++ b/tools/libxc/xc_cpuid_x86.c
@@ -436,6 +436,8 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, bool restore,
     xen_cpuid_leaf_t *leaves = NULL;
     struct cpuid_policy *p = NULL;
     uint32_t err_leaf = -1, err_subleaf = -1, err_msr = -1;
+    uint32_t host_featureset[FEATURESET_NR_ENTRIES] = {};
+    uint32_t len = ARRAY_SIZE(host_featureset);
 
     if ( xc_domain_getinfo(xch, domid, 1, &di) != 1 ||
          di.domid != domid )
@@ -458,6 +460,22 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, bool restore,
          (p = calloc(1, sizeof(*p))) == NULL )
         goto out;
 
+    /* Get the host policy. */
+    rc = xc_get_cpu_featureset(xch, XEN_SYSCTL_cpu_featureset_host,
+                               &len, host_featureset);
+    if ( rc )
+    {
+        /* Tolerate "buffer too small", as we've got the bits we need. */
+        if ( errno == ENOBUFS )
+            rc = 0;
+        else
+        {
+            PERROR("Failed to obtain host featureset");
+            rc = -errno;
+            goto out;
+        }
+    }
+
     /* Get the domain's default policy. */
     nr_msrs = 0;
     rc = xc_get_system_cpu_policy(xch, di.hvm ? XEN_SYSCTL_cpu_policy_hvm_default
@@ -479,6 +497,18 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, bool restore,
         goto out;
     }
 
+    /*
+     * Account for feature which have been disabled by default since Xen 4.13,
+     * so migrated-in VM's don't risk seeing features disappearing.
+     */
+    if ( restore )
+    {
+        if ( di.hvm )
+        {
+            p->feat.mpx = test_bit(X86_FEATURE_MPX, host_featureset);
+        }
+    }
+
     if ( featureset )
     {
         uint32_t disabled_features[FEATURESET_NR_ENTRIES],
@@ -530,24 +560,6 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, bool restore,
 
     if ( !di.hvm )
     {
-        uint32_t host_featureset[FEATURESET_NR_ENTRIES] = {};
-        uint32_t len = ARRAY_SIZE(host_featureset);
-
-        rc = xc_get_cpu_featureset(xch, XEN_SYSCTL_cpu_featureset_host,
-                                   &len, host_featureset);
-        if ( rc )
-        {
-            /* Tolerate "buffer too small", as we've got the bits we need. */
-            if ( errno == ENOBUFS )
-                rc = 0;
-            else
-            {
-                PERROR("Failed to obtain host featureset");
-                rc = -errno;
-                goto out;
-            }
-        }
-
         /*
          * On hardware without CPUID Faulting, PV guests see real topology.
          * As a consequence, they also need to see the host htt/cmp fields.
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 5ca35d9d97..af1b8a96a6 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -207,7 +207,7 @@ XEN_CPUFEATURE(INVPCID,       5*32+10) /*H  Invalidate Process Context ID */
 XEN_CPUFEATURE(RTM,           5*32+11) /*A  Restricted Transactional Memory */
 XEN_CPUFEATURE(PQM,           5*32+12) /*   Platform QoS Monitoring */
 XEN_CPUFEATURE(NO_FPU_SEL,    5*32+13) /*!  FPU CS/DS stored as zero */
-XEN_CPUFEATURE(MPX,           5*32+14) /*S  Memory Protection Extensions */
+XEN_CPUFEATURE(MPX,           5*32+14) /*s  Memory Protection Extensions */
 XEN_CPUFEATURE(PQE,           5*32+15) /*   Platform QoS Enforcement */
 XEN_CPUFEATURE(AVX512F,       5*32+16) /*A  AVX-512 Foundation Instructions */
 XEN_CPUFEATURE(AVX512DQ,      5*32+17) /*A  AVX-512 Doubleword & Quadword Instrs */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jun 17 13:34:18 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 17 Jun 2020 13:34: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 1jlYCo-0005pS-Bq; Wed, 17 Jun 2020 13:34: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=rp6Z=76=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jlYCm-0005pH-TJ
 for xen-changelog@lists.xenproject.org; Wed, 17 Jun 2020 13:34:16 +0000
X-Inumbo-ID: 3d4c34ec-b09f-11ea-b9eb-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 3d4c34ec-b09f-11ea-b9eb-12813bfff9fa;
 Wed, 17 Jun 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=vy+Wla59Dt6DPQ0WZ5z3DF9FLjKcIdIVs4X40LDVLy4=; b=6DrNtG4vUzWr6ODPdy0fvJtwj7
 oZlqt/gRbuVnCPt0tdtl4okdT/0dcv5SQCICIOtwice5xsfj+v92a/q6maTKBX8STGj338LZ66732
 rPKvWMPKeZX234FaDkIR4s1jO9VjMrHdwrNBfADnyADCo/zqyB2sIivh01nW1jJRh0Ws=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jlYCm-0003kz-5U
 for xen-changelog@lists.xenproject.org; Wed, 17 Jun 2020 13:34:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jlYCm-00020Z-4d
 for xen-changelog@lists.xenproject.org; Wed, 17 Jun 2020 13:34:16 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/cpuid: Introduce missing feature adjustment in
 calculate_pv_def_policy()
Message-Id: <E1jlYCm-00020Z-4d@xenbits.xenproject.org>
Date: Wed, 17 Jun 2020 13:34: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 fde4acd5feb7961269a2e6edd918c7a46626cf6b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Jun 15 13:42:11 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jun 17 13:54:12 2020 +0100

    x86/cpuid: Introduce missing feature adjustment in calculate_pv_def_policy()
    
    This was an accidental asymmetry with the HVM side.
    
    No change in behaviour at this point.
    
    Fixes: 83b387382 ("x86/cpuid: Introduce and use default CPUID policies")
    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/cpuid.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index ee11087626..f2fc0aa895 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -402,6 +402,8 @@ static void __init calculate_pv_def_policy(void)
     for ( i = 0; i < ARRAY_SIZE(pv_featureset); ++i )
         pv_featureset[i] &= pv_def_featuremask[i];
 
+    guest_common_feature_adjustments(pv_featureset);
+
     sanitise_featureset(pv_featureset);
     cpuid_featureset_to_policy(pv_featureset, p);
     recalculate_xstate(p);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jun 17 13:34:28 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 17 Jun 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 1jlYCy-0005qh-DU; Wed, 17 Jun 2020 13:34: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=rp6Z=76=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jlYCx-0005qQ-41
 for xen-changelog@lists.xenproject.org; Wed, 17 Jun 2020 13:34:27 +0000
X-Inumbo-ID: 434d8ac6-b09f-11ea-b9eb-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 434d8ac6-b09f-11ea-b9eb-12813bfff9fa;
 Wed, 17 Jun 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=YLcZK7xDkZWolzCnYkcUSSZsDOfFWR+r7++YwVPPjuk=; b=yzwnzS2TDCF4rmQonf817mO4Je
 RMhSXQy3d25XtCY47u3uaaYEhxJm9ufhg6xT7CfDOC25umJAWzl+8AhO+RP5Iil5tEyJJNq1Qp5W+
 Nhbx2IT0gkk/P/DuZ2Cq7OSu+aspWTvoCpn6LXtbYywGCxMfT79Ghv0ygDhWmsmiD5VI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jlYCw-0003li-8i
 for xen-changelog@lists.xenproject.org; Wed, 17 Jun 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 1jlYCw-000225-7v
 for xen-changelog@lists.xenproject.org; Wed, 17 Jun 2020 13:34:26 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/spec-ctrl: Hide RDRAND by default on IvyBridge
 client
Message-Id: <E1jlYCw-000225-7v@xenbits.xenproject.org>
Date: Wed, 17 Jun 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 71ca0e0ad000e690899936327eb09709ab182ade
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jun 12 13:39:13 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jun 17 13:54:12 2020 +0100

    x86/spec-ctrl: Hide RDRAND by default on IvyBridge client
    
    To combat the absence of mitigating microcode, arrange to hide RDRAND by
    default on IvyBridge client hardware.
    
    Adjust the default feature derivation to hide RDRAND on IvyBridge client
    parts, unless `cpuid=rdrand` is explicitly provided.
    
    Adjust the restore path in xc_cpuid_apply_policy() to not hide RDRAND from VMs
    which migrated from pre-4.14.
    
    In all cases, individual guests can continue using RDRAND if explicitly
    enabled in their config files.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 docs/misc/xen-command-line.pandoc           | 20 +++++++++++++++-----
 tools/libxc/xc_cpuid_x86.c                  |  2 ++
 xen/arch/x86/cpuid.c                        | 21 +++++++++++++++++++++
 xen/include/public/arch-x86/cpufeatureset.h |  2 +-
 4 files changed, 39 insertions(+), 6 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index fde749c669..4ae9391fcd 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -512,11 +512,21 @@ The Speculation Control hardware features `srbds-ctrl`, `md-clear`, `ibrsb`,
 `stibp`, `ibpb`, `l1d-flush` and `ssbd` are used by default if available and
 applicable.  They can all be ignored.
 
-`rdrand` and `rdseed` can be ignored, as a mitigation to XSA-320 /
-CVE-2020-0543.  The RDRAND feature is disabled by default on certain AMD
-systems, due to possible malfunctions after ACPI S3 suspend/resume.  `rdrand`
-may be used in its positive form to override Xen's default behaviour on these
-systems, and make the feature fully usable.
+`rdrand` and `rdseed` have multiple interactions.
+
+*   For Special Register Buffer Data Sampling (SRBDS, XSA-320, CVE-2020-0543),
+    RDRAND and RDSEED can be ignored.
+
+    Due to the absence of microcode to address SRBDS on IvyBridge client
+    hardware, the RDRAND feature is hidden by default for guests, unless
+    `rdrand` is used in its positive form.  Irrespective of the setting here,
+    VMs can use RDRAND if explicitly enabled in guest config file, and VMs
+    already using RDRAND can migrate in.
+
+*   The RDRAND feature is disabled by default on AMD Fam15/16 systems, due to
+    possible malfunctions after ACPI S3 suspend/resume.  `rdrand` may be used
+    in its positive form to override Xen's default behaviour on these systems,
+    and make the feature fully usable.
 
 ### cpuid_mask_cpu
 > `= fam_0f_rev_[cdefg] | fam_10_rev_[bc] | fam_11_rev_b`
diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c
index 6e80fcd1d2..0f24d6dd08 100644
--- a/tools/libxc/xc_cpuid_x86.c
+++ b/tools/libxc/xc_cpuid_x86.c
@@ -503,6 +503,8 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, bool restore,
      */
     if ( restore )
     {
+        p->basic.rdrand = test_bit(X86_FEATURE_RDRAND, host_featureset);
+
         if ( di.hvm )
         {
             p->feat.mpx = test_bit(X86_FEATURE_MPX, host_featureset);
diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index f2fc0aa895..6a4a787b68 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -340,6 +340,25 @@ static void __init calculate_host_policy(void)
     }
 }
 
+static void __init guest_common_default_feature_adjustments(uint32_t *fs)
+{
+    /*
+     * IvyBridge client parts suffer from leakage of RDRAND data due to SRBDS
+     * (XSA-320 / CVE-2020-0543), and won't be receiving microcode to
+     * compensate.
+     *
+     * Mitigate by hiding RDRAND from guests by default, unless explicitly
+     * overridden on the Xen command line (cpuid=rdrand).  Irrespective of the
+     * default setting, guests can use RDRAND if explicitly enabled
+     * (cpuid="host,rdrand=1") in the VM's config file, and VMs which were
+     * previously using RDRAND can migrate in.
+     */
+    if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
+         boot_cpu_data.x86 == 6 && boot_cpu_data.x86_model == 0x3a &&
+         cpu_has_rdrand && !is_forced_cpu_cap(X86_FEATURE_RDRAND) )
+        __clear_bit(X86_FEATURE_RDRAND, fs);
+}
+
 static void __init guest_common_feature_adjustments(uint32_t *fs)
 {
     /* Unconditionally claim to be able to set the hypervisor bit. */
@@ -403,6 +422,7 @@ static void __init calculate_pv_def_policy(void)
         pv_featureset[i] &= pv_def_featuremask[i];
 
     guest_common_feature_adjustments(pv_featureset);
+    guest_common_default_feature_adjustments(pv_featureset);
 
     sanitise_featureset(pv_featureset);
     cpuid_featureset_to_policy(pv_featureset, p);
@@ -485,6 +505,7 @@ static void __init calculate_hvm_def_policy(void)
         hvm_featureset[i] &= hvm_featuremask[i];
 
     guest_common_feature_adjustments(hvm_featureset);
+    guest_common_default_feature_adjustments(hvm_featureset);
 
     sanitise_featureset(hvm_featureset);
     cpuid_featureset_to_policy(hvm_featureset, p);
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index af1b8a96a6..fe7492a225 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -149,7 +149,7 @@ XEN_CPUFEATURE(XSAVE,         1*32+26) /*A  XSAVE/XRSTOR/XSETBV/XGETBV */
 XEN_CPUFEATURE(OSXSAVE,       1*32+27) /*!  OSXSAVE */
 XEN_CPUFEATURE(AVX,           1*32+28) /*A  Advanced Vector Extensions */
 XEN_CPUFEATURE(F16C,          1*32+29) /*A  Half-precision convert instruction */
-XEN_CPUFEATURE(RDRAND,        1*32+30) /*A  Digital Random Number Generator */
+XEN_CPUFEATURE(RDRAND,        1*32+30) /*!A Digital Random Number Generator */
 XEN_CPUFEATURE(HYPERVISOR,    1*32+31) /*!A Running under some hypervisor */
 
 /* AMD-defined CPU features, CPUID level 0x80000001.edx, word 2 */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jun 18 15:55:10 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 18 Jun 2020 15: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 1jlwsc-00026r-LX; Thu, 18 Jun 2020 15: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=eF0o=77=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jlwsc-00026l-5p
 for xen-changelog@lists.xenproject.org; Thu, 18 Jun 2020 15:55:06 +0000
X-Inumbo-ID: 136f2a52-b17c-11ea-bab2-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 136f2a52-b17c-11ea-bab2-12813bfff9fa;
 Thu, 18 Jun 2020 15:55:05 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=whujJEuDrENsabbiSuK0f5xnGeD0yJPLAa3OaNf+5SY=; b=hhId9CRk77PnZ2LKiS/VjLm9ZL
 +j3t2XTyC+1M3fY0wZjtjLfw/D7DQAyNUmx39qp7O+vDr0dZGlGPu2mboeJpM+eqreRKQ7KkL8XWB
 nRnvpFdOpKk8ErBCLgCWxGthRXw/j4GDrdFMCpZd07TRjKPUevh3oM7GciZWSGqnU6GU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jlwsa-0003et-Nt
 for xen-changelog@lists.xenproject.org; Thu, 18 Jun 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 1jlwsa-0007if-Mn
 for xen-changelog@lists.xenproject.org; Thu, 18 Jun 2020 15:55:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] tools/xen-ucode: return correct exit code on failed
 microcode update
Message-Id: <E1jlwsa-0007if-Mn@xenbits.xenproject.org>
Date: Thu, 18 Jun 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 25636ed707cf1211ce846c7ec58f8643e435d7a7
Author:     Igor Druzhinin <igor.druzhinin@citrix.com>
AuthorDate: Wed Jun 17 03:19:13 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Thu Jun 18 16:45:14 2020 +0100

    tools/xen-ucode: return correct exit code on failed microcode update
    
    Otherwise it's difficult to know if operation failed inside the automation.
    
    While at it, also switch to returning 1 and 2 instead of errno to avoid
    incompatibilies between errno and special exit code numbers.
    
    Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    Release-acked-by: Paul Durrant <paul@xen.org>
    Reviewed-by: Igor Druzhinin <igor.druzhinin@citrix.com>
---
 tools/misc/xen-ucode.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/tools/misc/xen-ucode.c b/tools/misc/xen-ucode.c
index 0c257f4998..ad32face2b 100644
--- a/tools/misc/xen-ucode.c
+++ b/tools/misc/xen-ucode.c
@@ -25,7 +25,7 @@ int main(int argc, char *argv[])
         fprintf(stderr,
                 "xen-ucode: Xen microcode updating tool\n"
                 "Usage: %s <microcode blob>\n", argv[0]);
-        return 0;
+        exit(2);
     }
 
     filename = argv[1];
@@ -34,14 +34,14 @@ int main(int argc, char *argv[])
     {
         fprintf(stderr, "Could not open %s. (err: %s)\n",
                 filename, strerror(errno));
-        return errno;
+        exit(1);
     }
 
     if ( fstat(fd, &st) != 0 )
     {
         fprintf(stderr, "Could not get the size of %s. (err: %s)\n",
                 filename, strerror(errno));
-        return errno;
+        exit(1);
     }
 
     len = st.st_size;
@@ -49,7 +49,7 @@ int main(int argc, char *argv[])
     if ( buf == MAP_FAILED )
     {
         fprintf(stderr, "mmap failed. (error: %s)\n", strerror(errno));
-        return errno;
+        exit(1);
     }
 
     xch = xc_interface_open(NULL, NULL, 0);
@@ -57,20 +57,23 @@ int main(int argc, char *argv[])
     {
         fprintf(stderr, "Error opening xc interface. (err: %s)\n",
                 strerror(errno));
-        return errno;
+        exit(1);
     }
 
     ret = xc_microcode_update(xch, buf, len);
     if ( ret )
+    {
         fprintf(stderr, "Failed to update microcode. (err: %s)\n",
                 strerror(errno));
+        exit(1);
+    }
 
     xc_interface_close(xch);
 
     if ( munmap(buf, len) )
     {
         printf("Could not unmap: %d(%s)\n", errno, strerror(errno));
-        return errno;
+        exit(1);
     }
     close(fd);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jun 18 16:00:07 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 18 Jun 2020 16: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 1jlwxT-0003KN-Ib; Thu, 18 Jun 2020 16: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=eF0o=77=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jlwxS-0003Gh-FB
 for xen-changelog@lists.xenproject.org; Thu, 18 Jun 2020 16:00:06 +0000
X-Inumbo-ID: c4e48016-b17c-11ea-bab3-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id c4e48016-b17c-11ea-bab3-12813bfff9fa;
 Thu, 18 Jun 2020 16: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=y6gt/QvhlL9F7Nk4u3Mtwke1Rwc8EmyTDhUs5ZO4wRY=; b=NNPk7IF9ejf3XuBjRTJs9mIm2G
 cNDUp3iFsF6SRAsYh8kc5A5SfY9kZYLW0f0Hw7sZf7Um3KfZEyLOlAvU+p794P6QcQblaYz0J0oJ+
 ZVD0em1opxTSmnl7C9e/6T/cTsIy7UDJSUmVG24TZr9OsTD6eHnG+SJ23aXSLLDlback=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jlwxO-000423-FE
 for xen-changelog@lists.xenproject.org; Thu, 18 Jun 2020 16:00:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jlwxO-0007x8-EB
 for xen-changelog@lists.xenproject.org; Thu, 18 Jun 2020 16:00:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] tools: check go compiler version if present
Message-Id: <E1jlwxO-0007x8-EB@xenbits.xenproject.org>
Date: Thu, 18 Jun 2020 16: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 fec6a7af5c5760b9bccd9e7c3eaf29f0401af264
Author:     Nick Rosbrook <rosbrookn@gmail.com>
AuthorDate: Fri Jun 12 15:31:02 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Mon Jun 15 15:49:13 2020 +0100

    tools: check go compiler version if present
    
    Currently, no minimum go compiler version is required by the configure
    scripts. However, the go bindings actually will not build with some
    older versions of go. Add a check for a minimum go version of 1.11.1 in
    accordance with tools/golang/xenlight/go.mod.
    
    Signed-off-by: Nick Rosbrook <rosbrookn@ainfosec.com>
    Acked-by: George Dunlap <george.dunlap@citrix.com>
    Tested-by: Nick Rosbrook <rosbrookn@ainfosec.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 m4/golang.m4       |  4 ++++
 tools/configure    | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 tools/configure.ac |  7 +++++++
 3 files changed, 60 insertions(+)

diff --git a/m4/golang.m4 b/m4/golang.m4
index 0b4bd54ce0..9cfd7e00a5 100644
--- a/m4/golang.m4
+++ b/m4/golang.m4
@@ -1,4 +1,8 @@
 AC_DEFUN([AC_PROG_GO], [
     dnl Check for the go compiler
     AC_CHECK_TOOL([GO],[go],[no])
+
+    if test "$GO" != "no"; then
+        GOVERSION=`$GO version | cut -d " " -f 3 | sed "s/go//"`
+    fi
 ])
diff --git a/tools/configure b/tools/configure
index 3df1a01ff9..15ba28211a 100755
--- a/tools/configure
+++ b/tools/configure
@@ -6833,6 +6833,10 @@ else
 fi
 
 
+    if test "$GO" != "no"; then
+        GOVERSION=`$GO version | cut -d " " -f 3 | sed "s/go//"`
+    fi
+
     if test "x$GO" = "xno"; then :
 
         if test "x$enable_golang" =  "xyes"; then :
@@ -6842,6 +6846,51 @@ fi
 fi
         golang="n"
 
+else
+
+
+
+
+  # Used to indicate true or false condition
+  ax_compare_version=false
+
+  # Convert the two version strings to be compared into a format that
+  # allows a simple string comparison.  The end result is that a version
+  # string of the form 1.12.5-r617 will be converted to the form
+  # 0001001200050617.  In other words, each number is zero padded to four
+  # digits, and non digits are removed.
+
+  ax_compare_version_A=`echo "$GOVERSION" | sed -e 's/\([0-9]*\)/Z\1Z/g' \
+                     -e 's/Z\([0-9]\)Z/Z0\1Z/g' \
+                     -e 's/Z\([0-9][0-9]\)Z/Z0\1Z/g' \
+                     -e 's/Z\([0-9][0-9][0-9]\)Z/Z0\1Z/g' \
+                     -e 's/[^0-9]//g'`
+
+
+  ax_compare_version_B=`echo "1.11.1" | sed -e 's/\([0-9]*\)/Z\1Z/g' \
+                     -e 's/Z\([0-9]\)Z/Z0\1Z/g' \
+                     -e 's/Z\([0-9][0-9]\)Z/Z0\1Z/g' \
+                     -e 's/Z\([0-9][0-9][0-9]\)Z/Z0\1Z/g' \
+                     -e 's/[^0-9]//g'`
+
+
+    ax_compare_version=`echo "x$ax_compare_version_A
+x$ax_compare_version_B" | sed 's/^ *//' | sort -r | sed "s/x${ax_compare_version_A}/false/;s/x${ax_compare_version_B}/true/;1q"`
+
+
+
+    if test "$ax_compare_version" = "true" ; then
+
+            if test "x$enable_golang" = "xyes"; then :
+
+                as_fn_error $? "\"Your version of go: $GOVERSION is not supported\"" "$LINENO" 5
+
+fi
+            golang="n"
+
+      fi
+
+
 fi
 
 fi
diff --git a/tools/configure.ac b/tools/configure.ac
index a9af0a21c6..9d126b7a14 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -338,6 +338,13 @@ AS_IF([test "x$golang" = "xy"], [
             AC_MSG_ERROR([Go tools enabled, but missing go compiler])
         ])
         golang="n"
+    ], [
+        AX_COMPARE_VERSION([$GOVERSION], [lt], [1.11.1], [
+            AS_IF([test "x$enable_golang" = "xyes"], [
+                AC_MSG_ERROR(["Your version of go: $GOVERSION is not supported"])
+            ])
+            golang="n"
+        ])
     ])
 ])
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Jun 18 16:00:17 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 18 Jun 2020 16: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 1jlwxb-0003Xo-TV; Thu, 18 Jun 2020 16: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=eF0o=77=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jlwxa-0003RJ-5X
 for xen-changelog@lists.xenproject.org; Thu, 18 Jun 2020 16:00:14 +0000
X-Inumbo-ID: caeea3ba-b17c-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id caeea3ba-b17c-11ea-8496-bc764e2007e4;
 Thu, 18 Jun 2020 16: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=8ahHIonBLTluubC98fP/jKH71sAEcPI+OPzfnvaISqc=; b=1oxWBL8cTFPXi8hwBrz5znLJRT
 5wQ+nf8GNEgIP2IArDS0X+LgB2uadxXqDkCmSpZNc5HKC4uvYfgRQRP03FuANa6PA8x3Lidpmxfr1
 vZF28hVgNvSuIjjukxfow5kmy1oe+XQhWPSqDul0hVmJ75oI1A6G3ge+UH+yqujou/eM=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jlwxY-0004Jc-J4
 for xen-changelog@lists.xenproject.org; Thu, 18 Jun 2020 16:00:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jlwxY-0007yh-Hz
 for xen-changelog@lists.xenproject.org; Thu, 18 Jun 2020 16:00:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] golang/xenlight: sort cases in switch statement
Message-Id: <E1jlwxY-0007yh-Hz@xenbits.xenproject.org>
Date: Thu, 18 Jun 2020 16: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 1251402caf8685f45d9d580f01583370f7e2d272
Author:     Nick Rosbrook <rosbrookn@gmail.com>
AuthorDate: Mon Jun 15 11:39:42 2020 -0400
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Mon Jun 15 16:47:59 2020 +0100

    golang/xenlight: sort cases in switch statement
    
    The xenlight_golang_union_from_C function iterates over a dict to
    construct a switch statement that marshals a C keyed union into a Go
    type. Because python does not guarantee dict ordering across all
    versions, this can result in the switch statement being generated in a
    different order depending on the version of python used. For example,
    running gengotypes.py with python2.7 and python3.6 will yield different
    orderings.
    
    Iterate over sorted(cases.items()) rather than cases.items() to fix
    this.
    
    This patch changes the ordering from what was previously checked-in, but
    running gengotypes.py with different versions of python will now yield
    the same result.
    
    Signed-off-by: Nick Rosbrook <rosbrookn@ainfosec.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Acked-by: George Dunlap <george.dunlap@citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/golang/xenlight/gengotypes.py  |  2 +-
 tools/golang/xenlight/helpers.gen.go | 32 ++++++++++++++++----------------
 2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/tools/golang/xenlight/gengotypes.py b/tools/golang/xenlight/gengotypes.py
index ecca59745f..557fecd07b 100644
--- a/tools/golang/xenlight/gengotypes.py
+++ b/tools/golang/xenlight/gengotypes.py
@@ -379,7 +379,7 @@ def xenlight_golang_union_from_C(ty = None, union_name = '', struct_name = ''):
 
     # Create switch statement to determine which 'union element'
     # to populate in the Go struct.
-    for case_name, case_tuple in cases.items():
+    for case_name, case_tuple in sorted(cases.items()):
         (case_val, case_type) = case_tuple
 
         s += 'case {}:\n'.format(case_val)
diff --git a/tools/golang/xenlight/helpers.gen.go b/tools/golang/xenlight/helpers.gen.go
index 935d3bc50a..152c7e8e6b 100644
--- a/tools/golang/xenlight/helpers.gen.go
+++ b/tools/golang/xenlight/helpers.gen.go
@@ -431,8 +431,6 @@ x.Evtch = int(xc.evtch)
 x.Rref = int(xc.rref)
 x.Connection = ChannelConnection(xc.connection)
 switch x.Connection{
-case ChannelConnectionUnknown:
-x.ConnectionUnion = nil
 case ChannelConnectionPty:
 var connectionPty ChannelinfoConnectionUnionPty
 if err := connectionPty.fromC(xc);err != nil {
@@ -441,6 +439,8 @@ if err := connectionPty.fromC(xc);err != nil {
 x.ConnectionUnion = connectionPty
 case ChannelConnectionSocket:
 x.ConnectionUnion = nil
+case ChannelConnectionUnknown:
+x.ConnectionUnion = nil
 default:
 return fmt.Errorf("invalid union key '%v'", x.Connection)}
 
@@ -1098,6 +1098,8 @@ if err := typeHvm.fromC(xc);err != nil {
  return fmt.Errorf("converting field typeHvm: %v", err)
 }
 x.TypeUnion = typeHvm
+case DomainTypeInvalid:
+x.TypeUnion = nil
 case DomainTypePv:
 var typePv DomainBuildInfoTypeUnionPv
 if err := typePv.fromC(xc);err != nil {
@@ -1110,8 +1112,6 @@ if err := typePvh.fromC(xc);err != nil {
  return fmt.Errorf("converting field typePvh: %v", err)
 }
 x.TypeUnion = typePvh
-case DomainTypeInvalid:
-x.TypeUnion = nil
 default:
 return fmt.Errorf("invalid union key '%v'", x.Type)}
 x.ArchArm.GicVersion = GicVersion(xc.arch_arm.gic_version)
@@ -2360,8 +2360,6 @@ x.Devid = Devid(xc.devid)
 x.Name = C.GoString(xc.name)
 x.Connection = ChannelConnection(xc.connection)
 switch x.Connection{
-case ChannelConnectionUnknown:
-x.ConnectionUnion = nil
 case ChannelConnectionPty:
 x.ConnectionUnion = nil
 case ChannelConnectionSocket:
@@ -2370,6 +2368,8 @@ if err := connectionSocket.fromC(xc);err != nil {
  return fmt.Errorf("converting field connectionSocket: %v", err)
 }
 x.ConnectionUnion = connectionSocket
+case ChannelConnectionUnknown:
+x.ConnectionUnion = nil
 default:
 return fmt.Errorf("invalid union key '%v'", x.Connection)}
 
@@ -3933,28 +3933,28 @@ return fmt.Errorf("converting field Domuuid: %v", err)
 x.ForUser = uint64(xc.for_user)
 x.Type = EventType(xc._type)
 switch x.Type{
-case EventTypeDomainShutdown:
-var typeDomainShutdown EventTypeUnionDomainShutdown
-if err := typeDomainShutdown.fromC(xc);err != nil {
- return fmt.Errorf("converting field typeDomainShutdown: %v", err)
-}
-x.TypeUnion = typeDomainShutdown
-case EventTypeDomainDeath:
-x.TypeUnion = nil
 case EventTypeDiskEject:
 var typeDiskEject EventTypeUnionDiskEject
 if err := typeDiskEject.fromC(xc);err != nil {
  return fmt.Errorf("converting field typeDiskEject: %v", err)
 }
 x.TypeUnion = typeDiskEject
+case EventTypeDomainCreateConsoleAvailable:
+x.TypeUnion = nil
+case EventTypeDomainDeath:
+x.TypeUnion = nil
+case EventTypeDomainShutdown:
+var typeDomainShutdown EventTypeUnionDomainShutdown
+if err := typeDomainShutdown.fromC(xc);err != nil {
+ return fmt.Errorf("converting field typeDomainShutdown: %v", err)
+}
+x.TypeUnion = typeDomainShutdown
 case EventTypeOperationComplete:
 var typeOperationComplete EventTypeUnionOperationComplete
 if err := typeOperationComplete.fromC(xc);err != nil {
  return fmt.Errorf("converting field typeOperationComplete: %v", err)
 }
 x.TypeUnion = typeOperationComplete
-case EventTypeDomainCreateConsoleAvailable:
-x.TypeUnion = nil
 default:
 return fmt.Errorf("invalid union key '%v'", x.Type)}
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Jun 18 16:00:23 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 18 Jun 2020 16:00: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 1jlwxj-0003Zi-V7; Thu, 18 Jun 2020 16:00:23 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=eF0o=77=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jlwxj-0003ZU-GK
 for xen-changelog@lists.xenproject.org; Thu, 18 Jun 2020 16:00:23 +0000
X-Inumbo-ID: d0ef750a-b17c-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id d0ef750a-b17c-11ea-bca7-bc764e2007e4;
 Thu, 18 Jun 2020 16: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=Keo6UoFnpEGUYodY2ZonVYYDjJZgGccmY5i8wcU7TBQ=; b=hnsun526XVr2rsGE0XBnb+bV8A
 QEW6klZQ9xCHUerW4zfKPclmV6AVbGcdu6JHBfY2zUfD4y3gs3FQSZo6xcDJQvdop9CfoETH+rzUH
 5m6rtiEzviLhrUozko0T/92b8yTOYajQm3z/fIDpDIVzsdUUNnOjSRNLT2HzAZ4ncMFI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jlwxi-0004Js-Mi
 for xen-changelog@lists.xenproject.org; Thu, 18 Jun 2020 16:00:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jlwxi-0007zD-La
 for xen-changelog@lists.xenproject.org; Thu, 18 Jun 2020 16:00:22 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/mem_sharing: block interrupt injection for forks
Message-Id: <E1jlwxi-0007zD-La@xenbits.xenproject.org>
Date: Thu, 18 Jun 2020 16: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 3371ced37ced359167b5a71abee2062854371323
Author:     Tamas K Lengyel <tamas.lengyel@intel.com>
AuthorDate: Tue Jun 16 10:29:16 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jun 16 10:29:16 2020 +0200

    x86/mem_sharing: block interrupt injection for forks
    
    When running VM forks without device models (QEMU), it may
    be undesirable for Xen to inject interrupts. When creating such forks from
    Windows VMs we have observed the kernel trying to process interrupts
    immediately after the fork is executed. However without QEMU running such
    interrupt handling may not be possible because it may attempt to interact with
    devices that are not emulated by a backend. In the best case scenario such
    interrupt handling would only present a detour in the VM forks' execution
    flow, but in the worst case as we actually observed can completely stall it.
    By disabling interrupt injection a fuzzer can exercise the target code without
    interference. For other use-cases this option probably doesn't make sense,
    that's why this is not enabled by default.
    
    Forks & memory sharing are only available on Intel CPUs so this only applies
    to vmx. Note that this is part of the experimental VM forking feature that's
    completely disabled by default and can only be enabled by using
    XEN_CONFIG_EXPERT during compile time.
    
    Signed-off-by: Tamas K Lengyel <tamas.lengyel@intel.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Wei Liu <wl@xen.org>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/arch/x86/hvm/vmx/intr.c      | 6 ++++++
 xen/arch/x86/mm/mem_sharing.c    | 6 +++++-
 xen/include/asm-x86/hvm/domain.h | 2 +-
 xen/include/public/memory.h      | 3 +++
 4 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/intr.c b/xen/arch/x86/hvm/vmx/intr.c
index 000e14af49..80bfbb4787 100644
--- a/xen/arch/x86/hvm/vmx/intr.c
+++ b/xen/arch/x86/hvm/vmx/intr.c
@@ -256,6 +256,12 @@ void vmx_intr_assist(void)
     if ( unlikely(v->arch.vm_event) && v->arch.vm_event->sync_event )
         return;
 
+#ifdef CONFIG_MEM_SHARING
+    /* Block event injection for VM fork if requested */
+    if ( unlikely(v->domain->arch.hvm.mem_sharing.block_interrupts) )
+        return;
+#endif
+
     /* Crank the handle on interrupt state. */
     pt_vector = pt_update_irq(v);
 
diff --git a/xen/arch/x86/mm/mem_sharing.c b/xen/arch/x86/mm/mem_sharing.c
index 19922ab5d1..c428fd16ce 100644
--- a/xen/arch/x86/mm/mem_sharing.c
+++ b/xen/arch/x86/mm/mem_sharing.c
@@ -2106,7 +2106,8 @@ int mem_sharing_memop(XEN_GUEST_HANDLE_PARAM(xen_mem_sharing_op_t) arg)
         rc = -EINVAL;
         if ( mso.u.fork.pad )
             goto out;
-        if ( mso.u.fork.flags & ~XENMEM_FORK_WITH_IOMMU_ALLOWED )
+        if ( mso.u.fork.flags &
+             ~(XENMEM_FORK_WITH_IOMMU_ALLOWED | XENMEM_FORK_BLOCK_INTERRUPTS) )
             goto out;
 
         rc = rcu_lock_live_remote_domain_by_id(mso.u.fork.parent_domain,
@@ -2134,6 +2135,9 @@ int mem_sharing_memop(XEN_GUEST_HANDLE_PARAM(xen_mem_sharing_op_t) arg)
             rc = hypercall_create_continuation(__HYPERVISOR_memory_op,
                                                "lh", XENMEM_sharing_op,
                                                arg);
+        else if ( !rc && (mso.u.fork.flags & XENMEM_FORK_BLOCK_INTERRUPTS) )
+            d->arch.hvm.mem_sharing.block_interrupts = true;
+
         rcu_unlock_domain(pd);
         break;
     }
diff --git a/xen/include/asm-x86/hvm/domain.h b/xen/include/asm-x86/hvm/domain.h
index 95fe18cddc..9d247baf4d 100644
--- a/xen/include/asm-x86/hvm/domain.h
+++ b/xen/include/asm-x86/hvm/domain.h
@@ -67,7 +67,7 @@ struct hvm_ioreq_server {
 #ifdef CONFIG_MEM_SHARING
 struct mem_sharing_domain
 {
-    bool enabled;
+    bool enabled, block_interrupts;
 
     /*
      * When releasing shared gfn's in a preemptible manner, recall where
diff --git a/xen/include/public/memory.h b/xen/include/public/memory.h
index dbd35305df..850bd72c52 100644
--- a/xen/include/public/memory.h
+++ b/xen/include/public/memory.h
@@ -536,7 +536,10 @@ struct xen_mem_sharing_op {
         } debug;
         struct mem_sharing_op_fork {      /* OP_FORK */
             domid_t parent_domain;        /* IN: parent's domain id */
+/* Only makes sense for short-lived forks */
 #define XENMEM_FORK_WITH_IOMMU_ALLOWED (1u << 0)
+/* Only makes sense for short-lived forks */
+#define XENMEM_FORK_BLOCK_INTERRUPTS   (1u << 1)
             uint16_t flags;               /* IN: optional settings */
             uint32_t pad;                 /* Must be set to 0 */
         } fork;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Jun 18 16:00:34 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 18 Jun 2020 16: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 1jlwxu-0003cE-0M; Thu, 18 Jun 2020 16: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=eF0o=77=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jlwxt-0003c1-DI
 for xen-changelog@lists.xenproject.org; Thu, 18 Jun 2020 16:00:33 +0000
X-Inumbo-ID: d6fa893a-b17c-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id d6fa893a-b17c-11ea-bb8b-bc764e2007e4;
 Thu, 18 Jun 2020 16:00: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=AIiWcsU59MSW7+RE5XSeAfKFa7a2tFwDFh4Asco+e4w=; b=sivhpPhfNgXEie+dn6odo1abhl
 svTXGrJu+fhAx0EcUeigcnHNTfVYsKOW7ZrfnaU4MAElfhOMbufs+Sv7Pz4Q7Yy/y8T6dVvKFgH/q
 P9+4MwdEj/ePMuwkxb09uqoRseXUjfNyJx2JbHkkLbm+9C9CRa7UUYmfzdq8rB7SpAUo=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jlwxs-0004K1-Qc
 for xen-changelog@lists.xenproject.org; Thu, 18 Jun 2020 16:00:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jlwxs-0007zh-PF
 for xen-changelog@lists.xenproject.org; Thu, 18 Jun 2020 16:00:32 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] libxc: xc_memshr_fork with interrupts blocked
Message-Id: <E1jlwxs-0007zh-PF@xenbits.xenproject.org>
Date: Thu, 18 Jun 2020 16: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 05f488e418db0498dc2b7775874bd6957afd3a05
Author:     Tamas K Lengyel <tamas.lengyel@intel.com>
AuthorDate: Tue Jun 16 10:30:48 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jun 16 10:30:48 2020 +0200

    libxc: xc_memshr_fork with interrupts blocked
    
    Toolstack side for creating forks with interrupt injection blocked.
    
    Signed-off-by: Tamas K Lengyel <tamas.lengyel@intel.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Acked-by: Wei Liu <wl@xen.org>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/libxc/include/xenctrl.h | 3 ++-
 tools/libxc/xc_memshr.c       | 4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h
index 113ddd935d..7f15a61f29 100644
--- a/tools/libxc/include/xenctrl.h
+++ b/tools/libxc/include/xenctrl.h
@@ -2240,7 +2240,8 @@ int xc_memshr_range_share(xc_interface *xch,
 int xc_memshr_fork(xc_interface *xch,
                    uint32_t source_domain,
                    uint32_t client_domain,
-                   bool allow_with_iommu);
+                   bool allow_with_iommu,
+                   bool block_interrupts);
 
 /*
  * Note: this function is only intended to be used on short-lived forks that
diff --git a/tools/libxc/xc_memshr.c b/tools/libxc/xc_memshr.c
index 2300cc7075..a6cfd7dccf 100644
--- a/tools/libxc/xc_memshr.c
+++ b/tools/libxc/xc_memshr.c
@@ -240,7 +240,7 @@ int xc_memshr_debug_gref(xc_interface *xch,
 }
 
 int xc_memshr_fork(xc_interface *xch, uint32_t pdomid, uint32_t domid,
-                   bool allow_with_iommu)
+                   bool allow_with_iommu, bool block_interrupts)
 {
     xen_mem_sharing_op_t mso;
 
@@ -251,6 +251,8 @@ int xc_memshr_fork(xc_interface *xch, uint32_t pdomid, uint32_t domid,
 
     if ( allow_with_iommu )
         mso.u.fork.flags |= XENMEM_FORK_WITH_IOMMU_ALLOWED;
+    if ( block_interrupts )
+        mso.u.fork.flags |= XENMEM_FORK_BLOCK_INTERRUPTS;
 
     return xc_memshr_memop(xch, domid, &mso);
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Jun 18 16:00:44 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 18 Jun 2020 16: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 1jlwy4-0003fR-39; Thu, 18 Jun 2020 16: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=eF0o=77=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jlwy3-0003c1-FI
 for xen-changelog@lists.xenproject.org; Thu, 18 Jun 2020 16:00:43 +0000
X-Inumbo-ID: dd0070b0-b17c-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id dd0070b0-b17c-11ea-8496-bc764e2007e4;
 Thu, 18 Jun 2020 16: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=GQ90a5rkoyG/+nzbpHtcPEJUP68olqZs2RNgnNE3kvU=; b=YdKb8UgeupzpSqECp6D6hT1QLm
 lit4Ob0oU0CQprkhGZAB3eV37Xd3eXCD5ekYyMx9uh2L0uydVYPXPHzWLaC/BEjw01d4RIFzWEzld
 ccV6LTa8P32cOSgGEVhdlm9em8KVo58V76ZlvMbsUUBfxIu5m/imHk9Mc9INngUMFvZk=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jlwy2-0004L3-Uf
 for xen-changelog@lists.xenproject.org; Thu, 18 Jun 2020 16:00:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jlwy2-00080u-Sw
 for xen-changelog@lists.xenproject.org; Thu, 18 Jun 2020 16:00:42 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] libacpi: widen TPM detection
Message-Id: <E1jlwy2-00080u-Sw@xenbits.xenproject.org>
Date: Thu, 18 Jun 2020 16: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 d3db7e043cddd7e939195e014241ce2c5d436179
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Tue Jun 16 10:31:08 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jun 16 10:31:08 2020 +0200

    libacpi: widen TPM detection
    
    The hardcoded tpm_signature is too restrictive to detect many TPMs.  For
    instance, it doesn't accept a QEMU emulated TPM (VID 0x1014 DID 0x0001).
    Make the TPM detection match that in rombios which accepts a wider
    range.
    
    With this change, the TPM's TCPA ACPI table is generated and the guest
    OS can automatically load the tpm_tis driver.  It also allows seabios to
    detect and use the TPM.  However, seabios skips some TPM initialization
    when running under Xen, so it will not populate any PCRs unless modified
    to run the initialization under Xen.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/libacpi/build.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/tools/libacpi/build.c b/tools/libacpi/build.c
index fa7d14e090..a61dd5583a 100644
--- a/tools/libacpi/build.c
+++ b/tools/libacpi/build.c
@@ -351,7 +351,6 @@ static int construct_secondary_tables(struct acpi_ctxt *ctxt,
     struct acpi_20_waet *waet;
     struct acpi_20_tcpa *tcpa;
     unsigned char *ssdt;
-    static const uint16_t tis_signature[] = {0x0001, 0x0001, 0x0001};
     void *lasa;
 
     /* MADT. */
@@ -413,9 +412,8 @@ static int construct_secondary_tables(struct acpi_ctxt *ctxt,
 
     /* TPM TCPA and SSDT. */
     if ( (config->table_flags & ACPI_HAS_TCPA) &&
-         (config->tis_hdr[0] == tis_signature[0]) &&
-         (config->tis_hdr[1] == tis_signature[1]) &&
-         (config->tis_hdr[2] == tis_signature[2]) )
+         (config->tis_hdr[0] != 0 && config->tis_hdr[0] != 0xffff) &&
+         (config->tis_hdr[1] != 0 && config->tis_hdr[1] != 0xffff) )
     {
         ssdt = ctxt->mem_ops.alloc(ctxt, sizeof(ssdt_tpm), 16);
         if (!ssdt) return -1;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Jun 18 16:00:55 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 18 Jun 2020 16: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 1jlwyF-0003hN-4l; Thu, 18 Jun 2020 16: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=eF0o=77=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jlwyE-0003hA-B9
 for xen-changelog@lists.xenproject.org; Thu, 18 Jun 2020 16:00:54 +0000
X-Inumbo-ID: e30b6f1e-b17c-11ea-bab3-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id e30b6f1e-b17c-11ea-bab3-12813bfff9fa;
 Thu, 18 Jun 2020 16: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=1tc0x7qAE4xGseT1JUYptrXCLShhSnZk6I+vhPx1nq4=; b=UMxZPXvTueOesP6RkPNmc4cLiZ
 wH70EBV+dZpYt/iX03nO2K+CLeL6MAROIb/oM+dPjntyHHvBJursnkjYRrdvcMDop/tqcq6g4qpk2
 pN7fcekCycUc35igDEdNdqNL6EhjOWaAaJyvh57Ovty30XjraiEg6rNjecYylIrZKAT4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jlwyD-0004LE-2H
 for xen-changelog@lists.xenproject.org; Thu, 18 Jun 2020 16:00:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jlwyD-00081k-1F
 for xen-changelog@lists.xenproject.org; Thu, 18 Jun 2020 16:00:53 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/boot: use BASEDIR for include path
Message-Id: <E1jlwyD-00081k-1F@xenbits.xenproject.org>
Date: Thu, 18 Jun 2020 16:00: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 3625b04991b4d6affadd99d377ab84bac48dfff4
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Tue Jun 16 10:31:26 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jun 16 10:31:26 2020 +0200

    x86/boot: use BASEDIR for include path
    
    Use $(BASEDIR)/include instead of $(XEN_ROOT)/xen/include for the
    include path to be coherent with the rest of the Makefiles.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/arch/x86/boot/build32.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/boot/build32.mk b/xen/arch/x86/boot/build32.mk
index 5851ebff5f..8cd5403926 100644
--- a/xen/arch/x86/boot/build32.mk
+++ b/xen/arch/x86/boot/build32.mk
@@ -5,7 +5,7 @@ include $(XEN_ROOT)/Config.mk
 $(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
 
 CFLAGS += -Werror -fno-builtin -g0 -msoft-float
-CFLAGS += -I$(XEN_ROOT)/xen/include
+CFLAGS += -I$(BASEDIR)/include
 CFLAGS := $(filter-out -flto,$(CFLAGS)) 
 
 # NB. awk invocation is a portable alternative to 'head -n -1'
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Jun 18 16:01:08 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 18 Jun 2020 16:01: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 1jlwyS-0003jQ-6y; Thu, 18 Jun 2020 16:01: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=eF0o=77=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jlwyR-0003jF-Ji
 for xen-changelog@lists.xenproject.org; Thu, 18 Jun 2020 16:01:07 +0000
X-Inumbo-ID: eb46ce26-b17c-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id eb46ce26-b17c-11ea-8496-bc764e2007e4;
 Thu, 18 Jun 2020 16:01: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=NL55Kw6nTlTQ8V2OO5YQRwTTb9dIETHCSOfd/sxhggc=; b=tvtaGsEAKpOKI13b0pLGjwifNw
 R6jfl1fVWztDzW9Pr4X3SA5ceJlXC73WK5S8JGSdA8O2LIIwWQm5ND7LgFwQfmsiuqQ/B8ghg4M3L
 9g+vUUlwmi77q56+CfQxFWDnE6snEreWIKiAJ+azOrMJzbtDGlYVxmEZRTAWZPekX+ug=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jlwyQ-0004LZ-SH
 for xen-changelog@lists.xenproject.org; Thu, 18 Jun 2020 16:01:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jlwyQ-0008AG-RX
 for xen-changelog@lists.xenproject.org; Thu, 18 Jun 2020 16:01:06 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] xl: Allow shutdown wait for domain death
Message-Id: <E1jlwyQ-0008AG-RX@xenbits.xenproject.org>
Date: Thu, 18 Jun 2020 16:01: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 f0dca895a58710ecd49d813c96d382d5625b74c1
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Wed Jun 17 03:36:42 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Thu Jun 18 16:58:56 2020 +0100

    xl: Allow shutdown wait for domain death
    
    `xl shutdown -w` waits for the first of either domain shutdown or death.
    Shutdown is the halting of the guest operating system, and death is the
    freeing of domain resources.
    
    Allow specifying -w multiple times to wait for only domain death.  This
    is useful in scripts so that all resources are free before the script
    continues.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 docs/man/xl.1.pod.in    |  4 +++-
 tools/xl/xl_vmcontrol.c | 17 +++++++++++------
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/docs/man/xl.1.pod.in b/docs/man/xl.1.pod.in
index 09339282e6..52a47a6fbd 100644
--- a/docs/man/xl.1.pod.in
+++ b/docs/man/xl.1.pod.in
@@ -743,7 +743,9 @@ of a Xen system.
 
 =item B<-w>, B<--wait>
 
-Wait for the domain to complete shutdown before returning.
+Wait for the domain to complete shutdown before returning.  If given once,
+the wait is for domain shutdown or domain death.  If given multiple times,
+the wait is for domain death only.
 
 =item B<-F>
 
diff --git a/tools/xl/xl_vmcontrol.c b/tools/xl/xl_vmcontrol.c
index 17b4514c94..435155a033 100644
--- a/tools/xl/xl_vmcontrol.c
+++ b/tools/xl/xl_vmcontrol.c
@@ -162,7 +162,8 @@ static void shutdown_domain(uint32_t domid,
     }
 }
 
-static void wait_for_domain_deaths(libxl_evgen_domain_death **deathws, int nr)
+static void wait_for_domain_deaths(libxl_evgen_domain_death **deathws, int nr,
+                                   int wait_for_shutdown_or_death)
 {
     int rc, count = 0;
     LOG("Waiting for %d domains", nr);
@@ -183,8 +184,12 @@ static void wait_for_domain_deaths(libxl_evgen_domain_death **deathws, int nr)
         case LIBXL_EVENT_TYPE_DOMAIN_SHUTDOWN:
             LOG("Domain %d has been shut down, reason code %d",
                 event->domid, event->u.domain_shutdown.shutdown_reason);
-            libxl_evdisable_domain_death(ctx, deathws[event->for_user]);
-            count++;
+            if (wait_for_shutdown_or_death) {
+                libxl_evdisable_domain_death(ctx, deathws[event->for_user]);
+                count++;
+            } else {
+                LOG("Domain %d continue waiting for death", event->domid);
+            }
             break;
         default:
             LOG("Unexpected event type %d", event->type);
@@ -214,7 +219,7 @@ static int main_shutdown_or_reboot(int do_reboot, int argc, char **argv)
         all = 1;
         break;
     case 'w':
-        wait_for_it = 1;
+        wait_for_it++;
         break;
     case 'F':
         fallback_trigger = 1;
@@ -246,7 +251,7 @@ static int main_shutdown_or_reboot(int do_reboot, int argc, char **argv)
         }
 
         if (deathws) {
-            wait_for_domain_deaths(deathws, nrdeathws);
+            wait_for_domain_deaths(deathws, nrdeathws, wait_for_it == 1);
             free(deathws);
         }
 
@@ -258,7 +263,7 @@ static int main_shutdown_or_reboot(int do_reboot, int argc, char **argv)
         fn(domid, wait_for_it ? &deathw : NULL, 0, fallback_trigger);
 
         if (wait_for_it)
-            wait_for_domain_deaths(&deathw, 1);
+            wait_for_domain_deaths(&deathw, 1, wait_for_it == 1);
     }
 
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jun 18 16:11:13 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 18 Jun 2020 16:11:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jlx8A-00053E-Cj; Thu, 18 Jun 2020 16:11:10 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=eF0o=77=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jlx89-000539-7g
 for xen-changelog@lists.xenproject.org; Thu, 18 Jun 2020 16:11:09 +0000
X-Inumbo-ID: 515ebefc-b17e-11ea-bab8-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 515ebefc-b17e-11ea-bab8-12813bfff9fa;
 Thu, 18 Jun 2020 16:11: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=6sHliRddg3oXdiKDBnHtc1yVf1xMHVB2NrL+AJ7TTlU=; b=tn2kG0HpDhh4C5m61uPBO5PIQu
 Ns0qpSNw43UaQ3PMUIrW8Fv31X+J87zFHvR9U2iDGxQ0GMkksb/kcMl70PHuboOU4wSdFLiRHMKsg
 LjYqJXjpwOtblw5Y74gTF9F/FFR153X+ztdsCYmUobMprQu0iBBU/FDBlsBy/0/jb8P4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jlx87-0004YH-KB
 for xen-changelog@lists.xenproject.org; Thu, 18 Jun 2020 16:11:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jlx87-0000Pm-IK
 for xen-changelog@lists.xenproject.org; Thu, 18 Jun 2020 16:11:07 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] stubdom/vtpm: add extern to function declarations
Message-Id: <E1jlx87-0000Pm-IK@xenbits.xenproject.org>
Date: Thu, 18 Jun 2020 16:11: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 f1d376a825f4878eab0ef9cabe50ec4299968629
Author:     Olaf Hering <olaf@aepfle.de>
AuthorDate: Wed Jun 17 07:08:41 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Thu Jun 18 17:04:51 2020 +0100

    stubdom/vtpm: add extern to function declarations
    
    Code compiled with gcc10 will not link properly due to multiple definition of the same function.
    
    Signed-off-by: Olaf Hering <olaf@aepfle.de>
    Reviewed-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: Samuel Thibault <samuel.thibaut@ens-lyon.org>
    Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 stubdom/Makefile          |  1 +
 stubdom/vtpm_extern.patch | 48 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+)

diff --git a/stubdom/Makefile b/stubdom/Makefile
index 12aa211ac3..af8cde41b9 100644
--- a/stubdom/Makefile
+++ b/stubdom/Makefile
@@ -231,6 +231,7 @@ tpm_emulator-$(XEN_TARGET_ARCH): tpm_emulator-$(TPMEMU_VERSION).tar.gz
 	patch -d $@ -p1 < vtpm-cmake-Wextra.patch
 	patch -d $@ -p1 < vtpm-implicit-fallthrough.patch
 	patch -d $@ -p1 < vtpm_TPM_ChangeAuthAsymFinish.patch
+	patch -d $@ -p1 < vtpm_extern.patch
 	mkdir $@/build
 	cd $@/build; CC=${CC} $(CMAKE) .. -DCMAKE_C_FLAGS:STRING="-std=c99 -DTPM_NO_EXTERN $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -Wno-declaration-after-statement"
 	touch $@
diff --git a/stubdom/vtpm_extern.patch b/stubdom/vtpm_extern.patch
new file mode 100644
index 0000000000..5ea4023e6d
--- /dev/null
+++ b/stubdom/vtpm_extern.patch
@@ -0,0 +1,48 @@
+ld: /home/abuild/rpmbuild/BUILD/xen-4.8.20191211T160002.8db85532cb/non-dbg/stubdom/vtpm/vtpm.a(vtpm_cmd.o):(.bss+0x28): multiple definition of `tpm_malloc'; /home/abuild/rpmbuild/BUILD/xen-4.8.20191211T160002.8db85532cb/non-dbg/stubdom/vtpm/vtpm.a(vtpm.o):(.bss+0x728): first defined here
+--- a/tpm/tpm_emulator_extern.h
++++ b/tpm/tpm_emulator_extern.h
+@@ -29,7 +29,7 @@ enum {
+   TPM_LOG_ERROR
+ };
+ 
+-void (*tpm_log)(int priority, const char *fmt, ...);
++extern void (*tpm_log)(int priority, const char *fmt, ...);
+ 
+ #if defined(_WIN32) || defined(_WIN64)
+ #define __BFILE__ ((strrchr(__FILE__, '\\') ? : __FILE__ - 1) + 1)
+@@ -44,27 +44,27 @@ void (*tpm_log)(int priority, const char
+ #define error(fmt, ...) tpm_log(TPM_LOG_ERROR, "%s:%d: Error: " fmt "\n", \
+                                 __BFILE__, __LINE__, ## __VA_ARGS__)
+ /* initialization */
+-int (*tpm_extern_init)(void);
+-void (*tpm_extern_release)(void);
++extern int (*tpm_extern_init)(void);
++extern void (*tpm_extern_release)(void);
+ 
+ /* memory allocation */
+ 
+-void* (*tpm_malloc)(size_t size);
++extern void* (*tpm_malloc)(size_t size);
+ 
+-void (*tpm_free)(/*const*/ void *ptr);
++extern void (*tpm_free)(/*const*/ void *ptr);
+ 
+ /* random numbers */
+ 
+-void (*tpm_get_extern_random_bytes)(void *buf, size_t nbytes);
++extern void (*tpm_get_extern_random_bytes)(void *buf, size_t nbytes);
+ 
+ /* usec since last call */
+ 
+-uint64_t (*tpm_get_ticks)(void);
++extern uint64_t (*tpm_get_ticks)(void);
+ 
+ /* file handling */
+ 
+-int (*tpm_write_to_storage)(uint8_t *data, size_t data_length);
+-int (*tpm_read_from_storage)(uint8_t **data, size_t *data_length);
++extern int (*tpm_write_to_storage)(uint8_t *data, size_t data_length);
++extern int (*tpm_read_from_storage)(uint8_t **data, size_t *data_length);
+ 
+ #endif /* _TPM_EMULATOR_EXTERN_H_ */
+ 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jun 19 13:33:11 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Jun 2020 13:33: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 1jmH8k-0001sU-Rr; Fri, 19 Jun 2020 13: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=ckxn=AA=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jmH8j-0001rd-Fd
 for xen-changelog@lists.xenproject.org; Fri, 19 Jun 2020 13:33:05 +0000
X-Inumbo-ID: 67a401a0-b231-11ea-bb81-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 67a401a0-b231-11ea-bb81-12813bfff9fa;
 Fri, 19 Jun 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=upxJ3BfcTLrP7GQpnN2zJPsdjSL8hT/H+mmR3J6ZEf0=; b=SZ+rNYhth2EcKjekD5neieMhAx
 +4XmuzV5yced9+IU2NFWwXJSP+OY7gDSUfqnCKEach2NjxHCDgGvPntOERmJ/iUZFnfDJW7Tni2Ug
 n8uaJnZuyqerjbBV/yaaXhfkb8HdtDwEkyONQqHGDpd8VpOSXnAOOc53cNEHN5RMaXIg=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jmH8i-0007sF-Uo
 for xen-changelog@lists.xenproject.org; Fri, 19 Jun 2020 13:33:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jmH8i-0003aB-Tu
 for xen-changelog@lists.xenproject.org; Fri, 19 Jun 2020 13:33:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/hvm: check against VIOAPIC_LEVEL_TRIG in
 hvm_gsi_deassert
Message-Id: <E1jmH8i-0003aB-Tu@xenbits.xenproject.org>
Date: Fri, 19 Jun 2020 13: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 81ebf6e707ec0f49e257b136ce0421cbba4f4819
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Fri Jun 19 15:23:50 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jun 19 15:23:50 2020 +0200

    x86/hvm: check against VIOAPIC_LEVEL_TRIG in hvm_gsi_deassert
    
    In order to avoid relying on the specific values of
    VIOAPIC_{LEVEL/EDGE}_TRIG.
    
    No functional change.
    
    Requested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/arch/x86/hvm/irq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/irq.c b/xen/arch/x86/hvm/irq.c
index fd02cf2e8d..38ac5fb6c7 100644
--- a/xen/arch/x86/hvm/irq.c
+++ b/xen/arch/x86/hvm/irq.c
@@ -201,7 +201,7 @@ void hvm_gsi_deassert(struct domain *d, unsigned int gsi)
     int trig = vioapic_get_trigger_mode(d, gsi);
     struct hvm_irq *hvm_irq = hvm_domain_irq(d);
 
-    if ( trig <= VIOAPIC_EDGE_TRIG || gsi >= hvm_irq->nr_gsis )
+    if ( trig != VIOAPIC_LEVEL_TRIG || gsi >= hvm_irq->nr_gsis )
     {
         ASSERT(trig == VIOAPIC_EDGE_TRIG && gsi < hvm_irq->nr_gsis);
         return;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jun 19 13:33:16 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Jun 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 1jmH8u-0001tp-TZ; Fri, 19 Jun 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=ckxn=AA=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jmH8u-0001tj-1z
 for xen-changelog@lists.xenproject.org; Fri, 19 Jun 2020 13:33:16 +0000
X-Inumbo-ID: 6daa79a8-b231-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 6daa79a8-b231-11ea-b7bb-bc764e2007e4;
 Fri, 19 Jun 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=ONnFkKElg+/DB5g6NS1KpYEhRC5v3lXP/M09+LSFtn4=; b=XJ04rqhu+Ps1l0HVt/nMUsa/oC
 Tw8P8knmxsZ2h2d6IWx9XAphq/aMcF5RcOvYEenTzXrd7fxRP0Zpm0xMzAYTHMkgUA2Qnx19jEese
 1XLBK4QOzUfCn/p7KXBUO7sFbsdltMgr/mSrtVN83dEMXqti5Hv5/zjmePytgtivCvyI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jmH8t-0007sL-2D
 for xen-changelog@lists.xenproject.org; Fri, 19 Jun 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 1jmH8t-0003ah-13
 for xen-changelog@lists.xenproject.org; Fri, 19 Jun 2020 13:33:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/vmx: use P2M_ALLOC in vmx_load_pdptrs instead of
 P2M_UNSHARE
Message-Id: <E1jmH8t-0003ah-13@xenbits.xenproject.org>
Date: Fri, 19 Jun 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 b67e859d0823f5b450e29379af9142d44a3ea370
Author:     Tamas K Lengyel <tamas.lengyel@intel.com>
AuthorDate: Fri Jun 19 15:24:55 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jun 19 15:24:55 2020 +0200

    x86/vmx: use P2M_ALLOC in vmx_load_pdptrs instead of P2M_UNSHARE
    
    While forking VMs running a small RTOS system (Zephyr) a Xen crash has been
    observed due to a mm-lock order violation while copying the HVM CPU context
    from the parent. This issue has been identified to be due to
    hap_update_paging_modes first getting a lock on the gfn using get_gfn. This
    call also creates a shared entry in the fork's memory map for the cr3 gfn. The
    function later calls hap_update_cr3 while holding the paging_lock, which
    results in the lock-order violation in vmx_load_pdptrs when it tries to unshare
    the above entry when it grabs the page with the P2M_UNSHARE flag set.
    
    Since vmx_load_pdptrs only reads from the page its usage of P2M_UNSHARE was
    unnecessary to start with. Using P2M_ALLOC is the appropriate flag to ensure
    the p2m is properly populated.
    
    Note that the lock order violation is avoided because before the paging_lock is
    taken a lookup is performed with P2M_ALLOC that forks the page, thus the second
    lookup in vmx_load_pdptrs succeeds without having to perform the fork. We keep
    P2M_ALLOC in vmx_load_pdptrs because there are code-paths leading up to it
    which don't take the paging_lock and that have no previous lookup. Currently no
    other code-path exists leading there with the paging_lock taken, thus no
    further adjustments are necessary.
    
    Signed-off-by: Tamas K Lengyel <tamas.lengyel@intel.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/arch/x86/hvm/vmx/vmx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index ab19d9424e..cc6d4ece22 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -1325,7 +1325,7 @@ static void vmx_load_pdptrs(struct vcpu *v)
     if ( (cr3 & 0x1fUL) && !hvm_pcid_enabled(v) )
         goto crash;
 
-    page = get_page_from_gfn(v->domain, cr3 >> PAGE_SHIFT, &p2mt, P2M_UNSHARE);
+    page = get_page_from_gfn(v->domain, cr3 >> PAGE_SHIFT, &p2mt, P2M_ALLOC);
     if ( !page )
     {
         /* Ideally you don't want to crash but rather go into a wait 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jun 19 15:22:11 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Jun 2020 15: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 1jmIqG-00030u-0y; Fri, 19 Jun 2020 15: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=ckxn=AA=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jmIqE-00030n-KD
 for xen-changelog@lists.xenproject.org; Fri, 19 Jun 2020 15:22:06 +0000
X-Inumbo-ID: a1f9de7e-b240-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id a1f9de7e-b240-11ea-bb8b-bc764e2007e4;
 Fri, 19 Jun 2020 15: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=5GcaYc6p6vzeucK8uEjlAyApMFH7V3a94SHXuXaaBUU=; b=STWLBcfnPG4EP6ibJVhi36GCEE
 Hez0K+pdgZHTUVYA36bUTDSE1HEpKtXTvsFJ8UIiZghlmVu2fFq74DwTNPn6Q0JUHM7nKYU6N51WX
 bNeO5Ya9uDmF0ar/GY28IPyL/QEqc4IkpX1Ekwa4MiB8+Q4wMAM5MNHPr+jUfvZliViQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jmIqD-0001WJ-7r
 for xen-changelog@lists.xenproject.org; Fri, 19 Jun 2020 15:22:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jmIqD-0001Av-6m
 for xen-changelog@lists.xenproject.org; Fri, 19 Jun 2020 15:22:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] tools: Commit autoconf output from Debian buster
Message-Id: <E1jmIqD-0001Av-6m@xenbits.xenproject.org>
Date: Fri, 19 Jun 2020 15: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 4f4f6a67ac251fab13d03baab0d16bf7427ffd91
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Fri Jun 12 15:31:06 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Fri Jun 19 16:19:59 2020 +0100

    tools: Commit autoconf output from Debian buster
    
    These files are in tree so that people can build (including from git)
    without needing recent autotools.
    
    We should update them periodically.  Debian buster has been Debian
    stable fopr a while.  Our CI is running buster.
    
    There should be no significant functional change; it's possible that
    there are bugfixes to the configure scripts but I have not reviewed
    them.
    
    These files were last changed in
      83c845033dc8bb3a35ae245effb7832b6823174a
      libxl: use vchan for QMP access with Linux stubdomain
    where a new feature was added.  However, that commit contains a lot of
    extraneous noise in configure compared to its parent.
    
    Compared to 83c845033dc8bb3a35ae245effb7832b6823174a~, this commit
    restores those extraneous changes, leaving precisely the correct
    changes.  So one way of looking at the changes we are making now, is
    that we are undoing accidental changes to the autoconf output.
    
    I used Debian's autoconf 2.69-11 on amd64.
    
    CC: Wei Liu <wl@xen.org>
    CC: Nick Rosbrook <rosbrookn@gmail.com>
    Reported-by: Nick Rosbrook <rosbrookn@gmail.com>
    CC: Paul Durrant <paul@xen.org>
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 configure         | 14 +++++++++++++-
 docs/configure    | 14 +++++++++++++-
 stubdom/configure | 14 +++++++++++++-
 tools/configure   | 24 ++++++++++++++++++------
 4 files changed, 57 insertions(+), 9 deletions(-)

diff --git a/configure b/configure
index 8af54e8a5a..9da3970cef 100755
--- a/configure
+++ b/configure
@@ -644,6 +644,7 @@ infodir
 docdir
 oldincludedir
 includedir
+runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -722,6 +723,7 @@ datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -974,6 +976,15 @@ do
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
+  -runstatedir | --runstatedir | --runstatedi | --runstated \
+  | --runstate | --runstat | --runsta | --runst | --runs \
+  | --run | --ru | --r)
+    ac_prev=runstatedir ;;
+  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+  | --run=* | --ru=* | --r=*)
+    runstatedir=$ac_optarg ;;
+
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1111,7 +1122,7 @@ fi
 for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
 		datadir sysconfdir sharedstatedir localstatedir includedir \
 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir
+		libdir localedir mandir runstatedir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1264,6 +1275,7 @@ Fine tuning of the installation directories:
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
diff --git a/docs/configure b/docs/configure
index 93e9dcf404..9e3ed60462 100755
--- a/docs/configure
+++ b/docs/configure
@@ -634,6 +634,7 @@ infodir
 docdir
 oldincludedir
 includedir
+runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -710,6 +711,7 @@ datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -962,6 +964,15 @@ do
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
+  -runstatedir | --runstatedir | --runstatedi | --runstated \
+  | --runstate | --runstat | --runsta | --runst | --runs \
+  | --run | --ru | --r)
+    ac_prev=runstatedir ;;
+  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+  | --run=* | --ru=* | --r=*)
+    runstatedir=$ac_optarg ;;
+
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1099,7 +1110,7 @@ fi
 for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
 		datadir sysconfdir sharedstatedir localstatedir includedir \
 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir
+		libdir localedir mandir runstatedir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1252,6 +1263,7 @@ Fine tuning of the installation directories:
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
diff --git a/stubdom/configure b/stubdom/configure
index f7604a37f7..da03da535a 100755
--- a/stubdom/configure
+++ b/stubdom/configure
@@ -661,6 +661,7 @@ infodir
 docdir
 oldincludedir
 includedir
+runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -750,6 +751,7 @@ datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1002,6 +1004,15 @@ do
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
+  -runstatedir | --runstatedir | --runstatedi | --runstated \
+  | --runstate | --runstat | --runsta | --runst | --runs \
+  | --run | --ru | --r)
+    ac_prev=runstatedir ;;
+  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+  | --run=* | --ru=* | --r=*)
+    runstatedir=$ac_optarg ;;
+
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1139,7 +1150,7 @@ fi
 for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
 		datadir sysconfdir sharedstatedir localstatedir includedir \
 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir
+		libdir localedir mandir runstatedir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1292,6 +1303,7 @@ Fine tuning of the installation directories:
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
diff --git a/tools/configure b/tools/configure
index 15ba28211a..f3f19c1a90 100755
--- a/tools/configure
+++ b/tools/configure
@@ -772,6 +772,7 @@ infodir
 docdir
 oldincludedir
 includedir
+runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -899,6 +900,7 @@ datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1151,6 +1153,15 @@ do
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
+  -runstatedir | --runstatedir | --runstatedi | --runstated \
+  | --runstate | --runstat | --runsta | --runst | --runs \
+  | --run | --ru | --r)
+    ac_prev=runstatedir ;;
+  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+  | --run=* | --ru=* | --r=*)
+    runstatedir=$ac_optarg ;;
+
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1288,7 +1299,7 @@ fi
 for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
 		datadir sysconfdir sharedstatedir localstatedir includedir \
 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir
+		libdir localedir mandir runstatedir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1441,6 +1452,7 @@ Fine tuning of the installation directories:
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
@@ -3374,7 +3386,7 @@ else
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
 		       && LARGE_OFF_T % 2147483647 == 1)
 		      ? 1 : -1];
@@ -3420,7 +3432,7 @@ else
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
 		       && LARGE_OFF_T % 2147483647 == 1)
 		      ? 1 : -1];
@@ -3444,7 +3456,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
 		       && LARGE_OFF_T % 2147483647 == 1)
 		      ? 1 : -1];
@@ -3489,7 +3501,7 @@ else
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
 		       && LARGE_OFF_T % 2147483647 == 1)
 		      ? 1 : -1];
@@ -3513,7 +3525,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
 		       && LARGE_OFF_T % 2147483647 == 1)
 		      ? 1 : -1];
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jun 19 15:22:22 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Jun 2020 15:22:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jmIqU-00032q-2t; Fri, 19 Jun 2020 15:22:22 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=ckxn=AA=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jmIqT-00032Y-0C
 for xen-changelog@lists.xenproject.org; Fri, 19 Jun 2020 15:22:21 +0000
X-Inumbo-ID: a80278b2-b240-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id a80278b2-b240-11ea-b7bb-bc764e2007e4;
 Fri, 19 Jun 2020 15: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=WtlFyuzlzD9h2WuWJkGuRxXIJA9AKqMaG2RaJzzopdg=; b=TSy2fDVhHOKc46gfjQ/D6gMWfV
 ZzL38dBGCsgEW6I2XRDCRItLFyleDMpSef2QBvycfz9X0W2vkCe6kohb62gJe3LD7S6uiPLPwveQv
 LZbaISQWbAWJHFpcK9gpyCm1wDmn50ooJLB8YGrwMs93My7LXcRG2+yh4Gw/eOqZuIfQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jmIqN-0001WR-CP
 for xen-changelog@lists.xenproject.org; Fri, 19 Jun 2020 15:22:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jmIqN-0001BQ-Ac
 for xen-changelog@lists.xenproject.org; Fri, 19 Jun 2020 15:22:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] tools: Commit flex (2.6.4) & bison (3.3.2) output from
 Debian buster
Message-Id: <E1jmIqN-0001BQ-Ac@xenbits.xenproject.org>
Date: Fri, 19 Jun 2020 15: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 fde76f895d0aa817a1207d844d793239c6639bc6
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Fri Jun 12 16:03:25 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Fri Jun 19 16:20:11 2020 +0100

    tools: Commit flex (2.6.4) & bison (3.3.2) output from Debian buster
    
    These files are in tree so that people can build (including from git)
    without needing less-than-a-decade-old flex and bison.
    
    We should update them periodically.  Debian buster has been Debian
    stable for a while.  Our CI is running buster.
    
    There should be no significant functional change; it's possible that
    there are bugfixes but I have not reviewed the changes.  I *have*
    checked that the flex I am using has the fix for CVE-2016-6354.
    
    CC: Paul Durrant <paul@xen.org>
    CC: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/libxl/libxlu_cfg_l.c | 676 ++++++++++++++++++++++++++++++---------------
 tools/libxl/libxlu_cfg_l.h | 471 ++++++++++++++++++++++++++++---
 tools/libxl/libxlu_cfg_y.c | 285 +++++++++----------
 tools/libxl/libxlu_cfg_y.h |  12 +-
 4 files changed, 1033 insertions(+), 411 deletions(-)

diff --git a/tools/libxl/libxlu_cfg_l.c b/tools/libxl/libxlu_cfg_l.c
index b82df00b4e..406b50a037 100644
--- a/tools/libxl/libxlu_cfg_l.c
+++ b/tools/libxl/libxlu_cfg_l.c
@@ -9,11 +9,245 @@
 #define FLEX_SCANNER
 #define YY_FLEX_MAJOR_VERSION 2
 #define YY_FLEX_MINOR_VERSION 6
-#define YY_FLEX_SUBMINOR_VERSION 1
+#define YY_FLEX_SUBMINOR_VERSION 4
 #if YY_FLEX_SUBMINOR_VERSION > 0
 #define FLEX_BETA
 #endif
 
+#ifdef yy_create_buffer
+#define xlu__cfg_yy_create_buffer_ALREADY_DEFINED
+#else
+#define yy_create_buffer xlu__cfg_yy_create_buffer
+#endif
+
+#ifdef yy_delete_buffer
+#define xlu__cfg_yy_delete_buffer_ALREADY_DEFINED
+#else
+#define yy_delete_buffer xlu__cfg_yy_delete_buffer
+#endif
+
+#ifdef yy_scan_buffer
+#define xlu__cfg_yy_scan_buffer_ALREADY_DEFINED
+#else
+#define yy_scan_buffer xlu__cfg_yy_scan_buffer
+#endif
+
+#ifdef yy_scan_string
+#define xlu__cfg_yy_scan_string_ALREADY_DEFINED
+#else
+#define yy_scan_string xlu__cfg_yy_scan_string
+#endif
+
+#ifdef yy_scan_bytes
+#define xlu__cfg_yy_scan_bytes_ALREADY_DEFINED
+#else
+#define yy_scan_bytes xlu__cfg_yy_scan_bytes
+#endif
+
+#ifdef yy_init_buffer
+#define xlu__cfg_yy_init_buffer_ALREADY_DEFINED
+#else
+#define yy_init_buffer xlu__cfg_yy_init_buffer
+#endif
+
+#ifdef yy_flush_buffer
+#define xlu__cfg_yy_flush_buffer_ALREADY_DEFINED
+#else
+#define yy_flush_buffer xlu__cfg_yy_flush_buffer
+#endif
+
+#ifdef yy_load_buffer_state
+#define xlu__cfg_yy_load_buffer_state_ALREADY_DEFINED
+#else
+#define yy_load_buffer_state xlu__cfg_yy_load_buffer_state
+#endif
+
+#ifdef yy_switch_to_buffer
+#define xlu__cfg_yy_switch_to_buffer_ALREADY_DEFINED
+#else
+#define yy_switch_to_buffer xlu__cfg_yy_switch_to_buffer
+#endif
+
+#ifdef yypush_buffer_state
+#define xlu__cfg_yypush_buffer_state_ALREADY_DEFINED
+#else
+#define yypush_buffer_state xlu__cfg_yypush_buffer_state
+#endif
+
+#ifdef yypop_buffer_state
+#define xlu__cfg_yypop_buffer_state_ALREADY_DEFINED
+#else
+#define yypop_buffer_state xlu__cfg_yypop_buffer_state
+#endif
+
+#ifdef yyensure_buffer_stack
+#define xlu__cfg_yyensure_buffer_stack_ALREADY_DEFINED
+#else
+#define yyensure_buffer_stack xlu__cfg_yyensure_buffer_stack
+#endif
+
+#ifdef yylex
+#define xlu__cfg_yylex_ALREADY_DEFINED
+#else
+#define yylex xlu__cfg_yylex
+#endif
+
+#ifdef yyrestart
+#define xlu__cfg_yyrestart_ALREADY_DEFINED
+#else
+#define yyrestart xlu__cfg_yyrestart
+#endif
+
+#ifdef yylex_init
+#define xlu__cfg_yylex_init_ALREADY_DEFINED
+#else
+#define yylex_init xlu__cfg_yylex_init
+#endif
+
+#ifdef yylex_init_extra
+#define xlu__cfg_yylex_init_extra_ALREADY_DEFINED
+#else
+#define yylex_init_extra xlu__cfg_yylex_init_extra
+#endif
+
+#ifdef yylex_destroy
+#define xlu__cfg_yylex_destroy_ALREADY_DEFINED
+#else
+#define yylex_destroy xlu__cfg_yylex_destroy
+#endif
+
+#ifdef yyget_debug
+#define xlu__cfg_yyget_debug_ALREADY_DEFINED
+#else
+#define yyget_debug xlu__cfg_yyget_debug
+#endif
+
+#ifdef yyset_debug
+#define xlu__cfg_yyset_debug_ALREADY_DEFINED
+#else
+#define yyset_debug xlu__cfg_yyset_debug
+#endif
+
+#ifdef yyget_extra
+#define xlu__cfg_yyget_extra_ALREADY_DEFINED
+#else
+#define yyget_extra xlu__cfg_yyget_extra
+#endif
+
+#ifdef yyset_extra
+#define xlu__cfg_yyset_extra_ALREADY_DEFINED
+#else
+#define yyset_extra xlu__cfg_yyset_extra
+#endif
+
+#ifdef yyget_in
+#define xlu__cfg_yyget_in_ALREADY_DEFINED
+#else
+#define yyget_in xlu__cfg_yyget_in
+#endif
+
+#ifdef yyset_in
+#define xlu__cfg_yyset_in_ALREADY_DEFINED
+#else
+#define yyset_in xlu__cfg_yyset_in
+#endif
+
+#ifdef yyget_out
+#define xlu__cfg_yyget_out_ALREADY_DEFINED
+#else
+#define yyget_out xlu__cfg_yyget_out
+#endif
+
+#ifdef yyset_out
+#define xlu__cfg_yyset_out_ALREADY_DEFINED
+#else
+#define yyset_out xlu__cfg_yyset_out
+#endif
+
+#ifdef yyget_leng
+#define xlu__cfg_yyget_leng_ALREADY_DEFINED
+#else
+#define yyget_leng xlu__cfg_yyget_leng
+#endif
+
+#ifdef yyget_text
+#define xlu__cfg_yyget_text_ALREADY_DEFINED
+#else
+#define yyget_text xlu__cfg_yyget_text
+#endif
+
+#ifdef yyget_lineno
+#define xlu__cfg_yyget_lineno_ALREADY_DEFINED
+#else
+#define yyget_lineno xlu__cfg_yyget_lineno
+#endif
+
+#ifdef yyset_lineno
+#define xlu__cfg_yyset_lineno_ALREADY_DEFINED
+#else
+#define yyset_lineno xlu__cfg_yyset_lineno
+#endif
+
+#ifdef yyget_column
+#define xlu__cfg_yyget_column_ALREADY_DEFINED
+#else
+#define yyget_column xlu__cfg_yyget_column
+#endif
+
+#ifdef yyset_column
+#define xlu__cfg_yyset_column_ALREADY_DEFINED
+#else
+#define yyset_column xlu__cfg_yyset_column
+#endif
+
+#ifdef yywrap
+#define xlu__cfg_yywrap_ALREADY_DEFINED
+#else
+#define yywrap xlu__cfg_yywrap
+#endif
+
+#ifdef yyget_lval
+#define xlu__cfg_yyget_lval_ALREADY_DEFINED
+#else
+#define yyget_lval xlu__cfg_yyget_lval
+#endif
+
+#ifdef yyset_lval
+#define xlu__cfg_yyset_lval_ALREADY_DEFINED
+#else
+#define yyset_lval xlu__cfg_yyset_lval
+#endif
+
+#ifdef yyget_lloc
+#define xlu__cfg_yyget_lloc_ALREADY_DEFINED
+#else
+#define yyget_lloc xlu__cfg_yyget_lloc
+#endif
+
+#ifdef yyset_lloc
+#define xlu__cfg_yyset_lloc_ALREADY_DEFINED
+#else
+#define yyset_lloc xlu__cfg_yyset_lloc
+#endif
+
+#ifdef yyalloc
+#define xlu__cfg_yyalloc_ALREADY_DEFINED
+#else
+#define yyalloc xlu__cfg_yyalloc
+#endif
+
+#ifdef yyrealloc
+#define xlu__cfg_yyrealloc_ALREADY_DEFINED
+#else
+#define yyrealloc xlu__cfg_yyrealloc
+#endif
+
+#ifdef yyfree
+#define xlu__cfg_yyfree_ALREADY_DEFINED
+#else
+#define yyfree xlu__cfg_yyfree
+#endif
+
 /* First, we deal with  platform-specific or compiler-specific issues. */
 
 /* begin standard C headers. */
@@ -84,10 +318,16 @@ typedef unsigned int flex_uint32_t;
 #define UINT32_MAX             (4294967295U)
 #endif
 
+#ifndef SIZE_MAX
+#define SIZE_MAX               (~(size_t)0)
+#endif
+
 #endif /* ! C99 */
 
 #endif /* ! FLEXINT_H */
 
+/* begin standard C++ headers. */
+
 /* TODO: this is always defined, so inline it */
 #define yyconst const
 
@@ -100,12 +340,10 @@ typedef unsigned int flex_uint32_t;
 /* Returned upon end-of-file. */
 #define YY_NULL 0
 
-/* Promotes a possibly negative, possibly signed char to an unsigned
- * integer for use as an array index.  If the signed char is negative,
- * we want to instead treat it as an 8-bit unsigned char, hence the
- * double cast.
+/* Promotes a possibly negative, possibly signed char to an
+ *   integer in range [0..255] for use as an array index.
  */
-#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
+#define YY_SC_TO_UI(c) ((YY_CHAR) (c))
 
 /* An opaque pointer. */
 #ifndef YY_TYPEDEF_YY_SCANNER_T
@@ -129,20 +367,16 @@ typedef void* yyscan_t;
  * definition of BEGIN.
  */
 #define BEGIN yyg->yy_start = 1 + 2 *
-
 /* Translate the current start state into a value that can be later handed
  * to BEGIN to return to the state.  The YYSTATE alias is for lex
  * compatibility.
  */
 #define YY_START ((yyg->yy_start - 1) / 2)
 #define YYSTATE YY_START
-
 /* Action number for EOF rule of a given start state. */
 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
-
 /* Special action meaning "start processing a new file". */
-#define YY_NEW_FILE xlu__cfg_yyrestart(yyin ,yyscanner )
-
+#define YY_NEW_FILE yyrestart( yyin , yyscanner )
 #define YY_END_OF_BUFFER_CHAR 0
 
 /* Size of default input buffer. */
@@ -175,10 +409,10 @@ typedef size_t yy_size_t;
 #define EOB_ACT_CONTINUE_SCAN 0
 #define EOB_ACT_END_OF_FILE 1
 #define EOB_ACT_LAST_MATCH 2
-
+    
     /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
      *       access to the local variable yy_act. Since yyless() is a macro, it would break
-     *       existing scanners that call yyless() from OUTSIDE xlu__cfg_yylex.
+     *       existing scanners that call yyless() from OUTSIDE yylex.
      *       One obvious solution it to make yy_act a global. I tried that, and saw
      *       a 5% performance hit in a non-yylineno scanner, because yy_act is
      *       normally declared as a register variable-- so it is not worth it.
@@ -211,7 +445,6 @@ typedef size_t yy_size_t;
 		YY_DO_BEFORE_ACTION; /* set up yytext again */ \
 		} \
 	while ( 0 )
-
 #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
 
 #ifndef YY_STRUCT_YY_BUFFER_STATE
@@ -271,7 +504,7 @@ struct yy_buffer_state
 	 * possible backing-up.
 	 *
 	 * When we actually see the EOF, we change the status to "new"
-	 * (via xlu__cfg_yyrestart()), so that the user can continue scanning by
+	 * (via yyrestart()), so that the user can continue scanning by
 	 * just pointing yyin at a new input file.
 	 */
 #define YY_BUFFER_EOF_PENDING 2
@@ -288,71 +521,65 @@ struct yy_buffer_state
 #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
                           ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
                           : NULL)
-
 /* Same as previous macro, but useful when we know that the buffer stack is not
  * NULL or when we need an lvalue. For internal use only.
  */
 #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
 
-void xlu__cfg_yyrestart (FILE *input_file ,yyscan_t yyscanner );
-void xlu__cfg_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
-YY_BUFFER_STATE xlu__cfg_yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner );
-void xlu__cfg_yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
-void xlu__cfg_yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
-void xlu__cfg_yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
-void xlu__cfg_yypop_buffer_state (yyscan_t yyscanner );
-
-static void xlu__cfg_yyensure_buffer_stack (yyscan_t yyscanner );
-static void xlu__cfg_yy_load_buffer_state (yyscan_t yyscanner );
-static void xlu__cfg_yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );
+void yyrestart ( FILE *input_file , yyscan_t yyscanner );
+void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );
+YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner );
+void yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );
+void yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );
+void yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );
+void yypop_buffer_state ( yyscan_t yyscanner );
 
-#define YY_FLUSH_BUFFER xlu__cfg_yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
+static void yyensure_buffer_stack ( yyscan_t yyscanner );
+static void yy_load_buffer_state ( yyscan_t yyscanner );
+static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file , yyscan_t yyscanner );
+#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER , yyscanner)
 
-YY_BUFFER_STATE xlu__cfg_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
-YY_BUFFER_STATE xlu__cfg_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
-YY_BUFFER_STATE xlu__cfg_yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
+YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner );
+YY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner );
+YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner );
 
-void *xlu__cfg_yyalloc (yy_size_t ,yyscan_t yyscanner );
-void *xlu__cfg_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner );
-void xlu__cfg_yyfree (void * ,yyscan_t yyscanner );
-
-#define yy_new_buffer xlu__cfg_yy_create_buffer
+void *yyalloc ( yy_size_t , yyscan_t yyscanner );
+void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner );
+void yyfree ( void * , yyscan_t yyscanner );
 
+#define yy_new_buffer yy_create_buffer
 #define yy_set_interactive(is_interactive) \
 	{ \
 	if ( ! YY_CURRENT_BUFFER ){ \
-        xlu__cfg_yyensure_buffer_stack (yyscanner); \
+        yyensure_buffer_stack (yyscanner); \
 		YY_CURRENT_BUFFER_LVALUE =    \
-            xlu__cfg_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
+            yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \
 	} \
 	YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
 	}
-
 #define yy_set_bol(at_bol) \
 	{ \
 	if ( ! YY_CURRENT_BUFFER ){\
-        xlu__cfg_yyensure_buffer_stack (yyscanner); \
+        yyensure_buffer_stack (yyscanner); \
 		YY_CURRENT_BUFFER_LVALUE =    \
-            xlu__cfg_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
+            yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \
 	} \
 	YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
 	}
-
 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
 
 #define xlu__cfg_yywrap(yyscanner) (/*CONSTCOND*/1)
 #define YY_SKIP_YYWRAP
-
-typedef unsigned char YY_CHAR;
+typedef flex_uint8_t YY_CHAR;
 
 typedef int yy_state_type;
 
 #define yytext_ptr yytext_r
 
-static yy_state_type yy_get_previous_state (yyscan_t yyscanner );
-static yy_state_type yy_try_NUL_trans (yy_state_type current_state  ,yyscan_t yyscanner);
-static int yy_get_next_buffer (yyscan_t yyscanner );
-static void yynoreturn yy_fatal_error (yyconst char* msg ,yyscan_t yyscanner );
+static yy_state_type yy_get_previous_state ( yyscan_t yyscanner );
+static yy_state_type yy_try_NUL_trans ( yy_state_type current_state  , yyscan_t yyscanner);
+static int yy_get_next_buffer ( yyscan_t yyscanner );
+static void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner );
 
 /* Done after the current pattern has been matched and before the
  * corresponding action - sets up yytext.
@@ -364,7 +591,6 @@ static void yynoreturn yy_fatal_error (yyconst char* msg ,yyscan_t yyscanner );
 	yyg->yy_hold_char = *yy_cp; \
 	*yy_cp = '\0'; \
 	yyg->yy_c_buf_p = yy_cp;
-
 #define YY_NUM_RULES 17
 #define YY_END_OF_BUFFER 18
 /* This struct is not used in this scanner,
@@ -374,7 +600,7 @@ struct yy_trans_info
 	flex_int32_t yy_verify;
 	flex_int32_t yy_nxt;
 	};
-static yyconst flex_int16_t yy_accept[37] =
+static const flex_int16_t yy_accept[37] =
     {   0,
         0,    0,   15,   15,   18,   14,    3,   10,   14,   14,
        14,   13,   13,    4,    2,    9,    8,    5,    6,    1,
@@ -382,7 +608,7 @@ static yyconst flex_int16_t yy_accept[37] =
         0,    7,    2,    1,   15,    0
     } ;
 
-static yyconst YY_CHAR yy_ec[256] =
+static const YY_CHAR yy_ec[256] =
     {   0,
         1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
@@ -414,13 +640,13 @@ static yyconst YY_CHAR yy_ec[256] =
         1,    1,    1,    1,    1
     } ;
 
-static yyconst YY_CHAR yy_meta[20] =
+static const YY_CHAR yy_meta[20] =
     {   0,
         1,    2,    3,    1,    1,    1,    1,    1,    1,    4,
         4,    1,    1,    1,    1,    1,    4,    4,    4
     } ;
 
-static yyconst flex_uint16_t yy_base[43] =
+static const flex_int16_t yy_base[43] =
     {   0,
         0,    0,   18,   20,   53,   59,   59,   59,   20,   42,
        19,   59,   19,   59,   15,   59,   59,   59,   59,    0,
@@ -429,7 +655,7 @@ static yyconst flex_uint16_t yy_base[43] =
        26,   54
     } ;
 
-static yyconst flex_int16_t yy_def[43] =
+static const flex_int16_t yy_def[43] =
     {   0,
        36,    1,   37,   37,   36,   36,   36,   36,   38,   39,
        40,   36,   36,   36,   36,   36,   36,   36,   36,   41,
@@ -438,7 +664,7 @@ static yyconst flex_int16_t yy_def[43] =
        36,   36
     } ;
 
-static yyconst flex_uint16_t yy_nxt[79] =
+static const flex_int16_t yy_nxt[79] =
     {   0,
         6,    7,    8,    9,   10,   11,   12,   13,   14,   12,
        15,   16,   17,   18,    6,   19,    6,   20,   20,   22,
@@ -450,7 +676,7 @@ static yyconst flex_uint16_t yy_nxt[79] =
        36,   36,   36,   36,   36,   36,   36,   36
     } ;
 
-static yyconst flex_int16_t yy_chk[79] =
+static const flex_int16_t yy_chk[79] =
     {   0,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    3,
@@ -463,7 +689,7 @@ static yyconst flex_int16_t yy_chk[79] =
     } ;
 
 /* Table of booleans, true if rule could match eol. */
-static yyconst flex_int32_t yy_rule_can_match_eol[18] =
+static const flex_int32_t yy_rule_can_match_eol[18] =
     {   0,
 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0,     };
 
@@ -510,8 +736,9 @@ static yyconst flex_int32_t yy_rule_can_match_eol[18] =
 int xlu__cfg_yyget_column(yyscan_t yyscanner);
 void xlu__cfg_yyset_column(int  column_no, yyscan_t yyscanner);
 
+#line 740 "libxlu_cfg_l.c"
 
-#line 515 "libxlu_cfg_l.c"
+#line 742 "libxlu_cfg_l.c"
 
 #define INITIAL 0
 #define lexerr 1
@@ -566,7 +793,7 @@ struct yyguts_t
 
     }; /* end struct yyguts_t */
 
-static int yy_init_globals (yyscan_t yyscanner );
+static int yy_init_globals ( yyscan_t yyscanner );
 
     /* This must go here because YYSTYPE and YYLTYPE are included
      * from bison output in section 1.*/
@@ -574,50 +801,50 @@ static int yy_init_globals (yyscan_t yyscanner );
     
     #    define yylloc yyg->yylloc_r
     
-int xlu__cfg_yylex_init (yyscan_t* scanner);
+int yylex_init (yyscan_t* scanner);
 
-int xlu__cfg_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
+int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner);
 
 /* Accessor methods to globals.
    These are made visible to non-reentrant scanners for convenience. */
 
-int xlu__cfg_yylex_destroy (yyscan_t yyscanner );
+int yylex_destroy ( yyscan_t yyscanner );
 
-int xlu__cfg_yyget_debug (yyscan_t yyscanner );
+int yyget_debug ( yyscan_t yyscanner );
 
-void xlu__cfg_yyset_debug (int debug_flag ,yyscan_t yyscanner );
+void yyset_debug ( int debug_flag , yyscan_t yyscanner );
 
-YY_EXTRA_TYPE xlu__cfg_yyget_extra (yyscan_t yyscanner );
+YY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner );
 
-void xlu__cfg_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
+void yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner );
 
-FILE *xlu__cfg_yyget_in (yyscan_t yyscanner );
+FILE *yyget_in ( yyscan_t yyscanner );
 
-void xlu__cfg_yyset_in  (FILE * _in_str ,yyscan_t yyscanner );
+void yyset_in  ( FILE * _in_str , yyscan_t yyscanner );
 
-FILE *xlu__cfg_yyget_out (yyscan_t yyscanner );
+FILE *yyget_out ( yyscan_t yyscanner );
 
-void xlu__cfg_yyset_out  (FILE * _out_str ,yyscan_t yyscanner );
+void yyset_out  ( FILE * _out_str , yyscan_t yyscanner );
 
-			int xlu__cfg_yyget_leng (yyscan_t yyscanner );
+			int yyget_leng ( yyscan_t yyscanner );
 
-char *xlu__cfg_yyget_text (yyscan_t yyscanner );
+char *yyget_text ( yyscan_t yyscanner );
 
-int xlu__cfg_yyget_lineno (yyscan_t yyscanner );
+int yyget_lineno ( yyscan_t yyscanner );
 
-void xlu__cfg_yyset_lineno (int _line_number ,yyscan_t yyscanner );
+void yyset_lineno ( int _line_number , yyscan_t yyscanner );
 
-int xlu__cfg_yyget_column  (yyscan_t yyscanner );
+int yyget_column  ( yyscan_t yyscanner );
 
-void xlu__cfg_yyset_column (int _column_no ,yyscan_t yyscanner );
+void yyset_column ( int _column_no , yyscan_t yyscanner );
 
-YYSTYPE * xlu__cfg_yyget_lval (yyscan_t yyscanner );
+YYSTYPE * yyget_lval ( yyscan_t yyscanner );
 
-void xlu__cfg_yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
+void yyset_lval ( YYSTYPE * yylval_param , yyscan_t yyscanner );
 
-       YYLTYPE *xlu__cfg_yyget_lloc (yyscan_t yyscanner );
+       YYLTYPE *yyget_lloc ( yyscan_t yyscanner );
     
-        void xlu__cfg_yyset_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner );
+        void yyset_lloc ( YYLTYPE * yylloc_param , yyscan_t yyscanner );
     
 /* Macros after this point can all be overridden by user definitions in
  * section 1.
@@ -625,9 +852,9 @@ void xlu__cfg_yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
 
 #ifndef YY_SKIP_YYWRAP
 #ifdef __cplusplus
-extern "C" int xlu__cfg_yywrap (yyscan_t yyscanner );
+extern "C" int yywrap ( yyscan_t yyscanner );
 #else
-extern int xlu__cfg_yywrap (yyscan_t yyscanner );
+extern int yywrap ( yyscan_t yyscanner );
 #endif
 #endif
 
@@ -636,19 +863,18 @@ extern int xlu__cfg_yywrap (yyscan_t yyscanner );
 #endif
 
 #ifndef yytext_ptr
-static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
+static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner);
 #endif
 
 #ifdef YY_NEED_STRLEN
-static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
+static int yy_flex_strlen ( const char * , yyscan_t yyscanner);
 #endif
 
 #ifndef YY_NO_INPUT
-
 #ifdef __cplusplus
-static int yyinput (yyscan_t yyscanner );
+static int yyinput ( yyscan_t yyscanner );
 #else
-static int input (yyscan_t yyscanner );
+static int input ( yyscan_t yyscanner );
 #endif
 
 #endif
@@ -679,7 +905,7 @@ static int input (yyscan_t yyscanner );
 	if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
 		{ \
 		int c = '*'; \
-		size_t n; \
+		int n; \
 		for ( n = 0; n < max_size && \
 			     (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
 			buf[n] = (char) c; \
@@ -692,7 +918,7 @@ static int input (yyscan_t yyscanner );
 	else \
 		{ \
 		errno=0; \
-		while ( (result = (int) fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
+		while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \
 			{ \
 			if( errno != EINTR) \
 				{ \
@@ -733,10 +959,10 @@ static int input (yyscan_t yyscanner );
 #ifndef YY_DECL
 #define YY_DECL_IS_OURS 1
 
-extern int xlu__cfg_yylex \
-               (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner);
+extern int yylex \
+               (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner);
 
-#define YY_DECL int xlu__cfg_yylex \
+#define YY_DECL int yylex \
                (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner)
 #endif /* !YY_DECL */
 
@@ -786,26 +1012,26 @@ YY_DECL
 			yyout = stdout;
 
 		if ( ! YY_CURRENT_BUFFER ) {
-			xlu__cfg_yyensure_buffer_stack (yyscanner);
+			yyensure_buffer_stack (yyscanner);
 			YY_CURRENT_BUFFER_LVALUE =
-				xlu__cfg_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
+				yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner);
 		}
 
-		xlu__cfg_yy_load_buffer_state(yyscanner );
+		yy_load_buffer_state( yyscanner );
 		}
 
 	{
 #line 53 "libxlu_cfg_l.l"
 
 
-#line 802 "libxlu_cfg_l.c"
+#line 1028 "libxlu_cfg_l.c"
 
 	while ( /*CONSTCOND*/1 )		/* loops until end-of-file is reached */
 		{
 		yyg->yy_more_len = 0;
 		if ( yyg->yy_more_flag )
 			{
-			yyg->yy_more_len = yyg->yy_c_buf_p - yyg->yytext_ptr;
+			yyg->yy_more_len = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr);
 			yyg->yy_more_flag = 0;
 			}
 		yy_cp = yyg->yy_c_buf_p;
@@ -832,9 +1058,9 @@ yy_match:
 				{
 				yy_current_state = (int) yy_def[yy_current_state];
 				if ( yy_current_state >= 37 )
-					yy_c = yy_meta[(unsigned int) yy_c];
+					yy_c = yy_meta[yy_c];
 				}
-			yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
+			yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
 			++yy_cp;
 			}
 		while ( yy_current_state != 36 );
@@ -982,7 +1208,7 @@ YY_RULE_SETUP
 #line 105 "libxlu_cfg_l.l"
 YY_FATAL_ERROR( "flex scanner jammed" );
 	YY_BREAK
-#line 986 "libxlu_cfg_l.c"
+#line 1212 "libxlu_cfg_l.c"
 case YY_STATE_EOF(INITIAL):
 case YY_STATE_EOF(lexerr):
 	yyterminate();
@@ -1001,7 +1227,7 @@ case YY_STATE_EOF(lexerr):
 			/* We're scanning a new file or input source.  It's
 			 * possible that this happened because the user
 			 * just pointed yyin at a new source and called
-			 * xlu__cfg_yylex().  If so, then we have to assure
+			 * yylex().  If so, then we have to assure
 			 * consistency between YY_CURRENT_BUFFER and our
 			 * globals.  Here is the right place to do so, because
 			 * this is the first action (other than possibly a
@@ -1062,7 +1288,7 @@ case YY_STATE_EOF(lexerr):
 				{
 				yyg->yy_did_buffer_switch_on_eof = 0;
 
-				if ( xlu__cfg_yywrap(yyscanner ) )
+				if ( yywrap( yyscanner ) )
 					{
 					/* Note: because we've taken care in
 					 * yy_get_next_buffer() to have set up
@@ -1116,7 +1342,7 @@ case YY_STATE_EOF(lexerr):
 	} /* end of action switch */
 		} /* end of scanning one token */
 	} /* end of user's declarations */
-} /* end of xlu__cfg_yylex */
+} /* end of yylex */
 
 /* yy_get_next_buffer - try to read in a new buffer
  *
@@ -1195,7 +1421,8 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
 
 				b->yy_ch_buf = (char *)
 					/* Include room in for 2 EOB chars. */
-					xlu__cfg_yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner );
+					yyrealloc( (void *) b->yy_ch_buf,
+							 (yy_size_t) (b->yy_buf_size + 2) , yyscanner );
 				}
 			else
 				/* Can't grow it, we don't own it. */
@@ -1227,7 +1454,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
 		if ( number_to_move == YY_MORE_ADJ )
 			{
 			ret_val = EOB_ACT_END_OF_FILE;
-			xlu__cfg_yyrestart(yyin  ,yyscanner);
+			yyrestart( yyin  , yyscanner);
 			}
 
 		else
@@ -1244,9 +1471,12 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
 	if ((yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
 		/* Extend the array by 50%, plus the number we really need. */
 		int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
-		YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) xlu__cfg_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
+		YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
+			(void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size , yyscanner );
 		if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
 			YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
+		/* "- 2" to take care of EOB's */
+		YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
 	}
 
 	yyg->yy_n_chars += number_to_move;
@@ -1280,9 +1510,9 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
 			{
 			yy_current_state = (int) yy_def[yy_current_state];
 			if ( yy_current_state >= 37 )
-				yy_c = yy_meta[(unsigned int) yy_c];
+				yy_c = yy_meta[yy_c];
 			}
-		yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
+		yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
 		}
 
 	return yy_current_state;
@@ -1309,9 +1539,9 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
 		{
 		yy_current_state = (int) yy_def[yy_current_state];
 		if ( yy_current_state >= 37 )
-			yy_c = yy_meta[(unsigned int) yy_c];
+			yy_c = yy_meta[yy_c];
 		}
-	yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
+	yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
 	yy_is_jam = (yy_current_state == 36);
 
 	(void)yyg;
@@ -1347,7 +1577,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
 
 		else
 			{ /* need more input */
-			int offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
+			int offset = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr);
 			++yyg->yy_c_buf_p;
 
 			switch ( yy_get_next_buffer( yyscanner ) )
@@ -1364,13 +1594,13 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
 					 */
 
 					/* Reset buffer status. */
-					xlu__cfg_yyrestart(yyin ,yyscanner);
+					yyrestart( yyin , yyscanner);
 
 					/*FALLTHROUGH*/
 
 				case EOB_ACT_END_OF_FILE:
 					{
-					if ( xlu__cfg_yywrap(yyscanner ) )
+					if ( yywrap( yyscanner ) )
 						return 0;
 
 					if ( ! yyg->yy_did_buffer_switch_on_eof )
@@ -1409,34 +1639,34 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
  * @param yyscanner The scanner object.
  * @note This function does not reset the start condition to @c INITIAL .
  */
-    void xlu__cfg_yyrestart  (FILE * input_file , yyscan_t yyscanner)
+    void yyrestart  (FILE * input_file , yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
 	if ( ! YY_CURRENT_BUFFER ){
-        xlu__cfg_yyensure_buffer_stack (yyscanner);
+        yyensure_buffer_stack (yyscanner);
 		YY_CURRENT_BUFFER_LVALUE =
-            xlu__cfg_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
+            yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner);
 	}
 
-	xlu__cfg_yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
-	xlu__cfg_yy_load_buffer_state(yyscanner );
+	yy_init_buffer( YY_CURRENT_BUFFER, input_file , yyscanner);
+	yy_load_buffer_state( yyscanner );
 }
 
 /** Switch to a different input buffer.
  * @param new_buffer The new input buffer.
  * @param yyscanner The scanner object.
  */
-    void xlu__cfg_yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer , yyscan_t yyscanner)
+    void yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer , yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
 	/* TODO. We should be able to replace this entire function body
 	 * with
-	 *		xlu__cfg_yypop_buffer_state();
-	 *		xlu__cfg_yypush_buffer_state(new_buffer);
+	 *		yypop_buffer_state();
+	 *		yypush_buffer_state(new_buffer);
      */
-	xlu__cfg_yyensure_buffer_stack (yyscanner);
+	yyensure_buffer_stack (yyscanner);
 	if ( YY_CURRENT_BUFFER == new_buffer )
 		return;
 
@@ -1449,17 +1679,17 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
 		}
 
 	YY_CURRENT_BUFFER_LVALUE = new_buffer;
-	xlu__cfg_yy_load_buffer_state(yyscanner );
+	yy_load_buffer_state( yyscanner );
 
 	/* We don't actually know whether we did this switch during
-	 * EOF (xlu__cfg_yywrap()) processing, but the only time this flag
-	 * is looked at is after xlu__cfg_yywrap() is called, so it's safe
+	 * EOF (yywrap()) processing, but the only time this flag
+	 * is looked at is after yywrap() is called, so it's safe
 	 * to go ahead and always set it.
 	 */
 	yyg->yy_did_buffer_switch_on_eof = 1;
 }
 
-static void xlu__cfg_yy_load_buffer_state  (yyscan_t yyscanner)
+static void yy_load_buffer_state  (yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 	yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
@@ -1474,35 +1704,35 @@ static void xlu__cfg_yy_load_buffer_state  (yyscan_t yyscanner)
  * @param yyscanner The scanner object.
  * @return the allocated buffer state.
  */
-    YY_BUFFER_STATE xlu__cfg_yy_create_buffer  (FILE * file, int  size , yyscan_t yyscanner)
+    YY_BUFFER_STATE yy_create_buffer  (FILE * file, int  size , yyscan_t yyscanner)
 {
 	YY_BUFFER_STATE b;
     
-	b = (YY_BUFFER_STATE) xlu__cfg_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
+	b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );
 	if ( ! b )
-		YY_FATAL_ERROR( "out of dynamic memory in xlu__cfg_yy_create_buffer()" );
+		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
 
-	b->yy_buf_size = (yy_size_t)size;
+	b->yy_buf_size = size;
 
 	/* yy_ch_buf has to be 2 characters longer than the size given because
 	 * we need to put in 2 end-of-buffer characters.
 	 */
-	b->yy_ch_buf = (char *) xlu__cfg_yyalloc(b->yy_buf_size + 2 ,yyscanner );
+	b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) , yyscanner );
 	if ( ! b->yy_ch_buf )
-		YY_FATAL_ERROR( "out of dynamic memory in xlu__cfg_yy_create_buffer()" );
+		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
 
 	b->yy_is_our_buffer = 1;
 
-	xlu__cfg_yy_init_buffer(b,file ,yyscanner);
+	yy_init_buffer( b, file , yyscanner);
 
 	return b;
 }
 
 /** Destroy the buffer.
- * @param b a buffer created with xlu__cfg_yy_create_buffer()
+ * @param b a buffer created with yy_create_buffer()
  * @param yyscanner The scanner object.
  */
-    void xlu__cfg_yy_delete_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)
+    void yy_delete_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
@@ -1513,28 +1743,28 @@ static void xlu__cfg_yy_load_buffer_state  (yyscan_t yyscanner)
 		YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
 
 	if ( b->yy_is_our_buffer )
-		xlu__cfg_yyfree((void *) b->yy_ch_buf ,yyscanner );
+		yyfree( (void *) b->yy_ch_buf , yyscanner );
 
-	xlu__cfg_yyfree((void *) b ,yyscanner );
+	yyfree( (void *) b , yyscanner );
 }
 
 /* Initializes or reinitializes a buffer.
  * This function is sometimes called more than once on the same buffer,
- * such as during a xlu__cfg_yyrestart() or at EOF.
+ * such as during a yyrestart() or at EOF.
  */
-    static void xlu__cfg_yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file , yyscan_t yyscanner)
+    static void yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file , yyscan_t yyscanner)
 
 {
 	int oerrno = errno;
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
-	xlu__cfg_yy_flush_buffer(b ,yyscanner);
+	yy_flush_buffer( b , yyscanner);
 
 	b->yy_input_file = file;
 	b->yy_fill_buffer = 1;
 
-    /* If b is the current buffer, then xlu__cfg_yy_init_buffer was _probably_
-     * called from xlu__cfg_yyrestart() or through yy_get_next_buffer.
+    /* If b is the current buffer, then yy_init_buffer was _probably_
+     * called from yyrestart() or through yy_get_next_buffer.
      * In that case, we don't want to reset the lineno or column.
      */
     if (b != YY_CURRENT_BUFFER){
@@ -1551,7 +1781,7 @@ static void xlu__cfg_yy_load_buffer_state  (yyscan_t yyscanner)
  * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
  * @param yyscanner The scanner object.
  */
-    void xlu__cfg_yy_flush_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)
+    void yy_flush_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 	if ( ! b )
@@ -1572,7 +1802,7 @@ static void xlu__cfg_yy_load_buffer_state  (yyscan_t yyscanner)
 	b->yy_buffer_status = YY_BUFFER_NEW;
 
 	if ( b == YY_CURRENT_BUFFER )
-		xlu__cfg_yy_load_buffer_state(yyscanner );
+		yy_load_buffer_state( yyscanner );
 }
 
 /** Pushes the new state onto the stack. The new state becomes
@@ -1581,15 +1811,15 @@ static void xlu__cfg_yy_load_buffer_state  (yyscan_t yyscanner)
  *  @param new_buffer The new state.
  *  @param yyscanner The scanner object.
  */
-void xlu__cfg_yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
+void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 	if (new_buffer == NULL)
 		return;
 
-	xlu__cfg_yyensure_buffer_stack(yyscanner);
+	yyensure_buffer_stack(yyscanner);
 
-	/* This block is copied from xlu__cfg_yy_switch_to_buffer. */
+	/* This block is copied from yy_switch_to_buffer. */
 	if ( YY_CURRENT_BUFFER )
 		{
 		/* Flush out information for old buffer. */
@@ -1603,8 +1833,8 @@ void xlu__cfg_yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscann
 		yyg->yy_buffer_stack_top++;
 	YY_CURRENT_BUFFER_LVALUE = new_buffer;
 
-	/* copied from xlu__cfg_yy_switch_to_buffer. */
-	xlu__cfg_yy_load_buffer_state(yyscanner );
+	/* copied from yy_switch_to_buffer. */
+	yy_load_buffer_state( yyscanner );
 	yyg->yy_did_buffer_switch_on_eof = 1;
 }
 
@@ -1612,19 +1842,19 @@ void xlu__cfg_yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscann
  *  The next element becomes the new top.
  *  @param yyscanner The scanner object.
  */
-void xlu__cfg_yypop_buffer_state (yyscan_t yyscanner)
+void yypop_buffer_state (yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 	if (!YY_CURRENT_BUFFER)
 		return;
 
-	xlu__cfg_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner);
+	yy_delete_buffer(YY_CURRENT_BUFFER , yyscanner);
 	YY_CURRENT_BUFFER_LVALUE = NULL;
 	if (yyg->yy_buffer_stack_top > 0)
 		--yyg->yy_buffer_stack_top;
 
 	if (YY_CURRENT_BUFFER) {
-		xlu__cfg_yy_load_buffer_state(yyscanner );
+		yy_load_buffer_state( yyscanner );
 		yyg->yy_did_buffer_switch_on_eof = 1;
 	}
 }
@@ -1632,9 +1862,9 @@ void xlu__cfg_yypop_buffer_state (yyscan_t yyscanner)
 /* Allocates the stack if it does not exist.
  *  Guarantees space for at least one push.
  */
-static void xlu__cfg_yyensure_buffer_stack (yyscan_t yyscanner)
+static void yyensure_buffer_stack (yyscan_t yyscanner)
 {
-	int num_to_alloc;
+	yy_size_t num_to_alloc;
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
 	if (!yyg->yy_buffer_stack) {
@@ -1644,11 +1874,11 @@ static void xlu__cfg_yyensure_buffer_stack (yyscan_t yyscanner)
 		 * immediate realloc on the next call.
          */
       num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
-		yyg->yy_buffer_stack = (struct yy_buffer_state**)xlu__cfg_yyalloc
+		yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc
 								(num_to_alloc * sizeof(struct yy_buffer_state*)
 								, yyscanner);
 		if ( ! yyg->yy_buffer_stack )
-			YY_FATAL_ERROR( "out of dynamic memory in xlu__cfg_yyensure_buffer_stack()" );
+			YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
 
 		memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
 
@@ -1663,12 +1893,12 @@ static void xlu__cfg_yyensure_buffer_stack (yyscan_t yyscanner)
 		yy_size_t grow_size = 8 /* arbitrary grow size */;
 
 		num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
-		yyg->yy_buffer_stack = (struct yy_buffer_state**)xlu__cfg_yyrealloc
+		yyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc
 								(yyg->yy_buffer_stack,
 								num_to_alloc * sizeof(struct yy_buffer_state*)
 								, yyscanner);
 		if ( ! yyg->yy_buffer_stack )
-			YY_FATAL_ERROR( "out of dynamic memory in xlu__cfg_yyensure_buffer_stack()" );
+			YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
 
 		/* zero only the new slots.*/
 		memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
@@ -1682,7 +1912,7 @@ static void xlu__cfg_yyensure_buffer_stack (yyscan_t yyscanner)
  * @param yyscanner The scanner object.
  * @return the newly allocated buffer state object.
  */
-YY_BUFFER_STATE xlu__cfg_yy_scan_buffer  (char * base, yy_size_t  size , yyscan_t yyscanner)
+YY_BUFFER_STATE yy_scan_buffer  (char * base, yy_size_t  size , yyscan_t yyscanner)
 {
 	YY_BUFFER_STATE b;
     
@@ -1692,11 +1922,11 @@ YY_BUFFER_STATE xlu__cfg_yy_scan_buffer  (char * base, yy_size_t  size , yyscan_
 		/* They forgot to leave room for the EOB's. */
 		return NULL;
 
-	b = (YY_BUFFER_STATE) xlu__cfg_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
+	b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );
 	if ( ! b )
-		YY_FATAL_ERROR( "out of dynamic memory in xlu__cfg_yy_scan_buffer()" );
+		YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
 
-	b->yy_buf_size = size - 2;	/* "- 2" to take care of EOB's */
+	b->yy_buf_size = (int) (size - 2);	/* "- 2" to take care of EOB's */
 	b->yy_buf_pos = b->yy_ch_buf = base;
 	b->yy_is_our_buffer = 0;
 	b->yy_input_file = NULL;
@@ -1706,33 +1936,33 @@ YY_BUFFER_STATE xlu__cfg_yy_scan_buffer  (char * base, yy_size_t  size , yyscan_
 	b->yy_fill_buffer = 0;
 	b->yy_buffer_status = YY_BUFFER_NEW;
 
-	xlu__cfg_yy_switch_to_buffer(b ,yyscanner );
+	yy_switch_to_buffer( b , yyscanner );
 
 	return b;
 }
 
-/** Setup the input buffer state to scan a string. The next call to xlu__cfg_yylex() will
+/** Setup the input buffer state to scan a string. The next call to yylex() will
  * scan from a @e copy of @a str.
  * @param yystr a NUL-terminated string to scan
  * @param yyscanner The scanner object.
  * @return the newly allocated buffer state object.
  * @note If you want to scan bytes that may contain NUL values, then use
- *       xlu__cfg_yy_scan_bytes() instead.
+ *       yy_scan_bytes() instead.
  */
-YY_BUFFER_STATE xlu__cfg_yy_scan_string (yyconst char * yystr , yyscan_t yyscanner)
+YY_BUFFER_STATE yy_scan_string (const char * yystr , yyscan_t yyscanner)
 {
     
-	return xlu__cfg_yy_scan_bytes(yystr,(int) strlen(yystr) ,yyscanner);
+	return yy_scan_bytes( yystr, (int) strlen(yystr) , yyscanner);
 }
 
-/** Setup the input buffer state to scan the given bytes. The next call to xlu__cfg_yylex() will
+/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
  * scan from a @e copy of @a bytes.
  * @param yybytes the byte buffer to scan
  * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
  * @param yyscanner The scanner object.
  * @return the newly allocated buffer state object.
  */
-YY_BUFFER_STATE xlu__cfg_yy_scan_bytes  (yyconst char * yybytes, int  _yybytes_len , yyscan_t yyscanner)
+YY_BUFFER_STATE yy_scan_bytes  (const char * yybytes, int  _yybytes_len , yyscan_t yyscanner)
 {
 	YY_BUFFER_STATE b;
 	char *buf;
@@ -1741,18 +1971,18 @@ YY_BUFFER_STATE xlu__cfg_yy_scan_bytes  (yyconst char * yybytes, int  _yybytes_l
     
 	/* Get memory for full buffer, including space for trailing EOB's. */
 	n = (yy_size_t) (_yybytes_len + 2);
-	buf = (char *) xlu__cfg_yyalloc(n ,yyscanner );
+	buf = (char *) yyalloc( n , yyscanner );
 	if ( ! buf )
-		YY_FATAL_ERROR( "out of dynamic memory in xlu__cfg_yy_scan_bytes()" );
+		YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
 
 	for ( i = 0; i < _yybytes_len; ++i )
 		buf[i] = yybytes[i];
 
 	buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
 
-	b = xlu__cfg_yy_scan_buffer(buf,n ,yyscanner);
+	b = yy_scan_buffer( buf, n , yyscanner);
 	if ( ! b )
-		YY_FATAL_ERROR( "bad buffer in xlu__cfg_yy_scan_bytes()" );
+		YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
 
 	/* It's okay to grow etc. this buffer, and we should throw it
 	 * away when we're done.
@@ -1766,11 +1996,11 @@ YY_BUFFER_STATE xlu__cfg_yy_scan_bytes  (yyconst char * yybytes, int  _yybytes_l
 #define YY_EXIT_FAILURE 2
 #endif
 
-static void yynoreturn yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
+static void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner)
 {
 	struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 	(void)yyg;
-	(void) fprintf( stderr, "%s\n", msg );
+	fprintf( stderr, "%s\n", msg );
 	exit( YY_EXIT_FAILURE );
 }
 
@@ -1796,7 +2026,7 @@ static void yynoreturn yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
 /** Get the user-defined data for this scanner.
  * @param yyscanner The scanner object.
  */
-YY_EXTRA_TYPE xlu__cfg_yyget_extra  (yyscan_t yyscanner)
+YY_EXTRA_TYPE yyget_extra  (yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
     return yyextra;
@@ -1805,7 +2035,7 @@ YY_EXTRA_TYPE xlu__cfg_yyget_extra  (yyscan_t yyscanner)
 /** Get the current line number.
  * @param yyscanner The scanner object.
  */
-int xlu__cfg_yyget_lineno  (yyscan_t yyscanner)
+int yyget_lineno  (yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
@@ -1818,7 +2048,7 @@ int xlu__cfg_yyget_lineno  (yyscan_t yyscanner)
 /** Get the current column number.
  * @param yyscanner The scanner object.
  */
-int xlu__cfg_yyget_column  (yyscan_t yyscanner)
+int yyget_column  (yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
@@ -1831,7 +2061,7 @@ int xlu__cfg_yyget_column  (yyscan_t yyscanner)
 /** Get the input stream.
  * @param yyscanner The scanner object.
  */
-FILE *xlu__cfg_yyget_in  (yyscan_t yyscanner)
+FILE *yyget_in  (yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
     return yyin;
@@ -1840,7 +2070,7 @@ FILE *xlu__cfg_yyget_in  (yyscan_t yyscanner)
 /** Get the output stream.
  * @param yyscanner The scanner object.
  */
-FILE *xlu__cfg_yyget_out  (yyscan_t yyscanner)
+FILE *yyget_out  (yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
     return yyout;
@@ -1849,7 +2079,7 @@ FILE *xlu__cfg_yyget_out  (yyscan_t yyscanner)
 /** Get the length of the current token.
  * @param yyscanner The scanner object.
  */
-int xlu__cfg_yyget_leng  (yyscan_t yyscanner)
+int yyget_leng  (yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
     return yyleng;
@@ -1859,7 +2089,7 @@ int xlu__cfg_yyget_leng  (yyscan_t yyscanner)
  * @param yyscanner The scanner object.
  */
 
-char *xlu__cfg_yyget_text  (yyscan_t yyscanner)
+char *yyget_text  (yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
     return yytext;
@@ -1869,7 +2099,7 @@ char *xlu__cfg_yyget_text  (yyscan_t yyscanner)
  * @param user_defined The data to be associated with this scanner.
  * @param yyscanner The scanner object.
  */
-void xlu__cfg_yyset_extra (YY_EXTRA_TYPE  user_defined , yyscan_t yyscanner)
+void yyset_extra (YY_EXTRA_TYPE  user_defined , yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
     yyextra = user_defined ;
@@ -1879,13 +2109,13 @@ void xlu__cfg_yyset_extra (YY_EXTRA_TYPE  user_defined , yyscan_t yyscanner)
  * @param _line_number line number
  * @param yyscanner The scanner object.
  */
-void xlu__cfg_yyset_lineno (int  _line_number , yyscan_t yyscanner)
+void yyset_lineno (int  _line_number , yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
         /* lineno is only valid if an input buffer exists. */
         if (! YY_CURRENT_BUFFER )
-           YY_FATAL_ERROR( "xlu__cfg_yyset_lineno called with no buffer" );
+           YY_FATAL_ERROR( "yyset_lineno called with no buffer" );
     
     yylineno = _line_number;
 }
@@ -1894,13 +2124,13 @@ void xlu__cfg_yyset_lineno (int  _line_number , yyscan_t yyscanner)
  * @param _column_no column number
  * @param yyscanner The scanner object.
  */
-void xlu__cfg_yyset_column (int  _column_no , yyscan_t yyscanner)
+void yyset_column (int  _column_no , yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
         /* column is only valid if an input buffer exists. */
         if (! YY_CURRENT_BUFFER )
-           YY_FATAL_ERROR( "xlu__cfg_yyset_column called with no buffer" );
+           YY_FATAL_ERROR( "yyset_column called with no buffer" );
     
     yycolumn = _column_no;
 }
@@ -1909,27 +2139,27 @@ void xlu__cfg_yyset_column (int  _column_no , yyscan_t yyscanner)
  * input buffer.
  * @param _in_str A readable stream.
  * @param yyscanner The scanner object.
- * @see xlu__cfg_yy_switch_to_buffer
+ * @see yy_switch_to_buffer
  */
-void xlu__cfg_yyset_in (FILE *  _in_str , yyscan_t yyscanner)
+void yyset_in (FILE *  _in_str , yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
     yyin = _in_str ;
 }
 
-void xlu__cfg_yyset_out (FILE *  _out_str , yyscan_t yyscanner)
+void yyset_out (FILE *  _out_str , yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
     yyout = _out_str ;
 }
 
-int xlu__cfg_yyget_debug  (yyscan_t yyscanner)
+int yyget_debug  (yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
     return yy_flex_debug;
 }
 
-void xlu__cfg_yyset_debug (int  _bdebug , yyscan_t yyscanner)
+void yyset_debug (int  _bdebug , yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
     yy_flex_debug = _bdebug ;
@@ -1937,25 +2167,25 @@ void xlu__cfg_yyset_debug (int  _bdebug , yyscan_t yyscanner)
 
 /* Accessor methods for yylval and yylloc */
 
-YYSTYPE * xlu__cfg_yyget_lval  (yyscan_t yyscanner)
+YYSTYPE * yyget_lval  (yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
     return yylval;
 }
 
-void xlu__cfg_yyset_lval (YYSTYPE *  yylval_param , yyscan_t yyscanner)
+void yyset_lval (YYSTYPE *  yylval_param , yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
     yylval = yylval_param;
 }
 
-YYLTYPE *xlu__cfg_yyget_lloc  (yyscan_t yyscanner)
+YYLTYPE *yyget_lloc  (yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
     return yylloc;
 }
     
-void xlu__cfg_yyset_lloc (YYLTYPE *  yylloc_param , yyscan_t yyscanner)
+void yyset_lloc (YYLTYPE *  yylloc_param , yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
     yylloc = yylloc_param;
@@ -1963,20 +2193,18 @@ void xlu__cfg_yyset_lloc (YYLTYPE *  yylloc_param , yyscan_t yyscanner)
     
 /* User-visible API */
 
-/* xlu__cfg_yylex_init is special because it creates the scanner itself, so it is
+/* yylex_init is special because it creates the scanner itself, so it is
  * the ONLY reentrant function that doesn't take the scanner as the last argument.
  * That's why we explicitly handle the declaration, instead of using our macros.
  */
-
-int xlu__cfg_yylex_init(yyscan_t* ptr_yy_globals)
-
+int yylex_init(yyscan_t* ptr_yy_globals)
 {
     if (ptr_yy_globals == NULL){
         errno = EINVAL;
         return 1;
     }
 
-    *ptr_yy_globals = (yyscan_t) xlu__cfg_yyalloc ( sizeof( struct yyguts_t ), NULL );
+    *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL );
 
     if (*ptr_yy_globals == NULL){
         errno = ENOMEM;
@@ -1989,27 +2217,25 @@ int xlu__cfg_yylex_init(yyscan_t* ptr_yy_globals)
     return yy_init_globals ( *ptr_yy_globals );
 }
 
-/* xlu__cfg_yylex_init_extra has the same functionality as xlu__cfg_yylex_init, but follows the
+/* yylex_init_extra has the same functionality as yylex_init, but follows the
  * convention of taking the scanner as the last argument. Note however, that
  * this is a *pointer* to a scanner, as it will be allocated by this call (and
  * is the reason, too, why this function also must handle its own declaration).
- * The user defined value in the first argument will be available to xlu__cfg_yyalloc in
+ * The user defined value in the first argument will be available to yyalloc in
  * the yyextra field.
  */
-
-int xlu__cfg_yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals )
-
+int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals )
 {
     struct yyguts_t dummy_yyguts;
 
-    xlu__cfg_yyset_extra (yy_user_defined, &dummy_yyguts);
+    yyset_extra (yy_user_defined, &dummy_yyguts);
 
     if (ptr_yy_globals == NULL){
         errno = EINVAL;
         return 1;
     }
 
-    *ptr_yy_globals = (yyscan_t) xlu__cfg_yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
+    *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
 
     if (*ptr_yy_globals == NULL){
         errno = ENOMEM;
@@ -2020,7 +2246,7 @@ int xlu__cfg_yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_glo
     yy_init_globals. Leave at 0x00 for releases. */
     memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
 
-    xlu__cfg_yyset_extra (yy_user_defined, *ptr_yy_globals);
+    yyset_extra (yy_user_defined, *ptr_yy_globals);
 
     return yy_init_globals ( *ptr_yy_globals );
 }
@@ -2029,7 +2255,7 @@ static int yy_init_globals (yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
     /* Initialization is the same as for the non-reentrant scanner.
-     * This function is called from xlu__cfg_yylex_destroy(), so don't allocate here.
+     * This function is called from yylex_destroy(), so don't allocate here.
      */
 
     yyg->yy_buffer_stack = NULL;
@@ -2053,37 +2279,37 @@ static int yy_init_globals (yyscan_t yyscanner)
 #endif
 
     /* For future reference: Set errno on error, since we are called by
-     * xlu__cfg_yylex_init()
+     * yylex_init()
      */
     return 0;
 }
 
-/* xlu__cfg_yylex_destroy is for both reentrant and non-reentrant scanners. */
-int xlu__cfg_yylex_destroy  (yyscan_t yyscanner)
+/* yylex_destroy is for both reentrant and non-reentrant scanners. */
+int yylex_destroy  (yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
     /* Pop the buffer stack, destroying each element. */
 	while(YY_CURRENT_BUFFER){
-		xlu__cfg_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
+		yy_delete_buffer( YY_CURRENT_BUFFER , yyscanner );
 		YY_CURRENT_BUFFER_LVALUE = NULL;
-		xlu__cfg_yypop_buffer_state(yyscanner);
+		yypop_buffer_state(yyscanner);
 	}
 
 	/* Destroy the stack itself. */
-	xlu__cfg_yyfree(yyg->yy_buffer_stack ,yyscanner);
+	yyfree(yyg->yy_buffer_stack , yyscanner);
 	yyg->yy_buffer_stack = NULL;
 
     /* Destroy the start condition stack. */
-        xlu__cfg_yyfree(yyg->yy_start_stack ,yyscanner );
+        yyfree( yyg->yy_start_stack , yyscanner );
         yyg->yy_start_stack = NULL;
 
     /* Reset the globals. This is important in a non-reentrant scanner so the next time
-     * xlu__cfg_yylex() is called, initialization will occur. */
+     * yylex() is called, initialization will occur. */
     yy_init_globals( yyscanner);
 
     /* Destroy the main struct (reentrant only). */
-    xlu__cfg_yyfree ( yyscanner , yyscanner );
+    yyfree ( yyscanner , yyscanner );
     yyscanner = NULL;
     return 0;
 }
@@ -2093,7 +2319,7 @@ int xlu__cfg_yylex_destroy  (yyscan_t yyscanner)
  */
 
 #ifndef yytext_ptr
-static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
+static void yy_flex_strncpy (char* s1, const char * s2, int n , yyscan_t yyscanner)
 {
 	struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 	(void)yyg;
@@ -2105,7 +2331,7 @@ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yysca
 #endif
 
 #ifdef YY_NEED_STRLEN
-static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
+static int yy_flex_strlen (const char * s , yyscan_t yyscanner)
 {
 	int n;
 	for ( n = 0; s[n]; ++n )
@@ -2115,14 +2341,14 @@ static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
 }
 #endif
 
-void *xlu__cfg_yyalloc (yy_size_t  size , yyscan_t yyscanner)
+void *yyalloc (yy_size_t  size , yyscan_t yyscanner)
 {
 	struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 	(void)yyg;
 	return malloc(size);
 }
 
-void *xlu__cfg_yyrealloc  (void * ptr, yy_size_t  size , yyscan_t yyscanner)
+void *yyrealloc  (void * ptr, yy_size_t  size , yyscan_t yyscanner)
 {
 	struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 	(void)yyg;
@@ -2137,11 +2363,11 @@ void *xlu__cfg_yyrealloc  (void * ptr, yy_size_t  size , yyscan_t yyscanner)
 	return realloc(ptr, size);
 }
 
-void xlu__cfg_yyfree (void * ptr , yyscan_t yyscanner)
+void yyfree (void * ptr , yyscan_t yyscanner)
 {
 	struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 	(void)yyg;
-	free( (char *) ptr );	/* see xlu__cfg_yyrealloc() for (char *) cast */
+	free( (char *) ptr );	/* see yyrealloc() for (char *) cast */
 }
 
 #define YYTABLES_NAME "yytables"
diff --git a/tools/libxl/libxlu_cfg_l.h b/tools/libxl/libxlu_cfg_l.h
index 415c3ce089..213ba18b86 100644
--- a/tools/libxl/libxlu_cfg_l.h
+++ b/tools/libxl/libxlu_cfg_l.h
@@ -13,11 +13,245 @@
 #define FLEX_SCANNER
 #define YY_FLEX_MAJOR_VERSION 2
 #define YY_FLEX_MINOR_VERSION 6
-#define YY_FLEX_SUBMINOR_VERSION 1
+#define YY_FLEX_SUBMINOR_VERSION 4
 #if YY_FLEX_SUBMINOR_VERSION > 0
 #define FLEX_BETA
 #endif
 
+#ifdef yy_create_buffer
+#define xlu__cfg_yy_create_buffer_ALREADY_DEFINED
+#else
+#define yy_create_buffer xlu__cfg_yy_create_buffer
+#endif
+
+#ifdef yy_delete_buffer
+#define xlu__cfg_yy_delete_buffer_ALREADY_DEFINED
+#else
+#define yy_delete_buffer xlu__cfg_yy_delete_buffer
+#endif
+
+#ifdef yy_scan_buffer
+#define xlu__cfg_yy_scan_buffer_ALREADY_DEFINED
+#else
+#define yy_scan_buffer xlu__cfg_yy_scan_buffer
+#endif
+
+#ifdef yy_scan_string
+#define xlu__cfg_yy_scan_string_ALREADY_DEFINED
+#else
+#define yy_scan_string xlu__cfg_yy_scan_string
+#endif
+
+#ifdef yy_scan_bytes
+#define xlu__cfg_yy_scan_bytes_ALREADY_DEFINED
+#else
+#define yy_scan_bytes xlu__cfg_yy_scan_bytes
+#endif
+
+#ifdef yy_init_buffer
+#define xlu__cfg_yy_init_buffer_ALREADY_DEFINED
+#else
+#define yy_init_buffer xlu__cfg_yy_init_buffer
+#endif
+
+#ifdef yy_flush_buffer
+#define xlu__cfg_yy_flush_buffer_ALREADY_DEFINED
+#else
+#define yy_flush_buffer xlu__cfg_yy_flush_buffer
+#endif
+
+#ifdef yy_load_buffer_state
+#define xlu__cfg_yy_load_buffer_state_ALREADY_DEFINED
+#else
+#define yy_load_buffer_state xlu__cfg_yy_load_buffer_state
+#endif
+
+#ifdef yy_switch_to_buffer
+#define xlu__cfg_yy_switch_to_buffer_ALREADY_DEFINED
+#else
+#define yy_switch_to_buffer xlu__cfg_yy_switch_to_buffer
+#endif
+
+#ifdef yypush_buffer_state
+#define xlu__cfg_yypush_buffer_state_ALREADY_DEFINED
+#else
+#define yypush_buffer_state xlu__cfg_yypush_buffer_state
+#endif
+
+#ifdef yypop_buffer_state
+#define xlu__cfg_yypop_buffer_state_ALREADY_DEFINED
+#else
+#define yypop_buffer_state xlu__cfg_yypop_buffer_state
+#endif
+
+#ifdef yyensure_buffer_stack
+#define xlu__cfg_yyensure_buffer_stack_ALREADY_DEFINED
+#else
+#define yyensure_buffer_stack xlu__cfg_yyensure_buffer_stack
+#endif
+
+#ifdef yylex
+#define xlu__cfg_yylex_ALREADY_DEFINED
+#else
+#define yylex xlu__cfg_yylex
+#endif
+
+#ifdef yyrestart
+#define xlu__cfg_yyrestart_ALREADY_DEFINED
+#else
+#define yyrestart xlu__cfg_yyrestart
+#endif
+
+#ifdef yylex_init
+#define xlu__cfg_yylex_init_ALREADY_DEFINED
+#else
+#define yylex_init xlu__cfg_yylex_init
+#endif
+
+#ifdef yylex_init_extra
+#define xlu__cfg_yylex_init_extra_ALREADY_DEFINED
+#else
+#define yylex_init_extra xlu__cfg_yylex_init_extra
+#endif
+
+#ifdef yylex_destroy
+#define xlu__cfg_yylex_destroy_ALREADY_DEFINED
+#else
+#define yylex_destroy xlu__cfg_yylex_destroy
+#endif
+
+#ifdef yyget_debug
+#define xlu__cfg_yyget_debug_ALREADY_DEFINED
+#else
+#define yyget_debug xlu__cfg_yyget_debug
+#endif
+
+#ifdef yyset_debug
+#define xlu__cfg_yyset_debug_ALREADY_DEFINED
+#else
+#define yyset_debug xlu__cfg_yyset_debug
+#endif
+
+#ifdef yyget_extra
+#define xlu__cfg_yyget_extra_ALREADY_DEFINED
+#else
+#define yyget_extra xlu__cfg_yyget_extra
+#endif
+
+#ifdef yyset_extra
+#define xlu__cfg_yyset_extra_ALREADY_DEFINED
+#else
+#define yyset_extra xlu__cfg_yyset_extra
+#endif
+
+#ifdef yyget_in
+#define xlu__cfg_yyget_in_ALREADY_DEFINED
+#else
+#define yyget_in xlu__cfg_yyget_in
+#endif
+
+#ifdef yyset_in
+#define xlu__cfg_yyset_in_ALREADY_DEFINED
+#else
+#define yyset_in xlu__cfg_yyset_in
+#endif
+
+#ifdef yyget_out
+#define xlu__cfg_yyget_out_ALREADY_DEFINED
+#else
+#define yyget_out xlu__cfg_yyget_out
+#endif
+
+#ifdef yyset_out
+#define xlu__cfg_yyset_out_ALREADY_DEFINED
+#else
+#define yyset_out xlu__cfg_yyset_out
+#endif
+
+#ifdef yyget_leng
+#define xlu__cfg_yyget_leng_ALREADY_DEFINED
+#else
+#define yyget_leng xlu__cfg_yyget_leng
+#endif
+
+#ifdef yyget_text
+#define xlu__cfg_yyget_text_ALREADY_DEFINED
+#else
+#define yyget_text xlu__cfg_yyget_text
+#endif
+
+#ifdef yyget_lineno
+#define xlu__cfg_yyget_lineno_ALREADY_DEFINED
+#else
+#define yyget_lineno xlu__cfg_yyget_lineno
+#endif
+
+#ifdef yyset_lineno
+#define xlu__cfg_yyset_lineno_ALREADY_DEFINED
+#else
+#define yyset_lineno xlu__cfg_yyset_lineno
+#endif
+
+#ifdef yyget_column
+#define xlu__cfg_yyget_column_ALREADY_DEFINED
+#else
+#define yyget_column xlu__cfg_yyget_column
+#endif
+
+#ifdef yyset_column
+#define xlu__cfg_yyset_column_ALREADY_DEFINED
+#else
+#define yyset_column xlu__cfg_yyset_column
+#endif
+
+#ifdef yywrap
+#define xlu__cfg_yywrap_ALREADY_DEFINED
+#else
+#define yywrap xlu__cfg_yywrap
+#endif
+
+#ifdef yyget_lval
+#define xlu__cfg_yyget_lval_ALREADY_DEFINED
+#else
+#define yyget_lval xlu__cfg_yyget_lval
+#endif
+
+#ifdef yyset_lval
+#define xlu__cfg_yyset_lval_ALREADY_DEFINED
+#else
+#define yyset_lval xlu__cfg_yyset_lval
+#endif
+
+#ifdef yyget_lloc
+#define xlu__cfg_yyget_lloc_ALREADY_DEFINED
+#else
+#define yyget_lloc xlu__cfg_yyget_lloc
+#endif
+
+#ifdef yyset_lloc
+#define xlu__cfg_yyset_lloc_ALREADY_DEFINED
+#else
+#define yyset_lloc xlu__cfg_yyset_lloc
+#endif
+
+#ifdef yyalloc
+#define xlu__cfg_yyalloc_ALREADY_DEFINED
+#else
+#define yyalloc xlu__cfg_yyalloc
+#endif
+
+#ifdef yyrealloc
+#define xlu__cfg_yyrealloc_ALREADY_DEFINED
+#else
+#define yyrealloc xlu__cfg_yyrealloc
+#endif
+
+#ifdef yyfree
+#define xlu__cfg_yyfree_ALREADY_DEFINED
+#else
+#define yyfree xlu__cfg_yyfree
+#endif
+
 /* First, we deal with  platform-specific or compiler-specific issues. */
 
 /* begin standard C headers. */
@@ -88,10 +322,16 @@ typedef unsigned int flex_uint32_t;
 #define UINT32_MAX             (4294967295U)
 #endif
 
+#ifndef SIZE_MAX
+#define SIZE_MAX               (~(size_t)0)
+#endif
+
 #endif /* ! C99 */
 
 #endif /* ! FLEXINT_H */
 
+/* begin standard C++ headers. */
+
 /* TODO: this is always defined, so inline it */
 #define yyconst const
 
@@ -192,21 +432,21 @@ struct yy_buffer_state
 	};
 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
 
-void xlu__cfg_yyrestart (FILE *input_file ,yyscan_t yyscanner );
-void xlu__cfg_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
-YY_BUFFER_STATE xlu__cfg_yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner );
-void xlu__cfg_yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
-void xlu__cfg_yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
-void xlu__cfg_yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
-void xlu__cfg_yypop_buffer_state (yyscan_t yyscanner );
+void yyrestart ( FILE *input_file , yyscan_t yyscanner );
+void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );
+YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner );
+void yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );
+void yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );
+void yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );
+void yypop_buffer_state ( yyscan_t yyscanner );
 
-YY_BUFFER_STATE xlu__cfg_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
-YY_BUFFER_STATE xlu__cfg_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
-YY_BUFFER_STATE xlu__cfg_yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
+YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner );
+YY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner );
+YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner );
 
-void *xlu__cfg_yyalloc (yy_size_t ,yyscan_t yyscanner );
-void *xlu__cfg_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner );
-void xlu__cfg_yyfree (void * ,yyscan_t yyscanner );
+void *yyalloc ( yy_size_t , yyscan_t yyscanner );
+void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner );
+void yyfree ( void * , yyscan_t yyscanner );
 
 #define xlu__cfg_yywrap(yyscanner) (/*CONSTCOND*/1)
 #define YY_SKIP_YYWRAP
@@ -231,50 +471,50 @@ void xlu__cfg_yyfree (void * ,yyscan_t yyscanner );
 #define YY_EXTRA_TYPE void *
 #endif
 
-int xlu__cfg_yylex_init (yyscan_t* scanner);
+int yylex_init (yyscan_t* scanner);
 
-int xlu__cfg_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
+int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner);
 
 /* Accessor methods to globals.
    These are made visible to non-reentrant scanners for convenience. */
 
-int xlu__cfg_yylex_destroy (yyscan_t yyscanner );
+int yylex_destroy ( yyscan_t yyscanner );
 
-int xlu__cfg_yyget_debug (yyscan_t yyscanner );
+int yyget_debug ( yyscan_t yyscanner );
 
-void xlu__cfg_yyset_debug (int debug_flag ,yyscan_t yyscanner );
+void yyset_debug ( int debug_flag , yyscan_t yyscanner );
 
-YY_EXTRA_TYPE xlu__cfg_yyget_extra (yyscan_t yyscanner );
+YY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner );
 
-void xlu__cfg_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
+void yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner );
 
-FILE *xlu__cfg_yyget_in (yyscan_t yyscanner );
+FILE *yyget_in ( yyscan_t yyscanner );
 
-void xlu__cfg_yyset_in  (FILE * _in_str ,yyscan_t yyscanner );
+void yyset_in  ( FILE * _in_str , yyscan_t yyscanner );
 
-FILE *xlu__cfg_yyget_out (yyscan_t yyscanner );
+FILE *yyget_out ( yyscan_t yyscanner );
 
-void xlu__cfg_yyset_out  (FILE * _out_str ,yyscan_t yyscanner );
+void yyset_out  ( FILE * _out_str , yyscan_t yyscanner );
 
-			int xlu__cfg_yyget_leng (yyscan_t yyscanner );
+			int yyget_leng ( yyscan_t yyscanner );
 
-char *xlu__cfg_yyget_text (yyscan_t yyscanner );
+char *yyget_text ( yyscan_t yyscanner );
 
-int xlu__cfg_yyget_lineno (yyscan_t yyscanner );
+int yyget_lineno ( yyscan_t yyscanner );
 
-void xlu__cfg_yyset_lineno (int _line_number ,yyscan_t yyscanner );
+void yyset_lineno ( int _line_number , yyscan_t yyscanner );
 
-int xlu__cfg_yyget_column  (yyscan_t yyscanner );
+int yyget_column  ( yyscan_t yyscanner );
 
-void xlu__cfg_yyset_column (int _column_no ,yyscan_t yyscanner );
+void yyset_column ( int _column_no , yyscan_t yyscanner );
 
-YYSTYPE * xlu__cfg_yyget_lval (yyscan_t yyscanner );
+YYSTYPE * yyget_lval ( yyscan_t yyscanner );
 
-void xlu__cfg_yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
+void yyset_lval ( YYSTYPE * yylval_param , yyscan_t yyscanner );
 
-       YYLTYPE *xlu__cfg_yyget_lloc (yyscan_t yyscanner );
+       YYLTYPE *yyget_lloc ( yyscan_t yyscanner );
     
-        void xlu__cfg_yyset_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner );
+        void yyset_lloc ( YYLTYPE * yylloc_param , yyscan_t yyscanner );
     
 /* Macros after this point can all be overridden by user definitions in
  * section 1.
@@ -282,18 +522,18 @@ void xlu__cfg_yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
 
 #ifndef YY_SKIP_YYWRAP
 #ifdef __cplusplus
-extern "C" int xlu__cfg_yywrap (yyscan_t yyscanner );
+extern "C" int yywrap ( yyscan_t yyscanner );
 #else
-extern int xlu__cfg_yywrap (yyscan_t yyscanner );
+extern int yywrap ( yyscan_t yyscanner );
 #endif
 #endif
 
 #ifndef yytext_ptr
-static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
+static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner);
 #endif
 
 #ifdef YY_NEED_STRLEN
-static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
+static int yy_flex_strlen ( const char * , yyscan_t yyscanner);
 #endif
 
 #ifndef YY_NO_INPUT
@@ -321,10 +561,10 @@ static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
 #ifndef YY_DECL
 #define YY_DECL_IS_OURS 1
 
-extern int xlu__cfg_yylex \
-               (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner);
+extern int yylex \
+               (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner);
 
-#define YY_DECL int xlu__cfg_yylex \
+#define YY_DECL int yylex \
                (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner)
 #endif /* !YY_DECL */
 
@@ -342,8 +582,153 @@ extern int xlu__cfg_yylex \
 #undef YY_DECL
 #endif
 
+#ifndef xlu__cfg_yy_create_buffer_ALREADY_DEFINED
+#undef yy_create_buffer
+#endif
+#ifndef xlu__cfg_yy_delete_buffer_ALREADY_DEFINED
+#undef yy_delete_buffer
+#endif
+#ifndef xlu__cfg_yy_scan_buffer_ALREADY_DEFINED
+#undef yy_scan_buffer
+#endif
+#ifndef xlu__cfg_yy_scan_string_ALREADY_DEFINED
+#undef yy_scan_string
+#endif
+#ifndef xlu__cfg_yy_scan_bytes_ALREADY_DEFINED
+#undef yy_scan_bytes
+#endif
+#ifndef xlu__cfg_yy_init_buffer_ALREADY_DEFINED
+#undef yy_init_buffer
+#endif
+#ifndef xlu__cfg_yy_flush_buffer_ALREADY_DEFINED
+#undef yy_flush_buffer
+#endif
+#ifndef xlu__cfg_yy_load_buffer_state_ALREADY_DEFINED
+#undef yy_load_buffer_state
+#endif
+#ifndef xlu__cfg_yy_switch_to_buffer_ALREADY_DEFINED
+#undef yy_switch_to_buffer
+#endif
+#ifndef xlu__cfg_yypush_buffer_state_ALREADY_DEFINED
+#undef yypush_buffer_state
+#endif
+#ifndef xlu__cfg_yypop_buffer_state_ALREADY_DEFINED
+#undef yypop_buffer_state
+#endif
+#ifndef xlu__cfg_yyensure_buffer_stack_ALREADY_DEFINED
+#undef yyensure_buffer_stack
+#endif
+#ifndef xlu__cfg_yylex_ALREADY_DEFINED
+#undef yylex
+#endif
+#ifndef xlu__cfg_yyrestart_ALREADY_DEFINED
+#undef yyrestart
+#endif
+#ifndef xlu__cfg_yylex_init_ALREADY_DEFINED
+#undef yylex_init
+#endif
+#ifndef xlu__cfg_yylex_init_extra_ALREADY_DEFINED
+#undef yylex_init_extra
+#endif
+#ifndef xlu__cfg_yylex_destroy_ALREADY_DEFINED
+#undef yylex_destroy
+#endif
+#ifndef xlu__cfg_yyget_debug_ALREADY_DEFINED
+#undef yyget_debug
+#endif
+#ifndef xlu__cfg_yyset_debug_ALREADY_DEFINED
+#undef yyset_debug
+#endif
+#ifndef xlu__cfg_yyget_extra_ALREADY_DEFINED
+#undef yyget_extra
+#endif
+#ifndef xlu__cfg_yyset_extra_ALREADY_DEFINED
+#undef yyset_extra
+#endif
+#ifndef xlu__cfg_yyget_in_ALREADY_DEFINED
+#undef yyget_in
+#endif
+#ifndef xlu__cfg_yyset_in_ALREADY_DEFINED
+#undef yyset_in
+#endif
+#ifndef xlu__cfg_yyget_out_ALREADY_DEFINED
+#undef yyget_out
+#endif
+#ifndef xlu__cfg_yyset_out_ALREADY_DEFINED
+#undef yyset_out
+#endif
+#ifndef xlu__cfg_yyget_leng_ALREADY_DEFINED
+#undef yyget_leng
+#endif
+#ifndef xlu__cfg_yyget_text_ALREADY_DEFINED
+#undef yyget_text
+#endif
+#ifndef xlu__cfg_yyget_lineno_ALREADY_DEFINED
+#undef yyget_lineno
+#endif
+#ifndef xlu__cfg_yyset_lineno_ALREADY_DEFINED
+#undef yyset_lineno
+#endif
+#ifndef xlu__cfg_yyget_column_ALREADY_DEFINED
+#undef yyget_column
+#endif
+#ifndef xlu__cfg_yyset_column_ALREADY_DEFINED
+#undef yyset_column
+#endif
+#ifndef xlu__cfg_yywrap_ALREADY_DEFINED
+#undef yywrap
+#endif
+#ifndef xlu__cfg_yyget_lval_ALREADY_DEFINED
+#undef yyget_lval
+#endif
+#ifndef xlu__cfg_yyset_lval_ALREADY_DEFINED
+#undef yyset_lval
+#endif
+#ifndef xlu__cfg_yyget_lloc_ALREADY_DEFINED
+#undef yyget_lloc
+#endif
+#ifndef xlu__cfg_yyset_lloc_ALREADY_DEFINED
+#undef yyset_lloc
+#endif
+#ifndef xlu__cfg_yyalloc_ALREADY_DEFINED
+#undef yyalloc
+#endif
+#ifndef xlu__cfg_yyrealloc_ALREADY_DEFINED
+#undef yyrealloc
+#endif
+#ifndef xlu__cfg_yyfree_ALREADY_DEFINED
+#undef yyfree
+#endif
+#ifndef xlu__cfg_yytext_ALREADY_DEFINED
+#undef yytext
+#endif
+#ifndef xlu__cfg_yyleng_ALREADY_DEFINED
+#undef yyleng
+#endif
+#ifndef xlu__cfg_yyin_ALREADY_DEFINED
+#undef yyin
+#endif
+#ifndef xlu__cfg_yyout_ALREADY_DEFINED
+#undef yyout
+#endif
+#ifndef xlu__cfg_yy_flex_debug_ALREADY_DEFINED
+#undef yy_flex_debug
+#endif
+#ifndef xlu__cfg_yylineno_ALREADY_DEFINED
+#undef yylineno
+#endif
+#ifndef xlu__cfg_yytables_fload_ALREADY_DEFINED
+#undef yytables_fload
+#endif
+#ifndef xlu__cfg_yytables_destroy_ALREADY_DEFINED
+#undef yytables_destroy
+#endif
+#ifndef xlu__cfg_yyTABLES_NAME_ALREADY_DEFINED
+#undef yyTABLES_NAME
+#endif
+
 #line 105 "libxlu_cfg_l.l"
 
-#line 348 "libxlu_cfg_l.h"
+#line 733 "libxlu_cfg_l.h"
 #undef xlu__cfg_yyIN_HEADER
 #endif /* xlu__cfg_yyHEADER_H */
diff --git a/tools/libxl/libxlu_cfg_y.c b/tools/libxl/libxlu_cfg_y.c
index 751daa3842..6d4638afc9 100644
--- a/tools/libxl/libxlu_cfg_y.c
+++ b/tools/libxl/libxlu_cfg_y.c
@@ -1,8 +1,9 @@
-/* A Bison parser, made by GNU Bison 3.0.4.  */
+/* A Bison parser, made by GNU Bison 3.3.2.  */
 
 /* Bison implementation for Yacc-like parsers in C
 
-   Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
+   Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation,
+   Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -40,11 +41,14 @@
    define necessary library symbols; they are noted "INFRINGES ON
    USER NAME SPACE" below.  */
 
+/* Undocumented macros, especially those whose name start with YY_,
+   are private implementation details.  Do not rely on them.  */
+
 /* Identify Bison output.  */
 #define YYBISON 1
 
 /* Bison version.  */
-#define YYBISON_VERSION "3.0.4"
+#define YYBISON_VERSION "3.3.2"
 
 /* Skeleton name.  */
 #define YYSKELETON_NAME "yacc.c"
@@ -67,20 +71,23 @@
 #define yynerrs         xlu__cfg_yynerrs
 
 
-/* Copy the first part of user declarations.  */
-#line 19 "libxlu_cfg_y.y" /* yacc.c:339  */
+/* First part of user prologue.  */
+#line 19 "libxlu_cfg_y.y" /* yacc.c:337  */
 
 #define ctx_scanner ctx->scanner
 #include "libxlu_cfg_i.h"
 #include "libxlu_cfg_l.h"
 
-#line 78 "libxlu_cfg_y.c" /* yacc.c:339  */
-
+#line 82 "libxlu_cfg_y.c" /* yacc.c:337  */
 # ifndef YY_NULLPTR
-#  if defined __cplusplus && 201103L <= __cplusplus
-#   define YY_NULLPTR nullptr
+#  if defined __cplusplus
+#   if 201103L <= __cplusplus
+#    define YY_NULLPTR nullptr
+#   else
+#    define YY_NULLPTR 0
+#   endif
 #  else
-#   define YY_NULLPTR 0
+#   define YY_NULLPTR ((void*)0)
 #  endif
 # endif
 
@@ -122,12 +129,12 @@ extern int xlu__cfg_yydebug;
 
 union YYSTYPE
 {
-#line 25 "libxlu_cfg_y.y" /* yacc.c:355  */
+#line 25 "libxlu_cfg_y.y" /* yacc.c:352  */
 
   char *string;
   XLU_ConfigValue *value;
 
-#line 131 "libxlu_cfg_y.c" /* yacc.c:355  */
+#line 138 "libxlu_cfg_y.c" /* yacc.c:352  */
 };
 
 typedef union YYSTYPE YYSTYPE;
@@ -155,9 +162,7 @@ int xlu__cfg_yyparse (CfgParseContext *ctx);
 
 #endif /* !YY_XLU_CFG_YY_LIBXLU_CFG_Y_H_INCLUDED  */
 
-/* Copy the second part of user declarations.  */
 
-#line 161 "libxlu_cfg_y.c" /* yacc.c:358  */
 
 #ifdef short
 # undef short
@@ -178,13 +183,13 @@ typedef signed char yytype_int8;
 #ifdef YYTYPE_UINT16
 typedef YYTYPE_UINT16 yytype_uint16;
 #else
-typedef unsigned short int yytype_uint16;
+typedef unsigned short yytype_uint16;
 #endif
 
 #ifdef YYTYPE_INT16
 typedef YYTYPE_INT16 yytype_int16;
 #else
-typedef short int yytype_int16;
+typedef short yytype_int16;
 #endif
 
 #ifndef YYSIZE_T
@@ -196,7 +201,7 @@ typedef short int yytype_int16;
 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
 #  define YYSIZE_T size_t
 # else
-#  define YYSIZE_T unsigned int
+#  define YYSIZE_T unsigned
 # endif
 #endif
 
@@ -232,15 +237,6 @@ typedef short int yytype_int16;
 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
 #endif
 
-#if !defined _Noreturn \
-     && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
-# if defined _MSC_VER && 1200 <= _MSC_VER
-#  define _Noreturn __declspec (noreturn)
-# else
-#  define _Noreturn YY_ATTRIBUTE ((__noreturn__))
-# endif
-#endif
-
 /* Suppress unused-variable warnings by "using" E.  */
 #if ! defined lint || defined __GNUC__
 # define YYUSE(E) ((void) (E))
@@ -248,7 +244,7 @@ typedef short int yytype_int16;
 # define YYUSE(E) /* empty */
 #endif
 
-#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
+#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
 /* Suppress an incorrect diagnostic about yylval being uninitialized.  */
 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
     _Pragma ("GCC diagnostic push") \
@@ -412,16 +408,16 @@ union yyalloc
 /* YYNSTATES -- Number of states.  */
 #define YYNSTATES  32
 
-/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
-   by yylex, with out-of-bounds checking.  */
 #define YYUNDEFTOK  2
 #define YYMAXUTOK   262
 
+/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
+   as returned by yylex, with out-of-bounds checking.  */
 #define YYTRANSLATE(YYX)                                                \
-  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
+  ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
 
 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
-   as returned by yylex, without out-of-bounds checking.  */
+   as returned by yylex.  */
 static const yytype_uint8 yytranslate[] =
 {
        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
@@ -586,22 +582,22 @@ static const yytype_uint8 yyr2[] =
 
 #define YYRECOVERING()  (!!yyerrstatus)
 
-#define YYBACKUP(Token, Value)                                  \
-do                                                              \
-  if (yychar == YYEMPTY)                                        \
-    {                                                           \
-      yychar = (Token);                                         \
-      yylval = (Value);                                         \
-      YYPOPSTACK (yylen);                                       \
-      yystate = *yyssp;                                         \
-      goto yybackup;                                            \
-    }                                                           \
-  else                                                          \
-    {                                                           \
-      yyerror (&yylloc, ctx, YY_("syntax error: cannot back up")); \
-      YYERROR;                                                  \
-    }                                                           \
-while (0)
+#define YYBACKUP(Token, Value)                                    \
+  do                                                              \
+    if (yychar == YYEMPTY)                                        \
+      {                                                           \
+        yychar = (Token);                                         \
+        yylval = (Value);                                         \
+        YYPOPSTACK (yylen);                                       \
+        yystate = *yyssp;                                         \
+        goto yybackup;                                            \
+      }                                                           \
+    else                                                          \
+      {                                                           \
+        yyerror (&yylloc, ctx, YY_("syntax error: cannot back up")); \
+        YYERROR;                                                  \
+      }                                                           \
+  while (0)
 
 /* Error token number */
 #define YYTERROR        1
@@ -660,10 +656,10 @@ do {                                            \
 /* Print *YYLOCP on YYO.  Private, do not rely on its existence. */
 
 YY_ATTRIBUTE_UNUSED
-static unsigned
+static int
 yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
 {
-  unsigned res = 0;
+  int res = 0;
   int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
   if (0 <= yylocp->first_line)
     {
@@ -706,41 +702,41 @@ do {                                                                      \
 } while (0)
 
 
-/*----------------------------------------.
-| Print this symbol's value on YYOUTPUT.  |
-`----------------------------------------*/
+/*-----------------------------------.
+| Print this symbol's value on YYO.  |
+`-----------------------------------*/
 
 static void
-yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, CfgParseContext *ctx)
+yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, CfgParseContext *ctx)
 {
-  FILE *yyo = yyoutput;
-  YYUSE (yyo);
+  FILE *yyoutput = yyo;
+  YYUSE (yyoutput);
   YYUSE (yylocationp);
   YYUSE (ctx);
   if (!yyvaluep)
     return;
 # ifdef YYPRINT
   if (yytype < YYNTOKENS)
-    YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
+    YYPRINT (yyo, yytoknum[yytype], *yyvaluep);
 # endif
   YYUSE (yytype);
 }
 
 
-/*--------------------------------.
-| Print this symbol on YYOUTPUT.  |
-`--------------------------------*/
+/*---------------------------.
+| Print this symbol on YYO.  |
+`---------------------------*/
 
 static void
-yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, CfgParseContext *ctx)
+yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, CfgParseContext *ctx)
 {
-  YYFPRINTF (yyoutput, "%s %s (",
+  YYFPRINTF (yyo, "%s %s (",
              yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
 
-  YY_LOCATION_PRINT (yyoutput, *yylocationp);
-  YYFPRINTF (yyoutput, ": ");
-  yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, ctx);
-  YYFPRINTF (yyoutput, ")");
+  YY_LOCATION_PRINT (yyo, *yylocationp);
+  YYFPRINTF (yyo, ": ");
+  yy_symbol_value_print (yyo, yytype, yyvaluep, yylocationp, ctx);
+  YYFPRINTF (yyo, ")");
 }
 
 /*------------------------------------------------------------------.
@@ -774,7 +770,7 @@ do {                                                            \
 static void
 yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, CfgParseContext *ctx)
 {
-  unsigned long int yylno = yyrline[yyrule];
+  unsigned long yylno = yyrline[yyrule];
   int yynrhs = yyr2[yyrule];
   int yyi;
   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
@@ -785,7 +781,7 @@ yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule
       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
       yy_symbol_print (stderr,
                        yystos[yyssp[yyi + 1 - yynrhs]],
-                       &(yyvsp[(yyi + 1) - (yynrhs)])
+                       &yyvsp[(yyi + 1) - (yynrhs)]
                        , &(yylsp[(yyi + 1) - (yynrhs)])                       , ctx);
       YYFPRINTF (stderr, "\n");
     }
@@ -889,7 +885,10 @@ yytnamerr (char *yyres, const char *yystr)
           case '\\':
             if (*++yyp != '\\')
               goto do_not_strip_quotes;
-            /* Fall through.  */
+            else
+              goto append;
+
+          append:
           default:
             if (yyres)
               yyres[yyn] = *yyp;
@@ -907,7 +906,7 @@ yytnamerr (char *yyres, const char *yystr)
   if (! yyres)
     return yystrlen (yystr);
 
-  return yystpcpy (yyres, yystr) - yyres;
+  return (YYSIZE_T) (yystpcpy (yyres, yystr) - yyres);
 }
 # endif
 
@@ -985,10 +984,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
                 yyarg[yycount++] = yytname[yyx];
                 {
                   YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
-                  if (! (yysize <= yysize1
-                         && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+                  if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
+                    yysize = yysize1;
+                  else
                     return 2;
-                  yysize = yysize1;
                 }
               }
         }
@@ -1000,6 +999,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
       case N:                               \
         yyformat = S;                       \
       break
+    default: /* Avoid compiler warnings. */
       YYCASE_(0, YY_("syntax error"));
       YYCASE_(1, YY_("syntax error, unexpected %s"));
       YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
@@ -1011,9 +1011,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
 
   {
     YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
-    if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+    if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
+      yysize = yysize1;
+    else
       return 2;
-    yysize = yysize1;
   }
 
   if (*yymsg_alloc < yysize)
@@ -1064,49 +1065,48 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocatio
   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
   switch (yytype)
     {
-          case 3: /* IDENT  */
+    case 3: /* IDENT  */
 #line 40 "libxlu_cfg_y.y" /* yacc.c:1257  */
       { free(((*yyvaluep).string)); }
-#line 1071 "libxlu_cfg_y.c" /* yacc.c:1257  */
+#line 1072 "libxlu_cfg_y.c" /* yacc.c:1257  */
         break;
 
     case 4: /* STRING  */
 #line 40 "libxlu_cfg_y.y" /* yacc.c:1257  */
       { free(((*yyvaluep).string)); }
-#line 1077 "libxlu_cfg_y.c" /* yacc.c:1257  */
+#line 1078 "libxlu_cfg_y.c" /* yacc.c:1257  */
         break;
 
     case 5: /* NUMBER  */
 #line 40 "libxlu_cfg_y.y" /* yacc.c:1257  */
       { free(((*yyvaluep).string)); }
-#line 1083 "libxlu_cfg_y.c" /* yacc.c:1257  */
+#line 1084 "libxlu_cfg_y.c" /* yacc.c:1257  */
         break;
 
     case 19: /* value  */
 #line 44 "libxlu_cfg_y.y" /* yacc.c:1257  */
       { xlu__cfg_value_free(((*yyvaluep).value)); }
-#line 1089 "libxlu_cfg_y.c" /* yacc.c:1257  */
+#line 1090 "libxlu_cfg_y.c" /* yacc.c:1257  */
         break;
 
     case 20: /* atom  */
 #line 40 "libxlu_cfg_y.y" /* yacc.c:1257  */
       { free(((*yyvaluep).string)); }
-#line 1095 "libxlu_cfg_y.c" /* yacc.c:1257  */
+#line 1096 "libxlu_cfg_y.c" /* yacc.c:1257  */
         break;
 
     case 21: /* valuelist  */
 #line 44 "libxlu_cfg_y.y" /* yacc.c:1257  */
       { xlu__cfg_value_free(((*yyvaluep).value)); }
-#line 1101 "libxlu_cfg_y.c" /* yacc.c:1257  */
+#line 1102 "libxlu_cfg_y.c" /* yacc.c:1257  */
         break;
 
     case 22: /* values  */
 #line 44 "libxlu_cfg_y.y" /* yacc.c:1257  */
       { xlu__cfg_value_free(((*yyvaluep).value)); }
-#line 1107 "libxlu_cfg_y.c" /* yacc.c:1257  */
+#line 1108 "libxlu_cfg_y.c" /* yacc.c:1257  */
         break;
 
-
       default:
         break;
     }
@@ -1212,23 +1212,31 @@ YYLTYPE yylloc = yyloc_default;
   yylsp[0] = yylloc;
   goto yysetstate;
 
+
 /*------------------------------------------------------------.
-| yynewstate -- Push a new state, which is found in yystate.  |
+| yynewstate -- push a new state, which is found in yystate.  |
 `------------------------------------------------------------*/
- yynewstate:
+yynewstate:
   /* In all cases, when you get here, the value and location stacks
      have just been pushed.  So pushing a state here evens the stacks.  */
   yyssp++;
 
- yysetstate:
-  *yyssp = yystate;
+
+/*--------------------------------------------------------------------.
+| yynewstate -- set current state (the top of the stack) to yystate.  |
+`--------------------------------------------------------------------*/
+yysetstate:
+  *yyssp = (yytype_int16) yystate;
 
   if (yyss + yystacksize - 1 <= yyssp)
+#if !defined yyoverflow && !defined YYSTACK_RELOCATE
+    goto yyexhaustedlab;
+#else
     {
       /* Get the current used size of the three stacks, in elements.  */
-      YYSIZE_T yysize = yyssp - yyss + 1;
+      YYSIZE_T yysize = (YYSIZE_T) (yyssp - yyss + 1);
 
-#ifdef yyoverflow
+# if defined yyoverflow
       {
         /* Give user a chance to reallocate the stack.  Use copies of
            these so that the &'s don't force the real ones into
@@ -1246,15 +1254,11 @@ YYLTYPE yylloc = yyloc_default;
                     &yyvs1, yysize * sizeof (*yyvsp),
                     &yyls1, yysize * sizeof (*yylsp),
                     &yystacksize);
-
-        yyls = yyls1;
         yyss = yyss1;
         yyvs = yyvs1;
+        yyls = yyls1;
       }
-#else /* no yyoverflow */
-# ifndef YYSTACK_RELOCATE
-      goto yyexhaustedlab;
-# else
+# else /* defined YYSTACK_RELOCATE */
       /* Extend the stack our own way.  */
       if (YYMAXDEPTH <= yystacksize)
         goto yyexhaustedlab;
@@ -1271,23 +1275,23 @@ YYLTYPE yylloc = yyloc_default;
         YYSTACK_RELOCATE (yyss_alloc, yyss);
         YYSTACK_RELOCATE (yyvs_alloc, yyvs);
         YYSTACK_RELOCATE (yyls_alloc, yyls);
-#  undef YYSTACK_RELOCATE
+# undef YYSTACK_RELOCATE
         if (yyss1 != yyssa)
           YYSTACK_FREE (yyss1);
       }
 # endif
-#endif /* no yyoverflow */
 
       yyssp = yyss + yysize - 1;
       yyvsp = yyvs + yysize - 1;
       yylsp = yyls + yysize - 1;
 
       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
-                  (unsigned long int) yystacksize));
+                  (unsigned long) yystacksize));
 
       if (yyss + yystacksize - 1 <= yyssp)
         YYABORT;
     }
+#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
 
   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
 
@@ -1296,11 +1300,11 @@ YYLTYPE yylloc = yyloc_default;
 
   goto yybackup;
 
+
 /*-----------.
 | yybackup.  |
 `-----------*/
 yybackup:
-
   /* Do appropriate processing given the current state.  Read a
      lookahead token if we need one and don't already have one.  */
 
@@ -1373,7 +1377,7 @@ yydefault:
 
 
 /*-----------------------------.
-| yyreduce -- Do a reduction.  |
+| yyreduce -- do a reduction.  |
 `-----------------------------*/
 yyreduce:
   /* yyn is the number of a rule to reduce with.  */
@@ -1389,79 +1393,80 @@ yyreduce:
      GCC warning that YYVAL may be used uninitialized.  */
   yyval = yyvsp[1-yylen];
 
-  /* Default location.  */
+  /* Default location. */
   YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
+  yyerror_range[1] = yyloc;
   YY_REDUCE_PRINT (yyn);
   switch (yyn)
     {
         case 9:
-#line 58 "libxlu_cfg_y.y" /* yacc.c:1646  */
+#line 58 "libxlu_cfg_y.y" /* yacc.c:1652  */
     { xlu__cfg_set_store(ctx,(yyvsp[-2].string),XLU_OP_ASSIGNMENT,(yyvsp[0].value),(yylsp[0]).first_line); }
-#line 1401 "libxlu_cfg_y.c" /* yacc.c:1646  */
+#line 1406 "libxlu_cfg_y.c" /* yacc.c:1652  */
     break;
 
   case 10:
-#line 59 "libxlu_cfg_y.y" /* yacc.c:1646  */
+#line 59 "libxlu_cfg_y.y" /* yacc.c:1652  */
     { xlu__cfg_set_store(ctx,(yyvsp[-2].string),XLU_OP_ADDITION,(yyvsp[0].value),(yylsp[0]).first_line); }
-#line 1407 "libxlu_cfg_y.c" /* yacc.c:1646  */
+#line 1412 "libxlu_cfg_y.c" /* yacc.c:1652  */
     break;
 
   case 13:
-#line 64 "libxlu_cfg_y.y" /* yacc.c:1646  */
+#line 64 "libxlu_cfg_y.y" /* yacc.c:1652  */
     { (yyval.value)= xlu__cfg_string_mk(ctx,(yyvsp[0].string),&(yylsp[0])); }
-#line 1413 "libxlu_cfg_y.c" /* yacc.c:1646  */
+#line 1418 "libxlu_cfg_y.c" /* yacc.c:1652  */
     break;
 
   case 14:
-#line 65 "libxlu_cfg_y.y" /* yacc.c:1646  */
+#line 65 "libxlu_cfg_y.y" /* yacc.c:1652  */
     { (yyval.value)= (yyvsp[-1].value); }
-#line 1419 "libxlu_cfg_y.c" /* yacc.c:1646  */
+#line 1424 "libxlu_cfg_y.c" /* yacc.c:1652  */
     break;
 
   case 15:
-#line 67 "libxlu_cfg_y.y" /* yacc.c:1646  */
+#line 67 "libxlu_cfg_y.y" /* yacc.c:1652  */
     { (yyval.string)= (yyvsp[0].string); }
-#line 1425 "libxlu_cfg_y.c" /* yacc.c:1646  */
+#line 1430 "libxlu_cfg_y.c" /* yacc.c:1652  */
     break;
 
   case 16:
-#line 68 "libxlu_cfg_y.y" /* yacc.c:1646  */
+#line 68 "libxlu_cfg_y.y" /* yacc.c:1652  */
     { (yyval.string)= (yyvsp[0].string); }
-#line 1431 "libxlu_cfg_y.c" /* yacc.c:1646  */
+#line 1436 "libxlu_cfg_y.c" /* yacc.c:1652  */
     break;
 
   case 17:
-#line 70 "libxlu_cfg_y.y" /* yacc.c:1646  */
+#line 70 "libxlu_cfg_y.y" /* yacc.c:1652  */
     { (yyval.value)= xlu__cfg_list_mk(ctx,NULL,&yylloc); }
-#line 1437 "libxlu_cfg_y.c" /* yacc.c:1646  */
+#line 1442 "libxlu_cfg_y.c" /* yacc.c:1652  */
     break;
 
   case 18:
-#line 71 "libxlu_cfg_y.y" /* yacc.c:1646  */
+#line 71 "libxlu_cfg_y.y" /* yacc.c:1652  */
     { (yyval.value)= (yyvsp[0].value); }
-#line 1443 "libxlu_cfg_y.c" /* yacc.c:1646  */
+#line 1448 "libxlu_cfg_y.c" /* yacc.c:1652  */
     break;
 
   case 19:
-#line 72 "libxlu_cfg_y.y" /* yacc.c:1646  */
+#line 72 "libxlu_cfg_y.y" /* yacc.c:1652  */
     { (yyval.value)= (yyvsp[-2].value); }
-#line 1449 "libxlu_cfg_y.c" /* yacc.c:1646  */
+#line 1454 "libxlu_cfg_y.c" /* yacc.c:1652  */
     break;
 
   case 20:
-#line 74 "libxlu_cfg_y.y" /* yacc.c:1646  */
+#line 74 "libxlu_cfg_y.y" /* yacc.c:1652  */
     { (yyval.value)= xlu__cfg_list_mk(ctx,(yyvsp[-1].value),&(yylsp[-1])); }
-#line 1455 "libxlu_cfg_y.c" /* yacc.c:1646  */
+#line 1460 "libxlu_cfg_y.c" /* yacc.c:1652  */
     break;
 
   case 21:
-#line 75 "libxlu_cfg_y.y" /* yacc.c:1646  */
+#line 75 "libxlu_cfg_y.y" /* yacc.c:1652  */
     { xlu__cfg_list_append(ctx,(yyvsp[-4].value),(yyvsp[-1].value)); (yyval.value)= (yyvsp[-4].value); }
-#line 1461 "libxlu_cfg_y.c" /* yacc.c:1646  */
+#line 1466 "libxlu_cfg_y.c" /* yacc.c:1652  */
     break;
 
 
-#line 1465 "libxlu_cfg_y.c" /* yacc.c:1646  */
+#line 1470 "libxlu_cfg_y.c" /* yacc.c:1652  */
       default: break;
     }
   /* User semantic actions sometimes alter yychar, and that requires
@@ -1487,14 +1492,13 @@ yyreduce:
   /* Now 'shift' the result of the reduction.  Determine what state
      that goes to, based on the state we popped back to and the rule
      number reduced by.  */
-
-  yyn = yyr1[yyn];
-
-  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
-  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
-    yystate = yytable[yystate];
-  else
-    yystate = yydefgoto[yyn - YYNTOKENS];
+  {
+    const int yylhs = yyr1[yyn] - YYNTOKENS;
+    const int yyi = yypgoto[yylhs] + *yyssp;
+    yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
+               ? yytable[yyi]
+               : yydefgoto[yylhs]);
+  }
 
   goto yynewstate;
 
@@ -1577,14 +1581,11 @@ yyerrlab:
 | yyerrorlab -- error raised explicitly by YYERROR.  |
 `---------------------------------------------------*/
 yyerrorlab:
+  /* Pacify compilers when the user code never invokes YYERROR and the
+     label yyerrorlab therefore never appears in user code.  */
+  if (0)
+    YYERROR;
 
-  /* Pacify compilers like GCC when the user code never invokes
-     YYERROR and the label yyerrorlab therefore never appears in user
-     code.  */
-  if (/*CONSTCOND*/ 0)
-     goto yyerrorlab;
-
-  yyerror_range[1] = yylsp[1-yylen];
   /* Do not reclaim the symbols of the rule whose action triggered
      this YYERROR.  */
   YYPOPSTACK (yylen);
@@ -1650,6 +1651,7 @@ yyacceptlab:
   yyresult = 0;
   goto yyreturn;
 
+
 /*-----------------------------------.
 | yyabortlab -- YYABORT comes here.  |
 `-----------------------------------*/
@@ -1657,6 +1659,7 @@ yyabortlab:
   yyresult = 1;
   goto yyreturn;
 
+
 #if !defined yyoverflow || YYERROR_VERBOSE
 /*-------------------------------------------------.
 | yyexhaustedlab -- memory exhaustion comes here.  |
@@ -1667,6 +1670,10 @@ yyexhaustedlab:
   /* Fall through.  */
 #endif
 
+
+/*-----------------------------------------------------.
+| yyreturn -- parsing is finished, return the result.  |
+`-----------------------------------------------------*/
 yyreturn:
   if (yychar != YYEMPTY)
     {
diff --git a/tools/libxl/libxlu_cfg_y.h b/tools/libxl/libxlu_cfg_y.h
index 9691bf1350..1233cb94fc 100644
--- a/tools/libxl/libxlu_cfg_y.h
+++ b/tools/libxl/libxlu_cfg_y.h
@@ -1,8 +1,9 @@
-/* A Bison parser, made by GNU Bison 3.0.4.  */
+/* A Bison parser, made by GNU Bison 3.3.2.  */
 
 /* Bison interface for Yacc-like parsers in C
 
-   Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
+   Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation,
+   Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -30,6 +31,9 @@
    This special exception was added by the Free Software Foundation in
    version 2.2 of Bison.  */
 
+/* Undocumented macros, especially those whose name start with YY_,
+   are private implementation details.  Do not rely on them.  */
+
 #ifndef YY_XLU_CFG_YY_LIBXLU_CFG_Y_H_INCLUDED
 # define YY_XLU_CFG_YY_LIBXLU_CFG_Y_H_INCLUDED
 /* Debug traces.  */
@@ -58,12 +62,12 @@ extern int xlu__cfg_yydebug;
 
 union YYSTYPE
 {
-#line 25 "libxlu_cfg_y.y" /* yacc.c:1909  */
+#line 25 "libxlu_cfg_y.y" /* yacc.c:1921  */
 
   char *string;
   XLU_ConfigValue *value;
 
-#line 67 "libxlu_cfg_y.h" /* yacc.c:1909  */
+#line 71 "libxlu_cfg_y.h" /* yacc.c:1921  */
 };
 
 typedef union YYSTYPE YYSTYPE;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sat Jun 20 00:55:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 20 Jun 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 1jmRmj-0003UL-4m; Sat, 20 Jun 2020 00: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=XOwH=AB=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jmRmi-0003UG-8I
 for xen-changelog@lists.xenproject.org; Sat, 20 Jun 2020 00:55:04 +0000
X-Inumbo-ID: ac478b42-b290-11ea-bc2f-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id ac478b42-b290-11ea-bc2f-12813bfff9fa;
 Sat, 20 Jun 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=1hNFCSPmm3RbffTnbq58N47T4tcRzPJcEUMtlV7SFzQ=; b=1FRtp5XE0jAIk7Rv8epsGR2zFD
 vJgmvJf0AuxzpFXbqRhI6wKvLGWrAG90J2NqI35Nq1i6quj2R68LP+kF0XPu9sm2KqWCFzQ02qEVW
 /xBdfiZlLoMEU1VcbFrmDu2czlGqHjbp6yrc4PYxPjGRnJZ6Rs7j22QWyTnMvtC7t9l8=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jmRmg-0004lG-6m
 for xen-changelog@lists.xenproject.org; Sat, 20 Jun 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 1jmRmg-0000be-5X
 for xen-changelog@lists.xenproject.org; Sat, 20 Jun 2020 00:55:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.9] x86/spec-ctrl: CPUID/MSR definitions for Special
 Register Buffer Data Sampling
Message-Id: <E1jmRmg-0000be-5X@xenbits.xenproject.org>
Date: Sat, 20 Jun 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 04af886e1bc87bb321339417c5588d12f506003c
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 8 19:47:46 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jun 9 17:46:49 2020 +0100

    x86/spec-ctrl: CPUID/MSR definitions for Special Register Buffer Data Sampling
    
    This is part of XSA-320 / CVE-2020-0543
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Wei Liu <wl@xen.org>
    (cherry picked from commit caab85ab58c0cdf74ab070a5de5c4df89f509ff3)
---
 docs/misc/xen-command-line.markdown         | 8 ++++----
 tools/libxl/libxl_cpuid.c                   | 1 +
 tools/misc/xen-cpuid.c                      | 3 ++-
 xen/arch/x86/cpuid.c                        | 5 +++++
 xen/arch/x86/hvm/hvm.c                      | 2 ++
 xen/arch/x86/spec_ctrl.c                    | 3 ++-
 xen/arch/x86/traps.c                        | 2 ++
 xen/include/asm-x86/msr-index.h             | 3 +++
 xen/include/public/arch-x86/cpufeatureset.h | 1 +
 9 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown
index 80048d4230..177decaece 100644
--- a/docs/misc/xen-command-line.markdown
+++ b/docs/misc/xen-command-line.markdown
@@ -456,10 +456,10 @@ accounting for hardware capabilities as enumerated via CPUID.
 
 Currently accepted:
 
-The Speculation Control hardware features `md-clear`, `ibrsb`, `stibp`, `ibpb`,
-`l1d-flush` and `ssbd` are used by default if available and applicable.  They can
-be ignored, e.g. `no-ibrsb`, at which point Xen won't use them itself, and
-won't offer them to guests.
+The Speculation Control hardware features `srbds-ctrl`, `md-clear`, `ibrsb`,
+`stibp`, `ibpb`, `l1d-flush` and `ssbd` are used by default if available and
+applicable.  They can be ignored, e.g. `no-ibrsb`, at which point Xen won't
+use them itself, and won't offer them to guests.
 
 ### cpuid\_mask\_cpu (AMD only)
 > `= fam_0f_rev_c | fam_0f_rev_d | fam_0f_rev_e | fam_0f_rev_f | fam_0f_rev_g | fam_10_rev_b | fam_10_rev_c | fam_11_rev_b`
diff --git a/tools/libxl/libxl_cpuid.c b/tools/libxl/libxl_cpuid.c
index 20d060251a..5a2c67fcac 100644
--- a/tools/libxl/libxl_cpuid.c
+++ b/tools/libxl/libxl_cpuid.c
@@ -158,6 +158,7 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
         {"de",           0x00000001, NA, CPUID_REG_EDX,  2,  1},
         {"vme",          0x00000001, NA, CPUID_REG_EDX,  1,  1},
         {"fpu",          0x00000001, NA, CPUID_REG_EDX,  0,  1},
+        {"srbds-ctrl",   0x00000007,  0, CPUID_REG_EDX,  9,  1},
         {"md-clear",     0x00000007,  0, CPUID_REG_EDX, 10,  1},
         {"ibrsb",        0x00000007,  0, CPUID_REG_EDX, 26,  1},
         {"stibp",        0x00000007,  0, CPUID_REG_EDX, 27,  1},
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index 72c67d0e77..b853656404 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -157,8 +157,9 @@ static const char *str_7d0[32] =
 
     [ 2] = "avx512_4vnniw", [ 3] = "avx512_4fmaps",
 
-    [4 ... 9] = "REZ",
+    [4 ... 7] = "REZ",
 
+    [ 8] = "REZ",           [ 9] = "srbds-ctrl",
     [10] = "md-clear",      [11] = "REZ",
     [12] = "REZ",           [13] = "tsx-force-abort",
 
diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 9aaf8b8283..b4988ba527 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -58,6 +58,11 @@ static int __init parse_xen_cpuid(const char *s)
             if ( !val )
                 setup_clear_cpu_cap(X86_FEATURE_SSBD);
         }
+        else if ( (val = parse_boolean("srbds-ctrl", s, ss)) >= 0 )
+        {
+            if ( !val )
+                setup_clear_cpu_cap(X86_FEATURE_SRBDS_CTRL);
+        }
         else
             rc = -EINVAL;
 
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 2aa9ac06a4..e03c221f54 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -3445,6 +3445,7 @@ int hvm_msr_read_intercept(unsigned int msr, uint64_t *msr_content)
         /* Write-only */
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
+    case MSR_MCU_OPT_CTRL:
         /* Not offered to guests. */
         goto gp_fault;
 
@@ -3671,6 +3672,7 @@ int hvm_msr_write_intercept(unsigned int msr, uint64_t msr_content,
         /* Read-only */
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
+    case MSR_MCU_OPT_CTRL:
         /* Not offered to guests. */
         goto gp_fault;
 
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index f44df6ff43..e212a20127 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -348,12 +348,13 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
     printk("Speculative mitigation facilities:\n");
 
     /* Hardware features which pertain to speculative mitigations. */
-    printk("  Hardware features:%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
+    printk("  Hardware features:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
            (_7d0 & cpufeat_mask(X86_FEATURE_IBRSB)) ? " IBRS/IBPB" : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_STIBP)) ? " STIBP"     : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_L1D_FLUSH)) ? " L1D_FLUSH" : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_SSBD))  ? " SSBD"      : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_MD_CLEAR)) ? " MD_CLEAR" : "",
+           (_7d0 & cpufeat_mask(X86_FEATURE_SRBDS_CTRL)) ? " SRBDS_CTRL" : "",
            (e8b  & cpufeat_mask(X86_FEATURE_IBPB))  ? " IBPB"      : "",
            (caps & ARCH_CAPABILITIES_IBRS_ALL)      ? " IBRS_ALL"  : "",
            (caps & ARCH_CAPABILITIES_RDCL_NO)       ? " RDCL_NO"   : "",
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 9b4bb6a009..6ea582c393 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -2655,6 +2655,7 @@ static int priv_op_read_msr(unsigned int reg, uint64_t *val,
         /* Write-only */
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
+    case MSR_MCU_OPT_CTRL:
         /* Not offered to guests. */
         break;
 
@@ -2880,6 +2881,7 @@ static int priv_op_write_msr(unsigned int reg, uint64_t val,
         /* The MSR is read-only. */
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
+    case MSR_MCU_OPT_CTRL:
         /* Not offered to guests. */
         break;
 
diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h
index 5d636cc250..d77aeb9afa 100644
--- a/xen/include/asm-x86/msr-index.h
+++ b/xen/include/asm-x86/msr-index.h
@@ -176,6 +176,9 @@
 #define MSR_IA32_VMX_TRUE_ENTRY_CTLS            0x490
 #define MSR_IA32_VMX_VMFUNC                     0x491
 
+#define MSR_MCU_OPT_CTRL                    0x00000123
+#define  MCU_OPT_CTRL_RNGDS_MITG_DIS        (_AC(1, ULL) <<  0)
+
 /* K7/K8 MSRs. Not complete. See the architecture manual for a more
    complete list. */
 #define MSR_K7_EVNTSEL0			0xc0010000
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 000a941e50..c75014f4e3 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -241,6 +241,7 @@ XEN_CPUFEATURE(IBPB,          8*32+12) /*A  IBPB support only (no IBRS, used by
 /* 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(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 */
 XEN_CPUFEATURE(IBRSB,         9*32+26) /*A  IBRS and IBPB support (used by Intel) */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.9


From xen-changelog-bounces@lists.xenproject.org Sat Jun 20 00:55:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 20 Jun 2020 00: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 1jmRms-0003VA-6R; Sat, 20 Jun 2020 00: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=XOwH=AB=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jmRmr-0003V5-HA
 for xen-changelog@lists.xenproject.org; Sat, 20 Jun 2020 00:55:13 +0000
X-Inumbo-ID: b2420c5c-b290-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id b2420c5c-b290-11ea-bca7-bc764e2007e4;
 Sat, 20 Jun 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=4fjRo4BflmE1ct7LfDvLpmc7yje/FzGSssdg/IzrPJc=; b=s5g1BZ7xgpuQqUEz5FJRZW0u8P
 uzK0Zwu+hyOCuvyFW4sLPFq5wsMgQzLTgCK2TfLoSJLRc53M49PyxknCbb6f/b9ib8W0u4nA1OT6q
 mCxNfaMusnVFCfRqZ6rn93oihLZXwoQjaYpH0xiW8hpBFyfR+XZIWPd7AZgoJJUolAx4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jmRmq-0004ll-AN
 for xen-changelog@lists.xenproject.org; Sat, 20 Jun 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 1jmRmq-0000cG-9P
 for xen-changelog@lists.xenproject.org; Sat, 20 Jun 2020 00:55:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.9] x86/spec-ctrl: Mitigate the Special Register Buffer
 Data Sampling sidechannel
Message-Id: <E1jmRmq-0000cG-9P@xenbits.xenproject.org>
Date: Sat, 20 Jun 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 ad0c1a0023077ee03d325a6f84bb654150539f49
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 8 19:47:46 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jun 9 17:46:56 2020 +0100

    x86/spec-ctrl: Mitigate the Special Register Buffer Data Sampling sidechannel
    
    See patch documentation and comments.
    
    This is part of XSA-320 / CVE-2020-0543
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 6a49b9a7920c82015381740905582b666160d955)
---
 docs/misc/xen-command-line.markdown |  8 +++++++-
 xen/arch/x86/acpi/power.c           |  3 +++
 xen/arch/x86/smpboot.c              |  8 +++++---
 xen/arch/x86/spec_ctrl.c            | 41 ++++++++++++++++++++++++++++++++++++-
 xen/include/asm-x86/spec_ctrl.h     |  2 ++
 5 files changed, 57 insertions(+), 5 deletions(-)

diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown
index 177decaece..4b34eefeb5 100644
--- a/docs/misc/xen-command-line.markdown
+++ b/docs/misc/xen-command-line.markdown
@@ -1704,7 +1704,7 @@ false disable the quirk workaround, which is also the default.
 ### spec-ctrl (x86)
 > `= List of [ <bool>, xen=<bool>, {pv,hvm,msr-sc,rsb,md-clear}=<bool>,
 >              bti-thunk=retpoline|lfence|jmp, {ibrs,ibpb,ssbd,eager-fpu,
->              l1d-flush}=<bool> ]`
+>              l1d-flush,srb-lock}=<bool> ]`
 
 Controls for speculative execution sidechannel mitigations.  By default, Xen
 will pick the most appropriate mitigations based on compiled in support,
@@ -1776,6 +1776,12 @@ Irrespective of Xen's setting, the feature is virtualised for HVM guests to
 use.  By default, Xen will enable this mitigation on hardware believed to be
 vulnerable to L1TF.
 
+On hardware supporting SRBDS_CTRL, the `srb-lock=` option can be used to force
+or prevent Xen from protect the Special Register Buffer from leaking stale
+data. By default, Xen will enable this mitigation, except on parts where MDS
+is fixed and TAA is fixed/mitigated (in which case, there is believed to be no
+way for an attacker to obtain the stale data).
+
 ### sync\_console
 > `= <boolean>`
 
diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
index f3480aa800..4d72b6ce97 100644
--- a/xen/arch/x86/acpi/power.c
+++ b/xen/arch/x86/acpi/power.c
@@ -259,6 +259,9 @@ static int enter_state(u32 state)
     ci->spec_ctrl_flags |= (default_spec_ctrl_flags & SCF_ist_wrmsr);
     spec_ctrl_exit_idle(ci);
 
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+        wrmsrl(MSR_MCU_OPT_CTRL, default_xen_mcu_opt_ctrl);
+
  done:
     spin_debug_enable();
     local_irq_restore(flags);
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index 641f830cd1..9db8ef0926 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -356,12 +356,14 @@ void start_secondary(void *unused)
         microcode_resume_cpu(cpu);
 
     /*
-     * If MSR_SPEC_CTRL is available, apply Xen's default setting and discard
-     * any firmware settings.  Note: MSR_SPEC_CTRL may only become available
-     * after loading microcode.
+     * If any speculative control MSRs are available, apply Xen's default
+     * settings.  Note: These MSRs may only become available after loading
+     * microcode.
      */
     if ( boot_cpu_has(X86_FEATURE_IBRSB) )
         wrmsrl(MSR_SPEC_CTRL, default_xen_spec_ctrl);
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+        wrmsrl(MSR_MCU_OPT_CTRL, default_xen_mcu_opt_ctrl);
 
     tsx_init(); /* Needs microcode.  May change HLE/RTM feature bits. */
 
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index e212a20127..289e91fb04 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -62,6 +62,9 @@ static unsigned int __initdata l1d_maxphysaddr;
 static bool __initdata cpu_has_bug_msbds_only; /* => minimal HT impact. */
 static bool __initdata cpu_has_bug_mds; /* Any other M{LP,SB,FB}DS combination. */
 
+static int8_t __initdata opt_srb_lock = -1;
+uint64_t __read_mostly default_xen_mcu_opt_ctrl;
+
 static int __init parse_bti(const char *s)
 {
     const char *ss;
@@ -149,6 +152,7 @@ static int __init parse_spec_ctrl(char *s)
             opt_ibpb = false;
             opt_ssbd = false;
             opt_l1d_flush = 0;
+            opt_srb_lock = 0;
         }
         else if ( val > 0 )
             rc = -EINVAL;
@@ -214,6 +218,8 @@ static int __init parse_spec_ctrl(char *s)
             opt_eager_fpu = val;
         else if ( (val = parse_boolean("l1d-flush", s, ss)) >= 0 )
             opt_l1d_flush = val;
+        else if ( (val = parse_boolean("srb-lock", s, ss)) >= 0 )
+            opt_srb_lock = val;
         else
             rc = -EINVAL;
 
@@ -377,7 +383,7 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
                "\n");
 
     /* Settings for Xen's protection, irrespective of guests. */
-    printk("  Xen settings: BTI-Thunk %s, SPEC_CTRL: %s%s%s, Other:%s%s%s\n",
+    printk("  Xen settings: BTI-Thunk %s, SPEC_CTRL: %s%s%s, Other:%s%s%s%s\n",
            thunk == THUNK_NONE      ? "N/A" :
            thunk == THUNK_RETPOLINE ? "RETPOLINE" :
            thunk == THUNK_LFENCE    ? "LFENCE" :
@@ -388,6 +394,8 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
            (default_xen_spec_ctrl & SPEC_CTRL_SSBD)  ? " SSBD+" : " SSBD-",
            !(caps & ARCH_CAPS_TSX_CTRL)              ? "" :
            (opt_tsx & 1)                             ? " TSX+" : " TSX-",
+           !boot_cpu_has(X86_FEATURE_SRBDS_CTRL)     ? "" :
+           opt_srb_lock                              ? " SRB_LOCK+" : " SRB_LOCK-",
            opt_ibpb                                  ? " IBPB"  : "",
            opt_l1d_flush                             ? " L1D_FLUSH" : "",
            opt_md_clear_pv || opt_md_clear_hvm       ? " VERW"  : "");
@@ -1152,6 +1160,34 @@ void __init init_speculation_mitigations(void)
         tsx_init();
     }
 
+    /* Calculate suitable defaults for MSR_MCU_OPT_CTRL */
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+    {
+        uint64_t val;
+
+        rdmsrl(MSR_MCU_OPT_CTRL, val);
+
+        /*
+         * On some SRBDS-affected hardware, it may be safe to relax srb-lock
+         * by default.
+         *
+         * On parts which enumerate MDS_NO and not TAA_NO, TSX is the only way
+         * to access the Fill Buffer.  If TSX isn't available (inc. SKU
+         * reasons on some models), or TSX is explicitly disabled, then there
+         * is no need for the extra overhead to protect RDRAND/RDSEED.
+         */
+        if ( opt_srb_lock == -1 &&
+             (caps & (ARCH_CAPS_MDS_NO|ARCH_CAPS_TAA_NO)) == ARCH_CAPS_MDS_NO &&
+             (!cpu_has_hle || ((caps & ARCH_CAPS_TSX_CTRL) && opt_tsx == 0)) )
+            opt_srb_lock = 0;
+
+        val &= ~MCU_OPT_CTRL_RNGDS_MITG_DIS;
+        if ( !opt_srb_lock )
+            val |= MCU_OPT_CTRL_RNGDS_MITG_DIS;
+
+        default_xen_mcu_opt_ctrl = val;
+    }
+
     print_details(thunk, caps);
 
     /*
@@ -1183,6 +1219,9 @@ void __init init_speculation_mitigations(void)
 
         wrmsrl(MSR_SPEC_CTRL, bsp_delay_spec_ctrl ? 0 : default_xen_spec_ctrl);
     }
+
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+        wrmsrl(MSR_MCU_OPT_CTRL, default_xen_mcu_opt_ctrl);
 }
 
 static void __init __maybe_unused build_assertions(void)
diff --git a/xen/include/asm-x86/spec_ctrl.h b/xen/include/asm-x86/spec_ctrl.h
index 98a0a504f6..df862ec4d0 100644
--- a/xen/include/asm-x86/spec_ctrl.h
+++ b/xen/include/asm-x86/spec_ctrl.h
@@ -46,6 +46,8 @@ extern int8_t opt_pv_l1tf_hwdom, opt_pv_l1tf_domu;
  */
 extern paddr_t l1tf_addr_mask, l1tf_safe_maddr;
 
+extern uint64_t default_xen_mcu_opt_ctrl;
+
 static inline void init_shadow_spec_ctrl_state(void)
 {
     struct cpu_info *info = get_cpu_info();
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.9


From xen-changelog-bounces@lists.xenproject.org Sat Jun 20 00:55:24 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 20 Jun 2020 00: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 1jmRn2-0003WV-7u; Sat, 20 Jun 2020 00:55: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=XOwH=AB=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jmRn1-0003WJ-94
 for xen-changelog@lists.xenproject.org; Sat, 20 Jun 2020 00:55:23 +0000
X-Inumbo-ID: b8479ebe-b290-11ea-bc2f-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id b8479ebe-b290-11ea-bc2f-12813bfff9fa;
 Sat, 20 Jun 2020 00: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=199nkoTdOgsdy/oqorDd25f0RuBI8fkzaCGce54ZHxQ=; b=chGmtj9uBxCSxC1oRMxEClJbGV
 xr/LPXPDD2Pe95/Tya+H8lJLZX0aOMZu86/RCUemvHli5jh14DME7gUsWnT8/ajWGFtOr75269Mmj
 +08uMrWiHAoz0Y9LMrK222vAWuwF3hNpix4ZLdh6NzYHWmN8T9MQiOaY45p4k7ztPv7g=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jmRn0-0004m0-E3
 for xen-changelog@lists.xenproject.org; Sat, 20 Jun 2020 00:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jmRn0-0000ci-Cu
 for xen-changelog@lists.xenproject.org; Sat, 20 Jun 2020 00:55:22 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.9] x86/spec-ctrl: Allow the RDRAND/RDSEED features to
 be hidden
Message-Id: <E1jmRn0-0000ci-Cu@xenbits.xenproject.org>
Date: Sat, 20 Jun 2020 00: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 80d78acf9e60ae6a88d6cb6f3535eaf67c81f61c
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 10 18:57:00 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jun 11 16:27:47 2020 +0100

    x86/spec-ctrl: Allow the RDRAND/RDSEED features to be hidden
    
    RDRAND/RDSEED can be hidden using cpuid= to mitigate SRBDS if microcode
    isn't available.
    
    Extend libxl's table of named parameters to include RDRAND/RDSEED, and
    have the compiler construct it in .rodata, rather than on the stack at runtime
    each time it is called.
    
    This is part of XSA-320 / CVE-2020-0543.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    (cherry picked from commit 7028534d8482d25860c4d1aa8e45f0b911abfc5a)
---
 docs/misc/xen-command-line.markdown | 10 ++++++++--
 tools/libxl/libxl_cpuid.c           |  6 ++++--
 xen/arch/x86/cpuid.c                | 10 ++++++++++
 3 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown
index 4b34eefeb5..44a5a911c0 100644
--- a/docs/misc/xen-command-line.markdown
+++ b/docs/misc/xen-command-line.markdown
@@ -454,12 +454,18 @@ choice of `dom0-kernel` is deprecated and not supported by all Dom0 kernels.
 This option allows for fine tuning of the facilities Xen will use, after
 accounting for hardware capabilities as enumerated via CPUID.
 
+Unless otherwise noted, options only have any effect in their negative form,
+to hide the named feature(s).  Ignoring a feature using this mechanism will
+cause Xen not to use the feature, nor offer them as usable to guests.
+
 Currently accepted:
 
 The Speculation Control hardware features `srbds-ctrl`, `md-clear`, `ibrsb`,
 `stibp`, `ibpb`, `l1d-flush` and `ssbd` are used by default if available and
-applicable.  They can be ignored, e.g. `no-ibrsb`, at which point Xen won't
-use them itself, and won't offer them to guests.
+applicable.  They can all be ignored.
+
+`rdrand` and `rdseed` can be ignored, as a mitigation to XSA-320 /
+CVE-2020-0543.
 
 ### cpuid\_mask\_cpu (AMD only)
 > `= fam_0f_rev_c | fam_0f_rev_d | fam_0f_rev_e | fam_0f_rev_f | fam_0f_rev_g | fam_10_rev_b | fam_10_rev_c | fam_11_rev_b`
diff --git a/tools/libxl/libxl_cpuid.c b/tools/libxl/libxl_cpuid.c
index 5a2c67fcac..ea2e708c47 100644
--- a/tools/libxl/libxl_cpuid.c
+++ b/tools/libxl/libxl_cpuid.c
@@ -89,7 +89,7 @@ static libxl_cpuid_policy_list cpuid_find_match(libxl_cpuid_policy_list *list,
 int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
 {
 #define NA XEN_CPUID_INPUT_UNUSED
-    struct cpuid_flags cpuid_flags[] = {
+    static const struct cpuid_flags cpuid_flags[] = {
         {"maxleaf",      0x00000000, NA, CPUID_REG_EAX,  0, 32},
       /* the following two entries are subject to tweaking later in the code */
         {"family",       0x00000001, NA, CPUID_REG_EAX,  8,  8},
@@ -100,6 +100,7 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
         {"clflush",      0x00000001, NA, CPUID_REG_EBX,  8,  8},
         {"brandid",      0x00000001, NA, CPUID_REG_EBX,  0,  8},
         {"hypervisor",   0x00000001, NA, CPUID_REG_ECX, 31,  1},
+        {"rdrand",       0x00000001, NA, CPUID_REG_ECX, 30,  1},
         {"f16c",         0x00000001, NA, CPUID_REG_ECX, 29,  1},
         {"avx",          0x00000001, NA, CPUID_REG_ECX, 28,  1},
         {"osxsave",      0x00000001, NA, CPUID_REG_ECX, 27,  1},
@@ -160,6 +161,7 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
         {"fpu",          0x00000001, NA, CPUID_REG_EDX,  0,  1},
         {"srbds-ctrl",   0x00000007,  0, CPUID_REG_EDX,  9,  1},
         {"md-clear",     0x00000007,  0, CPUID_REG_EDX, 10,  1},
+        {"rdseed",       0x00000007,  0, CPUID_REG_EBX, 18,  1},
         {"ibrsb",        0x00000007,  0, CPUID_REG_EDX, 26,  1},
         {"stibp",        0x00000007,  0, CPUID_REG_EDX, 27,  1},
         {"l1d-flush",    0x00000007,  0, CPUID_REG_EDX, 28,  1},
@@ -211,7 +213,7 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
 #undef NA
     char *sep, *val, *endptr;
     int i;
-    struct cpuid_flags *flag;
+    const struct cpuid_flags *flag;
     struct libxl__cpuid_policy *entry;
     unsigned long num;
     char flags[33], *resstr;
diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index b4988ba527..8fb98c1dad 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -63,6 +63,16 @@ static int __init parse_xen_cpuid(const char *s)
             if ( !val )
                 setup_clear_cpu_cap(X86_FEATURE_SRBDS_CTRL);
         }
+        else if ( (val = parse_boolean("rdrand", s, ss)) >= 0 )
+        {
+            if ( !val )
+                setup_clear_cpu_cap(X86_FEATURE_RDRAND);
+        }
+        else if ( (val = parse_boolean("rdseed", s, ss)) >= 0 )
+        {
+            if ( !val )
+                setup_clear_cpu_cap(X86_FEATURE_RDSEED);
+        }
         else
             rc = -EINVAL;
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.9


From xen-changelog-bounces@lists.xenproject.org Sat Jun 20 00:55:34 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 20 Jun 2020 00:55:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jmRnC-0003YY-9b; Sat, 20 Jun 2020 00:55: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=XOwH=AB=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jmRnB-0003YI-2z
 for xen-changelog@lists.xenproject.org; Sat, 20 Jun 2020 00:55:33 +0000
X-Inumbo-ID: be4fa2ca-b290-11ea-bc2f-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id be4fa2ca-b290-11ea-bc2f-12813bfff9fa;
 Sat, 20 Jun 2020 00:55: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=r8w8WR/nW3G8jktCt1Du9EknB42jQW3OZv4DCo0xaQg=; b=4L3I1oaja97CWdV4irxRh/Nyr0
 TvbeEr4+ZjismyEteF4sY8X2CIilbXviBppILHqz33YcJbdLpVXmEIrIbMA4LoXG6ATkGldzp+ecT
 dGDo+Bx1L5VrA6l5LMAkazNz7+rK1GZ8mq7Dt/HcuZyBUgzl9bxyYxEAeIGI32QoHWqA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jmRnA-0004m7-Hx
 for xen-changelog@lists.xenproject.org; Sat, 20 Jun 2020 00:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jmRnA-0000dG-GL
 for xen-changelog@lists.xenproject.org; Sat, 20 Jun 2020 00:55:32 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.9] tools/xentop : replace use of deprecated vwprintw
Message-Id: <E1jmRnA-0000dG-GL@xenbits.xenproject.org>
Date: Sat, 20 Jun 2020 00:55: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 1dd64783024c5c9e600c3d33393b795c68a46f65
Author:     Christopher Clark <christopher.w.clark@gmail.com>
AuthorDate: Wed Jul 18 15:22:17 2018 -0700
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Fri Jun 12 17:01:39 2020 +0100

    tools/xentop : replace use of deprecated vwprintw
    
    gcc-8.1 complains:
    
    | xentop.c: In function 'print':
    | xentop.c:304:4: error: 'vwprintw' is deprecated [-Werror=deprecated-declarations]
    |     vwprintw(stdscr, (curses_str_t)fmt, args);
    |     ^~~~~~~~
    
    vw_printw (note the underscore) is a non-deprecated alternative.
    
    Signed-off-by: Christopher Clark <christopher.clark6@baesystems.com>
    Acked-by: Wei Liu <wei.liu2@citrix.com>
    (cherry picked from commit 2b50cdbc444c637575580dcfa6c9525a84d5cc62)
---
 tools/xenstat/xentop/xentop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/xenstat/xentop/xentop.c b/tools/xenstat/xentop/xentop.c
index 2fd2b6742e..c46581062b 100644
--- a/tools/xenstat/xentop/xentop.c
+++ b/tools/xenstat/xentop/xentop.c
@@ -301,7 +301,7 @@ static void print(const char *fmt, ...)
 	if (!batch) {
 		if((current_row() < lines()-1)) {
 			va_start(args, fmt);
-			vwprintw(stdscr, (curses_str_t)fmt, args);
+			vw_printw(stdscr, (curses_str_t)fmt, args);
 			va_end(args);
 		}
 	} else {
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.9


From xen-changelog-bounces@lists.xenproject.org Sat Jun 20 00:55:44 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 20 Jun 2020 00:55:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jmRnM-0003Zr-Cd; Sat, 20 Jun 2020 00:55: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=XOwH=AB=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jmRnL-0003Zg-7J
 for xen-changelog@lists.xenproject.org; Sat, 20 Jun 2020 00:55:43 +0000
X-Inumbo-ID: c455e8dc-b290-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id c455e8dc-b290-11ea-8496-bc764e2007e4;
 Sat, 20 Jun 2020 00:55: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=6yWv/DX7AeiaROaWBxMP6SGlyEU90LaiaieN/Npxfak=; b=lx3tCXvjF45odGC6fHD3sGBgPM
 QwaMMccpOu8lEwY67gidSfqbVSUygMbF770sodr0CF1TwXJiAOuLUJ8Zftx04YaWj12tBBWRA4Ex8
 QTiHaqY7aVNWX9AlVQ7iQczPnYtFKikIJw7vtkcVzqSV4l92rInNKSHFo4Vzl4asJqqk=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jmRnK-0004nB-L2
 for xen-changelog@lists.xenproject.org; Sat, 20 Jun 2020 00:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jmRnK-0000dk-KC
 for xen-changelog@lists.xenproject.org; Sat, 20 Jun 2020 00:55:42 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.9] tools/libxc: fix strncpy size
Message-Id: <E1jmRnK-0000dk-KC@xenbits.xenproject.org>
Date: Sat, 20 Jun 2020 00:55: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 9737f89b076ae4d05e6f974a7c21aced4459966e
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Thu Apr 5 03:50:49 2018 +0200
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Fri Jun 12 17:01:39 2020 +0100

    tools/libxc: fix strncpy size
    
    gcc-8 warns about possible truncation of trailing '\0'.
    Final character is overridden by '\0' anyway, so don't bother to copy
    it.
    
    This fixes compile failure:
    
        xc_pm.c: In function 'xc_set_cpufreq_gov':
        xc_pm.c:308:5: error: 'strncpy' specified bound 16 equals destination size [-Werror=stringop-truncation]
             strncpy(scaling_governor, govname, CPUFREQ_NAME_LEN);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        cc1: all warnings being treated as errors
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Wei Liu <wei.liu2@citrix.com>
    Release-Acked-by: Juergen Gross <jgross@suse.com>
    (cherry picked from commit fa7789ef18bd2e716997937af71b2e4b5b00a159)
---
 tools/libxc/xc_pm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libxc/xc_pm.c b/tools/libxc/xc_pm.c
index ae917bc630..0fc47047ce 100644
--- a/tools/libxc/xc_pm.c
+++ b/tools/libxc/xc_pm.c
@@ -305,7 +305,7 @@ int xc_set_cpufreq_gov(xc_interface *xch, int cpuid, char *govname)
     sysctl.cmd = XEN_SYSCTL_pm_op;
     sysctl.u.pm_op.cmd = SET_CPUFREQ_GOV;
     sysctl.u.pm_op.cpuid = cpuid;
-    strncpy(scaling_governor, govname, CPUFREQ_NAME_LEN);
+    strncpy(scaling_governor, govname, CPUFREQ_NAME_LEN - 1);
     scaling_governor[CPUFREQ_NAME_LEN - 1] = '\0';
 
     return xc_sysctl(xch, &sysctl);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.9


From xen-changelog-bounces@lists.xenproject.org Sat Jun 20 00:55:54 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 20 Jun 2020 00:55:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jmRnW-0003au-EF; Sat, 20 Jun 2020 00:55: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=XOwH=AB=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jmRnV-0003ai-Bs
 for xen-changelog@lists.xenproject.org; Sat, 20 Jun 2020 00:55:53 +0000
X-Inumbo-ID: ca596178-b290-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id ca596178-b290-11ea-bb8b-bc764e2007e4;
 Sat, 20 Jun 2020 00:55: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=tvjeqpUR/F79zZtvwaMGCGJSScpbNp0+vjKLWLjoWfc=; b=5g0OBHA1OLMHfU3JUBrP54ETmG
 PoMKsDEzlYlUTrSEEMA0cZRrTS0ND0FP7iFSOVfDa1/P2Mk3A2RLTBAZVb9N7Byoyme4T+U3BTf7G
 1UtsRV3pkV4/MO7PCxx7tXrFGSGmplxwgttWYmv/YY1tPRT76KPUnjLwK1lleCj/Rn9E=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jmRnU-0004nL-OF
 for xen-changelog@lists.xenproject.org; Sat, 20 Jun 2020 00:55:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jmRnU-0000eM-NC
 for xen-changelog@lists.xenproject.org; Sat, 20 Jun 2020 00:55:52 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.9] tools/xenpmd: fix possible '\0' truncation
Message-Id: <E1jmRnU-0000eM-NC@xenbits.xenproject.org>
Date: Sat, 20 Jun 2020 00:55: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 f034ab45c15aef9c784dbcdc5c893e268d4a094c
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Thu Apr 5 03:50:53 2018 +0200
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Fri Jun 12 17:01:39 2020 +0100

    tools/xenpmd: fix possible '\0' truncation
    
    gcc-8 complains:
        xenpmd.c:207:9: error: 'strncpy' specified bound 32 equals destination size [-Werror=stringop-truncation]
                 strncpy(info->oem_info, attrib_value, 32);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        xenpmd.c:201:9: error: 'strncpy' specified bound 32 equals destination size [-Werror=stringop-truncation]
                 strncpy(info->battery_type, attrib_value, 32);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        xenpmd.c:195:9: error: 'strncpy' specified bound 32 equals destination size [-Werror=stringop-truncation]
                 strncpy(info->serial_number, attrib_value, 32);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        xenpmd.c:189:9: error: 'strncpy' specified bound 32 equals destination size [-Werror=stringop-truncation]
                 strncpy(info->model_number, attrib_value, 32);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    Copy 31 chars, then make sure terminating '\0' is present. Those fields
    are passed to strlen and as '%s' for snprintf later.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Wei Liu <wei.liu2@citrix.com>
    Release-Acked-by: Juergen Gross <jgross@suse.com>
    (cherry picked from commit 938c8f53b1f80175c6f7a1399efdb984abb0cb8b)
---
 tools/xenpmd/xenpmd.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/tools/xenpmd/xenpmd.c b/tools/xenpmd/xenpmd.c
index 689c8fd670..56412a9a81 100644
--- a/tools/xenpmd/xenpmd.c
+++ b/tools/xenpmd/xenpmd.c
@@ -186,25 +186,29 @@ void set_attribute_battery_info(char *attrib_name,
 
     if ( strstr(attrib_name, "model number") ) 
     {
-        strncpy(info->model_number, attrib_value, 32);
+        strncpy(info->model_number, attrib_value, 31);
+        info->model_number[31] = '\0';
         return;
     }
 
     if ( strstr(attrib_name, "serial number") ) 
     {
-        strncpy(info->serial_number, attrib_value, 32);
+        strncpy(info->serial_number, attrib_value, 31);
+        info->serial_number[31] = '\0';
         return;
     }
 
     if ( strstr(attrib_name, "battery type") ) 
     {
-        strncpy(info->battery_type, attrib_value, 32);
+        strncpy(info->battery_type, attrib_value, 31);
+        info->battery_type[31] = '\0';
         return;
     }
 
     if ( strstr(attrib_name, "OEM info") ) 
     {
-        strncpy(info->oem_info, attrib_value, 32);
+        strncpy(info->oem_info, attrib_value, 31);
+        info->oem_info[31] = '\0';
         return;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.9


From xen-changelog-bounces@lists.xenproject.org Sat Jun 20 00:56:04 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 20 Jun 2020 00:56:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jmRng-0003c4-Fu; Sat, 20 Jun 2020 00:56: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=XOwH=AB=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jmRnf-0003bv-Ct
 for xen-changelog@lists.xenproject.org; Sat, 20 Jun 2020 00:56:03 +0000
X-Inumbo-ID: d05eb186-b290-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id d05eb186-b290-11ea-8496-bc764e2007e4;
 Sat, 20 Jun 2020 00:56: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=+yhjoNo9vE0CvooGGM1w5EseTuafQPopeLYJZQ1SZ1c=; b=ivd2O8uuKtvb7n5XodP1H937RT
 SxvCrK2abzzyRKyJKdwmFB0PsINQ/H5PBQKpzkE8WA1VdJxFFf0lJu6KbUJKHKTA8fJKdiH4ek36c
 KQY/YcslD+rNfm8X/88K22VaTSz/wvAh9ET2oVl0UIe8ZzHo/Zly2j2eg4Mf932IEz9E=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jmRne-0004ni-Rl
 for xen-changelog@lists.xenproject.org; Sat, 20 Jun 2020 00:56:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jmRne-0000f3-Qo
 for xen-changelog@lists.xenproject.org; Sat, 20 Jun 2020 00:56:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.9] tools/gdbsx: fix -Wstringop-truncation warning
Message-Id: <E1jmRne-0000f3-Qo@xenbits.xenproject.org>
Date: Sat, 20 Jun 2020 00:56: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 f1e75e5c7054d8cd7bdfe30c6a95af35cc24fbb2
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Thu Apr 5 03:50:54 2018 +0200
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Fri Jun 12 17:01:39 2020 +0100

    tools/gdbsx: fix -Wstringop-truncation warning
    
    gcc-8 complains:
    
        gx_main.c: In function 'prepare_stop_reply':
        gx_main.c:385:9: error: 'strncpy' output truncated before terminating nul copying 6 bytes from a string of the same length [-Werror=stringop-truncation]
                 strncpy(buf, "watch:", 6);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~
    
    Since terminating '\0' isn't needed here at all, switch to memcpy.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Wei Liu <wei.liu2@citrix.com>
    Release-Acked-by: Juergen Gross <jgross@suse.com>
    (cherry picked from commit 7f601f7c341c80d554615556d60e3b8ed1e5ad4f)
---
 tools/debugger/gdbsx/gx/gx_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/debugger/gdbsx/gx/gx_main.c b/tools/debugger/gdbsx/gx/gx_main.c
index a908c45e1d..6dfa501145 100644
--- a/tools/debugger/gdbsx/gx/gx_main.c
+++ b/tools/debugger/gdbsx/gx/gx_main.c
@@ -382,7 +382,7 @@ prepare_stop_reply(enum target_signal sig, char *buf, vcpuid_t vcpu)
 
     /* TBD: check if we stopped because of watchpoint */
     if (watchpoint_stop()) {
-        strncpy(buf, "watch:", 6);
+        memcpy(buf, "watch:", 6);
         buf += 6;
         /* TBD: **/
     }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.9


From xen-changelog-bounces@lists.xenproject.org Sat Jun 20 00:56:15 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 20 Jun 2020 00:56:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jmRnr-0003dB-HZ; Sat, 20 Jun 2020 00:56: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=XOwH=AB=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jmRnq-0003d1-Fl
 for xen-changelog@lists.xenproject.org; Sat, 20 Jun 2020 00:56:14 +0000
X-Inumbo-ID: d6642bb0-b290-11ea-bc2f-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id d6642bb0-b290-11ea-bc2f-12813bfff9fa;
 Sat, 20 Jun 2020 00:56: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=mRQwEnquPyYqUkEYewXd24eWcrNEjNSmcYxIR7jMK5M=; b=P5sWP8fXfu8S/vlT5MPQkDZze1
 RXbIDw3LTy90+6zVdzXcmU9+5F4eBeDiuYLIFEy60bICxm5w7P8kqefpc/1wXKW8ZMH0btbUqB6q/
 vUkgKMBoISdqoD0VfhvcU2xOQMl/ITep+ODLG+7958W5Eqi0m+nznVyEVCIdYsNvus5Q=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jmRno-0004oP-Ut
 for xen-changelog@lists.xenproject.org; Sat, 20 Jun 2020 00:56:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jmRno-0000fb-U3
 for xen-changelog@lists.xenproject.org; Sat, 20 Jun 2020 00:56:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.9] tools/blktap2: fix possible '\0' truncation
Message-Id: <E1jmRno-0000fb-U3@xenbits.xenproject.org>
Date: Sat, 20 Jun 2020 00:56: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 1eae17268887bacbc598ef6e3290059dbeb4fd8f
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Thu Apr 5 03:50:52 2018 +0200
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Fri Jun 12 17:01:39 2020 +0100

    tools/blktap2: fix possible '\0' truncation
    
    gcc-8 complains:
    
        tapdisk-vbd.c: In function 'tapdisk_vbd_resume_ring':
        tapdisk-vbd.c:1671:53: error: 'snprintf' output may be truncated before the last format character [-Werror=format-truncation=]
           snprintf(params.name, sizeof(params.name) - 1, "%s", message);
                                                             ^
        tapdisk-vbd.c:1671:3: note: 'snprintf' output between 1 and 256 bytes into a destination of size 255
           snprintf(params.name, sizeof(params.name) - 1, "%s", message);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    The "- 1" in buffer size should be actually applied to message, to leave
    place for terminating '\0', not the other way around (truncate '\0' even
    if it would fit).
    
        In function 'tapdisk_control_open_image',
            inlined from 'tapdisk_control_handle_request' at tapdisk-control.c:660:10:
        tapdisk-control.c:465:2: error: 'strncpy' specified bound 256 equals destination size [-Werror=stringop-truncation]
          strncpy(params.name, vbd->name, BLKTAP2_MAX_MESSAGE_LEN);
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
        In function 'tapdisk_control_create_socket',
            inlined from 'tapdisk_control_open' at tapdisk-control.c:836:9:
        tapdisk-control.c:793:2: error: 'strncpy' specified bound 108 equals destination size [-Werror=stringop-truncation]
          strncpy(saddr.sun_path, td_control.path, sizeof(saddr.sun_path));
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
        block-qcow.c: In function 'qcow_create':
        block-qcow.c:1216:5: error: 'strncpy' specified bound 4096 equals destination size [-Werror=stringop-truncation]
             strncpy(backing_filename, backing_file,
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              sizeof(backing_filename));
              ~~~~~~~~~~~~~~~~~~~~~~~~~
    
    I those cases, reduce size of copied string and make sure final '\0' is
    added.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Wei Liu <wei.liu2@citrix.com>
    Release-Acked-by: Juergen Gross <jgross@suse.com>
    (cherry picked from commit 850e89b3ef1a7be6b71fa7ae22333c884e08431a)
---
 tools/blktap2/drivers/block-qcow.c      | 3 ++-
 tools/blktap2/drivers/tapdisk-control.c | 5 +++--
 tools/blktap2/drivers/tapdisk-vbd.c     | 3 ++-
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/tools/blktap2/drivers/block-qcow.c b/tools/blktap2/drivers/block-qcow.c
index b45bcaa077..ae439221ab 100644
--- a/tools/blktap2/drivers/block-qcow.c
+++ b/tools/blktap2/drivers/block-qcow.c
@@ -1214,7 +1214,8 @@ int qcow_create(const char *filename, uint64_t total_size,
 			if (p && (p - backing_file) >= 2) {
 				/* URL like but exclude "c:" like filenames */
 				strncpy(backing_filename, backing_file,
-					sizeof(backing_filename));
+					sizeof(backing_filename) - 1);
+				backing_filename[sizeof(backing_filename) - 1] = '\0';
 			} else {
 				if (realpath(backing_file, backing_filename) == NULL ||
 				    stat(backing_filename, &st) != 0) {
diff --git a/tools/blktap2/drivers/tapdisk-control.c b/tools/blktap2/drivers/tapdisk-control.c
index 0b5cf3cdd3..3ca5713063 100644
--- a/tools/blktap2/drivers/tapdisk-control.c
+++ b/tools/blktap2/drivers/tapdisk-control.c
@@ -462,7 +462,8 @@ tapdisk_control_open_image(struct tapdisk_control_connection *connection,
 
 	params.capacity = image.size;
 	params.sector_size = image.secsize;
-	strncpy(params.name, vbd->name, BLKTAP2_MAX_MESSAGE_LEN);
+	strncpy(params.name, vbd->name, BLKTAP2_MAX_MESSAGE_LEN - 1);
+	params.name[BLKTAP2_MAX_MESSAGE_LEN - 1] = '\0';
 
 	err = ioctl(vbd->ring.fd, BLKTAP2_IOCTL_CREATE_DEVICE, &params);
 	if (err && errno != EEXIST) {
@@ -790,7 +791,7 @@ tapdisk_control_create_socket(char **socket_path)
 	}
 
 	memset(&saddr, 0, sizeof(saddr));
-	strncpy(saddr.sun_path, td_control.path, sizeof(saddr.sun_path));
+	strncpy(saddr.sun_path, td_control.path, sizeof(saddr.sun_path) - 1);
 	saddr.sun_family = AF_UNIX;
 
 	err = bind(td_control.socket,
diff --git a/tools/blktap2/drivers/tapdisk-vbd.c b/tools/blktap2/drivers/tapdisk-vbd.c
index fd4999a5ec..842a427861 100644
--- a/tools/blktap2/drivers/tapdisk-vbd.c
+++ b/tools/blktap2/drivers/tapdisk-vbd.c
@@ -1668,7 +1668,8 @@ out:
 
 		params.sector_size = image.secsize;
 		params.capacity    = image.size;
-		snprintf(params.name, sizeof(params.name) - 1, "%s", message);
+		snprintf(params.name, sizeof(params.name),
+			 "%.*s", (int)sizeof(params.name) - 1, message);
 
 		ioctl(vbd->ring.fd, BLKTAP2_IOCTL_SET_PARAMS, &params);
 		td_flag_clear(vbd->state, TD_VBD_PAUSED);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.9


From xen-changelog-bounces@lists.xenproject.org Sat Jun 20 00:56:24 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 20 Jun 2020 00:56: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 1jmRo0-0003e9-JD; Sat, 20 Jun 2020 00:56: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=XOwH=AB=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jmRnz-0003e3-Ne
 for xen-changelog@lists.xenproject.org; Sat, 20 Jun 2020 00:56:23 +0000
X-Inumbo-ID: dc688b0a-b290-11ea-bc2f-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id dc688b0a-b290-11ea-bc2f-12813bfff9fa;
 Sat, 20 Jun 2020 00:56: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=/deG62YAI6MLpyjVuB0Jgx6pe9bIieBAtck+mBqKgCQ=; b=E7PxSHKoDJdB/SoK93ri84ZI7+
 kBVKwIr+LZzFAhn/vKR98x0CTHx9iC58KzlWndnlWB2cvJAFwwcxs3dDsJPBaQRzsr86FdZ5hH1dL
 /mwvF221eCMqf5jOw6NBmQFj8u8L3s55Y+LtcrzyET5WDmmjmvo6V/EcKZmHjM4iMlbE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jmRnz-0004oX-1p
 for xen-changelog@lists.xenproject.org; Sat, 20 Jun 2020 00:56:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jmRnz-0000g5-0q
 for xen-changelog@lists.xenproject.org; Sat, 20 Jun 2020 00:56:23 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.9] tools/misc: fix hypothetical buffer overflow in
 xen-lowmemd
Message-Id: <E1jmRnz-0000g5-0q@xenbits.xenproject.org>
Date: Sat, 20 Jun 2020 00:56: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 41f597f5167c2e78a3c70d219710c8805d7fec8e
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Thu Apr 5 03:50:50 2018 +0200
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Fri Jun 12 17:01:39 2020 +0100

    tools/misc: fix hypothetical buffer overflow in xen-lowmemd
    
    gcc-8 complains:
    
        xen-lowmemd.c: In function 'handle_low_mem':
        xen-lowmemd.c:80:55: error: '%s' directive output may be truncated writing up to 511 bytes into a region of size 489 [-Werror=format-truncation=]
                 snprintf(error, BUFSZ,"Failed to write target %s to xenstore", data);
                                                               ^~               ~~~~
        xen-lowmemd.c:80:9: note: 'snprintf' output between 36 and 547 bytes into a destination of size 512
                 snprintf(error, BUFSZ,"Failed to write target %s to xenstore", data);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    In practice it wouldn't happen, because 'data' contains string
    representation of 64-bit unsigned number (20 characters at most).
    But place a limit to mute gcc warning.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Wei Liu <wei.liu2@citrix.com>
    Release-Acked-by: Juergen Gross <jgross@suse.com>
    (cherry picked from commit 27751d89248c8c5eef6d8b56eb8f7d2084145080)
---
 tools/misc/xen-lowmemd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/misc/xen-lowmemd.c b/tools/misc/xen-lowmemd.c
index 865a54cec1..79ad34cb4a 100644
--- a/tools/misc/xen-lowmemd.c
+++ b/tools/misc/xen-lowmemd.c
@@ -77,7 +77,7 @@ void handle_low_mem(void)
     if (!xs_write(xs_handle, XBT_NULL, 
             "/local/domain/0/memory/target", data, strlen(data)))
     {
-        snprintf(error, BUFSZ,"Failed to write target %s to xenstore", data);
+        snprintf(error, BUFSZ,"Failed to write target %.24s to xenstore", data);
         perror(error);
     }
 }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.9


From xen-changelog-bounces@lists.xenproject.org Sat Jun 20 00:56:34 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 20 Jun 2020 00:56: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 1jmRoA-0003fr-Km; Sat, 20 Jun 2020 00:56: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=XOwH=AB=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jmRo9-0003fd-Ob
 for xen-changelog@lists.xenproject.org; Sat, 20 Jun 2020 00:56:33 +0000
X-Inumbo-ID: e26d1af2-b290-11ea-bc2f-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id e26d1af2-b290-11ea-bc2f-12813bfff9fa;
 Sat, 20 Jun 2020 00:56: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=8+Zhnj0iY2FR9Qhd8KKD4YKr1G6iaJ8FFuoabp3OJ7c=; b=4QGVYaENyjW++/PxoaP6wSYdeQ
 e2K93uWSJYwGZwAGMuBum9yi45DNEs77YEGN0NixJ+0nAIIHcs9+e5xYPVZNX/wSHdYkl2+NgQLLt
 0O7i06W0cmfh4eDrXux8GyMXm2hOjqqwHG+I2gRyvl5q9mhfFxI6QLwt/jWTQh5Ubnmg=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jmRo9-0004oa-4i
 for xen-changelog@lists.xenproject.org; Sat, 20 Jun 2020 00:56:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jmRo9-0000gZ-3v
 for xen-changelog@lists.xenproject.org; Sat, 20 Jun 2020 00:56:33 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.9] tools/ocaml/libs/xc fix gcc-8 format-truncation
 warning
Message-Id: <E1jmRo9-0000gZ-3v@xenbits.xenproject.org>
Date: Sat, 20 Jun 2020 00:56: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 6a1c431890599c701117bf9822898f60a18444a3
Author:     John Thomson <git@johnthomson.fastmail.com.au>
AuthorDate: Tue May 15 11:48:43 2018 +1000
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Fri Jun 12 17:01:39 2020 +0100

    tools/ocaml/libs/xc fix gcc-8 format-truncation warning
    
     CC       xenctrl_stubs.o
    xenctrl_stubs.c: In function 'failwith_xc':
    xenctrl_stubs.c:65:17: error: 'snprintf' output may be truncated before the last format character [-Werror=format-truncation=]
          "%d: %s: %s", error->code,
                     ^
    xenctrl_stubs.c:64:4: note: 'snprintf' output 6 or more bytes (assuming 1029) into a destination of size 1028
        snprintf(error_str, sizeof(error_str),
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          "%d: %s: %s", error->code,
          ~~~~~~~~~~~~~~~~~~~~~~~~~~
          xc_error_code_to_desc(error->code),
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          error->message);
          ~~~~~~~~~~~~~~~
    cc1: all warnings being treated as errors
    make[8]: *** [/build/xen-git/src/xen/tools/ocaml/libs/xc/../../Makefile.rules:37: xenctrl_stubs.o] Error 1
    m
    
    Signed-off-by: John Thomson <git@johnthomson.fastmail.com.au>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    Release-acked-by: Juergen Gross <jgross@suse.com>
    (cherry picked from commit 2adc90908fbb1e614c477e29f2d45eda94570795)
---
 tools/ocaml/libs/xc/xenctrl_stubs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index f1b28db53a..beefe6e8ad 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -54,7 +54,7 @@
 
 static void Noreturn failwith_xc(xc_interface *xch)
 {
-	char error_str[1028];
+	char error_str[XC_MAX_ERROR_MSG_LEN + 6];
 	if (xch) {
 		const xc_error *error = xc_get_last_error(xch);
 		if (error->code == XC_ERROR_NONE)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.9


From xen-changelog-bounces@lists.xenproject.org Sat Jun 20 00:56:44 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 20 Jun 2020 00:56: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 1jmRoK-0003iE-NY; Sat, 20 Jun 2020 00:56: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=XOwH=AB=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jmRoJ-0003hY-Ow
 for xen-changelog@lists.xenproject.org; Sat, 20 Jun 2020 00:56:43 +0000
X-Inumbo-ID: e8714e1e-b290-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id e8714e1e-b290-11ea-b7bb-bc764e2007e4;
 Sat, 20 Jun 2020 00:56: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=ftFJzbmcPVm2cNiZCcZT+nSGlI0VbOYToL6d36HMBZ4=; b=U0qeoq0QefLAiTQRovgyb2mfCo
 wwmWM20o1TbzgO3TOj1E+G5bCc5rGAonzd98i0do+lx8D20Zc/GJCuM/+jDfI4Bf4bRKEiTEqnBUs
 YeiwSgLzWW7pkkVoQb4+yFjcrotn6tzAx94P+mnWKiiuDMFf5ONwmsX+gf5YeAJBbrHk=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jmRoJ-0004of-80
 for xen-changelog@lists.xenproject.org; Sat, 20 Jun 2020 00:56:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jmRoJ-0000hB-6s
 for xen-changelog@lists.xenproject.org; Sat, 20 Jun 2020 00:56:43 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.9] ipxe: update to newer commit
Message-Id: <E1jmRoJ-0000hB-6s@xenbits.xenproject.org>
Date: Sat, 20 Jun 2020 00:56: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 6e477c2ea4d5c26a7a7b2f850166aa79edc5225c
Author:     Wei Liu <wei.liu2@citrix.com>
AuthorDate: Mon Jun 12 16:04:17 2017 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Fri Jun 12 17:01:39 2020 +0100

    ipxe: update to newer commit
    
    To get 5f85cbb9ee1c00cec81a848a9e871ad5d1e7f53f to placate gcc 7.
    
    The only patch we have applies cleanly.
    
    Reported-by: Zhongze Liu <blackskygg@gmail.com>
    Signed-off-by: Wei Liu <wei.liu2@citrix.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
    (cherry picked from commit 461b2165346de236fff2d00d1c318062f1daab08)
---
 tools/firmware/etherboot/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/firmware/etherboot/Makefile b/tools/firmware/etherboot/Makefile
index 459a1e22e6..89d9ace8c8 100644
--- a/tools/firmware/etherboot/Makefile
+++ b/tools/firmware/etherboot/Makefile
@@ -10,7 +10,7 @@ else
 IPXE_GIT_URL ?= git://git.ipxe.org/ipxe.git
 endif
 
-IPXE_GIT_TAG := 827dd1bfee67daa683935ce65316f7e0f057fe1c
+IPXE_GIT_TAG := 356f6c1b64d7a97746d1816cef8ca22bdd8d0b5d
 
 IPXE_TARBALL_URL ?= $(XEN_EXTFILES_URL)/ipxe-git-$(IPXE_GIT_TAG).tar.gz
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.9


From xen-changelog-bounces@lists.xenproject.org Sun Jun 21 17:11:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 21 Jun 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 1jn3Um-0006M5-Ec; Sun, 21 Jun 2020 17: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=c5Ce=AC=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jn3Ul-0006Ly-MQ
 for xen-changelog@lists.xenproject.org; Sun, 21 Jun 2020 17:11:03 +0000
X-Inumbo-ID: 2f007722-b3e2-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 2f007722-b3e2-11ea-bb8b-bc764e2007e4;
 Sun, 21 Jun 2020 17: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=8Ji8QjzNWmF6ufZx9VNGcCJlWOMovCgc9WEuAWmjeJk=; b=SFZqHouCdBVy+XnlkfRzmNmkqu
 bA+soNryr0sJT5emwCEr3/0YcoG4acCQKD3PZPyVWWcm2OJiVLoXE+cBHSOeB1Caxz3YnDdEiVS8+
 gv7wWYbv9q5Zn9Wabrejd62x6nFUl3CifL2SHBmyX/6GmKSwtrB21dbU+3qMecYfjypw=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jn3Uj-0006OY-W3
 for xen-changelog@lists.xenproject.org; Sun, 21 Jun 2020 17:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jn3Uj-00063d-V3
 for xen-changelog@lists.xenproject.org; Sun, 21 Jun 2020 17:11:01 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.10] x86/spec-ctrl: CPUID/MSR definitions for Special
 Register Buffer Data Sampling
Message-Id: <E1jn3Uj-00063d-V3@xenbits.xenproject.org>
Date: Sun, 21 Jun 2020 17: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 afca67fafde22033b9a967ae197a10af5c654f02
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 8 19:47:46 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jun 9 17:46:28 2020 +0100

    x86/spec-ctrl: CPUID/MSR definitions for Special Register Buffer Data Sampling
    
    This is part of XSA-320 / CVE-2020-0543
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Wei Liu <wl@xen.org>
    (cherry picked from commit caab85ab58c0cdf74ab070a5de5c4df89f509ff3)
---
 docs/misc/xen-command-line.markdown         | 8 ++++----
 tools/libxl/libxl_cpuid.c                   | 1 +
 tools/misc/xen-cpuid.c                      | 3 ++-
 xen/arch/x86/cpuid.c                        | 5 +++++
 xen/arch/x86/msr.c                          | 2 ++
 xen/arch/x86/spec_ctrl.c                    | 3 ++-
 xen/include/asm-x86/msr-index.h             | 3 +++
 xen/include/public/arch-x86/cpufeatureset.h | 1 +
 8 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown
index 1f08dde186..ab26a26381 100644
--- a/docs/misc/xen-command-line.markdown
+++ b/docs/misc/xen-command-line.markdown
@@ -496,10 +496,10 @@ accounting for hardware capabilities as enumerated via CPUID.
 
 Currently accepted:
 
-The Speculation Control hardware features `md-clear`, `ibrsb`, `stibp`, `ibpb`,
-`l1d-flush` and `ssbd` are used by default if available and applicable.  They can
-be ignored, e.g. `no-ibrsb`, at which point Xen won't use them itself, and
-won't offer them to guests.
+The Speculation Control hardware features `srbds-ctrl`, `md-clear`, `ibrsb`,
+`stibp`, `ibpb`, `l1d-flush` and `ssbd` are used by default if available and
+applicable.  They can be ignored, e.g. `no-ibrsb`, at which point Xen won't
+use them itself, and won't offer them to guests.
 
 ### cpuid\_mask\_cpu (AMD only)
 > `= fam_0f_rev_c | fam_0f_rev_d | fam_0f_rev_e | fam_0f_rev_f | fam_0f_rev_g | fam_10_rev_b | fam_10_rev_c | fam_11_rev_b`
diff --git a/tools/libxl/libxl_cpuid.c b/tools/libxl/libxl_cpuid.c
index 5a1702d703..1235c8b91e 100644
--- a/tools/libxl/libxl_cpuid.c
+++ b/tools/libxl/libxl_cpuid.c
@@ -202,6 +202,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},
+        {"srbds-ctrl",   0x00000007,  0, CPUID_REG_EDX,  9,  1},
         {"md-clear",     0x00000007,  0, CPUID_REG_EDX, 10,  1},
         {"ibrsb",        0x00000007,  0, CPUID_REG_EDX, 26,  1},
         {"stibp",        0x00000007,  0, CPUID_REG_EDX, 27,  1},
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index 89d50e048c..7f9612f0a9 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -162,8 +162,9 @@ static const char *str_7d0[32] =
 
     [ 2] = "avx512_4vnniw", [ 3] = "avx512_4fmaps",
 
-    [4 ... 9] = "REZ",
+    [4 ... 7] = "REZ",
 
+    [ 8] = "REZ",           [ 9] = "srbds-ctrl",
     [10] = "md-clear",      [11] = "REZ",
     [12] = "REZ",           [13] = "tsx-force-abort",
 
diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index e943d70bca..67a2a2e6a0 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -58,6 +58,11 @@ static int __init parse_xen_cpuid(const char *s)
             if ( !val )
                 setup_clear_cpu_cap(X86_FEATURE_SSBD);
         }
+        else if ( (val = parse_boolean("srbds-ctrl", s, ss)) >= 0 )
+        {
+            if ( !val )
+                setup_clear_cpu_cap(X86_FEATURE_SRBDS_CTRL);
+        }
         else
             rc = -EINVAL;
 
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 6ceea913fb..90561a5392 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -135,6 +135,7 @@ int guest_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val)
         /* Write-only */
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
+    case MSR_MCU_OPT_CTRL:
         /* Not offered to guests. */
         goto gp_fault;
 
@@ -194,6 +195,7 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
         /* Read-only */
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
+    case MSR_MCU_OPT_CTRL:
         /* Not offered to guests. */
         goto gp_fault;
 
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index 0f30362111..b7733b34f6 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -349,12 +349,13 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
     printk("Speculative mitigation facilities:\n");
 
     /* Hardware features which pertain to speculative mitigations. */
-    printk("  Hardware features:%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
+    printk("  Hardware features:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
            (_7d0 & cpufeat_mask(X86_FEATURE_IBRSB)) ? " IBRS/IBPB" : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_STIBP)) ? " STIBP"     : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_L1D_FLUSH)) ? " L1D_FLUSH" : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_SSBD))  ? " SSBD"      : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_MD_CLEAR)) ? " MD_CLEAR" : "",
+           (_7d0 & cpufeat_mask(X86_FEATURE_SRBDS_CTRL)) ? " SRBDS_CTRL" : "",
            (e8b  & cpufeat_mask(X86_FEATURE_IBPB))  ? " IBPB"      : "",
            (caps & ARCH_CAPS_IBRS_ALL)              ? " IBRS_ALL"  : "",
            (caps & ARCH_CAPS_RDCL_NO)               ? " RDCL_NO"   : "",
diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h
index 5ef80735b2..d1435db6a3 100644
--- a/xen/include/asm-x86/msr-index.h
+++ b/xen/include/asm-x86/msr-index.h
@@ -177,6 +177,9 @@
 #define MSR_IA32_VMX_TRUE_ENTRY_CTLS            0x490
 #define MSR_IA32_VMX_VMFUNC                     0x491
 
+#define MSR_MCU_OPT_CTRL                    0x00000123
+#define  MCU_OPT_CTRL_RNGDS_MITG_DIS        (_AC(1, ULL) <<  0)
+
 /* K7/K8 MSRs. Not complete. See the architecture manual for a more
    complete list. */
 #define MSR_K7_EVNTSEL0			0xc0010000
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index a14d8a7013..9d210e74a0 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -242,6 +242,7 @@ XEN_CPUFEATURE(IBPB,          8*32+12) /*A  IBPB support only (no IBRS, used by
 /* 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(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 */
 XEN_CPUFEATURE(IBRSB,         9*32+26) /*A  IBRS and IBPB support (used by Intel) */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.10


From xen-changelog-bounces@lists.xenproject.org Sun Jun 21 17:11:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 21 Jun 2020 17: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 1jn3Uw-0006Mk-GK; Sun, 21 Jun 2020 17: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=c5Ce=AC=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jn3Uv-0006Me-C9
 for xen-changelog@lists.xenproject.org; Sun, 21 Jun 2020 17:11:13 +0000
X-Inumbo-ID: 350ba902-b3e2-11ea-bdc7-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 350ba902-b3e2-11ea-bdc7-12813bfff9fa;
 Sun, 21 Jun 2020 17: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=hh0XXBCRolIHclCASIAmN6slJp6T5B+tY0enFFcZ11I=; b=KYYF9zKZi5h1uKNATWbNYbrtFI
 rw9c/H0D9KogdmxizhvzyXpiSxLr1krlJDhNDrnexN7xLF2L0VbWVWsUWmMIWsNT5GC/0YaAztBe1
 x9tjM3BYa9i0nJOx00RGevZU0QYOOpfbAdmvawFdjbB11HSWNIrkA3/rLBvHRZtFjcgE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jn3Uu-0006PU-3a
 for xen-changelog@lists.xenproject.org; Sun, 21 Jun 2020 17:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jn3Uu-000657-2O
 for xen-changelog@lists.xenproject.org; Sun, 21 Jun 2020 17:11:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.10] x86/spec-ctrl: Mitigate the Special Register Buffer
 Data Sampling sidechannel
Message-Id: <E1jn3Uu-000657-2O@xenbits.xenproject.org>
Date: Sun, 21 Jun 2020 17: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 a1a9b055a349748083665e42843f75d6db2c6a7b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 8 19:47:46 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jun 9 17:46:35 2020 +0100

    x86/spec-ctrl: Mitigate the Special Register Buffer Data Sampling sidechannel
    
    See patch documentation and comments.
    
    This is part of XSA-320 / CVE-2020-0543
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 6a49b9a7920c82015381740905582b666160d955)
---
 docs/misc/xen-command-line.markdown |  8 +++++++-
 xen/arch/x86/acpi/power.c           |  3 +++
 xen/arch/x86/smpboot.c              |  8 +++++---
 xen/arch/x86/spec_ctrl.c            | 41 ++++++++++++++++++++++++++++++++++++-
 xen/include/asm-x86/spec_ctrl.h     |  2 ++
 5 files changed, 57 insertions(+), 5 deletions(-)

diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown
index ab26a26381..b96f93c95e 100644
--- a/docs/misc/xen-command-line.markdown
+++ b/docs/misc/xen-command-line.markdown
@@ -1809,7 +1809,7 @@ false disable the quirk workaround, which is also the default.
 ### spec-ctrl (x86)
 > `= List of [ <bool>, xen=<bool>, {pv,hvm,msr-sc,rsb,md-clear}=<bool>,
 >              bti-thunk=retpoline|lfence|jmp, {ibrs,ibpb,ssbd,eager-fpu,
->              l1d-flush}=<bool> ]`
+>              l1d-flush,srb-lock}=<bool> ]`
 
 Controls for speculative execution sidechannel mitigations.  By default, Xen
 will pick the most appropriate mitigations based on compiled in support,
@@ -1881,6 +1881,12 @@ Irrespective of Xen's setting, the feature is virtualised for HVM guests to
 use.  By default, Xen will enable this mitigation on hardware believed to be
 vulnerable to L1TF.
 
+On hardware supporting SRBDS_CTRL, the `srb-lock=` option can be used to force
+or prevent Xen from protect the Special Register Buffer from leaking stale
+data. By default, Xen will enable this mitigation, except on parts where MDS
+is fixed and TAA is fixed/mitigated (in which case, there is believed to be no
+way for an attacker to obtain the stale data).
+
 ### sync\_console
 > `= <boolean>`
 
diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
index f3480aa800..4d72b6ce97 100644
--- a/xen/arch/x86/acpi/power.c
+++ b/xen/arch/x86/acpi/power.c
@@ -259,6 +259,9 @@ static int enter_state(u32 state)
     ci->spec_ctrl_flags |= (default_spec_ctrl_flags & SCF_ist_wrmsr);
     spec_ctrl_exit_idle(ci);
 
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+        wrmsrl(MSR_MCU_OPT_CTRL, default_xen_mcu_opt_ctrl);
+
  done:
     spin_debug_enable();
     local_irq_restore(flags);
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index cdf53afc1e..b4a09f2dc2 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -363,12 +363,14 @@ void start_secondary(void *unused)
         microcode_resume_cpu(cpu);
 
     /*
-     * If MSR_SPEC_CTRL is available, apply Xen's default setting and discard
-     * any firmware settings.  Note: MSR_SPEC_CTRL may only become available
-     * after loading microcode.
+     * If any speculative control MSRs are available, apply Xen's default
+     * settings.  Note: These MSRs may only become available after loading
+     * microcode.
      */
     if ( boot_cpu_has(X86_FEATURE_IBRSB) )
         wrmsrl(MSR_SPEC_CTRL, default_xen_spec_ctrl);
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+        wrmsrl(MSR_MCU_OPT_CTRL, default_xen_mcu_opt_ctrl);
 
     tsx_init(); /* Needs microcode.  May change HLE/RTM feature bits. */
 
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index b7733b34f6..cc0946b963 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -63,6 +63,9 @@ static unsigned int __initdata l1d_maxphysaddr;
 static bool __initdata cpu_has_bug_msbds_only; /* => minimal HT impact. */
 static bool __initdata cpu_has_bug_mds; /* Any other M{LP,SB,FB}DS combination. */
 
+static int8_t __initdata opt_srb_lock = -1;
+uint64_t __read_mostly default_xen_mcu_opt_ctrl;
+
 static int __init parse_bti(const char *s)
 {
     const char *ss;
@@ -150,6 +153,7 @@ static int __init parse_spec_ctrl(const char *s)
             opt_ibpb = false;
             opt_ssbd = false;
             opt_l1d_flush = 0;
+            opt_srb_lock = 0;
         }
         else if ( val > 0 )
             rc = -EINVAL;
@@ -215,6 +219,8 @@ static int __init parse_spec_ctrl(const char *s)
             opt_eager_fpu = val;
         else if ( (val = parse_boolean("l1d-flush", s, ss)) >= 0 )
             opt_l1d_flush = val;
+        else if ( (val = parse_boolean("srb-lock", s, ss)) >= 0 )
+            opt_srb_lock = val;
         else
             rc = -EINVAL;
 
@@ -378,7 +384,7 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
                "\n");
 
     /* Settings for Xen's protection, irrespective of guests. */
-    printk("  Xen settings: BTI-Thunk %s, SPEC_CTRL: %s%s%s, Other:%s%s%s\n",
+    printk("  Xen settings: BTI-Thunk %s, SPEC_CTRL: %s%s%s, Other:%s%s%s%s\n",
            thunk == THUNK_NONE      ? "N/A" :
            thunk == THUNK_RETPOLINE ? "RETPOLINE" :
            thunk == THUNK_LFENCE    ? "LFENCE" :
@@ -389,6 +395,8 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
            (default_xen_spec_ctrl & SPEC_CTRL_SSBD)  ? " SSBD+" : " SSBD-",
            !(caps & ARCH_CAPS_TSX_CTRL)              ? "" :
            (opt_tsx & 1)                             ? " TSX+" : " TSX-",
+           !boot_cpu_has(X86_FEATURE_SRBDS_CTRL)     ? "" :
+           opt_srb_lock                              ? " SRB_LOCK+" : " SRB_LOCK-",
            opt_ibpb                                  ? " IBPB"  : "",
            opt_l1d_flush                             ? " L1D_FLUSH" : "",
            opt_md_clear_pv || opt_md_clear_hvm       ? " VERW"  : "");
@@ -1176,6 +1184,34 @@ void __init init_speculation_mitigations(void)
         tsx_init();
     }
 
+    /* Calculate suitable defaults for MSR_MCU_OPT_CTRL */
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+    {
+        uint64_t val;
+
+        rdmsrl(MSR_MCU_OPT_CTRL, val);
+
+        /*
+         * On some SRBDS-affected hardware, it may be safe to relax srb-lock
+         * by default.
+         *
+         * On parts which enumerate MDS_NO and not TAA_NO, TSX is the only way
+         * to access the Fill Buffer.  If TSX isn't available (inc. SKU
+         * reasons on some models), or TSX is explicitly disabled, then there
+         * is no need for the extra overhead to protect RDRAND/RDSEED.
+         */
+        if ( opt_srb_lock == -1 &&
+             (caps & (ARCH_CAPS_MDS_NO|ARCH_CAPS_TAA_NO)) == ARCH_CAPS_MDS_NO &&
+             (!cpu_has_hle || ((caps & ARCH_CAPS_TSX_CTRL) && opt_tsx == 0)) )
+            opt_srb_lock = 0;
+
+        val &= ~MCU_OPT_CTRL_RNGDS_MITG_DIS;
+        if ( !opt_srb_lock )
+            val |= MCU_OPT_CTRL_RNGDS_MITG_DIS;
+
+        default_xen_mcu_opt_ctrl = val;
+    }
+
     print_details(thunk, caps);
 
     /*
@@ -1207,6 +1243,9 @@ void __init init_speculation_mitigations(void)
 
         wrmsrl(MSR_SPEC_CTRL, bsp_delay_spec_ctrl ? 0 : default_xen_spec_ctrl);
     }
+
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+        wrmsrl(MSR_MCU_OPT_CTRL, default_xen_mcu_opt_ctrl);
 }
 
 static void __init __maybe_unused build_assertions(void)
diff --git a/xen/include/asm-x86/spec_ctrl.h b/xen/include/asm-x86/spec_ctrl.h
index 98a0a504f6..df862ec4d0 100644
--- a/xen/include/asm-x86/spec_ctrl.h
+++ b/xen/include/asm-x86/spec_ctrl.h
@@ -46,6 +46,8 @@ extern int8_t opt_pv_l1tf_hwdom, opt_pv_l1tf_domu;
  */
 extern paddr_t l1tf_addr_mask, l1tf_safe_maddr;
 
+extern uint64_t default_xen_mcu_opt_ctrl;
+
 static inline void init_shadow_spec_ctrl_state(void)
 {
     struct cpu_info *info = get_cpu_info();
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.10


From xen-changelog-bounces@lists.xenproject.org Sun Jun 21 17:11:23 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 21 Jun 2020 17:11:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jn3V5-0006No-I6; Sun, 21 Jun 2020 17:11:23 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=c5Ce=AC=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jn3V4-0006Nf-Mx
 for xen-changelog@lists.xenproject.org; Sun, 21 Jun 2020 17:11:22 +0000
X-Inumbo-ID: 3b189e2c-b3e2-11ea-bdc7-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 3b189e2c-b3e2-11ea-bdc7-12813bfff9fa;
 Sun, 21 Jun 2020 17: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=1Q9ed1kuNEpC6WjYhj3kjNYI7gxYnhcrDjUyzBg2GgQ=; b=BePbyYh38oO3jvagwD9qFdp+xw
 WoTOQVGrKH0ZDC1teiPnpIck9vX//KEqacqxlOSIi4ylG7FQDqCDkbs+OoJvMHpduhcU/dNMtiY/s
 B7NKfRWadHWM5xfCsRXrCQUJukGu3hIIlLbtf9VrgF0m6Z9kP5XqdGZhRsSE1c6SFAng=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jn3V4-0006Pb-7z
 for xen-changelog@lists.xenproject.org; Sun, 21 Jun 2020 17:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jn3V4-00066E-67
 for xen-changelog@lists.xenproject.org; Sun, 21 Jun 2020 17:11:22 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.10] tools/xentop : replace use of deprecated vwprintw
Message-Id: <E1jn3V4-00066E-67@xenbits.xenproject.org>
Date: Sun, 21 Jun 2020 17: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 e20bb5818174e9d09389776cb14781b9c6436554
Author:     Christopher Clark <christopher.w.clark@gmail.com>
AuthorDate: Wed Jul 18 15:22:17 2018 -0700
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Wed Jun 10 11:34:31 2020 +0100

    tools/xentop : replace use of deprecated vwprintw
    
    gcc-8.1 complains:
    
    | xentop.c: In function 'print':
    | xentop.c:304:4: error: 'vwprintw' is deprecated [-Werror=deprecated-declarations]
    |     vwprintw(stdscr, (curses_str_t)fmt, args);
    |     ^~~~~~~~
    
    vw_printw (note the underscore) is a non-deprecated alternative.
    
    Signed-off-by: Christopher Clark <christopher.clark6@baesystems.com>
    Acked-by: Wei Liu <wei.liu2@citrix.com>
    (cherry picked from commit 2b50cdbc444c637575580dcfa6c9525a84d5cc62)
---
 tools/xenstat/xentop/xentop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/xenstat/xentop/xentop.c b/tools/xenstat/xentop/xentop.c
index 2fd2b6742e..c46581062b 100644
--- a/tools/xenstat/xentop/xentop.c
+++ b/tools/xenstat/xentop/xentop.c
@@ -301,7 +301,7 @@ static void print(const char *fmt, ...)
 	if (!batch) {
 		if((current_row() < lines()-1)) {
 			va_start(args, fmt);
-			vwprintw(stdscr, (curses_str_t)fmt, args);
+			vw_printw(stdscr, (curses_str_t)fmt, args);
 			va_end(args);
 		}
 	} else {
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.10


From xen-changelog-bounces@lists.xenproject.org Sun Jun 21 17:11:34 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 21 Jun 2020 17:11:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jn3VG-0006PZ-Jn; Sun, 21 Jun 2020 17: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=c5Ce=AC=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jn3VF-0006PO-3B
 for xen-changelog@lists.xenproject.org; Sun, 21 Jun 2020 17:11:33 +0000
X-Inumbo-ID: 41185286-b3e2-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 41185286-b3e2-11ea-b7bb-bc764e2007e4;
 Sun, 21 Jun 2020 17: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=Pas/QPZIZD90SYESgO6/2V0+ot7TMWMuTAEPWbaIvj8=; b=JXMUZG3Vgt62YOj8YSpxGAuHqp
 vRnuzqNi9SZ+PO3eDN/X0XxjCkPJ6AKzHT9fNkpxy3cZsUBH6RoYqVCfRNTHhVSI7NZ4HjZeZjWb+
 U5fYY96aNxgRypCxC2gP78rR+h3WmYtG19FO97LoKUauz3zkCAUbA4aiDAHtZvN9Ad3Q=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jn3VE-0006Pi-B0
 for xen-changelog@lists.xenproject.org; Sun, 21 Jun 2020 17:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jn3VE-00067X-AB
 for xen-changelog@lists.xenproject.org; Sun, 21 Jun 2020 17:11:32 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.10] tools/libxc: fix strncpy size
Message-Id: <E1jn3VE-00067X-AB@xenbits.xenproject.org>
Date: Sun, 21 Jun 2020 17: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 6df4d40d846eb5151a89d26d1a63d632c6b9eb55
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Thu Apr 5 03:50:49 2018 +0200
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Wed Jun 10 11:50:16 2020 +0100

    tools/libxc: fix strncpy size
    
    gcc-8 warns about possible truncation of trailing '\0'.
    Final character is overridden by '\0' anyway, so don't bother to copy
    it.
    
    This fixes compile failure:
    
        xc_pm.c: In function 'xc_set_cpufreq_gov':
        xc_pm.c:308:5: error: 'strncpy' specified bound 16 equals destination size [-Werror=stringop-truncation]
             strncpy(scaling_governor, govname, CPUFREQ_NAME_LEN);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        cc1: all warnings being treated as errors
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Wei Liu <wei.liu2@citrix.com>
    Release-Acked-by: Juergen Gross <jgross@suse.com>
    (cherry picked from commit fa7789ef18bd2e716997937af71b2e4b5b00a159)
---
 tools/libxc/xc_pm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libxc/xc_pm.c b/tools/libxc/xc_pm.c
index ae917bc630..0fc47047ce 100644
--- a/tools/libxc/xc_pm.c
+++ b/tools/libxc/xc_pm.c
@@ -305,7 +305,7 @@ int xc_set_cpufreq_gov(xc_interface *xch, int cpuid, char *govname)
     sysctl.cmd = XEN_SYSCTL_pm_op;
     sysctl.u.pm_op.cmd = SET_CPUFREQ_GOV;
     sysctl.u.pm_op.cpuid = cpuid;
-    strncpy(scaling_governor, govname, CPUFREQ_NAME_LEN);
+    strncpy(scaling_governor, govname, CPUFREQ_NAME_LEN - 1);
     scaling_governor[CPUFREQ_NAME_LEN - 1] = '\0';
 
     return xc_sysctl(xch, &sysctl);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.10


From xen-changelog-bounces@lists.xenproject.org Sun Jun 21 17:11:43 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 21 Jun 2020 17:11:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jn3VP-0006QR-LW; Sun, 21 Jun 2020 17:11:43 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=c5Ce=AC=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jn3VO-0006QI-Tw
 for xen-changelog@lists.xenproject.org; Sun, 21 Jun 2020 17:11:42 +0000
X-Inumbo-ID: 4722c594-b3e2-11ea-bdc7-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 4722c594-b3e2-11ea-bdc7-12813bfff9fa;
 Sun, 21 Jun 2020 17: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=burVj2y+OOh9NBSDXkAq9emsW5dGpH4Rx5F0BApyFLs=; b=Mccyodr2TSAango3Rh5sbn1jtq
 LVHAIs8GjU445BQd14DiEVzJSBAM1J88038Lwiu5txMeLNN4Mab3hLSogtJsjlk+gzLaZt38mbKBr
 dLQJWv5m3x+5tA13eMFmGQgzpnsYMfOpekKDJ+mN+KmJB3ze+a4mKvwLDGAe3pcM2gxQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jn3VO-0006Pr-EF
 for xen-changelog@lists.xenproject.org; Sun, 21 Jun 2020 17:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jn3VO-00068V-DG
 for xen-changelog@lists.xenproject.org; Sun, 21 Jun 2020 17:11:42 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.10] tools/xenpmd: fix possible '\0' truncation
Message-Id: <E1jn3VO-00068V-DG@xenbits.xenproject.org>
Date: Sun, 21 Jun 2020 17: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 bf467cc828bde380e9201d8b49c7866a5b92d719
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Thu Apr 5 03:50:53 2018 +0200
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Wed Jun 10 11:51:09 2020 +0100

    tools/xenpmd: fix possible '\0' truncation
    
    gcc-8 complains:
        xenpmd.c:207:9: error: 'strncpy' specified bound 32 equals destination size [-Werror=stringop-truncation]
                 strncpy(info->oem_info, attrib_value, 32);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        xenpmd.c:201:9: error: 'strncpy' specified bound 32 equals destination size [-Werror=stringop-truncation]
                 strncpy(info->battery_type, attrib_value, 32);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        xenpmd.c:195:9: error: 'strncpy' specified bound 32 equals destination size [-Werror=stringop-truncation]
                 strncpy(info->serial_number, attrib_value, 32);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        xenpmd.c:189:9: error: 'strncpy' specified bound 32 equals destination size [-Werror=stringop-truncation]
                 strncpy(info->model_number, attrib_value, 32);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    Copy 31 chars, then make sure terminating '\0' is present. Those fields
    are passed to strlen and as '%s' for snprintf later.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Wei Liu <wei.liu2@citrix.com>
    Release-Acked-by: Juergen Gross <jgross@suse.com>
    (cherry picked from commit 938c8f53b1f80175c6f7a1399efdb984abb0cb8b)
---
 tools/xenpmd/xenpmd.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/tools/xenpmd/xenpmd.c b/tools/xenpmd/xenpmd.c
index 689c8fd670..56412a9a81 100644
--- a/tools/xenpmd/xenpmd.c
+++ b/tools/xenpmd/xenpmd.c
@@ -186,25 +186,29 @@ void set_attribute_battery_info(char *attrib_name,
 
     if ( strstr(attrib_name, "model number") ) 
     {
-        strncpy(info->model_number, attrib_value, 32);
+        strncpy(info->model_number, attrib_value, 31);
+        info->model_number[31] = '\0';
         return;
     }
 
     if ( strstr(attrib_name, "serial number") ) 
     {
-        strncpy(info->serial_number, attrib_value, 32);
+        strncpy(info->serial_number, attrib_value, 31);
+        info->serial_number[31] = '\0';
         return;
     }
 
     if ( strstr(attrib_name, "battery type") ) 
     {
-        strncpy(info->battery_type, attrib_value, 32);
+        strncpy(info->battery_type, attrib_value, 31);
+        info->battery_type[31] = '\0';
         return;
     }
 
     if ( strstr(attrib_name, "OEM info") ) 
     {
-        strncpy(info->oem_info, attrib_value, 32);
+        strncpy(info->oem_info, attrib_value, 31);
+        info->oem_info[31] = '\0';
         return;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.10


From xen-changelog-bounces@lists.xenproject.org Sun Jun 21 17:11:54 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 21 Jun 2020 17:11:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jn3Va-0006Ro-Ox; Sun, 21 Jun 2020 17:11: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=c5Ce=AC=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jn3VZ-0006Re-3L
 for xen-changelog@lists.xenproject.org; Sun, 21 Jun 2020 17:11:53 +0000
X-Inumbo-ID: 4d1f9300-b3e2-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 4d1f9300-b3e2-11ea-bb8b-bc764e2007e4;
 Sun, 21 Jun 2020 17:11: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=Ff86dX1+qQXU1fO99/l7rtO5OBLN1OZeobe1AVWNBSA=; b=60e6h9lgOMYguxUX4AFpoRUqsJ
 jLrZ5UWrZtVwVror+a6sLj6yL3bvndTjN/FOJGgFTFabHjgVUrKI4SB4VeXtZIKB/M72i64hfxdNu
 8bJU4hHDrVPXsxC/QkltgDx9W36/6RD/py0vfgp1/rYjDFWiOPB2sm6dt9EBFnV02rtk=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jn3VY-0006Q7-HN
 for xen-changelog@lists.xenproject.org; Sun, 21 Jun 2020 17:11:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jn3VY-00069H-GW
 for xen-changelog@lists.xenproject.org; Sun, 21 Jun 2020 17:11:52 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.10] tools/gdbsx: fix -Wstringop-truncation warning
Message-Id: <E1jn3VY-00069H-GW@xenbits.xenproject.org>
Date: Sun, 21 Jun 2020 17:11: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 2f83654fa3331d1ec79275072f8742f175f82bc5
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Thu Apr 5 03:50:54 2018 +0200
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Wed Jun 10 11:51:15 2020 +0100

    tools/gdbsx: fix -Wstringop-truncation warning
    
    gcc-8 complains:
    
        gx_main.c: In function 'prepare_stop_reply':
        gx_main.c:385:9: error: 'strncpy' output truncated before terminating nul copying 6 bytes from a string of the same length [-Werror=stringop-truncation]
                 strncpy(buf, "watch:", 6);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~
    
    Since terminating '\0' isn't needed here at all, switch to memcpy.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Wei Liu <wei.liu2@citrix.com>
    Release-Acked-by: Juergen Gross <jgross@suse.com>
    (cherry picked from commit 7f601f7c341c80d554615556d60e3b8ed1e5ad4f)
---
 tools/debugger/gdbsx/gx/gx_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/debugger/gdbsx/gx/gx_main.c b/tools/debugger/gdbsx/gx/gx_main.c
index a908c45e1d..6dfa501145 100644
--- a/tools/debugger/gdbsx/gx/gx_main.c
+++ b/tools/debugger/gdbsx/gx/gx_main.c
@@ -382,7 +382,7 @@ prepare_stop_reply(enum target_signal sig, char *buf, vcpuid_t vcpu)
 
     /* TBD: check if we stopped because of watchpoint */
     if (watchpoint_stop()) {
-        strncpy(buf, "watch:", 6);
+        memcpy(buf, "watch:", 6);
         buf += 6;
         /* TBD: **/
     }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.10


From xen-changelog-bounces@lists.xenproject.org Sun Jun 21 17:12:04 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 21 Jun 2020 17:12:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jn3Vk-0006Sj-Qk; Sun, 21 Jun 2020 17:12:04 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=c5Ce=AC=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jn3Vj-0006SY-EV
 for xen-changelog@lists.xenproject.org; Sun, 21 Jun 2020 17:12:03 +0000
X-Inumbo-ID: 53272fec-b3e2-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 53272fec-b3e2-11ea-bca7-bc764e2007e4;
 Sun, 21 Jun 2020 17:12: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=oozo5XQiFb1x4Q5hU9xCfBFB9VKAd1Ij5SkST72U18U=; b=6E858x3WG1pOx+mwni9tQ7jL8K
 06g58LyyWg9p1k/hO/aBiFGUUq88ILZQ0ru354SOffQ3qt+Ec94Kfd4aAzY3wpOzpkXHe2RZv5SmF
 J2vKz6s9G4FUWdmf5OfHszXZHlm2+aX7DvRrZUzcpPtfwuPZI0tKAkfMoOVGUwmYfsWk=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jn3Vi-0006QU-L8
 for xen-changelog@lists.xenproject.org; Sun, 21 Jun 2020 17:12:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jn3Vi-0006AK-Jm
 for xen-changelog@lists.xenproject.org; Sun, 21 Jun 2020 17:12:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.10] tools/blktap2: fix possible '\0' truncation
Message-Id: <E1jn3Vi-0006AK-Jm@xenbits.xenproject.org>
Date: Sun, 21 Jun 2020 17:12: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 dfc0b23403a2f0069bc7b9c0c20dfe5513eb8fb5
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Thu Apr 5 03:50:52 2018 +0200
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Wed Jun 10 11:51:20 2020 +0100

    tools/blktap2: fix possible '\0' truncation
    
    gcc-8 complains:
    
        tapdisk-vbd.c: In function 'tapdisk_vbd_resume_ring':
        tapdisk-vbd.c:1671:53: error: 'snprintf' output may be truncated before the last format character [-Werror=format-truncation=]
           snprintf(params.name, sizeof(params.name) - 1, "%s", message);
                                                             ^
        tapdisk-vbd.c:1671:3: note: 'snprintf' output between 1 and 256 bytes into a destination of size 255
           snprintf(params.name, sizeof(params.name) - 1, "%s", message);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    The "- 1" in buffer size should be actually applied to message, to leave
    place for terminating '\0', not the other way around (truncate '\0' even
    if it would fit).
    
        In function 'tapdisk_control_open_image',
            inlined from 'tapdisk_control_handle_request' at tapdisk-control.c:660:10:
        tapdisk-control.c:465:2: error: 'strncpy' specified bound 256 equals destination size [-Werror=stringop-truncation]
          strncpy(params.name, vbd->name, BLKTAP2_MAX_MESSAGE_LEN);
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
        In function 'tapdisk_control_create_socket',
            inlined from 'tapdisk_control_open' at tapdisk-control.c:836:9:
        tapdisk-control.c:793:2: error: 'strncpy' specified bound 108 equals destination size [-Werror=stringop-truncation]
          strncpy(saddr.sun_path, td_control.path, sizeof(saddr.sun_path));
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
        block-qcow.c: In function 'qcow_create':
        block-qcow.c:1216:5: error: 'strncpy' specified bound 4096 equals destination size [-Werror=stringop-truncation]
             strncpy(backing_filename, backing_file,
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              sizeof(backing_filename));
              ~~~~~~~~~~~~~~~~~~~~~~~~~
    
    I those cases, reduce size of copied string and make sure final '\0' is
    added.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Wei Liu <wei.liu2@citrix.com>
    Release-Acked-by: Juergen Gross <jgross@suse.com>
    (cherry picked from commit 850e89b3ef1a7be6b71fa7ae22333c884e08431a)
---
 tools/blktap2/drivers/block-qcow.c      | 3 ++-
 tools/blktap2/drivers/tapdisk-control.c | 5 +++--
 tools/blktap2/drivers/tapdisk-vbd.c     | 3 ++-
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/tools/blktap2/drivers/block-qcow.c b/tools/blktap2/drivers/block-qcow.c
index b45bcaa077..ae439221ab 100644
--- a/tools/blktap2/drivers/block-qcow.c
+++ b/tools/blktap2/drivers/block-qcow.c
@@ -1214,7 +1214,8 @@ int qcow_create(const char *filename, uint64_t total_size,
 			if (p && (p - backing_file) >= 2) {
 				/* URL like but exclude "c:" like filenames */
 				strncpy(backing_filename, backing_file,
-					sizeof(backing_filename));
+					sizeof(backing_filename) - 1);
+				backing_filename[sizeof(backing_filename) - 1] = '\0';
 			} else {
 				if (realpath(backing_file, backing_filename) == NULL ||
 				    stat(backing_filename, &st) != 0) {
diff --git a/tools/blktap2/drivers/tapdisk-control.c b/tools/blktap2/drivers/tapdisk-control.c
index 0b5cf3cdd3..3ca5713063 100644
--- a/tools/blktap2/drivers/tapdisk-control.c
+++ b/tools/blktap2/drivers/tapdisk-control.c
@@ -462,7 +462,8 @@ tapdisk_control_open_image(struct tapdisk_control_connection *connection,
 
 	params.capacity = image.size;
 	params.sector_size = image.secsize;
-	strncpy(params.name, vbd->name, BLKTAP2_MAX_MESSAGE_LEN);
+	strncpy(params.name, vbd->name, BLKTAP2_MAX_MESSAGE_LEN - 1);
+	params.name[BLKTAP2_MAX_MESSAGE_LEN - 1] = '\0';
 
 	err = ioctl(vbd->ring.fd, BLKTAP2_IOCTL_CREATE_DEVICE, &params);
 	if (err && errno != EEXIST) {
@@ -790,7 +791,7 @@ tapdisk_control_create_socket(char **socket_path)
 	}
 
 	memset(&saddr, 0, sizeof(saddr));
-	strncpy(saddr.sun_path, td_control.path, sizeof(saddr.sun_path));
+	strncpy(saddr.sun_path, td_control.path, sizeof(saddr.sun_path) - 1);
 	saddr.sun_family = AF_UNIX;
 
 	err = bind(td_control.socket,
diff --git a/tools/blktap2/drivers/tapdisk-vbd.c b/tools/blktap2/drivers/tapdisk-vbd.c
index fd4999a5ec..842a427861 100644
--- a/tools/blktap2/drivers/tapdisk-vbd.c
+++ b/tools/blktap2/drivers/tapdisk-vbd.c
@@ -1668,7 +1668,8 @@ out:
 
 		params.sector_size = image.secsize;
 		params.capacity    = image.size;
-		snprintf(params.name, sizeof(params.name) - 1, "%s", message);
+		snprintf(params.name, sizeof(params.name),
+			 "%.*s", (int)sizeof(params.name) - 1, message);
 
 		ioctl(vbd->ring.fd, BLKTAP2_IOCTL_SET_PARAMS, &params);
 		td_flag_clear(vbd->state, TD_VBD_PAUSED);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.10


From xen-changelog-bounces@lists.xenproject.org Sun Jun 21 17:12:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 21 Jun 2020 17:12:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jn3Vu-0006Tp-Sa; Sun, 21 Jun 2020 17:12: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=c5Ce=AC=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jn3Vt-0006Ta-4i
 for xen-changelog@lists.xenproject.org; Sun, 21 Jun 2020 17:12:13 +0000
X-Inumbo-ID: 59297e5e-b3e2-11ea-bdc7-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 59297e5e-b3e2-11ea-bdc7-12813bfff9fa;
 Sun, 21 Jun 2020 17:12: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=a5Rb+QTKCr8LdirI0tg9NEtgyfblijHPklVlMiQ/Ap8=; b=4Sa/veGHkHMdSjexkOkMSfF2qa
 PC7zAku0yVpSV1AvtrBJC/X2+181ToaVSzM6hGNIm50fDJk9EK+LH9Jo70kQ6dqqTV6noFhKl6tbA
 cVt1Nwt9DJsfHXhAk+kt55HeGqGeQ7WkBZ7JI6UAlNFiB87q3DnKrTJZCtLo9fDvDhE8=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jn3Vs-0006R6-OD
 for xen-changelog@lists.xenproject.org; Sun, 21 Jun 2020 17:12:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jn3Vs-0006BH-NM
 for xen-changelog@lists.xenproject.org; Sun, 21 Jun 2020 17:12:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.10] tools/misc: fix hypothetical buffer overflow in
 xen-lowmemd
Message-Id: <E1jn3Vs-0006BH-NM@xenbits.xenproject.org>
Date: Sun, 21 Jun 2020 17:12: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 6e636f297f12a52ce12db11ea0787dd541937ed6
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Thu Apr 5 03:50:50 2018 +0200
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Wed Jun 10 11:52:02 2020 +0100

    tools/misc: fix hypothetical buffer overflow in xen-lowmemd
    
    gcc-8 complains:
    
        xen-lowmemd.c: In function 'handle_low_mem':
        xen-lowmemd.c:80:55: error: '%s' directive output may be truncated writing up to 511 bytes into a region of size 489 [-Werror=format-truncation=]
                 snprintf(error, BUFSZ,"Failed to write target %s to xenstore", data);
                                                               ^~               ~~~~
        xen-lowmemd.c:80:9: note: 'snprintf' output between 36 and 547 bytes into a destination of size 512
                 snprintf(error, BUFSZ,"Failed to write target %s to xenstore", data);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    In practice it wouldn't happen, because 'data' contains string
    representation of 64-bit unsigned number (20 characters at most).
    But place a limit to mute gcc warning.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Wei Liu <wei.liu2@citrix.com>
    Release-Acked-by: Juergen Gross <jgross@suse.com>
    (cherry picked from commit 27751d89248c8c5eef6d8b56eb8f7d2084145080)
---
 tools/misc/xen-lowmemd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/misc/xen-lowmemd.c b/tools/misc/xen-lowmemd.c
index 865a54cec1..79ad34cb4a 100644
--- a/tools/misc/xen-lowmemd.c
+++ b/tools/misc/xen-lowmemd.c
@@ -77,7 +77,7 @@ void handle_low_mem(void)
     if (!xs_write(xs_handle, XBT_NULL, 
             "/local/domain/0/memory/target", data, strlen(data)))
     {
-        snprintf(error, BUFSZ,"Failed to write target %s to xenstore", data);
+        snprintf(error, BUFSZ,"Failed to write target %.24s to xenstore", data);
         perror(error);
     }
 }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.10


From xen-changelog-bounces@lists.xenproject.org Sun Jun 21 17:12:24 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 21 Jun 2020 17:12:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jn3W4-0006Uw-UL; Sun, 21 Jun 2020 17:12: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=c5Ce=AC=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jn3W3-0006Uk-8T
 for xen-changelog@lists.xenproject.org; Sun, 21 Jun 2020 17:12:23 +0000
X-Inumbo-ID: 5f2fc2c2-b3e2-11ea-bdc7-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 5f2fc2c2-b3e2-11ea-bdc7-12813bfff9fa;
 Sun, 21 Jun 2020 17:12:23 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=DV1sOvsC+UJP5iopyZtXlhTtkRMkGVkpQ0HlOq8JYAw=; b=Mj5rr5o33/03WQ619K0ibTUYt4
 dArkU41J15as6sAL1bUXD57ubLJ7mnWvNJR0RjKMl6B5vXGFk8eC3xC7+P3hH/1YZbV0l/+sbC0l7
 TVImJt6mUncEdqUXu4dbdPyJ87adQ66rxOtk79YEr1Rc/rh3G8YwujJqAKks0CrwrY7M=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jn3W2-0006RE-RP
 for xen-changelog@lists.xenproject.org; Sun, 21 Jun 2020 17:12:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jn3W2-0006C2-QW
 for xen-changelog@lists.xenproject.org; Sun, 21 Jun 2020 17:12:22 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.10] tools/ocaml/libs/xc fix gcc-8 format-truncation
 warning
Message-Id: <E1jn3W2-0006C2-QW@xenbits.xenproject.org>
Date: Sun, 21 Jun 2020 17:12: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 934d6e1a77947662504cf4d5e36c9520e03aa731
Author:     John Thomson <git@johnthomson.fastmail.com.au>
AuthorDate: Tue May 15 11:48:43 2018 +1000
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Wed Jun 10 11:57:16 2020 +0100

    tools/ocaml/libs/xc fix gcc-8 format-truncation warning
    
     CC       xenctrl_stubs.o
    xenctrl_stubs.c: In function 'failwith_xc':
    xenctrl_stubs.c:65:17: error: 'snprintf' output may be truncated before the last format character [-Werror=format-truncation=]
          "%d: %s: %s", error->code,
                     ^
    xenctrl_stubs.c:64:4: note: 'snprintf' output 6 or more bytes (assuming 1029) into a destination of size 1028
        snprintf(error_str, sizeof(error_str),
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          "%d: %s: %s", error->code,
          ~~~~~~~~~~~~~~~~~~~~~~~~~~
          xc_error_code_to_desc(error->code),
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          error->message);
          ~~~~~~~~~~~~~~~
    cc1: all warnings being treated as errors
    make[8]: *** [/build/xen-git/src/xen/tools/ocaml/libs/xc/../../Makefile.rules:37: xenctrl_stubs.o] Error 1
    m
    
    Signed-off-by: John Thomson <git@johnthomson.fastmail.com.au>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    Release-acked-by: Juergen Gross <jgross@suse.com>
    (cherry picked from commit 2adc90908fbb1e614c477e29f2d45eda94570795)
---
 tools/ocaml/libs/xc/xenctrl_stubs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index dd6000caa3..c486e69086 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -54,7 +54,7 @@
 
 static void Noreturn failwith_xc(xc_interface *xch)
 {
-	char error_str[1028];
+	char error_str[XC_MAX_ERROR_MSG_LEN + 6];
 	if (xch) {
 		const xc_error *error = xc_get_last_error(xch);
 		if (error->code == XC_ERROR_NONE)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.10


From xen-changelog-bounces@lists.xenproject.org Sun Jun 21 17:12:35 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 21 Jun 2020 17: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 1jn3WE-0006Wa-Vy; Sun, 21 Jun 2020 17:12: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=c5Ce=AC=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jn3WD-0006WO-Ju
 for xen-changelog@lists.xenproject.org; Sun, 21 Jun 2020 17:12:33 +0000
X-Inumbo-ID: 6533ffb2-b3e2-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 6533ffb2-b3e2-11ea-8496-bc764e2007e4;
 Sun, 21 Jun 2020 17:12: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=sqfAUeontjajNLd0NOX3Uc9kh7Nh9kiOVySvyfrBqao=; b=fb5rzlznnxFqhAm5RyfkHi0XwD
 mymERc3QXNKlIMzuFSL7KrzbfgK2p2ZbzBwSaJ3ZZJxqxhhZJZGiQEVE8XPBqUjoWYQNTwbu77OGB
 v3n9VeB0hZ9lPyekdfHVg+FNE4KI4sZTCqNYIIhVPuQ0QF0PM/UblDUIhsoeauxyhMyo=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jn3WC-0006RN-Uh
 for xen-changelog@lists.xenproject.org; Sun, 21 Jun 2020 17:12:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jn3WC-0006Cw-Tl
 for xen-changelog@lists.xenproject.org; Sun, 21 Jun 2020 17:12:32 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.10] x86/spec-ctrl: Allow the RDRAND/RDSEED features to
 be hidden
Message-Id: <E1jn3WC-0006Cw-Tl@xenbits.xenproject.org>
Date: Sun, 21 Jun 2020 17:12: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 ce056837082da7b2759a069045e480638094adcd
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 10 18:57:00 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jun 11 16:27:53 2020 +0100

    x86/spec-ctrl: Allow the RDRAND/RDSEED features to be hidden
    
    RDRAND/RDSEED can be hidden using cpuid= to mitigate SRBDS if microcode
    isn't available.
    
    This is part of XSA-320 / CVE-2020-0543.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    (cherry picked from commit 7028534d8482d25860c4d1aa8e45f0b911abfc5a)
---
 docs/misc/xen-command-line.markdown | 10 ++++++++--
 xen/arch/x86/cpuid.c                | 10 ++++++++++
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown
index b96f93c95e..aae80e82b6 100644
--- a/docs/misc/xen-command-line.markdown
+++ b/docs/misc/xen-command-line.markdown
@@ -494,12 +494,18 @@ choice of `dom0-kernel` is deprecated and not supported by all Dom0 kernels.
 This option allows for fine tuning of the facilities Xen will use, after
 accounting for hardware capabilities as enumerated via CPUID.
 
+Unless otherwise noted, options only have any effect in their negative form,
+to hide the named feature(s).  Ignoring a feature using this mechanism will
+cause Xen not to use the feature, nor offer them as usable to guests.
+
 Currently accepted:
 
 The Speculation Control hardware features `srbds-ctrl`, `md-clear`, `ibrsb`,
 `stibp`, `ibpb`, `l1d-flush` and `ssbd` are used by default if available and
-applicable.  They can be ignored, e.g. `no-ibrsb`, at which point Xen won't
-use them itself, and won't offer them to guests.
+applicable.  They can all be ignored.
+
+`rdrand` and `rdseed` can be ignored, as a mitigation to XSA-320 /
+CVE-2020-0543.
 
 ### cpuid\_mask\_cpu (AMD only)
 > `= fam_0f_rev_c | fam_0f_rev_d | fam_0f_rev_e | fam_0f_rev_f | fam_0f_rev_g | fam_10_rev_b | fam_10_rev_c | fam_11_rev_b`
diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 67a2a2e6a0..b5bef83d70 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -63,6 +63,16 @@ static int __init parse_xen_cpuid(const char *s)
             if ( !val )
                 setup_clear_cpu_cap(X86_FEATURE_SRBDS_CTRL);
         }
+        else if ( (val = parse_boolean("rdrand", s, ss)) >= 0 )
+        {
+            if ( !val )
+                setup_clear_cpu_cap(X86_FEATURE_RDRAND);
+        }
+        else if ( (val = parse_boolean("rdseed", s, ss)) >= 0 )
+        {
+            if ( !val )
+                setup_clear_cpu_cap(X86_FEATURE_RDSEED);
+        }
         else
             rc = -EINVAL;
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.10


From xen-changelog-bounces@lists.xenproject.org Sun Jun 21 17:12:45 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 21 Jun 2020 17:12: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 1jn3WP-0006Xb-1P; Sun, 21 Jun 2020 17:12:45 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=c5Ce=AC=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jn3WN-0006XN-ES
 for xen-changelog@lists.xenproject.org; Sun, 21 Jun 2020 17:12:43 +0000
X-Inumbo-ID: 6b38931e-b3e2-11ea-bdc7-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 6b38931e-b3e2-11ea-bdc7-12813bfff9fa;
 Sun, 21 Jun 2020 17:12: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=pjzeWdGDKC3AhfKntCqJnzyHjjPQI+Nf1AxfP4EAJ4c=; b=vcw/jvIpVxhZhU4dKT+gmlRYuv
 0eAw4aFrTBtDtJy4bU1zbpVmC/j+AgjiBUilU75BRA0LgCw329vCtXWY3IFpGilftpswFi9p89RxF
 Qe8hUEDKCQV/J/MQfXgmw6ULYk4VdcWAeOoIYzopLYIetHGAB5V/iVOkLTPZ5+P1zcFk=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jn3WN-0006Ra-1c
 for xen-changelog@lists.xenproject.org; Sun, 21 Jun 2020 17:12:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jn3WN-0006E8-0e
 for xen-changelog@lists.xenproject.org; Sun, 21 Jun 2020 17:12:43 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.10] lz4: refine commit 9143a6c55ef7 for the 64-bit case
Message-Id: <E1jn3WN-0006E8-0e@xenbits.xenproject.org>
Date: Sun, 21 Jun 2020 17:12: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 bd20589e6d687bd768b4016ccda0727b409b08e6
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Dec 11 15:34:51 2019 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Mon Jun 15 14:41:49 2020 +0100

    lz4: refine commit 9143a6c55ef7 for the 64-bit case
    
    I clearly went too far there: While the LZ4_WILDCOPY() instances indeed
    need prior guarding, LZ4_SECURECOPY() needs this only in the 32-bit case
    (where it simply aliases LZ4_WILDCOPY()). "cpy" can validly point
    (slightly) below "op" in these cases, due to
    
                    cpy = op + length - (STEPSIZE - 4);
    
    where length can be as low as 0 and STEPSIZE is 8. However, instead of
    removing the check via "#if !LZ4_ARCH64", refine it such that it would
    also properly work in the 64-bit case, aborting decompression instead
    of continuing on bogus input.
    
    Reported-by: Mark Pryor <pryorm09@gmail.com>
    Reported-by: Jeremi Piotrowski <jeremi.piotrowski@gmail.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Mark Pryor <pryorm09@gmail.com>
    Tested-by: Jeremi Piotrowski <jeremi.piotrowski@gmail.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 2d7572cdfa4d481c1ca246aa1ce5239ccae7eb59
    master date: 2019-12-09 14:01:25 +0100
    
    (cherry picked from commit 6561994b87af3e9cd28ee99c42e8b2697621687d)
---
 xen/common/lz4/decompress.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/common/lz4/decompress.c b/xen/common/lz4/decompress.c
index 94ad591331..e8636e193a 100644
--- a/xen/common/lz4/decompress.c
+++ b/xen/common/lz4/decompress.c
@@ -147,7 +147,7 @@ static int INIT lz4_uncompress(const unsigned char *source, unsigned char *dest,
 				goto _output_error;
 			continue;
 		}
-		if (unlikely((unsigned long)cpy < (unsigned long)op))
+		if (unlikely((unsigned long)cpy < (unsigned long)op - (STEPSIZE - 4)))
 			goto _output_error;
 		LZ4_SECURECOPY(ref, op, cpy);
 		op = cpy; /* correction */
@@ -279,7 +279,7 @@ static int lz4_uncompress_unknownoutputsize(const unsigned char *source,
 				goto _output_error;
 			continue;
 		}
-		if (unlikely((unsigned long)cpy < (unsigned long)op))
+		if (unlikely((unsigned long)cpy < (unsigned long)op - (STEPSIZE - 4)))
 			goto _output_error;
 		LZ4_SECURECOPY(ref, op, cpy);
 		op = cpy; /* correction */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.10


From xen-changelog-bounces@lists.xenproject.org Sun Jun 21 17:12:55 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 21 Jun 2020 17:12:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jn3WZ-0006Yq-4V; Sun, 21 Jun 2020 17:12: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=c5Ce=AC=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jn3WX-0006Ye-OV
 for xen-changelog@lists.xenproject.org; Sun, 21 Jun 2020 17:12:53 +0000
X-Inumbo-ID: 713f62ce-b3e2-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 713f62ce-b3e2-11ea-8496-bc764e2007e4;
 Sun, 21 Jun 2020 17:12: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=uujq2CYYNJq8o9u+WgMb8vHHEwD5X49QTU37LZL4tmY=; b=N4piDT+E+SxG/ZUbMdboMnONJD
 hHCg1ytgPiTNhMuZIZHLfCzjA0BekT1Oeoo/8e2MoNUXPrYXnJkgD1/UEthfVbqhe+UKMITUpjeeq
 pXCSJpP9G9T39/3ezj7WGZ2LUQvtjSg0Nwmow6jQfcqX1ngLVDEFYA/9wqBHVZ3Oto6Q=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jn3WX-0006Ri-4h
 for xen-changelog@lists.xenproject.org; Sun, 21 Jun 2020 17:12:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jn3WX-0006FT-3o
 for xen-changelog@lists.xenproject.org; Sun, 21 Jun 2020 17:12:53 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.10] lz4: fix system halt at boot kernel on x86_64
Message-Id: <E1jn3WX-0006FT-3o@xenbits.xenproject.org>
Date: Sun, 21 Jun 2020 17:12: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 fd6e49ecae03840610fdc6a416a638590c0b6535
Author:     Krzysztof Kolasa <kkolasa@winsoft.pl>
AuthorDate: Wed Dec 11 15:35:39 2019 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Mon Jun 15 14:41:57 2020 +0100

    lz4: fix system halt at boot kernel on x86_64
    
    Sometimes, on x86_64, decompression fails with the following
    error:
    
    Decompressing Linux...
    
    Decoding failed
    
     -- System halted
    
    This condition is not needed for a 64bit kernel(from commit d5e7caf):
    
    if( ... ||
        (op + COPYLENGTH) > oend)
        goto _output_error
    
    macro LZ4_SECURE_COPY() tests op and does not copy any data
    when op exceeds the value.
    
    added by analogy to lz4_uncompress_unknownoutputsize(...)
    
    Signed-off-by: Krzysztof Kolasa <kkolasa@winsoft.pl>
    [Linux commit 99b7e93c95c78952724a9783de6c78def8fbfc3f]
    
    The offending commit in our case is fcc17f96c277 ("LZ4 : fix the data
    abort issue").
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 5d90ff79542ab9c6eebe5c315c68c196bcf353b9
    master date: 2019-12-09 14:02:35 +0100
    
    (cherry picked from commit 14b62ab3e5a79816edfc6dd3afce1bb68c106ac5)
---
 xen/common/lz4/decompress.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/xen/common/lz4/decompress.c b/xen/common/lz4/decompress.c
index e8636e193a..bef3a9a99c 100644
--- a/xen/common/lz4/decompress.c
+++ b/xen/common/lz4/decompress.c
@@ -132,8 +132,12 @@ static int INIT lz4_uncompress(const unsigned char *source, unsigned char *dest,
 			/* Error: request to write beyond destination buffer */
 			if (cpy > oend)
 				goto _output_error;
+#if LZ4_ARCH64
+			if ((ref + COPYLENGTH) > oend)
+#else
 			if ((ref + COPYLENGTH) > oend ||
 					(op + COPYLENGTH) > oend)
+#endif
 				goto _output_error;
 			LZ4_SECURECOPY(ref, op, (oend - COPYLENGTH));
 			while (op < cpy)
@@ -266,7 +270,13 @@ static int lz4_uncompress_unknownoutputsize(const unsigned char *source,
 		if (cpy > oend - COPYLENGTH) {
 			if (cpy > oend)
 				goto _output_error; /* write outside of buf */
-
+#if LZ4_ARCH64
+			if ((ref + COPYLENGTH) > oend)
+#else
+			if ((ref + COPYLENGTH) > oend ||
+					(op + COPYLENGTH) > oend)
+#endif
+				goto _output_error;
 			LZ4_SECURECOPY(ref, op, (oend - COPYLENGTH));
 			while (op < cpy)
 				*op++ = *ref++;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.10


From xen-changelog-bounces@lists.xenproject.org Mon Jun 22 09:55:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 22 Jun 2020 09: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 1jnJAO-0004eR-8h; Mon, 22 Jun 2020 09: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=O5+D=AD=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jnJAN-0004eK-Md
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:55:03 +0000
X-Inumbo-ID: 712e5182-b46e-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 712e5182-b46e-11ea-bca7-bc764e2007e4;
 Mon, 22 Jun 2020 09: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=6XGPfA6SBcCh7oVvn8u2KqTthLhX/PtZvkX7ep927/k=; b=NUhtJAOYxTiO5IA37dHIvGUtVY
 K9ykFytiVoxuWazhM+X9IeSMdIP0zvxJSySxHhQV79LMF+kMgNvt+huSHBSjWaw8nnYGwAgunZcGz
 8E/RJTj1j5RIPCK2un8zb6CSvdat2fY2h7vk+qoceazVFQYhqWrHld63mqo1jofi8t3I=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jnJAM-0003Ki-F6
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jnJAM-0000KR-Ds
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:55:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] tools/libx[cl]: Introduce struct xc_xend_cpuid for
 xc_cpuid_set()
Message-Id: <E1jnJAM-0000KR-Ds@xenbits.xenproject.org>
Date: Mon, 22 Jun 2020 09: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 700738bf6a7a89a1b41cc783ae58f7c8ec1e9cfa
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jun 12 14:05:44 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jun 17 13:54:12 2020 +0100

    tools/libx[cl]: Introduce struct xc_xend_cpuid for xc_cpuid_set()
    
    In order to combine the functionality of xc_cpuid_set() with
    xc_cpuid_apply_policy(), arrange to pass the data in a single contained
    struct, rather than two arrays.
    
    libxl__cpuid_policy is the ideal structure to use, but that would introduce a
    reverse dependency between libxc and libxl.  Introduce xc_xend_cpuid (with a
    transparent union to provide more useful names for the inputs), and use this
    structure in libxl.
    
    The public API has libxl_cpuid_policy as an opaque type referencing
    libxl__cpuid_policy.  Drop the inappropriate comment about its internals, and
    use xc_xend_cpuid as a differently named opaque backing object.  Users of both
    libxl and libxc are not permitted to look at the internals.
    
    No change in behaviour.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/libxc/include/xenctrl.h | 30 ++++++++++++++++++++++++++++--
 tools/libxc/xc_cpuid_x86.c    | 39 +++++++++++----------------------------
 tools/libxl/libxl.h           |  8 ++++----
 tools/libxl/libxl_cpuid.c     |  7 +++----
 tools/libxl/libxl_internal.h  | 10 ----------
 5 files changed, 46 insertions(+), 48 deletions(-)

diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h
index 7f15a61f29..6e622fc8e4 100644
--- a/tools/libxc/include/xenctrl.h
+++ b/tools/libxc/include/xenctrl.h
@@ -1792,10 +1792,36 @@ int xc_domain_debug_control(xc_interface *xch,
                             uint32_t vcpu);
 
 #if defined(__i386__) || defined(__x86_64__)
+
+/*
+ * CPUID policy data, expressed in the legacy XEND format.
+ *
+ * Policy is an array of strings, 32 chars long:
+ *   policy[0] = eax
+ *   policy[1] = ebx
+ *   policy[2] = ecx
+ *   policy[3] = edx
+ *
+ * The format of the string is the following:
+ *   '1' -> force to 1
+ *   '0' -> force to 0
+ *   'x' -> we don't care (use default)
+ *   'k' -> pass through host value
+ *   's' -> legacy alias for 'k'
+ */
+struct xc_xend_cpuid {
+    union {
+        struct {
+            uint32_t leaf, subleaf;
+        };
+        uint32_t input[2];
+    };
+    char *policy[4];
+};
+
 int xc_cpuid_set(xc_interface *xch,
                  uint32_t domid,
-                 const unsigned int *input,
-                 const char **config);
+                 const struct xc_xend_cpuid *xend);
 
 /*
  * Make adjustments to the CPUID settings for a domain.
diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c
index b42edd6457..edc2ad9b47 100644
--- a/tools/libxc/xc_cpuid_x86.c
+++ b/tools/libxc/xc_cpuid_x86.c
@@ -259,27 +259,8 @@ int xc_set_domain_cpu_policy(xc_interface *xch, uint32_t domid,
     return ret;
 }
 
-/*
- * Configure a single input with the informatiom from config.
- *
- * Config is an array of strings:
- *   config[0] = eax
- *   config[1] = ebx
- *   config[2] = ecx
- *   config[3] = edx
- *
- * The format of the string is the following:
- *   '1' -> force to 1
- *   '0' -> force to 0
- *   'x' -> we don't care (use default)
- *   'k' -> pass through host value
- *   's' -> legacy alias for 'k'
- *
- * In all cases, the returned string consists of just '0' and '1'.
- */
 int xc_cpuid_set(
-    xc_interface *xch, uint32_t domid, const unsigned int *input,
-    const char **config)
+    xc_interface *xch, uint32_t domid, const struct xc_xend_cpuid *xend)
 {
     int rc;
     unsigned int i, j, regs[4] = {}, polregs[4] = {};
@@ -324,7 +305,8 @@ int xc_cpuid_set(
         goto fail;
     }
     for ( i = 0; i < policy_leaves; ++i )
-        if ( leaves[i].leaf == input[0] && leaves[i].subleaf == input[1] )
+        if ( leaves[i].leaf == xend->leaf &&
+             leaves[i].subleaf == xend->subleaf )
         {
             polregs[0] = leaves[i].a;
             polregs[1] = leaves[i].b;
@@ -345,7 +327,8 @@ int xc_cpuid_set(
         goto fail;
     }
     for ( i = 0; i < policy_leaves; ++i )
-        if ( leaves[i].leaf == input[0] && leaves[i].subleaf == input[1] )
+        if ( leaves[i].leaf == xend->leaf &&
+             leaves[i].subleaf == xend->subleaf )
         {
             regs[0] = leaves[i].a;
             regs[1] = leaves[i].b;
@@ -356,7 +339,7 @@ int xc_cpuid_set(
 
     for ( i = 0; i < 4; i++ )
     {
-        if ( config[i] == NULL )
+        if ( xend->policy[i] == NULL )
         {
             regs[i] = polregs[i];
             continue;
@@ -375,14 +358,14 @@ int xc_cpuid_set(
             unsigned char polval = !!((polregs[i] & (1U << (31 - j))));
 
             rc = -EINVAL;
-            if ( !strchr("10xks", config[i][j]) )
+            if ( !strchr("10xks", xend->policy[i][j]) )
                 goto fail;
 
-            if ( config[i][j] == '1' )
+            if ( xend->policy[i][j] == '1' )
                 val = 1;
-            else if ( config[i][j] == '0' )
+            else if ( xend->policy[i][j] == '0' )
                 val = 0;
-            else if ( config[i][j] == 'x' )
+            else if ( xend->policy[i][j] == 'x' )
                 val = polval;
 
             if ( val )
@@ -393,7 +376,7 @@ int xc_cpuid_set(
     }
 
     /* Feed the transformed leaf back up to Xen. */
-    leaves[0] = (xen_cpuid_leaf_t){ input[0], input[1],
+    leaves[0] = (xen_cpuid_leaf_t){ xend->leaf, xend->subleaf,
                                     regs[0], regs[1], regs[2], regs[3] };
     rc = xc_set_domain_cpu_policy(xch, domid, 1, leaves, 0, NULL,
                                   &err_leaf, &err_subleaf, &err_msr);
diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
index 71709dc585..1cd6c38e83 100644
--- a/tools/libxl/libxl.h
+++ b/tools/libxl/libxl.h
@@ -1310,11 +1310,11 @@ typedef struct {
 void libxl_bitmap_init(libxl_bitmap *map);
 void libxl_bitmap_dispose(libxl_bitmap *map);
 
-/* libxl_cpuid_policy_list is a dynamic array storing CPUID policies
- * for multiple leafs. It is terminated with an entry holding
- * XEN_CPUID_INPUT_UNUSED in input[0]
+/*
+ * libxl_cpuid_policy is opaque in the libxl ABI.  Users of both libxl and
+ * libxc may not make assumptions about xc_xend_cpuid.
  */
-typedef struct libxl__cpuid_policy libxl_cpuid_policy;
+typedef struct xc_xend_cpuid libxl_cpuid_policy;
 typedef libxl_cpuid_policy * libxl_cpuid_policy_list;
 void libxl_cpuid_dispose(libxl_cpuid_policy_list *cpuid_list);
 int libxl_cpuid_policy_list_length(const libxl_cpuid_policy_list *l);
diff --git a/tools/libxl/libxl_cpuid.c b/tools/libxl/libxl_cpuid.c
index 796ec4f2d9..e001cbcd4f 100644
--- a/tools/libxl/libxl_cpuid.c
+++ b/tools/libxl/libxl_cpuid.c
@@ -288,7 +288,7 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
     char *sep, *val, *endptr;
     int i;
     const struct cpuid_flags *flag;
-    struct libxl__cpuid_policy *entry;
+    struct xc_xend_cpuid *entry;
     unsigned long num;
     char flags[33], *resstr;
 
@@ -366,7 +366,7 @@ int libxl_cpuid_parse_config_xend(libxl_cpuid_policy_list *cpuid,
     char *endptr;
     unsigned long value;
     uint32_t leaf, subleaf = XEN_CPUID_INPUT_UNUSED;
-    struct libxl__cpuid_policy *entry;
+    struct xc_xend_cpuid *entry;
 
     /* parse the leaf number */
     value = strtoul(str, &endptr, 0);
@@ -442,8 +442,7 @@ void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid,
         return;
 
     for (i = 0; cpuid[i].input[0] != XEN_CPUID_INPUT_UNUSED; i++)
-        xc_cpuid_set(ctx->xch, domid, cpuid[i].input,
-                     (const char**)cpuid[i].policy);
+        xc_cpuid_set(ctx->xch, domid, &cpuid[i]);
 }
 
 static const char *input_names[2] = { "leaf", "subleaf" };
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index c7ece066c4..79c2bf5f5e 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -2056,16 +2056,6 @@ typedef yajl_gen_status (*libxl__gen_json_callback)(yajl_gen hand, void *);
 _hidden char *libxl__object_to_json(libxl_ctx *ctx, const char *type,
                                     libxl__gen_json_callback gen, void *p);
 
-  /* holds the CPUID response for a single CPUID leaf
-   * input contains the value of the EAX and ECX register,
-   * and each policy string contains a filter to apply to
-   * the host given values for that particular leaf.
-   */
-struct libxl__cpuid_policy {
-    uint32_t input[2];
-    char *policy[4];
-};
-
 _hidden void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid,
                                  libxl_domain_build_info *info);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jun 22 09:55:15 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 22 Jun 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 1jnJAZ-0004fT-AU; Mon, 22 Jun 2020 09: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=O5+D=AD=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jnJAY-0004fJ-LI
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:55:14 +0000
X-Inumbo-ID: 7727eb34-b46e-11ea-be66-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 7727eb34-b46e-11ea-be66-12813bfff9fa;
 Mon, 22 Jun 2020 09: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=6ZjCz+frKhcBRZkXcXoJtzkuiDZ6WSDhC3MEh7Plhp0=; b=Flr9GWjFah4cUJazZ629OjA8tZ
 8B8A5nTeV1zQv0ZbIdjNzyKTNZ5IPtHkBMI0rCDkYyotwxig6HehXwfiVQlYVfnP/lrMGbHthMxVz
 qomFXfqLkgp1zvCyAOdmzEmGTioqbeLqHLrvHdv9pxuaJ4UFNoSRl4DWdLxmBcTtcErg=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jnJAW-0003Kp-I4
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jnJAW-0000L2-HH
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:55:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] tests/cpu-policy: Confirm that CPUID serialisation is
 sorted
Message-Id: <E1jnJAW-0000L2-HH@xenbits.xenproject.org>
Date: Mon, 22 Jun 2020 09: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 c22ced93e167f56104111fcc414298c0cd2db3e9
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jun 12 16:48:02 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jun 17 13:54:12 2020 +0100

    tests/cpu-policy: Confirm that CPUID serialisation is sorted
    
    The existing x86_cpuid_copy_to_buffer() does produce sorted results, and we're
    about to start relying on this.  Extend the unit tests.
    
    As test_cpuid_serialise_success() is a fairly limited set of synthetic
    examples right now, introduce test_cpuid_current() to operate on the full
    policy for the current CPU.
    
    Tweak the fail() macro to allow for simplified control flow.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/tests/cpu-policy/test-cpu-policy.c | 49 +++++++++++++++++++++++++++++++-
 1 file changed, 48 insertions(+), 1 deletion(-)

diff --git a/tools/tests/cpu-policy/test-cpu-policy.c b/tools/tests/cpu-policy/test-cpu-policy.c
index fe8cdf6ea9..7ba9707236 100644
--- a/tools/tests/cpu-policy/test-cpu-policy.c
+++ b/tools/tests/cpu-policy/test-cpu-policy.c
@@ -16,7 +16,7 @@ static unsigned int nr_failures;
 #define fail(fmt, ...)                          \
 ({                                              \
     nr_failures++;                              \
-    printf(fmt, ##__VA_ARGS__);                 \
+    (void)printf(fmt, ##__VA_ARGS__);           \
 })
 
 #define memdup(ptr)                             \
@@ -66,6 +66,45 @@ static void test_vendor_identification(void)
     }
 }
 
+static bool leaves_are_sorted(const xen_cpuid_leaf_t *leaves, unsigned int nr)
+{
+    for ( unsigned int i = 1; i < nr; ++i )
+    {
+        /* leaf index went backwards => not sorted. */
+        if ( leaves[i - 1].leaf > leaves[i].leaf )
+            return false;
+
+        /* leaf index went forwards => ok */
+        if ( leaves[i - 1].leaf < leaves[i].leaf )
+            continue;
+
+        /* leave index the same, subleaf didn't increase => not sorted. */
+        if ( leaves[i - 1].subleaf >= leaves[i].subleaf )
+            return false;
+    }
+
+    return true;
+}
+
+static void test_cpuid_current(void)
+{
+    struct cpuid_policy p;
+    xen_cpuid_leaf_t leaves[CPUID_MAX_SERIALISED_LEAVES];
+    unsigned int nr = ARRAY_SIZE(leaves);
+    int rc;
+
+    printf("Testing CPUID on current CPU\n");
+
+    x86_cpuid_policy_fill_native(&p);
+
+    rc = x86_cpuid_copy_to_buffer(&p, leaves, &nr);
+    if ( rc != 0 )
+        return fail("  Serialise, expected rc 0, got %d\n", rc);
+
+    if ( !leaves_are_sorted(leaves, nr) )
+        return fail("  Leaves not sorted\n");
+}
+
 static void test_cpuid_serialise_success(void)
 {
     static const struct test {
@@ -178,6 +217,13 @@ static void test_cpuid_serialise_success(void)
             goto test_done;
         }
 
+        if ( !leaves_are_sorted(leaves, nr) )
+        {
+            fail("  Test %s, leaves not sorted\n",
+                 t->name);
+            goto test_done;
+        }
+
     test_done:
         free(leaves);
     }
@@ -613,6 +659,7 @@ int main(int argc, char **argv)
 
     test_vendor_identification();
 
+    test_cpuid_current();
     test_cpuid_serialise_success();
     test_cpuid_deserialise_failure();
     test_cpuid_out_of_range_clearing();
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jun 22 09:55:24 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 22 Jun 2020 09: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 1jnJAi-0004gq-CC; Mon, 22 Jun 2020 09: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=O5+D=AD=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jnJAh-0004gg-QC
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:55:23 +0000
X-Inumbo-ID: 7d29a6ee-b46e-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 7d29a6ee-b46e-11ea-bca7-bc764e2007e4;
 Mon, 22 Jun 2020 09: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=9hsCaFhSpr1MmGGfoxENZJbyBppCDevLvYjFin7eX7c=; b=SFfGrYPeKjOUTmv2stH0urRmo3
 6SgAioOvCKWv6rB0kzUFGn7cJvZDsxcZxCxZfvvrAvJBHDlaA31Fq6nbTMRBWtq3vvuW+ObtAGTBN
 1JPNIs5NkGFKEpiUuirz+OlrOGUZopeVqitkFA1iebZvhENKqpqDYcGFdvS0MtLZdOj0=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jnJAg-0003L6-Kz
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jnJAg-0000LW-KM
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:55:22 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] tools/libx[cl]: Move processing loop down into
 xc_cpuid_set()
Message-Id: <E1jnJAg-0000LW-KM@xenbits.xenproject.org>
Date: Mon, 22 Jun 2020 09: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 585c7f4317987b4e92a381d6178be238be4c9653
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jun 12 14:07:10 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jun 17 13:54:12 2020 +0100

    tools/libx[cl]: Move processing loop down into xc_cpuid_set()
    
    Currently, libxl__cpuid_legacy() passes each element of the policy list to
    xc_cpuid_set() individually.  This is wasteful both in terms of the number of
    hypercalls made, and the quantity of repeated merging/auditing work performed
    by Xen.
    
    Move the loop processing down into xc_cpuid_set(), which allows us to do one
    set of hypercalls, rather than one per list entry.
    
    In xc_cpuid_set(), obtain the full host, guest max and current policies to
    begin with, and loop over the xend array, processing one leaf at a time.
    Replace the linear search with a binary search, seeing as the serialised
    leaves are sorted.
    
    No change in behaviour from the guests point of view.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/libxc/xc_cpuid_x86.c | 159 +++++++++++++++++++++++++++------------------
 tools/libxl/libxl_cpuid.c  |   4 +-
 2 files changed, 95 insertions(+), 68 deletions(-)

diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c
index edc2ad9b47..548762e7b4 100644
--- a/tools/libxc/xc_cpuid_x86.c
+++ b/tools/libxc/xc_cpuid_x86.c
@@ -38,8 +38,6 @@ enum {
 
 #define bitmaskof(idx)      (1u << ((idx) & 31))
 #define featureword_of(idx) ((idx) >> 5)
-#define clear_feature(idx, dst) ((dst) &= ~bitmaskof(idx))
-#define set_feature(idx, dst)   ((dst) |=  bitmaskof(idx))
 
 int xc_get_cpu_levelling_caps(xc_interface *xch, uint32_t *caps)
 {
@@ -259,15 +257,42 @@ int xc_set_domain_cpu_policy(xc_interface *xch, uint32_t domid,
     return ret;
 }
 
+static int compare_leaves(const void *l, const void *r)
+{
+    const xen_cpuid_leaf_t *lhs = l;
+    const xen_cpuid_leaf_t *rhs = r;
+
+    if ( lhs->leaf != rhs->leaf )
+        return lhs->leaf < rhs->leaf ? -1 : 1;
+
+    if ( lhs->subleaf != rhs->subleaf )
+        return lhs->subleaf < rhs->subleaf ? -1 : 1;
+
+    return 0;
+}
+
+static xen_cpuid_leaf_t *find_leaf(
+    xen_cpuid_leaf_t *leaves, unsigned int nr_leaves,
+    const struct xc_xend_cpuid *xend)
+{
+    const xen_cpuid_leaf_t key = { xend->leaf, xend->subleaf };
+
+    return bsearch(&key, leaves, nr_leaves, sizeof(*leaves), compare_leaves);
+}
+
 int xc_cpuid_set(
     xc_interface *xch, uint32_t domid, const struct xc_xend_cpuid *xend)
 {
     int rc;
-    unsigned int i, j, regs[4] = {}, polregs[4] = {};
     xc_dominfo_t di;
-    xen_cpuid_leaf_t *leaves = NULL;
-    unsigned int nr_leaves, policy_leaves, nr_msrs;
+    unsigned int nr_leaves, nr_msrs;
     uint32_t err_leaf = -1, err_subleaf = -1, err_msr = -1;
+    /*
+     * Three full policies.  The host, domain max, and domain current for the
+     * domain type.
+     */
+    xen_cpuid_leaf_t *host = NULL, *max = NULL, *cur = NULL;
+    unsigned int nr_host, nr_max, nr_cur;
 
     if ( xc_domain_getinfo(xch, domid, 1, &di) != 1 ||
          di.domid != domid )
@@ -286,99 +311,101 @@ int xc_cpuid_set(
     }
 
     rc = -ENOMEM;
-    if ( (leaves = calloc(nr_leaves, sizeof(*leaves))) == NULL )
+    if ( (host = calloc(nr_leaves, sizeof(*host))) == NULL ||
+         (max  = calloc(nr_leaves, sizeof(*max)))  == NULL ||
+         (cur  = calloc(nr_leaves, sizeof(*cur)))  == NULL )
     {
         ERROR("Unable to allocate memory for %u CPUID leaves", nr_leaves);
         goto fail;
     }
 
+    /* Get the domain's current policy. */
+    nr_msrs = 0;
+    nr_cur = nr_leaves;
+    rc = xc_get_domain_cpu_policy(xch, domid, &nr_cur, cur, &nr_msrs, NULL);
+    if ( rc )
+    {
+        PERROR("Failed to obtain d%d current policy", domid);
+        rc = -errno;
+        goto fail;
+    }
+
     /* Get the domain's max policy. */
     nr_msrs = 0;
-    policy_leaves = nr_leaves;
+    nr_max = nr_leaves;
     rc = xc_get_system_cpu_policy(xch, di.hvm ? XEN_SYSCTL_cpu_policy_hvm_max
                                               : XEN_SYSCTL_cpu_policy_pv_max,
-                                  &policy_leaves, leaves, &nr_msrs, NULL);
+                                  &nr_max, max, &nr_msrs, NULL);
     if ( rc )
     {
         PERROR("Failed to obtain %s max policy", di.hvm ? "hvm" : "pv");
         rc = -errno;
         goto fail;
     }
-    for ( i = 0; i < policy_leaves; ++i )
-        if ( leaves[i].leaf == xend->leaf &&
-             leaves[i].subleaf == xend->subleaf )
-        {
-            polregs[0] = leaves[i].a;
-            polregs[1] = leaves[i].b;
-            polregs[2] = leaves[i].c;
-            polregs[3] = leaves[i].d;
-            break;
-        }
 
     /* Get the host policy. */
     nr_msrs = 0;
-    policy_leaves = nr_leaves;
+    nr_host = nr_leaves;
     rc = xc_get_system_cpu_policy(xch, XEN_SYSCTL_cpu_policy_host,
-                                  &policy_leaves, leaves, &nr_msrs, NULL);
+                                  &nr_host, host, &nr_msrs, NULL);
     if ( rc )
     {
         PERROR("Failed to obtain host policy");
         rc = -errno;
         goto fail;
     }
-    for ( i = 0; i < policy_leaves; ++i )
-        if ( leaves[i].leaf == xend->leaf &&
-             leaves[i].subleaf == xend->subleaf )
-        {
-            regs[0] = leaves[i].a;
-            regs[1] = leaves[i].b;
-            regs[2] = leaves[i].c;
-            regs[3] = leaves[i].d;
-            break;
-        }
 
-    for ( i = 0; i < 4; i++ )
+    rc = -EINVAL;
+    for ( ; xend->leaf != XEN_CPUID_INPUT_UNUSED; ++xend )
     {
-        if ( xend->policy[i] == NULL )
+        xen_cpuid_leaf_t *cur_leaf = find_leaf(cur, nr_cur, xend);
+        const xen_cpuid_leaf_t *max_leaf = find_leaf(max, nr_max, xend);
+        const xen_cpuid_leaf_t *host_leaf = find_leaf(host, nr_host, xend);
+
+        if ( cur_leaf == NULL || max_leaf == NULL || host_leaf == NULL )
         {
-            regs[i] = polregs[i];
-            continue;
+            ERROR("Missing leaf %#x, subleaf %#x", xend->leaf, xend->subleaf);
+            goto fail;
         }
 
-        /*
-         * Notes for following this algorithm:
-         *
-         * While it will accept any leaf data, it only makes sense to use on
-         * feature leaves.  regs[] initially contains the host values.  This,
-         * with the fall-through chain, is how the 's' and 'k' options work.
-         */
-        for ( j = 0; j < 32; j++ )
+        for ( unsigned int i = 0; i < ARRAY_SIZE(xend->policy); i++ )
         {
-            unsigned char val = !!((regs[i] & (1U << (31 - j))));
-            unsigned char polval = !!((polregs[i] & (1U << (31 - j))));
-
-            rc = -EINVAL;
-            if ( !strchr("10xks", xend->policy[i][j]) )
-                goto fail;
-
-            if ( xend->policy[i][j] == '1' )
-                val = 1;
-            else if ( xend->policy[i][j] == '0' )
-                val = 0;
-            else if ( xend->policy[i][j] == 'x' )
-                val = polval;
-
-            if ( val )
-                set_feature(31 - j, regs[i]);
-            else
-                clear_feature(31 - j, regs[i]);
+            uint32_t *cur_reg = &cur_leaf->a + i;
+            const uint32_t *max_reg = &max_leaf->a + i;
+            const uint32_t *host_reg = &host_leaf->a + i;
+
+            if ( xend->policy[i] == NULL )
+                continue;
+
+            for ( unsigned int j = 0; j < 32; j++ )
+            {
+                bool val;
+
+                if ( xend->policy[i][j] == '1' )
+                    val = true;
+                else if ( xend->policy[i][j] == '0' )
+                    val = false;
+                else if ( xend->policy[i][j] == 'x' )
+                    val = test_bit(31 - j, max_reg);
+                else if ( xend->policy[i][j] == 'k' ||
+                          xend->policy[i][j] == 's' )
+                    val = test_bit(31 - j, host_reg);
+                else
+                {
+                    ERROR("Bad character '%c' in policy[%d] string '%s'",
+                          xend->policy[i][j], i, xend->policy[i]);
+                    goto fail;
+                }
+
+                clear_bit(31 - j, cur_reg);
+                if ( val )
+                    set_bit(31 - j, cur_reg);
+            }
         }
     }
 
-    /* Feed the transformed leaf back up to Xen. */
-    leaves[0] = (xen_cpuid_leaf_t){ xend->leaf, xend->subleaf,
-                                    regs[0], regs[1], regs[2], regs[3] };
-    rc = xc_set_domain_cpu_policy(xch, domid, 1, leaves, 0, NULL,
+    /* Feed the transformed currrent policy back up to Xen. */
+    rc = xc_set_domain_cpu_policy(xch, domid, nr_cur, cur, 0, NULL,
                                   &err_leaf, &err_subleaf, &err_msr);
     if ( rc )
     {
@@ -391,7 +418,9 @@ int xc_cpuid_set(
     /* Success! */
 
  fail:
-    free(leaves);
+    free(cur);
+    free(max);
+    free(host);
 
     return rc;
 }
diff --git a/tools/libxl/libxl_cpuid.c b/tools/libxl/libxl_cpuid.c
index e001cbcd4f..6f7cf2054e 100644
--- a/tools/libxl/libxl_cpuid.c
+++ b/tools/libxl/libxl_cpuid.c
@@ -420,7 +420,6 @@ void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid,
                          libxl_domain_build_info *info)
 {
     libxl_cpuid_policy_list cpuid = info->cpuid;
-    int i;
     bool pae = true;
 
     /*
@@ -441,8 +440,7 @@ void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid,
     if (!cpuid)
         return;
 
-    for (i = 0; cpuid[i].input[0] != XEN_CPUID_INPUT_UNUSED; i++)
-        xc_cpuid_set(ctx->xch, domid, &cpuid[i]);
+    xc_cpuid_set(ctx->xch, domid, info->cpuid);
 }
 
 static const char *input_names[2] = { "leaf", "subleaf" };
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jun 22 09:55:34 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 22 Jun 2020 09:55:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jnJAs-0004iV-F3; Mon, 22 Jun 2020 09:55: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=O5+D=AD=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jnJAr-0004iH-Ka
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:55:33 +0000
X-Inumbo-ID: 832abfec-b46e-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 832abfec-b46e-11ea-bca7-bc764e2007e4;
 Mon, 22 Jun 2020 09:55: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=qnUGxo3aR2yFVxceWnrSHL52OBLX97z22kaR8LUjfR4=; b=jwVZKJvPpVVYj6d/GCVPvut2pq
 71vRT4AYUoIN7/0gn2sEL2rfzOzhyUwyVGkSvKobeGLmyYoL/CKvmHg6wegNN4iWmv+8EEG0NcOpM
 jI+qsefaJVD11F83NnmZKd1UPlbKkkkUaoP+h5YhqeloNePkWKMHkSoOVkBuvfy/4LXQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jnJAq-0003LD-OE
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jnJAq-0000M6-NS
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:55:32 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] tools/libx[cl]: Merge xc_cpuid_set() into
 xc_cpuid_apply_policy()
Message-Id: <E1jnJAq-0000M6-NS@xenbits.xenproject.org>
Date: Mon, 22 Jun 2020 09:55: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 f79cd47cd7a2ea321a0fe7d46586bdbea4845cdd
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jun 12 14:07:10 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jun 17 13:54:12 2020 +0100

    tools/libx[cl]: Merge xc_cpuid_set() into xc_cpuid_apply_policy()
    
    This reduces the number of CPUID handling entry-points to just one.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/libxc/include/xenctrl.h | 9 ++++-----
 tools/libxc/xc_cpuid_x86.c    | 8 ++++++--
 tools/libxl/libxl_cpuid.c     | 8 +-------
 3 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h
index 6e622fc8e4..c1495553a5 100644
--- a/tools/libxc/include/xenctrl.h
+++ b/tools/libxc/include/xenctrl.h
@@ -1819,20 +1819,19 @@ struct xc_xend_cpuid {
     char *policy[4];
 };
 
-int xc_cpuid_set(xc_interface *xch,
-                 uint32_t domid,
-                 const struct xc_xend_cpuid *xend);
-
 /*
  * Make adjustments to the CPUID settings for a domain.
  *
  * Either pass a full new @featureset (and @nr_features), or adjust individual
  * features (@pae).
+ *
+ * Then (optionally) apply legacy XEND overrides (@xend) to the result.
  */
 int xc_cpuid_apply_policy(xc_interface *xch,
                           uint32_t domid,
                           const uint32_t *featureset,
-                          unsigned int nr_features, bool pae);
+                          unsigned int nr_features, bool pae,
+                          const struct xc_xend_cpuid *xend);
 int xc_mca_op(xc_interface *xch, struct xen_mc *mc);
 int xc_mca_op_inject_v2(xc_interface *xch, unsigned int flags,
                         xc_cpumap_t cpumap, unsigned int nr_cpus);
diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c
index 548762e7b4..77aab0854f 100644
--- a/tools/libxc/xc_cpuid_x86.c
+++ b/tools/libxc/xc_cpuid_x86.c
@@ -280,7 +280,7 @@ static xen_cpuid_leaf_t *find_leaf(
     return bsearch(&key, leaves, nr_leaves, sizeof(*leaves), compare_leaves);
 }
 
-int xc_cpuid_set(
+static int xc_cpuid_xend_policy(
     xc_interface *xch, uint32_t domid, const struct xc_xend_cpuid *xend)
 {
     int rc;
@@ -427,7 +427,8 @@ int xc_cpuid_set(
 
 int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid,
                           const uint32_t *featureset, unsigned int nr_features,
-                          bool pae)
+                          bool pae,
+                          const struct xc_xend_cpuid *xend)
 {
     int rc;
     xc_dominfo_t di;
@@ -637,6 +638,9 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid,
         goto out;
     }
 
+    if ( xend && (rc = xc_cpuid_xend_policy(xch, domid, xend)) )
+        goto out;
+
     rc = 0;
 
 out:
diff --git a/tools/libxl/libxl_cpuid.c b/tools/libxl/libxl_cpuid.c
index 6f7cf2054e..edfcf315ca 100644
--- a/tools/libxl/libxl_cpuid.c
+++ b/tools/libxl/libxl_cpuid.c
@@ -419,7 +419,6 @@ int libxl_cpuid_parse_config_xend(libxl_cpuid_policy_list *cpuid,
 void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid,
                          libxl_domain_build_info *info)
 {
-    libxl_cpuid_policy_list cpuid = info->cpuid;
     bool pae = true;
 
     /*
@@ -435,12 +434,7 @@ void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid,
     if (info->type == LIBXL_DOMAIN_TYPE_HVM)
         pae = libxl_defbool_val(info->u.hvm.pae);
 
-    xc_cpuid_apply_policy(ctx->xch, domid, NULL, 0, pae);
-
-    if (!cpuid)
-        return;
-
-    xc_cpuid_set(ctx->xch, domid, info->cpuid);
+    xc_cpuid_apply_policy(ctx->xch, domid, NULL, 0, pae, info->cpuid);
 }
 
 static const char *input_names[2] = { "leaf", "subleaf" };
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jun 22 09:55:44 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 22 Jun 2020 09:55:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jnJB2-0004ja-HA; Mon, 22 Jun 2020 09:55: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=O5+D=AD=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jnJB1-0004jQ-KA
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:55:43 +0000
X-Inumbo-ID: 88543445-b46e-11ea-be66-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 88543445-b46e-11ea-be66-12813bfff9fa;
 Mon, 22 Jun 2020 09:55: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=57Y2Hha3UhmBwaUJXO6JJJleuCccTyP6ZRaiELT/yQs=; b=Td/XURi3BrlN2f5JWcTS7oRipq
 rAty30poBtGk0NJxDl9RBxPlJCCX2nD5BtUl7dqEYp0njqkTZQGWxNvqIINk0vzNvTzrl7jZyIYOv
 mlb0/QYWjOra2DmuSjU097hbphzoXvHRTVFClZVJtcYTZ5Ef8AQDp7sIPWLQTGnoXCvg=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jnJB0-0003Mq-Re
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jnJB0-0000Mc-Qv
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:55:42 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] tools/libx[cl]: Plumb bool restore down into
 xc_cpuid_apply_policy()
Message-Id: <E1jnJB0-0000Mc-Qv@xenbits.xenproject.org>
Date: Mon, 22 Jun 2020 09:55: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 057012d2899e4e71e274f77fcab136b0cad23099
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jun 12 14:07:10 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jun 17 13:54:12 2020 +0100

    tools/libx[cl]: Plumb bool restore down into xc_cpuid_apply_policy()
    
    In order to safely disable some features by default, without breaking
    migration from 4.13 or older, the CPUID logic needs to distinguish the two
    cases.
    
    Plumb a restore boolean down from the two callers of libxl__cpuid_legacy() all
    the way down into xc_cpuid_apply_policy().
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/libxc/include/xenctrl.h | 7 ++++++-
 tools/libxc/xc_cpuid_x86.c    | 2 +-
 tools/libxl/libxl_cpuid.c     | 4 ++--
 tools/libxl/libxl_create.c    | 2 +-
 tools/libxl/libxl_dom.c       | 2 +-
 tools/libxl/libxl_internal.h  | 2 +-
 tools/libxl/libxl_nocpuid.c   | 2 +-
 7 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h
index c1495553a5..4c89b7294c 100644
--- a/tools/libxc/include/xenctrl.h
+++ b/tools/libxc/include/xenctrl.h
@@ -1822,13 +1822,18 @@ struct xc_xend_cpuid {
 /*
  * Make adjustments to the CPUID settings for a domain.
  *
+ * This path is used in two cases.  First, for fresh boots of the domain, and
+ * secondly for migrate-in/restore of pre-4.14 guests (where CPUID data was
+ * missing from the stream).  The @restore parameter distinguishes these
+ * cases, and the generated policy must be compatible with a 4.13.
+ *
  * Either pass a full new @featureset (and @nr_features), or adjust individual
  * features (@pae).
  *
  * Then (optionally) apply legacy XEND overrides (@xend) to the result.
  */
 int xc_cpuid_apply_policy(xc_interface *xch,
-                          uint32_t domid,
+                          uint32_t domid, bool restore,
                           const uint32_t *featureset,
                           unsigned int nr_features, bool pae,
                           const struct xc_xend_cpuid *xend);
diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c
index 77aab0854f..b6b5dc88a2 100644
--- a/tools/libxc/xc_cpuid_x86.c
+++ b/tools/libxc/xc_cpuid_x86.c
@@ -425,7 +425,7 @@ static int xc_cpuid_xend_policy(
     return rc;
 }
 
-int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid,
+int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, bool restore,
                           const uint32_t *featureset, unsigned int nr_features,
                           bool pae,
                           const struct xc_xend_cpuid *xend)
diff --git a/tools/libxl/libxl_cpuid.c b/tools/libxl/libxl_cpuid.c
index edfcf315ca..db2f12d115 100644
--- a/tools/libxl/libxl_cpuid.c
+++ b/tools/libxl/libxl_cpuid.c
@@ -416,7 +416,7 @@ int libxl_cpuid_parse_config_xend(libxl_cpuid_policy_list *cpuid,
     return 0;
 }
 
-void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid,
+void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid, bool restore,
                          libxl_domain_build_info *info)
 {
     bool pae = true;
@@ -434,7 +434,7 @@ void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid,
     if (info->type == LIBXL_DOMAIN_TYPE_HVM)
         pae = libxl_defbool_val(info->u.hvm.pae);
 
-    xc_cpuid_apply_policy(ctx->xch, domid, NULL, 0, pae, info->cpuid);
+    xc_cpuid_apply_policy(ctx->xch, domid, restore, NULL, 0, pae, info->cpuid);
 }
 
 static const char *input_names[2] = { "leaf", "subleaf" };
diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index 75862dc6ed..2814818e34 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -1447,7 +1447,7 @@ int libxl__srm_callout_callback_static_data_done(unsigned int missing,
      * stream doesn't contain any CPUID data.
      */
     if (missing & XGR_SDD_MISSING_CPUID)
-        libxl__cpuid_legacy(ctx, dcs->guest_domid, info);
+        libxl__cpuid_legacy(ctx, dcs->guest_domid, true, info);
 
     return 0;
 }
diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c
index dd1aff89a3..f8661e90d4 100644
--- a/tools/libxl/libxl_dom.c
+++ b/tools/libxl/libxl_dom.c
@@ -391,7 +391,7 @@ int libxl__build_pre(libxl__gc *gc, uint32_t domid,
      * being migrated-in/restored have CPUID handled during the
      * static_data_done() callback. */
     if (!state->restore)
-        libxl__cpuid_legacy(ctx, domid, info);
+        libxl__cpuid_legacy(ctx, domid, false, info);
 
     return rc;
 }
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 79c2bf5f5e..94a23179d3 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -2056,7 +2056,7 @@ typedef yajl_gen_status (*libxl__gen_json_callback)(yajl_gen hand, void *);
 _hidden char *libxl__object_to_json(libxl_ctx *ctx, const char *type,
                                     libxl__gen_json_callback gen, void *p);
 
-_hidden void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid,
+_hidden void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid, bool retore,
                                  libxl_domain_build_info *info);
 
 /* Calls poll() again - useful to check whether a signaled condition
diff --git a/tools/libxl/libxl_nocpuid.c b/tools/libxl/libxl_nocpuid.c
index 3f30e148be..f47336565b 100644
--- a/tools/libxl/libxl_nocpuid.c
+++ b/tools/libxl/libxl_nocpuid.c
@@ -34,7 +34,7 @@ int libxl_cpuid_parse_config_xend(libxl_cpuid_policy_list *cpuid,
     return 0;
 }
 
-void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid,
+void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid, bool restore,
                          libxl_domain_build_info *info)
 {
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jun 22 09:55:55 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 22 Jun 2020 09:55:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jnJBD-0004kp-Ik; Mon, 22 Jun 2020 09:55: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=O5+D=AD=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jnJBC-0004ki-9l
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:55:54 +0000
X-Inumbo-ID: 8f314b4e-b46e-11ea-be66-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 8f314b4e-b46e-11ea-be66-12813bfff9fa;
 Mon, 22 Jun 2020 09:55: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=68unhNfmTzxPBAG6MsHvGWwfpvHgZ5Rlo/4icNYRA+o=; b=fOooO95iy4PLNs4OYFlQYpcPj0
 1lAdlRcwNSHThX1ZnN7+m8TJmhdEcI7Dm1mYdwaRm2iGoFXBOf58puXSGw+aThvnk0uV64EYSIQ/9
 rxg1ata4LYsyfkZTtc5NhkgjnyCeojxtjHgDyI+vRzy5lP1eQVf2yy/TPvK54x7ima5A=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jnJBA-0003N3-UU
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:55:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jnJBA-0000NJ-Tk
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:55:52 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/gen-cpuid: Distinguish default vs max in feature
 annotations
Message-Id: <E1jnJBA-0000NJ-Tk@xenbits.xenproject.org>
Date: Mon, 22 Jun 2020 09:55: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 1accd92514f286c44e76f198f1bba90ad2e9e83b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Feb 25 15:33:31 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jun 17 13:54:12 2020 +0100

    x86/gen-cpuid: Distinguish default vs max in feature annotations
    
    The toolstack logic can now correctly distinguish a clean boot from a
    migrate/restore.
    
    Allow lowercase a/s/h to be used to annotate a non-default feature.
    
    Due to the emulator work prepared earlier in 4.14, this now allows VMs to
    explicity opt in to the TSXLDTRK, MOVDIR{I,64B} and SERIALIZE instructions via
    their xl.cfg file, rather than getting them as a matter of default.
    
    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/tools/gen-cpuid.py | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/xen/tools/gen-cpuid.py b/xen/tools/gen-cpuid.py
index 037954cfb8..ffd9529fdf 100755
--- a/xen/tools/gen-cpuid.py
+++ b/xen/tools/gen-cpuid.py
@@ -130,17 +130,13 @@ def crunch_numbers(state):
                  MTRR, PGE, MCA, CMOV, PAT, PSE36, MMX, FXSR)
     state.common_1d = common_1d
 
-    state.pv_def = state.raw['A']
-    state.hvm_shadow_def = state.pv_def | state.raw['S']
-    state.hvm_hap_def = state.hvm_shadow_def | state.raw['H']
-
-    # TODO: Ignore def/max split until the toolstack migration logic is fixed
-    state.pv_max = state.pv_def
-    state.hvm_shadow_max = state.hvm_shadow_def
-    state.hvm_hap_max = state.hvm_hap_def
-    # state.pv_max =                                state.raw['A'] | state.raw['a']
-    # state.hvm_shadow_max = state.pv_max         | state.raw['S'] | state.raw['s']
-    # state.hvm_hap_max =    state.hvm_shadow_max | state.raw['H'] | state.raw['h']
+    state.pv_def =                                state.raw['A']
+    state.hvm_shadow_def = state.pv_def         | state.raw['S']
+    state.hvm_hap_def =    state.hvm_shadow_def | state.raw['H']
+
+    state.pv_max =                                state.raw['A'] | state.raw['a']
+    state.hvm_shadow_max = state.pv_max         | state.raw['S'] | state.raw['s']
+    state.hvm_hap_max =    state.hvm_shadow_max | state.raw['H'] | state.raw['h']
 
     #
     # Feature dependency information.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jun 22 09:56:04 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 22 Jun 2020 09:56:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jnJBM-0004mK-KH; Mon, 22 Jun 2020 09:56: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=O5+D=AD=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jnJBL-0004mA-TU
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:56:03 +0000
X-Inumbo-ID: 95367564-b46e-11ea-be66-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 95367564-b46e-11ea-be66-12813bfff9fa;
 Mon, 22 Jun 2020 09:56: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=ARFINLg6JcA2BrOdZzbiyDRjFavobf3wsw3WlJY7wWc=; b=NELpVR4u9DvEk7rMfshRqVmuM5
 8Kuqe0+hFI78VkPdCedwlw2zNSoa/oBwkyyzWRvQh3t6+dre0fNytG3Jqt+4K+o0c24ueaZBFnS5+
 Wktp9gi7QYi9IQpIZ9l2pwZAT/grV19wW807nBmS41qWsET7yzWYCdWW03giQLNexAeA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jnJBL-0003NR-1K
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:56:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jnJBL-0000O2-0Z
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:56:03 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/hvm: Disable MPX by default
Message-Id: <E1jnJBL-0000O2-0Z@xenbits.xenproject.org>
Date: Mon, 22 Jun 2020 09:56: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 54463aa79dac70a9d92f55650c7b8fe3e9fcc967
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Feb 24 17:15:56 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jun 17 13:54:12 2020 +0100

    x86/hvm: Disable MPX by default
    
    Memory Protection eXtension support has been dropped from GCC and Linux, and
    will be dropped from future Intel CPUs.
    
    With all other default/max pieces in place, move MPX from default to max.
    This means that VMs won't be offered it by default, but can explicitly opt
    into using it via cpuid="host,mpx=1" in their vm.cfg file.
    
    The difference as visible to the guest is:
    
      diff --git a/default b/mpx
      index 0e91765d6b..c8c33cd584 100644
      --- a/default
      +++ b/mpx
      @@ -13,15 +13,17 @@ Native cpuid:
         00000004:00000004 -> 00000000:00000000:00000000:00000000
         00000005:ffffffff -> 00000000:00000000:00000000:00000000
         00000006:ffffffff -> 00000000:00000000:00000000:00000000
      -  00000007:00000000 -> 00000000:009c2fbb:00000000:9c000400
      +  00000007:00000000 -> 00000000:009c6fbb:00000000:9c000400
         00000008:ffffffff -> 00000000:00000000:00000000:00000000
         00000009:ffffffff -> 00000000:00000000:00000000:00000000
         0000000a:ffffffff -> 00000000:00000000:00000000:00000000
         0000000b:ffffffff -> 00000000:00000000:00000000:00000000
         0000000c:ffffffff -> 00000000:00000000:00000000:00000000
      -  0000000d:00000000 -> 00000007:00000240:00000340:00000000
      +  0000000d:00000000 -> 0000001f:00000240:00000440:00000000
         0000000d:00000001 -> 0000000f:00000240:00000000:00000000
         0000000d:00000002 -> 00000100:00000240:00000000:00000000
      +  0000000d:00000003 -> 00000040:000003c0:00000000:00000000
      +  0000000d:00000004 -> 00000040:00000400:00000000:00000000
         40000000:ffffffff -> 40000005:566e6558:65584d4d:4d4d566e
         40000001:ffffffff -> 0004000e:00000000:00000000:00000000
         40000002:ffffffff -> 00000001:40000000:00000000:00000000
    
    Adjust the legacy restore path in libxc to cope safely with pre-4.14 VMs.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/libxc/xc_cpuid_x86.c                  | 48 ++++++++++++++++++-----------
 xen/include/public/arch-x86/cpufeatureset.h |  2 +-
 2 files changed, 31 insertions(+), 19 deletions(-)

diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c
index b6b5dc88a2..6e80fcd1d2 100644
--- a/tools/libxc/xc_cpuid_x86.c
+++ b/tools/libxc/xc_cpuid_x86.c
@@ -436,6 +436,8 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, bool restore,
     xen_cpuid_leaf_t *leaves = NULL;
     struct cpuid_policy *p = NULL;
     uint32_t err_leaf = -1, err_subleaf = -1, err_msr = -1;
+    uint32_t host_featureset[FEATURESET_NR_ENTRIES] = {};
+    uint32_t len = ARRAY_SIZE(host_featureset);
 
     if ( xc_domain_getinfo(xch, domid, 1, &di) != 1 ||
          di.domid != domid )
@@ -458,6 +460,22 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, bool restore,
          (p = calloc(1, sizeof(*p))) == NULL )
         goto out;
 
+    /* Get the host policy. */
+    rc = xc_get_cpu_featureset(xch, XEN_SYSCTL_cpu_featureset_host,
+                               &len, host_featureset);
+    if ( rc )
+    {
+        /* Tolerate "buffer too small", as we've got the bits we need. */
+        if ( errno == ENOBUFS )
+            rc = 0;
+        else
+        {
+            PERROR("Failed to obtain host featureset");
+            rc = -errno;
+            goto out;
+        }
+    }
+
     /* Get the domain's default policy. */
     nr_msrs = 0;
     rc = xc_get_system_cpu_policy(xch, di.hvm ? XEN_SYSCTL_cpu_policy_hvm_default
@@ -479,6 +497,18 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, bool restore,
         goto out;
     }
 
+    /*
+     * Account for feature which have been disabled by default since Xen 4.13,
+     * so migrated-in VM's don't risk seeing features disappearing.
+     */
+    if ( restore )
+    {
+        if ( di.hvm )
+        {
+            p->feat.mpx = test_bit(X86_FEATURE_MPX, host_featureset);
+        }
+    }
+
     if ( featureset )
     {
         uint32_t disabled_features[FEATURESET_NR_ENTRIES],
@@ -530,24 +560,6 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, bool restore,
 
     if ( !di.hvm )
     {
-        uint32_t host_featureset[FEATURESET_NR_ENTRIES] = {};
-        uint32_t len = ARRAY_SIZE(host_featureset);
-
-        rc = xc_get_cpu_featureset(xch, XEN_SYSCTL_cpu_featureset_host,
-                                   &len, host_featureset);
-        if ( rc )
-        {
-            /* Tolerate "buffer too small", as we've got the bits we need. */
-            if ( errno == ENOBUFS )
-                rc = 0;
-            else
-            {
-                PERROR("Failed to obtain host featureset");
-                rc = -errno;
-                goto out;
-            }
-        }
-
         /*
          * On hardware without CPUID Faulting, PV guests see real topology.
          * As a consequence, they also need to see the host htt/cmp fields.
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 5ca35d9d97..af1b8a96a6 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -207,7 +207,7 @@ XEN_CPUFEATURE(INVPCID,       5*32+10) /*H  Invalidate Process Context ID */
 XEN_CPUFEATURE(RTM,           5*32+11) /*A  Restricted Transactional Memory */
 XEN_CPUFEATURE(PQM,           5*32+12) /*   Platform QoS Monitoring */
 XEN_CPUFEATURE(NO_FPU_SEL,    5*32+13) /*!  FPU CS/DS stored as zero */
-XEN_CPUFEATURE(MPX,           5*32+14) /*S  Memory Protection Extensions */
+XEN_CPUFEATURE(MPX,           5*32+14) /*s  Memory Protection Extensions */
 XEN_CPUFEATURE(PQE,           5*32+15) /*   Platform QoS Enforcement */
 XEN_CPUFEATURE(AVX512F,       5*32+16) /*A  AVX-512 Foundation Instructions */
 XEN_CPUFEATURE(AVX512DQ,      5*32+17) /*A  AVX-512 Doubleword & Quadword Instrs */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jun 22 09:56:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 22 Jun 2020 09:56:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jnJBW-0004nO-Lw; Mon, 22 Jun 2020 09:56: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=O5+D=AD=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jnJBV-0004nF-OU
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:56:13 +0000
X-Inumbo-ID: 9b40cc70-b46e-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 9b40cc70-b46e-11ea-8496-bc764e2007e4;
 Mon, 22 Jun 2020 09:56: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=w7+6OLz41/S6YdTJi6/GC69V65/HbWVlZHeeLF39ngM=; b=Hzox/jnt2ASdcpc/gLNFuY5IKy
 dSzr+SE76dG7IPj5y28TCq3abmIZjio/jz1CIozVRLaFh6fhBuNSlZMuRW0jCATPQDidtDo2TUKmM
 FLE55J/TnuptVVzASJXqjCtKOiXEmVIemX90WrIn5bsYG+O2Sa7fa+iBdcoyDRKopTv4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jnJBV-0003NY-4K
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:56:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jnJBV-0000Oq-3T
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:56:13 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/cpuid: Introduce missing feature adjustment in
 calculate_pv_def_policy()
Message-Id: <E1jnJBV-0000Oq-3T@xenbits.xenproject.org>
Date: Mon, 22 Jun 2020 09:56: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 fde4acd5feb7961269a2e6edd918c7a46626cf6b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Jun 15 13:42:11 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jun 17 13:54:12 2020 +0100

    x86/cpuid: Introduce missing feature adjustment in calculate_pv_def_policy()
    
    This was an accidental asymmetry with the HVM side.
    
    No change in behaviour at this point.
    
    Fixes: 83b387382 ("x86/cpuid: Introduce and use default CPUID policies")
    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/cpuid.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index ee11087626..f2fc0aa895 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -402,6 +402,8 @@ static void __init calculate_pv_def_policy(void)
     for ( i = 0; i < ARRAY_SIZE(pv_featureset); ++i )
         pv_featureset[i] &= pv_def_featuremask[i];
 
+    guest_common_feature_adjustments(pv_featureset);
+
     sanitise_featureset(pv_featureset);
     cpuid_featureset_to_policy(pv_featureset, p);
     recalculate_xstate(p);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jun 22 09:56:24 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 22 Jun 2020 09:56: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 1jnJBg-0004t4-Ob; Mon, 22 Jun 2020 09:56: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=O5+D=AD=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jnJBg-0004su-1p
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:56:24 +0000
X-Inumbo-ID: a13f2a04-b46e-11ea-be66-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id a13f2a04-b46e-11ea-be66-12813bfff9fa;
 Mon, 22 Jun 2020 09:56: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=X1SS7l7+6T9tlrlfbfEqnyn3yQKSH9qNCiv98xOJ7Vg=; b=YgLeZmtafKdjwcv/cZcI+WqTPu
 A8HtnF600izPXPGZ/0CE0B+wgpMM1Te1TCynXdSnP9IfjGAWLG2tsNf3wly3G11Kz20gZA2cN1OOQ
 Pg17oA4orMjtXtZ9UkJ4HRArGbeBnbPLq7gciOE43YRH/JW4PmIof4x3gzgga0n7oBSc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jnJBf-0003Nf-7V
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:56:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jnJBf-0000PU-6q
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:56:23 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/spec-ctrl: Hide RDRAND by default on IvyBridge client
Message-Id: <E1jnJBf-0000PU-6q@xenbits.xenproject.org>
Date: Mon, 22 Jun 2020 09:56: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 71ca0e0ad000e690899936327eb09709ab182ade
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jun 12 13:39:13 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jun 17 13:54:12 2020 +0100

    x86/spec-ctrl: Hide RDRAND by default on IvyBridge client
    
    To combat the absence of mitigating microcode, arrange to hide RDRAND by
    default on IvyBridge client hardware.
    
    Adjust the default feature derivation to hide RDRAND on IvyBridge client
    parts, unless `cpuid=rdrand` is explicitly provided.
    
    Adjust the restore path in xc_cpuid_apply_policy() to not hide RDRAND from VMs
    which migrated from pre-4.14.
    
    In all cases, individual guests can continue using RDRAND if explicitly
    enabled in their config files.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 docs/misc/xen-command-line.pandoc           | 20 +++++++++++++++-----
 tools/libxc/xc_cpuid_x86.c                  |  2 ++
 xen/arch/x86/cpuid.c                        | 21 +++++++++++++++++++++
 xen/include/public/arch-x86/cpufeatureset.h |  2 +-
 4 files changed, 39 insertions(+), 6 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index fde749c669..4ae9391fcd 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -512,11 +512,21 @@ The Speculation Control hardware features `srbds-ctrl`, `md-clear`, `ibrsb`,
 `stibp`, `ibpb`, `l1d-flush` and `ssbd` are used by default if available and
 applicable.  They can all be ignored.
 
-`rdrand` and `rdseed` can be ignored, as a mitigation to XSA-320 /
-CVE-2020-0543.  The RDRAND feature is disabled by default on certain AMD
-systems, due to possible malfunctions after ACPI S3 suspend/resume.  `rdrand`
-may be used in its positive form to override Xen's default behaviour on these
-systems, and make the feature fully usable.
+`rdrand` and `rdseed` have multiple interactions.
+
+*   For Special Register Buffer Data Sampling (SRBDS, XSA-320, CVE-2020-0543),
+    RDRAND and RDSEED can be ignored.
+
+    Due to the absence of microcode to address SRBDS on IvyBridge client
+    hardware, the RDRAND feature is hidden by default for guests, unless
+    `rdrand` is used in its positive form.  Irrespective of the setting here,
+    VMs can use RDRAND if explicitly enabled in guest config file, and VMs
+    already using RDRAND can migrate in.
+
+*   The RDRAND feature is disabled by default on AMD Fam15/16 systems, due to
+    possible malfunctions after ACPI S3 suspend/resume.  `rdrand` may be used
+    in its positive form to override Xen's default behaviour on these systems,
+    and make the feature fully usable.
 
 ### cpuid_mask_cpu
 > `= fam_0f_rev_[cdefg] | fam_10_rev_[bc] | fam_11_rev_b`
diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c
index 6e80fcd1d2..0f24d6dd08 100644
--- a/tools/libxc/xc_cpuid_x86.c
+++ b/tools/libxc/xc_cpuid_x86.c
@@ -503,6 +503,8 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, bool restore,
      */
     if ( restore )
     {
+        p->basic.rdrand = test_bit(X86_FEATURE_RDRAND, host_featureset);
+
         if ( di.hvm )
         {
             p->feat.mpx = test_bit(X86_FEATURE_MPX, host_featureset);
diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index f2fc0aa895..6a4a787b68 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -340,6 +340,25 @@ static void __init calculate_host_policy(void)
     }
 }
 
+static void __init guest_common_default_feature_adjustments(uint32_t *fs)
+{
+    /*
+     * IvyBridge client parts suffer from leakage of RDRAND data due to SRBDS
+     * (XSA-320 / CVE-2020-0543), and won't be receiving microcode to
+     * compensate.
+     *
+     * Mitigate by hiding RDRAND from guests by default, unless explicitly
+     * overridden on the Xen command line (cpuid=rdrand).  Irrespective of the
+     * default setting, guests can use RDRAND if explicitly enabled
+     * (cpuid="host,rdrand=1") in the VM's config file, and VMs which were
+     * previously using RDRAND can migrate in.
+     */
+    if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
+         boot_cpu_data.x86 == 6 && boot_cpu_data.x86_model == 0x3a &&
+         cpu_has_rdrand && !is_forced_cpu_cap(X86_FEATURE_RDRAND) )
+        __clear_bit(X86_FEATURE_RDRAND, fs);
+}
+
 static void __init guest_common_feature_adjustments(uint32_t *fs)
 {
     /* Unconditionally claim to be able to set the hypervisor bit. */
@@ -403,6 +422,7 @@ static void __init calculate_pv_def_policy(void)
         pv_featureset[i] &= pv_def_featuremask[i];
 
     guest_common_feature_adjustments(pv_featureset);
+    guest_common_default_feature_adjustments(pv_featureset);
 
     sanitise_featureset(pv_featureset);
     cpuid_featureset_to_policy(pv_featureset, p);
@@ -485,6 +505,7 @@ static void __init calculate_hvm_def_policy(void)
         hvm_featureset[i] &= hvm_featuremask[i];
 
     guest_common_feature_adjustments(hvm_featureset);
+    guest_common_default_feature_adjustments(hvm_featureset);
 
     sanitise_featureset(hvm_featureset);
     cpuid_featureset_to_policy(hvm_featureset, p);
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index af1b8a96a6..fe7492a225 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -149,7 +149,7 @@ XEN_CPUFEATURE(XSAVE,         1*32+26) /*A  XSAVE/XRSTOR/XSETBV/XGETBV */
 XEN_CPUFEATURE(OSXSAVE,       1*32+27) /*!  OSXSAVE */
 XEN_CPUFEATURE(AVX,           1*32+28) /*A  Advanced Vector Extensions */
 XEN_CPUFEATURE(F16C,          1*32+29) /*A  Half-precision convert instruction */
-XEN_CPUFEATURE(RDRAND,        1*32+30) /*A  Digital Random Number Generator */
+XEN_CPUFEATURE(RDRAND,        1*32+30) /*!A Digital Random Number Generator */
 XEN_CPUFEATURE(HYPERVISOR,    1*32+31) /*!A Running under some hypervisor */
 
 /* AMD-defined CPU features, CPUID level 0x80000001.edx, word 2 */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jun 22 09:56:35 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 22 Jun 2020 09:56: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 1jnJBr-0004uB-QD; Mon, 22 Jun 2020 09:56: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=O5+D=AD=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jnJBq-0004u0-Lj
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:56:34 +0000
X-Inumbo-ID: a743b4ec-b46e-11ea-be66-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id a743b4ec-b46e-11ea-be66-12813bfff9fa;
 Mon, 22 Jun 2020 09:56: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=ndKwWUzvENPhwZpwnrmz7i0D5SfrC7ZVT58/WNduQKs=; b=0Uv7lDJwfouNVt+pZxA0+FC3dt
 9/oWuLBLLB4U9Rx2ynsnMALnGuw1d6cKWwK4Ta/v67XN8La374TdYEIzhN6h0P0Z7x/JBOdkFb+Sr
 lOqvtYs+8QQMf6TWgkRdFbbM9E550dg49IkZK+EtyHKj0RItsRQBCgd0qcUoED60xj1s=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jnJBp-0003Np-AY
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:56:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jnJBp-0000Q5-9i
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:56:33 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] tools/xen-ucode: return correct exit code on failed
 microcode update
Message-Id: <E1jnJBp-0000Q5-9i@xenbits.xenproject.org>
Date: Mon, 22 Jun 2020 09:56: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 25636ed707cf1211ce846c7ec58f8643e435d7a7
Author:     Igor Druzhinin <igor.druzhinin@citrix.com>
AuthorDate: Wed Jun 17 03:19:13 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Thu Jun 18 16:45:14 2020 +0100

    tools/xen-ucode: return correct exit code on failed microcode update
    
    Otherwise it's difficult to know if operation failed inside the automation.
    
    While at it, also switch to returning 1 and 2 instead of errno to avoid
    incompatibilies between errno and special exit code numbers.
    
    Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    Release-acked-by: Paul Durrant <paul@xen.org>
    Reviewed-by: Igor Druzhinin <igor.druzhinin@citrix.com>
---
 tools/misc/xen-ucode.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/tools/misc/xen-ucode.c b/tools/misc/xen-ucode.c
index 0c257f4998..ad32face2b 100644
--- a/tools/misc/xen-ucode.c
+++ b/tools/misc/xen-ucode.c
@@ -25,7 +25,7 @@ int main(int argc, char *argv[])
         fprintf(stderr,
                 "xen-ucode: Xen microcode updating tool\n"
                 "Usage: %s <microcode blob>\n", argv[0]);
-        return 0;
+        exit(2);
     }
 
     filename = argv[1];
@@ -34,14 +34,14 @@ int main(int argc, char *argv[])
     {
         fprintf(stderr, "Could not open %s. (err: %s)\n",
                 filename, strerror(errno));
-        return errno;
+        exit(1);
     }
 
     if ( fstat(fd, &st) != 0 )
     {
         fprintf(stderr, "Could not get the size of %s. (err: %s)\n",
                 filename, strerror(errno));
-        return errno;
+        exit(1);
     }
 
     len = st.st_size;
@@ -49,7 +49,7 @@ int main(int argc, char *argv[])
     if ( buf == MAP_FAILED )
     {
         fprintf(stderr, "mmap failed. (error: %s)\n", strerror(errno));
-        return errno;
+        exit(1);
     }
 
     xch = xc_interface_open(NULL, NULL, 0);
@@ -57,20 +57,23 @@ int main(int argc, char *argv[])
     {
         fprintf(stderr, "Error opening xc interface. (err: %s)\n",
                 strerror(errno));
-        return errno;
+        exit(1);
     }
 
     ret = xc_microcode_update(xch, buf, len);
     if ( ret )
+    {
         fprintf(stderr, "Failed to update microcode. (err: %s)\n",
                 strerror(errno));
+        exit(1);
+    }
 
     xc_interface_close(xch);
 
     if ( munmap(buf, len) )
     {
         printf("Could not unmap: %d(%s)\n", errno, strerror(errno));
-        return errno;
+        exit(1);
     }
     close(fd);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jun 22 09:56:44 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 22 Jun 2020 09:56: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 1jnJC0-0004v9-S0; Mon, 22 Jun 2020 09:56: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=O5+D=AD=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jnJC0-0004v1-3W
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:56:44 +0000
X-Inumbo-ID: ad454c7a-b46e-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id ad454c7a-b46e-11ea-bca7-bc764e2007e4;
 Mon, 22 Jun 2020 09:56: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=0wRgTq64Skqi3f6Se+ZToH9Eau1vfV6QHzIDP6CAIZ4=; b=q1wKQrItuliZ2Tm03EsiJy6Len
 MTAqZ0vdWeXa4NeiFW38negrCPf7pmjbmnOBfjhxexqnCv1WoCvDQfPWDZFy+H7nYCJxJJWCL4Duy
 cf0VUlAtaQ0phrUskCtllAtB86edO/R+hxYEQBIN3lvOK+BQdvgJPFUat+TIaD0EO/4s=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jnJBz-0003OQ-DP
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:56:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jnJBz-0000Qm-Co
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:56:43 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] xl: Allow shutdown wait for domain death
Message-Id: <E1jnJBz-0000Qm-Co@xenbits.xenproject.org>
Date: Mon, 22 Jun 2020 09:56: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 f0dca895a58710ecd49d813c96d382d5625b74c1
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Wed Jun 17 03:36:42 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Thu Jun 18 16:58:56 2020 +0100

    xl: Allow shutdown wait for domain death
    
    `xl shutdown -w` waits for the first of either domain shutdown or death.
    Shutdown is the halting of the guest operating system, and death is the
    freeing of domain resources.
    
    Allow specifying -w multiple times to wait for only domain death.  This
    is useful in scripts so that all resources are free before the script
    continues.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 docs/man/xl.1.pod.in    |  4 +++-
 tools/xl/xl_vmcontrol.c | 17 +++++++++++------
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/docs/man/xl.1.pod.in b/docs/man/xl.1.pod.in
index 09339282e6..52a47a6fbd 100644
--- a/docs/man/xl.1.pod.in
+++ b/docs/man/xl.1.pod.in
@@ -743,7 +743,9 @@ of a Xen system.
 
 =item B<-w>, B<--wait>
 
-Wait for the domain to complete shutdown before returning.
+Wait for the domain to complete shutdown before returning.  If given once,
+the wait is for domain shutdown or domain death.  If given multiple times,
+the wait is for domain death only.
 
 =item B<-F>
 
diff --git a/tools/xl/xl_vmcontrol.c b/tools/xl/xl_vmcontrol.c
index 17b4514c94..435155a033 100644
--- a/tools/xl/xl_vmcontrol.c
+++ b/tools/xl/xl_vmcontrol.c
@@ -162,7 +162,8 @@ static void shutdown_domain(uint32_t domid,
     }
 }
 
-static void wait_for_domain_deaths(libxl_evgen_domain_death **deathws, int nr)
+static void wait_for_domain_deaths(libxl_evgen_domain_death **deathws, int nr,
+                                   int wait_for_shutdown_or_death)
 {
     int rc, count = 0;
     LOG("Waiting for %d domains", nr);
@@ -183,8 +184,12 @@ static void wait_for_domain_deaths(libxl_evgen_domain_death **deathws, int nr)
         case LIBXL_EVENT_TYPE_DOMAIN_SHUTDOWN:
             LOG("Domain %d has been shut down, reason code %d",
                 event->domid, event->u.domain_shutdown.shutdown_reason);
-            libxl_evdisable_domain_death(ctx, deathws[event->for_user]);
-            count++;
+            if (wait_for_shutdown_or_death) {
+                libxl_evdisable_domain_death(ctx, deathws[event->for_user]);
+                count++;
+            } else {
+                LOG("Domain %d continue waiting for death", event->domid);
+            }
             break;
         default:
             LOG("Unexpected event type %d", event->type);
@@ -214,7 +219,7 @@ static int main_shutdown_or_reboot(int do_reboot, int argc, char **argv)
         all = 1;
         break;
     case 'w':
-        wait_for_it = 1;
+        wait_for_it++;
         break;
     case 'F':
         fallback_trigger = 1;
@@ -246,7 +251,7 @@ static int main_shutdown_or_reboot(int do_reboot, int argc, char **argv)
         }
 
         if (deathws) {
-            wait_for_domain_deaths(deathws, nrdeathws);
+            wait_for_domain_deaths(deathws, nrdeathws, wait_for_it == 1);
             free(deathws);
         }
 
@@ -258,7 +263,7 @@ static int main_shutdown_or_reboot(int do_reboot, int argc, char **argv)
         fn(domid, wait_for_it ? &deathw : NULL, 0, fallback_trigger);
 
         if (wait_for_it)
-            wait_for_domain_deaths(&deathw, 1);
+            wait_for_domain_deaths(&deathw, 1, wait_for_it == 1);
     }
 
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jun 22 09:56:55 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 22 Jun 2020 09:56: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 1jnJCB-0004wK-Ti; Mon, 22 Jun 2020 09:56: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=O5+D=AD=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jnJCA-0004w9-72
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:56:54 +0000
X-Inumbo-ID: b34d686e-b46e-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id b34d686e-b46e-11ea-b7bb-bc764e2007e4;
 Mon, 22 Jun 2020 09:56: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=kAscFB4oGmAhD6E0UvJf1kEpXbIcqHvwTsf5VC6WKlw=; b=Ed9Dw9dm2n/BMAD+il2Kn6OOTo
 ePG2qncJWtxI+LMfYxZezL8hHt0TXjHc9uxDpHsZF/jTETbjUpHBhhBM1KrkLGQXvZPtanBVQOL3p
 a6Es/ngdD86eOaQVRHEh6zY43C+PZ3NJJv+7TAWMroM9jQMXHy0KPq73mERnTUHnmo7I=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jnJC9-0003Og-GK
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:56:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jnJC9-0000RS-FX
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:56:53 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] stubdom/vtpm: add extern to function declarations
Message-Id: <E1jnJC9-0000RS-FX@xenbits.xenproject.org>
Date: Mon, 22 Jun 2020 09:56: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 f1d376a825f4878eab0ef9cabe50ec4299968629
Author:     Olaf Hering <olaf@aepfle.de>
AuthorDate: Wed Jun 17 07:08:41 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Thu Jun 18 17:04:51 2020 +0100

    stubdom/vtpm: add extern to function declarations
    
    Code compiled with gcc10 will not link properly due to multiple definition of the same function.
    
    Signed-off-by: Olaf Hering <olaf@aepfle.de>
    Reviewed-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: Samuel Thibault <samuel.thibaut@ens-lyon.org>
    Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 stubdom/Makefile          |  1 +
 stubdom/vtpm_extern.patch | 48 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+)

diff --git a/stubdom/Makefile b/stubdom/Makefile
index 12aa211ac3..af8cde41b9 100644
--- a/stubdom/Makefile
+++ b/stubdom/Makefile
@@ -231,6 +231,7 @@ tpm_emulator-$(XEN_TARGET_ARCH): tpm_emulator-$(TPMEMU_VERSION).tar.gz
 	patch -d $@ -p1 < vtpm-cmake-Wextra.patch
 	patch -d $@ -p1 < vtpm-implicit-fallthrough.patch
 	patch -d $@ -p1 < vtpm_TPM_ChangeAuthAsymFinish.patch
+	patch -d $@ -p1 < vtpm_extern.patch
 	mkdir $@/build
 	cd $@/build; CC=${CC} $(CMAKE) .. -DCMAKE_C_FLAGS:STRING="-std=c99 -DTPM_NO_EXTERN $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -Wno-declaration-after-statement"
 	touch $@
diff --git a/stubdom/vtpm_extern.patch b/stubdom/vtpm_extern.patch
new file mode 100644
index 0000000000..5ea4023e6d
--- /dev/null
+++ b/stubdom/vtpm_extern.patch
@@ -0,0 +1,48 @@
+ld: /home/abuild/rpmbuild/BUILD/xen-4.8.20191211T160002.8db85532cb/non-dbg/stubdom/vtpm/vtpm.a(vtpm_cmd.o):(.bss+0x28): multiple definition of `tpm_malloc'; /home/abuild/rpmbuild/BUILD/xen-4.8.20191211T160002.8db85532cb/non-dbg/stubdom/vtpm/vtpm.a(vtpm.o):(.bss+0x728): first defined here
+--- a/tpm/tpm_emulator_extern.h
++++ b/tpm/tpm_emulator_extern.h
+@@ -29,7 +29,7 @@ enum {
+   TPM_LOG_ERROR
+ };
+ 
+-void (*tpm_log)(int priority, const char *fmt, ...);
++extern void (*tpm_log)(int priority, const char *fmt, ...);
+ 
+ #if defined(_WIN32) || defined(_WIN64)
+ #define __BFILE__ ((strrchr(__FILE__, '\\') ? : __FILE__ - 1) + 1)
+@@ -44,27 +44,27 @@ void (*tpm_log)(int priority, const char
+ #define error(fmt, ...) tpm_log(TPM_LOG_ERROR, "%s:%d: Error: " fmt "\n", \
+                                 __BFILE__, __LINE__, ## __VA_ARGS__)
+ /* initialization */
+-int (*tpm_extern_init)(void);
+-void (*tpm_extern_release)(void);
++extern int (*tpm_extern_init)(void);
++extern void (*tpm_extern_release)(void);
+ 
+ /* memory allocation */
+ 
+-void* (*tpm_malloc)(size_t size);
++extern void* (*tpm_malloc)(size_t size);
+ 
+-void (*tpm_free)(/*const*/ void *ptr);
++extern void (*tpm_free)(/*const*/ void *ptr);
+ 
+ /* random numbers */
+ 
+-void (*tpm_get_extern_random_bytes)(void *buf, size_t nbytes);
++extern void (*tpm_get_extern_random_bytes)(void *buf, size_t nbytes);
+ 
+ /* usec since last call */
+ 
+-uint64_t (*tpm_get_ticks)(void);
++extern uint64_t (*tpm_get_ticks)(void);
+ 
+ /* file handling */
+ 
+-int (*tpm_write_to_storage)(uint8_t *data, size_t data_length);
+-int (*tpm_read_from_storage)(uint8_t **data, size_t *data_length);
++extern int (*tpm_write_to_storage)(uint8_t *data, size_t data_length);
++extern int (*tpm_read_from_storage)(uint8_t **data, size_t *data_length);
+ 
+ #endif /* _TPM_EMULATOR_EXTERN_H_ */
+ 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jun 22 09:57:04 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 22 Jun 2020 09:57: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 1jnJCK-0004xx-VF; Mon, 22 Jun 2020 09:57: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=O5+D=AD=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jnJCK-0004xp-68
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:57:04 +0000
X-Inumbo-ID: b950012c-b46e-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id b950012c-b46e-11ea-bb8b-bc764e2007e4;
 Mon, 22 Jun 2020 09:57: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=td5n/LvpwJsZZBiukMBGfw3mMYZm1pd+sM3KXjojJ6Q=; b=ZjghV7ERvZPXWozQ6us+nuF39g
 ZGCYz3FhOlILda21/1Be9UR4OGvastpfThtcw88jua5RbEchOvnPD3A7/Z9nuOk7wHjIrYzWEo3Lm
 B1KbM3E+kJZyG6UI9PDTs5ZjDyGDDsstkvFrkHROKwOygnLaexxOI8vb89WLW+XgtQV4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jnJCJ-0003P3-Jb
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:57:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jnJCJ-0000S7-If
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:57:03 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/hvm: check against VIOAPIC_LEVEL_TRIG in
 hvm_gsi_deassert
Message-Id: <E1jnJCJ-0000S7-If@xenbits.xenproject.org>
Date: Mon, 22 Jun 2020 09:57: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 81ebf6e707ec0f49e257b136ce0421cbba4f4819
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Fri Jun 19 15:23:50 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jun 19 15:23:50 2020 +0200

    x86/hvm: check against VIOAPIC_LEVEL_TRIG in hvm_gsi_deassert
    
    In order to avoid relying on the specific values of
    VIOAPIC_{LEVEL/EDGE}_TRIG.
    
    No functional change.
    
    Requested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/arch/x86/hvm/irq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/irq.c b/xen/arch/x86/hvm/irq.c
index fd02cf2e8d..38ac5fb6c7 100644
--- a/xen/arch/x86/hvm/irq.c
+++ b/xen/arch/x86/hvm/irq.c
@@ -201,7 +201,7 @@ void hvm_gsi_deassert(struct domain *d, unsigned int gsi)
     int trig = vioapic_get_trigger_mode(d, gsi);
     struct hvm_irq *hvm_irq = hvm_domain_irq(d);
 
-    if ( trig <= VIOAPIC_EDGE_TRIG || gsi >= hvm_irq->nr_gsis )
+    if ( trig != VIOAPIC_LEVEL_TRIG || gsi >= hvm_irq->nr_gsis )
     {
         ASSERT(trig == VIOAPIC_EDGE_TRIG && gsi < hvm_irq->nr_gsis);
         return;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jun 22 09:57:16 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 22 Jun 2020 09:57: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 1jnJCW-0004zD-0k; Mon, 22 Jun 2020 09:57: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=O5+D=AD=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jnJCU-0004z5-Td
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:57:14 +0000
X-Inumbo-ID: bf54cc74-b46e-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id bf54cc74-b46e-11ea-bb8b-bc764e2007e4;
 Mon, 22 Jun 2020 09:57: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=6EgNTy5e+XbCM1v0lLCnOgprHYSLPVortuH7tlz2JVg=; b=iINHk0JW9UevRcFIwyysKPn13R
 EOiWdMqDEzpJeQIUGuWnVxxkyl4SHc1RFUSN6xu9RA21PlAC4dO7DpPvet5UMKrzbcZPjP2yHwVHZ
 Z6DdXhhZ1fBHWi9y6xNhdR7gS8nRWV6nv/3TsTO6GYBnDLu2e7xrPCbe8cRisoyOjBS0=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jnJCT-0003PE-Mk
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:57:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jnJCT-0000Sf-M6
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:57:13 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/vmx: use P2M_ALLOC in vmx_load_pdptrs instead of
 P2M_UNSHARE
Message-Id: <E1jnJCT-0000Sf-M6@xenbits.xenproject.org>
Date: Mon, 22 Jun 2020 09:57: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 b67e859d0823f5b450e29379af9142d44a3ea370
Author:     Tamas K Lengyel <tamas.lengyel@intel.com>
AuthorDate: Fri Jun 19 15:24:55 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jun 19 15:24:55 2020 +0200

    x86/vmx: use P2M_ALLOC in vmx_load_pdptrs instead of P2M_UNSHARE
    
    While forking VMs running a small RTOS system (Zephyr) a Xen crash has been
    observed due to a mm-lock order violation while copying the HVM CPU context
    from the parent. This issue has been identified to be due to
    hap_update_paging_modes first getting a lock on the gfn using get_gfn. This
    call also creates a shared entry in the fork's memory map for the cr3 gfn. The
    function later calls hap_update_cr3 while holding the paging_lock, which
    results in the lock-order violation in vmx_load_pdptrs when it tries to unshare
    the above entry when it grabs the page with the P2M_UNSHARE flag set.
    
    Since vmx_load_pdptrs only reads from the page its usage of P2M_UNSHARE was
    unnecessary to start with. Using P2M_ALLOC is the appropriate flag to ensure
    the p2m is properly populated.
    
    Note that the lock order violation is avoided because before the paging_lock is
    taken a lookup is performed with P2M_ALLOC that forks the page, thus the second
    lookup in vmx_load_pdptrs succeeds without having to perform the fork. We keep
    P2M_ALLOC in vmx_load_pdptrs because there are code-paths leading up to it
    which don't take the paging_lock and that have no previous lookup. Currently no
    other code-path exists leading there with the paging_lock taken, thus no
    further adjustments are necessary.
    
    Signed-off-by: Tamas K Lengyel <tamas.lengyel@intel.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/arch/x86/hvm/vmx/vmx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index ab19d9424e..cc6d4ece22 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -1325,7 +1325,7 @@ static void vmx_load_pdptrs(struct vcpu *v)
     if ( (cr3 & 0x1fUL) && !hvm_pcid_enabled(v) )
         goto crash;
 
-    page = get_page_from_gfn(v->domain, cr3 >> PAGE_SHIFT, &p2mt, P2M_UNSHARE);
+    page = get_page_from_gfn(v->domain, cr3 >> PAGE_SHIFT, &p2mt, P2M_ALLOC);
     if ( !page )
     {
         /* Ideally you don't want to crash but rather go into a wait 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jun 22 09:57:26 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 22 Jun 2020 09:57: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 1jnJCg-00050P-3y; Mon, 22 Jun 2020 09:57: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=O5+D=AD=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jnJCf-00050F-17
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:57:25 +0000
X-Inumbo-ID: c5603856-b46e-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id c5603856-b46e-11ea-8496-bc764e2007e4;
 Mon, 22 Jun 2020 09:57: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=Fzbf3h555BTCldpXp73AtJd5RmMnfUBLEuHl0alfb+M=; b=dZ6UwWLLGpLnS/h5hcKhDiudEP
 hwPCk2KSSSBGWvWJV0S/7ACpRNd+pUcS+3ClcNPdaOoNCOJT86KLCzfYBtKakmZatIoIgfRAyy8ij
 zTCZHMDMaLgNaE6z7gFS48I5lZfP6ixQI0aDp+EXuIzH9ZiRcxjtDUiorfHPWzBhVwvY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jnJCd-0003PM-RV
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:57:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jnJCd-0000TT-Qe
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:57:23 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] tools: Commit autoconf output from Debian buster
Message-Id: <E1jnJCd-0000TT-Qe@xenbits.xenproject.org>
Date: Mon, 22 Jun 2020 09:57: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 4f4f6a67ac251fab13d03baab0d16bf7427ffd91
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Fri Jun 12 15:31:06 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Fri Jun 19 16:19:59 2020 +0100

    tools: Commit autoconf output from Debian buster
    
    These files are in tree so that people can build (including from git)
    without needing recent autotools.
    
    We should update them periodically.  Debian buster has been Debian
    stable fopr a while.  Our CI is running buster.
    
    There should be no significant functional change; it's possible that
    there are bugfixes to the configure scripts but I have not reviewed
    them.
    
    These files were last changed in
      83c845033dc8bb3a35ae245effb7832b6823174a
      libxl: use vchan for QMP access with Linux stubdomain
    where a new feature was added.  However, that commit contains a lot of
    extraneous noise in configure compared to its parent.
    
    Compared to 83c845033dc8bb3a35ae245effb7832b6823174a~, this commit
    restores those extraneous changes, leaving precisely the correct
    changes.  So one way of looking at the changes we are making now, is
    that we are undoing accidental changes to the autoconf output.
    
    I used Debian's autoconf 2.69-11 on amd64.
    
    CC: Wei Liu <wl@xen.org>
    CC: Nick Rosbrook <rosbrookn@gmail.com>
    Reported-by: Nick Rosbrook <rosbrookn@gmail.com>
    CC: Paul Durrant <paul@xen.org>
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 configure         | 14 +++++++++++++-
 docs/configure    | 14 +++++++++++++-
 stubdom/configure | 14 +++++++++++++-
 tools/configure   | 24 ++++++++++++++++++------
 4 files changed, 57 insertions(+), 9 deletions(-)

diff --git a/configure b/configure
index 8af54e8a5a..9da3970cef 100755
--- a/configure
+++ b/configure
@@ -644,6 +644,7 @@ infodir
 docdir
 oldincludedir
 includedir
+runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -722,6 +723,7 @@ datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -974,6 +976,15 @@ do
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
+  -runstatedir | --runstatedir | --runstatedi | --runstated \
+  | --runstate | --runstat | --runsta | --runst | --runs \
+  | --run | --ru | --r)
+    ac_prev=runstatedir ;;
+  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+  | --run=* | --ru=* | --r=*)
+    runstatedir=$ac_optarg ;;
+
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1111,7 +1122,7 @@ fi
 for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
 		datadir sysconfdir sharedstatedir localstatedir includedir \
 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir
+		libdir localedir mandir runstatedir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1264,6 +1275,7 @@ Fine tuning of the installation directories:
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
diff --git a/docs/configure b/docs/configure
index 93e9dcf404..9e3ed60462 100755
--- a/docs/configure
+++ b/docs/configure
@@ -634,6 +634,7 @@ infodir
 docdir
 oldincludedir
 includedir
+runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -710,6 +711,7 @@ datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -962,6 +964,15 @@ do
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
+  -runstatedir | --runstatedir | --runstatedi | --runstated \
+  | --runstate | --runstat | --runsta | --runst | --runs \
+  | --run | --ru | --r)
+    ac_prev=runstatedir ;;
+  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+  | --run=* | --ru=* | --r=*)
+    runstatedir=$ac_optarg ;;
+
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1099,7 +1110,7 @@ fi
 for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
 		datadir sysconfdir sharedstatedir localstatedir includedir \
 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir
+		libdir localedir mandir runstatedir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1252,6 +1263,7 @@ Fine tuning of the installation directories:
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
diff --git a/stubdom/configure b/stubdom/configure
index f7604a37f7..da03da535a 100755
--- a/stubdom/configure
+++ b/stubdom/configure
@@ -661,6 +661,7 @@ infodir
 docdir
 oldincludedir
 includedir
+runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -750,6 +751,7 @@ datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1002,6 +1004,15 @@ do
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
+  -runstatedir | --runstatedir | --runstatedi | --runstated \
+  | --runstate | --runstat | --runsta | --runst | --runs \
+  | --run | --ru | --r)
+    ac_prev=runstatedir ;;
+  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+  | --run=* | --ru=* | --r=*)
+    runstatedir=$ac_optarg ;;
+
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1139,7 +1150,7 @@ fi
 for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
 		datadir sysconfdir sharedstatedir localstatedir includedir \
 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir
+		libdir localedir mandir runstatedir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1292,6 +1303,7 @@ Fine tuning of the installation directories:
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
diff --git a/tools/configure b/tools/configure
index 15ba28211a..f3f19c1a90 100755
--- a/tools/configure
+++ b/tools/configure
@@ -772,6 +772,7 @@ infodir
 docdir
 oldincludedir
 includedir
+runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -899,6 +900,7 @@ datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1151,6 +1153,15 @@ do
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
+  -runstatedir | --runstatedir | --runstatedi | --runstated \
+  | --runstate | --runstat | --runsta | --runst | --runs \
+  | --run | --ru | --r)
+    ac_prev=runstatedir ;;
+  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+  | --run=* | --ru=* | --r=*)
+    runstatedir=$ac_optarg ;;
+
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1288,7 +1299,7 @@ fi
 for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
 		datadir sysconfdir sharedstatedir localstatedir includedir \
 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir
+		libdir localedir mandir runstatedir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1441,6 +1452,7 @@ Fine tuning of the installation directories:
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
@@ -3374,7 +3386,7 @@ else
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
 		       && LARGE_OFF_T % 2147483647 == 1)
 		      ? 1 : -1];
@@ -3420,7 +3432,7 @@ else
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
 		       && LARGE_OFF_T % 2147483647 == 1)
 		      ? 1 : -1];
@@ -3444,7 +3456,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
 		       && LARGE_OFF_T % 2147483647 == 1)
 		      ? 1 : -1];
@@ -3489,7 +3501,7 @@ else
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
 		       && LARGE_OFF_T % 2147483647 == 1)
 		      ? 1 : -1];
@@ -3513,7 +3525,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
 		       && LARGE_OFF_T % 2147483647 == 1)
 		      ? 1 : -1];
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jun 22 09:57:40 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 22 Jun 2020 09:57: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 1jnJCu-00051X-62; Mon, 22 Jun 2020 09:57:40 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=O5+D=AD=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jnJCs-00051Q-Lt
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:57:38 +0000
X-Inumbo-ID: cb6aa330-b46e-11ea-be66-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id cb6aa330-b46e-11ea-be66-12813bfff9fa;
 Mon, 22 Jun 2020 09:57: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=OBpFoc5poWAXLgBmG/2GKREJq+OZR4JoBGvHjC47kyQ=; b=BujWP0Os3RmWJ6t5ZwFTyyLO2R
 7eZI02WboI17G1EfnNPxpdDv8pc+R7yAhqbORtFclu3BV5Tj2QJksCCUDYhaxbs1JrBbITxHnoGjq
 05EZckN+cKZKyFLoU8Y+5kTPpI+gpfp5mq2D7DDe8oxLJQRPgQ8Wk1Hlt46r6EuW21AY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jnJCn-0003PX-Vc
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:57:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jnJCn-0000U5-UD
 for xen-changelog@lists.xenproject.org; Mon, 22 Jun 2020 09:57:33 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] tools: Commit flex (2.6.4) & bison (3.3.2) output from
 Debian buster
Message-Id: <E1jnJCn-0000U5-UD@xenbits.xenproject.org>
Date: Mon, 22 Jun 2020 09:57: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 fde76f895d0aa817a1207d844d793239c6639bc6
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Fri Jun 12 16:03:25 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Fri Jun 19 16:20:11 2020 +0100

    tools: Commit flex (2.6.4) & bison (3.3.2) output from Debian buster
    
    These files are in tree so that people can build (including from git)
    without needing less-than-a-decade-old flex and bison.
    
    We should update them periodically.  Debian buster has been Debian
    stable for a while.  Our CI is running buster.
    
    There should be no significant functional change; it's possible that
    there are bugfixes but I have not reviewed the changes.  I *have*
    checked that the flex I am using has the fix for CVE-2016-6354.
    
    CC: Paul Durrant <paul@xen.org>
    CC: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/libxl/libxlu_cfg_l.c | 676 ++++++++++++++++++++++++++++++---------------
 tools/libxl/libxlu_cfg_l.h | 471 ++++++++++++++++++++++++++++---
 tools/libxl/libxlu_cfg_y.c | 285 +++++++++----------
 tools/libxl/libxlu_cfg_y.h |  12 +-
 4 files changed, 1033 insertions(+), 411 deletions(-)

diff --git a/tools/libxl/libxlu_cfg_l.c b/tools/libxl/libxlu_cfg_l.c
index b82df00b4e..406b50a037 100644
--- a/tools/libxl/libxlu_cfg_l.c
+++ b/tools/libxl/libxlu_cfg_l.c
@@ -9,11 +9,245 @@
 #define FLEX_SCANNER
 #define YY_FLEX_MAJOR_VERSION 2
 #define YY_FLEX_MINOR_VERSION 6
-#define YY_FLEX_SUBMINOR_VERSION 1
+#define YY_FLEX_SUBMINOR_VERSION 4
 #if YY_FLEX_SUBMINOR_VERSION > 0
 #define FLEX_BETA
 #endif
 
+#ifdef yy_create_buffer
+#define xlu__cfg_yy_create_buffer_ALREADY_DEFINED
+#else
+#define yy_create_buffer xlu__cfg_yy_create_buffer
+#endif
+
+#ifdef yy_delete_buffer
+#define xlu__cfg_yy_delete_buffer_ALREADY_DEFINED
+#else
+#define yy_delete_buffer xlu__cfg_yy_delete_buffer
+#endif
+
+#ifdef yy_scan_buffer
+#define xlu__cfg_yy_scan_buffer_ALREADY_DEFINED
+#else
+#define yy_scan_buffer xlu__cfg_yy_scan_buffer
+#endif
+
+#ifdef yy_scan_string
+#define xlu__cfg_yy_scan_string_ALREADY_DEFINED
+#else
+#define yy_scan_string xlu__cfg_yy_scan_string
+#endif
+
+#ifdef yy_scan_bytes
+#define xlu__cfg_yy_scan_bytes_ALREADY_DEFINED
+#else
+#define yy_scan_bytes xlu__cfg_yy_scan_bytes
+#endif
+
+#ifdef yy_init_buffer
+#define xlu__cfg_yy_init_buffer_ALREADY_DEFINED
+#else
+#define yy_init_buffer xlu__cfg_yy_init_buffer
+#endif
+
+#ifdef yy_flush_buffer
+#define xlu__cfg_yy_flush_buffer_ALREADY_DEFINED
+#else
+#define yy_flush_buffer xlu__cfg_yy_flush_buffer
+#endif
+
+#ifdef yy_load_buffer_state
+#define xlu__cfg_yy_load_buffer_state_ALREADY_DEFINED
+#else
+#define yy_load_buffer_state xlu__cfg_yy_load_buffer_state
+#endif
+
+#ifdef yy_switch_to_buffer
+#define xlu__cfg_yy_switch_to_buffer_ALREADY_DEFINED
+#else
+#define yy_switch_to_buffer xlu__cfg_yy_switch_to_buffer
+#endif
+
+#ifdef yypush_buffer_state
+#define xlu__cfg_yypush_buffer_state_ALREADY_DEFINED
+#else
+#define yypush_buffer_state xlu__cfg_yypush_buffer_state
+#endif
+
+#ifdef yypop_buffer_state
+#define xlu__cfg_yypop_buffer_state_ALREADY_DEFINED
+#else
+#define yypop_buffer_state xlu__cfg_yypop_buffer_state
+#endif
+
+#ifdef yyensure_buffer_stack
+#define xlu__cfg_yyensure_buffer_stack_ALREADY_DEFINED
+#else
+#define yyensure_buffer_stack xlu__cfg_yyensure_buffer_stack
+#endif
+
+#ifdef yylex
+#define xlu__cfg_yylex_ALREADY_DEFINED
+#else
+#define yylex xlu__cfg_yylex
+#endif
+
+#ifdef yyrestart
+#define xlu__cfg_yyrestart_ALREADY_DEFINED
+#else
+#define yyrestart xlu__cfg_yyrestart
+#endif
+
+#ifdef yylex_init
+#define xlu__cfg_yylex_init_ALREADY_DEFINED
+#else
+#define yylex_init xlu__cfg_yylex_init
+#endif
+
+#ifdef yylex_init_extra
+#define xlu__cfg_yylex_init_extra_ALREADY_DEFINED
+#else
+#define yylex_init_extra xlu__cfg_yylex_init_extra
+#endif
+
+#ifdef yylex_destroy
+#define xlu__cfg_yylex_destroy_ALREADY_DEFINED
+#else
+#define yylex_destroy xlu__cfg_yylex_destroy
+#endif
+
+#ifdef yyget_debug
+#define xlu__cfg_yyget_debug_ALREADY_DEFINED
+#else
+#define yyget_debug xlu__cfg_yyget_debug
+#endif
+
+#ifdef yyset_debug
+#define xlu__cfg_yyset_debug_ALREADY_DEFINED
+#else
+#define yyset_debug xlu__cfg_yyset_debug
+#endif
+
+#ifdef yyget_extra
+#define xlu__cfg_yyget_extra_ALREADY_DEFINED
+#else
+#define yyget_extra xlu__cfg_yyget_extra
+#endif
+
+#ifdef yyset_extra
+#define xlu__cfg_yyset_extra_ALREADY_DEFINED
+#else
+#define yyset_extra xlu__cfg_yyset_extra
+#endif
+
+#ifdef yyget_in
+#define xlu__cfg_yyget_in_ALREADY_DEFINED
+#else
+#define yyget_in xlu__cfg_yyget_in
+#endif
+
+#ifdef yyset_in
+#define xlu__cfg_yyset_in_ALREADY_DEFINED
+#else
+#define yyset_in xlu__cfg_yyset_in
+#endif
+
+#ifdef yyget_out
+#define xlu__cfg_yyget_out_ALREADY_DEFINED
+#else
+#define yyget_out xlu__cfg_yyget_out
+#endif
+
+#ifdef yyset_out
+#define xlu__cfg_yyset_out_ALREADY_DEFINED
+#else
+#define yyset_out xlu__cfg_yyset_out
+#endif
+
+#ifdef yyget_leng
+#define xlu__cfg_yyget_leng_ALREADY_DEFINED
+#else
+#define yyget_leng xlu__cfg_yyget_leng
+#endif
+
+#ifdef yyget_text
+#define xlu__cfg_yyget_text_ALREADY_DEFINED
+#else
+#define yyget_text xlu__cfg_yyget_text
+#endif
+
+#ifdef yyget_lineno
+#define xlu__cfg_yyget_lineno_ALREADY_DEFINED
+#else
+#define yyget_lineno xlu__cfg_yyget_lineno
+#endif
+
+#ifdef yyset_lineno
+#define xlu__cfg_yyset_lineno_ALREADY_DEFINED
+#else
+#define yyset_lineno xlu__cfg_yyset_lineno
+#endif
+
+#ifdef yyget_column
+#define xlu__cfg_yyget_column_ALREADY_DEFINED
+#else
+#define yyget_column xlu__cfg_yyget_column
+#endif
+
+#ifdef yyset_column
+#define xlu__cfg_yyset_column_ALREADY_DEFINED
+#else
+#define yyset_column xlu__cfg_yyset_column
+#endif
+
+#ifdef yywrap
+#define xlu__cfg_yywrap_ALREADY_DEFINED
+#else
+#define yywrap xlu__cfg_yywrap
+#endif
+
+#ifdef yyget_lval
+#define xlu__cfg_yyget_lval_ALREADY_DEFINED
+#else
+#define yyget_lval xlu__cfg_yyget_lval
+#endif
+
+#ifdef yyset_lval
+#define xlu__cfg_yyset_lval_ALREADY_DEFINED
+#else
+#define yyset_lval xlu__cfg_yyset_lval
+#endif
+
+#ifdef yyget_lloc
+#define xlu__cfg_yyget_lloc_ALREADY_DEFINED
+#else
+#define yyget_lloc xlu__cfg_yyget_lloc
+#endif
+
+#ifdef yyset_lloc
+#define xlu__cfg_yyset_lloc_ALREADY_DEFINED
+#else
+#define yyset_lloc xlu__cfg_yyset_lloc
+#endif
+
+#ifdef yyalloc
+#define xlu__cfg_yyalloc_ALREADY_DEFINED
+#else
+#define yyalloc xlu__cfg_yyalloc
+#endif
+
+#ifdef yyrealloc
+#define xlu__cfg_yyrealloc_ALREADY_DEFINED
+#else
+#define yyrealloc xlu__cfg_yyrealloc
+#endif
+
+#ifdef yyfree
+#define xlu__cfg_yyfree_ALREADY_DEFINED
+#else
+#define yyfree xlu__cfg_yyfree
+#endif
+
 /* First, we deal with  platform-specific or compiler-specific issues. */
 
 /* begin standard C headers. */
@@ -84,10 +318,16 @@ typedef unsigned int flex_uint32_t;
 #define UINT32_MAX             (4294967295U)
 #endif
 
+#ifndef SIZE_MAX
+#define SIZE_MAX               (~(size_t)0)
+#endif
+
 #endif /* ! C99 */
 
 #endif /* ! FLEXINT_H */
 
+/* begin standard C++ headers. */
+
 /* TODO: this is always defined, so inline it */
 #define yyconst const
 
@@ -100,12 +340,10 @@ typedef unsigned int flex_uint32_t;
 /* Returned upon end-of-file. */
 #define YY_NULL 0
 
-/* Promotes a possibly negative, possibly signed char to an unsigned
- * integer for use as an array index.  If the signed char is negative,
- * we want to instead treat it as an 8-bit unsigned char, hence the
- * double cast.
+/* Promotes a possibly negative, possibly signed char to an
+ *   integer in range [0..255] for use as an array index.
  */
-#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
+#define YY_SC_TO_UI(c) ((YY_CHAR) (c))
 
 /* An opaque pointer. */
 #ifndef YY_TYPEDEF_YY_SCANNER_T
@@ -129,20 +367,16 @@ typedef void* yyscan_t;
  * definition of BEGIN.
  */
 #define BEGIN yyg->yy_start = 1 + 2 *
-
 /* Translate the current start state into a value that can be later handed
  * to BEGIN to return to the state.  The YYSTATE alias is for lex
  * compatibility.
  */
 #define YY_START ((yyg->yy_start - 1) / 2)
 #define YYSTATE YY_START
-
 /* Action number for EOF rule of a given start state. */
 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
-
 /* Special action meaning "start processing a new file". */
-#define YY_NEW_FILE xlu__cfg_yyrestart(yyin ,yyscanner )
-
+#define YY_NEW_FILE yyrestart( yyin , yyscanner )
 #define YY_END_OF_BUFFER_CHAR 0
 
 /* Size of default input buffer. */
@@ -175,10 +409,10 @@ typedef size_t yy_size_t;
 #define EOB_ACT_CONTINUE_SCAN 0
 #define EOB_ACT_END_OF_FILE 1
 #define EOB_ACT_LAST_MATCH 2
-
+    
     /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
      *       access to the local variable yy_act. Since yyless() is a macro, it would break
-     *       existing scanners that call yyless() from OUTSIDE xlu__cfg_yylex.
+     *       existing scanners that call yyless() from OUTSIDE yylex.
      *       One obvious solution it to make yy_act a global. I tried that, and saw
      *       a 5% performance hit in a non-yylineno scanner, because yy_act is
      *       normally declared as a register variable-- so it is not worth it.
@@ -211,7 +445,6 @@ typedef size_t yy_size_t;
 		YY_DO_BEFORE_ACTION; /* set up yytext again */ \
 		} \
 	while ( 0 )
-
 #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
 
 #ifndef YY_STRUCT_YY_BUFFER_STATE
@@ -271,7 +504,7 @@ struct yy_buffer_state
 	 * possible backing-up.
 	 *
 	 * When we actually see the EOF, we change the status to "new"
-	 * (via xlu__cfg_yyrestart()), so that the user can continue scanning by
+	 * (via yyrestart()), so that the user can continue scanning by
 	 * just pointing yyin at a new input file.
 	 */
 #define YY_BUFFER_EOF_PENDING 2
@@ -288,71 +521,65 @@ struct yy_buffer_state
 #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
                           ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
                           : NULL)
-
 /* Same as previous macro, but useful when we know that the buffer stack is not
  * NULL or when we need an lvalue. For internal use only.
  */
 #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
 
-void xlu__cfg_yyrestart (FILE *input_file ,yyscan_t yyscanner );
-void xlu__cfg_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
-YY_BUFFER_STATE xlu__cfg_yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner );
-void xlu__cfg_yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
-void xlu__cfg_yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
-void xlu__cfg_yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
-void xlu__cfg_yypop_buffer_state (yyscan_t yyscanner );
-
-static void xlu__cfg_yyensure_buffer_stack (yyscan_t yyscanner );
-static void xlu__cfg_yy_load_buffer_state (yyscan_t yyscanner );
-static void xlu__cfg_yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );
+void yyrestart ( FILE *input_file , yyscan_t yyscanner );
+void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );
+YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner );
+void yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );
+void yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );
+void yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );
+void yypop_buffer_state ( yyscan_t yyscanner );
 
-#define YY_FLUSH_BUFFER xlu__cfg_yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
+static void yyensure_buffer_stack ( yyscan_t yyscanner );
+static void yy_load_buffer_state ( yyscan_t yyscanner );
+static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file , yyscan_t yyscanner );
+#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER , yyscanner)
 
-YY_BUFFER_STATE xlu__cfg_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
-YY_BUFFER_STATE xlu__cfg_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
-YY_BUFFER_STATE xlu__cfg_yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
+YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner );
+YY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner );
+YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner );
 
-void *xlu__cfg_yyalloc (yy_size_t ,yyscan_t yyscanner );
-void *xlu__cfg_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner );
-void xlu__cfg_yyfree (void * ,yyscan_t yyscanner );
-
-#define yy_new_buffer xlu__cfg_yy_create_buffer
+void *yyalloc ( yy_size_t , yyscan_t yyscanner );
+void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner );
+void yyfree ( void * , yyscan_t yyscanner );
 
+#define yy_new_buffer yy_create_buffer
 #define yy_set_interactive(is_interactive) \
 	{ \
 	if ( ! YY_CURRENT_BUFFER ){ \
-        xlu__cfg_yyensure_buffer_stack (yyscanner); \
+        yyensure_buffer_stack (yyscanner); \
 		YY_CURRENT_BUFFER_LVALUE =    \
-            xlu__cfg_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
+            yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \
 	} \
 	YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
 	}
-
 #define yy_set_bol(at_bol) \
 	{ \
 	if ( ! YY_CURRENT_BUFFER ){\
-        xlu__cfg_yyensure_buffer_stack (yyscanner); \
+        yyensure_buffer_stack (yyscanner); \
 		YY_CURRENT_BUFFER_LVALUE =    \
-            xlu__cfg_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
+            yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \
 	} \
 	YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
 	}
-
 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
 
 #define xlu__cfg_yywrap(yyscanner) (/*CONSTCOND*/1)
 #define YY_SKIP_YYWRAP
-
-typedef unsigned char YY_CHAR;
+typedef flex_uint8_t YY_CHAR;
 
 typedef int yy_state_type;
 
 #define yytext_ptr yytext_r
 
-static yy_state_type yy_get_previous_state (yyscan_t yyscanner );
-static yy_state_type yy_try_NUL_trans (yy_state_type current_state  ,yyscan_t yyscanner);
-static int yy_get_next_buffer (yyscan_t yyscanner );
-static void yynoreturn yy_fatal_error (yyconst char* msg ,yyscan_t yyscanner );
+static yy_state_type yy_get_previous_state ( yyscan_t yyscanner );
+static yy_state_type yy_try_NUL_trans ( yy_state_type current_state  , yyscan_t yyscanner);
+static int yy_get_next_buffer ( yyscan_t yyscanner );
+static void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner );
 
 /* Done after the current pattern has been matched and before the
  * corresponding action - sets up yytext.
@@ -364,7 +591,6 @@ static void yynoreturn yy_fatal_error (yyconst char* msg ,yyscan_t yyscanner );
 	yyg->yy_hold_char = *yy_cp; \
 	*yy_cp = '\0'; \
 	yyg->yy_c_buf_p = yy_cp;
-
 #define YY_NUM_RULES 17
 #define YY_END_OF_BUFFER 18
 /* This struct is not used in this scanner,
@@ -374,7 +600,7 @@ struct yy_trans_info
 	flex_int32_t yy_verify;
 	flex_int32_t yy_nxt;
 	};
-static yyconst flex_int16_t yy_accept[37] =
+static const flex_int16_t yy_accept[37] =
     {   0,
         0,    0,   15,   15,   18,   14,    3,   10,   14,   14,
        14,   13,   13,    4,    2,    9,    8,    5,    6,    1,
@@ -382,7 +608,7 @@ static yyconst flex_int16_t yy_accept[37] =
         0,    7,    2,    1,   15,    0
     } ;
 
-static yyconst YY_CHAR yy_ec[256] =
+static const YY_CHAR yy_ec[256] =
     {   0,
         1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
@@ -414,13 +640,13 @@ static yyconst YY_CHAR yy_ec[256] =
         1,    1,    1,    1,    1
     } ;
 
-static yyconst YY_CHAR yy_meta[20] =
+static const YY_CHAR yy_meta[20] =
     {   0,
         1,    2,    3,    1,    1,    1,    1,    1,    1,    4,
         4,    1,    1,    1,    1,    1,    4,    4,    4
     } ;
 
-static yyconst flex_uint16_t yy_base[43] =
+static const flex_int16_t yy_base[43] =
     {   0,
         0,    0,   18,   20,   53,   59,   59,   59,   20,   42,
        19,   59,   19,   59,   15,   59,   59,   59,   59,    0,
@@ -429,7 +655,7 @@ static yyconst flex_uint16_t yy_base[43] =
        26,   54
     } ;
 
-static yyconst flex_int16_t yy_def[43] =
+static const flex_int16_t yy_def[43] =
     {   0,
        36,    1,   37,   37,   36,   36,   36,   36,   38,   39,
        40,   36,   36,   36,   36,   36,   36,   36,   36,   41,
@@ -438,7 +664,7 @@ static yyconst flex_int16_t yy_def[43] =
        36,   36
     } ;
 
-static yyconst flex_uint16_t yy_nxt[79] =
+static const flex_int16_t yy_nxt[79] =
     {   0,
         6,    7,    8,    9,   10,   11,   12,   13,   14,   12,
        15,   16,   17,   18,    6,   19,    6,   20,   20,   22,
@@ -450,7 +676,7 @@ static yyconst flex_uint16_t yy_nxt[79] =
        36,   36,   36,   36,   36,   36,   36,   36
     } ;
 
-static yyconst flex_int16_t yy_chk[79] =
+static const flex_int16_t yy_chk[79] =
     {   0,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    3,
@@ -463,7 +689,7 @@ static yyconst flex_int16_t yy_chk[79] =
     } ;
 
 /* Table of booleans, true if rule could match eol. */
-static yyconst flex_int32_t yy_rule_can_match_eol[18] =
+static const flex_int32_t yy_rule_can_match_eol[18] =
     {   0,
 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0,     };
 
@@ -510,8 +736,9 @@ static yyconst flex_int32_t yy_rule_can_match_eol[18] =
 int xlu__cfg_yyget_column(yyscan_t yyscanner);
 void xlu__cfg_yyset_column(int  column_no, yyscan_t yyscanner);
 
+#line 740 "libxlu_cfg_l.c"
 
-#line 515 "libxlu_cfg_l.c"
+#line 742 "libxlu_cfg_l.c"
 
 #define INITIAL 0
 #define lexerr 1
@@ -566,7 +793,7 @@ struct yyguts_t
 
     }; /* end struct yyguts_t */
 
-static int yy_init_globals (yyscan_t yyscanner );
+static int yy_init_globals ( yyscan_t yyscanner );
 
     /* This must go here because YYSTYPE and YYLTYPE are included
      * from bison output in section 1.*/
@@ -574,50 +801,50 @@ static int yy_init_globals (yyscan_t yyscanner );
     
     #    define yylloc yyg->yylloc_r
     
-int xlu__cfg_yylex_init (yyscan_t* scanner);
+int yylex_init (yyscan_t* scanner);
 
-int xlu__cfg_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
+int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner);
 
 /* Accessor methods to globals.
    These are made visible to non-reentrant scanners for convenience. */
 
-int xlu__cfg_yylex_destroy (yyscan_t yyscanner );
+int yylex_destroy ( yyscan_t yyscanner );
 
-int xlu__cfg_yyget_debug (yyscan_t yyscanner );
+int yyget_debug ( yyscan_t yyscanner );
 
-void xlu__cfg_yyset_debug (int debug_flag ,yyscan_t yyscanner );
+void yyset_debug ( int debug_flag , yyscan_t yyscanner );
 
-YY_EXTRA_TYPE xlu__cfg_yyget_extra (yyscan_t yyscanner );
+YY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner );
 
-void xlu__cfg_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
+void yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner );
 
-FILE *xlu__cfg_yyget_in (yyscan_t yyscanner );
+FILE *yyget_in ( yyscan_t yyscanner );
 
-void xlu__cfg_yyset_in  (FILE * _in_str ,yyscan_t yyscanner );
+void yyset_in  ( FILE * _in_str , yyscan_t yyscanner );
 
-FILE *xlu__cfg_yyget_out (yyscan_t yyscanner );
+FILE *yyget_out ( yyscan_t yyscanner );
 
-void xlu__cfg_yyset_out  (FILE * _out_str ,yyscan_t yyscanner );
+void yyset_out  ( FILE * _out_str , yyscan_t yyscanner );
 
-			int xlu__cfg_yyget_leng (yyscan_t yyscanner );
+			int yyget_leng ( yyscan_t yyscanner );
 
-char *xlu__cfg_yyget_text (yyscan_t yyscanner );
+char *yyget_text ( yyscan_t yyscanner );
 
-int xlu__cfg_yyget_lineno (yyscan_t yyscanner );
+int yyget_lineno ( yyscan_t yyscanner );
 
-void xlu__cfg_yyset_lineno (int _line_number ,yyscan_t yyscanner );
+void yyset_lineno ( int _line_number , yyscan_t yyscanner );
 
-int xlu__cfg_yyget_column  (yyscan_t yyscanner );
+int yyget_column  ( yyscan_t yyscanner );
 
-void xlu__cfg_yyset_column (int _column_no ,yyscan_t yyscanner );
+void yyset_column ( int _column_no , yyscan_t yyscanner );
 
-YYSTYPE * xlu__cfg_yyget_lval (yyscan_t yyscanner );
+YYSTYPE * yyget_lval ( yyscan_t yyscanner );
 
-void xlu__cfg_yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
+void yyset_lval ( YYSTYPE * yylval_param , yyscan_t yyscanner );
 
-       YYLTYPE *xlu__cfg_yyget_lloc (yyscan_t yyscanner );
+       YYLTYPE *yyget_lloc ( yyscan_t yyscanner );
     
-        void xlu__cfg_yyset_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner );
+        void yyset_lloc ( YYLTYPE * yylloc_param , yyscan_t yyscanner );
     
 /* Macros after this point can all be overridden by user definitions in
  * section 1.
@@ -625,9 +852,9 @@ void xlu__cfg_yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
 
 #ifndef YY_SKIP_YYWRAP
 #ifdef __cplusplus
-extern "C" int xlu__cfg_yywrap (yyscan_t yyscanner );
+extern "C" int yywrap ( yyscan_t yyscanner );
 #else
-extern int xlu__cfg_yywrap (yyscan_t yyscanner );
+extern int yywrap ( yyscan_t yyscanner );
 #endif
 #endif
 
@@ -636,19 +863,18 @@ extern int xlu__cfg_yywrap (yyscan_t yyscanner );
 #endif
 
 #ifndef yytext_ptr
-static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
+static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner);
 #endif
 
 #ifdef YY_NEED_STRLEN
-static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
+static int yy_flex_strlen ( const char * , yyscan_t yyscanner);
 #endif
 
 #ifndef YY_NO_INPUT
-
 #ifdef __cplusplus
-static int yyinput (yyscan_t yyscanner );
+static int yyinput ( yyscan_t yyscanner );
 #else
-static int input (yyscan_t yyscanner );
+static int input ( yyscan_t yyscanner );
 #endif
 
 #endif
@@ -679,7 +905,7 @@ static int input (yyscan_t yyscanner );
 	if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
 		{ \
 		int c = '*'; \
-		size_t n; \
+		int n; \
 		for ( n = 0; n < max_size && \
 			     (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
 			buf[n] = (char) c; \
@@ -692,7 +918,7 @@ static int input (yyscan_t yyscanner );
 	else \
 		{ \
 		errno=0; \
-		while ( (result = (int) fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
+		while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \
 			{ \
 			if( errno != EINTR) \
 				{ \
@@ -733,10 +959,10 @@ static int input (yyscan_t yyscanner );
 #ifndef YY_DECL
 #define YY_DECL_IS_OURS 1
 
-extern int xlu__cfg_yylex \
-               (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner);
+extern int yylex \
+               (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner);
 
-#define YY_DECL int xlu__cfg_yylex \
+#define YY_DECL int yylex \
                (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner)
 #endif /* !YY_DECL */
 
@@ -786,26 +1012,26 @@ YY_DECL
 			yyout = stdout;
 
 		if ( ! YY_CURRENT_BUFFER ) {
-			xlu__cfg_yyensure_buffer_stack (yyscanner);
+			yyensure_buffer_stack (yyscanner);
 			YY_CURRENT_BUFFER_LVALUE =
-				xlu__cfg_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
+				yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner);
 		}
 
-		xlu__cfg_yy_load_buffer_state(yyscanner );
+		yy_load_buffer_state( yyscanner );
 		}
 
 	{
 #line 53 "libxlu_cfg_l.l"
 
 
-#line 802 "libxlu_cfg_l.c"
+#line 1028 "libxlu_cfg_l.c"
 
 	while ( /*CONSTCOND*/1 )		/* loops until end-of-file is reached */
 		{
 		yyg->yy_more_len = 0;
 		if ( yyg->yy_more_flag )
 			{
-			yyg->yy_more_len = yyg->yy_c_buf_p - yyg->yytext_ptr;
+			yyg->yy_more_len = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr);
 			yyg->yy_more_flag = 0;
 			}
 		yy_cp = yyg->yy_c_buf_p;
@@ -832,9 +1058,9 @@ yy_match:
 				{
 				yy_current_state = (int) yy_def[yy_current_state];
 				if ( yy_current_state >= 37 )
-					yy_c = yy_meta[(unsigned int) yy_c];
+					yy_c = yy_meta[yy_c];
 				}
-			yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
+			yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
 			++yy_cp;
 			}
 		while ( yy_current_state != 36 );
@@ -982,7 +1208,7 @@ YY_RULE_SETUP
 #line 105 "libxlu_cfg_l.l"
 YY_FATAL_ERROR( "flex scanner jammed" );
 	YY_BREAK
-#line 986 "libxlu_cfg_l.c"
+#line 1212 "libxlu_cfg_l.c"
 case YY_STATE_EOF(INITIAL):
 case YY_STATE_EOF(lexerr):
 	yyterminate();
@@ -1001,7 +1227,7 @@ case YY_STATE_EOF(lexerr):
 			/* We're scanning a new file or input source.  It's
 			 * possible that this happened because the user
 			 * just pointed yyin at a new source and called
-			 * xlu__cfg_yylex().  If so, then we have to assure
+			 * yylex().  If so, then we have to assure
 			 * consistency between YY_CURRENT_BUFFER and our
 			 * globals.  Here is the right place to do so, because
 			 * this is the first action (other than possibly a
@@ -1062,7 +1288,7 @@ case YY_STATE_EOF(lexerr):
 				{
 				yyg->yy_did_buffer_switch_on_eof = 0;
 
-				if ( xlu__cfg_yywrap(yyscanner ) )
+				if ( yywrap( yyscanner ) )
 					{
 					/* Note: because we've taken care in
 					 * yy_get_next_buffer() to have set up
@@ -1116,7 +1342,7 @@ case YY_STATE_EOF(lexerr):
 	} /* end of action switch */
 		} /* end of scanning one token */
 	} /* end of user's declarations */
-} /* end of xlu__cfg_yylex */
+} /* end of yylex */
 
 /* yy_get_next_buffer - try to read in a new buffer
  *
@@ -1195,7 +1421,8 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
 
 				b->yy_ch_buf = (char *)
 					/* Include room in for 2 EOB chars. */
-					xlu__cfg_yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner );
+					yyrealloc( (void *) b->yy_ch_buf,
+							 (yy_size_t) (b->yy_buf_size + 2) , yyscanner );
 				}
 			else
 				/* Can't grow it, we don't own it. */
@@ -1227,7 +1454,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
 		if ( number_to_move == YY_MORE_ADJ )
 			{
 			ret_val = EOB_ACT_END_OF_FILE;
-			xlu__cfg_yyrestart(yyin  ,yyscanner);
+			yyrestart( yyin  , yyscanner);
 			}
 
 		else
@@ -1244,9 +1471,12 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
 	if ((yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
 		/* Extend the array by 50%, plus the number we really need. */
 		int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
-		YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) xlu__cfg_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
+		YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
+			(void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size , yyscanner );
 		if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
 			YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
+		/* "- 2" to take care of EOB's */
+		YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
 	}
 
 	yyg->yy_n_chars += number_to_move;
@@ -1280,9 +1510,9 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
 			{
 			yy_current_state = (int) yy_def[yy_current_state];
 			if ( yy_current_state >= 37 )
-				yy_c = yy_meta[(unsigned int) yy_c];
+				yy_c = yy_meta[yy_c];
 			}
-		yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
+		yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
 		}
 
 	return yy_current_state;
@@ -1309,9 +1539,9 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
 		{
 		yy_current_state = (int) yy_def[yy_current_state];
 		if ( yy_current_state >= 37 )
-			yy_c = yy_meta[(unsigned int) yy_c];
+			yy_c = yy_meta[yy_c];
 		}
-	yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
+	yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
 	yy_is_jam = (yy_current_state == 36);
 
 	(void)yyg;
@@ -1347,7 +1577,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
 
 		else
 			{ /* need more input */
-			int offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
+			int offset = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr);
 			++yyg->yy_c_buf_p;
 
 			switch ( yy_get_next_buffer( yyscanner ) )
@@ -1364,13 +1594,13 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
 					 */
 
 					/* Reset buffer status. */
-					xlu__cfg_yyrestart(yyin ,yyscanner);
+					yyrestart( yyin , yyscanner);
 
 					/*FALLTHROUGH*/
 
 				case EOB_ACT_END_OF_FILE:
 					{
-					if ( xlu__cfg_yywrap(yyscanner ) )
+					if ( yywrap( yyscanner ) )
 						return 0;
 
 					if ( ! yyg->yy_did_buffer_switch_on_eof )
@@ -1409,34 +1639,34 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
  * @param yyscanner The scanner object.
  * @note This function does not reset the start condition to @c INITIAL .
  */
-    void xlu__cfg_yyrestart  (FILE * input_file , yyscan_t yyscanner)
+    void yyrestart  (FILE * input_file , yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
 	if ( ! YY_CURRENT_BUFFER ){
-        xlu__cfg_yyensure_buffer_stack (yyscanner);
+        yyensure_buffer_stack (yyscanner);
 		YY_CURRENT_BUFFER_LVALUE =
-            xlu__cfg_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
+            yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner);
 	}
 
-	xlu__cfg_yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
-	xlu__cfg_yy_load_buffer_state(yyscanner );
+	yy_init_buffer( YY_CURRENT_BUFFER, input_file , yyscanner);
+	yy_load_buffer_state( yyscanner );
 }
 
 /** Switch to a different input buffer.
  * @param new_buffer The new input buffer.
  * @param yyscanner The scanner object.
  */
-    void xlu__cfg_yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer , yyscan_t yyscanner)
+    void yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer , yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
 	/* TODO. We should be able to replace this entire function body
 	 * with
-	 *		xlu__cfg_yypop_buffer_state();
-	 *		xlu__cfg_yypush_buffer_state(new_buffer);
+	 *		yypop_buffer_state();
+	 *		yypush_buffer_state(new_buffer);
      */
-	xlu__cfg_yyensure_buffer_stack (yyscanner);
+	yyensure_buffer_stack (yyscanner);
 	if ( YY_CURRENT_BUFFER == new_buffer )
 		return;
 
@@ -1449,17 +1679,17 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
 		}
 
 	YY_CURRENT_BUFFER_LVALUE = new_buffer;
-	xlu__cfg_yy_load_buffer_state(yyscanner );
+	yy_load_buffer_state( yyscanner );
 
 	/* We don't actually know whether we did this switch during
-	 * EOF (xlu__cfg_yywrap()) processing, but the only time this flag
-	 * is looked at is after xlu__cfg_yywrap() is called, so it's safe
+	 * EOF (yywrap()) processing, but the only time this flag
+	 * is looked at is after yywrap() is called, so it's safe
 	 * to go ahead and always set it.
 	 */
 	yyg->yy_did_buffer_switch_on_eof = 1;
 }
 
-static void xlu__cfg_yy_load_buffer_state  (yyscan_t yyscanner)
+static void yy_load_buffer_state  (yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 	yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
@@ -1474,35 +1704,35 @@ static void xlu__cfg_yy_load_buffer_state  (yyscan_t yyscanner)
  * @param yyscanner The scanner object.
  * @return the allocated buffer state.
  */
-    YY_BUFFER_STATE xlu__cfg_yy_create_buffer  (FILE * file, int  size , yyscan_t yyscanner)
+    YY_BUFFER_STATE yy_create_buffer  (FILE * file, int  size , yyscan_t yyscanner)
 {
 	YY_BUFFER_STATE b;
     
-	b = (YY_BUFFER_STATE) xlu__cfg_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
+	b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );
 	if ( ! b )
-		YY_FATAL_ERROR( "out of dynamic memory in xlu__cfg_yy_create_buffer()" );
+		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
 
-	b->yy_buf_size = (yy_size_t)size;
+	b->yy_buf_size = size;
 
 	/* yy_ch_buf has to be 2 characters longer than the size given because
 	 * we need to put in 2 end-of-buffer characters.
 	 */
-	b->yy_ch_buf = (char *) xlu__cfg_yyalloc(b->yy_buf_size + 2 ,yyscanner );
+	b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) , yyscanner );
 	if ( ! b->yy_ch_buf )
-		YY_FATAL_ERROR( "out of dynamic memory in xlu__cfg_yy_create_buffer()" );
+		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
 
 	b->yy_is_our_buffer = 1;
 
-	xlu__cfg_yy_init_buffer(b,file ,yyscanner);
+	yy_init_buffer( b, file , yyscanner);
 
 	return b;
 }
 
 /** Destroy the buffer.
- * @param b a buffer created with xlu__cfg_yy_create_buffer()
+ * @param b a buffer created with yy_create_buffer()
  * @param yyscanner The scanner object.
  */
-    void xlu__cfg_yy_delete_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)
+    void yy_delete_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
@@ -1513,28 +1743,28 @@ static void xlu__cfg_yy_load_buffer_state  (yyscan_t yyscanner)
 		YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
 
 	if ( b->yy_is_our_buffer )
-		xlu__cfg_yyfree((void *) b->yy_ch_buf ,yyscanner );
+		yyfree( (void *) b->yy_ch_buf , yyscanner );
 
-	xlu__cfg_yyfree((void *) b ,yyscanner );
+	yyfree( (void *) b , yyscanner );
 }
 
 /* Initializes or reinitializes a buffer.
  * This function is sometimes called more than once on the same buffer,
- * such as during a xlu__cfg_yyrestart() or at EOF.
+ * such as during a yyrestart() or at EOF.
  */
-    static void xlu__cfg_yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file , yyscan_t yyscanner)
+    static void yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file , yyscan_t yyscanner)
 
 {
 	int oerrno = errno;
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
-	xlu__cfg_yy_flush_buffer(b ,yyscanner);
+	yy_flush_buffer( b , yyscanner);
 
 	b->yy_input_file = file;
 	b->yy_fill_buffer = 1;
 
-    /* If b is the current buffer, then xlu__cfg_yy_init_buffer was _probably_
-     * called from xlu__cfg_yyrestart() or through yy_get_next_buffer.
+    /* If b is the current buffer, then yy_init_buffer was _probably_
+     * called from yyrestart() or through yy_get_next_buffer.
      * In that case, we don't want to reset the lineno or column.
      */
     if (b != YY_CURRENT_BUFFER){
@@ -1551,7 +1781,7 @@ static void xlu__cfg_yy_load_buffer_state  (yyscan_t yyscanner)
  * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
  * @param yyscanner The scanner object.
  */
-    void xlu__cfg_yy_flush_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)
+    void yy_flush_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 	if ( ! b )
@@ -1572,7 +1802,7 @@ static void xlu__cfg_yy_load_buffer_state  (yyscan_t yyscanner)
 	b->yy_buffer_status = YY_BUFFER_NEW;
 
 	if ( b == YY_CURRENT_BUFFER )
-		xlu__cfg_yy_load_buffer_state(yyscanner );
+		yy_load_buffer_state( yyscanner );
 }
 
 /** Pushes the new state onto the stack. The new state becomes
@@ -1581,15 +1811,15 @@ static void xlu__cfg_yy_load_buffer_state  (yyscan_t yyscanner)
  *  @param new_buffer The new state.
  *  @param yyscanner The scanner object.
  */
-void xlu__cfg_yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
+void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 	if (new_buffer == NULL)
 		return;
 
-	xlu__cfg_yyensure_buffer_stack(yyscanner);
+	yyensure_buffer_stack(yyscanner);
 
-	/* This block is copied from xlu__cfg_yy_switch_to_buffer. */
+	/* This block is copied from yy_switch_to_buffer. */
 	if ( YY_CURRENT_BUFFER )
 		{
 		/* Flush out information for old buffer. */
@@ -1603,8 +1833,8 @@ void xlu__cfg_yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscann
 		yyg->yy_buffer_stack_top++;
 	YY_CURRENT_BUFFER_LVALUE = new_buffer;
 
-	/* copied from xlu__cfg_yy_switch_to_buffer. */
-	xlu__cfg_yy_load_buffer_state(yyscanner );
+	/* copied from yy_switch_to_buffer. */
+	yy_load_buffer_state( yyscanner );
 	yyg->yy_did_buffer_switch_on_eof = 1;
 }
 
@@ -1612,19 +1842,19 @@ void xlu__cfg_yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscann
  *  The next element becomes the new top.
  *  @param yyscanner The scanner object.
  */
-void xlu__cfg_yypop_buffer_state (yyscan_t yyscanner)
+void yypop_buffer_state (yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 	if (!YY_CURRENT_BUFFER)
 		return;
 
-	xlu__cfg_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner);
+	yy_delete_buffer(YY_CURRENT_BUFFER , yyscanner);
 	YY_CURRENT_BUFFER_LVALUE = NULL;
 	if (yyg->yy_buffer_stack_top > 0)
 		--yyg->yy_buffer_stack_top;
 
 	if (YY_CURRENT_BUFFER) {
-		xlu__cfg_yy_load_buffer_state(yyscanner );
+		yy_load_buffer_state( yyscanner );
 		yyg->yy_did_buffer_switch_on_eof = 1;
 	}
 }
@@ -1632,9 +1862,9 @@ void xlu__cfg_yypop_buffer_state (yyscan_t yyscanner)
 /* Allocates the stack if it does not exist.
  *  Guarantees space for at least one push.
  */
-static void xlu__cfg_yyensure_buffer_stack (yyscan_t yyscanner)
+static void yyensure_buffer_stack (yyscan_t yyscanner)
 {
-	int num_to_alloc;
+	yy_size_t num_to_alloc;
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
 	if (!yyg->yy_buffer_stack) {
@@ -1644,11 +1874,11 @@ static void xlu__cfg_yyensure_buffer_stack (yyscan_t yyscanner)
 		 * immediate realloc on the next call.
          */
       num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
-		yyg->yy_buffer_stack = (struct yy_buffer_state**)xlu__cfg_yyalloc
+		yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc
 								(num_to_alloc * sizeof(struct yy_buffer_state*)
 								, yyscanner);
 		if ( ! yyg->yy_buffer_stack )
-			YY_FATAL_ERROR( "out of dynamic memory in xlu__cfg_yyensure_buffer_stack()" );
+			YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
 
 		memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
 
@@ -1663,12 +1893,12 @@ static void xlu__cfg_yyensure_buffer_stack (yyscan_t yyscanner)
 		yy_size_t grow_size = 8 /* arbitrary grow size */;
 
 		num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
-		yyg->yy_buffer_stack = (struct yy_buffer_state**)xlu__cfg_yyrealloc
+		yyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc
 								(yyg->yy_buffer_stack,
 								num_to_alloc * sizeof(struct yy_buffer_state*)
 								, yyscanner);
 		if ( ! yyg->yy_buffer_stack )
-			YY_FATAL_ERROR( "out of dynamic memory in xlu__cfg_yyensure_buffer_stack()" );
+			YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
 
 		/* zero only the new slots.*/
 		memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
@@ -1682,7 +1912,7 @@ static void xlu__cfg_yyensure_buffer_stack (yyscan_t yyscanner)
  * @param yyscanner The scanner object.
  * @return the newly allocated buffer state object.
  */
-YY_BUFFER_STATE xlu__cfg_yy_scan_buffer  (char * base, yy_size_t  size , yyscan_t yyscanner)
+YY_BUFFER_STATE yy_scan_buffer  (char * base, yy_size_t  size , yyscan_t yyscanner)
 {
 	YY_BUFFER_STATE b;
     
@@ -1692,11 +1922,11 @@ YY_BUFFER_STATE xlu__cfg_yy_scan_buffer  (char * base, yy_size_t  size , yyscan_
 		/* They forgot to leave room for the EOB's. */
 		return NULL;
 
-	b = (YY_BUFFER_STATE) xlu__cfg_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
+	b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );
 	if ( ! b )
-		YY_FATAL_ERROR( "out of dynamic memory in xlu__cfg_yy_scan_buffer()" );
+		YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
 
-	b->yy_buf_size = size - 2;	/* "- 2" to take care of EOB's */
+	b->yy_buf_size = (int) (size - 2);	/* "- 2" to take care of EOB's */
 	b->yy_buf_pos = b->yy_ch_buf = base;
 	b->yy_is_our_buffer = 0;
 	b->yy_input_file = NULL;
@@ -1706,33 +1936,33 @@ YY_BUFFER_STATE xlu__cfg_yy_scan_buffer  (char * base, yy_size_t  size , yyscan_
 	b->yy_fill_buffer = 0;
 	b->yy_buffer_status = YY_BUFFER_NEW;
 
-	xlu__cfg_yy_switch_to_buffer(b ,yyscanner );
+	yy_switch_to_buffer( b , yyscanner );
 
 	return b;
 }
 
-/** Setup the input buffer state to scan a string. The next call to xlu__cfg_yylex() will
+/** Setup the input buffer state to scan a string. The next call to yylex() will
  * scan from a @e copy of @a str.
  * @param yystr a NUL-terminated string to scan
  * @param yyscanner The scanner object.
  * @return the newly allocated buffer state object.
  * @note If you want to scan bytes that may contain NUL values, then use
- *       xlu__cfg_yy_scan_bytes() instead.
+ *       yy_scan_bytes() instead.
  */
-YY_BUFFER_STATE xlu__cfg_yy_scan_string (yyconst char * yystr , yyscan_t yyscanner)
+YY_BUFFER_STATE yy_scan_string (const char * yystr , yyscan_t yyscanner)
 {
     
-	return xlu__cfg_yy_scan_bytes(yystr,(int) strlen(yystr) ,yyscanner);
+	return yy_scan_bytes( yystr, (int) strlen(yystr) , yyscanner);
 }
 
-/** Setup the input buffer state to scan the given bytes. The next call to xlu__cfg_yylex() will
+/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
  * scan from a @e copy of @a bytes.
  * @param yybytes the byte buffer to scan
  * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
  * @param yyscanner The scanner object.
  * @return the newly allocated buffer state object.
  */
-YY_BUFFER_STATE xlu__cfg_yy_scan_bytes  (yyconst char * yybytes, int  _yybytes_len , yyscan_t yyscanner)
+YY_BUFFER_STATE yy_scan_bytes  (const char * yybytes, int  _yybytes_len , yyscan_t yyscanner)
 {
 	YY_BUFFER_STATE b;
 	char *buf;
@@ -1741,18 +1971,18 @@ YY_BUFFER_STATE xlu__cfg_yy_scan_bytes  (yyconst char * yybytes, int  _yybytes_l
     
 	/* Get memory for full buffer, including space for trailing EOB's. */
 	n = (yy_size_t) (_yybytes_len + 2);
-	buf = (char *) xlu__cfg_yyalloc(n ,yyscanner );
+	buf = (char *) yyalloc( n , yyscanner );
 	if ( ! buf )
-		YY_FATAL_ERROR( "out of dynamic memory in xlu__cfg_yy_scan_bytes()" );
+		YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
 
 	for ( i = 0; i < _yybytes_len; ++i )
 		buf[i] = yybytes[i];
 
 	buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
 
-	b = xlu__cfg_yy_scan_buffer(buf,n ,yyscanner);
+	b = yy_scan_buffer( buf, n , yyscanner);
 	if ( ! b )
-		YY_FATAL_ERROR( "bad buffer in xlu__cfg_yy_scan_bytes()" );
+		YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
 
 	/* It's okay to grow etc. this buffer, and we should throw it
 	 * away when we're done.
@@ -1766,11 +1996,11 @@ YY_BUFFER_STATE xlu__cfg_yy_scan_bytes  (yyconst char * yybytes, int  _yybytes_l
 #define YY_EXIT_FAILURE 2
 #endif
 
-static void yynoreturn yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
+static void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner)
 {
 	struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 	(void)yyg;
-	(void) fprintf( stderr, "%s\n", msg );
+	fprintf( stderr, "%s\n", msg );
 	exit( YY_EXIT_FAILURE );
 }
 
@@ -1796,7 +2026,7 @@ static void yynoreturn yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
 /** Get the user-defined data for this scanner.
  * @param yyscanner The scanner object.
  */
-YY_EXTRA_TYPE xlu__cfg_yyget_extra  (yyscan_t yyscanner)
+YY_EXTRA_TYPE yyget_extra  (yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
     return yyextra;
@@ -1805,7 +2035,7 @@ YY_EXTRA_TYPE xlu__cfg_yyget_extra  (yyscan_t yyscanner)
 /** Get the current line number.
  * @param yyscanner The scanner object.
  */
-int xlu__cfg_yyget_lineno  (yyscan_t yyscanner)
+int yyget_lineno  (yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
@@ -1818,7 +2048,7 @@ int xlu__cfg_yyget_lineno  (yyscan_t yyscanner)
 /** Get the current column number.
  * @param yyscanner The scanner object.
  */
-int xlu__cfg_yyget_column  (yyscan_t yyscanner)
+int yyget_column  (yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
@@ -1831,7 +2061,7 @@ int xlu__cfg_yyget_column  (yyscan_t yyscanner)
 /** Get the input stream.
  * @param yyscanner The scanner object.
  */
-FILE *xlu__cfg_yyget_in  (yyscan_t yyscanner)
+FILE *yyget_in  (yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
     return yyin;
@@ -1840,7 +2070,7 @@ FILE *xlu__cfg_yyget_in  (yyscan_t yyscanner)
 /** Get the output stream.
  * @param yyscanner The scanner object.
  */
-FILE *xlu__cfg_yyget_out  (yyscan_t yyscanner)
+FILE *yyget_out  (yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
     return yyout;
@@ -1849,7 +2079,7 @@ FILE *xlu__cfg_yyget_out  (yyscan_t yyscanner)
 /** Get the length of the current token.
  * @param yyscanner The scanner object.
  */
-int xlu__cfg_yyget_leng  (yyscan_t yyscanner)
+int yyget_leng  (yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
     return yyleng;
@@ -1859,7 +2089,7 @@ int xlu__cfg_yyget_leng  (yyscan_t yyscanner)
  * @param yyscanner The scanner object.
  */
 
-char *xlu__cfg_yyget_text  (yyscan_t yyscanner)
+char *yyget_text  (yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
     return yytext;
@@ -1869,7 +2099,7 @@ char *xlu__cfg_yyget_text  (yyscan_t yyscanner)
  * @param user_defined The data to be associated with this scanner.
  * @param yyscanner The scanner object.
  */
-void xlu__cfg_yyset_extra (YY_EXTRA_TYPE  user_defined , yyscan_t yyscanner)
+void yyset_extra (YY_EXTRA_TYPE  user_defined , yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
     yyextra = user_defined ;
@@ -1879,13 +2109,13 @@ void xlu__cfg_yyset_extra (YY_EXTRA_TYPE  user_defined , yyscan_t yyscanner)
  * @param _line_number line number
  * @param yyscanner The scanner object.
  */
-void xlu__cfg_yyset_lineno (int  _line_number , yyscan_t yyscanner)
+void yyset_lineno (int  _line_number , yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
         /* lineno is only valid if an input buffer exists. */
         if (! YY_CURRENT_BUFFER )
-           YY_FATAL_ERROR( "xlu__cfg_yyset_lineno called with no buffer" );
+           YY_FATAL_ERROR( "yyset_lineno called with no buffer" );
     
     yylineno = _line_number;
 }
@@ -1894,13 +2124,13 @@ void xlu__cfg_yyset_lineno (int  _line_number , yyscan_t yyscanner)
  * @param _column_no column number
  * @param yyscanner The scanner object.
  */
-void xlu__cfg_yyset_column (int  _column_no , yyscan_t yyscanner)
+void yyset_column (int  _column_no , yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
         /* column is only valid if an input buffer exists. */
         if (! YY_CURRENT_BUFFER )
-           YY_FATAL_ERROR( "xlu__cfg_yyset_column called with no buffer" );
+           YY_FATAL_ERROR( "yyset_column called with no buffer" );
     
     yycolumn = _column_no;
 }
@@ -1909,27 +2139,27 @@ void xlu__cfg_yyset_column (int  _column_no , yyscan_t yyscanner)
  * input buffer.
  * @param _in_str A readable stream.
  * @param yyscanner The scanner object.
- * @see xlu__cfg_yy_switch_to_buffer
+ * @see yy_switch_to_buffer
  */
-void xlu__cfg_yyset_in (FILE *  _in_str , yyscan_t yyscanner)
+void yyset_in (FILE *  _in_str , yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
     yyin = _in_str ;
 }
 
-void xlu__cfg_yyset_out (FILE *  _out_str , yyscan_t yyscanner)
+void yyset_out (FILE *  _out_str , yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
     yyout = _out_str ;
 }
 
-int xlu__cfg_yyget_debug  (yyscan_t yyscanner)
+int yyget_debug  (yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
     return yy_flex_debug;
 }
 
-void xlu__cfg_yyset_debug (int  _bdebug , yyscan_t yyscanner)
+void yyset_debug (int  _bdebug , yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
     yy_flex_debug = _bdebug ;
@@ -1937,25 +2167,25 @@ void xlu__cfg_yyset_debug (int  _bdebug , yyscan_t yyscanner)
 
 /* Accessor methods for yylval and yylloc */
 
-YYSTYPE * xlu__cfg_yyget_lval  (yyscan_t yyscanner)
+YYSTYPE * yyget_lval  (yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
     return yylval;
 }
 
-void xlu__cfg_yyset_lval (YYSTYPE *  yylval_param , yyscan_t yyscanner)
+void yyset_lval (YYSTYPE *  yylval_param , yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
     yylval = yylval_param;
 }
 
-YYLTYPE *xlu__cfg_yyget_lloc  (yyscan_t yyscanner)
+YYLTYPE *yyget_lloc  (yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
     return yylloc;
 }
     
-void xlu__cfg_yyset_lloc (YYLTYPE *  yylloc_param , yyscan_t yyscanner)
+void yyset_lloc (YYLTYPE *  yylloc_param , yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
     yylloc = yylloc_param;
@@ -1963,20 +2193,18 @@ void xlu__cfg_yyset_lloc (YYLTYPE *  yylloc_param , yyscan_t yyscanner)
     
 /* User-visible API */
 
-/* xlu__cfg_yylex_init is special because it creates the scanner itself, so it is
+/* yylex_init is special because it creates the scanner itself, so it is
  * the ONLY reentrant function that doesn't take the scanner as the last argument.
  * That's why we explicitly handle the declaration, instead of using our macros.
  */
-
-int xlu__cfg_yylex_init(yyscan_t* ptr_yy_globals)
-
+int yylex_init(yyscan_t* ptr_yy_globals)
 {
     if (ptr_yy_globals == NULL){
         errno = EINVAL;
         return 1;
     }
 
-    *ptr_yy_globals = (yyscan_t) xlu__cfg_yyalloc ( sizeof( struct yyguts_t ), NULL );
+    *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL );
 
     if (*ptr_yy_globals == NULL){
         errno = ENOMEM;
@@ -1989,27 +2217,25 @@ int xlu__cfg_yylex_init(yyscan_t* ptr_yy_globals)
     return yy_init_globals ( *ptr_yy_globals );
 }
 
-/* xlu__cfg_yylex_init_extra has the same functionality as xlu__cfg_yylex_init, but follows the
+/* yylex_init_extra has the same functionality as yylex_init, but follows the
  * convention of taking the scanner as the last argument. Note however, that
  * this is a *pointer* to a scanner, as it will be allocated by this call (and
  * is the reason, too, why this function also must handle its own declaration).
- * The user defined value in the first argument will be available to xlu__cfg_yyalloc in
+ * The user defined value in the first argument will be available to yyalloc in
  * the yyextra field.
  */
-
-int xlu__cfg_yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals )
-
+int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals )
 {
     struct yyguts_t dummy_yyguts;
 
-    xlu__cfg_yyset_extra (yy_user_defined, &dummy_yyguts);
+    yyset_extra (yy_user_defined, &dummy_yyguts);
 
     if (ptr_yy_globals == NULL){
         errno = EINVAL;
         return 1;
     }
 
-    *ptr_yy_globals = (yyscan_t) xlu__cfg_yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
+    *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
 
     if (*ptr_yy_globals == NULL){
         errno = ENOMEM;
@@ -2020,7 +2246,7 @@ int xlu__cfg_yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_glo
     yy_init_globals. Leave at 0x00 for releases. */
     memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
 
-    xlu__cfg_yyset_extra (yy_user_defined, *ptr_yy_globals);
+    yyset_extra (yy_user_defined, *ptr_yy_globals);
 
     return yy_init_globals ( *ptr_yy_globals );
 }
@@ -2029,7 +2255,7 @@ static int yy_init_globals (yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
     /* Initialization is the same as for the non-reentrant scanner.
-     * This function is called from xlu__cfg_yylex_destroy(), so don't allocate here.
+     * This function is called from yylex_destroy(), so don't allocate here.
      */
 
     yyg->yy_buffer_stack = NULL;
@@ -2053,37 +2279,37 @@ static int yy_init_globals (yyscan_t yyscanner)
 #endif
 
     /* For future reference: Set errno on error, since we are called by
-     * xlu__cfg_yylex_init()
+     * yylex_init()
      */
     return 0;
 }
 
-/* xlu__cfg_yylex_destroy is for both reentrant and non-reentrant scanners. */
-int xlu__cfg_yylex_destroy  (yyscan_t yyscanner)
+/* yylex_destroy is for both reentrant and non-reentrant scanners. */
+int yylex_destroy  (yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
     /* Pop the buffer stack, destroying each element. */
 	while(YY_CURRENT_BUFFER){
-		xlu__cfg_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
+		yy_delete_buffer( YY_CURRENT_BUFFER , yyscanner );
 		YY_CURRENT_BUFFER_LVALUE = NULL;
-		xlu__cfg_yypop_buffer_state(yyscanner);
+		yypop_buffer_state(yyscanner);
 	}
 
 	/* Destroy the stack itself. */
-	xlu__cfg_yyfree(yyg->yy_buffer_stack ,yyscanner);
+	yyfree(yyg->yy_buffer_stack , yyscanner);
 	yyg->yy_buffer_stack = NULL;
 
     /* Destroy the start condition stack. */
-        xlu__cfg_yyfree(yyg->yy_start_stack ,yyscanner );
+        yyfree( yyg->yy_start_stack , yyscanner );
         yyg->yy_start_stack = NULL;
 
     /* Reset the globals. This is important in a non-reentrant scanner so the next time
-     * xlu__cfg_yylex() is called, initialization will occur. */
+     * yylex() is called, initialization will occur. */
     yy_init_globals( yyscanner);
 
     /* Destroy the main struct (reentrant only). */
-    xlu__cfg_yyfree ( yyscanner , yyscanner );
+    yyfree ( yyscanner , yyscanner );
     yyscanner = NULL;
     return 0;
 }
@@ -2093,7 +2319,7 @@ int xlu__cfg_yylex_destroy  (yyscan_t yyscanner)
  */
 
 #ifndef yytext_ptr
-static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
+static void yy_flex_strncpy (char* s1, const char * s2, int n , yyscan_t yyscanner)
 {
 	struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 	(void)yyg;
@@ -2105,7 +2331,7 @@ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yysca
 #endif
 
 #ifdef YY_NEED_STRLEN
-static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
+static int yy_flex_strlen (const char * s , yyscan_t yyscanner)
 {
 	int n;
 	for ( n = 0; s[n]; ++n )
@@ -2115,14 +2341,14 @@ static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
 }
 #endif
 
-void *xlu__cfg_yyalloc (yy_size_t  size , yyscan_t yyscanner)
+void *yyalloc (yy_size_t  size , yyscan_t yyscanner)
 {
 	struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 	(void)yyg;
 	return malloc(size);
 }
 
-void *xlu__cfg_yyrealloc  (void * ptr, yy_size_t  size , yyscan_t yyscanner)
+void *yyrealloc  (void * ptr, yy_size_t  size , yyscan_t yyscanner)
 {
 	struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 	(void)yyg;
@@ -2137,11 +2363,11 @@ void *xlu__cfg_yyrealloc  (void * ptr, yy_size_t  size , yyscan_t yyscanner)
 	return realloc(ptr, size);
 }
 
-void xlu__cfg_yyfree (void * ptr , yyscan_t yyscanner)
+void yyfree (void * ptr , yyscan_t yyscanner)
 {
 	struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 	(void)yyg;
-	free( (char *) ptr );	/* see xlu__cfg_yyrealloc() for (char *) cast */
+	free( (char *) ptr );	/* see yyrealloc() for (char *) cast */
 }
 
 #define YYTABLES_NAME "yytables"
diff --git a/tools/libxl/libxlu_cfg_l.h b/tools/libxl/libxlu_cfg_l.h
index 415c3ce089..213ba18b86 100644
--- a/tools/libxl/libxlu_cfg_l.h
+++ b/tools/libxl/libxlu_cfg_l.h
@@ -13,11 +13,245 @@
 #define FLEX_SCANNER
 #define YY_FLEX_MAJOR_VERSION 2
 #define YY_FLEX_MINOR_VERSION 6
-#define YY_FLEX_SUBMINOR_VERSION 1
+#define YY_FLEX_SUBMINOR_VERSION 4
 #if YY_FLEX_SUBMINOR_VERSION > 0
 #define FLEX_BETA
 #endif
 
+#ifdef yy_create_buffer
+#define xlu__cfg_yy_create_buffer_ALREADY_DEFINED
+#else
+#define yy_create_buffer xlu__cfg_yy_create_buffer
+#endif
+
+#ifdef yy_delete_buffer
+#define xlu__cfg_yy_delete_buffer_ALREADY_DEFINED
+#else
+#define yy_delete_buffer xlu__cfg_yy_delete_buffer
+#endif
+
+#ifdef yy_scan_buffer
+#define xlu__cfg_yy_scan_buffer_ALREADY_DEFINED
+#else
+#define yy_scan_buffer xlu__cfg_yy_scan_buffer
+#endif
+
+#ifdef yy_scan_string
+#define xlu__cfg_yy_scan_string_ALREADY_DEFINED
+#else
+#define yy_scan_string xlu__cfg_yy_scan_string
+#endif
+
+#ifdef yy_scan_bytes
+#define xlu__cfg_yy_scan_bytes_ALREADY_DEFINED
+#else
+#define yy_scan_bytes xlu__cfg_yy_scan_bytes
+#endif
+
+#ifdef yy_init_buffer
+#define xlu__cfg_yy_init_buffer_ALREADY_DEFINED
+#else
+#define yy_init_buffer xlu__cfg_yy_init_buffer
+#endif
+
+#ifdef yy_flush_buffer
+#define xlu__cfg_yy_flush_buffer_ALREADY_DEFINED
+#else
+#define yy_flush_buffer xlu__cfg_yy_flush_buffer
+#endif
+
+#ifdef yy_load_buffer_state
+#define xlu__cfg_yy_load_buffer_state_ALREADY_DEFINED
+#else
+#define yy_load_buffer_state xlu__cfg_yy_load_buffer_state
+#endif
+
+#ifdef yy_switch_to_buffer
+#define xlu__cfg_yy_switch_to_buffer_ALREADY_DEFINED
+#else
+#define yy_switch_to_buffer xlu__cfg_yy_switch_to_buffer
+#endif
+
+#ifdef yypush_buffer_state
+#define xlu__cfg_yypush_buffer_state_ALREADY_DEFINED
+#else
+#define yypush_buffer_state xlu__cfg_yypush_buffer_state
+#endif
+
+#ifdef yypop_buffer_state
+#define xlu__cfg_yypop_buffer_state_ALREADY_DEFINED
+#else
+#define yypop_buffer_state xlu__cfg_yypop_buffer_state
+#endif
+
+#ifdef yyensure_buffer_stack
+#define xlu__cfg_yyensure_buffer_stack_ALREADY_DEFINED
+#else
+#define yyensure_buffer_stack xlu__cfg_yyensure_buffer_stack
+#endif
+
+#ifdef yylex
+#define xlu__cfg_yylex_ALREADY_DEFINED
+#else
+#define yylex xlu__cfg_yylex
+#endif
+
+#ifdef yyrestart
+#define xlu__cfg_yyrestart_ALREADY_DEFINED
+#else
+#define yyrestart xlu__cfg_yyrestart
+#endif
+
+#ifdef yylex_init
+#define xlu__cfg_yylex_init_ALREADY_DEFINED
+#else
+#define yylex_init xlu__cfg_yylex_init
+#endif
+
+#ifdef yylex_init_extra
+#define xlu__cfg_yylex_init_extra_ALREADY_DEFINED
+#else
+#define yylex_init_extra xlu__cfg_yylex_init_extra
+#endif
+
+#ifdef yylex_destroy
+#define xlu__cfg_yylex_destroy_ALREADY_DEFINED
+#else
+#define yylex_destroy xlu__cfg_yylex_destroy
+#endif
+
+#ifdef yyget_debug
+#define xlu__cfg_yyget_debug_ALREADY_DEFINED
+#else
+#define yyget_debug xlu__cfg_yyget_debug
+#endif
+
+#ifdef yyset_debug
+#define xlu__cfg_yyset_debug_ALREADY_DEFINED
+#else
+#define yyset_debug xlu__cfg_yyset_debug
+#endif
+
+#ifdef yyget_extra
+#define xlu__cfg_yyget_extra_ALREADY_DEFINED
+#else
+#define yyget_extra xlu__cfg_yyget_extra
+#endif
+
+#ifdef yyset_extra
+#define xlu__cfg_yyset_extra_ALREADY_DEFINED
+#else
+#define yyset_extra xlu__cfg_yyset_extra
+#endif
+
+#ifdef yyget_in
+#define xlu__cfg_yyget_in_ALREADY_DEFINED
+#else
+#define yyget_in xlu__cfg_yyget_in
+#endif
+
+#ifdef yyset_in
+#define xlu__cfg_yyset_in_ALREADY_DEFINED
+#else
+#define yyset_in xlu__cfg_yyset_in
+#endif
+
+#ifdef yyget_out
+#define xlu__cfg_yyget_out_ALREADY_DEFINED
+#else
+#define yyget_out xlu__cfg_yyget_out
+#endif
+
+#ifdef yyset_out
+#define xlu__cfg_yyset_out_ALREADY_DEFINED
+#else
+#define yyset_out xlu__cfg_yyset_out
+#endif
+
+#ifdef yyget_leng
+#define xlu__cfg_yyget_leng_ALREADY_DEFINED
+#else
+#define yyget_leng xlu__cfg_yyget_leng
+#endif
+
+#ifdef yyget_text
+#define xlu__cfg_yyget_text_ALREADY_DEFINED
+#else
+#define yyget_text xlu__cfg_yyget_text
+#endif
+
+#ifdef yyget_lineno
+#define xlu__cfg_yyget_lineno_ALREADY_DEFINED
+#else
+#define yyget_lineno xlu__cfg_yyget_lineno
+#endif
+
+#ifdef yyset_lineno
+#define xlu__cfg_yyset_lineno_ALREADY_DEFINED
+#else
+#define yyset_lineno xlu__cfg_yyset_lineno
+#endif
+
+#ifdef yyget_column
+#define xlu__cfg_yyget_column_ALREADY_DEFINED
+#else
+#define yyget_column xlu__cfg_yyget_column
+#endif
+
+#ifdef yyset_column
+#define xlu__cfg_yyset_column_ALREADY_DEFINED
+#else
+#define yyset_column xlu__cfg_yyset_column
+#endif
+
+#ifdef yywrap
+#define xlu__cfg_yywrap_ALREADY_DEFINED
+#else
+#define yywrap xlu__cfg_yywrap
+#endif
+
+#ifdef yyget_lval
+#define xlu__cfg_yyget_lval_ALREADY_DEFINED
+#else
+#define yyget_lval xlu__cfg_yyget_lval
+#endif
+
+#ifdef yyset_lval
+#define xlu__cfg_yyset_lval_ALREADY_DEFINED
+#else
+#define yyset_lval xlu__cfg_yyset_lval
+#endif
+
+#ifdef yyget_lloc
+#define xlu__cfg_yyget_lloc_ALREADY_DEFINED
+#else
+#define yyget_lloc xlu__cfg_yyget_lloc
+#endif
+
+#ifdef yyset_lloc
+#define xlu__cfg_yyset_lloc_ALREADY_DEFINED
+#else
+#define yyset_lloc xlu__cfg_yyset_lloc
+#endif
+
+#ifdef yyalloc
+#define xlu__cfg_yyalloc_ALREADY_DEFINED
+#else
+#define yyalloc xlu__cfg_yyalloc
+#endif
+
+#ifdef yyrealloc
+#define xlu__cfg_yyrealloc_ALREADY_DEFINED
+#else
+#define yyrealloc xlu__cfg_yyrealloc
+#endif
+
+#ifdef yyfree
+#define xlu__cfg_yyfree_ALREADY_DEFINED
+#else
+#define yyfree xlu__cfg_yyfree
+#endif
+
 /* First, we deal with  platform-specific or compiler-specific issues. */
 
 /* begin standard C headers. */
@@ -88,10 +322,16 @@ typedef unsigned int flex_uint32_t;
 #define UINT32_MAX             (4294967295U)
 #endif
 
+#ifndef SIZE_MAX
+#define SIZE_MAX               (~(size_t)0)
+#endif
+
 #endif /* ! C99 */
 
 #endif /* ! FLEXINT_H */
 
+/* begin standard C++ headers. */
+
 /* TODO: this is always defined, so inline it */
 #define yyconst const
 
@@ -192,21 +432,21 @@ struct yy_buffer_state
 	};
 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
 
-void xlu__cfg_yyrestart (FILE *input_file ,yyscan_t yyscanner );
-void xlu__cfg_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
-YY_BUFFER_STATE xlu__cfg_yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner );
-void xlu__cfg_yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
-void xlu__cfg_yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
-void xlu__cfg_yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
-void xlu__cfg_yypop_buffer_state (yyscan_t yyscanner );
+void yyrestart ( FILE *input_file , yyscan_t yyscanner );
+void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );
+YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner );
+void yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );
+void yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );
+void yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );
+void yypop_buffer_state ( yyscan_t yyscanner );
 
-YY_BUFFER_STATE xlu__cfg_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
-YY_BUFFER_STATE xlu__cfg_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
-YY_BUFFER_STATE xlu__cfg_yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
+YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner );
+YY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner );
+YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner );
 
-void *xlu__cfg_yyalloc (yy_size_t ,yyscan_t yyscanner );
-void *xlu__cfg_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner );
-void xlu__cfg_yyfree (void * ,yyscan_t yyscanner );
+void *yyalloc ( yy_size_t , yyscan_t yyscanner );
+void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner );
+void yyfree ( void * , yyscan_t yyscanner );
 
 #define xlu__cfg_yywrap(yyscanner) (/*CONSTCOND*/1)
 #define YY_SKIP_YYWRAP
@@ -231,50 +471,50 @@ void xlu__cfg_yyfree (void * ,yyscan_t yyscanner );
 #define YY_EXTRA_TYPE void *
 #endif
 
-int xlu__cfg_yylex_init (yyscan_t* scanner);
+int yylex_init (yyscan_t* scanner);
 
-int xlu__cfg_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
+int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner);
 
 /* Accessor methods to globals.
    These are made visible to non-reentrant scanners for convenience. */
 
-int xlu__cfg_yylex_destroy (yyscan_t yyscanner );
+int yylex_destroy ( yyscan_t yyscanner );
 
-int xlu__cfg_yyget_debug (yyscan_t yyscanner );
+int yyget_debug ( yyscan_t yyscanner );
 
-void xlu__cfg_yyset_debug (int debug_flag ,yyscan_t yyscanner );
+void yyset_debug ( int debug_flag , yyscan_t yyscanner );
 
-YY_EXTRA_TYPE xlu__cfg_yyget_extra (yyscan_t yyscanner );
+YY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner );
 
-void xlu__cfg_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
+void yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner );
 
-FILE *xlu__cfg_yyget_in (yyscan_t yyscanner );
+FILE *yyget_in ( yyscan_t yyscanner );
 
-void xlu__cfg_yyset_in  (FILE * _in_str ,yyscan_t yyscanner );
+void yyset_in  ( FILE * _in_str , yyscan_t yyscanner );
 
-FILE *xlu__cfg_yyget_out (yyscan_t yyscanner );
+FILE *yyget_out ( yyscan_t yyscanner );
 
-void xlu__cfg_yyset_out  (FILE * _out_str ,yyscan_t yyscanner );
+void yyset_out  ( FILE * _out_str , yyscan_t yyscanner );
 
-			int xlu__cfg_yyget_leng (yyscan_t yyscanner );
+			int yyget_leng ( yyscan_t yyscanner );
 
-char *xlu__cfg_yyget_text (yyscan_t yyscanner );
+char *yyget_text ( yyscan_t yyscanner );
 
-int xlu__cfg_yyget_lineno (yyscan_t yyscanner );
+int yyget_lineno ( yyscan_t yyscanner );
 
-void xlu__cfg_yyset_lineno (int _line_number ,yyscan_t yyscanner );
+void yyset_lineno ( int _line_number , yyscan_t yyscanner );
 
-int xlu__cfg_yyget_column  (yyscan_t yyscanner );
+int yyget_column  ( yyscan_t yyscanner );
 
-void xlu__cfg_yyset_column (int _column_no ,yyscan_t yyscanner );
+void yyset_column ( int _column_no , yyscan_t yyscanner );
 
-YYSTYPE * xlu__cfg_yyget_lval (yyscan_t yyscanner );
+YYSTYPE * yyget_lval ( yyscan_t yyscanner );
 
-void xlu__cfg_yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
+void yyset_lval ( YYSTYPE * yylval_param , yyscan_t yyscanner );
 
-       YYLTYPE *xlu__cfg_yyget_lloc (yyscan_t yyscanner );
+       YYLTYPE *yyget_lloc ( yyscan_t yyscanner );
     
-        void xlu__cfg_yyset_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner );
+        void yyset_lloc ( YYLTYPE * yylloc_param , yyscan_t yyscanner );
     
 /* Macros after this point can all be overridden by user definitions in
  * section 1.
@@ -282,18 +522,18 @@ void xlu__cfg_yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
 
 #ifndef YY_SKIP_YYWRAP
 #ifdef __cplusplus
-extern "C" int xlu__cfg_yywrap (yyscan_t yyscanner );
+extern "C" int yywrap ( yyscan_t yyscanner );
 #else
-extern int xlu__cfg_yywrap (yyscan_t yyscanner );
+extern int yywrap ( yyscan_t yyscanner );
 #endif
 #endif
 
 #ifndef yytext_ptr
-static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
+static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner);
 #endif
 
 #ifdef YY_NEED_STRLEN
-static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
+static int yy_flex_strlen ( const char * , yyscan_t yyscanner);
 #endif
 
 #ifndef YY_NO_INPUT
@@ -321,10 +561,10 @@ static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
 #ifndef YY_DECL
 #define YY_DECL_IS_OURS 1
 
-extern int xlu__cfg_yylex \
-               (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner);
+extern int yylex \
+               (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner);
 
-#define YY_DECL int xlu__cfg_yylex \
+#define YY_DECL int yylex \
                (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner)
 #endif /* !YY_DECL */
 
@@ -342,8 +582,153 @@ extern int xlu__cfg_yylex \
 #undef YY_DECL
 #endif
 
+#ifndef xlu__cfg_yy_create_buffer_ALREADY_DEFINED
+#undef yy_create_buffer
+#endif
+#ifndef xlu__cfg_yy_delete_buffer_ALREADY_DEFINED
+#undef yy_delete_buffer
+#endif
+#ifndef xlu__cfg_yy_scan_buffer_ALREADY_DEFINED
+#undef yy_scan_buffer
+#endif
+#ifndef xlu__cfg_yy_scan_string_ALREADY_DEFINED
+#undef yy_scan_string
+#endif
+#ifndef xlu__cfg_yy_scan_bytes_ALREADY_DEFINED
+#undef yy_scan_bytes
+#endif
+#ifndef xlu__cfg_yy_init_buffer_ALREADY_DEFINED
+#undef yy_init_buffer
+#endif
+#ifndef xlu__cfg_yy_flush_buffer_ALREADY_DEFINED
+#undef yy_flush_buffer
+#endif
+#ifndef xlu__cfg_yy_load_buffer_state_ALREADY_DEFINED
+#undef yy_load_buffer_state
+#endif
+#ifndef xlu__cfg_yy_switch_to_buffer_ALREADY_DEFINED
+#undef yy_switch_to_buffer
+#endif
+#ifndef xlu__cfg_yypush_buffer_state_ALREADY_DEFINED
+#undef yypush_buffer_state
+#endif
+#ifndef xlu__cfg_yypop_buffer_state_ALREADY_DEFINED
+#undef yypop_buffer_state
+#endif
+#ifndef xlu__cfg_yyensure_buffer_stack_ALREADY_DEFINED
+#undef yyensure_buffer_stack
+#endif
+#ifndef xlu__cfg_yylex_ALREADY_DEFINED
+#undef yylex
+#endif
+#ifndef xlu__cfg_yyrestart_ALREADY_DEFINED
+#undef yyrestart
+#endif
+#ifndef xlu__cfg_yylex_init_ALREADY_DEFINED
+#undef yylex_init
+#endif
+#ifndef xlu__cfg_yylex_init_extra_ALREADY_DEFINED
+#undef yylex_init_extra
+#endif
+#ifndef xlu__cfg_yylex_destroy_ALREADY_DEFINED
+#undef yylex_destroy
+#endif
+#ifndef xlu__cfg_yyget_debug_ALREADY_DEFINED
+#undef yyget_debug
+#endif
+#ifndef xlu__cfg_yyset_debug_ALREADY_DEFINED
+#undef yyset_debug
+#endif
+#ifndef xlu__cfg_yyget_extra_ALREADY_DEFINED
+#undef yyget_extra
+#endif
+#ifndef xlu__cfg_yyset_extra_ALREADY_DEFINED
+#undef yyset_extra
+#endif
+#ifndef xlu__cfg_yyget_in_ALREADY_DEFINED
+#undef yyget_in
+#endif
+#ifndef xlu__cfg_yyset_in_ALREADY_DEFINED
+#undef yyset_in
+#endif
+#ifndef xlu__cfg_yyget_out_ALREADY_DEFINED
+#undef yyget_out
+#endif
+#ifndef xlu__cfg_yyset_out_ALREADY_DEFINED
+#undef yyset_out
+#endif
+#ifndef xlu__cfg_yyget_leng_ALREADY_DEFINED
+#undef yyget_leng
+#endif
+#ifndef xlu__cfg_yyget_text_ALREADY_DEFINED
+#undef yyget_text
+#endif
+#ifndef xlu__cfg_yyget_lineno_ALREADY_DEFINED
+#undef yyget_lineno
+#endif
+#ifndef xlu__cfg_yyset_lineno_ALREADY_DEFINED
+#undef yyset_lineno
+#endif
+#ifndef xlu__cfg_yyget_column_ALREADY_DEFINED
+#undef yyget_column
+#endif
+#ifndef xlu__cfg_yyset_column_ALREADY_DEFINED
+#undef yyset_column
+#endif
+#ifndef xlu__cfg_yywrap_ALREADY_DEFINED
+#undef yywrap
+#endif
+#ifndef xlu__cfg_yyget_lval_ALREADY_DEFINED
+#undef yyget_lval
+#endif
+#ifndef xlu__cfg_yyset_lval_ALREADY_DEFINED
+#undef yyset_lval
+#endif
+#ifndef xlu__cfg_yyget_lloc_ALREADY_DEFINED
+#undef yyget_lloc
+#endif
+#ifndef xlu__cfg_yyset_lloc_ALREADY_DEFINED
+#undef yyset_lloc
+#endif
+#ifndef xlu__cfg_yyalloc_ALREADY_DEFINED
+#undef yyalloc
+#endif
+#ifndef xlu__cfg_yyrealloc_ALREADY_DEFINED
+#undef yyrealloc
+#endif
+#ifndef xlu__cfg_yyfree_ALREADY_DEFINED
+#undef yyfree
+#endif
+#ifndef xlu__cfg_yytext_ALREADY_DEFINED
+#undef yytext
+#endif
+#ifndef xlu__cfg_yyleng_ALREADY_DEFINED
+#undef yyleng
+#endif
+#ifndef xlu__cfg_yyin_ALREADY_DEFINED
+#undef yyin
+#endif
+#ifndef xlu__cfg_yyout_ALREADY_DEFINED
+#undef yyout
+#endif
+#ifndef xlu__cfg_yy_flex_debug_ALREADY_DEFINED
+#undef yy_flex_debug
+#endif
+#ifndef xlu__cfg_yylineno_ALREADY_DEFINED
+#undef yylineno
+#endif
+#ifndef xlu__cfg_yytables_fload_ALREADY_DEFINED
+#undef yytables_fload
+#endif
+#ifndef xlu__cfg_yytables_destroy_ALREADY_DEFINED
+#undef yytables_destroy
+#endif
+#ifndef xlu__cfg_yyTABLES_NAME_ALREADY_DEFINED
+#undef yyTABLES_NAME
+#endif
+
 #line 105 "libxlu_cfg_l.l"
 
-#line 348 "libxlu_cfg_l.h"
+#line 733 "libxlu_cfg_l.h"
 #undef xlu__cfg_yyIN_HEADER
 #endif /* xlu__cfg_yyHEADER_H */
diff --git a/tools/libxl/libxlu_cfg_y.c b/tools/libxl/libxlu_cfg_y.c
index 751daa3842..6d4638afc9 100644
--- a/tools/libxl/libxlu_cfg_y.c
+++ b/tools/libxl/libxlu_cfg_y.c
@@ -1,8 +1,9 @@
-/* A Bison parser, made by GNU Bison 3.0.4.  */
+/* A Bison parser, made by GNU Bison 3.3.2.  */
 
 /* Bison implementation for Yacc-like parsers in C
 
-   Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
+   Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation,
+   Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -40,11 +41,14 @@
    define necessary library symbols; they are noted "INFRINGES ON
    USER NAME SPACE" below.  */
 
+/* Undocumented macros, especially those whose name start with YY_,
+   are private implementation details.  Do not rely on them.  */
+
 /* Identify Bison output.  */
 #define YYBISON 1
 
 /* Bison version.  */
-#define YYBISON_VERSION "3.0.4"
+#define YYBISON_VERSION "3.3.2"
 
 /* Skeleton name.  */
 #define YYSKELETON_NAME "yacc.c"
@@ -67,20 +71,23 @@
 #define yynerrs         xlu__cfg_yynerrs
 
 
-/* Copy the first part of user declarations.  */
-#line 19 "libxlu_cfg_y.y" /* yacc.c:339  */
+/* First part of user prologue.  */
+#line 19 "libxlu_cfg_y.y" /* yacc.c:337  */
 
 #define ctx_scanner ctx->scanner
 #include "libxlu_cfg_i.h"
 #include "libxlu_cfg_l.h"
 
-#line 78 "libxlu_cfg_y.c" /* yacc.c:339  */
-
+#line 82 "libxlu_cfg_y.c" /* yacc.c:337  */
 # ifndef YY_NULLPTR
-#  if defined __cplusplus && 201103L <= __cplusplus
-#   define YY_NULLPTR nullptr
+#  if defined __cplusplus
+#   if 201103L <= __cplusplus
+#    define YY_NULLPTR nullptr
+#   else
+#    define YY_NULLPTR 0
+#   endif
 #  else
-#   define YY_NULLPTR 0
+#   define YY_NULLPTR ((void*)0)
 #  endif
 # endif
 
@@ -122,12 +129,12 @@ extern int xlu__cfg_yydebug;
 
 union YYSTYPE
 {
-#line 25 "libxlu_cfg_y.y" /* yacc.c:355  */
+#line 25 "libxlu_cfg_y.y" /* yacc.c:352  */
 
   char *string;
   XLU_ConfigValue *value;
 
-#line 131 "libxlu_cfg_y.c" /* yacc.c:355  */
+#line 138 "libxlu_cfg_y.c" /* yacc.c:352  */
 };
 
 typedef union YYSTYPE YYSTYPE;
@@ -155,9 +162,7 @@ int xlu__cfg_yyparse (CfgParseContext *ctx);
 
 #endif /* !YY_XLU_CFG_YY_LIBXLU_CFG_Y_H_INCLUDED  */
 
-/* Copy the second part of user declarations.  */
 
-#line 161 "libxlu_cfg_y.c" /* yacc.c:358  */
 
 #ifdef short
 # undef short
@@ -178,13 +183,13 @@ typedef signed char yytype_int8;
 #ifdef YYTYPE_UINT16
 typedef YYTYPE_UINT16 yytype_uint16;
 #else
-typedef unsigned short int yytype_uint16;
+typedef unsigned short yytype_uint16;
 #endif
 
 #ifdef YYTYPE_INT16
 typedef YYTYPE_INT16 yytype_int16;
 #else
-typedef short int yytype_int16;
+typedef short yytype_int16;
 #endif
 
 #ifndef YYSIZE_T
@@ -196,7 +201,7 @@ typedef short int yytype_int16;
 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
 #  define YYSIZE_T size_t
 # else
-#  define YYSIZE_T unsigned int
+#  define YYSIZE_T unsigned
 # endif
 #endif
 
@@ -232,15 +237,6 @@ typedef short int yytype_int16;
 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
 #endif
 
-#if !defined _Noreturn \
-     && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
-# if defined _MSC_VER && 1200 <= _MSC_VER
-#  define _Noreturn __declspec (noreturn)
-# else
-#  define _Noreturn YY_ATTRIBUTE ((__noreturn__))
-# endif
-#endif
-
 /* Suppress unused-variable warnings by "using" E.  */
 #if ! defined lint || defined __GNUC__
 # define YYUSE(E) ((void) (E))
@@ -248,7 +244,7 @@ typedef short int yytype_int16;
 # define YYUSE(E) /* empty */
 #endif
 
-#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
+#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
 /* Suppress an incorrect diagnostic about yylval being uninitialized.  */
 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
     _Pragma ("GCC diagnostic push") \
@@ -412,16 +408,16 @@ union yyalloc
 /* YYNSTATES -- Number of states.  */
 #define YYNSTATES  32
 
-/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
-   by yylex, with out-of-bounds checking.  */
 #define YYUNDEFTOK  2
 #define YYMAXUTOK   262
 
+/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
+   as returned by yylex, with out-of-bounds checking.  */
 #define YYTRANSLATE(YYX)                                                \
-  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
+  ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
 
 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
-   as returned by yylex, without out-of-bounds checking.  */
+   as returned by yylex.  */
 static const yytype_uint8 yytranslate[] =
 {
        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
@@ -586,22 +582,22 @@ static const yytype_uint8 yyr2[] =
 
 #define YYRECOVERING()  (!!yyerrstatus)
 
-#define YYBACKUP(Token, Value)                                  \
-do                                                              \
-  if (yychar == YYEMPTY)                                        \
-    {                                                           \
-      yychar = (Token);                                         \
-      yylval = (Value);                                         \
-      YYPOPSTACK (yylen);                                       \
-      yystate = *yyssp;                                         \
-      goto yybackup;                                            \
-    }                                                           \
-  else                                                          \
-    {                                                           \
-      yyerror (&yylloc, ctx, YY_("syntax error: cannot back up")); \
-      YYERROR;                                                  \
-    }                                                           \
-while (0)
+#define YYBACKUP(Token, Value)                                    \
+  do                                                              \
+    if (yychar == YYEMPTY)                                        \
+      {                                                           \
+        yychar = (Token);                                         \
+        yylval = (Value);                                         \
+        YYPOPSTACK (yylen);                                       \
+        yystate = *yyssp;                                         \
+        goto yybackup;                                            \
+      }                                                           \
+    else                                                          \
+      {                                                           \
+        yyerror (&yylloc, ctx, YY_("syntax error: cannot back up")); \
+        YYERROR;                                                  \
+      }                                                           \
+  while (0)
 
 /* Error token number */
 #define YYTERROR        1
@@ -660,10 +656,10 @@ do {                                            \
 /* Print *YYLOCP on YYO.  Private, do not rely on its existence. */
 
 YY_ATTRIBUTE_UNUSED
-static unsigned
+static int
 yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
 {
-  unsigned res = 0;
+  int res = 0;
   int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
   if (0 <= yylocp->first_line)
     {
@@ -706,41 +702,41 @@ do {                                                                      \
 } while (0)
 
 
-/*----------------------------------------.
-| Print this symbol's value on YYOUTPUT.  |
-`----------------------------------------*/
+/*-----------------------------------.
+| Print this symbol's value on YYO.  |
+`-----------------------------------*/
 
 static void
-yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, CfgParseContext *ctx)
+yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, CfgParseContext *ctx)
 {
-  FILE *yyo = yyoutput;
-  YYUSE (yyo);
+  FILE *yyoutput = yyo;
+  YYUSE (yyoutput);
   YYUSE (yylocationp);
   YYUSE (ctx);
   if (!yyvaluep)
     return;
 # ifdef YYPRINT
   if (yytype < YYNTOKENS)
-    YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
+    YYPRINT (yyo, yytoknum[yytype], *yyvaluep);
 # endif
   YYUSE (yytype);
 }
 
 
-/*--------------------------------.
-| Print this symbol on YYOUTPUT.  |
-`--------------------------------*/
+/*---------------------------.
+| Print this symbol on YYO.  |
+`---------------------------*/
 
 static void
-yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, CfgParseContext *ctx)
+yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, CfgParseContext *ctx)
 {
-  YYFPRINTF (yyoutput, "%s %s (",
+  YYFPRINTF (yyo, "%s %s (",
              yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
 
-  YY_LOCATION_PRINT (yyoutput, *yylocationp);
-  YYFPRINTF (yyoutput, ": ");
-  yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, ctx);
-  YYFPRINTF (yyoutput, ")");
+  YY_LOCATION_PRINT (yyo, *yylocationp);
+  YYFPRINTF (yyo, ": ");
+  yy_symbol_value_print (yyo, yytype, yyvaluep, yylocationp, ctx);
+  YYFPRINTF (yyo, ")");
 }
 
 /*------------------------------------------------------------------.
@@ -774,7 +770,7 @@ do {                                                            \
 static void
 yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, CfgParseContext *ctx)
 {
-  unsigned long int yylno = yyrline[yyrule];
+  unsigned long yylno = yyrline[yyrule];
   int yynrhs = yyr2[yyrule];
   int yyi;
   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
@@ -785,7 +781,7 @@ yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule
       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
       yy_symbol_print (stderr,
                        yystos[yyssp[yyi + 1 - yynrhs]],
-                       &(yyvsp[(yyi + 1) - (yynrhs)])
+                       &yyvsp[(yyi + 1) - (yynrhs)]
                        , &(yylsp[(yyi + 1) - (yynrhs)])                       , ctx);
       YYFPRINTF (stderr, "\n");
     }
@@ -889,7 +885,10 @@ yytnamerr (char *yyres, const char *yystr)
           case '\\':
             if (*++yyp != '\\')
               goto do_not_strip_quotes;
-            /* Fall through.  */
+            else
+              goto append;
+
+          append:
           default:
             if (yyres)
               yyres[yyn] = *yyp;
@@ -907,7 +906,7 @@ yytnamerr (char *yyres, const char *yystr)
   if (! yyres)
     return yystrlen (yystr);
 
-  return yystpcpy (yyres, yystr) - yyres;
+  return (YYSIZE_T) (yystpcpy (yyres, yystr) - yyres);
 }
 # endif
 
@@ -985,10 +984,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
                 yyarg[yycount++] = yytname[yyx];
                 {
                   YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
-                  if (! (yysize <= yysize1
-                         && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+                  if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
+                    yysize = yysize1;
+                  else
                     return 2;
-                  yysize = yysize1;
                 }
               }
         }
@@ -1000,6 +999,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
       case N:                               \
         yyformat = S;                       \
       break
+    default: /* Avoid compiler warnings. */
       YYCASE_(0, YY_("syntax error"));
       YYCASE_(1, YY_("syntax error, unexpected %s"));
       YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
@@ -1011,9 +1011,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
 
   {
     YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
-    if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+    if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
+      yysize = yysize1;
+    else
       return 2;
-    yysize = yysize1;
   }
 
   if (*yymsg_alloc < yysize)
@@ -1064,49 +1065,48 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocatio
   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
   switch (yytype)
     {
-          case 3: /* IDENT  */
+    case 3: /* IDENT  */
 #line 40 "libxlu_cfg_y.y" /* yacc.c:1257  */
       { free(((*yyvaluep).string)); }
-#line 1071 "libxlu_cfg_y.c" /* yacc.c:1257  */
+#line 1072 "libxlu_cfg_y.c" /* yacc.c:1257  */
         break;
 
     case 4: /* STRING  */
 #line 40 "libxlu_cfg_y.y" /* yacc.c:1257  */
       { free(((*yyvaluep).string)); }
-#line 1077 "libxlu_cfg_y.c" /* yacc.c:1257  */
+#line 1078 "libxlu_cfg_y.c" /* yacc.c:1257  */
         break;
 
     case 5: /* NUMBER  */
 #line 40 "libxlu_cfg_y.y" /* yacc.c:1257  */
       { free(((*yyvaluep).string)); }
-#line 1083 "libxlu_cfg_y.c" /* yacc.c:1257  */
+#line 1084 "libxlu_cfg_y.c" /* yacc.c:1257  */
         break;
 
     case 19: /* value  */
 #line 44 "libxlu_cfg_y.y" /* yacc.c:1257  */
       { xlu__cfg_value_free(((*yyvaluep).value)); }
-#line 1089 "libxlu_cfg_y.c" /* yacc.c:1257  */
+#line 1090 "libxlu_cfg_y.c" /* yacc.c:1257  */
         break;
 
     case 20: /* atom  */
 #line 40 "libxlu_cfg_y.y" /* yacc.c:1257  */
       { free(((*yyvaluep).string)); }
-#line 1095 "libxlu_cfg_y.c" /* yacc.c:1257  */
+#line 1096 "libxlu_cfg_y.c" /* yacc.c:1257  */
         break;
 
     case 21: /* valuelist  */
 #line 44 "libxlu_cfg_y.y" /* yacc.c:1257  */
       { xlu__cfg_value_free(((*yyvaluep).value)); }
-#line 1101 "libxlu_cfg_y.c" /* yacc.c:1257  */
+#line 1102 "libxlu_cfg_y.c" /* yacc.c:1257  */
         break;
 
     case 22: /* values  */
 #line 44 "libxlu_cfg_y.y" /* yacc.c:1257  */
       { xlu__cfg_value_free(((*yyvaluep).value)); }
-#line 1107 "libxlu_cfg_y.c" /* yacc.c:1257  */
+#line 1108 "libxlu_cfg_y.c" /* yacc.c:1257  */
         break;
 
-
       default:
         break;
     }
@@ -1212,23 +1212,31 @@ YYLTYPE yylloc = yyloc_default;
   yylsp[0] = yylloc;
   goto yysetstate;
 
+
 /*------------------------------------------------------------.
-| yynewstate -- Push a new state, which is found in yystate.  |
+| yynewstate -- push a new state, which is found in yystate.  |
 `------------------------------------------------------------*/
- yynewstate:
+yynewstate:
   /* In all cases, when you get here, the value and location stacks
      have just been pushed.  So pushing a state here evens the stacks.  */
   yyssp++;
 
- yysetstate:
-  *yyssp = yystate;
+
+/*--------------------------------------------------------------------.
+| yynewstate -- set current state (the top of the stack) to yystate.  |
+`--------------------------------------------------------------------*/
+yysetstate:
+  *yyssp = (yytype_int16) yystate;
 
   if (yyss + yystacksize - 1 <= yyssp)
+#if !defined yyoverflow && !defined YYSTACK_RELOCATE
+    goto yyexhaustedlab;
+#else
     {
       /* Get the current used size of the three stacks, in elements.  */
-      YYSIZE_T yysize = yyssp - yyss + 1;
+      YYSIZE_T yysize = (YYSIZE_T) (yyssp - yyss + 1);
 
-#ifdef yyoverflow
+# if defined yyoverflow
       {
         /* Give user a chance to reallocate the stack.  Use copies of
            these so that the &'s don't force the real ones into
@@ -1246,15 +1254,11 @@ YYLTYPE yylloc = yyloc_default;
                     &yyvs1, yysize * sizeof (*yyvsp),
                     &yyls1, yysize * sizeof (*yylsp),
                     &yystacksize);
-
-        yyls = yyls1;
         yyss = yyss1;
         yyvs = yyvs1;
+        yyls = yyls1;
       }
-#else /* no yyoverflow */
-# ifndef YYSTACK_RELOCATE
-      goto yyexhaustedlab;
-# else
+# else /* defined YYSTACK_RELOCATE */
       /* Extend the stack our own way.  */
       if (YYMAXDEPTH <= yystacksize)
         goto yyexhaustedlab;
@@ -1271,23 +1275,23 @@ YYLTYPE yylloc = yyloc_default;
         YYSTACK_RELOCATE (yyss_alloc, yyss);
         YYSTACK_RELOCATE (yyvs_alloc, yyvs);
         YYSTACK_RELOCATE (yyls_alloc, yyls);
-#  undef YYSTACK_RELOCATE
+# undef YYSTACK_RELOCATE
         if (yyss1 != yyssa)
           YYSTACK_FREE (yyss1);
       }
 # endif
-#endif /* no yyoverflow */
 
       yyssp = yyss + yysize - 1;
       yyvsp = yyvs + yysize - 1;
       yylsp = yyls + yysize - 1;
 
       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
-                  (unsigned long int) yystacksize));
+                  (unsigned long) yystacksize));
 
       if (yyss + yystacksize - 1 <= yyssp)
         YYABORT;
     }
+#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
 
   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
 
@@ -1296,11 +1300,11 @@ YYLTYPE yylloc = yyloc_default;
 
   goto yybackup;
 
+
 /*-----------.
 | yybackup.  |
 `-----------*/
 yybackup:
-
   /* Do appropriate processing given the current state.  Read a
      lookahead token if we need one and don't already have one.  */
 
@@ -1373,7 +1377,7 @@ yydefault:
 
 
 /*-----------------------------.
-| yyreduce -- Do a reduction.  |
+| yyreduce -- do a reduction.  |
 `-----------------------------*/
 yyreduce:
   /* yyn is the number of a rule to reduce with.  */
@@ -1389,79 +1393,80 @@ yyreduce:
      GCC warning that YYVAL may be used uninitialized.  */
   yyval = yyvsp[1-yylen];
 
-  /* Default location.  */
+  /* Default location. */
   YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
+  yyerror_range[1] = yyloc;
   YY_REDUCE_PRINT (yyn);
   switch (yyn)
     {
         case 9:
-#line 58 "libxlu_cfg_y.y" /* yacc.c:1646  */
+#line 58 "libxlu_cfg_y.y" /* yacc.c:1652  */
     { xlu__cfg_set_store(ctx,(yyvsp[-2].string),XLU_OP_ASSIGNMENT,(yyvsp[0].value),(yylsp[0]).first_line); }
-#line 1401 "libxlu_cfg_y.c" /* yacc.c:1646  */
+#line 1406 "libxlu_cfg_y.c" /* yacc.c:1652  */
     break;
 
   case 10:
-#line 59 "libxlu_cfg_y.y" /* yacc.c:1646  */
+#line 59 "libxlu_cfg_y.y" /* yacc.c:1652  */
     { xlu__cfg_set_store(ctx,(yyvsp[-2].string),XLU_OP_ADDITION,(yyvsp[0].value),(yylsp[0]).first_line); }
-#line 1407 "libxlu_cfg_y.c" /* yacc.c:1646  */
+#line 1412 "libxlu_cfg_y.c" /* yacc.c:1652  */
     break;
 
   case 13:
-#line 64 "libxlu_cfg_y.y" /* yacc.c:1646  */
+#line 64 "libxlu_cfg_y.y" /* yacc.c:1652  */
     { (yyval.value)= xlu__cfg_string_mk(ctx,(yyvsp[0].string),&(yylsp[0])); }
-#line 1413 "libxlu_cfg_y.c" /* yacc.c:1646  */
+#line 1418 "libxlu_cfg_y.c" /* yacc.c:1652  */
     break;
 
   case 14:
-#line 65 "libxlu_cfg_y.y" /* yacc.c:1646  */
+#line 65 "libxlu_cfg_y.y" /* yacc.c:1652  */
     { (yyval.value)= (yyvsp[-1].value); }
-#line 1419 "libxlu_cfg_y.c" /* yacc.c:1646  */
+#line 1424 "libxlu_cfg_y.c" /* yacc.c:1652  */
     break;
 
   case 15:
-#line 67 "libxlu_cfg_y.y" /* yacc.c:1646  */
+#line 67 "libxlu_cfg_y.y" /* yacc.c:1652  */
     { (yyval.string)= (yyvsp[0].string); }
-#line 1425 "libxlu_cfg_y.c" /* yacc.c:1646  */
+#line 1430 "libxlu_cfg_y.c" /* yacc.c:1652  */
     break;
 
   case 16:
-#line 68 "libxlu_cfg_y.y" /* yacc.c:1646  */
+#line 68 "libxlu_cfg_y.y" /* yacc.c:1652  */
     { (yyval.string)= (yyvsp[0].string); }
-#line 1431 "libxlu_cfg_y.c" /* yacc.c:1646  */
+#line 1436 "libxlu_cfg_y.c" /* yacc.c:1652  */
     break;
 
   case 17:
-#line 70 "libxlu_cfg_y.y" /* yacc.c:1646  */
+#line 70 "libxlu_cfg_y.y" /* yacc.c:1652  */
     { (yyval.value)= xlu__cfg_list_mk(ctx,NULL,&yylloc); }
-#line 1437 "libxlu_cfg_y.c" /* yacc.c:1646  */
+#line 1442 "libxlu_cfg_y.c" /* yacc.c:1652  */
     break;
 
   case 18:
-#line 71 "libxlu_cfg_y.y" /* yacc.c:1646  */
+#line 71 "libxlu_cfg_y.y" /* yacc.c:1652  */
     { (yyval.value)= (yyvsp[0].value); }
-#line 1443 "libxlu_cfg_y.c" /* yacc.c:1646  */
+#line 1448 "libxlu_cfg_y.c" /* yacc.c:1652  */
     break;
 
   case 19:
-#line 72 "libxlu_cfg_y.y" /* yacc.c:1646  */
+#line 72 "libxlu_cfg_y.y" /* yacc.c:1652  */
     { (yyval.value)= (yyvsp[-2].value); }
-#line 1449 "libxlu_cfg_y.c" /* yacc.c:1646  */
+#line 1454 "libxlu_cfg_y.c" /* yacc.c:1652  */
     break;
 
   case 20:
-#line 74 "libxlu_cfg_y.y" /* yacc.c:1646  */
+#line 74 "libxlu_cfg_y.y" /* yacc.c:1652  */
     { (yyval.value)= xlu__cfg_list_mk(ctx,(yyvsp[-1].value),&(yylsp[-1])); }
-#line 1455 "libxlu_cfg_y.c" /* yacc.c:1646  */
+#line 1460 "libxlu_cfg_y.c" /* yacc.c:1652  */
     break;
 
   case 21:
-#line 75 "libxlu_cfg_y.y" /* yacc.c:1646  */
+#line 75 "libxlu_cfg_y.y" /* yacc.c:1652  */
     { xlu__cfg_list_append(ctx,(yyvsp[-4].value),(yyvsp[-1].value)); (yyval.value)= (yyvsp[-4].value); }
-#line 1461 "libxlu_cfg_y.c" /* yacc.c:1646  */
+#line 1466 "libxlu_cfg_y.c" /* yacc.c:1652  */
     break;
 
 
-#line 1465 "libxlu_cfg_y.c" /* yacc.c:1646  */
+#line 1470 "libxlu_cfg_y.c" /* yacc.c:1652  */
       default: break;
     }
   /* User semantic actions sometimes alter yychar, and that requires
@@ -1487,14 +1492,13 @@ yyreduce:
   /* Now 'shift' the result of the reduction.  Determine what state
      that goes to, based on the state we popped back to and the rule
      number reduced by.  */
-
-  yyn = yyr1[yyn];
-
-  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
-  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
-    yystate = yytable[yystate];
-  else
-    yystate = yydefgoto[yyn - YYNTOKENS];
+  {
+    const int yylhs = yyr1[yyn] - YYNTOKENS;
+    const int yyi = yypgoto[yylhs] + *yyssp;
+    yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
+               ? yytable[yyi]
+               : yydefgoto[yylhs]);
+  }
 
   goto yynewstate;
 
@@ -1577,14 +1581,11 @@ yyerrlab:
 | yyerrorlab -- error raised explicitly by YYERROR.  |
 `---------------------------------------------------*/
 yyerrorlab:
+  /* Pacify compilers when the user code never invokes YYERROR and the
+     label yyerrorlab therefore never appears in user code.  */
+  if (0)
+    YYERROR;
 
-  /* Pacify compilers like GCC when the user code never invokes
-     YYERROR and the label yyerrorlab therefore never appears in user
-     code.  */
-  if (/*CONSTCOND*/ 0)
-     goto yyerrorlab;
-
-  yyerror_range[1] = yylsp[1-yylen];
   /* Do not reclaim the symbols of the rule whose action triggered
      this YYERROR.  */
   YYPOPSTACK (yylen);
@@ -1650,6 +1651,7 @@ yyacceptlab:
   yyresult = 0;
   goto yyreturn;
 
+
 /*-----------------------------------.
 | yyabortlab -- YYABORT comes here.  |
 `-----------------------------------*/
@@ -1657,6 +1659,7 @@ yyabortlab:
   yyresult = 1;
   goto yyreturn;
 
+
 #if !defined yyoverflow || YYERROR_VERBOSE
 /*-------------------------------------------------.
 | yyexhaustedlab -- memory exhaustion comes here.  |
@@ -1667,6 +1670,10 @@ yyexhaustedlab:
   /* Fall through.  */
 #endif
 
+
+/*-----------------------------------------------------.
+| yyreturn -- parsing is finished, return the result.  |
+`-----------------------------------------------------*/
 yyreturn:
   if (yychar != YYEMPTY)
     {
diff --git a/tools/libxl/libxlu_cfg_y.h b/tools/libxl/libxlu_cfg_y.h
index 9691bf1350..1233cb94fc 100644
--- a/tools/libxl/libxlu_cfg_y.h
+++ b/tools/libxl/libxlu_cfg_y.h
@@ -1,8 +1,9 @@
-/* A Bison parser, made by GNU Bison 3.0.4.  */
+/* A Bison parser, made by GNU Bison 3.3.2.  */
 
 /* Bison interface for Yacc-like parsers in C
 
-   Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
+   Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation,
+   Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -30,6 +31,9 @@
    This special exception was added by the Free Software Foundation in
    version 2.2 of Bison.  */
 
+/* Undocumented macros, especially those whose name start with YY_,
+   are private implementation details.  Do not rely on them.  */
+
 #ifndef YY_XLU_CFG_YY_LIBXLU_CFG_Y_H_INCLUDED
 # define YY_XLU_CFG_YY_LIBXLU_CFG_Y_H_INCLUDED
 /* Debug traces.  */
@@ -58,12 +62,12 @@ extern int xlu__cfg_yydebug;
 
 union YYSTYPE
 {
-#line 25 "libxlu_cfg_y.y" /* yacc.c:1909  */
+#line 25 "libxlu_cfg_y.y" /* yacc.c:1921  */
 
   char *string;
   XLU_ConfigValue *value;
 
-#line 67 "libxlu_cfg_y.h" /* yacc.c:1909  */
+#line 71 "libxlu_cfg_y.h" /* yacc.c:1921  */
 };
 
 typedef union YYSTYPE YYSTYPE;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 14:55:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 14: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 1jo6ns-0004z6-LV; Wed, 24 Jun 2020 14:55: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo6nr-0004z1-Ez
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:55:07 +0000
X-Inumbo-ID: b0b5f91e-b62a-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id b0b5f91e-b62a-11ea-b7bb-bc764e2007e4;
 Wed, 24 Jun 2020 14: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=BOGVZngJB6YdSKa+1M+RWpF09fa5JGghfX5mIPlSOUY=; b=KpgTeZZeszqWgVCFacuXt4Iet0
 lr0utbqJsIvApIRGURova9M1N6Yb27FWq7HlK1PfAROpJdwz9i3XWy4lEWKqqtMwSKPU4Bwc2YvRW
 bpy28AjghSF3YYbcvHLbcJkwiFxxm8UwTCP0kRt73a1qxFuWZDtpOKlyYfgJ/SoF938M=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6np-0003cC-LF
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:55:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6np-0005lP-Jp
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:55:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] update Xen version to 4.13.2-pre
Message-Id: <E1jo6np-0005lP-Jp@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 14: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 333519f5a82d58568d094962ccb27a4c4e06e648
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jun 24 16:19:23 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:19:23 2020 +0200

    update Xen version to 4.13.2-pre
---
 xen/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/Makefile b/xen/Makefile
index 6b89ff1162..5db0a25b3e 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -2,7 +2,7 @@
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 13
-export XEN_EXTRAVERSION ?= .1$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .2-pre$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 14:55:17 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 14:55:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jo6o1-0004zT-N0; Wed, 24 Jun 2020 14:55: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo6o1-0004zO-HX
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:55:17 +0000
X-Inumbo-ID: b6b921f6-b62a-11ea-80e8-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id b6b921f6-b62a-11ea-80e8-12813bfff9fa;
 Wed, 24 Jun 2020 14:55:16 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=ABXoHovOhNxUCshOSK7TDDKIr0b2XCNMhErj6UpA+rk=; b=1J6Lcm6Y6rwAToJqOxOgMLyrpt
 zow5e+8OxY4OJl0FqaVfkD6Kotz9cjbQEUDfAw4WPE+4WCODOiU7KMLZUHxlKOK1Iu/E5i1M121Qd
 yHhAigQjbtpJwHjhAUKnmTGY4Vm5oex2p2rV27k52uD33asCxVeBhK4gcEyCwWP78LfQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6nz-0003cN-Oo
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:55:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6nz-0005m0-Nf
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:55:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] x86/cpuidle: correct Cannon Lake residency MSRs
Message-Id: <E1jo6nz-0005m0-Nf@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 14: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 d112db32c62238df5e5fe342c5079d47cb6465d1
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jun 24 16:21:00 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:21:00 2020 +0200

    x86/cpuidle: correct Cannon Lake residency MSRs
    
    As per SDM rev 071 Cannon Lake has
    - no CC3 residency MSR at 3FC,
    - a CC1 residency MSR ar 660 (like various Atoms),
    - a useless (always zero) CC3 residency MSR at 662.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 9ff09aefc46385dc04c38b6dd1f1ac25f784f482
    master date: 2020-04-03 17:15:58 +0200
---
 xen/arch/x86/acpi/cpu_idle.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c
index 836f524ef4..d24f44167b 100644
--- a/xen/arch/x86/acpi/cpu_idle.c
+++ b/xen/arch/x86/acpi/cpu_idle.c
@@ -68,7 +68,7 @@
 #define GET_PC8_RES(val)  GET_HW_RES_IN_NS(0x630, val) /* some Haswells only */
 #define GET_PC9_RES(val)  GET_HW_RES_IN_NS(0x631, val) /* some Haswells only */
 #define GET_PC10_RES(val) GET_HW_RES_IN_NS(0x632, val) /* some Haswells only */
-#define GET_CC1_RES(val)  GET_HW_RES_IN_NS(0x660, val) /* Silvermont only */
+#define GET_CC1_RES(val)  GET_HW_RES_IN_NS(0x660, val)
 #define GET_CC3_RES(val)  GET_HW_RES_IN_NS(0x3FC, val)
 #define GET_CC6_RES(val)  GET_HW_RES_IN_NS(0x3FD, val)
 #define GET_CC7_RES(val)  GET_HW_RES_IN_NS(0x3FE, val) /* SNB onwards */
@@ -179,8 +179,6 @@ static void do_get_hw_residencies(void *arg)
     case 0x4E:
     case 0x55:
     case 0x5E:
-    /* Cannon Lake */
-    case 0x66:
     /* Kaby Lake */
     case 0x8E:
     case 0x9E:
@@ -202,6 +200,16 @@ static void do_get_hw_residencies(void *arg)
         GET_CC3_RES(hw_res->cc3);
         GET_CC6_RES(hw_res->cc6);
         break;
+    /* Cannon Lake */
+    case 0x66:
+        GET_PC2_RES(hw_res->pc2);
+        GET_PC3_RES(hw_res->pc3);
+        GET_PC6_RES(hw_res->pc6);
+        GET_PC7_RES(hw_res->pc7);
+        GET_CC1_RES(hw_res->cc1);
+        GET_CC6_RES(hw_res->cc6);
+        GET_CC7_RES(hw_res->cc7);
+        break;
     /* Xeon Phi Knights Landing */
     case 0x57:
     /* Xeon Phi Knights Mill */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 14:55:27 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 14:55:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jo6oB-000510-Ol; Wed, 24 Jun 2020 14:55: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo6oA-00050p-Qn
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:55:26 +0000
X-Inumbo-ID: bcbbcb1c-b62a-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id bcbbcb1c-b62a-11ea-bca7-bc764e2007e4;
 Wed, 24 Jun 2020 14:55:26 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=4ELQOlDA+oUWOspnJH7YkBQPcr+5zBtofwvCQjl6VKI=; b=CODK3th4OuOyT7Koxwst4K5z8E
 u80a+8+eThZYWT2Mp1uGUMrdiYAgMts/NiRLITAM9T3epa/iGj/Z68DqsviHWQSBmYfMVqnKWCSiK
 /a2Q+d3RxfDUew+QQ8CZL6rKKPcdUFoC6BsfP5DjncBt2UOcjDWF7eXBOJWPzLbDn12I=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6o9-0003ca-S9
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:55:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6o9-0005mY-R8
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:55:25 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] cpupool: fix removing cpu from a cpupool
Message-Id: <E1jo6o9-0005mY-R8@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 14: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 9eec3eecadec0a74b8b2a7d5a2a154414856822d
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Jun 24 16:21:50 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:21:50 2020 +0200

    cpupool: fix removing cpu from a cpupool
    
    Commit cb563d7665f2 ("xen/sched: support core scheduling for moving
    cpus to/from cpupools") introduced a regression when trying to remove
    an offline cpu from a cpupool, as the system would crash in this
    situation.
    
    Fix that by testing the cpu to be online.
    
    Fixes: cb563d7665f2 ("xen/sched: support core scheduling for moving cpus to/from cpupools")
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Dario Faggioli <dfaggioli@suse.com>
    master commit: 498d73647fa17d9eb7a67d2e9bdccac6b438e559
    master date: 2020-05-08 10:44:22 +0200
---
 xen/common/cpupool.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xen/common/cpupool.c b/xen/common/cpupool.c
index b90bf42703..85f22c5f53 100644
--- a/xen/common/cpupool.c
+++ b/xen/common/cpupool.c
@@ -519,6 +519,9 @@ static int cpupool_unassign_cpu(struct cpupool *c, unsigned int cpu)
     debugtrace_printk("cpupool_unassign_cpu(pool=%d,cpu=%d)\n",
                       c->cpupool_id, cpu);
 
+    if ( !cpu_online(cpu) )
+        return -EINVAL;
+
     master_cpu = sched_get_resource_cpu(cpu);
     ret = cpupool_unassign_cpu_start(c, master_cpu);
     if ( ret )
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 14:55:37 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 14: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 1jo6oL-00052S-QH; Wed, 24 Jun 2020 14:55: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo6oK-00052G-LW
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:55:36 +0000
X-Inumbo-ID: c2c54f38-b62a-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id c2c54f38-b62a-11ea-bca7-bc764e2007e4;
 Wed, 24 Jun 2020 14:55: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=bhtyTxHwwYT7ZTUgrYA0Bpa4kGyEjw0jwJkSpsvNrnI=; b=bWBWWxblK+xpMYwU9kAO6itsOL
 dKCnZrG2wYDCUdGYJN3UqlpgyUng96JkmCCrJvmn91jsquPttiVEkYd9nfF4GyCbPcylM6U1Md1X/
 KdjcxM0oTgrw6BibqMgO1b0rpWSUqplcJqxoS9uV7ZLpK+gshF3profDPa9t6gMFWboI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6oJ-0003ch-Vg
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:55:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6oJ-0005nH-Uh
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:55:35 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] sched: always modify vcpu pause flags atomically
Message-Id: <E1jo6oJ-0005nH-Uh@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 14: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 d74eb10956fe7f0c2d73fbc7b65f5be0e3e9471f
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Jun 24 16:22:28 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:22:28 2020 +0200

    sched: always modify vcpu pause flags atomically
    
    credit2 is currently modifying the pause flags of vcpus non-atomically
    via sched_set_pause_flags() and sched_clear_pause_flags(). This is
    dangerous as there are cases where the paus flags are modified without
    any lock held.
    
    So drop the non-atomic pause flag modification functions and rename the
    atomic ones dropping the _atomic suffix.
    
    Fixes: a76255b4266516 ("xen/sched: make credit2 scheduler vcpu agnostic.")
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Dario Faggioli <dfaggioli@suse.com>
    master commit: e0d92d9bd7997c6bcda17a19aba4f3957dd1a2e9
    master date: 2020-05-08 10:47:38 +0200
---
 xen/common/sched_credit.c  |  4 ++--
 xen/include/xen/sched-if.h | 22 +---------------------
 2 files changed, 3 insertions(+), 23 deletions(-)

diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c
index aa41a3301b..e60b96da87 100644
--- a/xen/common/sched_credit.c
+++ b/xen/common/sched_credit.c
@@ -452,7 +452,7 @@ static inline void __runq_tickle(struct csched_unit *new)
                     SCHED_UNIT_STAT_CRANK(cur, kicked_away);
                     SCHED_UNIT_STAT_CRANK(cur, migrate_r);
                     SCHED_STAT_CRANK(migrate_kicked_away);
-                    sched_set_pause_flags_atomic(cur->unit, _VPF_migrating);
+                    sched_set_pause_flags(cur->unit, _VPF_migrating);
                 }
                 /* Tickle cpu anyway, to let new preempt cur. */
                 SCHED_STAT_CRANK(tickled_busy_cpu);
@@ -983,7 +983,7 @@ csched_unit_acct(struct csched_private *prv, unsigned int cpu)
         {
             SCHED_UNIT_STAT_CRANK(svc, migrate_r);
             SCHED_STAT_CRANK(migrate_running);
-            sched_set_pause_flags_atomic(currunit, _VPF_migrating);
+            sched_set_pause_flags(currunit, _VPF_migrating);
             /*
              * As we are about to tickle cpu, we should clear its bit in
              * idlers. But, if we are here, it means there is someone running
diff --git a/xen/include/xen/sched-if.h b/xen/include/xen/sched-if.h
index b0ac54e63d..b366f1774f 100644
--- a/xen/include/xen/sched-if.h
+++ b/xen/include/xen/sched-if.h
@@ -175,7 +175,7 @@ static inline void sched_set_pause_flags(struct sched_unit *unit,
     struct vcpu *v;
 
     for_each_sched_unit_vcpu ( unit, v )
-        __set_bit(bit, &v->pause_flags);
+        set_bit(bit, &v->pause_flags);
 }
 
 /* Clear a bit in pause_flags of all vcpus of a unit. */
@@ -184,26 +184,6 @@ static inline void sched_clear_pause_flags(struct sched_unit *unit,
 {
     struct vcpu *v;
 
-    for_each_sched_unit_vcpu ( unit, v )
-        __clear_bit(bit, &v->pause_flags);
-}
-
-/* Set a bit in pause_flags of all vcpus of a unit via atomic updates. */
-static inline void sched_set_pause_flags_atomic(struct sched_unit *unit,
-                                                unsigned int bit)
-{
-    struct vcpu *v;
-
-    for_each_sched_unit_vcpu ( unit, v )
-        set_bit(bit, &v->pause_flags);
-}
-
-/* Clear a bit in pause_flags of all vcpus of a unit via atomic updates. */
-static inline void sched_clear_pause_flags_atomic(struct sched_unit *unit,
-                                                  unsigned int bit)
-{
-    struct vcpu *v;
-
     for_each_sched_unit_vcpu ( unit, v )
         clear_bit(bit, &v->pause_flags);
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 14:55:47 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 14: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 1jo6oV-00053T-Rs; Wed, 24 Jun 2020 14:55: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo6oU-00053J-Mi
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:55:46 +0000
X-Inumbo-ID: c8ca0090-b62a-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id c8ca0090-b62a-11ea-8496-bc764e2007e4;
 Wed, 24 Jun 2020 14:55: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=fzxsBy/MwmgEgTaujvSZFGMZC7yiQ3UjqiCynjvIUUo=; b=1yygLlAqgZNKwlguwqFrCXdAXb
 VbM8YaLMkdnpC+y01NcynN/FA4IKldYtAGqD8hQm1xmZtiExY3ukgYYl753XqfOkizscV1ayt5y4Z
 fp6jYGiTetxG6tANwoiCTEj9xZcTcDWNYvaYDF9UjfFsGugcxLzRtUYysOrUT5FLDBm8=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6oU-0003dg-2g
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:55:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6oU-0005nl-1h
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:55:46 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] x86/guest: Fix assembler warnings with newer
 binutils
Message-Id: <E1jo6oU-0005nl-1h@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 14:55: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 7d57caa9a26ed0ae46391e0d94cfca397e5bc8ba
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 24 16:23:20 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:23:20 2020 +0200

    x86/guest: Fix assembler warnings with newer binutils
    
    GAS of at least version 2.34 complains:
    
      hypercall_page.S: Assembler messages:
      hypercall_page.S:24: Warning: symbol 'HYPERCALL_set_trap_table' already has its type set
      ...
      hypercall_page.S:71: Warning: symbol 'HYPERCALL_arch_7' already has its type set
    
    which is because the whole page is declared as STT_OBJECT already.  Rearrange
    .set with respect to .type in DECLARE_HYPERCALL() so STT_FUNC is already in
    place.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/guest/hypercall_page.S | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/guest/hypercall_page.S b/xen/arch/x86/guest/hypercall_page.S
index 6485e9150e..9958d02cfd 100644
--- a/xen/arch/x86/guest/hypercall_page.S
+++ b/xen/arch/x86/guest/hypercall_page.S
@@ -17,9 +17,9 @@ GLOBAL(hypercall_page)
  */
 #define DECLARE_HYPERCALL(name)                                                 \
         .globl HYPERCALL_ ## name;                                              \
-        .set   HYPERCALL_ ## name, hypercall_page + __HYPERVISOR_ ## name * 32; \
         .type  HYPERCALL_ ## name, STT_FUNC;                                    \
-        .size  HYPERCALL_ ## name, 32
+        .size  HYPERCALL_ ## name, 32;                                          \
+        .set   HYPERCALL_ ## name, hypercall_page + __HYPERVISOR_ ## name * 32
 
 DECLARE_HYPERCALL(set_trap_table)
 DECLARE_HYPERCALL(mmu_update)
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 14:55:58 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 14:55:58 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jo6og-00054Y-Ts; Wed, 24 Jun 2020 14:55: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo6of-00054O-L4
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:55:57 +0000
X-Inumbo-ID: cec97e76-b62a-11ea-80e8-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id cec97e76-b62a-11ea-80e8-12813bfff9fa;
 Wed, 24 Jun 2020 14:55: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=0cwtl7qMaxoEiI0XYIwgt1gjqilbI92+8giWKcayT+4=; b=C114sWmkmtkfh/qDjkDUyywTkW
 Pm/5hasFPGh5rxZ4LYRkWX59NzSeGK89aZuLb10zGKRlctE6IUZD8swNrlCfA+SvLFHifHYC3k7YL
 vwfV03nTjh3wCHf8avwAApNXc5wM/S+LY6BlVGOi0jIdwxkuSu8N4Hjc7r5F7o8+81oY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6oe-0003dr-5l
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:55:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6oe-0005oL-4r
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:55:56 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] x86/build32: Discard all orphaned sections
Message-Id: <E1jo6oe-0005oL-4r@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 14:55: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 bdddd33ff290230ca065a0813576b9c051b51d0d
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 24 16:23:53 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:23:53 2020 +0200

    x86/build32: Discard all orphaned sections
    
    Linkers may put orphaned sections ahead of .text, which breaks the calling
    requirements.  A concrete example is Ubuntu's GCC-9 default of enabling
    -fcf-protection which causes us to try and execute .note.gnu.properties during
    Xen's boot.
    
    Put .got.plt in its own section as it specifically needs preserving from the
    linkers point of view, and discard everything else.  This will hopefully be
    more robust to other unexpected toolchain properties.
    
    Fixes boot from an Ubuntu build of Xen.
    
    Reported-by: Jason Andryuk <jandryuk@gmail.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Tested-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/boot/build32.lds | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/boot/build32.lds b/xen/arch/x86/boot/build32.lds
index da35aee910..97454b40ff 100644
--- a/xen/arch/x86/boot/build32.lds
+++ b/xen/arch/x86/boot/build32.lds
@@ -31,7 +31,7 @@ SECTIONS
         *(.bss.*)
   }
 
-  /DISCARD/ : {
+  .got.plt : {
         /*
          * PIC/PIE executable contains .got.plt section even if it is not linked
          * with dynamic libraries. In such case it is just placeholder for
@@ -47,6 +47,14 @@ SECTIONS
          *
          * Please check build32.mk for more details.
          */
-        /* *(.got.plt) */
+        *(.got.plt)
+  }
+
+  /DISCARD/ : {
+        /*
+         * Discard everything else, to prevent linkers from putting
+         * orphaned sections ahead of .text, which needs to be first.
+         */
+        *(*)
   }
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 14:56:07 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 14: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 1jo6op-00055V-VN; Wed, 24 Jun 2020 14: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo6oo-00055K-Uc
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:56:06 +0000
X-Inumbo-ID: d4cdeca8-b62a-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id d4cdeca8-b62a-11ea-b7bb-bc764e2007e4;
 Wed, 24 Jun 2020 14: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=3XLnSaQOs+6eqefNSWOvHzm4SqhNIGcAclhXGnKvk8E=; b=mLe3dQFk4EWbo7n/e/tJtWCuii
 XW/2jAcRJNxgphHIoQNqD+DpwJpVvZC472c+/8GwLY0wTissQEHWYL2WX4ApOYdHpQLcDY3tB2wWC
 roS0FIr3bG1OuMA+6vBKSKh6BhmXbR/+869+Gdew9Up//VMMtldcO5tsKDfgh6G3wCHs=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6oo-0003ed-8y
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:56:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6oo-0005pA-7x
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:56:06 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] x86/build: move -fno-asynchronous-unwind-tables
 into EMBEDDED_EXTRA_CFLAGS
Message-Id: <E1jo6oo-0005pA-7x@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 14:56: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 6bfb364c3c13c26c47c04f02fd23847a202cc226
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 24 16:24:23 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:24:23 2020 +0200

    x86/build: move -fno-asynchronous-unwind-tables into EMBEDDED_EXTRA_CFLAGS
    
    Users of EMBEDDED_EXTRA_CFLAGS already use -fno-asynchronous-unwind-tables, or
    ought to.  This shrinks the size of the rombios 32bit stubs in guest memory.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 Config.mk                            | 2 +-
 tools/tests/x86_emulator/testcase.mk | 2 +-
 xen/arch/x86/Rules.mk                | 2 +-
 xen/arch/x86/boot/build32.mk         | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Config.mk b/Config.mk
index c70957d730..85bde01f77 100644
--- a/Config.mk
+++ b/Config.mk
@@ -235,7 +235,7 @@ APPEND_LDFLAGS += $(foreach i, $(APPEND_LIB), -L$(i))
 APPEND_CFLAGS += $(foreach i, $(APPEND_INCLUDES), -I$(i))
 
 EMBEDDED_EXTRA_CFLAGS := -nopie -fno-stack-protector -fno-stack-protector-all
-EMBEDDED_EXTRA_CFLAGS += -fno-exceptions
+EMBEDDED_EXTRA_CFLAGS += -fno-exceptions -fno-asynchronous-unwind-tables
 
 XEN_EXTFILES_URL ?= http://xenbits.xen.org/xen-extfiles
 # All the files at that location were downloaded from elsewhere on
diff --git a/tools/tests/x86_emulator/testcase.mk b/tools/tests/x86_emulator/testcase.mk
index a565d15524..dafeb6caf7 100644
--- a/tools/tests/x86_emulator/testcase.mk
+++ b/tools/tests/x86_emulator/testcase.mk
@@ -4,7 +4,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 $(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
 
-CFLAGS += -fno-builtin -fno-asynchronous-unwind-tables -g0 $($(TESTCASE)-cflags)
+CFLAGS += -fno-builtin -g0 $($(TESTCASE)-cflags)
 
 .PHONY: all
 all: $(TESTCASE).bin
diff --git a/xen/arch/x86/Rules.mk b/xen/arch/x86/Rules.mk
index 659ac3d83e..812a652eec 100644
--- a/xen/arch/x86/Rules.mk
+++ b/xen/arch/x86/Rules.mk
@@ -35,7 +35,7 @@ $(call as-option-add,CFLAGS,CC,\
 $(call as-option-add,CFLAGS,CC,\
     ".L1: .L2: .nops (.L2 - .L1)$$(comma)9",-DHAVE_AS_NOPS_DIRECTIVE)
 
-CFLAGS += -mno-red-zone -fpic -fno-asynchronous-unwind-tables
+CFLAGS += -mno-red-zone -fpic
 
 # Xen doesn't use SSE interally.  If the compiler supports it, also skip the
 # SSE setup for variadic function calls.
diff --git a/xen/arch/x86/boot/build32.mk b/xen/arch/x86/boot/build32.mk
index 48c7407c00..5851ebff5f 100644
--- a/xen/arch/x86/boot/build32.mk
+++ b/xen/arch/x86/boot/build32.mk
@@ -4,7 +4,7 @@ include $(XEN_ROOT)/Config.mk
 
 $(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
 
-CFLAGS += -Werror -fno-asynchronous-unwind-tables -fno-builtin -g0 -msoft-float
+CFLAGS += -Werror -fno-builtin -g0 -msoft-float
 CFLAGS += -I$(XEN_ROOT)/xen/include
 CFLAGS := $(filter-out -flto,$(CFLAGS)) 
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 14:56:18 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 14:56:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jo6p0-000575-20; Wed, 24 Jun 2020 14:56: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo6oz-00056a-35
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:56:17 +0000
X-Inumbo-ID: dad7bd9a-b62a-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id dad7bd9a-b62a-11ea-bb8b-bc764e2007e4;
 Wed, 24 Jun 2020 14: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=4hQYOx5PPZGlViCglpcbUJcxrfOZrdYVF0Yt3u9TQeg=; b=i1AZQcHttu3WdhaflZYtBUEfu8
 ptBs/h7u+4EDpFZ+4t4ucX51RPZV7znYoaP4YkS1o/AIXIct5XKbKGI048g5+ee7BD7nM06/Itq3l
 Y8Mf03KW1ZTQomyX/bdajbkGmdGi496CSAWTlXHTjZq/OJ6LC+8DLMG1xl7MsmhNxrcQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6oy-0003el-C4
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:56:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6oy-0005pt-BJ
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:56:16 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] x86/build: Unilaterally disable -fcf-protection
Message-Id: <E1jo6oy-0005pt-BJ@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 14:56: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 eccc242b590c04758c176120a0ff5a53c044aee0
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 24 16:24:56 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:24:56 2020 +0200

    x86/build: Unilaterally disable -fcf-protection
    
    Xen doesn't support CET-IBT yet.  At a minimum, logic is required to enable it
    for supervisor use, but the livepatch functionality needs to learn not to
    overwrite ENDBR64 instructions.
    
    Furthermore, Ubuntu enables -fcf-protection by default, along with a buggy
    version of GCC-9 which objects to it in combination with
    -mindirect-branch=thunk-extern (Fixed in GCC 10, 9.4).
    
    Various objects (Xen boot path, Rombios 32 stubs) require .text to be at the
    beginning of the object.  These paths explode when .note.gnu.properties gets
    put ahead of .text and we end up executing the notes data.
    
    Disable -fcf-protection for all embedded objects.
    
    Reported-by: Jason Andryuk <jandryuk@gmail.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 Config.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Config.mk b/Config.mk
index 85bde01f77..fb7c0511b1 100644
--- a/Config.mk
+++ b/Config.mk
@@ -236,6 +236,7 @@ APPEND_CFLAGS += $(foreach i, $(APPEND_INCLUDES), -I$(i))
 
 EMBEDDED_EXTRA_CFLAGS := -nopie -fno-stack-protector -fno-stack-protector-all
 EMBEDDED_EXTRA_CFLAGS += -fno-exceptions -fno-asynchronous-unwind-tables
+EMBEDDED_EXTRA_CFLAGS += -fcf-protection=none
 
 XEN_EXTFILES_URL ?= http://xenbits.xen.org/xen-extfiles
 # All the files at that location were downloaded from elsewhere on
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 14:56:28 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 14: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 1jo6pA-0005Ej-3Q; Wed, 24 Jun 2020 14: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo6p9-0005Ea-2g
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:56:27 +0000
X-Inumbo-ID: e0d852e0-b62a-11ea-80e8-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id e0d852e0-b62a-11ea-80e8-12813bfff9fa;
 Wed, 24 Jun 2020 14: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=Q7rbIc420qk+Xse0B4XIf48Y/wWxHtIDEAmoG7X7m2Q=; b=MlFZzPSTzzaLQFmC3cf8hxwYbq
 mt9JHYZgaU4FPrq8cunUFSVlHLYUr40DwZWDzDm/9PrwF289/pTYyvrJqZpzyCv5fgShcZAG0Ia8R
 rI7p0zZeRxrOUkVbLh/3yroOs7n455o5AUINPY71qU80qQHfoiH+y7rrSsYO1REfiRB0=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6p8-0003et-FP
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:56:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6p8-0005qN-EZ
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:56:26 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] x86/PVH: PHYSDEVOP_pci_mmcfg_reserved should not
 blindly register a region
Message-Id: <E1jo6p8-0005qN-EZ@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 14: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 d61fef6c411362876337fd4f473fbdef67ed00a5
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jun 24 16:25:29 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:25:29 2020 +0200

    x86/PVH: PHYSDEVOP_pci_mmcfg_reserved should not blindly register a region
    
    The op has a "is reserved" flag, and hence registration shouldn't
    happen unilaterally.
    
    Fixes: eb3dd90e4089 ("x86/physdev: enable PHYSDEVOP_pci_mmcfg_reserved for PVH Dom0")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: b539eeffc737d859dd1814c2e529e0ed0feba7a7
    master date: 2020-05-14 07:53:55 +0200
---
 xen/arch/x86/physdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/physdev.c b/xen/arch/x86/physdev.c
index 3a3c15890b..23465bcd00 100644
--- a/xen/arch/x86/physdev.c
+++ b/xen/arch/x86/physdev.c
@@ -556,7 +556,7 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 
         ret = pci_mmcfg_reserved(info.address, info.segment,
                                  info.start_bus, info.end_bus, info.flags);
-        if ( !ret && has_vpci(currd) )
+        if ( !ret && has_vpci(currd) && (info.flags & XEN_PCI_MMCFG_RESERVED) )
         {
             /*
              * For HVM (PVH) domains try to add the newly found MMCFG to the
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 14:56:38 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 14: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 1jo6pK-0005Fn-4x; Wed, 24 Jun 2020 14:56: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo6pJ-0005Fe-7j
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:56:37 +0000
X-Inumbo-ID: e6de8466-b62a-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id e6de8466-b62a-11ea-b7bb-bc764e2007e4;
 Wed, 24 Jun 2020 14: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=ZyG4SxMse7NwPjeDq6DkzQzjEUsIiyQK1YYLdpCXlmY=; b=RZpCsSUJHfS0g9bfmSfFnGabYW
 fgeVx3308T/tAXbbJF7Kvpq38BUDKpB/TwOcQdvqOHjf0BJIqliOic5pYDaE7O8pwQaBSAxTXraCN
 76ZxJqqBu7yW6H5OQPjKLC0cgRTm1hfy26OKGJcfTym+kTXiL5uHaf9W7vsWZn+9Cpcc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6pI-0003f0-Io
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:56:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6pI-0005qr-I1
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:56:36 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] sched: allow rcu work to happen when syncing cpus
 in core scheduling
Message-Id: <E1jo6pI-0005qr-I1@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 14: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 f2ad77ba78224a9cc21e14f57bb1d2210d561e0b
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Jun 24 16:26:11 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:26:11 2020 +0200

    sched: allow rcu work to happen when syncing cpus in core scheduling
    
    With RCU barriers moved from tasklets to normal RCU processing cpu
    offlining in core scheduling might deadlock due to cpu synchronization
    required by RCU processing and core scheduling concurrently.
    
    Fix that by bailing out from core scheduling synchronization in case
    of pending RCU work. Additionally the RCU softirq is now required to
    be of higher priority than the scheduling softirqs in order to do
    RCU processing before entering the scheduler again, as bailing out from
    the core scheduling synchronization requires to raise another softirq
    SCHED_SLAVE, which would bypass RCU processing again.
    
    Reported-by: Sergey Dyasli <sergey.dyasli@citrix.com>
    Tested-by: Sergey Dyasli <sergey.dyasli@citrix.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Dario Faggioli <dfaggioli@suse.com>
    master commit: 4e9c57c4edbabab1b66f965db0203100097944ff
    master date: 2020-05-15 16:04:00 +0200
---
 xen/common/schedule.c     | 13 ++++++++++---
 xen/include/xen/softirq.h |  2 +-
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/xen/common/schedule.c b/xen/common/schedule.c
index 6d24a3a135..ccc20ce040 100644
--- a/xen/common/schedule.c
+++ b/xen/common/schedule.c
@@ -2270,13 +2270,20 @@ static struct sched_unit *sched_wait_rendezvous_in(struct sched_unit *prev,
             v = unit2vcpu_cpu(prev, cpu);
         }
         /*
-         * Coming from idle might need to do tasklet work.
+         * Check for any work to be done which might need cpu synchronization.
+         * This is either pending RCU work, or tasklet work when coming from
+         * idle. It is mandatory that RCU softirqs are of higher priority
+         * than scheduling ones as otherwise a deadlock might occur.
          * In order to avoid deadlocks we can't do that here, but have to
-         * continue the idle loop.
+         * schedule the previous vcpu again, which will lead to the desired
+         * processing to be done.
          * Undo the rendezvous_in_cnt decrement and schedule another call of
          * sched_slave().
          */
-        if ( is_idle_unit(prev) && sched_tasklet_check_cpu(cpu) )
+        BUILD_BUG_ON(RCU_SOFTIRQ > SCHED_SLAVE_SOFTIRQ ||
+                     RCU_SOFTIRQ > SCHEDULE_SOFTIRQ);
+        if ( rcu_pending(cpu) ||
+             (is_idle_unit(prev) && sched_tasklet_check_cpu(cpu)) )
         {
             struct vcpu *vprev = current;
 
diff --git a/xen/include/xen/softirq.h b/xen/include/xen/softirq.h
index d7273b389b..d21b048b8c 100644
--- a/xen/include/xen/softirq.h
+++ b/xen/include/xen/softirq.h
@@ -4,10 +4,10 @@
 /* Low-latency softirqs come first in the following list. */
 enum {
     TIMER_SOFTIRQ = 0,
+    RCU_SOFTIRQ,
     SCHED_SLAVE_SOFTIRQ,
     SCHEDULE_SOFTIRQ,
     NEW_TLBFLUSH_CLOCK_PERIOD_SOFTIRQ,
-    RCU_SOFTIRQ,
     TASKLET_SOFTIRQ,
     NR_COMMON_SOFTIRQS
 };
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 14:56:48 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 14: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 1jo6pU-0005Gt-6a; Wed, 24 Jun 2020 14:56: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo6pT-0005Gk-AW
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:56:47 +0000
X-Inumbo-ID: ece52fc2-b62a-11ea-80e8-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id ece52fc2-b62a-11ea-80e8-12813bfff9fa;
 Wed, 24 Jun 2020 14: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=EB1Y7pX68uT62LjXtkR1B/wXYg86ZJQirXvmZ7VU5Fw=; b=TPK6ckArzOLaeWa/2RK5s96806
 ivVy+CMiOgSommvOflWzy0hFyxg5Qkdys7cbbqKbt2+/vHvl2/EQKX9c79SYEaQPw3LPByVZ6K8qp
 VsHicv5AQVVm8EhLaYTPyllqVD4f+FQxz+SaEv7ny8SQo+39j50TJBAjoPufhDgsJLlc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6pS-0003fA-MB
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:56:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6pS-0005rV-LG
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:56:46 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] x86/hvm: Fix shifting in stdvga_mem_read()
Message-Id: <E1jo6pS-0005rV-LG@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 14: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 04aedf4048c12a9f0dba3b693df7f2c5df614901
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 24 16:27:16 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:27:16 2020 +0200

    x86/hvm: Fix shifting in stdvga_mem_read()
    
    stdvga_mem_read() has a return type of uint8_t, which promotes to int rather
    than unsigned int.  Shifting by 24 may hit the sign bit.
    
    Spotted by Coverity.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 97fb0253e6c2f2221bfd0895b7ffe3a99330d847
    master date: 2020-05-18 15:22:53 +0100
---
 xen/arch/x86/hvm/stdvga.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/stdvga.c b/xen/arch/x86/hvm/stdvga.c
index bd398dbb1b..e2675139e7 100644
--- a/xen/arch/x86/hvm/stdvga.c
+++ b/xen/arch/x86/hvm/stdvga.c
@@ -322,7 +322,7 @@ static int stdvga_mem_read(const struct hvm_io_handler *handler,
         data = stdvga_mem_readb(addr);
         data |= stdvga_mem_readb(addr + 1) << 8;
         data |= stdvga_mem_readb(addr + 2) << 16;
-        data |= stdvga_mem_readb(addr + 3) << 24;
+        data |= (uint32_t)stdvga_mem_readb(addr + 3) << 24;
         break;
 
     case 8:
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 14:56:58 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 14:56:58 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jo6pe-0005Hy-8A; Wed, 24 Jun 2020 14:56: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo6pd-0005Hp-Et
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:56:57 +0000
X-Inumbo-ID: f2eaa5be-b62a-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id f2eaa5be-b62a-11ea-b7bb-bc764e2007e4;
 Wed, 24 Jun 2020 14: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=E7blaAh4BO9p3rGupnaacBrh7Y4GZgSSrqfhocmC21Q=; b=IRQau3yLR+EQ9wgAsJGEVBYEL2
 7pCURsE7Ud/pA0B/Chn263BYqursiG1ChHwdeYpBiIiXeYk2Dr0tIpwLRd8IThNQGZINBQIXuwBwY
 DRSZHUGo0W4ikANXgPGCew2CoayvJEogv/aAm3BgGl6877SSlifNV8iEh7S0eJTNA4xE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6pc-0003fQ-PW
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:56:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6pc-0005sN-Ok
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:56:56 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] x86: determine MXCSR mask in all cases
Message-Id: <E1jo6pc-0005sN-Ok@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 14: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 7f6b66d71ff7ef5695da15b1e4b3ee7e0fc5140d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jun 24 16:27:55 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:27:55 2020 +0200

    x86: determine MXCSR mask in all cases
    
    For its use(s) by the emulator to be correct in all cases, the filling
    of the variable needs to be independent of XSAVE availability. As
    there's no suitable function in i387.c to put the logic in, keep it in
    xstate_init(), arrange for the function to be called unconditionally,
    and pull the logic ahead of all return paths there.
    
    Fixes: 9a4496a35b20 ("x86emul: support {,V}{LD,ST}MXCSR")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 2b532519d64e653a6bbfd9eefed6040a09c8876d
    master date: 2020-05-18 17:18:56 +0200
---
 xen/arch/x86/cpu/common.c |  3 +--
 xen/arch/x86/xstate.c     | 18 ++++++++++++------
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index e5ad17d8d9..ad34d9b526 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -487,8 +487,7 @@ void identify_cpu(struct cpuinfo_x86 *c)
 
 	/* Now the feature flags better reflect actual CPU features! */
 
-	if ( cpu_has_xsave )
-		xstate_init(c);
+	xstate_init(c);
 
 #ifdef NOISY_CAPS
 	printk(KERN_DEBUG "CPU: After all inits, caps:");
diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c
index 243495ed07..0abf20d2ef 100644
--- a/xen/arch/x86/xstate.c
+++ b/xen/arch/x86/xstate.c
@@ -587,6 +587,18 @@ void xstate_init(struct cpuinfo_x86 *c)
     u32 eax, ebx, ecx, edx;
     u64 feature_mask;
 
+    if ( bsp )
+    {
+        static typeof(current->arch.xsave_area->fpu_sse) __initdata ctxt;
+
+        asm ( "fxsave %0" : "=m" (ctxt) );
+        if ( ctxt.mxcsr_mask )
+            mxcsr_mask = ctxt.mxcsr_mask;
+    }
+
+    if ( !cpu_has_xsave )
+        return;
+
     if ( (bsp && !use_xsave) ||
          boot_cpu_data.cpuid_level < XSTATE_CPUID )
     {
@@ -610,8 +622,6 @@ void xstate_init(struct cpuinfo_x86 *c)
 
     if ( bsp )
     {
-        static typeof(current->arch.xsave_area->fpu_sse) __initdata ctxt;
-
         xfeature_mask = feature_mask;
         /*
          * xsave_cntxt_size is the max size required by enabled features.
@@ -620,10 +630,6 @@ void xstate_init(struct cpuinfo_x86 *c)
         xsave_cntxt_size = _xstate_ctxt_size(feature_mask);
         printk("xstate: size: %#x and states: %#"PRIx64"\n",
                xsave_cntxt_size, xfeature_mask);
-
-        asm ( "fxsave %0" : "=m" (ctxt) );
-        if ( ctxt.mxcsr_mask )
-            mxcsr_mask = ctxt.mxcsr_mask;
     }
     else
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 14:57:08 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 14:57:08 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jo6po-0005Ip-9m; Wed, 24 Jun 2020 14:57: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo6pn-0005Ih-Ns
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:57:07 +0000
X-Inumbo-ID: f8ef2b38-b62a-11ea-80e8-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id f8ef2b38-b62a-11ea-80e8-12813bfff9fa;
 Wed, 24 Jun 2020 14:57: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=CrtmylRxgMpheeexuhegryjNFA0QFhb6/oOHj3B5d/s=; b=khnErxEtgcZJjkepW91tnxxUQv
 gFpC5pHubGNw43fsE+UKIUyW7jAms4DMZgDLyGNjbzVXF5bm4TA+S3x+SMkA2DzJDKBqkpcQ8SFSP
 pjWdd/dq0ODq0WgaCEndtLYlOHUWiZ/h6QMSehrN/DmfR/XzNiDljxMYfTb5d42KEWNU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6pm-0003gS-Sm
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:57:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6pm-0005t0-Rw
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:57:06 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] x86/idle: rework C6 EOI workaround
Message-Id: <E1jo6pm-0005t0-Rw@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 14: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 85ac0083529735c88b012c43227a4e0d5eb16a30
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Jun 24 16:28:36 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:28:36 2020 +0200

    x86/idle: rework C6 EOI workaround
    
    Change the C6 EOI workaround (errata AAJ72) to use x86_match_cpu. Also
    call the workaround from mwait_idle, previously it was only used by
    the ACPI idle driver. Finally make sure the routine is called for all
    states equal or greater than ACPI_STATE_C3, note that the ACPI driver
    doesn't currently handle them, but the errata condition shouldn't be
    limited by that.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 5fef1fd713660406a6187ef352fbf79986abfe43
    master date: 2020-05-20 12:48:37 +0200
---
 xen/arch/x86/acpi/cpu_idle.c  | 43 ++++++++++++++++++++++++++-----------------
 xen/arch/x86/cpu/mwait-idle.c |  3 +++
 xen/include/asm-x86/cpuidle.h |  2 ++
 3 files changed, 31 insertions(+), 17 deletions(-)

diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c
index d24f44167b..1e6b374136 100644
--- a/xen/arch/x86/acpi/cpu_idle.c
+++ b/xen/arch/x86/acpi/cpu_idle.c
@@ -545,26 +545,35 @@ void trace_exit_reason(u32 *irq_traced)
     }
 }
 
-/*
- * "AAJ72. EOI Transaction May Not be Sent if Software Enters Core C6 During 
- * an Interrupt Service Routine"
- * 
- * There was an errata with some Core i7 processors that an EOI transaction 
- * may not be sent if software enters core C6 during an interrupt service 
- * routine. So we don't enter deep Cx state if there is an EOI pending.
- */
-static bool errata_c6_eoi_workaround(void)
+bool errata_c6_eoi_workaround(void)
 {
-    static int8_t fix_needed = -1;
+    static int8_t __read_mostly fix_needed = -1;
 
     if ( unlikely(fix_needed == -1) )
     {
-        int model = boot_cpu_data.x86_model;
-        fix_needed = (cpu_has_apic && !directed_eoi_enabled &&
-                      (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) &&
-                      (boot_cpu_data.x86 == 6) &&
-                      ((model == 0x1a) || (model == 0x1e) || (model == 0x1f) ||
-                       (model == 0x25) || (model == 0x2c) || (model == 0x2f)));
+#define INTEL_FAM6_MODEL(m) { X86_VENDOR_INTEL, 6, m, X86_FEATURE_ALWAYS }
+        /*
+         * Errata AAJ72: EOI Transaction May Not be Sent if Software Enters
+         * Core C6 During an Interrupt Service Routine"
+         *
+         * There was an errata with some Core i7 processors that an EOI
+         * transaction may not be sent if software enters core C6 during an
+         * interrupt service routine. So we don't enter deep Cx state if
+         * there is an EOI pending.
+         */
+        static const struct x86_cpu_id eoi_errata[] = {
+            INTEL_FAM6_MODEL(0x1a),
+            INTEL_FAM6_MODEL(0x1e),
+            INTEL_FAM6_MODEL(0x1f),
+            INTEL_FAM6_MODEL(0x25),
+            INTEL_FAM6_MODEL(0x2c),
+            INTEL_FAM6_MODEL(0x2f),
+            { }
+        };
+#undef INTEL_FAM6_MODEL
+
+        fix_needed = cpu_has_apic && !directed_eoi_enabled &&
+                     x86_match_cpu(eoi_errata);
     }
 
     return (fix_needed && cpu_has_pending_apic_eoi());
@@ -672,7 +681,7 @@ static void acpi_processor_idle(void)
         return;
     }
 
-    if ( (cx->type == ACPI_STATE_C3) && errata_c6_eoi_workaround() )
+    if ( (cx->type >= ACPI_STATE_C3) && errata_c6_eoi_workaround() )
         cx = power->safe_state;
 
 
diff --git a/xen/arch/x86/cpu/mwait-idle.c b/xen/arch/x86/cpu/mwait-idle.c
index 52413e6da1..f0380c0428 100644
--- a/xen/arch/x86/cpu/mwait-idle.c
+++ b/xen/arch/x86/cpu/mwait-idle.c
@@ -769,6 +769,9 @@ static void mwait_idle(void)
 		return;
 	}
 
+	if ((cx->type >= 3) && errata_c6_eoi_workaround())
+		cx = power->safe_state;
+
 	eax = cx->address;
 	cstate = ((eax >> MWAIT_SUBSTATE_SIZE) & MWAIT_CSTATE_MASK) + 1;
 
diff --git a/xen/include/asm-x86/cpuidle.h b/xen/include/asm-x86/cpuidle.h
index 5d7dffd228..51368694dc 100644
--- a/xen/include/asm-x86/cpuidle.h
+++ b/xen/include/asm-x86/cpuidle.h
@@ -26,4 +26,6 @@ void update_idle_stats(struct acpi_processor_power *,
 void update_last_cx_stat(struct acpi_processor_power *,
                          struct acpi_processor_cx *, uint64_t);
 
+bool errata_c6_eoi_workaround(void);
+
 #endif /* __X86_ASM_CPUIDLE_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 14:57:18 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 14: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 1jo6py-0005KK-Co; Wed, 24 Jun 2020 14: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo6px-0005KD-Mi
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:57:17 +0000
X-Inumbo-ID: fef360da-b62a-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id fef360da-b62a-11ea-8496-bc764e2007e4;
 Wed, 24 Jun 2020 14:57: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=esAb9dyE/YQ5tia3IuA3LHuGFYZgXyDaN1DHnIRx3rQ=; b=pZvtOyn5mHfyCEcVnz75ABnrJd
 n+8W7ZqWllG8lIjdR7sptlbQAXn0CC8owkmqABx8Xj0m15rFvt6czLXPzOdT5tHxgKTNrVzQM5QBh
 bH8qAl7+6DYIcZcikT4BE6W4mHsetbM9dUJgZOvof+PhDEEzoRWgZuIux4yLf939xIjg=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6pw-0003ga-Vu
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:57:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6pw-0005tb-VA
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:57:16 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] x86/idle: prevent entering C6 with in service
 interrupts on Intel
Message-Id: <E1jo6pw-0005tb-VA@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 14: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 0a85f84e6593a964323d8a879d84d58c53379c9c
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Jun 24 16:29:17 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:29:17 2020 +0200

    x86/idle: prevent entering C6 with in service interrupts on Intel
    
    Apply a workaround for Intel errata BDX99, CLX30, SKX100, CFW125,
    BDF104, BDH85, BDM135, KWB131: "A Pending Fixed Interrupt May Be
    Dispatched Before an Interrupt of The Same Priority Completes".
    
    Apply the errata to all server and client models (big cores) from
    Broadwell to Cascade Lake. The workaround is grouped together with the
    existing fix for errata AAJ72, and the eoi from the function name is
    removed.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: fc44a7014cafe28b8c53eeaf6ac2a71f5bc8b815
    master date: 2020-05-22 16:07:38 +0200
---
 xen/arch/x86/acpi/cpu_idle.c  | 38 ++++++++++++++++++++++++++++++++++----
 xen/arch/x86/cpu/mwait-idle.c |  2 +-
 xen/include/asm-x86/cpuidle.h |  2 +-
 3 files changed, 36 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c
index 1e6b374136..e79776bc09 100644
--- a/xen/arch/x86/acpi/cpu_idle.c
+++ b/xen/arch/x86/acpi/cpu_idle.c
@@ -545,7 +545,7 @@ void trace_exit_reason(u32 *irq_traced)
     }
 }
 
-bool errata_c6_eoi_workaround(void)
+bool errata_c6_workaround(void)
 {
     static int8_t __read_mostly fix_needed = -1;
 
@@ -570,10 +570,40 @@ bool errata_c6_eoi_workaround(void)
             INTEL_FAM6_MODEL(0x2f),
             { }
         };
+        /*
+         * Errata BDX99, CLX30, SKX100, CFW125, BDF104, BDH85, BDM135, KWB131:
+         * A Pending Fixed Interrupt May Be Dispatched Before an Interrupt of
+         * The Same Priority Completes.
+         *
+         * Resuming from C6 Sleep-State, with Fixed Interrupts of the same
+         * priority queued (in the corresponding bits of the IRR and ISR APIC
+         * registers), the processor may dispatch the second interrupt (from
+         * the IRR bit) before the first interrupt has completed and written to
+         * the EOI register, causing the first interrupt to never complete.
+         */
+        static const struct x86_cpu_id isr_errata[] = {
+            /* Broadwell */
+            INTEL_FAM6_MODEL(0x47),
+            INTEL_FAM6_MODEL(0x3d),
+            INTEL_FAM6_MODEL(0x4f),
+            INTEL_FAM6_MODEL(0x56),
+            /* Skylake (client) */
+            INTEL_FAM6_MODEL(0x5e),
+            INTEL_FAM6_MODEL(0x4e),
+            /* {Sky/Cascade}lake (server) */
+            INTEL_FAM6_MODEL(0x55),
+            /* {Kaby/Coffee/Whiskey/Amber} Lake */
+            INTEL_FAM6_MODEL(0x9e),
+            INTEL_FAM6_MODEL(0x8e),
+            /* Cannon Lake */
+            INTEL_FAM6_MODEL(0x66),
+            { }
+        };
 #undef INTEL_FAM6_MODEL
 
-        fix_needed = cpu_has_apic && !directed_eoi_enabled &&
-                     x86_match_cpu(eoi_errata);
+        fix_needed = cpu_has_apic &&
+                     ((!directed_eoi_enabled && x86_match_cpu(eoi_errata)) ||
+                      x86_match_cpu(isr_errata));
     }
 
     return (fix_needed && cpu_has_pending_apic_eoi());
@@ -681,7 +711,7 @@ static void acpi_processor_idle(void)
         return;
     }
 
-    if ( (cx->type >= ACPI_STATE_C3) && errata_c6_eoi_workaround() )
+    if ( (cx->type >= ACPI_STATE_C3) && errata_c6_workaround() )
         cx = power->safe_state;
 
 
diff --git a/xen/arch/x86/cpu/mwait-idle.c b/xen/arch/x86/cpu/mwait-idle.c
index f0380c0428..d0736d4502 100644
--- a/xen/arch/x86/cpu/mwait-idle.c
+++ b/xen/arch/x86/cpu/mwait-idle.c
@@ -769,7 +769,7 @@ static void mwait_idle(void)
 		return;
 	}
 
-	if ((cx->type >= 3) && errata_c6_eoi_workaround())
+	if ((cx->type >= 3) && errata_c6_workaround())
 		cx = power->safe_state;
 
 	eax = cx->address;
diff --git a/xen/include/asm-x86/cpuidle.h b/xen/include/asm-x86/cpuidle.h
index 51368694dc..0981a8fd64 100644
--- a/xen/include/asm-x86/cpuidle.h
+++ b/xen/include/asm-x86/cpuidle.h
@@ -26,6 +26,6 @@ void update_idle_stats(struct acpi_processor_power *,
 void update_last_cx_stat(struct acpi_processor_power *,
                          struct acpi_processor_cx *, uint64_t);
 
-bool errata_c6_eoi_workaround(void);
+bool errata_c6_workaround(void);
 
 #endif /* __X86_ASM_CPUIDLE_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 14:57:28 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 14: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 1jo6q8-0005Lh-EN; Wed, 24 Jun 2020 14:57: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo6q7-0005LZ-OQ
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:57:27 +0000
X-Inumbo-ID: 04fa47a0-b62b-11ea-80e8-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 04fa47a0-b62b-11ea-80e8-12813bfff9fa;
 Wed, 24 Jun 2020 14:57: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=OH3tbUnnZHp6WEz1cgLzIc/AiQnHEvSbfAmGEtWKKco=; b=hNYeVnxZLjsEqLfHvrJSEo/GJQ
 0qFGI7n5e0vQjK4xKQ6gzblsB6NPRPcWRsluSX79340fdOZ5xx0JZXjNllmyZKBXCQxWEoEBRVAF6
 avNWKjWl6GqTnk8BWg0qBhDa6kEhZcGGa8n0k+hDUcrAPEo0gp7GHd9Y5vFgaHpCFBnE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6q7-0003gj-37
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:57:27 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6q7-0005uh-2C
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:57:27 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] x86/idle: prevent entering C3/C6 on some Intel
 CPUs due to errata
Message-Id: <E1jo6q7-0005uh-2C@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 14:57: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 c437e06ba203f5bed82fc30dcfffacf899f91861
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Jun 24 16:29:51 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:29:51 2020 +0200

    x86/idle: prevent entering C3/C6 on some Intel CPUs due to errata
    
    Apply a workaround for errata BA80, AAK120, AAM108, AAO67, BD59,
    AAY54: Rapid Core C3/C6 Transition May Cause Unpredictable System
    Behavior.
    
    Limit maximum C state to C1 when SMT is enabled on the affected CPUs.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: b2d502466547e6782ccadd501b8ef1482c391f2c
    master date: 2020-05-22 16:08:54 +0200
---
 xen/arch/x86/cpu/intel.c | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/xen/arch/x86/cpu/intel.c b/xen/arch/x86/cpu/intel.c
index 4d7324e4d0..856de244ce 100644
--- a/xen/arch/x86/cpu/intel.c
+++ b/xen/arch/x86/cpu/intel.c
@@ -296,6 +296,41 @@ static void early_init_intel(struct cpuinfo_x86 *c)
 	ctxt_switch_levelling(NULL);
 }
 
+/*
+ * Errata BA80, AAK120, AAM108, AAO67, BD59, AAY54: Rapid Core C3/C6 Transition
+ * May Cause Unpredictable System Behavior
+ *
+ * Under a complex set of internal conditions, cores rapidly performing C3/C6
+ * transitions in a system with Intel Hyper-Threading Technology enabled may
+ * cause a machine check error (IA32_MCi_STATUS.MCACOD = 0x0106), system hang
+ * or unpredictable system behavior.
+ */
+static void probe_c3_errata(const struct cpuinfo_x86 *c)
+{
+#define INTEL_FAM6_MODEL(m) { X86_VENDOR_INTEL, 6, m, X86_FEATURE_ALWAYS }
+    static const struct x86_cpu_id models[] = {
+        /* Nehalem */
+        INTEL_FAM6_MODEL(0x1a),
+        INTEL_FAM6_MODEL(0x1e),
+        INTEL_FAM6_MODEL(0x1f),
+        INTEL_FAM6_MODEL(0x2e),
+        /* Westmere (note Westmere-EX is not affected) */
+        INTEL_FAM6_MODEL(0x2c),
+        INTEL_FAM6_MODEL(0x25),
+        { }
+    };
+#undef INTEL_FAM6_MODEL
+
+    /* Serialized by the AP bringup code. */
+    if ( max_cstate > 1 && (c->apicid & (c->x86_num_siblings - 1)) &&
+         x86_match_cpu(models) )
+    {
+        printk(XENLOG_WARNING
+	       "Disabling C-states C3 and C6 due to CPU errata\n");
+        max_cstate = 1;
+    }
+}
+
 /*
  * P4 Xeon errata 037 workaround.
  * Hardware prefetcher may cause stale data to be loaded into the cache.
@@ -323,6 +358,8 @@ static void Intel_errata_workarounds(struct cpuinfo_x86 *c)
 
 	if (cpu_has_tsx_force_abort && opt_rtm_abort)
 		wrmsrl(MSR_TSX_FORCE_ABORT, TSX_FORCE_ABORT_RTM);
+
+	probe_c3_errata(c);
 }
 
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 14:57:39 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 14:57: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 1jo6qJ-0005Mq-GF; Wed, 24 Jun 2020 14:57:39 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo6qI-0005Mf-GM
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:57:38 +0000
X-Inumbo-ID: 0b03f0ec-b62b-11ea-80e8-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 0b03f0ec-b62b-11ea-80e8-12813bfff9fa;
 Wed, 24 Jun 2020 14:57: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=kQne9AT2+hN0Sp7C6VKCBev5ylvHS2jHE9NTuvDguss=; b=a0GX5f49tNRdq4SSBiCDw4EVD+
 RiTegKafn8xiCDqmWjTLv8Zw+XYwb4WOhFC0xfLtjDdscugabU5gZX1nTYanoHg3jCjahDBWtXpFC
 jOSGKY/FHZykiwhbXlXoK9xTKrtuIbnaHAWXp80+DDT1UvAcPcIuIfw1XgP8PwazLl0Y=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6qH-0003gt-7U
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:57:37 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6qH-0005vV-6Y
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:57:37 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] x86/idle: Extend ISR/C6 erratum workaround to
 Haswell
Message-Id: <E1jo6qH-0005vV-6Y@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 14:57: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 a6f20805232b0754eb2dfe69a092063868b7d0e3
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 24 16:30:29 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:30:29 2020 +0200

    x86/idle: Extend ISR/C6 erratum workaround to Haswell
    
    This bug was first discovered against Haswell.  It is definitely affected.
    
    (The XenServer ticket for this bug was opened on 2013-05-30 which is coming up
    on 7 years old, and predates Broadwell).
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: b72d8870b5f68f06b083e6bfdb28f081bcb6ab3b
    master date: 2020-05-22 20:04:23 +0100
---
 xen/arch/x86/acpi/cpu_idle.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c
index e79776bc09..95990dc8b7 100644
--- a/xen/arch/x86/acpi/cpu_idle.c
+++ b/xen/arch/x86/acpi/cpu_idle.c
@@ -580,8 +580,16 @@ bool errata_c6_workaround(void)
          * registers), the processor may dispatch the second interrupt (from
          * the IRR bit) before the first interrupt has completed and written to
          * the EOI register, causing the first interrupt to never complete.
+         *
+         * Note: Haswell hasn't had errata issued, but this issue was first
+         * discovered on Haswell hardware, and is affected.
          */
         static const struct x86_cpu_id isr_errata[] = {
+            /* Haswell */
+            INTEL_FAM6_MODEL(0x3c),
+            INTEL_FAM6_MODEL(0x3f),
+            INTEL_FAM6_MODEL(0x45),
+            INTEL_FAM6_MODEL(0x46),
             /* Broadwell */
             INTEL_FAM6_MODEL(0x47),
             INTEL_FAM6_MODEL(0x3d),
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 14:57:49 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 14:57: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 1jo6qT-0005Nr-Hq; Wed, 24 Jun 2020 14:57: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo6qS-0005Nf-5r
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:57:48 +0000
X-Inumbo-ID: 110c7644-b62b-11ea-80e8-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 110c7644-b62b-11ea-80e8-12813bfff9fa;
 Wed, 24 Jun 2020 14:57: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=3aXM3mpjQzx2iNF3Qv8qz4dlLBsFZPxQWCJ4uvUZkCM=; b=pVzcPmxn0rXm+5IERGfJ4L7MTt
 1Kp39/syFhqZO7whB3muvbPhrgRrbKiSc6o/4tjApa+QybkcjF8aHNCY/uyIBt4nUpyX1tw2Vdhmp
 vaUy/Xtgc3XXz2pvw2RGinGyBKF83guJmzChzo35cRfAm1k1rQraDZ5/5Wkq8dMdlD/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 1jo6qR-0003h3-BG
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:57:47 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6qR-0005wB-9x
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:57:47 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] xen/trace: Don't dump offline CPUs in
 debugtrace_dump_worker()
Message-Id: <E1jo6qR-0005wB-9x@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 14:57: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 672976cfbb2673065b4e8bb380189a9332c98cbc
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 24 16:31:09 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:31:09 2020 +0200

    xen/trace: Don't dump offline CPUs in debugtrace_dump_worker()
    
    The 'T' debugkey reliably wedges on one of my systems, which has a sparse
    APIC_ID layout due to a non power-of-2 number of cores per socket.  The
    per_cpu(dt_cpu_data, cpu) calcution falls over the deliberately non-canonical
    poison value.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: abf378e6483195b98a3f32e2c9d017e0eeeb275f
    master date: 2020-05-22 20:04:46 +0100
---
 xen/common/debugtrace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/debugtrace.c b/xen/common/debugtrace.c
index a788e55b4c..11ac198d93 100644
--- a/xen/common/debugtrace.c
+++ b/xen/common/debugtrace.c
@@ -94,7 +94,7 @@ static void debugtrace_dump_worker(void)
 
     debugtrace_dump_buffer(dt_data, "global");
 
-    for ( cpu = 0; cpu < nr_cpu_ids; cpu++ )
+    for_each_online_cpu ( cpu )
     {
         char buf[16];
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 14:58:00 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 14:58: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 1jo6qe-0005Os-JS; Wed, 24 Jun 2020 14:58: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo6qd-0005Oe-4f
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:57:59 +0000
X-Inumbo-ID: 17121fb2-b62b-11ea-80e8-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 17121fb2-b62b-11ea-80e8-12813bfff9fa;
 Wed, 24 Jun 2020 14:57: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=oFZ8+zmQRtbgTw460fSnBUJUZzesW3KIQcfqMKXF0W4=; b=IjBnReJh0U6vHrGglkUoi8cCfl
 6E5y+U+9wcNpIJyay2LwUz+jojIzrIF4giw79jfHQuj3TSa0ux0nEKrLmRnYcxOP1SpUikxoDNtjb
 dY6dQ1oy22Yv2YtKg7+RYgC3N3JXrp4gDmmWmkMDQHl30CuYUp8Wfql0e6r6/goDBTK0=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6qb-0003hB-Ei
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:57:57 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6qb-0005wx-Dy
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:57:57 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] x86: clear RDRAND CPUID bit on AMD family 15h/16h
Message-Id: <E1jo6qb-0005wx-Dy@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 14:57: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 05232254ba8361f76a8961bf979560eaf15416f8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jun 24 16:36:48 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:36:48 2020 +0200

    x86: clear RDRAND CPUID bit on AMD family 15h/16h
    
    Inspired by Linux commit c49a0a80137c7ca7d6ced4c812c9e07a949f6f24:
    
        There have been reports of RDRAND issues after resuming from suspend on
        some AMD family 15h and family 16h systems. This issue stems from a BIOS
        not performing the proper steps during resume to ensure RDRAND continues
        to function properly.
    
        Update the CPU initialization to clear the RDRAND CPUID bit for any family
        15h and 16h processor that supports RDRAND. If it is known that the family
        15h or family 16h system does not have an RDRAND resume issue or that the
        system will not be placed in suspend, the "cpuid=rdrand" kernel parameter
        can be used to stop the clearing of the RDRAND CPUID bit.
    
        Note, that clearing the RDRAND CPUID bit does not prevent a processor
        that normally supports the RDRAND instruction from executing it. So any
        code that determined the support based on family and model won't #UD.
    
    Warn if no explicit choice was given on affected hardware.
    
    Check RDRAND functions at boot as well as after S3 resume (the retry
    limit chosen is entirely arbitrary).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 93401e28a84b9dc5945f5d0bf5bce68e9d5ee121
    master date: 2020-05-27 09:49:37 +0200
---
 docs/misc/xen-command-line.pandoc |  5 ++++-
 xen/arch/x86/cpu/amd.c            | 21 +++++++++++++++++++++
 xen/arch/x86/cpu/common.c         | 27 +++++++++++++++++++++++++++
 xen/arch/x86/cpuid.c              |  3 +++
 xen/include/asm-x86/processor.h   |  1 +
 5 files changed, 56 insertions(+), 1 deletion(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 81e12d053c..125b4f330b 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -492,7 +492,10 @@ The Speculation Control hardware features `srbds-ctrl`, `md-clear`, `ibrsb`,
 applicable.  They can all be ignored.
 
 `rdrand` and `rdseed` can be ignored, as a mitigation to XSA-320 /
-CVE-2020-0543.
+CVE-2020-0543.  The RDRAND feature is disabled by default on certain AMD
+systems, due to possible malfunctions after ACPI S3 suspend/resume.  `rdrand`
+may be used in its positive form to override Xen's default behaviour on these
+systems, and make the feature fully usable.
 
 ### cpuid_mask_cpu
 > `= fam_0f_rev_[cdefg] | fam_10_rev_[bc] | fam_11_rev_b`
diff --git a/xen/arch/x86/cpu/amd.c b/xen/arch/x86/cpu/amd.c
index 0906b23582..b77fa19297 100644
--- a/xen/arch/x86/cpu/amd.c
+++ b/xen/arch/x86/cpu/amd.c
@@ -3,6 +3,7 @@
 #include <xen/mm.h>
 #include <xen/smp.h>
 #include <xen/pci.h>
+#include <xen/warning.h>
 #include <asm/io.h>
 #include <asm/msr.h>
 #include <asm/processor.h>
@@ -645,6 +646,26 @@ static void init_amd(struct cpuinfo_x86 *c)
 		if (acpi_smi_cmd && (acpi_enable_value | acpi_disable_value))
 			amd_acpi_c1e_quirk = true;
 		break;
+
+	case 0x15: case 0x16:
+		/*
+		 * There are some Fam15/Fam16 systems where upon resume from S3
+		 * firmware fails to re-setup properly functioning RDRAND.
+		 * By the time we can spot the problem, it is too late to take
+		 * action, and there is nothing Xen can do to repair the problem.
+		 * Clear the feature unless force-enabled on the command line.
+		 */
+		if (c == &boot_cpu_data &&
+		    cpu_has(c, X86_FEATURE_RDRAND) &&
+		    !is_forced_cpu_cap(X86_FEATURE_RDRAND)) {
+			static const char __initconst text[] =
+				"RDRAND may cease to work on this hardware upon resume from S3.\n"
+				"Please choose an explicit cpuid={no-}rdrand setting.\n";
+
+			setup_clear_cpu_cap(X86_FEATURE_RDRAND);
+			warning_add(text);
+		}
+		break;
 	}
 
 	display_cacheinfo(c);
diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index ad34d9b526..e370226485 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -10,6 +10,7 @@
 #include <asm/io.h>
 #include <asm/mpspec.h>
 #include <asm/apic.h>
+#include <asm/random.h>
 #include <asm/setup.h>
 #include <mach_apic.h>
 #include <public/sysctl.h> /* for XEN_INVALID_{SOCKET,CORE}_ID */
@@ -97,6 +98,11 @@ void __init setup_force_cpu_cap(unsigned int cap)
 	__set_bit(cap, boot_cpu_data.x86_capability);
 }
 
+bool __init is_forced_cpu_cap(unsigned int cap)
+{
+	return test_bit(cap, forced_caps);
+}
+
 static void default_init(struct cpuinfo_x86 * c)
 {
 	/* Not much we can do here... */
@@ -496,6 +502,27 @@ void identify_cpu(struct cpuinfo_x86 *c)
 	printk("\n");
 #endif
 
+	/*
+	 * If RDRAND is available, make an attempt to check that it actually
+	 * (still) works.
+	 */
+	if (cpu_has(c, X86_FEATURE_RDRAND)) {
+		unsigned int prev = 0;
+
+		for (i = 0; i < 5; ++i)
+		{
+			unsigned int cur = arch_get_random();
+
+			if (prev && cur != prev)
+				break;
+			prev = cur;
+		}
+
+		if (i >= 5)
+			printk(XENLOG_WARNING "CPU%u: RDRAND appears to not work\n",
+			       smp_processor_id());
+	}
+
 	if (system_state == SYS_STATE_resume)
 		return;
 
diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 7055509ed6..005b892a90 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -67,6 +67,9 @@ static int __init parse_xen_cpuid(const char *s)
             {
                 if ( !val )
                     setup_clear_cpu_cap(mid->bit);
+                else if ( mid->bit == X86_FEATURE_RDRAND &&
+                          (cpuid_ecx(1) & cpufeat_mask(X86_FEATURE_RDRAND)) )
+                    setup_force_cpu_cap(X86_FEATURE_RDRAND);
                 mid = NULL;
             }
 
diff --git a/xen/include/asm-x86/processor.h b/xen/include/asm-x86/processor.h
index 19328f481a..60ad3b7344 100644
--- a/xen/include/asm-x86/processor.h
+++ b/xen/include/asm-x86/processor.h
@@ -166,6 +166,7 @@ extern const struct x86_cpu_id *x86_match_cpu(const struct x86_cpu_id table[]);
 extern void identify_cpu(struct cpuinfo_x86 *);
 extern void setup_clear_cpu_cap(unsigned int);
 extern void setup_force_cpu_cap(unsigned int);
+extern bool is_forced_cpu_cap(unsigned int);
 extern void print_cpu_info(unsigned int cpu);
 extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 14:58:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 14:58: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 1jo6qn-0005Ql-LJ; Wed, 24 Jun 2020 14:58: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo6qm-0005Qb-F6
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:58:08 +0000
X-Inumbo-ID: 1d196370-b62b-11ea-80e8-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 1d196370-b62b-11ea-80e8-12813bfff9fa;
 Wed, 24 Jun 2020 14:58: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=Cc6llUJDk6GYDlJftDIzQb8BVgQ0fOWBMC6tBVod2Aw=; b=ZmS8W3K6vmi3qjgMvGWBndP885
 QrOSkxo7qWdhQSvxvBA6ue7RJbqCZrpGF2mixJSqOSZUz3UFsrwd8ALY9/+hbT0/8xn9ahTrqG1PQ
 eATbVXX70j+KmydsjgN1nvyKRRDaltYZAvMQxxBRFA+7XLb/MD67v6kCMAK858swtI7c=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6ql-0003i0-I3
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:58:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6ql-0005xj-HI
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:58:07 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] VT-x: extend LBR Broadwell errata coverage
Message-Id: <E1jo6ql-0005xj-HI@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 14:58: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 c3eea2cfc8d0433db221edc13709972667c12f24
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jun 24 16:37:37 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:37:37 2020 +0200

    VT-x: extend LBR Broadwell errata coverage
    
    For lbr_tsx_fixup_check() simply name a few more specific erratum
    numbers.
    
    For bdf93_fixup_check(), however, more models are affected. Oddly enough
    despite being the same model and stepping, the erratum is listed for
    Xeon E3 but not its Core counterpart. Apply the workaround uniformly,
    and also for Xeon D, which only has the LBR-from one listed in its spec
    update.
    
    Seeing this broader applicability, rename anything BDF93-related to more
    generic names.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: 724913de8ac8426d313a4645741d86c1169ae406
    master date: 2020-05-28 12:03:25 +0200
---
 xen/arch/x86/hvm/vmx/vmx.c | 52 ++++++++++++++++++++++++++++++----------------
 1 file changed, 34 insertions(+), 18 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index e70096b798..2be74aa8c3 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2375,7 +2375,7 @@ static void pi_notification_interrupt(struct cpu_user_regs *regs)
 }
 
 static void __init lbr_tsx_fixup_check(void);
-static void __init bdf93_fixup_check(void);
+static void __init ler_to_fixup_check(void);
 
 /*
  * Calculate whether the CPU is vulnerable to Instruction Fetch page
@@ -2551,7 +2551,7 @@ const struct hvm_function_table * __init start_vmx(void)
     setup_vmcs_dump();
 
     lbr_tsx_fixup_check();
-    bdf93_fixup_check();
+    ler_to_fixup_check();
 
     return &vmx_function_table;
 }
@@ -2827,11 +2827,11 @@ enum
 
 #define LBR_MSRS_INSERTED      (1u << 0)
 #define LBR_FIXUP_TSX          (1u << 1)
-#define LBR_FIXUP_BDF93        (1u << 2)
-#define LBR_FIXUP_MASK         (LBR_FIXUP_TSX | LBR_FIXUP_BDF93)
+#define LBR_FIXUP_LER_TO       (1u << 2)
+#define LBR_FIXUP_MASK         (LBR_FIXUP_TSX | LBR_FIXUP_LER_TO)
 
 static bool __read_mostly lbr_tsx_fixup_needed;
-static bool __read_mostly bdf93_fixup_needed;
+static bool __read_mostly ler_to_fixup_needed;
 
 static void __init lbr_tsx_fixup_check(void)
 {
@@ -2839,7 +2839,7 @@ static void __init lbr_tsx_fixup_check(void)
     uint32_t lbr_format;
 
     /*
-     * HSM182, HSD172, HSE117, BDM127, BDD117, BDF85, BDE105:
+     * Haswell erratum HSM182 et al, Broadwell erratum BDM127 et al:
      *
      * On processors that do not support Intel Transactional Synchronization
      * Extensions (Intel TSX) (CPUID.07H.EBX bits 4 and 11 are both zero),
@@ -2863,8 +2863,11 @@ static void __init lbr_tsx_fixup_check(void)
     case 0x45: /* HSM182 - 4th gen Core */
     case 0x46: /* HSM182, HSD172 - 4th gen Core (GT3) */
     case 0x3d: /* BDM127 - 5th gen Core */
-    case 0x47: /* BDD117 - 5th gen Core (GT3) */
-    case 0x4f: /* BDF85  - Xeon E5-2600 v4 */
+    case 0x47: /* BDD117 - 5th gen Core (GT3)
+                  BDW117 - Xeon E3-1200 v4 */
+    case 0x4f: /* BDF85  - Xeon E5-2600 v4
+                  BDH75  - Core-i7 for LGA2011-v3 Socket
+                  BDX88  - Xeon E7-x800 v4 */
     case 0x56: /* BDE105 - Xeon D-1500 */
         break;
     default:
@@ -2885,18 +2888,31 @@ static void __init lbr_tsx_fixup_check(void)
         lbr_tsx_fixup_needed = true;
 }
 
-static void __init bdf93_fixup_check(void)
+static void __init ler_to_fixup_check(void)
 {
     /*
-     * Broadwell erratum BDF93:
+     * Broadwell erratum BDF93 et al:
      *
      * Reads from MSR_LER_TO_LIP (MSR 1DEH) may return values for bits[63:61]
      * that are not equal to bit[47].  Attempting to context switch this value
      * may cause a #GP.  Software should sign extend the MSR.
      */
-    if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
-         boot_cpu_data.x86 == 6 && boot_cpu_data.x86_model == 0x4f )
-        bdf93_fixup_needed = true;
+    if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL ||
+         boot_cpu_data.x86 != 6 )
+        return;
+
+    switch ( boot_cpu_data.x86_model )
+    {
+    case 0x3d: /* BDM131 - 5th gen Core */
+    case 0x47: /* BDD??? - 5th gen Core (H-Processor line)
+                  BDW120 - Xeon E3-1200 v4 */
+    case 0x4f: /* BDF93  - Xeon E5-2600 v4
+                  BDH80  - Core-i7 for LGA2011-v3 Socket
+                  BDX93  - Xeon E7-x800 v4 */
+    case 0x56: /* BDE??? - Xeon D-1500 */
+        ler_to_fixup_needed = true;
+        break;
+    }
 }
 
 static int is_last_branch_msr(u32 ecx)
@@ -3257,8 +3273,8 @@ static int vmx_msr_write_intercept(unsigned int msr, uint64_t msr_content)
             v->arch.hvm.vmx.lbr_flags |= LBR_MSRS_INSERTED;
             if ( lbr_tsx_fixup_needed )
                 v->arch.hvm.vmx.lbr_flags |= LBR_FIXUP_TSX;
-            if ( bdf93_fixup_needed )
-                v->arch.hvm.vmx.lbr_flags |= LBR_FIXUP_BDF93;
+            if ( ler_to_fixup_needed )
+                v->arch.hvm.vmx.lbr_flags |= LBR_FIXUP_LER_TO;
         }
 
         __vmwrite(GUEST_IA32_DEBUGCTL, msr_content);
@@ -4319,7 +4335,7 @@ static void sign_extend_msr(struct vcpu *v, u32 msr, int type)
         entry->data = canonicalise_addr(entry->data);
 }
 
-static void bdf93_fixup(void)
+static void ler_to_fixup(void)
 {
     struct vcpu *curr = current;
 
@@ -4332,8 +4348,8 @@ static void lbr_fixup(void)
 
     if ( curr->arch.hvm.vmx.lbr_flags & LBR_FIXUP_TSX )
         lbr_tsx_fixup();
-    if ( curr->arch.hvm.vmx.lbr_flags & LBR_FIXUP_BDF93 )
-        bdf93_fixup();
+    if ( curr->arch.hvm.vmx.lbr_flags & LBR_FIXUP_LER_TO )
+        ler_to_fixup();
 }
 
 /* Returns false if the vmentry has to be restarted */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 14:58:19 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 14:58: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 1jo6qx-0005Sc-OL; Wed, 24 Jun 2020 14:58: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo6qw-0005Ro-9L
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:58:18 +0000
X-Inumbo-ID: 231cad36-b62b-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 231cad36-b62b-11ea-bb8b-bc764e2007e4;
 Wed, 24 Jun 2020 14:58: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=eDPtM/z6zxlJHnsNd/1mJ2n6luVYu0idXQX34av0wWE=; b=u9F9npHrKqneA6wr3wdcUG8hDc
 6bX79X0Xqlnbw4dOJqC/2NeBdu0lBskl7uHdhkvo7W1XoKlTDMDtKcHnLyrXijQwhofqnUkqoBbYs
 LjamUVUREEEpd1c+AUkRXD+jHYBbqmU9b1oueVlhY/XG7/tqCW+xFqOcEXPxI0n6UHhA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6qv-0003i7-LK
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:58:17 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6qv-0005yj-KV
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:58:17 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] x86/hvm: Improve error information in handle_pio()
Message-Id: <E1jo6qv-0005yj-KV@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 14:58: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 350aaca679576ed69c6ec795c89c9e6284b44420
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 24 16:38:16 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:38:16 2020 +0200

    x86/hvm: Improve error information in handle_pio()
    
    domain_crash() should always have a message which is emitted even in release
    builds, so something more useful than this is presented to the user.
    
      (XEN) domain_crash called from io.c:171
      (XEN) domain_crash called from io.c:171
      (XEN) domain_crash called from io.c:171
      ...
    
    To avoid possibly printing stack rubble, initialise data to ~0 right away.
    Furthermore, the maximum access size is 4, so drop data from long to int.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 4609fc8eb04e6af531d86923c9d057f32a96b7d8
    master date: 2020-05-29 16:25:05 +0100
---
 xen/arch/x86/hvm/io.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/hvm/io.c b/xen/arch/x86/hvm/io.c
index a5b0a23f06..724ab44a76 100644
--- a/xen/arch/x86/hvm/io.c
+++ b/xen/arch/x86/hvm/io.c
@@ -132,13 +132,15 @@ bool handle_pio(uint16_t port, unsigned int size, int dir)
 {
     struct vcpu *curr = current;
     struct hvm_vcpu_io *vio = &curr->arch.hvm.hvm_io;
-    unsigned long data;
+    unsigned int data;
     int rc;
 
     ASSERT((size - 1) < 4 && size != 3);
 
     if ( dir == IOREQ_WRITE )
         data = guest_cpu_user_regs()->eax;
+    else
+        data = ~0; /* Avoid any risk of stack rubble. */
 
     rc = hvmemul_do_pio_buffer(port, size, dir, &data);
 
@@ -151,7 +153,7 @@ bool handle_pio(uint16_t port, unsigned int size, int dir)
         if ( dir == IOREQ_READ )
         {
             if ( size == 4 ) /* Needs zero extension. */
-                guest_cpu_user_regs()->rax = (uint32_t)data;
+                guest_cpu_user_regs()->rax = data;
             else
                 memcpy(&guest_cpu_user_regs()->rax, &data, size);
         }
@@ -167,7 +169,9 @@ bool handle_pio(uint16_t port, unsigned int size, int dir)
         break;
 
     default:
-        gdprintk(XENLOG_ERR, "Weird HVM ioemulation status %d.\n", rc);
+        gprintk(XENLOG_ERR, "Unexpected PIO status %d, port %#x %s 0x%0*x\n",
+                rc, port, dir == IOREQ_WRITE ? "write" : "read",
+                size * 2, data & ((1u << (size * 8)) - 1));
         domain_crash(curr->domain);
         return false;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 14:58:29 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 14:58: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 1jo6r7-0005Tq-Pv; Wed, 24 Jun 2020 14:58: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo6r6-0005Tg-Mc
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:58:28 +0000
X-Inumbo-ID: 29235dce-b62b-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 29235dce-b62b-11ea-b7bb-bc764e2007e4;
 Wed, 24 Jun 2020 14:58: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=D4QER1wY1HqyIeciGgApHvHGNit6mFfr/nwa7ZybNx8=; b=l4oLKdxtRBYJmn27qD70evQYBu
 r4d3OUUqCLln1BSCxTOyiwReTfecH+5BNUckdsTet89m7cG1xjjA/AVFoQwQNNg2xTDdRvpfG7+fg
 S5XY/f3GR+9XKsFI/NnY3oGp9cQ+ToyioBO4CDjKgGX3mTNKKAHJ3DqX3qEA3C5I5MgQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6r5-0003iH-P6
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:58:27 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6r5-0005zJ-OJ
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:58:27 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] x86emul: address x86_insn_is_mem_{access,
 write}() omissions
Message-Id: <E1jo6r5-0005zJ-OJ@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 14:58: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 ea7e8d2aa913c9ca95cc3dfb1314e439b21b6e68
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jun 24 16:38:52 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:38:52 2020 +0200

    x86emul: address x86_insn_is_mem_{access,write}() omissions
    
    First of all explain in comments what the functions' purposes are. Then
    make them actually match their comments.
    
    Note that fc6fa977be54 ("x86emul: extend x86_insn_is_mem_write()
    coverage") didn't actually fix the function's behavior for {,V}STMXCSR:
    Both are covered by generic code higher up in the function, due to
    x86_decode_twobyte() already doing suitable adjustments. And VSTMXCSR
    wouldn't have been covered anyway without a further X86EMUL_OPC_VEX()
    case label. Keep the inner case label in a comment for reference.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: e28d13eeb65c25c0bd56e8bfa83c7473047d778d
    master date: 2020-05-29 17:28:04 +0200
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 126 ++++++++++++++++++++++++++++++---
 1 file changed, 118 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 0a3ef4a9fe..76c7aa72f6 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -11318,25 +11318,87 @@ x86_insn_operand_ea(const struct x86_emulate_state *state,
     return state->ea.mem.off;
 }
 
+/*
+ * This function means to return 'true' for all supported insns with explicit
+ * accesses to memory.  This means also insns which don't have an explicit
+ * memory operand (like POP), but it does not mean e.g. segment selector
+ * loads, where the descriptor table access is considered an implicit one.
+ */
 bool
 x86_insn_is_mem_access(const struct x86_emulate_state *state,
                        const struct x86_emulate_ctxt *ctxt)
 {
+    if ( mode_64bit() && state->not_64bit )
+        return false;
+
     if ( state->ea.type == OP_MEM )
-        return ctxt->opcode != 0x8d /* LEA */ &&
-               (ctxt->opcode != X86EMUL_OPC(0x0f, 0x01) ||
-                (state->modrm_reg & 7) != 7) /* INVLPG */;
+    {
+        switch ( ctxt->opcode )
+        {
+        case 0x8d: /* LEA */
+        case X86EMUL_OPC(0x0f, 0x0d): /* PREFETCH */
+        case X86EMUL_OPC(0x0f, 0x18)
+         ... X86EMUL_OPC(0x0f, 0x1f): /* NOP space */
+        case X86EMUL_OPC_66(0x0f, 0x18)
+         ... X86EMUL_OPC_66(0x0f, 0x1f): /* NOP space */
+        case X86EMUL_OPC_F3(0x0f, 0x18)
+         ... X86EMUL_OPC_F3(0x0f, 0x1f): /* NOP space */
+        case X86EMUL_OPC_F2(0x0f, 0x18)
+         ... X86EMUL_OPC_F2(0x0f, 0x1f): /* NOP space */
+        case X86EMUL_OPC(0x0f, 0xb9): /* UD1 */
+        case X86EMUL_OPC(0x0f, 0xff): /* UD0 */
+            return false;
+
+        case X86EMUL_OPC(0x0f, 0x01):
+            return (state->modrm_reg & 7) != 7; /* INVLPG */
+
+        case X86EMUL_OPC(0x0f, 0xae):
+            return (state->modrm_reg & 7) != 7; /* CLFLUSH */
+
+        case X86EMUL_OPC_66(0x0f, 0xae):
+            return (state->modrm_reg & 7) < 6; /* CLWB, CLFLUSHOPT */
+        }
+
+        return true;
+    }
 
     switch ( ctxt->opcode )
     {
+    case 0x06 ... 0x07: /* PUSH / POP %es */
+    case 0x0e:          /* PUSH %cs */
+    case 0x16 ... 0x17: /* PUSH / POP %ss */
+    case 0x1e ... 0x1f: /* PUSH / POP %ds */
+    case 0x50 ... 0x5f: /* PUSH / POP reg */
+    case 0x60 ... 0x61: /* PUSHA / POPA */
+    case 0x68: case 0x6a: /* PUSH imm */
     case 0x6c ... 0x6f: /* INS / OUTS */
+    case 0x8f:          /* POP r/m */
+    case 0x9a:          /* CALL (far, direct) */
+    case 0x9c ... 0x9d: /* PUSHF / POPF */
     case 0xa4 ... 0xa7: /* MOVS / CMPS */
     case 0xaa ... 0xaf: /* STOS / LODS / SCAS */
+    case 0xc2 ... 0xc3: /* RET (near) */
+    case 0xc8 ... 0xc9: /* ENTER / LEAVE */
+    case 0xca ... 0xcb: /* RET (far) */
     case 0xd7:          /* XLAT */
+    case 0xe8:          /* CALL (near, direct) */
+    case X86EMUL_OPC(0x0f, 0xa0):         /* PUSH %fs */
+    case X86EMUL_OPC(0x0f, 0xa1):         /* POP %fs */
+    case X86EMUL_OPC(0x0f, 0xa8):         /* PUSH %gs */
+    case X86EMUL_OPC(0x0f, 0xa9):         /* POP %gs */
     CASE_SIMD_PACKED_INT(0x0f, 0xf7):    /* MASKMOV{Q,DQU} */
     case X86EMUL_OPC_VEX_66(0x0f, 0xf7): /* VMASKMOVDQU */
         return true;
 
+    case 0xff:
+        switch ( state->modrm_reg & 7 )
+        {
+        case 2: /* CALL (near, indirect) */
+        case 6: /* PUSH r/m */
+            return true;
+        }
+        break;
+
     case X86EMUL_OPC(0x0f, 0x01):
         /* Cover CLZERO. */
         return (state->modrm_rm & 7) == 4 && (state->modrm_reg & 7) == 7;
@@ -11345,10 +11407,20 @@ x86_insn_is_mem_access(const struct x86_emulate_state *state,
     return false;
 }
 
+/*
+ * This function means to return 'true' for all supported insns with explicit
+ * writes to memory.  This means also insns which don't have an explicit
+ * memory operand (like PUSH), but it does not mean e.g. segment selector
+ * loads, where the (possible) descriptor table write is considered an
+ * implicit access.
+ */
 bool
 x86_insn_is_mem_write(const struct x86_emulate_state *state,
                       const struct x86_emulate_ctxt *ctxt)
 {
+    if ( mode_64bit() && state->not_64bit )
+        return false;
+
     switch ( state->desc & DstMask )
     {
     case DstMem:
@@ -11360,19 +11432,48 @@ x86_insn_is_mem_write(const struct x86_emulate_state *state,
         break;
 
     default:
+        switch ( ctxt->opcode )
+        {
+        case 0x63:                         /* ARPL */
+            return !mode_64bit();
+        }
+
         return false;
     }
 
     if ( state->modrm_mod == 3 )
-        /* CLZERO is the odd one. */
-        return ctxt->opcode == X86EMUL_OPC(0x0f, 0x01) &&
-               (state->modrm_rm & 7) == 4 && (state->modrm_reg & 7) == 7;
+    {
+        switch ( ctxt->opcode )
+        {
+        case 0xff: /* Grp5 */
+            break;
+
+        case X86EMUL_OPC(0x0f, 0x01): /* CLZERO is the odd one. */
+            return (state->modrm_rm & 7) == 4 && (state->modrm_reg & 7) == 7;
+
+        default:
+            return false;
+        }
+    }
 
     switch ( ctxt->opcode )
     {
+    case 0x06:                           /* PUSH %es */
+    case 0x0e:                           /* PUSH %cs */
+    case 0x16:                           /* PUSH %ss */
+    case 0x1e:                           /* PUSH %ds */
+    case 0x50 ... 0x57:                  /* PUSH reg */
+    case 0x60:                           /* PUSHA */
+    case 0x68: case 0x6a:                /* PUSH imm */
     case 0x6c: case 0x6d:                /* INS */
+    case 0x9a:                           /* CALL (far, direct) */
+    case 0x9c:                           /* PUSHF */
     case 0xa4: case 0xa5:                /* MOVS */
     case 0xaa: case 0xab:                /* STOS */
+    case 0xc8:                           /* ENTER */
+    case 0xe8:                           /* CALL (near, direct) */
+    case X86EMUL_OPC(0x0f, 0xa0):        /* PUSH %fs */
+    case X86EMUL_OPC(0x0f, 0xa8):        /* PUSH %gs */
     case X86EMUL_OPC(0x0f, 0xab):        /* BTS */
     case X86EMUL_OPC(0x0f, 0xb3):        /* BTR */
     case X86EMUL_OPC(0x0f, 0xbb):        /* BTC */
@@ -11430,6 +11531,16 @@ x86_insn_is_mem_write(const struct x86_emulate_state *state,
         }
         break;
 
+    case 0xff:
+        switch ( state->modrm_reg & 7 )
+        {
+        case 2: /* CALL (near, indirect) */
+        case 3: /* CALL (far, indirect) */
+        case 6: /* PUSH r/m */
+            return true;
+        }
+        break;
+
     case X86EMUL_OPC(0x0f, 0x01):
         switch ( state->modrm_reg & 7 )
         {
@@ -11444,7 +11555,7 @@ x86_insn_is_mem_write(const struct x86_emulate_state *state,
         switch ( state->modrm_reg & 7 )
         {
         case 0: /* FXSAVE */
-        case 3: /* {,V}STMXCSR */
+        /* case 3: STMXCSR - handled above */
         case 4: /* XSAVE */
         case 6: /* XSAVEOPT */
             return true;
@@ -11460,7 +11571,6 @@ x86_insn_is_mem_write(const struct x86_emulate_state *state,
         case 1: /* CMPXCHG{8,16}B */
         case 4: /* XSAVEC */
         case 5: /* XSAVES */
-        case 7: /* VMPTRST */
             return true;
         }
         break;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 14:58:39 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 14:58: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 1jo6rH-0005Uh-RW; Wed, 24 Jun 2020 14:58: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo6rG-0005UY-KQ
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:58:38 +0000
X-Inumbo-ID: 2f2be36c-b62b-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 2f2be36c-b62b-11ea-bb8b-bc764e2007e4;
 Wed, 24 Jun 2020 14:58: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=t1EbdhUBvDDl78UrmkxPjzk0jCYYZc7FclaiuMbkTSY=; b=PJm+QS5jDEUORO30mRa4kc+ukD
 pT9GF82uDomj/dzyo41VMrBezdT60VsuSnRQUKd86Q45CGf3v2KjPKAqx7UUNZJ3bVRJ1LtcRo/wO
 g4QhjFDrl9RBkXIlkRyE/Rgd8uXHA1idlUtjXfLkJf9yiDlLdUGVvL7Hu9JbHSVji66k=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6rF-0003iP-Sj
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:58:37 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6rF-000608-Ry
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:58:37 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] x86emul: rework CMP and TEST emulation
Message-Id: <E1jo6rF-000608-Ry@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 14:58: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 8ad99de837434a3e8cf16f7570d196cf2a8da9a3
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jun 24 16:39:32 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:39:32 2020 +0200

    x86emul: rework CMP and TEST emulation
    
    Unlike similarly encoded insns these don't write their memory operands,
    and hence x86_is_mem_write() should return false for them. However,
    rather than adding special logic there, rework how their emulation gets
    done, by making decoding attributes properly describe the r/o nature of
    their memory operands:
    -  change the table entries for opcodes 0x38 and 0x39, with no other
       adjustments to the attributes later on,
    -  for the other opcodes, leave the table entries as they are, and
       override the attributes for the specific sub-cases (identified by
       ModRM.reg).
    
    For opcodes 0x38 and 0x39 the change of the table entries implies
    changing the order of operands as passed to emulate_2op_SrcV(), hence
    the splitting of the cases in the main switch().
    
    Note how this also allows dropping custom LOCK prefix checks.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 20bc1b9cc99b70b17757e1903f629c7a26584790
    master date: 2020-05-29 17:28:45 +0200
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 37 +++++++++++++++++++++-------------
 1 file changed, 23 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 76c7aa72f6..3a60c6f3f2 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -84,7 +84,7 @@ static const opcode_desc_t opcode_table[256] = {
     ByteOp|DstReg|SrcMem|ModRM, DstReg|SrcMem|ModRM,
     ByteOp|DstEax|SrcImm, DstEax|SrcImm, 0, ImplicitOps,
     /* 0x38 - 0x3F */
-    ByteOp|DstMem|SrcReg|ModRM, DstMem|SrcReg|ModRM,
+    ByteOp|DstReg|SrcMem|ModRM, DstReg|SrcMem|ModRM,
     ByteOp|DstReg|SrcMem|ModRM, DstReg|SrcMem|ModRM,
     ByteOp|DstEax|SrcImm, DstEax|SrcImm, 0, ImplicitOps,
     /* 0x40 - 0x4F */
@@ -2471,7 +2471,6 @@ x86_decode_onebyte(
     case 0x60: /* pusha */
     case 0x61: /* popa */
     case 0x62: /* bound */
-    case 0x82: /* Grp1 (x86/32 only) */
     case 0xc4: /* les */
     case 0xc5: /* lds */
     case 0xce: /* into */
@@ -2481,6 +2480,14 @@ x86_decode_onebyte(
         state->not_64bit = true;
         break;
 
+    case 0x82: /* Grp1 (x86/32 only) */
+        state->not_64bit = true;
+        /* fall through */
+    case 0x80: case 0x81: case 0x83: /* Grp1 */
+        if ( (modrm_reg & 7) == 7 ) /* cmp */
+            state->desc = (state->desc & ByteOp) | DstNone | SrcMem;
+        break;
+
     case 0x90: /* nop / pause */
         if ( repe_prefix() )
             ctxt->opcode |= X86EMUL_OPC_F3(0, 0);
@@ -2511,6 +2518,11 @@ x86_decode_onebyte(
         imm2 = insn_fetch_type(uint8_t);
         break;
 
+    case 0xf6: case 0xf7: /* Grp3 */
+        if ( !(modrm_reg & 6) ) /* test */
+            state->desc = (state->desc & ByteOp) | DstNone | SrcMem;
+        break;
+
     case 0xff: /* Grp5 */
         switch ( modrm_reg & 7 )
         {
@@ -3894,13 +3906,11 @@ x86_emulate(
         break;
 
     case 0x38: case 0x39: cmp: /* cmp reg,mem */
-        if ( ops->rmw && dst.type == OP_MEM &&
-             (rc = read_ulong(dst.mem.seg, dst.mem.off, &dst.val,
-                              dst.bytes, ctxt, ops)) != X86EMUL_OKAY )
-            goto done;
-        /* fall through */
+        emulate_2op_SrcV("cmp", dst, src, _regs.eflags);
+        dst.type = OP_NONE;
+        break;
+
     case 0x3a ... 0x3d: /* cmp */
-        generate_exception_if(lock_prefix, EXC_UD);
         emulate_2op_SrcV("cmp", src, dst, _regs.eflags);
         dst.type = OP_NONE;
         break;
@@ -4207,7 +4217,9 @@ x86_emulate(
         case 4: goto and;
         case 5: goto sub;
         case 6: goto xor;
-        case 7: goto cmp;
+        case 7:
+            dst.val = imm1;
+            goto cmp;
         }
         break;
 
@@ -5200,11 +5212,8 @@ x86_emulate(
             unsigned long u[2], v;
 
         case 0 ... 1: /* test */
-            generate_exception_if(lock_prefix, EXC_UD);
-            if ( ops->rmw && dst.type == OP_MEM &&
-                 (rc = read_ulong(dst.mem.seg, dst.mem.off, &dst.val,
-                                  dst.bytes, ctxt, ops)) != X86EMUL_OKAY )
-                goto done;
+            dst.val = imm1;
+            dst.bytes = src.bytes;
             goto test;
         case 2: /* not */
             if ( ops->rmw && dst.type == OP_MEM )
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 14:58:49 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 14:58: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 1jo6rR-0005Vo-Tm; Wed, 24 Jun 2020 14:58: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo6rQ-0005Ve-K9
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:58:48 +0000
X-Inumbo-ID: 3535b666-b62b-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 3535b666-b62b-11ea-b7bb-bc764e2007e4;
 Wed, 24 Jun 2020 14:58: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=IPDIaGzgHSv+Y5vI3ZH6PSYRaZCWBuX60WE92eNSd74=; b=YMGIWHo9gPlLt77itgV8jJsRBp
 tDFDx1usJS/+k9CUh2I2JoVbSF6feS5llLnpX7eXsETIlIBV7mYWWB0uP9witUP9t4+dDfvcD4ETC
 Cecml6tFqspJCDLEw3Q4GWMDLhnPlCLycVjU8JgE+vNpEB7E0x3rQ43q5KtGtlnLOD1c=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6rQ-0003iW-0y
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:58:48 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6rP-00061O-VW
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:58:47 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] x86/mm: do not attempt to convert _PAGE_GNTTAB to
 a boolean
Message-Id: <E1jo6rP-00061O-VW@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 14:58: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 0243559f45a79f56d3720b63f4bea3cc6e4aaa61
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Jun 24 16:40:10 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:40:10 2020 +0200

    x86/mm: do not attempt to convert _PAGE_GNTTAB to a boolean
    
    Clang 10 complains with:
    
    mm.c:1239:10: error: converting the result of '<<' to a boolean always evaluates to true
          [-Werror,-Wtautological-constant-compare]
        if ( _PAGE_GNTTAB && (l1e_get_flags(l1e) & _PAGE_GNTTAB) &&
             ^
    xen/include/asm/x86_64/page.h:161:25: note: expanded from macro '_PAGE_GNTTAB'
    #define _PAGE_GNTTAB (1U<<22)
                            ^
    
    Remove the conversion of _PAGE_GNTTAB to a boolean and instead use a
    preprocessor conditional to check if _PAGE_GNTTAB is defined.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 6eb61b1a9dfe23ca443f977799cafb22770708a0
    master date: 2020-06-02 13:36:41 +0200
---
 xen/arch/x86/mm.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 97c8d73b7b..30dffb68e8 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -1236,8 +1236,14 @@ void put_page_from_l1e(l1_pgentry_t l1e, struct domain *l1e_owner)
      *
      * (Note that the undestroyable active grants are not a security hole in
      * Xen. All active grants can safely be cleaned up when the domain dies.)
+     *
+     * NB: the preprocessor conditional is required in order to prevent clang's
+     * -Wtautological-constant-compare complaining about converting the result
+     * of a << into a bool is always true if it's evaluated directly in the if
+     * condition.
      */
-    if ( _PAGE_GNTTAB && (l1e_get_flags(l1e) & _PAGE_GNTTAB) &&
+#if _PAGE_GNTTAB
+    if ( (l1e_get_flags(l1e) & _PAGE_GNTTAB) &&
          !l1e_owner->is_shutting_down && !l1e_owner->is_dying )
     {
         gdprintk(XENLOG_WARNING,
@@ -1245,6 +1251,7 @@ void put_page_from_l1e(l1_pgentry_t l1e, struct domain *l1e_owner)
                  l1e_get_intpte(l1e));
         domain_crash(l1e_owner);
     }
+#endif
 
     /*
      * Remember we didn't take a type-count of foreign writable mappings
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 14:58:59 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 14:58: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 1jo6rb-0005Wr-VO; Wed, 24 Jun 2020 14:58: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo6ra-0005Wc-LJ
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:58:58 +0000
X-Inumbo-ID: 3b3a2e2a-b62b-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 3b3a2e2a-b62b-11ea-bb8b-bc764e2007e4;
 Wed, 24 Jun 2020 14:58: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=vDKMLhRZdYytnbcteAlj5d+Y+chrOSRnnJsfIuHSunE=; b=4BiTdVZ51KGVI1SiKma24Lq6md
 Q42lkH2+RVOTnaOFErJH9w7+xIgodnmtZgDFwKClNYpdKUSlnKApnPidhkvYvO72esdH5jwQvGAlM
 KIyFKG/QE631yChxTSatpHdJzyNcI0OWCnSzF+HONcnecn+1jb1+78/C18/Xr0pwwZo4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6ra-0003ie-45
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:58:58 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6ra-000621-3N
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:58:58 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] build32: don't discard .shstrtab in linker script
Message-Id: <E1jo6ra-000621-3N@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 14:58: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 74ce65c012e9b286842336fd9b02fea8cea34602
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Jun 24 16:41:06 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:41:06 2020 +0200

    build32: don't discard .shstrtab in linker script
    
    LLVM linker doesn't support discarding .shstrtab, and complains with:
    
    ld -melf_i386_fbsd -N -T build32.lds -o reloc.lnk reloc.o
    ld: error: discarding .shstrtab section is not allowed
    
    Add an explicit .shstrtab, .strtab and .symtab sections to the linker
    script after the text section in order to make LLVM LD happy and match
    the behavior of GNU LD.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 10d27b48b5b4dfbead2d9bf03290984bba4806e4
    master date: 2020-06-02 13:37:53 +0200
---
 xen/arch/x86/boot/build32.lds | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/xen/arch/x86/boot/build32.lds b/xen/arch/x86/boot/build32.lds
index 97454b40ff..1ab9418793 100644
--- a/xen/arch/x86/boot/build32.lds
+++ b/xen/arch/x86/boot/build32.lds
@@ -50,6 +50,20 @@ SECTIONS
         *(.got.plt)
   }
 
+  /*
+   * Discarding .shstrtab is not supported by LLD (LLVM LD) and will trigger an
+   * error. Also keep the rest of the control sections to match GNU LD behavior.
+   */
+  .shstrtab : {
+        *(.shstrtab)
+  }
+  .strtab : {
+        *(.strtab)
+  }
+  .symtab : {
+        *(.symtab)
+  }
+
   /DISCARD/ : {
         /*
          * Discard everything else, to prevent linkers from putting
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 14:59:10 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 14:59: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 1jo6rm-0005YB-2a; Wed, 24 Jun 2020 14:59:10 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo6rk-0005Y0-TV
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:59:08 +0000
X-Inumbo-ID: 413fd28e-b62b-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 413fd28e-b62b-11ea-8496-bc764e2007e4;
 Wed, 24 Jun 2020 14:59: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=miL1i1QqTja3GR6EO3nutQe87RbI1vfPe2cbgdroEKk=; b=gqK9xxYPxXfmvpxOt1Y9VKeh0R
 P9o9IUP1Kz709VMx5yrGxjX/Kk8xg2fZRzHz9P47IBJRq71/jUtMRBxmNqaEq9RrNSOi3Q1j1R7Ir
 tT66Dh88R9PQvZN6vYA+GHyruG+5DS/zUb85AspLdG4DA/c4ojdQOszLr/s1X4qBfzpo=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6rk-0003jd-7B
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:59:08 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6rk-00062k-6Q
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:59:08 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] x86/boot: Fix load_system_tables() to be
 NMI/#MC-safe
Message-Id: <E1jo6rk-00062k-6Q@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 14:59:08 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit b4afe058c679bd3a3370d041c1c373e9cfb800d3
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 24 16:41:57 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:41:57 2020 +0200

    x86/boot: Fix load_system_tables() to be NMI/#MC-safe
    
    During boot, load_system_tables() is used in reinit_bsp_stack() to switch the
    virtual addresses used from their .data/.bss alias, to their directmap alias.
    
    The structure assignment is implemented as a memset() to zero first, then a
    copy-in of the new data.  This causes the NMI/#MC stack pointers to
    transiently become 0, at a point where we may have an NMI watchdog running.
    
    Rewrite the logic using a volatile tss pointer (equivalent to, but more
    readable than, using ACCESS_ONCE() for all writes).
    
    This does drop the zeroing side effect for holes in the structure, but the
    backing memory for the TSS is fully zeroed anyway, and architecturally, they
    are all reserved.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 9f3e9139fa6c3d620eb08dff927518fc88200b8d
    master date: 2020-05-27 16:44:04 +0100
---
 xen/arch/x86/cpu/common.c | 49 ++++++++++++++++++++++-------------------------
 1 file changed, 23 insertions(+), 26 deletions(-)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index e370226485..4317c06670 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -729,11 +729,12 @@ static cpumask_t cpu_initialized;
  */
 void load_system_tables(void)
 {
-	unsigned int cpu = smp_processor_id();
+	unsigned int i, cpu = smp_processor_id();
 	unsigned long stack_bottom = get_stack_bottom(),
 		stack_top = stack_bottom & ~(STACK_SIZE - 1);
 
-	struct tss64 *tss = &this_cpu(tss_page).tss;
+	/* The TSS may be live.	 Disuade any clever optimisations. */
+	volatile struct tss64 *tss = &this_cpu(tss_page).tss;
 	seg_desc_t *gdt =
 		this_cpu(gdt) - FIRST_RESERVED_GDT_ENTRY;
 	seg_desc_t *compat_gdt =
@@ -748,30 +749,26 @@ void load_system_tables(void)
 		.limit = (IDT_ENTRIES * sizeof(idt_entry_t)) - 1,
 	};
 
-	*tss = (struct tss64){
-		/* Main stack for interrupts/exceptions. */
-		.rsp0 = stack_bottom,
-
-		/* Ring 1 and 2 stacks poisoned. */
-		.rsp1 = 0x8600111111111111ul,
-		.rsp2 = 0x8600111111111111ul,
-
-		/*
-		 * MCE, NMI and Double Fault handlers get their own stacks.
-		 * All others poisoned.
-		 */
-		.ist = {
-			[IST_MCE - 1] = stack_top + IST_MCE * PAGE_SIZE,
-			[IST_DF  - 1] = stack_top + IST_DF  * PAGE_SIZE,
-			[IST_NMI - 1] = stack_top + IST_NMI * PAGE_SIZE,
-			[IST_DB  - 1] = stack_top + IST_DB  * PAGE_SIZE,
-
-			[IST_MAX ... ARRAY_SIZE(tss->ist) - 1] =
-				0x8600111111111111ul,
-		},
-
-		.bitmap = IOBMP_INVALID_OFFSET,
-	};
+	/*
+	 * Set up the TSS.  Warning - may be live, and the NMI/#MC must remain
+	 * valid on every instruction boundary.  (Note: these are all
+	 * semantically ACCESS_ONCE() due to tss's volatile qualifier.)
+	 *
+	 * rsp0 refers to the primary stack.  #MC, #DF, NMI and #DB handlers
+	 * each get their own stacks.  No IO Bitmap.
+	 */
+	tss->rsp0 = stack_bottom;
+	tss->ist[IST_MCE - 1] = stack_top + IST_MCE * PAGE_SIZE;
+	tss->ist[IST_DF  - 1] = stack_top + IST_DF  * PAGE_SIZE;
+	tss->ist[IST_NMI - 1] = stack_top + IST_NMI * PAGE_SIZE;
+	tss->ist[IST_DB  - 1] = stack_top + IST_DB  * PAGE_SIZE;
+	tss->bitmap = IOBMP_INVALID_OFFSET;
+
+	/* All other stack pointers poisioned. */
+	for ( i = IST_MAX; i < ARRAY_SIZE(tss->ist); ++i )
+		tss->ist[i] = 0x8600111111111111ul;
+	tss->rsp1 = 0x8600111111111111ul;
+	tss->rsp2 = 0x8600111111111111ul;
 
 	BUILD_BUG_ON(sizeof(*tss) <= 0x67); /* Mandated by the architecture. */
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 14:59:21 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 14:59:21 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jo6rx-0005Ze-4B; Wed, 24 Jun 2020 14:59:21 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo6rv-0005ZV-Af
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:59:19 +0000
X-Inumbo-ID: 474b5126-b62b-11ea-80e8-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 474b5126-b62b-11ea-80e8-12813bfff9fa;
 Wed, 24 Jun 2020 14:59: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=i7nbZj8uUBUIDECH5B5veXLQo/jSVVAu3D6H1iur1fg=; b=1qVhDB1/1iZZvW2AFaFCGQyppC
 QPOXI5XB29eTe5BcfYAA6z6vC374hqEXh0+mboxCICh3ePC8qExmQ5EDmq9rxrM/+BFatsT27wj9J
 qPFEprIFudHLFKRISo5fo4r/GMrNJC2rXkSnfie/tXy0FZBdUeE2753NZvkav3U7IHwk=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6ru-0003jn-BZ
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:59:18 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6ru-00064e-Aa
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:59:18 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] x86/ucode: Fix errors with start/end_update()
Message-Id: <E1jo6ru-00064e-Aa@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 14:59:18 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 53bafb59e94041c1f46f979e0ce75c69f05564e8
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 24 16:44:54 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:44:54 2020 +0200

    x86/ucode: Fix errors with start/end_update()
    
    c/s 9267a439c "x86/ucode: Document the behaviour of the microcode_ops hooks"
    identified several poor behaviours of the start_update()/end_update_percpu()
    hooks.
    
    AMD have subsequently confirmed that OSVW don't, and are not expected to,
    change across a microcode load, rendering all of this complexity unecessary.
    
    Instead of fixing up the logic to not leave the OSVW state reset in a number
    of corner cases, delete the logic entirely.
    
    This in turn allows for the removal of the poorly-named 'start_update'
    parameter to microcode_update_one(), and for svm_host_osvw_{init,reset}() to
    become static.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 3659f54e9bd31f0f59268402fd67fb4b4118e184
    master date: 2020-06-02 19:18:44 +0100
---
 xen/arch/x86/acpi/power.c         |  2 +-
 xen/arch/x86/hvm/svm/svm.c        |  4 ++--
 xen/arch/x86/microcode.c          | 33 +++------------------------------
 xen/arch/x86/microcode_amd.c      | 18 ------------------
 xen/arch/x86/smpboot.c            |  2 +-
 xen/include/asm-x86/hvm/svm/svm.h |  3 ---
 xen/include/asm-x86/microcode.h   |  2 --
 xen/include/asm-x86/processor.h   |  2 +-
 8 files changed, 8 insertions(+), 58 deletions(-)

diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
index 75c6e34164..ec679c4d3a 100644
--- a/xen/arch/x86/acpi/power.c
+++ b/xen/arch/x86/acpi/power.c
@@ -286,7 +286,7 @@ static int enter_state(u32 state)
     console_end_sync();
     watchdog_enable();
 
-    microcode_update_one(true);
+    microcode_update_one();
 
     if ( !recheck_cpu_features(0) )
         panic("Missing previously available feature(s)\n");
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index dd2ec68650..0cec511b3a 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -1082,7 +1082,7 @@ static void svm_guest_osvw_init(struct domain *d)
     spin_unlock(&osvw_lock);
 }
 
-void svm_host_osvw_reset()
+static void svm_host_osvw_reset(void)
 {
     spin_lock(&osvw_lock);
 
@@ -1092,7 +1092,7 @@ void svm_host_osvw_reset()
     spin_unlock(&osvw_lock);
 }
 
-void svm_host_osvw_init()
+static void svm_host_osvw_init(void)
 {
     spin_lock(&osvw_lock);
 
diff --git a/xen/arch/x86/microcode.c b/xen/arch/x86/microcode.c
index 29b3f42cc2..27ba958d93 100644
--- a/xen/arch/x86/microcode.c
+++ b/xen/arch/x86/microcode.c
@@ -578,9 +578,6 @@ static int do_microcode_update(void *patch)
     else
         ret = secondary_thread_fn();
 
-    if ( microcode_ops->end_update_percpu )
-        microcode_ops->end_update_percpu();
-
     return ret;
 }
 
@@ -652,16 +649,6 @@ static long microcode_update_helper(void *data)
     }
     spin_unlock(&microcode_mutex);
 
-    if ( microcode_ops->start_update )
-    {
-        ret = microcode_ops->start_update();
-        if ( ret )
-        {
-            microcode_free_patch(patch);
-            goto put;
-        }
-    }
-
     cpumask_clear(&cpu_callin_map);
     atomic_set(&cpu_out, 0);
     atomic_set(&cpu_updated, 0);
@@ -760,28 +747,14 @@ static int __init microcode_init(void)
 __initcall(microcode_init);
 
 /* Load a cached update to current cpu */
-int microcode_update_one(bool start_update)
+int microcode_update_one(void)
 {
-    int err;
-
     if ( !microcode_ops )
         return -EOPNOTSUPP;
 
     microcode_ops->collect_cpu_info(&this_cpu(cpu_sig));
 
-    if ( start_update && microcode_ops->start_update )
-    {
-        err = microcode_ops->start_update();
-        if ( err )
-            return err;
-    }
-
-    err = microcode_update_cpu(NULL);
-
-    if ( microcode_ops->end_update_percpu )
-        microcode_ops->end_update_percpu();
-
-    return err;
+    return microcode_update_cpu(NULL);
 }
 
 /* BSP calls this function to parse ucode blob and then apply an update. */
@@ -825,7 +798,7 @@ int __init early_microcode_update_cpu(void)
     spin_unlock(&microcode_mutex);
     ASSERT(rc);
 
-    return microcode_update_one(true);
+    return microcode_update_one();
 }
 
 int __init early_microcode_init(void)
diff --git a/xen/arch/x86/microcode_amd.c b/xen/arch/x86/microcode_amd.c
index 846cf099e8..a5becbfaf4 100644
--- a/xen/arch/x86/microcode_amd.c
+++ b/xen/arch/x86/microcode_amd.c
@@ -24,7 +24,6 @@
 #include <asm/msr.h>
 #include <asm/processor.h>
 #include <asm/microcode.h>
-#include <asm/hvm/svm/svm.h>
 
 #define pr_debug(x...) ((void)0)
 
@@ -590,27 +589,10 @@ static struct microcode_patch *cpu_request_microcode(const void *buf,
     return patch;
 }
 
-#ifdef CONFIG_HVM
-static int start_update(void)
-{
-    /*
-     * svm_host_osvw_init() will be called on each cpu by calling '.end_update'
-     * in common code.
-     */
-    svm_host_osvw_reset();
-
-    return 0;
-}
-#endif
-
 static const struct microcode_ops microcode_amd_ops = {
     .cpu_request_microcode            = cpu_request_microcode,
     .collect_cpu_info                 = collect_cpu_info,
     .apply_microcode                  = apply_microcode,
-#ifdef CONFIG_HVM
-    .start_update                     = start_update,
-    .end_update_percpu                = svm_host_osvw_init,
-#endif
     .free_patch                       = free_patch,
     .compare_patch                    = compare_patch,
     .match_cpu                        = match_cpu,
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index b1e51b3aff..2d525c8b2c 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -358,7 +358,7 @@ void start_secondary(void *unused)
 
     initialize_cpu_data(cpu);
 
-    microcode_update_one(false);
+    microcode_update_one();
 
     /*
      * If any speculative control MSRs are available, apply Xen's default
diff --git a/xen/include/asm-x86/hvm/svm/svm.h b/xen/include/asm-x86/hvm/svm/svm.h
index 16a994ec74..63eebab48a 100644
--- a/xen/include/asm-x86/hvm/svm/svm.h
+++ b/xen/include/asm-x86/hvm/svm/svm.h
@@ -93,9 +93,6 @@ extern u32 svm_feature_flags;
 #define DEFAULT_TSC_RATIO       0x0000000100000000ULL
 #define TSC_RATIO_RSVD_BITS     0xffffff0000000000ULL
 
-extern void svm_host_osvw_reset(void);
-extern void svm_host_osvw_init(void);
-
 /* EXITINFO1 fields on NPT faults */
 #define _NPT_PFEC_with_gla     32
 #define NPT_PFEC_with_gla      (1UL<<_NPT_PFEC_with_gla)
diff --git a/xen/include/asm-x86/microcode.h b/xen/include/asm-x86/microcode.h
index 7d5a1f8e8a..e1350bdc63 100644
--- a/xen/include/asm-x86/microcode.h
+++ b/xen/include/asm-x86/microcode.h
@@ -24,8 +24,6 @@ struct microcode_ops {
                                                      size_t size);
     int (*collect_cpu_info)(struct cpu_signature *csig);
     int (*apply_microcode)(const struct microcode_patch *patch);
-    int (*start_update)(void);
-    void (*end_update_percpu)(void);
     void (*free_patch)(void *mc);
     bool (*match_cpu)(const struct microcode_patch *patch);
     enum microcode_match_result (*compare_patch)(
diff --git a/xen/include/asm-x86/processor.h b/xen/include/asm-x86/processor.h
index 60ad3b7344..970f2af501 100644
--- a/xen/include/asm-x86/processor.h
+++ b/xen/include/asm-x86/processor.h
@@ -586,7 +586,7 @@ void microcode_set_module(unsigned int);
 int microcode_update(XEN_GUEST_HANDLE_PARAM(const_void), unsigned long len);
 int early_microcode_update_cpu(void);
 int early_microcode_init(void);
-int microcode_update_one(bool start_update);
+int microcode_update_one(void);
 int microcode_init_intel(void);
 int microcode_init_amd(void);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 14:59:31 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 14:59:31 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jo6s7-0005af-5k; Wed, 24 Jun 2020 14:59:31 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo6s5-0005aV-HD
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:59:29 +0000
X-Inumbo-ID: 4d527108-b62b-11ea-80e8-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 4d527108-b62b-11ea-80e8-12813bfff9fa;
 Wed, 24 Jun 2020 14:59: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=O8GC7vmInYlQvvgd09XWNmHpQbjagw2DlIeUelOJpe0=; b=i87O0t7zbvc/IF82fELt40UAAg
 vQ7/5005dLPr+2f8qXzJYwKqBPX9YUayYB2EWm8mZpP5pbZbqohHXaN4SfyZYJm0X38XLFK20/1kb
 1ebt7fE+vCQJcLdp8B5dGZnTnot+/RhKrI9m07Rg2YRsc1ll6Jk9ZQ3CdacdfYPhggZs=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6s4-0003ju-FG
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:59:28 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6s4-00065F-EO
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:59:28 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] x86/svm: do not try to handle recalc NPT faults
 immediately
Message-Id: <E1jo6s4-00065F-EO@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 14:59:28 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 11ea967c99b90011f371e64ec063bb6e38bd2b6c
Author:     Igor Druzhinin <igor.druzhinin@citrix.com>
AuthorDate: Wed Jun 24 16:45:59 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:45:59 2020 +0200

    x86/svm: do not try to handle recalc NPT faults immediately
    
    A recalculation NPT fault doesn't always require additional handling
    in hvm_hap_nested_page_fault(), moreover in general case if there is no
    explicit handling done there - the fault is wrongly considered fatal.
    
    This covers a specific case of migration with vGPU assigned which
    uses direct MMIO mappings made by XEN_DOMCTL_memory_mapping hypercall:
    at a moment log-dirty is enabled globally, recalculation is requested
    for the whole guest memory including those mapped MMIO regions
    which causes a page fault being raised at the first access to them;
    but due to MMIO P2M type not having any explicit handling in
    hvm_hap_nested_page_fault() a domain is erroneously crashed with unhandled
    SVM violation.
    
    Instead of trying to be opportunistic - use safer approach and handle
    P2M recalculation in a separate NPT fault by attempting to retry after
    making the necessary adjustments. This is aligned with Intel behavior
    where there are separate VMEXITs for recalculation and EPT violations
    (faults) and only faults are handled in hvm_hap_nested_page_fault().
    Do it by also unifying do_recalc return code with Intel implementation
    where returning 1 means P2M was actually changed.
    
    Since there was no case previously where p2m_pt_handle_deferred_changes()
    could return a positive value - it's safe to replace ">= 0" with just "== 0"
    in VMEXIT_NPF handler. finish_type_change() is also not affected by the
    change as being able to deal with >0 return value of p2m->recalc from
    EPT implementation.
    
    Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 51ca66c37371b10b378513af126646de22eddb17
    master date: 2020-06-05 17:12:11 +0200
---
 xen/arch/x86/hvm/svm/svm.c | 5 +++--
 xen/arch/x86/mm/p2m-pt.c   | 7 ++++++-
 xen/arch/x86/mm/p2m.c      | 2 +-
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 0cec511b3a..8317ef8fb0 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -2947,9 +2947,10 @@ void svm_vmexit_handler(struct cpu_user_regs *regs)
             v->arch.hvm.svm.cached_insn_len = vmcb->guest_ins_len & 0xf;
         rc = vmcb->exitinfo1 & PFEC_page_present
              ? p2m_pt_handle_deferred_changes(vmcb->exitinfo2) : 0;
-        if ( rc >= 0 )
+        if ( rc == 0 )
+            /* If no recal adjustments were being made - handle this fault */
             svm_do_nested_pgfault(v, regs, vmcb->exitinfo1, vmcb->exitinfo2);
-        else
+        else if ( rc < 0 )
         {
             printk(XENLOG_G_ERR
                    "%pv: Error %d handling NPF (gpa=%08lx ec=%04lx)\n",
diff --git a/xen/arch/x86/mm/p2m-pt.c b/xen/arch/x86/mm/p2m-pt.c
index eb66077496..2b74726e39 100644
--- a/xen/arch/x86/mm/p2m-pt.c
+++ b/xen/arch/x86/mm/p2m-pt.c
@@ -341,6 +341,7 @@ static int do_recalc(struct p2m_domain *p2m, unsigned long gfn)
     unsigned int level = 4;
     l1_pgentry_t *pent;
     int err = 0;
+    bool recalc_done = false;
 
     table = map_domain_page(pagetable_get_mfn(p2m_get_pagetable(p2m)));
     while ( --level )
@@ -402,6 +403,8 @@ static int do_recalc(struct p2m_domain *p2m, unsigned long gfn)
                 clear_recalc(l1, e);
                 err = p2m->write_p2m_entry(p2m, gfn, pent, e, level + 1);
                 ASSERT(!err);
+
+                recalc_done = true;
             }
         }
         unmap_domain_page((void *)((unsigned long)pent & PAGE_MASK));
@@ -448,12 +451,14 @@ static int do_recalc(struct p2m_domain *p2m, unsigned long gfn)
             clear_recalc(l1, e);
         err = p2m->write_p2m_entry(p2m, gfn, pent, e, level + 1);
         ASSERT(!err);
+
+        recalc_done = true;
     }
 
  out:
     unmap_domain_page(table);
 
-    return err;
+    return err ?: recalc_done;
 }
 
 int p2m_pt_handle_deferred_changes(uint64_t gpa)
diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index ba126f790a..4039630761 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -1194,7 +1194,7 @@ static int finish_type_change(struct p2m_domain *p2m,
         rc = p2m->recalc(p2m, gfn);
         /*
          * ept->recalc could return 0/1/-ENOMEM. pt->recalc could return
-         * 0/-ENOMEM/-ENOENT, -ENOENT isn't an error as we are looping
+         * 0/1/-ENOMEM/-ENOENT, -ENOENT isn't an error as we are looping
          * gfn here. If rc is 1 we need to have it 0 for success.
          */
         if ( rc == -ENOENT || rc > 0 )
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 14:59:41 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 14:59:41 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jo6sH-0005bj-7K; Wed, 24 Jun 2020 14:59:41 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo6sF-0005bT-7d
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:59:39 +0000
X-Inumbo-ID: 535779cc-b62b-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 535779cc-b62b-11ea-8496-bc764e2007e4;
 Wed, 24 Jun 2020 14:59: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=02695qofG8h4Pu6ih/2o9TYtCAp8zM1Y+RyjgULIx/4=; b=n1UK8L0jEoVeDD8GfO2+bauc0s
 FNGyHMeBWrPfrdnHmjnFXsdbOwt7yWPqCFYGShWcKrllubCu5oTYZfh9tGW4d2877h1brJs70aQmi
 NfZciUNSslatLcmSw/KNN7izyP6SHho9PHqenPx1y+UyPSKsRKFXwMv98VnQEP8DI51w=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6sE-0003k4-IZ
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:59:38 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6sE-00065m-Hl
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:59:38 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] build: fix dependency tracking for preprocessed
 files
Message-Id: <E1jo6sE-00065m-Hl@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 14:59: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 27d4f1ac67a99a7f4d098d7d7339cb9050aa8218
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jun 24 16:46:49 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:46:49 2020 +0200

    build: fix dependency tracking for preprocessed files
    
    While the issue is more general, I noticed that asm-macros.i not getting
    re-generated as needed. This was due to its .*.d file mentioning
    asm-macros.o instead of asm-macros.i. Use -MQ here as well, and while at
    it also use -MQ to avoid the somewhat fragile sed-ary on the *.lds
    dependency tracking files. While there, further avoid open-coding $(CPP)
    and drop the bogus (Arm) / stale (x86) -Ui386.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    master commit: 75131ad75bb3c91717b5dfda6881e61c52bfd22e
    master date: 2020-06-08 10:25:40 +0200
---
 xen/Rules.mk          | 4 ++--
 xen/arch/arm/Makefile | 4 +---
 xen/arch/x86/Makefile | 8 ++------
 3 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/xen/Rules.mk b/xen/Rules.mk
index 9d0e6acc2e..882725d5cd 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -235,13 +235,13 @@ $(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): %.init.o: %.o Makefile
 	$(OBJCOPY) $(foreach s,$(SPECIAL_DATA_SECTIONS),--rename-section .$(s)=.init.$(s)) $< $@
 
 %.i: %.c Makefile
-	$(CPP) $(filter-out -Wa$(comma)%,$(CFLAGS)) $< -o $@
+	$(CPP) $(filter-out -Wa$(comma)%,$(CFLAGS)) -MQ $@ -o $@ $<
 
 %.s: %.c Makefile
 	$(CC) $(filter-out -Wa$(comma)%,$(CFLAGS)) -S $< -o $@
 
 # -std=gnu{89,99} gets confused by # as an end-of-line comment marker
 %.s: %.S Makefile
-	$(CPP) $(filter-out -Wa$(comma)%,$(AFLAGS)) $< -o $@
+	$(CPP) $(filter-out -Wa$(comma)%,$(AFLAGS)) -MQ $@ -o $@ $<
 
 -include $(DEPS_INCLUDE)
diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index 70f532e42a..8edb200245 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -124,9 +124,7 @@ asm-offsets.s: $(TARGET_SUBARCH)/asm-offsets.c
 	$(CC) $(filter-out -flto,$(CFLAGS)) -S -o $@ $<
 
 xen.lds: xen.lds.S
-	$(CC) -P -E -Ui386 $(AFLAGS) -o $@ $<
-	sed -e 's/xen\.lds\.o:/xen\.lds:/g' <.xen.lds.d >.xen.lds.d.new
-	mv -f .xen.lds.d.new .xen.lds.d
+	$(CPP) -P $(AFLAGS) -MQ $@ -o $@ $<
 
 dtb.o: $(CONFIG_DTB_FILE)
 
diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index a0b2f4ab15..00d7dbe51b 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -241,14 +241,10 @@ $(BASEDIR)/include/asm-x86/asm-macros.h: asm-macros.i Makefile
 	$(call move-if-changed,$@.new,$@)
 
 xen.lds: xen.lds.S
-	$(CC) -P -E -Ui386 $(filter-out -Wa$(comma)%,$(AFLAGS)) -o $@ $<
-	sed -e 's/.*\.lds\.o:/$(@F):/g' <.$(@F).d >.$(@F).d.new
-	mv -f .$(@F).d.new .$(@F).d
+	$(CPP) -P $(filter-out -Wa$(comma)%,$(AFLAGS)) -MQ $@ -o $@ $<
 
 efi.lds: xen.lds.S
-	$(CC) -P -E -Ui386 -DEFI $(filter-out -Wa$(comma)%,$(AFLAGS)) -o $@ $<
-	sed -e 's/.*\.lds\.o:/$(@F):/g' <.$(@F).d >.$(@F).d.new
-	mv -f .$(@F).d.new .$(@F).d
+	$(CPP) -P -DEFI $(filter-out -Wa$(comma)%,$(AFLAGS)) -MQ $@ -o $@ $<
 
 boot/mkelf32: boot/mkelf32.c
 	$(HOSTCC) $(HOSTCFLAGS) -o $@ $<
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 14:59:51 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 14:59:51 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jo6sR-0005cm-8t; Wed, 24 Jun 2020 14:59:51 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo6sP-0005cb-MF
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:59:49 +0000
X-Inumbo-ID: 58a3ded5-b62b-11ea-80e8-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 58a3ded5-b62b-11ea-80e8-12813bfff9fa;
 Wed, 24 Jun 2020 14:59: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=avPGMIFODdQuaF0fr9siMzE0AN0yHs9lrlHt4uHaiTg=; b=hAJkOnXaPV8UTPzKdPbBAWxLTx
 Suf95WVazXeuKUhidoTlq0bJM1Hs8FMzxtsz++TDs8NSWMLItx9bwvgNtNOypeJZSVqi53zZc8imo
 koMxM+fSesPWe5mV/hAIq9PQoG9JJYYOK1+FEtsU5rO0ht+nAgApmtIhwwf5gnD2vuOw=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6sO-0003kC-Lv
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:59:48 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6sO-00066w-L6
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:59:48 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] x86/rtc: provide mediated access to RTC for PVH
 dom0
Message-Id: <E1jo6sO-00066w-L6@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 14:59: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 31c5d84c515cd4d8f61f19f3a1d644601a1a7624
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Jun 24 16:47:36 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:47:36 2020 +0200

    x86/rtc: provide mediated access to RTC for PVH dom0
    
    Mediated access to the RTC was provided for PVHv1 dom0 using the PV
    code paths (guest_io_{write/read}), but those accesses where never
    implemented for PVHv2 dom0. This patch provides such mediated accesses
    to the RTC for PVH dom0, just like it's provided for a classic PV
    dom0.
    
    Pull out some of the RTC logic from guest_io_{read/write} into
    specific helpers that can be used by both PV and HVM guests. The
    setup of the handlers for PVH is done in rtc_init, which is already
    used to initialize the fully emulated RTC.
    
    Without this a Linux PVH dom0 will read garbage when trying to access
    the RTC, and one vCPU will be constantly looping in
    rtc_timer_do_work.
    
    Note that such issue doesn't happen on domUs because the ACPI
    NO_CMOS_RTC flag is set in FADT, which prevents the OS from accessing
    the RTC. Also the X86_EMU_RTC flag is not set for PVH dom0, as the
    accesses are not emulated but rather forwarded to the physical
    hardware.
    
    No functional change expected for classic PV dom0.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 835d8d69d96aa7feb52ef7b3dd8ecf43f0807578
    master date: 2020-06-08 18:40:05 +0100
---
 xen/arch/x86/hvm/rtc.c            | 26 ++++++++++++++++
 xen/arch/x86/pv/emul-priv-op.c    | 30 +++---------------
 xen/arch/x86/time.c               | 65 +++++++++++++++++++++++++++++++++++++++
 xen/include/asm-x86/mc146818rtc.h |  3 ++
 4 files changed, 98 insertions(+), 26 deletions(-)

diff --git a/xen/arch/x86/hvm/rtc.c b/xen/arch/x86/hvm/rtc.c
index dec39e3857..690d7b0029 100644
--- a/xen/arch/x86/hvm/rtc.c
+++ b/xen/arch/x86/hvm/rtc.c
@@ -799,12 +799,38 @@ void rtc_reset(struct domain *d)
     s->pt.source = PTSRC_isa;
 }
 
+/* RTC mediator for HVM hardware domain. */
+static int hw_rtc_io(int dir, unsigned int port, unsigned int size,
+                     uint32_t *val)
+{
+    if ( dir == IOREQ_READ )
+        *val = ~0;
+
+    if ( size != 1 )
+    {
+        gdprintk(XENLOG_WARNING, "bad RTC access size (%u)\n", size);
+        return X86EMUL_OKAY;
+    }
+
+    if ( dir == IOREQ_WRITE )
+        rtc_guest_write(port, *val);
+    else
+        *val = rtc_guest_read(port);
+
+    return X86EMUL_OKAY;
+}
+
 void rtc_init(struct domain *d)
 {
     RTCState *s = domain_vrtc(d);
 
     if ( !has_vrtc(d) )
+    {
+        if ( is_hardware_domain(d) )
+            /* Hardware domain gets mediated access to the physical RTC. */
+            register_portio_handler(d, RTC_PORT(0), 2, hw_rtc_io);
         return;
+    }
 
     spin_lock_init(&s->lock);
 
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index e24b84f46a..90693fe9ee 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -236,19 +236,9 @@ static uint32_t guest_io_read(unsigned int port, unsigned int bytes,
         {
             sub_data = pv_pit_handler(port, 0, 0);
         }
-        else if ( port == RTC_PORT(0) )
+        else if ( port == RTC_PORT(0) || port == RTC_PORT(1) )
         {
-            sub_data = currd->arch.cmos_idx;
-        }
-        else if ( (port == RTC_PORT(1)) &&
-                  ioports_access_permitted(currd, RTC_PORT(0), RTC_PORT(1)) )
-        {
-            unsigned long flags;
-
-            spin_lock_irqsave(&rtc_lock, flags);
-            outb(currd->arch.cmos_idx & 0x7f, RTC_PORT(0));
-            sub_data = inb(RTC_PORT(1));
-            spin_unlock_irqrestore(&rtc_lock, flags);
+            sub_data = rtc_guest_read(port);
         }
         else if ( (port == 0xcf8) && (bytes == 4) )
         {
@@ -369,21 +359,9 @@ static void guest_io_write(unsigned int port, unsigned int bytes,
         {
             pv_pit_handler(port, (uint8_t)data, 1);
         }
-        else if ( port == RTC_PORT(0) )
-        {
-            currd->arch.cmos_idx = data;
-        }
-        else if ( (port == RTC_PORT(1)) &&
-                  ioports_access_permitted(currd, RTC_PORT(0), RTC_PORT(1)) )
+        else if ( port == RTC_PORT(0) || port == RTC_PORT(1) )
         {
-            unsigned long flags;
-
-            if ( pv_rtc_handler )
-                pv_rtc_handler(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));
-            spin_unlock_irqrestore(&rtc_lock, flags);
+            rtc_guest_write(port, data);
         }
         else if ( (port == 0xcf8) && (bytes == 4) )
         {
diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 3dac3f3ad6..97ae10e46f 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -26,6 +26,7 @@
 #include <xen/keyhandler.h>
 #include <xen/guest_access.h>
 #include <asm/io.h>
+#include <asm/iocap.h>
 #include <asm/msr.h>
 #include <asm/mpspec.h>
 #include <asm/processor.h>
@@ -1008,6 +1009,70 @@ static unsigned long get_cmos_time(void)
     return mktime(rtc.year, rtc.mon, rtc.day, rtc.hour, rtc.min, rtc.sec);
 }
 
+/* Helpers for guest accesses to the physical RTC. */
+unsigned int rtc_guest_read(unsigned int port)
+{
+    const struct domain *currd = current->domain;
+    unsigned long flags;
+    unsigned int data = ~0;
+
+    switch ( port )
+    {
+    case RTC_PORT(0):
+        /*
+         * All PV domains (and PVH dom0) are allowed to read the latched value
+         * of the first RTC port, as there's no access to the physical IO
+         * ports.
+         */
+        data = currd->arch.cmos_idx;
+        break;
+
+    case RTC_PORT(1):
+        if ( !ioports_access_permitted(currd, RTC_PORT(0), RTC_PORT(1)) )
+            break;
+        spin_lock_irqsave(&rtc_lock, flags);
+        outb(currd->arch.cmos_idx & 0x7f, RTC_PORT(0));
+        data = inb(RTC_PORT(1));
+        spin_unlock_irqrestore(&rtc_lock, flags);
+        break;
+
+    default:
+        ASSERT_UNREACHABLE();
+    }
+
+    return data;
+}
+
+void rtc_guest_write(unsigned int port, unsigned int data)
+{
+    struct domain *currd = current->domain;
+    unsigned long flags;
+
+    switch ( port )
+    {
+    case RTC_PORT(0):
+        /*
+         * All PV domains (and PVH dom0) are allowed to write to the latched
+         * value of the first RTC port, as there's no access to the physical IO
+         * ports.
+         */
+        currd->arch.cmos_idx = data;
+        break;
+
+    case RTC_PORT(1):
+        if ( !ioports_access_permitted(currd, RTC_PORT(0), RTC_PORT(1)) )
+            break;
+        spin_lock_irqsave(&rtc_lock, flags);
+        outb(currd->arch.cmos_idx & 0x7f, RTC_PORT(0));
+        outb(data, RTC_PORT(1));
+        spin_unlock_irqrestore(&rtc_lock, flags);
+        break;
+
+    default:
+        ASSERT_UNREACHABLE();
+    }
+}
+
 static unsigned long get_wallclock_time(void)
 {
 #ifdef CONFIG_XEN_GUEST
diff --git a/xen/include/asm-x86/mc146818rtc.h b/xen/include/asm-x86/mc146818rtc.h
index 8758528f7c..803b236c0a 100644
--- a/xen/include/asm-x86/mc146818rtc.h
+++ b/xen/include/asm-x86/mc146818rtc.h
@@ -110,4 +110,7 @@ outb_p((val),RTC_PORT(1)); \
 
 #define RTC_IRQ 8
 
+unsigned int rtc_guest_read(unsigned int port);
+void rtc_guest_write(unsigned int port, unsigned int data);
+
 #endif /* _ASM_MC146818RTC_H */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 15:00:00 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 15:00: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 1jo6sa-0005dw-Bw; Wed, 24 Jun 2020 15:00:00 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo6sZ-0005dn-CB
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:59:59 +0000
X-Inumbo-ID: 5f627640-b62b-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 5f627640-b62b-11ea-bca7-bc764e2007e4;
 Wed, 24 Jun 2020 14:59: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=S9WFKnurCZMSwIWCUwarul5PPcZ1P1I5W+ZE4RMppmc=; b=tJilrdv78CsZNySHfs90xAyUIv
 RRC7Xx1SwVL3RRWNbsRlrqLJK53fyK51F1WxytBQgdMiUx1s3QXo35p401Y10dIx4zWftWVFsAtEE
 2va3a+No33WZA3EErqyiWVZVf2Ffa0UihZYEupqHX6GVQtjFk0RRnwkL9jP3IRTNIPmg=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6sY-0003kK-PQ
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:59:58 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6sY-00067p-Oi
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 14:59:58 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] x86/Intel: insert Ice Lake and Comet Lake model
 numbers
Message-Id: <E1jo6sY-00067p-Oi@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 14:59: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 780d3761f1176132fc154161b3c480ab9d256f53
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jun 24 16:48:12 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:48:12 2020 +0200

    x86/Intel: insert Ice Lake and Comet Lake model numbers
    
    Both match prior generation processors as far as LBR and C-state MSRs
    go (SDM rev 072) as well as applicability of the if_pschange_mc erratum
    (recent spec updates).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 1fe406685cb19e9544681c6243e7d376deb0297e
    master date: 2020-06-09 12:55:53 +0200
---
 xen/arch/x86/acpi/cpu_idle.c | 6 ++++++
 xen/arch/x86/hvm/vmx/vmx.c   | 8 ++++++++
 2 files changed, 14 insertions(+)

diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c
index 95990dc8b7..1dea781442 100644
--- a/xen/arch/x86/acpi/cpu_idle.c
+++ b/xen/arch/x86/acpi/cpu_idle.c
@@ -179,9 +179,15 @@ static void do_get_hw_residencies(void *arg)
     case 0x4E:
     case 0x55:
     case 0x5E:
+    /* Ice Lake */
+    case 0x7D:
+    case 0x7E:
     /* Kaby Lake */
     case 0x8E:
     case 0x9E:
+    /* Comet Lake */
+    case 0xA5:
+    case 0xA6:
         GET_PC2_RES(hw_res->pc2);
         GET_CC7_RES(hw_res->cc7);
         /* fall through */
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 2be74aa8c3..5c47d10384 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2433,8 +2433,12 @@ static bool __init has_if_pschange_mc(void)
     case 0x4e: /* Skylake M */
     case 0x5e: /* Skylake D */
     case 0x55: /* Skylake-X / Cascade Lake */
+    case 0x7d: /* Ice Lake */
+    case 0x7e: /* Ice Lake */
     case 0x8e: /* Kaby / Coffee / Whiskey Lake M */
     case 0x9e: /* Kaby / Coffee / Whiskey Lake D */
+    case 0xa5: /* Comet Lake H/S */
+    case 0xa6: /* Comet Lake U */
         return true;
 
         /*
@@ -2778,8 +2782,12 @@ static const struct lbr_info *last_branch_msr_get(void)
         case 0x66:
         /* Goldmont Plus */
         case 0x7a:
+        /* Ice Lake */
+        case 0x7d: case 0x7e:
         /* Kaby Lake */
         case 0x8e: case 0x9e:
+        /* Comet Lake */
+        case 0xa5: case 0xa6:
             return sk_lbr;
         /* Atom */
         case 0x1c: case 0x26: case 0x27: case 0x35: case 0x36:
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 15:00:10 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 15:00: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 1jo6sk-0006KP-Dl; Wed, 24 Jun 2020 15:00:10 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo6sj-0006KG-L7
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:00:09 +0000
X-Inumbo-ID: 6568b8ec-b62b-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 6568b8ec-b62b-11ea-bb8b-bc764e2007e4;
 Wed, 24 Jun 2020 15:00:09 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=c+qbeUfijP8CoG73iHTIVqn526Yg3zesfJ+uijA+w+k=; b=lU+mWDU1ujrC4NcT7CxdgitmWM
 UrP+AyJbG4LGivZ4Wt49zqgOvmGLCgd56ZrP9C7VJGWLkk4fieAsgZZjXmv6cSBcemP1OnBgxqPUT
 OxxOR3Gw7B0cStKNj/2Z+FNlVVgKpMIB9k/V0EHv0zS2kGNptbuMtRFTKNkOYGtHlaUs=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6si-0003nC-Sc
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:00:08 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6si-0006AM-Rq
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:00:08 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] ioreq: handle pending emulation racing with ioreq
 server destruction
Message-Id: <E1jo6si-0006AM-Rq@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 15:00:08 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 05ba427181723848d9bd462cccd2929e42e3c219
Author:     Paul Durrant <pdurrant@amazon.com>
AuthorDate: Wed Jun 24 16:49:02 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:49:02 2020 +0200

    ioreq: handle pending emulation racing with ioreq server destruction
    
    When an emulation request is initiated in hvm_send_ioreq() the guest vcpu is
    blocked on an event channel until that request is completed. If, however,
    the emulator is killed whilst that emulation is pending then the ioreq
    server may be destroyed. Thus when the vcpu is awoken the code in
    handle_hvm_io_completion() will find no pending request to wait for, but will
    leave the internal vcpu io_req.state set to IOREQ_READY and the vcpu shutdown
    deferall flag in place (because hvm_io_assist() will never be called). The
    emulation request is then completed anyway. This means that any subsequent call
    to hvmemul_do_io() will find an unexpected value in io_req.state and will
    return X86EMUL_UNHANDLEABLE, which in some cases will result in continuous
    re-tries.
    
    This patch fixes the issue by moving the setting of io_req.state and clearing
    of shutdown deferral (as will as MSI-X write completion) out of hvm_io_assist()
    and directly into handle_hvm_io_completion().
    
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Paul Durrant <pdurrant@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: f7039ee41b3d3448775a1623f230037fd0455104
    master date: 2020-06-09 12:56:24 +0200
---
 xen/arch/x86/hvm/ioreq.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/hvm/ioreq.c b/xen/arch/x86/hvm/ioreq.c
index 0b54536bde..b8e7c2d089 100644
--- a/xen/arch/x86/hvm/ioreq.c
+++ b/xen/arch/x86/hvm/ioreq.c
@@ -107,15 +107,7 @@ static void hvm_io_assist(struct hvm_ioreq_vcpu *sv, uint64_t data)
     ioreq_t *ioreq = &v->arch.hvm.hvm_io.io_req;
 
     if ( hvm_ioreq_needs_completion(ioreq) )
-    {
-        ioreq->state = STATE_IORESP_READY;
         ioreq->data = data;
-    }
-    else
-        ioreq->state = STATE_IOREQ_NONE;
-
-    msix_write_completion(v);
-    vcpu_end_shutdown_deferral(v);
 
     sv->pending = false;
 }
@@ -207,6 +199,12 @@ bool handle_hvm_io_completion(struct vcpu *v)
         }
     }
 
+    vio->io_req.state = hvm_ioreq_needs_completion(&vio->io_req) ?
+        STATE_IORESP_READY : STATE_IOREQ_NONE;
+
+    msix_write_completion(v);
+    vcpu_end_shutdown_deferral(v);
+
     io_completion = vio->io_completion;
     vio->io_completion = HVMIO_no_completion;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 15:00:22 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 15:00:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jo6su-0006M0-FO; Wed, 24 Jun 2020 15:00:20 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo6st-0006Lp-Jj
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:00:19 +0000
X-Inumbo-ID: 6b6eba3e-b62b-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 6b6eba3e-b62b-11ea-8496-bc764e2007e4;
 Wed, 24 Jun 2020 15:00:19 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=2mHiXgYOiFZr7ngbTEE9W8jbngrgIT9fYhzs0DO3ZyI=; b=28bD6c8tRIhNQgar97CYoKrxju
 0iI/yVKmLu+jFZdyhD1XVicKwwaYmjeDOg9jpkXYZPOvWkHznz6ZIWWmzpan5CvSn+9dLZB7i+Xgr
 7dFYZX65i2QieYQpu7ab1jpjwAvcPUzU9YAwnPQPNGrnBrdXds68ls4mfi1Ape+5SqA8=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6ss-0003nQ-Vb
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:00:18 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6ss-0006BP-Ur
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:00:18 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] x86/passthrough: do not assert edge triggered GSIs
 for PVH dom0
Message-Id: <E1jo6ss-0006BP-Ur@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 15:00:18 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit a9d46ba3323061029772610fcc8b804f614bf619
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Jun 24 16:49:50 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:49:50 2020 +0200

    x86/passthrough: do not assert edge triggered GSIs for PVH dom0
    
    Edge triggered interrupts do not assert the line, so the handling done
    in Xen should also avoid asserting it. Asserting the line prevents
    further edge triggered interrupts on the same vIO-APIC pin from being
    delivered, since the line is not de-asserted.
    
    One case of such kind of interrupt is the RTC timer, which is edge
    triggered and available to a PVH dom0. Note this should not affect
    domUs, as it only modifies the behavior of IDENTITY_GSI kind of passed
    through interrupts.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    master commit: 6fa25d568f4e597b1940309d97cfd98f4f6eecd6
    master date: 2020-06-11 18:14:29 +0100
---
 xen/arch/x86/hvm/irq.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/hvm/irq.c b/xen/arch/x86/hvm/irq.c
index c684422b24..d2bfb6d05d 100644
--- a/xen/arch/x86/hvm/irq.c
+++ b/xen/arch/x86/hvm/irq.c
@@ -168,9 +168,10 @@ void hvm_pci_intx_deassert(
 
 void hvm_gsi_assert(struct domain *d, unsigned int gsi)
 {
+    int trig = vioapic_get_trigger_mode(d, gsi);
     struct hvm_irq *hvm_irq = hvm_domain_irq(d);
 
-    if ( gsi >= hvm_irq->nr_gsis )
+    if ( gsi >= hvm_irq->nr_gsis || trig < 0 )
     {
         ASSERT_UNREACHABLE();
         return;
@@ -185,9 +186,10 @@ void hvm_gsi_assert(struct domain *d, unsigned int gsi)
      * to know if the GSI is pending or not.
      */
     spin_lock(&d->arch.hvm.irq_lock);
-    if ( !hvm_irq->gsi_assert_count[gsi] )
+    if ( trig == VIOAPIC_EDGE_TRIG || !hvm_irq->gsi_assert_count[gsi] )
     {
-        hvm_irq->gsi_assert_count[gsi] = 1;
+        if ( trig == VIOAPIC_LEVEL_TRIG )
+            hvm_irq->gsi_assert_count[gsi] = 1;
         assert_gsi(d, gsi);
     }
     spin_unlock(&d->arch.hvm.irq_lock);
@@ -195,11 +197,12 @@ void hvm_gsi_assert(struct domain *d, unsigned int gsi)
 
 void hvm_gsi_deassert(struct domain *d, unsigned int gsi)
 {
+    int trig = vioapic_get_trigger_mode(d, gsi);
     struct hvm_irq *hvm_irq = hvm_domain_irq(d);
 
-    if ( gsi >= hvm_irq->nr_gsis )
+    if ( trig <= VIOAPIC_EDGE_TRIG || gsi >= hvm_irq->nr_gsis )
     {
-        ASSERT_UNREACHABLE();
+        ASSERT(trig == VIOAPIC_EDGE_TRIG && gsi < hvm_irq->nr_gsis);
         return;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 15:00:30 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 15:00: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 1jo6t4-0006Mz-HA; Wed, 24 Jun 2020 15:00:30 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo6t3-0006Mr-Uq
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:00:29 +0000
X-Inumbo-ID: 7162a98d-b62b-11ea-80e9-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 7162a98d-b62b-11ea-80e9-12813bfff9fa;
 Wed, 24 Jun 2020 15:00:29 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=9SrbDD5Tf9R2CpEfzyCA09nVYn5lFD2XaO8LiE1Nc68=; b=oOoLWYxc+h3kxyRlfGaAvZPHfe
 2fIHugg+xiLpxrxuniurrJdgiqWyvIfkoZh5ZYgHs5MQoGjqo93dud+H26awOyWHO0eX9cb7q88dP
 inDz3rfSTWqL5SfuwBTAEa2hsRTgiCXXMMia5Qly/JRzNS4+3L91GraNkROXJzIDBB0o=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6t3-0003nY-2Z
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:00:29 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6t3-0006CJ-1g
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:00:29 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] x86/passthrough: introduce a flag for GSIs not
 requiring an EOI or unmask
Message-Id: <E1jo6t3-0006CJ-1g@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 15:00:29 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit cdd8f958d6c142d9ac5d63ca737f0397eaf6ba7a
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Jun 24 16:50:25 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:50:25 2020 +0200

    x86/passthrough: introduce a flag for GSIs not requiring an EOI or unmask
    
    There's no need to setup a timer for GSIs that are edge triggered,
    since those don't require any EIO or unmask, and hence couldn't block
    other interrupts.
    
    Note this is only used by PVH dom0, that can setup the passthrough of
    edge triggered interrupts from the vIO-APIC. One example of such kind
    of interrupt that can be used by a PVH dom0 would be the RTC timer.
    
    While there introduce an out label to do the unlock and reduce code
    duplication.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 2995d0afdf2d3fb44d07eada088db3613741db1e
    master date: 2020-06-11 18:14:29 +0100
---
 xen/drivers/passthrough/io.c  | 24 +++++++++++++++---------
 xen/include/asm-x86/hvm/irq.h |  2 ++
 2 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/xen/drivers/passthrough/io.c b/xen/drivers/passthrough/io.c
index b292e79382..6b1305a3e5 100644
--- a/xen/drivers/passthrough/io.c
+++ b/xen/drivers/passthrough/io.c
@@ -138,7 +138,8 @@ static void pt_pirq_softirq_reset(struct hvm_pirq_dpci *pirq_dpci)
 
 bool pt_irq_need_timer(uint32_t flags)
 {
-    return !(flags & (HVM_IRQ_DPCI_GUEST_MSI | HVM_IRQ_DPCI_TRANSLATE));
+    return !(flags & (HVM_IRQ_DPCI_GUEST_MSI | HVM_IRQ_DPCI_TRANSLATE |
+                      HVM_IRQ_DPCI_NO_EOI));
 }
 
 static int pt_irq_guest_eoi(struct domain *d, struct hvm_pirq_dpci *pirq_dpci,
@@ -558,6 +559,12 @@ int pt_irq_create_bind(
                      */
                     ASSERT(!mask);
                     share = trigger_mode;
+                    if ( trigger_mode == VIOAPIC_EDGE_TRIG )
+                        /*
+                         * Edge IO-APIC interrupt, no EOI or unmask to perform
+                         * and hence no timer needed.
+                         */
+                        pirq_dpci->flags |= HVM_IRQ_DPCI_NO_EOI;
                 }
             }
 
@@ -897,17 +904,13 @@ static void hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci)
             send_guest_pirq(d, pirq);
 
             if ( pirq_dpci->flags & HVM_IRQ_DPCI_GUEST_MSI )
-            {
-                spin_unlock(&d->event_lock);
-                return;
-            }
+                goto out;
         }
 
         if ( pirq_dpci->flags & HVM_IRQ_DPCI_GUEST_MSI )
         {
             vmsi_deliver_pirq(d, pirq_dpci);
-            spin_unlock(&d->event_lock);
-            return;
+            goto out;
         }
 
         list_for_each_entry ( digl, &pirq_dpci->digl_list, list )
@@ -920,6 +923,8 @@ static void hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci)
         if ( pirq_dpci->flags & HVM_IRQ_DPCI_IDENTITY_GSI )
         {
             hvm_gsi_assert(d, pirq->pirq);
+            if ( pirq_dpci->flags & HVM_IRQ_DPCI_NO_EOI )
+                goto out;
             pirq_dpci->pending++;
         }
 
@@ -927,8 +932,7 @@ static void hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci)
         {
             /* for translated MSI to INTx interrupt, eoi as early as possible */
             __msi_pirq_eoi(pirq_dpci);
-            spin_unlock(&d->event_lock);
-            return;
+            goto out;
         }
 
         /*
@@ -941,6 +945,8 @@ static void hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci)
         ASSERT(pt_irq_need_timer(pirq_dpci->flags));
         set_timer(&pirq_dpci->timer, NOW() + PT_IRQ_TIME_OUT);
     }
+
+ out:
     spin_unlock(&d->event_lock);
 }
 
diff --git a/xen/include/asm-x86/hvm/irq.h b/xen/include/asm-x86/hvm/irq.h
index d306cfeade..532880d497 100644
--- a/xen/include/asm-x86/hvm/irq.h
+++ b/xen/include/asm-x86/hvm/irq.h
@@ -121,6 +121,7 @@ struct dev_intx_gsi_link {
 #define _HVM_IRQ_DPCI_GUEST_PCI_SHIFT           4
 #define _HVM_IRQ_DPCI_GUEST_MSI_SHIFT           5
 #define _HVM_IRQ_DPCI_IDENTITY_GSI_SHIFT        6
+#define _HVM_IRQ_DPCI_NO_EOI_SHIFT              7
 #define _HVM_IRQ_DPCI_TRANSLATE_SHIFT          15
 #define HVM_IRQ_DPCI_MACH_PCI        (1u << _HVM_IRQ_DPCI_MACH_PCI_SHIFT)
 #define HVM_IRQ_DPCI_MACH_MSI        (1u << _HVM_IRQ_DPCI_MACH_MSI_SHIFT)
@@ -129,6 +130,7 @@ struct dev_intx_gsi_link {
 #define HVM_IRQ_DPCI_GUEST_PCI       (1u << _HVM_IRQ_DPCI_GUEST_PCI_SHIFT)
 #define HVM_IRQ_DPCI_GUEST_MSI       (1u << _HVM_IRQ_DPCI_GUEST_MSI_SHIFT)
 #define HVM_IRQ_DPCI_IDENTITY_GSI    (1u << _HVM_IRQ_DPCI_IDENTITY_GSI_SHIFT)
+#define HVM_IRQ_DPCI_NO_EOI          (1u << _HVM_IRQ_DPCI_NO_EOI_SHIFT)
 #define HVM_IRQ_DPCI_TRANSLATE       (1u << _HVM_IRQ_DPCI_TRANSLATE_SHIFT)
 
 struct hvm_gmsi_info {
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 15:00:40 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 15:00: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 1jo6tE-0006O1-Ix; Wed, 24 Jun 2020 15:00: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo6tD-0006Nr-N6
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:00:39 +0000
X-Inumbo-ID: 77742b2a-b62b-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 77742b2a-b62b-11ea-bb8b-bc764e2007e4;
 Wed, 24 Jun 2020 15:00:39 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=O89cuX3B6gUoN+wVaKYKjbUayDywKQ36vAlOOIxrJeU=; b=Dye77npUUU6R3ICut/ne8M6JNK
 jkcBT8d3+sFsjt2fmpMRMu85AF6iG3ZEIYqMccgUy+xHIRFtAPcuP3vnXihrOI5+v9Ikhq5Xb4Yjw
 MI0BmLrRAwA+ssx/HrMijdK9RixXBE20Af56EQClcpZJsfLFdmSb2A3xN+oZlKhLwfes=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6tD-0003oY-5S
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:00:39 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo6tD-0006E6-4j
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:00:39 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] libacpi: widen TPM detection
Message-Id: <E1jo6tD-0006E6-4j@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 15:00:39 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 9f7e8bac4ca279b3bfccb5f3730fb2e5398c95ab
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Wed Jun 24 16:51:16 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:51:16 2020 +0200

    libacpi: widen TPM detection
    
    The hardcoded tpm_signature is too restrictive to detect many TPMs.  For
    instance, it doesn't accept a QEMU emulated TPM (VID 0x1014 DID 0x0001).
    Make the TPM detection match that in rombios which accepts a wider
    range.
    
    With this change, the TPM's TCPA ACPI table is generated and the guest
    OS can automatically load the tpm_tis driver.  It also allows seabios to
    detect and use the TPM.  However, seabios skips some TPM initialization
    when running under Xen, so it will not populate any PCRs unless modified
    to run the initialization under Xen.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: d3db7e043cddd7e939195e014241ce2c5d436179
    master date: 2020-06-16 10:31:08 +0200
---
 tools/libacpi/build.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/tools/libacpi/build.c b/tools/libacpi/build.c
index fa7d14e090..a61dd5583a 100644
--- a/tools/libacpi/build.c
+++ b/tools/libacpi/build.c
@@ -351,7 +351,6 @@ static int construct_secondary_tables(struct acpi_ctxt *ctxt,
     struct acpi_20_waet *waet;
     struct acpi_20_tcpa *tcpa;
     unsigned char *ssdt;
-    static const uint16_t tis_signature[] = {0x0001, 0x0001, 0x0001};
     void *lasa;
 
     /* MADT. */
@@ -413,9 +412,8 @@ static int construct_secondary_tables(struct acpi_ctxt *ctxt,
 
     /* TPM TCPA and SSDT. */
     if ( (config->table_flags & ACPI_HAS_TCPA) &&
-         (config->tis_hdr[0] == tis_signature[0]) &&
-         (config->tis_hdr[1] == tis_signature[1]) &&
-         (config->tis_hdr[2] == tis_signature[2]) )
+         (config->tis_hdr[0] != 0 && config->tis_hdr[0] != 0xffff) &&
+         (config->tis_hdr[1] != 0 && config->tis_hdr[1] != 0xffff) )
     {
         ssdt = ctxt->mem_ops.alloc(ctxt, sizeof(ssdt_tpm), 16);
         if (!ssdt) return -1;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 15:22:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 15: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 1jo7Dz-0008D7-9P; Wed, 24 Jun 2020 15: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo7Dy-0008D2-6h
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:22:06 +0000
X-Inumbo-ID: 7630aac4-b62e-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 7630aac4-b62e-11ea-bb8b-bc764e2007e4;
 Wed, 24 Jun 2020 15: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=XbIUC6pUFsMhcrMhwQr35Gh6fVOMy6xuQRtz8U4Voao=; b=XLzfdF6hkNiCATh73USAkhpi+e
 cE3Li1wIze1zIBTpRa5HS4rDH39UOlL20ubEkX7p066BLJGp0NhkXVVEScGHgWmoLnjTCVTto4Ga3
 ZVzKOmUQG2jD7EF2fSZsmFb3xO4f45io9f5K5zsPEfdb5I8Pjcl+n12H6p9MqaAO5pg0=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7Dx-0004Bx-Fq
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:22:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7Dx-0007ai-En
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:22:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.12] update Xen version to 4.12.4-pre
Message-Id: <E1jo7Dx-0007ai-En@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 15: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 be5c240252cb2b8ed2663b6a239e9bbd0700a3a2
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jun 24 16:55:04 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:55:04 2020 +0200

    update Xen version to 4.12.4-pre
---
 xen/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/Makefile b/xen/Makefile
index baa61cd27b..25e8014dba 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -2,7 +2,7 @@
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 12
-export XEN_EXTRAVERSION ?= .3$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .4-pre$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 15:22:17 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 15: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 1jo7E9-0008Dw-CL; Wed, 24 Jun 2020 15: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo7E8-0008Dm-8w
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:22:16 +0000
X-Inumbo-ID: 7c382352-b62e-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 7c382352-b62e-11ea-b7bb-bc764e2007e4;
 Wed, 24 Jun 2020 15: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=/rzj+K4VLiPzjpZDpbV7DiLpaAYKUkzclOJx5xXn0O0=; b=PQb8FtO1kfqOWrKdFjYK+wljvW
 rlp2QElEPVLQgMd4LUfX/N/H1jZ10G9HjnEZ8cq84pxaU+ezMGaqKXhMfoylcVF61sSmuUgSuOzXp
 D713wuYnhNNDiYdA1aV/btc91oH+VFXro+7HsObvLAhERpUmL4wzz+kTuiQMecc0FTE8=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7E7-0004C3-JW
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:22:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7E7-0007bF-IE
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:22:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.12] x86/cpuidle: correct Cannon Lake residency MSRs
Message-Id: <E1jo7E7-0007bF-IE@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 15: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 bc775d06d0e6d26eb2ba476d03cfb474c7b7aba6
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jun 24 16:57:39 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:57:39 2020 +0200

    x86/cpuidle: correct Cannon Lake residency MSRs
    
    As per SDM rev 071 Cannon Lake has
    - no CC3 residency MSR at 3FC,
    - a CC1 residency MSR ar 660 (like various Atoms),
    - a useless (always zero) CC3 residency MSR at 662.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 9ff09aefc46385dc04c38b6dd1f1ac25f784f482
    master date: 2020-04-03 17:15:58 +0200
---
 xen/arch/x86/acpi/cpu_idle.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c
index 14b02789c5..121aab2ce8 100644
--- a/xen/arch/x86/acpi/cpu_idle.c
+++ b/xen/arch/x86/acpi/cpu_idle.c
@@ -69,7 +69,7 @@
 #define GET_PC8_RES(val)  GET_HW_RES_IN_NS(0x630, val) /* some Haswells only */
 #define GET_PC9_RES(val)  GET_HW_RES_IN_NS(0x631, val) /* some Haswells only */
 #define GET_PC10_RES(val) GET_HW_RES_IN_NS(0x632, val) /* some Haswells only */
-#define GET_CC1_RES(val)  GET_HW_RES_IN_NS(0x660, val) /* Silvermont only */
+#define GET_CC1_RES(val)  GET_HW_RES_IN_NS(0x660, val)
 #define GET_CC3_RES(val)  GET_HW_RES_IN_NS(0x3FC, val)
 #define GET_CC6_RES(val)  GET_HW_RES_IN_NS(0x3FD, val)
 #define GET_CC7_RES(val)  GET_HW_RES_IN_NS(0x3FE, val) /* SNB onwards */
@@ -165,8 +165,6 @@ static void do_get_hw_residencies(void *arg)
     case 0x4E:
     case 0x55:
     case 0x5E:
-    /* Cannon Lake */
-    case 0x66:
     /* Kaby Lake */
     case 0x8E:
     case 0x9E:
@@ -188,6 +186,16 @@ static void do_get_hw_residencies(void *arg)
         GET_CC3_RES(hw_res->cc3);
         GET_CC6_RES(hw_res->cc6);
         break;
+    /* Cannon Lake */
+    case 0x66:
+        GET_PC2_RES(hw_res->pc2);
+        GET_PC3_RES(hw_res->pc3);
+        GET_PC6_RES(hw_res->pc6);
+        GET_PC7_RES(hw_res->pc7);
+        GET_CC1_RES(hw_res->cc1);
+        GET_CC6_RES(hw_res->cc6);
+        GET_CC7_RES(hw_res->cc7);
+        break;
     /* Xeon Phi Knights Landing */
     case 0x57:
     /* Xeon Phi Knights Mill */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 15:22:27 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 15: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 1jo7EJ-0008Fk-Du; Wed, 24 Jun 2020 15:22:27 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo7EI-0008FX-9X
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:22:26 +0000
X-Inumbo-ID: 823bc470-b62e-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 823bc470-b62e-11ea-8496-bc764e2007e4;
 Wed, 24 Jun 2020 15: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=92Ndk1aFiQAwIAfKgxTV/e6u92+C2FUECdF9ggMQzic=; b=5JO5wf4CIrwlbpySmaKkgmiooc
 pcaQYi0P8YLXNR5OiwlTICInIwBDHmX25dQd5bT8ISeqC90pIUms6WkZ3kZq5GXy/Krrt+JV+JYuJ
 kBMpWCSRLXKP5Utrjhn/oNnIstztRgjxttxNTk2viws3kUWKbG95T/moIp/Ie7FyY/bY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7EH-0004CE-ND
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:22:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7EH-0007bj-M2
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:22:25 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.12] x86/guest: Fix assembler warnings with newer
 binutils
Message-Id: <E1jo7EH-0007bj-M2@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 15:22: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 dd49ddf0eb2c61a38fd1174084103c0cceae254e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 24 16:58:22 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:58:22 2020 +0200

    x86/guest: Fix assembler warnings with newer binutils
    
    GAS of at least version 2.34 complains:
    
      hypercall_page.S: Assembler messages:
      hypercall_page.S:24: Warning: symbol 'HYPERCALL_set_trap_table' already has its type set
      ...
      hypercall_page.S:71: Warning: symbol 'HYPERCALL_arch_7' already has its type set
    
    which is because the whole page is declared as STT_OBJECT already.  Rearrange
    .set with respect to .type in DECLARE_HYPERCALL() so STT_FUNC is already in
    place.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/guest/hypercall_page.S | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/guest/hypercall_page.S b/xen/arch/x86/guest/hypercall_page.S
index 26afabf909..21408a69e8 100644
--- a/xen/arch/x86/guest/hypercall_page.S
+++ b/xen/arch/x86/guest/hypercall_page.S
@@ -17,9 +17,9 @@ GLOBAL(hypercall_page)
  */
 #define DECLARE_HYPERCALL(name)                                                 \
         .globl HYPERCALL_ ## name;                                              \
-        .set   HYPERCALL_ ## name, hypercall_page + __HYPERVISOR_ ## name * 32; \
         .type  HYPERCALL_ ## name, STT_FUNC;                                    \
-        .size  HYPERCALL_ ## name, 32
+        .size  HYPERCALL_ ## name, 32;                                          \
+        .set   HYPERCALL_ ## name, hypercall_page + __HYPERVISOR_ ## name * 32
 
 DECLARE_HYPERCALL(set_trap_table)
 DECLARE_HYPERCALL(mmu_update)
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 15:22:37 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 15: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 1jo7ET-0008H2-Fm; Wed, 24 Jun 2020 15:22: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo7ES-0008Gu-UX
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:22:36 +0000
X-Inumbo-ID: 88412dba-b62e-11ea-80f0-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 88412dba-b62e-11ea-80f0-12813bfff9fa;
 Wed, 24 Jun 2020 15:22: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=mb09msd2aCJ0EoMPObOWfLD0Q3npBEGO+mycwQhdMw8=; b=dn+yoJydiIJhE0nZpi9wVX5vh3
 wciOfta+edsWUwqlQ/6baBSuejabLAoS7CcstvdQSpC7uO/qp0gIX3YhkVLy0N4CH8CGErZOKK6sg
 c2mKrIe6iImJrNwRZ0d54UMcv/lbAIhZ+lRgTa5Eewyo8OfAiNwr20RpEGdW6/kUzXb4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7ER-0004CN-QN
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:22:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7ER-0007cP-PZ
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:22:35 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.12] x86/build32: Discard all orphaned sections
Message-Id: <E1jo7ER-0007cP-PZ@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 15: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 a022f3679aae642d702f9ef3137c8d3db46018a7
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 24 16:58:51 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:58:51 2020 +0200

    x86/build32: Discard all orphaned sections
    
    Linkers may put orphaned sections ahead of .text, which breaks the calling
    requirements.  A concrete example is Ubuntu's GCC-9 default of enabling
    -fcf-protection which causes us to try and execute .note.gnu.properties during
    Xen's boot.
    
    Put .got.plt in its own section as it specifically needs preserving from the
    linkers point of view, and discard everything else.  This will hopefully be
    more robust to other unexpected toolchain properties.
    
    Fixes boot from an Ubuntu build of Xen.
    
    Reported-by: Jason Andryuk <jandryuk@gmail.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Tested-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/boot/build32.lds | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/boot/build32.lds b/xen/arch/x86/boot/build32.lds
index da35aee910..97454b40ff 100644
--- a/xen/arch/x86/boot/build32.lds
+++ b/xen/arch/x86/boot/build32.lds
@@ -31,7 +31,7 @@ SECTIONS
         *(.bss.*)
   }
 
-  /DISCARD/ : {
+  .got.plt : {
         /*
          * PIC/PIE executable contains .got.plt section even if it is not linked
          * with dynamic libraries. In such case it is just placeholder for
@@ -47,6 +47,14 @@ SECTIONS
          *
          * Please check build32.mk for more details.
          */
-        /* *(.got.plt) */
+        *(.got.plt)
+  }
+
+  /DISCARD/ : {
+        /*
+         * Discard everything else, to prevent linkers from putting
+         * orphaned sections ahead of .text, which needs to be first.
+         */
+        *(*)
   }
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 15:22:47 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 15: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 1jo7Ed-0008I5-HU; Wed, 24 Jun 2020 15: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo7Ec-0008Hv-I9
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:22:46 +0000
X-Inumbo-ID: 8e4861ec-b62e-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 8e4861ec-b62e-11ea-8496-bc764e2007e4;
 Wed, 24 Jun 2020 15:22: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=gks7fUdKXqaTFtZWqmrBqUyVk+Af5eXP+0nOo/k49tM=; b=iswdjh1wIOj/mpaAcrapDe5S8M
 lxH4Q4FMzr4G6ev3KqcBHOSxDLICvz9sggful2Vf6Dqapel+S6x2W4aYA7oH1OAKGhASzPtI9570q
 UnuKVDgE2OcRFMdRklKt0uevMvUA5P3r3CpN7abe/E/kAKmp6kJJkmRtJqusip2qy7VQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7Eb-0004CV-Tg
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:22:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7Eb-0007cq-Si
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:22:45 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.12] x86/build: move -fno-asynchronous-unwind-tables
 into EMBEDDED_EXTRA_CFLAGS
Message-Id: <E1jo7Eb-0007cq-Si@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 15: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 2b10a3238ad1e339b8238e4ee7fe7fad210f4588
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 24 16:59:21 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:59:21 2020 +0200

    x86/build: move -fno-asynchronous-unwind-tables into EMBEDDED_EXTRA_CFLAGS
    
    Users of EMBEDDED_EXTRA_CFLAGS already use -fno-asynchronous-unwind-tables, or
    ought to.  This shrinks the size of the rombios 32bit stubs in guest memory.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 Config.mk                            | 2 +-
 tools/tests/x86_emulator/testcase.mk | 2 +-
 xen/arch/x86/Rules.mk                | 2 +-
 xen/arch/x86/boot/build32.mk         | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Config.mk b/Config.mk
index 0298482ca6..952b398174 100644
--- a/Config.mk
+++ b/Config.mk
@@ -235,7 +235,7 @@ APPEND_LDFLAGS += $(foreach i, $(APPEND_LIB), -L$(i))
 APPEND_CFLAGS += $(foreach i, $(APPEND_INCLUDES), -I$(i))
 
 EMBEDDED_EXTRA_CFLAGS := -nopie -fno-stack-protector -fno-stack-protector-all
-EMBEDDED_EXTRA_CFLAGS += -fno-exceptions
+EMBEDDED_EXTRA_CFLAGS += -fno-exceptions -fno-asynchronous-unwind-tables
 
 XEN_EXTFILES_URL ?= http://xenbits.xen.org/xen-extfiles
 # All the files at that location were downloaded from elsewhere on
diff --git a/tools/tests/x86_emulator/testcase.mk b/tools/tests/x86_emulator/testcase.mk
index a565d15524..dafeb6caf7 100644
--- a/tools/tests/x86_emulator/testcase.mk
+++ b/tools/tests/x86_emulator/testcase.mk
@@ -4,7 +4,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 $(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
 
-CFLAGS += -fno-builtin -fno-asynchronous-unwind-tables -g0 $($(TESTCASE)-cflags)
+CFLAGS += -fno-builtin -g0 $($(TESTCASE)-cflags)
 
 .PHONY: all
 all: $(TESTCASE).bin
diff --git a/xen/arch/x86/Rules.mk b/xen/arch/x86/Rules.mk
index 3f2687bbe4..1455ac904c 100644
--- a/xen/arch/x86/Rules.mk
+++ b/xen/arch/x86/Rules.mk
@@ -33,7 +33,7 @@ $(call as-option-add,CFLAGS,CC,\
 $(call as-option-add,CFLAGS,CC,\
     ".L1: .L2: .nops (.L2 - .L1)$$(comma)9",-DHAVE_AS_NOPS_DIRECTIVE)
 
-CFLAGS += -mno-red-zone -fpic -fno-asynchronous-unwind-tables
+CFLAGS += -mno-red-zone -fpic
 
 # Xen doesn't use SSE interally.  If the compiler supports it, also skip the
 # SSE setup for variadic function calls.
diff --git a/xen/arch/x86/boot/build32.mk b/xen/arch/x86/boot/build32.mk
index 48c7407c00..5851ebff5f 100644
--- a/xen/arch/x86/boot/build32.mk
+++ b/xen/arch/x86/boot/build32.mk
@@ -4,7 +4,7 @@ include $(XEN_ROOT)/Config.mk
 
 $(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
 
-CFLAGS += -Werror -fno-asynchronous-unwind-tables -fno-builtin -g0 -msoft-float
+CFLAGS += -Werror -fno-builtin -g0 -msoft-float
 CFLAGS += -I$(XEN_ROOT)/xen/include
 CFLAGS := $(filter-out -flto,$(CFLAGS)) 
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 15:22:58 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 15:22:58 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jo7Eo-0008JF-J7; Wed, 24 Jun 2020 15:22: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo7En-0008J9-RO
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:22:57 +0000
X-Inumbo-ID: 944cec84-b62e-11ea-80f0-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 944cec84-b62e-11ea-80f0-12813bfff9fa;
 Wed, 24 Jun 2020 15:22: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=c/3aeajfJ63A+r0gpDm7WtR8cPRyIHgVVO6+YK2XGso=; b=QCMnqf4J+FoPNC6RhfGXoJ/WjK
 dCID/kyH2Osl2Mw8nM0f5jGOiEhoxotGYOpm81Fw6DmA1ismw3cuw4ZpG9pYUgAReNgSl6DTnwu9+
 7cqfo235tXZhHidRDjllG8q/pKe2OBrfTIP9epeKg/JQdfyKewvCl68PPbFPQGsaH1Qo=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7Em-0004Cd-0l
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:22:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7El-0007dU-W7
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:22:55 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.12] x86/build: Unilaterally disable -fcf-protection
Message-Id: <E1jo7El-0007dU-W7@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 15: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 bcdaffc58987c943e553739b6bcbfa4323cc5bd8
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 24 16:59:49 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:59:49 2020 +0200

    x86/build: Unilaterally disable -fcf-protection
    
    Xen doesn't support CET-IBT yet.  At a minimum, logic is required to enable it
    for supervisor use, but the livepatch functionality needs to learn not to
    overwrite ENDBR64 instructions.
    
    Furthermore, Ubuntu enables -fcf-protection by default, along with a buggy
    version of GCC-9 which objects to it in combination with
    -mindirect-branch=thunk-extern (Fixed in GCC 10, 9.4).
    
    Various objects (Xen boot path, Rombios 32 stubs) require .text to be at the
    beginning of the object.  These paths explode when .note.gnu.properties gets
    put ahead of .text and we end up executing the notes data.
    
    Disable -fcf-protection for all embedded objects.
    
    Reported-by: Jason Andryuk <jandryuk@gmail.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 Config.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Config.mk b/Config.mk
index 952b398174..be5634f26e 100644
--- a/Config.mk
+++ b/Config.mk
@@ -236,6 +236,7 @@ APPEND_CFLAGS += $(foreach i, $(APPEND_INCLUDES), -I$(i))
 
 EMBEDDED_EXTRA_CFLAGS := -nopie -fno-stack-protector -fno-stack-protector-all
 EMBEDDED_EXTRA_CFLAGS += -fno-exceptions -fno-asynchronous-unwind-tables
+EMBEDDED_EXTRA_CFLAGS += -fcf-protection=none
 
 XEN_EXTFILES_URL ?= http://xenbits.xen.org/xen-extfiles
 # All the files at that location were downloaded from elsewhere on
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 15:23:07 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 15: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 1jo7Ex-0008L8-Kp; Wed, 24 Jun 2020 15:23: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo7Ew-0008Kr-Qb
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:23:06 +0000
X-Inumbo-ID: 9a4e67fc-b62e-11ea-80f0-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 9a4e67fc-b62e-11ea-80f0-12813bfff9fa;
 Wed, 24 Jun 2020 15:23: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=EWbLJsgBioR2JEPjqR1DA8U5RGugi2WVgEKwOxsgH3I=; b=sZRdwDjzuKxfs6ZzFTGIJgOcso
 TTGwqJvg2I8iZNDUYLpquXqil+DhBWSEBF6xetvgOJiu2f91OZ+cNhONntaKmN9xlrT5g73BwW5Im
 9GyBhAq/DPO/7C+QW0JUc62Wn03/cxuaPX6fDTLARppvaMubZTsvwy2u8K27O5qwdN04=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7Ew-0004Dk-3r
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:23:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7Ew-0007eC-34
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:23:06 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.12] x86/hvm: Fix shifting in stdvga_mem_read()
Message-Id: <E1jo7Ew-0007eC-34@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 15:23: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 f769c99f923d0bba81626f4b50bb1e2ebc5ec9b9
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 24 17:00:33 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 17:00:33 2020 +0200

    x86/hvm: Fix shifting in stdvga_mem_read()
    
    stdvga_mem_read() has a return type of uint8_t, which promotes to int rather
    than unsigned int.  Shifting by 24 may hit the sign bit.
    
    Spotted by Coverity.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 97fb0253e6c2f2221bfd0895b7ffe3a99330d847
    master date: 2020-05-18 15:22:53 +0100
---
 xen/arch/x86/hvm/stdvga.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/stdvga.c b/xen/arch/x86/hvm/stdvga.c
index bd398dbb1b..e2675139e7 100644
--- a/xen/arch/x86/hvm/stdvga.c
+++ b/xen/arch/x86/hvm/stdvga.c
@@ -322,7 +322,7 @@ static int stdvga_mem_read(const struct hvm_io_handler *handler,
         data = stdvga_mem_readb(addr);
         data |= stdvga_mem_readb(addr + 1) << 8;
         data |= stdvga_mem_readb(addr + 2) << 16;
-        data |= stdvga_mem_readb(addr + 3) << 24;
+        data |= (uint32_t)stdvga_mem_readb(addr + 3) << 24;
         break;
 
     case 8:
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 15:23:18 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 15:23:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jo7F8-0008ME-Mm; Wed, 24 Jun 2020 15:23: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo7F7-0008M6-Es
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:23:17 +0000
X-Inumbo-ID: a057e54c-b62e-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id a057e54c-b62e-11ea-bb8b-bc764e2007e4;
 Wed, 24 Jun 2020 15:23: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=Nc3hDG2v5EQQVmh/Umrp7sPgft93v+FxCaV1DY5Z4Bg=; b=4VQ60BFsNI5AV7ynRDwoBG9Odz
 nT0ulJSOgAtP6P/gwx5WJGTUSChyF4Q6jMq7qDgpvUhs7c0rQPIIZ1AbouUM8NUF7RtMYWGw92tm3
 RTJeHD2a0zbju/RgK4Mh9+PtJIZDp8ietZrx2w2N3+wHTj5E4mlp+MnweleOPyJIiReU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7F6-0004Dt-7Q
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:23:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7F6-0007em-6Z
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:23:16 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.12] x86: determine MXCSR mask in all cases
Message-Id: <E1jo7F6-0007em-6Z@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 15:23: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 b3af150fd42ed0a0723115063c028f21feab348a
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jun 24 17:01:10 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 17:01:10 2020 +0200

    x86: determine MXCSR mask in all cases
    
    For its use(s) by the emulator to be correct in all cases, the filling
    of the variable needs to be independent of XSAVE availability. As
    there's no suitable function in i387.c to put the logic in, keep it in
    xstate_init(), arrange for the function to be called unconditionally,
    and pull the logic ahead of all return paths there.
    
    Fixes: 9a4496a35b20 ("x86emul: support {,V}{LD,ST}MXCSR")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 2b532519d64e653a6bbfd9eefed6040a09c8876d
    master date: 2020-05-18 17:18:56 +0200
---
 xen/arch/x86/cpu/common.c |  3 +--
 xen/arch/x86/xstate.c     | 18 ++++++++++++------
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 851c23ddc5..f3a8c69020 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -488,8 +488,7 @@ void identify_cpu(struct cpuinfo_x86 *c)
 
 	/* Now the feature flags better reflect actual CPU features! */
 
-	if ( cpu_has_xsave )
-		xstate_init(c);
+	xstate_init(c);
 
 #ifdef NOISY_CAPS
 	printk(KERN_DEBUG "CPU: After all inits, caps:");
diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c
index 858d1a6573..1469292d27 100644
--- a/xen/arch/x86/xstate.c
+++ b/xen/arch/x86/xstate.c
@@ -584,6 +584,18 @@ void xstate_init(struct cpuinfo_x86 *c)
     u32 eax, ebx, ecx, edx;
     u64 feature_mask;
 
+    if ( bsp )
+    {
+        static typeof(current->arch.xsave_area->fpu_sse) __initdata ctxt;
+
+        asm ( "fxsave %0" : "=m" (ctxt) );
+        if ( ctxt.mxcsr_mask )
+            mxcsr_mask = ctxt.mxcsr_mask;
+    }
+
+    if ( !cpu_has_xsave )
+        return;
+
     if ( (bsp && !use_xsave) ||
          boot_cpu_data.cpuid_level < XSTATE_CPUID )
     {
@@ -607,8 +619,6 @@ void xstate_init(struct cpuinfo_x86 *c)
 
     if ( bsp )
     {
-        static typeof(current->arch.xsave_area->fpu_sse) __initdata ctxt;
-
         xfeature_mask = feature_mask;
         /*
          * xsave_cntxt_size is the max size required by enabled features.
@@ -617,10 +627,6 @@ void xstate_init(struct cpuinfo_x86 *c)
         xsave_cntxt_size = _xstate_ctxt_size(feature_mask);
         printk("xstate: size: %#x and states: %#"PRIx64"\n",
                xsave_cntxt_size, xfeature_mask);
-
-        asm ( "fxsave %0" : "=m" (ctxt) );
-        if ( ctxt.mxcsr_mask )
-            mxcsr_mask = ctxt.mxcsr_mask;
     }
     else
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 15:23:28 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 15: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 1jo7FI-0008No-Ph; Wed, 24 Jun 2020 15: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo7FH-0008Nb-2m
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:23:27 +0000
X-Inumbo-ID: a660d840-b62e-11ea-80f0-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id a660d840-b62e-11ea-80f0-12813bfff9fa;
 Wed, 24 Jun 2020 15:23: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=5vi+l3TvjEl/AV2aVXqWy2h5CgxgoRocGis7Y8G0r6k=; b=gH7Stix7QhdOSiwtNslCW/73OO
 wIsVrhrB19s+AO8Qy5sglUOmkdV3IQZZoPgdWgqrqD4tzCn+Njt8QKySZAPFcNT7jDdVXCIYzUsiJ
 TYgIs8gdVd2nnRhECCAdKSWHGqJxzqUOszo6WOqc7RKUHFMtk0YYftxTn1p5Vepyvets=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7FG-0004E4-BH
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:23:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7FG-0007fl-AH
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:23:26 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.12] x86/idle: rework C6 EOI workaround
Message-Id: <E1jo7FG-0007fl-AH@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 15:23: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 2eb277ec762f59581a581571d6e3c170eef5d324
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Jun 24 17:01:48 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 17:01:48 2020 +0200

    x86/idle: rework C6 EOI workaround
    
    Change the C6 EOI workaround (errata AAJ72) to use x86_match_cpu. Also
    call the workaround from mwait_idle, previously it was only used by
    the ACPI idle driver. Finally make sure the routine is called for all
    states equal or greater than ACPI_STATE_C3, note that the ACPI driver
    doesn't currently handle them, but the errata condition shouldn't be
    limited by that.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 5fef1fd713660406a6187ef352fbf79986abfe43
    master date: 2020-05-20 12:48:37 +0200
---
 xen/arch/x86/acpi/cpu_idle.c  | 43 ++++++++++++++++++++++++++-----------------
 xen/arch/x86/cpu/mwait-idle.c |  3 +++
 xen/include/asm-x86/cpuidle.h |  2 ++
 3 files changed, 31 insertions(+), 17 deletions(-)

diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c
index 121aab2ce8..bc8a7c6568 100644
--- a/xen/arch/x86/acpi/cpu_idle.c
+++ b/xen/arch/x86/acpi/cpu_idle.c
@@ -515,26 +515,35 @@ void trace_exit_reason(u32 *irq_traced)
     }
 }
 
-/*
- * "AAJ72. EOI Transaction May Not be Sent if Software Enters Core C6 During 
- * an Interrupt Service Routine"
- * 
- * There was an errata with some Core i7 processors that an EOI transaction 
- * may not be sent if software enters core C6 during an interrupt service 
- * routine. So we don't enter deep Cx state if there is an EOI pending.
- */
-static bool errata_c6_eoi_workaround(void)
+bool errata_c6_eoi_workaround(void)
 {
-    static int8_t fix_needed = -1;
+    static int8_t __read_mostly fix_needed = -1;
 
     if ( unlikely(fix_needed == -1) )
     {
-        int model = boot_cpu_data.x86_model;
-        fix_needed = (cpu_has_apic && !directed_eoi_enabled &&
-                      (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) &&
-                      (boot_cpu_data.x86 == 6) &&
-                      ((model == 0x1a) || (model == 0x1e) || (model == 0x1f) ||
-                       (model == 0x25) || (model == 0x2c) || (model == 0x2f)));
+#define INTEL_FAM6_MODEL(m) { X86_VENDOR_INTEL, 6, m, X86_FEATURE_ALWAYS }
+        /*
+         * Errata AAJ72: EOI Transaction May Not be Sent if Software Enters
+         * Core C6 During an Interrupt Service Routine"
+         *
+         * There was an errata with some Core i7 processors that an EOI
+         * transaction may not be sent if software enters core C6 during an
+         * interrupt service routine. So we don't enter deep Cx state if
+         * there is an EOI pending.
+         */
+        static const struct x86_cpu_id eoi_errata[] = {
+            INTEL_FAM6_MODEL(0x1a),
+            INTEL_FAM6_MODEL(0x1e),
+            INTEL_FAM6_MODEL(0x1f),
+            INTEL_FAM6_MODEL(0x25),
+            INTEL_FAM6_MODEL(0x2c),
+            INTEL_FAM6_MODEL(0x2f),
+            { }
+        };
+#undef INTEL_FAM6_MODEL
+
+        fix_needed = cpu_has_apic && !directed_eoi_enabled &&
+                     x86_match_cpu(eoi_errata);
     }
 
     return (fix_needed && cpu_has_pending_apic_eoi());
@@ -627,7 +636,7 @@ static void acpi_processor_idle(void)
         return;
     }
 
-    if ( (cx->type == ACPI_STATE_C3) && errata_c6_eoi_workaround() )
+    if ( (cx->type >= ACPI_STATE_C3) && errata_c6_eoi_workaround() )
         cx = power->safe_state;
 
 
diff --git a/xen/arch/x86/cpu/mwait-idle.c b/xen/arch/x86/cpu/mwait-idle.c
index f89c52f256..a3e286162f 100644
--- a/xen/arch/x86/cpu/mwait-idle.c
+++ b/xen/arch/x86/cpu/mwait-idle.c
@@ -763,6 +763,9 @@ static void mwait_idle(void)
 		return;
 	}
 
+	if ((cx->type >= 3) && errata_c6_eoi_workaround())
+		cx = power->safe_state;
+
 	eax = cx->address;
 	cstate = ((eax >> MWAIT_SUBSTATE_SIZE) & MWAIT_CSTATE_MASK) + 1;
 
diff --git a/xen/include/asm-x86/cpuidle.h b/xen/include/asm-x86/cpuidle.h
index 08da01803f..007fe38563 100644
--- a/xen/include/asm-x86/cpuidle.h
+++ b/xen/include/asm-x86/cpuidle.h
@@ -26,6 +26,8 @@ void update_idle_stats(struct acpi_processor_power *,
 void update_last_cx_stat(struct acpi_processor_power *,
                          struct acpi_processor_cx *, uint64_t);
 
+bool errata_c6_eoi_workaround(void);
+
 /*
  * vcpu is urgent if vcpu is polling event channel
  *
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 15:23:38 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 15: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 1jo7FS-0008Og-RQ; Wed, 24 Jun 2020 15:23: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo7FR-0008OX-4y
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:23:37 +0000
X-Inumbo-ID: ac6056a8-b62e-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id ac6056a8-b62e-11ea-b7bb-bc764e2007e4;
 Wed, 24 Jun 2020 15:23: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=SyQ0M+d9GJZPnzKkKvr8zTsTcgLgDKQB2bVY/bvitSY=; b=jcnsh6XB+vIwyqH8v351R+hUtJ
 Z/xxeAOXR0zal4+dXiMdXx+xciZWHBlMKFE22dtoVwLY0i0XsXcg5XgUoHOViQlBUzqcabaXGxi0K
 cjqVa+q2ENShBmlq7NgG7/OaSrA8gxLIqALuqQ5lHOW2SJpvm2e0lpvfMp3TbCzro5t4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7FQ-0004ED-ES
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:23:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7FQ-0007gC-DX
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:23:36 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.12] x86/idle: prevent entering C6 with in service
 interrupts on Intel
Message-Id: <E1jo7FQ-0007gC-DX@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 15:23: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 ed44947e18ebdc7f345fbc36918febd77f7d5775
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Jun 24 17:02:23 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 17:02:23 2020 +0200

    x86/idle: prevent entering C6 with in service interrupts on Intel
    
    Apply a workaround for Intel errata BDX99, CLX30, SKX100, CFW125,
    BDF104, BDH85, BDM135, KWB131: "A Pending Fixed Interrupt May Be
    Dispatched Before an Interrupt of The Same Priority Completes".
    
    Apply the errata to all server and client models (big cores) from
    Broadwell to Cascade Lake. The workaround is grouped together with the
    existing fix for errata AAJ72, and the eoi from the function name is
    removed.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: fc44a7014cafe28b8c53eeaf6ac2a71f5bc8b815
    master date: 2020-05-22 16:07:38 +0200
---
 xen/arch/x86/acpi/cpu_idle.c  | 38 ++++++++++++++++++++++++++++++++++----
 xen/arch/x86/cpu/mwait-idle.c |  2 +-
 xen/include/asm-x86/cpuidle.h |  2 +-
 3 files changed, 36 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c
index bc8a7c6568..e879f8dfe9 100644
--- a/xen/arch/x86/acpi/cpu_idle.c
+++ b/xen/arch/x86/acpi/cpu_idle.c
@@ -515,7 +515,7 @@ void trace_exit_reason(u32 *irq_traced)
     }
 }
 
-bool errata_c6_eoi_workaround(void)
+bool errata_c6_workaround(void)
 {
     static int8_t __read_mostly fix_needed = -1;
 
@@ -540,10 +540,40 @@ bool errata_c6_eoi_workaround(void)
             INTEL_FAM6_MODEL(0x2f),
             { }
         };
+        /*
+         * Errata BDX99, CLX30, SKX100, CFW125, BDF104, BDH85, BDM135, KWB131:
+         * A Pending Fixed Interrupt May Be Dispatched Before an Interrupt of
+         * The Same Priority Completes.
+         *
+         * Resuming from C6 Sleep-State, with Fixed Interrupts of the same
+         * priority queued (in the corresponding bits of the IRR and ISR APIC
+         * registers), the processor may dispatch the second interrupt (from
+         * the IRR bit) before the first interrupt has completed and written to
+         * the EOI register, causing the first interrupt to never complete.
+         */
+        static const struct x86_cpu_id isr_errata[] = {
+            /* Broadwell */
+            INTEL_FAM6_MODEL(0x47),
+            INTEL_FAM6_MODEL(0x3d),
+            INTEL_FAM6_MODEL(0x4f),
+            INTEL_FAM6_MODEL(0x56),
+            /* Skylake (client) */
+            INTEL_FAM6_MODEL(0x5e),
+            INTEL_FAM6_MODEL(0x4e),
+            /* {Sky/Cascade}lake (server) */
+            INTEL_FAM6_MODEL(0x55),
+            /* {Kaby/Coffee/Whiskey/Amber} Lake */
+            INTEL_FAM6_MODEL(0x9e),
+            INTEL_FAM6_MODEL(0x8e),
+            /* Cannon Lake */
+            INTEL_FAM6_MODEL(0x66),
+            { }
+        };
 #undef INTEL_FAM6_MODEL
 
-        fix_needed = cpu_has_apic && !directed_eoi_enabled &&
-                     x86_match_cpu(eoi_errata);
+        fix_needed = cpu_has_apic &&
+                     ((!directed_eoi_enabled && x86_match_cpu(eoi_errata)) ||
+                      x86_match_cpu(isr_errata));
     }
 
     return (fix_needed && cpu_has_pending_apic_eoi());
@@ -636,7 +666,7 @@ static void acpi_processor_idle(void)
         return;
     }
 
-    if ( (cx->type >= ACPI_STATE_C3) && errata_c6_eoi_workaround() )
+    if ( (cx->type >= ACPI_STATE_C3) && errata_c6_workaround() )
         cx = power->safe_state;
 
 
diff --git a/xen/arch/x86/cpu/mwait-idle.c b/xen/arch/x86/cpu/mwait-idle.c
index a3e286162f..bf058777fd 100644
--- a/xen/arch/x86/cpu/mwait-idle.c
+++ b/xen/arch/x86/cpu/mwait-idle.c
@@ -763,7 +763,7 @@ static void mwait_idle(void)
 		return;
 	}
 
-	if ((cx->type >= 3) && errata_c6_eoi_workaround())
+	if ((cx->type >= 3) && errata_c6_workaround())
 		cx = power->safe_state;
 
 	eax = cx->address;
diff --git a/xen/include/asm-x86/cpuidle.h b/xen/include/asm-x86/cpuidle.h
index 007fe38563..b5faac0051 100644
--- a/xen/include/asm-x86/cpuidle.h
+++ b/xen/include/asm-x86/cpuidle.h
@@ -26,7 +26,7 @@ void update_idle_stats(struct acpi_processor_power *,
 void update_last_cx_stat(struct acpi_processor_power *,
                          struct acpi_processor_cx *, uint64_t);
 
-bool errata_c6_eoi_workaround(void);
+bool errata_c6_workaround(void);
 
 /*
  * vcpu is urgent if vcpu is polling event channel
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 15:23:48 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 15: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 1jo7Fc-0008Ph-TB; Wed, 24 Jun 2020 15:23: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo7Fb-0008PT-63
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:23:47 +0000
X-Inumbo-ID: b2673bfc-b62e-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id b2673bfc-b62e-11ea-bb8b-bc764e2007e4;
 Wed, 24 Jun 2020 15: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=ibrWHbqkjBiNYZRcQY7HKLTOlDx/dMSZ5HHBKJeooOQ=; b=Si/cg+k0AtBBWREloE0t36ZIom
 soKwvo2PuGBLyMSDOsHCc8CJ0xMVsRcen1c2qRaOabbXWIUWSHgJhAbV63A8RvC0S/ZzDmjE15cPo
 kb020+6sFFczCf+6EycLDDsKmHl5La9RBNYbW+cP387enBX3MNYLfI36FOweBZrpJNTo=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7Fa-0004EL-Hs
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:23:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7Fa-0007hN-Gy
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:23:46 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.12] x86/idle: prevent entering C3/C6 on some Intel
 CPUs due to errata
Message-Id: <E1jo7Fa-0007hN-Gy@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 15:23: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 4969f34b496bff1185e5280cedb4fe99112e3066
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Jun 24 17:02:55 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 17:02:55 2020 +0200

    x86/idle: prevent entering C3/C6 on some Intel CPUs due to errata
    
    Apply a workaround for errata BA80, AAK120, AAM108, AAO67, BD59,
    AAY54: Rapid Core C3/C6 Transition May Cause Unpredictable System
    Behavior.
    
    Limit maximum C state to C1 when SMT is enabled on the affected CPUs.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: b2d502466547e6782ccadd501b8ef1482c391f2c
    master date: 2020-05-22 16:08:54 +0200
---
 xen/arch/x86/cpu/intel.c | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/xen/arch/x86/cpu/intel.c b/xen/arch/x86/cpu/intel.c
index 29c6b87512..986748b155 100644
--- a/xen/arch/x86/cpu/intel.c
+++ b/xen/arch/x86/cpu/intel.c
@@ -262,6 +262,41 @@ static void early_init_intel(struct cpuinfo_x86 *c)
 	ctxt_switch_levelling(NULL);
 }
 
+/*
+ * Errata BA80, AAK120, AAM108, AAO67, BD59, AAY54: Rapid Core C3/C6 Transition
+ * May Cause Unpredictable System Behavior
+ *
+ * Under a complex set of internal conditions, cores rapidly performing C3/C6
+ * transitions in a system with Intel Hyper-Threading Technology enabled may
+ * cause a machine check error (IA32_MCi_STATUS.MCACOD = 0x0106), system hang
+ * or unpredictable system behavior.
+ */
+static void probe_c3_errata(const struct cpuinfo_x86 *c)
+{
+#define INTEL_FAM6_MODEL(m) { X86_VENDOR_INTEL, 6, m, X86_FEATURE_ALWAYS }
+    static const struct x86_cpu_id models[] = {
+        /* Nehalem */
+        INTEL_FAM6_MODEL(0x1a),
+        INTEL_FAM6_MODEL(0x1e),
+        INTEL_FAM6_MODEL(0x1f),
+        INTEL_FAM6_MODEL(0x2e),
+        /* Westmere (note Westmere-EX is not affected) */
+        INTEL_FAM6_MODEL(0x2c),
+        INTEL_FAM6_MODEL(0x25),
+        { }
+    };
+#undef INTEL_FAM6_MODEL
+
+    /* Serialized by the AP bringup code. */
+    if ( max_cstate > 1 && (c->apicid & (c->x86_num_siblings - 1)) &&
+         x86_match_cpu(models) )
+    {
+        printk(XENLOG_WARNING
+	       "Disabling C-states C3 and C6 due to CPU errata\n");
+        max_cstate = 1;
+    }
+}
+
 /*
  * P4 Xeon errata 037 workaround.
  * Hardware prefetcher may cause stale data to be loaded into the cache.
@@ -289,6 +324,8 @@ static void Intel_errata_workarounds(struct cpuinfo_x86 *c)
 
 	if (cpu_has_tsx_force_abort && opt_rtm_abort)
 		wrmsrl(MSR_TSX_FORCE_ABORT, TSX_FORCE_ABORT_RTM);
+
+	probe_c3_errata(c);
 }
 
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 15:23:58 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 15: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 1jo7Fm-0008Qu-Ul; Wed, 24 Jun 2020 15:23: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo7Fl-0008Qf-8t
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:23:57 +0000
X-Inumbo-ID: b87030da-b62e-11ea-80f0-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id b87030da-b62e-11ea-80f0-12813bfff9fa;
 Wed, 24 Jun 2020 15: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=n8IXrDcFhXy1ZoQgyfRdYsBVvjMG0XQ3q+Jvbid8EFY=; b=kt8V8BTdzZZBb6vHgOjD85ipu4
 xDOP4YMxv9l4xRmGhNPhemKfPtzExUu/CZzqedyAm4ZJwv+/THbCRMBUMCUC8jwzHWPMHNjGVUoy5
 eEz+hgp1RDteONJVCtazFKIcpT1iRuvJIpw91xV20CgUORFx3Jb5QyizdAh+BKtfhBBg=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7Fk-0004ET-LQ
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:23:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7Fk-0007iC-KO
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:23:56 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.12] x86/idle: Extend ISR/C6 erratum workaround to
 Haswell
Message-Id: <E1jo7Fk-0007iC-KO@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 15:23: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 1f581f966a789c29d05dd7d9d58d98dba06c01c9
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 24 17:03:30 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 17:03:30 2020 +0200

    x86/idle: Extend ISR/C6 erratum workaround to Haswell
    
    This bug was first discovered against Haswell.  It is definitely affected.
    
    (The XenServer ticket for this bug was opened on 2013-05-30 which is coming up
    on 7 years old, and predates Broadwell).
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: b72d8870b5f68f06b083e6bfdb28f081bcb6ab3b
    master date: 2020-05-22 20:04:23 +0100
---
 xen/arch/x86/acpi/cpu_idle.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c
index e879f8dfe9..4ff8693ae6 100644
--- a/xen/arch/x86/acpi/cpu_idle.c
+++ b/xen/arch/x86/acpi/cpu_idle.c
@@ -550,8 +550,16 @@ bool errata_c6_workaround(void)
          * registers), the processor may dispatch the second interrupt (from
          * the IRR bit) before the first interrupt has completed and written to
          * the EOI register, causing the first interrupt to never complete.
+         *
+         * Note: Haswell hasn't had errata issued, but this issue was first
+         * discovered on Haswell hardware, and is affected.
          */
         static const struct x86_cpu_id isr_errata[] = {
+            /* Haswell */
+            INTEL_FAM6_MODEL(0x3c),
+            INTEL_FAM6_MODEL(0x3f),
+            INTEL_FAM6_MODEL(0x45),
+            INTEL_FAM6_MODEL(0x46),
             /* Broadwell */
             INTEL_FAM6_MODEL(0x47),
             INTEL_FAM6_MODEL(0x3d),
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 15:24:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 15:24:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jo7Fx-0008S3-03; Wed, 24 Jun 2020 15:24: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo7Fv-0008Rs-Kv
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:24:07 +0000
X-Inumbo-ID: be769b40-b62e-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id be769b40-b62e-11ea-b7bb-bc764e2007e4;
 Wed, 24 Jun 2020 15:24: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=IfDELNXs346vMJ44XseiOJLkX+U0l2AMbAxIxzrLJyo=; b=et4drWPsi/cmhsa/T1eX4JM2a7
 GlcJ3K37LTglBsviQwGoGzV167Z5F5cIE0BwceQnkIGsOOSJ9PFCwPtwTrc2UozAA6FJqCI19QK36
 2XJJW8OG2N9PH5eFYjk7rtV6/5BhRu1WEGhT65f+7Uhw0yOT4PFj0kt1JU+596l6wXxY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7Fu-0004FF-Oy
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:24:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7Fu-0007jK-OE
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:24:06 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.12] x86: clear RDRAND CPUID bit on AMD family 15h/16h
Message-Id: <E1jo7Fu-0007jK-OE@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 15:24: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 aca68b9ca9a39e88f42a35cd9aae1ce5d08d6154
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jun 24 17:10:22 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 17:10:22 2020 +0200

    x86: clear RDRAND CPUID bit on AMD family 15h/16h
    
    Inspired by Linux commit c49a0a80137c7ca7d6ced4c812c9e07a949f6f24:
    
        There have been reports of RDRAND issues after resuming from suspend on
        some AMD family 15h and family 16h systems. This issue stems from a BIOS
        not performing the proper steps during resume to ensure RDRAND continues
        to function properly.
    
        Update the CPU initialization to clear the RDRAND CPUID bit for any family
        15h and 16h processor that supports RDRAND. If it is known that the family
        15h or family 16h system does not have an RDRAND resume issue or that the
        system will not be placed in suspend, the "cpuid=rdrand" kernel parameter
        can be used to stop the clearing of the RDRAND CPUID bit.
    
        Note, that clearing the RDRAND CPUID bit does not prevent a processor
        that normally supports the RDRAND instruction from executing it. So any
        code that determined the support based on family and model won't #UD.
    
    Warn if no explicit choice was given on affected hardware.
    
    Check RDRAND functions at boot as well as after S3 resume (the retry
    limit chosen is entirely arbitrary).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 93401e28a84b9dc5945f5d0bf5bce68e9d5ee121
    master date: 2020-05-27 09:49:37 +0200
---
 docs/misc/xen-command-line.pandoc |  5 ++++-
 xen/arch/x86/cpu/amd.c            | 21 +++++++++++++++++++++
 xen/arch/x86/cpu/common.c         | 27 +++++++++++++++++++++++++++
 xen/arch/x86/cpuid.c              |  2 ++
 xen/include/asm-x86/processor.h   |  1 +
 5 files changed, 55 insertions(+), 1 deletion(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 7897da55ca..d7919f2ed4 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -492,7 +492,10 @@ The Speculation Control hardware features `srbds-ctrl`, `md-clear`, `ibrsb`,
 applicable.  They can all be ignored.
 
 `rdrand` and `rdseed` can be ignored, as a mitigation to XSA-320 /
-CVE-2020-0543.
+CVE-2020-0543.  The RDRAND feature is disabled by default on certain AMD
+systems, due to possible malfunctions after ACPI S3 suspend/resume.  `rdrand`
+may be used in its positive form to override Xen's default behaviour on these
+systems, and make the feature fully usable.
 
 ### cpuid_mask_cpu
 > `= fam_0f_rev_[cdefg] | fam_10_rev_[bc] | fam_11_rev_b`
diff --git a/xen/arch/x86/cpu/amd.c b/xen/arch/x86/cpu/amd.c
index 7144717da7..eb48e29e17 100644
--- a/xen/arch/x86/cpu/amd.c
+++ b/xen/arch/x86/cpu/amd.c
@@ -3,6 +3,7 @@
 #include <xen/mm.h>
 #include <xen/smp.h>
 #include <xen/pci.h>
+#include <xen/warning.h>
 #include <asm/io.h>
 #include <asm/msr.h>
 #include <asm/processor.h>
@@ -633,6 +634,26 @@ static void init_amd(struct cpuinfo_x86 *c)
 		if (acpi_smi_cmd && (acpi_enable_value | acpi_disable_value))
 			amd_acpi_c1e_quirk = true;
 		break;
+
+	case 0x15: case 0x16:
+		/*
+		 * There are some Fam15/Fam16 systems where upon resume from S3
+		 * firmware fails to re-setup properly functioning RDRAND.
+		 * By the time we can spot the problem, it is too late to take
+		 * action, and there is nothing Xen can do to repair the problem.
+		 * Clear the feature unless force-enabled on the command line.
+		 */
+		if (c == &boot_cpu_data &&
+		    cpu_has(c, X86_FEATURE_RDRAND) &&
+		    !is_forced_cpu_cap(X86_FEATURE_RDRAND)) {
+			static const char __initconst text[] =
+				"RDRAND may cease to work on this hardware upon resume from S3.\n"
+				"Please choose an explicit cpuid={no-}rdrand setting.\n";
+
+			setup_clear_cpu_cap(X86_FEATURE_RDRAND);
+			warning_add(text);
+		}
+		break;
 	}
 
 	display_cacheinfo(c);
diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index f3a8c69020..9bd9e3e24e 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -10,6 +10,7 @@
 #include <asm/io.h>
 #include <asm/mpspec.h>
 #include <asm/apic.h>
+#include <asm/random.h>
 #include <mach_apic.h>
 #include <public/sysctl.h> /* for XEN_INVALID_{SOCKET,CORE}_ID */
 
@@ -94,6 +95,11 @@ void __init setup_force_cpu_cap(unsigned int cap)
 	__set_bit(cap, boot_cpu_data.x86_capability);
 }
 
+bool __init is_forced_cpu_cap(unsigned int cap)
+{
+	return test_bit(cap, forced_caps);
+}
+
 static void default_init(struct cpuinfo_x86 * c)
 {
 	/* Not much we can do here... */
@@ -497,6 +503,27 @@ void identify_cpu(struct cpuinfo_x86 *c)
 	printk("\n");
 #endif
 
+	/*
+	 * If RDRAND is available, make an attempt to check that it actually
+	 * (still) works.
+	 */
+	if (cpu_has(c, X86_FEATURE_RDRAND)) {
+		unsigned int prev = 0;
+
+		for (i = 0; i < 5; ++i)
+		{
+			unsigned int cur = arch_get_random();
+
+			if (prev && cur != prev)
+				break;
+			prev = cur;
+		}
+
+		if (i >= 5)
+			printk(XENLOG_WARNING "CPU%u: RDRAND appears to not work\n",
+			       smp_processor_id());
+	}
+
 	if (system_state == SYS_STATE_resume)
 		return;
 
diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index d07567c901..91faf02a2b 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -68,6 +68,8 @@ static int __init parse_xen_cpuid(const char *s)
         {
             if ( !val )
                 setup_clear_cpu_cap(X86_FEATURE_RDRAND);
+            else if ( (cpuid_ecx(1) & cpufeat_mask(X86_FEATURE_RDRAND)) )
+                setup_force_cpu_cap(X86_FEATURE_RDRAND);
         }
         else if ( (val = parse_boolean("rdseed", s, ss)) >= 0 )
         {
diff --git a/xen/include/asm-x86/processor.h b/xen/include/asm-x86/processor.h
index 1b52712180..c6f26a85b8 100644
--- a/xen/include/asm-x86/processor.h
+++ b/xen/include/asm-x86/processor.h
@@ -167,6 +167,7 @@ extern const struct x86_cpu_id *x86_match_cpu(const struct x86_cpu_id table[]);
 extern void identify_cpu(struct cpuinfo_x86 *);
 extern void setup_clear_cpu_cap(unsigned int);
 extern void setup_force_cpu_cap(unsigned int);
+extern bool is_forced_cpu_cap(unsigned int);
 extern void print_cpu_info(unsigned int cpu);
 extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 15:24:19 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 15:24:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jo7G7-0008TJ-3C; Wed, 24 Jun 2020 15:24: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo7G6-0008T7-1r
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:24:18 +0000
X-Inumbo-ID: c478f59c-b62e-11ea-80f0-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id c478f59c-b62e-11ea-80f0-12813bfff9fa;
 Wed, 24 Jun 2020 15:24: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=+sHjmi8+mmgiizSQRmkyYj7omg+mBmno/s8l1r/uUCo=; b=oCkSTxvqUmy49VEjxUMvqR4B5r
 HMcgW93sDE91WpWnN2S8vsnzIOAVGRYpC1y73slWGteeJ7EL/dXtKlEHYsVD4OVbvGNG7EEd2fWdu
 MBo19bYW6sbQlWp4hofj65RQpPsAxHceFKr1WcTRMFaDWQsA058KmGhKAn6F1YclEMg8=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7G4-0004FR-Rw
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:24:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7G4-0007kB-RG
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:24:16 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.12] x86/boot: Fix load_system_tables() to be
 NMI/#MC-safe
Message-Id: <E1jo7G4-0007kB-RG@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 15:24: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 218a19b911c28e79fdb8dc73436cdddc5f42d934
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 24 17:11:08 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 17:11:08 2020 +0200

    x86/boot: Fix load_system_tables() to be NMI/#MC-safe
    
    During boot, load_system_tables() is used in reinit_bsp_stack() to switch the
    virtual addresses used from their .data/.bss alias, to their directmap alias.
    
    The structure assignment is implemented as a memset() to zero first, then a
    copy-in of the new data.  This causes the NMI/#MC stack pointers to
    transiently become 0, at a point where we may have an NMI watchdog running.
    
    Rewrite the logic using a volatile tss pointer (equivalent to, but more
    readable than, using ACCESS_ONCE() for all writes).
    
    This does drop the zeroing side effect for holes in the structure, but the
    backing memory for the TSS is fully zeroed anyway, and architecturally, they
    are all reserved.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 9f3e9139fa6c3d620eb08dff927518fc88200b8d
    master date: 2020-05-27 16:44:04 +0100
---
 xen/arch/x86/cpu/common.c | 49 ++++++++++++++++++++++-------------------------
 1 file changed, 23 insertions(+), 26 deletions(-)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 9bd9e3e24e..7a21941e40 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -749,11 +749,12 @@ void __init early_cpu_init(void)
  */
 void load_system_tables(void)
 {
-	unsigned int cpu = smp_processor_id();
+	unsigned int i, cpu = smp_processor_id();
 	unsigned long stack_bottom = get_stack_bottom(),
 		stack_top = stack_bottom & ~(STACK_SIZE - 1);
 
-	struct tss64 *tss = &this_cpu(tss_page).tss;
+	/* The TSS may be live.	 Disuade any clever optimisations. */
+	volatile struct tss64 *tss = &this_cpu(tss_page).tss;
 	seg_desc_t *gdt =
 		this_cpu(gdt_table) - FIRST_RESERVED_GDT_ENTRY;
 	seg_desc_t *compat_gdt =
@@ -768,30 +769,26 @@ void load_system_tables(void)
 		.limit = (IDT_ENTRIES * sizeof(idt_entry_t)) - 1,
 	};
 
-	*tss = (struct tss64){
-		/* Main stack for interrupts/exceptions. */
-		.rsp0 = stack_bottom,
-
-		/* Ring 1 and 2 stacks poisoned. */
-		.rsp1 = 0x8600111111111111ul,
-		.rsp2 = 0x8600111111111111ul,
-
-		/*
-		 * MCE, NMI and Double Fault handlers get their own stacks.
-		 * All others poisoned.
-		 */
-		.ist = {
-			[IST_MCE - 1] = stack_top + IST_MCE * PAGE_SIZE,
-			[IST_DF  - 1] = stack_top + IST_DF  * PAGE_SIZE,
-			[IST_NMI - 1] = stack_top + IST_NMI * PAGE_SIZE,
-			[IST_DB  - 1] = stack_top + IST_DB  * PAGE_SIZE,
-
-			[IST_MAX ... ARRAY_SIZE(tss->ist) - 1] =
-				0x8600111111111111ul,
-		},
-
-		.bitmap = IOBMP_INVALID_OFFSET,
-	};
+	/*
+	 * Set up the TSS.  Warning - may be live, and the NMI/#MC must remain
+	 * valid on every instruction boundary.  (Note: these are all
+	 * semantically ACCESS_ONCE() due to tss's volatile qualifier.)
+	 *
+	 * rsp0 refers to the primary stack.  #MC, #DF, NMI and #DB handlers
+	 * each get their own stacks.  No IO Bitmap.
+	 */
+	tss->rsp0 = stack_bottom;
+	tss->ist[IST_MCE - 1] = stack_top + IST_MCE * PAGE_SIZE;
+	tss->ist[IST_DF  - 1] = stack_top + IST_DF  * PAGE_SIZE;
+	tss->ist[IST_NMI - 1] = stack_top + IST_NMI * PAGE_SIZE;
+	tss->ist[IST_DB  - 1] = stack_top + IST_DB  * PAGE_SIZE;
+	tss->bitmap = IOBMP_INVALID_OFFSET;
+
+	/* All other stack pointers poisioned. */
+	for ( i = IST_MAX; i < ARRAY_SIZE(tss->ist); ++i )
+		tss->ist[i] = 0x8600111111111111ul;
+	tss->rsp1 = 0x8600111111111111ul;
+	tss->rsp2 = 0x8600111111111111ul;
 
 	BUILD_BUG_ON(sizeof(*tss) <= 0x67); /* Mandated by the architecture. */
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 15:24:29 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 15:24:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jo7GH-0008V3-4r; Wed, 24 Jun 2020 15:24: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo7GF-0008Ul-Oz
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:24:27 +0000
X-Inumbo-ID: ca818fee-b62e-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id ca818fee-b62e-11ea-b7bb-bc764e2007e4;
 Wed, 24 Jun 2020 15:24: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=3vl5cVLpSeuvnB/ODlcWsLicTwpgwDs+P5T7sFN+S6Y=; b=1v01MVuU+wAqQ9rb3D8ldB2TQ8
 q2J/KQPRdiiV5OBwmNTQ5WWJd9KHTCfLr4n20zv1DyO6MN1zJY+wFNT5KfyTDlZ6VFxjUMA0mxBVN
 oitcmtmskvf1qiIX5SGQ2ZEtBpCo7NnlIGrgT0UDz0fMN7OYCMuEloIHbVCB/BBmtSBk=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7GE-0004FZ-Vw
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:24:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7GE-0007lw-UN
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:24:26 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.12] VT-x: extend LBR Broadwell errata coverage
Message-Id: <E1jo7GE-0007lw-UN@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 15:24: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 ad20170c7135b591f262719725f457c029fe34ad
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jun 24 17:11:44 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 17:11:44 2020 +0200

    VT-x: extend LBR Broadwell errata coverage
    
    For lbr_tsx_fixup_check() simply name a few more specific erratum
    numbers.
    
    For bdf93_fixup_check(), however, more models are affected. Oddly enough
    despite being the same model and stepping, the erratum is listed for
    Xeon E3 but not its Core counterpart. Apply the workaround uniformly,
    and also for Xeon D, which only has the LBR-from one listed in its spec
    update.
    
    Seeing this broader applicability, rename anything BDF93-related to more
    generic names.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: 724913de8ac8426d313a4645741d86c1169ae406
    master date: 2020-05-28 12:03:25 +0200
---
 xen/arch/x86/hvm/vmx/vmx.c | 52 ++++++++++++++++++++++++++++++----------------
 1 file changed, 34 insertions(+), 18 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 69a9b502f6..7d29065d0b 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2449,7 +2449,7 @@ static void pi_notification_interrupt(struct cpu_user_regs *regs)
 }
 
 static void __init lbr_tsx_fixup_check(void);
-static void __init bdf93_fixup_check(void);
+static void __init ler_to_fixup_check(void);
 
 /*
  * Calculate whether the CPU is vulnerable to Instruction Fetch page
@@ -2628,7 +2628,7 @@ const struct hvm_function_table * __init start_vmx(void)
     setup_vmcs_dump();
 
     lbr_tsx_fixup_check();
-    bdf93_fixup_check();
+    ler_to_fixup_check();
 
     return &vmx_function_table;
 }
@@ -2927,11 +2927,11 @@ enum
 
 #define LBR_MSRS_INSERTED      (1u << 0)
 #define LBR_FIXUP_TSX          (1u << 1)
-#define LBR_FIXUP_BDF93        (1u << 2)
-#define LBR_FIXUP_MASK         (LBR_FIXUP_TSX | LBR_FIXUP_BDF93)
+#define LBR_FIXUP_LER_TO       (1u << 2)
+#define LBR_FIXUP_MASK         (LBR_FIXUP_TSX | LBR_FIXUP_LER_TO)
 
 static bool __read_mostly lbr_tsx_fixup_needed;
-static bool __read_mostly bdf93_fixup_needed;
+static bool __read_mostly ler_to_fixup_needed;
 
 static void __init lbr_tsx_fixup_check(void)
 {
@@ -2939,7 +2939,7 @@ static void __init lbr_tsx_fixup_check(void)
     uint32_t lbr_format;
 
     /*
-     * HSM182, HSD172, HSE117, BDM127, BDD117, BDF85, BDE105:
+     * Haswell erratum HSM182 et al, Broadwell erratum BDM127 et al:
      *
      * On processors that do not support Intel Transactional Synchronization
      * Extensions (Intel TSX) (CPUID.07H.EBX bits 4 and 11 are both zero),
@@ -2963,8 +2963,11 @@ static void __init lbr_tsx_fixup_check(void)
     case 0x45: /* HSM182 - 4th gen Core */
     case 0x46: /* HSM182, HSD172 - 4th gen Core (GT3) */
     case 0x3d: /* BDM127 - 5th gen Core */
-    case 0x47: /* BDD117 - 5th gen Core (GT3) */
-    case 0x4f: /* BDF85  - Xeon E5-2600 v4 */
+    case 0x47: /* BDD117 - 5th gen Core (GT3)
+                  BDW117 - Xeon E3-1200 v4 */
+    case 0x4f: /* BDF85  - Xeon E5-2600 v4
+                  BDH75  - Core-i7 for LGA2011-v3 Socket
+                  BDX88  - Xeon E7-x800 v4 */
     case 0x56: /* BDE105 - Xeon D-1500 */
         break;
     default:
@@ -2985,18 +2988,31 @@ static void __init lbr_tsx_fixup_check(void)
         lbr_tsx_fixup_needed = true;
 }
 
-static void __init bdf93_fixup_check(void)
+static void __init ler_to_fixup_check(void)
 {
     /*
-     * Broadwell erratum BDF93:
+     * Broadwell erratum BDF93 et al:
      *
      * Reads from MSR_LER_TO_LIP (MSR 1DEH) may return values for bits[63:61]
      * that are not equal to bit[47].  Attempting to context switch this value
      * may cause a #GP.  Software should sign extend the MSR.
      */
-    if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
-         boot_cpu_data.x86 == 6 && boot_cpu_data.x86_model == 0x4f )
-        bdf93_fixup_needed = true;
+    if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL ||
+         boot_cpu_data.x86 != 6 )
+        return;
+
+    switch ( boot_cpu_data.x86_model )
+    {
+    case 0x3d: /* BDM131 - 5th gen Core */
+    case 0x47: /* BDD??? - 5th gen Core (H-Processor line)
+                  BDW120 - Xeon E3-1200 v4 */
+    case 0x4f: /* BDF93  - Xeon E5-2600 v4
+                  BDH80  - Core-i7 for LGA2011-v3 Socket
+                  BDX93  - Xeon E7-x800 v4 */
+    case 0x56: /* BDE??? - Xeon D-1500 */
+        ler_to_fixup_needed = true;
+        break;
+    }
 }
 
 static int is_last_branch_msr(u32 ecx)
@@ -3357,8 +3373,8 @@ static int vmx_msr_write_intercept(unsigned int msr, uint64_t msr_content)
             v->arch.hvm.vmx.lbr_flags |= LBR_MSRS_INSERTED;
             if ( lbr_tsx_fixup_needed )
                 v->arch.hvm.vmx.lbr_flags |= LBR_FIXUP_TSX;
-            if ( bdf93_fixup_needed )
-                v->arch.hvm.vmx.lbr_flags |= LBR_FIXUP_BDF93;
+            if ( ler_to_fixup_needed )
+                v->arch.hvm.vmx.lbr_flags |= LBR_FIXUP_LER_TO;
         }
 
         __vmwrite(GUEST_IA32_DEBUGCTL, msr_content);
@@ -4418,7 +4434,7 @@ static void sign_extend_msr(struct vcpu *v, u32 msr, int type)
         entry->data = canonicalise_addr(entry->data);
 }
 
-static void bdf93_fixup(void)
+static void ler_to_fixup(void)
 {
     struct vcpu *curr = current;
 
@@ -4431,8 +4447,8 @@ static void lbr_fixup(void)
 
     if ( curr->arch.hvm.vmx.lbr_flags & LBR_FIXUP_TSX )
         lbr_tsx_fixup();
-    if ( curr->arch.hvm.vmx.lbr_flags & LBR_FIXUP_BDF93 )
-        bdf93_fixup();
+    if ( curr->arch.hvm.vmx.lbr_flags & LBR_FIXUP_LER_TO )
+        ler_to_fixup();
 }
 
 /* Returns false if the vmentry has to be restarted */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 15:24:39 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 15:24:39 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jo7GR-0008W4-6W; Wed, 24 Jun 2020 15:24: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo7GP-0008Vs-M5
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:24:37 +0000
X-Inumbo-ID: d0859cbe-b62e-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id d0859cbe-b62e-11ea-8496-bc764e2007e4;
 Wed, 24 Jun 2020 15:24: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=fpN0x9ZZSqrWttHiaGEUxCHZtl5+LjlNuaIe9mT6el8=; b=ciAV+lZRDY8J/86ednntGgN1EI
 ApJeh4jUVe16sorTU7XRcxI0AVhvVEfC8B9FnYBVSkLjTKM/3/YibrgI2jFjz1qR2tSvJjcy/mFRe
 Ot0vsFkr8MajzWxnjmvAz5ZtY4Ws6AGOpCppY9SvhyPXCwVPfNQXlxh7/+ux6W/pkqFU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7GP-0004Fh-2u
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:24:37 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7GP-0007mv-2D
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:24:37 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.12] x86/hvm: Improve error information in handle_pio()
Message-Id: <E1jo7GP-0007mv-2D@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 15:24: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 6182e5dd894f047669d86bc97f3cd13b19f60110
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 24 17:12:20 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 17:12:20 2020 +0200

    x86/hvm: Improve error information in handle_pio()
    
    domain_crash() should always have a message which is emitted even in release
    builds, so something more useful than this is presented to the user.
    
      (XEN) domain_crash called from io.c:171
      (XEN) domain_crash called from io.c:171
      (XEN) domain_crash called from io.c:171
      ...
    
    To avoid possibly printing stack rubble, initialise data to ~0 right away.
    Furthermore, the maximum access size is 4, so drop data from long to int.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 4609fc8eb04e6af531d86923c9d057f32a96b7d8
    master date: 2020-05-29 16:25:05 +0100
---
 xen/arch/x86/hvm/io.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/hvm/io.c b/xen/arch/x86/hvm/io.c
index a5b0a23f06..724ab44a76 100644
--- a/xen/arch/x86/hvm/io.c
+++ b/xen/arch/x86/hvm/io.c
@@ -132,13 +132,15 @@ bool handle_pio(uint16_t port, unsigned int size, int dir)
 {
     struct vcpu *curr = current;
     struct hvm_vcpu_io *vio = &curr->arch.hvm.hvm_io;
-    unsigned long data;
+    unsigned int data;
     int rc;
 
     ASSERT((size - 1) < 4 && size != 3);
 
     if ( dir == IOREQ_WRITE )
         data = guest_cpu_user_regs()->eax;
+    else
+        data = ~0; /* Avoid any risk of stack rubble. */
 
     rc = hvmemul_do_pio_buffer(port, size, dir, &data);
 
@@ -151,7 +153,7 @@ bool handle_pio(uint16_t port, unsigned int size, int dir)
         if ( dir == IOREQ_READ )
         {
             if ( size == 4 ) /* Needs zero extension. */
-                guest_cpu_user_regs()->rax = (uint32_t)data;
+                guest_cpu_user_regs()->rax = data;
             else
                 memcpy(&guest_cpu_user_regs()->rax, &data, size);
         }
@@ -167,7 +169,9 @@ bool handle_pio(uint16_t port, unsigned int size, int dir)
         break;
 
     default:
-        gdprintk(XENLOG_ERR, "Weird HVM ioemulation status %d.\n", rc);
+        gprintk(XENLOG_ERR, "Unexpected PIO status %d, port %#x %s 0x%0*x\n",
+                rc, port, dir == IOREQ_WRITE ? "write" : "read",
+                size * 2, data & ((1u << (size * 8)) - 1));
         domain_crash(curr->domain);
         return false;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 15:24:49 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 15:24:49 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jo7Gb-00005Z-85; Wed, 24 Jun 2020 15:24: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo7Ga-00005N-6L
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:24:48 +0000
X-Inumbo-ID: d69a6a6c-b62e-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id d69a6a6c-b62e-11ea-b7bb-bc764e2007e4;
 Wed, 24 Jun 2020 15:24: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=QPSMlQyjHyWtUD1qEcgurY0hlrYpO6bVI+h6EbQh8rI=; b=FDz8gtzSDaiyb6zsAoKrur+vH/
 0Yh5ER8mm6s0Q8ohEVFPo46Zz5v5F6YpEugLC3gBG5+NxA6pIoHOxjanG8pLgngldVAZBIcWNOLEI
 kQbrvwcLWHt23nYezTxjs+UPDEtF28/LQcHsF1s8XzKTHYrNXBxB5rZjd94/rmgOVxu4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7GZ-0004Fp-9A
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:24:47 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7GZ-0007nz-76
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:24:47 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.12] x86emul: address x86_insn_is_mem_{access,
 write}() omissions
Message-Id: <E1jo7GZ-0007nz-76@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 15:24: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 946113a444de009a694c963b65717d28372691d6
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jun 24 17:12:53 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 17:12:53 2020 +0200

    x86emul: address x86_insn_is_mem_{access,write}() omissions
    
    First of all explain in comments what the functions' purposes are. Then
    make them actually match their comments.
    
    Note that fc6fa977be54 ("x86emul: extend x86_insn_is_mem_write()
    coverage") didn't actually fix the function's behavior for {,V}STMXCSR:
    Both are covered by generic code higher up in the function, due to
    x86_decode_twobyte() already doing suitable adjustments. And VSTMXCSR
    wouldn't have been covered anyway without a further X86EMUL_OPC_VEX()
    case label. Keep the inner case label in a comment for reference.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: e28d13eeb65c25c0bd56e8bfa83c7473047d778d
    master date: 2020-05-29 17:28:04 +0200
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 126 ++++++++++++++++++++++++++++++---
 1 file changed, 118 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index facd88d2b8..0c0a51e13c 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -9990,25 +9990,87 @@ x86_insn_operand_ea(const struct x86_emulate_state *state,
     return state->ea.mem.off;
 }
 
+/*
+ * This function means to return 'true' for all supported insns with explicit
+ * accesses to memory.  This means also insns which don't have an explicit
+ * memory operand (like POP), but it does not mean e.g. segment selector
+ * loads, where the descriptor table access is considered an implicit one.
+ */
 bool
 x86_insn_is_mem_access(const struct x86_emulate_state *state,
                        const struct x86_emulate_ctxt *ctxt)
 {
+    if ( mode_64bit() && state->not_64bit )
+        return false;
+
     if ( state->ea.type == OP_MEM )
-        return ctxt->opcode != 0x8d /* LEA */ &&
-               (ctxt->opcode != X86EMUL_OPC(0x0f, 0x01) ||
-                (state->modrm_reg & 7) != 7) /* INVLPG */;
+    {
+        switch ( ctxt->opcode )
+        {
+        case 0x8d: /* LEA */
+        case X86EMUL_OPC(0x0f, 0x0d): /* PREFETCH */
+        case X86EMUL_OPC(0x0f, 0x18)
+         ... X86EMUL_OPC(0x0f, 0x1f): /* NOP space */
+        case X86EMUL_OPC_66(0x0f, 0x18)
+         ... X86EMUL_OPC_66(0x0f, 0x1f): /* NOP space */
+        case X86EMUL_OPC_F3(0x0f, 0x18)
+         ... X86EMUL_OPC_F3(0x0f, 0x1f): /* NOP space */
+        case X86EMUL_OPC_F2(0x0f, 0x18)
+         ... X86EMUL_OPC_F2(0x0f, 0x1f): /* NOP space */
+        case X86EMUL_OPC(0x0f, 0xb9): /* UD1 */
+        case X86EMUL_OPC(0x0f, 0xff): /* UD0 */
+            return false;
+
+        case X86EMUL_OPC(0x0f, 0x01):
+            return (state->modrm_reg & 7) != 7; /* INVLPG */
+
+        case X86EMUL_OPC(0x0f, 0xae):
+            return (state->modrm_reg & 7) != 7; /* CLFLUSH */
+
+        case X86EMUL_OPC_66(0x0f, 0xae):
+            return (state->modrm_reg & 7) < 6; /* CLWB, CLFLUSHOPT */
+        }
+
+        return true;
+    }
 
     switch ( ctxt->opcode )
     {
+    case 0x06 ... 0x07: /* PUSH / POP %es */
+    case 0x0e:          /* PUSH %cs */
+    case 0x16 ... 0x17: /* PUSH / POP %ss */
+    case 0x1e ... 0x1f: /* PUSH / POP %ds */
+    case 0x50 ... 0x5f: /* PUSH / POP reg */
+    case 0x60 ... 0x61: /* PUSHA / POPA */
+    case 0x68: case 0x6a: /* PUSH imm */
     case 0x6c ... 0x6f: /* INS / OUTS */
+    case 0x8f:          /* POP r/m */
+    case 0x9a:          /* CALL (far, direct) */
+    case 0x9c ... 0x9d: /* PUSHF / POPF */
     case 0xa4 ... 0xa7: /* MOVS / CMPS */
     case 0xaa ... 0xaf: /* STOS / LODS / SCAS */
+    case 0xc2 ... 0xc3: /* RET (near) */
+    case 0xc8 ... 0xc9: /* ENTER / LEAVE */
+    case 0xca ... 0xcb: /* RET (far) */
     case 0xd7:          /* XLAT */
+    case 0xe8:          /* CALL (near, direct) */
+    case X86EMUL_OPC(0x0f, 0xa0):         /* PUSH %fs */
+    case X86EMUL_OPC(0x0f, 0xa1):         /* POP %fs */
+    case X86EMUL_OPC(0x0f, 0xa8):         /* PUSH %gs */
+    case X86EMUL_OPC(0x0f, 0xa9):         /* POP %gs */
     CASE_SIMD_PACKED_INT(0x0f, 0xf7):    /* MASKMOV{Q,DQU} */
     case X86EMUL_OPC_VEX_66(0x0f, 0xf7): /* VMASKMOVDQU */
         return true;
 
+    case 0xff:
+        switch ( state->modrm_reg & 7 )
+        {
+        case 2: /* CALL (near, indirect) */
+        case 6: /* PUSH r/m */
+            return true;
+        }
+        break;
+
     case X86EMUL_OPC(0x0f, 0x01):
         /* Cover CLZERO. */
         return (state->modrm_rm & 7) == 4 && (state->modrm_reg & 7) == 7;
@@ -10017,10 +10079,20 @@ x86_insn_is_mem_access(const struct x86_emulate_state *state,
     return false;
 }
 
+/*
+ * This function means to return 'true' for all supported insns with explicit
+ * writes to memory.  This means also insns which don't have an explicit
+ * memory operand (like PUSH), but it does not mean e.g. segment selector
+ * loads, where the (possible) descriptor table write is considered an
+ * implicit access.
+ */
 bool
 x86_insn_is_mem_write(const struct x86_emulate_state *state,
                       const struct x86_emulate_ctxt *ctxt)
 {
+    if ( mode_64bit() && state->not_64bit )
+        return false;
+
     switch ( state->desc & DstMask )
     {
     case DstMem:
@@ -10032,19 +10104,48 @@ x86_insn_is_mem_write(const struct x86_emulate_state *state,
         break;
 
     default:
+        switch ( ctxt->opcode )
+        {
+        case 0x63:                         /* ARPL */
+            return !mode_64bit();
+        }
+
         return false;
     }
 
     if ( state->modrm_mod == 3 )
-        /* CLZERO is the odd one. */
-        return ctxt->opcode == X86EMUL_OPC(0x0f, 0x01) &&
-               (state->modrm_rm & 7) == 4 && (state->modrm_reg & 7) == 7;
+    {
+        switch ( ctxt->opcode )
+        {
+        case 0xff: /* Grp5 */
+            break;
+
+        case X86EMUL_OPC(0x0f, 0x01): /* CLZERO is the odd one. */
+            return (state->modrm_rm & 7) == 4 && (state->modrm_reg & 7) == 7;
+
+        default:
+            return false;
+        }
+    }
 
     switch ( ctxt->opcode )
     {
+    case 0x06:                           /* PUSH %es */
+    case 0x0e:                           /* PUSH %cs */
+    case 0x16:                           /* PUSH %ss */
+    case 0x1e:                           /* PUSH %ds */
+    case 0x50 ... 0x57:                  /* PUSH reg */
+    case 0x60:                           /* PUSHA */
+    case 0x68: case 0x6a:                /* PUSH imm */
     case 0x6c: case 0x6d:                /* INS */
+    case 0x9a:                           /* CALL (far, direct) */
+    case 0x9c:                           /* PUSHF */
     case 0xa4: case 0xa5:                /* MOVS */
     case 0xaa: case 0xab:                /* STOS */
+    case 0xc8:                           /* ENTER */
+    case 0xe8:                           /* CALL (near, direct) */
+    case X86EMUL_OPC(0x0f, 0xa0):        /* PUSH %fs */
+    case X86EMUL_OPC(0x0f, 0xa8):        /* PUSH %gs */
     case X86EMUL_OPC(0x0f, 0xab):        /* BTS */
     case X86EMUL_OPC(0x0f, 0xb3):        /* BTR */
     case X86EMUL_OPC(0x0f, 0xbb):        /* BTC */
@@ -10096,6 +10197,16 @@ x86_insn_is_mem_write(const struct x86_emulate_state *state,
         }
         break;
 
+    case 0xff:
+        switch ( state->modrm_reg & 7 )
+        {
+        case 2: /* CALL (near, indirect) */
+        case 3: /* CALL (far, indirect) */
+        case 6: /* PUSH r/m */
+            return true;
+        }
+        break;
+
     case X86EMUL_OPC(0x0f, 0x01):
         switch ( state->modrm_reg & 7 )
         {
@@ -10110,7 +10221,7 @@ x86_insn_is_mem_write(const struct x86_emulate_state *state,
         switch ( state->modrm_reg & 7 )
         {
         case 0: /* FXSAVE */
-        case 3: /* {,V}STMXCSR */
+        /* case 3: STMXCSR - handled above */
         case 4: /* XSAVE */
         case 6: /* XSAVEOPT */
             return true;
@@ -10126,7 +10237,6 @@ x86_insn_is_mem_write(const struct x86_emulate_state *state,
         case 1: /* CMPXCHG{8,16}B */
         case 4: /* XSAVEC */
         case 5: /* XSAVES */
-        case 7: /* VMPTRST */
             return true;
         }
         break;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 15:24:59 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 15:24: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 1jo7Gl-00006o-BP; Wed, 24 Jun 2020 15:24: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo7Gk-00006c-4E
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:24:58 +0000
X-Inumbo-ID: dca69e44-b62e-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id dca69e44-b62e-11ea-bca7-bc764e2007e4;
 Wed, 24 Jun 2020 15:24: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=dI7Uz4ae7o77ojUl0PMYFwIT2JhqiYAv4wj1zOjZNf0=; b=1dFwIBmiVOut2nHWrd96Idx4il
 G50TWFgqajbL4Pc8ltfH5k+KLqXayL+I/+nOFjGiyB4hVmFUZmj71O4kVaZh+tCKofrHOAKS9KBlT
 06wJ7fJ/iOInpK2NDhSyR3qGvTUDYbLujfu8naYeZgfDa0hjvcJ1QtUx76RzMjTtIZ1Y=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7Gj-0004Fx-E0
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:24:57 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7Gj-0007of-Cv
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:24:57 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.12] x86emul: rework CMP and TEST emulation
Message-Id: <E1jo7Gj-0007of-Cv@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 15:24: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 74a12302245dd7febbc8bb214cf965377fda055d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jun 24 17:13:29 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 17:13:29 2020 +0200

    x86emul: rework CMP and TEST emulation
    
    Unlike similarly encoded insns these don't write their memory operands,
    and hence x86_is_mem_write() should return false for them. However,
    rather than adding special logic there, rework how their emulation gets
    done, by making decoding attributes properly describe the r/o nature of
    their memory operands:
    -  change the table entries for opcodes 0x38 and 0x39, with no other
       adjustments to the attributes later on,
    -  for the other opcodes, leave the table entries as they are, and
       override the attributes for the specific sub-cases (identified by
       ModRM.reg).
    
    For opcodes 0x38 and 0x39 the change of the table entries implies
    changing the order of operands as passed to emulate_2op_SrcV(), hence
    the splitting of the cases in the main switch().
    
    Note how this also allows dropping custom LOCK prefix checks.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 20bc1b9cc99b70b17757e1903f629c7a26584790
    master date: 2020-05-29 17:28:45 +0200
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 37 +++++++++++++++++++++-------------
 1 file changed, 23 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 0c0a51e13c..98f52083f8 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -84,7 +84,7 @@ static const opcode_desc_t opcode_table[256] = {
     ByteOp|DstReg|SrcMem|ModRM, DstReg|SrcMem|ModRM,
     ByteOp|DstEax|SrcImm, DstEax|SrcImm, 0, ImplicitOps,
     /* 0x38 - 0x3F */
-    ByteOp|DstMem|SrcReg|ModRM, DstMem|SrcReg|ModRM,
+    ByteOp|DstReg|SrcMem|ModRM, DstReg|SrcMem|ModRM,
     ByteOp|DstReg|SrcMem|ModRM, DstReg|SrcMem|ModRM,
     ByteOp|DstEax|SrcImm, DstEax|SrcImm, 0, ImplicitOps,
     /* 0x40 - 0x4F */
@@ -2405,7 +2405,6 @@ x86_decode_onebyte(
     case 0x60: /* pusha */
     case 0x61: /* popa */
     case 0x62: /* bound */
-    case 0x82: /* Grp1 (x86/32 only) */
     case 0xc4: /* les */
     case 0xc5: /* lds */
     case 0xce: /* into */
@@ -2415,6 +2414,14 @@ x86_decode_onebyte(
         state->not_64bit = true;
         break;
 
+    case 0x82: /* Grp1 (x86/32 only) */
+        state->not_64bit = true;
+        /* fall through */
+    case 0x80: case 0x81: case 0x83: /* Grp1 */
+        if ( (modrm_reg & 7) == 7 ) /* cmp */
+            state->desc = (state->desc & ByteOp) | DstNone | SrcMem;
+        break;
+
     case 0x90: /* nop / pause */
         if ( repe_prefix() )
             ctxt->opcode |= X86EMUL_OPC_F3(0, 0);
@@ -2445,6 +2452,11 @@ x86_decode_onebyte(
         imm2 = insn_fetch_type(uint8_t);
         break;
 
+    case 0xf6: case 0xf7: /* Grp3 */
+        if ( !(modrm_reg & 6) ) /* test */
+            state->desc = (state->desc & ByteOp) | DstNone | SrcMem;
+        break;
+
     case 0xff: /* Grp5 */
         switch ( modrm_reg & 7 )
         {
@@ -3725,13 +3737,11 @@ x86_emulate(
         break;
 
     case 0x38: case 0x39: cmp: /* cmp reg,mem */
-        if ( ops->rmw && dst.type == OP_MEM &&
-             (rc = read_ulong(dst.mem.seg, dst.mem.off, &dst.val,
-                              dst.bytes, ctxt, ops)) != X86EMUL_OKAY )
-            goto done;
-        /* fall through */
+        emulate_2op_SrcV("cmp", dst, src, _regs.eflags);
+        dst.type = OP_NONE;
+        break;
+
     case 0x3a ... 0x3d: /* cmp */
-        generate_exception_if(lock_prefix, EXC_UD);
         emulate_2op_SrcV("cmp", src, dst, _regs.eflags);
         dst.type = OP_NONE;
         break;
@@ -4033,7 +4043,9 @@ x86_emulate(
         case 4: goto and;
         case 5: goto sub;
         case 6: goto xor;
-        case 7: goto cmp;
+        case 7:
+            dst.val = imm1;
+            goto cmp;
         }
         break;
 
@@ -5026,11 +5038,8 @@ x86_emulate(
             unsigned long u[2], v;
 
         case 0 ... 1: /* test */
-            generate_exception_if(lock_prefix, EXC_UD);
-            if ( ops->rmw && dst.type == OP_MEM &&
-                 (rc = read_ulong(dst.mem.seg, dst.mem.off, &dst.val,
-                                  dst.bytes, ctxt, ops)) != X86EMUL_OKAY )
-                goto done;
+            dst.val = imm1;
+            dst.bytes = src.bytes;
             goto test;
         case 2: /* not */
             if ( ops->rmw && dst.type == OP_MEM )
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 15:25:10 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 15:25: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 1jo7Gw-000084-D8; Wed, 24 Jun 2020 15:25:10 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo7Gu-00007p-BP
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:25:08 +0000
X-Inumbo-ID: e2ade23e-b62e-11ea-80f0-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id e2ade23e-b62e-11ea-80f0-12813bfff9fa;
 Wed, 24 Jun 2020 15:25: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=nEaKgZOxQJL4xXgWIJdjWI9XtB4DJsC3n22XJVrsz9w=; b=vSniYeY2DZy+CPtkP4fENHApdZ
 N7rOOH24CZPq9h4q8703XFfVUg491XUKN0BKV0FRF6QIjZLmoYZQ1I0uNg8wN8lEy4x+eH6GnaEFK
 REjphXcerNcbWhWu6s9fHyKyUfS7hoOqYVA1aKSvJEMvDLF6EN6Yt0tXwLa+yX8HlXQw=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7Gt-0004Gw-Ha
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:25:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7Gt-0007pS-Gn
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:25:07 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.12] x86/mm: do not attempt to convert _PAGE_GNTTAB to
 a boolean
Message-Id: <E1jo7Gt-0007pS-Gn@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 15:25: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 7eed533a8b77a1b06c98721fee2f53a864b46fc8
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Jun 24 17:14:11 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 17:14:11 2020 +0200

    x86/mm: do not attempt to convert _PAGE_GNTTAB to a boolean
    
    Clang 10 complains with:
    
    mm.c:1239:10: error: converting the result of '<<' to a boolean always evaluates to true
          [-Werror,-Wtautological-constant-compare]
        if ( _PAGE_GNTTAB && (l1e_get_flags(l1e) & _PAGE_GNTTAB) &&
             ^
    xen/include/asm/x86_64/page.h:161:25: note: expanded from macro '_PAGE_GNTTAB'
    #define _PAGE_GNTTAB (1U<<22)
                            ^
    
    Remove the conversion of _PAGE_GNTTAB to a boolean and instead use a
    preprocessor conditional to check if _PAGE_GNTTAB is defined.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 6eb61b1a9dfe23ca443f977799cafb22770708a0
    master date: 2020-06-02 13:36:41 +0200
---
 xen/arch/x86/mm.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 6f5f70c16e..b4c90bd054 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -1268,8 +1268,14 @@ void put_page_from_l1e(l1_pgentry_t l1e, struct domain *l1e_owner)
      *
      * (Note that the undestroyable active grants are not a security hole in
      * Xen. All active grants can safely be cleaned up when the domain dies.)
+     *
+     * NB: the preprocessor conditional is required in order to prevent clang's
+     * -Wtautological-constant-compare complaining about converting the result
+     * of a << into a bool is always true if it's evaluated directly in the if
+     * condition.
      */
-    if ( _PAGE_GNTTAB && (l1e_get_flags(l1e) & _PAGE_GNTTAB) &&
+#if _PAGE_GNTTAB
+    if ( (l1e_get_flags(l1e) & _PAGE_GNTTAB) &&
          !l1e_owner->is_shutting_down && !l1e_owner->is_dying )
     {
         gdprintk(XENLOG_WARNING,
@@ -1277,6 +1283,7 @@ void put_page_from_l1e(l1_pgentry_t l1e, struct domain *l1e_owner)
                  l1e_get_intpte(l1e));
         domain_crash(l1e_owner);
     }
+#endif
 
     /*
      * Remember we didn't take a type-count of foreign writable mappings
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 15:25:19 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 15:25: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 1jo7H5-00008y-Et; Wed, 24 Jun 2020 15:25: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo7H4-00008p-9W
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:25:18 +0000
X-Inumbo-ID: e8b23afe-b62e-11ea-80f0-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id e8b23afe-b62e-11ea-80f0-12813bfff9fa;
 Wed, 24 Jun 2020 15:25: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=2u2P4oFtIeQXomM6jiVsOQnnWRJauBvNT9yRrLo8LvI=; b=5gFkdOZQKu+6rhNaALz92SXUwk
 kwgG/j+1HEHQWAPavY586G824y5lqqCiy/VqlIodutgkNipT0/8DzROJ9tiCHq0P+eKTBZq1iEpej
 qQbM4D/wfGNC+N+eOQiYUrPjEgF/PwSkrCNjrFmcZoT3fVHUeeKTfpCjgB/gUV9tb+NU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7H3-0004HA-Kg
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:25:17 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7H3-0007qC-Jv
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:25:17 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.12] build32: don't discard .shstrtab in linker script
Message-Id: <E1jo7H3-0007qC-Jv@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 15:25: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 7641573b333966271ddedae849dde3e72bf4d457
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Jun 24 17:14:40 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 17:14:40 2020 +0200

    build32: don't discard .shstrtab in linker script
    
    LLVM linker doesn't support discarding .shstrtab, and complains with:
    
    ld -melf_i386_fbsd -N -T build32.lds -o reloc.lnk reloc.o
    ld: error: discarding .shstrtab section is not allowed
    
    Add an explicit .shstrtab, .strtab and .symtab sections to the linker
    script after the text section in order to make LLVM LD happy and match
    the behavior of GNU LD.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 10d27b48b5b4dfbead2d9bf03290984bba4806e4
    master date: 2020-06-02 13:37:53 +0200
---
 xen/arch/x86/boot/build32.lds | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/xen/arch/x86/boot/build32.lds b/xen/arch/x86/boot/build32.lds
index 97454b40ff..1ab9418793 100644
--- a/xen/arch/x86/boot/build32.lds
+++ b/xen/arch/x86/boot/build32.lds
@@ -50,6 +50,20 @@ SECTIONS
         *(.got.plt)
   }
 
+  /*
+   * Discarding .shstrtab is not supported by LLD (LLVM LD) and will trigger an
+   * error. Also keep the rest of the control sections to match GNU LD behavior.
+   */
+  .shstrtab : {
+        *(.shstrtab)
+  }
+  .strtab : {
+        *(.strtab)
+  }
+  .symtab : {
+        *(.symtab)
+  }
+
   /DISCARD/ : {
         /*
          * Discard everything else, to prevent linkers from putting
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 15:25:29 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 15:25: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 1jo7HF-0000AX-GV; Wed, 24 Jun 2020 15:25: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo7HF-0000AN-51
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:25:29 +0000
X-Inumbo-ID: eeb8681a-b62e-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id eeb8681a-b62e-11ea-8496-bc764e2007e4;
 Wed, 24 Jun 2020 15:25: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=B+lORaKwJY9hbhhiIgPcqa04EePhuE7B3BFG7UN/ZV4=; b=outFCmE9P/nr5EOQIO0xVbEnsm
 bhk11SurWJ3OGEPxkyrzttqpZ3PQvtjZQAf5AuE5ciHF2RwRcIM9Z7CsVeG7+PxTVBUmeV4tCSIir
 WOTvbYAvJKdyrqUGnmMRqY/f3UXc8I6zIRucFqrGflDizVmPBbLQXxULtASE78bB4UXA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7HD-0004HH-O1
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:25:27 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7HD-0007r0-NE
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:25:27 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.12] x86/svm: do not try to handle recalc NPT faults
 immediately
Message-Id: <E1jo7HD-0007r0-NE@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 15:25: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 d937532ff5cebb27149224db4c502d2142c3106e
Author:     Igor Druzhinin <igor.druzhinin@citrix.com>
AuthorDate: Wed Jun 24 17:15:23 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 17:15:23 2020 +0200

    x86/svm: do not try to handle recalc NPT faults immediately
    
    A recalculation NPT fault doesn't always require additional handling
    in hvm_hap_nested_page_fault(), moreover in general case if there is no
    explicit handling done there - the fault is wrongly considered fatal.
    
    This covers a specific case of migration with vGPU assigned which
    uses direct MMIO mappings made by XEN_DOMCTL_memory_mapping hypercall:
    at a moment log-dirty is enabled globally, recalculation is requested
    for the whole guest memory including those mapped MMIO regions
    which causes a page fault being raised at the first access to them;
    but due to MMIO P2M type not having any explicit handling in
    hvm_hap_nested_page_fault() a domain is erroneously crashed with unhandled
    SVM violation.
    
    Instead of trying to be opportunistic - use safer approach and handle
    P2M recalculation in a separate NPT fault by attempting to retry after
    making the necessary adjustments. This is aligned with Intel behavior
    where there are separate VMEXITs for recalculation and EPT violations
    (faults) and only faults are handled in hvm_hap_nested_page_fault().
    Do it by also unifying do_recalc return code with Intel implementation
    where returning 1 means P2M was actually changed.
    
    Since there was no case previously where p2m_pt_handle_deferred_changes()
    could return a positive value - it's safe to replace ">= 0" with just "== 0"
    in VMEXIT_NPF handler. finish_type_change() is also not affected by the
    change as being able to deal with >0 return value of p2m->recalc from
    EPT implementation.
    
    Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 51ca66c37371b10b378513af126646de22eddb17
    master date: 2020-06-05 17:12:11 +0200
---
 xen/arch/x86/hvm/svm/svm.c | 5 +++--
 xen/arch/x86/mm/p2m-pt.c   | 7 ++++++-
 xen/arch/x86/mm/p2m.c      | 2 +-
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 9128e923b0..d74701718b 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -3042,9 +3042,10 @@ void svm_vmexit_handler(struct cpu_user_regs *regs)
             v->arch.hvm.svm.cached_insn_len = vmcb->guest_ins_len & 0xf;
         rc = vmcb->exitinfo1 & PFEC_page_present
              ? p2m_pt_handle_deferred_changes(vmcb->exitinfo2) : 0;
-        if ( rc >= 0 )
+        if ( rc == 0 )
+            /* If no recal adjustments were being made - handle this fault */
             svm_do_nested_pgfault(v, regs, vmcb->exitinfo1, vmcb->exitinfo2);
-        else
+        else if ( rc < 0 )
         {
             printk(XENLOG_G_ERR
                    "%pv: Error %d handling NPF (gpa=%08lx ec=%04lx)\n",
diff --git a/xen/arch/x86/mm/p2m-pt.c b/xen/arch/x86/mm/p2m-pt.c
index 87bf74ed92..0629cd530e 100644
--- a/xen/arch/x86/mm/p2m-pt.c
+++ b/xen/arch/x86/mm/p2m-pt.c
@@ -370,6 +370,7 @@ static int do_recalc(struct p2m_domain *p2m, unsigned long gfn)
     unsigned int level = 4;
     l1_pgentry_t *pent;
     int err = 0;
+    bool recalc_done = false;
 
     table = map_domain_page(pagetable_get_mfn(p2m_get_pagetable(p2m)));
     while ( --level )
@@ -431,6 +432,8 @@ static int do_recalc(struct p2m_domain *p2m, unsigned long gfn)
                 clear_recalc(l1, e);
                 err = p2m->write_p2m_entry(p2m, gfn, pent, e, level + 1);
                 ASSERT(!err);
+
+                recalc_done = true;
             }
         }
         unmap_domain_page((void *)((unsigned long)pent & PAGE_MASK));
@@ -480,12 +483,14 @@ static int do_recalc(struct p2m_domain *p2m, unsigned long gfn)
             clear_recalc(l1, e);
         err = p2m->write_p2m_entry(p2m, gfn, pent, e, level + 1);
         ASSERT(!err);
+
+        recalc_done = true;
     }
 
  out:
     unmap_domain_page(table);
 
-    return err;
+    return err ?: recalc_done;
 }
 
 int p2m_pt_handle_deferred_changes(uint64_t gpa)
diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 16608098b1..25ce19f20b 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -1178,7 +1178,7 @@ static int finish_type_change(struct p2m_domain *p2m,
         rc = p2m->recalc(p2m, gfn);
         /*
          * ept->recalc could return 0/1/-ENOMEM. pt->recalc could return
-         * 0/-ENOMEM/-ENOENT, -ENOENT isn't an error as we are looping
+         * 0/1/-ENOMEM/-ENOENT, -ENOENT isn't an error as we are looping
          * gfn here.
          */
         if ( rc == -ENOENT )
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 15:25:39 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 15:25: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 1jo7HP-0000Bg-IG; Wed, 24 Jun 2020 15:25:39 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo7HO-0000BW-Ob
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:25:38 +0000
X-Inumbo-ID: f4bcc364-b62e-11ea-80f0-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id f4bcc364-b62e-11ea-80f0-12813bfff9fa;
 Wed, 24 Jun 2020 15:25: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=w3O3COkeyRjyuvr/VIGwwRfU6l5PorCx8AvszdSNxfc=; b=xDYIXacv/M5jLHZo6MsiMRNvAu
 FAHLIB/prXutG/219SZn4RSwgCXGXakKtGfSFxwS0nDRjg3HHKz4EzgnQBoNHTECw+G+Bz6g/W1VT
 xDzt1yD4r6tMPhDohkzxKL/PeANKvicfxJ2hzBUPnLFw0Cjmz4ZG0hYwlIrVvLOnaBeQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7HN-0004IH-R8
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:25:37 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7HN-0007rl-QM
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:25:37 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.12] build: fix dependency tracking for preprocessed
 files
Message-Id: <E1jo7HN-0007rl-QM@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 15:25: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 7cdc0cff95776a25edc05488da0b76930c463e80
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jun 24 17:15:53 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 17:15:53 2020 +0200

    build: fix dependency tracking for preprocessed files
    
    While the issue is more general, I noticed that asm-macros.i not getting
    re-generated as needed. This was due to its .*.d file mentioning
    asm-macros.o instead of asm-macros.i. Use -MQ here as well, and while at
    it also use -MQ to avoid the somewhat fragile sed-ary on the *.lds
    dependency tracking files. While there, further avoid open-coding $(CPP)
    and drop the bogus (Arm) / stale (x86) -Ui386.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    master commit: 75131ad75bb3c91717b5dfda6881e61c52bfd22e
    master date: 2020-06-08 10:25:40 +0200
---
 xen/Rules.mk          | 4 ++--
 xen/arch/arm/Makefile | 4 +---
 xen/arch/x86/Makefile | 8 ++------
 3 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/xen/Rules.mk b/xen/Rules.mk
index a151b3f625..dc0632ddf5 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -217,13 +217,13 @@ $(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): %.init.o: %.o Makefile
 	$(OBJCOPY) $(foreach s,$(SPECIAL_DATA_SECTIONS),--rename-section .$(s)=.init.$(s)) $< $@
 
 %.i: %.c Makefile
-	$(CPP) $(filter-out -Wa$(comma)%,$(CFLAGS)) $< -o $@
+	$(CPP) $(filter-out -Wa$(comma)%,$(CFLAGS)) -MQ $@ -o $@ $<
 
 %.s: %.c Makefile
 	$(CC) $(filter-out -Wa$(comma)%,$(CFLAGS)) -S $< -o $@
 
 # -std=gnu{89,99} gets confused by # as an end-of-line comment marker
 %.s: %.S Makefile
-	$(CPP) $(filter-out -Wa$(comma)%,$(AFLAGS)) $< -o $@
+	$(CPP) $(filter-out -Wa$(comma)%,$(AFLAGS)) -MQ $@ -o $@ $<
 
 -include $(DEPS_INCLUDE)
diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index 872a155b60..6b29e45bbe 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -123,9 +123,7 @@ asm-offsets.s: $(TARGET_SUBARCH)/asm-offsets.c
 	$(CC) $(filter-out -flto,$(CFLAGS)) -S -o $@ $<
 
 xen.lds: xen.lds.S
-	$(CC) -P -E -Ui386 $(AFLAGS) -o $@ $<
-	sed -e 's/xen\.lds\.o:/xen\.lds:/g' <.xen.lds.d >.xen.lds.d.new
-	mv -f .xen.lds.d.new .xen.lds.d
+	$(CPP) -P $(AFLAGS) -MQ $@ -o $@ $<
 
 dtb.o: $(CONFIG_DTB_FILE)
 
diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index a53bdcf979..beaa5ec016 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -233,14 +233,10 @@ $(BASEDIR)/include/asm-x86/asm-macros.h: asm-macros.i Makefile
 	$(call move-if-changed,$@.new,$@)
 
 xen.lds: xen.lds.S
-	$(CC) -P -E -Ui386 $(filter-out -Wa$(comma)%,$(AFLAGS)) -o $@ $<
-	sed -e 's/.*\.lds\.o:/$(@F):/g' <.$(@F).d >.$(@F).d.new
-	mv -f .$(@F).d.new .$(@F).d
+	$(CPP) -P $(filter-out -Wa$(comma)%,$(AFLAGS)) -MQ $@ -o $@ $<
 
 efi.lds: xen.lds.S
-	$(CC) -P -E -Ui386 -DEFI $(filter-out -Wa$(comma)%,$(AFLAGS)) -o $@ $<
-	sed -e 's/.*\.lds\.o:/$(@F):/g' <.$(@F).d >.$(@F).d.new
-	mv -f .$(@F).d.new .$(@F).d
+	$(CPP) -P -DEFI $(filter-out -Wa$(comma)%,$(AFLAGS)) -MQ $@ -o $@ $<
 
 boot/mkelf32: boot/mkelf32.c
 	$(HOSTCC) $(HOSTCFLAGS) -o $@ $<
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 15:25:49 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 15:25: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 1jo7HZ-0000Ci-KL; Wed, 24 Jun 2020 15:25: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo7HY-0000Cb-VC
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:25:48 +0000
X-Inumbo-ID: fac39fd0-b62e-11ea-80f0-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id fac39fd0-b62e-11ea-80f0-12813bfff9fa;
 Wed, 24 Jun 2020 15:25: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=To5uofp+RUrt69Ktze43BEX8yhBSu4VFwTCaea9/8aE=; b=nJwpBvNth5IpzdfiVwPTVvcjg0
 lk7dWu1daIrb/bPLOuTG2UDrVTp9cIz+i1Gt3T+pNq0WVa2GSUGjrzjnSYTSyrI+t/NPQs11WI4cS
 NF9TWsEfJpBpKzmhjfbOCvXCwYNv5ggjXxr5ekzByxH8puhv7gEClDF2XeYnP83zq6/s=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7HX-0004IO-Um
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:25:47 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7HX-0007sZ-Tw
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:25:47 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.12] x86/Intel: insert Ice Lake and Comet Lake model
 numbers
Message-Id: <E1jo7HX-0007sZ-Tw@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 15:25: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 96e8abab83d721ecf0bb0867e173e933778c6ba1
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jun 24 17:16:30 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 17:16:30 2020 +0200

    x86/Intel: insert Ice Lake and Comet Lake model numbers
    
    Both match prior generation processors as far as LBR and C-state MSRs
    go (SDM rev 072) as well as applicability of the if_pschange_mc erratum
    (recent spec updates).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 1fe406685cb19e9544681c6243e7d376deb0297e
    master date: 2020-06-09 12:55:53 +0200
---
 xen/arch/x86/acpi/cpu_idle.c | 6 ++++++
 xen/arch/x86/hvm/vmx/vmx.c   | 8 ++++++++
 2 files changed, 14 insertions(+)

diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c
index 4ff8693ae6..99e75c1d7e 100644
--- a/xen/arch/x86/acpi/cpu_idle.c
+++ b/xen/arch/x86/acpi/cpu_idle.c
@@ -165,9 +165,15 @@ static void do_get_hw_residencies(void *arg)
     case 0x4E:
     case 0x55:
     case 0x5E:
+    /* Ice Lake */
+    case 0x7D:
+    case 0x7E:
     /* Kaby Lake */
     case 0x8E:
     case 0x9E:
+    /* Comet Lake */
+    case 0xA5:
+    case 0xA6:
         GET_PC2_RES(hw_res->pc2);
         GET_CC7_RES(hw_res->cc7);
         /* fall through */
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 7d29065d0b..662c3988dd 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2507,8 +2507,12 @@ static bool __init has_if_pschange_mc(void)
     case 0x4e: /* Skylake M */
     case 0x5e: /* Skylake D */
     case 0x55: /* Skylake-X / Cascade Lake */
+    case 0x7d: /* Ice Lake */
+    case 0x7e: /* Ice Lake */
     case 0x8e: /* Kaby / Coffee / Whiskey Lake M */
     case 0x9e: /* Kaby / Coffee / Whiskey Lake D */
+    case 0xa5: /* Comet Lake H/S */
+    case 0xa6: /* Comet Lake U */
         return true;
 
         /*
@@ -2878,8 +2882,12 @@ static const struct lbr_info *last_branch_msr_get(void)
         case 0x66:
         /* Goldmont Plus */
         case 0x7a:
+        /* Ice Lake */
+        case 0x7d: case 0x7e:
         /* Kaby Lake */
         case 0x8e: case 0x9e:
+        /* Comet Lake */
+        case 0xa5: case 0xa6:
             return sk_lbr;
         /* Atom */
         case 0x1c: case 0x26: case 0x27: case 0x35: case 0x36:
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 15:25:59 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 15:25: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 1jo7Hj-0000Dz-Nd; Wed, 24 Jun 2020 15:25: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo7Hi-0000Do-MP
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:25:58 +0000
X-Inumbo-ID: 00c8197e-b62f-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 00c8197e-b62f-11ea-b7bb-bc764e2007e4;
 Wed, 24 Jun 2020 15:25: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=l+SYG10OK9dxyIFJmnUBddnX2YHmz1tVgdKlr6RMV7E=; b=jRhSaPAs9nWqWz6Vie6VFsjzXu
 3bqsxv0o5PW4pgY8anOBVvczIC7DSPNnKonYpdSvqX5erOoBcSb2mbIpRSLFlhtL+VQ75cjN7XAAP
 jse7Xgus7SHa7v4RWzFGpKpfzs38h7rcUXhS3reVL7SRUMm5HgL82EVCp0WO5uTbwJQg=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7Hi-0004IY-1l
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:25:58 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7Hi-0007tG-10
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:25:58 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.12] ioreq: handle pending emulation racing with ioreq
 server destruction
Message-Id: <E1jo7Hi-0007tG-10@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 15:25: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 436ec68ea251e634b05e67a8acf7bf40832e1da9
Author:     Paul Durrant <pdurrant@amazon.com>
AuthorDate: Wed Jun 24 17:17:05 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 17:17:05 2020 +0200

    ioreq: handle pending emulation racing with ioreq server destruction
    
    When an emulation request is initiated in hvm_send_ioreq() the guest vcpu is
    blocked on an event channel until that request is completed. If, however,
    the emulator is killed whilst that emulation is pending then the ioreq
    server may be destroyed. Thus when the vcpu is awoken the code in
    handle_hvm_io_completion() will find no pending request to wait for, but will
    leave the internal vcpu io_req.state set to IOREQ_READY and the vcpu shutdown
    deferall flag in place (because hvm_io_assist() will never be called). The
    emulation request is then completed anyway. This means that any subsequent call
    to hvmemul_do_io() will find an unexpected value in io_req.state and will
    return X86EMUL_UNHANDLEABLE, which in some cases will result in continuous
    re-tries.
    
    This patch fixes the issue by moving the setting of io_req.state and clearing
    of shutdown deferral (as will as MSI-X write completion) out of hvm_io_assist()
    and directly into handle_hvm_io_completion().
    
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Paul Durrant <pdurrant@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: f7039ee41b3d3448775a1623f230037fd0455104
    master date: 2020-06-09 12:56:24 +0200
---
 xen/arch/x86/hvm/ioreq.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/hvm/ioreq.c b/xen/arch/x86/hvm/ioreq.c
index f7466bf4bd..1eedfb3d5d 100644
--- a/xen/arch/x86/hvm/ioreq.c
+++ b/xen/arch/x86/hvm/ioreq.c
@@ -107,15 +107,7 @@ static void hvm_io_assist(struct hvm_ioreq_vcpu *sv, uint64_t data)
     ioreq_t *ioreq = &v->arch.hvm.hvm_io.io_req;
 
     if ( hvm_ioreq_needs_completion(ioreq) )
-    {
-        ioreq->state = STATE_IORESP_READY;
         ioreq->data = data;
-    }
-    else
-        ioreq->state = STATE_IOREQ_NONE;
-
-    msix_write_completion(v);
-    vcpu_end_shutdown_deferral(v);
 
     sv->pending = false;
 }
@@ -207,6 +199,12 @@ bool handle_hvm_io_completion(struct vcpu *v)
         }
     }
 
+    vio->io_req.state = hvm_ioreq_needs_completion(&vio->io_req) ?
+        STATE_IORESP_READY : STATE_IOREQ_NONE;
+
+    msix_write_completion(v);
+    vcpu_end_shutdown_deferral(v);
+
     io_completion = vio->io_completion;
     vio->io_completion = HVMIO_no_completion;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 15:26:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 15:26: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 1jo7Ht-0000Ez-PI; Wed, 24 Jun 2020 15:26: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jo7Hs-0000Eo-SF
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:26:08 +0000
X-Inumbo-ID: 06ce01e4-b62f-11ea-80f0-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 06ce01e4-b62f-11ea-80f0-12813bfff9fa;
 Wed, 24 Jun 2020 15:26: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=7tmusmn1qCEipIOzp1y12Mq+Y+YfMLxRtm6nCkoX7tg=; b=XCW7zkmmpxXKDPN+Z0+G0xJJbU
 bwwb+tEH9nfxXYEkk8Yh8Eg34RLnMig2DkVUv/HwXtUFtDtC7na7u0C+HTOQvCTNYjsjOtY5eGoFe
 dk0bAdxFNmrw6dJiqHFH6MLASty9FYDvDCtUzfSTg+55lpRZ38aJB/hIlhE/2IKaNKdI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7Hs-0004JK-4z
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:26:08 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jo7Hs-0007u0-49
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 15:26:08 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.12] libacpi: widen TPM detection
Message-Id: <E1jo7Hs-0007u0-49@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 15:26:08 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 050fe48dc981e0488de1f6c6c07d8110f3b7523b
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Wed Jun 24 17:17:38 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 17:17:38 2020 +0200

    libacpi: widen TPM detection
    
    The hardcoded tpm_signature is too restrictive to detect many TPMs.  For
    instance, it doesn't accept a QEMU emulated TPM (VID 0x1014 DID 0x0001).
    Make the TPM detection match that in rombios which accepts a wider
    range.
    
    With this change, the TPM's TCPA ACPI table is generated and the guest
    OS can automatically load the tpm_tis driver.  It also allows seabios to
    detect and use the TPM.  However, seabios skips some TPM initialization
    when running under Xen, so it will not populate any PCRs unless modified
    to run the initialization under Xen.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: d3db7e043cddd7e939195e014241ce2c5d436179
    master date: 2020-06-16 10:31:08 +0200
---
 tools/libacpi/build.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/tools/libacpi/build.c b/tools/libacpi/build.c
index fa7d14e090..a61dd5583a 100644
--- a/tools/libacpi/build.c
+++ b/tools/libacpi/build.c
@@ -351,7 +351,6 @@ static int construct_secondary_tables(struct acpi_ctxt *ctxt,
     struct acpi_20_waet *waet;
     struct acpi_20_tcpa *tcpa;
     unsigned char *ssdt;
-    static const uint16_t tis_signature[] = {0x0001, 0x0001, 0x0001};
     void *lasa;
 
     /* MADT. */
@@ -413,9 +412,8 @@ static int construct_secondary_tables(struct acpi_ctxt *ctxt,
 
     /* TPM TCPA and SSDT. */
     if ( (config->table_flags & ACPI_HAS_TCPA) &&
-         (config->tis_hdr[0] == tis_signature[0]) &&
-         (config->tis_hdr[1] == tis_signature[1]) &&
-         (config->tis_hdr[2] == tis_signature[2]) )
+         (config->tis_hdr[0] != 0 && config->tis_hdr[0] != 0xffff) &&
+         (config->tis_hdr[1] != 0 && config->tis_hdr[1] != 0xffff) )
     {
         ssdt = ctxt->mem_ops.alloc(ctxt, sizeof(ssdt_tpm), 16);
         if (!ssdt) return -1;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 20:33:11 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 20:33: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 1joC4w-0005Yn-Ey; Wed, 24 Jun 2020 20: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1joC4u-0005Xw-R4
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 20:33:04 +0000
X-Inumbo-ID: e6a13f00-b659-11ea-813d-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id e6a13f00-b659-11ea-813d-12813bfff9fa;
 Wed, 24 Jun 2020 20: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=L1o3r2R20RLoyheDyq+eTl80uuoSsCze1+4fn52j/Pc=; b=fPwHLeMAV3MkIOT0P0uS3fvJXF
 /HGb7tK+17wr0OS1bJsIrNxggAD2dUA6nAPLjbublzGwariyx9dGNXkEaONXiXwUv+IWufPchrVYz
 ytV1entzX8tDtdb9wzHfXuHaezPX+zmNNI22M0oGR3jDL3X6cgZsj9ir3TDJCWBUTpuI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joC4s-0002Bu-Fj
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 20:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joC4s-0001Yd-EP
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 20:33:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.11] x86/spec-ctrl: CPUID/MSR definitions for Special
 Register Buffer Data Sampling
Message-Id: <E1joC4s-0001Yd-EP@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 20: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 1c751c4146b9e1d8dd9b61ee6a01caa1b07463cc
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 8 19:47:46 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jun 9 17:46:05 2020 +0100

    x86/spec-ctrl: CPUID/MSR definitions for Special Register Buffer Data Sampling
    
    This is part of XSA-320 / CVE-2020-0543
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Wei Liu <wl@xen.org>
    (cherry picked from commit caab85ab58c0cdf74ab070a5de5c4df89f509ff3)
---
 docs/misc/xen-command-line.markdown         | 8 ++++----
 tools/libxl/libxl_cpuid.c                   | 1 +
 tools/misc/xen-cpuid.c                      | 1 +
 xen/arch/x86/cpuid.c                        | 5 +++++
 xen/arch/x86/msr.c                          | 2 ++
 xen/arch/x86/spec_ctrl.c                    | 3 ++-
 xen/include/asm-x86/msr-index.h             | 3 +++
 xen/include/public/arch-x86/cpufeatureset.h | 1 +
 8 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown
index 194615bfc5..9be18ac99f 100644
--- a/docs/misc/xen-command-line.markdown
+++ b/docs/misc/xen-command-line.markdown
@@ -489,10 +489,10 @@ accounting for hardware capabilities as enumerated via CPUID.
 
 Currently accepted:
 
-The Speculation Control hardware features `md-clear`, `ibrsb`, `stibp`, `ibpb`,
-`l1d-flush` and `ssbd` are used by default if available and applicable.  They can
-be ignored, e.g. `no-ibrsb`, at which point Xen won't use them itself, and
-won't offer them to guests.
+The Speculation Control hardware features `srbds-ctrl`, `md-clear`, `ibrsb`,
+`stibp`, `ibpb`, `l1d-flush` and `ssbd` are used by default if available and
+applicable.  They can be ignored, e.g. `no-ibrsb`, at which point Xen won't
+use them itself, and won't offer them to guests.
 
 ### cpuid\_mask\_cpu (AMD only)
 > `= fam_0f_rev_c | fam_0f_rev_d | fam_0f_rev_e | fam_0f_rev_f | fam_0f_rev_g | fam_10_rev_b | fam_10_rev_c | fam_11_rev_b`
diff --git a/tools/libxl/libxl_cpuid.c b/tools/libxl/libxl_cpuid.c
index 5a1702d703..1235c8b91e 100644
--- a/tools/libxl/libxl_cpuid.c
+++ b/tools/libxl/libxl_cpuid.c
@@ -202,6 +202,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},
+        {"srbds-ctrl",   0x00000007,  0, CPUID_REG_EDX,  9,  1},
         {"md-clear",     0x00000007,  0, CPUID_REG_EDX, 10,  1},
         {"ibrsb",        0x00000007,  0, CPUID_REG_EDX, 26,  1},
         {"stibp",        0x00000007,  0, CPUID_REG_EDX, 27,  1},
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index 4c9af6b7f0..8fb54c3001 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -142,6 +142,7 @@ static const char *str_7d0[32] =
 {
     [ 2] = "avx512_4vnniw", [ 3] = "avx512_4fmaps",
 
+    /*  8 */                [ 9] = "srbds-ctrl",
     [10] = "md-clear",
     /* 12 */                [13] = "tsx-force-abort",
 
diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 04aefa555d..b8e5b6fe67 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -58,6 +58,11 @@ static int __init parse_xen_cpuid(const char *s)
             if ( !val )
                 setup_clear_cpu_cap(X86_FEATURE_SSBD);
         }
+        else if ( (val = parse_boolean("srbds-ctrl", s, ss)) >= 0 )
+        {
+            if ( !val )
+                setup_clear_cpu_cap(X86_FEATURE_SRBDS_CTRL);
+        }
         else
             rc = -EINVAL;
 
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index ccb316c547..256e58d82b 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -154,6 +154,7 @@ int guest_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val)
         /* Write-only */
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
+    case MSR_MCU_OPT_CTRL:
         /* Not offered to guests. */
         goto gp_fault;
 
@@ -243,6 +244,7 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
         /* Read-only */
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
+    case MSR_MCU_OPT_CTRL:
         /* Not offered to guests. */
         goto gp_fault;
 
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index ab196b156d..94ab8dd786 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -365,12 +365,13 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
     printk("Speculative mitigation facilities:\n");
 
     /* Hardware features which pertain to speculative mitigations. */
-    printk("  Hardware features:%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
+    printk("  Hardware features:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
            (_7d0 & cpufeat_mask(X86_FEATURE_IBRSB)) ? " IBRS/IBPB" : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_STIBP)) ? " STIBP"     : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_L1D_FLUSH)) ? " L1D_FLUSH" : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_SSBD))  ? " SSBD"      : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_MD_CLEAR)) ? " MD_CLEAR" : "",
+           (_7d0 & cpufeat_mask(X86_FEATURE_SRBDS_CTRL)) ? " SRBDS_CTRL" : "",
            (e8b  & cpufeat_mask(X86_FEATURE_IBPB))  ? " IBPB"      : "",
            (caps & ARCH_CAPS_IBRS_ALL)              ? " IBRS_ALL"  : "",
            (caps & ARCH_CAPS_RDCL_NO)               ? " RDCL_NO"   : "",
diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h
index 1761a01f1f..480d1d8102 100644
--- a/xen/include/asm-x86/msr-index.h
+++ b/xen/include/asm-x86/msr-index.h
@@ -177,6 +177,9 @@
 #define MSR_IA32_VMX_TRUE_ENTRY_CTLS            0x490
 #define MSR_IA32_VMX_VMFUNC                     0x491
 
+#define MSR_MCU_OPT_CTRL                    0x00000123
+#define  MCU_OPT_CTRL_RNGDS_MITG_DIS        (_AC(1, ULL) <<  0)
+
 /* K7/K8 MSRs. Not complete. See the architecture manual for a more
    complete list. */
 #define MSR_K7_EVNTSEL0			0xc0010000
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index a14d8a7013..9d210e74a0 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -242,6 +242,7 @@ XEN_CPUFEATURE(IBPB,          8*32+12) /*A  IBPB support only (no IBRS, used by
 /* 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(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 */
 XEN_CPUFEATURE(IBRSB,         9*32+26) /*A  IBRS and IBPB support (used by Intel) */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.11


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 20:33:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 20: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 1joC54-0005ZN-GW; Wed, 24 Jun 2020 20: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1joC54-0005ZH-7m
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 20:33:14 +0000
X-Inumbo-ID: eca90306-b659-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id eca90306-b659-11ea-bb8b-bc764e2007e4;
 Wed, 24 Jun 2020 20: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=PJwGd56zCr58sw7X5TL7Q5COrGi2Px3oluuOQHceknY=; b=ijGiy4F1CzZykNAoygkN16L7kf
 6R+gJM2y8tRX8iDWom/iaeboMqhmiDcyHlsRQ7e77ztaNeP7QANtOuNyfTc9d7s+d3ePdgZ9LjaF8
 2BZRSgbiAAWrU9dRK4VZOPvGx3uE+jOp3g1g6dmHSmigqYPHRzhhEmFIuX0I2CWSYdbc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joC52-0002Ce-Jg
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 20:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joC52-0001ZB-IP
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 20:33:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.11] x86/spec-ctrl: Mitigate the Special Register Buffer
 Data Sampling sidechannel
Message-Id: <E1joC52-0001ZB-IP@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 20: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 b8d476a9eaee8877cd5ba2c9eb6dbc5412626d13
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 8 19:47:46 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jun 9 17:46:14 2020 +0100

    x86/spec-ctrl: Mitigate the Special Register Buffer Data Sampling sidechannel
    
    See patch documentation and comments.
    
    This is part of XSA-320 / CVE-2020-0543
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 6a49b9a7920c82015381740905582b666160d955)
---
 docs/misc/xen-command-line.markdown |  8 +++++++-
 xen/arch/x86/acpi/power.c           |  3 +++
 xen/arch/x86/smpboot.c              |  8 +++++---
 xen/arch/x86/spec_ctrl.c            | 41 ++++++++++++++++++++++++++++++++++++-
 xen/include/asm-x86/spec_ctrl.h     |  2 ++
 5 files changed, 57 insertions(+), 5 deletions(-)

diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown
index 9be18ac99f..3356e59fee 100644
--- a/docs/misc/xen-command-line.markdown
+++ b/docs/misc/xen-command-line.markdown
@@ -1858,7 +1858,7 @@ false disable the quirk workaround, which is also the default.
 ### spec-ctrl (x86)
 > `= List of [ <bool>, xen=<bool>, {pv,hvm,msr-sc,rsb,md-clear}=<bool>,
 >              bti-thunk=retpoline|lfence|jmp, {ibrs,ibpb,ssbd,eager-fpu,
->              l1d-flush}=<bool> ]`
+>              l1d-flush,srb-lock}=<bool> ]`
 
 Controls for speculative execution sidechannel mitigations.  By default, Xen
 will pick the most appropriate mitigations based on compiled in support,
@@ -1930,6 +1930,12 @@ Irrespective of Xen's setting, the feature is virtualised for HVM guests to
 use.  By default, Xen will enable this mitigation on hardware believed to be
 vulnerable to L1TF.
 
+On hardware supporting SRBDS_CTRL, the `srb-lock=` option can be used to force
+or prevent Xen from protect the Special Register Buffer from leaking stale
+data. By default, Xen will enable this mitigation, except on parts where MDS
+is fixed and TAA is fixed/mitigated (in which case, there is believed to be no
+way for an attacker to obtain the stale data).
+
 ### sync\_console
 > `= <boolean>`
 
diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
index 4c12794809..30e1bd5cd3 100644
--- a/xen/arch/x86/acpi/power.c
+++ b/xen/arch/x86/acpi/power.c
@@ -266,6 +266,9 @@ static int enter_state(u32 state)
     ci->spec_ctrl_flags |= (default_spec_ctrl_flags & SCF_ist_wrmsr);
     spec_ctrl_exit_idle(ci);
 
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+        wrmsrl(MSR_MCU_OPT_CTRL, default_xen_mcu_opt_ctrl);
+
  done:
     spin_debug_enable();
     local_irq_restore(flags);
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index 0887806e85..d24d215946 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -369,12 +369,14 @@ void start_secondary(void *unused)
         microcode_resume_cpu(cpu);
 
     /*
-     * If MSR_SPEC_CTRL is available, apply Xen's default setting and discard
-     * any firmware settings.  Note: MSR_SPEC_CTRL may only become available
-     * after loading microcode.
+     * If any speculative control MSRs are available, apply Xen's default
+     * settings.  Note: These MSRs may only become available after loading
+     * microcode.
      */
     if ( boot_cpu_has(X86_FEATURE_IBRSB) )
         wrmsrl(MSR_SPEC_CTRL, default_xen_spec_ctrl);
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+        wrmsrl(MSR_MCU_OPT_CTRL, default_xen_mcu_opt_ctrl);
 
     tsx_init(); /* Needs microcode.  May change HLE/RTM feature bits. */
 
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index 94ab8dd786..a306d10c34 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -63,6 +63,9 @@ static unsigned int __initdata l1d_maxphysaddr;
 static bool __initdata cpu_has_bug_msbds_only; /* => minimal HT impact. */
 static bool __initdata cpu_has_bug_mds; /* Any other M{LP,SB,FB}DS combination. */
 
+static int8_t __initdata opt_srb_lock = -1;
+uint64_t __read_mostly default_xen_mcu_opt_ctrl;
+
 static int __init parse_bti(const char *s)
 {
     const char *ss;
@@ -166,6 +169,7 @@ static int __init parse_spec_ctrl(const char *s)
             opt_ibpb = false;
             opt_ssbd = false;
             opt_l1d_flush = 0;
+            opt_srb_lock = 0;
         }
         else if ( val > 0 )
             rc = -EINVAL;
@@ -231,6 +235,8 @@ static int __init parse_spec_ctrl(const char *s)
             opt_eager_fpu = val;
         else if ( (val = parse_boolean("l1d-flush", s, ss)) >= 0 )
             opt_l1d_flush = val;
+        else if ( (val = parse_boolean("srb-lock", s, ss)) >= 0 )
+            opt_srb_lock = val;
         else
             rc = -EINVAL;
 
@@ -394,7 +400,7 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
                "\n");
 
     /* Settings for Xen's protection, irrespective of guests. */
-    printk("  Xen settings: BTI-Thunk %s, SPEC_CTRL: %s%s%s, Other:%s%s%s\n",
+    printk("  Xen settings: BTI-Thunk %s, SPEC_CTRL: %s%s%s, Other:%s%s%s%s\n",
            thunk == THUNK_NONE      ? "N/A" :
            thunk == THUNK_RETPOLINE ? "RETPOLINE" :
            thunk == THUNK_LFENCE    ? "LFENCE" :
@@ -405,6 +411,8 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
            (default_xen_spec_ctrl & SPEC_CTRL_SSBD)  ? " SSBD+" : " SSBD-",
            !(caps & ARCH_CAPS_TSX_CTRL)              ? "" :
            (opt_tsx & 1)                             ? " TSX+" : " TSX-",
+           !boot_cpu_has(X86_FEATURE_SRBDS_CTRL)     ? "" :
+           opt_srb_lock                              ? " SRB_LOCK+" : " SRB_LOCK-",
            opt_ibpb                                  ? " IBPB"  : "",
            opt_l1d_flush                             ? " L1D_FLUSH" : "",
            opt_md_clear_pv || opt_md_clear_hvm       ? " VERW"  : "");
@@ -1196,6 +1204,34 @@ void __init init_speculation_mitigations(void)
         tsx_init();
     }
 
+    /* Calculate suitable defaults for MSR_MCU_OPT_CTRL */
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+    {
+        uint64_t val;
+
+        rdmsrl(MSR_MCU_OPT_CTRL, val);
+
+        /*
+         * On some SRBDS-affected hardware, it may be safe to relax srb-lock
+         * by default.
+         *
+         * On parts which enumerate MDS_NO and not TAA_NO, TSX is the only way
+         * to access the Fill Buffer.  If TSX isn't available (inc. SKU
+         * reasons on some models), or TSX is explicitly disabled, then there
+         * is no need for the extra overhead to protect RDRAND/RDSEED.
+         */
+        if ( opt_srb_lock == -1 &&
+             (caps & (ARCH_CAPS_MDS_NO|ARCH_CAPS_TAA_NO)) == ARCH_CAPS_MDS_NO &&
+             (!cpu_has_hle || ((caps & ARCH_CAPS_TSX_CTRL) && opt_tsx == 0)) )
+            opt_srb_lock = 0;
+
+        val &= ~MCU_OPT_CTRL_RNGDS_MITG_DIS;
+        if ( !opt_srb_lock )
+            val |= MCU_OPT_CTRL_RNGDS_MITG_DIS;
+
+        default_xen_mcu_opt_ctrl = val;
+    }
+
     print_details(thunk, caps);
 
     /*
@@ -1227,6 +1263,9 @@ void __init init_speculation_mitigations(void)
 
         wrmsrl(MSR_SPEC_CTRL, bsp_delay_spec_ctrl ? 0 : default_xen_spec_ctrl);
     }
+
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+        wrmsrl(MSR_MCU_OPT_CTRL, default_xen_mcu_opt_ctrl);
 }
 
 static void __init __maybe_unused build_assertions(void)
diff --git a/xen/include/asm-x86/spec_ctrl.h b/xen/include/asm-x86/spec_ctrl.h
index 333d180b7e..bf10d2ce5c 100644
--- a/xen/include/asm-x86/spec_ctrl.h
+++ b/xen/include/asm-x86/spec_ctrl.h
@@ -46,6 +46,8 @@ extern int8_t opt_pv_l1tf_hwdom, opt_pv_l1tf_domu;
  */
 extern paddr_t l1tf_addr_mask, l1tf_safe_maddr;
 
+extern uint64_t default_xen_mcu_opt_ctrl;
+
 static inline void init_shadow_spec_ctrl_state(void)
 {
     struct cpu_info *info = get_cpu_info();
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.11


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 20:33:24 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 20: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 1joC5E-0005aa-IL; Wed, 24 Jun 2020 20: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1joC5D-0005aO-IO
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 20:33:23 +0000
X-Inumbo-ID: f2b5e188-b659-11ea-813d-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id f2b5e188-b659-11ea-813d-12813bfff9fa;
 Wed, 24 Jun 2020 20: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=K+2YTToiTSdBj7QIt6PZt3Wse4wDQlRvBydAI7TVB+4=; b=FGwGkgkQc7d/XIF4Uf4CyjxuI9
 +/8yLK8tdR/s5+9JlYdXmF5B5i0AoYg+6FlQp++27UiLQP18A5+epqaRunDE7XdGo7aoMBnKXwMYA
 TlMG0YDyvQKhVigHi/68kb1FBcxpNDXiLSLskoB/DHGjDjODkHpi+5sn6KhsrjfPzUqs=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joC5C-0002Cp-NM
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 20:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joC5C-0001Zf-M1
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 20:33:22 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.11] tools/xentop : replace use of deprecated vwprintw
Message-Id: <E1joC5C-0001Zf-M1@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 20: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 9be79927a6395f12c9e24afaccf6acbaf81d402e
Author:     Christopher Clark <christopher.w.clark@gmail.com>
AuthorDate: Wed Jul 18 15:22:17 2018 -0700
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Wed Jun 10 11:34:11 2020 +0100

    tools/xentop : replace use of deprecated vwprintw
    
    gcc-8.1 complains:
    
    | xentop.c: In function 'print':
    | xentop.c:304:4: error: 'vwprintw' is deprecated [-Werror=deprecated-declarations]
    |     vwprintw(stdscr, (curses_str_t)fmt, args);
    |     ^~~~~~~~
    
    vw_printw (note the underscore) is a non-deprecated alternative.
    
    Signed-off-by: Christopher Clark <christopher.clark6@baesystems.com>
    Acked-by: Wei Liu <wei.liu2@citrix.com>
    (cherry picked from commit 2b50cdbc444c637575580dcfa6c9525a84d5cc62)
---
 tools/xenstat/xentop/xentop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/xenstat/xentop/xentop.c b/tools/xenstat/xentop/xentop.c
index 2fd2b6742e..c46581062b 100644
--- a/tools/xenstat/xentop/xentop.c
+++ b/tools/xenstat/xentop/xentop.c
@@ -301,7 +301,7 @@ static void print(const char *fmt, ...)
 	if (!batch) {
 		if((current_row() < lines()-1)) {
 			va_start(args, fmt);
-			vwprintw(stdscr, (curses_str_t)fmt, args);
+			vw_printw(stdscr, (curses_str_t)fmt, args);
 			va_end(args);
 		}
 	} else {
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.11


From xen-changelog-bounces@lists.xenproject.org Wed Jun 24 20:33:34 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Jun 2020 20: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 1joC5O-0005cW-Lo; Wed, 24 Jun 2020 20: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=9erU=AF=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1joC5N-0005cO-Mu
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 20:33:33 +0000
X-Inumbo-ID: f8bfa23a-b659-11ea-813d-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id f8bfa23a-b659-11ea-813d-12813bfff9fa;
 Wed, 24 Jun 2020 20: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=KGwg5d+m4wbGv6OAWTQrHHFGsQQEWvFkWV2Eg9gb3HA=; b=u/7dofORDQ+YK/nuQWrNEnN7np
 C8FF7agWrnzClmMnQZ7bHmZ+xx1bzDnLV212W8OxWvsii/MNdAwsFoq+dwia5TFqc8IVo7S3TcQNG
 3uiCRrAJKOhVwQgJ6LSqjY06cNqjFUEpFFc8NM0jbtzRyg+h5PEUYpz+AbcoVxnlmYaU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joC5M-0002D0-Rk
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 20:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joC5M-0001aF-Ps
 for xen-changelog@lists.xenproject.org; Wed, 24 Jun 2020 20:33:32 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.11] x86/spec-ctrl: Allow the RDRAND/RDSEED features to
 be hidden
Message-Id: <E1joC5M-0001aF-Ps@xenbits.xenproject.org>
Date: Wed, 24 Jun 2020 20: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 2b77729888fb851ab96e7f77bc854122626b4861
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 10 18:57:00 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jun 11 16:27:59 2020 +0100

    x86/spec-ctrl: Allow the RDRAND/RDSEED features to be hidden
    
    RDRAND/RDSEED can be hidden using cpuid= to mitigate SRBDS if microcode
    isn't available.
    
    This is part of XSA-320 / CVE-2020-0543.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    (cherry picked from commit 7028534d8482d25860c4d1aa8e45f0b911abfc5a)
---
 docs/misc/xen-command-line.markdown | 10 ++++++++--
 xen/arch/x86/cpuid.c                | 10 ++++++++++
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown
index 3356e59fee..ac397e7de0 100644
--- a/docs/misc/xen-command-line.markdown
+++ b/docs/misc/xen-command-line.markdown
@@ -487,12 +487,18 @@ choice of `dom0-kernel` is deprecated and not supported by all Dom0 kernels.
 This option allows for fine tuning of the facilities Xen will use, after
 accounting for hardware capabilities as enumerated via CPUID.
 
+Unless otherwise noted, options only have any effect in their negative form,
+to hide the named feature(s).  Ignoring a feature using this mechanism will
+cause Xen not to use the feature, nor offer them as usable to guests.
+
 Currently accepted:
 
 The Speculation Control hardware features `srbds-ctrl`, `md-clear`, `ibrsb`,
 `stibp`, `ibpb`, `l1d-flush` and `ssbd` are used by default if available and
-applicable.  They can be ignored, e.g. `no-ibrsb`, at which point Xen won't
-use them itself, and won't offer them to guests.
+applicable.  They can all be ignored.
+
+`rdrand` and `rdseed` can be ignored, as a mitigation to XSA-320 /
+CVE-2020-0543.
 
 ### cpuid\_mask\_cpu (AMD only)
 > `= fam_0f_rev_c | fam_0f_rev_d | fam_0f_rev_e | fam_0f_rev_f | fam_0f_rev_g | fam_10_rev_b | fam_10_rev_c | fam_11_rev_b`
diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index b8e5b6fe67..78d08dbb32 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -63,6 +63,16 @@ static int __init parse_xen_cpuid(const char *s)
             if ( !val )
                 setup_clear_cpu_cap(X86_FEATURE_SRBDS_CTRL);
         }
+        else if ( (val = parse_boolean("rdrand", s, ss)) >= 0 )
+        {
+            if ( !val )
+                setup_clear_cpu_cap(X86_FEATURE_RDRAND);
+        }
+        else if ( (val = parse_boolean("rdseed", s, ss)) >= 0 )
+        {
+            if ( !val )
+                setup_clear_cpu_cap(X86_FEATURE_RDSEED);
+        }
         else
             rc = -EINVAL;
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.11


From xen-changelog-bounces@lists.xenproject.org Thu Jun 25 07:22:13 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Jun 2020 07: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 1joMD2-0005ww-15; Thu, 25 Jun 2020 07: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=UBdM=AG=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1joMD0-0005wr-DE
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 07:22:06 +0000
X-Inumbo-ID: 926006fa-b6b4-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 926006fa-b6b4-11ea-b7bb-bc764e2007e4;
 Thu, 25 Jun 2020 07: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=WhQSMQSug+3scGZTiHnZZ/VvvZPgPg3Y1u3wUTXJ73I=; b=rVMWPB3S7ylQ4zByH0A7braukN
 yWmVy5LPrCemFuyVe7O5pAqmqIEwSMsNbn1/zzIvr07DYGaJ6FI6hGGmauECSdNX0KwSbiILnrz9v
 LcNgAiD3XdeNDJMofwj4kNHJstHItkZN7uJzF+9gU5XYh4iNvBauB6BD9lsHN0M2qaHI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joMCz-000080-BK
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 07:22:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joMCz-00008r-A7
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 07:22:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/acpi: use FADT flags to determine the PMTMR width
Message-Id: <E1joMCz-00008r-A7@xenbits.xenproject.org>
Date: Thu, 25 Jun 2020 07: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 f325d2477eef8229c47d97031d314629521c70ab
Author:     Grzegorz Uriasz <gorbak25@gmail.com>
AuthorDate: Thu Jun 25 09:11:09 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Jun 25 09:11:09 2020 +0200

    x86/acpi: use FADT flags to determine the PMTMR width
    
    On some computers the bit width of the PM Timer as reported
    by ACPI is 32 bits when in fact the FADT flags report correctly
    that the timer is 24 bits wide. On affected machines such as the
    ASUS FX504GM and never gaming laptops this results in the inability
    to resume the machine from suspend. Without this patch suspend is
    broken on affected machines and even if a machine manages to resume
    correctly then the kernel time and xen timers are trashed.
    
    Signed-off-by: Grzegorz Uriasz <gorbak25@gmail.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/arch/x86/acpi/boot.c    | 19 +++++++++++++++----
 xen/arch/x86/time.c         | 12 ++++--------
 xen/include/acpi/acmacros.h |  8 ++++++++
 3 files changed, 27 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/acpi/boot.c b/xen/arch/x86/acpi/boot.c
index bcba52e232..ed40ce56b4 100644
--- a/xen/arch/x86/acpi/boot.c
+++ b/xen/arch/x86/acpi/boot.c
@@ -475,10 +475,17 @@ static int __init acpi_parse_fadt(struct acpi_table_header *table)
 
 #ifdef CONFIG_X86_PM_TIMER
 	/* detect the location of the ACPI PM Timer */
-	if (fadt->header.revision >= FADT2_REVISION_ID) {
+	if (fadt->header.revision >= FADT2_REVISION_ID &&
+	    fadt->xpm_timer_block.space_id == ACPI_ADR_SPACE_SYSTEM_IO) {
 		/* FADT rev. 2 */
-		if (fadt->xpm_timer_block.space_id ==
-		    ACPI_ADR_SPACE_SYSTEM_IO) {
+		if (fadt->xpm_timer_block.access_width != 0 &&
+		    ACPI_ACCESS_BIT_WIDTH(fadt->xpm_timer_block.access_width) != 32)
+			printk(KERN_WARNING PREFIX "PM-Timer has invalid access width(%u)\n",
+			       fadt->xpm_timer_block.access_width);
+		else if (fadt->xpm_timer_block.bit_offset != 0)
+			printk(KERN_WARNING PREFIX "PM-Timer has invalid bit offset(%u)\n",
+			       fadt->xpm_timer_block.bit_offset);
+		else {
 			pmtmr_ioport = fadt->xpm_timer_block.address;
 			pmtmr_width = fadt->xpm_timer_block.bit_width;
 		}
@@ -490,8 +497,12 @@ static int __init acpi_parse_fadt(struct acpi_table_header *table)
  	 */
 	if (!pmtmr_ioport) {
 		pmtmr_ioport = fadt->pm_timer_block;
-		pmtmr_width = fadt->pm_timer_length == 4 ? 24 : 0;
+		pmtmr_width = fadt->pm_timer_length == 4 ? 32 : 0;
 	}
+	if (pmtmr_width < 32 && (fadt->flags & ACPI_FADT_32BIT_TIMER))
+		printk(KERN_WARNING PREFIX "PM-Timer is too short\n");
+	if (pmtmr_width > 24 && !(fadt->flags & ACPI_FADT_32BIT_TIMER))
+		pmtmr_width = 24;
 	if (pmtmr_ioport)
 		printk(KERN_INFO PREFIX "PM-Timer IO Port: %#x (%u bits)\n",
 		       pmtmr_ioport, pmtmr_width);
diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index d643590c0a..cf97dde9d6 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -457,16 +457,13 @@ static u64 read_pmtimer_count(void)
 static s64 __init init_pmtimer(struct platform_timesource *pts)
 {
     u64 start;
-    u32 count, target, mask = 0xffffff;
+    u32 count, target, mask;
 
-    if ( !pmtmr_ioport || !pmtmr_width )
+    if ( !pmtmr_ioport || (pmtmr_width != 24 && pmtmr_width != 32) )
         return 0;
 
-    if ( pmtmr_width == 32 )
-    {
-        pts->counter_bits = 32;
-        mask = 0xffffffff;
-    }
+    pts->counter_bits = pmtmr_width;
+    mask = 0xffffffff >> (32 - pmtmr_width);
 
     count = inl(pmtmr_ioport) & mask;
     start = rdtsc_ordered();
@@ -486,7 +483,6 @@ static struct platform_timesource __initdata plt_pmtimer =
     .name = "ACPI PM Timer",
     .frequency = ACPI_PM_FREQUENCY,
     .read_counter = read_pmtimer_count,
-    .counter_bits = 24,
     .init = init_pmtimer
 };
 
diff --git a/xen/include/acpi/acmacros.h b/xen/include/acpi/acmacros.h
index 6765535053..86c503c20f 100644
--- a/xen/include/acpi/acmacros.h
+++ b/xen/include/acpi/acmacros.h
@@ -121,6 +121,14 @@
 #define ACPI_COMPARE_NAME(a,b)          (!ACPI_STRNCMP (ACPI_CAST_PTR (char,(a)), ACPI_CAST_PTR (char,(b)), ACPI_NAME_SIZE))
 #endif
 
+/*
+ * Algorithm to obtain access bit or byte width.
+ * Can be used with access_width of struct acpi_generic_address and access_size of
+ * struct acpi_resource_generic_register.
+ */
+#define ACPI_ACCESS_BIT_WIDTH(size)     (1 << ((size) + 2))
+#define ACPI_ACCESS_BYTE_WIDTH(size)    (1 << ((size) - 1))
+
 /*
  * Macros for moving data around to/from buffers that are possibly unaligned.
  * If the hardware supports the transfer of unaligned data, just do the store.
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jun 25 07:22:17 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Jun 2020 07: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 1joMDB-0005xa-2R; Thu, 25 Jun 2020 07: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=UBdM=AG=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1joMDA-0005xR-2B
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 07:22:16 +0000
X-Inumbo-ID: 9861726e-b6b4-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 9861726e-b6b4-11ea-b7bb-bc764e2007e4;
 Thu, 25 Jun 2020 07: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=qx9kccXl35fzKX2fMZ4nCZvpMciz7TFLetisIQ0q9Ck=; b=o7/h4eE+eR2wrfZUhB3Xrp/8rs
 v4inttVpE4DK3nF+8lVSPhVng8WCv8ilyIcNd1nz2z7nYal3TVztvCVo4/VszZV5mURXrLWEp1Rva
 1qBCAfcM83X/sf9+oERcSO4Gs51mHy27jx/xSg/Dwpsb5AgC4ule791rr1nQuyNi1yaY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joMD9-000087-EK
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 07:22:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joMD9-00009f-DR
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 07:22:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/CPUID: fill all fields in
 x86_cpuid_policy_fill_native()
Message-Id: <E1joMD9-00009f-DR@xenbits.xenproject.org>
Date: Thu, 25 Jun 2020 07: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 e4d2207165b379ec13c8b512936f63982af62d13
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Jun 25 09:12:21 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Jun 25 09:12:21 2020 +0200

    x86/CPUID: fill all fields in x86_cpuid_policy_fill_native()
    
    Coverity validly complains that the new call from
    tools/tests/cpu-policy/test-cpu-policy.c:test_cpuid_current() leaves
    two fields uninitialized, yet they get then consumed by
    x86_cpuid_copy_to_buffer(). (All other present callers of the function
    pass a pointer to a static - and hence initialized - buffer.)
    
    Coverity-ID: 1464809
    Fixes: c22ced93e167 ("tests/cpu-policy: Confirm that CPUID serialisation is sorted")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/lib/x86/cpuid.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/lib/x86/cpuid.c b/xen/lib/x86/cpuid.c
index c111d43b00..c7a0508148 100644
--- a/xen/lib/x86/cpuid.c
+++ b/xen/lib/x86/cpuid.c
@@ -176,6 +176,10 @@ void x86_cpuid_policy_fill_native(struct cpuid_policy *p)
                           ARRAY_SIZE(p->extd.raw) - 1); ++i )
         cpuid_leaf(0x80000000 + i, &p->extd.raw[i]);
 
+    /* Don't report leaves from possible lower level hypervisor, for now. */
+    p->hv_limit = 0;
+    p->hv2_limit = 0;
+
     x86_cpuid_policy_recalc_synth(p);
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jun 25 13:22:08 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Jun 2020 13:22:08 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1joRpM-0002Sh-Kn; Thu, 25 Jun 2020 13:22:04 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=UBdM=AG=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1joRpL-0002Sb-K8
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:22:03 +0000
X-Inumbo-ID: db3e62e0-b6e6-11ea-81b8-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id db3e62e0-b6e6-11ea-81b8-12813bfff9fa;
 Thu, 25 Jun 2020 13: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=2HgW82ubLUmt6s86eNcaoX/LTHfk3PH1gZJylT3S530=; b=qoXMArqcUx3QXGIXsJfvTLWVLP
 28j2Fjn4QPBt8CZCkEwyAMSPdu8CN4yqVsLnKCNW57CEZ4XHP1F9SkQgyQpQGTfdg6z+nl+Y9zOJH
 /WEnDSdeOCRYJ29fNm/5Cj2C1tKqqWF0XPGpirUmU+NThFdUMDQRKKSWsmifo1X3/atA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRpK-0007Lb-Eq
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRpK-0003Hc-Dh
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:22:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] update Xen version to 4.13.2-pre
Message-Id: <E1joRpK-0003Hc-Dh@xenbits.xenproject.org>
Date: Thu, 25 Jun 2020 13: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 333519f5a82d58568d094962ccb27a4c4e06e648
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jun 24 16:19:23 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:19:23 2020 +0200

    update Xen version to 4.13.2-pre
---
 xen/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/Makefile b/xen/Makefile
index 6b89ff1162..5db0a25b3e 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -2,7 +2,7 @@
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 13
-export XEN_EXTRAVERSION ?= .1$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .2-pre$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Thu Jun 25 13:22:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Jun 2020 13: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 1joRpW-0002Ta-MM; Thu, 25 Jun 2020 13: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=UBdM=AG=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1joRpV-0002TR-CY
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:22:13 +0000
X-Inumbo-ID: e145f892-b6e6-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id e145f892-b6e6-11ea-8496-bc764e2007e4;
 Thu, 25 Jun 2020 13: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=bx24h2pNUV4CV2eWgLT+T5ufSkHLtMcP4VMuRrJ+pfI=; b=QcscD5BGlCwkgEL4BwBw0b+kmZ
 H2U7qPgQ6gOQk6Lxv1zUh5QazLnU+wqh/FQl9zVOHKugvT3sT/wG1oy82tFEK2bzsjckwr3ZoiUHs
 QiKwAQ+uIkmOMtSjaYByj4jv48JDQFyQmVU8QtRZKiYI/60T4yDOzvBew24SIYavhXao=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRpU-0007Lm-IM
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRpU-0003ID-HH
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:22:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] x86/cpuidle: correct Cannon Lake residency MSRs
Message-Id: <E1joRpU-0003ID-HH@xenbits.xenproject.org>
Date: Thu, 25 Jun 2020 13: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 d112db32c62238df5e5fe342c5079d47cb6465d1
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jun 24 16:21:00 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:21:00 2020 +0200

    x86/cpuidle: correct Cannon Lake residency MSRs
    
    As per SDM rev 071 Cannon Lake has
    - no CC3 residency MSR at 3FC,
    - a CC1 residency MSR ar 660 (like various Atoms),
    - a useless (always zero) CC3 residency MSR at 662.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 9ff09aefc46385dc04c38b6dd1f1ac25f784f482
    master date: 2020-04-03 17:15:58 +0200
---
 xen/arch/x86/acpi/cpu_idle.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c
index 836f524ef4..d24f44167b 100644
--- a/xen/arch/x86/acpi/cpu_idle.c
+++ b/xen/arch/x86/acpi/cpu_idle.c
@@ -68,7 +68,7 @@
 #define GET_PC8_RES(val)  GET_HW_RES_IN_NS(0x630, val) /* some Haswells only */
 #define GET_PC9_RES(val)  GET_HW_RES_IN_NS(0x631, val) /* some Haswells only */
 #define GET_PC10_RES(val) GET_HW_RES_IN_NS(0x632, val) /* some Haswells only */
-#define GET_CC1_RES(val)  GET_HW_RES_IN_NS(0x660, val) /* Silvermont only */
+#define GET_CC1_RES(val)  GET_HW_RES_IN_NS(0x660, val)
 #define GET_CC3_RES(val)  GET_HW_RES_IN_NS(0x3FC, val)
 #define GET_CC6_RES(val)  GET_HW_RES_IN_NS(0x3FD, val)
 #define GET_CC7_RES(val)  GET_HW_RES_IN_NS(0x3FE, val) /* SNB onwards */
@@ -179,8 +179,6 @@ static void do_get_hw_residencies(void *arg)
     case 0x4E:
     case 0x55:
     case 0x5E:
-    /* Cannon Lake */
-    case 0x66:
     /* Kaby Lake */
     case 0x8E:
     case 0x9E:
@@ -202,6 +200,16 @@ static void do_get_hw_residencies(void *arg)
         GET_CC3_RES(hw_res->cc3);
         GET_CC6_RES(hw_res->cc6);
         break;
+    /* Cannon Lake */
+    case 0x66:
+        GET_PC2_RES(hw_res->pc2);
+        GET_PC3_RES(hw_res->pc3);
+        GET_PC6_RES(hw_res->pc6);
+        GET_PC7_RES(hw_res->pc7);
+        GET_CC1_RES(hw_res->cc1);
+        GET_CC6_RES(hw_res->cc6);
+        GET_CC7_RES(hw_res->cc7);
+        break;
     /* Xeon Phi Knights Landing */
     case 0x57:
     /* Xeon Phi Knights Mill */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Thu Jun 25 13:22:25 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Jun 2020 13: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 1joRph-0002V1-Nu; Thu, 25 Jun 2020 13: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=UBdM=AG=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1joRpg-0002Un-5O
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:22:24 +0000
X-Inumbo-ID: e74f2182-b6e6-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id e74f2182-b6e6-11ea-bb8b-bc764e2007e4;
 Thu, 25 Jun 2020 13: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=RRhZ4yBXKeUixEXfjHB6t9NKNE1eT9BONajtwDqrrQY=; b=QWPk+JjgzjEeP9IMzQhxsbVEK9
 d6RAE47DIpVtHUVOWtLBmkSUFgx4YLuvLg0OHIn/3evNoy2qBXr7/zT96nyIRE5mdxbM22Qvl/yIs
 VlMxgTYb4XQqJD5jcN6/rRAIL6/KFT3bZKTnQqprCxC11PFHQLMe2dyJeXKmxoZO8yrM=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRpe-0007Ls-Ln
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRpe-0003Ij-Ke
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:22:22 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] cpupool: fix removing cpu from a cpupool
Message-Id: <E1joRpe-0003Ij-Ke@xenbits.xenproject.org>
Date: Thu, 25 Jun 2020 13: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 9eec3eecadec0a74b8b2a7d5a2a154414856822d
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Jun 24 16:21:50 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:21:50 2020 +0200

    cpupool: fix removing cpu from a cpupool
    
    Commit cb563d7665f2 ("xen/sched: support core scheduling for moving
    cpus to/from cpupools") introduced a regression when trying to remove
    an offline cpu from a cpupool, as the system would crash in this
    situation.
    
    Fix that by testing the cpu to be online.
    
    Fixes: cb563d7665f2 ("xen/sched: support core scheduling for moving cpus to/from cpupools")
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Dario Faggioli <dfaggioli@suse.com>
    master commit: 498d73647fa17d9eb7a67d2e9bdccac6b438e559
    master date: 2020-05-08 10:44:22 +0200
---
 xen/common/cpupool.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xen/common/cpupool.c b/xen/common/cpupool.c
index b90bf42703..85f22c5f53 100644
--- a/xen/common/cpupool.c
+++ b/xen/common/cpupool.c
@@ -519,6 +519,9 @@ static int cpupool_unassign_cpu(struct cpupool *c, unsigned int cpu)
     debugtrace_printk("cpupool_unassign_cpu(pool=%d,cpu=%d)\n",
                       c->cpupool_id, cpu);
 
+    if ( !cpu_online(cpu) )
+        return -EINVAL;
+
     master_cpu = sched_get_resource_cpu(cpu);
     ret = cpupool_unassign_cpu_start(c, master_cpu);
     if ( ret )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Thu Jun 25 13:22:34 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Jun 2020 13:22: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 1joRpq-0002W0-PP; Thu, 25 Jun 2020 13:22: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=UBdM=AG=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1joRpp-0002Vs-E7
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:22:33 +0000
X-Inumbo-ID: ed508350-b6e6-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id ed508350-b6e6-11ea-bb8b-bc764e2007e4;
 Thu, 25 Jun 2020 13:22: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=H+Ec13eozQ4eU0righXSjiuKc0SxRKOAylk9QtOQPF4=; b=WlZhwccP484WbA/hnaOCIGjyG5
 dNeCY6gAXbeikg0jmVKxPix2/8+cd60U0UWy/7nfqqguC/RIlCXHfEyB7x8HYmVbCQP5MiHwG10bM
 unZNt0atrZAKoO4lWBfLAb2SKaKDxZdsBLiq8o6VDQFvMvw2FPfxn2aSZqijDWjnCqYw=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRpo-0007Ly-Pa
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRpo-0003JZ-OM
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:22:32 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] sched: always modify vcpu pause flags atomically
Message-Id: <E1joRpo-0003JZ-OM@xenbits.xenproject.org>
Date: Thu, 25 Jun 2020 13: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 d74eb10956fe7f0c2d73fbc7b65f5be0e3e9471f
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Jun 24 16:22:28 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:22:28 2020 +0200

    sched: always modify vcpu pause flags atomically
    
    credit2 is currently modifying the pause flags of vcpus non-atomically
    via sched_set_pause_flags() and sched_clear_pause_flags(). This is
    dangerous as there are cases where the paus flags are modified without
    any lock held.
    
    So drop the non-atomic pause flag modification functions and rename the
    atomic ones dropping the _atomic suffix.
    
    Fixes: a76255b4266516 ("xen/sched: make credit2 scheduler vcpu agnostic.")
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Dario Faggioli <dfaggioli@suse.com>
    master commit: e0d92d9bd7997c6bcda17a19aba4f3957dd1a2e9
    master date: 2020-05-08 10:47:38 +0200
---
 xen/common/sched_credit.c  |  4 ++--
 xen/include/xen/sched-if.h | 22 +---------------------
 2 files changed, 3 insertions(+), 23 deletions(-)

diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c
index aa41a3301b..e60b96da87 100644
--- a/xen/common/sched_credit.c
+++ b/xen/common/sched_credit.c
@@ -452,7 +452,7 @@ static inline void __runq_tickle(struct csched_unit *new)
                     SCHED_UNIT_STAT_CRANK(cur, kicked_away);
                     SCHED_UNIT_STAT_CRANK(cur, migrate_r);
                     SCHED_STAT_CRANK(migrate_kicked_away);
-                    sched_set_pause_flags_atomic(cur->unit, _VPF_migrating);
+                    sched_set_pause_flags(cur->unit, _VPF_migrating);
                 }
                 /* Tickle cpu anyway, to let new preempt cur. */
                 SCHED_STAT_CRANK(tickled_busy_cpu);
@@ -983,7 +983,7 @@ csched_unit_acct(struct csched_private *prv, unsigned int cpu)
         {
             SCHED_UNIT_STAT_CRANK(svc, migrate_r);
             SCHED_STAT_CRANK(migrate_running);
-            sched_set_pause_flags_atomic(currunit, _VPF_migrating);
+            sched_set_pause_flags(currunit, _VPF_migrating);
             /*
              * As we are about to tickle cpu, we should clear its bit in
              * idlers. But, if we are here, it means there is someone running
diff --git a/xen/include/xen/sched-if.h b/xen/include/xen/sched-if.h
index b0ac54e63d..b366f1774f 100644
--- a/xen/include/xen/sched-if.h
+++ b/xen/include/xen/sched-if.h
@@ -175,7 +175,7 @@ static inline void sched_set_pause_flags(struct sched_unit *unit,
     struct vcpu *v;
 
     for_each_sched_unit_vcpu ( unit, v )
-        __set_bit(bit, &v->pause_flags);
+        set_bit(bit, &v->pause_flags);
 }
 
 /* Clear a bit in pause_flags of all vcpus of a unit. */
@@ -184,26 +184,6 @@ static inline void sched_clear_pause_flags(struct sched_unit *unit,
 {
     struct vcpu *v;
 
-    for_each_sched_unit_vcpu ( unit, v )
-        __clear_bit(bit, &v->pause_flags);
-}
-
-/* Set a bit in pause_flags of all vcpus of a unit via atomic updates. */
-static inline void sched_set_pause_flags_atomic(struct sched_unit *unit,
-                                                unsigned int bit)
-{
-    struct vcpu *v;
-
-    for_each_sched_unit_vcpu ( unit, v )
-        set_bit(bit, &v->pause_flags);
-}
-
-/* Clear a bit in pause_flags of all vcpus of a unit via atomic updates. */
-static inline void sched_clear_pause_flags_atomic(struct sched_unit *unit,
-                                                  unsigned int bit)
-{
-    struct vcpu *v;
-
     for_each_sched_unit_vcpu ( unit, v )
         clear_bit(bit, &v->pause_flags);
 }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Thu Jun 25 13:22:44 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Jun 2020 13: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 1joRq0-0002XB-R4; Thu, 25 Jun 2020 13: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=UBdM=AG=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1joRpz-0002X1-Gz
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:22:43 +0000
X-Inumbo-ID: f3560702-b6e6-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id f3560702-b6e6-11ea-bca7-bc764e2007e4;
 Thu, 25 Jun 2020 13: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=FzuZT5FfCdYQPueYEFxmqZxlJsQonLT0lDL3x90SlRc=; b=431tPsLH6PPzsecbxZRltTdBa6
 wRnDqtpbfPSCgcO/C1YIbkpINE91jzeHLQ/q7yO35+Ak+V5cKyzmDL7jsDCsewjtfSYpOu2WFd45e
 OzM9Nu/qG8YPbaJXCevLSf3bDPyabmEXylu8DYWU0Bgf1MBwxNHqZPZ6E4KscoVjXRdc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRpy-0007MZ-Sa
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:22:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRpy-0003K7-Rs
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:22:42 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] x86/guest: Fix assembler warnings with newer
 binutils
Message-Id: <E1joRpy-0003K7-Rs@xenbits.xenproject.org>
Date: Thu, 25 Jun 2020 13: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 7d57caa9a26ed0ae46391e0d94cfca397e5bc8ba
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 24 16:23:20 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:23:20 2020 +0200

    x86/guest: Fix assembler warnings with newer binutils
    
    GAS of at least version 2.34 complains:
    
      hypercall_page.S: Assembler messages:
      hypercall_page.S:24: Warning: symbol 'HYPERCALL_set_trap_table' already has its type set
      ...
      hypercall_page.S:71: Warning: symbol 'HYPERCALL_arch_7' already has its type set
    
    which is because the whole page is declared as STT_OBJECT already.  Rearrange
    .set with respect to .type in DECLARE_HYPERCALL() so STT_FUNC is already in
    place.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/guest/hypercall_page.S | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/guest/hypercall_page.S b/xen/arch/x86/guest/hypercall_page.S
index 6485e9150e..9958d02cfd 100644
--- a/xen/arch/x86/guest/hypercall_page.S
+++ b/xen/arch/x86/guest/hypercall_page.S
@@ -17,9 +17,9 @@ GLOBAL(hypercall_page)
  */
 #define DECLARE_HYPERCALL(name)                                                 \
         .globl HYPERCALL_ ## name;                                              \
-        .set   HYPERCALL_ ## name, hypercall_page + __HYPERVISOR_ ## name * 32; \
         .type  HYPERCALL_ ## name, STT_FUNC;                                    \
-        .size  HYPERCALL_ ## name, 32
+        .size  HYPERCALL_ ## name, 32;                                          \
+        .set   HYPERCALL_ ## name, hypercall_page + __HYPERVISOR_ ## name * 32
 
 DECLARE_HYPERCALL(set_trap_table)
 DECLARE_HYPERCALL(mmu_update)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Thu Jun 25 13:22:54 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Jun 2020 13: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 1joRqA-0002Yt-Sb; Thu, 25 Jun 2020 13: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=UBdM=AG=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1joRq9-0002Y5-L8
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:22:53 +0000
X-Inumbo-ID: f95917c0-b6e6-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id f95917c0-b6e6-11ea-b7bb-bc764e2007e4;
 Thu, 25 Jun 2020 13: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=4IWdg78obLKUYxWTOi07OefghHhpRiGvzz3kX0S7SAs=; b=QCrCV810KiTf8+WtOMdGTfq/L3
 V8pZptsWSHWB5Ws70mni33XJRSEbwTEHxocfoj5ytsWU301aa3sUTwqZ+c14nQRsmROD9X989oGGw
 pzd/MfIGqQXfhF5oB3maWDycSAFvIq2MfhW2lXaQf85Oz9UG4XSB+wc2Mp4UUxtDh/As=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRq8-0007Ml-Vl
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:22:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRq8-0003Kw-Us
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:22:52 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] x86/build32: Discard all orphaned sections
Message-Id: <E1joRq8-0003Kw-Us@xenbits.xenproject.org>
Date: Thu, 25 Jun 2020 13:22: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 bdddd33ff290230ca065a0813576b9c051b51d0d
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 24 16:23:53 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:23:53 2020 +0200

    x86/build32: Discard all orphaned sections
    
    Linkers may put orphaned sections ahead of .text, which breaks the calling
    requirements.  A concrete example is Ubuntu's GCC-9 default of enabling
    -fcf-protection which causes us to try and execute .note.gnu.properties during
    Xen's boot.
    
    Put .got.plt in its own section as it specifically needs preserving from the
    linkers point of view, and discard everything else.  This will hopefully be
    more robust to other unexpected toolchain properties.
    
    Fixes boot from an Ubuntu build of Xen.
    
    Reported-by: Jason Andryuk <jandryuk@gmail.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Tested-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/boot/build32.lds | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/boot/build32.lds b/xen/arch/x86/boot/build32.lds
index da35aee910..97454b40ff 100644
--- a/xen/arch/x86/boot/build32.lds
+++ b/xen/arch/x86/boot/build32.lds
@@ -31,7 +31,7 @@ SECTIONS
         *(.bss.*)
   }
 
-  /DISCARD/ : {
+  .got.plt : {
         /*
          * PIC/PIE executable contains .got.plt section even if it is not linked
          * with dynamic libraries. In such case it is just placeholder for
@@ -47,6 +47,14 @@ SECTIONS
          *
          * Please check build32.mk for more details.
          */
-        /* *(.got.plt) */
+        *(.got.plt)
+  }
+
+  /DISCARD/ : {
+        /*
+         * Discard everything else, to prevent linkers from putting
+         * orphaned sections ahead of .text, which needs to be first.
+         */
+        *(*)
   }
 }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Thu Jun 25 13:23:06 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Jun 2020 13:23:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1joRqM-0002as-UU; Thu, 25 Jun 2020 13:23: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=UBdM=AG=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1joRqL-0002a0-JD
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:23:05 +0000
X-Inumbo-ID: ff6335ce-b6e6-11ea-81b8-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id ff6335ce-b6e6-11ea-81b8-12813bfff9fa;
 Thu, 25 Jun 2020 13: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=8dCDhk2B1VSHv4h9FDxcIb0IsS7PsJNVicPxeIW71tM=; b=13AXpgZ1H6Dh4fjLCqFAy5kIZ4
 08EzlqCbKFBXF6q1oQAqdOBhNrQS8qHwGjy3Y14XO+Eevd8s42GjMC8UBdSArJLxh9S041MKQlw8O
 h8usBvlGNm6A6VWIPYJiT6PVNlqKYU1PCyBoNREgkACtzb9vyUyxEumQ62LYwQba6BOM=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRqJ-0007N9-2y
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:23:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRqJ-0003Ln-1r
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:23:03 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] x86/build: move -fno-asynchronous-unwind-tables
 into EMBEDDED_EXTRA_CFLAGS
Message-Id: <E1joRqJ-0003Ln-1r@xenbits.xenproject.org>
Date: Thu, 25 Jun 2020 13: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 6bfb364c3c13c26c47c04f02fd23847a202cc226
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 24 16:24:23 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:24:23 2020 +0200

    x86/build: move -fno-asynchronous-unwind-tables into EMBEDDED_EXTRA_CFLAGS
    
    Users of EMBEDDED_EXTRA_CFLAGS already use -fno-asynchronous-unwind-tables, or
    ought to.  This shrinks the size of the rombios 32bit stubs in guest memory.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 Config.mk                            | 2 +-
 tools/tests/x86_emulator/testcase.mk | 2 +-
 xen/arch/x86/Rules.mk                | 2 +-
 xen/arch/x86/boot/build32.mk         | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Config.mk b/Config.mk
index c70957d730..85bde01f77 100644
--- a/Config.mk
+++ b/Config.mk
@@ -235,7 +235,7 @@ APPEND_LDFLAGS += $(foreach i, $(APPEND_LIB), -L$(i))
 APPEND_CFLAGS += $(foreach i, $(APPEND_INCLUDES), -I$(i))
 
 EMBEDDED_EXTRA_CFLAGS := -nopie -fno-stack-protector -fno-stack-protector-all
-EMBEDDED_EXTRA_CFLAGS += -fno-exceptions
+EMBEDDED_EXTRA_CFLAGS += -fno-exceptions -fno-asynchronous-unwind-tables
 
 XEN_EXTFILES_URL ?= http://xenbits.xen.org/xen-extfiles
 # All the files at that location were downloaded from elsewhere on
diff --git a/tools/tests/x86_emulator/testcase.mk b/tools/tests/x86_emulator/testcase.mk
index a565d15524..dafeb6caf7 100644
--- a/tools/tests/x86_emulator/testcase.mk
+++ b/tools/tests/x86_emulator/testcase.mk
@@ -4,7 +4,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 $(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
 
-CFLAGS += -fno-builtin -fno-asynchronous-unwind-tables -g0 $($(TESTCASE)-cflags)
+CFLAGS += -fno-builtin -g0 $($(TESTCASE)-cflags)
 
 .PHONY: all
 all: $(TESTCASE).bin
diff --git a/xen/arch/x86/Rules.mk b/xen/arch/x86/Rules.mk
index 659ac3d83e..812a652eec 100644
--- a/xen/arch/x86/Rules.mk
+++ b/xen/arch/x86/Rules.mk
@@ -35,7 +35,7 @@ $(call as-option-add,CFLAGS,CC,\
 $(call as-option-add,CFLAGS,CC,\
     ".L1: .L2: .nops (.L2 - .L1)$$(comma)9",-DHAVE_AS_NOPS_DIRECTIVE)
 
-CFLAGS += -mno-red-zone -fpic -fno-asynchronous-unwind-tables
+CFLAGS += -mno-red-zone -fpic
 
 # Xen doesn't use SSE interally.  If the compiler supports it, also skip the
 # SSE setup for variadic function calls.
diff --git a/xen/arch/x86/boot/build32.mk b/xen/arch/x86/boot/build32.mk
index 48c7407c00..5851ebff5f 100644
--- a/xen/arch/x86/boot/build32.mk
+++ b/xen/arch/x86/boot/build32.mk
@@ -4,7 +4,7 @@ include $(XEN_ROOT)/Config.mk
 
 $(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
 
-CFLAGS += -Werror -fno-asynchronous-unwind-tables -fno-builtin -g0 -msoft-float
+CFLAGS += -Werror -fno-builtin -g0 -msoft-float
 CFLAGS += -I$(XEN_ROOT)/xen/include
 CFLAGS := $(filter-out -flto,$(CFLAGS)) 
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Thu Jun 25 13:23:15 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Jun 2020 13: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 1joRqV-0002c7-1J; Thu, 25 Jun 2020 13: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=UBdM=AG=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1joRqT-0002by-UI
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:23:13 +0000
X-Inumbo-ID: 0564c046-b6e7-11ea-81b8-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 0564c046-b6e7-11ea-81b8-12813bfff9fa;
 Thu, 25 Jun 2020 13: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=xQWOSxdiBwtHzhK8gsfwGnaDGNNdlrLkdHlyt9Q4kMM=; b=s0Lv5i9yMow4GHvjUa79Pr6n63
 IJlOdh5sGLJdockrY4Mvi+mchDRSxRJcMwXCzAlPxdYutC7EMTfwbenl+S+35xipIFQbb2nR1P+v8
 umN6+0LkTN06+zgutsrHxj7o4NANdhBcFXI4FKpTwgmT0dSrVVXHNYKfzxugI1h15v8o=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRqT-0007NI-5x
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:23:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRqT-0003MK-5D
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:23:13 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] x86/build: Unilaterally disable -fcf-protection
Message-Id: <E1joRqT-0003MK-5D@xenbits.xenproject.org>
Date: Thu, 25 Jun 2020 13: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 eccc242b590c04758c176120a0ff5a53c044aee0
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 24 16:24:56 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:24:56 2020 +0200

    x86/build: Unilaterally disable -fcf-protection
    
    Xen doesn't support CET-IBT yet.  At a minimum, logic is required to enable it
    for supervisor use, but the livepatch functionality needs to learn not to
    overwrite ENDBR64 instructions.
    
    Furthermore, Ubuntu enables -fcf-protection by default, along with a buggy
    version of GCC-9 which objects to it in combination with
    -mindirect-branch=thunk-extern (Fixed in GCC 10, 9.4).
    
    Various objects (Xen boot path, Rombios 32 stubs) require .text to be at the
    beginning of the object.  These paths explode when .note.gnu.properties gets
    put ahead of .text and we end up executing the notes data.
    
    Disable -fcf-protection for all embedded objects.
    
    Reported-by: Jason Andryuk <jandryuk@gmail.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 Config.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Config.mk b/Config.mk
index 85bde01f77..fb7c0511b1 100644
--- a/Config.mk
+++ b/Config.mk
@@ -236,6 +236,7 @@ APPEND_CFLAGS += $(foreach i, $(APPEND_INCLUDES), -I$(i))
 
 EMBEDDED_EXTRA_CFLAGS := -nopie -fno-stack-protector -fno-stack-protector-all
 EMBEDDED_EXTRA_CFLAGS += -fno-exceptions -fno-asynchronous-unwind-tables
+EMBEDDED_EXTRA_CFLAGS += -fcf-protection=none
 
 XEN_EXTFILES_URL ?= http://xenbits.xen.org/xen-extfiles
 # All the files at that location were downloaded from elsewhere on
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Thu Jun 25 13:23:25 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Jun 2020 13: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 1joRqf-0002dI-2v; Thu, 25 Jun 2020 13: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=UBdM=AG=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1joRqd-0002d9-UW
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:23:23 +0000
X-Inumbo-ID: 0b6a9222-b6e7-11ea-81b8-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 0b6a9222-b6e7-11ea-81b8-12813bfff9fa;
 Thu, 25 Jun 2020 13: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=45ArsRmewacsEErMb15fG1or72nBRQcWqC1btGZoyS8=; b=I1KFe3YdlPIOKtaMYzAlTe339O
 ErPefU37kqKeBTHvCuEysEQsvQlS8uKO4f97t+srO3cU0LDpPAReT5Oa60ds189S2bAdGsNWaIRgF
 b42yEFg32ESJIeum1mKEzuc5ZZkh8Wg92fg1AnvNVZfnBQ4+56FsWKeASLP1KU5wHBC0=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRqd-0007NV-9I
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:23:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRqd-0003Ms-8A
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:23:23 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] x86/PVH: PHYSDEVOP_pci_mmcfg_reserved should not
 blindly register a region
Message-Id: <E1joRqd-0003Ms-8A@xenbits.xenproject.org>
Date: Thu, 25 Jun 2020 13: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 d61fef6c411362876337fd4f473fbdef67ed00a5
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jun 24 16:25:29 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:25:29 2020 +0200

    x86/PVH: PHYSDEVOP_pci_mmcfg_reserved should not blindly register a region
    
    The op has a "is reserved" flag, and hence registration shouldn't
    happen unilaterally.
    
    Fixes: eb3dd90e4089 ("x86/physdev: enable PHYSDEVOP_pci_mmcfg_reserved for PVH Dom0")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: b539eeffc737d859dd1814c2e529e0ed0feba7a7
    master date: 2020-05-14 07:53:55 +0200
---
 xen/arch/x86/physdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/physdev.c b/xen/arch/x86/physdev.c
index 3a3c15890b..23465bcd00 100644
--- a/xen/arch/x86/physdev.c
+++ b/xen/arch/x86/physdev.c
@@ -556,7 +556,7 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 
         ret = pci_mmcfg_reserved(info.address, info.segment,
                                  info.start_bus, info.end_bus, info.flags);
-        if ( !ret && has_vpci(currd) )
+        if ( !ret && has_vpci(currd) && (info.flags & XEN_PCI_MMCFG_RESERVED) )
         {
             /*
              * For HVM (PVH) domains try to add the newly found MMCFG to the
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Thu Jun 25 13:23:35 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Jun 2020 13: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 1joRqp-0002eL-4f; Thu, 25 Jun 2020 13:23: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=UBdM=AG=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1joRqo-0002eA-4p
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:23:34 +0000
X-Inumbo-ID: 116ff478-b6e7-11ea-81b8-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 116ff478-b6e7-11ea-81b8-12813bfff9fa;
 Thu, 25 Jun 2020 13: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=txC/0NCsXP1A2dgDSW7PxAKxKP3d+wnyKkV8glkCdLA=; b=vv/4X0/xNMztxBZNns5nEKvfgw
 KvBPOZihJWBaV2Nq8vltzpQec5ZJMGyYL9LJdyTUGQ+XOjOB/Sm/MxGaAHFbfOOc6HjjnT4GGSJiS
 xEyMe/GJZ2UrJG+VqH0ENU+PHvpWzatIa0RfKlwDbW4fKUL/VIPTdCDG3CJs6QHz86to=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRqn-0007Nj-Ca
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:23:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRqn-0003NI-Bi
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:23:33 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] sched: allow rcu work to happen when syncing cpus
 in core scheduling
Message-Id: <E1joRqn-0003NI-Bi@xenbits.xenproject.org>
Date: Thu, 25 Jun 2020 13: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 f2ad77ba78224a9cc21e14f57bb1d2210d561e0b
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Jun 24 16:26:11 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:26:11 2020 +0200

    sched: allow rcu work to happen when syncing cpus in core scheduling
    
    With RCU barriers moved from tasklets to normal RCU processing cpu
    offlining in core scheduling might deadlock due to cpu synchronization
    required by RCU processing and core scheduling concurrently.
    
    Fix that by bailing out from core scheduling synchronization in case
    of pending RCU work. Additionally the RCU softirq is now required to
    be of higher priority than the scheduling softirqs in order to do
    RCU processing before entering the scheduler again, as bailing out from
    the core scheduling synchronization requires to raise another softirq
    SCHED_SLAVE, which would bypass RCU processing again.
    
    Reported-by: Sergey Dyasli <sergey.dyasli@citrix.com>
    Tested-by: Sergey Dyasli <sergey.dyasli@citrix.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Dario Faggioli <dfaggioli@suse.com>
    master commit: 4e9c57c4edbabab1b66f965db0203100097944ff
    master date: 2020-05-15 16:04:00 +0200
---
 xen/common/schedule.c     | 13 ++++++++++---
 xen/include/xen/softirq.h |  2 +-
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/xen/common/schedule.c b/xen/common/schedule.c
index 6d24a3a135..ccc20ce040 100644
--- a/xen/common/schedule.c
+++ b/xen/common/schedule.c
@@ -2270,13 +2270,20 @@ static struct sched_unit *sched_wait_rendezvous_in(struct sched_unit *prev,
             v = unit2vcpu_cpu(prev, cpu);
         }
         /*
-         * Coming from idle might need to do tasklet work.
+         * Check for any work to be done which might need cpu synchronization.
+         * This is either pending RCU work, or tasklet work when coming from
+         * idle. It is mandatory that RCU softirqs are of higher priority
+         * than scheduling ones as otherwise a deadlock might occur.
          * In order to avoid deadlocks we can't do that here, but have to
-         * continue the idle loop.
+         * schedule the previous vcpu again, which will lead to the desired
+         * processing to be done.
          * Undo the rendezvous_in_cnt decrement and schedule another call of
          * sched_slave().
          */
-        if ( is_idle_unit(prev) && sched_tasklet_check_cpu(cpu) )
+        BUILD_BUG_ON(RCU_SOFTIRQ > SCHED_SLAVE_SOFTIRQ ||
+                     RCU_SOFTIRQ > SCHEDULE_SOFTIRQ);
+        if ( rcu_pending(cpu) ||
+             (is_idle_unit(prev) && sched_tasklet_check_cpu(cpu)) )
         {
             struct vcpu *vprev = current;
 
diff --git a/xen/include/xen/softirq.h b/xen/include/xen/softirq.h
index d7273b389b..d21b048b8c 100644
--- a/xen/include/xen/softirq.h
+++ b/xen/include/xen/softirq.h
@@ -4,10 +4,10 @@
 /* Low-latency softirqs come first in the following list. */
 enum {
     TIMER_SOFTIRQ = 0,
+    RCU_SOFTIRQ,
     SCHED_SLAVE_SOFTIRQ,
     SCHEDULE_SOFTIRQ,
     NEW_TLBFLUSH_CLOCK_PERIOD_SOFTIRQ,
-    RCU_SOFTIRQ,
     TASKLET_SOFTIRQ,
     NR_COMMON_SOFTIRQS
 };
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Thu Jun 25 13:23:45 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Jun 2020 13: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 1joRqz-0002fM-6A; Thu, 25 Jun 2020 13: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=UBdM=AG=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1joRqy-0002fD-6v
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:23:44 +0000
X-Inumbo-ID: 17779d26-b6e7-11ea-81b8-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 17779d26-b6e7-11ea-81b8-12813bfff9fa;
 Thu, 25 Jun 2020 13: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=QX8rzmpqGexb4fYkNd7fkNqKnINGllv6ylK/zZViohE=; b=gaXwiclDpDxWJiIIanispY3/21
 08WmACAycDawoD76Ab/8Mjfx5C6ae3beFP+YZj6DObEzVE+kvqzzoo1LdrVjXalQ6PaKFeNufIcuE
 jPK9D6ylnjpWCOtFUw0sfUa4/8u87uYCJE54/R8zKhK5PgNFUUFZTJO6lX9dHVWCoAcg=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRqx-0007OX-Ft
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:23:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRqx-0003Nv-F1
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:23:43 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] x86/hvm: Fix shifting in stdvga_mem_read()
Message-Id: <E1joRqx-0003Nv-F1@xenbits.xenproject.org>
Date: Thu, 25 Jun 2020 13: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 04aedf4048c12a9f0dba3b693df7f2c5df614901
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 24 16:27:16 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:27:16 2020 +0200

    x86/hvm: Fix shifting in stdvga_mem_read()
    
    stdvga_mem_read() has a return type of uint8_t, which promotes to int rather
    than unsigned int.  Shifting by 24 may hit the sign bit.
    
    Spotted by Coverity.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 97fb0253e6c2f2221bfd0895b7ffe3a99330d847
    master date: 2020-05-18 15:22:53 +0100
---
 xen/arch/x86/hvm/stdvga.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/stdvga.c b/xen/arch/x86/hvm/stdvga.c
index bd398dbb1b..e2675139e7 100644
--- a/xen/arch/x86/hvm/stdvga.c
+++ b/xen/arch/x86/hvm/stdvga.c
@@ -322,7 +322,7 @@ static int stdvga_mem_read(const struct hvm_io_handler *handler,
         data = stdvga_mem_readb(addr);
         data |= stdvga_mem_readb(addr + 1) << 8;
         data |= stdvga_mem_readb(addr + 2) << 16;
-        data |= stdvga_mem_readb(addr + 3) << 24;
+        data |= (uint32_t)stdvga_mem_readb(addr + 3) << 24;
         break;
 
     case 8:
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Thu Jun 25 13:23:56 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Jun 2020 13:23: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 1joRrA-0002gq-7j; Thu, 25 Jun 2020 13:23: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=UBdM=AG=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1joRr9-0002gj-9O
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:23:55 +0000
X-Inumbo-ID: 1d78f30a-b6e7-11ea-81b8-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 1d78f30a-b6e7-11ea-81b8-12813bfff9fa;
 Thu, 25 Jun 2020 13: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=XukNz6BokouJkCQ8OCRfEZh6oNXQ9winSeaHgVc12Ac=; b=bpOOaQAK4d5ZjHMiFSmAcDve1Y
 cJvmUxOjMgYZLfFHyiDAjGOoMykpyFqpMvw8IsHW1t37OkAkFODBFDwZBbv3DnT5PvtJAoLPIzgkB
 YXuEXvj3avLx5Ix8nR0iyAlv/cesqed/PfFMnzGUJqT8b2MrTDOneqTCYDUq/9kBYc+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 1joRr7-0007Oa-It
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:23:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRr7-0003Ob-IH
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:23:53 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] x86: determine MXCSR mask in all cases
Message-Id: <E1joRr7-0003Ob-IH@xenbits.xenproject.org>
Date: Thu, 25 Jun 2020 13: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 7f6b66d71ff7ef5695da15b1e4b3ee7e0fc5140d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jun 24 16:27:55 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:27:55 2020 +0200

    x86: determine MXCSR mask in all cases
    
    For its use(s) by the emulator to be correct in all cases, the filling
    of the variable needs to be independent of XSAVE availability. As
    there's no suitable function in i387.c to put the logic in, keep it in
    xstate_init(), arrange for the function to be called unconditionally,
    and pull the logic ahead of all return paths there.
    
    Fixes: 9a4496a35b20 ("x86emul: support {,V}{LD,ST}MXCSR")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 2b532519d64e653a6bbfd9eefed6040a09c8876d
    master date: 2020-05-18 17:18:56 +0200
---
 xen/arch/x86/cpu/common.c |  3 +--
 xen/arch/x86/xstate.c     | 18 ++++++++++++------
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index e5ad17d8d9..ad34d9b526 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -487,8 +487,7 @@ void identify_cpu(struct cpuinfo_x86 *c)
 
 	/* Now the feature flags better reflect actual CPU features! */
 
-	if ( cpu_has_xsave )
-		xstate_init(c);
+	xstate_init(c);
 
 #ifdef NOISY_CAPS
 	printk(KERN_DEBUG "CPU: After all inits, caps:");
diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c
index 243495ed07..0abf20d2ef 100644
--- a/xen/arch/x86/xstate.c
+++ b/xen/arch/x86/xstate.c
@@ -587,6 +587,18 @@ void xstate_init(struct cpuinfo_x86 *c)
     u32 eax, ebx, ecx, edx;
     u64 feature_mask;
 
+    if ( bsp )
+    {
+        static typeof(current->arch.xsave_area->fpu_sse) __initdata ctxt;
+
+        asm ( "fxsave %0" : "=m" (ctxt) );
+        if ( ctxt.mxcsr_mask )
+            mxcsr_mask = ctxt.mxcsr_mask;
+    }
+
+    if ( !cpu_has_xsave )
+        return;
+
     if ( (bsp && !use_xsave) ||
          boot_cpu_data.cpuid_level < XSTATE_CPUID )
     {
@@ -610,8 +622,6 @@ void xstate_init(struct cpuinfo_x86 *c)
 
     if ( bsp )
     {
-        static typeof(current->arch.xsave_area->fpu_sse) __initdata ctxt;
-
         xfeature_mask = feature_mask;
         /*
          * xsave_cntxt_size is the max size required by enabled features.
@@ -620,10 +630,6 @@ void xstate_init(struct cpuinfo_x86 *c)
         xsave_cntxt_size = _xstate_ctxt_size(feature_mask);
         printk("xstate: size: %#x and states: %#"PRIx64"\n",
                xsave_cntxt_size, xfeature_mask);
-
-        asm ( "fxsave %0" : "=m" (ctxt) );
-        if ( ctxt.mxcsr_mask )
-            mxcsr_mask = ctxt.mxcsr_mask;
     }
     else
     {
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Thu Jun 25 13:24:05 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Jun 2020 13:24: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 1joRrJ-0002hz-9R; Thu, 25 Jun 2020 13:24: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=UBdM=AG=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1joRrI-0002hr-CZ
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:24:04 +0000
X-Inumbo-ID: 237e0d9e-b6e7-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 237e0d9e-b6e7-11ea-b7bb-bc764e2007e4;
 Thu, 25 Jun 2020 13:24: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=TxOwpMf5ZzCVaHZeDFOMTg71STcU/gsAKwQbZ6WLThw=; b=ZpSDEeqRuvMW2wKrWjZlShqh45
 DQn+EQVx/Mzvr0sldmFteAi7HzUE/rkmNBW9Dt8J2LlpFwFOA2I3CcL4KfiS1bsHm3ElQ+rFMGXQH
 v2HAo8J7V7XWbEEd1E96ArZpmEGsGywCj98QLIJI2bGo5U7qClJU5SLfRr9Oujit5qcE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRrH-0007Ov-M8
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:24:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRrH-0003PE-LO
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:24:03 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] x86/idle: rework C6 EOI workaround
Message-Id: <E1joRrH-0003PE-LO@xenbits.xenproject.org>
Date: Thu, 25 Jun 2020 13:24: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 85ac0083529735c88b012c43227a4e0d5eb16a30
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Jun 24 16:28:36 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:28:36 2020 +0200

    x86/idle: rework C6 EOI workaround
    
    Change the C6 EOI workaround (errata AAJ72) to use x86_match_cpu. Also
    call the workaround from mwait_idle, previously it was only used by
    the ACPI idle driver. Finally make sure the routine is called for all
    states equal or greater than ACPI_STATE_C3, note that the ACPI driver
    doesn't currently handle them, but the errata condition shouldn't be
    limited by that.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 5fef1fd713660406a6187ef352fbf79986abfe43
    master date: 2020-05-20 12:48:37 +0200
---
 xen/arch/x86/acpi/cpu_idle.c  | 43 ++++++++++++++++++++++++++-----------------
 xen/arch/x86/cpu/mwait-idle.c |  3 +++
 xen/include/asm-x86/cpuidle.h |  2 ++
 3 files changed, 31 insertions(+), 17 deletions(-)

diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c
index d24f44167b..1e6b374136 100644
--- a/xen/arch/x86/acpi/cpu_idle.c
+++ b/xen/arch/x86/acpi/cpu_idle.c
@@ -545,26 +545,35 @@ void trace_exit_reason(u32 *irq_traced)
     }
 }
 
-/*
- * "AAJ72. EOI Transaction May Not be Sent if Software Enters Core C6 During 
- * an Interrupt Service Routine"
- * 
- * There was an errata with some Core i7 processors that an EOI transaction 
- * may not be sent if software enters core C6 during an interrupt service 
- * routine. So we don't enter deep Cx state if there is an EOI pending.
- */
-static bool errata_c6_eoi_workaround(void)
+bool errata_c6_eoi_workaround(void)
 {
-    static int8_t fix_needed = -1;
+    static int8_t __read_mostly fix_needed = -1;
 
     if ( unlikely(fix_needed == -1) )
     {
-        int model = boot_cpu_data.x86_model;
-        fix_needed = (cpu_has_apic && !directed_eoi_enabled &&
-                      (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) &&
-                      (boot_cpu_data.x86 == 6) &&
-                      ((model == 0x1a) || (model == 0x1e) || (model == 0x1f) ||
-                       (model == 0x25) || (model == 0x2c) || (model == 0x2f)));
+#define INTEL_FAM6_MODEL(m) { X86_VENDOR_INTEL, 6, m, X86_FEATURE_ALWAYS }
+        /*
+         * Errata AAJ72: EOI Transaction May Not be Sent if Software Enters
+         * Core C6 During an Interrupt Service Routine"
+         *
+         * There was an errata with some Core i7 processors that an EOI
+         * transaction may not be sent if software enters core C6 during an
+         * interrupt service routine. So we don't enter deep Cx state if
+         * there is an EOI pending.
+         */
+        static const struct x86_cpu_id eoi_errata[] = {
+            INTEL_FAM6_MODEL(0x1a),
+            INTEL_FAM6_MODEL(0x1e),
+            INTEL_FAM6_MODEL(0x1f),
+            INTEL_FAM6_MODEL(0x25),
+            INTEL_FAM6_MODEL(0x2c),
+            INTEL_FAM6_MODEL(0x2f),
+            { }
+        };
+#undef INTEL_FAM6_MODEL
+
+        fix_needed = cpu_has_apic && !directed_eoi_enabled &&
+                     x86_match_cpu(eoi_errata);
     }
 
     return (fix_needed && cpu_has_pending_apic_eoi());
@@ -672,7 +681,7 @@ static void acpi_processor_idle(void)
         return;
     }
 
-    if ( (cx->type == ACPI_STATE_C3) && errata_c6_eoi_workaround() )
+    if ( (cx->type >= ACPI_STATE_C3) && errata_c6_eoi_workaround() )
         cx = power->safe_state;
 
 
diff --git a/xen/arch/x86/cpu/mwait-idle.c b/xen/arch/x86/cpu/mwait-idle.c
index 52413e6da1..f0380c0428 100644
--- a/xen/arch/x86/cpu/mwait-idle.c
+++ b/xen/arch/x86/cpu/mwait-idle.c
@@ -769,6 +769,9 @@ static void mwait_idle(void)
 		return;
 	}
 
+	if ((cx->type >= 3) && errata_c6_eoi_workaround())
+		cx = power->safe_state;
+
 	eax = cx->address;
 	cstate = ((eax >> MWAIT_SUBSTATE_SIZE) & MWAIT_CSTATE_MASK) + 1;
 
diff --git a/xen/include/asm-x86/cpuidle.h b/xen/include/asm-x86/cpuidle.h
index 5d7dffd228..51368694dc 100644
--- a/xen/include/asm-x86/cpuidle.h
+++ b/xen/include/asm-x86/cpuidle.h
@@ -26,4 +26,6 @@ void update_idle_stats(struct acpi_processor_power *,
 void update_last_cx_stat(struct acpi_processor_power *,
                          struct acpi_processor_cx *, uint64_t);
 
+bool errata_c6_eoi_workaround(void);
+
 #endif /* __X86_ASM_CPUIDLE_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Thu Jun 25 13:24:17 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Jun 2020 13:24:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1joRrU-0002jY-Cj; Thu, 25 Jun 2020 13:24: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=UBdM=AG=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1joRrS-0002jM-U4
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:24:14 +0000
X-Inumbo-ID: 2982e64c-b6e7-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 2982e64c-b6e7-11ea-8496-bc764e2007e4;
 Thu, 25 Jun 2020 13:24: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=jMJU6ftNrbBFTkZfyXdXkFBzIOFwexSXbPCZuPROpIc=; b=aPlZsULc6VubD9tDE1eQnjCfo9
 Q1OMyK7ct/v1yzVT7O9XGDfe5bhtaXkHwIk7UbfK2hVrgvst+DISvTSHAlPi6soRcPIC29+ms1XSG
 kOS/Kdeo90GTDTeMDL1SIXtQYoPWoIpSgcXdyhp33tnzGE4FW98G3js0X/+DlFEJe6XA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRrR-0007PB-PH
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:24:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRrR-0003Pm-OX
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:24:13 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] x86/idle: prevent entering C6 with in service
 interrupts on Intel
Message-Id: <E1joRrR-0003Pm-OX@xenbits.xenproject.org>
Date: Thu, 25 Jun 2020 13:24: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 0a85f84e6593a964323d8a879d84d58c53379c9c
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Jun 24 16:29:17 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:29:17 2020 +0200

    x86/idle: prevent entering C6 with in service interrupts on Intel
    
    Apply a workaround for Intel errata BDX99, CLX30, SKX100, CFW125,
    BDF104, BDH85, BDM135, KWB131: "A Pending Fixed Interrupt May Be
    Dispatched Before an Interrupt of The Same Priority Completes".
    
    Apply the errata to all server and client models (big cores) from
    Broadwell to Cascade Lake. The workaround is grouped together with the
    existing fix for errata AAJ72, and the eoi from the function name is
    removed.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: fc44a7014cafe28b8c53eeaf6ac2a71f5bc8b815
    master date: 2020-05-22 16:07:38 +0200
---
 xen/arch/x86/acpi/cpu_idle.c  | 38 ++++++++++++++++++++++++++++++++++----
 xen/arch/x86/cpu/mwait-idle.c |  2 +-
 xen/include/asm-x86/cpuidle.h |  2 +-
 3 files changed, 36 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c
index 1e6b374136..e79776bc09 100644
--- a/xen/arch/x86/acpi/cpu_idle.c
+++ b/xen/arch/x86/acpi/cpu_idle.c
@@ -545,7 +545,7 @@ void trace_exit_reason(u32 *irq_traced)
     }
 }
 
-bool errata_c6_eoi_workaround(void)
+bool errata_c6_workaround(void)
 {
     static int8_t __read_mostly fix_needed = -1;
 
@@ -570,10 +570,40 @@ bool errata_c6_eoi_workaround(void)
             INTEL_FAM6_MODEL(0x2f),
             { }
         };
+        /*
+         * Errata BDX99, CLX30, SKX100, CFW125, BDF104, BDH85, BDM135, KWB131:
+         * A Pending Fixed Interrupt May Be Dispatched Before an Interrupt of
+         * The Same Priority Completes.
+         *
+         * Resuming from C6 Sleep-State, with Fixed Interrupts of the same
+         * priority queued (in the corresponding bits of the IRR and ISR APIC
+         * registers), the processor may dispatch the second interrupt (from
+         * the IRR bit) before the first interrupt has completed and written to
+         * the EOI register, causing the first interrupt to never complete.
+         */
+        static const struct x86_cpu_id isr_errata[] = {
+            /* Broadwell */
+            INTEL_FAM6_MODEL(0x47),
+            INTEL_FAM6_MODEL(0x3d),
+            INTEL_FAM6_MODEL(0x4f),
+            INTEL_FAM6_MODEL(0x56),
+            /* Skylake (client) */
+            INTEL_FAM6_MODEL(0x5e),
+            INTEL_FAM6_MODEL(0x4e),
+            /* {Sky/Cascade}lake (server) */
+            INTEL_FAM6_MODEL(0x55),
+            /* {Kaby/Coffee/Whiskey/Amber} Lake */
+            INTEL_FAM6_MODEL(0x9e),
+            INTEL_FAM6_MODEL(0x8e),
+            /* Cannon Lake */
+            INTEL_FAM6_MODEL(0x66),
+            { }
+        };
 #undef INTEL_FAM6_MODEL
 
-        fix_needed = cpu_has_apic && !directed_eoi_enabled &&
-                     x86_match_cpu(eoi_errata);
+        fix_needed = cpu_has_apic &&
+                     ((!directed_eoi_enabled && x86_match_cpu(eoi_errata)) ||
+                      x86_match_cpu(isr_errata));
     }
 
     return (fix_needed && cpu_has_pending_apic_eoi());
@@ -681,7 +711,7 @@ static void acpi_processor_idle(void)
         return;
     }
 
-    if ( (cx->type >= ACPI_STATE_C3) && errata_c6_eoi_workaround() )
+    if ( (cx->type >= ACPI_STATE_C3) && errata_c6_workaround() )
         cx = power->safe_state;
 
 
diff --git a/xen/arch/x86/cpu/mwait-idle.c b/xen/arch/x86/cpu/mwait-idle.c
index f0380c0428..d0736d4502 100644
--- a/xen/arch/x86/cpu/mwait-idle.c
+++ b/xen/arch/x86/cpu/mwait-idle.c
@@ -769,7 +769,7 @@ static void mwait_idle(void)
 		return;
 	}
 
-	if ((cx->type >= 3) && errata_c6_eoi_workaround())
+	if ((cx->type >= 3) && errata_c6_workaround())
 		cx = power->safe_state;
 
 	eax = cx->address;
diff --git a/xen/include/asm-x86/cpuidle.h b/xen/include/asm-x86/cpuidle.h
index 51368694dc..0981a8fd64 100644
--- a/xen/include/asm-x86/cpuidle.h
+++ b/xen/include/asm-x86/cpuidle.h
@@ -26,6 +26,6 @@ void update_idle_stats(struct acpi_processor_power *,
 void update_last_cx_stat(struct acpi_processor_power *,
                          struct acpi_processor_cx *, uint64_t);
 
-bool errata_c6_eoi_workaround(void);
+bool errata_c6_workaround(void);
 
 #endif /* __X86_ASM_CPUIDLE_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Thu Jun 25 13:24:28 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Jun 2020 13:24: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 1joRrg-0002kk-EM; Thu, 25 Jun 2020 13:24: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=UBdM=AG=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1joRre-0002kT-LQ
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:24:26 +0000
X-Inumbo-ID: 2f891ff2-b6e7-11ea-81b8-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 2f891ff2-b6e7-11ea-81b8-12813bfff9fa;
 Thu, 25 Jun 2020 13:24: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=/gfpTPxiPIZoEUgP358Zh1EwhH09vZ1clhOJUwaFO/4=; b=tNM8rvqFsrSiy1swHT4J69lwQB
 QoobeDtyTiyryHsMqyePO/y60UnlotZqOwG2lta8G15KsOXpBkfDTdmzZrG5kvjGVTT+QMXHf5cQp
 WZbiamAFurGr5zVM9Sgadrm3fO22+JuS3+Ff7bLxlXK8/K0E2p4hgQCin4CG27o67dpI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRrb-0007PJ-SO
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:24:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRrb-0003RL-Rc
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:24:23 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] x86/idle: prevent entering C3/C6 on some Intel CPUs
 due to errata
Message-Id: <E1joRrb-0003RL-Rc@xenbits.xenproject.org>
Date: Thu, 25 Jun 2020 13:24: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 c437e06ba203f5bed82fc30dcfffacf899f91861
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Jun 24 16:29:51 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:29:51 2020 +0200

    x86/idle: prevent entering C3/C6 on some Intel CPUs due to errata
    
    Apply a workaround for errata BA80, AAK120, AAM108, AAO67, BD59,
    AAY54: Rapid Core C3/C6 Transition May Cause Unpredictable System
    Behavior.
    
    Limit maximum C state to C1 when SMT is enabled on the affected CPUs.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: b2d502466547e6782ccadd501b8ef1482c391f2c
    master date: 2020-05-22 16:08:54 +0200
---
 xen/arch/x86/cpu/intel.c | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/xen/arch/x86/cpu/intel.c b/xen/arch/x86/cpu/intel.c
index 4d7324e4d0..856de244ce 100644
--- a/xen/arch/x86/cpu/intel.c
+++ b/xen/arch/x86/cpu/intel.c
@@ -296,6 +296,41 @@ static void early_init_intel(struct cpuinfo_x86 *c)
 	ctxt_switch_levelling(NULL);
 }
 
+/*
+ * Errata BA80, AAK120, AAM108, AAO67, BD59, AAY54: Rapid Core C3/C6 Transition
+ * May Cause Unpredictable System Behavior
+ *
+ * Under a complex set of internal conditions, cores rapidly performing C3/C6
+ * transitions in a system with Intel Hyper-Threading Technology enabled may
+ * cause a machine check error (IA32_MCi_STATUS.MCACOD = 0x0106), system hang
+ * or unpredictable system behavior.
+ */
+static void probe_c3_errata(const struct cpuinfo_x86 *c)
+{
+#define INTEL_FAM6_MODEL(m) { X86_VENDOR_INTEL, 6, m, X86_FEATURE_ALWAYS }
+    static const struct x86_cpu_id models[] = {
+        /* Nehalem */
+        INTEL_FAM6_MODEL(0x1a),
+        INTEL_FAM6_MODEL(0x1e),
+        INTEL_FAM6_MODEL(0x1f),
+        INTEL_FAM6_MODEL(0x2e),
+        /* Westmere (note Westmere-EX is not affected) */
+        INTEL_FAM6_MODEL(0x2c),
+        INTEL_FAM6_MODEL(0x25),
+        { }
+    };
+#undef INTEL_FAM6_MODEL
+
+    /* Serialized by the AP bringup code. */
+    if ( max_cstate > 1 && (c->apicid & (c->x86_num_siblings - 1)) &&
+         x86_match_cpu(models) )
+    {
+        printk(XENLOG_WARNING
+	       "Disabling C-states C3 and C6 due to CPU errata\n");
+        max_cstate = 1;
+    }
+}
+
 /*
  * P4 Xeon errata 037 workaround.
  * Hardware prefetcher may cause stale data to be loaded into the cache.
@@ -323,6 +358,8 @@ static void Intel_errata_workarounds(struct cpuinfo_x86 *c)
 
 	if (cpu_has_tsx_force_abort && opt_rtm_abort)
 		wrmsrl(MSR_TSX_FORCE_ABORT, TSX_FORCE_ABORT_RTM);
+
+	probe_c3_errata(c);
 }
 
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Thu Jun 25 13:24:37 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Jun 2020 13:24: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 1joRrp-0002lh-Fr; Thu, 25 Jun 2020 13:24: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=UBdM=AG=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1joRrn-0002lX-LJ
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:24:35 +0000
X-Inumbo-ID: 358c587e-b6e7-11ea-81b8-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 358c587e-b6e7-11ea-81b8-12813bfff9fa;
 Thu, 25 Jun 2020 13:24: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=ZRqby2cd3dZVi9swlqTHpQWCEazleSucLW9iOQtfPsQ=; b=zlhjMtGJGObXH7gudw1yugjaR/
 Nbi0s9y3l+KkG0QAp6gWPAWAsGjmVPaWtuuTaU7CRhbugGHeqBqHfyv6Wvd01yeRTj3wOVqqieSQ1
 pmCVv73m9ethEObbi6lr98Do9W4LIaNGrS1r7NDAMVLOYg38J6KWlBLVvDCV4dL73ECE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRrl-0007PP-VT
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:24:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRrl-0003Rn-Ul
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:24:33 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] x86/idle: Extend ISR/C6 erratum workaround to
 Haswell
Message-Id: <E1joRrl-0003Rn-Ul@xenbits.xenproject.org>
Date: Thu, 25 Jun 2020 13:24: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 a6f20805232b0754eb2dfe69a092063868b7d0e3
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 24 16:30:29 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:30:29 2020 +0200

    x86/idle: Extend ISR/C6 erratum workaround to Haswell
    
    This bug was first discovered against Haswell.  It is definitely affected.
    
    (The XenServer ticket for this bug was opened on 2013-05-30 which is coming up
    on 7 years old, and predates Broadwell).
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: b72d8870b5f68f06b083e6bfdb28f081bcb6ab3b
    master date: 2020-05-22 20:04:23 +0100
---
 xen/arch/x86/acpi/cpu_idle.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c
index e79776bc09..95990dc8b7 100644
--- a/xen/arch/x86/acpi/cpu_idle.c
+++ b/xen/arch/x86/acpi/cpu_idle.c
@@ -580,8 +580,16 @@ bool errata_c6_workaround(void)
          * registers), the processor may dispatch the second interrupt (from
          * the IRR bit) before the first interrupt has completed and written to
          * the EOI register, causing the first interrupt to never complete.
+         *
+         * Note: Haswell hasn't had errata issued, but this issue was first
+         * discovered on Haswell hardware, and is affected.
          */
         static const struct x86_cpu_id isr_errata[] = {
+            /* Haswell */
+            INTEL_FAM6_MODEL(0x3c),
+            INTEL_FAM6_MODEL(0x3f),
+            INTEL_FAM6_MODEL(0x45),
+            INTEL_FAM6_MODEL(0x46),
             /* Broadwell */
             INTEL_FAM6_MODEL(0x47),
             INTEL_FAM6_MODEL(0x3d),
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Thu Jun 25 13:24:46 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Jun 2020 13:24: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 1joRry-0002mo-HV; Thu, 25 Jun 2020 13:24: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=UBdM=AG=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1joRrw-0002ma-KQ
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:24:44 +0000
X-Inumbo-ID: 3b9082f4-b6e7-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 3b9082f4-b6e7-11ea-bca7-bc764e2007e4;
 Thu, 25 Jun 2020 13:24: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=0Sggbgos/X/v5Tt32CwNs03N27qh5YwkHdIYuYs3TJU=; b=PZqrktOnvKGUMMn+y/IC5a2F4O
 +k/OrwSTNiskbMO7BL5gp7oErGv3jFD9fwb5rpT1iFI1Xp2STNmzST+Urg0fRn+plo148Eo/59h4U
 PgYQa13j3Z+bExzBUp7OvKeukb1JwaaGFMqyrO1UJ4QkZRquUO7gK1OusVQJwMjbkHh0=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRrw-0007Px-2B
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:24:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRrw-0003Sa-1Z
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:24:44 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] xen/trace: Don't dump offline CPUs in
 debugtrace_dump_worker()
Message-Id: <E1joRrw-0003Sa-1Z@xenbits.xenproject.org>
Date: Thu, 25 Jun 2020 13:24: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 672976cfbb2673065b4e8bb380189a9332c98cbc
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 24 16:31:09 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:31:09 2020 +0200

    xen/trace: Don't dump offline CPUs in debugtrace_dump_worker()
    
    The 'T' debugkey reliably wedges on one of my systems, which has a sparse
    APIC_ID layout due to a non power-of-2 number of cores per socket.  The
    per_cpu(dt_cpu_data, cpu) calcution falls over the deliberately non-canonical
    poison value.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: abf378e6483195b98a3f32e2c9d017e0eeeb275f
    master date: 2020-05-22 20:04:46 +0100
---
 xen/common/debugtrace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/debugtrace.c b/xen/common/debugtrace.c
index a788e55b4c..11ac198d93 100644
--- a/xen/common/debugtrace.c
+++ b/xen/common/debugtrace.c
@@ -94,7 +94,7 @@ static void debugtrace_dump_worker(void)
 
     debugtrace_dump_buffer(dt_data, "global");
 
-    for ( cpu = 0; cpu < nr_cpu_ids; cpu++ )
+    for_each_online_cpu ( cpu )
     {
         char buf[16];
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Thu Jun 25 13:24:56 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Jun 2020 13:24: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 1joRs8-0002oZ-JB; Thu, 25 Jun 2020 13:24: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=UBdM=AG=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1joRs7-0002oM-0L
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:24:55 +0000
X-Inumbo-ID: 41936d6a-b6e7-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 41936d6a-b6e7-11ea-bb8b-bc764e2007e4;
 Thu, 25 Jun 2020 13:24: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=KSkzb3hoGKeHaSvQYyC3L13gd+/eeC8kqnOZ9ZLc24A=; b=0b9G2PTjbg8EmGe9DbdZfucqrn
 357W7Be/62wR9wMqvBlzc7tVaBLvkvGTWgTXLTgkdPzoqtYJAYmhF6vbiBWykKXUdNO9m/MDLXpEc
 HaCsUR79pkk2J9JgvKyqNdYryI/gimlq7/TyEPLqH7TMkSxWHVFc0AFhm//5yL7O4XPk=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRs6-0007Q7-5N
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:24:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRs6-0003T4-4k
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:24:54 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] x86: clear RDRAND CPUID bit on AMD family 15h/16h
Message-Id: <E1joRs6-0003T4-4k@xenbits.xenproject.org>
Date: Thu, 25 Jun 2020 13:24: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 05232254ba8361f76a8961bf979560eaf15416f8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jun 24 16:36:48 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:36:48 2020 +0200

    x86: clear RDRAND CPUID bit on AMD family 15h/16h
    
    Inspired by Linux commit c49a0a80137c7ca7d6ced4c812c9e07a949f6f24:
    
        There have been reports of RDRAND issues after resuming from suspend on
        some AMD family 15h and family 16h systems. This issue stems from a BIOS
        not performing the proper steps during resume to ensure RDRAND continues
        to function properly.
    
        Update the CPU initialization to clear the RDRAND CPUID bit for any family
        15h and 16h processor that supports RDRAND. If it is known that the family
        15h or family 16h system does not have an RDRAND resume issue or that the
        system will not be placed in suspend, the "cpuid=rdrand" kernel parameter
        can be used to stop the clearing of the RDRAND CPUID bit.
    
        Note, that clearing the RDRAND CPUID bit does not prevent a processor
        that normally supports the RDRAND instruction from executing it. So any
        code that determined the support based on family and model won't #UD.
    
    Warn if no explicit choice was given on affected hardware.
    
    Check RDRAND functions at boot as well as after S3 resume (the retry
    limit chosen is entirely arbitrary).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 93401e28a84b9dc5945f5d0bf5bce68e9d5ee121
    master date: 2020-05-27 09:49:37 +0200
---
 docs/misc/xen-command-line.pandoc |  5 ++++-
 xen/arch/x86/cpu/amd.c            | 21 +++++++++++++++++++++
 xen/arch/x86/cpu/common.c         | 27 +++++++++++++++++++++++++++
 xen/arch/x86/cpuid.c              |  3 +++
 xen/include/asm-x86/processor.h   |  1 +
 5 files changed, 56 insertions(+), 1 deletion(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 81e12d053c..125b4f330b 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -492,7 +492,10 @@ The Speculation Control hardware features `srbds-ctrl`, `md-clear`, `ibrsb`,
 applicable.  They can all be ignored.
 
 `rdrand` and `rdseed` can be ignored, as a mitigation to XSA-320 /
-CVE-2020-0543.
+CVE-2020-0543.  The RDRAND feature is disabled by default on certain AMD
+systems, due to possible malfunctions after ACPI S3 suspend/resume.  `rdrand`
+may be used in its positive form to override Xen's default behaviour on these
+systems, and make the feature fully usable.
 
 ### cpuid_mask_cpu
 > `= fam_0f_rev_[cdefg] | fam_10_rev_[bc] | fam_11_rev_b`
diff --git a/xen/arch/x86/cpu/amd.c b/xen/arch/x86/cpu/amd.c
index 0906b23582..b77fa19297 100644
--- a/xen/arch/x86/cpu/amd.c
+++ b/xen/arch/x86/cpu/amd.c
@@ -3,6 +3,7 @@
 #include <xen/mm.h>
 #include <xen/smp.h>
 #include <xen/pci.h>
+#include <xen/warning.h>
 #include <asm/io.h>
 #include <asm/msr.h>
 #include <asm/processor.h>
@@ -645,6 +646,26 @@ static void init_amd(struct cpuinfo_x86 *c)
 		if (acpi_smi_cmd && (acpi_enable_value | acpi_disable_value))
 			amd_acpi_c1e_quirk = true;
 		break;
+
+	case 0x15: case 0x16:
+		/*
+		 * There are some Fam15/Fam16 systems where upon resume from S3
+		 * firmware fails to re-setup properly functioning RDRAND.
+		 * By the time we can spot the problem, it is too late to take
+		 * action, and there is nothing Xen can do to repair the problem.
+		 * Clear the feature unless force-enabled on the command line.
+		 */
+		if (c == &boot_cpu_data &&
+		    cpu_has(c, X86_FEATURE_RDRAND) &&
+		    !is_forced_cpu_cap(X86_FEATURE_RDRAND)) {
+			static const char __initconst text[] =
+				"RDRAND may cease to work on this hardware upon resume from S3.\n"
+				"Please choose an explicit cpuid={no-}rdrand setting.\n";
+
+			setup_clear_cpu_cap(X86_FEATURE_RDRAND);
+			warning_add(text);
+		}
+		break;
 	}
 
 	display_cacheinfo(c);
diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index ad34d9b526..e370226485 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -10,6 +10,7 @@
 #include <asm/io.h>
 #include <asm/mpspec.h>
 #include <asm/apic.h>
+#include <asm/random.h>
 #include <asm/setup.h>
 #include <mach_apic.h>
 #include <public/sysctl.h> /* for XEN_INVALID_{SOCKET,CORE}_ID */
@@ -97,6 +98,11 @@ void __init setup_force_cpu_cap(unsigned int cap)
 	__set_bit(cap, boot_cpu_data.x86_capability);
 }
 
+bool __init is_forced_cpu_cap(unsigned int cap)
+{
+	return test_bit(cap, forced_caps);
+}
+
 static void default_init(struct cpuinfo_x86 * c)
 {
 	/* Not much we can do here... */
@@ -496,6 +502,27 @@ void identify_cpu(struct cpuinfo_x86 *c)
 	printk("\n");
 #endif
 
+	/*
+	 * If RDRAND is available, make an attempt to check that it actually
+	 * (still) works.
+	 */
+	if (cpu_has(c, X86_FEATURE_RDRAND)) {
+		unsigned int prev = 0;
+
+		for (i = 0; i < 5; ++i)
+		{
+			unsigned int cur = arch_get_random();
+
+			if (prev && cur != prev)
+				break;
+			prev = cur;
+		}
+
+		if (i >= 5)
+			printk(XENLOG_WARNING "CPU%u: RDRAND appears to not work\n",
+			       smp_processor_id());
+	}
+
 	if (system_state == SYS_STATE_resume)
 		return;
 
diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 7055509ed6..005b892a90 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -67,6 +67,9 @@ static int __init parse_xen_cpuid(const char *s)
             {
                 if ( !val )
                     setup_clear_cpu_cap(mid->bit);
+                else if ( mid->bit == X86_FEATURE_RDRAND &&
+                          (cpuid_ecx(1) & cpufeat_mask(X86_FEATURE_RDRAND)) )
+                    setup_force_cpu_cap(X86_FEATURE_RDRAND);
                 mid = NULL;
             }
 
diff --git a/xen/include/asm-x86/processor.h b/xen/include/asm-x86/processor.h
index 19328f481a..60ad3b7344 100644
--- a/xen/include/asm-x86/processor.h
+++ b/xen/include/asm-x86/processor.h
@@ -166,6 +166,7 @@ extern const struct x86_cpu_id *x86_match_cpu(const struct x86_cpu_id table[]);
 extern void identify_cpu(struct cpuinfo_x86 *);
 extern void setup_clear_cpu_cap(unsigned int);
 extern void setup_force_cpu_cap(unsigned int);
+extern bool is_forced_cpu_cap(unsigned int);
 extern void print_cpu_info(unsigned int cpu);
 extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c);
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Thu Jun 25 13:25:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Jun 2020 13:25: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 1joRsL-0002pi-Kv; Thu, 25 Jun 2020 13:25: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=UBdM=AG=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1joRsK-0002pb-DO
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:25:08 +0000
X-Inumbo-ID: 479afa98-b6e7-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 479afa98-b6e7-11ea-b7bb-bc764e2007e4;
 Thu, 25 Jun 2020 13:25: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=7Y5kmSgRkdQ+Sf2L+yU7gyxzc+EOqqoqxDYtbzYj5Nk=; b=dtRiOVhGcs3beIBtLMe2Ur/xTr
 CHbTb0CoLyutPIv1g6y56yl9HC6sZ9qRwHI0kwAww9+GS2iKrgmB7PployXBSL9zVBrFlPRNOgPvu
 0Ovm8798FsOtG82FPO/UZAYKtY1w9EcPkCcjtkYou6lbtH5e5Xj6k1F+DlPjM+heLIxQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRsG-0007QS-8p
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:25:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRsG-0003Tm-7v
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:25:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] VT-x: extend LBR Broadwell errata coverage
Message-Id: <E1joRsG-0003Tm-7v@xenbits.xenproject.org>
Date: Thu, 25 Jun 2020 13:25: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 c3eea2cfc8d0433db221edc13709972667c12f24
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jun 24 16:37:37 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:37:37 2020 +0200

    VT-x: extend LBR Broadwell errata coverage
    
    For lbr_tsx_fixup_check() simply name a few more specific erratum
    numbers.
    
    For bdf93_fixup_check(), however, more models are affected. Oddly enough
    despite being the same model and stepping, the erratum is listed for
    Xeon E3 but not its Core counterpart. Apply the workaround uniformly,
    and also for Xeon D, which only has the LBR-from one listed in its spec
    update.
    
    Seeing this broader applicability, rename anything BDF93-related to more
    generic names.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: 724913de8ac8426d313a4645741d86c1169ae406
    master date: 2020-05-28 12:03:25 +0200
---
 xen/arch/x86/hvm/vmx/vmx.c | 52 ++++++++++++++++++++++++++++++----------------
 1 file changed, 34 insertions(+), 18 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index e70096b798..2be74aa8c3 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2375,7 +2375,7 @@ static void pi_notification_interrupt(struct cpu_user_regs *regs)
 }
 
 static void __init lbr_tsx_fixup_check(void);
-static void __init bdf93_fixup_check(void);
+static void __init ler_to_fixup_check(void);
 
 /*
  * Calculate whether the CPU is vulnerable to Instruction Fetch page
@@ -2551,7 +2551,7 @@ const struct hvm_function_table * __init start_vmx(void)
     setup_vmcs_dump();
 
     lbr_tsx_fixup_check();
-    bdf93_fixup_check();
+    ler_to_fixup_check();
 
     return &vmx_function_table;
 }
@@ -2827,11 +2827,11 @@ enum
 
 #define LBR_MSRS_INSERTED      (1u << 0)
 #define LBR_FIXUP_TSX          (1u << 1)
-#define LBR_FIXUP_BDF93        (1u << 2)
-#define LBR_FIXUP_MASK         (LBR_FIXUP_TSX | LBR_FIXUP_BDF93)
+#define LBR_FIXUP_LER_TO       (1u << 2)
+#define LBR_FIXUP_MASK         (LBR_FIXUP_TSX | LBR_FIXUP_LER_TO)
 
 static bool __read_mostly lbr_tsx_fixup_needed;
-static bool __read_mostly bdf93_fixup_needed;
+static bool __read_mostly ler_to_fixup_needed;
 
 static void __init lbr_tsx_fixup_check(void)
 {
@@ -2839,7 +2839,7 @@ static void __init lbr_tsx_fixup_check(void)
     uint32_t lbr_format;
 
     /*
-     * HSM182, HSD172, HSE117, BDM127, BDD117, BDF85, BDE105:
+     * Haswell erratum HSM182 et al, Broadwell erratum BDM127 et al:
      *
      * On processors that do not support Intel Transactional Synchronization
      * Extensions (Intel TSX) (CPUID.07H.EBX bits 4 and 11 are both zero),
@@ -2863,8 +2863,11 @@ static void __init lbr_tsx_fixup_check(void)
     case 0x45: /* HSM182 - 4th gen Core */
     case 0x46: /* HSM182, HSD172 - 4th gen Core (GT3) */
     case 0x3d: /* BDM127 - 5th gen Core */
-    case 0x47: /* BDD117 - 5th gen Core (GT3) */
-    case 0x4f: /* BDF85  - Xeon E5-2600 v4 */
+    case 0x47: /* BDD117 - 5th gen Core (GT3)
+                  BDW117 - Xeon E3-1200 v4 */
+    case 0x4f: /* BDF85  - Xeon E5-2600 v4
+                  BDH75  - Core-i7 for LGA2011-v3 Socket
+                  BDX88  - Xeon E7-x800 v4 */
     case 0x56: /* BDE105 - Xeon D-1500 */
         break;
     default:
@@ -2885,18 +2888,31 @@ static void __init lbr_tsx_fixup_check(void)
         lbr_tsx_fixup_needed = true;
 }
 
-static void __init bdf93_fixup_check(void)
+static void __init ler_to_fixup_check(void)
 {
     /*
-     * Broadwell erratum BDF93:
+     * Broadwell erratum BDF93 et al:
      *
      * Reads from MSR_LER_TO_LIP (MSR 1DEH) may return values for bits[63:61]
      * that are not equal to bit[47].  Attempting to context switch this value
      * may cause a #GP.  Software should sign extend the MSR.
      */
-    if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
-         boot_cpu_data.x86 == 6 && boot_cpu_data.x86_model == 0x4f )
-        bdf93_fixup_needed = true;
+    if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL ||
+         boot_cpu_data.x86 != 6 )
+        return;
+
+    switch ( boot_cpu_data.x86_model )
+    {
+    case 0x3d: /* BDM131 - 5th gen Core */
+    case 0x47: /* BDD??? - 5th gen Core (H-Processor line)
+                  BDW120 - Xeon E3-1200 v4 */
+    case 0x4f: /* BDF93  - Xeon E5-2600 v4
+                  BDH80  - Core-i7 for LGA2011-v3 Socket
+                  BDX93  - Xeon E7-x800 v4 */
+    case 0x56: /* BDE??? - Xeon D-1500 */
+        ler_to_fixup_needed = true;
+        break;
+    }
 }
 
 static int is_last_branch_msr(u32 ecx)
@@ -3257,8 +3273,8 @@ static int vmx_msr_write_intercept(unsigned int msr, uint64_t msr_content)
             v->arch.hvm.vmx.lbr_flags |= LBR_MSRS_INSERTED;
             if ( lbr_tsx_fixup_needed )
                 v->arch.hvm.vmx.lbr_flags |= LBR_FIXUP_TSX;
-            if ( bdf93_fixup_needed )
-                v->arch.hvm.vmx.lbr_flags |= LBR_FIXUP_BDF93;
+            if ( ler_to_fixup_needed )
+                v->arch.hvm.vmx.lbr_flags |= LBR_FIXUP_LER_TO;
         }
 
         __vmwrite(GUEST_IA32_DEBUGCTL, msr_content);
@@ -4319,7 +4335,7 @@ static void sign_extend_msr(struct vcpu *v, u32 msr, int type)
         entry->data = canonicalise_addr(entry->data);
 }
 
-static void bdf93_fixup(void)
+static void ler_to_fixup(void)
 {
     struct vcpu *curr = current;
 
@@ -4332,8 +4348,8 @@ static void lbr_fixup(void)
 
     if ( curr->arch.hvm.vmx.lbr_flags & LBR_FIXUP_TSX )
         lbr_tsx_fixup();
-    if ( curr->arch.hvm.vmx.lbr_flags & LBR_FIXUP_BDF93 )
-        bdf93_fixup();
+    if ( curr->arch.hvm.vmx.lbr_flags & LBR_FIXUP_LER_TO )
+        ler_to_fixup();
 }
 
 /* Returns false if the vmentry has to be restarted */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Thu Jun 25 13:25:15 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Jun 2020 13:25: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 1joRsR-0002qf-Nm; Thu, 25 Jun 2020 13:25: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=UBdM=AG=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1joRsQ-0002qY-VL
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:25:14 +0000
X-Inumbo-ID: 4d9f7202-b6e7-11ea-81b8-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 4d9f7202-b6e7-11ea-81b8-12813bfff9fa;
 Thu, 25 Jun 2020 13:25: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=WBcnboimjOo9XLCuQC6qR84JTLdGttvBbI2Dypw/eG4=; b=svL/Xv9KXkSAH4M+3hRsd1VAqt
 qS1Xbn40KXLE0Zy48Ov360iAmFuk0XvVMuVPkzDRuy+uRsvMF+Vx/jGCwsAyJyU3ZOuvVM42HMALe
 1UzCgrF1mexBdY98kicqnK4V/pjQUnrOEix7+5c6vg052iv5873aWaIPhixkpbw41EZo=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRsQ-0007QY-Bl
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:25:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRsQ-0003UL-B8
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:25:14 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] x86/hvm: Improve error information in handle_pio()
Message-Id: <E1joRsQ-0003UL-B8@xenbits.xenproject.org>
Date: Thu, 25 Jun 2020 13:25: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 350aaca679576ed69c6ec795c89c9e6284b44420
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 24 16:38:16 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:38:16 2020 +0200

    x86/hvm: Improve error information in handle_pio()
    
    domain_crash() should always have a message which is emitted even in release
    builds, so something more useful than this is presented to the user.
    
      (XEN) domain_crash called from io.c:171
      (XEN) domain_crash called from io.c:171
      (XEN) domain_crash called from io.c:171
      ...
    
    To avoid possibly printing stack rubble, initialise data to ~0 right away.
    Furthermore, the maximum access size is 4, so drop data from long to int.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 4609fc8eb04e6af531d86923c9d057f32a96b7d8
    master date: 2020-05-29 16:25:05 +0100
---
 xen/arch/x86/hvm/io.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/hvm/io.c b/xen/arch/x86/hvm/io.c
index a5b0a23f06..724ab44a76 100644
--- a/xen/arch/x86/hvm/io.c
+++ b/xen/arch/x86/hvm/io.c
@@ -132,13 +132,15 @@ bool handle_pio(uint16_t port, unsigned int size, int dir)
 {
     struct vcpu *curr = current;
     struct hvm_vcpu_io *vio = &curr->arch.hvm.hvm_io;
-    unsigned long data;
+    unsigned int data;
     int rc;
 
     ASSERT((size - 1) < 4 && size != 3);
 
     if ( dir == IOREQ_WRITE )
         data = guest_cpu_user_regs()->eax;
+    else
+        data = ~0; /* Avoid any risk of stack rubble. */
 
     rc = hvmemul_do_pio_buffer(port, size, dir, &data);
 
@@ -151,7 +153,7 @@ bool handle_pio(uint16_t port, unsigned int size, int dir)
         if ( dir == IOREQ_READ )
         {
             if ( size == 4 ) /* Needs zero extension. */
-                guest_cpu_user_regs()->rax = (uint32_t)data;
+                guest_cpu_user_regs()->rax = data;
             else
                 memcpy(&guest_cpu_user_regs()->rax, &data, size);
         }
@@ -167,7 +169,9 @@ bool handle_pio(uint16_t port, unsigned int size, int dir)
         break;
 
     default:
-        gdprintk(XENLOG_ERR, "Weird HVM ioemulation status %d.\n", rc);
+        gprintk(XENLOG_ERR, "Unexpected PIO status %d, port %#x %s 0x%0*x\n",
+                rc, port, dir == IOREQ_WRITE ? "write" : "read",
+                size * 2, data & ((1u << (size * 8)) - 1));
         domain_crash(curr->domain);
         return false;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Thu Jun 25 13:25:26 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Jun 2020 13:25: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 1joRsc-0002rx-PM; Thu, 25 Jun 2020 13:25: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=UBdM=AG=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1joRsc-0002rr-E6
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:25:26 +0000
X-Inumbo-ID: 53a6da96-b6e7-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 53a6da96-b6e7-11ea-b7bb-bc764e2007e4;
 Thu, 25 Jun 2020 13:25: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=ObjN/MkgsnKJn4ISkac5un81G+SZaPk/MzR2XM4vo/4=; b=vAwRlMmJ5u4/RKhfr3fFYg02N5
 N7AK2iGOljkoBcg5hYXsd+VjjeAbT0bOGP3X8FYqvuU2aVXt7qXlbOu4B1lUypYptgUWoX5KgMUCn
 FIo9wnTmCBRKLE8BE87oFIc52DR//OYP0CV1BsIinxjIMajEBliR+MCy5HI8PHGHiwJc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRsa-0007Qo-FN
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:25:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRsa-0003Ut-Ed
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:25:24 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] x86emul: address x86_insn_is_mem_{access,
 write}() omissions
Message-Id: <E1joRsa-0003Ut-Ed@xenbits.xenproject.org>
Date: Thu, 25 Jun 2020 13:25: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 ea7e8d2aa913c9ca95cc3dfb1314e439b21b6e68
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jun 24 16:38:52 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:38:52 2020 +0200

    x86emul: address x86_insn_is_mem_{access,write}() omissions
    
    First of all explain in comments what the functions' purposes are. Then
    make them actually match their comments.
    
    Note that fc6fa977be54 ("x86emul: extend x86_insn_is_mem_write()
    coverage") didn't actually fix the function's behavior for {,V}STMXCSR:
    Both are covered by generic code higher up in the function, due to
    x86_decode_twobyte() already doing suitable adjustments. And VSTMXCSR
    wouldn't have been covered anyway without a further X86EMUL_OPC_VEX()
    case label. Keep the inner case label in a comment for reference.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: e28d13eeb65c25c0bd56e8bfa83c7473047d778d
    master date: 2020-05-29 17:28:04 +0200
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 126 ++++++++++++++++++++++++++++++---
 1 file changed, 118 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 0a3ef4a9fe..76c7aa72f6 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -11318,25 +11318,87 @@ x86_insn_operand_ea(const struct x86_emulate_state *state,
     return state->ea.mem.off;
 }
 
+/*
+ * This function means to return 'true' for all supported insns with explicit
+ * accesses to memory.  This means also insns which don't have an explicit
+ * memory operand (like POP), but it does not mean e.g. segment selector
+ * loads, where the descriptor table access is considered an implicit one.
+ */
 bool
 x86_insn_is_mem_access(const struct x86_emulate_state *state,
                        const struct x86_emulate_ctxt *ctxt)
 {
+    if ( mode_64bit() && state->not_64bit )
+        return false;
+
     if ( state->ea.type == OP_MEM )
-        return ctxt->opcode != 0x8d /* LEA */ &&
-               (ctxt->opcode != X86EMUL_OPC(0x0f, 0x01) ||
-                (state->modrm_reg & 7) != 7) /* INVLPG */;
+    {
+        switch ( ctxt->opcode )
+        {
+        case 0x8d: /* LEA */
+        case X86EMUL_OPC(0x0f, 0x0d): /* PREFETCH */
+        case X86EMUL_OPC(0x0f, 0x18)
+         ... X86EMUL_OPC(0x0f, 0x1f): /* NOP space */
+        case X86EMUL_OPC_66(0x0f, 0x18)
+         ... X86EMUL_OPC_66(0x0f, 0x1f): /* NOP space */
+        case X86EMUL_OPC_F3(0x0f, 0x18)
+         ... X86EMUL_OPC_F3(0x0f, 0x1f): /* NOP space */
+        case X86EMUL_OPC_F2(0x0f, 0x18)
+         ... X86EMUL_OPC_F2(0x0f, 0x1f): /* NOP space */
+        case X86EMUL_OPC(0x0f, 0xb9): /* UD1 */
+        case X86EMUL_OPC(0x0f, 0xff): /* UD0 */
+            return false;
+
+        case X86EMUL_OPC(0x0f, 0x01):
+            return (state->modrm_reg & 7) != 7; /* INVLPG */
+
+        case X86EMUL_OPC(0x0f, 0xae):
+            return (state->modrm_reg & 7) != 7; /* CLFLUSH */
+
+        case X86EMUL_OPC_66(0x0f, 0xae):
+            return (state->modrm_reg & 7) < 6; /* CLWB, CLFLUSHOPT */
+        }
+
+        return true;
+    }
 
     switch ( ctxt->opcode )
     {
+    case 0x06 ... 0x07: /* PUSH / POP %es */
+    case 0x0e:          /* PUSH %cs */
+    case 0x16 ... 0x17: /* PUSH / POP %ss */
+    case 0x1e ... 0x1f: /* PUSH / POP %ds */
+    case 0x50 ... 0x5f: /* PUSH / POP reg */
+    case 0x60 ... 0x61: /* PUSHA / POPA */
+    case 0x68: case 0x6a: /* PUSH imm */
     case 0x6c ... 0x6f: /* INS / OUTS */
+    case 0x8f:          /* POP r/m */
+    case 0x9a:          /* CALL (far, direct) */
+    case 0x9c ... 0x9d: /* PUSHF / POPF */
     case 0xa4 ... 0xa7: /* MOVS / CMPS */
     case 0xaa ... 0xaf: /* STOS / LODS / SCAS */
+    case 0xc2 ... 0xc3: /* RET (near) */
+    case 0xc8 ... 0xc9: /* ENTER / LEAVE */
+    case 0xca ... 0xcb: /* RET (far) */
     case 0xd7:          /* XLAT */
+    case 0xe8:          /* CALL (near, direct) */
+    case X86EMUL_OPC(0x0f, 0xa0):         /* PUSH %fs */
+    case X86EMUL_OPC(0x0f, 0xa1):         /* POP %fs */
+    case X86EMUL_OPC(0x0f, 0xa8):         /* PUSH %gs */
+    case X86EMUL_OPC(0x0f, 0xa9):         /* POP %gs */
     CASE_SIMD_PACKED_INT(0x0f, 0xf7):    /* MASKMOV{Q,DQU} */
     case X86EMUL_OPC_VEX_66(0x0f, 0xf7): /* VMASKMOVDQU */
         return true;
 
+    case 0xff:
+        switch ( state->modrm_reg & 7 )
+        {
+        case 2: /* CALL (near, indirect) */
+        case 6: /* PUSH r/m */
+            return true;
+        }
+        break;
+
     case X86EMUL_OPC(0x0f, 0x01):
         /* Cover CLZERO. */
         return (state->modrm_rm & 7) == 4 && (state->modrm_reg & 7) == 7;
@@ -11345,10 +11407,20 @@ x86_insn_is_mem_access(const struct x86_emulate_state *state,
     return false;
 }
 
+/*
+ * This function means to return 'true' for all supported insns with explicit
+ * writes to memory.  This means also insns which don't have an explicit
+ * memory operand (like PUSH), but it does not mean e.g. segment selector
+ * loads, where the (possible) descriptor table write is considered an
+ * implicit access.
+ */
 bool
 x86_insn_is_mem_write(const struct x86_emulate_state *state,
                       const struct x86_emulate_ctxt *ctxt)
 {
+    if ( mode_64bit() && state->not_64bit )
+        return false;
+
     switch ( state->desc & DstMask )
     {
     case DstMem:
@@ -11360,19 +11432,48 @@ x86_insn_is_mem_write(const struct x86_emulate_state *state,
         break;
 
     default:
+        switch ( ctxt->opcode )
+        {
+        case 0x63:                         /* ARPL */
+            return !mode_64bit();
+        }
+
         return false;
     }
 
     if ( state->modrm_mod == 3 )
-        /* CLZERO is the odd one. */
-        return ctxt->opcode == X86EMUL_OPC(0x0f, 0x01) &&
-               (state->modrm_rm & 7) == 4 && (state->modrm_reg & 7) == 7;
+    {
+        switch ( ctxt->opcode )
+        {
+        case 0xff: /* Grp5 */
+            break;
+
+        case X86EMUL_OPC(0x0f, 0x01): /* CLZERO is the odd one. */
+            return (state->modrm_rm & 7) == 4 && (state->modrm_reg & 7) == 7;
+
+        default:
+            return false;
+        }
+    }
 
     switch ( ctxt->opcode )
     {
+    case 0x06:                           /* PUSH %es */
+    case 0x0e:                           /* PUSH %cs */
+    case 0x16:                           /* PUSH %ss */
+    case 0x1e:                           /* PUSH %ds */
+    case 0x50 ... 0x57:                  /* PUSH reg */
+    case 0x60:                           /* PUSHA */
+    case 0x68: case 0x6a:                /* PUSH imm */
     case 0x6c: case 0x6d:                /* INS */
+    case 0x9a:                           /* CALL (far, direct) */
+    case 0x9c:                           /* PUSHF */
     case 0xa4: case 0xa5:                /* MOVS */
     case 0xaa: case 0xab:                /* STOS */
+    case 0xc8:                           /* ENTER */
+    case 0xe8:                           /* CALL (near, direct) */
+    case X86EMUL_OPC(0x0f, 0xa0):        /* PUSH %fs */
+    case X86EMUL_OPC(0x0f, 0xa8):        /* PUSH %gs */
     case X86EMUL_OPC(0x0f, 0xab):        /* BTS */
     case X86EMUL_OPC(0x0f, 0xb3):        /* BTR */
     case X86EMUL_OPC(0x0f, 0xbb):        /* BTC */
@@ -11430,6 +11531,16 @@ x86_insn_is_mem_write(const struct x86_emulate_state *state,
         }
         break;
 
+    case 0xff:
+        switch ( state->modrm_reg & 7 )
+        {
+        case 2: /* CALL (near, indirect) */
+        case 3: /* CALL (far, indirect) */
+        case 6: /* PUSH r/m */
+            return true;
+        }
+        break;
+
     case X86EMUL_OPC(0x0f, 0x01):
         switch ( state->modrm_reg & 7 )
         {
@@ -11444,7 +11555,7 @@ x86_insn_is_mem_write(const struct x86_emulate_state *state,
         switch ( state->modrm_reg & 7 )
         {
         case 0: /* FXSAVE */
-        case 3: /* {,V}STMXCSR */
+        /* case 3: STMXCSR - handled above */
         case 4: /* XSAVE */
         case 6: /* XSAVEOPT */
             return true;
@@ -11460,7 +11571,6 @@ x86_insn_is_mem_write(const struct x86_emulate_state *state,
         case 1: /* CMPXCHG{8,16}B */
         case 4: /* XSAVEC */
         case 5: /* XSAVES */
-        case 7: /* VMPTRST */
             return true;
         }
         break;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Thu Jun 25 13:25:36 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Jun 2020 13:25: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 1joRsm-0002st-R2; Thu, 25 Jun 2020 13:25: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=UBdM=AG=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1joRsl-0002sj-ML
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:25:35 +0000
X-Inumbo-ID: 59ad3a20-b6e7-11ea-81b8-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 59ad3a20-b6e7-11ea-81b8-12813bfff9fa;
 Thu, 25 Jun 2020 13:25: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=gh9QYfNVmUXZk+yS9+ELmnuWyx2XJxXKfKvHMIx05FU=; b=eG1sbzlURqkBmGP6i8dpH9QT2A
 2sisvKXNCqVN0/q7hX5MK1KtrmOmZyTtpT3didypqtZPjltEpuknlaUs7osrjdgxlp2VFaVldFVlh
 Wgz/d/Ef+8NhkqQVRXrc17csD0Mc6r8F1jC/GNKJzFMymo2iTqMpwR8tlGddVnfc8NL0=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRsk-0007Qw-J3
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:25:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRsk-0003VV-IJ
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:25:34 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] x86emul: rework CMP and TEST emulation
Message-Id: <E1joRsk-0003VV-IJ@xenbits.xenproject.org>
Date: Thu, 25 Jun 2020 13:25: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 8ad99de837434a3e8cf16f7570d196cf2a8da9a3
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jun 24 16:39:32 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:39:32 2020 +0200

    x86emul: rework CMP and TEST emulation
    
    Unlike similarly encoded insns these don't write their memory operands,
    and hence x86_is_mem_write() should return false for them. However,
    rather than adding special logic there, rework how their emulation gets
    done, by making decoding attributes properly describe the r/o nature of
    their memory operands:
    -  change the table entries for opcodes 0x38 and 0x39, with no other
       adjustments to the attributes later on,
    -  for the other opcodes, leave the table entries as they are, and
       override the attributes for the specific sub-cases (identified by
       ModRM.reg).
    
    For opcodes 0x38 and 0x39 the change of the table entries implies
    changing the order of operands as passed to emulate_2op_SrcV(), hence
    the splitting of the cases in the main switch().
    
    Note how this also allows dropping custom LOCK prefix checks.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 20bc1b9cc99b70b17757e1903f629c7a26584790
    master date: 2020-05-29 17:28:45 +0200
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 37 +++++++++++++++++++++-------------
 1 file changed, 23 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 76c7aa72f6..3a60c6f3f2 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -84,7 +84,7 @@ static const opcode_desc_t opcode_table[256] = {
     ByteOp|DstReg|SrcMem|ModRM, DstReg|SrcMem|ModRM,
     ByteOp|DstEax|SrcImm, DstEax|SrcImm, 0, ImplicitOps,
     /* 0x38 - 0x3F */
-    ByteOp|DstMem|SrcReg|ModRM, DstMem|SrcReg|ModRM,
+    ByteOp|DstReg|SrcMem|ModRM, DstReg|SrcMem|ModRM,
     ByteOp|DstReg|SrcMem|ModRM, DstReg|SrcMem|ModRM,
     ByteOp|DstEax|SrcImm, DstEax|SrcImm, 0, ImplicitOps,
     /* 0x40 - 0x4F */
@@ -2471,7 +2471,6 @@ x86_decode_onebyte(
     case 0x60: /* pusha */
     case 0x61: /* popa */
     case 0x62: /* bound */
-    case 0x82: /* Grp1 (x86/32 only) */
     case 0xc4: /* les */
     case 0xc5: /* lds */
     case 0xce: /* into */
@@ -2481,6 +2480,14 @@ x86_decode_onebyte(
         state->not_64bit = true;
         break;
 
+    case 0x82: /* Grp1 (x86/32 only) */
+        state->not_64bit = true;
+        /* fall through */
+    case 0x80: case 0x81: case 0x83: /* Grp1 */
+        if ( (modrm_reg & 7) == 7 ) /* cmp */
+            state->desc = (state->desc & ByteOp) | DstNone | SrcMem;
+        break;
+
     case 0x90: /* nop / pause */
         if ( repe_prefix() )
             ctxt->opcode |= X86EMUL_OPC_F3(0, 0);
@@ -2511,6 +2518,11 @@ x86_decode_onebyte(
         imm2 = insn_fetch_type(uint8_t);
         break;
 
+    case 0xf6: case 0xf7: /* Grp3 */
+        if ( !(modrm_reg & 6) ) /* test */
+            state->desc = (state->desc & ByteOp) | DstNone | SrcMem;
+        break;
+
     case 0xff: /* Grp5 */
         switch ( modrm_reg & 7 )
         {
@@ -3894,13 +3906,11 @@ x86_emulate(
         break;
 
     case 0x38: case 0x39: cmp: /* cmp reg,mem */
-        if ( ops->rmw && dst.type == OP_MEM &&
-             (rc = read_ulong(dst.mem.seg, dst.mem.off, &dst.val,
-                              dst.bytes, ctxt, ops)) != X86EMUL_OKAY )
-            goto done;
-        /* fall through */
+        emulate_2op_SrcV("cmp", dst, src, _regs.eflags);
+        dst.type = OP_NONE;
+        break;
+
     case 0x3a ... 0x3d: /* cmp */
-        generate_exception_if(lock_prefix, EXC_UD);
         emulate_2op_SrcV("cmp", src, dst, _regs.eflags);
         dst.type = OP_NONE;
         break;
@@ -4207,7 +4217,9 @@ x86_emulate(
         case 4: goto and;
         case 5: goto sub;
         case 6: goto xor;
-        case 7: goto cmp;
+        case 7:
+            dst.val = imm1;
+            goto cmp;
         }
         break;
 
@@ -5200,11 +5212,8 @@ x86_emulate(
             unsigned long u[2], v;
 
         case 0 ... 1: /* test */
-            generate_exception_if(lock_prefix, EXC_UD);
-            if ( ops->rmw && dst.type == OP_MEM &&
-                 (rc = read_ulong(dst.mem.seg, dst.mem.off, &dst.val,
-                                  dst.bytes, ctxt, ops)) != X86EMUL_OKAY )
-                goto done;
+            dst.val = imm1;
+            dst.bytes = src.bytes;
             goto test;
         case 2: /* not */
             if ( ops->rmw && dst.type == OP_MEM )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Thu Jun 25 13:25:45 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Jun 2020 13:25: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 1joRsv-0002tp-Sc; Thu, 25 Jun 2020 13:25: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=UBdM=AG=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1joRsv-0002tg-C4
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:25:45 +0000
X-Inumbo-ID: 5fb21e9a-b6e7-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 5fb21e9a-b6e7-11ea-bb8b-bc764e2007e4;
 Thu, 25 Jun 2020 13:25: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=pKugxcei0fcHzTU9ApzEsuoYZL8Izb0YHb9bsTHUH2w=; b=IUq1WCELlL4X+s0c6bSU0kjYDJ
 4JhTA54juBAkE46/lf+bNHx33oXPiK0PpM12mS8FbHC4N5AEmJjwb3gitB+o8EyVf76UWAG/nD5Nc
 4FQ99EeaQfIYZ13c7l1AiM51It6kJHa8sKyL1r0eyQhz50iD63f/a6KEh9buu7k0IHEc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRsu-0007Sa-MI
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:25:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRsu-0003W1-Le
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:25:44 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] x86/mm: do not attempt to convert _PAGE_GNTTAB to a
 boolean
Message-Id: <E1joRsu-0003W1-Le@xenbits.xenproject.org>
Date: Thu, 25 Jun 2020 13:25: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 0243559f45a79f56d3720b63f4bea3cc6e4aaa61
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Jun 24 16:40:10 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:40:10 2020 +0200

    x86/mm: do not attempt to convert _PAGE_GNTTAB to a boolean
    
    Clang 10 complains with:
    
    mm.c:1239:10: error: converting the result of '<<' to a boolean always evaluates to true
          [-Werror,-Wtautological-constant-compare]
        if ( _PAGE_GNTTAB && (l1e_get_flags(l1e) & _PAGE_GNTTAB) &&
             ^
    xen/include/asm/x86_64/page.h:161:25: note: expanded from macro '_PAGE_GNTTAB'
    #define _PAGE_GNTTAB (1U<<22)
                            ^
    
    Remove the conversion of _PAGE_GNTTAB to a boolean and instead use a
    preprocessor conditional to check if _PAGE_GNTTAB is defined.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 6eb61b1a9dfe23ca443f977799cafb22770708a0
    master date: 2020-06-02 13:36:41 +0200
---
 xen/arch/x86/mm.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 97c8d73b7b..30dffb68e8 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -1236,8 +1236,14 @@ void put_page_from_l1e(l1_pgentry_t l1e, struct domain *l1e_owner)
      *
      * (Note that the undestroyable active grants are not a security hole in
      * Xen. All active grants can safely be cleaned up when the domain dies.)
+     *
+     * NB: the preprocessor conditional is required in order to prevent clang's
+     * -Wtautological-constant-compare complaining about converting the result
+     * of a << into a bool is always true if it's evaluated directly in the if
+     * condition.
      */
-    if ( _PAGE_GNTTAB && (l1e_get_flags(l1e) & _PAGE_GNTTAB) &&
+#if _PAGE_GNTTAB
+    if ( (l1e_get_flags(l1e) & _PAGE_GNTTAB) &&
          !l1e_owner->is_shutting_down && !l1e_owner->is_dying )
     {
         gdprintk(XENLOG_WARNING,
@@ -1245,6 +1251,7 @@ void put_page_from_l1e(l1_pgentry_t l1e, struct domain *l1e_owner)
                  l1e_get_intpte(l1e));
         domain_crash(l1e_owner);
     }
+#endif
 
     /*
      * Remember we didn't take a type-count of foreign writable mappings
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Thu Jun 25 13:25:55 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Jun 2020 13:25: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 1joRt5-0002vO-UT; Thu, 25 Jun 2020 13:25: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=UBdM=AG=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1joRt5-0002vH-Dn
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:25:55 +0000
X-Inumbo-ID: 65b5ce4a-b6e7-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 65b5ce4a-b6e7-11ea-b7bb-bc764e2007e4;
 Thu, 25 Jun 2020 13:25: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=mbAD7yDzM5RmrEQQS0xCNBOS+mpVQdOh5hXM94m9L3w=; b=bodIC3ZJmy8CjkATmN81IKQTFm
 nUnlZ9angIcn1MLBztqyqE2/SbsfKYAOcLV8FJVtpra7emaIHb/IbhDojZ3QH9mMYUBHDy52QzEjA
 DcMEZd5c2AjqID3OBF+C5OU26C25nl3HfmQGFjkzrZscVLo0MRcBSIOclkLQ7uk8ol5A=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRt4-0007Sl-PE
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:25:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRt4-0003WZ-OW
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:25:54 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] build32: don't discard .shstrtab in linker script
Message-Id: <E1joRt4-0003WZ-OW@xenbits.xenproject.org>
Date: Thu, 25 Jun 2020 13:25: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 74ce65c012e9b286842336fd9b02fea8cea34602
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Jun 24 16:41:06 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:41:06 2020 +0200

    build32: don't discard .shstrtab in linker script
    
    LLVM linker doesn't support discarding .shstrtab, and complains with:
    
    ld -melf_i386_fbsd -N -T build32.lds -o reloc.lnk reloc.o
    ld: error: discarding .shstrtab section is not allowed
    
    Add an explicit .shstrtab, .strtab and .symtab sections to the linker
    script after the text section in order to make LLVM LD happy and match
    the behavior of GNU LD.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 10d27b48b5b4dfbead2d9bf03290984bba4806e4
    master date: 2020-06-02 13:37:53 +0200
---
 xen/arch/x86/boot/build32.lds | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/xen/arch/x86/boot/build32.lds b/xen/arch/x86/boot/build32.lds
index 97454b40ff..1ab9418793 100644
--- a/xen/arch/x86/boot/build32.lds
+++ b/xen/arch/x86/boot/build32.lds
@@ -50,6 +50,20 @@ SECTIONS
         *(.got.plt)
   }
 
+  /*
+   * Discarding .shstrtab is not supported by LLD (LLVM LD) and will trigger an
+   * error. Also keep the rest of the control sections to match GNU LD behavior.
+   */
+  .shstrtab : {
+        *(.shstrtab)
+  }
+  .strtab : {
+        *(.strtab)
+  }
+  .symtab : {
+        *(.symtab)
+  }
+
   /DISCARD/ : {
         /*
          * Discard everything else, to prevent linkers from putting
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Thu Jun 25 13:26:07 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Jun 2020 13:26: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 1joRtH-0002wi-1E; Thu, 25 Jun 2020 13:26: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=UBdM=AG=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1joRtG-0002wc-FT
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:26:06 +0000
X-Inumbo-ID: 6ae2c437-b6e7-11ea-81b8-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 6ae2c437-b6e7-11ea-81b8-12813bfff9fa;
 Thu, 25 Jun 2020 13:26: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=c1TQ6IMZzM6OJ1ITKPxygnrzzoKfbM1Vo9ilMAJoklM=; b=L47deLBpqm2pNcaDSNZ5sDCW2f
 v6uDub3/T4/7e+5lMcxfIg2Z+f770TtS0vHJj0PQUX3bBOtoa08cJH+RY2e4r/SkuHbq39/VAGp5S
 1jRm68r/BA2tzvKsJdg5/19A7Bd0Q3lFwRQresYuS6VLUjAM3+tFgySA8xTuT26eRbw4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRtE-0007T6-SQ
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:26:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRtE-0003XI-Re
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:26:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] x86/boot: Fix load_system_tables() to be
 NMI/#MC-safe
Message-Id: <E1joRtE-0003XI-Re@xenbits.xenproject.org>
Date: Thu, 25 Jun 2020 13:26: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 b4afe058c679bd3a3370d041c1c373e9cfb800d3
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 24 16:41:57 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:41:57 2020 +0200

    x86/boot: Fix load_system_tables() to be NMI/#MC-safe
    
    During boot, load_system_tables() is used in reinit_bsp_stack() to switch the
    virtual addresses used from their .data/.bss alias, to their directmap alias.
    
    The structure assignment is implemented as a memset() to zero first, then a
    copy-in of the new data.  This causes the NMI/#MC stack pointers to
    transiently become 0, at a point where we may have an NMI watchdog running.
    
    Rewrite the logic using a volatile tss pointer (equivalent to, but more
    readable than, using ACCESS_ONCE() for all writes).
    
    This does drop the zeroing side effect for holes in the structure, but the
    backing memory for the TSS is fully zeroed anyway, and architecturally, they
    are all reserved.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 9f3e9139fa6c3d620eb08dff927518fc88200b8d
    master date: 2020-05-27 16:44:04 +0100
---
 xen/arch/x86/cpu/common.c | 49 ++++++++++++++++++++++-------------------------
 1 file changed, 23 insertions(+), 26 deletions(-)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index e370226485..4317c06670 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -729,11 +729,12 @@ static cpumask_t cpu_initialized;
  */
 void load_system_tables(void)
 {
-	unsigned int cpu = smp_processor_id();
+	unsigned int i, cpu = smp_processor_id();
 	unsigned long stack_bottom = get_stack_bottom(),
 		stack_top = stack_bottom & ~(STACK_SIZE - 1);
 
-	struct tss64 *tss = &this_cpu(tss_page).tss;
+	/* The TSS may be live.	 Disuade any clever optimisations. */
+	volatile struct tss64 *tss = &this_cpu(tss_page).tss;
 	seg_desc_t *gdt =
 		this_cpu(gdt) - FIRST_RESERVED_GDT_ENTRY;
 	seg_desc_t *compat_gdt =
@@ -748,30 +749,26 @@ void load_system_tables(void)
 		.limit = (IDT_ENTRIES * sizeof(idt_entry_t)) - 1,
 	};
 
-	*tss = (struct tss64){
-		/* Main stack for interrupts/exceptions. */
-		.rsp0 = stack_bottom,
-
-		/* Ring 1 and 2 stacks poisoned. */
-		.rsp1 = 0x8600111111111111ul,
-		.rsp2 = 0x8600111111111111ul,
-
-		/*
-		 * MCE, NMI and Double Fault handlers get their own stacks.
-		 * All others poisoned.
-		 */
-		.ist = {
-			[IST_MCE - 1] = stack_top + IST_MCE * PAGE_SIZE,
-			[IST_DF  - 1] = stack_top + IST_DF  * PAGE_SIZE,
-			[IST_NMI - 1] = stack_top + IST_NMI * PAGE_SIZE,
-			[IST_DB  - 1] = stack_top + IST_DB  * PAGE_SIZE,
-
-			[IST_MAX ... ARRAY_SIZE(tss->ist) - 1] =
-				0x8600111111111111ul,
-		},
-
-		.bitmap = IOBMP_INVALID_OFFSET,
-	};
+	/*
+	 * Set up the TSS.  Warning - may be live, and the NMI/#MC must remain
+	 * valid on every instruction boundary.  (Note: these are all
+	 * semantically ACCESS_ONCE() due to tss's volatile qualifier.)
+	 *
+	 * rsp0 refers to the primary stack.  #MC, #DF, NMI and #DB handlers
+	 * each get their own stacks.  No IO Bitmap.
+	 */
+	tss->rsp0 = stack_bottom;
+	tss->ist[IST_MCE - 1] = stack_top + IST_MCE * PAGE_SIZE;
+	tss->ist[IST_DF  - 1] = stack_top + IST_DF  * PAGE_SIZE;
+	tss->ist[IST_NMI - 1] = stack_top + IST_NMI * PAGE_SIZE;
+	tss->ist[IST_DB  - 1] = stack_top + IST_DB  * PAGE_SIZE;
+	tss->bitmap = IOBMP_INVALID_OFFSET;
+
+	/* All other stack pointers poisioned. */
+	for ( i = IST_MAX; i < ARRAY_SIZE(tss->ist); ++i )
+		tss->ist[i] = 0x8600111111111111ul;
+	tss->rsp1 = 0x8600111111111111ul;
+	tss->rsp2 = 0x8600111111111111ul;
 
 	BUILD_BUG_ON(sizeof(*tss) <= 0x67); /* Mandated by the architecture. */
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Thu Jun 25 13:26:17 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Jun 2020 13:26: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 1joRtR-0002xl-2q; Thu, 25 Jun 2020 13:26: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=UBdM=AG=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1joRtQ-0002xd-67
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:26:16 +0000
X-Inumbo-ID: 71efd6f6-b6e7-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 71efd6f6-b6e7-11ea-8496-bc764e2007e4;
 Thu, 25 Jun 2020 13:26: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=58SaYy1SOpQDaYbr3v2ZxOYAdXoYiu499RZ10j1hFog=; b=GxaMaT5lV55FTsh9XLRGxv51Kw
 PN9pu5OqSBMPsLYuRexwVL0+C0+F9iSz1bq8FPo7bOWtF2Nr00qHs3TmWphGI870Ut0QzBakclwKz
 F6pagv+ZdS1E29Kf/Tpv4vMvXsp128ocZT9CJcFt3VyUucyLU3yx3RPG3G+O4LK7BhJo=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRtP-0007TE-9X
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:26:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRtO-0003Xk-VB
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:26:14 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] x86/ucode: Fix errors with start/end_update()
Message-Id: <E1joRtO-0003Xk-VB@xenbits.xenproject.org>
Date: Thu, 25 Jun 2020 13:26: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 53bafb59e94041c1f46f979e0ce75c69f05564e8
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 24 16:44:54 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:44:54 2020 +0200

    x86/ucode: Fix errors with start/end_update()
    
    c/s 9267a439c "x86/ucode: Document the behaviour of the microcode_ops hooks"
    identified several poor behaviours of the start_update()/end_update_percpu()
    hooks.
    
    AMD have subsequently confirmed that OSVW don't, and are not expected to,
    change across a microcode load, rendering all of this complexity unecessary.
    
    Instead of fixing up the logic to not leave the OSVW state reset in a number
    of corner cases, delete the logic entirely.
    
    This in turn allows for the removal of the poorly-named 'start_update'
    parameter to microcode_update_one(), and for svm_host_osvw_{init,reset}() to
    become static.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 3659f54e9bd31f0f59268402fd67fb4b4118e184
    master date: 2020-06-02 19:18:44 +0100
---
 xen/arch/x86/acpi/power.c         |  2 +-
 xen/arch/x86/hvm/svm/svm.c        |  4 ++--
 xen/arch/x86/microcode.c          | 33 +++------------------------------
 xen/arch/x86/microcode_amd.c      | 18 ------------------
 xen/arch/x86/smpboot.c            |  2 +-
 xen/include/asm-x86/hvm/svm/svm.h |  3 ---
 xen/include/asm-x86/microcode.h   |  2 --
 xen/include/asm-x86/processor.h   |  2 +-
 8 files changed, 8 insertions(+), 58 deletions(-)

diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
index 75c6e34164..ec679c4d3a 100644
--- a/xen/arch/x86/acpi/power.c
+++ b/xen/arch/x86/acpi/power.c
@@ -286,7 +286,7 @@ static int enter_state(u32 state)
     console_end_sync();
     watchdog_enable();
 
-    microcode_update_one(true);
+    microcode_update_one();
 
     if ( !recheck_cpu_features(0) )
         panic("Missing previously available feature(s)\n");
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index dd2ec68650..0cec511b3a 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -1082,7 +1082,7 @@ static void svm_guest_osvw_init(struct domain *d)
     spin_unlock(&osvw_lock);
 }
 
-void svm_host_osvw_reset()
+static void svm_host_osvw_reset(void)
 {
     spin_lock(&osvw_lock);
 
@@ -1092,7 +1092,7 @@ void svm_host_osvw_reset()
     spin_unlock(&osvw_lock);
 }
 
-void svm_host_osvw_init()
+static void svm_host_osvw_init(void)
 {
     spin_lock(&osvw_lock);
 
diff --git a/xen/arch/x86/microcode.c b/xen/arch/x86/microcode.c
index 29b3f42cc2..27ba958d93 100644
--- a/xen/arch/x86/microcode.c
+++ b/xen/arch/x86/microcode.c
@@ -578,9 +578,6 @@ static int do_microcode_update(void *patch)
     else
         ret = secondary_thread_fn();
 
-    if ( microcode_ops->end_update_percpu )
-        microcode_ops->end_update_percpu();
-
     return ret;
 }
 
@@ -652,16 +649,6 @@ static long microcode_update_helper(void *data)
     }
     spin_unlock(&microcode_mutex);
 
-    if ( microcode_ops->start_update )
-    {
-        ret = microcode_ops->start_update();
-        if ( ret )
-        {
-            microcode_free_patch(patch);
-            goto put;
-        }
-    }
-
     cpumask_clear(&cpu_callin_map);
     atomic_set(&cpu_out, 0);
     atomic_set(&cpu_updated, 0);
@@ -760,28 +747,14 @@ static int __init microcode_init(void)
 __initcall(microcode_init);
 
 /* Load a cached update to current cpu */
-int microcode_update_one(bool start_update)
+int microcode_update_one(void)
 {
-    int err;
-
     if ( !microcode_ops )
         return -EOPNOTSUPP;
 
     microcode_ops->collect_cpu_info(&this_cpu(cpu_sig));
 
-    if ( start_update && microcode_ops->start_update )
-    {
-        err = microcode_ops->start_update();
-        if ( err )
-            return err;
-    }
-
-    err = microcode_update_cpu(NULL);
-
-    if ( microcode_ops->end_update_percpu )
-        microcode_ops->end_update_percpu();
-
-    return err;
+    return microcode_update_cpu(NULL);
 }
 
 /* BSP calls this function to parse ucode blob and then apply an update. */
@@ -825,7 +798,7 @@ int __init early_microcode_update_cpu(void)
     spin_unlock(&microcode_mutex);
     ASSERT(rc);
 
-    return microcode_update_one(true);
+    return microcode_update_one();
 }
 
 int __init early_microcode_init(void)
diff --git a/xen/arch/x86/microcode_amd.c b/xen/arch/x86/microcode_amd.c
index 846cf099e8..a5becbfaf4 100644
--- a/xen/arch/x86/microcode_amd.c
+++ b/xen/arch/x86/microcode_amd.c
@@ -24,7 +24,6 @@
 #include <asm/msr.h>
 #include <asm/processor.h>
 #include <asm/microcode.h>
-#include <asm/hvm/svm/svm.h>
 
 #define pr_debug(x...) ((void)0)
 
@@ -590,27 +589,10 @@ static struct microcode_patch *cpu_request_microcode(const void *buf,
     return patch;
 }
 
-#ifdef CONFIG_HVM
-static int start_update(void)
-{
-    /*
-     * svm_host_osvw_init() will be called on each cpu by calling '.end_update'
-     * in common code.
-     */
-    svm_host_osvw_reset();
-
-    return 0;
-}
-#endif
-
 static const struct microcode_ops microcode_amd_ops = {
     .cpu_request_microcode            = cpu_request_microcode,
     .collect_cpu_info                 = collect_cpu_info,
     .apply_microcode                  = apply_microcode,
-#ifdef CONFIG_HVM
-    .start_update                     = start_update,
-    .end_update_percpu                = svm_host_osvw_init,
-#endif
     .free_patch                       = free_patch,
     .compare_patch                    = compare_patch,
     .match_cpu                        = match_cpu,
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index b1e51b3aff..2d525c8b2c 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -358,7 +358,7 @@ void start_secondary(void *unused)
 
     initialize_cpu_data(cpu);
 
-    microcode_update_one(false);
+    microcode_update_one();
 
     /*
      * If any speculative control MSRs are available, apply Xen's default
diff --git a/xen/include/asm-x86/hvm/svm/svm.h b/xen/include/asm-x86/hvm/svm/svm.h
index 16a994ec74..63eebab48a 100644
--- a/xen/include/asm-x86/hvm/svm/svm.h
+++ b/xen/include/asm-x86/hvm/svm/svm.h
@@ -93,9 +93,6 @@ extern u32 svm_feature_flags;
 #define DEFAULT_TSC_RATIO       0x0000000100000000ULL
 #define TSC_RATIO_RSVD_BITS     0xffffff0000000000ULL
 
-extern void svm_host_osvw_reset(void);
-extern void svm_host_osvw_init(void);
-
 /* EXITINFO1 fields on NPT faults */
 #define _NPT_PFEC_with_gla     32
 #define NPT_PFEC_with_gla      (1UL<<_NPT_PFEC_with_gla)
diff --git a/xen/include/asm-x86/microcode.h b/xen/include/asm-x86/microcode.h
index 7d5a1f8e8a..e1350bdc63 100644
--- a/xen/include/asm-x86/microcode.h
+++ b/xen/include/asm-x86/microcode.h
@@ -24,8 +24,6 @@ struct microcode_ops {
                                                      size_t size);
     int (*collect_cpu_info)(struct cpu_signature *csig);
     int (*apply_microcode)(const struct microcode_patch *patch);
-    int (*start_update)(void);
-    void (*end_update_percpu)(void);
     void (*free_patch)(void *mc);
     bool (*match_cpu)(const struct microcode_patch *patch);
     enum microcode_match_result (*compare_patch)(
diff --git a/xen/include/asm-x86/processor.h b/xen/include/asm-x86/processor.h
index 60ad3b7344..970f2af501 100644
--- a/xen/include/asm-x86/processor.h
+++ b/xen/include/asm-x86/processor.h
@@ -586,7 +586,7 @@ void microcode_set_module(unsigned int);
 int microcode_update(XEN_GUEST_HANDLE_PARAM(const_void), unsigned long len);
 int early_microcode_update_cpu(void);
 int early_microcode_init(void);
-int microcode_update_one(bool start_update);
+int microcode_update_one(void);
 int microcode_init_intel(void);
 int microcode_init_amd(void);
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Thu Jun 25 13:26:29 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Jun 2020 13:26: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 1joRtd-0002zi-4j; Thu, 25 Jun 2020 13:26: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=UBdM=AG=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1joRtb-0002zb-Nz
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:26:27 +0000
X-Inumbo-ID: 77f5a3f0-b6e7-11ea-81b8-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 77f5a3f0-b6e7-11ea-81b8-12813bfff9fa;
 Thu, 25 Jun 2020 13:26: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=CsDS3dJyMEohUVceKHzTB6JNtlT26HuQK+KmOwL7NPo=; b=bqGvjVZbtxqa72VZWksrJe1xXx
 5DpYAb70RrNUum7nk4SHKSEYfA8D08mLv9MWDWu9Rv20FL/vDfd+UQ65xTgILdfZVHqOnvelsigzj
 aBVcL4uiz7JKJTI65oJSADnb/tYaVOqjom+u54Wmrbs0O3kJlonornuwoW5TLt3HrNGk=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRtZ-0007TM-Co
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:26:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRtZ-0003YJ-CA
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:26:25 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] x86/svm: do not try to handle recalc NPT faults
 immediately
Message-Id: <E1joRtZ-0003YJ-CA@xenbits.xenproject.org>
Date: Thu, 25 Jun 2020 13:26: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 11ea967c99b90011f371e64ec063bb6e38bd2b6c
Author:     Igor Druzhinin <igor.druzhinin@citrix.com>
AuthorDate: Wed Jun 24 16:45:59 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:45:59 2020 +0200

    x86/svm: do not try to handle recalc NPT faults immediately
    
    A recalculation NPT fault doesn't always require additional handling
    in hvm_hap_nested_page_fault(), moreover in general case if there is no
    explicit handling done there - the fault is wrongly considered fatal.
    
    This covers a specific case of migration with vGPU assigned which
    uses direct MMIO mappings made by XEN_DOMCTL_memory_mapping hypercall:
    at a moment log-dirty is enabled globally, recalculation is requested
    for the whole guest memory including those mapped MMIO regions
    which causes a page fault being raised at the first access to them;
    but due to MMIO P2M type not having any explicit handling in
    hvm_hap_nested_page_fault() a domain is erroneously crashed with unhandled
    SVM violation.
    
    Instead of trying to be opportunistic - use safer approach and handle
    P2M recalculation in a separate NPT fault by attempting to retry after
    making the necessary adjustments. This is aligned with Intel behavior
    where there are separate VMEXITs for recalculation and EPT violations
    (faults) and only faults are handled in hvm_hap_nested_page_fault().
    Do it by also unifying do_recalc return code with Intel implementation
    where returning 1 means P2M was actually changed.
    
    Since there was no case previously where p2m_pt_handle_deferred_changes()
    could return a positive value - it's safe to replace ">= 0" with just "== 0"
    in VMEXIT_NPF handler. finish_type_change() is also not affected by the
    change as being able to deal with >0 return value of p2m->recalc from
    EPT implementation.
    
    Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 51ca66c37371b10b378513af126646de22eddb17
    master date: 2020-06-05 17:12:11 +0200
---
 xen/arch/x86/hvm/svm/svm.c | 5 +++--
 xen/arch/x86/mm/p2m-pt.c   | 7 ++++++-
 xen/arch/x86/mm/p2m.c      | 2 +-
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 0cec511b3a..8317ef8fb0 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -2947,9 +2947,10 @@ void svm_vmexit_handler(struct cpu_user_regs *regs)
             v->arch.hvm.svm.cached_insn_len = vmcb->guest_ins_len & 0xf;
         rc = vmcb->exitinfo1 & PFEC_page_present
              ? p2m_pt_handle_deferred_changes(vmcb->exitinfo2) : 0;
-        if ( rc >= 0 )
+        if ( rc == 0 )
+            /* If no recal adjustments were being made - handle this fault */
             svm_do_nested_pgfault(v, regs, vmcb->exitinfo1, vmcb->exitinfo2);
-        else
+        else if ( rc < 0 )
         {
             printk(XENLOG_G_ERR
                    "%pv: Error %d handling NPF (gpa=%08lx ec=%04lx)\n",
diff --git a/xen/arch/x86/mm/p2m-pt.c b/xen/arch/x86/mm/p2m-pt.c
index eb66077496..2b74726e39 100644
--- a/xen/arch/x86/mm/p2m-pt.c
+++ b/xen/arch/x86/mm/p2m-pt.c
@@ -341,6 +341,7 @@ static int do_recalc(struct p2m_domain *p2m, unsigned long gfn)
     unsigned int level = 4;
     l1_pgentry_t *pent;
     int err = 0;
+    bool recalc_done = false;
 
     table = map_domain_page(pagetable_get_mfn(p2m_get_pagetable(p2m)));
     while ( --level )
@@ -402,6 +403,8 @@ static int do_recalc(struct p2m_domain *p2m, unsigned long gfn)
                 clear_recalc(l1, e);
                 err = p2m->write_p2m_entry(p2m, gfn, pent, e, level + 1);
                 ASSERT(!err);
+
+                recalc_done = true;
             }
         }
         unmap_domain_page((void *)((unsigned long)pent & PAGE_MASK));
@@ -448,12 +451,14 @@ static int do_recalc(struct p2m_domain *p2m, unsigned long gfn)
             clear_recalc(l1, e);
         err = p2m->write_p2m_entry(p2m, gfn, pent, e, level + 1);
         ASSERT(!err);
+
+        recalc_done = true;
     }
 
  out:
     unmap_domain_page(table);
 
-    return err;
+    return err ?: recalc_done;
 }
 
 int p2m_pt_handle_deferred_changes(uint64_t gpa)
diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index ba126f790a..4039630761 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -1194,7 +1194,7 @@ static int finish_type_change(struct p2m_domain *p2m,
         rc = p2m->recalc(p2m, gfn);
         /*
          * ept->recalc could return 0/1/-ENOMEM. pt->recalc could return
-         * 0/-ENOMEM/-ENOENT, -ENOENT isn't an error as we are looping
+         * 0/1/-ENOMEM/-ENOENT, -ENOENT isn't an error as we are looping
          * gfn here. If rc is 1 we need to have it 0 for success.
          */
         if ( rc == -ENOENT || rc > 0 )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Thu Jun 25 13:26:37 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Jun 2020 13:26: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 1joRtl-00030U-6Q; Thu, 25 Jun 2020 13:26: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=UBdM=AG=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1joRtk-00030N-DJ
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:26:36 +0000
X-Inumbo-ID: 7dfa177c-b6e7-11ea-81b8-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 7dfa177c-b6e7-11ea-81b8-12813bfff9fa;
 Thu, 25 Jun 2020 13:26: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=3gwJeSV/5noN8KRB63p0OOWyLcbG7sM52EdnNUZJPHg=; b=W8ixIqHw0vzO1bvWSuX9UUs30P
 fsTzL3ah0jeRiu3WHuGySgpwiRbHGMGQzjetRPcq3vdreaOEDqNp6q8bAR+TwIMDbm0Ip9G7ddNUM
 TeaiQ/0uOiM6hwYJa54T3V2e9XIj0Bp1K4Y4siGWpXgCC+JrD+6/2P37PkHKBx4e/P1g=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRtj-0007TR-Fx
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:26:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRtj-0003Yp-FC
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:26:35 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] build: fix dependency tracking for preprocessed
 files
Message-Id: <E1joRtj-0003Yp-FC@xenbits.xenproject.org>
Date: Thu, 25 Jun 2020 13:26: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 27d4f1ac67a99a7f4d098d7d7339cb9050aa8218
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jun 24 16:46:49 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:46:49 2020 +0200

    build: fix dependency tracking for preprocessed files
    
    While the issue is more general, I noticed that asm-macros.i not getting
    re-generated as needed. This was due to its .*.d file mentioning
    asm-macros.o instead of asm-macros.i. Use -MQ here as well, and while at
    it also use -MQ to avoid the somewhat fragile sed-ary on the *.lds
    dependency tracking files. While there, further avoid open-coding $(CPP)
    and drop the bogus (Arm) / stale (x86) -Ui386.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    master commit: 75131ad75bb3c91717b5dfda6881e61c52bfd22e
    master date: 2020-06-08 10:25:40 +0200
---
 xen/Rules.mk          | 4 ++--
 xen/arch/arm/Makefile | 4 +---
 xen/arch/x86/Makefile | 8 ++------
 3 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/xen/Rules.mk b/xen/Rules.mk
index 9d0e6acc2e..882725d5cd 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -235,13 +235,13 @@ $(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): %.init.o: %.o Makefile
 	$(OBJCOPY) $(foreach s,$(SPECIAL_DATA_SECTIONS),--rename-section .$(s)=.init.$(s)) $< $@
 
 %.i: %.c Makefile
-	$(CPP) $(filter-out -Wa$(comma)%,$(CFLAGS)) $< -o $@
+	$(CPP) $(filter-out -Wa$(comma)%,$(CFLAGS)) -MQ $@ -o $@ $<
 
 %.s: %.c Makefile
 	$(CC) $(filter-out -Wa$(comma)%,$(CFLAGS)) -S $< -o $@
 
 # -std=gnu{89,99} gets confused by # as an end-of-line comment marker
 %.s: %.S Makefile
-	$(CPP) $(filter-out -Wa$(comma)%,$(AFLAGS)) $< -o $@
+	$(CPP) $(filter-out -Wa$(comma)%,$(AFLAGS)) -MQ $@ -o $@ $<
 
 -include $(DEPS_INCLUDE)
diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index 70f532e42a..8edb200245 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -124,9 +124,7 @@ asm-offsets.s: $(TARGET_SUBARCH)/asm-offsets.c
 	$(CC) $(filter-out -flto,$(CFLAGS)) -S -o $@ $<
 
 xen.lds: xen.lds.S
-	$(CC) -P -E -Ui386 $(AFLAGS) -o $@ $<
-	sed -e 's/xen\.lds\.o:/xen\.lds:/g' <.xen.lds.d >.xen.lds.d.new
-	mv -f .xen.lds.d.new .xen.lds.d
+	$(CPP) -P $(AFLAGS) -MQ $@ -o $@ $<
 
 dtb.o: $(CONFIG_DTB_FILE)
 
diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index a0b2f4ab15..00d7dbe51b 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -241,14 +241,10 @@ $(BASEDIR)/include/asm-x86/asm-macros.h: asm-macros.i Makefile
 	$(call move-if-changed,$@.new,$@)
 
 xen.lds: xen.lds.S
-	$(CC) -P -E -Ui386 $(filter-out -Wa$(comma)%,$(AFLAGS)) -o $@ $<
-	sed -e 's/.*\.lds\.o:/$(@F):/g' <.$(@F).d >.$(@F).d.new
-	mv -f .$(@F).d.new .$(@F).d
+	$(CPP) -P $(filter-out -Wa$(comma)%,$(AFLAGS)) -MQ $@ -o $@ $<
 
 efi.lds: xen.lds.S
-	$(CC) -P -E -Ui386 -DEFI $(filter-out -Wa$(comma)%,$(AFLAGS)) -o $@ $<
-	sed -e 's/.*\.lds\.o:/$(@F):/g' <.$(@F).d >.$(@F).d.new
-	mv -f .$(@F).d.new .$(@F).d
+	$(CPP) -P -DEFI $(filter-out -Wa$(comma)%,$(AFLAGS)) -MQ $@ -o $@ $<
 
 boot/mkelf32: boot/mkelf32.c
 	$(HOSTCC) $(HOSTCFLAGS) -o $@ $<
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Thu Jun 25 13:26:51 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Jun 2020 13:26:51 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1joRtz-00031p-87; Thu, 25 Jun 2020 13:26:51 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=UBdM=AG=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1joRty-00031j-G7
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:26:50 +0000
X-Inumbo-ID: 83e65d1d-b6e7-11ea-81b8-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 83e65d1d-b6e7-11ea-81b8-12813bfff9fa;
 Thu, 25 Jun 2020 13:26: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=XZcnY4lLSMNX9HRTYRmoLNHOPf/bct+pNC6dC45xIBA=; b=uD6+bCTykFwTsvo6jBS9EjfPk3
 IoKP0wWsALs/LlNHhHlNoPZqRKVNBcVIhB/7Kf9Ci3p66uxUV3pcqbl+cSckYg6KnffoklEHHVhQy
 x8n8TQfgysQIlkKGvcqFtZi8zB7Ob+RVXf6UNi7eCQf7NQ7e12bsm+iSoSRD4zX1+qTg=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRtt-0007U5-JF
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:26:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRtt-0003ZS-Ic
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:26:45 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] x86/rtc: provide mediated access to RTC for PVH dom0
Message-Id: <E1joRtt-0003ZS-Ic@xenbits.xenproject.org>
Date: Thu, 25 Jun 2020 13:26: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 31c5d84c515cd4d8f61f19f3a1d644601a1a7624
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Jun 24 16:47:36 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:47:36 2020 +0200

    x86/rtc: provide mediated access to RTC for PVH dom0
    
    Mediated access to the RTC was provided for PVHv1 dom0 using the PV
    code paths (guest_io_{write/read}), but those accesses where never
    implemented for PVHv2 dom0. This patch provides such mediated accesses
    to the RTC for PVH dom0, just like it's provided for a classic PV
    dom0.
    
    Pull out some of the RTC logic from guest_io_{read/write} into
    specific helpers that can be used by both PV and HVM guests. The
    setup of the handlers for PVH is done in rtc_init, which is already
    used to initialize the fully emulated RTC.
    
    Without this a Linux PVH dom0 will read garbage when trying to access
    the RTC, and one vCPU will be constantly looping in
    rtc_timer_do_work.
    
    Note that such issue doesn't happen on domUs because the ACPI
    NO_CMOS_RTC flag is set in FADT, which prevents the OS from accessing
    the RTC. Also the X86_EMU_RTC flag is not set for PVH dom0, as the
    accesses are not emulated but rather forwarded to the physical
    hardware.
    
    No functional change expected for classic PV dom0.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 835d8d69d96aa7feb52ef7b3dd8ecf43f0807578
    master date: 2020-06-08 18:40:05 +0100
---
 xen/arch/x86/hvm/rtc.c            | 26 ++++++++++++++++
 xen/arch/x86/pv/emul-priv-op.c    | 30 +++---------------
 xen/arch/x86/time.c               | 65 +++++++++++++++++++++++++++++++++++++++
 xen/include/asm-x86/mc146818rtc.h |  3 ++
 4 files changed, 98 insertions(+), 26 deletions(-)

diff --git a/xen/arch/x86/hvm/rtc.c b/xen/arch/x86/hvm/rtc.c
index dec39e3857..690d7b0029 100644
--- a/xen/arch/x86/hvm/rtc.c
+++ b/xen/arch/x86/hvm/rtc.c
@@ -799,12 +799,38 @@ void rtc_reset(struct domain *d)
     s->pt.source = PTSRC_isa;
 }
 
+/* RTC mediator for HVM hardware domain. */
+static int hw_rtc_io(int dir, unsigned int port, unsigned int size,
+                     uint32_t *val)
+{
+    if ( dir == IOREQ_READ )
+        *val = ~0;
+
+    if ( size != 1 )
+    {
+        gdprintk(XENLOG_WARNING, "bad RTC access size (%u)\n", size);
+        return X86EMUL_OKAY;
+    }
+
+    if ( dir == IOREQ_WRITE )
+        rtc_guest_write(port, *val);
+    else
+        *val = rtc_guest_read(port);
+
+    return X86EMUL_OKAY;
+}
+
 void rtc_init(struct domain *d)
 {
     RTCState *s = domain_vrtc(d);
 
     if ( !has_vrtc(d) )
+    {
+        if ( is_hardware_domain(d) )
+            /* Hardware domain gets mediated access to the physical RTC. */
+            register_portio_handler(d, RTC_PORT(0), 2, hw_rtc_io);
         return;
+    }
 
     spin_lock_init(&s->lock);
 
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index e24b84f46a..90693fe9ee 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -236,19 +236,9 @@ static uint32_t guest_io_read(unsigned int port, unsigned int bytes,
         {
             sub_data = pv_pit_handler(port, 0, 0);
         }
-        else if ( port == RTC_PORT(0) )
+        else if ( port == RTC_PORT(0) || port == RTC_PORT(1) )
         {
-            sub_data = currd->arch.cmos_idx;
-        }
-        else if ( (port == RTC_PORT(1)) &&
-                  ioports_access_permitted(currd, RTC_PORT(0), RTC_PORT(1)) )
-        {
-            unsigned long flags;
-
-            spin_lock_irqsave(&rtc_lock, flags);
-            outb(currd->arch.cmos_idx & 0x7f, RTC_PORT(0));
-            sub_data = inb(RTC_PORT(1));
-            spin_unlock_irqrestore(&rtc_lock, flags);
+            sub_data = rtc_guest_read(port);
         }
         else if ( (port == 0xcf8) && (bytes == 4) )
         {
@@ -369,21 +359,9 @@ static void guest_io_write(unsigned int port, unsigned int bytes,
         {
             pv_pit_handler(port, (uint8_t)data, 1);
         }
-        else if ( port == RTC_PORT(0) )
-        {
-            currd->arch.cmos_idx = data;
-        }
-        else if ( (port == RTC_PORT(1)) &&
-                  ioports_access_permitted(currd, RTC_PORT(0), RTC_PORT(1)) )
+        else if ( port == RTC_PORT(0) || port == RTC_PORT(1) )
         {
-            unsigned long flags;
-
-            if ( pv_rtc_handler )
-                pv_rtc_handler(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));
-            spin_unlock_irqrestore(&rtc_lock, flags);
+            rtc_guest_write(port, data);
         }
         else if ( (port == 0xcf8) && (bytes == 4) )
         {
diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 3dac3f3ad6..97ae10e46f 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -26,6 +26,7 @@
 #include <xen/keyhandler.h>
 #include <xen/guest_access.h>
 #include <asm/io.h>
+#include <asm/iocap.h>
 #include <asm/msr.h>
 #include <asm/mpspec.h>
 #include <asm/processor.h>
@@ -1008,6 +1009,70 @@ static unsigned long get_cmos_time(void)
     return mktime(rtc.year, rtc.mon, rtc.day, rtc.hour, rtc.min, rtc.sec);
 }
 
+/* Helpers for guest accesses to the physical RTC. */
+unsigned int rtc_guest_read(unsigned int port)
+{
+    const struct domain *currd = current->domain;
+    unsigned long flags;
+    unsigned int data = ~0;
+
+    switch ( port )
+    {
+    case RTC_PORT(0):
+        /*
+         * All PV domains (and PVH dom0) are allowed to read the latched value
+         * of the first RTC port, as there's no access to the physical IO
+         * ports.
+         */
+        data = currd->arch.cmos_idx;
+        break;
+
+    case RTC_PORT(1):
+        if ( !ioports_access_permitted(currd, RTC_PORT(0), RTC_PORT(1)) )
+            break;
+        spin_lock_irqsave(&rtc_lock, flags);
+        outb(currd->arch.cmos_idx & 0x7f, RTC_PORT(0));
+        data = inb(RTC_PORT(1));
+        spin_unlock_irqrestore(&rtc_lock, flags);
+        break;
+
+    default:
+        ASSERT_UNREACHABLE();
+    }
+
+    return data;
+}
+
+void rtc_guest_write(unsigned int port, unsigned int data)
+{
+    struct domain *currd = current->domain;
+    unsigned long flags;
+
+    switch ( port )
+    {
+    case RTC_PORT(0):
+        /*
+         * All PV domains (and PVH dom0) are allowed to write to the latched
+         * value of the first RTC port, as there's no access to the physical IO
+         * ports.
+         */
+        currd->arch.cmos_idx = data;
+        break;
+
+    case RTC_PORT(1):
+        if ( !ioports_access_permitted(currd, RTC_PORT(0), RTC_PORT(1)) )
+            break;
+        spin_lock_irqsave(&rtc_lock, flags);
+        outb(currd->arch.cmos_idx & 0x7f, RTC_PORT(0));
+        outb(data, RTC_PORT(1));
+        spin_unlock_irqrestore(&rtc_lock, flags);
+        break;
+
+    default:
+        ASSERT_UNREACHABLE();
+    }
+}
+
 static unsigned long get_wallclock_time(void)
 {
 #ifdef CONFIG_XEN_GUEST
diff --git a/xen/include/asm-x86/mc146818rtc.h b/xen/include/asm-x86/mc146818rtc.h
index 8758528f7c..803b236c0a 100644
--- a/xen/include/asm-x86/mc146818rtc.h
+++ b/xen/include/asm-x86/mc146818rtc.h
@@ -110,4 +110,7 @@ outb_p((val),RTC_PORT(1)); \
 
 #define RTC_IRQ 8
 
+unsigned int rtc_guest_read(unsigned int port);
+void rtc_guest_write(unsigned int port, unsigned int data);
+
 #endif /* _ASM_MC146818RTC_H */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Thu Jun 25 13:26:57 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Jun 2020 13:26: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 1joRu5-00033M-Aq; Thu, 25 Jun 2020 13:26: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=UBdM=AG=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1joRu4-00033E-A0
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:26:56 +0000
X-Inumbo-ID: 8a0496fa-b6e7-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 8a0496fa-b6e7-11ea-b7bb-bc764e2007e4;
 Thu, 25 Jun 2020 13:26: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=V5dfeaVANmsOV6309tqsnODtz8QtCudXwct9FR+OOEs=; b=NzoNyO+HH0/lWBxyDeJw6x6UGv
 gn/1atypyaN9lqsGQmZSiLcvCXKx1QJ8yuCLdds9BP8muvXrFSzv5GybQl49f7Jcch1HXL3PQ8GSg
 LUIqKFADKdp6jFsGjzeakHGctXoHBxrTmJIgr8LpEczzDyTchhcv6f8wwgaZBHFuhNJc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRu3-0007UL-MU
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:26:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRu3-0003a0-Lq
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:26:55 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] x86/Intel: insert Ice Lake and Comet Lake model
 numbers
Message-Id: <E1joRu3-0003a0-Lq@xenbits.xenproject.org>
Date: Thu, 25 Jun 2020 13:26: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 780d3761f1176132fc154161b3c480ab9d256f53
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jun 24 16:48:12 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:48:12 2020 +0200

    x86/Intel: insert Ice Lake and Comet Lake model numbers
    
    Both match prior generation processors as far as LBR and C-state MSRs
    go (SDM rev 072) as well as applicability of the if_pschange_mc erratum
    (recent spec updates).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 1fe406685cb19e9544681c6243e7d376deb0297e
    master date: 2020-06-09 12:55:53 +0200
---
 xen/arch/x86/acpi/cpu_idle.c | 6 ++++++
 xen/arch/x86/hvm/vmx/vmx.c   | 8 ++++++++
 2 files changed, 14 insertions(+)

diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c
index 95990dc8b7..1dea781442 100644
--- a/xen/arch/x86/acpi/cpu_idle.c
+++ b/xen/arch/x86/acpi/cpu_idle.c
@@ -179,9 +179,15 @@ static void do_get_hw_residencies(void *arg)
     case 0x4E:
     case 0x55:
     case 0x5E:
+    /* Ice Lake */
+    case 0x7D:
+    case 0x7E:
     /* Kaby Lake */
     case 0x8E:
     case 0x9E:
+    /* Comet Lake */
+    case 0xA5:
+    case 0xA6:
         GET_PC2_RES(hw_res->pc2);
         GET_CC7_RES(hw_res->cc7);
         /* fall through */
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 2be74aa8c3..5c47d10384 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2433,8 +2433,12 @@ static bool __init has_if_pschange_mc(void)
     case 0x4e: /* Skylake M */
     case 0x5e: /* Skylake D */
     case 0x55: /* Skylake-X / Cascade Lake */
+    case 0x7d: /* Ice Lake */
+    case 0x7e: /* Ice Lake */
     case 0x8e: /* Kaby / Coffee / Whiskey Lake M */
     case 0x9e: /* Kaby / Coffee / Whiskey Lake D */
+    case 0xa5: /* Comet Lake H/S */
+    case 0xa6: /* Comet Lake U */
         return true;
 
         /*
@@ -2778,8 +2782,12 @@ static const struct lbr_info *last_branch_msr_get(void)
         case 0x66:
         /* Goldmont Plus */
         case 0x7a:
+        /* Ice Lake */
+        case 0x7d: case 0x7e:
         /* Kaby Lake */
         case 0x8e: case 0x9e:
+        /* Comet Lake */
+        case 0xa5: case 0xa6:
             return sk_lbr;
         /* Atom */
         case 0x1c: case 0x26: case 0x27: case 0x35: case 0x36:
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Thu Jun 25 13:27:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Jun 2020 13:27: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 1joRuF-00034g-CL; Thu, 25 Jun 2020 13:27: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=UBdM=AG=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1joRuE-00034X-E2
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:27:06 +0000
X-Inumbo-ID: 9009608a-b6e7-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 9009608a-b6e7-11ea-bca7-bc764e2007e4;
 Thu, 25 Jun 2020 13:27: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=tXoKs/hn8AMugRlueetrK4lBzqyIWVAubo9/zQCrOY0=; b=KOgjzChIj5zVRUc6PFKcYqZWjt
 sE3+rp7jlcrWK+juCI27zTeDuNSYmOsOQ7iVwPL6pzw6SGrT2ljYmbNXy6BqxGaGp9z0mVSe52PAg
 0CVa7qfki/t+GKA10jokJjIIKO4VoCSoPC3PfX73vKSMQBtL78LtLE3ykQgwOIVPCsBA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRuD-0007Ul-PW
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:27:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRuD-0003aj-Or
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:27:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] ioreq: handle pending emulation racing with ioreq
 server destruction
Message-Id: <E1joRuD-0003aj-Or@xenbits.xenproject.org>
Date: Thu, 25 Jun 2020 13:27: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 05ba427181723848d9bd462cccd2929e42e3c219
Author:     Paul Durrant <pdurrant@amazon.com>
AuthorDate: Wed Jun 24 16:49:02 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:49:02 2020 +0200

    ioreq: handle pending emulation racing with ioreq server destruction
    
    When an emulation request is initiated in hvm_send_ioreq() the guest vcpu is
    blocked on an event channel until that request is completed. If, however,
    the emulator is killed whilst that emulation is pending then the ioreq
    server may be destroyed. Thus when the vcpu is awoken the code in
    handle_hvm_io_completion() will find no pending request to wait for, but will
    leave the internal vcpu io_req.state set to IOREQ_READY and the vcpu shutdown
    deferall flag in place (because hvm_io_assist() will never be called). The
    emulation request is then completed anyway. This means that any subsequent call
    to hvmemul_do_io() will find an unexpected value in io_req.state and will
    return X86EMUL_UNHANDLEABLE, which in some cases will result in continuous
    re-tries.
    
    This patch fixes the issue by moving the setting of io_req.state and clearing
    of shutdown deferral (as will as MSI-X write completion) out of hvm_io_assist()
    and directly into handle_hvm_io_completion().
    
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Paul Durrant <pdurrant@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: f7039ee41b3d3448775a1623f230037fd0455104
    master date: 2020-06-09 12:56:24 +0200
---
 xen/arch/x86/hvm/ioreq.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/hvm/ioreq.c b/xen/arch/x86/hvm/ioreq.c
index 0b54536bde..b8e7c2d089 100644
--- a/xen/arch/x86/hvm/ioreq.c
+++ b/xen/arch/x86/hvm/ioreq.c
@@ -107,15 +107,7 @@ static void hvm_io_assist(struct hvm_ioreq_vcpu *sv, uint64_t data)
     ioreq_t *ioreq = &v->arch.hvm.hvm_io.io_req;
 
     if ( hvm_ioreq_needs_completion(ioreq) )
-    {
-        ioreq->state = STATE_IORESP_READY;
         ioreq->data = data;
-    }
-    else
-        ioreq->state = STATE_IOREQ_NONE;
-
-    msix_write_completion(v);
-    vcpu_end_shutdown_deferral(v);
 
     sv->pending = false;
 }
@@ -207,6 +199,12 @@ bool handle_hvm_io_completion(struct vcpu *v)
         }
     }
 
+    vio->io_req.state = hvm_ioreq_needs_completion(&vio->io_req) ?
+        STATE_IORESP_READY : STATE_IOREQ_NONE;
+
+    msix_write_completion(v);
+    vcpu_end_shutdown_deferral(v);
+
     io_completion = vio->io_completion;
     vio->io_completion = HVMIO_no_completion;
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Thu Jun 25 13:27:18 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Jun 2020 13:27: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 1joRuQ-00035t-Dw; Thu, 25 Jun 2020 13:27: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=UBdM=AG=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1joRuO-00035e-Vt
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:27:17 +0000
X-Inumbo-ID: 960ec1aa-b6e7-11ea-81b8-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 960ec1aa-b6e7-11ea-81b8-12813bfff9fa;
 Thu, 25 Jun 2020 13:27: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=DheHzSSq8PLQX8xq6FzU2YxQxcUv5vZGPeLlAN931/g=; b=H2Oc449gyCx6ewS6CRSsUR7tys
 Kd8i8yVhsGuMgZJEa7vzE1OuCz/7xKaoxM9hrseP+7utzkdbaY37cD1p7CKAvOFvz+gLDYT+0jb7j
 TosUFS+KuxDqhUeMWcFTq/jJXrndwLf1sOp5GJAmFfvqO1T7QBUg/NNzGZbvnkc5FdNo=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRuN-0007Ut-Sf
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:27:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRuN-0003bJ-Rq
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:27:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] x86/passthrough: do not assert edge triggered GSIs
 for PVH dom0
Message-Id: <E1joRuN-0003bJ-Rq@xenbits.xenproject.org>
Date: Thu, 25 Jun 2020 13:27: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 a9d46ba3323061029772610fcc8b804f614bf619
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Jun 24 16:49:50 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:49:50 2020 +0200

    x86/passthrough: do not assert edge triggered GSIs for PVH dom0
    
    Edge triggered interrupts do not assert the line, so the handling done
    in Xen should also avoid asserting it. Asserting the line prevents
    further edge triggered interrupts on the same vIO-APIC pin from being
    delivered, since the line is not de-asserted.
    
    One case of such kind of interrupt is the RTC timer, which is edge
    triggered and available to a PVH dom0. Note this should not affect
    domUs, as it only modifies the behavior of IDENTITY_GSI kind of passed
    through interrupts.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    master commit: 6fa25d568f4e597b1940309d97cfd98f4f6eecd6
    master date: 2020-06-11 18:14:29 +0100
---
 xen/arch/x86/hvm/irq.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/hvm/irq.c b/xen/arch/x86/hvm/irq.c
index c684422b24..d2bfb6d05d 100644
--- a/xen/arch/x86/hvm/irq.c
+++ b/xen/arch/x86/hvm/irq.c
@@ -168,9 +168,10 @@ void hvm_pci_intx_deassert(
 
 void hvm_gsi_assert(struct domain *d, unsigned int gsi)
 {
+    int trig = vioapic_get_trigger_mode(d, gsi);
     struct hvm_irq *hvm_irq = hvm_domain_irq(d);
 
-    if ( gsi >= hvm_irq->nr_gsis )
+    if ( gsi >= hvm_irq->nr_gsis || trig < 0 )
     {
         ASSERT_UNREACHABLE();
         return;
@@ -185,9 +186,10 @@ void hvm_gsi_assert(struct domain *d, unsigned int gsi)
      * to know if the GSI is pending or not.
      */
     spin_lock(&d->arch.hvm.irq_lock);
-    if ( !hvm_irq->gsi_assert_count[gsi] )
+    if ( trig == VIOAPIC_EDGE_TRIG || !hvm_irq->gsi_assert_count[gsi] )
     {
-        hvm_irq->gsi_assert_count[gsi] = 1;
+        if ( trig == VIOAPIC_LEVEL_TRIG )
+            hvm_irq->gsi_assert_count[gsi] = 1;
         assert_gsi(d, gsi);
     }
     spin_unlock(&d->arch.hvm.irq_lock);
@@ -195,11 +197,12 @@ void hvm_gsi_assert(struct domain *d, unsigned int gsi)
 
 void hvm_gsi_deassert(struct domain *d, unsigned int gsi)
 {
+    int trig = vioapic_get_trigger_mode(d, gsi);
     struct hvm_irq *hvm_irq = hvm_domain_irq(d);
 
-    if ( gsi >= hvm_irq->nr_gsis )
+    if ( trig <= VIOAPIC_EDGE_TRIG || gsi >= hvm_irq->nr_gsis )
     {
-        ASSERT_UNREACHABLE();
+        ASSERT(trig == VIOAPIC_EDGE_TRIG && gsi < hvm_irq->nr_gsis);
         return;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Thu Jun 25 13:27:31 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Jun 2020 13:27:31 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1joRud-00036y-Fr; Thu, 25 Jun 2020 13:27:31 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=UBdM=AG=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1joRub-00036m-SO
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:27:29 +0000
X-Inumbo-ID: 9c140e5c-b6e7-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 9c140e5c-b6e7-11ea-b7bb-bc764e2007e4;
 Thu, 25 Jun 2020 13:27: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=q7u41JNbaJoAKJcspClm7+m8ANRif+TqW3ngozYG1hA=; b=yzLc8Vk7sClo6wmo/jUzLEhiTs
 oRaRoHseT4EQ+AiO9KaGOVWOeSkbXOcApe9u5fdMG3Q5wGi0otmEKuVuAbgs4oWCOphpFJiW4YCgG
 kHcGH/+BCNrwVuuTzohemg9engtHG4XRSOvredQcEfPTHqjKtxKFtkRrazdpJu++H1bU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRuX-0007V2-W4
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:27:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRuX-0003br-VA
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:27:25 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] x86/passthrough: introduce a flag for GSIs not
 requiring an EOI or unmask
Message-Id: <E1joRuX-0003br-VA@xenbits.xenproject.org>
Date: Thu, 25 Jun 2020 13:27: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 cdd8f958d6c142d9ac5d63ca737f0397eaf6ba7a
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Jun 24 16:50:25 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:50:25 2020 +0200

    x86/passthrough: introduce a flag for GSIs not requiring an EOI or unmask
    
    There's no need to setup a timer for GSIs that are edge triggered,
    since those don't require any EIO or unmask, and hence couldn't block
    other interrupts.
    
    Note this is only used by PVH dom0, that can setup the passthrough of
    edge triggered interrupts from the vIO-APIC. One example of such kind
    of interrupt that can be used by a PVH dom0 would be the RTC timer.
    
    While there introduce an out label to do the unlock and reduce code
    duplication.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 2995d0afdf2d3fb44d07eada088db3613741db1e
    master date: 2020-06-11 18:14:29 +0100
---
 xen/drivers/passthrough/io.c  | 24 +++++++++++++++---------
 xen/include/asm-x86/hvm/irq.h |  2 ++
 2 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/xen/drivers/passthrough/io.c b/xen/drivers/passthrough/io.c
index b292e79382..6b1305a3e5 100644
--- a/xen/drivers/passthrough/io.c
+++ b/xen/drivers/passthrough/io.c
@@ -138,7 +138,8 @@ static void pt_pirq_softirq_reset(struct hvm_pirq_dpci *pirq_dpci)
 
 bool pt_irq_need_timer(uint32_t flags)
 {
-    return !(flags & (HVM_IRQ_DPCI_GUEST_MSI | HVM_IRQ_DPCI_TRANSLATE));
+    return !(flags & (HVM_IRQ_DPCI_GUEST_MSI | HVM_IRQ_DPCI_TRANSLATE |
+                      HVM_IRQ_DPCI_NO_EOI));
 }
 
 static int pt_irq_guest_eoi(struct domain *d, struct hvm_pirq_dpci *pirq_dpci,
@@ -558,6 +559,12 @@ int pt_irq_create_bind(
                      */
                     ASSERT(!mask);
                     share = trigger_mode;
+                    if ( trigger_mode == VIOAPIC_EDGE_TRIG )
+                        /*
+                         * Edge IO-APIC interrupt, no EOI or unmask to perform
+                         * and hence no timer needed.
+                         */
+                        pirq_dpci->flags |= HVM_IRQ_DPCI_NO_EOI;
                 }
             }
 
@@ -897,17 +904,13 @@ static void hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci)
             send_guest_pirq(d, pirq);
 
             if ( pirq_dpci->flags & HVM_IRQ_DPCI_GUEST_MSI )
-            {
-                spin_unlock(&d->event_lock);
-                return;
-            }
+                goto out;
         }
 
         if ( pirq_dpci->flags & HVM_IRQ_DPCI_GUEST_MSI )
         {
             vmsi_deliver_pirq(d, pirq_dpci);
-            spin_unlock(&d->event_lock);
-            return;
+            goto out;
         }
 
         list_for_each_entry ( digl, &pirq_dpci->digl_list, list )
@@ -920,6 +923,8 @@ static void hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci)
         if ( pirq_dpci->flags & HVM_IRQ_DPCI_IDENTITY_GSI )
         {
             hvm_gsi_assert(d, pirq->pirq);
+            if ( pirq_dpci->flags & HVM_IRQ_DPCI_NO_EOI )
+                goto out;
             pirq_dpci->pending++;
         }
 
@@ -927,8 +932,7 @@ static void hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci)
         {
             /* for translated MSI to INTx interrupt, eoi as early as possible */
             __msi_pirq_eoi(pirq_dpci);
-            spin_unlock(&d->event_lock);
-            return;
+            goto out;
         }
 
         /*
@@ -941,6 +945,8 @@ static void hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci)
         ASSERT(pt_irq_need_timer(pirq_dpci->flags));
         set_timer(&pirq_dpci->timer, NOW() + PT_IRQ_TIME_OUT);
     }
+
+ out:
     spin_unlock(&d->event_lock);
 }
 
diff --git a/xen/include/asm-x86/hvm/irq.h b/xen/include/asm-x86/hvm/irq.h
index d306cfeade..532880d497 100644
--- a/xen/include/asm-x86/hvm/irq.h
+++ b/xen/include/asm-x86/hvm/irq.h
@@ -121,6 +121,7 @@ struct dev_intx_gsi_link {
 #define _HVM_IRQ_DPCI_GUEST_PCI_SHIFT           4
 #define _HVM_IRQ_DPCI_GUEST_MSI_SHIFT           5
 #define _HVM_IRQ_DPCI_IDENTITY_GSI_SHIFT        6
+#define _HVM_IRQ_DPCI_NO_EOI_SHIFT              7
 #define _HVM_IRQ_DPCI_TRANSLATE_SHIFT          15
 #define HVM_IRQ_DPCI_MACH_PCI        (1u << _HVM_IRQ_DPCI_MACH_PCI_SHIFT)
 #define HVM_IRQ_DPCI_MACH_MSI        (1u << _HVM_IRQ_DPCI_MACH_MSI_SHIFT)
@@ -129,6 +130,7 @@ struct dev_intx_gsi_link {
 #define HVM_IRQ_DPCI_GUEST_PCI       (1u << _HVM_IRQ_DPCI_GUEST_PCI_SHIFT)
 #define HVM_IRQ_DPCI_GUEST_MSI       (1u << _HVM_IRQ_DPCI_GUEST_MSI_SHIFT)
 #define HVM_IRQ_DPCI_IDENTITY_GSI    (1u << _HVM_IRQ_DPCI_IDENTITY_GSI_SHIFT)
+#define HVM_IRQ_DPCI_NO_EOI          (1u << _HVM_IRQ_DPCI_NO_EOI_SHIFT)
 #define HVM_IRQ_DPCI_TRANSLATE       (1u << _HVM_IRQ_DPCI_TRANSLATE_SHIFT)
 
 struct hvm_gmsi_info {
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Thu Jun 25 13:27:38 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Jun 2020 13:27: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 1joRuk-00037j-Ho; Thu, 25 Jun 2020 13:27: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=UBdM=AG=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1joRuj-00037c-Em
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:27:37 +0000
X-Inumbo-ID: a185835d-b6e7-11ea-81b8-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id a185835d-b6e7-11ea-81b8-12813bfff9fa;
 Thu, 25 Jun 2020 13:27: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=2dWJSzA2K4WId1o7PEMLfzrMUxvgUwsYpuz0GZcGAqU=; b=EH8G9VdXGe9D97qCqLHEIkX0pn
 bxT8AeP4DhVJKs9Ob84wknao1lh0tjBD4MbxXORk/O5C0a7r5d/CgOAYP+awuzXyN5hx+1dXwrF+S
 +42W90D0DbdGTVWbTXw6bwA9K9k+AtjBaHRl5+WAp4SOVrqgH2NLKQ/LXIhcFe/MzsHM=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRui-0007VC-2q
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:27:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joRui-0003cK-21
 for xen-changelog@lists.xenproject.org; Thu, 25 Jun 2020 13:27:36 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] libacpi: widen TPM detection
Message-Id: <E1joRui-0003cK-21@xenbits.xenproject.org>
Date: Thu, 25 Jun 2020 13:27: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 9f7e8bac4ca279b3bfccb5f3730fb2e5398c95ab
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Wed Jun 24 16:51:16 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:51:16 2020 +0200

    libacpi: widen TPM detection
    
    The hardcoded tpm_signature is too restrictive to detect many TPMs.  For
    instance, it doesn't accept a QEMU emulated TPM (VID 0x1014 DID 0x0001).
    Make the TPM detection match that in rombios which accepts a wider
    range.
    
    With this change, the TPM's TCPA ACPI table is generated and the guest
    OS can automatically load the tpm_tis driver.  It also allows seabios to
    detect and use the TPM.  However, seabios skips some TPM initialization
    when running under Xen, so it will not populate any PCRs unless modified
    to run the initialization under Xen.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: d3db7e043cddd7e939195e014241ce2c5d436179
    master date: 2020-06-16 10:31:08 +0200
---
 tools/libacpi/build.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/tools/libacpi/build.c b/tools/libacpi/build.c
index fa7d14e090..a61dd5583a 100644
--- a/tools/libacpi/build.c
+++ b/tools/libacpi/build.c
@@ -351,7 +351,6 @@ static int construct_secondary_tables(struct acpi_ctxt *ctxt,
     struct acpi_20_waet *waet;
     struct acpi_20_tcpa *tcpa;
     unsigned char *ssdt;
-    static const uint16_t tis_signature[] = {0x0001, 0x0001, 0x0001};
     void *lasa;
 
     /* MADT. */
@@ -413,9 +412,8 @@ static int construct_secondary_tables(struct acpi_ctxt *ctxt,
 
     /* TPM TCPA and SSDT. */
     if ( (config->table_flags & ACPI_HAS_TCPA) &&
-         (config->tis_hdr[0] == tis_signature[0]) &&
-         (config->tis_hdr[1] == tis_signature[1]) &&
-         (config->tis_hdr[2] == tis_signature[2]) )
+         (config->tis_hdr[0] != 0 && config->tis_hdr[0] != 0xffff) &&
+         (config->tis_hdr[1] != 0 && config->tis_hdr[1] != 0xffff) )
     {
         ssdt = ctxt->mem_ops.alloc(ctxt, sizeof(ssdt_tpm), 16);
         if (!ssdt) return -1;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Fri Jun 26 10:11:11 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Jun 2020 10: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 1jolK8-0001kf-46; Fri, 26 Jun 2020 10:11: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=LwDn=AH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jolK6-0001kZ-SY
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 2020 10:11:06 +0000
X-Inumbo-ID: 581abaa8-b795-11ea-8291-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 581abaa8-b795-11ea-8291-12813bfff9fa;
 Fri, 26 Jun 2020 10: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=IHKwlQTLOm2/h6TP/5WydYkaipxPdl3WcWdcSePlMtA=; b=WLVkvjjyhvQW8Uv8LRKqNOIgc0
 H9tjFOouSVpg/987v/DpErnQVom8U464hoU5qGx/iH7qxGb7UwaoqBNHbtw+3jFucEHVcVMyDmjZV
 ByeLG8qqu7CKFdipGbaFtLOIoMpYlhzJxQroGIhxcfO6vXdp/aH0t3w1kF+ld1udvj7M=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jolK4-0000lk-CD
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 2020 10:11:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jolK4-00070Z-BA
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 2020 10:11:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] scripts: don't rely on "stat -" support
Message-Id: <E1jolK4-00070Z-BA@xenbits.xenproject.org>
Date: Fri, 26 Jun 2020 10: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 d3688bf60f798074bf38d712a3e15c88cfb81ed4
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Jun 25 17:16:02 2020 +0200
Commit:     Wei Liu <wl@xen.org>
CommitDate: Fri Jun 26 10:08:05 2020 +0000

    scripts: don't rely on "stat -" support
    
    While commit b72682c602b8 ("scripts: Use stat to check lock claim")
    validly indicates that stat has gained support for the special "-"
    command line option in 2009, we should still try to avoid breaking being
    able to run on even older distros. As it has been determined, contary to
    the comment in the script using /dev/stdin (/proc/self/fd/$_lockfd) is
    fine here, as Linux specially treats these /proc inodes.
    
    Suggested-by: Ian Jackson <ian.jackson@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Tested-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Jason Andryuk <jandryuk@gmail.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/hotplug/Linux/locking.sh | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/tools/hotplug/Linux/locking.sh b/tools/hotplug/Linux/locking.sh
index 69aefae6f6..2e6fb35f02 100644
--- a/tools/hotplug/Linux/locking.sh
+++ b/tools/hotplug/Linux/locking.sh
@@ -45,18 +45,14 @@ claim_lock()
     while true; do
         eval "exec $_lockfd<>$_lockfile"
         flock -x $_lockfd || return $?
-        # We can't just stat /dev/stdin or /proc/self/fd/$_lockfd or
-        # use bash's test -ef because those all go through what is
-        # actually a synthetic symlink in /proc and we aren't
-        # guaranteed that our stat(2) won't lose the race with an
-        # rm(1) between reading the synthetic link and traversing the
-        # file system to find the inum.  stat(1) translates '-' into an
-        # fstat(2) of FD 0.  So we just need to arrange the FDs properly
-        # to get the fstat(2) we need.  stat will output two lines like:
+        # Although /dev/stdin (i.e. /proc/self/fd/0) looks like a symlink,
+        # stat(2) bypasses the synthetic symlink and directly accesses the
+        # underlying open-file.  So this works correctly even if the file
+        # has been renamed or unlinked.  stat will output two lines like:
         # WW.XXX
         # YY.ZZZ
         # which need to be separated and compared.
-        if stat=$( stat -L -c '%D.%i' - $_lockfile 0<&$_lockfd 2>/dev/null )
+        if stat=$( stat -L -c '%D.%i' /dev/stdin $_lockfile 0<&$_lockfd 2>/dev/null )
         then
             local file_stat
             local fd_stat
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jun 26 12:11:11 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Jun 2020 12: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 1jonCF-0004h7-I0; Fri, 26 Jun 2020 12: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=LwDn=AH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jonCE-0004h2-8y
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 2020 12:11:06 +0000
X-Inumbo-ID: 1c1fe77e-b7a6-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 1c1fe77e-b7a6-11ea-bca7-bc764e2007e4;
 Fri, 26 Jun 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=MCYpGwzxZTKGqrFSmkoQcqPeLrbR3Tsm8pWQbJWdaFU=; b=n6DCAtSQWF7DyR23A5M/DhSid/
 QqimUoRxLwEk1kriFjBLxh5GdhMlWChb+PLvqzQClTCl/0c6eTX9NZ9libZbBycSDgKhSWA2Ml3yn
 1Hq9gsIIDK/QNqkkJ+qR4rwtwPQ06r8XfKEVp39AKWSL6QrVN0/kv2KHjYxwJ9m3clj0=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jonCD-00034R-4z
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 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 1jonCD-0005Vn-3l
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 2020 12:11:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] tools: fix error path of xendevicemodel_open()
Message-Id: <E1jonCD-0005Vn-3l@xenbits.xenproject.org>
Date: Fri, 26 Jun 2020 12:11: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 f91d103e74d4c2efa60fb42b6e9d530a92838f8e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 10 12:40:04 2020 +0100
Commit:     Wei Liu <wl@xen.org>
CommitDate: Fri Jun 26 10:29:26 2020 +0000

    tools: fix error path of xendevicemodel_open()
    
    c/s 6902cb00e03 "tools/libxendevicemodel: extract functions and add a compat
    layer" introduced calls to both xencall_open() and osdep_xendevicemodel_open()
    but failed to fix up the error path.
    
    c/s f68c7c618a3 "libs/devicemodel: free xencall handle in error path in
    _open()" fixed up the xencall_open() aspect of the error path (missing the
    osdep_xendevicemodel_open() aspect), but positioned the xencall_close()
    incorrectly, creating the same pattern proved to be problematic by c/s
    30a72f02870 "tools: fix error path of xenhypfs_open()".
    
    Reposition xtl_logger_destroy(), and introduce the missing
    osdep_xendevicemodel_close().
    
    Fixes: 6902cb00e03 ("tools/libxendevicemodel: extract functions and add a compat layer")
    Fixes: f68c7c618a3 ("libs/devicemodel: free xencall handle in error path in _open()")
    Backport: 4.9+
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
    Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 tools/libs/devicemodel/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/libs/devicemodel/core.c b/tools/libs/devicemodel/core.c
index db501d9e80..4d4063956d 100644
--- a/tools/libs/devicemodel/core.c
+++ b/tools/libs/devicemodel/core.c
@@ -67,9 +67,10 @@ xendevicemodel_handle *xendevicemodel_open(xentoollog_logger *logger,
     return dmod;
 
 err:
-    xtl_logger_destroy(dmod->logger_tofree);
+    osdep_xendevicemodel_close(dmod);
     xentoolcore__deregister_active_handle(&dmod->tc_ah);
     xencall_close(dmod->xcall);
+    xtl_logger_destroy(dmod->logger_tofree);
     free(dmod);
     return NULL;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jun 26 12:11:17 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Jun 2020 12: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 1jonCP-0004hf-Jx; Fri, 26 Jun 2020 12:11:17 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=LwDn=AH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jonCO-0004hY-VL
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 2020 12:11:16 +0000
X-Inumbo-ID: 22219d70-b7a6-11ea-82a9-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 22219d70-b7a6-11ea-82a9-12813bfff9fa;
 Fri, 26 Jun 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=xmY9hOMl/ttSScldZiRrC1H2oxwNdqQYcyH1JJMecy4=; b=g/mM9TLJWLjesrjRD5d/OPkdKz
 NHiID/GeaLkrqm9S5rY+j8XIpFEkIFSX5Ojfw7V1MqaAe/eiT1julVhv2ot0tiU9xGGoQZLd828+k
 Zq3qdqGVlQB3CjnxmDzCQZqTs4aMMUs5G57PInJnFuX9SOHunCTOEhojv72FeDsD9Ffw=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jonCN-00034y-8D
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 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 1jonCN-0005WU-7I
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 2020 12:11:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] kdd: stop using [0] arrays to access packet contents
Message-Id: <E1jonCN-0005WU-7I@xenbits.xenproject.org>
Date: Fri, 26 Jun 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 3471cafbdda35eacf04670881dd2aee2558b4f08
Author:     Tim Deegan <tim@xen.org>
AuthorDate: Fri Jun 26 10:40:44 2020 +0000
Commit:     Wei Liu <wl@xen.org>
CommitDate: Fri Jun 26 10:41:33 2020 +0000

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

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


From xen-changelog-bounces@lists.xenproject.org Fri Jun 26 12:11:27 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Jun 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 1jonCZ-0004iq-Le; Fri, 26 Jun 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=LwDn=AH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jonCY-0004ie-80
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 2020 12:11:26 +0000
X-Inumbo-ID: 2828e598-b7a6-11ea-82a9-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 2828e598-b7a6-11ea-82a9-12813bfff9fa;
 Fri, 26 Jun 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=pXgt9fSkwE9XF3aPiH4pPm1qwPfpAdiofbDQH65tiXE=; b=PMmiy68dusVZiW/vgfW2pWKMJZ
 GfI9kPLrt1M9OQIVA6amSUir6UoW+L6pX7JoNwvAqE1REUwlNqsdo/a0sFOveChjFCDYijSy5NzQE
 FUVsUtNV1HK7Ggk+S3/EB249ZgOtbCXOGmDbVwejrwuaX/uf4cBXuUS2WR39JLAQSxPE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jonCX-000358-C1
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 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 1jonCX-0005X9-AO
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 2020 12:11:25 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] libxl: tooling expects wrong errno
Message-Id: <E1jonCX-0005X9-AO@xenbits.xenproject.org>
Date: Fri, 26 Jun 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 ed69c2ecaf3a6745b7c5a10cf2482e3c49cb8c4f
Author:     Grzegorz Uriasz <gorbak25@gmail.com>
AuthorDate: Sun Jun 14 16:17:08 2020 +0000
Commit:     Wei Liu <wl@xen.org>
CommitDate: Fri Jun 26 11:56:31 2020 +0000

    libxl: tooling expects wrong errno
    
    When iommu is not enabled for a given domain then pci passthrough
    hypercalls such as xc_test_assign_device return EOPNOTSUPP.
    The code responsible for this is in "iommu_do_domctl" inside
    xen/drivers/passthrough/iommu.c
    This patch fixes the error message reported by libxl when assigning
    pci devices to domains without iommu.
    
    Signed-off-by: Grzegorz Uriasz <gorbak25@gmail.com>
    Tested-by: Grzegorz Uriasz <gorbak25@gmail.com>
    Backport: 4.13
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/libxl/libxl_pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c
index 957ff5c8e9..bc5843b137 100644
--- a/tools/libxl/libxl_pci.c
+++ b/tools/libxl/libxl_pci.c
@@ -1561,7 +1561,7 @@ void libxl__device_pci_add(libxl__egc *egc, uint32_t domid,
             LOGD(ERROR, domid,
                  "PCI device %04x:%02x:%02x.%u %s?",
                  pcidev->domain, pcidev->bus, pcidev->dev, pcidev->func,
-                 errno == ENOSYS ? "cannot be assigned - no IOMMU"
+                 errno == EOPNOTSUPP ? "cannot be assigned - no IOMMU"
                  : "already assigned to a different guest");
             goto out;
         }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jun 26 12:11:37 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Jun 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 1jonCj-0004kU-NM; Fri, 26 Jun 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=LwDn=AH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jonCi-0004kK-Al
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 2020 12:11:36 +0000
X-Inumbo-ID: 2e31c6d0-b7a6-11ea-82a9-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 2e31c6d0-b7a6-11ea-82a9-12813bfff9fa;
 Fri, 26 Jun 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=12vaYQwBk87FAZkKtDXULkC0JlbjsQtHFLRPA7fnxFc=; b=aXvAOlnfTAzvgN7T4tINErZSaQ
 RC+OWJtqWHLYUaczfgGrrVMeYmluCQUOcCf5quZgkA9T2rnMEthBnjU/vf3GUVYpWJGgVlTI+KBRR
 GLgPMhAztOUcpYL4yKxpYMaTq//T2BsQ06INp40WmntQ7SD2NkekVJ8yv+qD4pqQ2vUQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jonCh-00035G-FR
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 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 1jonCh-0005Xu-EL
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 2020 12:11:35 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] vchan-socket-proxy: Ensure UNIX path NUL terminated
Message-Id: <E1jonCh-0005Xu-EL@xenbits.xenproject.org>
Date: Fri, 26 Jun 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 2c8ac47d4e780389842f812bb6b2f95fa673add5
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Wed Jun 10 23:29:27 2020 -0400
Commit:     Wei Liu <wl@xen.org>
CommitDate: Fri Jun 26 11:58:30 2020 +0000

    vchan-socket-proxy: Ensure UNIX path NUL terminated
    
    Check the socket path length to ensure sun_path is NUL terminated.
    
    This was spotted by Citrix's Coverity.
    
    Also use strcpy to avoid a warning "'__builtin_strncpy' specified bound
    108 equals destination size [-Werror=stringop-truncation]" flagged by
    gcc 10.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: Wei Liu <wl@xen.org>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/libvchan/vchan-socket-proxy.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/tools/libvchan/vchan-socket-proxy.c b/tools/libvchan/vchan-socket-proxy.c
index 13700c5d67..6ae1d84143 100644
--- a/tools/libvchan/vchan-socket-proxy.c
+++ b/tools/libvchan/vchan-socket-proxy.c
@@ -148,12 +148,18 @@ static int connect_socket(const char *path_or_fd) {
         return fd;
     }
 
+    if (strlen(path_or_fd) >= sizeof(addr.sun_path)) {
+        fprintf(stderr, "UNIX socket path \"%s\" too long (%zd >= %zd)\n",
+                path_or_fd, strlen(path_or_fd), sizeof(addr.sun_path));
+        return -1;
+    }
+
     fd = socket(AF_UNIX, SOCK_STREAM, 0);
     if (fd == -1)
         return -1;
 
     addr.sun_family = AF_UNIX;
-    strncpy(addr.sun_path, path_or_fd, sizeof(addr.sun_path));
+    strcpy(addr.sun_path, path_or_fd);
     if (connect(fd, (const struct sockaddr *)&addr, sizeof(addr)) == -1) {
         close(fd);
         return -1;
@@ -174,13 +180,19 @@ static int listen_socket(const char *path_or_fd) {
         return fd;
     }
 
+    if (strlen(path_or_fd) >= sizeof(addr.sun_path)) {
+        fprintf(stderr, "UNIX socket path \"%s\" too long (%zd >= %zd)\n",
+                path_or_fd, strlen(path_or_fd), sizeof(addr.sun_path));
+        return -1;
+    }
+
     /* if not a number, assume a socket path */
     fd = socket(AF_UNIX, SOCK_STREAM, 0);
     if (fd == -1)
         return -1;
 
     addr.sun_family = AF_UNIX;
-    strncpy(addr.sun_path, path_or_fd, sizeof(addr.sun_path));
+    strcpy(addr.sun_path, path_or_fd);
     if (bind(fd, (const struct sockaddr *)&addr, sizeof(addr)) == -1) {
         close(fd);
         return -1;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jun 26 12:11:47 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Jun 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 1jonCt-0004lI-P8; Fri, 26 Jun 2020 12:11: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=LwDn=AH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jonCs-0004l8-Ao
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 2020 12:11:46 +0000
X-Inumbo-ID: 34342cf8-b7a6-11ea-82a9-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 34342cf8-b7a6-11ea-82a9-12813bfff9fa;
 Fri, 26 Jun 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=ONMrwizL0h0vE7rUrEpQ95I6pDEFuMy0U6Lppr7pwlk=; b=wg/Dfel6Hr/j8fuDs01kRNdF1I
 /ZYbUtb4z2LUp79Gk1XgjiTBNw5Z8Pn21YmsgIBWw4c02F8zTHJJQ7FDy5iRmKcSgX7vLVmfZf2MH
 w3cpEU9+Y0nYrJZfOiQnb1n7OU9yk6dQQAxPjvzaZq7xO/3Kbvcu0UmCzSe53Sn45fo4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jonCr-00035Q-IT
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 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 1jonCr-0005Yv-Ha
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 2020 12:11:45 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] vchan-socket-proxy: Move perror() into listen_socket
Message-Id: <E1jonCr-0005Yv-Ha@xenbits.xenproject.org>
Date: Fri, 26 Jun 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 01b9a28e7d1dc54968d5081bdc089449052df939
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Wed Jun 10 23:29:28 2020 -0400
Commit:     Wei Liu <wl@xen.org>
CommitDate: Fri Jun 26 11:59:38 2020 +0000

    vchan-socket-proxy: Move perror() into listen_socket
    
    The use of perror on the return from listen_socket can produce
    misleading results like:
    UNIX socket path "/tmp/aa....aa" too long (156 >= 108)
    listen socket: Success
    
    errno is reset by subsequent system & library calls, so it may be
    inaccurate by the time listen_socket returns.  Call perror immediately
    after failing system calls to print the proper message.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: Wei Liu <wl@xen.org>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/libvchan/vchan-socket-proxy.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tools/libvchan/vchan-socket-proxy.c b/tools/libvchan/vchan-socket-proxy.c
index 6ae1d84143..4edc3a44f5 100644
--- a/tools/libvchan/vchan-socket-proxy.c
+++ b/tools/libvchan/vchan-socket-proxy.c
@@ -188,16 +188,20 @@ static int listen_socket(const char *path_or_fd) {
 
     /* if not a number, assume a socket path */
     fd = socket(AF_UNIX, SOCK_STREAM, 0);
-    if (fd == -1)
+    if (fd == -1) {
+        perror("socket");
         return -1;
+    }
 
     addr.sun_family = AF_UNIX;
     strcpy(addr.sun_path, path_or_fd);
     if (bind(fd, (const struct sockaddr *)&addr, sizeof(addr)) == -1) {
+        perror("bind");
         close(fd);
         return -1;
     }
     if (listen(fd, 5) != 0) {
+        perror("listen");
         close(fd);
         return -1;
     }
@@ -419,7 +423,7 @@ int main(int argc, char **argv)
         } else {
             socket_fd = listen_socket(socket_path);
             if (socket_fd == -1) {
-                perror("listen socket");
+                fprintf(stderr, "listen socket failed\n");
                 return 1;
             }
         }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jun 26 12:11:57 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Jun 2020 12:11:57 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jonD3-0004mY-Qp; Fri, 26 Jun 2020 12:11: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=LwDn=AH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jonD2-0004mC-84
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 2020 12:11:56 +0000
X-Inumbo-ID: 3a367930-b7a6-11ea-82a9-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 3a367930-b7a6-11ea-82a9-12813bfff9fa;
 Fri, 26 Jun 2020 12: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=pdXWqCbMXUcozpqxGr9ynAOm9RpHzF+BGA8GWyCqVgg=; b=ez+ClGhXNBHsESck1rGQHFiTEK
 UpCmFchFzGSoApcM9sWD0dnLwNA/PxfOf62ZUwgDa4utLvAoF+Yv8Ze1nhOwhDWJMrhFEW3jMdhiy
 t0qxOD8oRf53ykb5zBP7Art47zUeXS92yz3WAtcrSzEQHAhikzBuGcplUIziv6G+0QGM=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jonD1-00035e-LI
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 2020 12:11:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jonD1-0005Zg-Ka
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 2020 12:11:55 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] vchan-socket-proxy: Move perror() into connect_socket
Message-Id: <E1jonD1-0005Zg-Ka@xenbits.xenproject.org>
Date: Fri, 26 Jun 2020 12:11: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 fbdf181fe36516d74b77217207565e87511bf805
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Wed Jun 10 23:29:29 2020 -0400
Commit:     Wei Liu <wl@xen.org>
CommitDate: Fri Jun 26 11:59:41 2020 +0000

    vchan-socket-proxy: Move perror() into connect_socket
    
    errno is reset by subsequent system & library calls, so it may be
    inaccurate by the time connect_socket returns.  Call perror immediately
    after failing system calls to print the proper message.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: Wei Liu <wl@xen.org>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/libvchan/vchan-socket-proxy.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/libvchan/vchan-socket-proxy.c b/tools/libvchan/vchan-socket-proxy.c
index 4edc3a44f5..c6a83e4712 100644
--- a/tools/libvchan/vchan-socket-proxy.c
+++ b/tools/libvchan/vchan-socket-proxy.c
@@ -155,12 +155,15 @@ static int connect_socket(const char *path_or_fd) {
     }
 
     fd = socket(AF_UNIX, SOCK_STREAM, 0);
-    if (fd == -1)
+    if (fd == -1) {
+        perror("socket");
         return -1;
+    }
 
     addr.sun_family = AF_UNIX;
     strcpy(addr.sun_path, path_or_fd);
     if (connect(fd, (const struct sockaddr *)&addr, sizeof(addr)) == -1) {
+        perror("connect");
         close(fd);
         return -1;
     }
@@ -457,7 +460,7 @@ int main(int argc, char **argv)
                 input_fd = output_fd = connect_socket(socket_path);
             }
             if (input_fd == -1) {
-                perror("connect socket");
+                fprintf(stderr, "connect_socket failed\n");
                 return 1;
             }
             if (data_loop(ctrl, input_fd, output_fd) != 0)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jun 26 12:12:07 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Jun 2020 12:12:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jonDD-0004ng-SP; Fri, 26 Jun 2020 12:12:07 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=LwDn=AH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jonDC-0004nV-Be
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 2020 12:12:06 +0000
X-Inumbo-ID: 403973e6-b7a6-11ea-82a9-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 403973e6-b7a6-11ea-82a9-12813bfff9fa;
 Fri, 26 Jun 2020 12: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=sQT285jZpn2Fv7CryiRlZaXYVoCeTyhzfS3UX0GSZX0=; b=iGymIc+oj2bjTQJus3kEfsxjWt
 9vmDyuoG8MkKxOu3CF5iPz2jBe0I19ohWFTYD0Lq+tVOvCFWtphJMVvSxNPrTNCeoXlRIzWoBCQKC
 vswAUXtzfL6HispLa8MzAGIKsYzAqoReEWLppeI9gG/Brh/D9mlphyL4c/P/QDqGNwnY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jonDB-000364-OY
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 2020 12:12:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jonDB-0005aN-Nb
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 2020 12:12:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] vchan-socket-proxy: Check xs_watch return value
Message-Id: <E1jonDB-0005aN-Nb@xenbits.xenproject.org>
Date: Fri, 26 Jun 2020 12: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 20b65c15a38d98f31f212925a3e5a733dce5b477
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Wed Jun 10 23:29:30 2020 -0400
Commit:     Wei Liu <wl@xen.org>
CommitDate: Fri Jun 26 11:59:46 2020 +0000

    vchan-socket-proxy: Check xs_watch return value
    
    Check the return value of xs_watch and error out on failure.
    
    This was found by Citrix's Coverity.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: Wei Liu <wl@xen.org>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/libvchan/vchan-socket-proxy.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/tools/libvchan/vchan-socket-proxy.c b/tools/libvchan/vchan-socket-proxy.c
index c6a83e4712..196f6016b9 100644
--- a/tools/libvchan/vchan-socket-proxy.c
+++ b/tools/libvchan/vchan-socket-proxy.c
@@ -232,8 +232,15 @@ static struct libxenvchan *connect_vchan(int domid, const char *path) {
         goto out;
     }
     /* wait for vchan server to create *path* */
-    xs_watch(xs, path, "path");
-    xs_watch(xs, "@releaseDomain", "release");
+    if (!xs_watch(xs, path, "path")) {
+        fprintf(stderr, "xs_watch(%s) failed.\n", path);
+        goto out;
+    }
+    if (!xs_watch(xs, "@releaseDomain", "release")) {
+        fprintf(stderr, "xs_watch(@releaseDomain failed.\n");
+        goto out;
+    }
+
     while ((watch_ret = xs_read_watch(xs, &watch_num))) {
         /* don't care about exact which fired the watch */
         free(watch_ret);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jun 26 12:12:18 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Jun 2020 12:12: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 1jonDN-0004p6-Vx; Fri, 26 Jun 2020 12:12: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=LwDn=AH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jonDM-0004ot-Fj
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 2020 12:12:16 +0000
X-Inumbo-ID: 463ce8ea-b7a6-11ea-82a9-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 463ce8ea-b7a6-11ea-82a9-12813bfff9fa;
 Fri, 26 Jun 2020 12:12: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=uH7MPW55AZZIj/qZUpRI/0rYlB2RvLZrV5d80mNxqRU=; b=EQ6QELfnkUK3JrF2FsfUVjzEUF
 78lS7h/ynhtt5ARv2CWtiz99IjwYNGm5DPsuZcU1SGn9t7Yr8MBcLrTAMxEnmv0iCC+AjWS+MqFUt
 y/QQ4JNzG3eWEcdZtiIpvT2nSYEB3BoZaPsSxzDKCkT88C201KAPCGw58LFreTLQejBc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jonDL-00036p-RY
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 2020 12:12:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jonDL-0005bJ-Qk
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 2020 12:12:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] vchan-socket-proxy: Unify main return value
Message-Id: <E1jonDL-0005bJ-Qk@xenbits.xenproject.org>
Date: Fri, 26 Jun 2020 12: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 2b1a2188111ec3f39de1c6e6ff834e6894d1e05a
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Wed Jun 10 23:29:31 2020 -0400
Commit:     Wei Liu <wl@xen.org>
CommitDate: Fri Jun 26 11:59:49 2020 +0000

    vchan-socket-proxy: Unify main return value
    
    Introduce 'ret' for main's return value and remove direct returns.  This
    is in preparation for a unified exit path with resource cleanup.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: Wei Liu <wl@xen.org>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/libvchan/vchan-socket-proxy.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/tools/libvchan/vchan-socket-proxy.c b/tools/libvchan/vchan-socket-proxy.c
index 196f6016b9..36a2fe2cb8 100644
--- a/tools/libvchan/vchan-socket-proxy.c
+++ b/tools/libvchan/vchan-socket-proxy.c
@@ -388,6 +388,7 @@ int main(int argc, char **argv)
     const char *vchan_path;
     const char *state_path = NULL;
     int opt;
+    int ret;
 
     while ((opt = getopt_long(argc, argv, "m:vs:", options, NULL)) != -1) {
         switch (opt) {
@@ -454,6 +455,8 @@ int main(int argc, char **argv)
         xs_close(xs);
     }
 
+    ret = 0;
+
     for (;;) {
         if (is_server) {
             /* wait for vchan connection */
@@ -468,7 +471,8 @@ int main(int argc, char **argv)
             }
             if (input_fd == -1) {
                 fprintf(stderr, "connect_socket failed\n");
-                return 1;
+                ret = 1;
+                break;
             }
             if (data_loop(ctrl, input_fd, output_fd) != 0)
                 break;
@@ -481,14 +485,16 @@ int main(int argc, char **argv)
                 input_fd = output_fd = accept(socket_fd, NULL, NULL);
             if (input_fd == -1) {
                 perror("accept");
-                return 1;
+                ret = 1;
+                break;
             }
             set_nonblocking(input_fd, 1);
             set_nonblocking(output_fd, 1);
             ctrl = connect_vchan(domid, vchan_path);
             if (!ctrl) {
                 perror("vchan client init");
-                return 1;
+                ret = 1;
+                break;
             }
             if (data_loop(ctrl, input_fd, output_fd) != 0)
                 break;
@@ -500,5 +506,6 @@ int main(int argc, char **argv)
             ctrl = NULL;
         }
     }
-    return 0;
+
+    return ret;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jun 26 12:12:28 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Jun 2020 12:12:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jonDY-0004q6-1N; Fri, 26 Jun 2020 12:12: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=LwDn=AH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jonDW-0004px-RS
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 2020 12:12:26 +0000
X-Inumbo-ID: 4c441ac4-b7a6-11ea-82a9-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 4c441ac4-b7a6-11ea-82a9-12813bfff9fa;
 Fri, 26 Jun 2020 12:12:26 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=IgYmMvix1giHa02ZTGXfmMVVDQlb7djfx5knaWLW3+U=; b=BhRkIRb2zaD68UuhjBGgNfyorL
 cRnmEcg8sHOrnyNmbzCJwS1a2PwvzSfSHjPJTrfvXgW7sHxa1eYs3mPfRebWN1EdSZy3/yZSJk/I4
 UBkl/F/T0RnN/4Nz7mo4nFI/03b2sPI3fD2RJOCYI0AN6aASl77rzIsKZK7pD3KY+KFw=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jonDV-00036y-Uf
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 2020 12:12:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jonDV-0005bl-Tm
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 2020 12:12:25 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] vchan-socket-proxy: Use a struct to store state
Message-Id: <E1jonDV-0005bl-Tm@xenbits.xenproject.org>
Date: Fri, 26 Jun 2020 12: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 ace450ebdf120c081e02b40896dc719646708046
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Wed Jun 10 23:29:32 2020 -0400
Commit:     Wei Liu <wl@xen.org>
CommitDate: Fri Jun 26 11:59:53 2020 +0000

    vchan-socket-proxy: Use a struct to store state
    
    Use a struct to group the vchan ctrl and FDs.  This will facilite
    tracking the state of open and closed FDs and ctrl in data_loop().
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: Wei Liu <wl@xen.org>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/libvchan/vchan-socket-proxy.c | 52 +++++++++++++++++++++----------------
 1 file changed, 30 insertions(+), 22 deletions(-)

diff --git a/tools/libvchan/vchan-socket-proxy.c b/tools/libvchan/vchan-socket-proxy.c
index 36a2fe2cb8..a932c94c97 100644
--- a/tools/libvchan/vchan-socket-proxy.c
+++ b/tools/libvchan/vchan-socket-proxy.c
@@ -89,6 +89,12 @@ int insiz = 0;
 int outsiz = 0;
 int verbose = 0;
 
+struct vchan_proxy_state {
+    struct libxenvchan *ctrl;
+    int output_fd;
+    int input_fd;
+};
+
 static void vchan_wr(struct libxenvchan *ctrl) {
     int ret;
 
@@ -381,8 +387,9 @@ int main(int argc, char **argv)
 {
     int is_server = 0;
     int socket_fd = -1;
-    int input_fd, output_fd;
-    struct libxenvchan *ctrl = NULL;
+    struct vchan_proxy_state state = { .ctrl = NULL,
+                                       .input_fd = -1,
+                                       .output_fd = -1 };
     const char *socket_path;
     int domid;
     const char *vchan_path;
@@ -422,15 +429,15 @@ int main(int argc, char **argv)
     socket_path = argv[optind+2];
 
     if (is_server) {
-        ctrl = libxenvchan_server_init(NULL, domid, vchan_path, 0, 0);
-        if (!ctrl) {
+        state.ctrl = libxenvchan_server_init(NULL, domid, vchan_path, 0, 0);
+        if (!state.ctrl) {
             perror("libxenvchan_server_init");
             exit(1);
         }
     } else {
         if (strcmp(socket_path, "-") == 0) {
-            input_fd = 0;
-            output_fd = 1;
+            state.input_fd = 0;
+            state.output_fd = 1;
         } else {
             socket_fd = listen_socket(socket_path);
             if (socket_fd == -1) {
@@ -460,21 +467,21 @@ int main(int argc, char **argv)
     for (;;) {
         if (is_server) {
             /* wait for vchan connection */
-            while (libxenvchan_is_open(ctrl) != 1)
-                libxenvchan_wait(ctrl);
+            while (libxenvchan_is_open(state.ctrl) != 1)
+                libxenvchan_wait(state.ctrl);
             /* vchan client connected, setup local FD if needed */
             if (strcmp(socket_path, "-") == 0) {
-                input_fd = 0;
-                output_fd = 1;
+                state.input_fd = 0;
+                state.output_fd = 1;
             } else {
-                input_fd = output_fd = connect_socket(socket_path);
+                state.input_fd = state.output_fd = connect_socket(socket_path);
             }
-            if (input_fd == -1) {
+            if (state.input_fd == -1) {
                 fprintf(stderr, "connect_socket failed\n");
                 ret = 1;
                 break;
             }
-            if (data_loop(ctrl, input_fd, output_fd) != 0)
+            if (data_loop(state.ctrl, state.input_fd, state.output_fd) != 0)
                 break;
             /* keep it running only when get UNIX socket path */
             if (socket_path[0] != '/')
@@ -482,28 +489,29 @@ int main(int argc, char **argv)
         } else {
             /* wait for local socket connection */
             if (strcmp(socket_path, "-") != 0)
-                input_fd = output_fd = accept(socket_fd, NULL, NULL);
-            if (input_fd == -1) {
+                state.input_fd = state.output_fd = accept(socket_fd,
+                                                          NULL, NULL);
+            if (state.input_fd == -1) {
                 perror("accept");
                 ret = 1;
                 break;
             }
-            set_nonblocking(input_fd, 1);
-            set_nonblocking(output_fd, 1);
-            ctrl = connect_vchan(domid, vchan_path);
-            if (!ctrl) {
+            set_nonblocking(state.input_fd, 1);
+            set_nonblocking(state.output_fd, 1);
+            state.ctrl = connect_vchan(domid, vchan_path);
+            if (!state.ctrl) {
                 perror("vchan client init");
                 ret = 1;
                 break;
             }
-            if (data_loop(ctrl, input_fd, output_fd) != 0)
+            if (data_loop(state.ctrl, state.input_fd, state.output_fd) != 0)
                 break;
             /* don't reconnect if output was stdout */
             if (strcmp(socket_path, "-") == 0)
                 break;
 
-            libxenvchan_close(ctrl);
-            ctrl = NULL;
+            libxenvchan_close(state.ctrl);
+            state.ctrl = NULL;
         }
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jun 26 12:12:38 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Jun 2020 12:12: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 1jonDi-0004rX-32; Fri, 26 Jun 2020 12:12:38 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=LwDn=AH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jonDh-0004rM-0Y
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 2020 12:12:37 +0000
X-Inumbo-ID: 5245ff96-b7a6-11ea-82a9-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 5245ff96-b7a6-11ea-82a9-12813bfff9fa;
 Fri, 26 Jun 2020 12:12: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=PyP4uNlQcRWEP/HNkqPsPf92ctxQv/iqKyoVLlLk3S4=; b=stbU7pxNJxcOjDV1aNv2TF/x41
 52G/CThEHx2PvtfGalikqWHI6h2DXzmyhOM8VXzwvWImwPKzaTXUic7tOVIw0B5FQQVAOICbjKCf6
 XgKbTIuO4R50QJ4xraZ9/LB/v0ep1+HuDa6T9GFxELVyUH8GaEGpZ/KTkbmdbkdVFqkI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jonDg-000378-1T
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 2020 12:12:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jonDg-0005cF-0d
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 2020 12:12:36 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] vchan-socket-proxy: Switch data_loop() to take state
Message-Id: <E1jonDg-0005cF-0d@xenbits.xenproject.org>
Date: Fri, 26 Jun 2020 12:12: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 bfb310ee686bc36c9a8f9c15c42f97f96206cd29
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Wed Jun 10 23:29:33 2020 -0400
Commit:     Wei Liu <wl@xen.org>
CommitDate: Fri Jun 26 11:59:56 2020 +0000

    vchan-socket-proxy: Switch data_loop() to take state
    
    Switch data_loop to take a pointer to vchan_proxy_state.
    
    No functional change.
    
    This removes a dead store to input_fd identified by Coverity.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: Wei Liu <wl@xen.org>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/libvchan/vchan-socket-proxy.c | 65 +++++++++++++++++++------------------
 1 file changed, 33 insertions(+), 32 deletions(-)

diff --git a/tools/libvchan/vchan-socket-proxy.c b/tools/libvchan/vchan-socket-proxy.c
index a932c94c97..29a12260ed 100644
--- a/tools/libvchan/vchan-socket-proxy.c
+++ b/tools/libvchan/vchan-socket-proxy.c
@@ -286,13 +286,13 @@ static void discard_buffers(struct libxenvchan *ctrl) {
     }
 }
 
-int data_loop(struct libxenvchan *ctrl, int input_fd, int output_fd)
+int data_loop(struct vchan_proxy_state *state)
 {
     int ret;
     int libxenvchan_fd;
     int max_fd;
 
-    libxenvchan_fd = libxenvchan_fd_for_select(ctrl);
+    libxenvchan_fd = libxenvchan_fd_for_select(state->ctrl);
     for (;;) {
         fd_set rfds;
         fd_set wfds;
@@ -300,15 +300,15 @@ int data_loop(struct libxenvchan *ctrl, int input_fd, int output_fd)
         FD_ZERO(&wfds);
 
         max_fd = -1;
-        if (input_fd != -1 && insiz != BUFSIZE) {
-            FD_SET(input_fd, &rfds);
-            if (input_fd > max_fd)
-                max_fd = input_fd;
+        if (state->input_fd != -1 && insiz != BUFSIZE) {
+            FD_SET(state->input_fd, &rfds);
+            if (state->input_fd > max_fd)
+                max_fd = state->input_fd;
         }
-        if (output_fd != -1 && outsiz) {
-            FD_SET(output_fd, &wfds);
-            if (output_fd > max_fd)
-                max_fd = output_fd;
+        if (state->output_fd != -1 && outsiz) {
+            FD_SET(state->output_fd, &wfds);
+            if (state->output_fd > max_fd)
+                max_fd = state->output_fd;
         }
         FD_SET(libxenvchan_fd, &rfds);
         if (libxenvchan_fd > max_fd)
@@ -319,52 +319,53 @@ int data_loop(struct libxenvchan *ctrl, int input_fd, int output_fd)
             exit(1);
         }
         if (FD_ISSET(libxenvchan_fd, &rfds)) {
-            libxenvchan_wait(ctrl);
-            if (!libxenvchan_is_open(ctrl)) {
+            libxenvchan_wait(state->ctrl);
+            if (!libxenvchan_is_open(state->ctrl)) {
                 if (verbose)
                     fprintf(stderr, "vchan client disconnected\n");
                 while (outsiz)
-                    socket_wr(output_fd);
-                close(output_fd);
-                close(input_fd);
-                discard_buffers(ctrl);
+                    socket_wr(state->output_fd);
+                close(state->output_fd);
+                close(state->input_fd);
+                discard_buffers(state->ctrl);
                 break;
             }
-            vchan_wr(ctrl);
+            vchan_wr(state->ctrl);
         }
 
-        if (FD_ISSET(input_fd, &rfds)) {
-            ret = read(input_fd, inbuf + insiz, BUFSIZE - insiz);
+        if (FD_ISSET(state->input_fd, &rfds)) {
+            ret = read(state->input_fd, inbuf + insiz, BUFSIZE - insiz);
             if (ret < 0 && errno != EAGAIN)
                 exit(1);
             if (verbose)
                 fprintf(stderr, "from-unix: %.*s\n", ret, inbuf + insiz);
             if (ret == 0) {
                 /* EOF on socket, write everything in the buffer and close the
-                 * input_fd socket */
+                 * state->input_fd socket */
                 while (insiz) {
-                    vchan_wr(ctrl);
-                    libxenvchan_wait(ctrl);
+                    vchan_wr(state->ctrl);
+                    libxenvchan_wait(state->ctrl);
                 }
-                close(input_fd);
-                input_fd = -1;
+                close(state->input_fd);
+                state->input_fd = -1;
                 /* TODO: maybe signal the vchan client somehow? */
                 break;
             }
             if (ret)
                 insiz += ret;
-            vchan_wr(ctrl);
+            vchan_wr(state->ctrl);
         }
-        if (FD_ISSET(output_fd, &wfds))
-            socket_wr(output_fd);
-        while (libxenvchan_data_ready(ctrl) && outsiz < BUFSIZE) {
-            ret = libxenvchan_read(ctrl, outbuf + outsiz, BUFSIZE - outsiz);
+        if (FD_ISSET(state->output_fd, &wfds))
+            socket_wr(state->output_fd);
+        while (libxenvchan_data_ready(state->ctrl) && outsiz < BUFSIZE) {
+            ret = libxenvchan_read(state->ctrl, outbuf + outsiz,
+                                   BUFSIZE - outsiz);
             if (ret < 0)
                 exit(1);
             if (verbose)
                 fprintf(stderr, "from-vchan: %.*s\n", ret, outbuf + outsiz);
             outsiz += ret;
-            socket_wr(output_fd);
+            socket_wr(state->output_fd);
         }
     }
     return 0;
@@ -481,7 +482,7 @@ int main(int argc, char **argv)
                 ret = 1;
                 break;
             }
-            if (data_loop(state.ctrl, state.input_fd, state.output_fd) != 0)
+            if (data_loop(&state) != 0)
                 break;
             /* keep it running only when get UNIX socket path */
             if (socket_path[0] != '/')
@@ -504,7 +505,7 @@ int main(int argc, char **argv)
                 ret = 1;
                 break;
             }
-            if (data_loop(state.ctrl, state.input_fd, state.output_fd) != 0)
+            if (data_loop(&state) != 0)
                 break;
             /* don't reconnect if output was stdout */
             if (strcmp(socket_path, "-") == 0)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jun 26 12:12:48 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Jun 2020 12:12: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 1jonDs-0004sf-4j; Fri, 26 Jun 2020 12:12: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=LwDn=AH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jonDq-0004sT-Mr
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 2020 12:12:46 +0000
X-Inumbo-ID: 584ac110-b7a6-11ea-82a9-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 584ac110-b7a6-11ea-82a9-12813bfff9fa;
 Fri, 26 Jun 2020 12:12: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=9w6BVXDlEgPRLRtSaRHm/OGygF0kauFjKiiZsZefLAo=; b=UpZz67+vdU1EO3iZZ5SUvVmr2m
 pB8Un5Pk8hSsETpgnkf6yvVdlJlt8VPCIn+vT/L/KwDYrv9tA6q5KQRDReGRlgpLIrBhzw2PnH3B/
 tbkJNI21/O8+1vMPfzMQhqN8k/LBmeEsHek1n+GSqFWueb9iRf+Nlqy0nPIrzeNM/dsA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jonDq-00037G-4a
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 2020 12:12:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jonDq-0005dA-3e
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 2020 12:12:46 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] vchan-socket-proxy: Set closed FDs to -1
Message-Id: <E1jonDq-0005dA-3e@xenbits.xenproject.org>
Date: Fri, 26 Jun 2020 12:12: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 620225c48573396dc2394f59080a2d704a566c9d
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Wed Jun 10 23:29:34 2020 -0400
Commit:     Wei Liu <wl@xen.org>
CommitDate: Fri Jun 26 11:59:59 2020 +0000

    vchan-socket-proxy: Set closed FDs to -1
    
    These FDs are closed, so set them to -1 so they are no longer valid.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: Wei Liu <wl@xen.org>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/libvchan/vchan-socket-proxy.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/libvchan/vchan-socket-proxy.c b/tools/libvchan/vchan-socket-proxy.c
index 29a12260ed..cd7629bc4e 100644
--- a/tools/libvchan/vchan-socket-proxy.c
+++ b/tools/libvchan/vchan-socket-proxy.c
@@ -326,7 +326,9 @@ int data_loop(struct vchan_proxy_state *state)
                 while (outsiz)
                     socket_wr(state->output_fd);
                 close(state->output_fd);
+                state->output_fd = -1;
                 close(state->input_fd);
+                state->input_fd = -1;
                 discard_buffers(state->ctrl);
                 break;
             }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jun 26 12:12:58 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Jun 2020 12:12: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 1jonE2-0004ti-6G; Fri, 26 Jun 2020 12:12: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=LwDn=AH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jonE0-0004tW-Qm
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 2020 12:12:56 +0000
X-Inumbo-ID: 5e4f6638-b7a6-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 5e4f6638-b7a6-11ea-bca7-bc764e2007e4;
 Fri, 26 Jun 2020 12:12: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=EXYVFcvc3F++o1rY1yj5vYk22Lq1SswC7fpnrBZonI0=; b=lY8OK29EaTKTNRIpjEWAmsDTD0
 5TSM+2N48FGhBeS3+9fxU8HDl6TTCuIxts8iBOBtCjDzBA5s1A95i7SsL4o5+bG4mkFKUup6jqaDK
 tDWazhmWTVO8CuXtVwGpzjbpdGujYTsnhXlYJEA+jn7jf/a+LXNKhvFQdCy8y38yWTTE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jonE0-00037O-7e
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 2020 12:12:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jonE0-0005eL-6p
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 2020 12:12:56 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] vchan-socket-proxy: Cleanup resources on exit
Message-Id: <E1jonE0-0005eL-6p@xenbits.xenproject.org>
Date: Fri, 26 Jun 2020 12:12: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 d20c0f1a7864a38b6c26d11d0e44467fba118625
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Wed Jun 10 23:29:35 2020 -0400
Commit:     Wei Liu <wl@xen.org>
CommitDate: Fri Jun 26 12:00:02 2020 +0000

    vchan-socket-proxy: Cleanup resources on exit
    
    Close open FDs and close th vchan connection when exiting the program.
    
    This addresses some Coverity findings about leaking file descriptors.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: Wei Liu <wl@xen.org>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/libvchan/vchan-socket-proxy.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tools/libvchan/vchan-socket-proxy.c b/tools/libvchan/vchan-socket-proxy.c
index cd7629bc4e..3552783ec2 100644
--- a/tools/libvchan/vchan-socket-proxy.c
+++ b/tools/libvchan/vchan-socket-proxy.c
@@ -518,5 +518,14 @@ int main(int argc, char **argv)
         }
     }
 
+    if (state.output_fd >= 0)
+        close(state.output_fd);
+    if (state.input_fd >= 0)
+        close(state.input_fd);
+    if (state.ctrl)
+        libxenvchan_close(state.ctrl);
+    if (socket_fd >= 0)
+        close(socket_fd);
+
     return ret;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jun 26 12:13:08 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Jun 2020 12:13: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 1jonEC-0004vf-7l; Fri, 26 Jun 2020 12:13: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=LwDn=AH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jonEB-0004vM-0Q
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 2020 12:13:07 +0000
X-Inumbo-ID: 64390c53-b7a6-11ea-82a9-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 64390c53-b7a6-11ea-82a9-12813bfff9fa;
 Fri, 26 Jun 2020 12:13: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=KkP5eUK5vuqlu2WChJUlV3kfdF62ZBLZ5AmCjgXw4xs=; b=Eu0ANjWfnZkwQnGrXeUP21qu5N
 JFybfpw+onWxmuugaZUlCi4ZuEY3ARqKBZaSPJGStmQBo4U8yflVYKfU6pshqnUg0U/nLjGQNJPsR
 JJH7G4kDJwLJxM2AUVO4sDpmDKc3GdfTjg1AqdRVFvR034/bruu54Nr6JFcT3pTva4aw=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jonEA-00037o-Aq
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 2020 12:13:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jonEA-0005fO-9y
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 2020 12:13:06 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] vchan-socket-proxy: Handle closing shared
 input/output_fd
Message-Id: <E1jonEA-0005fO-9y@xenbits.xenproject.org>
Date: Fri, 26 Jun 2020 12:13: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 40b532fbdcb2095da7152a1d08d9f0288524c223
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Wed Jun 10 23:29:36 2020 -0400
Commit:     Wei Liu <wl@xen.org>
CommitDate: Fri Jun 26 12:00:05 2020 +0000

    vchan-socket-proxy: Handle closing shared input/output_fd
    
    input_fd & output_fd may be the same FD.  In that case, mark both as -1
    when closing one.  That avoids a dangling FD reference.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: Wei Liu <wl@xen.org>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/libvchan/vchan-socket-proxy.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/libvchan/vchan-socket-proxy.c b/tools/libvchan/vchan-socket-proxy.c
index 3552783ec2..e1d959c6d1 100644
--- a/tools/libvchan/vchan-socket-proxy.c
+++ b/tools/libvchan/vchan-socket-proxy.c
@@ -349,6 +349,8 @@ int data_loop(struct vchan_proxy_state *state)
                     libxenvchan_wait(state->ctrl);
                 }
                 close(state->input_fd);
+                if (state->input_fd == state->output_fd)
+                    state->output_fd = -1;
                 state->input_fd = -1;
                 /* TODO: maybe signal the vchan client somehow? */
                 break;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jun 26 15:44:11 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Jun 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 1joqWN-0007mQ-3w; Fri, 26 Jun 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=LwDn=AH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1joqWM-0007mL-O5
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 2020 15:44:06 +0000
X-Inumbo-ID: dda855bc-b7c3-11ea-82d7-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id dda855bc-b7c3-11ea-82d7-12813bfff9fa;
 Fri, 26 Jun 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=97sDyIDnzBeBgUtaZ1kIwQ8Uf2Fg723nhSQAabxPZhg=; b=kEZW65LPOAlPjRQJnRbTRVlK8q
 IzoJ0aO+DqQRFip30unL5xd9n6q8uxoiAlTYYa0tTrQ+6XMUUAxglFaqRfRXS/LxuT7XoO2Jtg6qr
 ywoMdJ6OXmFbCCadm/DSfaWlGbi6wfOcASA+UKZNeMPn4FuZEmtrLxgqiocfzJkTGdoE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joqWL-00076h-7U
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 2020 15:44:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joqWL-0008NT-6I
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 2020 15:44:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/msr: Disallow access to Processor Trace MSRs
Message-Id: <E1joqWL-0008NT-6I@xenbits.xenproject.org>
Date: Fri, 26 Jun 2020 15:44: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 bcdfbb70fca579baa04f212c0936b77919bdae11
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jun 19 12:14:32 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Jun 26 16:34:02 2020 +0100

    x86/msr: Disallow access to Processor Trace MSRs
    
    We do not expose the feature to guests, so should disallow access to the
    respective MSRs.  For simplicity, drop the entire block of MSRs, not just the
    subset which have been specified thus far.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Wei Liu <wl@xen.org>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/arch/x86/msr.c              | 2 ++
 xen/include/asm-x86/msr-index.h | 8 ++++++++
 2 files changed, 10 insertions(+)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 0bfb5839b2..22f921cc71 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -168,6 +168,7 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
     case MSR_MCU_OPT_CTRL:
+    case MSR_RTIT_OUTPUT_BASE ... MSR_RTIT_ADDR_B(7):
     case MSR_U_CET:
     case MSR_S_CET:
     case MSR_PL0_SSP ... MSR_INTERRUPT_SSP_TABLE:
@@ -329,6 +330,7 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
     case MSR_MCU_OPT_CTRL:
+    case MSR_RTIT_OUTPUT_BASE ... MSR_RTIT_ADDR_B(7):
     case MSR_U_CET:
     case MSR_S_CET:
     case MSR_PL0_SSP ... MSR_INTERRUPT_SSP_TABLE:
diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h
index b328a47ed8..0fe98af923 100644
--- a/xen/include/asm-x86/msr-index.h
+++ b/xen/include/asm-x86/msr-index.h
@@ -69,6 +69,14 @@
 #define MSR_MCU_OPT_CTRL                    0x00000123
 #define  MCU_OPT_CTRL_RNGDS_MITG_DIS        (_AC(1, ULL) <<  0)
 
+#define MSR_RTIT_OUTPUT_BASE                0x00000560
+#define MSR_RTIT_OUTPUT_MASK                0x00000561
+#define MSR_RTIT_CTL                        0x00000570
+#define MSR_RTIT_STATUS                     0x00000571
+#define MSR_RTIT_CR3_MATCH                  0x00000572
+#define MSR_RTIT_ADDR_A(n)                 (0x00000580 + (n) * 2)
+#define MSR_RTIT_ADDR_B(n)                 (0x00000581 + (n) * 2)
+
 #define MSR_U_CET                           0x000006a0
 #define MSR_S_CET                           0x000006a2
 #define  CET_SHSTK_EN                       (_AC(1, ULL) <<  0)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jun 26 15:44:19 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Jun 2020 15: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 1joqWZ-0007n7-5d; Fri, 26 Jun 2020 15:44: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=LwDn=AH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1joqWX-0007n0-Ue
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 2020 15:44:17 +0000
X-Inumbo-ID: e3ad3662-b7c3-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id e3ad3662-b7c3-11ea-b7bb-bc764e2007e4;
 Fri, 26 Jun 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=pJzturSZ0jxvy47IWm2J43mShxoFMwPP4s+0FxUcjII=; b=leY8Y44KQa7XpQvgkgZpvlvkax
 RGsoHmNog1wM2jbd1qCVdHFj3TMZ9cNzf/JSHlVkQgI3uZQs/LOz9x+U2F2wtfCZ4lrCn1B2uZ2tk
 uQTjXy2mmhNMZAyrlTQtA8FGuDK91C5J80KbhuVBcDzXsQ5TN5ytUpL+GT8HUslH+ES4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joqWV-00076r-BB
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 2020 15:44:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joqWV-0008O6-9y
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 2020 15:44:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/livepatch: Make livepatching compatible with CET
 Shadow Stacks
Message-Id: <E1joqWV-0008O6-9y@xenbits.xenproject.org>
Date: Fri, 26 Jun 2020 15: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 92167e9430c010df410336f2b68cc4e30b7872d9
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Jun 8 18:47:58 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Jun 26 16:34:02 2020 +0100

    x86/livepatch: Make livepatching compatible with CET Shadow Stacks
    
    Just like the alternatives infrastructure, the livepatch infrastructure
    disables CR0.WP to perform patching, which is not permitted with CET active.
    
    Modify arch_livepatch_{quiesce,revive}() to disable CET before disabling WP,
    and reset the dirty bits on all virtual regions before re-enabling CET.
    
    One complication is that arch_livepatch_revive() has to fix up the top of the
    shadow stack.  This depends on the functions not being inlined, even under
    LTO.  Another limitation is that reset_virtual_region_perms() may shatter the
    final superpage of .text depending on alignment.
    
    This logic, and its downsides, are temporary until the patching infrastructure
    can be adjusted to not use CR0.WP.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/arch/x86/livepatch.c         | 35 +++++++++++++++++++++++++++++++++--
 xen/common/virtual_region.c      | 15 +++++++++++++++
 xen/include/xen/virtual_region.h |  1 +
 3 files changed, 49 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/livepatch.c b/xen/arch/x86/livepatch.c
index 901fad96bf..49f0d902e5 100644
--- a/xen/arch/x86/livepatch.c
+++ b/xen/arch/x86/livepatch.c
@@ -12,6 +12,7 @@
 #include <xen/livepatch.h>
 #include <xen/sched.h>
 #include <xen/vm_event.h>
+#include <xen/virtual_region.h>
 
 #include <asm/fixmap.h>
 #include <asm/nmi.h>
@@ -56,18 +57,48 @@ int arch_livepatch_safety_check(void)
     return -EBUSY;
 }
 
-int arch_livepatch_quiesce(void)
+int noinline arch_livepatch_quiesce(void)
 {
+    /* If Shadow Stacks are in use, disable CR4.CET so we can modify CR0.WP. */
+    if ( cpu_has_xen_shstk )
+        write_cr4(read_cr4() & ~X86_CR4_CET);
+
     /* Disable WP to allow changes to read-only pages. */
     write_cr0(read_cr0() & ~X86_CR0_WP);
 
     return 0;
 }
 
-void arch_livepatch_revive(void)
+void noinline arch_livepatch_revive(void)
 {
     /* Reinstate WP. */
     write_cr0(read_cr0() | X86_CR0_WP);
+
+    /* Clobber dirty bits and reinstate CET, if applicable. */
+    if ( IS_ENABLED(CONFIG_XEN_SHSTK) && cpu_has_xen_shstk )
+    {
+        unsigned long tmp;
+
+        reset_virtual_region_perms();
+
+        write_cr4(read_cr4() | X86_CR4_CET);
+
+        /*
+         * Fix up the return address on the shadow stack, which currently
+         * points at arch_livepatch_quiesce()'s caller.
+         *
+         * Note: this is somewhat fragile, and depends on both
+         * arch_livepatch_{quiesce,revive}() being called from the same
+         * function, which is currently the case.
+         *
+         * Any error will result in Xen dying with #CP, and its too late to
+         * recover in any way.
+         */
+        asm volatile ("rdsspq %[ssp];"
+                      "wrssq %[addr], (%[ssp]);"
+                      : [ssp] "=&r" (tmp)
+                      : [addr] "r" (__builtin_return_address(0)));
+    }
 }
 
 int arch_livepatch_verify_func(const struct livepatch_func *func)
diff --git a/xen/common/virtual_region.c b/xen/common/virtual_region.c
index aa23918bce..4fbc02e35a 100644
--- a/xen/common/virtual_region.c
+++ b/xen/common/virtual_region.c
@@ -4,6 +4,7 @@
 
 #include <xen/init.h>
 #include <xen/kernel.h>
+#include <xen/mm.h>
 #include <xen/rcupdate.h>
 #include <xen/spinlock.h>
 #include <xen/virtual_region.h>
@@ -91,6 +92,20 @@ void unregister_virtual_region(struct virtual_region *r)
     remove_virtual_region(r);
 }
 
+#if defined(CONFIG_LIVEPATCH) && defined(CONFIG_XEN_SHSTK)
+void reset_virtual_region_perms(void)
+{
+    const struct virtual_region *region;
+
+    rcu_read_lock(&rcu_virtual_region_lock);
+    list_for_each_entry_rcu( region, &virtual_region_list, list )
+        modify_xen_mappings((unsigned long)region->start,
+                            ROUNDUP((unsigned long)region->end, PAGE_SIZE),
+                            PAGE_HYPERVISOR_RX);
+    rcu_read_unlock(&rcu_virtual_region_lock);
+}
+#endif
+
 void __init unregister_init_virtual_region(void)
 {
     BUG_ON(system_state != SYS_STATE_active);
diff --git a/xen/include/xen/virtual_region.h b/xen/include/xen/virtual_region.h
index e5e58ed96b..ba408eb87a 100644
--- a/xen/include/xen/virtual_region.h
+++ b/xen/include/xen/virtual_region.h
@@ -33,6 +33,7 @@ void setup_virtual_regions(const struct exception_table_entry *start,
 void unregister_init_virtual_region(void);
 void register_virtual_region(struct virtual_region *r);
 void unregister_virtual_region(struct virtual_region *r);
+void reset_virtual_region_perms(void);
 
 #endif /* __XEN_VIRTUAL_REGION_H__ */
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jun 26 15:44:27 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Jun 2020 15: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 1joqWh-0007oJ-7B; Fri, 26 Jun 2020 15:44:27 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=LwDn=AH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1joqWg-0007oA-9O
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 2020 15:44:26 +0000
X-Inumbo-ID: e9ab4bbc-b7c3-11ea-82d7-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id e9ab4bbc-b7c3-11ea-82d7-12813bfff9fa;
 Fri, 26 Jun 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=AgBP+AUYtMyvNH3xspDWwCxrmTJrl6YGAnz8wr6vTRQ=; b=KPGmRdCK61x9GTTfvHjcZ0Yr6r
 jvAJ2SvFeMeylr7BMiORSg/fSvfOn96juQ16ZMIaCxCZB+FIWrk20yOf908hVHT5HtErq0MNPEjUm
 o6rz1H2eBAeDvZ6X6lN1TI3Tl5S2l+biVZjO5DPn7Qt75OHQcnu7CI/m+SMCNggyR6tM=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1joqWf-00077c-EN
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 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 1joqWf-0008Pr-DM
 for xen-changelog@lists.xenproject.org; Fri, 26 Jun 2020 15:44:25 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] changelog: Add notes about CET and Migration changes
Message-Id: <E1joqWf-0008Pr-DM@xenbits.xenproject.org>
Date: Fri, 26 Jun 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 88cfd062e8318dfeb67c7d2eb50b6cd224b0738a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jun 26 15:35:27 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Jun 26 16:34:02 2020 +0100

    changelog: Add notes about CET and Migration changes
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 CHANGELOG.md | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 43fd260156..5c3d3c791d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -21,6 +21,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - New 'domid_policy', allowing domain-ids to be randomly chosen.
  - Option to preserve domain-id across migrate or save+restore.
  - Support in kdd for initial KD protocol handshake for Win 7, 8 and 10 (64 bit).
+ - Tech preview support for Control-flow Execution Technology, with Xen using
+   Supervisor Shadow Stacks for its own protection.
+
+### Changed
+ - The CPUID data seen by a guest on boot is now moved in the migration
+   stream.  A guest migrating between non-identical hardware will now no
+   longer observe details such as Family/Model/Stepping, Cache, etc changing.
+   An administrator still needs to take care to ensure the features visible to
+   the guest at boot are compatible with anywhere it might migrate.
 
 ## [4.13.0](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.13.0) - 2019-12-17
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sat Jun 27 10:22:11 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Jun 2020 10: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 1jp7yH-0001MZ-IN; Sat, 27 Jun 2020 10:22:05 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=MmMb=AI=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jp7yG-0001MU-D8
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 10:22:04 +0000
X-Inumbo-ID: 0ad46bf6-b860-11ea-8356-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 0ad46bf6-b860-11ea-8356-12813bfff9fa;
 Sat, 27 Jun 2020 10: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=fSpu4w/WPSxLWfHpozpiFqOIu0YJzANPRGuVE6lwNVk=; b=UPPx4DLfy48aqnDaED0+mNw5vy
 JN4Tj5o1M+NG8bmSWJxQ+sh7nxSq8PlUJkQBw/Dtgb6lVbpL8O+i7+aLwMOx4hSJcvyLMn687pLeV
 gQxxHQhJkS72ktoZnS5VVzdwpErhLWKxnQx0hulUyEIbMaSwIqyWUgFOl+aejK7B6xMk=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jp7yE-0006PH-HF
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 10:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jp7yE-0002Ni-GD
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 10:22:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/acpi: use FADT flags to determine the PMTMR width
Message-Id: <E1jp7yE-0002Ni-GD@xenbits.xenproject.org>
Date: Sat, 27 Jun 2020 10: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 f325d2477eef8229c47d97031d314629521c70ab
Author:     Grzegorz Uriasz <gorbak25@gmail.com>
AuthorDate: Thu Jun 25 09:11:09 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Jun 25 09:11:09 2020 +0200

    x86/acpi: use FADT flags to determine the PMTMR width
    
    On some computers the bit width of the PM Timer as reported
    by ACPI is 32 bits when in fact the FADT flags report correctly
    that the timer is 24 bits wide. On affected machines such as the
    ASUS FX504GM and never gaming laptops this results in the inability
    to resume the machine from suspend. Without this patch suspend is
    broken on affected machines and even if a machine manages to resume
    correctly then the kernel time and xen timers are trashed.
    
    Signed-off-by: Grzegorz Uriasz <gorbak25@gmail.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/arch/x86/acpi/boot.c    | 19 +++++++++++++++----
 xen/arch/x86/time.c         | 12 ++++--------
 xen/include/acpi/acmacros.h |  8 ++++++++
 3 files changed, 27 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/acpi/boot.c b/xen/arch/x86/acpi/boot.c
index bcba52e232..ed40ce56b4 100644
--- a/xen/arch/x86/acpi/boot.c
+++ b/xen/arch/x86/acpi/boot.c
@@ -475,10 +475,17 @@ static int __init acpi_parse_fadt(struct acpi_table_header *table)
 
 #ifdef CONFIG_X86_PM_TIMER
 	/* detect the location of the ACPI PM Timer */
-	if (fadt->header.revision >= FADT2_REVISION_ID) {
+	if (fadt->header.revision >= FADT2_REVISION_ID &&
+	    fadt->xpm_timer_block.space_id == ACPI_ADR_SPACE_SYSTEM_IO) {
 		/* FADT rev. 2 */
-		if (fadt->xpm_timer_block.space_id ==
-		    ACPI_ADR_SPACE_SYSTEM_IO) {
+		if (fadt->xpm_timer_block.access_width != 0 &&
+		    ACPI_ACCESS_BIT_WIDTH(fadt->xpm_timer_block.access_width) != 32)
+			printk(KERN_WARNING PREFIX "PM-Timer has invalid access width(%u)\n",
+			       fadt->xpm_timer_block.access_width);
+		else if (fadt->xpm_timer_block.bit_offset != 0)
+			printk(KERN_WARNING PREFIX "PM-Timer has invalid bit offset(%u)\n",
+			       fadt->xpm_timer_block.bit_offset);
+		else {
 			pmtmr_ioport = fadt->xpm_timer_block.address;
 			pmtmr_width = fadt->xpm_timer_block.bit_width;
 		}
@@ -490,8 +497,12 @@ static int __init acpi_parse_fadt(struct acpi_table_header *table)
  	 */
 	if (!pmtmr_ioport) {
 		pmtmr_ioport = fadt->pm_timer_block;
-		pmtmr_width = fadt->pm_timer_length == 4 ? 24 : 0;
+		pmtmr_width = fadt->pm_timer_length == 4 ? 32 : 0;
 	}
+	if (pmtmr_width < 32 && (fadt->flags & ACPI_FADT_32BIT_TIMER))
+		printk(KERN_WARNING PREFIX "PM-Timer is too short\n");
+	if (pmtmr_width > 24 && !(fadt->flags & ACPI_FADT_32BIT_TIMER))
+		pmtmr_width = 24;
 	if (pmtmr_ioport)
 		printk(KERN_INFO PREFIX "PM-Timer IO Port: %#x (%u bits)\n",
 		       pmtmr_ioport, pmtmr_width);
diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index d643590c0a..cf97dde9d6 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -457,16 +457,13 @@ static u64 read_pmtimer_count(void)
 static s64 __init init_pmtimer(struct platform_timesource *pts)
 {
     u64 start;
-    u32 count, target, mask = 0xffffff;
+    u32 count, target, mask;
 
-    if ( !pmtmr_ioport || !pmtmr_width )
+    if ( !pmtmr_ioport || (pmtmr_width != 24 && pmtmr_width != 32) )
         return 0;
 
-    if ( pmtmr_width == 32 )
-    {
-        pts->counter_bits = 32;
-        mask = 0xffffffff;
-    }
+    pts->counter_bits = pmtmr_width;
+    mask = 0xffffffff >> (32 - pmtmr_width);
 
     count = inl(pmtmr_ioport) & mask;
     start = rdtsc_ordered();
@@ -486,7 +483,6 @@ static struct platform_timesource __initdata plt_pmtimer =
     .name = "ACPI PM Timer",
     .frequency = ACPI_PM_FREQUENCY,
     .read_counter = read_pmtimer_count,
-    .counter_bits = 24,
     .init = init_pmtimer
 };
 
diff --git a/xen/include/acpi/acmacros.h b/xen/include/acpi/acmacros.h
index 6765535053..86c503c20f 100644
--- a/xen/include/acpi/acmacros.h
+++ b/xen/include/acpi/acmacros.h
@@ -121,6 +121,14 @@
 #define ACPI_COMPARE_NAME(a,b)          (!ACPI_STRNCMP (ACPI_CAST_PTR (char,(a)), ACPI_CAST_PTR (char,(b)), ACPI_NAME_SIZE))
 #endif
 
+/*
+ * Algorithm to obtain access bit or byte width.
+ * Can be used with access_width of struct acpi_generic_address and access_size of
+ * struct acpi_resource_generic_register.
+ */
+#define ACPI_ACCESS_BIT_WIDTH(size)     (1 << ((size) + 2))
+#define ACPI_ACCESS_BYTE_WIDTH(size)    (1 << ((size) - 1))
+
 /*
  * Macros for moving data around to/from buffers that are possibly unaligned.
  * If the hardware supports the transfer of unaligned data, just do the store.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jun 27 10:22:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Jun 2020 10:22:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jp7yQ-0001ND-K1; Sat, 27 Jun 2020 10: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=MmMb=AI=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jp7yP-0001N6-Bg
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 10:22:13 +0000
X-Inumbo-ID: 0febe4d5-b860-11ea-8356-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 0febe4d5-b860-11ea-8356-12813bfff9fa;
 Sat, 27 Jun 2020 10: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=5R1IKXw3waCGmBrMhBW/OfypV0pGa/51K0CypvzxHjk=; b=dQ9fMTO0PhGa7p1g+vfs4zrSbL
 38uozwBkGVV3uH/7vmaXDfgk6v9jFGofKMv4SnlEmAsiCJWWPHasg3k57wCJ6ZpxJTj3OtC/rzWxr
 dCc+b8D8udjtCs2jlKsVjhgp1OZHy3SUS0vvprtwymfYA5BkPkZWLe0/xnoHL7lSbg74=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jp7yO-0006PN-Kl
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 10:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jp7yO-0002Om-JQ
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 10:22:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/CPUID: fill all fields in
 x86_cpuid_policy_fill_native()
Message-Id: <E1jp7yO-0002Om-JQ@xenbits.xenproject.org>
Date: Sat, 27 Jun 2020 10: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 e4d2207165b379ec13c8b512936f63982af62d13
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Jun 25 09:12:21 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Jun 25 09:12:21 2020 +0200

    x86/CPUID: fill all fields in x86_cpuid_policy_fill_native()
    
    Coverity validly complains that the new call from
    tools/tests/cpu-policy/test-cpu-policy.c:test_cpuid_current() leaves
    two fields uninitialized, yet they get then consumed by
    x86_cpuid_copy_to_buffer(). (All other present callers of the function
    pass a pointer to a static - and hence initialized - buffer.)
    
    Coverity-ID: 1464809
    Fixes: c22ced93e167 ("tests/cpu-policy: Confirm that CPUID serialisation is sorted")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/lib/x86/cpuid.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/lib/x86/cpuid.c b/xen/lib/x86/cpuid.c
index c111d43b00..c7a0508148 100644
--- a/xen/lib/x86/cpuid.c
+++ b/xen/lib/x86/cpuid.c
@@ -176,6 +176,10 @@ void x86_cpuid_policy_fill_native(struct cpuid_policy *p)
                           ARRAY_SIZE(p->extd.raw) - 1); ++i )
         cpuid_leaf(0x80000000 + i, &p->extd.raw[i]);
 
+    /* Don't report leaves from possible lower level hypervisor, for now. */
+    p->hv_limit = 0;
+    p->hv2_limit = 0;
+
     x86_cpuid_policy_recalc_synth(p);
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jun 27 10:22:24 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Jun 2020 10:22:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jp7ya-0001OO-LQ; Sat, 27 Jun 2020 10: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=MmMb=AI=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jp7yZ-0001OA-GI
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 10:22:23 +0000
X-Inumbo-ID: 16e0842a-b860-11ea-8356-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 16e0842a-b860-11ea-8356-12813bfff9fa;
 Sat, 27 Jun 2020 10: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=ewszKDREvTeQKLXdUzjg4kOeXs1bZ4iDZeIql9flqTE=; b=3Omr/WhndTLDzU905vgsx5PTTD
 Ozdy0nt3xIcnPybTPBkxp2xCo7A6jKYlpDHl79hNWUOlAfHEvxgRn2xOHvGUKNgvolZkUFD+V2wCx
 VGFiv7d8nxgNfDwjdrhXVUMeFGvxghTcP2Jfmryl8ftSFb4rTQBYfIpCVJJg0SBAdP8I=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jp7yY-0006PV-Nr
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 10:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jp7yY-0002PI-Ms
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 10:22:22 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] scripts: don't rely on "stat -" support
Message-Id: <E1jp7yY-0002PI-Ms@xenbits.xenproject.org>
Date: Sat, 27 Jun 2020 10: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 d3688bf60f798074bf38d712a3e15c88cfb81ed4
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Jun 25 17:16:02 2020 +0200
Commit:     Wei Liu <wl@xen.org>
CommitDate: Fri Jun 26 10:08:05 2020 +0000

    scripts: don't rely on "stat -" support
    
    While commit b72682c602b8 ("scripts: Use stat to check lock claim")
    validly indicates that stat has gained support for the special "-"
    command line option in 2009, we should still try to avoid breaking being
    able to run on even older distros. As it has been determined, contary to
    the comment in the script using /dev/stdin (/proc/self/fd/$_lockfd) is
    fine here, as Linux specially treats these /proc inodes.
    
    Suggested-by: Ian Jackson <ian.jackson@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Tested-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Jason Andryuk <jandryuk@gmail.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/hotplug/Linux/locking.sh | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/tools/hotplug/Linux/locking.sh b/tools/hotplug/Linux/locking.sh
index 69aefae6f6..2e6fb35f02 100644
--- a/tools/hotplug/Linux/locking.sh
+++ b/tools/hotplug/Linux/locking.sh
@@ -45,18 +45,14 @@ claim_lock()
     while true; do
         eval "exec $_lockfd<>$_lockfile"
         flock -x $_lockfd || return $?
-        # We can't just stat /dev/stdin or /proc/self/fd/$_lockfd or
-        # use bash's test -ef because those all go through what is
-        # actually a synthetic symlink in /proc and we aren't
-        # guaranteed that our stat(2) won't lose the race with an
-        # rm(1) between reading the synthetic link and traversing the
-        # file system to find the inum.  stat(1) translates '-' into an
-        # fstat(2) of FD 0.  So we just need to arrange the FDs properly
-        # to get the fstat(2) we need.  stat will output two lines like:
+        # Although /dev/stdin (i.e. /proc/self/fd/0) looks like a symlink,
+        # stat(2) bypasses the synthetic symlink and directly accesses the
+        # underlying open-file.  So this works correctly even if the file
+        # has been renamed or unlinked.  stat will output two lines like:
         # WW.XXX
         # YY.ZZZ
         # which need to be separated and compared.
-        if stat=$( stat -L -c '%D.%i' - $_lockfile 0<&$_lockfd 2>/dev/null )
+        if stat=$( stat -L -c '%D.%i' /dev/stdin $_lockfile 0<&$_lockfd 2>/dev/null )
         then
             local file_stat
             local fd_stat
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jun 27 14:55:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Jun 2020 14: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 1jpCET-0006Fw-E7; Sat, 27 Jun 2020 14: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=MmMb=AI=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jpCES-0006Fm-2s
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:55:04 +0000
X-Inumbo-ID: 2e55fba0-b886-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 2e55fba0-b886-11ea-b7bb-bc764e2007e4;
 Sat, 27 Jun 2020 14:55: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=xIjpLr0EDhCcUyxjKvxpYL8H9DvfY9hdAx5GF8Uk5GY=; b=5MxRXDK4rhxSMjR+OGLrRgl9QS
 Em0SCpFgaCuRSIeDxOGme84wgU06EPCOSsbZxNSu5qmLrqWyklmo06l3cxyxfkMI58gDW6WVgo5gA
 33GX5DJya8PYQHjc937w+aEvHDJgxaAhjB+y92r0Dqt982FB+ORnRx/pRjisLS9AOsyE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCEQ-0002xi-Vj
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCEQ-0007G1-Uj
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:55:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.12] x86/spec-ctrl: CPUID/MSR definitions for Special
 Register Buffer Data Sampling
Message-Id: <E1jpCEQ-0007G1-Uj@xenbits.xenproject.org>
Date: Sat, 27 Jun 2020 14: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 9dc284294017c7206bd09223090d49003f6c71db
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 8 19:47:46 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jun 9 17:45:37 2020 +0100

    x86/spec-ctrl: CPUID/MSR definitions for Special Register Buffer Data Sampling
    
    This is part of XSA-320 / CVE-2020-0543
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Wei Liu <wl@xen.org>
    (cherry picked from commit caab85ab58c0cdf74ab070a5de5c4df89f509ff3)
---
 docs/misc/xen-command-line.pandoc           | 8 ++++----
 tools/libxl/libxl_cpuid.c                   | 1 +
 tools/misc/xen-cpuid.c                      | 1 +
 xen/arch/x86/cpuid.c                        | 5 +++++
 xen/arch/x86/msr.c                          | 2 ++
 xen/arch/x86/spec_ctrl.c                    | 3 ++-
 xen/include/asm-x86/msr-index.h             | 3 +++
 xen/include/public/arch-x86/cpufeatureset.h | 1 +
 8 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 3561d88b59..dbdaee92dc 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -483,10 +483,10 @@ accounting for hardware capabilities as enumerated via CPUID.
 
 Currently accepted:
 
-The Speculation Control hardware features `md-clear`, `ibrsb`, `stibp`, `ibpb`,
-`l1d-flush` and `ssbd` are used by default if available and applicable.  They can
-be ignored, e.g. `no-ibrsb`, at which point Xen won't use them itself, and
-won't offer them to guests.
+The Speculation Control hardware features `srbds-ctrl`, `md-clear`, `ibrsb`,
+`stibp`, `ibpb`, `l1d-flush` and `ssbd` are used by default if available and
+applicable.  They can be ignored, e.g. `no-ibrsb`, at which point Xen won't
+use them itself, and won't offer them to guests.
 
 ### cpuid_mask_cpu
 > `= fam_0f_rev_[cdefg] | fam_10_rev_[bc] | fam_11_rev_b`
diff --git a/tools/libxl/libxl_cpuid.c b/tools/libxl/libxl_cpuid.c
index 4cf0f0738d..88b5760c85 100644
--- a/tools/libxl/libxl_cpuid.c
+++ b/tools/libxl/libxl_cpuid.c
@@ -203,6 +203,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},
+        {"srbds-ctrl",   0x00000007,  0, CPUID_REG_EDX,  9,  1},
         {"md-clear",     0x00000007,  0, CPUID_REG_EDX, 10,  1},
         {"cet-ibt",      0x00000007,  0, CPUID_REG_EDX, 20,  1},
         {"ibrsb",        0x00000007,  0, CPUID_REG_EDX, 26,  1},
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index 2a00697643..b4c4dfcf19 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -154,6 +154,7 @@ static const char *str_7d0[32] =
     [ 2] = "avx512_4vnniw", [ 3] = "avx512_4fmaps",
     [ 4] = "fsrm",
 
+    /*  8 */                [ 9] = "srbds-ctrl",
     [10] = "md-clear",
     /* 12 */                [13] = "tsx-force-abort",
 
diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 1727497459..22d8c71a95 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -59,6 +59,11 @@ static int __init parse_xen_cpuid(const char *s)
             if ( !val )
                 setup_clear_cpu_cap(X86_FEATURE_SSBD);
         }
+        else if ( (val = parse_boolean("srbds-ctrl", s, ss)) >= 0 )
+        {
+            if ( !val )
+                setup_clear_cpu_cap(X86_FEATURE_SRBDS_CTRL);
+        }
         else
             rc = -EINVAL;
 
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 4888fff16c..9ff27b7007 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -133,6 +133,7 @@ int guest_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val)
         /* Write-only */
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
+    case MSR_MCU_OPT_CTRL:
     case MSR_U_CET:
     case MSR_S_CET:
     case MSR_PL0_SSP ... MSR_INTERRUPT_SSP_TABLE:
@@ -273,6 +274,7 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
         /* Read-only */
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
+    case MSR_MCU_OPT_CTRL:
     case MSR_U_CET:
     case MSR_S_CET:
     case MSR_PL0_SSP ... MSR_INTERRUPT_SSP_TABLE:
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index 800139d79c..5158e012ca 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -309,12 +309,13 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
     printk("Speculative mitigation facilities:\n");
 
     /* Hardware features which pertain to speculative mitigations. */
-    printk("  Hardware features:%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
+    printk("  Hardware features:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
            (_7d0 & cpufeat_mask(X86_FEATURE_IBRSB)) ? " IBRS/IBPB" : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_STIBP)) ? " STIBP"     : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_L1D_FLUSH)) ? " L1D_FLUSH" : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_SSBD))  ? " SSBD"      : "",
            (_7d0 & cpufeat_mask(X86_FEATURE_MD_CLEAR)) ? " MD_CLEAR" : "",
+           (_7d0 & cpufeat_mask(X86_FEATURE_SRBDS_CTRL)) ? " SRBDS_CTRL" : "",
            (e8b  & cpufeat_mask(X86_FEATURE_IBPB))  ? " IBPB"      : "",
            (caps & ARCH_CAPS_IBRS_ALL)              ? " IBRS_ALL"  : "",
            (caps & ARCH_CAPS_RDCL_NO)               ? " RDCL_NO"   : "",
diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h
index 7693c4a71a..91994669e1 100644
--- a/xen/include/asm-x86/msr-index.h
+++ b/xen/include/asm-x86/msr-index.h
@@ -179,6 +179,9 @@
 #define MSR_IA32_VMX_TRUE_ENTRY_CTLS            0x490
 #define MSR_IA32_VMX_VMFUNC                     0x491
 
+#define MSR_MCU_OPT_CTRL                    0x00000123
+#define  MCU_OPT_CTRL_RNGDS_MITG_DIS        (_AC(1, ULL) <<  0)
+
 #define MSR_U_CET                           0x000006a0
 #define MSR_S_CET                           0x000006a2
 #define MSR_PL0_SSP                         0x000006a4
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 865a435d2c..31490a7c10 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -243,6 +243,7 @@ XEN_CPUFEATURE(IBPB,          8*32+12) /*A  IBPB support only (no IBRS, used by
 /* 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(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 */
 XEN_CPUFEATURE(CET_IBT,       9*32+20) /*   CET - Indirect Branch Tracking */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Sat Jun 27 14:55:15 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Jun 2020 14: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 1jpCEd-0006H2-Fg; Sat, 27 Jun 2020 14: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=MmMb=AI=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jpCEc-0006Gp-2f
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:55:14 +0000
X-Inumbo-ID: 345b195e-b886-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 345b195e-b886-11ea-bca7-bc764e2007e4;
 Sat, 27 Jun 2020 14:55: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=/MS84oI3W5V48ULDeEjXhaOl3FtOfRW2c9pqjrZXW4o=; b=IZp++TbuAjt1poRyHy+OSf487J
 9QcFfcLTuuUuzCn6IPl8aE33lCTQ7XzSlL+sE+Un/+325wXCydP9eBFqRCzzQS0soqPwDjfGUV80R
 tUGlL/k0dL9OYcvjDrRCHv0024sT4/rr3R/XV54jrlYtNE534kl/dGPsqJAZVzWo70lA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCEb-0002xp-36
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:55:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCEb-0007Ge-26
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:55:13 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.12] x86/spec-ctrl: Mitigate the Special Register Buffer
 Data Sampling sidechannel
Message-Id: <E1jpCEb-0007Ge-26@xenbits.xenproject.org>
Date: Sat, 27 Jun 2020 14:55: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 199ae1f15894bd1bdefdf7c3e44688127be3ba19
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 8 19:47:46 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jun 9 17:45:49 2020 +0100

    x86/spec-ctrl: Mitigate the Special Register Buffer Data Sampling sidechannel
    
    See patch documentation and comments.
    
    This is part of XSA-320 / CVE-2020-0543
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 6a49b9a7920c82015381740905582b666160d955)
---
 docs/misc/xen-command-line.pandoc |  8 +++++++-
 xen/arch/x86/acpi/power.c         |  3 +++
 xen/arch/x86/smpboot.c            |  8 +++++---
 xen/arch/x86/spec_ctrl.c          | 41 ++++++++++++++++++++++++++++++++++++++-
 xen/include/asm-x86/spec_ctrl.h   |  2 ++
 5 files changed, 57 insertions(+), 5 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index dbdaee92dc..337fbf0492 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -1909,7 +1909,7 @@ By default SSBD will be mitigated at runtime (i.e `ssbd=runtime`).
 ### spec-ctrl (x86)
 > `= List of [ <bool>, xen=<bool>, {pv,hvm,msr-sc,rsb,md-clear}=<bool>,
 >              bti-thunk=retpoline|lfence|jmp, {ibrs,ibpb,ssbd,eager-fpu,
->              l1d-flush}=<bool> ]`
+>              l1d-flush,srb-lock}=<bool> ]`
 
 Controls for speculative execution sidechannel mitigations.  By default, Xen
 will pick the most appropriate mitigations based on compiled in support,
@@ -1981,6 +1981,12 @@ Irrespective of Xen's setting, the feature is virtualised for HVM guests to
 use.  By default, Xen will enable this mitigation on hardware believed to be
 vulnerable to L1TF.
 
+On hardware supporting SRBDS_CTRL, the `srb-lock=` option can be used to force
+or prevent Xen from protect the Special Register Buffer from leaking stale
+data. By default, Xen will enable this mitigation, except on parts where MDS
+is fixed and TAA is fixed/mitigated (in which case, there is believed to be no
+way for an attacker to obtain the stale data).
+
 ### sync_console
 > `= <boolean>`
 
diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
index c1d772f63f..a07aa3b9ed 100644
--- a/xen/arch/x86/acpi/power.c
+++ b/xen/arch/x86/acpi/power.c
@@ -266,6 +266,9 @@ static int enter_state(u32 state)
     ci->spec_ctrl_flags |= (default_spec_ctrl_flags & SCF_ist_wrmsr);
     spec_ctrl_exit_idle(ci);
 
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+        wrmsrl(MSR_MCU_OPT_CTRL, default_xen_mcu_opt_ctrl);
+
  done:
     spin_debug_enable();
     local_irq_restore(flags);
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index 699e21bfb7..b741d1354a 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -369,12 +369,14 @@ void start_secondary(void *unused)
         microcode_resume_cpu(cpu);
 
     /*
-     * If MSR_SPEC_CTRL is available, apply Xen's default setting and discard
-     * any firmware settings.  Note: MSR_SPEC_CTRL may only become available
-     * after loading microcode.
+     * If any speculative control MSRs are available, apply Xen's default
+     * settings.  Note: These MSRs may only become available after loading
+     * microcode.
      */
     if ( boot_cpu_has(X86_FEATURE_IBRSB) )
         wrmsrl(MSR_SPEC_CTRL, default_xen_spec_ctrl);
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+        wrmsrl(MSR_MCU_OPT_CTRL, default_xen_mcu_opt_ctrl);
 
     tsx_init(); /* Needs microcode.  May change HLE/RTM feature bits. */
 
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index 5158e012ca..e2fcefc86a 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -64,6 +64,9 @@ static unsigned int __initdata l1d_maxphysaddr;
 static bool __initdata cpu_has_bug_msbds_only; /* => minimal HT impact. */
 static bool __initdata cpu_has_bug_mds; /* Any other M{LP,SB,FB}DS combination. */
 
+static int8_t __initdata opt_srb_lock = -1;
+uint64_t __read_mostly default_xen_mcu_opt_ctrl;
+
 static int __init parse_spec_ctrl(const char *s)
 {
     const char *ss;
@@ -110,6 +113,7 @@ static int __init parse_spec_ctrl(const char *s)
             opt_ibpb = false;
             opt_ssbd = false;
             opt_l1d_flush = 0;
+            opt_srb_lock = 0;
         }
         else if ( val > 0 )
             rc = -EINVAL;
@@ -175,6 +179,8 @@ static int __init parse_spec_ctrl(const char *s)
             opt_eager_fpu = val;
         else if ( (val = parse_boolean("l1d-flush", s, ss)) >= 0 )
             opt_l1d_flush = val;
+        else if ( (val = parse_boolean("srb-lock", s, ss)) >= 0 )
+            opt_srb_lock = val;
         else
             rc = -EINVAL;
 
@@ -338,7 +344,7 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
                "\n");
 
     /* Settings for Xen's protection, irrespective of guests. */
-    printk("  Xen settings: BTI-Thunk %s, SPEC_CTRL: %s%s%s, Other:%s%s%s\n",
+    printk("  Xen settings: BTI-Thunk %s, SPEC_CTRL: %s%s%s, Other:%s%s%s%s\n",
            thunk == THUNK_NONE      ? "N/A" :
            thunk == THUNK_RETPOLINE ? "RETPOLINE" :
            thunk == THUNK_LFENCE    ? "LFENCE" :
@@ -349,6 +355,8 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
            (default_xen_spec_ctrl & SPEC_CTRL_SSBD)  ? " SSBD+" : " SSBD-",
            !(caps & ARCH_CAPS_TSX_CTRL)              ? "" :
            (opt_tsx & 1)                             ? " TSX+" : " TSX-",
+           !boot_cpu_has(X86_FEATURE_SRBDS_CTRL)     ? "" :
+           opt_srb_lock                              ? " SRB_LOCK+" : " SRB_LOCK-",
            opt_ibpb                                  ? " IBPB"  : "",
            opt_l1d_flush                             ? " L1D_FLUSH" : "",
            opt_md_clear_pv || opt_md_clear_hvm       ? " VERW"  : "");
@@ -1142,6 +1150,34 @@ void __init init_speculation_mitigations(void)
         tsx_init();
     }
 
+    /* Calculate suitable defaults for MSR_MCU_OPT_CTRL */
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+    {
+        uint64_t val;
+
+        rdmsrl(MSR_MCU_OPT_CTRL, val);
+
+        /*
+         * On some SRBDS-affected hardware, it may be safe to relax srb-lock
+         * by default.
+         *
+         * On parts which enumerate MDS_NO and not TAA_NO, TSX is the only way
+         * to access the Fill Buffer.  If TSX isn't available (inc. SKU
+         * reasons on some models), or TSX is explicitly disabled, then there
+         * is no need for the extra overhead to protect RDRAND/RDSEED.
+         */
+        if ( opt_srb_lock == -1 &&
+             (caps & (ARCH_CAPS_MDS_NO|ARCH_CAPS_TAA_NO)) == ARCH_CAPS_MDS_NO &&
+             (!cpu_has_hle || ((caps & ARCH_CAPS_TSX_CTRL) && opt_tsx == 0)) )
+            opt_srb_lock = 0;
+
+        val &= ~MCU_OPT_CTRL_RNGDS_MITG_DIS;
+        if ( !opt_srb_lock )
+            val |= MCU_OPT_CTRL_RNGDS_MITG_DIS;
+
+        default_xen_mcu_opt_ctrl = val;
+    }
+
     print_details(thunk, caps);
 
     /*
@@ -1173,6 +1209,9 @@ void __init init_speculation_mitigations(void)
 
         wrmsrl(MSR_SPEC_CTRL, bsp_delay_spec_ctrl ? 0 : default_xen_spec_ctrl);
     }
+
+    if ( boot_cpu_has(X86_FEATURE_SRBDS_CTRL) )
+        wrmsrl(MSR_MCU_OPT_CTRL, default_xen_mcu_opt_ctrl);
 }
 
 static void __init __maybe_unused build_assertions(void)
diff --git a/xen/include/asm-x86/spec_ctrl.h b/xen/include/asm-x86/spec_ctrl.h
index ba03bb42e5..59bab1a41b 100644
--- a/xen/include/asm-x86/spec_ctrl.h
+++ b/xen/include/asm-x86/spec_ctrl.h
@@ -53,6 +53,8 @@ extern int8_t opt_pv_l1tf_hwdom, opt_pv_l1tf_domu;
  */
 extern paddr_t l1tf_addr_mask, l1tf_safe_maddr;
 
+extern uint64_t default_xen_mcu_opt_ctrl;
+
 static inline void init_shadow_spec_ctrl_state(void)
 {
     struct cpu_info *info = get_cpu_info();
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Sat Jun 27 14:55:25 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Jun 2020 14:55:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jpCEn-0006IG-HR; Sat, 27 Jun 2020 14:55:25 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=MmMb=AI=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jpCEm-0006I0-63
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:55:24 +0000
X-Inumbo-ID: 3a645982-b886-11ea-8396-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 3a645982-b886-11ea-8396-12813bfff9fa;
 Sat, 27 Jun 2020 14:55: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=oqYctcz4B1Uth40dVVVD2QDiUR9I9wExFqtQ/y7J3VA=; b=BHiNmRpzT7i2K8S79ZCjGbJA1+
 PMOxV84LnIcy35cJnwk39QaHQR+BNIEtLUKPOOjLvbA54h1wsbcBkjypkU6BVKZortmoD1glFkLGO
 aLn3tJax2F4pM2jzjKfPz9SKYZSi4OFVGNVYzmuf4QzKhNMNAcf2nwhEM4r9vGQ3KiWY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCEl-0002y2-6b
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:55:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCEl-0007HC-5e
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:55:23 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.12] x86/spec-ctrl: Allow the RDRAND/RDSEED features to
 be hidden
Message-Id: <E1jpCEl-0007HC-5e@xenbits.xenproject.org>
Date: Sat, 27 Jun 2020 14:55: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 d58c48df8c6ca819f5e6e6f1740bb114f24f024f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 10 18:57:00 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jun 11 16:28:04 2020 +0100

    x86/spec-ctrl: Allow the RDRAND/RDSEED features to be hidden
    
    RDRAND/RDSEED can be hidden using cpuid= to mitigate SRBDS if microcode
    isn't available.
    
    This is part of XSA-320 / CVE-2020-0543.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    (cherry picked from commit 7028534d8482d25860c4d1aa8e45f0b911abfc5a)
---
 docs/misc/xen-command-line.pandoc | 10 ++++++++--
 xen/arch/x86/cpuid.c              | 10 ++++++++++
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 337fbf0492..7897da55ca 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -481,12 +481,18 @@ choice of `dom0-kernel` is deprecated and not supported by all Dom0 kernels.
 This option allows for fine tuning of the facilities Xen will use, after
 accounting for hardware capabilities as enumerated via CPUID.
 
+Unless otherwise noted, options only have any effect in their negative form,
+to hide the named feature(s).  Ignoring a feature using this mechanism will
+cause Xen not to use the feature, nor offer them as usable to guests.
+
 Currently accepted:
 
 The Speculation Control hardware features `srbds-ctrl`, `md-clear`, `ibrsb`,
 `stibp`, `ibpb`, `l1d-flush` and `ssbd` are used by default if available and
-applicable.  They can be ignored, e.g. `no-ibrsb`, at which point Xen won't
-use them itself, and won't offer them to guests.
+applicable.  They can all be ignored.
+
+`rdrand` and `rdseed` can be ignored, as a mitigation to XSA-320 /
+CVE-2020-0543.
 
 ### cpuid_mask_cpu
 > `= fam_0f_rev_[cdefg] | fam_10_rev_[bc] | fam_11_rev_b`
diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 22d8c71a95..d07567c901 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -64,6 +64,16 @@ static int __init parse_xen_cpuid(const char *s)
             if ( !val )
                 setup_clear_cpu_cap(X86_FEATURE_SRBDS_CTRL);
         }
+        else if ( (val = parse_boolean("rdrand", s, ss)) >= 0 )
+        {
+            if ( !val )
+                setup_clear_cpu_cap(X86_FEATURE_RDRAND);
+        }
+        else if ( (val = parse_boolean("rdseed", s, ss)) >= 0 )
+        {
+            if ( !val )
+                setup_clear_cpu_cap(X86_FEATURE_RDSEED);
+        }
         else
             rc = -EINVAL;
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Sat Jun 27 14:55:35 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Jun 2020 14: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 1jpCEx-0006JO-Ix; Sat, 27 Jun 2020 14:55:35 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=MmMb=AI=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jpCEv-0006J4-TZ
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:55:33 +0000
X-Inumbo-ID: 406cc01c-b886-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 406cc01c-b886-11ea-bb8b-bc764e2007e4;
 Sat, 27 Jun 2020 14:55: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=zXKywAFPFjboMgziTKIj7kXMydadyfsLyGz+KU+yRrM=; b=A5rnNJ44e/8aLb5pWUWmGoLD8Y
 lJV+GxUQobQ0XPrSFMBZtbzKD/E9hm3Q8fXuWqzjoAW6m1DIJ8rXRGjxMRA2lQwcbuX8ORgRtX3kN
 whsrxqtSJCI6vKnvg9aQ3b+LJPTg7/hJh3chXpewSUFJP4wap4D4tncHC5/fXk9wQBDg=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCEv-0002yG-9x
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:55:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCEv-0007Hs-91
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:55:33 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.12] tools/libxl: Fix memory leak in libxl_cpuid_set()
Message-Id: <E1jpCEv-0007Hs-91@xenbits.xenproject.org>
Date: Sat, 27 Jun 2020 14:55: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 06760c2bf322cef4622b56bafee74fe93ae01630
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jun 12 18:32:27 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Mon Jun 15 15:46:17 2020 +0100

    tools/libxl: Fix memory leak in libxl_cpuid_set()
    
    xc_cpuid_set() returns allocated memory via cpuid_res, which libxl needs to
    free() seeing as it discards the results.
    
    This is logically a backport of c/s b91825f628 "tools/libxc: Drop
    config_transformed parameter from xc_cpuid_set()" but rewritten as one caller
    of xc_cpuid_set() does use returned values.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    (cherry picked from commit c54de7d9df7718ea53bf21e1ff5bbd339602a704)
---
 tools/libxl/libxl_cpuid.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tools/libxl/libxl_cpuid.c b/tools/libxl/libxl_cpuid.c
index 88b5760c85..07995c81d1 100644
--- a/tools/libxl/libxl_cpuid.c
+++ b/tools/libxl/libxl_cpuid.c
@@ -404,12 +404,17 @@ void libxl_cpuid_apply_policy(libxl_ctx *ctx, uint32_t domid)
 void libxl_cpuid_set(libxl_ctx *ctx, uint32_t domid,
                      libxl_cpuid_policy_list cpuid)
 {
-    int i;
+    int i, j;
     char *cpuid_res[4];
 
     for (i = 0; cpuid[i].input[0] != XEN_CPUID_INPUT_UNUSED; i++)
+    {
         xc_cpuid_set(ctx->xch, domid, cpuid[i].input,
                      (const char**)(cpuid[i].policy), cpuid_res);
+
+        for (j = 0; j < ARRAY_SIZE(cpuid_res); ++j)
+            free(cpuid_res[j]);
+    }
 }
 
 static const char *input_names[2] = { "leaf", "subleaf" };
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Sat Jun 27 14:55:45 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Jun 2020 14:55:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jpCF7-0006Kd-Kv; Sat, 27 Jun 2020 14:55:45 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=MmMb=AI=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jpCF5-0006KL-Uo
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:55:43 +0000
X-Inumbo-ID: 466c72c8-b886-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 466c72c8-b886-11ea-bb8b-bc764e2007e4;
 Sat, 27 Jun 2020 14:55: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=0ZIM0eWP8UFqp8pJYYJCtWjHBrU9pQz2lo4uO1z165g=; b=y9Yj56Bsfzw8dSssVG+Xg/u6Ta
 Kpc8+OL8wpSJPtvSftBlKwcm7kfOxLWLjRP20zSYbvGoebpYJiPPzK4lT+yoYOOXmx29q60j8zw7I
 /AXXFAYVHzltXCGYadKWlPnxb/xjKyS/Tuxk1j0jrbr9ZfHeingFxsWfsE+FtgcfYENY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCF5-0002zJ-D9
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:55:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCF5-0007IU-CI
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:55:43 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.12] update Xen version to 4.12.4-pre
Message-Id: <E1jpCF5-0007IU-CI@xenbits.xenproject.org>
Date: Sat, 27 Jun 2020 14:55: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 be5c240252cb2b8ed2663b6a239e9bbd0700a3a2
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jun 24 16:55:04 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:55:04 2020 +0200

    update Xen version to 4.12.4-pre
---
 xen/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/Makefile b/xen/Makefile
index baa61cd27b..25e8014dba 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -2,7 +2,7 @@
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 12
-export XEN_EXTRAVERSION ?= .3$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .4-pre$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Sat Jun 27 14:55:55 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Jun 2020 14:55:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jpCFH-0006Ls-Nm; Sat, 27 Jun 2020 14:55:55 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=MmMb=AI=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jpCFG-0006Lj-3E
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:55:54 +0000
X-Inumbo-ID: 4c6f0bb8-b886-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 4c6f0bb8-b886-11ea-8496-bc764e2007e4;
 Sat, 27 Jun 2020 14:55: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=CeK/QF4imsopjOGB9UJoArXGYFpN0OAmL2ILsRS6XhQ=; b=perwVE5YPOkiDeoYoIwN19hyvj
 BQ+89PTeERgSOXY5UqrqyXaICTNUGJpGM5GLpHnrxpjytjga6ECnKIr2lA1cEwqzCcirZwDByzo6D
 8CfgP6kpuaqaJxZVfahunoY8v27ckfe6D1fEaSnlLMRy27QOT6ZooYdFu3dA4klA73Bs=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCFF-0002zV-GU
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:55:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCFF-0007J2-FW
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:55:53 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.12] x86/cpuidle: correct Cannon Lake residency MSRs
Message-Id: <E1jpCFF-0007J2-FW@xenbits.xenproject.org>
Date: Sat, 27 Jun 2020 14:55: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 bc775d06d0e6d26eb2ba476d03cfb474c7b7aba6
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jun 24 16:57:39 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:57:39 2020 +0200

    x86/cpuidle: correct Cannon Lake residency MSRs
    
    As per SDM rev 071 Cannon Lake has
    - no CC3 residency MSR at 3FC,
    - a CC1 residency MSR ar 660 (like various Atoms),
    - a useless (always zero) CC3 residency MSR at 662.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 9ff09aefc46385dc04c38b6dd1f1ac25f784f482
    master date: 2020-04-03 17:15:58 +0200
---
 xen/arch/x86/acpi/cpu_idle.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c
index 14b02789c5..121aab2ce8 100644
--- a/xen/arch/x86/acpi/cpu_idle.c
+++ b/xen/arch/x86/acpi/cpu_idle.c
@@ -69,7 +69,7 @@
 #define GET_PC8_RES(val)  GET_HW_RES_IN_NS(0x630, val) /* some Haswells only */
 #define GET_PC9_RES(val)  GET_HW_RES_IN_NS(0x631, val) /* some Haswells only */
 #define GET_PC10_RES(val) GET_HW_RES_IN_NS(0x632, val) /* some Haswells only */
-#define GET_CC1_RES(val)  GET_HW_RES_IN_NS(0x660, val) /* Silvermont only */
+#define GET_CC1_RES(val)  GET_HW_RES_IN_NS(0x660, val)
 #define GET_CC3_RES(val)  GET_HW_RES_IN_NS(0x3FC, val)
 #define GET_CC6_RES(val)  GET_HW_RES_IN_NS(0x3FD, val)
 #define GET_CC7_RES(val)  GET_HW_RES_IN_NS(0x3FE, val) /* SNB onwards */
@@ -165,8 +165,6 @@ static void do_get_hw_residencies(void *arg)
     case 0x4E:
     case 0x55:
     case 0x5E:
-    /* Cannon Lake */
-    case 0x66:
     /* Kaby Lake */
     case 0x8E:
     case 0x9E:
@@ -188,6 +186,16 @@ static void do_get_hw_residencies(void *arg)
         GET_CC3_RES(hw_res->cc3);
         GET_CC6_RES(hw_res->cc6);
         break;
+    /* Cannon Lake */
+    case 0x66:
+        GET_PC2_RES(hw_res->pc2);
+        GET_PC3_RES(hw_res->pc3);
+        GET_PC6_RES(hw_res->pc6);
+        GET_PC7_RES(hw_res->pc7);
+        GET_CC1_RES(hw_res->cc1);
+        GET_CC6_RES(hw_res->cc6);
+        GET_CC7_RES(hw_res->cc7);
+        break;
     /* Xeon Phi Knights Landing */
     case 0x57:
     /* Xeon Phi Knights Mill */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Sat Jun 27 14:56:06 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Jun 2020 14: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 1jpCFS-0006N2-PI; Sat, 27 Jun 2020 14: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=MmMb=AI=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jpCFR-0006Ms-Ki
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:56:05 +0000
X-Inumbo-ID: 527a8c44-b886-11ea-8396-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 527a8c44-b886-11ea-8396-12813bfff9fa;
 Sat, 27 Jun 2020 14:56: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=tuL7CPJEPjqWw00NorVSG70Jgfoar22vDqogN7cWp5Y=; b=Ttu0L6lULt6WNch9HgaSinIZYE
 u5fg35CwJCLJqNBxq+ottVoVYXYQhtceSPhm8/I8fQjUubIlc5mc0Z+6NCJZWG96maGHWKrF1qMGC
 usEypCLovjn1ooyfYfg/TCNvKyT3wlAm6Fvirk2LgxQ1lgFWq+/Zrs/djD4RKH9VPXF4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCFP-00030G-Jh
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:56:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCFP-0007Jn-Iv
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:56:03 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.12] x86/guest: Fix assembler warnings with newer
 binutils
Message-Id: <E1jpCFP-0007Jn-Iv@xenbits.xenproject.org>
Date: Sat, 27 Jun 2020 14:56: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 dd49ddf0eb2c61a38fd1174084103c0cceae254e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 24 16:58:22 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:58:22 2020 +0200

    x86/guest: Fix assembler warnings with newer binutils
    
    GAS of at least version 2.34 complains:
    
      hypercall_page.S: Assembler messages:
      hypercall_page.S:24: Warning: symbol 'HYPERCALL_set_trap_table' already has its type set
      ...
      hypercall_page.S:71: Warning: symbol 'HYPERCALL_arch_7' already has its type set
    
    which is because the whole page is declared as STT_OBJECT already.  Rearrange
    .set with respect to .type in DECLARE_HYPERCALL() so STT_FUNC is already in
    place.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/guest/hypercall_page.S | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/guest/hypercall_page.S b/xen/arch/x86/guest/hypercall_page.S
index 26afabf909..21408a69e8 100644
--- a/xen/arch/x86/guest/hypercall_page.S
+++ b/xen/arch/x86/guest/hypercall_page.S
@@ -17,9 +17,9 @@ GLOBAL(hypercall_page)
  */
 #define DECLARE_HYPERCALL(name)                                                 \
         .globl HYPERCALL_ ## name;                                              \
-        .set   HYPERCALL_ ## name, hypercall_page + __HYPERVISOR_ ## name * 32; \
         .type  HYPERCALL_ ## name, STT_FUNC;                                    \
-        .size  HYPERCALL_ ## name, 32
+        .size  HYPERCALL_ ## name, 32;                                          \
+        .set   HYPERCALL_ ## name, hypercall_page + __HYPERVISOR_ ## name * 32
 
 DECLARE_HYPERCALL(set_trap_table)
 DECLARE_HYPERCALL(mmu_update)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Sat Jun 27 14:56:15 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Jun 2020 14:56:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jpCFb-0006Oh-Qu; Sat, 27 Jun 2020 14:56: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=MmMb=AI=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jpCFa-0006OX-9v
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:56:14 +0000
X-Inumbo-ID: 58781b48-b886-11ea-8396-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 58781b48-b886-11ea-8396-12813bfff9fa;
 Sat, 27 Jun 2020 14:56: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=paEYexxgX6uOugn0G2YKCa7QvNWgKeF16hGndwaJ984=; b=OkjS1H2AxVr7axPjIE0vSI7mX/
 T4LkJQpkJM98qkwqpEPTmdsVJcexU83rvfeYrZfSlM7nxfOwXP+21wVELCxhaobK40692bo8tt6p5
 l5+VdhQJ4GRDoWGzam+7wDX6F8yDJYh98zp2M8JWKclgkgNVBMd+89D66e/v6Wibuw+U=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCFZ-00030P-Mo
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:56:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCFZ-0007KI-Lz
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:56:13 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.12] x86/build32: Discard all orphaned sections
Message-Id: <E1jpCFZ-0007KI-Lz@xenbits.xenproject.org>
Date: Sat, 27 Jun 2020 14:56: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 a022f3679aae642d702f9ef3137c8d3db46018a7
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 24 16:58:51 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:58:51 2020 +0200

    x86/build32: Discard all orphaned sections
    
    Linkers may put orphaned sections ahead of .text, which breaks the calling
    requirements.  A concrete example is Ubuntu's GCC-9 default of enabling
    -fcf-protection which causes us to try and execute .note.gnu.properties during
    Xen's boot.
    
    Put .got.plt in its own section as it specifically needs preserving from the
    linkers point of view, and discard everything else.  This will hopefully be
    more robust to other unexpected toolchain properties.
    
    Fixes boot from an Ubuntu build of Xen.
    
    Reported-by: Jason Andryuk <jandryuk@gmail.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Tested-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/boot/build32.lds | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/boot/build32.lds b/xen/arch/x86/boot/build32.lds
index da35aee910..97454b40ff 100644
--- a/xen/arch/x86/boot/build32.lds
+++ b/xen/arch/x86/boot/build32.lds
@@ -31,7 +31,7 @@ SECTIONS
         *(.bss.*)
   }
 
-  /DISCARD/ : {
+  .got.plt : {
         /*
          * PIC/PIE executable contains .got.plt section even if it is not linked
          * with dynamic libraries. In such case it is just placeholder for
@@ -47,6 +47,14 @@ SECTIONS
          *
          * Please check build32.mk for more details.
          */
-        /* *(.got.plt) */
+        *(.got.plt)
+  }
+
+  /DISCARD/ : {
+        /*
+         * Discard everything else, to prevent linkers from putting
+         * orphaned sections ahead of .text, which needs to be first.
+         */
+        *(*)
   }
 }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Sat Jun 27 14:56:28 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Jun 2020 14: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 1jpCFo-0006QL-Sk; Sat, 27 Jun 2020 14: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=MmMb=AI=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jpCFn-0006QB-9w
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:56:27 +0000
X-Inumbo-ID: 5e378943-b886-11ea-8396-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 5e378943-b886-11ea-8396-12813bfff9fa;
 Sat, 27 Jun 2020 14:56: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=qmY7dDZaauUpWMPx/kj/QCEelA4IcpSkoABZWfJ0NjI=; b=t/wdIZtxoQg6FjfGu/k7jyzNds
 8cyE5hQaLhlVzdgGvonkoTtFeSMPRbWaoCzB00FM2F33W4Q06w9aSu1jDdukn5qckQMqOAK9i0n2t
 eys/FELw1G1lnhUyTdsHyLrc53sM29sH4Z1kagYWf5y6MdGKoA0kcmBHHCdrcav69gNc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCFj-00030X-Qq
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:56:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCFj-0007Kr-PG
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:56:23 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.12] x86/build: move -fno-asynchronous-unwind-tables
 into EMBEDDED_EXTRA_CFLAGS
Message-Id: <E1jpCFj-0007Kr-PG@xenbits.xenproject.org>
Date: Sat, 27 Jun 2020 14:56: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 2b10a3238ad1e339b8238e4ee7fe7fad210f4588
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 24 16:59:21 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:59:21 2020 +0200

    x86/build: move -fno-asynchronous-unwind-tables into EMBEDDED_EXTRA_CFLAGS
    
    Users of EMBEDDED_EXTRA_CFLAGS already use -fno-asynchronous-unwind-tables, or
    ought to.  This shrinks the size of the rombios 32bit stubs in guest memory.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 Config.mk                            | 2 +-
 tools/tests/x86_emulator/testcase.mk | 2 +-
 xen/arch/x86/Rules.mk                | 2 +-
 xen/arch/x86/boot/build32.mk         | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Config.mk b/Config.mk
index 0298482ca6..952b398174 100644
--- a/Config.mk
+++ b/Config.mk
@@ -235,7 +235,7 @@ APPEND_LDFLAGS += $(foreach i, $(APPEND_LIB), -L$(i))
 APPEND_CFLAGS += $(foreach i, $(APPEND_INCLUDES), -I$(i))
 
 EMBEDDED_EXTRA_CFLAGS := -nopie -fno-stack-protector -fno-stack-protector-all
-EMBEDDED_EXTRA_CFLAGS += -fno-exceptions
+EMBEDDED_EXTRA_CFLAGS += -fno-exceptions -fno-asynchronous-unwind-tables
 
 XEN_EXTFILES_URL ?= http://xenbits.xen.org/xen-extfiles
 # All the files at that location were downloaded from elsewhere on
diff --git a/tools/tests/x86_emulator/testcase.mk b/tools/tests/x86_emulator/testcase.mk
index a565d15524..dafeb6caf7 100644
--- a/tools/tests/x86_emulator/testcase.mk
+++ b/tools/tests/x86_emulator/testcase.mk
@@ -4,7 +4,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 $(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
 
-CFLAGS += -fno-builtin -fno-asynchronous-unwind-tables -g0 $($(TESTCASE)-cflags)
+CFLAGS += -fno-builtin -g0 $($(TESTCASE)-cflags)
 
 .PHONY: all
 all: $(TESTCASE).bin
diff --git a/xen/arch/x86/Rules.mk b/xen/arch/x86/Rules.mk
index 3f2687bbe4..1455ac904c 100644
--- a/xen/arch/x86/Rules.mk
+++ b/xen/arch/x86/Rules.mk
@@ -33,7 +33,7 @@ $(call as-option-add,CFLAGS,CC,\
 $(call as-option-add,CFLAGS,CC,\
     ".L1: .L2: .nops (.L2 - .L1)$$(comma)9",-DHAVE_AS_NOPS_DIRECTIVE)
 
-CFLAGS += -mno-red-zone -fpic -fno-asynchronous-unwind-tables
+CFLAGS += -mno-red-zone -fpic
 
 # Xen doesn't use SSE interally.  If the compiler supports it, also skip the
 # SSE setup for variadic function calls.
diff --git a/xen/arch/x86/boot/build32.mk b/xen/arch/x86/boot/build32.mk
index 48c7407c00..5851ebff5f 100644
--- a/xen/arch/x86/boot/build32.mk
+++ b/xen/arch/x86/boot/build32.mk
@@ -4,7 +4,7 @@ include $(XEN_ROOT)/Config.mk
 
 $(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
 
-CFLAGS += -Werror -fno-asynchronous-unwind-tables -fno-builtin -g0 -msoft-float
+CFLAGS += -Werror -fno-builtin -g0 -msoft-float
 CFLAGS += -I$(XEN_ROOT)/xen/include
 CFLAGS := $(filter-out -flto,$(CFLAGS)) 
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Sat Jun 27 14:56:35 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Jun 2020 14:56: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 1jpCFv-0006R8-US; Sat, 27 Jun 2020 14:56: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=MmMb=AI=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jpCFu-0006R0-He
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:56:34 +0000
X-Inumbo-ID: 64863640-b886-11ea-8396-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 64863640-b886-11ea-8396-12813bfff9fa;
 Sat, 27 Jun 2020 14:56: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=tVbwdrPHJNrnh7BTWIIV4K0ht3t/qLHXioW3O5MG8js=; b=WZUfz6gzwnPcs/S1JGnncPCAL1
 bA7K4BgIwn4L9Nw0XMJ9XaaX7U2qRWM2Vt1rpu/FZWjwaNRgFyXAw9yxYitr7BaYTsUy34wrYIBjZ
 2CIcBkX2I/EahOtqUp2WxXDY56yn53qCOrYGrH8VvOgjp4lr3/E/6VNWR+SQPzGYEAuw=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCFt-00030f-U7
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:56:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCFt-0007LQ-T8
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:56:33 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.12] x86/build: Unilaterally disable -fcf-protection
Message-Id: <E1jpCFt-0007LQ-T8@xenbits.xenproject.org>
Date: Sat, 27 Jun 2020 14:56: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 bcdaffc58987c943e553739b6bcbfa4323cc5bd8
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 24 16:59:49 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 16:59:49 2020 +0200

    x86/build: Unilaterally disable -fcf-protection
    
    Xen doesn't support CET-IBT yet.  At a minimum, logic is required to enable it
    for supervisor use, but the livepatch functionality needs to learn not to
    overwrite ENDBR64 instructions.
    
    Furthermore, Ubuntu enables -fcf-protection by default, along with a buggy
    version of GCC-9 which objects to it in combination with
    -mindirect-branch=thunk-extern (Fixed in GCC 10, 9.4).
    
    Various objects (Xen boot path, Rombios 32 stubs) require .text to be at the
    beginning of the object.  These paths explode when .note.gnu.properties gets
    put ahead of .text and we end up executing the notes data.
    
    Disable -fcf-protection for all embedded objects.
    
    Reported-by: Jason Andryuk <jandryuk@gmail.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 Config.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Config.mk b/Config.mk
index 952b398174..be5634f26e 100644
--- a/Config.mk
+++ b/Config.mk
@@ -236,6 +236,7 @@ APPEND_CFLAGS += $(foreach i, $(APPEND_INCLUDES), -I$(i))
 
 EMBEDDED_EXTRA_CFLAGS := -nopie -fno-stack-protector -fno-stack-protector-all
 EMBEDDED_EXTRA_CFLAGS += -fno-exceptions -fno-asynchronous-unwind-tables
+EMBEDDED_EXTRA_CFLAGS += -fcf-protection=none
 
 XEN_EXTFILES_URL ?= http://xenbits.xen.org/xen-extfiles
 # All the files at that location were downloaded from elsewhere on
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Sat Jun 27 14:56:46 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Jun 2020 14:56: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 1jpCG5-0006SP-W7; Sat, 27 Jun 2020 14:56: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=MmMb=AI=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jpCG4-0006SE-Ju
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:56:44 +0000
X-Inumbo-ID: 6a8f2d1c-b886-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 6a8f2d1c-b886-11ea-bb8b-bc764e2007e4;
 Sat, 27 Jun 2020 14:56: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=0PfACtl9T0EsmGCI0a5ahWXPOB7aJnsNlRU7y2hjSyI=; b=KAnH6jtMCM1ml4cmuJt/gqibeT
 BRld0nT/LwZBSNh36dNKjK++vOWdMOtZY3YwAM8N0RPIelyPw2nFz/B9tE+XUif5402Y7qj4uBkLx
 KW7bELJo8qnjtHiHLvM7Z3Nw/LAv2Viy2OQHR0CbNK3p8Znkvl7L1glN5e8NjVgf7gSc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCG4-00030o-18
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:56:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCG4-0007M8-0G
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:56:44 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.12] x86/hvm: Fix shifting in stdvga_mem_read()
Message-Id: <E1jpCG4-0007M8-0G@xenbits.xenproject.org>
Date: Sat, 27 Jun 2020 14:56: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 f769c99f923d0bba81626f4b50bb1e2ebc5ec9b9
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 24 17:00:33 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 17:00:33 2020 +0200

    x86/hvm: Fix shifting in stdvga_mem_read()
    
    stdvga_mem_read() has a return type of uint8_t, which promotes to int rather
    than unsigned int.  Shifting by 24 may hit the sign bit.
    
    Spotted by Coverity.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 97fb0253e6c2f2221bfd0895b7ffe3a99330d847
    master date: 2020-05-18 15:22:53 +0100
---
 xen/arch/x86/hvm/stdvga.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/stdvga.c b/xen/arch/x86/hvm/stdvga.c
index bd398dbb1b..e2675139e7 100644
--- a/xen/arch/x86/hvm/stdvga.c
+++ b/xen/arch/x86/hvm/stdvga.c
@@ -322,7 +322,7 @@ static int stdvga_mem_read(const struct hvm_io_handler *handler,
         data = stdvga_mem_readb(addr);
         data |= stdvga_mem_readb(addr + 1) << 8;
         data |= stdvga_mem_readb(addr + 2) << 16;
-        data |= stdvga_mem_readb(addr + 3) << 24;
+        data |= (uint32_t)stdvga_mem_readb(addr + 3) << 24;
         break;
 
     case 8:
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Sat Jun 27 14:56:56 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Jun 2020 14:56: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 1jpCGG-0006TU-1X; Sat, 27 Jun 2020 14:56: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=MmMb=AI=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jpCGE-0006TK-Nz
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:56:54 +0000
X-Inumbo-ID: 708ff656-b886-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 708ff656-b886-11ea-bb8b-bc764e2007e4;
 Sat, 27 Jun 2020 14:56: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=DqJKnsiYBlqZBRIxEdhxwBVFscG2SQUgs0/yZCW9aY4=; b=fXotg1hzSn6Xt22wmvFsN12gCT
 oqycA/lUYaoHmseXpVWQUYn3fs9Txrnn9MO6vxCUfHEWW8HuAFJYn/iLXdZmYYIkMBn1NJTrRVdET
 iwsuz4KgJkqXoJFrC8bp+XLQ4cn36TaI7LO9BQdyT6ie2ByXOL8VOwx1ZJud73HIea4c=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCGE-000311-4J
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:56:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCGE-0007Me-3R
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:56:54 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.12] x86: determine MXCSR mask in all cases
Message-Id: <E1jpCGE-0007Me-3R@xenbits.xenproject.org>
Date: Sat, 27 Jun 2020 14:56: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 b3af150fd42ed0a0723115063c028f21feab348a
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jun 24 17:01:10 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 17:01:10 2020 +0200

    x86: determine MXCSR mask in all cases
    
    For its use(s) by the emulator to be correct in all cases, the filling
    of the variable needs to be independent of XSAVE availability. As
    there's no suitable function in i387.c to put the logic in, keep it in
    xstate_init(), arrange for the function to be called unconditionally,
    and pull the logic ahead of all return paths there.
    
    Fixes: 9a4496a35b20 ("x86emul: support {,V}{LD,ST}MXCSR")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 2b532519d64e653a6bbfd9eefed6040a09c8876d
    master date: 2020-05-18 17:18:56 +0200
---
 xen/arch/x86/cpu/common.c |  3 +--
 xen/arch/x86/xstate.c     | 18 ++++++++++++------
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 851c23ddc5..f3a8c69020 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -488,8 +488,7 @@ void identify_cpu(struct cpuinfo_x86 *c)
 
 	/* Now the feature flags better reflect actual CPU features! */
 
-	if ( cpu_has_xsave )
-		xstate_init(c);
+	xstate_init(c);
 
 #ifdef NOISY_CAPS
 	printk(KERN_DEBUG "CPU: After all inits, caps:");
diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c
index 858d1a6573..1469292d27 100644
--- a/xen/arch/x86/xstate.c
+++ b/xen/arch/x86/xstate.c
@@ -584,6 +584,18 @@ void xstate_init(struct cpuinfo_x86 *c)
     u32 eax, ebx, ecx, edx;
     u64 feature_mask;
 
+    if ( bsp )
+    {
+        static typeof(current->arch.xsave_area->fpu_sse) __initdata ctxt;
+
+        asm ( "fxsave %0" : "=m" (ctxt) );
+        if ( ctxt.mxcsr_mask )
+            mxcsr_mask = ctxt.mxcsr_mask;
+    }
+
+    if ( !cpu_has_xsave )
+        return;
+
     if ( (bsp && !use_xsave) ||
          boot_cpu_data.cpuid_level < XSTATE_CPUID )
     {
@@ -607,8 +619,6 @@ void xstate_init(struct cpuinfo_x86 *c)
 
     if ( bsp )
     {
-        static typeof(current->arch.xsave_area->fpu_sse) __initdata ctxt;
-
         xfeature_mask = feature_mask;
         /*
          * xsave_cntxt_size is the max size required by enabled features.
@@ -617,10 +627,6 @@ void xstate_init(struct cpuinfo_x86 *c)
         xsave_cntxt_size = _xstate_ctxt_size(feature_mask);
         printk("xstate: size: %#x and states: %#"PRIx64"\n",
                xsave_cntxt_size, xfeature_mask);
-
-        asm ( "fxsave %0" : "=m" (ctxt) );
-        if ( ctxt.mxcsr_mask )
-            mxcsr_mask = ctxt.mxcsr_mask;
     }
     else
     {
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Sat Jun 27 14:57:07 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Jun 2020 14:57:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jpCGR-0006Ui-4v; Sat, 27 Jun 2020 14:57: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=MmMb=AI=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jpCGP-0006UZ-KB
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:57:05 +0000
X-Inumbo-ID: 7695fa8c-b886-11ea-8396-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 7695fa8c-b886-11ea-8396-12813bfff9fa;
 Sat, 27 Jun 2020 14:57: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=Ckc3TLfMzzE0YzaSVaii66Xha3AhgLzmgE/hzbHp+IA=; b=F3GIvi1KpxoUlS4EX+/K4kIu+n
 /BatpD2a15gfTmbUlhHQXU88mDquSlORDVhYdvp76J/5Q7c5q6X8GPZz38Ov5tXaqQ1BLKGFNmzKu
 vSv16Z3FEpXTHl3xCnmjqlJ+F7HrhDn2kMyY+BMNT0ro0wivNKHOFobd54sNug83NogE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCGO-000327-7X
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:57:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCGO-0007NP-6n
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:57:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.12] x86/idle: rework C6 EOI workaround
Message-Id: <E1jpCGO-0007NP-6n@xenbits.xenproject.org>
Date: Sat, 27 Jun 2020 14:57: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 2eb277ec762f59581a581571d6e3c170eef5d324
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Jun 24 17:01:48 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 17:01:48 2020 +0200

    x86/idle: rework C6 EOI workaround
    
    Change the C6 EOI workaround (errata AAJ72) to use x86_match_cpu. Also
    call the workaround from mwait_idle, previously it was only used by
    the ACPI idle driver. Finally make sure the routine is called for all
    states equal or greater than ACPI_STATE_C3, note that the ACPI driver
    doesn't currently handle them, but the errata condition shouldn't be
    limited by that.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 5fef1fd713660406a6187ef352fbf79986abfe43
    master date: 2020-05-20 12:48:37 +0200
---
 xen/arch/x86/acpi/cpu_idle.c  | 43 ++++++++++++++++++++++++++-----------------
 xen/arch/x86/cpu/mwait-idle.c |  3 +++
 xen/include/asm-x86/cpuidle.h |  2 ++
 3 files changed, 31 insertions(+), 17 deletions(-)

diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c
index 121aab2ce8..bc8a7c6568 100644
--- a/xen/arch/x86/acpi/cpu_idle.c
+++ b/xen/arch/x86/acpi/cpu_idle.c
@@ -515,26 +515,35 @@ void trace_exit_reason(u32 *irq_traced)
     }
 }
 
-/*
- * "AAJ72. EOI Transaction May Not be Sent if Software Enters Core C6 During 
- * an Interrupt Service Routine"
- * 
- * There was an errata with some Core i7 processors that an EOI transaction 
- * may not be sent if software enters core C6 during an interrupt service 
- * routine. So we don't enter deep Cx state if there is an EOI pending.
- */
-static bool errata_c6_eoi_workaround(void)
+bool errata_c6_eoi_workaround(void)
 {
-    static int8_t fix_needed = -1;
+    static int8_t __read_mostly fix_needed = -1;
 
     if ( unlikely(fix_needed == -1) )
     {
-        int model = boot_cpu_data.x86_model;
-        fix_needed = (cpu_has_apic && !directed_eoi_enabled &&
-                      (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) &&
-                      (boot_cpu_data.x86 == 6) &&
-                      ((model == 0x1a) || (model == 0x1e) || (model == 0x1f) ||
-                       (model == 0x25) || (model == 0x2c) || (model == 0x2f)));
+#define INTEL_FAM6_MODEL(m) { X86_VENDOR_INTEL, 6, m, X86_FEATURE_ALWAYS }
+        /*
+         * Errata AAJ72: EOI Transaction May Not be Sent if Software Enters
+         * Core C6 During an Interrupt Service Routine"
+         *
+         * There was an errata with some Core i7 processors that an EOI
+         * transaction may not be sent if software enters core C6 during an
+         * interrupt service routine. So we don't enter deep Cx state if
+         * there is an EOI pending.
+         */
+        static const struct x86_cpu_id eoi_errata[] = {
+            INTEL_FAM6_MODEL(0x1a),
+            INTEL_FAM6_MODEL(0x1e),
+            INTEL_FAM6_MODEL(0x1f),
+            INTEL_FAM6_MODEL(0x25),
+            INTEL_FAM6_MODEL(0x2c),
+            INTEL_FAM6_MODEL(0x2f),
+            { }
+        };
+#undef INTEL_FAM6_MODEL
+
+        fix_needed = cpu_has_apic && !directed_eoi_enabled &&
+                     x86_match_cpu(eoi_errata);
     }
 
     return (fix_needed && cpu_has_pending_apic_eoi());
@@ -627,7 +636,7 @@ static void acpi_processor_idle(void)
         return;
     }
 
-    if ( (cx->type == ACPI_STATE_C3) && errata_c6_eoi_workaround() )
+    if ( (cx->type >= ACPI_STATE_C3) && errata_c6_eoi_workaround() )
         cx = power->safe_state;
 
 
diff --git a/xen/arch/x86/cpu/mwait-idle.c b/xen/arch/x86/cpu/mwait-idle.c
index f89c52f256..a3e286162f 100644
--- a/xen/arch/x86/cpu/mwait-idle.c
+++ b/xen/arch/x86/cpu/mwait-idle.c
@@ -763,6 +763,9 @@ static void mwait_idle(void)
 		return;
 	}
 
+	if ((cx->type >= 3) && errata_c6_eoi_workaround())
+		cx = power->safe_state;
+
 	eax = cx->address;
 	cstate = ((eax >> MWAIT_SUBSTATE_SIZE) & MWAIT_CSTATE_MASK) + 1;
 
diff --git a/xen/include/asm-x86/cpuidle.h b/xen/include/asm-x86/cpuidle.h
index 08da01803f..007fe38563 100644
--- a/xen/include/asm-x86/cpuidle.h
+++ b/xen/include/asm-x86/cpuidle.h
@@ -26,6 +26,8 @@ void update_idle_stats(struct acpi_processor_power *,
 void update_last_cx_stat(struct acpi_processor_power *,
                          struct acpi_processor_cx *, uint64_t);
 
+bool errata_c6_eoi_workaround(void);
+
 /*
  * vcpu is urgent if vcpu is polling event channel
  *
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Sat Jun 27 14:57:16 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Jun 2020 14:57: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 1jpCGa-0006W6-6N; Sat, 27 Jun 2020 14:57: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=MmMb=AI=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jpCGZ-0006Vz-2H
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:57:15 +0000
X-Inumbo-ID: 7c9af28e-b886-11ea-8396-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 7c9af28e-b886-11ea-8396-12813bfff9fa;
 Sat, 27 Jun 2020 14:57: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=w0yLcu09BWqpDOZ+y9PNgtIvxmTAb5xnjEGiuLdDsgU=; b=PJ5RZy+gCWnF20ZsOhZaELMdpO
 K5bKTgKINGCTp0EN8WHRycJ68El81WpUAYIVykYNeg5+744gdgUBHj84HUBhmXyJ6wBTLVu37R/o7
 63MFzI4OJwDcMQqB25OUyyQBghwkKKGvpoEt6knsZi8N+2qmeX156eEmT/DFL6NOQHyo=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCGY-00032F-Aj
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:57:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCGY-0007O2-A4
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:57:14 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.12] x86/idle: prevent entering C6 with in service
 interrupts on Intel
Message-Id: <E1jpCGY-0007O2-A4@xenbits.xenproject.org>
Date: Sat, 27 Jun 2020 14:57: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 ed44947e18ebdc7f345fbc36918febd77f7d5775
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Jun 24 17:02:23 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 17:02:23 2020 +0200

    x86/idle: prevent entering C6 with in service interrupts on Intel
    
    Apply a workaround for Intel errata BDX99, CLX30, SKX100, CFW125,
    BDF104, BDH85, BDM135, KWB131: "A Pending Fixed Interrupt May Be
    Dispatched Before an Interrupt of The Same Priority Completes".
    
    Apply the errata to all server and client models (big cores) from
    Broadwell to Cascade Lake. The workaround is grouped together with the
    existing fix for errata AAJ72, and the eoi from the function name is
    removed.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: fc44a7014cafe28b8c53eeaf6ac2a71f5bc8b815
    master date: 2020-05-22 16:07:38 +0200
---
 xen/arch/x86/acpi/cpu_idle.c  | 38 ++++++++++++++++++++++++++++++++++----
 xen/arch/x86/cpu/mwait-idle.c |  2 +-
 xen/include/asm-x86/cpuidle.h |  2 +-
 3 files changed, 36 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c
index bc8a7c6568..e879f8dfe9 100644
--- a/xen/arch/x86/acpi/cpu_idle.c
+++ b/xen/arch/x86/acpi/cpu_idle.c
@@ -515,7 +515,7 @@ void trace_exit_reason(u32 *irq_traced)
     }
 }
 
-bool errata_c6_eoi_workaround(void)
+bool errata_c6_workaround(void)
 {
     static int8_t __read_mostly fix_needed = -1;
 
@@ -540,10 +540,40 @@ bool errata_c6_eoi_workaround(void)
             INTEL_FAM6_MODEL(0x2f),
             { }
         };
+        /*
+         * Errata BDX99, CLX30, SKX100, CFW125, BDF104, BDH85, BDM135, KWB131:
+         * A Pending Fixed Interrupt May Be Dispatched Before an Interrupt of
+         * The Same Priority Completes.
+         *
+         * Resuming from C6 Sleep-State, with Fixed Interrupts of the same
+         * priority queued (in the corresponding bits of the IRR and ISR APIC
+         * registers), the processor may dispatch the second interrupt (from
+         * the IRR bit) before the first interrupt has completed and written to
+         * the EOI register, causing the first interrupt to never complete.
+         */
+        static const struct x86_cpu_id isr_errata[] = {
+            /* Broadwell */
+            INTEL_FAM6_MODEL(0x47),
+            INTEL_FAM6_MODEL(0x3d),
+            INTEL_FAM6_MODEL(0x4f),
+            INTEL_FAM6_MODEL(0x56),
+            /* Skylake (client) */
+            INTEL_FAM6_MODEL(0x5e),
+            INTEL_FAM6_MODEL(0x4e),
+            /* {Sky/Cascade}lake (server) */
+            INTEL_FAM6_MODEL(0x55),
+            /* {Kaby/Coffee/Whiskey/Amber} Lake */
+            INTEL_FAM6_MODEL(0x9e),
+            INTEL_FAM6_MODEL(0x8e),
+            /* Cannon Lake */
+            INTEL_FAM6_MODEL(0x66),
+            { }
+        };
 #undef INTEL_FAM6_MODEL
 
-        fix_needed = cpu_has_apic && !directed_eoi_enabled &&
-                     x86_match_cpu(eoi_errata);
+        fix_needed = cpu_has_apic &&
+                     ((!directed_eoi_enabled && x86_match_cpu(eoi_errata)) ||
+                      x86_match_cpu(isr_errata));
     }
 
     return (fix_needed && cpu_has_pending_apic_eoi());
@@ -636,7 +666,7 @@ static void acpi_processor_idle(void)
         return;
     }
 
-    if ( (cx->type >= ACPI_STATE_C3) && errata_c6_eoi_workaround() )
+    if ( (cx->type >= ACPI_STATE_C3) && errata_c6_workaround() )
         cx = power->safe_state;
 
 
diff --git a/xen/arch/x86/cpu/mwait-idle.c b/xen/arch/x86/cpu/mwait-idle.c
index a3e286162f..bf058777fd 100644
--- a/xen/arch/x86/cpu/mwait-idle.c
+++ b/xen/arch/x86/cpu/mwait-idle.c
@@ -763,7 +763,7 @@ static void mwait_idle(void)
 		return;
 	}
 
-	if ((cx->type >= 3) && errata_c6_eoi_workaround())
+	if ((cx->type >= 3) && errata_c6_workaround())
 		cx = power->safe_state;
 
 	eax = cx->address;
diff --git a/xen/include/asm-x86/cpuidle.h b/xen/include/asm-x86/cpuidle.h
index 007fe38563..b5faac0051 100644
--- a/xen/include/asm-x86/cpuidle.h
+++ b/xen/include/asm-x86/cpuidle.h
@@ -26,7 +26,7 @@ void update_idle_stats(struct acpi_processor_power *,
 void update_last_cx_stat(struct acpi_processor_power *,
                          struct acpi_processor_cx *, uint64_t);
 
-bool errata_c6_eoi_workaround(void);
+bool errata_c6_workaround(void);
 
 /*
  * vcpu is urgent if vcpu is polling event channel
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Sat Jun 27 14:57:26 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Jun 2020 14:57: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 1jpCGk-0006XH-7v; Sat, 27 Jun 2020 14:57: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=MmMb=AI=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jpCGj-0006X5-1v
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:57:25 +0000
X-Inumbo-ID: 829faed6-b886-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 829faed6-b886-11ea-8496-bc764e2007e4;
 Sat, 27 Jun 2020 14:57: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=dwI2gd9hXx5y3106qMj1SvhJpTKURZM78DY2IfISgR8=; b=rIaiMoadAArQxKpmHsWUod3Lru
 G2gJ+gkIuHNAL870thYuwpxHs6i8aV3ZsPp09ed4zQy5uUWvgPxFT2+VIXCrjq+m3mGd7lhzOLgZx
 Tef0TGbJiblNZVnO0sN7U7qSZxLZqblXDOfLAYyYNjpUPsUiMNe/3bbOqmFTSk3rMjrQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCGi-00032O-Dw
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:57:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCGi-0007OU-DF
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:57:24 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.12] x86/idle: prevent entering C3/C6 on some Intel CPUs
 due to errata
Message-Id: <E1jpCGi-0007OU-DF@xenbits.xenproject.org>
Date: Sat, 27 Jun 2020 14:57: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 4969f34b496bff1185e5280cedb4fe99112e3066
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Jun 24 17:02:55 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 17:02:55 2020 +0200

    x86/idle: prevent entering C3/C6 on some Intel CPUs due to errata
    
    Apply a workaround for errata BA80, AAK120, AAM108, AAO67, BD59,
    AAY54: Rapid Core C3/C6 Transition May Cause Unpredictable System
    Behavior.
    
    Limit maximum C state to C1 when SMT is enabled on the affected CPUs.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: b2d502466547e6782ccadd501b8ef1482c391f2c
    master date: 2020-05-22 16:08:54 +0200
---
 xen/arch/x86/cpu/intel.c | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/xen/arch/x86/cpu/intel.c b/xen/arch/x86/cpu/intel.c
index 29c6b87512..986748b155 100644
--- a/xen/arch/x86/cpu/intel.c
+++ b/xen/arch/x86/cpu/intel.c
@@ -262,6 +262,41 @@ static void early_init_intel(struct cpuinfo_x86 *c)
 	ctxt_switch_levelling(NULL);
 }
 
+/*
+ * Errata BA80, AAK120, AAM108, AAO67, BD59, AAY54: Rapid Core C3/C6 Transition
+ * May Cause Unpredictable System Behavior
+ *
+ * Under a complex set of internal conditions, cores rapidly performing C3/C6
+ * transitions in a system with Intel Hyper-Threading Technology enabled may
+ * cause a machine check error (IA32_MCi_STATUS.MCACOD = 0x0106), system hang
+ * or unpredictable system behavior.
+ */
+static void probe_c3_errata(const struct cpuinfo_x86 *c)
+{
+#define INTEL_FAM6_MODEL(m) { X86_VENDOR_INTEL, 6, m, X86_FEATURE_ALWAYS }
+    static const struct x86_cpu_id models[] = {
+        /* Nehalem */
+        INTEL_FAM6_MODEL(0x1a),
+        INTEL_FAM6_MODEL(0x1e),
+        INTEL_FAM6_MODEL(0x1f),
+        INTEL_FAM6_MODEL(0x2e),
+        /* Westmere (note Westmere-EX is not affected) */
+        INTEL_FAM6_MODEL(0x2c),
+        INTEL_FAM6_MODEL(0x25),
+        { }
+    };
+#undef INTEL_FAM6_MODEL
+
+    /* Serialized by the AP bringup code. */
+    if ( max_cstate > 1 && (c->apicid & (c->x86_num_siblings - 1)) &&
+         x86_match_cpu(models) )
+    {
+        printk(XENLOG_WARNING
+	       "Disabling C-states C3 and C6 due to CPU errata\n");
+        max_cstate = 1;
+    }
+}
+
 /*
  * P4 Xeon errata 037 workaround.
  * Hardware prefetcher may cause stale data to be loaded into the cache.
@@ -289,6 +324,8 @@ static void Intel_errata_workarounds(struct cpuinfo_x86 *c)
 
 	if (cpu_has_tsx_force_abort && opt_rtm_abort)
 		wrmsrl(MSR_TSX_FORCE_ABORT, TSX_FORCE_ABORT_RTM);
+
+	probe_c3_errata(c);
 }
 
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Sat Jun 27 14:57:36 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Jun 2020 14:57: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 1jpCGu-0006YL-9d; Sat, 27 Jun 2020 14:57: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=MmMb=AI=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jpCGt-0006YB-6i
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:57:35 +0000
X-Inumbo-ID: 88a43338-b886-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 88a43338-b886-11ea-bb8b-bc764e2007e4;
 Sat, 27 Jun 2020 14:57: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=aNXvDM10OdXk235BvCjJoOzDqMy5yNLrAzJdQlw1CXc=; b=cyFYvbtUhUDJSFumchvIXCh7L6
 2kpUqwts16g3UX+Yawz1TKel8jRFuPJmone44ZnasCSrijaqT0FbcKZpA6cXiukxrSRI7F0Y7wu/i
 6PPWyX24fl6wQxJUhOaB15A+vMmF15SvxoA6Fawcs3fbGyQnOBZrB6gpNvKUczX2m2P8=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCGs-00032Y-HB
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:57:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCGs-0007P6-GL
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:57:34 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.12] x86/idle: Extend ISR/C6 erratum workaround to
 Haswell
Message-Id: <E1jpCGs-0007P6-GL@xenbits.xenproject.org>
Date: Sat, 27 Jun 2020 14:57: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 1f581f966a789c29d05dd7d9d58d98dba06c01c9
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 24 17:03:30 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 17:03:30 2020 +0200

    x86/idle: Extend ISR/C6 erratum workaround to Haswell
    
    This bug was first discovered against Haswell.  It is definitely affected.
    
    (The XenServer ticket for this bug was opened on 2013-05-30 which is coming up
    on 7 years old, and predates Broadwell).
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: b72d8870b5f68f06b083e6bfdb28f081bcb6ab3b
    master date: 2020-05-22 20:04:23 +0100
---
 xen/arch/x86/acpi/cpu_idle.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c
index e879f8dfe9..4ff8693ae6 100644
--- a/xen/arch/x86/acpi/cpu_idle.c
+++ b/xen/arch/x86/acpi/cpu_idle.c
@@ -550,8 +550,16 @@ bool errata_c6_workaround(void)
          * registers), the processor may dispatch the second interrupt (from
          * the IRR bit) before the first interrupt has completed and written to
          * the EOI register, causing the first interrupt to never complete.
+         *
+         * Note: Haswell hasn't had errata issued, but this issue was first
+         * discovered on Haswell hardware, and is affected.
          */
         static const struct x86_cpu_id isr_errata[] = {
+            /* Haswell */
+            INTEL_FAM6_MODEL(0x3c),
+            INTEL_FAM6_MODEL(0x3f),
+            INTEL_FAM6_MODEL(0x45),
+            INTEL_FAM6_MODEL(0x46),
             /* Broadwell */
             INTEL_FAM6_MODEL(0x47),
             INTEL_FAM6_MODEL(0x3d),
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Sat Jun 27 14:57:46 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Jun 2020 14:57: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 1jpCH4-0006Zb-BC; Sat, 27 Jun 2020 14:57: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=MmMb=AI=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jpCH3-0006ZM-Fp
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:57:45 +0000
X-Inumbo-ID: 8eabeaaa-b886-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 8eabeaaa-b886-11ea-bb8b-bc764e2007e4;
 Sat, 27 Jun 2020 14:57: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=ebz4pyKF1eFnHCtAsAcgTujjkZZAJTaMaFfA+9oNuMY=; b=dsuT5vlKMFl8r7WpeMMmgEwSq+
 wZw7Dim/tUXekBQJ9LQgLAR8fa7fkTzDvYTLKLXXTkNM4zkiZfWNPQ6j4/rLtP9cWWq4Cz1kspc25
 GQs7npsRk8em1ZPqF6WjPbjpmZlolrV/o/F9iKyZvVcZhQAwd6Cd8dotrZmewmfMvcfY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCH2-00032g-Kf
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:57:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCH2-0007Pl-Js
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:57:44 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.12] x86: clear RDRAND CPUID bit on AMD family 15h/16h
Message-Id: <E1jpCH2-0007Pl-Js@xenbits.xenproject.org>
Date: Sat, 27 Jun 2020 14:57: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 aca68b9ca9a39e88f42a35cd9aae1ce5d08d6154
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jun 24 17:10:22 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 17:10:22 2020 +0200

    x86: clear RDRAND CPUID bit on AMD family 15h/16h
    
    Inspired by Linux commit c49a0a80137c7ca7d6ced4c812c9e07a949f6f24:
    
        There have been reports of RDRAND issues after resuming from suspend on
        some AMD family 15h and family 16h systems. This issue stems from a BIOS
        not performing the proper steps during resume to ensure RDRAND continues
        to function properly.
    
        Update the CPU initialization to clear the RDRAND CPUID bit for any family
        15h and 16h processor that supports RDRAND. If it is known that the family
        15h or family 16h system does not have an RDRAND resume issue or that the
        system will not be placed in suspend, the "cpuid=rdrand" kernel parameter
        can be used to stop the clearing of the RDRAND CPUID bit.
    
        Note, that clearing the RDRAND CPUID bit does not prevent a processor
        that normally supports the RDRAND instruction from executing it. So any
        code that determined the support based on family and model won't #UD.
    
    Warn if no explicit choice was given on affected hardware.
    
    Check RDRAND functions at boot as well as after S3 resume (the retry
    limit chosen is entirely arbitrary).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 93401e28a84b9dc5945f5d0bf5bce68e9d5ee121
    master date: 2020-05-27 09:49:37 +0200
---
 docs/misc/xen-command-line.pandoc |  5 ++++-
 xen/arch/x86/cpu/amd.c            | 21 +++++++++++++++++++++
 xen/arch/x86/cpu/common.c         | 27 +++++++++++++++++++++++++++
 xen/arch/x86/cpuid.c              |  2 ++
 xen/include/asm-x86/processor.h   |  1 +
 5 files changed, 55 insertions(+), 1 deletion(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 7897da55ca..d7919f2ed4 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -492,7 +492,10 @@ The Speculation Control hardware features `srbds-ctrl`, `md-clear`, `ibrsb`,
 applicable.  They can all be ignored.
 
 `rdrand` and `rdseed` can be ignored, as a mitigation to XSA-320 /
-CVE-2020-0543.
+CVE-2020-0543.  The RDRAND feature is disabled by default on certain AMD
+systems, due to possible malfunctions after ACPI S3 suspend/resume.  `rdrand`
+may be used in its positive form to override Xen's default behaviour on these
+systems, and make the feature fully usable.
 
 ### cpuid_mask_cpu
 > `= fam_0f_rev_[cdefg] | fam_10_rev_[bc] | fam_11_rev_b`
diff --git a/xen/arch/x86/cpu/amd.c b/xen/arch/x86/cpu/amd.c
index 7144717da7..eb48e29e17 100644
--- a/xen/arch/x86/cpu/amd.c
+++ b/xen/arch/x86/cpu/amd.c
@@ -3,6 +3,7 @@
 #include <xen/mm.h>
 #include <xen/smp.h>
 #include <xen/pci.h>
+#include <xen/warning.h>
 #include <asm/io.h>
 #include <asm/msr.h>
 #include <asm/processor.h>
@@ -633,6 +634,26 @@ static void init_amd(struct cpuinfo_x86 *c)
 		if (acpi_smi_cmd && (acpi_enable_value | acpi_disable_value))
 			amd_acpi_c1e_quirk = true;
 		break;
+
+	case 0x15: case 0x16:
+		/*
+		 * There are some Fam15/Fam16 systems where upon resume from S3
+		 * firmware fails to re-setup properly functioning RDRAND.
+		 * By the time we can spot the problem, it is too late to take
+		 * action, and there is nothing Xen can do to repair the problem.
+		 * Clear the feature unless force-enabled on the command line.
+		 */
+		if (c == &boot_cpu_data &&
+		    cpu_has(c, X86_FEATURE_RDRAND) &&
+		    !is_forced_cpu_cap(X86_FEATURE_RDRAND)) {
+			static const char __initconst text[] =
+				"RDRAND may cease to work on this hardware upon resume from S3.\n"
+				"Please choose an explicit cpuid={no-}rdrand setting.\n";
+
+			setup_clear_cpu_cap(X86_FEATURE_RDRAND);
+			warning_add(text);
+		}
+		break;
 	}
 
 	display_cacheinfo(c);
diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index f3a8c69020..9bd9e3e24e 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -10,6 +10,7 @@
 #include <asm/io.h>
 #include <asm/mpspec.h>
 #include <asm/apic.h>
+#include <asm/random.h>
 #include <mach_apic.h>
 #include <public/sysctl.h> /* for XEN_INVALID_{SOCKET,CORE}_ID */
 
@@ -94,6 +95,11 @@ void __init setup_force_cpu_cap(unsigned int cap)
 	__set_bit(cap, boot_cpu_data.x86_capability);
 }
 
+bool __init is_forced_cpu_cap(unsigned int cap)
+{
+	return test_bit(cap, forced_caps);
+}
+
 static void default_init(struct cpuinfo_x86 * c)
 {
 	/* Not much we can do here... */
@@ -497,6 +503,27 @@ void identify_cpu(struct cpuinfo_x86 *c)
 	printk("\n");
 #endif
 
+	/*
+	 * If RDRAND is available, make an attempt to check that it actually
+	 * (still) works.
+	 */
+	if (cpu_has(c, X86_FEATURE_RDRAND)) {
+		unsigned int prev = 0;
+
+		for (i = 0; i < 5; ++i)
+		{
+			unsigned int cur = arch_get_random();
+
+			if (prev && cur != prev)
+				break;
+			prev = cur;
+		}
+
+		if (i >= 5)
+			printk(XENLOG_WARNING "CPU%u: RDRAND appears to not work\n",
+			       smp_processor_id());
+	}
+
 	if (system_state == SYS_STATE_resume)
 		return;
 
diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index d07567c901..91faf02a2b 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -68,6 +68,8 @@ static int __init parse_xen_cpuid(const char *s)
         {
             if ( !val )
                 setup_clear_cpu_cap(X86_FEATURE_RDRAND);
+            else if ( (cpuid_ecx(1) & cpufeat_mask(X86_FEATURE_RDRAND)) )
+                setup_force_cpu_cap(X86_FEATURE_RDRAND);
         }
         else if ( (val = parse_boolean("rdseed", s, ss)) >= 0 )
         {
diff --git a/xen/include/asm-x86/processor.h b/xen/include/asm-x86/processor.h
index 1b52712180..c6f26a85b8 100644
--- a/xen/include/asm-x86/processor.h
+++ b/xen/include/asm-x86/processor.h
@@ -167,6 +167,7 @@ extern const struct x86_cpu_id *x86_match_cpu(const struct x86_cpu_id table[]);
 extern void identify_cpu(struct cpuinfo_x86 *);
 extern void setup_clear_cpu_cap(unsigned int);
 extern void setup_force_cpu_cap(unsigned int);
+extern bool is_forced_cpu_cap(unsigned int);
 extern void print_cpu_info(unsigned int cpu);
 extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c);
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Sat Jun 27 14:57:56 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Jun 2020 14:57: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 1jpCHE-0006as-EB; Sat, 27 Jun 2020 14:57: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=MmMb=AI=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jpCHD-0006ai-E1
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:57:55 +0000
X-Inumbo-ID: 94af9992-b886-11ea-8396-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 94af9992-b886-11ea-8396-12813bfff9fa;
 Sat, 27 Jun 2020 14:57: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=i5fQEJq5lBU894Rm1IBFo50z8/tKpY8isRwSpVzhz2s=; b=0I89YKGtxSEDS+L5PVAVKyXkF2
 Iwt0RbZz56fCABtgXMIToxdMJtesADQQFOCPSpccSBsA5T0kJ1WvH7JxLtXuhpD7+7oOX3tpPM+rx
 +RWDg3RXcGpyC97YvxM2+2x8svCL6YtBp616S7R2Oc729aDlVo3HwGFanrgx3KsgZbaw=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCHC-00032o-Nd
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:57:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCHC-0007QX-N0
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:57:54 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.12] x86/boot: Fix load_system_tables() to be
 NMI/#MC-safe
Message-Id: <E1jpCHC-0007QX-N0@xenbits.xenproject.org>
Date: Sat, 27 Jun 2020 14:57: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 218a19b911c28e79fdb8dc73436cdddc5f42d934
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 24 17:11:08 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 17:11:08 2020 +0200

    x86/boot: Fix load_system_tables() to be NMI/#MC-safe
    
    During boot, load_system_tables() is used in reinit_bsp_stack() to switch the
    virtual addresses used from their .data/.bss alias, to their directmap alias.
    
    The structure assignment is implemented as a memset() to zero first, then a
    copy-in of the new data.  This causes the NMI/#MC stack pointers to
    transiently become 0, at a point where we may have an NMI watchdog running.
    
    Rewrite the logic using a volatile tss pointer (equivalent to, but more
    readable than, using ACCESS_ONCE() for all writes).
    
    This does drop the zeroing side effect for holes in the structure, but the
    backing memory for the TSS is fully zeroed anyway, and architecturally, they
    are all reserved.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 9f3e9139fa6c3d620eb08dff927518fc88200b8d
    master date: 2020-05-27 16:44:04 +0100
---
 xen/arch/x86/cpu/common.c | 49 ++++++++++++++++++++++-------------------------
 1 file changed, 23 insertions(+), 26 deletions(-)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 9bd9e3e24e..7a21941e40 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -749,11 +749,12 @@ void __init early_cpu_init(void)
  */
 void load_system_tables(void)
 {
-	unsigned int cpu = smp_processor_id();
+	unsigned int i, cpu = smp_processor_id();
 	unsigned long stack_bottom = get_stack_bottom(),
 		stack_top = stack_bottom & ~(STACK_SIZE - 1);
 
-	struct tss64 *tss = &this_cpu(tss_page).tss;
+	/* The TSS may be live.	 Disuade any clever optimisations. */
+	volatile struct tss64 *tss = &this_cpu(tss_page).tss;
 	seg_desc_t *gdt =
 		this_cpu(gdt_table) - FIRST_RESERVED_GDT_ENTRY;
 	seg_desc_t *compat_gdt =
@@ -768,30 +769,26 @@ void load_system_tables(void)
 		.limit = (IDT_ENTRIES * sizeof(idt_entry_t)) - 1,
 	};
 
-	*tss = (struct tss64){
-		/* Main stack for interrupts/exceptions. */
-		.rsp0 = stack_bottom,
-
-		/* Ring 1 and 2 stacks poisoned. */
-		.rsp1 = 0x8600111111111111ul,
-		.rsp2 = 0x8600111111111111ul,
-
-		/*
-		 * MCE, NMI and Double Fault handlers get their own stacks.
-		 * All others poisoned.
-		 */
-		.ist = {
-			[IST_MCE - 1] = stack_top + IST_MCE * PAGE_SIZE,
-			[IST_DF  - 1] = stack_top + IST_DF  * PAGE_SIZE,
-			[IST_NMI - 1] = stack_top + IST_NMI * PAGE_SIZE,
-			[IST_DB  - 1] = stack_top + IST_DB  * PAGE_SIZE,
-
-			[IST_MAX ... ARRAY_SIZE(tss->ist) - 1] =
-				0x8600111111111111ul,
-		},
-
-		.bitmap = IOBMP_INVALID_OFFSET,
-	};
+	/*
+	 * Set up the TSS.  Warning - may be live, and the NMI/#MC must remain
+	 * valid on every instruction boundary.  (Note: these are all
+	 * semantically ACCESS_ONCE() due to tss's volatile qualifier.)
+	 *
+	 * rsp0 refers to the primary stack.  #MC, #DF, NMI and #DB handlers
+	 * each get their own stacks.  No IO Bitmap.
+	 */
+	tss->rsp0 = stack_bottom;
+	tss->ist[IST_MCE - 1] = stack_top + IST_MCE * PAGE_SIZE;
+	tss->ist[IST_DF  - 1] = stack_top + IST_DF  * PAGE_SIZE;
+	tss->ist[IST_NMI - 1] = stack_top + IST_NMI * PAGE_SIZE;
+	tss->ist[IST_DB  - 1] = stack_top + IST_DB  * PAGE_SIZE;
+	tss->bitmap = IOBMP_INVALID_OFFSET;
+
+	/* All other stack pointers poisioned. */
+	for ( i = IST_MAX; i < ARRAY_SIZE(tss->ist); ++i )
+		tss->ist[i] = 0x8600111111111111ul;
+	tss->rsp1 = 0x8600111111111111ul;
+	tss->rsp2 = 0x8600111111111111ul;
 
 	BUILD_BUG_ON(sizeof(*tss) <= 0x67); /* Mandated by the architecture. */
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Sat Jun 27 14:58:06 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Jun 2020 14:58: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 1jpCHO-0006cl-Fr; Sat, 27 Jun 2020 14:58: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=MmMb=AI=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jpCHN-0006bs-O1
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:58:05 +0000
X-Inumbo-ID: 9ab5a8ae-b886-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 9ab5a8ae-b886-11ea-b7bb-bc764e2007e4;
 Sat, 27 Jun 2020 14:58: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=1P4sDKBsypYeYAZftnTYGudMObmRP5d1Se9J2sq5BMY=; b=K00XV/Eym6BHU4W9RIe+2PWQX8
 AoY1wJu2GjTOACyknsO13PLI4vzCfc15HQN4+kJhrSFazwomwS6arwWJYOEi1rqJ/BChN1y0YVTGY
 m7u5GUgJB+l6ZAsIs9bsCU5PrPRBN/mbbkawUe0rwnSCxghbhd60Zi3XVdTI0BINFRFU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCHM-00033c-R5
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:58:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCHM-0007RO-QF
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:58:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.12] VT-x: extend LBR Broadwell errata coverage
Message-Id: <E1jpCHM-0007RO-QF@xenbits.xenproject.org>
Date: Sat, 27 Jun 2020 14:58: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 ad20170c7135b591f262719725f457c029fe34ad
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jun 24 17:11:44 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 17:11:44 2020 +0200

    VT-x: extend LBR Broadwell errata coverage
    
    For lbr_tsx_fixup_check() simply name a few more specific erratum
    numbers.
    
    For bdf93_fixup_check(), however, more models are affected. Oddly enough
    despite being the same model and stepping, the erratum is listed for
    Xeon E3 but not its Core counterpart. Apply the workaround uniformly,
    and also for Xeon D, which only has the LBR-from one listed in its spec
    update.
    
    Seeing this broader applicability, rename anything BDF93-related to more
    generic names.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: 724913de8ac8426d313a4645741d86c1169ae406
    master date: 2020-05-28 12:03:25 +0200
---
 xen/arch/x86/hvm/vmx/vmx.c | 52 ++++++++++++++++++++++++++++++----------------
 1 file changed, 34 insertions(+), 18 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 69a9b502f6..7d29065d0b 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2449,7 +2449,7 @@ static void pi_notification_interrupt(struct cpu_user_regs *regs)
 }
 
 static void __init lbr_tsx_fixup_check(void);
-static void __init bdf93_fixup_check(void);
+static void __init ler_to_fixup_check(void);
 
 /*
  * Calculate whether the CPU is vulnerable to Instruction Fetch page
@@ -2628,7 +2628,7 @@ const struct hvm_function_table * __init start_vmx(void)
     setup_vmcs_dump();
 
     lbr_tsx_fixup_check();
-    bdf93_fixup_check();
+    ler_to_fixup_check();
 
     return &vmx_function_table;
 }
@@ -2927,11 +2927,11 @@ enum
 
 #define LBR_MSRS_INSERTED      (1u << 0)
 #define LBR_FIXUP_TSX          (1u << 1)
-#define LBR_FIXUP_BDF93        (1u << 2)
-#define LBR_FIXUP_MASK         (LBR_FIXUP_TSX | LBR_FIXUP_BDF93)
+#define LBR_FIXUP_LER_TO       (1u << 2)
+#define LBR_FIXUP_MASK         (LBR_FIXUP_TSX | LBR_FIXUP_LER_TO)
 
 static bool __read_mostly lbr_tsx_fixup_needed;
-static bool __read_mostly bdf93_fixup_needed;
+static bool __read_mostly ler_to_fixup_needed;
 
 static void __init lbr_tsx_fixup_check(void)
 {
@@ -2939,7 +2939,7 @@ static void __init lbr_tsx_fixup_check(void)
     uint32_t lbr_format;
 
     /*
-     * HSM182, HSD172, HSE117, BDM127, BDD117, BDF85, BDE105:
+     * Haswell erratum HSM182 et al, Broadwell erratum BDM127 et al:
      *
      * On processors that do not support Intel Transactional Synchronization
      * Extensions (Intel TSX) (CPUID.07H.EBX bits 4 and 11 are both zero),
@@ -2963,8 +2963,11 @@ static void __init lbr_tsx_fixup_check(void)
     case 0x45: /* HSM182 - 4th gen Core */
     case 0x46: /* HSM182, HSD172 - 4th gen Core (GT3) */
     case 0x3d: /* BDM127 - 5th gen Core */
-    case 0x47: /* BDD117 - 5th gen Core (GT3) */
-    case 0x4f: /* BDF85  - Xeon E5-2600 v4 */
+    case 0x47: /* BDD117 - 5th gen Core (GT3)
+                  BDW117 - Xeon E3-1200 v4 */
+    case 0x4f: /* BDF85  - Xeon E5-2600 v4
+                  BDH75  - Core-i7 for LGA2011-v3 Socket
+                  BDX88  - Xeon E7-x800 v4 */
     case 0x56: /* BDE105 - Xeon D-1500 */
         break;
     default:
@@ -2985,18 +2988,31 @@ static void __init lbr_tsx_fixup_check(void)
         lbr_tsx_fixup_needed = true;
 }
 
-static void __init bdf93_fixup_check(void)
+static void __init ler_to_fixup_check(void)
 {
     /*
-     * Broadwell erratum BDF93:
+     * Broadwell erratum BDF93 et al:
      *
      * Reads from MSR_LER_TO_LIP (MSR 1DEH) may return values for bits[63:61]
      * that are not equal to bit[47].  Attempting to context switch this value
      * may cause a #GP.  Software should sign extend the MSR.
      */
-    if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
-         boot_cpu_data.x86 == 6 && boot_cpu_data.x86_model == 0x4f )
-        bdf93_fixup_needed = true;
+    if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL ||
+         boot_cpu_data.x86 != 6 )
+        return;
+
+    switch ( boot_cpu_data.x86_model )
+    {
+    case 0x3d: /* BDM131 - 5th gen Core */
+    case 0x47: /* BDD??? - 5th gen Core (H-Processor line)
+                  BDW120 - Xeon E3-1200 v4 */
+    case 0x4f: /* BDF93  - Xeon E5-2600 v4
+                  BDH80  - Core-i7 for LGA2011-v3 Socket
+                  BDX93  - Xeon E7-x800 v4 */
+    case 0x56: /* BDE??? - Xeon D-1500 */
+        ler_to_fixup_needed = true;
+        break;
+    }
 }
 
 static int is_last_branch_msr(u32 ecx)
@@ -3357,8 +3373,8 @@ static int vmx_msr_write_intercept(unsigned int msr, uint64_t msr_content)
             v->arch.hvm.vmx.lbr_flags |= LBR_MSRS_INSERTED;
             if ( lbr_tsx_fixup_needed )
                 v->arch.hvm.vmx.lbr_flags |= LBR_FIXUP_TSX;
-            if ( bdf93_fixup_needed )
-                v->arch.hvm.vmx.lbr_flags |= LBR_FIXUP_BDF93;
+            if ( ler_to_fixup_needed )
+                v->arch.hvm.vmx.lbr_flags |= LBR_FIXUP_LER_TO;
         }
 
         __vmwrite(GUEST_IA32_DEBUGCTL, msr_content);
@@ -4418,7 +4434,7 @@ static void sign_extend_msr(struct vcpu *v, u32 msr, int type)
         entry->data = canonicalise_addr(entry->data);
 }
 
-static void bdf93_fixup(void)
+static void ler_to_fixup(void)
 {
     struct vcpu *curr = current;
 
@@ -4431,8 +4447,8 @@ static void lbr_fixup(void)
 
     if ( curr->arch.hvm.vmx.lbr_flags & LBR_FIXUP_TSX )
         lbr_tsx_fixup();
-    if ( curr->arch.hvm.vmx.lbr_flags & LBR_FIXUP_BDF93 )
-        bdf93_fixup();
+    if ( curr->arch.hvm.vmx.lbr_flags & LBR_FIXUP_LER_TO )
+        ler_to_fixup();
 }
 
 /* Returns false if the vmentry has to be restarted */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Sat Jun 27 14:58:16 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Jun 2020 14:58: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 1jpCHY-0006eR-HY; Sat, 27 Jun 2020 14:58: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=MmMb=AI=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jpCHX-0006eI-Jv
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:58:15 +0000
X-Inumbo-ID: a0bcae28-b886-11ea-8396-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id a0bcae28-b886-11ea-8396-12813bfff9fa;
 Sat, 27 Jun 2020 14:58: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=xsv13h0sm7ILZrpeTYevI20ww3NjWw0F1CQEzy+wk4Q=; b=xsU+TnJqcxwcrJLnTQeGOaH2UE
 lp1bCX838FKbQnwFs3uzAfgJMEgPiWcv9GlYM+ZasBA5UMXtlltWfYnTNySie/gJT+qJShtJ/iXZJ
 C9I3NG1HIBFndUtPjJePA8cK5CGQvNgObzeaytFer+iw+Ry+XdtTOvHgb2Wo7Bf1bK/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 1jpCHW-00033j-U8
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:58:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCHW-0007Rw-TP
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:58:14 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.12] x86/hvm: Improve error information in handle_pio()
Message-Id: <E1jpCHW-0007Rw-TP@xenbits.xenproject.org>
Date: Sat, 27 Jun 2020 14:58: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 6182e5dd894f047669d86bc97f3cd13b19f60110
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 24 17:12:20 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 17:12:20 2020 +0200

    x86/hvm: Improve error information in handle_pio()
    
    domain_crash() should always have a message which is emitted even in release
    builds, so something more useful than this is presented to the user.
    
      (XEN) domain_crash called from io.c:171
      (XEN) domain_crash called from io.c:171
      (XEN) domain_crash called from io.c:171
      ...
    
    To avoid possibly printing stack rubble, initialise data to ~0 right away.
    Furthermore, the maximum access size is 4, so drop data from long to int.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 4609fc8eb04e6af531d86923c9d057f32a96b7d8
    master date: 2020-05-29 16:25:05 +0100
---
 xen/arch/x86/hvm/io.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/hvm/io.c b/xen/arch/x86/hvm/io.c
index a5b0a23f06..724ab44a76 100644
--- a/xen/arch/x86/hvm/io.c
+++ b/xen/arch/x86/hvm/io.c
@@ -132,13 +132,15 @@ bool handle_pio(uint16_t port, unsigned int size, int dir)
 {
     struct vcpu *curr = current;
     struct hvm_vcpu_io *vio = &curr->arch.hvm.hvm_io;
-    unsigned long data;
+    unsigned int data;
     int rc;
 
     ASSERT((size - 1) < 4 && size != 3);
 
     if ( dir == IOREQ_WRITE )
         data = guest_cpu_user_regs()->eax;
+    else
+        data = ~0; /* Avoid any risk of stack rubble. */
 
     rc = hvmemul_do_pio_buffer(port, size, dir, &data);
 
@@ -151,7 +153,7 @@ bool handle_pio(uint16_t port, unsigned int size, int dir)
         if ( dir == IOREQ_READ )
         {
             if ( size == 4 ) /* Needs zero extension. */
-                guest_cpu_user_regs()->rax = (uint32_t)data;
+                guest_cpu_user_regs()->rax = data;
             else
                 memcpy(&guest_cpu_user_regs()->rax, &data, size);
         }
@@ -167,7 +169,9 @@ bool handle_pio(uint16_t port, unsigned int size, int dir)
         break;
 
     default:
-        gdprintk(XENLOG_ERR, "Weird HVM ioemulation status %d.\n", rc);
+        gprintk(XENLOG_ERR, "Unexpected PIO status %d, port %#x %s 0x%0*x\n",
+                rc, port, dir == IOREQ_WRITE ? "write" : "read",
+                size * 2, data & ((1u << (size * 8)) - 1));
         domain_crash(curr->domain);
         return false;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Sat Jun 27 14:58:27 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Jun 2020 14:58: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 1jpCHj-0006fb-J9; Sat, 27 Jun 2020 14:58: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=MmMb=AI=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jpCHi-0006fV-Da
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:58:26 +0000
X-Inumbo-ID: a6bfd124-b886-11ea-8396-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id a6bfd124-b886-11ea-8396-12813bfff9fa;
 Sat, 27 Jun 2020 14:58: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=GtnN/THeDfuMBFJcoNi/KX1dZuPFnfQvde7WJ0bDTcc=; b=1ddVs5IL6YHubrJoQ6rAdA+84H
 l/0Ig9jmM9VGx4W/phWvdXxv9fp/kZTqmYktSl11yeRo9sWA5a1eBCg+FFf9NNCk177VgIZpTbdox
 DWkZQkA7bpnll5qMnsF4+pyz5Yr50MHO196RRDtb02OiS1w2IDHJrtUPLtG8jUDh4doo=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCHh-00033v-1I
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:58:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCHh-0007Sc-0c
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:58:25 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.12] x86emul: address x86_insn_is_mem_{access,
 write}() omissions
Message-Id: <E1jpCHh-0007Sc-0c@xenbits.xenproject.org>
Date: Sat, 27 Jun 2020 14:58: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 946113a444de009a694c963b65717d28372691d6
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jun 24 17:12:53 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 17:12:53 2020 +0200

    x86emul: address x86_insn_is_mem_{access,write}() omissions
    
    First of all explain in comments what the functions' purposes are. Then
    make them actually match their comments.
    
    Note that fc6fa977be54 ("x86emul: extend x86_insn_is_mem_write()
    coverage") didn't actually fix the function's behavior for {,V}STMXCSR:
    Both are covered by generic code higher up in the function, due to
    x86_decode_twobyte() already doing suitable adjustments. And VSTMXCSR
    wouldn't have been covered anyway without a further X86EMUL_OPC_VEX()
    case label. Keep the inner case label in a comment for reference.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: e28d13eeb65c25c0bd56e8bfa83c7473047d778d
    master date: 2020-05-29 17:28:04 +0200
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 126 ++++++++++++++++++++++++++++++---
 1 file changed, 118 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index facd88d2b8..0c0a51e13c 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -9990,25 +9990,87 @@ x86_insn_operand_ea(const struct x86_emulate_state *state,
     return state->ea.mem.off;
 }
 
+/*
+ * This function means to return 'true' for all supported insns with explicit
+ * accesses to memory.  This means also insns which don't have an explicit
+ * memory operand (like POP), but it does not mean e.g. segment selector
+ * loads, where the descriptor table access is considered an implicit one.
+ */
 bool
 x86_insn_is_mem_access(const struct x86_emulate_state *state,
                        const struct x86_emulate_ctxt *ctxt)
 {
+    if ( mode_64bit() && state->not_64bit )
+        return false;
+
     if ( state->ea.type == OP_MEM )
-        return ctxt->opcode != 0x8d /* LEA */ &&
-               (ctxt->opcode != X86EMUL_OPC(0x0f, 0x01) ||
-                (state->modrm_reg & 7) != 7) /* INVLPG */;
+    {
+        switch ( ctxt->opcode )
+        {
+        case 0x8d: /* LEA */
+        case X86EMUL_OPC(0x0f, 0x0d): /* PREFETCH */
+        case X86EMUL_OPC(0x0f, 0x18)
+         ... X86EMUL_OPC(0x0f, 0x1f): /* NOP space */
+        case X86EMUL_OPC_66(0x0f, 0x18)
+         ... X86EMUL_OPC_66(0x0f, 0x1f): /* NOP space */
+        case X86EMUL_OPC_F3(0x0f, 0x18)
+         ... X86EMUL_OPC_F3(0x0f, 0x1f): /* NOP space */
+        case X86EMUL_OPC_F2(0x0f, 0x18)
+         ... X86EMUL_OPC_F2(0x0f, 0x1f): /* NOP space */
+        case X86EMUL_OPC(0x0f, 0xb9): /* UD1 */
+        case X86EMUL_OPC(0x0f, 0xff): /* UD0 */
+            return false;
+
+        case X86EMUL_OPC(0x0f, 0x01):
+            return (state->modrm_reg & 7) != 7; /* INVLPG */
+
+        case X86EMUL_OPC(0x0f, 0xae):
+            return (state->modrm_reg & 7) != 7; /* CLFLUSH */
+
+        case X86EMUL_OPC_66(0x0f, 0xae):
+            return (state->modrm_reg & 7) < 6; /* CLWB, CLFLUSHOPT */
+        }
+
+        return true;
+    }
 
     switch ( ctxt->opcode )
     {
+    case 0x06 ... 0x07: /* PUSH / POP %es */
+    case 0x0e:          /* PUSH %cs */
+    case 0x16 ... 0x17: /* PUSH / POP %ss */
+    case 0x1e ... 0x1f: /* PUSH / POP %ds */
+    case 0x50 ... 0x5f: /* PUSH / POP reg */
+    case 0x60 ... 0x61: /* PUSHA / POPA */
+    case 0x68: case 0x6a: /* PUSH imm */
     case 0x6c ... 0x6f: /* INS / OUTS */
+    case 0x8f:          /* POP r/m */
+    case 0x9a:          /* CALL (far, direct) */
+    case 0x9c ... 0x9d: /* PUSHF / POPF */
     case 0xa4 ... 0xa7: /* MOVS / CMPS */
     case 0xaa ... 0xaf: /* STOS / LODS / SCAS */
+    case 0xc2 ... 0xc3: /* RET (near) */
+    case 0xc8 ... 0xc9: /* ENTER / LEAVE */
+    case 0xca ... 0xcb: /* RET (far) */
     case 0xd7:          /* XLAT */
+    case 0xe8:          /* CALL (near, direct) */
+    case X86EMUL_OPC(0x0f, 0xa0):         /* PUSH %fs */
+    case X86EMUL_OPC(0x0f, 0xa1):         /* POP %fs */
+    case X86EMUL_OPC(0x0f, 0xa8):         /* PUSH %gs */
+    case X86EMUL_OPC(0x0f, 0xa9):         /* POP %gs */
     CASE_SIMD_PACKED_INT(0x0f, 0xf7):    /* MASKMOV{Q,DQU} */
     case X86EMUL_OPC_VEX_66(0x0f, 0xf7): /* VMASKMOVDQU */
         return true;
 
+    case 0xff:
+        switch ( state->modrm_reg & 7 )
+        {
+        case 2: /* CALL (near, indirect) */
+        case 6: /* PUSH r/m */
+            return true;
+        }
+        break;
+
     case X86EMUL_OPC(0x0f, 0x01):
         /* Cover CLZERO. */
         return (state->modrm_rm & 7) == 4 && (state->modrm_reg & 7) == 7;
@@ -10017,10 +10079,20 @@ x86_insn_is_mem_access(const struct x86_emulate_state *state,
     return false;
 }
 
+/*
+ * This function means to return 'true' for all supported insns with explicit
+ * writes to memory.  This means also insns which don't have an explicit
+ * memory operand (like PUSH), but it does not mean e.g. segment selector
+ * loads, where the (possible) descriptor table write is considered an
+ * implicit access.
+ */
 bool
 x86_insn_is_mem_write(const struct x86_emulate_state *state,
                       const struct x86_emulate_ctxt *ctxt)
 {
+    if ( mode_64bit() && state->not_64bit )
+        return false;
+
     switch ( state->desc & DstMask )
     {
     case DstMem:
@@ -10032,19 +10104,48 @@ x86_insn_is_mem_write(const struct x86_emulate_state *state,
         break;
 
     default:
+        switch ( ctxt->opcode )
+        {
+        case 0x63:                         /* ARPL */
+            return !mode_64bit();
+        }
+
         return false;
     }
 
     if ( state->modrm_mod == 3 )
-        /* CLZERO is the odd one. */
-        return ctxt->opcode == X86EMUL_OPC(0x0f, 0x01) &&
-               (state->modrm_rm & 7) == 4 && (state->modrm_reg & 7) == 7;
+    {
+        switch ( ctxt->opcode )
+        {
+        case 0xff: /* Grp5 */
+            break;
+
+        case X86EMUL_OPC(0x0f, 0x01): /* CLZERO is the odd one. */
+            return (state->modrm_rm & 7) == 4 && (state->modrm_reg & 7) == 7;
+
+        default:
+            return false;
+        }
+    }
 
     switch ( ctxt->opcode )
     {
+    case 0x06:                           /* PUSH %es */
+    case 0x0e:                           /* PUSH %cs */
+    case 0x16:                           /* PUSH %ss */
+    case 0x1e:                           /* PUSH %ds */
+    case 0x50 ... 0x57:                  /* PUSH reg */
+    case 0x60:                           /* PUSHA */
+    case 0x68: case 0x6a:                /* PUSH imm */
     case 0x6c: case 0x6d:                /* INS */
+    case 0x9a:                           /* CALL (far, direct) */
+    case 0x9c:                           /* PUSHF */
     case 0xa4: case 0xa5:                /* MOVS */
     case 0xaa: case 0xab:                /* STOS */
+    case 0xc8:                           /* ENTER */
+    case 0xe8:                           /* CALL (near, direct) */
+    case X86EMUL_OPC(0x0f, 0xa0):        /* PUSH %fs */
+    case X86EMUL_OPC(0x0f, 0xa8):        /* PUSH %gs */
     case X86EMUL_OPC(0x0f, 0xab):        /* BTS */
     case X86EMUL_OPC(0x0f, 0xb3):        /* BTR */
     case X86EMUL_OPC(0x0f, 0xbb):        /* BTC */
@@ -10096,6 +10197,16 @@ x86_insn_is_mem_write(const struct x86_emulate_state *state,
         }
         break;
 
+    case 0xff:
+        switch ( state->modrm_reg & 7 )
+        {
+        case 2: /* CALL (near, indirect) */
+        case 3: /* CALL (far, indirect) */
+        case 6: /* PUSH r/m */
+            return true;
+        }
+        break;
+
     case X86EMUL_OPC(0x0f, 0x01):
         switch ( state->modrm_reg & 7 )
         {
@@ -10110,7 +10221,7 @@ x86_insn_is_mem_write(const struct x86_emulate_state *state,
         switch ( state->modrm_reg & 7 )
         {
         case 0: /* FXSAVE */
-        case 3: /* {,V}STMXCSR */
+        /* case 3: STMXCSR - handled above */
         case 4: /* XSAVE */
         case 6: /* XSAVEOPT */
             return true;
@@ -10126,7 +10237,6 @@ x86_insn_is_mem_write(const struct x86_emulate_state *state,
         case 1: /* CMPXCHG{8,16}B */
         case 4: /* XSAVEC */
         case 5: /* XSAVES */
-        case 7: /* VMPTRST */
             return true;
         }
         break;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Sat Jun 27 14:58:36 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Jun 2020 14:58: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 1jpCHs-0006gj-M9; Sat, 27 Jun 2020 14:58: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=MmMb=AI=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jpCHr-0006ga-SK
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:58:35 +0000
X-Inumbo-ID: acc7a3c6-b886-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id acc7a3c6-b886-11ea-b7bb-bc764e2007e4;
 Sat, 27 Jun 2020 14:58: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=xqJZuXKzkG++0klIalThHxgQeyo1/2GKv0X+/iyaswQ=; b=Kwg6EOSiYnDTWphbeyEfkV80Ru
 wz1a6IwVrbuYkoDibobutRDgSgtZ8TEG23hMvDE4RFyWWKdfhmKtRRkbJmBahZJyBF+9FXiA0BbEP
 4rtDL1ne7hriZC+CzlD2m50gzqEEBZ5pI1I0sUvfR1NtpW76PfdLSFNt1qDlcjlKtXYQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCHr-000344-4t
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:58:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCHr-0007T6-4A
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:58:35 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.12] x86emul: rework CMP and TEST emulation
Message-Id: <E1jpCHr-0007T6-4A@xenbits.xenproject.org>
Date: Sat, 27 Jun 2020 14:58: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 74a12302245dd7febbc8bb214cf965377fda055d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jun 24 17:13:29 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 17:13:29 2020 +0200

    x86emul: rework CMP and TEST emulation
    
    Unlike similarly encoded insns these don't write their memory operands,
    and hence x86_is_mem_write() should return false for them. However,
    rather than adding special logic there, rework how their emulation gets
    done, by making decoding attributes properly describe the r/o nature of
    their memory operands:
    -  change the table entries for opcodes 0x38 and 0x39, with no other
       adjustments to the attributes later on,
    -  for the other opcodes, leave the table entries as they are, and
       override the attributes for the specific sub-cases (identified by
       ModRM.reg).
    
    For opcodes 0x38 and 0x39 the change of the table entries implies
    changing the order of operands as passed to emulate_2op_SrcV(), hence
    the splitting of the cases in the main switch().
    
    Note how this also allows dropping custom LOCK prefix checks.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 20bc1b9cc99b70b17757e1903f629c7a26584790
    master date: 2020-05-29 17:28:45 +0200
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 37 +++++++++++++++++++++-------------
 1 file changed, 23 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 0c0a51e13c..98f52083f8 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -84,7 +84,7 @@ static const opcode_desc_t opcode_table[256] = {
     ByteOp|DstReg|SrcMem|ModRM, DstReg|SrcMem|ModRM,
     ByteOp|DstEax|SrcImm, DstEax|SrcImm, 0, ImplicitOps,
     /* 0x38 - 0x3F */
-    ByteOp|DstMem|SrcReg|ModRM, DstMem|SrcReg|ModRM,
+    ByteOp|DstReg|SrcMem|ModRM, DstReg|SrcMem|ModRM,
     ByteOp|DstReg|SrcMem|ModRM, DstReg|SrcMem|ModRM,
     ByteOp|DstEax|SrcImm, DstEax|SrcImm, 0, ImplicitOps,
     /* 0x40 - 0x4F */
@@ -2405,7 +2405,6 @@ x86_decode_onebyte(
     case 0x60: /* pusha */
     case 0x61: /* popa */
     case 0x62: /* bound */
-    case 0x82: /* Grp1 (x86/32 only) */
     case 0xc4: /* les */
     case 0xc5: /* lds */
     case 0xce: /* into */
@@ -2415,6 +2414,14 @@ x86_decode_onebyte(
         state->not_64bit = true;
         break;
 
+    case 0x82: /* Grp1 (x86/32 only) */
+        state->not_64bit = true;
+        /* fall through */
+    case 0x80: case 0x81: case 0x83: /* Grp1 */
+        if ( (modrm_reg & 7) == 7 ) /* cmp */
+            state->desc = (state->desc & ByteOp) | DstNone | SrcMem;
+        break;
+
     case 0x90: /* nop / pause */
         if ( repe_prefix() )
             ctxt->opcode |= X86EMUL_OPC_F3(0, 0);
@@ -2445,6 +2452,11 @@ x86_decode_onebyte(
         imm2 = insn_fetch_type(uint8_t);
         break;
 
+    case 0xf6: case 0xf7: /* Grp3 */
+        if ( !(modrm_reg & 6) ) /* test */
+            state->desc = (state->desc & ByteOp) | DstNone | SrcMem;
+        break;
+
     case 0xff: /* Grp5 */
         switch ( modrm_reg & 7 )
         {
@@ -3725,13 +3737,11 @@ x86_emulate(
         break;
 
     case 0x38: case 0x39: cmp: /* cmp reg,mem */
-        if ( ops->rmw && dst.type == OP_MEM &&
-             (rc = read_ulong(dst.mem.seg, dst.mem.off, &dst.val,
-                              dst.bytes, ctxt, ops)) != X86EMUL_OKAY )
-            goto done;
-        /* fall through */
+        emulate_2op_SrcV("cmp", dst, src, _regs.eflags);
+        dst.type = OP_NONE;
+        break;
+
     case 0x3a ... 0x3d: /* cmp */
-        generate_exception_if(lock_prefix, EXC_UD);
         emulate_2op_SrcV("cmp", src, dst, _regs.eflags);
         dst.type = OP_NONE;
         break;
@@ -4033,7 +4043,9 @@ x86_emulate(
         case 4: goto and;
         case 5: goto sub;
         case 6: goto xor;
-        case 7: goto cmp;
+        case 7:
+            dst.val = imm1;
+            goto cmp;
         }
         break;
 
@@ -5026,11 +5038,8 @@ x86_emulate(
             unsigned long u[2], v;
 
         case 0 ... 1: /* test */
-            generate_exception_if(lock_prefix, EXC_UD);
-            if ( ops->rmw && dst.type == OP_MEM &&
-                 (rc = read_ulong(dst.mem.seg, dst.mem.off, &dst.val,
-                                  dst.bytes, ctxt, ops)) != X86EMUL_OKAY )
-                goto done;
+            dst.val = imm1;
+            dst.bytes = src.bytes;
             goto test;
         case 2: /* not */
             if ( ops->rmw && dst.type == OP_MEM )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Sat Jun 27 14:58:46 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Jun 2020 14:58: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 1jpCI2-0006hv-Nk; Sat, 27 Jun 2020 14:58: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=MmMb=AI=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jpCI1-0006hm-Ty
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:58:45 +0000
X-Inumbo-ID: b2cd8ef2-b886-11ea-8396-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id b2cd8ef2-b886-11ea-8396-12813bfff9fa;
 Sat, 27 Jun 2020 14:58: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=8fZNWMrehdVwbcU6GemauA32UYEwu1P833GF0g639bQ=; b=qXML77WkcPJvloUao6s6N+38i8
 hDsBX7cMoN9bY0ju7Nw7SLeHtVofpRx32prI3vtdwURlNyjDxnZH4IGqWN7E+quSFsUOcp+7zp1P4
 A9FeU+9v+6X7g6F5WgyYSTxwEpQRKbU1q0Wd0zVJo0cuFsafLQfb0TceGCvI+v8MoVqk=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCI1-00034C-8N
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:58:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCI1-0007Tr-7U
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:58:45 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.12] x86/mm: do not attempt to convert _PAGE_GNTTAB to a
 boolean
Message-Id: <E1jpCI1-0007Tr-7U@xenbits.xenproject.org>
Date: Sat, 27 Jun 2020 14:58: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 7eed533a8b77a1b06c98721fee2f53a864b46fc8
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Jun 24 17:14:11 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 17:14:11 2020 +0200

    x86/mm: do not attempt to convert _PAGE_GNTTAB to a boolean
    
    Clang 10 complains with:
    
    mm.c:1239:10: error: converting the result of '<<' to a boolean always evaluates to true
          [-Werror,-Wtautological-constant-compare]
        if ( _PAGE_GNTTAB && (l1e_get_flags(l1e) & _PAGE_GNTTAB) &&
             ^
    xen/include/asm/x86_64/page.h:161:25: note: expanded from macro '_PAGE_GNTTAB'
    #define _PAGE_GNTTAB (1U<<22)
                            ^
    
    Remove the conversion of _PAGE_GNTTAB to a boolean and instead use a
    preprocessor conditional to check if _PAGE_GNTTAB is defined.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 6eb61b1a9dfe23ca443f977799cafb22770708a0
    master date: 2020-06-02 13:36:41 +0200
---
 xen/arch/x86/mm.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 6f5f70c16e..b4c90bd054 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -1268,8 +1268,14 @@ void put_page_from_l1e(l1_pgentry_t l1e, struct domain *l1e_owner)
      *
      * (Note that the undestroyable active grants are not a security hole in
      * Xen. All active grants can safely be cleaned up when the domain dies.)
+     *
+     * NB: the preprocessor conditional is required in order to prevent clang's
+     * -Wtautological-constant-compare complaining about converting the result
+     * of a << into a bool is always true if it's evaluated directly in the if
+     * condition.
      */
-    if ( _PAGE_GNTTAB && (l1e_get_flags(l1e) & _PAGE_GNTTAB) &&
+#if _PAGE_GNTTAB
+    if ( (l1e_get_flags(l1e) & _PAGE_GNTTAB) &&
          !l1e_owner->is_shutting_down && !l1e_owner->is_dying )
     {
         gdprintk(XENLOG_WARNING,
@@ -1277,6 +1283,7 @@ void put_page_from_l1e(l1_pgentry_t l1e, struct domain *l1e_owner)
                  l1e_get_intpte(l1e));
         domain_crash(l1e_owner);
     }
+#endif
 
     /*
      * Remember we didn't take a type-count of foreign writable mappings
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Sat Jun 27 14:58:56 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Jun 2020 14:58: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 1jpCIC-0006iw-PP; Sat, 27 Jun 2020 14:58: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=MmMb=AI=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jpCIB-0006iq-Td
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:58:55 +0000
X-Inumbo-ID: b8d14bc2-b886-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id b8d14bc2-b886-11ea-bb8b-bc764e2007e4;
 Sat, 27 Jun 2020 14:58: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=mHbeeUV21RfDJTu52FpRpFqcOsDKOJXdzwP9xQ2xO0M=; b=UCWnlxlhLBdPKZAUu9yjtoH7Xc
 2Yc1dhl3DSFnr+oest0cYsvLnAHeDSx11liCf+fTyVTDGHwlbWwzJnHohjdZ2GV4nEhqkFc4ozb0k
 WripHfnMqRlwjQZx3I9Vk49Gu9/ystPsb5HlP3roUn2A26VGMEdAMAHBv2fLja1RlcAc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCIB-00034J-BC
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:58:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCIB-0007UP-Ab
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:58:55 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.12] build32: don't discard .shstrtab in linker script
Message-Id: <E1jpCIB-0007UP-Ab@xenbits.xenproject.org>
Date: Sat, 27 Jun 2020 14:58: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 7641573b333966271ddedae849dde3e72bf4d457
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Jun 24 17:14:40 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 17:14:40 2020 +0200

    build32: don't discard .shstrtab in linker script
    
    LLVM linker doesn't support discarding .shstrtab, and complains with:
    
    ld -melf_i386_fbsd -N -T build32.lds -o reloc.lnk reloc.o
    ld: error: discarding .shstrtab section is not allowed
    
    Add an explicit .shstrtab, .strtab and .symtab sections to the linker
    script after the text section in order to make LLVM LD happy and match
    the behavior of GNU LD.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 10d27b48b5b4dfbead2d9bf03290984bba4806e4
    master date: 2020-06-02 13:37:53 +0200
---
 xen/arch/x86/boot/build32.lds | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/xen/arch/x86/boot/build32.lds b/xen/arch/x86/boot/build32.lds
index 97454b40ff..1ab9418793 100644
--- a/xen/arch/x86/boot/build32.lds
+++ b/xen/arch/x86/boot/build32.lds
@@ -50,6 +50,20 @@ SECTIONS
         *(.got.plt)
   }
 
+  /*
+   * Discarding .shstrtab is not supported by LLD (LLVM LD) and will trigger an
+   * error. Also keep the rest of the control sections to match GNU LD behavior.
+   */
+  .shstrtab : {
+        *(.shstrtab)
+  }
+  .strtab : {
+        *(.strtab)
+  }
+  .symtab : {
+        *(.symtab)
+  }
+
   /DISCARD/ : {
         /*
          * Discard everything else, to prevent linkers from putting
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Sat Jun 27 14:59:07 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Jun 2020 14:59: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 1jpCIN-0006k8-R2; Sat, 27 Jun 2020 14:59: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=MmMb=AI=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jpCIM-0006k1-UX
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:59:06 +0000
X-Inumbo-ID: bed68c94-b886-11ea-8396-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id bed68c94-b886-11ea-8396-12813bfff9fa;
 Sat, 27 Jun 2020 14:59: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=i4c9JvwPqZCbO0IeKtnGD01+YNq3rnK4XdG/snsxs3Y=; b=TYFFIzJ9GGOFNbV+FQwa7J2oyE
 zkJUpX85Wy44rNUGM+D+lQ9sUYyTGu06YtSnlrLVI127+lMMzr/Yraf0JiJP0HwWgql8FlEyjosia
 Jp8HSCOrLLJX3ge5fkz3FsiBJtJh+iV6cch1UpgpYyZsG1PCyKSFaEMcrrvu6pZNugXw=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCIL-00035I-Ed
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:59:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCIL-0007V8-Dn
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:59:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.12] x86/svm: do not try to handle recalc NPT faults
 immediately
Message-Id: <E1jpCIL-0007V8-Dn@xenbits.xenproject.org>
Date: Sat, 27 Jun 2020 14:59: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 d937532ff5cebb27149224db4c502d2142c3106e
Author:     Igor Druzhinin <igor.druzhinin@citrix.com>
AuthorDate: Wed Jun 24 17:15:23 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 17:15:23 2020 +0200

    x86/svm: do not try to handle recalc NPT faults immediately
    
    A recalculation NPT fault doesn't always require additional handling
    in hvm_hap_nested_page_fault(), moreover in general case if there is no
    explicit handling done there - the fault is wrongly considered fatal.
    
    This covers a specific case of migration with vGPU assigned which
    uses direct MMIO mappings made by XEN_DOMCTL_memory_mapping hypercall:
    at a moment log-dirty is enabled globally, recalculation is requested
    for the whole guest memory including those mapped MMIO regions
    which causes a page fault being raised at the first access to them;
    but due to MMIO P2M type not having any explicit handling in
    hvm_hap_nested_page_fault() a domain is erroneously crashed with unhandled
    SVM violation.
    
    Instead of trying to be opportunistic - use safer approach and handle
    P2M recalculation in a separate NPT fault by attempting to retry after
    making the necessary adjustments. This is aligned with Intel behavior
    where there are separate VMEXITs for recalculation and EPT violations
    (faults) and only faults are handled in hvm_hap_nested_page_fault().
    Do it by also unifying do_recalc return code with Intel implementation
    where returning 1 means P2M was actually changed.
    
    Since there was no case previously where p2m_pt_handle_deferred_changes()
    could return a positive value - it's safe to replace ">= 0" with just "== 0"
    in VMEXIT_NPF handler. finish_type_change() is also not affected by the
    change as being able to deal with >0 return value of p2m->recalc from
    EPT implementation.
    
    Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 51ca66c37371b10b378513af126646de22eddb17
    master date: 2020-06-05 17:12:11 +0200
---
 xen/arch/x86/hvm/svm/svm.c | 5 +++--
 xen/arch/x86/mm/p2m-pt.c   | 7 ++++++-
 xen/arch/x86/mm/p2m.c      | 2 +-
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 9128e923b0..d74701718b 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -3042,9 +3042,10 @@ void svm_vmexit_handler(struct cpu_user_regs *regs)
             v->arch.hvm.svm.cached_insn_len = vmcb->guest_ins_len & 0xf;
         rc = vmcb->exitinfo1 & PFEC_page_present
              ? p2m_pt_handle_deferred_changes(vmcb->exitinfo2) : 0;
-        if ( rc >= 0 )
+        if ( rc == 0 )
+            /* If no recal adjustments were being made - handle this fault */
             svm_do_nested_pgfault(v, regs, vmcb->exitinfo1, vmcb->exitinfo2);
-        else
+        else if ( rc < 0 )
         {
             printk(XENLOG_G_ERR
                    "%pv: Error %d handling NPF (gpa=%08lx ec=%04lx)\n",
diff --git a/xen/arch/x86/mm/p2m-pt.c b/xen/arch/x86/mm/p2m-pt.c
index 87bf74ed92..0629cd530e 100644
--- a/xen/arch/x86/mm/p2m-pt.c
+++ b/xen/arch/x86/mm/p2m-pt.c
@@ -370,6 +370,7 @@ static int do_recalc(struct p2m_domain *p2m, unsigned long gfn)
     unsigned int level = 4;
     l1_pgentry_t *pent;
     int err = 0;
+    bool recalc_done = false;
 
     table = map_domain_page(pagetable_get_mfn(p2m_get_pagetable(p2m)));
     while ( --level )
@@ -431,6 +432,8 @@ static int do_recalc(struct p2m_domain *p2m, unsigned long gfn)
                 clear_recalc(l1, e);
                 err = p2m->write_p2m_entry(p2m, gfn, pent, e, level + 1);
                 ASSERT(!err);
+
+                recalc_done = true;
             }
         }
         unmap_domain_page((void *)((unsigned long)pent & PAGE_MASK));
@@ -480,12 +483,14 @@ static int do_recalc(struct p2m_domain *p2m, unsigned long gfn)
             clear_recalc(l1, e);
         err = p2m->write_p2m_entry(p2m, gfn, pent, e, level + 1);
         ASSERT(!err);
+
+        recalc_done = true;
     }
 
  out:
     unmap_domain_page(table);
 
-    return err;
+    return err ?: recalc_done;
 }
 
 int p2m_pt_handle_deferred_changes(uint64_t gpa)
diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 16608098b1..25ce19f20b 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -1178,7 +1178,7 @@ static int finish_type_change(struct p2m_domain *p2m,
         rc = p2m->recalc(p2m, gfn);
         /*
          * ept->recalc could return 0/1/-ENOMEM. pt->recalc could return
-         * 0/-ENOMEM/-ENOENT, -ENOENT isn't an error as we are looping
+         * 0/1/-ENOMEM/-ENOENT, -ENOENT isn't an error as we are looping
          * gfn here.
          */
         if ( rc == -ENOENT )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Sat Jun 27 14:59:16 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Jun 2020 14:59: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 1jpCIW-0006lN-Sg; Sat, 27 Jun 2020 14:59: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=MmMb=AI=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jpCIW-0006lE-7g
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:59:16 +0000
X-Inumbo-ID: c4da7efc-b886-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id c4da7efc-b886-11ea-bca7-bc764e2007e4;
 Sat, 27 Jun 2020 14:59: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=fSRHdOXElwiLV5DmYlr9KkdaIvk4Ca3Y3KydIQqOh4c=; b=t0c5JX5ryt46W8r41j6n94QkdB
 XrjvDcbBkx61TpzCT1hgJ8XXZ3Lr1XEm5aYSEIX2FzBURx5bPs78lNpx8FjfQwGHOnD1+dP8UN+DC
 +Kx48VkyTvZAbH4Reeo3hyFuetrCkKJsya9O/WHrV6dUyxQiKN6W5AcGTJ0nJ5dz9Wp8=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCIV-00035U-HZ
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:59:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCIV-0007Vk-Gv
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:59:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.12] build: fix dependency tracking for preprocessed
 files
Message-Id: <E1jpCIV-0007Vk-Gv@xenbits.xenproject.org>
Date: Sat, 27 Jun 2020 14:59: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 7cdc0cff95776a25edc05488da0b76930c463e80
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jun 24 17:15:53 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 17:15:53 2020 +0200

    build: fix dependency tracking for preprocessed files
    
    While the issue is more general, I noticed that asm-macros.i not getting
    re-generated as needed. This was due to its .*.d file mentioning
    asm-macros.o instead of asm-macros.i. Use -MQ here as well, and while at
    it also use -MQ to avoid the somewhat fragile sed-ary on the *.lds
    dependency tracking files. While there, further avoid open-coding $(CPP)
    and drop the bogus (Arm) / stale (x86) -Ui386.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    master commit: 75131ad75bb3c91717b5dfda6881e61c52bfd22e
    master date: 2020-06-08 10:25:40 +0200
---
 xen/Rules.mk          | 4 ++--
 xen/arch/arm/Makefile | 4 +---
 xen/arch/x86/Makefile | 8 ++------
 3 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/xen/Rules.mk b/xen/Rules.mk
index a151b3f625..dc0632ddf5 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -217,13 +217,13 @@ $(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): %.init.o: %.o Makefile
 	$(OBJCOPY) $(foreach s,$(SPECIAL_DATA_SECTIONS),--rename-section .$(s)=.init.$(s)) $< $@
 
 %.i: %.c Makefile
-	$(CPP) $(filter-out -Wa$(comma)%,$(CFLAGS)) $< -o $@
+	$(CPP) $(filter-out -Wa$(comma)%,$(CFLAGS)) -MQ $@ -o $@ $<
 
 %.s: %.c Makefile
 	$(CC) $(filter-out -Wa$(comma)%,$(CFLAGS)) -S $< -o $@
 
 # -std=gnu{89,99} gets confused by # as an end-of-line comment marker
 %.s: %.S Makefile
-	$(CPP) $(filter-out -Wa$(comma)%,$(AFLAGS)) $< -o $@
+	$(CPP) $(filter-out -Wa$(comma)%,$(AFLAGS)) -MQ $@ -o $@ $<
 
 -include $(DEPS_INCLUDE)
diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index 872a155b60..6b29e45bbe 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -123,9 +123,7 @@ asm-offsets.s: $(TARGET_SUBARCH)/asm-offsets.c
 	$(CC) $(filter-out -flto,$(CFLAGS)) -S -o $@ $<
 
 xen.lds: xen.lds.S
-	$(CC) -P -E -Ui386 $(AFLAGS) -o $@ $<
-	sed -e 's/xen\.lds\.o:/xen\.lds:/g' <.xen.lds.d >.xen.lds.d.new
-	mv -f .xen.lds.d.new .xen.lds.d
+	$(CPP) -P $(AFLAGS) -MQ $@ -o $@ $<
 
 dtb.o: $(CONFIG_DTB_FILE)
 
diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index a53bdcf979..beaa5ec016 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -233,14 +233,10 @@ $(BASEDIR)/include/asm-x86/asm-macros.h: asm-macros.i Makefile
 	$(call move-if-changed,$@.new,$@)
 
 xen.lds: xen.lds.S
-	$(CC) -P -E -Ui386 $(filter-out -Wa$(comma)%,$(AFLAGS)) -o $@ $<
-	sed -e 's/.*\.lds\.o:/$(@F):/g' <.$(@F).d >.$(@F).d.new
-	mv -f .$(@F).d.new .$(@F).d
+	$(CPP) -P $(filter-out -Wa$(comma)%,$(AFLAGS)) -MQ $@ -o $@ $<
 
 efi.lds: xen.lds.S
-	$(CC) -P -E -Ui386 -DEFI $(filter-out -Wa$(comma)%,$(AFLAGS)) -o $@ $<
-	sed -e 's/.*\.lds\.o:/$(@F):/g' <.$(@F).d >.$(@F).d.new
-	mv -f .$(@F).d.new .$(@F).d
+	$(CPP) -P -DEFI $(filter-out -Wa$(comma)%,$(AFLAGS)) -MQ $@ -o $@ $<
 
 boot/mkelf32: boot/mkelf32.c
 	$(HOSTCC) $(HOSTCFLAGS) -o $@ $<
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Sat Jun 27 14:59:26 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Jun 2020 14:59: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 1jpCIg-0006mZ-UE; Sat, 27 Jun 2020 14:59: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=MmMb=AI=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jpCIg-0006mS-9E
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:59:26 +0000
X-Inumbo-ID: cae0dc92-b886-11ea-8396-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id cae0dc92-b886-11ea-8396-12813bfff9fa;
 Sat, 27 Jun 2020 14:59: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=0eyRYhFxOELGrlL3CusRaoGYUxnMFO9yZkzMHy4PvG4=; b=UcrTI1uHL1SZs5cTHbk6oBxJTL
 KMBzjcVBOYIxmeRjovYoAJSm9xyNvaVpLvSFNIqRAPAIzr8JUgDI+86499LSAjK884PNrmGdsboaq
 3eOZR2VCJWpcDod97rIqQRHte2x2Jp9owt4D7IY7x0nOD8y9YJ7beKkK2y20XrluU15k=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCIf-00035b-L2
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:59:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCIf-0007XJ-KG
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:59:25 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.12] x86/Intel: insert Ice Lake and Comet Lake model
 numbers
Message-Id: <E1jpCIf-0007XJ-KG@xenbits.xenproject.org>
Date: Sat, 27 Jun 2020 14:59: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 96e8abab83d721ecf0bb0867e173e933778c6ba1
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jun 24 17:16:30 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 17:16:30 2020 +0200

    x86/Intel: insert Ice Lake and Comet Lake model numbers
    
    Both match prior generation processors as far as LBR and C-state MSRs
    go (SDM rev 072) as well as applicability of the if_pschange_mc erratum
    (recent spec updates).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 1fe406685cb19e9544681c6243e7d376deb0297e
    master date: 2020-06-09 12:55:53 +0200
---
 xen/arch/x86/acpi/cpu_idle.c | 6 ++++++
 xen/arch/x86/hvm/vmx/vmx.c   | 8 ++++++++
 2 files changed, 14 insertions(+)

diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c
index 4ff8693ae6..99e75c1d7e 100644
--- a/xen/arch/x86/acpi/cpu_idle.c
+++ b/xen/arch/x86/acpi/cpu_idle.c
@@ -165,9 +165,15 @@ static void do_get_hw_residencies(void *arg)
     case 0x4E:
     case 0x55:
     case 0x5E:
+    /* Ice Lake */
+    case 0x7D:
+    case 0x7E:
     /* Kaby Lake */
     case 0x8E:
     case 0x9E:
+    /* Comet Lake */
+    case 0xA5:
+    case 0xA6:
         GET_PC2_RES(hw_res->pc2);
         GET_CC7_RES(hw_res->cc7);
         /* fall through */
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 7d29065d0b..662c3988dd 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2507,8 +2507,12 @@ static bool __init has_if_pschange_mc(void)
     case 0x4e: /* Skylake M */
     case 0x5e: /* Skylake D */
     case 0x55: /* Skylake-X / Cascade Lake */
+    case 0x7d: /* Ice Lake */
+    case 0x7e: /* Ice Lake */
     case 0x8e: /* Kaby / Coffee / Whiskey Lake M */
     case 0x9e: /* Kaby / Coffee / Whiskey Lake D */
+    case 0xa5: /* Comet Lake H/S */
+    case 0xa6: /* Comet Lake U */
         return true;
 
         /*
@@ -2878,8 +2882,12 @@ static const struct lbr_info *last_branch_msr_get(void)
         case 0x66:
         /* Goldmont Plus */
         case 0x7a:
+        /* Ice Lake */
+        case 0x7d: case 0x7e:
         /* Kaby Lake */
         case 0x8e: case 0x9e:
+        /* Comet Lake */
+        case 0xa5: case 0xa6:
             return sk_lbr;
         /* Atom */
         case 0x1c: case 0x26: case 0x27: case 0x35: case 0x36:
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Sat Jun 27 14:59:37 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Jun 2020 14:59: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 1jpCIr-0006nr-10; Sat, 27 Jun 2020 14:59: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=MmMb=AI=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jpCIq-0006nm-CK
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:59:36 +0000
X-Inumbo-ID: d0e5088e-b886-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id d0e5088e-b886-11ea-bb8b-bc764e2007e4;
 Sat, 27 Jun 2020 14:59: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=E0Q3rDNlKSK6xoz8pS2JHVVEqE5bxIgTEM0WF/P99m4=; b=D8jekfBCRjzn3WqE6GiWz0vs/D
 avbjuG4k5pieg3YECm3bvadRLVbjLym5blrXuTsu9an56prIc0MdYiAV3Z97tcl091iToFGye+wkB
 2DkaJ6jyYG59hhclP/rNj9R3vsFSYxH34sUYLKpRAVVRaapPzmV+6yDXhmIp+mc1ZGV4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCIp-00035j-O5
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:59:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCIp-0007Xv-NN
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:59:35 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.12] ioreq: handle pending emulation racing with ioreq
 server destruction
Message-Id: <E1jpCIp-0007Xv-NN@xenbits.xenproject.org>
Date: Sat, 27 Jun 2020 14:59: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 436ec68ea251e634b05e67a8acf7bf40832e1da9
Author:     Paul Durrant <pdurrant@amazon.com>
AuthorDate: Wed Jun 24 17:17:05 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 17:17:05 2020 +0200

    ioreq: handle pending emulation racing with ioreq server destruction
    
    When an emulation request is initiated in hvm_send_ioreq() the guest vcpu is
    blocked on an event channel until that request is completed. If, however,
    the emulator is killed whilst that emulation is pending then the ioreq
    server may be destroyed. Thus when the vcpu is awoken the code in
    handle_hvm_io_completion() will find no pending request to wait for, but will
    leave the internal vcpu io_req.state set to IOREQ_READY and the vcpu shutdown
    deferall flag in place (because hvm_io_assist() will never be called). The
    emulation request is then completed anyway. This means that any subsequent call
    to hvmemul_do_io() will find an unexpected value in io_req.state and will
    return X86EMUL_UNHANDLEABLE, which in some cases will result in continuous
    re-tries.
    
    This patch fixes the issue by moving the setting of io_req.state and clearing
    of shutdown deferral (as will as MSI-X write completion) out of hvm_io_assist()
    and directly into handle_hvm_io_completion().
    
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Paul Durrant <pdurrant@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: f7039ee41b3d3448775a1623f230037fd0455104
    master date: 2020-06-09 12:56:24 +0200
---
 xen/arch/x86/hvm/ioreq.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/hvm/ioreq.c b/xen/arch/x86/hvm/ioreq.c
index f7466bf4bd..1eedfb3d5d 100644
--- a/xen/arch/x86/hvm/ioreq.c
+++ b/xen/arch/x86/hvm/ioreq.c
@@ -107,15 +107,7 @@ static void hvm_io_assist(struct hvm_ioreq_vcpu *sv, uint64_t data)
     ioreq_t *ioreq = &v->arch.hvm.hvm_io.io_req;
 
     if ( hvm_ioreq_needs_completion(ioreq) )
-    {
-        ioreq->state = STATE_IORESP_READY;
         ioreq->data = data;
-    }
-    else
-        ioreq->state = STATE_IOREQ_NONE;
-
-    msix_write_completion(v);
-    vcpu_end_shutdown_deferral(v);
 
     sv->pending = false;
 }
@@ -207,6 +199,12 @@ bool handle_hvm_io_completion(struct vcpu *v)
         }
     }
 
+    vio->io_req.state = hvm_ioreq_needs_completion(&vio->io_req) ?
+        STATE_IORESP_READY : STATE_IOREQ_NONE;
+
+    msix_write_completion(v);
+    vcpu_end_shutdown_deferral(v);
+
     io_completion = vio->io_completion;
     vio->io_completion = HVMIO_no_completion;
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Sat Jun 27 14:59:48 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Jun 2020 14:59: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 1jpCJ2-0006ow-2l; Sat, 27 Jun 2020 14:59: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=MmMb=AI=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jpCJ0-0006op-Si
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:59:46 +0000
X-Inumbo-ID: d6e90366-b886-11ea-8396-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id d6e90366-b886-11ea-8396-12813bfff9fa;
 Sat, 27 Jun 2020 14:59: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=IntqH9kThZi/1jycmAUaTJUiw8tA/Fa2V9pn4obnrDM=; b=p6gScIv8HC5AqI0xBQSbMgvB7J
 2nkbOKBFX79yNea2lcYqRY0eaC2BxoJ9ewpHNa6vfUwz6+lZd7Sh36U6tqnj7vjzmSG4As1Z+kcR/
 +xVdgr+/BprYeTxQAtGcwsJ+ymnadCrRFla9toIDx+BGMAC7szGDRbrPJ/9cuuDkpOTs=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCIz-00035r-R5
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:59:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpCIz-0007YX-QN
 for xen-changelog@lists.xenproject.org; Sat, 27 Jun 2020 14:59:45 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.12] libacpi: widen TPM detection
Message-Id: <E1jpCIz-0007YX-QN@xenbits.xenproject.org>
Date: Sat, 27 Jun 2020 14:59: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 050fe48dc981e0488de1f6c6c07d8110f3b7523b
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Wed Jun 24 17:17:38 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jun 24 17:17:38 2020 +0200

    libacpi: widen TPM detection
    
    The hardcoded tpm_signature is too restrictive to detect many TPMs.  For
    instance, it doesn't accept a QEMU emulated TPM (VID 0x1014 DID 0x0001).
    Make the TPM detection match that in rombios which accepts a wider
    range.
    
    With this change, the TPM's TCPA ACPI table is generated and the guest
    OS can automatically load the tpm_tis driver.  It also allows seabios to
    detect and use the TPM.  However, seabios skips some TPM initialization
    when running under Xen, so it will not populate any PCRs unless modified
    to run the initialization under Xen.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: d3db7e043cddd7e939195e014241ce2c5d436179
    master date: 2020-06-16 10:31:08 +0200
---
 tools/libacpi/build.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/tools/libacpi/build.c b/tools/libacpi/build.c
index fa7d14e090..a61dd5583a 100644
--- a/tools/libacpi/build.c
+++ b/tools/libacpi/build.c
@@ -351,7 +351,6 @@ static int construct_secondary_tables(struct acpi_ctxt *ctxt,
     struct acpi_20_waet *waet;
     struct acpi_20_tcpa *tcpa;
     unsigned char *ssdt;
-    static const uint16_t tis_signature[] = {0x0001, 0x0001, 0x0001};
     void *lasa;
 
     /* MADT. */
@@ -413,9 +412,8 @@ static int construct_secondary_tables(struct acpi_ctxt *ctxt,
 
     /* TPM TCPA and SSDT. */
     if ( (config->table_flags & ACPI_HAS_TCPA) &&
-         (config->tis_hdr[0] == tis_signature[0]) &&
-         (config->tis_hdr[1] == tis_signature[1]) &&
-         (config->tis_hdr[2] == tis_signature[2]) )
+         (config->tis_hdr[0] != 0 && config->tis_hdr[0] != 0xffff) &&
+         (config->tis_hdr[1] != 0 && config->tis_hdr[1] != 0xffff) )
     {
         ssdt = ctxt->mem_ops.alloc(ctxt, sizeof(ssdt_tpm), 16);
         if (!ssdt) return -1;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Mon Jun 29 06:33:11 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 29 Jun 2020 06:33: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 1jpnLk-0002vy-UI; Mon, 29 Jun 2020 06: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=Kq1Z=AK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jpnLj-0002vt-Dx
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:33:03 +0000
X-Inumbo-ID: 61be2e66-b9d2-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 61be2e66-b9d2-11ea-bca7-bc764e2007e4;
 Mon, 29 Jun 2020 06: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=A9q5rznonvrCg+fQ19y5V2hlfpMsGrob+491cTzK4/I=; b=sB8ZFiUUblHig646xnSX2a4dT0
 3C7AGHLt62xek9uJ3gB3CmMT2TYB2CmWaT4uhM4xp3tb63tCylA4k42z2uMKfcYrgG5l6LTmSHLGd
 FT1qksvpbwJP5aAHIM7AHU0Rw4a4Bp/qVtBNZWko9fHyS1jf3maIvFDRQn26u7pu+daE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpnLi-00040S-4H
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpnLi-0001zq-34
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:33:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] tools: fix error path of xendevicemodel_open()
Message-Id: <E1jpnLi-0001zq-34@xenbits.xenproject.org>
Date: Mon, 29 Jun 2020 06: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 f91d103e74d4c2efa60fb42b6e9d530a92838f8e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 10 12:40:04 2020 +0100
Commit:     Wei Liu <wl@xen.org>
CommitDate: Fri Jun 26 10:29:26 2020 +0000

    tools: fix error path of xendevicemodel_open()
    
    c/s 6902cb00e03 "tools/libxendevicemodel: extract functions and add a compat
    layer" introduced calls to both xencall_open() and osdep_xendevicemodel_open()
    but failed to fix up the error path.
    
    c/s f68c7c618a3 "libs/devicemodel: free xencall handle in error path in
    _open()" fixed up the xencall_open() aspect of the error path (missing the
    osdep_xendevicemodel_open() aspect), but positioned the xencall_close()
    incorrectly, creating the same pattern proved to be problematic by c/s
    30a72f02870 "tools: fix error path of xenhypfs_open()".
    
    Reposition xtl_logger_destroy(), and introduce the missing
    osdep_xendevicemodel_close().
    
    Fixes: 6902cb00e03 ("tools/libxendevicemodel: extract functions and add a compat layer")
    Fixes: f68c7c618a3 ("libs/devicemodel: free xencall handle in error path in _open()")
    Backport: 4.9+
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
    Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 tools/libs/devicemodel/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/libs/devicemodel/core.c b/tools/libs/devicemodel/core.c
index db501d9e80..4d4063956d 100644
--- a/tools/libs/devicemodel/core.c
+++ b/tools/libs/devicemodel/core.c
@@ -67,9 +67,10 @@ xendevicemodel_handle *xendevicemodel_open(xentoollog_logger *logger,
     return dmod;
 
 err:
-    xtl_logger_destroy(dmod->logger_tofree);
+    osdep_xendevicemodel_close(dmod);
     xentoolcore__deregister_active_handle(&dmod->tc_ah);
     xencall_close(dmod->xcall);
+    xtl_logger_destroy(dmod->logger_tofree);
     free(dmod);
     return NULL;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jun 29 06:33:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 29 Jun 2020 06: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 1jpnLu-0002y3-00; Mon, 29 Jun 2020 06: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=Kq1Z=AK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jpnLs-0002xx-T7
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:33:12 +0000
X-Inumbo-ID: 67bfa786-b9d2-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 67bfa786-b9d2-11ea-8496-bc764e2007e4;
 Mon, 29 Jun 2020 06: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=VULlLMdx0hnR4xUUWlg241/OkkrIT2ACBi7J7spB6qs=; b=Uj/8gTomKJXzCtPmRmkH8Uj9jx
 pdx6ZYAh14dCLjnHZNFMMNi8OyScpmSKF6MnyORF1vuZoGU9ebZy+rtnPRGZJdfPJU+ydqGGDMDBo
 lciLlI9zKnQlMGa993aKMMezjANoI1AuwKshNYWr2k9Y8ml+DwdA2OBvgTZS+ctREieU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpnLs-00040z-7d
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpnLs-00020O-6d
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:33:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] kdd: stop using [0] arrays to access packet contents
Message-Id: <E1jpnLs-00020O-6d@xenbits.xenproject.org>
Date: Mon, 29 Jun 2020 06: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 3471cafbdda35eacf04670881dd2aee2558b4f08
Author:     Tim Deegan <tim@xen.org>
AuthorDate: Fri Jun 26 10:40:44 2020 +0000
Commit:     Wei Liu <wl@xen.org>
CommitDate: Fri Jun 26 10:41:33 2020 +0000

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

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


From xen-changelog-bounces@lists.xenproject.org Mon Jun 29 06:33:24 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 29 Jun 2020 06: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 1jpnM4-0002z5-1X; Mon, 29 Jun 2020 06: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=Kq1Z=AK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jpnM2-0002yw-SX
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:33:22 +0000
X-Inumbo-ID: 6dc4823c-b9d2-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 6dc4823c-b9d2-11ea-b7bb-bc764e2007e4;
 Mon, 29 Jun 2020 06: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=g4Qu3C1NF6lYXJj39gMqBsWetGuyGE8hPHAu9KD8TWE=; b=OrdcTUGRk4NuEriRp/dCC7e5ZC
 uqkwhfdZShVUZosS04ZHYhU7hwsmjdtzlo5G/dPsflbr0uS+izKa0pY7wGCwZmdt+zyF+DJLeymk2
 vNZDpU/fQRUFXAXoQT7cOt5b5CCsOCYJE6XMkn1uy+4TWLQYJmPLvbdCEeEslopfzKj0=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpnM2-00041A-Ay
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpnM2-00020s-9t
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:33:22 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] libxl: tooling expects wrong errno
Message-Id: <E1jpnM2-00020s-9t@xenbits.xenproject.org>
Date: Mon, 29 Jun 2020 06: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 ed69c2ecaf3a6745b7c5a10cf2482e3c49cb8c4f
Author:     Grzegorz Uriasz <gorbak25@gmail.com>
AuthorDate: Sun Jun 14 16:17:08 2020 +0000
Commit:     Wei Liu <wl@xen.org>
CommitDate: Fri Jun 26 11:56:31 2020 +0000

    libxl: tooling expects wrong errno
    
    When iommu is not enabled for a given domain then pci passthrough
    hypercalls such as xc_test_assign_device return EOPNOTSUPP.
    The code responsible for this is in "iommu_do_domctl" inside
    xen/drivers/passthrough/iommu.c
    This patch fixes the error message reported by libxl when assigning
    pci devices to domains without iommu.
    
    Signed-off-by: Grzegorz Uriasz <gorbak25@gmail.com>
    Tested-by: Grzegorz Uriasz <gorbak25@gmail.com>
    Backport: 4.13
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/libxl/libxl_pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c
index 957ff5c8e9..bc5843b137 100644
--- a/tools/libxl/libxl_pci.c
+++ b/tools/libxl/libxl_pci.c
@@ -1561,7 +1561,7 @@ void libxl__device_pci_add(libxl__egc *egc, uint32_t domid,
             LOGD(ERROR, domid,
                  "PCI device %04x:%02x:%02x.%u %s?",
                  pcidev->domain, pcidev->bus, pcidev->dev, pcidev->func,
-                 errno == ENOSYS ? "cannot be assigned - no IOMMU"
+                 errno == EOPNOTSUPP ? "cannot be assigned - no IOMMU"
                  : "already assigned to a different guest");
             goto out;
         }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jun 29 06:33:36 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 29 Jun 2020 06: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 1jpnMG-00030O-2v; Mon, 29 Jun 2020 06:33:36 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Kq1Z=AK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jpnME-00030F-Ux
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:33:34 +0000
X-Inumbo-ID: 73c8d6a6-b9d2-11ea-852f-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 73c8d6a6-b9d2-11ea-852f-12813bfff9fa;
 Mon, 29 Jun 2020 06: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=Gwy6P1IWm0EdeYYIb0s5EV5Mi5EoVq1gg5wnbUC3IJ8=; b=EvL1M7QLLJqNvMbgJibiquxjXA
 rIx/uAczwg0oxfWTtMGb/XBKyWILmVgduWBR6CeA9YP6Wm1CAjP486Uug3dXvtKioYW846pbjlHEV
 1Cn20ylY+qf9YU54i6Rovo2ONp6jtdpQt4WuaixjZ66X8Hv7avu//AnkXy5viLr+I3Qs=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpnMC-00041I-ED
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpnMC-00021S-D8
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:33:32 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] vchan-socket-proxy: Ensure UNIX path NUL terminated
Message-Id: <E1jpnMC-00021S-D8@xenbits.xenproject.org>
Date: Mon, 29 Jun 2020 06: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 2c8ac47d4e780389842f812bb6b2f95fa673add5
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Wed Jun 10 23:29:27 2020 -0400
Commit:     Wei Liu <wl@xen.org>
CommitDate: Fri Jun 26 11:58:30 2020 +0000

    vchan-socket-proxy: Ensure UNIX path NUL terminated
    
    Check the socket path length to ensure sun_path is NUL terminated.
    
    This was spotted by Citrix's Coverity.
    
    Also use strcpy to avoid a warning "'__builtin_strncpy' specified bound
    108 equals destination size [-Werror=stringop-truncation]" flagged by
    gcc 10.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: Wei Liu <wl@xen.org>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/libvchan/vchan-socket-proxy.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/tools/libvchan/vchan-socket-proxy.c b/tools/libvchan/vchan-socket-proxy.c
index 13700c5d67..6ae1d84143 100644
--- a/tools/libvchan/vchan-socket-proxy.c
+++ b/tools/libvchan/vchan-socket-proxy.c
@@ -148,12 +148,18 @@ static int connect_socket(const char *path_or_fd) {
         return fd;
     }
 
+    if (strlen(path_or_fd) >= sizeof(addr.sun_path)) {
+        fprintf(stderr, "UNIX socket path \"%s\" too long (%zd >= %zd)\n",
+                path_or_fd, strlen(path_or_fd), sizeof(addr.sun_path));
+        return -1;
+    }
+
     fd = socket(AF_UNIX, SOCK_STREAM, 0);
     if (fd == -1)
         return -1;
 
     addr.sun_family = AF_UNIX;
-    strncpy(addr.sun_path, path_or_fd, sizeof(addr.sun_path));
+    strcpy(addr.sun_path, path_or_fd);
     if (connect(fd, (const struct sockaddr *)&addr, sizeof(addr)) == -1) {
         close(fd);
         return -1;
@@ -174,13 +180,19 @@ static int listen_socket(const char *path_or_fd) {
         return fd;
     }
 
+    if (strlen(path_or_fd) >= sizeof(addr.sun_path)) {
+        fprintf(stderr, "UNIX socket path \"%s\" too long (%zd >= %zd)\n",
+                path_or_fd, strlen(path_or_fd), sizeof(addr.sun_path));
+        return -1;
+    }
+
     /* if not a number, assume a socket path */
     fd = socket(AF_UNIX, SOCK_STREAM, 0);
     if (fd == -1)
         return -1;
 
     addr.sun_family = AF_UNIX;
-    strncpy(addr.sun_path, path_or_fd, sizeof(addr.sun_path));
+    strcpy(addr.sun_path, path_or_fd);
     if (bind(fd, (const struct sockaddr *)&addr, sizeof(addr)) == -1) {
         close(fd);
         return -1;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jun 29 06:33:44 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 29 Jun 2020 06:33:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jpnMO-00031I-4R; Mon, 29 Jun 2020 06:33: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=Kq1Z=AK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jpnMN-000316-3P
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:33:43 +0000
X-Inumbo-ID: 79cb0e48-b9d2-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 79cb0e48-b9d2-11ea-b7bb-bc764e2007e4;
 Mon, 29 Jun 2020 06: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=u4HNT1bP5uk7+NwHnoI+ES+mpcRAK/JbumlJdsH2DAg=; b=TpLLaRQSdcJSd/XVnuUkv9tZcd
 aWOt7GAD1SYMDYSGzHxP0SEQcQ6aRzY1rFRoqndahSyp03IyFYBxUT1f/yqFw1boWRXWfPlr3REpA
 MVfAwWftzoYl4LusHt7Rcnh/HId9nvmBMUbSY/F+P5YYWQNcpEJkyUhNDNdl6ew7OumI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpnMM-00041U-HD
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:33:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpnMM-00022D-GK
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:33:42 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] vchan-socket-proxy: Move perror() into listen_socket
Message-Id: <E1jpnMM-00022D-GK@xenbits.xenproject.org>
Date: Mon, 29 Jun 2020 06: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 01b9a28e7d1dc54968d5081bdc089449052df939
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Wed Jun 10 23:29:28 2020 -0400
Commit:     Wei Liu <wl@xen.org>
CommitDate: Fri Jun 26 11:59:38 2020 +0000

    vchan-socket-proxy: Move perror() into listen_socket
    
    The use of perror on the return from listen_socket can produce
    misleading results like:
    UNIX socket path "/tmp/aa....aa" too long (156 >= 108)
    listen socket: Success
    
    errno is reset by subsequent system & library calls, so it may be
    inaccurate by the time listen_socket returns.  Call perror immediately
    after failing system calls to print the proper message.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: Wei Liu <wl@xen.org>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/libvchan/vchan-socket-proxy.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tools/libvchan/vchan-socket-proxy.c b/tools/libvchan/vchan-socket-proxy.c
index 6ae1d84143..4edc3a44f5 100644
--- a/tools/libvchan/vchan-socket-proxy.c
+++ b/tools/libvchan/vchan-socket-proxy.c
@@ -188,16 +188,20 @@ static int listen_socket(const char *path_or_fd) {
 
     /* if not a number, assume a socket path */
     fd = socket(AF_UNIX, SOCK_STREAM, 0);
-    if (fd == -1)
+    if (fd == -1) {
+        perror("socket");
         return -1;
+    }
 
     addr.sun_family = AF_UNIX;
     strcpy(addr.sun_path, path_or_fd);
     if (bind(fd, (const struct sockaddr *)&addr, sizeof(addr)) == -1) {
+        perror("bind");
         close(fd);
         return -1;
     }
     if (listen(fd, 5) != 0) {
+        perror("listen");
         close(fd);
         return -1;
     }
@@ -419,7 +423,7 @@ int main(int argc, char **argv)
         } else {
             socket_fd = listen_socket(socket_path);
             if (socket_fd == -1) {
-                perror("listen socket");
+                fprintf(stderr, "listen socket failed\n");
                 return 1;
             }
         }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jun 29 06:33:54 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 29 Jun 2020 06: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 1jpnMY-00032j-EI; Mon, 29 Jun 2020 06:33: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=Kq1Z=AK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jpnMX-00032W-7D
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:33:53 +0000
X-Inumbo-ID: 7fd57b2a-b9d2-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 7fd57b2a-b9d2-11ea-8496-bc764e2007e4;
 Mon, 29 Jun 2020 06: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=Y7QICp3pd9eh73SO5fALh6+xAgYj9lMa8dWeEFIb10A=; b=VCUHLS1cwAHLy5M82shB3Oa2Qi
 54zn3JFiTFXwp3HXs+PD9I/7T17BjnqtaOpbRQGjKP8XCVX3DDARiTklooR2vT/SZJLq4jf6fDTfD
 rJZlwf2n6MkaikcQOYXHhbM3byhD3ixX7PZGSlIdMy4N4QKfaHqa5ATVP4MGlvB8T3pE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpnMW-00041e-Kk
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:33:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpnMW-00022q-JN
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:33:52 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] vchan-socket-proxy: Move perror() into connect_socket
Message-Id: <E1jpnMW-00022q-JN@xenbits.xenproject.org>
Date: Mon, 29 Jun 2020 06: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 fbdf181fe36516d74b77217207565e87511bf805
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Wed Jun 10 23:29:29 2020 -0400
Commit:     Wei Liu <wl@xen.org>
CommitDate: Fri Jun 26 11:59:41 2020 +0000

    vchan-socket-proxy: Move perror() into connect_socket
    
    errno is reset by subsequent system & library calls, so it may be
    inaccurate by the time connect_socket returns.  Call perror immediately
    after failing system calls to print the proper message.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: Wei Liu <wl@xen.org>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/libvchan/vchan-socket-proxy.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/libvchan/vchan-socket-proxy.c b/tools/libvchan/vchan-socket-proxy.c
index 4edc3a44f5..c6a83e4712 100644
--- a/tools/libvchan/vchan-socket-proxy.c
+++ b/tools/libvchan/vchan-socket-proxy.c
@@ -155,12 +155,15 @@ static int connect_socket(const char *path_or_fd) {
     }
 
     fd = socket(AF_UNIX, SOCK_STREAM, 0);
-    if (fd == -1)
+    if (fd == -1) {
+        perror("socket");
         return -1;
+    }
 
     addr.sun_family = AF_UNIX;
     strcpy(addr.sun_path, path_or_fd);
     if (connect(fd, (const struct sockaddr *)&addr, sizeof(addr)) == -1) {
+        perror("connect");
         close(fd);
         return -1;
     }
@@ -457,7 +460,7 @@ int main(int argc, char **argv)
                 input_fd = output_fd = connect_socket(socket_path);
             }
             if (input_fd == -1) {
-                perror("connect socket");
+                fprintf(stderr, "connect_socket failed\n");
                 return 1;
             }
             if (data_loop(ctrl, input_fd, output_fd) != 0)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jun 29 06:34:04 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 29 Jun 2020 06:34:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jpnMi-00034c-Fp; Mon, 29 Jun 2020 06:34:04 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Kq1Z=AK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jpnMh-00034M-Bd
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:34:03 +0000
X-Inumbo-ID: 85d4dea8-b9d2-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 85d4dea8-b9d2-11ea-bb8b-bc764e2007e4;
 Mon, 29 Jun 2020 06:34: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=vMX8W1dd7p76BWXKjTD8CbKpy8jN6sCf+cuMYqDFN0A=; b=UyXggHU1KXVvY83KlUfl0S2GiT
 8JRNKCpgyYgHF0j5Mq4neGTnPRMHEB1nlILjcQdSY4QFRsbtsVotmLSL0n6ZM1RUYteRjwi0H2ug0
 EB8/PEMFxF0zfE0I74UaH8nx/PuRexwcovPChgDz6rrEsXRhIBzP1+xjeRmFwpvikKvQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpnMg-00041z-NW
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:34:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpnMg-00023T-Mu
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:34:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] vchan-socket-proxy: Check xs_watch return value
Message-Id: <E1jpnMg-00023T-Mu@xenbits.xenproject.org>
Date: Mon, 29 Jun 2020 06:34: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 20b65c15a38d98f31f212925a3e5a733dce5b477
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Wed Jun 10 23:29:30 2020 -0400
Commit:     Wei Liu <wl@xen.org>
CommitDate: Fri Jun 26 11:59:46 2020 +0000

    vchan-socket-proxy: Check xs_watch return value
    
    Check the return value of xs_watch and error out on failure.
    
    This was found by Citrix's Coverity.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: Wei Liu <wl@xen.org>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/libvchan/vchan-socket-proxy.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/tools/libvchan/vchan-socket-proxy.c b/tools/libvchan/vchan-socket-proxy.c
index c6a83e4712..196f6016b9 100644
--- a/tools/libvchan/vchan-socket-proxy.c
+++ b/tools/libvchan/vchan-socket-proxy.c
@@ -232,8 +232,15 @@ static struct libxenvchan *connect_vchan(int domid, const char *path) {
         goto out;
     }
     /* wait for vchan server to create *path* */
-    xs_watch(xs, path, "path");
-    xs_watch(xs, "@releaseDomain", "release");
+    if (!xs_watch(xs, path, "path")) {
+        fprintf(stderr, "xs_watch(%s) failed.\n", path);
+        goto out;
+    }
+    if (!xs_watch(xs, "@releaseDomain", "release")) {
+        fprintf(stderr, "xs_watch(@releaseDomain failed.\n");
+        goto out;
+    }
+
     while ((watch_ret = xs_read_watch(xs, &watch_num))) {
         /* don't care about exact which fired the watch */
         free(watch_ret);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jun 29 06:34:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 29 Jun 2020 06:34:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jpnMs-000373-Iq; Mon, 29 Jun 2020 06:34:14 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Kq1Z=AK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jpnMr-00036l-IS
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:34:13 +0000
X-Inumbo-ID: 8be65cea-b9d2-11ea-852f-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 8be65cea-b9d2-11ea-852f-12813bfff9fa;
 Mon, 29 Jun 2020 06:34:13 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=hU2nYshc3qwdU0Gt5+Y3L/wQg41kdLUNPhwK6BZsAFI=; b=bqySqiVUAhNT11FLWkglEZNDAs
 HCjCZlSP49aROCbwV+hmdLiuYSUVBbs+jDUrpEiMthCSQIf3IkIC3ACpb7thdjjAt/wtFuekkJCw3
 gRu1oBuplilXzxBqZtCGlEpRqKAiR1VnW/tNeO/Bdi34FcEoz5Sk4sLPLdExyoqYxHY0=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpnMq-00042q-Qf
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:34:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpnMq-00024F-Pj
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:34:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] vchan-socket-proxy: Unify main return value
Message-Id: <E1jpnMq-00024F-Pj@xenbits.xenproject.org>
Date: Mon, 29 Jun 2020 06:34: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 2b1a2188111ec3f39de1c6e6ff834e6894d1e05a
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Wed Jun 10 23:29:31 2020 -0400
Commit:     Wei Liu <wl@xen.org>
CommitDate: Fri Jun 26 11:59:49 2020 +0000

    vchan-socket-proxy: Unify main return value
    
    Introduce 'ret' for main's return value and remove direct returns.  This
    is in preparation for a unified exit path with resource cleanup.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: Wei Liu <wl@xen.org>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/libvchan/vchan-socket-proxy.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/tools/libvchan/vchan-socket-proxy.c b/tools/libvchan/vchan-socket-proxy.c
index 196f6016b9..36a2fe2cb8 100644
--- a/tools/libvchan/vchan-socket-proxy.c
+++ b/tools/libvchan/vchan-socket-proxy.c
@@ -388,6 +388,7 @@ int main(int argc, char **argv)
     const char *vchan_path;
     const char *state_path = NULL;
     int opt;
+    int ret;
 
     while ((opt = getopt_long(argc, argv, "m:vs:", options, NULL)) != -1) {
         switch (opt) {
@@ -454,6 +455,8 @@ int main(int argc, char **argv)
         xs_close(xs);
     }
 
+    ret = 0;
+
     for (;;) {
         if (is_server) {
             /* wait for vchan connection */
@@ -468,7 +471,8 @@ int main(int argc, char **argv)
             }
             if (input_fd == -1) {
                 fprintf(stderr, "connect_socket failed\n");
-                return 1;
+                ret = 1;
+                break;
             }
             if (data_loop(ctrl, input_fd, output_fd) != 0)
                 break;
@@ -481,14 +485,16 @@ int main(int argc, char **argv)
                 input_fd = output_fd = accept(socket_fd, NULL, NULL);
             if (input_fd == -1) {
                 perror("accept");
-                return 1;
+                ret = 1;
+                break;
             }
             set_nonblocking(input_fd, 1);
             set_nonblocking(output_fd, 1);
             ctrl = connect_vchan(domid, vchan_path);
             if (!ctrl) {
                 perror("vchan client init");
-                return 1;
+                ret = 1;
+                break;
             }
             if (data_loop(ctrl, input_fd, output_fd) != 0)
                 break;
@@ -500,5 +506,6 @@ int main(int argc, char **argv)
             ctrl = NULL;
         }
     }
-    return 0;
+
+    return ret;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jun 29 06:34:24 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 29 Jun 2020 06:34:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jpnN2-00038b-KZ; Mon, 29 Jun 2020 06:34: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=Kq1Z=AK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jpnN1-00038L-Jd
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:34:23 +0000
X-Inumbo-ID: 91ddcbf6-b9d2-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 91ddcbf6-b9d2-11ea-8496-bc764e2007e4;
 Mon, 29 Jun 2020 06:34:23 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=fVc6N3BA12H2slwvqxqoMsi744uAeekUSGhkRW6om/c=; b=ReRjHtzWEYcAzk0m919/bS//0D
 0ceAvX0hrqRusen5jJ9706qBRgbjP6OWUwTku2JoeXqmbTEII8PtK4nWBGNCzqY2RtjvN4Xfsh32p
 vGuYZ/EkQOPi4tGdQaA44Gwbqny5H7gdHNdOhJK69RDq79tMfpMerGs1jHuJfIcah7fM=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpnN0-000432-Tj
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:34:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpnN0-000268-Su
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:34:22 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] vchan-socket-proxy: Use a struct to store state
Message-Id: <E1jpnN0-000268-Su@xenbits.xenproject.org>
Date: Mon, 29 Jun 2020 06:34: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 ace450ebdf120c081e02b40896dc719646708046
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Wed Jun 10 23:29:32 2020 -0400
Commit:     Wei Liu <wl@xen.org>
CommitDate: Fri Jun 26 11:59:53 2020 +0000

    vchan-socket-proxy: Use a struct to store state
    
    Use a struct to group the vchan ctrl and FDs.  This will facilite
    tracking the state of open and closed FDs and ctrl in data_loop().
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: Wei Liu <wl@xen.org>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/libvchan/vchan-socket-proxy.c | 52 +++++++++++++++++++++----------------
 1 file changed, 30 insertions(+), 22 deletions(-)

diff --git a/tools/libvchan/vchan-socket-proxy.c b/tools/libvchan/vchan-socket-proxy.c
index 36a2fe2cb8..a932c94c97 100644
--- a/tools/libvchan/vchan-socket-proxy.c
+++ b/tools/libvchan/vchan-socket-proxy.c
@@ -89,6 +89,12 @@ int insiz = 0;
 int outsiz = 0;
 int verbose = 0;
 
+struct vchan_proxy_state {
+    struct libxenvchan *ctrl;
+    int output_fd;
+    int input_fd;
+};
+
 static void vchan_wr(struct libxenvchan *ctrl) {
     int ret;
 
@@ -381,8 +387,9 @@ int main(int argc, char **argv)
 {
     int is_server = 0;
     int socket_fd = -1;
-    int input_fd, output_fd;
-    struct libxenvchan *ctrl = NULL;
+    struct vchan_proxy_state state = { .ctrl = NULL,
+                                       .input_fd = -1,
+                                       .output_fd = -1 };
     const char *socket_path;
     int domid;
     const char *vchan_path;
@@ -422,15 +429,15 @@ int main(int argc, char **argv)
     socket_path = argv[optind+2];
 
     if (is_server) {
-        ctrl = libxenvchan_server_init(NULL, domid, vchan_path, 0, 0);
-        if (!ctrl) {
+        state.ctrl = libxenvchan_server_init(NULL, domid, vchan_path, 0, 0);
+        if (!state.ctrl) {
             perror("libxenvchan_server_init");
             exit(1);
         }
     } else {
         if (strcmp(socket_path, "-") == 0) {
-            input_fd = 0;
-            output_fd = 1;
+            state.input_fd = 0;
+            state.output_fd = 1;
         } else {
             socket_fd = listen_socket(socket_path);
             if (socket_fd == -1) {
@@ -460,21 +467,21 @@ int main(int argc, char **argv)
     for (;;) {
         if (is_server) {
             /* wait for vchan connection */
-            while (libxenvchan_is_open(ctrl) != 1)
-                libxenvchan_wait(ctrl);
+            while (libxenvchan_is_open(state.ctrl) != 1)
+                libxenvchan_wait(state.ctrl);
             /* vchan client connected, setup local FD if needed */
             if (strcmp(socket_path, "-") == 0) {
-                input_fd = 0;
-                output_fd = 1;
+                state.input_fd = 0;
+                state.output_fd = 1;
             } else {
-                input_fd = output_fd = connect_socket(socket_path);
+                state.input_fd = state.output_fd = connect_socket(socket_path);
             }
-            if (input_fd == -1) {
+            if (state.input_fd == -1) {
                 fprintf(stderr, "connect_socket failed\n");
                 ret = 1;
                 break;
             }
-            if (data_loop(ctrl, input_fd, output_fd) != 0)
+            if (data_loop(state.ctrl, state.input_fd, state.output_fd) != 0)
                 break;
             /* keep it running only when get UNIX socket path */
             if (socket_path[0] != '/')
@@ -482,28 +489,29 @@ int main(int argc, char **argv)
         } else {
             /* wait for local socket connection */
             if (strcmp(socket_path, "-") != 0)
-                input_fd = output_fd = accept(socket_fd, NULL, NULL);
-            if (input_fd == -1) {
+                state.input_fd = state.output_fd = accept(socket_fd,
+                                                          NULL, NULL);
+            if (state.input_fd == -1) {
                 perror("accept");
                 ret = 1;
                 break;
             }
-            set_nonblocking(input_fd, 1);
-            set_nonblocking(output_fd, 1);
-            ctrl = connect_vchan(domid, vchan_path);
-            if (!ctrl) {
+            set_nonblocking(state.input_fd, 1);
+            set_nonblocking(state.output_fd, 1);
+            state.ctrl = connect_vchan(domid, vchan_path);
+            if (!state.ctrl) {
                 perror("vchan client init");
                 ret = 1;
                 break;
             }
-            if (data_loop(ctrl, input_fd, output_fd) != 0)
+            if (data_loop(state.ctrl, state.input_fd, state.output_fd) != 0)
                 break;
             /* don't reconnect if output was stdout */
             if (strcmp(socket_path, "-") == 0)
                 break;
 
-            libxenvchan_close(ctrl);
-            ctrl = NULL;
+            libxenvchan_close(state.ctrl);
+            state.ctrl = NULL;
         }
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jun 29 06:34:35 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 29 Jun 2020 06:34:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jpnND-0003AQ-MI; Mon, 29 Jun 2020 06:34: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=Kq1Z=AK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jpnNC-0003AG-RD
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:34:34 +0000
X-Inumbo-ID: 97e290e0-b9d2-11ea-852f-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 97e290e0-b9d2-11ea-852f-12813bfff9fa;
 Mon, 29 Jun 2020 06:34:33 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=ieYIZwO7fSDh5VHc6teXpzwrL3tzCopbg1xjfycvpsw=; b=3DrFEa5KOSdQRxqJjag9NyYdGD
 hguUS7cFv2ycKRqi07QC6GJDxHofNRDrAgNMgnDCZSbgeCZniWdzw0iDsB/5iQM/egVzfqrYDtU1F
 R/iJyoRNH5Q0GLXCGKbb9mUIapcc7ONNLi9vjYOxPSLfdMBcHQfyfRhYquplmxTFoPUM=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpnNB-000439-0H
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:34:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpnNA-00026w-Vu
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:34:32 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] vchan-socket-proxy: Switch data_loop() to take state
Message-Id: <E1jpnNA-00026w-Vu@xenbits.xenproject.org>
Date: Mon, 29 Jun 2020 06:34: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 bfb310ee686bc36c9a8f9c15c42f97f96206cd29
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Wed Jun 10 23:29:33 2020 -0400
Commit:     Wei Liu <wl@xen.org>
CommitDate: Fri Jun 26 11:59:56 2020 +0000

    vchan-socket-proxy: Switch data_loop() to take state
    
    Switch data_loop to take a pointer to vchan_proxy_state.
    
    No functional change.
    
    This removes a dead store to input_fd identified by Coverity.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: Wei Liu <wl@xen.org>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/libvchan/vchan-socket-proxy.c | 65 +++++++++++++++++++------------------
 1 file changed, 33 insertions(+), 32 deletions(-)

diff --git a/tools/libvchan/vchan-socket-proxy.c b/tools/libvchan/vchan-socket-proxy.c
index a932c94c97..29a12260ed 100644
--- a/tools/libvchan/vchan-socket-proxy.c
+++ b/tools/libvchan/vchan-socket-proxy.c
@@ -286,13 +286,13 @@ static void discard_buffers(struct libxenvchan *ctrl) {
     }
 }
 
-int data_loop(struct libxenvchan *ctrl, int input_fd, int output_fd)
+int data_loop(struct vchan_proxy_state *state)
 {
     int ret;
     int libxenvchan_fd;
     int max_fd;
 
-    libxenvchan_fd = libxenvchan_fd_for_select(ctrl);
+    libxenvchan_fd = libxenvchan_fd_for_select(state->ctrl);
     for (;;) {
         fd_set rfds;
         fd_set wfds;
@@ -300,15 +300,15 @@ int data_loop(struct libxenvchan *ctrl, int input_fd, int output_fd)
         FD_ZERO(&wfds);
 
         max_fd = -1;
-        if (input_fd != -1 && insiz != BUFSIZE) {
-            FD_SET(input_fd, &rfds);
-            if (input_fd > max_fd)
-                max_fd = input_fd;
+        if (state->input_fd != -1 && insiz != BUFSIZE) {
+            FD_SET(state->input_fd, &rfds);
+            if (state->input_fd > max_fd)
+                max_fd = state->input_fd;
         }
-        if (output_fd != -1 && outsiz) {
-            FD_SET(output_fd, &wfds);
-            if (output_fd > max_fd)
-                max_fd = output_fd;
+        if (state->output_fd != -1 && outsiz) {
+            FD_SET(state->output_fd, &wfds);
+            if (state->output_fd > max_fd)
+                max_fd = state->output_fd;
         }
         FD_SET(libxenvchan_fd, &rfds);
         if (libxenvchan_fd > max_fd)
@@ -319,52 +319,53 @@ int data_loop(struct libxenvchan *ctrl, int input_fd, int output_fd)
             exit(1);
         }
         if (FD_ISSET(libxenvchan_fd, &rfds)) {
-            libxenvchan_wait(ctrl);
-            if (!libxenvchan_is_open(ctrl)) {
+            libxenvchan_wait(state->ctrl);
+            if (!libxenvchan_is_open(state->ctrl)) {
                 if (verbose)
                     fprintf(stderr, "vchan client disconnected\n");
                 while (outsiz)
-                    socket_wr(output_fd);
-                close(output_fd);
-                close(input_fd);
-                discard_buffers(ctrl);
+                    socket_wr(state->output_fd);
+                close(state->output_fd);
+                close(state->input_fd);
+                discard_buffers(state->ctrl);
                 break;
             }
-            vchan_wr(ctrl);
+            vchan_wr(state->ctrl);
         }
 
-        if (FD_ISSET(input_fd, &rfds)) {
-            ret = read(input_fd, inbuf + insiz, BUFSIZE - insiz);
+        if (FD_ISSET(state->input_fd, &rfds)) {
+            ret = read(state->input_fd, inbuf + insiz, BUFSIZE - insiz);
             if (ret < 0 && errno != EAGAIN)
                 exit(1);
             if (verbose)
                 fprintf(stderr, "from-unix: %.*s\n", ret, inbuf + insiz);
             if (ret == 0) {
                 /* EOF on socket, write everything in the buffer and close the
-                 * input_fd socket */
+                 * state->input_fd socket */
                 while (insiz) {
-                    vchan_wr(ctrl);
-                    libxenvchan_wait(ctrl);
+                    vchan_wr(state->ctrl);
+                    libxenvchan_wait(state->ctrl);
                 }
-                close(input_fd);
-                input_fd = -1;
+                close(state->input_fd);
+                state->input_fd = -1;
                 /* TODO: maybe signal the vchan client somehow? */
                 break;
             }
             if (ret)
                 insiz += ret;
-            vchan_wr(ctrl);
+            vchan_wr(state->ctrl);
         }
-        if (FD_ISSET(output_fd, &wfds))
-            socket_wr(output_fd);
-        while (libxenvchan_data_ready(ctrl) && outsiz < BUFSIZE) {
-            ret = libxenvchan_read(ctrl, outbuf + outsiz, BUFSIZE - outsiz);
+        if (FD_ISSET(state->output_fd, &wfds))
+            socket_wr(state->output_fd);
+        while (libxenvchan_data_ready(state->ctrl) && outsiz < BUFSIZE) {
+            ret = libxenvchan_read(state->ctrl, outbuf + outsiz,
+                                   BUFSIZE - outsiz);
             if (ret < 0)
                 exit(1);
             if (verbose)
                 fprintf(stderr, "from-vchan: %.*s\n", ret, outbuf + outsiz);
             outsiz += ret;
-            socket_wr(output_fd);
+            socket_wr(state->output_fd);
         }
     }
     return 0;
@@ -481,7 +482,7 @@ int main(int argc, char **argv)
                 ret = 1;
                 break;
             }
-            if (data_loop(state.ctrl, state.input_fd, state.output_fd) != 0)
+            if (data_loop(&state) != 0)
                 break;
             /* keep it running only when get UNIX socket path */
             if (socket_path[0] != '/')
@@ -504,7 +505,7 @@ int main(int argc, char **argv)
                 ret = 1;
                 break;
             }
-            if (data_loop(state.ctrl, state.input_fd, state.output_fd) != 0)
+            if (data_loop(&state) != 0)
                 break;
             /* don't reconnect if output was stdout */
             if (strcmp(socket_path, "-") == 0)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jun 29 06:34:44 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 29 Jun 2020 06:34: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 1jpnNM-0003BX-Nz; Mon, 29 Jun 2020 06:34:44 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Kq1Z=AK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jpnNL-0003BM-L0
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:34:43 +0000
X-Inumbo-ID: 9dc61a05-b9d2-11ea-852f-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 9dc61a05-b9d2-11ea-852f-12813bfff9fa;
 Mon, 29 Jun 2020 06:34:43 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=WeD4gdxn/U2i9ixsWHEVBcA8+UKHWIo8u5fOFO6OMyE=; b=SAU4dP2tkFhHd2rwRsgeYxeFwC
 nRaM5TT3uO69o+ac6E+KO3BWCgZ8hwerIWug8MxQXjZtfS9/hv68vni/5RWTfSVzXYPQ50GO+T87Z
 +SKPLX6jqtFyRI2So4KLRyMXdRASggQ9JVhThwcVPm1gFQrz77LeEMyFIR3BacM6enhI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpnNL-00043H-3L
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:34:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpnNL-00027u-2W
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:34:43 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] vchan-socket-proxy: Set closed FDs to -1
Message-Id: <E1jpnNL-00027u-2W@xenbits.xenproject.org>
Date: Mon, 29 Jun 2020 06:34: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 620225c48573396dc2394f59080a2d704a566c9d
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Wed Jun 10 23:29:34 2020 -0400
Commit:     Wei Liu <wl@xen.org>
CommitDate: Fri Jun 26 11:59:59 2020 +0000

    vchan-socket-proxy: Set closed FDs to -1
    
    These FDs are closed, so set them to -1 so they are no longer valid.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: Wei Liu <wl@xen.org>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/libvchan/vchan-socket-proxy.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/libvchan/vchan-socket-proxy.c b/tools/libvchan/vchan-socket-proxy.c
index 29a12260ed..cd7629bc4e 100644
--- a/tools/libvchan/vchan-socket-proxy.c
+++ b/tools/libvchan/vchan-socket-proxy.c
@@ -326,7 +326,9 @@ int data_loop(struct vchan_proxy_state *state)
                 while (outsiz)
                     socket_wr(state->output_fd);
                 close(state->output_fd);
+                state->output_fd = -1;
                 close(state->input_fd);
+                state->input_fd = -1;
                 discard_buffers(state->ctrl);
                 break;
             }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jun 29 06:34:54 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 29 Jun 2020 06:34:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jpnNW-0003DB-Pn; Mon, 29 Jun 2020 06:34:54 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Kq1Z=AK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jpnNV-0003Cv-PZ
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:34:53 +0000
X-Inumbo-ID: a3ebc726-b9d2-11ea-852f-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id a3ebc726-b9d2-11ea-852f-12813bfff9fa;
 Mon, 29 Jun 2020 06:34:53 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=FOpti+wuHWDcVeicxeypeEJMcYyh7c4E2Mr02Wt7USI=; b=D/TqdnrWZv4KYXM6XQDwEO3xC6
 dMoc57ULbc+MUr+NaRPEWEb68stvqa8x4T+jKmyLN1F8aLunO6DcwiBbSfONMEBN3iGi2t3e5Z0Bh
 1whcHUFDvaLxRcAtADshdGkAd8JIbVxV0IqNiMs+7F3gVK4iBfRWVoJmuCtmrqLtZ7yw=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpnNV-00043P-6a
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:34:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpnNV-00028q-5e
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:34:53 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] vchan-socket-proxy: Cleanup resources on exit
Message-Id: <E1jpnNV-00028q-5e@xenbits.xenproject.org>
Date: Mon, 29 Jun 2020 06:34: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 d20c0f1a7864a38b6c26d11d0e44467fba118625
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Wed Jun 10 23:29:35 2020 -0400
Commit:     Wei Liu <wl@xen.org>
CommitDate: Fri Jun 26 12:00:02 2020 +0000

    vchan-socket-proxy: Cleanup resources on exit
    
    Close open FDs and close th vchan connection when exiting the program.
    
    This addresses some Coverity findings about leaking file descriptors.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: Wei Liu <wl@xen.org>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/libvchan/vchan-socket-proxy.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tools/libvchan/vchan-socket-proxy.c b/tools/libvchan/vchan-socket-proxy.c
index cd7629bc4e..3552783ec2 100644
--- a/tools/libvchan/vchan-socket-proxy.c
+++ b/tools/libvchan/vchan-socket-proxy.c
@@ -518,5 +518,14 @@ int main(int argc, char **argv)
         }
     }
 
+    if (state.output_fd >= 0)
+        close(state.output_fd);
+    if (state.input_fd >= 0)
+        close(state.input_fd);
+    if (state.ctrl)
+        libxenvchan_close(state.ctrl);
+    if (socket_fd >= 0)
+        close(socket_fd);
+
     return ret;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jun 29 06:35:04 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 29 Jun 2020 06:35:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jpnNg-0003EL-Ri; Mon, 29 Jun 2020 06:35: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=Kq1Z=AK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jpnNg-0003EB-07
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:35:04 +0000
X-Inumbo-ID: a9f0f2ae-b9d2-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id a9f0f2ae-b9d2-11ea-bca7-bc764e2007e4;
 Mon, 29 Jun 2020 06:35: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=7lFWm5JnUVizwSWth+Z/RSeEuz7d6AicrmU18X2XG8I=; b=TA+wfc8f6RQiVg1aKjKLe7oYsL
 zxN2nat6YfQ+jU3VrF/OhHvTGidVJJM2jDXJsXrmC7/kvqpbpzdTx9stV/R+IO7eiliC+W0zQgLrE
 XH5siiPii2b09y2ORmIPdAfobeZ63182ExroPPmdhWtYg0YlGlFFWABVpOL/N8nps9V8=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpnNf-00044A-9a
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:35:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpnNf-00029w-8q
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:35:03 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] vchan-socket-proxy: Handle closing shared input/output_fd
Message-Id: <E1jpnNf-00029w-8q@xenbits.xenproject.org>
Date: Mon, 29 Jun 2020 06:35: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 40b532fbdcb2095da7152a1d08d9f0288524c223
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Wed Jun 10 23:29:36 2020 -0400
Commit:     Wei Liu <wl@xen.org>
CommitDate: Fri Jun 26 12:00:05 2020 +0000

    vchan-socket-proxy: Handle closing shared input/output_fd
    
    input_fd & output_fd may be the same FD.  In that case, mark both as -1
    when closing one.  That avoids a dangling FD reference.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: Wei Liu <wl@xen.org>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/libvchan/vchan-socket-proxy.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/libvchan/vchan-socket-proxy.c b/tools/libvchan/vchan-socket-proxy.c
index 3552783ec2..e1d959c6d1 100644
--- a/tools/libvchan/vchan-socket-proxy.c
+++ b/tools/libvchan/vchan-socket-proxy.c
@@ -349,6 +349,8 @@ int data_loop(struct vchan_proxy_state *state)
                     libxenvchan_wait(state->ctrl);
                 }
                 close(state->input_fd);
+                if (state->input_fd == state->output_fd)
+                    state->output_fd = -1;
                 state->input_fd = -1;
                 /* TODO: maybe signal the vchan client somehow? */
                 break;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jun 29 06:35:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 29 Jun 2020 06:35:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jpnNq-0003GR-UW; Mon, 29 Jun 2020 06:35:14 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Kq1Z=AK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jpnNq-0003GG-0C
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:35:14 +0000
X-Inumbo-ID: aff4a754-b9d2-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id aff4a754-b9d2-11ea-bca7-bc764e2007e4;
 Mon, 29 Jun 2020 06:35: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=vYI7u8O7oif9r76Z5Z0WC4D4VUThbIiF4PFuhJJ8Y6M=; b=di87DXEsoinas03cOBh5WMMxjv
 iCzesAD24swnaPX/qMdpLc1K186FIKOLmGYt5kw210PyO+2vZoYB8J3Rb4VdT8bTq/ViWifeCXs4q
 IJktMixEdUBelj/7tX8aqifD01PQXY4Bh3XT1E4AZ6HpAEgHY2Po7hDRn3XEDw05QLj4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpnNp-00044I-Cg
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:35:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpnNp-0002An-Bp
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:35:13 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/msr: Disallow access to Processor Trace MSRs
Message-Id: <E1jpnNp-0002An-Bp@xenbits.xenproject.org>
Date: Mon, 29 Jun 2020 06:35: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 bcdfbb70fca579baa04f212c0936b77919bdae11
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jun 19 12:14:32 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Jun 26 16:34:02 2020 +0100

    x86/msr: Disallow access to Processor Trace MSRs
    
    We do not expose the feature to guests, so should disallow access to the
    respective MSRs.  For simplicity, drop the entire block of MSRs, not just the
    subset which have been specified thus far.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Wei Liu <wl@xen.org>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/arch/x86/msr.c              | 2 ++
 xen/include/asm-x86/msr-index.h | 8 ++++++++
 2 files changed, 10 insertions(+)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 0bfb5839b2..22f921cc71 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -168,6 +168,7 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
     case MSR_MCU_OPT_CTRL:
+    case MSR_RTIT_OUTPUT_BASE ... MSR_RTIT_ADDR_B(7):
     case MSR_U_CET:
     case MSR_S_CET:
     case MSR_PL0_SSP ... MSR_INTERRUPT_SSP_TABLE:
@@ -329,6 +330,7 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
     case MSR_MCU_OPT_CTRL:
+    case MSR_RTIT_OUTPUT_BASE ... MSR_RTIT_ADDR_B(7):
     case MSR_U_CET:
     case MSR_S_CET:
     case MSR_PL0_SSP ... MSR_INTERRUPT_SSP_TABLE:
diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h
index b328a47ed8..0fe98af923 100644
--- a/xen/include/asm-x86/msr-index.h
+++ b/xen/include/asm-x86/msr-index.h
@@ -69,6 +69,14 @@
 #define MSR_MCU_OPT_CTRL                    0x00000123
 #define  MCU_OPT_CTRL_RNGDS_MITG_DIS        (_AC(1, ULL) <<  0)
 
+#define MSR_RTIT_OUTPUT_BASE                0x00000560
+#define MSR_RTIT_OUTPUT_MASK                0x00000561
+#define MSR_RTIT_CTL                        0x00000570
+#define MSR_RTIT_STATUS                     0x00000571
+#define MSR_RTIT_CR3_MATCH                  0x00000572
+#define MSR_RTIT_ADDR_A(n)                 (0x00000580 + (n) * 2)
+#define MSR_RTIT_ADDR_B(n)                 (0x00000581 + (n) * 2)
+
 #define MSR_U_CET                           0x000006a0
 #define MSR_S_CET                           0x000006a2
 #define  CET_SHSTK_EN                       (_AC(1, ULL) <<  0)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jun 29 06:35:25 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 29 Jun 2020 06:35:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jpnO1-0003Hb-0E; Mon, 29 Jun 2020 06:35: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=Kq1Z=AK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jpnO0-0003HS-AJ
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:35:24 +0000
X-Inumbo-ID: b5f71f10-b9d2-11ea-852f-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id b5f71f10-b9d2-11ea-852f-12813bfff9fa;
 Mon, 29 Jun 2020 06:35: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=F/RA7y9GH9QwJTYgT0xTjGqlndBIcupAYSaM8wrcGWc=; b=bP61DlJjsnzY346vASGB8SQ+5Z
 /y/gAX7pBxCZfv8cBjRxZFNCJ6nTWiTr+bvHOcc5GA/nBPMgoJmWHPbVxGwiBkzHJJhqoMDxM5NPk
 0M91Y+7UlTQWnzaAzRPbId/+3M4bpJudS+CfoRDD1PaepBXQ6M8reGmmxDZS1kLbKofI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpnNz-00044W-FY
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:35:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpnNz-0002Bi-Es
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:35:23 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/livepatch: Make livepatching compatible with CET
 Shadow Stacks
Message-Id: <E1jpnNz-0002Bi-Es@xenbits.xenproject.org>
Date: Mon, 29 Jun 2020 06:35: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 92167e9430c010df410336f2b68cc4e30b7872d9
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Jun 8 18:47:58 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Jun 26 16:34:02 2020 +0100

    x86/livepatch: Make livepatching compatible with CET Shadow Stacks
    
    Just like the alternatives infrastructure, the livepatch infrastructure
    disables CR0.WP to perform patching, which is not permitted with CET active.
    
    Modify arch_livepatch_{quiesce,revive}() to disable CET before disabling WP,
    and reset the dirty bits on all virtual regions before re-enabling CET.
    
    One complication is that arch_livepatch_revive() has to fix up the top of the
    shadow stack.  This depends on the functions not being inlined, even under
    LTO.  Another limitation is that reset_virtual_region_perms() may shatter the
    final superpage of .text depending on alignment.
    
    This logic, and its downsides, are temporary until the patching infrastructure
    can be adjusted to not use CR0.WP.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/arch/x86/livepatch.c         | 35 +++++++++++++++++++++++++++++++++--
 xen/common/virtual_region.c      | 15 +++++++++++++++
 xen/include/xen/virtual_region.h |  1 +
 3 files changed, 49 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/livepatch.c b/xen/arch/x86/livepatch.c
index 901fad96bf..49f0d902e5 100644
--- a/xen/arch/x86/livepatch.c
+++ b/xen/arch/x86/livepatch.c
@@ -12,6 +12,7 @@
 #include <xen/livepatch.h>
 #include <xen/sched.h>
 #include <xen/vm_event.h>
+#include <xen/virtual_region.h>
 
 #include <asm/fixmap.h>
 #include <asm/nmi.h>
@@ -56,18 +57,48 @@ int arch_livepatch_safety_check(void)
     return -EBUSY;
 }
 
-int arch_livepatch_quiesce(void)
+int noinline arch_livepatch_quiesce(void)
 {
+    /* If Shadow Stacks are in use, disable CR4.CET so we can modify CR0.WP. */
+    if ( cpu_has_xen_shstk )
+        write_cr4(read_cr4() & ~X86_CR4_CET);
+
     /* Disable WP to allow changes to read-only pages. */
     write_cr0(read_cr0() & ~X86_CR0_WP);
 
     return 0;
 }
 
-void arch_livepatch_revive(void)
+void noinline arch_livepatch_revive(void)
 {
     /* Reinstate WP. */
     write_cr0(read_cr0() | X86_CR0_WP);
+
+    /* Clobber dirty bits and reinstate CET, if applicable. */
+    if ( IS_ENABLED(CONFIG_XEN_SHSTK) && cpu_has_xen_shstk )
+    {
+        unsigned long tmp;
+
+        reset_virtual_region_perms();
+
+        write_cr4(read_cr4() | X86_CR4_CET);
+
+        /*
+         * Fix up the return address on the shadow stack, which currently
+         * points at arch_livepatch_quiesce()'s caller.
+         *
+         * Note: this is somewhat fragile, and depends on both
+         * arch_livepatch_{quiesce,revive}() being called from the same
+         * function, which is currently the case.
+         *
+         * Any error will result in Xen dying with #CP, and its too late to
+         * recover in any way.
+         */
+        asm volatile ("rdsspq %[ssp];"
+                      "wrssq %[addr], (%[ssp]);"
+                      : [ssp] "=&r" (tmp)
+                      : [addr] "r" (__builtin_return_address(0)));
+    }
 }
 
 int arch_livepatch_verify_func(const struct livepatch_func *func)
diff --git a/xen/common/virtual_region.c b/xen/common/virtual_region.c
index aa23918bce..4fbc02e35a 100644
--- a/xen/common/virtual_region.c
+++ b/xen/common/virtual_region.c
@@ -4,6 +4,7 @@
 
 #include <xen/init.h>
 #include <xen/kernel.h>
+#include <xen/mm.h>
 #include <xen/rcupdate.h>
 #include <xen/spinlock.h>
 #include <xen/virtual_region.h>
@@ -91,6 +92,20 @@ void unregister_virtual_region(struct virtual_region *r)
     remove_virtual_region(r);
 }
 
+#if defined(CONFIG_LIVEPATCH) && defined(CONFIG_XEN_SHSTK)
+void reset_virtual_region_perms(void)
+{
+    const struct virtual_region *region;
+
+    rcu_read_lock(&rcu_virtual_region_lock);
+    list_for_each_entry_rcu( region, &virtual_region_list, list )
+        modify_xen_mappings((unsigned long)region->start,
+                            ROUNDUP((unsigned long)region->end, PAGE_SIZE),
+                            PAGE_HYPERVISOR_RX);
+    rcu_read_unlock(&rcu_virtual_region_lock);
+}
+#endif
+
 void __init unregister_init_virtual_region(void)
 {
     BUG_ON(system_state != SYS_STATE_active);
diff --git a/xen/include/xen/virtual_region.h b/xen/include/xen/virtual_region.h
index e5e58ed96b..ba408eb87a 100644
--- a/xen/include/xen/virtual_region.h
+++ b/xen/include/xen/virtual_region.h
@@ -33,6 +33,7 @@ void setup_virtual_regions(const struct exception_table_entry *start,
 void unregister_init_virtual_region(void);
 void register_virtual_region(struct virtual_region *r);
 void unregister_virtual_region(struct virtual_region *r);
+void reset_virtual_region_perms(void);
 
 #endif /* __XEN_VIRTUAL_REGION_H__ */
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jun 29 06:35:35 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 29 Jun 2020 06:35:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jpnOB-0003J0-25; Mon, 29 Jun 2020 06:35: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=Kq1Z=AK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jpnOA-0003Is-66
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:35:34 +0000
X-Inumbo-ID: bbfacab0-b9d2-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id bbfacab0-b9d2-11ea-bca7-bc764e2007e4;
 Mon, 29 Jun 2020 06:35: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=XqkXF418J4g4eRfVifRRPVJcRf70p3Pignq379YIYGs=; b=f1gLJl48j3ixqJ6t6Cbg5shhkt
 1tQIiH4EzEvKoZCvyn+JcGM+0eP/WPgTdgn2EiNmG+qz+QytlT+o8XkJc5XGN8J5Exvs/h43o0Q2u
 j0/tAoks8orpgiQ5fNr4KX/DzxMz8j7g/h4r60gkHWo+D45JXDoK2hX4kIUIkIm7hLII=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpnO9-00044e-IW
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:35:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpnO9-0002Ck-Hq
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 06:35:33 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] changelog: Add notes about CET and Migration changes
Message-Id: <E1jpnO9-0002Ck-Hq@xenbits.xenproject.org>
Date: Mon, 29 Jun 2020 06:35: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 88cfd062e8318dfeb67c7d2eb50b6cd224b0738a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jun 26 15:35:27 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Jun 26 16:34:02 2020 +0100

    changelog: Add notes about CET and Migration changes
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 CHANGELOG.md | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 43fd260156..5c3d3c791d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -21,6 +21,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - New 'domid_policy', allowing domain-ids to be randomly chosen.
  - Option to preserve domain-id across migrate or save+restore.
  - Support in kdd for initial KD protocol handshake for Win 7, 8 and 10 (64 bit).
+ - Tech preview support for Control-flow Execution Technology, with Xen using
+   Supervisor Shadow Stacks for its own protection.
+
+### Changed
+ - The CPUID data seen by a guest on boot is now moved in the migration
+   stream.  A guest migrating between non-identical hardware will now no
+   longer observe details such as Family/Model/Stepping, Cache, etc changing.
+   An administrator still needs to take care to ensure the features visible to
+   the guest at boot are compatible with anywhere it might migrate.
 
 ## [4.13.0](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.13.0) - 2019-12-17
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jun 29 12:44:11 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 29 Jun 2020 12: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 1jpt8o-0002dc-MZ; Mon, 29 Jun 2020 12: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=Kq1Z=AK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jpt8n-0002dX-RY
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 12:44:05 +0000
X-Inumbo-ID: 377851a2-ba06-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 377851a2-ba06-11ea-bb8b-bc764e2007e4;
 Mon, 29 Jun 2020 12: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=T3PoZkOHp+wuFjT8H0DeHTAOo//UAzi29+2ZwbTMcTY=; b=VHmevzHe6SW5tJFxt8YvQ+a6gk
 BZSSbz0xvtoUPjErSbglK+7P01Tyzxik5XdrU2krUF8quoCWZmVK5Op+EKPe4zZ/6RJOsb2bb0FoZ
 /Gn1IgQQVlwfOWPZ3GOZ8zKhZxcMkm51nniJ700L0TOBVSYYqJsEFtGiPRopSkVs0+Dw=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpt8n-00033s-1a
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 12:44:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpt8n-0007MF-0T
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 12:44:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/boot: Don't disable PV32 when XEN_SHSTK is compiled
 out
Message-Id: <E1jpt8n-0007MF-0T@xenbits.xenproject.org>
Date: Mon, 29 Jun 2020 12:44: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 d4764408db9488517150d6eb1f662f92a1a07bc3
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jun 26 11:30:55 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Jun 29 13:38:28 2020 +0100

    x86/boot: Don't disable PV32 when XEN_SHSTK is compiled out
    
    There is no need to automatically disable PV32 support on SHSTK-capable
    hardware if Xen isn't actually using the feature.
    
    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/setup.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 2aa1cd50b8..c9b6af826d 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -95,7 +95,11 @@ unsigned long __initdata highmem_start;
 size_param("highmem-start", highmem_start);
 #endif
 
+#ifdef CONFIG_XEN_SHSTK
 static bool __initdata opt_xen_shstk = true;
+#else
+#define opt_xen_shstk false
+#endif
 
 static int __init parse_cet(const char *s)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Jun 29 12:55:08 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 29 Jun 2020 12: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 1jptJS-0003XQ-K9; Mon, 29 Jun 2020 12: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=Kq1Z=AK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jptJR-0003XK-4E
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 12:55:05 +0000
X-Inumbo-ID: c052c3c6-ba07-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id c052c3c6-ba07-11ea-8496-bc764e2007e4;
 Mon, 29 Jun 2020 12: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=4jMLX2pmgP2DoEfFoy+Wxt8EQ2OJ3SfAyOFWKbWCOm8=; b=xJR5WaoJCPyJbB8o17jb1SaX6n
 mErRY9KmP0pG13ISH9/+x4V4Maq1r2MFjaFGkhDoaxZmPeTKBzT6f4ux/fD80KSvpvEphV5NwY6No
 zuyQiOhmepEoQubm+a3mbYnh1pFbrKYV13Fg4aH/fApsdVW2jsajpIhdYBiRvd6C1D3Y=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jptJQ-0003GB-5O
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 12:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jptJQ-00083Y-43
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 12:55:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] xsm: Drop trailing whitespace from build scripts
Message-Id: <E1jptJQ-00083Y-43@xenbits.xenproject.org>
Date: Mon, 29 Jun 2020 12: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 da53345dd5ff7d3a34e83587fd375c0b7722f46c
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jun 26 17:48:49 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Jun 29 13:49:51 2020 +0100

    xsm: Drop trailing whitespace from build scripts
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/xsm/flask/policy/mkaccess_vector.sh | 26 +++++++++++++-------------
 xen/xsm/flask/policy/mkflask.sh         | 32 ++++++++++++++++----------------
 2 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/xen/xsm/flask/policy/mkaccess_vector.sh b/xen/xsm/flask/policy/mkaccess_vector.sh
index 7fa4aaf638..942ede4713 100644
--- a/xen/xsm/flask/policy/mkaccess_vector.sh
+++ b/xen/xsm/flask/policy/mkaccess_vector.sh
@@ -22,7 +22,7 @@ BEGIN	{
 		printf("/* This file is automatically generated.  Do not edit. */\n") > avpermfile;
 ;
 	}
-/^[ \t]*#/	{ 
+/^[ \t]*#/	{
 			next;
 		}
 $1 == "class"	{
@@ -30,7 +30,7 @@ $1 == "class"	{
 			    nextstate != "CLASS_OR_CLASS-OPENBRACKET")
 			{
 				printf("Parse error:  Unexpected class definition on line %d\n", NR);
-				next;	
+				next;
 			}
 
 			tclass = $2;
@@ -39,7 +39,7 @@ $1 == "class"	{
 			{
 				printf("Duplicate access vector definition for %s on line %d\n", tclass, NR);
 				next;
-			} 
+			}
 			av_defined[tclass] = 1;
 
 			permission = 0;
@@ -47,7 +47,7 @@ $1 == "class"	{
 			nextstate = "INHERITS_OR_CLASS-OPENBRACKET";
 			next;
 		}
-$1 == "{"	{ 
+$1 == "{"	{
 			if (nextstate != "INHERITS_OR_CLASS-OPENBRACKET" &&
 			    nextstate != "CLASS_OR_CLASS-OPENBRACKET" &&
 			    nextstate != "COMMON-OPENBRACKET")
@@ -69,7 +69,7 @@ $1 == "{"	{
 			if (nextstate != "COMMON-CLOSEBRACKET" &&
 			    nextstate != "CLASS-CLOSEBRACKET")
 			{
-				printf("Parse error:  Unexpected symbol %s on line %d\n", $1, NR);		
+				printf("Parse error:  Unexpected symbol %s on line %d\n", $1, NR);
 				next;
 			}
 
@@ -83,7 +83,7 @@ $1 == "{"	{
 
 				common_perms[common_name,$1] = permission;
 
-				printf("#define COMMON_%s__%s", toupper(common_name), toupper($1)) > outfile; 
+				printf("#define COMMON_%s__%s", toupper(common_name), toupper($1)) > outfile;
 
 				printf("    S_(\"%s\")\n", $1) > cpermfile;
 			}
@@ -96,23 +96,23 @@ $1 == "{"	{
 				}
 
 				av_perms[tclass,$1] = permission;
-		
-				printf("#define %s__%s", toupper(tclass), toupper($1)) > outfile; 
 
-				printf("   S_(SECCLASS_%s, %s__%s, \"%s\")\n", toupper(tclass), toupper(tclass), toupper($1), $1) > avpermfile; 
+				printf("#define %s__%s", toupper(tclass), toupper($1)) > outfile;
+
+				printf("   S_(SECCLASS_%s, %s__%s, \"%s\")\n", toupper(tclass), toupper(tclass), toupper($1), $1) > avpermfile;
 			}
 
 			spaces = 40 - (length($1) + length(tclass));
 			if (spaces < 1)
 			      spaces = 1;
 
-			for (i = 0; i < spaces; i++) 
-				printf(" ") > outfile; 
+			for (i = 0; i < spaces; i++)
+				printf(" ") > outfile;
 			printf("(1UL << %u)\n", permission) > outfile;
 			permission = permission + 1;
 		}
 $1 == "}"	{
-			if (nextstate != "CLASS-CLOSEBRACKET" && 
+			if (nextstate != "CLASS-CLOSEBRACKET" &&
 			    nextstate != "COMMON-CLOSEBRACKET")
 			{
 				printf("Parse error:  Unexpected } on line %d\n", NR);
@@ -122,7 +122,7 @@ $1 == "}"	{
 			if (nextstate == "COMMON-CLOSEBRACKET")
 			{
 				common_base[common_name] = permission;
-				printf("TE_(common_%s_perm_to_string)\n\n", common_name) > cpermfile; 
+				printf("TE_(common_%s_perm_to_string)\n\n", common_name) > cpermfile;
 			}
 
 			printf("\n") > outfile;
diff --git a/xen/xsm/flask/policy/mkflask.sh b/xen/xsm/flask/policy/mkflask.sh
index 989a323b80..591ce832a1 100644
--- a/xen/xsm/flask/policy/mkflask.sh
+++ b/xen/xsm/flask/policy/mkflask.sh
@@ -37,51 +37,51 @@ BEGIN	{
 		printf("static char *initial_sid_to_string[] =\n{\n") > debugfile2;
 		printf("    \"null\",\n") > debugfile2;
 	}
-/^[ \t]*#/	{ 
+/^[ \t]*#/	{
 			next;
 		}
-$1 == "class"	{ 
+$1 == "class"	{
 			if (nextstate != "CLASS")
 			{
 				printf("Parse error:  Unexpected class definition on line %d\n", NR);
-				next;	
+				next;
 			}
 
 			if ($2 in class_found)
 			{
 				printf("Duplicate class definition for %s on line %d.\n", $2, NR);
 				next;
-			}	
+			}
 			class_found[$2] = 1;
 
 			class_value++;
 
 			printf("#define SECCLASS_%s", toupper($2)) > outfile;
-			for (i = 0; i < 40 - length($2); i++) 
-				printf(" ") > outfile; 
-			printf("%d\n", class_value) > outfile; 
+			for (i = 0; i < 40 - length($2); i++)
+				printf(" ") > outfile;
+			printf("%d\n", class_value) > outfile;
 
 			printf("    S_(\"%s\")\n", $2) > debugfile;
 		}
-$1 == "sid"	{ 
+$1 == "sid"	{
 			if (nextstate == "CLASS")
 			{
 			    nextstate = "SID";
-			    printf("\n/*\n * Security identifier indices for initial entities\n */\n") > outfile;			    
+			    printf("\n/*\n * Security identifier indices for initial entities\n */\n") > outfile;
 			}
 
 			if ($2 in sid_found)
 			{
 				printf("Duplicate SID definition for %s on line %d.\n", $2, NR);
 				next;
-			}	
+			}
 			sid_found[$2] = 1;
 			sid_value++;
 
 			printf("#define SECINITSID_%s", toupper($2)) > outfile;
-			for (i = 0; i < 37 - length($2); i++) 
-				printf(" ") > outfile; 
-			printf("%d\n", sid_value) > outfile; 
+			for (i = 0; i < 37 - length($2); i++)
+				printf(" ") > outfile;
+			printf("%d\n", sid_value) > outfile;
 			printf("    \"%s\",\n", $2) > debugfile2;
 		}
 END	{
@@ -89,9 +89,9 @@ END	{
 			printf("Parse error:  Unexpected end of file\n");
 
 		printf("\n#define SECINITSID_NUM") > outfile;
-		for (i = 0; i < 34; i++) 
-			printf(" ") > outfile; 
-		printf("%d\n", sid_value) > outfile; 
+		for (i = 0; i < 34; i++)
+			printf(" ") > outfile;
+		printf("%d\n", sid_value) > outfile;
 		printf("\n#endif /* __XEN__ || __XEN_TOOLS__ */\n") > outfile;
 		printf("\n#endif\n") > outfile;
 		printf("};\n\n") > debugfile2;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Jun 29 16:11:13 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 29 Jun 2020 16:11:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jpwNA-00058u-FN; Mon, 29 Jun 2020 16:11: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=Kq1Z=AK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jpwN8-00058p-V8
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 16:11:06 +0000
X-Inumbo-ID: 226ba8ab-ba23-11ea-8588-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 226ba8ab-ba23-11ea-8588-12813bfff9fa;
 Mon, 29 Jun 2020 16:11: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=2dSMrfTMAmw+pK7iTJ7SuIDdf9+G0QTMA1NEctvdlQg=; b=nlAWEI+RFsMdD+HEurxUUOuZoO
 RZXbhmnwJkz38irGYFjIiw/xSv4bXCSFXBlIlZFl0JEJhGixhNRl9QTbvudodvFjX4t1nuLsSwpnj
 eQuQjoW8pssoPra6oAexgYVs0hlzeKN1Qho19koUcmI+uYaPW+o7uin+7EEhDLnl+kWA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpwN7-0007So-5z
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 16:11:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jpwN7-0002TI-4s
 for xen-changelog@lists.xenproject.org; Mon, 29 Jun 2020 16:11:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] mm: fix public declaration of struct
 xen_mem_acquire_resource
Message-Id: <E1jpwN7-0002TI-4s@xenbits.xenproject.org>
Date: Mon, 29 Jun 2020 16:11: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 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#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jun 30 08:44:06 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 30 Jun 2020 08:44:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jqBs3-0005Ap-S0; Tue, 30 Jun 2020 08:44:03 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=9Lfk=AL=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jqBs3-0005Ae-9j
 for xen-changelog@lists.xenproject.org; Tue, 30 Jun 2020 08:44:03 +0000
X-Inumbo-ID: d940067c-baad-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id d940067c-baad-11ea-8496-bc764e2007e4;
 Tue, 30 Jun 2020 08: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=jDPC/hM5cWNV0yc07DEkVgjB+tju5rAKIYDTzSCn2JM=; b=Y5lwitHRQItVxzlem6mOOhmpu7
 2eIjO7J4neXkO97fGd58HkPZuVB/QiQB+tVUv2osP4AIBYgWF9ABtIDZ6EREhFF0gdsDNLAPyhPYi
 tZMa5GDGak0ml6TbxJh2gWG4xtjWqRtEalJhjlyDWGVDeyK/8DHITBG8dKsp8xiLiqxg=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jqBs2-0003xv-EY
 for xen-changelog@lists.xenproject.org; Tue, 30 Jun 2020 08:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jqBs2-00020r-DW
 for xen-changelog@lists.xenproject.org; Tue, 30 Jun 2020 08:44:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/boot: Don't disable PV32 when XEN_SHSTK is compiled
 out
Message-Id: <E1jqBs2-00020r-DW@xenbits.xenproject.org>
Date: Tue, 30 Jun 2020 08: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 d4764408db9488517150d6eb1f662f92a1a07bc3
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jun 26 11:30:55 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Jun 29 13:38:28 2020 +0100

    x86/boot: Don't disable PV32 when XEN_SHSTK is compiled out
    
    There is no need to automatically disable PV32 support on SHSTK-capable
    hardware if Xen isn't actually using the feature.
    
    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/setup.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 2aa1cd50b8..c9b6af826d 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -95,7 +95,11 @@ unsigned long __initdata highmem_start;
 size_param("highmem-start", highmem_start);
 #endif
 
+#ifdef CONFIG_XEN_SHSTK
 static bool __initdata opt_xen_shstk = true;
+#else
+#define opt_xen_shstk false
+#endif
 
 static int __init parse_cet(const char *s)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jun 30 08:44:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 30 Jun 2020 08:44:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jqBsE-0005Bf-TW; Tue, 30 Jun 2020 08:44: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=9Lfk=AL=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jqBsD-0005BZ-L5
 for xen-changelog@lists.xenproject.org; Tue, 30 Jun 2020 08:44:13 +0000
X-Inumbo-ID: df45a78e-baad-11ea-85d6-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id df45a78e-baad-11ea-85d6-12813bfff9fa;
 Tue, 30 Jun 2020 08:44:12 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=Uhr4kZFSsZpGI+HLG66gB3XZGELrVyy98U4X53W38Lo=; b=G1kHJwmkFu68NdFO5Aok/ke2fU
 qtAtDD8q8SmP83TvixvBz1Xja7SUscUwqwww+HtIreb3ENrdgVUVeWiZ9euKKb86vX0yYPMt8Az/L
 s7zkABp6OpI0+QEed3biJI0YVJIDqCaucxF7riESqOkZ/68Ku0EDDl08O62ex6uG6fm8=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jqBsC-0003y7-Hh
 for xen-changelog@lists.xenproject.org; Tue, 30 Jun 2020 08:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jqBsC-00021S-Gi
 for xen-changelog@lists.xenproject.org; Tue, 30 Jun 2020 08:44:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] xsm: Drop trailing whitespace from build scripts
Message-Id: <E1jqBsC-00021S-Gi@xenbits.xenproject.org>
Date: Tue, 30 Jun 2020 08:44: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 da53345dd5ff7d3a34e83587fd375c0b7722f46c
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jun 26 17:48:49 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Jun 29 13:49:51 2020 +0100

    xsm: Drop trailing whitespace from build scripts
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/xsm/flask/policy/mkaccess_vector.sh | 26 +++++++++++++-------------
 xen/xsm/flask/policy/mkflask.sh         | 32 ++++++++++++++++----------------
 2 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/xen/xsm/flask/policy/mkaccess_vector.sh b/xen/xsm/flask/policy/mkaccess_vector.sh
index 7fa4aaf638..942ede4713 100644
--- a/xen/xsm/flask/policy/mkaccess_vector.sh
+++ b/xen/xsm/flask/policy/mkaccess_vector.sh
@@ -22,7 +22,7 @@ BEGIN	{
 		printf("/* This file is automatically generated.  Do not edit. */\n") > avpermfile;
 ;
 	}
-/^[ \t]*#/	{ 
+/^[ \t]*#/	{
 			next;
 		}
 $1 == "class"	{
@@ -30,7 +30,7 @@ $1 == "class"	{
 			    nextstate != "CLASS_OR_CLASS-OPENBRACKET")
 			{
 				printf("Parse error:  Unexpected class definition on line %d\n", NR);
-				next;	
+				next;
 			}
 
 			tclass = $2;
@@ -39,7 +39,7 @@ $1 == "class"	{
 			{
 				printf("Duplicate access vector definition for %s on line %d\n", tclass, NR);
 				next;
-			} 
+			}
 			av_defined[tclass] = 1;
 
 			permission = 0;
@@ -47,7 +47,7 @@ $1 == "class"	{
 			nextstate = "INHERITS_OR_CLASS-OPENBRACKET";
 			next;
 		}
-$1 == "{"	{ 
+$1 == "{"	{
 			if (nextstate != "INHERITS_OR_CLASS-OPENBRACKET" &&
 			    nextstate != "CLASS_OR_CLASS-OPENBRACKET" &&
 			    nextstate != "COMMON-OPENBRACKET")
@@ -69,7 +69,7 @@ $1 == "{"	{
 			if (nextstate != "COMMON-CLOSEBRACKET" &&
 			    nextstate != "CLASS-CLOSEBRACKET")
 			{
-				printf("Parse error:  Unexpected symbol %s on line %d\n", $1, NR);		
+				printf("Parse error:  Unexpected symbol %s on line %d\n", $1, NR);
 				next;
 			}
 
@@ -83,7 +83,7 @@ $1 == "{"	{
 
 				common_perms[common_name,$1] = permission;
 
-				printf("#define COMMON_%s__%s", toupper(common_name), toupper($1)) > outfile; 
+				printf("#define COMMON_%s__%s", toupper(common_name), toupper($1)) > outfile;
 
 				printf("    S_(\"%s\")\n", $1) > cpermfile;
 			}
@@ -96,23 +96,23 @@ $1 == "{"	{
 				}
 
 				av_perms[tclass,$1] = permission;
-		
-				printf("#define %s__%s", toupper(tclass), toupper($1)) > outfile; 
 
-				printf("   S_(SECCLASS_%s, %s__%s, \"%s\")\n", toupper(tclass), toupper(tclass), toupper($1), $1) > avpermfile; 
+				printf("#define %s__%s", toupper(tclass), toupper($1)) > outfile;
+
+				printf("   S_(SECCLASS_%s, %s__%s, \"%s\")\n", toupper(tclass), toupper(tclass), toupper($1), $1) > avpermfile;
 			}
 
 			spaces = 40 - (length($1) + length(tclass));
 			if (spaces < 1)
 			      spaces = 1;
 
-			for (i = 0; i < spaces; i++) 
-				printf(" ") > outfile; 
+			for (i = 0; i < spaces; i++)
+				printf(" ") > outfile;
 			printf("(1UL << %u)\n", permission) > outfile;
 			permission = permission + 1;
 		}
 $1 == "}"	{
-			if (nextstate != "CLASS-CLOSEBRACKET" && 
+			if (nextstate != "CLASS-CLOSEBRACKET" &&
 			    nextstate != "COMMON-CLOSEBRACKET")
 			{
 				printf("Parse error:  Unexpected } on line %d\n", NR);
@@ -122,7 +122,7 @@ $1 == "}"	{
 			if (nextstate == "COMMON-CLOSEBRACKET")
 			{
 				common_base[common_name] = permission;
-				printf("TE_(common_%s_perm_to_string)\n\n", common_name) > cpermfile; 
+				printf("TE_(common_%s_perm_to_string)\n\n", common_name) > cpermfile;
 			}
 
 			printf("\n") > outfile;
diff --git a/xen/xsm/flask/policy/mkflask.sh b/xen/xsm/flask/policy/mkflask.sh
index 989a323b80..591ce832a1 100644
--- a/xen/xsm/flask/policy/mkflask.sh
+++ b/xen/xsm/flask/policy/mkflask.sh
@@ -37,51 +37,51 @@ BEGIN	{
 		printf("static char *initial_sid_to_string[] =\n{\n") > debugfile2;
 		printf("    \"null\",\n") > debugfile2;
 	}
-/^[ \t]*#/	{ 
+/^[ \t]*#/	{
 			next;
 		}
-$1 == "class"	{ 
+$1 == "class"	{
 			if (nextstate != "CLASS")
 			{
 				printf("Parse error:  Unexpected class definition on line %d\n", NR);
-				next;	
+				next;
 			}
 
 			if ($2 in class_found)
 			{
 				printf("Duplicate class definition for %s on line %d.\n", $2, NR);
 				next;
-			}	
+			}
 			class_found[$2] = 1;
 
 			class_value++;
 
 			printf("#define SECCLASS_%s", toupper($2)) > outfile;
-			for (i = 0; i < 40 - length($2); i++) 
-				printf(" ") > outfile; 
-			printf("%d\n", class_value) > outfile; 
+			for (i = 0; i < 40 - length($2); i++)
+				printf(" ") > outfile;
+			printf("%d\n", class_value) > outfile;
 
 			printf("    S_(\"%s\")\n", $2) > debugfile;
 		}
-$1 == "sid"	{ 
+$1 == "sid"	{
 			if (nextstate == "CLASS")
 			{
 			    nextstate = "SID";
-			    printf("\n/*\n * Security identifier indices for initial entities\n */\n") > outfile;			    
+			    printf("\n/*\n * Security identifier indices for initial entities\n */\n") > outfile;
 			}
 
 			if ($2 in sid_found)
 			{
 				printf("Duplicate SID definition for %s on line %d.\n", $2, NR);
 				next;
-			}	
+			}
 			sid_found[$2] = 1;
 			sid_value++;
 
 			printf("#define SECINITSID_%s", toupper($2)) > outfile;
-			for (i = 0; i < 37 - length($2); i++) 
-				printf(" ") > outfile; 
-			printf("%d\n", sid_value) > outfile; 
+			for (i = 0; i < 37 - length($2); i++)
+				printf(" ") > outfile;
+			printf("%d\n", sid_value) > outfile;
 			printf("    \"%s\",\n", $2) > debugfile2;
 		}
 END	{
@@ -89,9 +89,9 @@ END	{
 			printf("Parse error:  Unexpected end of file\n");
 
 		printf("\n#define SECINITSID_NUM") > outfile;
-		for (i = 0; i < 34; i++) 
-			printf(" ") > outfile; 
-		printf("%d\n", sid_value) > outfile; 
+		for (i = 0; i < 34; i++)
+			printf(" ") > outfile;
+		printf("%d\n", sid_value) > outfile;
 		printf("\n#endif /* __XEN__ || __XEN_TOOLS__ */\n") > outfile;
 		printf("\n#endif\n") > outfile;
 		printf("};\n\n") > debugfile2;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jun 30 10:55:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 30 Jun 2020 10: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 1jqDus-0007zB-8g; Tue, 30 Jun 2020 10: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=9Lfk=AL=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jqDur-0007z6-2J
 for xen-changelog@lists.xenproject.org; Tue, 30 Jun 2020 10:55:05 +0000
X-Inumbo-ID: 2744e9ca-bac0-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 2744e9ca-bac0-11ea-bca7-bc764e2007e4;
 Tue, 30 Jun 2020 10: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=gtUAfkCM+l623peK1tA4tPeMLlorNWy3mEHa4yAi9yU=; b=zheA6LTC6cw0VZhZiL/b1eYpqT
 q6uLzqj09ep7F9epyXv94N+JBWub7mnfEElJBBNf3B5RUESMDkKIPRHe6Tns9tuEKSwbMJZhifgpb
 9fidm6jKeBU+ElQMx+uLOzc8InXwwH/yeoT3kkz501hVvJKczBRbDj4UNINEr+QZbMSo=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jqDuq-0006Qj-7t
 for xen-changelog@lists.xenproject.org; Tue, 30 Jun 2020 10:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jqDuq-0008D4-5y
 for xen-changelog@lists.xenproject.org; Tue, 30 Jun 2020 10:55:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] kconfig: fix typo in XEN_SHSTK description
Message-Id: <E1jqDuq-0008D4-5y@xenbits.xenproject.org>
Date: Tue, 30 Jun 2020 10: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 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#staging


