From xen-changelog-bounces@lists.xenproject.org Tue Aug 02 00:33:11 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 02 Aug 2022 00:33:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.379160.612402 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oIfqK-0007Pl-PA; Tue, 02 Aug 2022 00:33:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 379160.612402; Tue, 02 Aug 2022 00:33:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oIfqK-0007Pd-MR; Tue, 02 Aug 2022 00:33:04 +0000
Received: by outflank-mailman (input) for mailman id 379160;
 Tue, 02 Aug 2022 00:33:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oIfqK-0007PX-8d
 for xen-changelog@lists.xenproject.org; Tue, 02 Aug 2022 00:33:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oIfqK-0007Rj-6l
 for xen-changelog@lists.xenproject.org; Tue, 02 Aug 2022 00:33:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oIfqK-0000gs-5f
 for xen-changelog@lists.xenproject.org; Tue, 02 Aug 2022 00:33:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZcN6mnB4sws7YpANy7tEnmVWMSbZwHkcEYGVksgtghU=; b=r4LSdTQ2lSX6CcxroqdUCbEW1m
	DJi4/Wairmhpw6ifvLzMqP0C1ZDddHWXTFh2HNdETtvu3NynI9STYecFQ/F3D78WmfNDjW6BVfjkI
	CbSPbjIcGjQiOztPo3vtVd82jI6xXaR4uFp4MKp1LuAkYIAfMfxSEAz45hZH6OmRS6KI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/efi: efibind: fix MISRA C 2012 Directive 4.10 violation
Message-Id: <E1oIfqK-0000gs-5f@xenbits.xenproject.org>
Date: Tue, 02 Aug 2022 00:33:04 +0000

commit 4d96a4fe2ac08cc93f2e7eca56120792363cb950
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Mon Aug 1 15:21:18 2022 +0300
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Aug 1 17:16:56 2022 -0700

    xen/efi: efibind: fix MISRA C 2012 Directive 4.10 violation
    
    Prevent header file from being included more than once by adding ifndef guard.
    
    In order to be close to gnu-efi code
    - for x86_64, use the same guard
    - for arm64, that there is no guard in gnu-efi, for consistency,
    use a similar format and position to the x86_64 guard
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/arch/arm/include/asm/arm64/efibind.h  | 5 ++++-
 xen/arch/x86/include/asm/x86_64/efibind.h | 4 +++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/include/asm/arm64/efibind.h b/xen/arch/arm/include/asm/arm64/efibind.h
index 2b0bf40bf2..8b43bb8495 100644
--- a/xen/arch/arm/include/asm/arm64/efibind.h
+++ b/xen/arch/arm/include/asm/arm64/efibind.h
@@ -16,7 +16,8 @@ Abstract:
 Revision History
 
 --*/
-
+#ifndef AARCH64_EFI_BIND
+#define AARCH64_EFI_BIND
 #ifndef __GNUC__
 #pragma pack()
 #endif
@@ -205,6 +206,8 @@ typedef uint64_t   UINTN;
 
 #endif
 
+#endif
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/x86/include/asm/x86_64/efibind.h b/xen/arch/x86/include/asm/x86_64/efibind.h
index ddcfae07ec..e23cd16cb6 100644
--- a/xen/arch/x86/include/asm/x86_64/efibind.h
+++ b/xen/arch/x86/include/asm/x86_64/efibind.h
@@ -16,7 +16,8 @@ Abstract:
 Revision History
 
 --*/
-
+#ifndef X86_64_EFI_BIND
+#define X86_64_EFI_BIND
 #ifndef __GNUC__
 #pragma pack()
 #endif
@@ -278,3 +279,4 @@ typedef uint64_t   UINTN;
 #pragma warning ( disable : 4731 )  // Suppress warnings about modification of EBP
 #endif
 
+#endif
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Aug 03 09:11:10 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Aug 2022 09:11:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.379683.613339 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJAPB-0005O7-Pw; Wed, 03 Aug 2022 09:11:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 379683.613339; Wed, 03 Aug 2022 09:11:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJAPB-0005Nz-N9; Wed, 03 Aug 2022 09:11:05 +0000
Received: by outflank-mailman (input) for mailman id 379683;
 Wed, 03 Aug 2022 09:11:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJAPA-0005Np-GG
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 09:11:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJAPA-0004E0-FU
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 09:11:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJAPA-00013a-El
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 09:11:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fon6FKuObkdOgqGk8htrVA+Q06PR5WaRlWQa3F7lt6A=; b=pc0pWU+ExLrVlFdDmb+TemCoyw
	n16LtFw2FBVRowTyJP/sia1lhEIE0/AhiHtxhplindByQt4mU11ftKh5/sn9eICtqx/1WHWxMKwqz
	QthhPT0QRpoXNgmiVQ6koFbARZ0aImx7l/QoglcwNub/FAwhUchsml4tf/XKLuYA2LJs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] arm/vgic-v3: fix virq offset in the rank when storing irouter
Message-Id: <E1oJAPA-00013a-El@xenbits.xenproject.org>
Date: Wed, 03 Aug 2022 09:11:04 +0000

commit 800f21499e0ec112771ce1e94490ca5811578bc2
Author:     Hongda Deng <Hongda.Deng@arm.com>
AuthorDate: Fri Jul 29 16:36:02 2022 +0800
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Wed Aug 3 10:07:34 2022 +0100

    arm/vgic-v3: fix virq offset in the rank when storing irouter
    
    When vGIC performs irouter registers emulation, to get the target vCPU
    via virq conveniently, Xen doesn't store the irouter value directly,
    instead it will use the value (affinities) in irouter to calculate the
    target vCPU, and then save the target vCPU in irq rank->vcpu[offset].
    
    When vGIC tries to get the target vCPU, it first calculates the target
    vCPU index via
      int target = read_atomic(&rank->vcpu[virq & INTERRUPT_RANK_MASK]);
    and then it gets the target vCPU via
      v->domain->vcpu[target];
    
    When vGIC tries to store irouter for one virq, the target vCPU index
    in the rank is computed as
      offset &= virq & INTERRUPT_RANK_MASK;
    finally it gets the target vCPU via
      d->vcpu[read_atomic(&rank->vcpu[offset])];
    
    There is a difference between them while getting the target vCPU index
    in the rank. Actually (virq & INTERRUPT_RANK_MASK) would already get
    the target vCPU index in the rank, it's wrong to add '&' before '=' when
    calculate the offset.
    
    For example, the target vCPU index in the rank should be 6 for virq 38,
    but vGIC will get offset=0 when vGIC stores the irouter for this virq,
    and finally vGIC will access the wrong target vCPU index in the rank
    when updating the irouter.
    
    Fixes: 5d495f4349b5 ("xen/arm: vgic: Optimize the way to store the target vCPU in the rank")
    Signed-off-by: Hongda Deng <Hongda.Deng@arm.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/vgic-v3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/vgic-v3.c b/xen/arch/arm/vgic-v3.c
index e4ba9a6476..7fb99a9ff2 100644
--- a/xen/arch/arm/vgic-v3.c
+++ b/xen/arch/arm/vgic-v3.c
@@ -135,7 +135,7 @@ static void vgic_store_irouter(struct domain *d, struct vgic_irq_rank *rank,
     ASSERT(virq >= 32);
 
     /* Get the index in the rank */
-    offset &= virq & INTERRUPT_RANK_MASK;
+    offset = virq & INTERRUPT_RANK_MASK;
 
     new_vcpu = vgic_v3_irouter_to_vcpu(d, irouter);
     old_vcpu = d->vcpu[read_atomic(&rank->vcpu[offset])];
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Aug 03 10:22:10 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Aug 2022 10:22:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.379751.613481 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJBVt-0002Ig-U9; Wed, 03 Aug 2022 10:22:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 379751.613481; Wed, 03 Aug 2022 10:22:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJBVt-0002IV-Qs; Wed, 03 Aug 2022 10:22:05 +0000
Received: by outflank-mailman (input) for mailman id 379751;
 Wed, 03 Aug 2022 10:22:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJBVs-0002IP-VA
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 10:22:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJBVs-0005cg-TT
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 10:22:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJBVs-0004b1-SV
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 10:22:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9HmM7lGiAffrvjKk+ep/EYrbh0AcixWzd+Zwy7kZhYo=; b=2Yntsy432okZmo63caAZgxd4Rf
	OlFXJ8K1MuDCiraeCM368ajIeggGngNSmiw0vn2IFZGckOySgMeojJ/dLtjQTe1Nt2Q5J0kpi1JsM
	L0xBGNE+YoF+OOpZR9rlfuv+H8MchEKWOlhTKdzMBrspMOY1McxpeWjpFG5R39r1clHM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] evtchn: convert domain event lock to an r/w one
Message-Id: <E1oJBVs-0004b1-SV@xenbits.xenproject.org>
Date: Wed, 03 Aug 2022 10:22:04 +0000

commit 9875c69c4b7decf0c1d2bc493e590ade2880fa5e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Aug 3 12:10:26 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Aug 3 12:10:26 2022 +0200

    evtchn: convert domain event lock to an r/w one
    
    Especially for the use in evtchn_move_pirqs() (called when moving a vCPU
    across pCPU-s) and the ones in EOI handling in PCI pass-through code,
    serializing perhaps an entire domain isn't helpful when no state (which
    isn't e.g. further protected by the per-channel lock) changes.
    
    Unfortunately this implies dropping of lock profiling for this lock,
    until r/w locks may get enabled for such functionality.
    
    While ->notify_vcpu_id is now meant to be consistently updated with the
    per-channel lock held, an extension applies to ECS_PIRQ: The field is
    also guaranteed to not change with the per-domain event lock held for
    writing. Therefore the link_pirq_port() call from evtchn_bind_pirq()
    could in principle be moved out of the per-channel locked regions, but
    this further code churn didn't seem worth it.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/arch/x86/domain.c                 |  4 +-
 xen/arch/x86/hvm/hvm.c                |  4 +-
 xen/arch/x86/hvm/irq.c                |  4 +-
 xen/arch/x86/hvm/vioapic.c            |  4 +-
 xen/arch/x86/hvm/vmsi.c               | 12 ++---
 xen/arch/x86/io_apic.c                |  4 +-
 xen/arch/x86/irq.c                    | 32 ++++++-------
 xen/arch/x86/physdev.c                | 22 ++++-----
 xen/arch/x86/pv/shim.c                | 10 ++--
 xen/common/event_channel.c            | 86 +++++++++++++++++------------------
 xen/common/event_fifo.c               | 10 ++--
 xen/drivers/passthrough/vtd/x86/hvm.c |  4 +-
 xen/drivers/passthrough/x86/hvm.c     | 58 +++++++++++------------
 xen/include/xen/sched.h               |  2 +-
 xen/xsm/flask/flask_op.c              |  4 +-
 15 files changed, 130 insertions(+), 130 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 532b87e8af..15e7e77201 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -967,7 +967,7 @@ int arch_domain_soft_reset(struct domain *d)
     if ( !is_hvm_domain(d) )
         return -EINVAL;
 
-    spin_lock(&d->event_lock);
+    write_lock(&d->event_lock);
     for ( i = 0; i < d->nr_pirqs ; i++ )
     {
         if ( domain_pirq_to_emuirq(d, i) != IRQ_UNBOUND )
@@ -977,7 +977,7 @@ int arch_domain_soft_reset(struct domain *d)
                 break;
         }
     }
-    spin_unlock(&d->event_lock);
+    write_unlock(&d->event_lock);
 
     if ( ret )
         return ret;
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index bb996b4c42..0dd320a6a9 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -492,9 +492,9 @@ void hvm_migrate_pirqs(struct vcpu *v)
     if ( !is_iommu_enabled(d) || !hvm_domain_irq(d)->dpci )
        return;
 
-    spin_lock(&d->event_lock);
+    read_lock(&d->event_lock);
     pt_pirq_iterate(d, migrate_pirq, v);
-    spin_unlock(&d->event_lock);
+    read_unlock(&d->event_lock);
 }
 
 static bool hvm_get_pending_event(struct vcpu *v, struct x86_event *info)
diff --git a/xen/arch/x86/hvm/irq.c b/xen/arch/x86/hvm/irq.c
index 19252448cb..858ab5b248 100644
--- a/xen/arch/x86/hvm/irq.c
+++ b/xen/arch/x86/hvm/irq.c
@@ -404,9 +404,9 @@ int hvm_inject_msi(struct domain *d, uint64_t addr, uint32_t data)
             {
                 int rc;
 
-                spin_lock(&d->event_lock);
+                write_lock(&d->event_lock);
                 rc = map_domain_emuirq_pirq(d, pirq, IRQ_MSI_EMU);
-                spin_unlock(&d->event_lock);
+                write_unlock(&d->event_lock);
                 if ( rc )
                     return rc;
                 info = pirq_info(d, pirq);
diff --git a/xen/arch/x86/hvm/vioapic.c b/xen/arch/x86/hvm/vioapic.c
index d5d5b02421..cb7f440160 100644
--- a/xen/arch/x86/hvm/vioapic.c
+++ b/xen/arch/x86/hvm/vioapic.c
@@ -203,9 +203,9 @@ static int vioapic_hwdom_map_gsi(unsigned int gsi, unsigned int trig,
     {
         gprintk(XENLOG_WARNING, "vioapic: error binding GSI %u: %d\n",
                 gsi, ret);
-        spin_lock(&currd->event_lock);
+        write_lock(&currd->event_lock);
         unmap_domain_pirq(currd, pirq);
-        spin_unlock(&currd->event_lock);
+        write_unlock(&currd->event_lock);
     }
     pcidevs_unlock();
 
diff --git a/xen/arch/x86/hvm/vmsi.c b/xen/arch/x86/hvm/vmsi.c
index d4a8c953e2..198fbd6708 100644
--- a/xen/arch/x86/hvm/vmsi.c
+++ b/xen/arch/x86/hvm/vmsi.c
@@ -467,7 +467,7 @@ int msixtbl_pt_register(struct domain *d, struct pirq *pirq, uint64_t gtable)
     int r = -EINVAL;
 
     ASSERT(pcidevs_locked());
-    ASSERT(spin_is_locked(&d->event_lock));
+    ASSERT(rw_is_write_locked(&d->event_lock));
 
     if ( !msixtbl_initialised(d) )
         return -ENODEV;
@@ -537,7 +537,7 @@ void msixtbl_pt_unregister(struct domain *d, struct pirq *pirq)
     struct msixtbl_entry *entry;
 
     ASSERT(pcidevs_locked());
-    ASSERT(spin_is_locked(&d->event_lock));
+    ASSERT(rw_is_write_locked(&d->event_lock));
 
     if ( !msixtbl_initialised(d) )
         return;
@@ -591,13 +591,13 @@ void msixtbl_pt_cleanup(struct domain *d)
     if ( !msixtbl_initialised(d) )
         return;
 
-    spin_lock(&d->event_lock);
+    write_lock(&d->event_lock);
 
     list_for_each_entry_safe( entry, temp,
                               &d->arch.hvm.msixtbl_list, list )
         del_msixtbl_entry(entry);
 
-    spin_unlock(&d->event_lock);
+    write_unlock(&d->event_lock);
 }
 
 void msix_write_completion(struct vcpu *v)
@@ -811,9 +811,9 @@ static void vpci_msi_disable(const struct pci_dev *pdev, int pirq,
         ASSERT(!rc);
     }
 
-    spin_lock(&pdev->domain->event_lock);
+    write_lock(&pdev->domain->event_lock);
     unmap_domain_pirq(pdev->domain, pirq);
-    spin_unlock(&pdev->domain->event_lock);
+    write_unlock(&pdev->domain->event_lock);
     pcidevs_unlock();
 }
 
diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index c086f40f63..9b8a972cf5 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -2457,10 +2457,10 @@ int ioapic_guest_write(unsigned long physbase, unsigned int reg, u32 val)
     }
     if ( pirq >= 0 )
     {
-        spin_lock(&hardware_domain->event_lock);
+        write_lock(&hardware_domain->event_lock);
         ret = map_domain_pirq(hardware_domain, pirq, irq,
                               MAP_PIRQ_TYPE_GSI, NULL);
-        spin_unlock(&hardware_domain->event_lock);
+        write_unlock(&hardware_domain->event_lock);
         if ( ret < 0 )
             return ret;
     }
diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c
index de30ee7779..fea901bfb1 100644
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -1550,7 +1550,7 @@ int pirq_guest_bind(struct vcpu *v, struct pirq *pirq, int will_share)
     unsigned int        max_nr_guests = will_share ? irq_max_guests : 1;
     int                 rc = 0;
 
-    WARN_ON(!spin_is_locked(&v->domain->event_lock));
+    WARN_ON(!rw_is_write_locked(&v->domain->event_lock));
     BUG_ON(!local_irq_is_enabled());
 
  retry:
@@ -1764,7 +1764,7 @@ void pirq_guest_unbind(struct domain *d, struct pirq *pirq)
     struct irq_desc *desc;
     int irq = 0;
 
-    WARN_ON(!spin_is_locked(&d->event_lock));
+    WARN_ON(!rw_is_write_locked(&d->event_lock));
 
     BUG_ON(!local_irq_is_enabled());
     desc = pirq_spin_lock_irq_desc(pirq, NULL);
@@ -1801,7 +1801,7 @@ static bool pirq_guest_force_unbind(struct domain *d, struct pirq *pirq)
     unsigned int i;
     bool bound = false;
 
-    WARN_ON(!spin_is_locked(&d->event_lock));
+    WARN_ON(!rw_is_write_locked(&d->event_lock));
 
     BUG_ON(!local_irq_is_enabled());
     desc = pirq_spin_lock_irq_desc(pirq, NULL);
@@ -2043,7 +2043,7 @@ int get_free_pirq(struct domain *d, int type)
 {
     int i;
 
-    ASSERT(spin_is_locked(&d->event_lock));
+    ASSERT(rw_is_write_locked(&d->event_lock));
 
     if ( type == MAP_PIRQ_TYPE_GSI )
     {
@@ -2068,7 +2068,7 @@ int get_free_pirqs(struct domain *d, unsigned int nr)
 {
     unsigned int i, found = 0;
 
-    ASSERT(spin_is_locked(&d->event_lock));
+    ASSERT(rw_is_write_locked(&d->event_lock));
 
     for ( i = d->nr_pirqs - 1; i >= nr_irqs_gsi; --i )
         if ( is_free_pirq(d, pirq_info(d, i)) )
@@ -2096,7 +2096,7 @@ int map_domain_pirq(
     DECLARE_BITMAP(prepared, MAX_MSI_IRQS) = {};
     DECLARE_BITMAP(granted, MAX_MSI_IRQS) = {};
 
-    ASSERT(spin_is_locked(&d->event_lock));
+    ASSERT(rw_is_write_locked(&d->event_lock));
 
     if ( !irq_access_permitted(current->domain, irq))
         return -EPERM;
@@ -2314,7 +2314,7 @@ int unmap_domain_pirq(struct domain *d, int pirq)
         return -EINVAL;
 
     ASSERT(pcidevs_locked());
-    ASSERT(spin_is_locked(&d->event_lock));
+    ASSERT(rw_is_write_locked(&d->event_lock));
 
     info = pirq_info(d, pirq);
     if ( !info || (irq = info->arch.irq) <= 0 )
@@ -2420,13 +2420,13 @@ void free_domain_pirqs(struct domain *d)
     int i;
 
     pcidevs_lock();
-    spin_lock(&d->event_lock);
+    write_lock(&d->event_lock);
 
     for ( i = 0; i < d->nr_pirqs; i++ )
         if ( domain_pirq_to_irq(d, i) > 0 )
             unmap_domain_pirq(d, i);
 
-    spin_unlock(&d->event_lock);
+    write_unlock(&d->event_lock);
     pcidevs_unlock();
 }
 
@@ -2669,7 +2669,7 @@ int map_domain_emuirq_pirq(struct domain *d, int pirq, int emuirq)
     int old_emuirq = IRQ_UNBOUND, old_pirq = IRQ_UNBOUND;
     struct pirq *info;
 
-    ASSERT(spin_is_locked(&d->event_lock));
+    ASSERT(rw_is_write_locked(&d->event_lock));
 
     if ( !is_hvm_domain(d) )
         return -EINVAL;
@@ -2735,7 +2735,7 @@ int unmap_domain_pirq_emuirq(struct domain *d, int pirq)
     if ( (pirq < 0) || (pirq >= d->nr_pirqs) )
         return -EINVAL;
 
-    ASSERT(spin_is_locked(&d->event_lock));
+    ASSERT(rw_is_write_locked(&d->event_lock));
 
     emuirq = domain_pirq_to_emuirq(d, pirq);
     if ( emuirq == IRQ_UNBOUND )
@@ -2783,7 +2783,7 @@ static int allocate_pirq(struct domain *d, int index, int pirq, int irq,
 {
     int current_pirq;
 
-    ASSERT(spin_is_locked(&d->event_lock));
+    ASSERT(rw_is_write_locked(&d->event_lock));
     current_pirq = domain_irq_to_pirq(d, irq);
     if ( pirq < 0 )
     {
@@ -2855,7 +2855,7 @@ int allocate_and_map_gsi_pirq(struct domain *d, int index, int *pirq_p)
     }
 
     /* Verify or get pirq. */
-    spin_lock(&d->event_lock);
+    write_lock(&d->event_lock);
     pirq = allocate_pirq(d, index, *pirq_p, irq, MAP_PIRQ_TYPE_GSI, NULL);
     if ( pirq < 0 )
     {
@@ -2868,7 +2868,7 @@ int allocate_and_map_gsi_pirq(struct domain *d, int index, int *pirq_p)
         *pirq_p = pirq;
 
  done:
-    spin_unlock(&d->event_lock);
+    write_unlock(&d->event_lock);
 
     return ret;
 }
@@ -2909,7 +2909,7 @@ int allocate_and_map_msi_pirq(struct domain *d, int index, int *pirq_p,
 
     pcidevs_lock();
     /* Verify or get pirq. */
-    spin_lock(&d->event_lock);
+    write_lock(&d->event_lock);
     pirq = allocate_pirq(d, index, *pirq_p, irq, type, &msi->entry_nr);
     if ( pirq < 0 )
     {
@@ -2922,7 +2922,7 @@ int allocate_and_map_msi_pirq(struct domain *d, int index, int *pirq_p,
         *pirq_p = pirq;
 
  done:
-    spin_unlock(&d->event_lock);
+    write_unlock(&d->event_lock);
     pcidevs_unlock();
     if ( ret )
     {
diff --git a/xen/arch/x86/physdev.c b/xen/arch/x86/physdev.c
index ea38be8b79..3837926728 100644
--- a/xen/arch/x86/physdev.c
+++ b/xen/arch/x86/physdev.c
@@ -34,7 +34,7 @@ static int physdev_hvm_map_pirq(
 
     ASSERT(!is_hardware_domain(d));
 
-    spin_lock(&d->event_lock);
+    write_lock(&d->event_lock);
     switch ( type )
     {
     case MAP_PIRQ_TYPE_GSI: {
@@ -84,7 +84,7 @@ static int physdev_hvm_map_pirq(
         break;
     }
 
-    spin_unlock(&d->event_lock);
+    write_unlock(&d->event_lock);
     return ret;
 }
 
@@ -154,18 +154,18 @@ int physdev_unmap_pirq(domid_t domid, int pirq)
 
     if ( is_hvm_domain(d) && has_pirq(d) )
     {
-        spin_lock(&d->event_lock);
+        write_lock(&d->event_lock);
         if ( domain_pirq_to_emuirq(d, pirq) != IRQ_UNBOUND )
             ret = unmap_domain_pirq_emuirq(d, pirq);
-        spin_unlock(&d->event_lock);
+        write_unlock(&d->event_lock);
         if ( domid == DOMID_SELF || ret )
             goto free_domain;
     }
 
     pcidevs_lock();
-    spin_lock(&d->event_lock);
+    write_lock(&d->event_lock);
     ret = unmap_domain_pirq(d, pirq);
-    spin_unlock(&d->event_lock);
+    write_unlock(&d->event_lock);
     pcidevs_unlock();
 
  free_domain:
@@ -192,10 +192,10 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
         ret = -EINVAL;
         if ( eoi.irq >= currd->nr_pirqs )
             break;
-        spin_lock(&currd->event_lock);
+        read_lock(&currd->event_lock);
         pirq = pirq_info(currd, eoi.irq);
         if ( !pirq ) {
-            spin_unlock(&currd->event_lock);
+            read_unlock(&currd->event_lock);
             break;
         }
         if ( currd->arch.auto_unmask )
@@ -214,7 +214,7 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
                     && hvm_irq->gsi_assert_count[gsi] )
                 send_guest_pirq(currd, pirq);
         }
-        spin_unlock(&currd->event_lock);
+        read_unlock(&currd->event_lock);
         ret = 0;
         break;
     }
@@ -578,7 +578,7 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
         if ( copy_from_guest(&out, arg, 1) != 0 )
             break;
 
-        spin_lock(&currd->event_lock);
+        write_lock(&currd->event_lock);
 
         ret = get_free_pirq(currd, out.type);
         if ( ret >= 0 )
@@ -591,7 +591,7 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
                 ret = -ENOMEM;
         }
 
-        spin_unlock(&currd->event_lock);
+        write_unlock(&currd->event_lock);
 
         if ( ret >= 0 )
         {
diff --git a/xen/arch/x86/pv/shim.c b/xen/arch/x86/pv/shim.c
index 2b74fea181..49ce4f93f2 100644
--- a/xen/arch/x86/pv/shim.c
+++ b/xen/arch/x86/pv/shim.c
@@ -431,7 +431,7 @@ long pv_shim_event_channel_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
         if ( rc )                                                           \
             break;                                                          \
                                                                             \
-        spin_lock(&d->event_lock);                                          \
+        write_lock(&d->event_lock);                                         \
         rc = evtchn_allocate_port(d, op.port_field);                        \
         if ( rc )                                                           \
         {                                                                   \
@@ -440,7 +440,7 @@ long pv_shim_event_channel_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
         }                                                                   \
         else                                                                \
             evtchn_reserve(d, op.port_field);                               \
-        spin_unlock(&d->event_lock);                                        \
+        write_unlock(&d->event_lock);                                       \
                                                                             \
         if ( !rc && __copy_to_guest(arg, &op, 1) )                          \
             rc = -EFAULT;                                                   \
@@ -568,11 +568,11 @@ long pv_shim_event_channel_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
         if ( rc )
             break;
 
-        spin_lock(&d->event_lock);
+        write_lock(&d->event_lock);
         rc = evtchn_allocate_port(d, ipi.port);
         if ( rc )
         {
-            spin_unlock(&d->event_lock);
+            write_unlock(&d->event_lock);
 
             close.port = ipi.port;
             BUG_ON(xen_hypercall_event_channel_op(EVTCHNOP_close, &close));
@@ -581,7 +581,7 @@ long pv_shim_event_channel_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 
         evtchn_assign_vcpu(d, ipi.port, ipi.vcpu);
         evtchn_reserve(d, ipi.port);
-        spin_unlock(&d->event_lock);
+        write_unlock(&d->event_lock);
 
         if ( __copy_to_guest(arg, &ipi, 1) )
             rc = -EFAULT;
diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index e25fa91913..c2c6f8c151 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -301,7 +301,7 @@ int evtchn_alloc_unbound(evtchn_alloc_unbound_t *alloc)
     if ( d == NULL )
         return -ESRCH;
 
-    spin_lock(&d->event_lock);
+    write_lock(&d->event_lock);
 
     if ( (port = get_free_port(d)) < 0 )
         ERROR_EXIT_DOM(port, d);
@@ -324,7 +324,7 @@ int evtchn_alloc_unbound(evtchn_alloc_unbound_t *alloc)
 
  out:
     check_free_port(d, port);
-    spin_unlock(&d->event_lock);
+    write_unlock(&d->event_lock);
     rcu_unlock_domain(d);
 
     return rc;
@@ -361,14 +361,14 @@ static int evtchn_bind_interdomain(evtchn_bind_interdomain_t *bind)
     /* Avoid deadlock by first acquiring lock of domain with smaller id. */
     if ( ld < rd )
     {
-        spin_lock(&ld->event_lock);
-        spin_lock(&rd->event_lock);
+        write_lock(&ld->event_lock);
+        write_lock(&rd->event_lock);
     }
     else
     {
         if ( ld != rd )
-            spin_lock(&rd->event_lock);
-        spin_lock(&ld->event_lock);
+            write_lock(&rd->event_lock);
+        write_lock(&ld->event_lock);
     }
 
     if ( (lport = get_free_port(ld)) < 0 )
@@ -409,9 +409,9 @@ static int evtchn_bind_interdomain(evtchn_bind_interdomain_t *bind)
 
  out:
     check_free_port(ld, lport);
-    spin_unlock(&ld->event_lock);
+    write_unlock(&ld->event_lock);
     if ( ld != rd )
-        spin_unlock(&rd->event_lock);
+        write_unlock(&rd->event_lock);
     
     rcu_unlock_domain(rd);
 
@@ -442,7 +442,7 @@ int evtchn_bind_virq(evtchn_bind_virq_t *bind, evtchn_port_t port)
     if ( (v = domain_vcpu(d, vcpu)) == NULL )
         return -ENOENT;
 
-    spin_lock(&d->event_lock);
+    write_lock(&d->event_lock);
 
     if ( read_atomic(&v->virq_to_evtchn[virq]) )
         ERROR_EXIT(-EEXIST);
@@ -483,7 +483,7 @@ int evtchn_bind_virq(evtchn_bind_virq_t *bind, evtchn_port_t port)
     write_atomic(&v->virq_to_evtchn[virq], port);
 
  out:
-    spin_unlock(&d->event_lock);
+    write_unlock(&d->event_lock);
 
     return rc;
 }
@@ -499,7 +499,7 @@ static int evtchn_bind_ipi(evtchn_bind_ipi_t *bind)
     if ( domain_vcpu(d, vcpu) == NULL )
         return -ENOENT;
 
-    spin_lock(&d->event_lock);
+    write_lock(&d->event_lock);
 
     if ( (port = get_free_port(d)) < 0 )
         ERROR_EXIT(port);
@@ -517,7 +517,7 @@ static int evtchn_bind_ipi(evtchn_bind_ipi_t *bind)
     bind->port = port;
 
  out:
-    spin_unlock(&d->event_lock);
+    write_unlock(&d->event_lock);
 
     return rc;
 }
@@ -563,7 +563,7 @@ static int evtchn_bind_pirq(evtchn_bind_pirq_t *bind)
     if ( !is_hvm_domain(d) && !pirq_access_permitted(d, pirq) )
         return -EPERM;
 
-    spin_lock(&d->event_lock);
+    write_lock(&d->event_lock);
 
     if ( pirq_to_evtchn(d, pirq) != 0 )
         ERROR_EXIT(-EEXIST);
@@ -603,7 +603,7 @@ static int evtchn_bind_pirq(evtchn_bind_pirq_t *bind)
 
  out:
     check_free_port(d, port);
-    spin_unlock(&d->event_lock);
+    write_unlock(&d->event_lock);
 
     return rc;
 }
@@ -619,7 +619,7 @@ int evtchn_close(struct domain *d1, int port1, bool guest)
         return -EINVAL;
 
  again:
-    spin_lock(&d1->event_lock);
+    write_lock(&d1->event_lock);
 
     /* Guest cannot close a Xen-attached event channel. */
     if ( unlikely(consumer_is_xen(chn1)) && guest )
@@ -682,13 +682,11 @@ int evtchn_close(struct domain *d1, int port1, bool guest)
             rcu_lock_domain(d2);
 
             if ( d1 < d2 )
-            {
-                spin_lock(&d2->event_lock);
-            }
+                write_lock(&d2->event_lock);
             else if ( d1 != d2 )
             {
-                spin_unlock(&d1->event_lock);
-                spin_lock(&d2->event_lock);
+                write_unlock(&d1->event_lock);
+                write_lock(&d2->event_lock);
                 goto again;
             }
         }
@@ -733,11 +731,11 @@ int evtchn_close(struct domain *d1, int port1, bool guest)
     if ( d2 != NULL )
     {
         if ( d1 != d2 )
-            spin_unlock(&d2->event_lock);
+            write_unlock(&d2->event_lock);
         rcu_unlock_domain(d2);
     }
 
-    spin_unlock(&d1->event_lock);
+    write_unlock(&d1->event_lock);
 
     return rc;
 }
@@ -977,7 +975,7 @@ int evtchn_status(evtchn_status_t *status)
         return -EINVAL;
     }
 
-    spin_lock(&d->event_lock);
+    read_lock(&d->event_lock);
 
     if ( consumer_is_xen(chn) )
     {
@@ -1023,7 +1021,7 @@ int evtchn_status(evtchn_status_t *status)
     status->vcpu = chn->notify_vcpu_id;
 
  out:
-    spin_unlock(&d->event_lock);
+    read_unlock(&d->event_lock);
     rcu_unlock_domain(d);
 
     return rc;
@@ -1045,7 +1043,7 @@ int evtchn_bind_vcpu(evtchn_port_t port, unsigned int vcpu_id)
     if ( !chn )
         return -EINVAL;
 
-    spin_lock(&d->event_lock);
+    write_lock(&d->event_lock);
 
     /* Guest cannot re-bind a Xen-attached event channel. */
     if ( unlikely(consumer_is_xen(chn)) )
@@ -1081,7 +1079,7 @@ int evtchn_bind_vcpu(evtchn_port_t port, unsigned int vcpu_id)
     }
 
  out:
-    spin_unlock(&d->event_lock);
+    write_unlock(&d->event_lock);
 
     return rc;
 }
@@ -1125,7 +1123,7 @@ int evtchn_reset(struct domain *d, bool resuming)
     if ( d != current->domain && !d->controller_pause_count )
         return -EINVAL;
 
-    spin_lock(&d->event_lock);
+    write_lock(&d->event_lock);
 
     /*
      * If we are resuming, then start where we stopped. Otherwise, check
@@ -1136,7 +1134,7 @@ int evtchn_reset(struct domain *d, bool resuming)
     if ( i > d->next_evtchn )
         d->next_evtchn = i;
 
-    spin_unlock(&d->event_lock);
+    write_unlock(&d->event_lock);
 
     if ( !i )
         return -EBUSY;
@@ -1148,14 +1146,14 @@ int evtchn_reset(struct domain *d, bool resuming)
         /* NB: Choice of frequency is arbitrary. */
         if ( !(i & 0x3f) && hypercall_preempt_check() )
         {
-            spin_lock(&d->event_lock);
+            write_lock(&d->event_lock);
             d->next_evtchn = i;
-            spin_unlock(&d->event_lock);
+            write_unlock(&d->event_lock);
             return -ERESTART;
         }
     }
 
-    spin_lock(&d->event_lock);
+    write_lock(&d->event_lock);
 
     d->next_evtchn = 0;
 
@@ -1168,7 +1166,7 @@ int evtchn_reset(struct domain *d, bool resuming)
         evtchn_2l_init(d);
     }
 
-    spin_unlock(&d->event_lock);
+    write_unlock(&d->event_lock);
 
     return rc;
 }
@@ -1360,7 +1358,7 @@ int alloc_unbound_xen_event_channel(
     struct evtchn *chn;
     int            port, rc;
 
-    spin_lock(&ld->event_lock);
+    write_lock(&ld->event_lock);
 
     port = rc = get_free_port(ld);
     if ( rc < 0 )
@@ -1388,7 +1386,7 @@ int alloc_unbound_xen_event_channel(
 
  out:
     check_free_port(ld, port);
-    spin_unlock(&ld->event_lock);
+    write_unlock(&ld->event_lock);
 
     return rc < 0 ? rc : port;
 }
@@ -1399,7 +1397,7 @@ void free_xen_event_channel(struct domain *d, int port)
     {
         /*
          * Make sure ->is_dying is read /after/ ->valid_evtchns, pairing
-         * with the spin_barrier() and BUG_ON() in evtchn_destroy().
+         * with the kind-of-barrier and BUG_ON() in evtchn_destroy().
          */
         smp_rmb();
         BUG_ON(!d->is_dying);
@@ -1419,7 +1417,7 @@ void notify_via_xen_event_channel(struct domain *ld, int lport)
     {
         /*
          * Make sure ->is_dying is read /after/ ->valid_evtchns, pairing
-         * with the spin_barrier() and BUG_ON() in evtchn_destroy().
+         * with the kind-of-barrier and BUG_ON() in evtchn_destroy().
          */
         smp_rmb();
         ASSERT(ld->is_dying);
@@ -1474,7 +1472,8 @@ int evtchn_init(struct domain *d, unsigned int max_port)
         return -ENOMEM;
     d->valid_evtchns = EVTCHNS_PER_BUCKET;
 
-    spin_lock_init_prof(d, event_lock);
+    rwlock_init(&d->event_lock);
+
     if ( get_free_port(d) != 0 )
     {
         free_evtchn_bucket(d, d->evtchn);
@@ -1499,9 +1498,10 @@ int evtchn_destroy(struct domain *d)
 {
     unsigned int i;
 
-    /* After this barrier no new event-channel allocations can occur. */
+    /* After this kind-of-barrier no new event-channel allocations can occur. */
     BUG_ON(!d->is_dying);
-    spin_barrier(&d->event_lock);
+    read_lock(&d->event_lock);
+    read_unlock(&d->event_lock);
 
     /* Close all existing event channels. */
     for ( i = d->valid_evtchns; --i; )
@@ -1559,13 +1559,13 @@ void evtchn_move_pirqs(struct vcpu *v)
     unsigned int port;
     struct evtchn *chn;
 
-    spin_lock(&d->event_lock);
+    read_lock(&d->event_lock);
     for ( port = v->pirq_evtchn_head; port; port = chn->u.pirq.next_port )
     {
         chn = evtchn_from_port(d, port);
         pirq_set_affinity(d, chn->u.pirq.irq, mask);
     }
-    spin_unlock(&d->event_lock);
+    read_unlock(&d->event_lock);
 }
 
 
@@ -1578,7 +1578,7 @@ static void domain_dump_evtchn_info(struct domain *d)
            "Polling vCPUs: {%*pbl}\n"
            "    port [p/m/s]\n", d->domain_id, d->max_vcpus, d->poll_mask);
 
-    spin_lock(&d->event_lock);
+    read_lock(&d->event_lock);
 
     for ( port = 1; ; ++port )
     {
@@ -1627,7 +1627,7 @@ static void domain_dump_evtchn_info(struct domain *d)
         }
     }
 
-    spin_unlock(&d->event_lock);
+    read_unlock(&d->event_lock);
 }
 
 static void cf_check dump_evtchn_info(unsigned char key)
diff --git a/xen/common/event_fifo.c b/xen/common/event_fifo.c
index 0766358e9e..6cebc3868a 100644
--- a/xen/common/event_fifo.c
+++ b/xen/common/event_fifo.c
@@ -602,7 +602,7 @@ int evtchn_fifo_init_control(struct evtchn_init_control *init_control)
     if ( offset & (8 - 1) )
         return -EINVAL;
 
-    spin_lock(&d->event_lock);
+    write_lock(&d->event_lock);
 
     /*
      * If this is the first control block, setup an empty event array
@@ -638,13 +638,13 @@ int evtchn_fifo_init_control(struct evtchn_init_control *init_control)
     else
         rc = map_control_block(v, gfn, offset);
 
-    spin_unlock(&d->event_lock);
+    write_unlock(&d->event_lock);
 
     return rc;
 
  error:
     evtchn_fifo_destroy(d);
-    spin_unlock(&d->event_lock);
+    write_unlock(&d->event_lock);
     return rc;
 }
 
@@ -697,9 +697,9 @@ int evtchn_fifo_expand_array(const struct evtchn_expand_array *expand_array)
     if ( !d->evtchn_fifo )
         return -EOPNOTSUPP;
 
-    spin_lock(&d->event_lock);
+    write_lock(&d->event_lock);
     rc = add_page_to_event_array(d, expand_array->array_gfn);
-    spin_unlock(&d->event_lock);
+    write_unlock(&d->event_lock);
 
     return rc;
 }
diff --git a/xen/drivers/passthrough/vtd/x86/hvm.c b/xen/drivers/passthrough/vtd/x86/hvm.c
index 132d252d1c..bc776cf7da 100644
--- a/xen/drivers/passthrough/vtd/x86/hvm.c
+++ b/xen/drivers/passthrough/vtd/x86/hvm.c
@@ -51,7 +51,7 @@ void hvm_dpci_isairq_eoi(struct domain *d, unsigned int isairq)
     if ( !is_iommu_enabled(d) )
         return;
 
-    spin_lock(&d->event_lock);
+    write_lock(&d->event_lock);
 
     dpci = domain_get_irq_dpci(d);
 
@@ -60,5 +60,5 @@ void hvm_dpci_isairq_eoi(struct domain *d, unsigned int isairq)
         /* Multiple mirq may be mapped to one isa irq */
         pt_pirq_iterate(d, _hvm_dpci_isairq_eoi, (void *)(long)isairq);
     }
-    spin_unlock(&d->event_lock);
+    write_unlock(&d->event_lock);
 }
diff --git a/xen/drivers/passthrough/x86/hvm.c b/xen/drivers/passthrough/x86/hvm.c
index 35b4938ab2..a16e0e5344 100644
--- a/xen/drivers/passthrough/x86/hvm.c
+++ b/xen/drivers/passthrough/x86/hvm.c
@@ -117,7 +117,7 @@ static void pt_pirq_softirq_reset(struct hvm_pirq_dpci *pirq_dpci)
 {
     struct domain *d = pirq_dpci->dom;
 
-    ASSERT(spin_is_locked(&d->event_lock));
+    ASSERT(rw_is_write_locked(&d->event_lock));
 
     switch ( cmpxchg(&pirq_dpci->state, 1 << STATE_SCHED, 0) )
     {
@@ -229,7 +229,7 @@ int pt_irq_create_bind(
         return -EINVAL;
 
  restart:
-    spin_lock(&d->event_lock);
+    write_lock(&d->event_lock);
 
     hvm_irq_dpci = domain_get_irq_dpci(d);
     if ( !hvm_irq_dpci && !is_hardware_domain(d) )
@@ -245,7 +245,7 @@ int pt_irq_create_bind(
         hvm_irq_dpci = xzalloc(struct hvm_irq_dpci);
         if ( hvm_irq_dpci == NULL )
         {
-            spin_unlock(&d->event_lock);
+            write_unlock(&d->event_lock);
             return -ENOMEM;
         }
         for ( i = 0; i < NR_HVM_DOMU_IRQS; i++ )
@@ -257,7 +257,7 @@ int pt_irq_create_bind(
     info = pirq_get_info(d, pirq);
     if ( !info )
     {
-        spin_unlock(&d->event_lock);
+        write_unlock(&d->event_lock);
         return -ENOMEM;
     }
     pirq_dpci = pirq_dpci(info);
@@ -272,7 +272,7 @@ int pt_irq_create_bind(
      */
     if ( pt_pirq_softirq_active(pirq_dpci) )
     {
-        spin_unlock(&d->event_lock);
+        write_unlock(&d->event_lock);
         cpu_relax();
         goto restart;
     }
@@ -330,7 +330,7 @@ int pt_irq_create_bind(
                 pirq_dpci->dom = NULL;
                 pirq_dpci->flags = 0;
                 pirq_cleanup_check(info, d);
-                spin_unlock(&d->event_lock);
+                write_unlock(&d->event_lock);
                 return rc;
             }
         }
@@ -340,7 +340,7 @@ int pt_irq_create_bind(
 
             if ( (pirq_dpci->flags & mask) != mask )
             {
-                spin_unlock(&d->event_lock);
+                write_unlock(&d->event_lock);
                 return -EBUSY;
             }
 
@@ -364,7 +364,7 @@ int pt_irq_create_bind(
 
         dest_vcpu_id = hvm_girq_dest_2_vcpu_id(d, dest, dest_mode);
         pirq_dpci->gmsi.dest_vcpu_id = dest_vcpu_id;
-        spin_unlock(&d->event_lock);
+        write_unlock(&d->event_lock);
 
         pirq_dpci->gmsi.posted = false;
         vcpu = (dest_vcpu_id >= 0) ? d->vcpu[dest_vcpu_id] : NULL;
@@ -424,7 +424,7 @@ int pt_irq_create_bind(
 
             if ( !digl || !girq )
             {
-                spin_unlock(&d->event_lock);
+                write_unlock(&d->event_lock);
                 xfree(girq);
                 xfree(digl);
                 return -ENOMEM;
@@ -451,7 +451,7 @@ int pt_irq_create_bind(
             if ( pt_irq_bind->irq_type != PT_IRQ_TYPE_PCI ||
                  pirq >= hvm_domain_irq(d)->nr_gsis )
             {
-                spin_unlock(&d->event_lock);
+                write_unlock(&d->event_lock);
 
                 return -EINVAL;
             }
@@ -487,7 +487,7 @@ int pt_irq_create_bind(
 
                     if ( mask < 0 || trigger_mode < 0 )
                     {
-                        spin_unlock(&d->event_lock);
+                        write_unlock(&d->event_lock);
 
                         ASSERT_UNREACHABLE();
                         return -EINVAL;
@@ -530,14 +530,14 @@ int pt_irq_create_bind(
                 }
                 pirq_dpci->flags = 0;
                 pirq_cleanup_check(info, d);
-                spin_unlock(&d->event_lock);
+                write_unlock(&d->event_lock);
                 xfree(girq);
                 xfree(digl);
                 return rc;
             }
         }
 
-        spin_unlock(&d->event_lock);
+        write_unlock(&d->event_lock);
 
         if ( iommu_verbose )
         {
@@ -555,7 +555,7 @@ int pt_irq_create_bind(
     }
 
     default:
-        spin_unlock(&d->event_lock);
+        write_unlock(&d->event_lock);
         return -EOPNOTSUPP;
     }
 
@@ -608,13 +608,13 @@ int pt_irq_destroy_bind(
         return -EOPNOTSUPP;
     }
 
-    spin_lock(&d->event_lock);
+    write_lock(&d->event_lock);
 
     hvm_irq_dpci = domain_get_irq_dpci(d);
 
     if ( !hvm_irq_dpci && !is_hardware_domain(d) )
     {
-        spin_unlock(&d->event_lock);
+        write_unlock(&d->event_lock);
         return -EINVAL;
     }
 
@@ -647,7 +647,7 @@ int pt_irq_destroy_bind(
 
         if ( girq )
         {
-            spin_unlock(&d->event_lock);
+            write_unlock(&d->event_lock);
             return -EINVAL;
         }
 
@@ -689,7 +689,7 @@ int pt_irq_destroy_bind(
         pirq_cleanup_check(pirq, d);
     }
 
-    spin_unlock(&d->event_lock);
+    write_unlock(&d->event_lock);
 
     if ( what && iommu_verbose )
     {
@@ -733,7 +733,7 @@ int pt_pirq_iterate(struct domain *d,
     unsigned int pirq = 0, n, i;
     struct pirq *pirqs[8];
 
-    ASSERT(spin_is_locked(&d->event_lock));
+    ASSERT(rw_is_locked(&d->event_lock));
 
     do {
         n = radix_tree_gang_lookup(&d->pirq_tree, (void **)pirqs, pirq,
@@ -818,9 +818,9 @@ void hvm_dpci_msi_eoi(struct domain *d, int vector)
          (!hvm_domain_irq(d)->dpci && !is_hardware_domain(d)) )
        return;
 
-    spin_lock(&d->event_lock);
+    read_lock(&d->event_lock);
     pt_pirq_iterate(d, _hvm_dpci_msi_eoi, (void *)(long)vector);
-    spin_unlock(&d->event_lock);
+    read_unlock(&d->event_lock);
 }
 
 static void hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci)
@@ -831,7 +831,7 @@ static void hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci)
         return;
     }
 
-    spin_lock(&d->event_lock);
+    write_lock(&d->event_lock);
     if ( test_and_clear_bool(pirq_dpci->masked) )
     {
         struct pirq *pirq = dpci_pirq(pirq_dpci);
@@ -875,7 +875,7 @@ static void hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci)
     }
 
  out:
-    spin_unlock(&d->event_lock);
+    write_unlock(&d->event_lock);
 }
 
 static void hvm_pirq_eoi(struct pirq *pirq)
@@ -935,7 +935,7 @@ void hvm_dpci_eoi(struct domain *d, unsigned int guest_gsi)
 
     if ( is_hardware_domain(d) )
     {
-        spin_lock(&d->event_lock);
+        write_lock(&d->event_lock);
         hvm_gsi_eoi(d, guest_gsi);
         goto unlock;
     }
@@ -946,7 +946,7 @@ void hvm_dpci_eoi(struct domain *d, unsigned int guest_gsi)
         return;
     }
 
-    spin_lock(&d->event_lock);
+    write_lock(&d->event_lock);
     hvm_irq_dpci = domain_get_irq_dpci(d);
 
     if ( !hvm_irq_dpci )
@@ -956,7 +956,7 @@ void hvm_dpci_eoi(struct domain *d, unsigned int guest_gsi)
         __hvm_dpci_eoi(d, girq);
 
 unlock:
-    spin_unlock(&d->event_lock);
+    write_unlock(&d->event_lock);
 }
 
 static int cf_check pci_clean_dpci_irq(
@@ -991,7 +991,7 @@ int arch_pci_clean_pirqs(struct domain *d)
     if ( !is_hvm_domain(d) )
         return 0;
 
-    spin_lock(&d->event_lock);
+    write_lock(&d->event_lock);
     hvm_irq_dpci = domain_get_irq_dpci(d);
     if ( hvm_irq_dpci != NULL )
     {
@@ -999,14 +999,14 @@ int arch_pci_clean_pirqs(struct domain *d)
 
         if ( ret )
         {
-            spin_unlock(&d->event_lock);
+            write_unlock(&d->event_lock);
             return ret;
         }
 
         hvm_domain_irq(d)->dpci = NULL;
         free_hvm_irq_dpci(hvm_irq_dpci);
     }
-    spin_unlock(&d->event_lock);
+    write_unlock(&d->event_lock);
 
     return 0;
 }
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index b9515eb497..e2b3b6daa3 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -429,7 +429,7 @@ struct domain
     unsigned int     xen_evtchns;
     /* Port to resume from in evtchn_reset(), when in a continuation. */
     unsigned int     next_evtchn;
-    spinlock_t       event_lock;
+    rwlock_t         event_lock;
     const struct evtchn_port_ops *evtchn_port_ops;
     struct evtchn_fifo_domain *evtchn_fifo;
 
diff --git a/xen/xsm/flask/flask_op.c b/xen/xsm/flask/flask_op.c
index eb16e289c3..d319466c6b 100644
--- a/xen/xsm/flask/flask_op.c
+++ b/xen/xsm/flask/flask_op.c
@@ -530,7 +530,7 @@ static int flask_get_peer_sid(struct xen_flask_peersid *arg)
     struct evtchn *chn;
     struct domain_security_struct *dsec;
 
-    spin_lock(&d->event_lock);
+    read_lock(&d->event_lock);
 
     if ( !port_is_valid(d, arg->evtchn) )
         goto out;
@@ -548,7 +548,7 @@ static int flask_get_peer_sid(struct xen_flask_peersid *arg)
     rv = 0;
 
  out:
-    spin_unlock(&d->event_lock);
+    read_unlock(&d->event_lock);
     return rv;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Aug 03 10:22:16 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Aug 2022 10:22:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.379752.613485 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJBW4-0002LC-0p; Wed, 03 Aug 2022 10:22:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 379752.613485; Wed, 03 Aug 2022 10: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 1oJBW3-0002L2-U2; Wed, 03 Aug 2022 10:22:15 +0000
Received: by outflank-mailman (input) for mailman id 379752;
 Wed, 03 Aug 2022 10:22:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJBW3-0002Kt-1q
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 10:22:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJBW3-0005ck-16
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 10:22:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJBW2-0004bQ-VW
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 10:22:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=n5qz5wHLVx0Jbc8xv9XLW9ABl+WtTfkkBCwXSX1NUUs=; b=E5wkEFuR6qb2ZXrhu8iOF2fQqr
	4ayn/JoHeV/qcc9h/njUfuYsp06F1N7I0ES3otQf3KGp850cs83ljRxGNSeUURozJS0vKByY4tL2F
	hHKAKqOjs0sG5MX4mwo711PNPAUFgG7BNu1fXvEePzngK6v2ta4Ep1axfbfkdca5HqCg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/ocaml: do not run ocamldep during make clean
Message-Id: <E1oJBW2-0004bQ-VW@xenbits.xenproject.org>
Date: Wed, 03 Aug 2022 10:22:14 +0000

commit 2f2b76d47c5bcd9323a2acac8ba365013af34141
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Wed Aug 3 12:13:39 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Aug 3 12:13:39 2022 +0200

    tools/ocaml: do not run ocamldep during make clean
    
    Trying to include .ocamldep.make will cause it to be generated if it
    doesn't exist.
    We do not want this during make clean: we would remove it anyway.
    
    Speeds up make clean.
    
    Before (measured on f732240fd3bac25116151db5ddeb7203b62e85ce, July 2022):
    ```
    Parsing /home/edwin/xen2/tools/ocaml/libs/xl/../../../../tools/libs/light/libxl_types.idl
    Parsing /home/edwin/xen2/tools/ocaml/libs/xl/../../../../tools/libs/light/libxl_types.idl
    Parsing /home/edwin/xen2/tools/ocaml/libs/xl/../../../../tools/libs/light/libxl_types.idl
    Parsing /home/edwin/xen2/tools/ocaml/libs/xl/../../../../tools/libs/light/libxl_types.idl
    Parsing /home/edwin/xen2/tools/ocaml/libs/xl/../../../../tools/libs/light/libxl_types.idl
    
     Performance counter stats for 'make clean -j8 -s' (5 runs):
    
                4.2233 +- 0.0208 seconds time elapsed  ( +-  0.49% )
    ```
    
    After:
    ```
    perf stat -r 5 --null make clean -j8 -s
    
     Performance counter stats for 'make clean -j8 -s' (5 runs):
    
                2.7325 +- 0.0138 seconds time elapsed  ( +-  0.51% )
    ```
    
    No functional change.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/Makefile.rules | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/ocaml/Makefile.rules b/tools/ocaml/Makefile.rules
index 7e4db457a1..d368308d9b 100644
--- a/tools/ocaml/Makefile.rules
+++ b/tools/ocaml/Makefile.rules
@@ -44,8 +44,10 @@ META: META.in
 
 ALL_OCAML_OBJ_SOURCES=$(addsuffix .ml, $(ALL_OCAML_OBJS))
 
+ifneq ($(MAKECMDGOALS),clean)
 .ocamldep.make: $(ALL_OCAML_OBJ_SOURCES) Makefile $(OCAML_TOPLEVEL)/Makefile.rules
 	$(call quiet-command, $(OCAMLDEP) $(ALL_OCAML_OBJ_SOURCES) *.mli $o,MLDEP,)
+endif
 
 clean: $(CLEAN_HOOKS)
 	$(Q)rm -f .*.d *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot *.spot *.spit $(LIBS) $(PROGRAMS) $(GENERATED_FILES) .ocamldep.make META
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Aug 03 10:22:26 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Aug 2022 10:22:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.379753.613489 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJBWE-0002OB-22; Wed, 03 Aug 2022 10:22:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 379753.613489; Wed, 03 Aug 2022 10:22:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJBWD-0002O3-VX; Wed, 03 Aug 2022 10:22:25 +0000
Received: by outflank-mailman (input) for mailman id 379753;
 Wed, 03 Aug 2022 10:22:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJBWD-0002Nt-59
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 10:22:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJBWD-0005d1-4L
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 10:22:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJBWD-0004bp-3E
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 10:22:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FmPWw3yhCVuBlqL7NoRj1KlZo+Wb1PXuV4nyPj6bt1g=; b=yhQ+yfl0cTgL+BTUA44y3Mv+RT
	xgbdtPgWNf5/MssnnCBSxZDNhNSAx1OMqQjxgzug8y1x3CvtAx+25wpm4l17kcX5j9IIvuBOdrY/o
	3YXuTDomuN2rWuIqBJamYT4BgtOkrF+yN8Ptk119e6rYgwIRHwYduvmTsnc4lEM6a2L8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] sched: dom0_vcpus_pin should only affect dom0
Message-Id: <E1oJBWD-0004bp-3E@xenbits.xenproject.org>
Date: Wed, 03 Aug 2022 10:22:25 +0000

commit 01ca29f0b17a50a94b0e232ba276c32e95d80ae3
Author:     Dario Faggioli <dfaggioli@suse.com>
AuthorDate: Wed Aug 3 12:14:01 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Aug 3 12:14:01 2022 +0200

    sched: dom0_vcpus_pin should only affect dom0
    
    If dom0_vcpus_pin is used, make sure the pinning is only done for
    dom0 vcpus, instead of for the hardware domain (which might not be
    dom0 at all!).
    
    Suggested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/sched/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c
index f689b55783..a066c629cb 100644
--- a/xen/common/sched/core.c
+++ b/xen/common/sched/core.c
@@ -575,7 +575,7 @@ int sched_init_vcpu(struct vcpu *v)
      * Initialize affinity settings. The idler, and potentially
      * domain-0 VCPUs, are pinned onto their respective physical CPUs.
      */
-    if ( is_idle_domain(d) || (is_hardware_domain(d) && opt_dom0_vcpus_pin) )
+    if ( is_idle_domain(d) || (d->domain_id == 0 && opt_dom0_vcpus_pin) )
         sched_set_affinity(unit, cpumask_of(processor), &cpumask_all);
     else
         sched_set_affinity(unit, &cpumask_all, &cpumask_all);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Aug 03 10:44:07 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Aug 2022 10:44:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.379776.613526 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJBrB-00068D-DB; Wed, 03 Aug 2022 10:44:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 379776.613526; Wed, 03 Aug 2022 10:44:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJBrB-000686-AN; Wed, 03 Aug 2022 10:44:05 +0000
Received: by outflank-mailman (input) for mailman id 379776;
 Wed, 03 Aug 2022 10:44:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJBrA-00067y-RU
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 10:44:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJBrA-000642-LY
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 10:44:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJBrA-0005lq-KY
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 10:44:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=k06uesjHtrvNJgyjJlVcLzdbXyw21haPafBjFCmXM5E=; b=SV4oopAUAqs0Lk0EUOUnfliNmz
	M8wON/hDo7qHv/DezEGWQiUPd3P7X6iGlWjCfekDiRmRSM0EncKJMYgjfe67CpVZq8mKzvwC0k/KN
	kprkfleTjBCcZCW9j1ypfYSZVRf1WNja0O/G2fWSa133GIc2ZF37ydc8qVIMPOpHTnAQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] tools/libxl: env variable to signal whether disk/nic backend is trusted
Message-Id: <E1oJBrA-0005lq-KY@xenbits.xenproject.org>
Date: Wed, 03 Aug 2022 10:44:04 +0000

commit 6689cab2bcc066f063abe6ded0043f1eeb211207
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Aug 3 12:38:36 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Aug 3 12:38:36 2022 +0200

    tools/libxl: env variable to signal whether disk/nic backend is trusted
    
    Introduce support in libxl for fetching the default backend trusted
    option for disk and nic devices.
    
    Users can set LIBXL_{DISK,NIC}_BACKEND_UNTRUSTED environment variable
    to notify libxl of whether the backends for disk and nic devices
    should be trusted.  Such information is passed into the frontend so it
    can take the appropriate measures.
    
    This is part of XSA-403.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 docs/man/xl.1.pod.in          | 18 ++++++++++++++++++
 tools/libs/light/libxl_disk.c |  5 +++++
 tools/libs/light/libxl_nic.c  |  7 +++++++
 3 files changed, 30 insertions(+)

diff --git a/docs/man/xl.1.pod.in b/docs/man/xl.1.pod.in
index e2176bd696..45e1430aeb 100644
--- a/docs/man/xl.1.pod.in
+++ b/docs/man/xl.1.pod.in
@@ -1946,6 +1946,24 @@ shows the decimal value. For non-linear mode, it shows hexadecimal value.
 
 =back
 
+=head1 ENVIRONMENT
+
+=over 4
+
+=item B<LIBXL_DISK_BACKEND_UNTRUSTED>
+
+Set this environment variable to "1" to suggest to the guest that the disk
+backend shouldn't be trusted. If the variable is absent or set to "0", the
+backend will be trusted.
+
+=item B<LIBXL_NIC_BACKEND_UNTRUSTED>
+
+Set this environment variable to "1" to suggest to the guest that the network
+backend shouldn't be trusted. If the variable is absent or set to "0", the
+backend will be trusted.
+
+=back
+
 =head1 IGNORED FOR COMPATIBILITY WITH XM
 
 xl is mostly command-line compatible with the old xm utility used with
diff --git a/tools/libs/light/libxl_disk.c b/tools/libs/light/libxl_disk.c
index 93936d0dd0..67d1cc1857 100644
--- a/tools/libs/light/libxl_disk.c
+++ b/tools/libs/light/libxl_disk.c
@@ -246,6 +246,7 @@ static void device_disk_add(libxl__egc *egc, uint32_t domid,
     libxl_domain_config d_config;
     libxl_device_disk disk_saved;
     libxl__flock *lock = NULL;
+    const char *envvar;
 
     libxl_domain_config_init(&d_config);
     libxl_device_disk_init(&disk_saved);
@@ -395,6 +396,10 @@ static void device_disk_add(libxl__egc *egc, uint32_t domid,
         flexarray_append(front, GCSPRINTF("%d", device->devid));
         flexarray_append(front, "device-type");
         flexarray_append(front, disk->is_cdrom ? "cdrom" : "disk");
+        flexarray_append(front, "trusted");
+        envvar = getenv("LIBXL_DISK_BACKEND_UNTRUSTED");
+        /* Set "trusted=1" if envvar missing or is "0". */
+        flexarray_append(front, !envvar || !strcmp("0", envvar) ? "1" : "0");
 
         /*
          * Old PV kernel disk frontends before 2.6.26 rely on tool stack to
diff --git a/tools/libs/light/libxl_nic.c b/tools/libs/light/libxl_nic.c
index 0b9e70c9d1..f87890d1d6 100644
--- a/tools/libs/light/libxl_nic.c
+++ b/tools/libs/light/libxl_nic.c
@@ -132,6 +132,8 @@ static int libxl__set_xenstore_nic(libxl__gc *gc, uint32_t domid,
                                    flexarray_t *back, flexarray_t *front,
                                    flexarray_t *ro_front)
 {
+    const char *envvar;
+
     flexarray_grow(back, 2);
 
     if (nic->script)
@@ -255,6 +257,11 @@ static int libxl__set_xenstore_nic(libxl__gc *gc, uint32_t domid,
     flexarray_append(back, "hotplug-status");
     flexarray_append(back, "");
 
+    flexarray_append(front, "trusted");
+    envvar = getenv("LIBXL_NIC_BACKEND_UNTRUSTED");
+    /* Set "trusted=1" if envvar missing or is "0". */
+    flexarray_append(front, !envvar || !strcmp("0", envvar) ? "1" : "0");
+
     return 0;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Wed Aug 03 10:44:15 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Aug 2022 10:44:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.379777.613529 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJBrL-0006AD-Eu; Wed, 03 Aug 2022 10:44:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 379777.613529; Wed, 03 Aug 2022 10:44:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJBrL-0006A6-By; Wed, 03 Aug 2022 10:44:15 +0000
Received: by outflank-mailman (input) for mailman id 379777;
 Wed, 03 Aug 2022 10:44:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJBrK-00069w-PW
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 10:44:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJBrK-00064D-On
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 10:44:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJBrK-0005ma-Nh
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 10:44:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=YE5SftDXmZsIyXR+7Ux9Ynla3alhvZFaiaR9cAZIrWQ=; b=fFmITfBZl7BgDiIKOFDSoTZc91
	ACTgJAh1ZyR0QKv3ugNN6yCGzk5u1u31eiCUT0yza/HyE2UQQxzWLc4XBqaEbnmRWlBsySGV+KqGs
	Rs8vjgd/rQIBqgA2TZETwxhqpqjLXbdOFpwIRoK+R/WjN2igErhJwDUt38KDHJgQ+LSg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] x86/msr: fix X2APIC_LAST
Message-Id: <E1oJBrK-0005ma-Nh@xenbits.xenproject.org>
Date: Wed, 03 Aug 2022 10:44:14 +0000

commit 89fe6d0edea841d1d2690cf3f5173e334c687823
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Wed Aug 3 12:39:13 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Aug 3 12:39:13 2022 +0200

    x86/msr: fix X2APIC_LAST
    
    The latest Intel manual now says the X2APIC reserved range is only
    0x800 to 0x8ff (NOT 0xbff).
    This changed between SDM 68 (Nov 2018) and SDM 69 (Jan 2019).
    The AMD manual documents 0x800-0x8ff too.
    
    There are non-X2APIC MSRs in the 0x900-0xbff range now:
    e.g. 0x981 is IA32_TME_CAPABILITY, an architectural MSR.
    
    The new MSR in this range appears to have been introduced in Icelake,
    so this commit should be backported to Xen versions supporting Icelake.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 13316827faadbb4f72ae6c625af9938d8f976f86
    master date: 2022-07-27 12:57:10 +0200
---
 xen/arch/x86/hvm/vmx/vmx.c      | 4 ++--
 xen/include/asm-x86/msr-index.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index a555930f8f..d429d76c18 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -3376,7 +3376,7 @@ void vmx_vlapic_msr_changed(struct vcpu *v)
             if ( cpu_has_vmx_apic_reg_virt )
             {
                 for ( msr = MSR_X2APIC_FIRST;
-                      msr <= MSR_X2APIC_FIRST + 0xff; msr++ )
+                      msr <= MSR_X2APIC_LAST; msr++ )
                     vmx_clear_msr_intercept(v, msr, VMX_MSR_R);
 
                 vmx_set_msr_intercept(v, MSR_X2APIC_PPR, VMX_MSR_R);
@@ -3397,7 +3397,7 @@ void vmx_vlapic_msr_changed(struct vcpu *v)
     if ( !(v->arch.hvm.vmx.secondary_exec_control &
            SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE) )
         for ( msr = MSR_X2APIC_FIRST;
-              msr <= MSR_X2APIC_FIRST + 0xff; msr++ )
+              msr <= MSR_X2APIC_LAST; msr++ )
             vmx_set_msr_intercept(v, msr, VMX_MSR_RW);
 
     vmx_update_secondary_exec_control(v);
diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h
index d3735e499e..3cb942eeac 100644
--- a/xen/include/asm-x86/msr-index.h
+++ b/xen/include/asm-x86/msr-index.h
@@ -135,7 +135,7 @@
 #define MSR_INTERRUPT_SSP_TABLE             0x000006a8
 
 #define MSR_X2APIC_FIRST                    0x00000800
-#define MSR_X2APIC_LAST                     0x00000bff
+#define MSR_X2APIC_LAST                     0x000008ff
 
 #define MSR_X2APIC_TPR                      0x00000808
 #define MSR_X2APIC_PPR                      0x0000080a
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Wed Aug 03 10:44:26 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Aug 2022 10:44:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.379778.613535 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJBrW-0006DF-GO; Wed, 03 Aug 2022 10:44:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 379778.613535; Wed, 03 Aug 2022 10:44:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJBrW-0006D3-DR; Wed, 03 Aug 2022 10:44:26 +0000
Received: by outflank-mailman (input) for mailman id 379778;
 Wed, 03 Aug 2022 10:44:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJBrV-0006Cs-8s
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 10:44:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJBrV-00064O-7N
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 10:44:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJBrV-0005nf-4I
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 10:44:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=EKl3Q4biz9k6bJYPObJwqM3isFVgf3k38R0PSQksw7g=; b=VUpx+HjA9vmi5g571wa3UNZckG
	diCVtKV5eKbQlsJ36k+rGOqDxiX1J6n0JnyIIhHm8sxFcQ+owvom4ocBAl8JYHmuf5fZ/cl5X5l+y
	xInPsb60+lw8ahjOmeWcb07G71uH+FIjnCai95M4+w4eXNrDGAHZuWk6sx8DTfA6baMo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] tools/libxl: env variable to signal whether disk/nic backend is trusted
Message-Id: <E1oJBrV-0005nf-4I@xenbits.xenproject.org>
Date: Wed, 03 Aug 2022 10:44:25 +0000

commit 1b9845dcf959421db3a071a6bc0aa9d8edbffb50
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Aug 3 12:41:18 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Aug 3 12:41:18 2022 +0200

    tools/libxl: env variable to signal whether disk/nic backend is trusted
    
    Introduce support in libxl for fetching the default backend trusted
    option for disk and nic devices.
    
    Users can set LIBXL_{DISK,NIC}_BACKEND_UNTRUSTED environment variable
    to notify libxl of whether the backends for disk and nic devices
    should be trusted.  Such information is passed into the frontend so it
    can take the appropriate measures.
    
    This is part of XSA-403.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 docs/man/xl.1.pod.in          | 18 ++++++++++++++++++
 tools/libs/light/libxl_disk.c |  5 +++++
 tools/libs/light/libxl_nic.c  |  7 +++++++
 3 files changed, 30 insertions(+)

diff --git a/docs/man/xl.1.pod.in b/docs/man/xl.1.pod.in
index e2176bd696..45e1430aeb 100644
--- a/docs/man/xl.1.pod.in
+++ b/docs/man/xl.1.pod.in
@@ -1946,6 +1946,24 @@ shows the decimal value. For non-linear mode, it shows hexadecimal value.
 
 =back
 
+=head1 ENVIRONMENT
+
+=over 4
+
+=item B<LIBXL_DISK_BACKEND_UNTRUSTED>
+
+Set this environment variable to "1" to suggest to the guest that the disk
+backend shouldn't be trusted. If the variable is absent or set to "0", the
+backend will be trusted.
+
+=item B<LIBXL_NIC_BACKEND_UNTRUSTED>
+
+Set this environment variable to "1" to suggest to the guest that the network
+backend shouldn't be trusted. If the variable is absent or set to "0", the
+backend will be trusted.
+
+=back
+
 =head1 IGNORED FOR COMPATIBILITY WITH XM
 
 xl is mostly command-line compatible with the old xm utility used with
diff --git a/tools/libs/light/libxl_disk.c b/tools/libs/light/libxl_disk.c
index 93936d0dd0..67d1cc1857 100644
--- a/tools/libs/light/libxl_disk.c
+++ b/tools/libs/light/libxl_disk.c
@@ -246,6 +246,7 @@ static void device_disk_add(libxl__egc *egc, uint32_t domid,
     libxl_domain_config d_config;
     libxl_device_disk disk_saved;
     libxl__flock *lock = NULL;
+    const char *envvar;
 
     libxl_domain_config_init(&d_config);
     libxl_device_disk_init(&disk_saved);
@@ -395,6 +396,10 @@ static void device_disk_add(libxl__egc *egc, uint32_t domid,
         flexarray_append(front, GCSPRINTF("%d", device->devid));
         flexarray_append(front, "device-type");
         flexarray_append(front, disk->is_cdrom ? "cdrom" : "disk");
+        flexarray_append(front, "trusted");
+        envvar = getenv("LIBXL_DISK_BACKEND_UNTRUSTED");
+        /* Set "trusted=1" if envvar missing or is "0". */
+        flexarray_append(front, !envvar || !strcmp("0", envvar) ? "1" : "0");
 
         /*
          * Old PV kernel disk frontends before 2.6.26 rely on tool stack to
diff --git a/tools/libs/light/libxl_nic.c b/tools/libs/light/libxl_nic.c
index 0b9e70c9d1..f87890d1d6 100644
--- a/tools/libs/light/libxl_nic.c
+++ b/tools/libs/light/libxl_nic.c
@@ -132,6 +132,8 @@ static int libxl__set_xenstore_nic(libxl__gc *gc, uint32_t domid,
                                    flexarray_t *back, flexarray_t *front,
                                    flexarray_t *ro_front)
 {
+    const char *envvar;
+
     flexarray_grow(back, 2);
 
     if (nic->script)
@@ -255,6 +257,11 @@ static int libxl__set_xenstore_nic(libxl__gc *gc, uint32_t domid,
     flexarray_append(back, "hotplug-status");
     flexarray_append(back, "");
 
+    flexarray_append(front, "trusted");
+    envvar = getenv("LIBXL_NIC_BACKEND_UNTRUSTED");
+    /* Set "trusted=1" if envvar missing or is "0". */
+    flexarray_append(front, !envvar || !strcmp("0", envvar) ? "1" : "0");
+
     return 0;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Wed Aug 03 10:44:36 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Aug 2022 10:44:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.379779.613538 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJBrg-0006G5-Hq; Wed, 03 Aug 2022 10:44:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 379779.613538; Wed, 03 Aug 2022 10:44:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJBrg-0006Fv-Ev; Wed, 03 Aug 2022 10:44:36 +0000
Received: by outflank-mailman (input) for mailman id 379779;
 Wed, 03 Aug 2022 10:44:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJBrf-0006Fl-Bi
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 10:44:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJBrf-00064Z-Ay
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 10:44:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJBrf-0005oL-9h
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 10:44:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=SdF/IZtt8ApLA1/vL8c8SHFLPsaRQx0unp6EsFBq9AA=; b=yNmnLQT2WdR5kXM89cxkSLaeLk
	5JQ2kaaRlObkdpKpsjr65IjGKQxdJIvhANA27gcdHXpnFIA/V+9+6xDv1yErkWAdSiRsc7GpJyNa6
	Tu/5BvuJ5fOFH2XqmVSMR60hYPnpx6cPPjFZrnmQJmSqGScE/vHp/i8cOKPd3i5uSU14=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] x86/msr: fix X2APIC_LAST
Message-Id: <E1oJBrf-0005oL-9h@xenbits.xenproject.org>
Date: Wed, 03 Aug 2022 10:44:35 +0000

commit df3395f6b2d759aba39fb67a7bc0fe49147c8b39
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Wed Aug 3 12:41:49 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Aug 3 12:41:49 2022 +0200

    x86/msr: fix X2APIC_LAST
    
    The latest Intel manual now says the X2APIC reserved range is only
    0x800 to 0x8ff (NOT 0xbff).
    This changed between SDM 68 (Nov 2018) and SDM 69 (Jan 2019).
    The AMD manual documents 0x800-0x8ff too.
    
    There are non-X2APIC MSRs in the 0x900-0xbff range now:
    e.g. 0x981 is IA32_TME_CAPABILITY, an architectural MSR.
    
    The new MSR in this range appears to have been introduced in Icelake,
    so this commit should be backported to Xen versions supporting Icelake.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 13316827faadbb4f72ae6c625af9938d8f976f86
    master date: 2022-07-27 12:57:10 +0200
---
 xen/arch/x86/hvm/vmx/vmx.c      | 4 ++--
 xen/include/asm-x86/msr-index.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 868151a2e5..775b36433e 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -3401,7 +3401,7 @@ void vmx_vlapic_msr_changed(struct vcpu *v)
             if ( cpu_has_vmx_apic_reg_virt )
             {
                 for ( msr = MSR_X2APIC_FIRST;
-                      msr <= MSR_X2APIC_FIRST + 0xff; msr++ )
+                      msr <= MSR_X2APIC_LAST; msr++ )
                     vmx_clear_msr_intercept(v, msr, VMX_MSR_R);
 
                 vmx_set_msr_intercept(v, MSR_X2APIC_PPR, VMX_MSR_R);
@@ -3422,7 +3422,7 @@ void vmx_vlapic_msr_changed(struct vcpu *v)
     if ( !(v->arch.hvm.vmx.secondary_exec_control &
            SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE) )
         for ( msr = MSR_X2APIC_FIRST;
-              msr <= MSR_X2APIC_FIRST + 0xff; msr++ )
+              msr <= MSR_X2APIC_LAST; msr++ )
             vmx_set_msr_intercept(v, msr, VMX_MSR_RW);
 
     vmx_update_secondary_exec_control(v);
diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h
index b4a360723b..f1b2cf5460 100644
--- a/xen/include/asm-x86/msr-index.h
+++ b/xen/include/asm-x86/msr-index.h
@@ -459,7 +459,7 @@
 #define MSR_IA32_TSC_ADJUST		0x0000003b
 
 #define MSR_X2APIC_FIRST                0x00000800
-#define MSR_X2APIC_LAST                 0x00000bff
+#define MSR_X2APIC_LAST                 0x000008ff
 
 #define MSR_X2APIC_TPR                  0x00000808
 #define MSR_X2APIC_PPR                  0x0000080a
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Wed Aug 03 12:22:10 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Aug 2022 12:22:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.379893.613757 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJDO1-0001YU-9i; Wed, 03 Aug 2022 12:22:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 379893.613757; Wed, 03 Aug 2022 12:22:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJDO1-0001YM-6i; Wed, 03 Aug 2022 12:22:05 +0000
Received: by outflank-mailman (input) for mailman id 379893;
 Wed, 03 Aug 2022 12:22:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJDO0-0001YG-2u
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 12:22:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJDNz-0007zh-Vr
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 12:22:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJDNz-0002KA-TC
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 12:22:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tmSnxt7N3FXJm681h9C5jkadxNOzez5AuvLkluLdlVw=; b=ixC9LrdG7HqnesciP8etezeSxK
	LpeOU5NiRM1/Btqv9V+VVR+0lmfOxOAarWtXzJX5UweABL8hMVxogQTO3rqHP35jOqBny7zTnb7P4
	0WiS1lFVGHwf+HJ+FJKKD+taobf5R2PVDP4Pb7TEV8gKIcakSoIriK9YeeHIvd0bC7pw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] tools/libxl: env variable to signal whether disk/nic backend is trusted
Message-Id: <E1oJDNz-0002KA-TC@xenbits.xenproject.org>
Date: Wed, 03 Aug 2022 12:22:03 +0000

commit 261b882f7704515a01f74589f57f0c1303e3b701
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Aug 3 14:19:12 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Aug 3 14:19:12 2022 +0200

    tools/libxl: env variable to signal whether disk/nic backend is trusted
    
    Introduce support in libxl for fetching the default backend trusted
    option for disk and nic devices.
    
    Users can set LIBXL_{DISK,NIC}_BACKEND_UNTRUSTED environment variable
    to notify libxl of whether the backends for disk and nic devices
    should be trusted.  Such information is passed into the frontend so it
    can take the appropriate measures.
    
    This is part of XSA-403.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 docs/man/xl.1.pod.in     | 18 ++++++++++++++++++
 tools/libxl/libxl_disk.c |  5 +++++
 tools/libxl/libxl_nic.c  |  7 +++++++
 3 files changed, 30 insertions(+)

diff --git a/docs/man/xl.1.pod.in b/docs/man/xl.1.pod.in
index 52a47a6fbd..8c28a5d5ca 100644
--- a/docs/man/xl.1.pod.in
+++ b/docs/man/xl.1.pod.in
@@ -1938,6 +1938,24 @@ shows the decimal value. For non-linear mode, it shows hexadecimal value.
 
 =back
 
+=head1 ENVIRONMENT
+
+=over 4
+
+=item B<LIBXL_DISK_BACKEND_UNTRUSTED>
+
+Set this environment variable to "1" to suggest to the guest that the disk
+backend shouldn't be trusted. If the variable is absent or set to "0", the
+backend will be trusted.
+
+=item B<LIBXL_NIC_BACKEND_UNTRUSTED>
+
+Set this environment variable to "1" to suggest to the guest that the network
+backend shouldn't be trusted. If the variable is absent or set to "0", the
+backend will be trusted.
+
+=back
+
 =head1 IGNORED FOR COMPATIBILITY WITH XM
 
 xl is mostly command-line compatible with the old xm utility used with
diff --git a/tools/libxl/libxl_disk.c b/tools/libxl/libxl_disk.c
index ddc1eec176..1e9d20d9c3 100644
--- a/tools/libxl/libxl_disk.c
+++ b/tools/libxl/libxl_disk.c
@@ -246,6 +246,7 @@ static void device_disk_add(libxl__egc *egc, uint32_t domid,
     libxl_domain_config d_config;
     libxl_device_disk disk_saved;
     libxl__flock *lock = NULL;
+    const char *envvar;
 
     libxl_domain_config_init(&d_config);
     libxl_device_disk_init(&disk_saved);
@@ -395,6 +396,10 @@ static void device_disk_add(libxl__egc *egc, uint32_t domid,
         flexarray_append(front, GCSPRINTF("%d", device->devid));
         flexarray_append(front, "device-type");
         flexarray_append(front, disk->is_cdrom ? "cdrom" : "disk");
+        flexarray_append(front, "trusted");
+        envvar = getenv("LIBXL_DISK_BACKEND_UNTRUSTED");
+        /* Set "trusted=1" if envvar missing or is "0". */
+        flexarray_append(front, !envvar || !strcmp("0", envvar) ? "1" : "0");
 
         /*
          * Old PV kernel disk frontends before 2.6.26 rely on tool stack to
diff --git a/tools/libxl/libxl_nic.c b/tools/libxl/libxl_nic.c
index 07880b39e1..b92281ab6a 100644
--- a/tools/libxl/libxl_nic.c
+++ b/tools/libxl/libxl_nic.c
@@ -129,6 +129,8 @@ static int libxl__set_xenstore_nic(libxl__gc *gc, uint32_t domid,
                                    flexarray_t *back, flexarray_t *front,
                                    flexarray_t *ro_front)
 {
+    const char *envvar;
+
     flexarray_grow(back, 2);
 
     if (nic->script)
@@ -237,6 +239,11 @@ static int libxl__set_xenstore_nic(libxl__gc *gc, uint32_t domid,
     flexarray_append(front, GCSPRINTF(
                                     LIBXL_MAC_FMT, LIBXL_MAC_BYTES(nic->mac)));
 
+    flexarray_append(front, "trusted");
+    envvar = getenv("LIBXL_NIC_BACKEND_UNTRUSTED");
+    /* Set "trusted=1" if envvar missing or is "0". */
+    flexarray_append(front, !envvar || !strcmp("0", envvar) ? "1" : "0");
+
     return 0;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Wed Aug 03 12:22:15 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Aug 2022 12:22:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.379894.613761 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJDOB-0001aS-Ay; Wed, 03 Aug 2022 12:22:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 379894.613761; Wed, 03 Aug 2022 12: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 1oJDOB-0001aK-8L; Wed, 03 Aug 2022 12:22:15 +0000
Received: by outflank-mailman (input) for mailman id 379894;
 Wed, 03 Aug 2022 12:22:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJDOA-0001a7-8U
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 12:22:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJDOA-0007zl-7f
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 12:22:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJDOA-0002Kx-6m
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 12:22:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7IoyVg1pAEZB09ymKWNYkvD7xM3gIpOkI6vAroTBpSo=; b=dx3CDd92owEha1DpVagfhU3/Gv
	FCeSEeljHJWUqjktlZ5BbLJKLlIJS307OPmblgS+SI9YhhUCKUQvDnR059M5++0MLkg1AXAxdeclP
	sqJLLKkmF1sRmkGZigPU7Rae5nnWKdM6dZiofFK99hiPrbyAJ2UjfMlnPV6Tcw7nOTDM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.13] tools/libxl: env variable to signal whether disk/nic backend is trusted
Message-Id: <E1oJDOA-0002Kx-6m@xenbits.xenproject.org>
Date: Wed, 03 Aug 2022 12:22:14 +0000

commit d8a693019845caa4e216bcac10f9501a814c99ae
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Aug 3 14:19:37 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Aug 3 14:19:37 2022 +0200

    tools/libxl: env variable to signal whether disk/nic backend is trusted
    
    Introduce support in libxl for fetching the default backend trusted
    option for disk and nic devices.
    
    Users can set LIBXL_{DISK,NIC}_BACKEND_UNTRUSTED environment variable
    to notify libxl of whether the backends for disk and nic devices
    should be trusted.  Such information is passed into the frontend so it
    can take the appropriate measures.
    
    This is part of XSA-403.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 docs/man/xl.1.pod.in     | 18 ++++++++++++++++++
 tools/libxl/libxl_disk.c |  5 +++++
 tools/libxl/libxl_nic.c  |  7 +++++++
 3 files changed, 30 insertions(+)

diff --git a/docs/man/xl.1.pod.in b/docs/man/xl.1.pod.in
index d4b5e8e362..0ec59a8b5c 100644
--- a/docs/man/xl.1.pod.in
+++ b/docs/man/xl.1.pod.in
@@ -1922,6 +1922,24 @@ shows the decimal value. For non-linear mode, it shows hexadecimal value.
 
 =back
 
+=head1 ENVIRONMENT
+
+=over 4
+
+=item B<LIBXL_DISK_BACKEND_UNTRUSTED>
+
+Set this environment variable to "1" to suggest to the guest that the disk
+backend shouldn't be trusted. If the variable is absent or set to "0", the
+backend will be trusted.
+
+=item B<LIBXL_NIC_BACKEND_UNTRUSTED>
+
+Set this environment variable to "1" to suggest to the guest that the network
+backend shouldn't be trusted. If the variable is absent or set to "0", the
+backend will be trusted.
+
+=back
+
 =head1 IGNORED FOR COMPATIBILITY WITH XM
 
 xl is mostly command-line compatible with the old xm utility used with
diff --git a/tools/libxl/libxl_disk.c b/tools/libxl/libxl_disk.c
index 64a6691424..fe4cb52811 100644
--- a/tools/libxl/libxl_disk.c
+++ b/tools/libxl/libxl_disk.c
@@ -246,6 +246,7 @@ static void device_disk_add(libxl__egc *egc, uint32_t domid,
     libxl_domain_config d_config;
     libxl_device_disk disk_saved;
     libxl__domain_userdata_lock *lock = NULL;
+    const char *envvar;
 
     libxl_domain_config_init(&d_config);
     libxl_device_disk_init(&disk_saved);
@@ -395,6 +396,10 @@ static void device_disk_add(libxl__egc *egc, uint32_t domid,
         flexarray_append(front, GCSPRINTF("%d", device->devid));
         flexarray_append(front, "device-type");
         flexarray_append(front, disk->is_cdrom ? "cdrom" : "disk");
+        flexarray_append(front, "trusted");
+        envvar = getenv("LIBXL_DISK_BACKEND_UNTRUSTED");
+        /* Set "trusted=1" if envvar missing or is "0". */
+        flexarray_append(front, !envvar || !strcmp("0", envvar) ? "1" : "0");
 
         /*
          * Old PV kernel disk frontends before 2.6.26 rely on tool stack to
diff --git a/tools/libxl/libxl_nic.c b/tools/libxl/libxl_nic.c
index 07880b39e1..b92281ab6a 100644
--- a/tools/libxl/libxl_nic.c
+++ b/tools/libxl/libxl_nic.c
@@ -129,6 +129,8 @@ static int libxl__set_xenstore_nic(libxl__gc *gc, uint32_t domid,
                                    flexarray_t *back, flexarray_t *front,
                                    flexarray_t *ro_front)
 {
+    const char *envvar;
+
     flexarray_grow(back, 2);
 
     if (nic->script)
@@ -237,6 +239,11 @@ static int libxl__set_xenstore_nic(libxl__gc *gc, uint32_t domid,
     flexarray_append(front, GCSPRINTF(
                                     LIBXL_MAC_FMT, LIBXL_MAC_BYTES(nic->mac)));
 
+    flexarray_append(front, "trusted");
+    envvar = getenv("LIBXL_NIC_BACKEND_UNTRUSTED");
+    /* Set "trusted=1" if envvar missing or is "0". */
+    flexarray_append(front, !envvar || !strcmp("0", envvar) ? "1" : "0");
+
     return 0;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Aug 03 23:44:12 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Aug 2022 23:44:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380115.614094 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJO21-0005Gh-9i; Wed, 03 Aug 2022 23:44:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380115.614094; Wed, 03 Aug 2022 23:44:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJO21-0005GZ-5t; Wed, 03 Aug 2022 23:44:05 +0000
Received: by outflank-mailman (input) for mailman id 380115;
 Wed, 03 Aug 2022 23:44:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJO20-0005GT-QQ
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 23:44:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJO20-0004kL-Kl
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 23:44:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJO20-0008Pe-Ji
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 23:44:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1NA13BtKdfABKaE5e+TJgb8aY9ufBN5Ef1O2f4NfMsU=; b=1KAJGcQC6IY8NCDSJjyPFhdpN0
	C5/vV62S0ms1ob3azwRmAuNLJxKHZ72+jfNSK7YoKGTuYwgysPo6sIVvqeSTfYUGh5njZQuMKL5uI
	bMk/Tafi5F7gf92alLU6JKKNmmwTpXbx3hErg9Mk30Tgr2VgtW4/jebhtUkbSxBXbZEQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] arm/its: enable LPIs before mapping the collection table
Message-Id: <E1oJO20-0008Pe-Ji@xenbits.xenproject.org>
Date: Wed, 03 Aug 2022 23:44:04 +0000

commit 271e9e860b7b5ee5fc01a8fd539aa7e1bcb096c6
Author:     Rahul Singh <rahul.singh@arm.com>
AuthorDate: Wed May 4 18:15:12 2022 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Aug 3 14:57:31 2022 -0700

    arm/its: enable LPIs before mapping the collection table
    
    When Xen boots on the platform that implements the GIC 600, ITS
    MAPC_LPI_OFF uncorrectable command error issue is observed.
    
    As per the GIC-600 TRM (Revision: r1p6) MAPC_LPI_OFF command error can
    be reported if the MAPC command has tried to map a collection to a core
    that does not have LPIs enabled. The definition of GICR.EnableLPIs
    also suggests enabling the LPIs before sending any ITS command that
    involves LPIs
    
    0b0 LPI support is disabled. Any doorbell interrupt generated as a
        result of a write to a virtual LPI register must be discarded,
        and any ITS translation requests or commands involving LPIs in
        this Redistributor are ignored.
    
    0b1 LPI support is enabled.
    
    To fix the MAPC command error issue, enable the LPIs using
    GICR_CTLR.EnableLPIs before mapping the collection table.
    
    gicv3_enable_lpis() is using writel_relaxed(), write to the GICR_CTLR
    register may not be visible before gicv3_its_setup_collection() send the
    MAPC command. Use wmb() after writel_relaxed() to make sure register
    write to enable LPIs is visible.
    
    Signed-off-by: Rahul Singh <rahul.singh@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    (cherry picked from commit 95604873ccf56eb81e96ed0dc8b4dec3278f40ca)
---
 xen/arch/arm/gic-v3.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
index 9a3a175ad7..9fbaaa44b4 100644
--- a/xen/arch/arm/gic-v3.c
+++ b/xen/arch/arm/gic-v3.c
@@ -701,6 +701,9 @@ static bool gicv3_enable_lpis(void)
     val = readl_relaxed(GICD_RDIST_BASE + GICR_CTLR);
     writel_relaxed(val | GICR_CTLR_ENABLE_LPIS, GICD_RDIST_BASE + GICR_CTLR);
 
+    /* Make sure the GIC has seen the above */
+    wmb();
+
     return true;
 }
 
@@ -818,11 +821,11 @@ static int gicv3_cpu_init(void)
     /* If the host has any ITSes, enable LPIs now. */
     if ( gicv3_its_host_has_its() )
     {
+        if ( !gicv3_enable_lpis() )
+            return -EBUSY;
         ret = gicv3_its_setup_collection(smp_processor_id());
         if ( ret )
             return ret;
-        if ( !gicv3_enable_lpis() )
-            return -EBUSY;
     }
 
     /* Set priority on PPI and SGI interrupts */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Wed Aug 03 23:44:15 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Aug 2022 23:44:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380116.614096 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJO2B-0005IV-AI; Wed, 03 Aug 2022 23:44:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380116.614096; Wed, 03 Aug 2022 23:44:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJO2B-0005IK-7V; Wed, 03 Aug 2022 23:44:15 +0000
Received: by outflank-mailman (input) for mailman id 380116;
 Wed, 03 Aug 2022 23:44:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJO2A-0005IC-PD
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 23:44:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJO2A-0004ki-OP
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 23:44:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJO2A-0008QA-My
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 23:44:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=pWaqktHSZFNQArvaWblIJn3r7gnsKfvPf5bWGVzSdeY=; b=Ucm+e/cmdSG0Glc4vc9kRz83YI
	3tiuY3AfJqpxzTzQLSOdA7u0/8NLcw0Xwp3HUGg9169lTmM/piUxwp6pp+jISu+aDQFBdcF/NP0Px
	EjhSyp/cYc5zIOLUcvHH9K57WNsv6XtHZj7YN60mNPWs237gn2tyqOdsUS+ZhXyY0mrc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] xen/arm: p2m don't fall over on FEAT_LPA enabled hw
Message-Id: <E1oJO2A-0008QA-My@xenbits.xenproject.org>
Date: Wed, 03 Aug 2022 23:44:14 +0000

commit fe02a5342d3ef372ac8eea12dcdbdf3ff7c47379
Author:     Alex Bennée <alex.bennee@linaro.org>
AuthorDate: Thu Apr 28 11:34:10 2022 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Aug 3 14:57:36 2022 -0700

    xen/arm: p2m don't fall over on FEAT_LPA enabled hw
    
    When we introduced FEAT_LPA to QEMU's -cpu max we discovered older
    kernels had a bug where the physical address was copied directly from
    ID_AA64MMFR0_EL1.PARange field. The early cpu_init code of Xen commits
    the same error by blindly copying across the max supported range.
    
    Unsurprisingly when the page tables aren't set up for these greater
    ranges hilarity ensues and the hypervisor crashes fairly early on in
    the boot-up sequence. This happens when we write to the control
    register in enable_mmu().
    
    Attempt to fix this the same way as the Linux kernel does by gating
    PARange to the maximum the hypervisor can handle. I also had to fix up
    code in p2m which panics when it sees an "invalid" entry in PARange.
    
    Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
    Cc: Richard Henderson <richard.henderson@linaro.org>
    Cc: Stefano Stabellini <sstabellini@kernel.org>
    Cc: Julien Grall <julien@xen.org>
    Cc: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
    Cc: Bertrand Marquis <bertrand.marquis@arm.com>
    Tested-by: Luca Fancellu <luca.fancellu@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    (cherry picked from commit 407b13a71e324aba76b11e5f66f59ce4a304a088)
---
 xen/arch/arm/arm64/head.S |  6 ++++++
 xen/arch/arm/p2m.c        | 10 +++++-----
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S
index aa1f88c764..057dd5d925 100644
--- a/xen/arch/arm/arm64/head.S
+++ b/xen/arch/arm/arm64/head.S
@@ -473,6 +473,12 @@ cpu_init:
         ldr   x0, =(TCR_RES1|TCR_SH0_IS|TCR_ORGN0_WBWA|TCR_IRGN0_WBWA|TCR_T0SZ(64-48))
         /* ID_AA64MMFR0_EL1[3:0] (PARange) corresponds to TCR_EL2[18:16] (PS) */
         mrs   x1, ID_AA64MMFR0_EL1
+        /* Limit to 48 bits, 256TB PA range (#5) */
+        ubfm  x1, x1, #0, #3
+        mov   x2, #5
+        cmp   x1, x2
+        csel  x1, x1, x2, lt
+
         bfi   x0, x1, #16, #3
 
         msr   tcr_el2, x0
diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index fb71fa4c1c..3349b464a3 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -32,10 +32,10 @@ static unsigned int __read_mostly max_vmid = MAX_VMID_8_BIT;
 #define P2M_ROOT_PAGES    (1<<P2M_ROOT_ORDER)
 
 /*
- * Set larger than any possible value, so the number of IPA bits can be
+ * Set to the maximum configured support for IPA bits, so the number of IPA bits can be
  * restricted by external entity (e.g. IOMMU).
  */
-unsigned int __read_mostly p2m_ipa_bits = 64;
+unsigned int __read_mostly p2m_ipa_bits = PADDR_BITS;
 
 /* Helpers to lookup the properties of each level */
 static const paddr_t level_masks[] =
@@ -2030,7 +2030,7 @@ void __init setup_virt_paging(void)
         unsigned int root_order; /* Page order of the root of the p2m */
         unsigned int sl0;    /* Desired SL0, maximum in comment */
     } pa_range_info[] = {
-        /* T0SZ minimum and SL0 maximum from ARM DDI 0487A.b Table D4-5 */
+        /* T0SZ minimum and SL0 maximum from ARM DDI 0487H.a Table D5-6 */
         /*      PA size, t0sz(min), root-order, sl0(max) */
         [0] = { 32,      32/*32*/,  0,          1 },
         [1] = { 36,      28/*28*/,  0,          1 },
@@ -2038,7 +2038,7 @@ void __init setup_virt_paging(void)
         [3] = { 42,      22/*22*/,  3,          1 },
         [4] = { 44,      20/*20*/,  0,          2 },
         [5] = { 48,      16/*16*/,  0,          2 },
-        [6] = { 0 }, /* Invalid */
+        [6] = { 52,      12/*12*/,  3,          3 },
         [7] = { 0 }  /* Invalid */
     };
 
@@ -2069,7 +2069,7 @@ void __init setup_virt_paging(void)
         }
     }
 
-    /* pa_range is 4 bits, but the defined encodings are only 3 bits */
+    /* pa_range is 4 bits but we don't support all modes */
     if ( pa_range >= ARRAY_SIZE(pa_range_info) || !pa_range_info[pa_range].pabits )
         panic("Unknown encoding of ID_AA64MMFR0_EL1.PARange %x\n", pa_range);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Wed Aug 03 23:44:25 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Aug 2022 23:44:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380118.614112 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJO2L-0005b6-JS; Wed, 03 Aug 2022 23:44:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380118.614112; Wed, 03 Aug 2022 23:44:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJO2L-0005au-G2; Wed, 03 Aug 2022 23:44:25 +0000
Received: by outflank-mailman (input) for mailman id 380118;
 Wed, 03 Aug 2022 23:44:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJO2K-0005aa-SG
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 23:44:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJO2K-0004lA-RT
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 23:44:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJO2K-0008Qj-QX
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 23:44:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=e0eAhwZdCFWtOS6DvR55UGKZWyHU4ewlzmW4tR5V0MI=; b=RnRb8bvwJZZMnOswGYGmeqA0ds
	pGJoBqgw5nSBK8yWpdXvQEI+1MogkcYieXfmz+CdLCIRglTOssTkpp3RngI5xjH3snK39SwbVw9S1
	+f0t8zsqyKOUQNhHUyxmOc5Qz/zeIhUcILd9Oh8LoeXFNH9au0c3f4MXJ3yi8xGZ87WU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] xen/arm: Avoid overflow using MIDR_IMPLEMENTOR_MASK
Message-Id: <E1oJO2K-0008Qj-QX@xenbits.xenproject.org>
Date: Wed, 03 Aug 2022 23:44:24 +0000

commit 048185188fbae9d0e7d25992d8318be2a4a5a2cc
Author:     Michal Orzel <michal.orzel@arm.com>
AuthorDate: Thu May 5 13:59:06 2022 +0200
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Aug 3 14:57:43 2022 -0700

    xen/arm: Avoid overflow using MIDR_IMPLEMENTOR_MASK
    
    Value of macro MIDR_IMPLEMENTOR_MASK exceeds the range of integer
    and can lead to overflow. Currently there is no issue as it is used
    in an expression implicitly casted to u32 in MIDR_IS_CPU_MODEL_RANGE.
    To avoid possible problems, fix the macro.
    
    Signed-off-by: Michal Orzel <michal.orzel@arm.com>
    Link: https://lore.kernel.org/r/20220426070603.56031-1-michal.orzel@arm.com
    Acked-by: Catalin Marinas <catalin.marinas@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    (cherry picked from commit aa1cba100bff84b211f27639bd6efeaf7e701bcc)
---
 xen/include/asm-arm/processor.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h
index 852b5f3c24..7a1c4c4410 100644
--- a/xen/include/asm-arm/processor.h
+++ b/xen/include/asm-arm/processor.h
@@ -39,7 +39,7 @@
 #define MIDR_VARIANT(midr) \
     (((midr) & MIDR_VARIANT_MASK) >> MIDR_VARIANT_SHIFT)
 #define MIDR_IMPLEMENTOR_SHIFT  24
-#define MIDR_IMPLEMENTOR_MASK   (0xff << MIDR_IMPLEMENTOR_SHIFT)
+#define MIDR_IMPLEMENTOR_MASK   (0xffU << MIDR_IMPLEMENTOR_SHIFT)
 #define MIDR_IMPLEMENTOR(midr) \
     (((midr) & MIDR_IMPLEMENTOR_MASK) >> MIDR_IMPLEMENTOR_SHIFT)
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Wed Aug 03 23:44:36 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Aug 2022 23:44:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380119.614115 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJO2W-0005i5-KB; Wed, 03 Aug 2022 23:44:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380119.614115; Wed, 03 Aug 2022 23:44:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJO2W-0005hw-HY; Wed, 03 Aug 2022 23:44:36 +0000
Received: by outflank-mailman (input) for mailman id 380119;
 Wed, 03 Aug 2022 23:44:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJO2U-0005gn-VK
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 23:44:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJO2U-0004lO-UX
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 23:44:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJO2U-0008RA-Te
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 23:44:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8sKmm8JUUerHdfOMYORU54RYM6Wkm35IDD33G8Dsiqo=; b=2EuZObVjYYAprNhcE/jr/z9XBC
	rqQPP43zftEujThOfBP7G/uH806lOjDMKMouuzgCIJjcyn1Qlt5ZIwNR0O6RPsDkGgj8aEdXENRSt
	mAES2RL9goBsriMKK9wzrmOl/GaeFc2cf5hljbhgIPzpFjombBQiEpIdf5jJtd0LvTI4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] xen/arm: traps: Fix reference to invalid erratum ID
Message-Id: <E1oJO2U-0008RA-Te@xenbits.xenproject.org>
Date: Wed, 03 Aug 2022 23:44:34 +0000

commit 6f65040081b78662bf6ecde9a3b73ee04758d0e9
Author:     Michal Orzel <michal.orzel@arm.com>
AuthorDate: Fri Jun 10 10:33:56 2022 +0200
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Aug 3 14:57:48 2022 -0700

    xen/arm: traps: Fix reference to invalid erratum ID
    
    The correct erratum ID should be 834220.
    
    Fixes: 0a7ba2936457 ("xen/arm: arm64: Add Cortex-A57 erratum 834220 workaround")
    Signed-off-by: Michal Orzel <michal.orzel@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    (cherry picked from commit a6f7ed5fc7d5fb5001ef82db99d34bc8a85fc2b6)
---
 xen/arch/arm/traps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 219ab3c3fb..bbbd15e9fa 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -1862,7 +1862,7 @@ static inline bool hpfar_is_valid(bool s1ptw, uint8_t fsc)
      *  1. the stage 2 fault happen during a stage 1 page table walk
      *  (the bit ESR_EL2.S1PTW is set)
      *  2. the fault was due to a translation fault and the processor
-     *  does not carry erratum #8342220
+     *  does not carry erratum #834220
      *
      * Note that technically HPFAR is valid for other cases, but they
      * are currently not supported by Xen.
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Wed Aug 03 23:44:46 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Aug 2022 23:44:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380121.614118 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJO2g-0005qJ-Mr; Wed, 03 Aug 2022 23:44:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380121.614118; Wed, 03 Aug 2022 23:44:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJO2g-0005qC-KK; Wed, 03 Aug 2022 23:44:46 +0000
Received: by outflank-mailman (input) for mailman id 380121;
 Wed, 03 Aug 2022 23:44:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJO2f-0005ob-34
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 23:44:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJO2f-0004lb-2H
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 23:44:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJO2f-0008Rq-0W
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 23:44:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=iaoeNdSeJ7RlqgFm7EdAT6s+bWJZOknCxO+czoXaDI8=; b=IvLw3AlOyCV9Jh1TkopfmjsY+0
	IE9+jJtzxxcmc/2nyv/18EXt2bKsmOUlC+8RwCfy3os7MQOWhNm5vQIjmTSOUb7altnyjiNxIzLGV
	NFWE5M0axHrTYy8EEPH/+USisWuzlKK5Sl76xAMYtryZGY/3Wmxz1KZFNKoRkW2+TJxg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] xen/arm: head: Add missing isb after writing to SCTLR_EL2/HSCTLR
Message-Id: <E1oJO2f-0008Rq-0W@xenbits.xenproject.org>
Date: Wed, 03 Aug 2022 23:44:45 +0000

commit 0d362e5ed3fa1b307834bcffbf7fd5341e32ebfd
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Sat Jul 16 15:34:07 2022 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Aug 3 14:57:53 2022 -0700

    xen/arm: head: Add missing isb after writing to SCTLR_EL2/HSCTLR
    
    Write to SCTLR_EL2/HSCTLR may not be visible until the next context
    synchronization. When initializing the CPU, we want the update to take
    effect right now. So add an isb afterwards.
    
    Spec references:
        - AArch64: D13.1.2 ARM DDI 0406C.d
        - AArch32 v8: G8.1.2 ARM DDI 0406C.d
        - AArch32 v7: B5.6.3 ARM DDI 0406C.d
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Michal Orzel <michal.orzel@arm.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    (cherry picked from commit 25424d1a6b7b7e875230aba77c2f044a4883e49a)
---
 xen/arch/arm/arm32/head.S | 1 +
 xen/arch/arm/arm64/head.S | 1 +
 2 files changed, 2 insertions(+)

diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S
index 7178865f48..854481f4f9 100644
--- a/xen/arch/arm/arm32/head.S
+++ b/xen/arch/arm/arm32/head.S
@@ -353,6 +353,7 @@ cpu_init_done:
 
         ldr   r0, =HSCTLR_SET
         mcr   CP32(r0, HSCTLR)
+        isb
 
         mov   pc, r5                        /* Return address is in r5 */
 ENDPROC(cpu_init)
diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S
index 057dd5d925..42a2177c53 100644
--- a/xen/arch/arm/arm64/head.S
+++ b/xen/arch/arm/arm64/head.S
@@ -485,6 +485,7 @@ cpu_init:
 
         ldr   x0, =SCTLR_EL2_SET
         msr   SCTLR_EL2, x0
+        isb
 
         /*
          * Ensure that any exceptions encountered at EL2
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Wed Aug 03 23:44:56 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Aug 2022 23:44:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380122.614123 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJO2q-0005vM-OW; Wed, 03 Aug 2022 23:44:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380122.614123; Wed, 03 Aug 2022 23: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 1oJO2q-0005vE-Ls; Wed, 03 Aug 2022 23:44:56 +0000
Received: by outflank-mailman (input) for mailman id 380122;
 Wed, 03 Aug 2022 23:44:55 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJO2p-0005ur-69
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 23:44:55 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJO2p-0004lm-5F
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 23:44:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJO2p-0008SI-4Q
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 23:44:55 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Thuz76CvYIOgayUa+b9dSlQwwG+gLRvvROIVebo+YIQ=; b=miJIHAM28QkzYce1mkM6owtLtv
	crpAAvKJHQTb+xuofwc+RafbbDxOnb1XH+z+YetqFp53RTnDwZ15S2lnnThypLlkwr1aJlQ7cDNBq
	HMMNiomJn3T6FshiNsAhfAktM0kI+h1B/99B7sEQKwj5+r2c7FE2KLN8b2Wed+OWf+14=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] arm/vgic-v3: fix virq offset in the rank when storing irouter
Message-Id: <E1oJO2p-0008SI-4Q@xenbits.xenproject.org>
Date: Wed, 03 Aug 2022 23:44:55 +0000

commit 3050769a171a881b6225c98c750e1c5f92311081
Author:     Hongda Deng <Hongda.Deng@arm.com>
AuthorDate: Fri Jul 29 16:36:02 2022 +0800
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Aug 3 14:57:58 2022 -0700

    arm/vgic-v3: fix virq offset in the rank when storing irouter
    
    When vGIC performs irouter registers emulation, to get the target vCPU
    via virq conveniently, Xen doesn't store the irouter value directly,
    instead it will use the value (affinities) in irouter to calculate the
    target vCPU, and then save the target vCPU in irq rank->vcpu[offset].
    
    When vGIC tries to get the target vCPU, it first calculates the target
    vCPU index via
      int target = read_atomic(&rank->vcpu[virq & INTERRUPT_RANK_MASK]);
    and then it gets the target vCPU via
      v->domain->vcpu[target];
    
    When vGIC tries to store irouter for one virq, the target vCPU index
    in the rank is computed as
      offset &= virq & INTERRUPT_RANK_MASK;
    finally it gets the target vCPU via
      d->vcpu[read_atomic(&rank->vcpu[offset])];
    
    There is a difference between them while getting the target vCPU index
    in the rank. Actually (virq & INTERRUPT_RANK_MASK) would already get
    the target vCPU index in the rank, it's wrong to add '&' before '=' when
    calculate the offset.
    
    For example, the target vCPU index in the rank should be 6 for virq 38,
    but vGIC will get offset=0 when vGIC stores the irouter for this virq,
    and finally vGIC will access the wrong target vCPU index in the rank
    when updating the irouter.
    
    Fixes: 5d495f4349b5 ("xen/arm: vgic: Optimize the way to store the target vCPU in the rank")
    Signed-off-by: Hongda Deng <Hongda.Deng@arm.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    (cherry picked from commit 800f21499e0ec112771ce1e94490ca5811578bc2)
---
 xen/arch/arm/vgic-v3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/vgic-v3.c b/xen/arch/arm/vgic-v3.c
index 65bb7991a6..191cfd0959 100644
--- a/xen/arch/arm/vgic-v3.c
+++ b/xen/arch/arm/vgic-v3.c
@@ -135,7 +135,7 @@ static void vgic_store_irouter(struct domain *d, struct vgic_irq_rank *rank,
     ASSERT(virq >= 32);
 
     /* Get the index in the rank */
-    offset &= virq & INTERRUPT_RANK_MASK;
+    offset = virq & INTERRUPT_RANK_MASK;
 
     new_vcpu = vgic_v3_irouter_to_vcpu(d, irouter);
     old_vcpu = d->vcpu[read_atomic(&rank->vcpu[offset])];
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Wed Aug 03 23:45:06 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Aug 2022 23:45:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380124.614126 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJO30-00061K-QD; Wed, 03 Aug 2022 23:45:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380124.614126; Wed, 03 Aug 2022 23: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 1oJO30-00061D-NP; Wed, 03 Aug 2022 23:45:06 +0000
Received: by outflank-mailman (input) for mailman id 380124;
 Wed, 03 Aug 2022 23:45:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJO2z-0005zw-9D
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 23:45:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJO2z-0004mR-8O
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 23:45:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJO2z-0008TG-7f
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 23:45:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fa0lc3hO/fS8rlX6UBTpM7euuRjKJFtHTD4vQGTz9ko=; b=OvilsAWu4Ma/qwoT+FgCCwJa88
	uyn8M/hm6aN5j64TRjSyFJGDQNIoIBXk6cZ8866NEtQPUZe4cipOdUQpC6cYjaCOgRLb4ZxhKZGCH
	NZ3W6iF91KO/Wqa+5XRP53ZwBtZ40ty08ZxqQqUbc5KBatpLHz0GhGGy2tdDnEdGrx2k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] xen/arm: avoid overflow when setting vtimer in context switch
Message-Id: <E1oJO2z-0008TG-7f@xenbits.xenproject.org>
Date: Wed, 03 Aug 2022 23:45:05 +0000

commit 48e7440ec6eb6eb99011a549a649c44632f69edb
Author:     Jiamei Xie <jiamei.xie@arm.com>
AuthorDate: Wed Jul 6 16:25:58 2022 +0800
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Aug 3 14:58:04 2022 -0700

    xen/arm: avoid overflow when setting vtimer in context switch
    
    virt_vtimer_save() will calculate the next deadline when the vCPU is
    scheduled out. At the moment, Xen will use the following equation:
    
      virt_timer.cval + virt_time_base.offset - boot_count
    
    The three values are 64-bit and one (cval) is controlled by domain. In
    theory, it would be possible that the domain has started a long time
    after the system boot. So virt_time_base.offset - boot_count may be a
    large numbers.
    
    This means a domain may inadvertently set a cval so the result would
    overflow. Consequently, the deadline would be set very far in the
    future. This could result to loss of timer interrupts or the vCPU
    getting block "forever".
    
    One way to solve the problem, would be to separately
       1) compute when the domain was created in ns
       2) convert cval to ns
       3) Add 1 and 2 together
    
    The first part of the equation never change (the value is set/known at
    domain creation). So take the opportunity to store it in domain structure.
    
    Signed-off-by: Jiamei Xie <jiamei.xie@arm.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    (cherry picked from commit 6655eb81092a94e065fdcd0b47a1b1d69dc4e54c)
---
 xen/arch/arm/vtimer.c        | 9 ++++++---
 xen/include/asm-arm/domain.h | 1 +
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/xen/arch/arm/vtimer.c b/xen/arch/arm/vtimer.c
index 0196951af4..23198d0396 100644
--- a/xen/arch/arm/vtimer.c
+++ b/xen/arch/arm/vtimer.c
@@ -63,7 +63,9 @@ static void virt_timer_expired(void *data)
 int domain_vtimer_init(struct domain *d, struct xen_arch_domainconfig *config)
 {
     d->arch.virt_timer_base.offset = get_cycles();
-    d->time_offset.seconds = ticks_to_ns(d->arch.virt_timer_base.offset - boot_count);
+    d->arch.virt_timer_base.nanoseconds =
+        ticks_to_ns(d->arch.virt_timer_base.offset - boot_count);
+    d->time_offset.seconds = d->arch.virt_timer_base.nanoseconds;
     do_div(d->time_offset.seconds, 1000000000);
 
     config->clock_frequency = timer_dt_clock_frequency;
@@ -144,8 +146,9 @@ void virt_timer_save(struct vcpu *v)
     if ( (v->arch.virt_timer.ctl & CNTx_CTL_ENABLE) &&
          !(v->arch.virt_timer.ctl & CNTx_CTL_MASK))
     {
-        set_timer(&v->arch.virt_timer.timer, ticks_to_ns(v->arch.virt_timer.cval +
-                  v->domain->arch.virt_timer_base.offset - boot_count));
+        set_timer(&v->arch.virt_timer.timer,
+                  v->domain->arch.virt_timer_base.nanoseconds +
+                  ticks_to_ns(v->arch.virt_timer.cval));
     }
 }
 
diff --git a/xen/include/asm-arm/domain.h b/xen/include/asm-arm/domain.h
index 9b3647587a..7f8ddd3f5c 100644
--- a/xen/include/asm-arm/domain.h
+++ b/xen/include/asm-arm/domain.h
@@ -58,6 +58,7 @@ struct arch_domain
 
     struct {
         uint64_t offset;
+        s_time_t nanoseconds;
     } virt_timer_base;
 
     struct vgic_dist vgic;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Wed Aug 03 23:45:16 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Aug 2022 23:45:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380125.614130 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJO3A-00065a-Rz; Wed, 03 Aug 2022 23:45:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380125.614130; Wed, 03 Aug 2022 23: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 1oJO3A-00065Q-PA; Wed, 03 Aug 2022 23:45:16 +0000
Received: by outflank-mailman (input) for mailman id 380125;
 Wed, 03 Aug 2022 23:45:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJO39-00063u-Bu
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 23:45:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJO39-0004mr-BD
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 23:45:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJO39-0008Tn-AZ
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 23:45:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zf33wAL28wKe/cp0YVTlZqy52kobzvdRJuipE4zPSJY=; b=LVENfhV5B8VfH6SkAiWA2+u53B
	LQdmc4KcGCe4roOm229sA0+HS7PX8Sg9sfisgd5+G0UyXRy7rbYvQdt95JBekIQ+NOD8uiNNo3L63
	CA35n87DGFajXiZdWh+VkYrZirbfz29H3zoMUv+3Y/8nbuObffzxJGd1p8ejsZjUm0FY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] xen/arm: Advertise workaround 1 if we apply 3
Message-Id: <E1oJO39-0008Tn-AZ@xenbits.xenproject.org>
Date: Wed, 03 Aug 2022 23:45:15 +0000

commit a0b823dca2ecb1b0b0d78dfa46bb7445b60ac8bd
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Tue May 3 10:38:30 2022 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Aug 3 14:58:08 2022 -0700

    xen/arm: Advertise workaround 1 if we apply 3
    
    SMCC_WORKAROUND_3 is handling both Spectre v2 and spectre BHB.
    So when a guest is asking if we support workaround 1, tell yes if we
    apply workaround 3 on exception entry as it handles it.
    
    This will allow guests not supporting Spectre BHB but impacted by
    spectre v2 to still handle it correctly.
    The modified behaviour is coherent with what the Linux kernel does in
    KVM for guests.
    
    While there use ARM_SMCCC_SUCCESS instead of 0 for the return code value
    for workaround detection to be coherent with Workaround 2 handling.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    (cherry picked from commit af570d1c90f1ed6040d724732f6c582383782e90)
---
 xen/arch/arm/vsmc.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/xen/arch/arm/vsmc.c b/xen/arch/arm/vsmc.c
index b633ff2fe8..676740ef15 100644
--- a/xen/arch/arm/vsmc.c
+++ b/xen/arch/arm/vsmc.c
@@ -104,8 +104,13 @@ static bool handle_arch(struct cpu_user_regs *regs)
         switch ( arch_func_id )
         {
         case ARM_SMCCC_ARCH_WORKAROUND_1_FID:
-            if ( cpus_have_cap(ARM_HARDEN_BRANCH_PREDICTOR) )
-                ret = 0;
+            /*
+             * Workaround 3 is also mitigating spectre v2 so advertise that we
+             * support Workaround 1 if we do Workaround 3 on exception entry.
+             */
+            if ( cpus_have_cap(ARM_HARDEN_BRANCH_PREDICTOR) ||
+                 cpus_have_cap(ARM_WORKAROUND_BHB_SMCC_3) )
+                ret = ARM_SMCCC_SUCCESS;
             break;
         case ARM_SMCCC_ARCH_WORKAROUND_2_FID:
             switch ( get_ssbd_state() )
@@ -126,7 +131,7 @@ static bool handle_arch(struct cpu_user_regs *regs)
             break;
         case ARM_SMCCC_ARCH_WORKAROUND_3_FID:
             if ( cpus_have_cap(ARM_WORKAROUND_BHB_SMCC_3) )
-                ret = 0;
+                ret = ARM_SMCCC_SUCCESS;
             break;
         }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Wed Aug 03 23:45:26 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Aug 2022 23:45:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380127.614135 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJO3K-00068T-Tc; Wed, 03 Aug 2022 23:45:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380127.614135; Wed, 03 Aug 2022 23:45:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJO3K-00068L-Qm; Wed, 03 Aug 2022 23:45:26 +0000
Received: by outflank-mailman (input) for mailman id 380127;
 Wed, 03 Aug 2022 23:45:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJO3J-00068B-Er
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 23:45:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJO3J-0004oV-E4
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 23:45:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJO3J-0008UO-DL
 for xen-changelog@lists.xenproject.org; Wed, 03 Aug 2022 23:45:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Da/n+a1GXrcMR0sd1nocmFDqELi8NmwmjpuLLepehFM=; b=TkPEBGQYK4D7aj9PsOpL1vAWe6
	4Nf4+nh40fdgNVbP3McsTn1ISbE64lL5HTGHPzqBhJgGRZwEIgCY0GLgLEDmTrfc+Y7JrO7K11bsS
	DxtvyZESuM9b7pshQj0rTTZ9uZspYvviecPAlH6FCrDQ0LGWB2jtQMyytO6qLVCPhEW0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] xen: arm: Don't use stop_cpu() in halt_this_cpu()
Message-Id: <E1oJO3J-0008UO-DL@xenbits.xenproject.org>
Date: Wed, 03 Aug 2022 23:45:25 +0000

commit 48b67651746f3124b0d5d30147180f1238d2e9c6
Author:     Dmytro Semenets <dmytro_semenets@epam.com>
AuthorDate: Thu Jun 23 10:44:28 2022 +0300
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Aug 3 14:58:11 2022 -0700

    xen: arm: Don't use stop_cpu() in halt_this_cpu()
    
    When shutting down (or rebooting) the platform, Xen will call stop_cpu()
    on all the CPUs but one. The last CPU will then request the system to
    shutdown/restart.
    
    On platform using PSCI, stop_cpu() will call PSCI CPU off. Per the spec
    (section 5.5.2 DEN0022D.b), the call could return DENIED if the Trusted
    OS is resident on the CPU that is about to be turned off.
    
    As Xen doesn't migrate off the trusted OS (which BTW may not be
    migratable), it would be possible to hit the panic().
    
    In the ideal situation, Xen should migrate the trusted OS or make sure
    the CPU off is not called. However, when shutting down (or rebooting)
    the platform, it is pointless to try to turn off all the CPUs (per
    section 5.10.2, it is only required to put the core in a known state).
    
    So solve the problem by open-coding stop_cpu() in halt_this_cpu() and
    not call PSCI CPU off.
    
    Signed-off-by: Dmytro Semenets <dmytro_semenets@epam.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    (cherry picked from commit ee11f092b515bf3c926eaad053d12d3f2b6e593e)
---
 xen/arch/arm/shutdown.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/shutdown.c b/xen/arch/arm/shutdown.c
index 3dc6819d56..a9aea19e8e 100644
--- a/xen/arch/arm/shutdown.c
+++ b/xen/arch/arm/shutdown.c
@@ -8,7 +8,12 @@
 
 static void noreturn halt_this_cpu(void *arg)
 {
-    stop_cpu();
+    local_irq_disable();
+    /* Make sure the write happens before we sleep forever */
+    dsb(sy);
+    isb();
+    while ( 1 )
+        wfi();
 }
 
 void machine_halt(void)
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Aug 04 01:22:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Aug 2022 01:22:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380131.614139 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJPYo-0005yg-Ip; Thu, 04 Aug 2022 01:22:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380131.614139; Thu, 04 Aug 2022 01:22:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJPYo-0005yY-Fz; Thu, 04 Aug 2022 01:22:02 +0000
Received: by outflank-mailman (input) for mailman id 380131;
 Thu, 04 Aug 2022 01:22:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJPYn-0005yS-Nq
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 01:22:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJPYn-0005bt-Mm
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 01:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJPYn-0004a7-Lu
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 01:22:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=qvfN2/OBpAD/iwGQ6L7bYRC1SCf/hkCfzpeyUzyGM50=; b=saaSZRyoHNhfJKHX4Frro6bOOA
	6tyvie7i3KGQcf4RBPVYiOHBs/zxwvdlH6ea0JS7KGlGoi1XLsp3PAvIOEUh+AKCxpo/VIuJjH86h
	NsmBt9K12GYnJMG1hGsR254Tj5SWzOjDvYgR7hock9NZS8vRcV5XkBGI01uGBVCjCpJ4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] tools/libxl: env variable to signal whether disk/nic backend is trusted
Message-Id: <E1oJPYn-0004a7-Lu@xenbits.xenproject.org>
Date: Thu, 04 Aug 2022 01:22:01 +0000

commit 1b9845dcf959421db3a071a6bc0aa9d8edbffb50
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Aug 3 12:41:18 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Aug 3 12:41:18 2022 +0200

    tools/libxl: env variable to signal whether disk/nic backend is trusted
    
    Introduce support in libxl for fetching the default backend trusted
    option for disk and nic devices.
    
    Users can set LIBXL_{DISK,NIC}_BACKEND_UNTRUSTED environment variable
    to notify libxl of whether the backends for disk and nic devices
    should be trusted.  Such information is passed into the frontend so it
    can take the appropriate measures.
    
    This is part of XSA-403.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 docs/man/xl.1.pod.in          | 18 ++++++++++++++++++
 tools/libs/light/libxl_disk.c |  5 +++++
 tools/libs/light/libxl_nic.c  |  7 +++++++
 3 files changed, 30 insertions(+)

diff --git a/docs/man/xl.1.pod.in b/docs/man/xl.1.pod.in
index e2176bd696..45e1430aeb 100644
--- a/docs/man/xl.1.pod.in
+++ b/docs/man/xl.1.pod.in
@@ -1946,6 +1946,24 @@ shows the decimal value. For non-linear mode, it shows hexadecimal value.
 
 =back
 
+=head1 ENVIRONMENT
+
+=over 4
+
+=item B<LIBXL_DISK_BACKEND_UNTRUSTED>
+
+Set this environment variable to "1" to suggest to the guest that the disk
+backend shouldn't be trusted. If the variable is absent or set to "0", the
+backend will be trusted.
+
+=item B<LIBXL_NIC_BACKEND_UNTRUSTED>
+
+Set this environment variable to "1" to suggest to the guest that the network
+backend shouldn't be trusted. If the variable is absent or set to "0", the
+backend will be trusted.
+
+=back
+
 =head1 IGNORED FOR COMPATIBILITY WITH XM
 
 xl is mostly command-line compatible with the old xm utility used with
diff --git a/tools/libs/light/libxl_disk.c b/tools/libs/light/libxl_disk.c
index 93936d0dd0..67d1cc1857 100644
--- a/tools/libs/light/libxl_disk.c
+++ b/tools/libs/light/libxl_disk.c
@@ -246,6 +246,7 @@ static void device_disk_add(libxl__egc *egc, uint32_t domid,
     libxl_domain_config d_config;
     libxl_device_disk disk_saved;
     libxl__flock *lock = NULL;
+    const char *envvar;
 
     libxl_domain_config_init(&d_config);
     libxl_device_disk_init(&disk_saved);
@@ -395,6 +396,10 @@ static void device_disk_add(libxl__egc *egc, uint32_t domid,
         flexarray_append(front, GCSPRINTF("%d", device->devid));
         flexarray_append(front, "device-type");
         flexarray_append(front, disk->is_cdrom ? "cdrom" : "disk");
+        flexarray_append(front, "trusted");
+        envvar = getenv("LIBXL_DISK_BACKEND_UNTRUSTED");
+        /* Set "trusted=1" if envvar missing or is "0". */
+        flexarray_append(front, !envvar || !strcmp("0", envvar) ? "1" : "0");
 
         /*
          * Old PV kernel disk frontends before 2.6.26 rely on tool stack to
diff --git a/tools/libs/light/libxl_nic.c b/tools/libs/light/libxl_nic.c
index 0b9e70c9d1..f87890d1d6 100644
--- a/tools/libs/light/libxl_nic.c
+++ b/tools/libs/light/libxl_nic.c
@@ -132,6 +132,8 @@ static int libxl__set_xenstore_nic(libxl__gc *gc, uint32_t domid,
                                    flexarray_t *back, flexarray_t *front,
                                    flexarray_t *ro_front)
 {
+    const char *envvar;
+
     flexarray_grow(back, 2);
 
     if (nic->script)
@@ -255,6 +257,11 @@ static int libxl__set_xenstore_nic(libxl__gc *gc, uint32_t domid,
     flexarray_append(back, "hotplug-status");
     flexarray_append(back, "");
 
+    flexarray_append(front, "trusted");
+    envvar = getenv("LIBXL_NIC_BACKEND_UNTRUSTED");
+    /* Set "trusted=1" if envvar missing or is "0". */
+    flexarray_append(front, !envvar || !strcmp("0", envvar) ? "1" : "0");
+
     return 0;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Thu Aug 04 01:22:12 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Aug 2022 01:22:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380132.614142 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJPYy-00060O-KG; Thu, 04 Aug 2022 01:22:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380132.614142; Thu, 04 Aug 2022 01: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 1oJPYy-00060G-Ha; Thu, 04 Aug 2022 01:22:12 +0000
Received: by outflank-mailman (input) for mailman id 380132;
 Thu, 04 Aug 2022 01:22:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJPYx-000606-R1
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 01:22:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJPYx-0005cU-QA
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 01:22:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJPYx-0004aW-PH
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 01:22:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=U7STNCcR5rmW9w6evzDAnACLbprm9Iau2zWBwrICgug=; b=hIExiz7XQASdN5xmD3AIXopZIV
	L4CM916NnpI2x/iezN/LQ1xtWTtfqg5rvGYubQa0siBfBTVbCE4z3YuRHRT3buZ1W1lGdvRGkjXgh
	6wOnTsxyb8onmD59zbJJCfGBiQyEd1JWIuDz2GrnnlFaeXNOtQEmHYPCfwLFe0KHYDUU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] x86/msr: fix X2APIC_LAST
Message-Id: <E1oJPYx-0004aW-PH@xenbits.xenproject.org>
Date: Thu, 04 Aug 2022 01:22:11 +0000

commit df3395f6b2d759aba39fb67a7bc0fe49147c8b39
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Wed Aug 3 12:41:49 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Aug 3 12:41:49 2022 +0200

    x86/msr: fix X2APIC_LAST
    
    The latest Intel manual now says the X2APIC reserved range is only
    0x800 to 0x8ff (NOT 0xbff).
    This changed between SDM 68 (Nov 2018) and SDM 69 (Jan 2019).
    The AMD manual documents 0x800-0x8ff too.
    
    There are non-X2APIC MSRs in the 0x900-0xbff range now:
    e.g. 0x981 is IA32_TME_CAPABILITY, an architectural MSR.
    
    The new MSR in this range appears to have been introduced in Icelake,
    so this commit should be backported to Xen versions supporting Icelake.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 13316827faadbb4f72ae6c625af9938d8f976f86
    master date: 2022-07-27 12:57:10 +0200
---
 xen/arch/x86/hvm/vmx/vmx.c      | 4 ++--
 xen/include/asm-x86/msr-index.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 868151a2e5..775b36433e 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -3401,7 +3401,7 @@ void vmx_vlapic_msr_changed(struct vcpu *v)
             if ( cpu_has_vmx_apic_reg_virt )
             {
                 for ( msr = MSR_X2APIC_FIRST;
-                      msr <= MSR_X2APIC_FIRST + 0xff; msr++ )
+                      msr <= MSR_X2APIC_LAST; msr++ )
                     vmx_clear_msr_intercept(v, msr, VMX_MSR_R);
 
                 vmx_set_msr_intercept(v, MSR_X2APIC_PPR, VMX_MSR_R);
@@ -3422,7 +3422,7 @@ void vmx_vlapic_msr_changed(struct vcpu *v)
     if ( !(v->arch.hvm.vmx.secondary_exec_control &
            SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE) )
         for ( msr = MSR_X2APIC_FIRST;
-              msr <= MSR_X2APIC_FIRST + 0xff; msr++ )
+              msr <= MSR_X2APIC_LAST; msr++ )
             vmx_set_msr_intercept(v, msr, VMX_MSR_RW);
 
     vmx_update_secondary_exec_control(v);
diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h
index b4a360723b..f1b2cf5460 100644
--- a/xen/include/asm-x86/msr-index.h
+++ b/xen/include/asm-x86/msr-index.h
@@ -459,7 +459,7 @@
 #define MSR_IA32_TSC_ADJUST		0x0000003b
 
 #define MSR_X2APIC_FIRST                0x00000800
-#define MSR_X2APIC_LAST                 0x00000bff
+#define MSR_X2APIC_LAST                 0x000008ff
 
 #define MSR_X2APIC_TPR                  0x00000808
 #define MSR_X2APIC_PPR                  0x0000080a
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Thu Aug 04 08:11:11 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Aug 2022 08:11:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380244.614314 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJVwd-0003G2-5f; Thu, 04 Aug 2022 08:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380244.614314; Thu, 04 Aug 2022 08:11:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJVwd-0003Fu-2k; Thu, 04 Aug 2022 08:11:03 +0000
Received: by outflank-mailman (input) for mailman id 380244;
 Thu, 04 Aug 2022 08:11:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJVwb-0003Fo-TN
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 08:11:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJVwb-0006XH-Rl
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 08:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJVwb-0008Qz-Pw
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 08:11:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hl9Di2JP3tTzAmXqCM0oNr98m7btHK+8pwtDevQGzKM=; b=hlGd8tJgxL2pZQpLQm8FmaMs8M
	1cIiowXr4Eka/K6VMIx66x31G6CHl3JO+2qql4M96kVxTRwx9aXiCv+YDpAyPA0ztsTVSH1P1SCIS
	DPgzZDHCDqM+KtDEdsUyEUkxdBUfjnDhTT4HwufsRpgB9471XL9BhOfoVqj1xF1EDjB4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] tools/libxl: env variable to signal whether disk/nic backend is trusted
Message-Id: <E1oJVwb-0008Qz-Pw@xenbits.xenproject.org>
Date: Thu, 04 Aug 2022 08:11:01 +0000

commit 261b882f7704515a01f74589f57f0c1303e3b701
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Aug 3 14:19:12 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Aug 3 14:19:12 2022 +0200

    tools/libxl: env variable to signal whether disk/nic backend is trusted
    
    Introduce support in libxl for fetching the default backend trusted
    option for disk and nic devices.
    
    Users can set LIBXL_{DISK,NIC}_BACKEND_UNTRUSTED environment variable
    to notify libxl of whether the backends for disk and nic devices
    should be trusted.  Such information is passed into the frontend so it
    can take the appropriate measures.
    
    This is part of XSA-403.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 docs/man/xl.1.pod.in     | 18 ++++++++++++++++++
 tools/libxl/libxl_disk.c |  5 +++++
 tools/libxl/libxl_nic.c  |  7 +++++++
 3 files changed, 30 insertions(+)

diff --git a/docs/man/xl.1.pod.in b/docs/man/xl.1.pod.in
index 52a47a6fbd..8c28a5d5ca 100644
--- a/docs/man/xl.1.pod.in
+++ b/docs/man/xl.1.pod.in
@@ -1938,6 +1938,24 @@ shows the decimal value. For non-linear mode, it shows hexadecimal value.
 
 =back
 
+=head1 ENVIRONMENT
+
+=over 4
+
+=item B<LIBXL_DISK_BACKEND_UNTRUSTED>
+
+Set this environment variable to "1" to suggest to the guest that the disk
+backend shouldn't be trusted. If the variable is absent or set to "0", the
+backend will be trusted.
+
+=item B<LIBXL_NIC_BACKEND_UNTRUSTED>
+
+Set this environment variable to "1" to suggest to the guest that the network
+backend shouldn't be trusted. If the variable is absent or set to "0", the
+backend will be trusted.
+
+=back
+
 =head1 IGNORED FOR COMPATIBILITY WITH XM
 
 xl is mostly command-line compatible with the old xm utility used with
diff --git a/tools/libxl/libxl_disk.c b/tools/libxl/libxl_disk.c
index ddc1eec176..1e9d20d9c3 100644
--- a/tools/libxl/libxl_disk.c
+++ b/tools/libxl/libxl_disk.c
@@ -246,6 +246,7 @@ static void device_disk_add(libxl__egc *egc, uint32_t domid,
     libxl_domain_config d_config;
     libxl_device_disk disk_saved;
     libxl__flock *lock = NULL;
+    const char *envvar;
 
     libxl_domain_config_init(&d_config);
     libxl_device_disk_init(&disk_saved);
@@ -395,6 +396,10 @@ static void device_disk_add(libxl__egc *egc, uint32_t domid,
         flexarray_append(front, GCSPRINTF("%d", device->devid));
         flexarray_append(front, "device-type");
         flexarray_append(front, disk->is_cdrom ? "cdrom" : "disk");
+        flexarray_append(front, "trusted");
+        envvar = getenv("LIBXL_DISK_BACKEND_UNTRUSTED");
+        /* Set "trusted=1" if envvar missing or is "0". */
+        flexarray_append(front, !envvar || !strcmp("0", envvar) ? "1" : "0");
 
         /*
          * Old PV kernel disk frontends before 2.6.26 rely on tool stack to
diff --git a/tools/libxl/libxl_nic.c b/tools/libxl/libxl_nic.c
index 07880b39e1..b92281ab6a 100644
--- a/tools/libxl/libxl_nic.c
+++ b/tools/libxl/libxl_nic.c
@@ -129,6 +129,8 @@ static int libxl__set_xenstore_nic(libxl__gc *gc, uint32_t domid,
                                    flexarray_t *back, flexarray_t *front,
                                    flexarray_t *ro_front)
 {
+    const char *envvar;
+
     flexarray_grow(back, 2);
 
     if (nic->script)
@@ -237,6 +239,11 @@ static int libxl__set_xenstore_nic(libxl__gc *gc, uint32_t domid,
     flexarray_append(front, GCSPRINTF(
                                     LIBXL_MAC_FMT, LIBXL_MAC_BYTES(nic->mac)));
 
+    flexarray_append(front, "trusted");
+    envvar = getenv("LIBXL_NIC_BACKEND_UNTRUSTED");
+    /* Set "trusted=1" if envvar missing or is "0". */
+    flexarray_append(front, !envvar || !strcmp("0", envvar) ? "1" : "0");
+
     return 0;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Thu Aug 04 11:33:07 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Aug 2022 11:33:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380277.614369 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJZ67-0006wS-HD; Thu, 04 Aug 2022 11:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380277.614369; Thu, 04 Aug 2022 11:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJZ67-0006wK-EH; Thu, 04 Aug 2022 11:33:03 +0000
Received: by outflank-mailman (input) for mailman id 380277;
 Thu, 04 Aug 2022 11:33:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJZ66-0006wB-6c
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 11:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJZ66-00022M-5m
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 11:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJZ66-0001s9-4X
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 11:33:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=C5MTWbhFrJUILQa7ZzFsk27QHzmiry/uqpmdzVPG6lo=; b=VMEYBsNrLw33KWKXJCu799wjlo
	FkVNwW+ueVBiheYVpMi013Glu7ZgdDGuSXjD0cJ2Pf0Ssjx1QDsGoB0l5G7ub7w08htmAokDUEU5m
	J8ZUzW0K7L7e9SizrjAtQTDkyIVPCcGoYFZ4sF2zHpmKup2LHaVwMKu2Q+SfewvBCx3U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.13] tools/libxl: env variable to signal whether disk/nic backend is trusted
Message-Id: <E1oJZ66-0001s9-4X@xenbits.xenproject.org>
Date: Thu, 04 Aug 2022 11:33:02 +0000

commit d8a693019845caa4e216bcac10f9501a814c99ae
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Aug 3 14:19:37 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Aug 3 14:19:37 2022 +0200

    tools/libxl: env variable to signal whether disk/nic backend is trusted
    
    Introduce support in libxl for fetching the default backend trusted
    option for disk and nic devices.
    
    Users can set LIBXL_{DISK,NIC}_BACKEND_UNTRUSTED environment variable
    to notify libxl of whether the backends for disk and nic devices
    should be trusted.  Such information is passed into the frontend so it
    can take the appropriate measures.
    
    This is part of XSA-403.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 docs/man/xl.1.pod.in     | 18 ++++++++++++++++++
 tools/libxl/libxl_disk.c |  5 +++++
 tools/libxl/libxl_nic.c  |  7 +++++++
 3 files changed, 30 insertions(+)

diff --git a/docs/man/xl.1.pod.in b/docs/man/xl.1.pod.in
index d4b5e8e362..0ec59a8b5c 100644
--- a/docs/man/xl.1.pod.in
+++ b/docs/man/xl.1.pod.in
@@ -1922,6 +1922,24 @@ shows the decimal value. For non-linear mode, it shows hexadecimal value.
 
 =back
 
+=head1 ENVIRONMENT
+
+=over 4
+
+=item B<LIBXL_DISK_BACKEND_UNTRUSTED>
+
+Set this environment variable to "1" to suggest to the guest that the disk
+backend shouldn't be trusted. If the variable is absent or set to "0", the
+backend will be trusted.
+
+=item B<LIBXL_NIC_BACKEND_UNTRUSTED>
+
+Set this environment variable to "1" to suggest to the guest that the network
+backend shouldn't be trusted. If the variable is absent or set to "0", the
+backend will be trusted.
+
+=back
+
 =head1 IGNORED FOR COMPATIBILITY WITH XM
 
 xl is mostly command-line compatible with the old xm utility used with
diff --git a/tools/libxl/libxl_disk.c b/tools/libxl/libxl_disk.c
index 64a6691424..fe4cb52811 100644
--- a/tools/libxl/libxl_disk.c
+++ b/tools/libxl/libxl_disk.c
@@ -246,6 +246,7 @@ static void device_disk_add(libxl__egc *egc, uint32_t domid,
     libxl_domain_config d_config;
     libxl_device_disk disk_saved;
     libxl__domain_userdata_lock *lock = NULL;
+    const char *envvar;
 
     libxl_domain_config_init(&d_config);
     libxl_device_disk_init(&disk_saved);
@@ -395,6 +396,10 @@ static void device_disk_add(libxl__egc *egc, uint32_t domid,
         flexarray_append(front, GCSPRINTF("%d", device->devid));
         flexarray_append(front, "device-type");
         flexarray_append(front, disk->is_cdrom ? "cdrom" : "disk");
+        flexarray_append(front, "trusted");
+        envvar = getenv("LIBXL_DISK_BACKEND_UNTRUSTED");
+        /* Set "trusted=1" if envvar missing or is "0". */
+        flexarray_append(front, !envvar || !strcmp("0", envvar) ? "1" : "0");
 
         /*
          * Old PV kernel disk frontends before 2.6.26 rely on tool stack to
diff --git a/tools/libxl/libxl_nic.c b/tools/libxl/libxl_nic.c
index 07880b39e1..b92281ab6a 100644
--- a/tools/libxl/libxl_nic.c
+++ b/tools/libxl/libxl_nic.c
@@ -129,6 +129,8 @@ static int libxl__set_xenstore_nic(libxl__gc *gc, uint32_t domid,
                                    flexarray_t *back, flexarray_t *front,
                                    flexarray_t *ro_front)
 {
+    const char *envvar;
+
     flexarray_grow(back, 2);
 
     if (nic->script)
@@ -237,6 +239,11 @@ static int libxl__set_xenstore_nic(libxl__gc *gc, uint32_t domid,
     flexarray_append(front, GCSPRINTF(
                                     LIBXL_MAC_FMT, LIBXL_MAC_BYTES(nic->mac)));
 
+    flexarray_append(front, "trusted");
+    envvar = getenv("LIBXL_NIC_BACKEND_UNTRUSTED");
+    /* Set "trusted=1" if envvar missing or is "0". */
+    flexarray_append(front, !envvar || !strcmp("0", envvar) ? "1" : "0");
+
     return 0;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Thu Aug 04 16:44:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Aug 2022 16:44:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380600.614820 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJdx5-0000kG-VH; Thu, 04 Aug 2022 16:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380600.614820; Thu, 04 Aug 2022 16:44:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJdx5-0000k9-RO; Thu, 04 Aug 2022 16:44:03 +0000
Received: by outflank-mailman (input) for mailman id 380600;
 Thu, 04 Aug 2022 16:44:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdx4-0000k3-8U
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdx4-0000RN-4j
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdx4-0000Oi-3Q
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:44:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZWzj/xbI3HnS08e4/BB22fnsIYHVvIXC+kQehNcK4R0=; b=ZxBuVkhI4bPZJxSC8EVnofsXks
	/RVg8z2Oxrq+ywDnfDWlgHSBjnL6lrIpLkmE0Uu8zdCPOuysYb1fwCUP1phmK/udf9c7sxNRCZmxK
	bethfXBqAfHUyOShrulImS+AHAv7v2sf5cRCZ+JX2bgA4atc4WD0I9sFBnSZvGbSGAzI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libxl: Add support for Virtio disk configuration
Message-Id: <E1oJdx4-0000Oi-3Q@xenbits.xenproject.org>
Date: Thu, 04 Aug 2022 16:44:02 +0000

commit 66dd1c62b2a3c707bd5c55750d10a8223fbd577f
Author:     Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
AuthorDate: Fri Jul 15 22:20:24 2022 +0300
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Jul 28 19:25:43 2022 +0100

    libxl: Add support for Virtio disk configuration
    
    This patch adds basic support for configuring and assisting virtio-mmio
    based virtio-disk backend (emulator) which is intended to run out of
    Qemu and could be run in any domain.
    Although the Virtio block device is quite different from traditional
    Xen PV block device (vbd) from the toolstack's point of view:
     - as the frontend is virtio-blk which is not a Xenbus driver, nothing
       written to Xenstore are fetched by the frontend currently ("vdev"
       is not passed to the frontend). But this might need to be revised
       in future, so frontend data might be written to Xenstore in order to
       support hotplugging virtio devices or passing the backend domain id
       on arch where the device-tree is not available.
     - the ring-ref/event-channel are not used for the backend<->frontend
       communication, the proposed IPC for Virtio is IOREQ/DM
    it is still a "block device" and ought to be integrated in existing
    "disk" handling. So, re-use (and adapt) "disk" parsing/configuration
    logic to deal with Virtio devices as well.
    
    For the immediate purpose and an ability to extend that support for
    other use-cases in future (Qemu, virtio-pci, etc) perform the following
    actions:
    - Add new disk backend type (LIBXL_DISK_BACKEND_STANDALONE) and reflect
      that in the configuration
    - Introduce new disk "specification" and "transport" fields to struct
      libxl_device_disk. Both are written to the Xenstore. The transport
      field is only used for the specification "virtio" and it assumes
      only "mmio" value for now.
    - Introduce new "specification" option with "xen" communication
      protocol being default value.
    - Add new device kind (LIBXL__DEVICE_KIND_VIRTIO_DISK) as current
      one (LIBXL__DEVICE_KIND_VBD) doesn't fit into Virtio disk model
    
    An example of domain configuration for Virtio disk:
    disk = [ 'phy:/dev/mmcblk0p3, xvda1, backendtype=standalone, specification=virtio']
    
    Nothing has changed for default Xen disk configuration.
    
    Please note, this patch is not enough for virtio-disk to work
    on Xen (Arm), as for every Virtio device (including disk) we need
    to allocate Virtio MMIO params (IRQ and memory region) and pass
    them to the backend, also update Guest device-tree. The subsequent
    patch will add these missing bits. For the current patch,
    the default "irq" and "base" are just written to the Xenstore.
    This is not an ideal splitting, but this way we avoid breaking
    the bisectability.
    
    Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: George Dunlap <george.dunlap@citrix.com>
    Tested-by: Jiamei Xie <jiamei.xie@arm.com>
---
 docs/man/xl-disk-configuration.5.pod.in   |  38 +-
 tools/golang/xenlight/helpers.gen.go      |   8 +
 tools/golang/xenlight/types.gen.go        |  18 +
 tools/include/libxl.h                     |   7 +
 tools/libs/light/libxl_device.c           |  62 +-
 tools/libs/light/libxl_disk.c             | 146 ++++-
 tools/libs/light/libxl_internal.h         |   2 +
 tools/libs/light/libxl_types.idl          |  18 +
 tools/libs/light/libxl_types_internal.idl |   1 +
 tools/libs/light/libxl_utils.c            |   2 +
 tools/libs/util/libxlu_disk_l.c           | 959 +++++++++++++++---------------
 tools/libs/util/libxlu_disk_l.h           |   2 +-
 tools/libs/util/libxlu_disk_l.l           |   9 +
 tools/xl/xl_block.c                       |   6 +
 14 files changed, 798 insertions(+), 480 deletions(-)

diff --git a/docs/man/xl-disk-configuration.5.pod.in b/docs/man/xl-disk-configuration.5.pod.in
index 95d039655a..bc945cc517 100644
--- a/docs/man/xl-disk-configuration.5.pod.in
+++ b/docs/man/xl-disk-configuration.5.pod.in
@@ -232,7 +232,7 @@ Specifies the backend implementation to use
 
 =item Supported values
 
-phy, qdisk
+phy, qdisk, standalone
 
 =item Mandatory
 
@@ -244,11 +244,13 @@ Automatically determine which backend to use.
 
 =back
 
-This does not affect the guest's view of the device.  It controls
-which software implementation of the Xen backend driver is used.
+It controls which software implementation of the backend driver is used.
+Depending on the "specification" option this may affect the guest's view
+of the device.
 
 Not all backend drivers support all combinations of other options.
-For example, "phy" does not support formats other than "raw".
+For example, "phy" and "standalone" do not support formats other than "raw"
+and "standalone" does not support specifications other than "virtio".
 Normally this option should not be specified, in which case libxl will
 automatically determine the most suitable backend.
 
@@ -373,8 +375,36 @@ processing or causing malfunction to the frontend or the whole domain.
 
 Note frontends can ignore such recommendation.
 
+=item B<specification>=I<SPECIFICATION>
+
+=over 4
+
+=item Description
+
+Specifies the communication protocol (specification) to use for the chosen
+"backendtype" option
+
+=item Supported values
+
+xen, virtio
+
+=item Mandatory
+
+No
+
+=item Default value
+
+xen
+
 =back
 
+Besides forcing toolstack to use specific backend implementation, this also
+affects the guest's view of the device. For example, "virtio" requires
+Virtio frontend driver (virtio-blk) to be used. Please note, the virtual
+device (vdev) is not passed to the guest in that case, but it still must be
+specified for the internal purposes.
+
+=back
 
 =head1 COLO Parameters
 
diff --git a/tools/golang/xenlight/helpers.gen.go b/tools/golang/xenlight/helpers.gen.go
index 33fe03971f..fa3cf2ab76 100644
--- a/tools/golang/xenlight/helpers.gen.go
+++ b/tools/golang/xenlight/helpers.gen.go
@@ -1763,6 +1763,10 @@ x.DirectIoSafe = bool(xc.direct_io_safe)
 if err := x.DiscardEnable.fromC(&xc.discard_enable);err != nil {
 return fmt.Errorf("converting field DiscardEnable: %v", err)
 }
+x.Specification = DiskSpecification(xc.specification)
+x.Transport = DiskTransport(xc.transport)
+x.Irq = uint32(xc.irq)
+x.Base = uint64(xc.base)
 if err := x.ColoEnable.fromC(&xc.colo_enable);err != nil {
 return fmt.Errorf("converting field ColoEnable: %v", err)
 }
@@ -1803,6 +1807,10 @@ xc.direct_io_safe = C.bool(x.DirectIoSafe)
 if err := x.DiscardEnable.toC(&xc.discard_enable); err != nil {
 return fmt.Errorf("converting field DiscardEnable: %v", err)
 }
+xc.specification = C.libxl_disk_specification(x.Specification)
+xc.transport = C.libxl_disk_transport(x.Transport)
+xc.irq = C.uint32_t(x.Irq)
+xc.base = C.uint64_t(x.Base)
 if err := x.ColoEnable.toC(&xc.colo_enable); err != nil {
 return fmt.Errorf("converting field ColoEnable: %v", err)
 }
diff --git a/tools/golang/xenlight/types.gen.go b/tools/golang/xenlight/types.gen.go
index bb149547fd..a0be7ada8c 100644
--- a/tools/golang/xenlight/types.gen.go
+++ b/tools/golang/xenlight/types.gen.go
@@ -99,6 +99,20 @@ DiskBackendUnknown DiskBackend = 0
 DiskBackendPhy DiskBackend = 1
 DiskBackendTap DiskBackend = 2
 DiskBackendQdisk DiskBackend = 3
+DiskBackendStandalone DiskBackend = 4
+)
+
+type DiskSpecification int
+const(
+DiskSpecificationUnknown DiskSpecification = 0
+DiskSpecificationXen DiskSpecification = 1
+DiskSpecificationVirtio DiskSpecification = 2
+)
+
+type DiskTransport int
+const(
+DiskTransportUnknown DiskTransport = 0
+DiskTransportMmio DiskTransport = 1
 )
 
 type NicType int
@@ -645,6 +659,10 @@ Readwrite int
 IsCdrom int
 DirectIoSafe bool
 DiscardEnable Defbool
+Specification DiskSpecification
+Transport DiskTransport
+Irq uint32
+Base uint64
 ColoEnable Defbool
 ColoRestoreEnable Defbool
 ColoHost string
diff --git a/tools/include/libxl.h b/tools/include/libxl.h
index f351669039..2321a648a5 100644
--- a/tools/include/libxl.h
+++ b/tools/include/libxl.h
@@ -549,6 +549,13 @@
  */
 #define LIBXL_HAVE_ASSISTED_APIC 1
 
+/*
+ * LIBXL_HAVE_DEVICE_DISK_SPECIFICATION indicates that 'specification' and
+ * 'transport' fields (of libxl_disk_specification and libxl_disk_transport
+ * types respectively) are present in libxl_device_disk.
+ */
+#define LIBXL_HAVE_DEVICE_DISK_SPECIFICATION 1
+
 /*
  * libxl ABI compatibility
  *
diff --git a/tools/libs/light/libxl_device.c b/tools/libs/light/libxl_device.c
index e6025d135e..a75c21d433 100644
--- a/tools/libs/light/libxl_device.c
+++ b/tools/libs/light/libxl_device.c
@@ -289,9 +289,16 @@ static int disk_try_backend(disk_try_backend_args *a,
                             libxl_disk_backend backend)
  {
     libxl__gc *gc = a->gc;
+    libxl_disk_specification specification = a->disk->specification;
     /* returns 0 (ie, DISK_BACKEND_UNKNOWN) on failure, or
      * backend on success */
 
+    if ((specification == LIBXL_DISK_SPECIFICATION_VIRTIO &&
+         backend != LIBXL_DISK_BACKEND_STANDALONE) ||
+        (specification != LIBXL_DISK_SPECIFICATION_VIRTIO &&
+         backend == LIBXL_DISK_BACKEND_STANDALONE))
+        goto bad_specification;
+
     switch (backend) {
     case LIBXL_DISK_BACKEND_PHY:
         if (a->disk->format != LIBXL_DISK_FORMAT_RAW) {
@@ -329,6 +336,29 @@ static int disk_try_backend(disk_try_backend_args *a,
         if (a->disk->script) goto bad_script;
         return backend;
 
+    case LIBXL_DISK_BACKEND_STANDALONE:
+        if (a->disk->format != LIBXL_DISK_FORMAT_RAW)
+            goto bad_format;
+
+        if (a->disk->script)
+            goto bad_script;
+
+        if (libxl_defbool_val(a->disk->colo_enable))
+            goto bad_colo;
+
+        if (a->disk->backend_domid != LIBXL_TOOLSTACK_DOMID) {
+            LOG(DEBUG, "Disk vdev=%s, is using a storage driver domain, "
+                       "skipping physical device check", a->disk->vdev);
+            return backend;
+        }
+
+        if (libxl__try_phy_backend(a->stab.st_mode))
+            return backend;
+
+        LOG(DEBUG, "Disk vdev=%s, backend standalone unsuitable as phys path not a "
+                   "block device", a->disk->vdev);
+        return 0;
+
     default:
         LOG(DEBUG, "Disk vdev=%s, backend %d unknown", a->disk->vdev, backend);
         return 0;
@@ -352,6 +382,12 @@ static int disk_try_backend(disk_try_backend_args *a,
     LOG(DEBUG, "Disk vdev=%s, backend %s not compatible with colo",
         a->disk->vdev, libxl_disk_backend_to_string(backend));
     return 0;
+
+ bad_specification:
+    LOG(DEBUG, "Disk vdev=%s, backend %s not compatible with specification %s",
+        a->disk->vdev, libxl_disk_backend_to_string(backend),
+        libxl_disk_specification_to_string(specification));
+    return 0;
 }
 
 int libxl__backendpath_parse_domid(libxl__gc *gc, const char *be_path,
@@ -376,8 +412,9 @@ int libxl__device_disk_set_backend(libxl__gc *gc, libxl_device_disk *disk) {
     a.gc = gc;
     a.disk = disk;
 
-    LOG(DEBUG, "Disk vdev=%s spec.backend=%s", disk->vdev,
-               libxl_disk_backend_to_string(disk->backend));
+    LOG(DEBUG, "Disk vdev=%s spec.backend=%s specification=%s", disk->vdev,
+               libxl_disk_backend_to_string(disk->backend),
+               libxl_disk_specification_to_string(disk->specification));
 
     if (disk->format == LIBXL_DISK_FORMAT_EMPTY) {
         if (!disk->is_cdrom) {
@@ -392,7 +429,8 @@ int libxl__device_disk_set_backend(libxl__gc *gc, libxl_device_disk *disk) {
         }
         memset(&a.stab, 0, sizeof(a.stab));
     } else if ((disk->backend == LIBXL_DISK_BACKEND_UNKNOWN ||
-                disk->backend == LIBXL_DISK_BACKEND_PHY) &&
+                disk->backend == LIBXL_DISK_BACKEND_PHY ||
+                disk->backend == LIBXL_DISK_BACKEND_STANDALONE) &&
                disk->backend_domid == LIBXL_TOOLSTACK_DOMID &&
                !disk->script) {
         if (stat(disk->pdev_path, &a.stab)) {
@@ -408,7 +446,8 @@ int libxl__device_disk_set_backend(libxl__gc *gc, libxl_device_disk *disk) {
         ok=
             disk_try_backend(&a, LIBXL_DISK_BACKEND_PHY) ?:
             disk_try_backend(&a, LIBXL_DISK_BACKEND_QDISK) ?:
-            disk_try_backend(&a, LIBXL_DISK_BACKEND_TAP);
+            disk_try_backend(&a, LIBXL_DISK_BACKEND_TAP) ?:
+            disk_try_backend(&a, LIBXL_DISK_BACKEND_STANDALONE);
         if (ok)
             LOG(DEBUG, "Disk vdev=%s, using backend %s",
                        disk->vdev,
@@ -441,10 +480,25 @@ char *libxl__device_disk_string_of_backend(libxl_disk_backend backend)
         case LIBXL_DISK_BACKEND_QDISK: return "qdisk";
         case LIBXL_DISK_BACKEND_TAP: return "phy";
         case LIBXL_DISK_BACKEND_PHY: return "phy";
+        case LIBXL_DISK_BACKEND_STANDALONE: return "standalone";
+        default: return NULL;
+    }
+}
+
+char *libxl__device_disk_string_of_specification(libxl_disk_specification specification)
+{
+    switch (specification) {
+        case LIBXL_DISK_SPECIFICATION_XEN: return "xen";
+        case LIBXL_DISK_SPECIFICATION_VIRTIO: return "virtio";
         default: return NULL;
     }
 }
 
+char *libxl__device_disk_string_of_transport(libxl_disk_transport transport)
+{
+    return (transport == LIBXL_DISK_TRANSPORT_MMIO ? "mmio" : NULL);
+}
+
 const char *libxl__qemu_disk_format_string(libxl_disk_format format)
 {
     switch (format) {
diff --git a/tools/libs/light/libxl_disk.c b/tools/libs/light/libxl_disk.c
index 9da2b2ed27..ea3623dd6f 100644
--- a/tools/libs/light/libxl_disk.c
+++ b/tools/libs/light/libxl_disk.c
@@ -164,6 +164,30 @@ static int libxl__device_disk_setdefault(libxl__gc *gc, uint32_t domid,
     rc = libxl__resolve_domid(gc, disk->backend_domname, &disk->backend_domid);
     if (rc < 0) return rc;
 
+    if (disk->specification == LIBXL_DISK_SPECIFICATION_UNKNOWN)
+        disk->specification = LIBXL_DISK_SPECIFICATION_XEN;
+
+    if (disk->specification == LIBXL_DISK_SPECIFICATION_XEN &&
+        disk->transport != LIBXL_DISK_TRANSPORT_UNKNOWN) {
+        LOGD(ERROR, domid, "Transport is only supported for specification virtio");
+        return ERROR_INVAL;
+    }
+
+    /* Force transport mmio for specification virtio for now */
+    if (disk->specification == LIBXL_DISK_SPECIFICATION_VIRTIO) {
+        if (!(disk->transport == LIBXL_DISK_TRANSPORT_UNKNOWN ||
+              disk->transport == LIBXL_DISK_TRANSPORT_MMIO)) {
+            LOGD(ERROR, domid, "Unsupported transport for specification virtio");
+            return ERROR_INVAL;
+        }
+        disk->transport = LIBXL_DISK_TRANSPORT_MMIO;
+    }
+
+    if (hotplug && disk->specification == LIBXL_DISK_SPECIFICATION_VIRTIO) {
+        LOGD(ERROR, domid, "Hotplug isn't supported for specification virtio");
+        return ERROR_FAIL;
+    }
+
     /* Force Qdisk backend for CDROM devices of guests with a device model. */
     if (disk->is_cdrom != 0 &&
         libxl__domain_type(gc, domid) == LIBXL_DOMAIN_TYPE_HVM) {
@@ -205,6 +229,9 @@ static int libxl__device_from_disk(libxl__gc *gc, uint32_t domid,
         case LIBXL_DISK_BACKEND_QDISK:
             device->backend_kind = LIBXL__DEVICE_KIND_QDISK;
             break;
+        case LIBXL_DISK_BACKEND_STANDALONE:
+            device->backend_kind = LIBXL__DEVICE_KIND_VIRTIO_DISK;
+            break;
         default:
             LOGD(ERROR, domid, "Unrecognized disk backend type: %d",
                  disk->backend);
@@ -213,7 +240,8 @@ static int libxl__device_from_disk(libxl__gc *gc, uint32_t domid,
 
     device->domid = domid;
     device->devid = devid;
-    device->kind  = LIBXL__DEVICE_KIND_VBD;
+    device->kind = disk->backend == LIBXL_DISK_BACKEND_STANDALONE ?
+        LIBXL__DEVICE_KIND_VIRTIO_DISK : LIBXL__DEVICE_KIND_VBD;
 
     return 0;
 }
@@ -331,7 +359,14 @@ static void device_disk_add(libxl__egc *egc, uint32_t domid,
 
                 assert(device->backend_kind == LIBXL__DEVICE_KIND_VBD);
                 break;
+            case LIBXL_DISK_BACKEND_STANDALONE:
+                dev = disk->pdev_path;
+
+                flexarray_append(back, "params");
+                flexarray_append(back, dev);
 
+                assert(device->backend_kind == LIBXL__DEVICE_KIND_VIRTIO_DISK);
+                break;
             case LIBXL_DISK_BACKEND_TAP:
                 LOG(ERROR, "blktap is not supported");
                 rc = ERROR_FAIL;
@@ -387,6 +422,14 @@ static void device_disk_add(libxl__egc *egc, uint32_t domid,
         flexarray_append_pair(back, "discard-enable",
                               libxl_defbool_val(disk->discard_enable) ?
                               "1" : "0");
+        flexarray_append(back, "specification");
+        flexarray_append(back, libxl__device_disk_string_of_specification(disk->specification));
+        if (disk->specification == LIBXL_DISK_SPECIFICATION_VIRTIO) {
+            flexarray_append(back, "transport");
+            flexarray_append(back, libxl__device_disk_string_of_transport(disk->transport));
+            flexarray_append_pair(back, "base", GCSPRINTF("%"PRIu64, disk->base));
+            flexarray_append_pair(back, "irq", GCSPRINTF("%u", disk->irq));
+        }
 
         flexarray_append(front, "backend-id");
         flexarray_append(front, GCSPRINTF("%d", disk->backend_domid));
@@ -535,6 +578,53 @@ static int libxl__disk_from_xenstore(libxl__gc *gc, const char *libxl_path,
     }
     libxl_string_to_backend(ctx, tmp, &(disk->backend));
 
+    tmp = libxl__xs_read(gc, XBT_NULL,
+                         GCSPRINTF("%s/specification", libxl_path));
+    if (!tmp) {
+        LOG(DEBUG, "Missing xenstore node %s/specification, assuming specification xen", libxl_path);
+        disk->specification = LIBXL_DISK_SPECIFICATION_XEN;
+    } else {
+        rc = libxl_disk_specification_from_string(tmp, &disk->specification);
+        if (rc) {
+            LOG(ERROR, "Unable to parse xenstore node %s/specification", libxl_path);
+            goto cleanup;
+        }
+    }
+
+    if (disk->specification == LIBXL_DISK_SPECIFICATION_VIRTIO) {
+        tmp = libxl__xs_read(gc, XBT_NULL,
+                             GCSPRINTF("%s/transport", libxl_path));
+        if (!tmp) {
+            LOG(ERROR, "Missing xenstore node %s/transport", libxl_path);
+            goto cleanup;
+        }
+        rc = libxl_disk_transport_from_string(tmp, &disk->transport);
+        if (rc) {
+            LOG(ERROR, "Unable to parse xenstore node %s/transport", libxl_path);
+            goto cleanup;
+        }
+        if (disk->transport != LIBXL_DISK_TRANSPORT_MMIO) {
+            LOG(ERROR, "Only transport mmio is expected for specification virtio");
+            goto cleanup;
+        }
+
+        tmp = libxl__xs_read(gc, XBT_NULL,
+                             GCSPRINTF("%s/base", libxl_path));
+        if (!tmp) {
+            LOG(ERROR, "Missing xenstore node %s/base", libxl_path);
+            goto cleanup;
+        }
+        disk->base = strtoul(tmp, NULL, 10);
+
+        tmp = libxl__xs_read(gc, XBT_NULL,
+                             GCSPRINTF("%s/irq", libxl_path));
+        if (!tmp) {
+            LOG(ERROR, "Missing xenstore node %s/irq", libxl_path);
+            goto cleanup;
+        }
+        disk->irq = strtoul(tmp, NULL, 10);
+    }
+
     disk->vdev = xs_read(ctx->xsh, XBT_NULL,
                          GCSPRINTF("%s/dev", libxl_path), &len);
     if (!disk->vdev) {
@@ -578,6 +668,42 @@ cleanup:
     return rc;
 }
 
+static int libxl__device_disk_get_path(libxl__gc *gc, uint32_t domid,
+                                       char **path)
+{
+    const char *xen_dir, *virtio_dir;
+    char *xen_path, *virtio_path;
+    int rc;
+
+    /* default path */
+    xen_path = GCSPRINTF("%s/device/%s",
+                         libxl__xs_libxl_path(gc, domid),
+                         libxl__device_kind_to_string(LIBXL__DEVICE_KIND_VBD));
+
+    rc = libxl__xs_read_checked(gc, XBT_NULL, xen_path, &xen_dir);
+    if (rc)
+        return rc;
+
+    virtio_path = GCSPRINTF("%s/device/%s",
+                            libxl__xs_libxl_path(gc, domid),
+                            libxl__device_kind_to_string(LIBXL__DEVICE_KIND_VIRTIO_DISK));
+
+    rc = libxl__xs_read_checked(gc, XBT_NULL, virtio_path, &virtio_dir);
+    if (rc)
+        return rc;
+
+    if (xen_dir && virtio_dir) {
+        LOGD(ERROR, domid, "Invalid configuration, both xen and virtio paths are present");
+        return ERROR_INVAL;
+    } else if (virtio_dir) {
+        *path = virtio_path;
+    } else {
+        *path = xen_path;
+    }
+
+    return 0;
+}
+
 int libxl_vdev_to_device_disk(libxl_ctx *ctx, uint32_t domid,
                               const char *vdev, libxl_device_disk *disk)
 {
@@ -591,10 +717,12 @@ int libxl_vdev_to_device_disk(libxl_ctx *ctx, uint32_t domid,
 
     libxl_device_disk_init(disk);
 
-    libxl_path = libxl__domain_device_libxl_path(gc, domid, devid,
-                                                 LIBXL__DEVICE_KIND_VBD);
+    rc = libxl__device_disk_get_path(gc, domid, &libxl_path);
+    if (rc)
+        return rc;
 
-    rc = libxl__disk_from_xenstore(gc, libxl_path, devid, disk);
+    rc = libxl__disk_from_xenstore(gc, GCSPRINTF("%s/%d", libxl_path, devid),
+                                   devid, disk);
 
     GC_FREE;
     return rc;
@@ -608,16 +736,19 @@ int libxl_device_disk_getinfo(libxl_ctx *ctx, uint32_t domid,
     char *fe_path, *libxl_path;
     char *val;
     int rc;
+    libxl__device_kind kind;
 
     diskinfo->backend = NULL;
 
     diskinfo->devid = libxl__device_disk_dev_number(disk->vdev, NULL, NULL);
 
-    /* tap devices entries in xenstore are written as vbd devices. */
+    /* tap devices entries in xenstore are written as vbd/virtio_disk devices. */
+    kind = disk->backend == LIBXL_DISK_BACKEND_STANDALONE ?
+        LIBXL__DEVICE_KIND_VIRTIO_DISK : LIBXL__DEVICE_KIND_VBD;
     fe_path = libxl__domain_device_frontend_path(gc, domid, diskinfo->devid,
-                                                 LIBXL__DEVICE_KIND_VBD);
+                                                 kind);
     libxl_path = libxl__domain_device_libxl_path(gc, domid, diskinfo->devid,
-                                                 LIBXL__DEVICE_KIND_VBD);
+                                                 kind);
     diskinfo->backend = xs_read(ctx->xsh, XBT_NULL,
                                 GCSPRINTF("%s/backend", libxl_path), NULL);
     if (!diskinfo->backend) {
@@ -1421,6 +1552,7 @@ LIBXL_DEFINE_DEVICE_LIST(disk)
 #define libxl__device_disk_update_devid NULL
 
 DEFINE_DEVICE_TYPE_STRUCT(disk, VBD, disks,
+    .get_path    = libxl__device_disk_get_path,
     .merge       = libxl_device_disk_merge,
     .dm_needed   = libxl_device_disk_dm_needed,
     .from_xenstore = (device_from_xenstore_fn_t)libxl__disk_from_xenstore,
diff --git a/tools/libs/light/libxl_internal.h b/tools/libs/light/libxl_internal.h
index bdef5a605e..cb9e8b3b8b 100644
--- a/tools/libs/light/libxl_internal.h
+++ b/tools/libs/light/libxl_internal.h
@@ -1493,6 +1493,8 @@ _hidden char * libxl__domain_pvcontrol_read(libxl__gc *gc,
 
 /* from xl_device */
 _hidden char *libxl__device_disk_string_of_backend(libxl_disk_backend backend);
+_hidden char *libxl__device_disk_string_of_specification(libxl_disk_specification specification);
+_hidden char *libxl__device_disk_string_of_transport(libxl_disk_transport transport);
 _hidden char *libxl__device_disk_string_of_format(libxl_disk_format format);
 _hidden const char *libxl__qemu_disk_format_string(libxl_disk_format format);
 _hidden int libxl__device_disk_set_backend(libxl__gc*, libxl_device_disk*);
diff --git a/tools/libs/light/libxl_types.idl b/tools/libs/light/libxl_types.idl
index f3ceb38c9e..d634f304cd 100644
--- a/tools/libs/light/libxl_types.idl
+++ b/tools/libs/light/libxl_types.idl
@@ -130,6 +130,18 @@ libxl_disk_backend = Enumeration("disk_backend", [
     (1, "PHY"),
     (2, "TAP"),
     (3, "QDISK"),
+    (4, "STANDALONE"), # Only relying on the Xenstore data
+    ])
+
+libxl_disk_specification = Enumeration("disk_specification", [
+    (0, "UNKNOWN"),
+    (1, "XEN"),
+    (2, "VIRTIO"),
+    ])
+
+libxl_disk_transport = Enumeration("disk_transport", [
+    (0, "UNKNOWN"),
+    (1, "MMIO"),
     ])
 
 libxl_nic_type = Enumeration("nic_type", [
@@ -706,6 +718,12 @@ libxl_device_disk = Struct("device_disk", [
     ("is_cdrom", integer),
     ("direct_io_safe", bool),
     ("discard_enable", libxl_defbool),
+    ("specification", libxl_disk_specification),
+    ("transport", libxl_disk_transport),
+    # Note that virtio-mmio parameters (irq and base) are for internal use
+    # by libxl and can't be modified.
+    ("irq", uint32),
+    ("base", uint64),
     # Note that the COLO configuration settings should be considered unstable.
     # They may change incompatibly in future versions of Xen.
     ("colo_enable", libxl_defbool),
diff --git a/tools/libs/light/libxl_types_internal.idl b/tools/libs/light/libxl_types_internal.idl
index 3593e21dbb..8f71980aec 100644
--- a/tools/libs/light/libxl_types_internal.idl
+++ b/tools/libs/light/libxl_types_internal.idl
@@ -32,6 +32,7 @@ libxl__device_kind = Enumeration("device_kind", [
     (14, "PVCALLS"),
     (15, "VSND"),
     (16, "VINPUT"),
+    (17, "VIRTIO_DISK"),
     ])
 
 libxl__console_backend = Enumeration("console_backend", [
diff --git a/tools/libs/light/libxl_utils.c b/tools/libs/light/libxl_utils.c
index e5e6b2da96..e403bd9bcf 100644
--- a/tools/libs/light/libxl_utils.c
+++ b/tools/libs/light/libxl_utils.c
@@ -297,6 +297,8 @@ int libxl_string_to_backend(libxl_ctx *ctx, char *s, libxl_disk_backend *backend
         *backend = LIBXL_DISK_BACKEND_TAP;
     } else if (!strcmp(s, "qdisk")) {
         *backend = LIBXL_DISK_BACKEND_QDISK;
+    } else if (!strcmp(s, "standalone")) {
+        *backend = LIBXL_DISK_BACKEND_STANDALONE;
     } else if (!strcmp(s, "tap")) {
         p = strchr(s, ':');
         if (!p) {
diff --git a/tools/libs/util/libxlu_disk_l.c b/tools/libs/util/libxlu_disk_l.c
index 32d4b74b58..0b59723b71 100644
--- a/tools/libs/util/libxlu_disk_l.c
+++ b/tools/libs/util/libxlu_disk_l.c
@@ -549,8 +549,8 @@ static void yynoreturn yy_fatal_error ( const 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 36
-#define YY_END_OF_BUFFER 37
+#define YY_NUM_RULES 37
+#define YY_END_OF_BUFFER 38
 /* This struct is not used in this scanner,
    but its presence is necessary. */
 struct yy_trans_info
@@ -558,74 +558,77 @@ struct yy_trans_info
 	flex_int32_t yy_verify;
 	flex_int32_t yy_nxt;
 	};
-static const flex_int16_t yy_acclist[575] =
+static const flex_int16_t yy_acclist[594] =
     {   0,
-       35,   35,   37,   33,   34,   36, 8193,   33,   34,   36,
-    16385, 8193,   33,   36,16385,   33,   34,   36,   34,   36,
-       33,   34,   36,   33,   34,   36,   33,   34,   36,   33,
-       34,   36,   33,   34,   36,   33,   34,   36,   33,   34,
-       36,   33,   34,   36,   33,   34,   36,   33,   34,   36,
-       33,   34,   36,   33,   34,   36,   33,   34,   36,   33,
-       34,   36,   33,   34,   36,   33,   34,   36,   35,   36,
-       36,   33,   33, 8193,   33, 8193,   33,16385, 8193,   33,
-     8193,   33,   33, 8224,   33,16416,   33,   33,   33,   33,
-       33,   33,   33,   33,   33,   33,   33,   33,   33,   33,
-
-       33,   33,   33,   33,   33,   33,   33,   33,   33,   35,
-     8193,   33, 8193,   33, 8193, 8224,   33, 8224,   33, 8224,
-       23,   33,   33,   33,   33,   33,   33,   33,   33,   33,
-       33,   33,   33,   33,   33,   33,   33,   33,   33,   33,
-       33,   33,   33,   33,   33, 8224,   33, 8224,   33, 8224,
-       23,   33,   33,   28, 8224,   33,16416,   33,   33,   15,
-       33,   33,   33,   33,   33,   33,   33,   33,   33, 8217,
-     8224,   33,16409,16416,   33,   33,   31, 8224,   33,16416,
-       33, 8216, 8224,   33,16408,16416,   33,   33, 8219, 8224,
-       33,16411,16416,   33,   33,   33,   33,   33,   28, 8224,
-
-       33,   28, 8224,   33,   28,   33,   28, 8224,   33,    3,
-       33,   15,   33,   33,   33,   33,   33,   30, 8224,   33,
-    16416,   33,   33,   33, 8217, 8224,   33, 8217, 8224,   33,
-     8217,   33, 8217, 8224,   33,   33,   31, 8224,   33,   31,
-     8224,   33,   31,   33,   31, 8224, 8216, 8224,   33, 8216,
-     8224,   33, 8216,   33, 8216, 8224,   33, 8219, 8224,   33,
-     8219, 8224,   33, 8219,   33, 8219, 8224,   33,   33,   10,
-       33,   33,   28, 8224,   33,   28, 8224,   33,   28, 8224,
-       28,   33,   28,   33,    3,   33,   33,   33,   33,   33,
-       33,   33,   30, 8224,   33,   30, 8224,   33,   30,   33,
-
-       30, 8224,   33,   33,   29, 8224,   33,16416, 8217, 8224,
-       33, 8217, 8224,   33, 8217, 8224, 8217,   33, 8217,   33,
-       33,   31, 8224,   33,   31, 8224,   33,   31, 8224,   31,
-       33,   31, 8216, 8224,   33, 8216, 8224,   33, 8216, 8224,
-     8216,   33, 8216,   33, 8219, 8224,   33, 8219, 8224,   33,
-     8219, 8224, 8219,   33, 8219,   33,   33,   10,   23,   10,
-        7,   33,   33,   33,   33,   33,   33,   33,   13,   33,
-       30, 8224,   33,   30, 8224,   33,   30, 8224,   30,   33,
-       30,    2,   33,   29, 8224,   33,   29, 8224,   33,   29,
-       33,   29, 8224,   16,   33,   33,   11,   33,   22,   10,
-
-       10,   23,    7,   23,    7,   33,    8,   33,   33,   33,
-       33,    6,   33,   13,   33,    2,   23,    2,   33,   29,
-     8224,   33,   29, 8224,   33,   29, 8224,   29,   33,   29,
-       16,   33,   33,   11,   23,   11,   26, 8224,   33,16416,
-       22,   23,   22,    7,    7,   23,   33,    8,   23,    8,
-       33,   33,   33,   33,    6,   23,    6,    6,   23,    6,
-       23,   33,    2,    2,   23,   33,   33,   11,   11,   23,
-       26, 8224,   33,   26, 8224,   33,   26,   33,   26, 8224,
-       22,   23,   33,    8,    8,   23,   33,   33,   17,   18,
-        6,    6,   23,    6,    6,   33,   33,   14,   33,   26,
-
-     8224,   33,   26, 8224,   33,   26, 8224,   26,   33,   26,
-       33,   33,   33,   17,   23,   17,   18,   23,   18,    6,
-        6,   33,   33,   14,   33,   20,    9,   19,   17,   17,
-       23,   18,   18,   23,    6,    5,    6,   33,   21,   20,
-       23,   20,    9,   23,    9,   19,   23,   19,    4,    6,
-        5,    6,   33,   21,   23,   21,   20,   20,   23,    9,
-        9,   23,   19,   19,   23,    4,    6,   12,   33,   21,
-       21,   23,   12,   33
+       36,   36,   38,   34,   35,   37, 8193,   34,   35,   37,
+    16385, 8193,   34,   37,16385,   34,   35,   37,   35,   37,
+       34,   35,   37,   34,   35,   37,   34,   35,   37,   34,
+       35,   37,   34,   35,   37,   34,   35,   37,   34,   35,
+       37,   34,   35,   37,   34,   35,   37,   34,   35,   37,
+       34,   35,   37,   34,   35,   37,   34,   35,   37,   34,
+       35,   37,   34,   35,   37,   34,   35,   37,   36,   37,
+       37,   34,   34, 8193,   34, 8193,   34,16385, 8193,   34,
+     8193,   34,   34, 8225,   34,16417,   34,   34,   34,   34,
+       34,   34,   34,   34,   34,   34,   34,   34,   34,   34,
+
+       34,   34,   34,   34,   34,   34,   34,   34,   34,   34,
+       36, 8193,   34, 8193,   34, 8193, 8225,   34, 8225,   34,
+     8225,   24,   34,   34,   34,   34,   34,   34,   34,   34,
+       34,   34,   34,   34,   34,   34,   34,   34,   34,   34,
+       34,   34,   34,   34,   34,   34,   34, 8225,   34, 8225,
+       34, 8225,   24,   34,   34,   29, 8225,   34,16417,   34,
+       34,   16,   34,   34,   34,   34,   34,   34,   34,   34,
+       34, 8218, 8225,   34,16410,16417,   34,   34,   32, 8225,
+       34,16417,   34, 8217, 8225,   34,16409,16417,   34,   34,
+       34, 8220, 8225,   34,16412,16417,   34,   34,   34,   34,
+
+       34,   29, 8225,   34,   29, 8225,   34,   29,   34,   29,
+     8225,   34,    3,   34,   16,   34,   34,   34,   34,   34,
+       31, 8225,   34,16417,   34,   34,   34, 8218, 8225,   34,
+     8218, 8225,   34, 8218,   34, 8218, 8225,   34,   34,   32,
+     8225,   34,   32, 8225,   34,   32,   34,   32, 8225, 8217,
+     8225,   34, 8217, 8225,   34, 8217,   34, 8217, 8225,   34,
+       34, 8220, 8225,   34, 8220, 8225,   34, 8220,   34, 8220,
+     8225,   34,   34,   11,   34,   34,   29, 8225,   34,   29,
+     8225,   34,   29, 8225,   29,   34,   29,   34,    3,   34,
+       34,   34,   34,   34,   34,   34,   31, 8225,   34,   31,
+
+     8225,   34,   31,   34,   31, 8225,   34,   34,   30, 8225,
+       34,16417, 8218, 8225,   34, 8218, 8225,   34, 8218, 8225,
+     8218,   34, 8218,   34,   34,   32, 8225,   34,   32, 8225,
+       34,   32, 8225,   32,   34,   32, 8217, 8225,   34, 8217,
+     8225,   34, 8217, 8225, 8217,   34, 8217,   34,   34, 8220,
+     8225,   34, 8220, 8225,   34, 8220, 8225, 8220,   34, 8220,
+       34,   34,   11,   24,   11,    7,   34,   34,   34,   34,
+       34,   34,   34,   14,   34,   31, 8225,   34,   31, 8225,
+       34,   31, 8225,   31,   34,   31,    2,   34,   30, 8225,
+       34,   30, 8225,   34,   30,   34,   30, 8225,   17,   34,
+
+       34,   12,   34,   34,   23,   11,   11,   24,    7,   24,
+        7,   34,    8,   34,   34,   34,   34,    6,   34,   14,
+       34,    2,   24,    2,   34,   30, 8225,   34,   30, 8225,
+       34,   30, 8225,   30,   34,   30,   17,   34,   34,   12,
+       24,   12,   34,   27, 8225,   34,16417,   23,   24,   23,
+        7,    7,   24,   34,    8,   24,    8,   34,   34,   34,
+       34,    6,   24,    6,    6,   24,    6,   24,   34,    2,
+        2,   24,   34,   34,   12,   12,   24,   34,   27, 8225,
+       34,   27, 8225,   34,   27,   34,   27, 8225,   23,   24,
+       34,    8,    8,   24,   34,   34,   18,   19,    6,    6,
+
+       24,    6,    6,   34,   34,   15,   34,   34,   27, 8225,
+       34,   27, 8225,   34,   27, 8225,   27,   34,   27,   34,
+       34,   34,   18,   24,   18,   19,   24,   19,    6,    6,
+       34,   34,   15,   34,   34,   21,    9,   20,   18,   18,
+       24,   19,   19,   24,    6,    5,    6,   34,   22,   34,
+       21,   24,   21,    9,   24,    9,   20,   24,   20,    4,
+        6,    5,    6,   34,   22,   24,   22,   34,   21,   21,
+       24,    9,    9,   24,   20,   20,   24,    4,    6,   13,
+       34,   22,   22,   24,   10,   13,   34,   10,   24,   10,
+       10,   10,   24
+
     } ;
 
-static const flex_int16_t yy_accept[356] =
+static const flex_int16_t yy_accept[373] =
     {   0,
         1,    1,    1,    2,    3,    4,    7,   12,   16,   19,
        21,   24,   27,   30,   33,   36,   39,   42,   45,   48,
@@ -633,39 +636,41 @@ static const flex_int16_t yy_accept[356] =
        74,   76,   79,   81,   82,   83,   84,   87,   87,   88,
        89,   90,   91,   92,   93,   94,   95,   96,   97,   98,
        99,  100,  101,  102,  103,  104,  105,  106,  107,  108,
-      109,  110,  111,  113,  115,  116,  118,  120,  121,  122,
+      109,  110,  111,  112,  114,  116,  117,  119,  121,  122,
       123,  124,  125,  126,  127,  128,  129,  130,  131,  132,
       133,  134,  135,  136,  137,  138,  139,  140,  141,  142,
-      143,  144,  145,  146,  148,  150,  151,  152,  153,  154,
-
-      158,  159,  160,  162,  163,  164,  165,  166,  167,  168,
-      169,  170,  175,  176,  177,  181,  182,  187,  188,  189,
-      194,  195,  196,  197,  198,  199,  202,  205,  207,  209,
-      210,  212,  214,  215,  216,  217,  218,  222,  223,  224,
-      225,  228,  231,  233,  235,  236,  237,  240,  243,  245,
-      247,  250,  253,  255,  257,  258,  261,  264,  266,  268,
-      269,  270,  271,  272,  273,  276,  279,  281,  283,  284,
-      285,  287,  288,  289,  290,  291,  292,  293,  296,  299,
-      301,  303,  304,  305,  309,  312,  315,  317,  319,  320,
-      321,  322,  325,  328,  330,  332,  333,  336,  339,  341,
-
-      343,  344,  345,  348,  351,  353,  355,  356,  357,  358,
-      360,  361,  362,  363,  364,  365,  366,  367,  368,  369,
-      371,  374,  377,  379,  381,  382,  383,  384,  387,  390,
-      392,  394,  396,  397,  398,  399,  400,  401,  403,  405,
-      406,  407,  408,  409,  410,  411,  412,  413,  414,  416,
-      418,  419,  420,  423,  426,  428,  430,  431,  433,  434,
-      436,  437,  441,  443,  444,  445,  447,  448,  450,  451,
-      452,  453,  454,  455,  457,  458,  460,  462,  463,  464,
-      466,  467,  468,  469,  471,  474,  477,  479,  481,  483,
-      484,  485,  487,  488,  489,  490,  491,  492,  494,  495,
-
-      496,  497,  498,  500,  503,  506,  508,  510,  511,  512,
-      513,  514,  516,  517,  519,  520,  521,  522,  523,  524,
-      526,  527,  528,  529,  530,  532,  533,  535,  536,  538,
-      539,  540,  542,  543,  545,  546,  548,  549,  551,  553,
-      554,  556,  557,  558,  560,  561,  563,  564,  566,  568,
-      570,  571,  573,  575,  575
+      143,  144,  145,  146,  147,  148,  150,  152,  153,  154,
+
+      155,  156,  160,  161,  162,  164,  165,  166,  167,  168,
+      169,  170,  171,  172,  177,  178,  179,  183,  184,  189,
+      190,  191,  192,  197,  198,  199,  200,  201,  202,  205,
+      208,  210,  212,  213,  215,  217,  218,  219,  220,  221,
+      225,  226,  227,  228,  231,  234,  236,  238,  239,  240,
+      243,  246,  248,  250,  253,  256,  258,  260,  261,  262,
+      265,  268,  270,  272,  273,  274,  275,  276,  277,  280,
+      283,  285,  287,  288,  289,  291,  292,  293,  294,  295,
+      296,  297,  300,  303,  305,  307,  308,  309,  313,  316,
+      319,  321,  323,  324,  325,  326,  329,  332,  334,  336,
+
+      337,  340,  343,  345,  347,  348,  349,  350,  353,  356,
+      358,  360,  361,  362,  363,  365,  366,  367,  368,  369,
+      370,  371,  372,  373,  374,  376,  379,  382,  384,  386,
+      387,  388,  389,  392,  395,  397,  399,  401,  402,  403,
+      404,  405,  406,  407,  409,  411,  412,  413,  414,  415,
+      416,  417,  418,  419,  420,  422,  424,  425,  426,  429,
+      432,  434,  436,  437,  439,  440,  442,  443,  444,  448,
+      450,  451,  452,  454,  455,  457,  458,  459,  460,  461,
+      462,  464,  465,  467,  469,  470,  471,  473,  474,  475,
+      476,  478,  479,  482,  485,  487,  489,  491,  492,  493,
+
+      495,  496,  497,  498,  499,  500,  502,  503,  504,  505,
+      506,  508,  509,  512,  515,  517,  519,  520,  521,  522,
+      523,  525,  526,  528,  529,  530,  531,  532,  533,  535,
+      536,  537,  538,  539,  540,  542,  543,  545,  546,  548,
+      549,  550,  551,  553,  554,  556,  557,  559,  560,  562,
+      564,  565,  567,  568,  569,  570,  572,  573,  575,  576,
+      578,  580,  582,  583,  585,  586,  588,  590,  591,  592,
+      594,  594
     } ;
 
 static const YY_CHAR yy_ec[256] =
@@ -708,216 +713,224 @@ static const YY_CHAR yy_meta[35] =
         1,    1,    1,    1
     } ;
 
-static const flex_int16_t yy_base[424] =
+static const flex_int16_t yy_base[443] =
     {   0,
-        0,    0,  901,  900,  902,  897,   33,   36,  905,  905,
-       45,   63,   31,   42,   51,   52,  890,   33,   65,   67,
-       69,   70,  889,   71,  888,   75,    0,  905,  893,  905,
-       91,   94,    0,    0,  103,  886,  112,    0,   89,   98,
-      113,   92,  114,   99,  100,   48,  121,  116,  119,   74,
-      124,  129,  123,  135,  132,  133,  137,  134,  138,  139,
-      141,    0,  155,    0,    0,  164,    0,    0,  849,  142,
-      152,  164,  140,  161,  165,  166,  167,  168,  169,  173,
-      174,  178,  176,  180,  184,  208,  189,  183,  192,  195,
-      215,  191,  193,  223,    0,    0,  905,  208,  204,  236,
-
-      219,  209,  238,  196,  237,  831,  242,  815,  241,  224,
-      243,  261,  244,  259,  277,  266,  286,  250,  288,  298,
-      249,  283,  274,  282,  294,  308,    0,  310,    0,  295,
-      305,  905,  308,  306,  313,  314,  342,  319,  316,  320,
-      331,    0,  349,    0,  342,  344,  356,    0,  358,    0,
-      365,    0,  367,    0,  354,  375,    0,  377,    0,  363,
-      356,  809,  327,  322,  384,    0,    0,    0,    0,  379,
-      905,  382,  384,  386,  390,  372,  392,  403,    0,  410,
-        0,  407,  413,  423,  426,    0,    0,    0,    0,  409,
-      424,  435,    0,    0,    0,    0,  437,    0,    0,    0,
-
-        0,  433,  444,    0,    0,    0,    0,  391,  440,  781,
-      905,  769,  439,  445,  444,  447,  449,  454,  453,  399,
-      464,    0,    0,    0,    0,  757,  465,  476,    0,  478,
-        0,  479,  476,  753,  462,  490,  749,  905,  745,  905,
-      483,  737,  424,  485,  487,  490,  500,  493,  905,  729,
-      905,  502,  518,    0,    0,    0,    0,  905,  498,  721,
-      905,  527,  713,    0,  705,  905,  495,  697,  905,  365,
-      521,  528,  530,  685,  905,  534,  540,  540,  657,  905,
-      537,  542,  650,  905,  553,    0,  557,    0,    0,  551,
-      641,  905,  558,  557,  633,  614,  613,  905,  547,  555,
-
-      563,  565,  569,  584,    0,    0,    0,    0,  583,  570,
-      585,  612,  905,  601,  905,  522,  580,  589,  594,  905,
-      600,  585,  563,  520,  905,  514,  905,  586,  486,  597,
-      480,  441,  905,  416,  905,  345,  905,  334,  905,  601,
-      254,  905,  242,  905,  200,  905,  151,  905,  905,  607,
-       86,  905,  905,  905,  620,  624,  627,  631,  635,  639,
-      643,  647,  651,  655,  659,  663,  667,  671,  675,  679,
-      683,  687,  691,  695,  699,  703,  707,  711,  715,  719,
-      723,  727,  731,  735,  739,  743,  747,  751,  755,  759,
-      763,  767,  771,  775,  779,  783,  787,  791,  795,  799,
-
-      803,  807,  811,  815,  819,  823,  827,  831,  835,  839,
-      843,  847,  851,  855,  859,  863,  867,  871,  875,  879,
-      883,  887,  891
+        0,    0,  936,  935,  937,  932,   33,   36,  940,  940,
+       45,   63,   31,   42,   51,   52,  925,   33,   65,   67,
+       69,   70,  924,   71,  923,   75,    0,  940,  928,  940,
+       91,   95,    0,    0,  104,  921,  113,    0,   91,   99,
+      114,   92,  115,   80,  100,   48,  119,  121,  122,   74,
+      123,  128,  131,  129,  125,  133,  135,  136,  137,  143,
+      138,  145,    0,  157,    0,    0,  168,    0,    0,  926,
+      140,  146,  165,  159,  152,  164,  155,  168,  171,  176,
+      177,  170,  180,  175,  184,  188,  212,  191,  185,  192,
+      193,  194,  219,  212,  199,  230,    0,    0,  940,  195,
+
+      200,  239,  235,  197,  246,  225,  226,  919,  244,  918,
+      243,  236,  245,  266,  248,  264,  282,  271,  291,  248,
+      270,  254,  300,  279,  296,  302,  288,  303,  311,    0,
+      315,    0,  311,  318,  940,  313,  319,  208,  313,  344,
+      321,  331,  325,  333,    0,  352,    0,  345,  347,  359,
+        0,  361,    0,  368,    0,  370,    0,  322,  366,  379,
+        0,  381,    0,  359,  357,  923,  382,  384,  392,    0,
+        0,    0,    0,  387,  940,  386,  390,  392,  329,  401,
+      397,  409,    0,  417,    0,  399,  412,  426,  429,    0,
+        0,    0,    0,  412,  427,  438,    0,    0,    0,    0,
+
+      440,    0,    0,    0,    0,  436,  405,  447,    0,    0,
+        0,    0,  438,  443,  922,  940,  921,  442,  450,  449,
+      452,  454,  459,  458,  453,  469,    0,    0,    0,    0,
+      920,  470,  481,    0,  483,    0,  484,  481,  919,  368,
+      467,  495,  918,  940,  917,  940,  488,  916,  479,  490,
+      492,  495,  505,  498,  940,  915,  940,  507,  523,    0,
+        0,    0,    0,  940,  503,  864,  940,  846,  532,  836,
+        0,  824,  940,  516,  796,  940,  513,  530,  536,  538,
+      784,  940,  542,  535,  547,  772,  940,  549,  551,  768,
+      940,  502,  562,    0,  564,    0,    0,  562,  764,  940,
+
+      544,  557,  760,  752,  744,  940,  552,  568,  571,  568,
+      581,  577,  588,    0,    0,    0,    0,  589,  580,  591,
+      736,  940,  728,  940,  601,  602,  597,  599,  940,  603,
+      720,  712,  700,  672,  940,  665,  940,  610,  656,  603,
+      648,  607,  629,  940,  627,  940,  625,  940,  624,  940,
+      607,  574,  940,  614,  572,  940,  491,  940,  433,  940,
+      940,  622,  389,  940,  303,  940,  261,  940,  204,  940,
+      940,  635,  639,  642,  646,  650,  654,  658,  662,  666,
+      670,  674,  678,  682,  686,  690,  694,  698,  702,  706,
+      710,  714,  718,  722,  726,  730,  734,  738,  742,  746,
+
+      750,  754,  758,  762,  766,  770,  774,  778,  782,  786,
+      790,  794,  798,  802,  806,  810,  814,  818,  822,  826,
+      830,  834,  838,  842,  846,  850,  854,  858,  862,  866,
+      870,  874,  878,  882,  886,  890,  894,  898,  902,  906,
+      910,  914
     } ;
 
-static const flex_int16_t yy_def[424] =
+static const flex_int16_t yy_def[443] =
     {   0,
-      354,    1,  355,  355,  354,  356,  357,  357,  354,  354,
-      358,  358,   12,   12,   12,   12,   12,   12,   12,   12,
-       12,   12,   12,   12,   12,   12,  359,  354,  356,  354,
-      360,  357,  361,  361,  362,   12,  356,  363,   12,   12,
-       12,   12,   12,   12,   12,   12,   12,   12,   12,   12,
+      371,    1,  372,  372,  371,  373,  374,  374,  371,  371,
+      375,  375,   12,   12,   12,   12,   12,   12,   12,   12,
+       12,   12,   12,   12,   12,   12,  376,  371,  373,  371,
+      377,  374,  378,  378,  379,   12,  373,  380,   12,   12,
        12,   12,   12,   12,   12,   12,   12,   12,   12,   12,
-       12,  359,  360,  361,  361,  364,  365,  365,  354,   12,
        12,   12,   12,   12,   12,   12,   12,   12,   12,   12,
-       12,   12,   12,   12,   12,  362,   12,   12,   12,   12,
-       12,   12,   12,  364,  365,  365,  354,   12,   12,  366,
-
+       12,   12,  376,  377,  378,  378,  381,  382,  382,  371,
        12,   12,   12,   12,   12,   12,   12,   12,   12,   12,
-       12,  367,   86,   86,  368,   12,  369,   12,   12,  370,
-       12,   12,   12,   12,   12,  371,  372,  366,  372,   12,
-       12,  354,   86,   12,   12,   12,  373,   12,   12,   12,
-      374,  375,  367,  375,   86,   86,  376,  377,  368,  377,
-      378,  379,  369,  379,   12,  380,  381,  370,  381,   12,
-       12,  382,   12,   12,  371,  372,  372,  383,  383,   12,
-      354,   86,   86,   86,   12,   12,   12,  384,  385,  373,
-      385,   12,   12,  386,  374,  375,  375,  387,  387,   86,
-       86,  376,  377,  377,  388,  388,  378,  379,  379,  389,
-
-      389,   12,  380,  381,  381,  390,  390,   12,   12,  391,
-      354,  392,   86,   12,   86,   86,   86,   12,   86,   12,
-      384,  385,  385,  393,  393,  394,   86,  395,  396,  386,
-      396,   86,   86,  397,   12,  398,  391,  354,  399,  354,
-       86,  400,   12,   86,   86,   86,  401,   86,  354,  402,
-      354,   86,  395,  396,  396,  403,  403,  354,   86,  404,
-      354,  405,  406,  406,  399,  354,   86,  407,  354,   12,
-       86,   86,   86,  408,  354,  408,  408,   86,  402,  354,
-       86,   86,  404,  354,  409,  410,  405,  410,  406,   86,
-      407,  354,   12,   86,  411,  412,  408,  354,  408,  408,
-
-       86,   86,   86,  409,  410,  410,  413,  413,   86,   12,
-       86,  414,  354,  415,  354,  408,  408,   86,   86,  354,
-      416,  417,  418,  414,  354,  415,  354,  408,  408,   86,
-      419,  420,  354,  421,  354,  422,  354,  408,  354,   86,
-      423,  354,  420,  354,  421,  354,  422,  354,  354,   86,
-      423,  354,  354,    0,  354,  354,  354,  354,  354,  354,
-      354,  354,  354,  354,  354,  354,  354,  354,  354,  354,
-      354,  354,  354,  354,  354,  354,  354,  354,  354,  354,
-      354,  354,  354,  354,  354,  354,  354,  354,  354,  354,
-      354,  354,  354,  354,  354,  354,  354,  354,  354,  354,
-
-      354,  354,  354,  354,  354,  354,  354,  354,  354,  354,
-      354,  354,  354,  354,  354,  354,  354,  354,  354,  354,
-      354,  354,  354
+       12,   12,   12,   12,   12,   12,  379,   12,   12,   12,
+       12,   12,   12,   12,   12,  381,  382,  382,  371,   12,
+
+       12,  383,   12,   12,   12,   12,   12,   12,   12,   12,
+       12,   12,   12,  384,   87,   87,  385,   12,  386,   12,
+       12,   12,  387,   12,   12,   12,   12,   12,  388,  389,
+      383,  389,   12,   12,  371,   87,   12,   12,   12,  390,
+       12,   12,   12,  391,  392,  384,  392,   87,   87,  393,
+      394,  385,  394,  395,  396,  386,  396,   12,   12,  397,
+      398,  387,  398,   12,   12,  399,   12,   12,  388,  389,
+      389,  400,  400,   12,  371,   87,   87,   87,   12,   12,
+       12,  401,  402,  390,  402,   12,   12,  403,  391,  392,
+      392,  404,  404,   87,   87,  393,  394,  394,  405,  405,
+
+      395,  396,  396,  406,  406,   12,   12,  397,  398,  398,
+      407,  407,   12,   12,  408,  371,  409,   87,   12,   87,
+       87,   87,   12,   87,   12,  401,  402,  402,  410,  410,
+      411,   87,  412,  413,  403,  413,   87,   87,  414,   12,
+       12,  415,  408,  371,  416,  371,   87,  417,   12,   87,
+       87,   87,  418,   87,  371,  419,  371,   87,  412,  413,
+      413,  420,  420,  371,   87,  421,  371,   12,  422,  423,
+      423,  416,  371,   87,  424,  371,   12,   87,   87,   87,
+      425,  371,  425,  425,   87,  419,  371,   87,   87,  421,
+      371,   12,  426,  427,  422,  427,  423,   87,  424,  371,
+
+       12,   87,  428,  429,  425,  371,  425,  425,   87,   87,
+       87,   12,  426,  427,  427,  430,  430,   87,   12,   87,
+      431,  371,  432,  371,  425,  425,   87,   87,  371,   12,
+      433,  434,  435,  431,  371,  432,  371,  425,  425,   87,
+      436,   12,  437,  371,  438,  371,  439,  371,  425,  371,
+       87,  440,  371,   12,  437,  371,  438,  371,  439,  371,
+      371,   87,  440,  371,  441,  371,  442,  371,  442,  371,
+        0,  371,  371,  371,  371,  371,  371,  371,  371,  371,
+      371,  371,  371,  371,  371,  371,  371,  371,  371,  371,
+      371,  371,  371,  371,  371,  371,  371,  371,  371,  371,
+
+      371,  371,  371,  371,  371,  371,  371,  371,  371,  371,
+      371,  371,  371,  371,  371,  371,  371,  371,  371,  371,
+      371,  371,  371,  371,  371,  371,  371,  371,  371,  371,
+      371,  371,  371,  371,  371,  371,  371,  371,  371,  371,
+      371,  371
     } ;
 
-static const flex_int16_t yy_nxt[940] =
+static const flex_int16_t yy_nxt[975] =
     {   0,
         6,    7,    8,    9,    6,    6,    6,    6,   10,   11,
        12,   13,   14,   15,   16,   17,   18,   19,   17,   17,
        17,   17,   20,   17,   21,   22,   23,   24,   25,   17,
        26,   17,   17,   17,   32,   32,   33,   32,   32,   33,
        36,   34,   36,   42,   34,   29,   29,   29,   30,   35,
-       50,   36,   37,   38,   43,   44,   39,   36,   79,   45,
+       50,   36,   37,   38,   43,   44,   39,   36,   80,   45,
        36,   36,   40,   29,   29,   29,   30,   35,   46,   48,
        37,   38,   41,   47,   36,   49,   36,   53,   36,   36,
-       36,   56,   58,   36,   36,   55,   82,   60,   51,  342,
-       54,   61,   52,   29,   64,   32,   32,   33,   36,   65,
-
-       70,   36,   34,   29,   29,   29,   30,   36,   36,   36,
-       29,   38,   66,   66,   66,   67,   66,   71,   74,   66,
-       68,   72,   36,   36,   73,   36,   77,   78,   36,   76,
-       36,   53,   36,   36,   75,   85,   80,   83,   36,   86,
-       84,   36,   36,   36,   36,   81,   36,   36,   36,   36,
-       36,   36,   93,   89,  337,   98,   88,   29,   64,  101,
-       90,   36,   91,   65,   92,   87,   29,   95,   89,   99,
-       36,  100,   96,   36,   36,   36,   36,   36,   36,  106,
-      105,   85,   36,   36,  102,   36,  107,   36,  103,   36,
-      109,  112,   36,   36,  104,  108,  115,  110,   36,  117,
-
-       36,   36,   36,  335,   36,   36,  122,  111,   29,   29,
-       29,   30,  118,   36,  116,   29,   38,   36,   36,  113,
-      114,  119,  120,  123,   36,   29,   95,  121,   36,  134,
-      131,   96,  130,   36,  125,  124,  126,  126,   66,  127,
-      126,  132,  133,  126,  129,  333,   36,   36,  135,  137,
-       36,   36,   36,  140,  139,   35,   35,  352,   36,   36,
-       85,  141,  141,   66,  142,  141,  160,  145,  141,  144,
-       35,   35,   89,  117,  155,   36,  146,  147,  147,   66,
-      148,  147,  162,   36,  147,  150,  151,  151,   66,  152,
-      151,   36,   36,  151,  154,  120,  161,   36,  156,  156,
-
-       66,  157,  156,   36,   36,  156,  159,  164,  171,  163,
-       29,  166,   29,  168,   36,   36,  167,  170,  169,   35,
-       35,  172,   36,   36,  173,   36,  213,  184,   36,   36,
-      175,   36,  174,   29,  186,  212,   36,  349,  183,  187,
-      177,  176,  178,  178,   66,  179,  178,  182,  348,  178,
-      181,   29,  188,   35,   35,   35,   35,  189,   29,  193,
-       29,  195,  190,   36,  194,   36,  196,   29,  198,   29,
-      200,  191,   36,  199,   36,  201,  219,   29,  204,   29,
-      206,   36,  202,  205,  209,  207,   29,  166,   36,  293,
-      208,  214,  167,   35,   35,   35,   35,   35,   35,   36,
-
-       36,   36,  249,  218,  220,   29,  222,  216,   36,  217,
-      235,  223,   29,  224,  215,  226,   36,  227,  225,  346,
-       35,   35,   36,  228,  228,   66,  229,  228,   29,  186,
-      228,  231,  232,   36,  187,  233,   35,   29,  193,   29,
-      198,  234,   36,  194,  344,  199,   29,  204,  236,   36,
-       35,  241,  205,  242,   36,   35,   35,  270,   35,   35,
-       35,   35,  247,   36,   35,   35,   29,  222,  244,  262,
-      248,   36,  223,  243,  245,  246,   35,  252,   29,  254,
-       29,  256,  258,  342,  255,  259,  257,   35,   35,  339,
-       35,   35,   69,  264,   35,   35,   35,   35,   35,   35,
-
-      267,   35,   35,  275,   35,   35,   35,   35,  271,   35,
-       35,  276,  277,   35,   35,  272,  278,  315,  273,  281,
-       29,  254,  290,  313,  282,  275,  255,  285,  285,   66,
-      286,  285,   35,   35,  285,  288,  295,  298,  296,   35,
-       35,   35,   35,  298,  301,  328,  299,  294,   35,   35,
-      275,   35,   35,   35,  303,   29,  305,  300,  275,   29,
-      307,  306,   35,   35,  302,  308,  337,   36,   35,   35,
-      309,  310,  320,  316,   35,   35,   35,   35,  322,   36,
-       35,   35,  317,  275,  319,  311,   29,  305,  335,  275,
-      318,  321,  306,  323,   35,   35,   35,   35,  330,  329,
-
-       35,   35,  331,  333,  327,   35,   35,  338,   35,   35,
-      353,  340,   35,   35,  350,  325,  275,  315,   35,   35,
-       27,   27,   27,   27,   29,   29,   29,   31,   31,   31,
-       31,   36,   36,   36,   36,   62,  313,   62,   62,   63,
-       63,   63,   63,   65,  269,   65,   65,   35,   35,   35,
-       35,   69,   69,  261,   69,   94,   94,   94,   94,   96,
-      251,   96,   96,  128,  128,  128,  128,  143,  143,  143,
-      143,  149,  149,  149,  149,  153,  153,  153,  153,  158,
-      158,  158,  158,  165,  165,  165,  165,  167,  298,  167,
-      167,  180,  180,  180,  180,  185,  185,  185,  185,  187,
-
-      292,  187,  187,  192,  192,  192,  192,  194,  240,  194,
-      194,  197,  197,  197,  197,  199,  289,  199,  199,  203,
-      203,  203,  203,  205,  284,  205,  205,  210,  210,  210,
-      210,  169,  280,  169,  169,  221,  221,  221,  221,  223,
-      269,  223,  223,  230,  230,  230,  230,  189,  266,  189,
-      189,  196,  211,  196,  196,  201,  261,  201,  201,  207,
-      251,  207,  207,  237,  237,  237,  237,  239,  239,  239,
-      239,  225,  240,  225,  225,  250,  250,  250,  250,  253,
-      253,  253,  253,  255,  238,  255,  255,  260,  260,  260,
-      260,  263,  263,  263,  263,  265,  265,  265,  265,  268,
-
-      268,  268,  268,  274,  274,  274,  274,  279,  279,  279,
-      279,  257,  211,  257,  257,  283,  283,  283,  283,  287,
-      287,  287,  287,  264,  138,  264,  264,  291,  291,  291,
-      291,  297,  297,  297,  297,  304,  304,  304,  304,  306,
-      136,  306,  306,  312,  312,  312,  312,  314,  314,  314,
-      314,  308,   97,  308,  308,  324,  324,  324,  324,  326,
-      326,  326,  326,  332,  332,  332,  332,  334,  334,  334,
-      334,  336,  336,  336,  336,  341,  341,  341,  341,  343,
-      343,  343,  343,  345,  345,  345,  345,  347,  347,  347,
-      347,  351,  351,  351,  351,   36,   30,   59,   57,   36,
-
-       30,  354,   28,   28,    5,  354,  354,  354,  354,  354,
-      354,  354,  354,  354,  354,  354,  354,  354,  354,  354,
-      354,  354,  354,  354,  354,  354,  354,  354,  354,  354,
-      354,  354,  354,  354,  354,  354,  354,  354,  354
+       36,   56,   58,   36,   36,   55,   83,   61,   51,   36,
+       54,   62,   52,   29,   65,   59,   32,   32,   33,   66,
+
+       36,   36,   71,   34,   29,   29,   29,   30,   36,   36,
+       77,   29,   38,   67,   67,   67,   68,   67,   75,   72,
+       67,   69,   73,   36,   36,   74,   78,   79,   36,   53,
+       36,   36,   36,   87,   36,   76,   84,   36,   36,   85,
+       36,   81,   36,   86,   36,   36,   36,   36,   82,   36,
+       92,   95,   36,  100,   36,   36,   89,   90,   88,   29,
+       65,   36,   91,  101,   36,   66,   90,   93,   36,   94,
+       29,   97,  102,   36,   36,  104,   98,   36,  103,   36,
+       36,  107,  108,  106,   36,   36,   36,  105,   86,   36,
+      109,  110,  111,   36,   36,  114,  112,   36,  117,  119,
+
+       36,   36,   36,   36,   36,  121,   36,  368,   36,   36,
+      120,  113,   29,   29,   29,   30,  118,   36,  134,   29,
+       38,   36,  127,  115,  116,  122,  123,  125,   36,  126,
+      128,  124,   29,   97,   36,   36,  180,  138,   98,  129,
+      129,   67,  130,  129,   36,   36,  129,  132,  133,  135,
+      136,  140,   36,   36,   36,   36,  142,   36,  137,   35,
+       35,  123,   86,   36,  370,  143,  144,  144,   67,  145,
+      144,  148,  158,  144,  147,   35,   35,   90,  119,   36,
+       36,  149,  150,  150,   67,  151,  150,  159,   36,  150,
+      153,  154,  154,   67,  155,  154,  164,   36,  154,  157,
+
+      160,  160,   67,  161,  160,   36,  368,  160,  163,  165,
+      166,   36,   36,   29,  170,  167,  168,   29,  172,  171,
+       36,  175,   36,  173,   35,   35,  176,   36,   36,  177,
+       36,   36,  188,  174,   36,   29,  190,  178,   36,  181,
+       36,  191,  223,  179,  182,  182,   67,  183,  182,  186,
+      206,  182,  185,  187,   29,  192,   35,   35,   35,   35,
+      193,   29,  197,   29,  199,  194,   36,  198,   36,  200,
+       29,  202,   29,  204,  195,   36,  203,   36,  205,  268,
+      207,   29,  209,   29,  211,  214,  213,  210,  218,  212,
+      217,   36,  353,   36,   29,  170,   36,   35,   35,  219,
+
+      171,   35,   35,   35,   35,  224,   36,  231,   36,  225,
+       36,   29,  227,  221,   36,  222,  232,  228,  220,   29,
+      229,   36,  240,   35,   35,  230,  233,  233,   67,  234,
+      233,   29,  190,  233,  236,  237,  348,  191,  238,   35,
+       29,  197,   29,  202,  239,   36,  198,   36,  203,   29,
+      209,  242,   36,   35,  247,  210,  255,  241,  248,   36,
+       35,   35,   36,   35,   35,   35,   35,  253,   36,   35,
+       35,   29,  227,  250,  269,  254,   36,  228,  249,  251,
+      252,   35,  258,   29,  260,   29,  262,  264,   36,  261,
+      265,  263,   35,   35,  346,   35,   35,   70,  271,   35,
+
+       35,   35,   35,   35,   35,  274,   35,   35,  282,   35,
+       35,   36,  277,  278,   35,   35,  283,  284,   35,   35,
+      279,  285,   36,  280,  288,   29,  260,   35,   35,  289,
+      312,  261,  293,  293,   67,  294,  293,  301,  306,  293,
+      296,   35,   35,  298,  303,  306,  304,   35,   35,   35,
+       35,  309,  308,   36,  307,  282,  302,  319,   35,   35,
+       35,   35,   35,  311,   29,  314,   29,  316,   35,   35,
+      315,  282,  317,   35,   35,  344,  310,  364,  325,   35,
+       35,  318,   35,   35,  329,  320,   36,  328,  332,   36,
+       29,  314,   35,   35,  330,  326,  315,  331,  327,  333,
+
+       35,   35,   35,   35,  282,  282,  340,  341,   35,   35,
+       35,   35,   36,  282,   35,   35,   36,  351,   35,   35,
+      362,  339,  365,   36,  338,  366,  342,  361,  360,  354,
+      358,  349,  356,   35,   35,   27,   27,   27,   27,   29,
+       29,   29,   31,   31,   31,   31,   36,   36,   36,   36,
+       63,  353,   63,   63,   64,   64,   64,   64,   66,  350,
+       66,   66,   35,   35,   35,   35,   70,   70,  324,   70,
+       96,   96,   96,   96,   98,  322,   98,   98,  131,  131,
+      131,  131,  146,  146,  146,  146,  152,  152,  152,  152,
+      156,  156,  156,  156,  162,  162,  162,  162,  169,  169,
+
+      169,  169,  171,  348,  171,  171,  184,  184,  184,  184,
+      189,  189,  189,  189,  191,  346,  191,  191,  196,  196,
+      196,  196,  198,  344,  198,  198,  201,  201,  201,  201,
+      203,  337,  203,  203,  208,  208,  208,  208,  210,  335,
+      210,  210,  215,  215,  215,  215,  173,  282,  173,  173,
+      226,  226,  226,  226,  228,  324,  228,  228,  235,  235,
+      235,  235,  193,  322,  193,  193,  200,  276,  200,  200,
+      205,  267,  205,  205,  212,  257,  212,  212,  243,  243,
+      243,  243,  245,  245,  245,  245,  230,  306,  230,  230,
+      256,  256,  256,  256,  259,  259,  259,  259,  261,  300,
+
+      261,  261,  266,  266,  266,  266,  270,  270,  270,  270,
+      272,  272,  272,  272,  275,  275,  275,  275,  281,  281,
+      281,  281,  286,  286,  286,  286,  263,  246,  263,  263,
+      290,  290,  290,  290,  295,  295,  295,  295,  271,  297,
+      271,  271,  299,  299,  299,  299,  305,  305,  305,  305,
+      313,  313,  313,  313,  315,  292,  315,  315,  321,  321,
+      321,  321,  323,  323,  323,  323,  317,  291,  317,  317,
+      334,  334,  334,  334,  336,  336,  336,  336,  343,  343,
+      343,  343,  345,  345,  345,  345,  347,  347,  347,  347,
+      352,  352,  352,  352,  355,  355,  355,  355,  357,  357,
+
+      357,  357,  359,  359,  359,  359,  363,  363,  363,  363,
+      367,  367,  367,  367,  369,  369,  369,  369,  287,  276,
+      273,  216,  267,  257,  246,  244,  216,  141,  139,   99,
+       36,   30,   60,   57,   36,   30,  371,   28,   28,    5,
+      371,  371,  371,  371,  371,  371,  371,  371,  371,  371,
+      371,  371,  371,  371,  371,  371,  371,  371,  371,  371,
+      371,  371,  371,  371,  371,  371,  371,  371,  371,  371,
+      371,  371,  371,  371
     } ;
 
-static const flex_int16_t yy_chk[940] =
+static const flex_int16_t yy_chk[975] =
     {   0,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
@@ -927,101 +940,105 @@ static const flex_int16_t yy_chk[940] =
        18,   14,   11,   11,   13,   14,   11,   46,   46,   14,
        15,   16,   11,   12,   12,   12,   12,   12,   14,   16,
        12,   12,   12,   15,   19,   16,   20,   20,   21,   22,
-       24,   22,   24,   50,   26,   21,   50,   26,   19,  351,
-       20,   26,   19,   31,   31,   32,   32,   32,   39,   31,
-
-       39,   42,   32,   35,   35,   35,   35,   40,   44,   45,
-       35,   35,   37,   37,   37,   37,   37,   39,   42,   37,
-       37,   40,   41,   43,   41,   48,   45,   45,   49,   44,
-       47,   47,   53,   51,   43,   53,   48,   51,   52,   54,
-       52,   55,   56,   58,   54,   49,   57,   59,   60,   73,
-       61,   70,   60,   61,  347,   70,   56,   63,   63,   73,
-       58,   71,   59,   63,   59,   55,   66,   66,   57,   71,
-       74,   72,   66,   72,   75,   76,   77,   78,   79,   78,
-       77,   79,   80,   81,   74,   83,   80,   82,   75,   84,
-       82,   85,   88,   85,   76,   81,   87,   83,   87,   89,
-
-       92,   89,   93,  345,   90,  104,   92,   84,   86,   86,
-       86,   86,   90,   99,   88,   86,   86,   98,  102,   86,
-       86,   91,   91,   93,   91,   94,   94,   91,  101,  104,
-      102,   94,  101,  110,   99,   98,  100,  100,  100,  100,
-      100,  103,  103,  100,  100,  343,  105,  103,  105,  107,
-      109,  107,  111,  110,  109,  113,  113,  341,  121,  118,
-      111,  112,  112,  112,  112,  112,  121,  113,  112,  112,
-      114,  114,  116,  116,  118,  116,  114,  115,  115,  115,
-      115,  115,  123,  123,  115,  115,  117,  117,  117,  117,
-      117,  124,  122,  117,  117,  119,  122,  119,  120,  120,
-
-      120,  120,  120,  125,  130,  120,  120,  125,  131,  124,
-      126,  126,  128,  128,  131,  134,  126,  130,  128,  133,
-      133,  133,  135,  136,  133,  139,  164,  140,  138,  140,
-      134,  164,  133,  141,  141,  163,  163,  338,  139,  141,
-      136,  135,  137,  137,  137,  137,  137,  138,  336,  137,
-      137,  143,  143,  145,  145,  146,  146,  143,  147,  147,
-      149,  149,  145,  155,  147,  161,  149,  151,  151,  153,
-      153,  146,  160,  151,  270,  153,  176,  156,  156,  158,
-      158,  176,  155,  156,  161,  158,  165,  165,  170,  270,
-      160,  170,  165,  172,  172,  173,  173,  174,  174,  175,
-
-      208,  177,  220,  175,  177,  178,  178,  173,  220,  174,
-      208,  178,  180,  180,  172,  182,  182,  183,  180,  334,
-      190,  190,  183,  184,  184,  184,  184,  184,  185,  185,
-      184,  184,  190,  243,  185,  191,  191,  192,  192,  197,
-      197,  202,  202,  192,  332,  197,  203,  203,  209,  209,
-      213,  213,  203,  214,  214,  215,  215,  243,  216,  216,
-      217,  217,  218,  218,  219,  219,  221,  221,  215,  235,
-      219,  235,  221,  214,  216,  217,  227,  227,  228,  228,
-      230,  230,  232,  331,  228,  233,  230,  233,  233,  329,
-      232,  232,  236,  236,  241,  241,  244,  244,  245,  245,
-
-      241,  246,  246,  247,  248,  248,  267,  267,  244,  259,
-      259,  247,  247,  252,  252,  245,  248,  326,  246,  252,
-      253,  253,  267,  324,  259,  316,  253,  262,  262,  262,
-      262,  262,  271,  271,  262,  262,  272,  276,  273,  272,
-      272,  273,  273,  277,  278,  316,  276,  271,  281,  281,
-      299,  278,  278,  282,  282,  285,  285,  277,  300,  287,
-      287,  285,  290,  290,  281,  287,  323,  293,  294,  294,
-      290,  293,  303,  299,  301,  301,  302,  302,  310,  310,
-      303,  303,  300,  317,  302,  294,  304,  304,  322,  328,
-      301,  309,  304,  311,  309,  309,  311,  311,  318,  317,
-
-      318,  318,  319,  321,  314,  319,  319,  328,  330,  330,
-      350,  330,  340,  340,  340,  312,  297,  296,  350,  350,
-      355,  355,  355,  355,  356,  356,  356,  357,  357,  357,
-      357,  358,  358,  358,  358,  359,  295,  359,  359,  360,
-      360,  360,  360,  361,  291,  361,  361,  362,  362,  362,
-      362,  363,  363,  283,  363,  364,  364,  364,  364,  365,
-      279,  365,  365,  366,  366,  366,  366,  367,  367,  367,
-      367,  368,  368,  368,  368,  369,  369,  369,  369,  370,
-      370,  370,  370,  371,  371,  371,  371,  372,  274,  372,
-      372,  373,  373,  373,  373,  374,  374,  374,  374,  375,
-
-      268,  375,  375,  376,  376,  376,  376,  377,  265,  377,
-      377,  378,  378,  378,  378,  379,  263,  379,  379,  380,
-      380,  380,  380,  381,  260,  381,  381,  382,  382,  382,
-      382,  383,  250,  383,  383,  384,  384,  384,  384,  385,
-      242,  385,  385,  386,  386,  386,  386,  387,  239,  387,
-      387,  388,  237,  388,  388,  389,  234,  389,  389,  390,
-      226,  390,  390,  391,  391,  391,  391,  392,  392,  392,
-      392,  393,  212,  393,  393,  394,  394,  394,  394,  395,
-      395,  395,  395,  396,  210,  396,  396,  397,  397,  397,
-      397,  398,  398,  398,  398,  399,  399,  399,  399,  400,
-
-      400,  400,  400,  401,  401,  401,  401,  402,  402,  402,
-      402,  403,  162,  403,  403,  404,  404,  404,  404,  405,
-      405,  405,  405,  406,  108,  406,  406,  407,  407,  407,
-      407,  408,  408,  408,  408,  409,  409,  409,  409,  410,
-      106,  410,  410,  411,  411,  411,  411,  412,  412,  412,
-      412,  413,   69,  413,  413,  414,  414,  414,  414,  415,
-      415,  415,  415,  416,  416,  416,  416,  417,  417,  417,
-      417,  418,  418,  418,  418,  419,  419,  419,  419,  420,
-      420,  420,  420,  421,  421,  421,  421,  422,  422,  422,
-      422,  423,  423,  423,  423,   36,   29,   25,   23,   17,
-
-        6,    5,    4,    3,  354,  354,  354,  354,  354,  354,
-      354,  354,  354,  354,  354,  354,  354,  354,  354,  354,
-      354,  354,  354,  354,  354,  354,  354,  354,  354,  354,
-      354,  354,  354,  354,  354,  354,  354,  354,  354
+       24,   22,   24,   50,   26,   21,   50,   26,   19,   44,
+       20,   26,   19,   31,   31,   24,   32,   32,   32,   31,
+
+       39,   42,   39,   32,   35,   35,   35,   35,   40,   45,
+       44,   35,   35,   37,   37,   37,   37,   37,   42,   39,
+       37,   37,   40,   41,   43,   41,   45,   45,   47,   47,
+       48,   49,   51,   54,   55,   43,   51,   52,   54,   52,
+       53,   48,   56,   53,   57,   58,   59,   61,   49,   71,
+       59,   61,   60,   71,   62,   72,   56,   62,   55,   64,
+       64,   75,   58,   72,   77,   64,   57,   60,   74,   60,
+       67,   67,   73,   76,   73,   75,   67,   78,   74,   82,
+       79,   78,   79,   77,   84,   80,   81,   76,   80,   83,
+       81,   82,   83,   85,   89,   86,   84,   86,   88,   90,
+
+       88,   90,   91,   92,  100,   92,  104,  369,   95,  101,
+       91,   85,   87,   87,   87,   87,   89,  138,  104,   87,
+       87,   94,  100,   87,   87,   93,   93,   94,   93,   95,
+      101,   93,   96,   96,  106,  107,  138,  107,   96,  102,
+      102,  102,  102,  102,  103,  112,  102,  102,  103,  105,
+      105,  109,  111,  109,  113,  105,  111,  120,  106,  115,
+      115,  122,  113,  122,  367,  112,  114,  114,  114,  114,
+      114,  115,  120,  114,  114,  116,  116,  118,  118,  121,
+      118,  116,  117,  117,  117,  117,  117,  121,  124,  117,
+      117,  119,  119,  119,  119,  119,  124,  127,  119,  119,
+
+      123,  123,  123,  123,  123,  125,  365,  123,  123,  125,
+      126,  126,  128,  129,  129,  127,  128,  131,  131,  129,
+      133,  134,  139,  131,  136,  136,  136,  134,  137,  136,
+      141,  158,  143,  133,  143,  144,  144,  136,  179,  139,
+      142,  144,  179,  137,  140,  140,  140,  140,  140,  141,
+      158,  140,  140,  142,  146,  146,  148,  148,  149,  149,
+      146,  150,  150,  152,  152,  148,  165,  150,  164,  152,
+      154,  154,  156,  156,  149,  159,  154,  240,  156,  240,
+      159,  160,  160,  162,  162,  165,  164,  160,  168,  162,
+      167,  167,  363,  168,  169,  169,  174,  176,  176,  174,
+
+      169,  177,  177,  178,  178,  180,  181,  186,  186,  181,
+      180,  182,  182,  177,  207,  178,  187,  182,  176,  184,
+      184,  187,  207,  194,  194,  184,  188,  188,  188,  188,
+      188,  189,  189,  188,  188,  194,  359,  189,  195,  195,
+      196,  196,  201,  201,  206,  206,  196,  213,  201,  208,
+      208,  214,  214,  218,  218,  208,  225,  213,  219,  219,
+      220,  220,  225,  221,  221,  222,  222,  223,  223,  224,
+      224,  226,  226,  220,  241,  224,  241,  226,  219,  221,
+      222,  232,  232,  233,  233,  235,  235,  237,  249,  233,
+      238,  235,  238,  238,  357,  237,  237,  242,  242,  247,
+
+      247,  250,  250,  251,  251,  247,  252,  252,  253,  254,
+      254,  292,  249,  250,  265,  265,  253,  253,  258,  258,
+      251,  254,  277,  252,  258,  259,  259,  274,  274,  265,
+      292,  259,  269,  269,  269,  269,  269,  277,  284,  269,
+      269,  278,  278,  274,  279,  283,  280,  279,  279,  280,
+      280,  285,  284,  301,  283,  307,  278,  301,  285,  285,
+      288,  288,  289,  289,  293,  293,  295,  295,  302,  302,
+      293,  308,  295,  298,  298,  355,  288,  352,  307,  310,
+      310,  298,  309,  309,  311,  302,  312,  310,  319,  319,
+      313,  313,  311,  311,  312,  308,  313,  318,  309,  320,
+
+      318,  318,  320,  320,  325,  326,  327,  328,  327,  327,
+      328,  328,  330,  338,  340,  340,  342,  340,  351,  351,
+      351,  326,  354,  354,  325,  362,  330,  349,  347,  342,
+      345,  338,  343,  362,  362,  372,  372,  372,  372,  373,
+      373,  373,  374,  374,  374,  374,  375,  375,  375,  375,
+      376,  341,  376,  376,  377,  377,  377,  377,  378,  339,
+      378,  378,  379,  379,  379,  379,  380,  380,  336,  380,
+      381,  381,  381,  381,  382,  334,  382,  382,  383,  383,
+      383,  383,  384,  384,  384,  384,  385,  385,  385,  385,
+      386,  386,  386,  386,  387,  387,  387,  387,  388,  388,
+
+      388,  388,  389,  333,  389,  389,  390,  390,  390,  390,
+      391,  391,  391,  391,  392,  332,  392,  392,  393,  393,
+      393,  393,  394,  331,  394,  394,  395,  395,  395,  395,
+      396,  323,  396,  396,  397,  397,  397,  397,  398,  321,
+      398,  398,  399,  399,  399,  399,  400,  305,  400,  400,
+      401,  401,  401,  401,  402,  304,  402,  402,  403,  403,
+      403,  403,  404,  303,  404,  404,  405,  299,  405,  405,
+      406,  290,  406,  406,  407,  286,  407,  407,  408,  408,
+      408,  408,  409,  409,  409,  409,  410,  281,  410,  410,
+      411,  411,  411,  411,  412,  412,  412,  412,  413,  275,
+
+      413,  413,  414,  414,  414,  414,  415,  415,  415,  415,
+      416,  416,  416,  416,  417,  417,  417,  417,  418,  418,
+      418,  418,  419,  419,  419,  419,  420,  272,  420,  420,
+      421,  421,  421,  421,  422,  422,  422,  422,  423,  270,
+      423,  423,  424,  424,  424,  424,  425,  425,  425,  425,
+      426,  426,  426,  426,  427,  268,  427,  427,  428,  428,
+      428,  428,  429,  429,  429,  429,  430,  266,  430,  430,
+      431,  431,  431,  431,  432,  432,  432,  432,  433,  433,
+      433,  433,  434,  434,  434,  434,  435,  435,  435,  435,
+      436,  436,  436,  436,  437,  437,  437,  437,  438,  438,
+
+      438,  438,  439,  439,  439,  439,  440,  440,  440,  440,
+      441,  441,  441,  441,  442,  442,  442,  442,  256,  248,
+      245,  243,  239,  231,  217,  215,  166,  110,  108,   70,
+       36,   29,   25,   23,   17,    6,    5,    4,    3,  371,
+      371,  371,  371,  371,  371,  371,  371,  371,  371,  371,
+      371,  371,  371,  371,  371,  371,  371,  371,  371,  371,
+      371,  371,  371,  371,  371,  371,  371,  371,  371,  371,
+      371,  371,  371,  371
     } ;
 
 #define YY_TRAILING_MASK 0x2000
@@ -1160,9 +1177,17 @@ static void setbackendtype(DiskParseContext *dpc, const char *str) {
     if (     !strcmp(str,"phy"))   DSET(dpc,backend,BACKEND,str,PHY);
     else if (!strcmp(str,"tap"))   DSET(dpc,backend,BACKEND,str,TAP);
     else if (!strcmp(str,"qdisk")) DSET(dpc,backend,BACKEND,str,QDISK);
+    else if (!strcmp(str,"standalone")) DSET(dpc,backend,BACKEND,str,STANDALONE);
     else xlu__disk_err(dpc,str,"unknown value for backendtype");
 }
 
+/* Sets ->specification from the string.  IDL should provide something for this. */
+static void setspecification(DiskParseContext *dpc, const char *str) {
+    if      (!strcmp(str,"xen"))    DSET(dpc,specification,SPECIFICATION,str,XEN);
+    else if (!strcmp(str,"virtio")) DSET(dpc,specification,SPECIFICATION,str,VIRTIO);
+    else xlu__disk_err(dpc,str,"unknown value for specification");
+}
+
 /* Sets ->colo-port from the string.  COLO need this. */
 static void setcoloport(DiskParseContext *dpc, const char *str) {
     int port = atoi(str);
@@ -1199,9 +1224,9 @@ static int vdev_and_devtype(DiskParseContext *dpc, char *str) {
 #undef DPC /* needs to be defined differently the actual lexer */
 #define DPC ((DiskParseContext*)yyextra)
 
-#line 1202 "libxlu_disk_l.c"
+#line 1227 "libxlu_disk_l.c"
 
-#line 1204 "libxlu_disk_l.c"
+#line 1229 "libxlu_disk_l.c"
 
 #define INITIAL 0
 #define LEXERR 1
@@ -1477,13 +1502,13 @@ YY_DECL
 		}
 
 	{
-#line 177 "libxlu_disk_l.l"
+#line 185 "libxlu_disk_l.l"
 
 
-#line 180 "libxlu_disk_l.l"
+#line 188 "libxlu_disk_l.l"
  /*----- the scanner rules which do the parsing -----*/
 
-#line 1486 "libxlu_disk_l.c"
+#line 1511 "libxlu_disk_l.c"
 
 	while ( /*CONSTCOND*/1 )		/* loops until end-of-file is reached */
 		{
@@ -1515,14 +1540,14 @@ yy_match:
 			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 				{
 				yy_current_state = (int) yy_def[yy_current_state];
-				if ( yy_current_state >= 355 )
+				if ( yy_current_state >= 372 )
 					yy_c = yy_meta[yy_c];
 				}
 			yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
 			*yyg->yy_state_ptr++ = yy_current_state;
 			++yy_cp;
 			}
-		while ( yy_current_state != 354 );
+		while ( yy_current_state != 371 );
 
 yy_find_action:
 		yy_current_state = *--yyg->yy_state_ptr;
@@ -1572,152 +1597,158 @@ do_action:	/* This label is used only to access EOF actions. */
 case 1:
 /* rule 1 can match eol */
 YY_RULE_SETUP
-#line 182 "libxlu_disk_l.l"
+#line 190 "libxlu_disk_l.l"
 { /* ignore whitespace before parameters */ }
 	YY_BREAK
 /* ordinary parameters setting enums or strings */
 case 2:
 /* rule 2 can match eol */
 YY_RULE_SETUP
-#line 186 "libxlu_disk_l.l"
+#line 194 "libxlu_disk_l.l"
 { STRIP(','); setformat(DPC, FROMEQUALS); }
 	YY_BREAK
 case 3:
 YY_RULE_SETUP
-#line 188 "libxlu_disk_l.l"
+#line 196 "libxlu_disk_l.l"
 { DPC->disk->is_cdrom = 1; }
 	YY_BREAK
 case 4:
 YY_RULE_SETUP
-#line 189 "libxlu_disk_l.l"
+#line 197 "libxlu_disk_l.l"
 { DPC->disk->is_cdrom = 1; }
 	YY_BREAK
 case 5:
 YY_RULE_SETUP
-#line 190 "libxlu_disk_l.l"
+#line 198 "libxlu_disk_l.l"
 { DPC->disk->is_cdrom = 0; }
 	YY_BREAK
 case 6:
 /* rule 6 can match eol */
 YY_RULE_SETUP
-#line 191 "libxlu_disk_l.l"
+#line 199 "libxlu_disk_l.l"
 { xlu__disk_err(DPC,yytext,"unknown value for type"); }
 	YY_BREAK
 case 7:
 /* rule 7 can match eol */
 YY_RULE_SETUP
-#line 193 "libxlu_disk_l.l"
+#line 201 "libxlu_disk_l.l"
 { STRIP(','); setaccess(DPC, FROMEQUALS); }
 	YY_BREAK
 case 8:
 /* rule 8 can match eol */
 YY_RULE_SETUP
-#line 194 "libxlu_disk_l.l"
+#line 202 "libxlu_disk_l.l"
 { STRIP(','); SAVESTRING("backend", backend_domname, FROMEQUALS); }
 	YY_BREAK
 case 9:
 /* rule 9 can match eol */
 YY_RULE_SETUP
-#line 195 "libxlu_disk_l.l"
+#line 203 "libxlu_disk_l.l"
 { STRIP(','); setbackendtype(DPC,FROMEQUALS); }
 	YY_BREAK
 case 10:
 /* rule 10 can match eol */
 YY_RULE_SETUP
-#line 197 "libxlu_disk_l.l"
-{ STRIP(','); SAVESTRING("vdev", vdev, FROMEQUALS); }
+#line 204 "libxlu_disk_l.l"
+{ STRIP(','); setspecification(DPC,FROMEQUALS); }
 	YY_BREAK
 case 11:
 /* rule 11 can match eol */
 YY_RULE_SETUP
-#line 198 "libxlu_disk_l.l"
-{ STRIP(','); SAVESTRING("script", script, FROMEQUALS); }
+#line 206 "libxlu_disk_l.l"
+{ STRIP(','); SAVESTRING("vdev", vdev, FROMEQUALS); }
 	YY_BREAK
 case 12:
+/* rule 12 can match eol */
 YY_RULE_SETUP
-#line 199 "libxlu_disk_l.l"
-{ DPC->disk->direct_io_safe = 1; }
+#line 207 "libxlu_disk_l.l"
+{ STRIP(','); SAVESTRING("script", script, FROMEQUALS); }
 	YY_BREAK
 case 13:
 YY_RULE_SETUP
-#line 200 "libxlu_disk_l.l"
-{ libxl_defbool_set(&DPC->disk->discard_enable, true); }
+#line 208 "libxlu_disk_l.l"
+{ DPC->disk->direct_io_safe = 1; }
 	YY_BREAK
 case 14:
 YY_RULE_SETUP
-#line 201 "libxlu_disk_l.l"
-{ libxl_defbool_set(&DPC->disk->discard_enable, false); }
+#line 209 "libxlu_disk_l.l"
+{ libxl_defbool_set(&DPC->disk->discard_enable, true); }
 	YY_BREAK
-/* Note that the COLO configuration settings should be considered unstable.
-  * They may change incompatibly in future versions of Xen. */
 case 15:
 YY_RULE_SETUP
-#line 204 "libxlu_disk_l.l"
-{ libxl_defbool_set(&DPC->disk->colo_enable, true); }
+#line 210 "libxlu_disk_l.l"
+{ libxl_defbool_set(&DPC->disk->discard_enable, false); }
 	YY_BREAK
+/* Note that the COLO configuration settings should be considered unstable.
+  * They may change incompatibly in future versions of Xen. */
 case 16:
 YY_RULE_SETUP
-#line 205 "libxlu_disk_l.l"
-{ libxl_defbool_set(&DPC->disk->colo_enable, false); }
+#line 213 "libxlu_disk_l.l"
+{ libxl_defbool_set(&DPC->disk->colo_enable, true); }
 	YY_BREAK
 case 17:
-/* rule 17 can match eol */
 YY_RULE_SETUP
-#line 206 "libxlu_disk_l.l"
-{ STRIP(','); SAVESTRING("colo-host", colo_host, FROMEQUALS); }
+#line 214 "libxlu_disk_l.l"
+{ libxl_defbool_set(&DPC->disk->colo_enable, false); }
 	YY_BREAK
 case 18:
 /* rule 18 can match eol */
 YY_RULE_SETUP
-#line 207 "libxlu_disk_l.l"
-{ STRIP(','); setcoloport(DPC, FROMEQUALS); }
+#line 215 "libxlu_disk_l.l"
+{ STRIP(','); SAVESTRING("colo-host", colo_host, FROMEQUALS); }
 	YY_BREAK
 case 19:
 /* rule 19 can match eol */
 YY_RULE_SETUP
-#line 208 "libxlu_disk_l.l"
-{ STRIP(','); SAVESTRING("colo-export", colo_export, FROMEQUALS); }
+#line 216 "libxlu_disk_l.l"
+{ STRIP(','); setcoloport(DPC, FROMEQUALS); }
 	YY_BREAK
 case 20:
 /* rule 20 can match eol */
 YY_RULE_SETUP
-#line 209 "libxlu_disk_l.l"
-{ STRIP(','); SAVESTRING("active-disk", active_disk, FROMEQUALS); }
+#line 217 "libxlu_disk_l.l"
+{ STRIP(','); SAVESTRING("colo-export", colo_export, FROMEQUALS); }
 	YY_BREAK
 case 21:
 /* rule 21 can match eol */
 YY_RULE_SETUP
-#line 210 "libxlu_disk_l.l"
+#line 218 "libxlu_disk_l.l"
+{ STRIP(','); SAVESTRING("active-disk", active_disk, FROMEQUALS); }
+	YY_BREAK
+case 22:
+/* rule 22 can match eol */
+YY_RULE_SETUP
+#line 219 "libxlu_disk_l.l"
 { STRIP(','); SAVESTRING("hidden-disk", hidden_disk, FROMEQUALS); }
 	YY_BREAK
 /* the target magic parameter, eats the rest of the string */
-case 22:
+case 23:
 YY_RULE_SETUP
-#line 214 "libxlu_disk_l.l"
+#line 223 "libxlu_disk_l.l"
 { STRIP(','); SAVESTRING("target", pdev_path, FROMEQUALS); }
 	YY_BREAK
 /* unknown parameters */
-case 23:
-/* rule 23 can match eol */
+case 24:
+/* rule 24 can match eol */
 YY_RULE_SETUP
-#line 218 "libxlu_disk_l.l"
+#line 227 "libxlu_disk_l.l"
 { xlu__disk_err(DPC,yytext,"unknown parameter"); }
 	YY_BREAK
 /* deprecated prefixes */
 /* the "/.*" in these patterns ensures that they count as if they
    * matched the whole string, so these patterns take precedence */
-case 24:
+case 25:
 YY_RULE_SETUP
-#line 225 "libxlu_disk_l.l"
+#line 234 "libxlu_disk_l.l"
 {
                     STRIP(':');
                     DPC->had_depr_prefix=1; DEPRECATE("use `[format=]...,'");
                     setformat(DPC, yytext);
                  }
 	YY_BREAK
-case 25:
+case 26:
 YY_RULE_SETUP
-#line 231 "libxlu_disk_l.l"
+#line 240 "libxlu_disk_l.l"
 {
                     char *newscript;
                     STRIP(':');
@@ -1731,65 +1762,65 @@ YY_RULE_SETUP
                     free(newscript);
                 }
 	YY_BREAK
-case 26:
+case 27:
 *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
 yyg->yy_c_buf_p = yy_cp = yy_bp + 8;
 YY_DO_BEFORE_ACTION; /* set up yytext again */
 YY_RULE_SETUP
-#line 244 "libxlu_disk_l.l"
+#line 253 "libxlu_disk_l.l"
 { DPC->had_depr_prefix=1; DEPRECATE(0); }
 	YY_BREAK
-case 27:
+case 28:
 YY_RULE_SETUP
-#line 245 "libxlu_disk_l.l"
+#line 254 "libxlu_disk_l.l"
 { DPC->had_depr_prefix=1; DEPRECATE(0); }
 	YY_BREAK
-case 28:
+case 29:
 *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
 yyg->yy_c_buf_p = yy_cp = yy_bp + 4;
 YY_DO_BEFORE_ACTION; /* set up yytext again */
 YY_RULE_SETUP
-#line 246 "libxlu_disk_l.l"
+#line 255 "libxlu_disk_l.l"
 { DPC->had_depr_prefix=1; DEPRECATE(0); }
 	YY_BREAK
-case 29:
+case 30:
 *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
 yyg->yy_c_buf_p = yy_cp = yy_bp + 6;
 YY_DO_BEFORE_ACTION; /* set up yytext again */
 YY_RULE_SETUP
-#line 247 "libxlu_disk_l.l"
+#line 256 "libxlu_disk_l.l"
 { DPC->had_depr_prefix=1; DEPRECATE(0); }
 	YY_BREAK
-case 30:
+case 31:
 *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
 yyg->yy_c_buf_p = yy_cp = yy_bp + 5;
 YY_DO_BEFORE_ACTION; /* set up yytext again */
 YY_RULE_SETUP
-#line 248 "libxlu_disk_l.l"
+#line 257 "libxlu_disk_l.l"
 { DPC->had_depr_prefix=1; DEPRECATE(0); }
 	YY_BREAK
-case 31:
+case 32:
 *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
 yyg->yy_c_buf_p = yy_cp = yy_bp + 4;
 YY_DO_BEFORE_ACTION; /* set up yytext again */
 YY_RULE_SETUP
-#line 249 "libxlu_disk_l.l"
+#line 258 "libxlu_disk_l.l"
 { DPC->had_depr_prefix=1; DEPRECATE(0); }
 	YY_BREAK
-case 32:
-/* rule 32 can match eol */
+case 33:
+/* rule 33 can match eol */
 YY_RULE_SETUP
-#line 251 "libxlu_disk_l.l"
+#line 260 "libxlu_disk_l.l"
 {
 		  xlu__disk_err(DPC,yytext,"unknown deprecated disk prefix");
 		  return 0;
 		}
 	YY_BREAK
 /* positional parameters */
-case 33:
-/* rule 33 can match eol */
+case 34:
+/* rule 34 can match eol */
 YY_RULE_SETUP
-#line 258 "libxlu_disk_l.l"
+#line 267 "libxlu_disk_l.l"
 {
     STRIP(',');
 
@@ -1816,27 +1847,27 @@ YY_RULE_SETUP
     }
 }
 	YY_BREAK
-case 34:
+case 35:
 YY_RULE_SETUP
-#line 284 "libxlu_disk_l.l"
+#line 293 "libxlu_disk_l.l"
 {
     BEGIN(LEXERR);
     yymore();
 }
 	YY_BREAK
-case 35:
+case 36:
 YY_RULE_SETUP
-#line 288 "libxlu_disk_l.l"
+#line 297 "libxlu_disk_l.l"
 {
     xlu__disk_err(DPC,yytext,"bad disk syntax"); return 0;
 }
 	YY_BREAK
-case 36:
+case 37:
 YY_RULE_SETUP
-#line 291 "libxlu_disk_l.l"
+#line 300 "libxlu_disk_l.l"
 YY_FATAL_ERROR( "flex scanner jammed" );
 	YY_BREAK
-#line 1839 "libxlu_disk_l.c"
+#line 1870 "libxlu_disk_l.c"
 			case YY_STATE_EOF(INITIAL):
 			case YY_STATE_EOF(LEXERR):
 				yyterminate();
@@ -2104,7 +2135,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
 		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 			{
 			yy_current_state = (int) yy_def[yy_current_state];
-			if ( yy_current_state >= 355 )
+			if ( yy_current_state >= 372 )
 				yy_c = yy_meta[yy_c];
 			}
 		yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
@@ -2128,11 +2159,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
 	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 		{
 		yy_current_state = (int) yy_def[yy_current_state];
-		if ( yy_current_state >= 355 )
+		if ( yy_current_state >= 372 )
 			yy_c = yy_meta[yy_c];
 		}
 	yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
-	yy_is_jam = (yy_current_state == 354);
+	yy_is_jam = (yy_current_state == 371);
 	if ( ! yy_is_jam )
 		*yyg->yy_state_ptr++ = yy_current_state;
 
@@ -2941,4 +2972,4 @@ void yyfree (void * ptr , yyscan_t yyscanner)
 
 #define YYTABLES_NAME "yytables"
 
-#line 291 "libxlu_disk_l.l"
+#line 300 "libxlu_disk_l.l"
diff --git a/tools/libs/util/libxlu_disk_l.h b/tools/libs/util/libxlu_disk_l.h
index 6abeecf279..509aad67dc 100644
--- a/tools/libs/util/libxlu_disk_l.h
+++ b/tools/libs/util/libxlu_disk_l.h
@@ -694,7 +694,7 @@ extern int yylex (yyscan_t yyscanner);
 #undef yyTABLES_NAME
 #endif
 
-#line 291 "libxlu_disk_l.l"
+#line 300 "libxlu_disk_l.l"
 
 #line 699 "libxlu_disk_l.h"
 #undef xlu__disk_yyIN_HEADER
diff --git a/tools/libs/util/libxlu_disk_l.l b/tools/libs/util/libxlu_disk_l.l
index e115460d99..6d53c093a3 100644
--- a/tools/libs/util/libxlu_disk_l.l
+++ b/tools/libs/util/libxlu_disk_l.l
@@ -122,9 +122,17 @@ static void setbackendtype(DiskParseContext *dpc, const char *str) {
     if (     !strcmp(str,"phy"))   DSET(dpc,backend,BACKEND,str,PHY);
     else if (!strcmp(str,"tap"))   DSET(dpc,backend,BACKEND,str,TAP);
     else if (!strcmp(str,"qdisk")) DSET(dpc,backend,BACKEND,str,QDISK);
+    else if (!strcmp(str,"standalone")) DSET(dpc,backend,BACKEND,str,STANDALONE);
     else xlu__disk_err(dpc,str,"unknown value for backendtype");
 }
 
+/* Sets ->specification from the string.  IDL should provide something for this. */
+static void setspecification(DiskParseContext *dpc, const char *str) {
+    if      (!strcmp(str,"xen"))    DSET(dpc,specification,SPECIFICATION,str,XEN);
+    else if (!strcmp(str,"virtio")) DSET(dpc,specification,SPECIFICATION,str,VIRTIO);
+    else xlu__disk_err(dpc,str,"unknown value for specification");
+}
+
 /* Sets ->colo-port from the string.  COLO need this. */
 static void setcoloport(DiskParseContext *dpc, const char *str) {
     int port = atoi(str);
@@ -192,6 +200,7 @@ devtype=[^,]*,?	{ xlu__disk_err(DPC,yytext,"unknown value for type"); }
 access=[^,]*,?	{ STRIP(','); setaccess(DPC, FROMEQUALS); }
 backend=[^,]*,? { STRIP(','); SAVESTRING("backend", backend_domname, FROMEQUALS); }
 backendtype=[^,]*,? { STRIP(','); setbackendtype(DPC,FROMEQUALS); }
+specification=[^,]*,? { STRIP(','); setspecification(DPC,FROMEQUALS); }
 
 vdev=[^,]*,?	{ STRIP(','); SAVESTRING("vdev", vdev, FROMEQUALS); }
 script=[^,]*,?	{ STRIP(','); SAVESTRING("script", script, FROMEQUALS); }
diff --git a/tools/xl/xl_block.c b/tools/xl/xl_block.c
index 70eed431e4..8836c07d6b 100644
--- a/tools/xl/xl_block.c
+++ b/tools/xl/xl_block.c
@@ -119,6 +119,12 @@ int main_blockdetach(int argc, char **argv)
         fprintf(stderr, "Error: Device %s not connected.\n", argv[optind+1]);
         return 1;
     }
+
+    if (disk.specification == LIBXL_DISK_SPECIFICATION_VIRTIO) {
+        fprintf(stderr, "Hotunplug isn't supported for specification virtio\n");
+        return 1;
+    }
+
     rc = !force ? libxl_device_disk_safe_remove(ctx, domid, &disk, 0) :
         libxl_device_disk_destroy(ctx, domid, &disk, 0);
     if (rc) {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 04 16:44:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Aug 2022 16:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380601.614825 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJdxF-0000mh-2h; Thu, 04 Aug 2022 16:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380601.614825; Thu, 04 Aug 2022 16:44:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJdxE-0000mY-Vq; Thu, 04 Aug 2022 16:44:12 +0000
Received: by outflank-mailman (input) for mailman id 380601;
 Thu, 04 Aug 2022 16:44:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdxE-0000mQ-8n
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:44:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdxE-0000RR-7t
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdxE-0000P9-7A
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:44:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cppcOh34rRrhaxKu4sKPnnEr3alIRbkdeL9W7m1Wwmw=; b=sk42PjBP9Jg4LUR7NwOG4YFG4I
	39tknqjboWGUr7qW755W7tBMahf8qWZLTkxslOXeOga2KRI3ZSEmkdDX1WIdPiwDe3uRcfdvHJxLA
	oRh7R+IpXVmsWdLdyYq2hZIEyvnEOV8QYOm+mARCwHEwtn4Uh2iItC4YNDEbonl6sHOM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libxl: Introduce basic virtio-mmio support on Arm
Message-Id: <E1oJdxE-0000P9-7A@xenbits.xenproject.org>
Date: Thu, 04 Aug 2022 16:44:12 +0000

commit 2128143c114c52c7536e37c32935fdd77f23edc1
Author:     Julien Grall <julien.grall@arm.com>
AuthorDate: Fri Jul 15 22:20:25 2022 +0300
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Jul 28 19:26:37 2022 +0100

    libxl: Introduce basic virtio-mmio support on Arm
    
    This patch introduces helpers to allocate Virtio MMIO params
    (IRQ and memory region) and create specific device node in
    the Guest device-tree with allocated params. In order to deal
    with multiple Virtio devices, reserve corresponding ranges.
    For now, we reserve 1MB for memory regions and 10 SPIs.
    
    As these helpers should be used for every Virtio device attached
    to the Guest, call them for Virtio disk(s).
    
    Please note, with statically allocated Virtio IRQs there is
    a risk of a clash with a physical IRQs of passthrough devices.
    For the first version, it's fine, but we should consider allocating
    the Virtio IRQs automatically. Thankfully, we know in advance which
    IRQs will be used for passthrough to be able to choose non-clashed
    ones.
    
    Signed-off-by: Julien Grall <julien.grall@arm.com>
    Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/libs/light/libxl_arm.c  | 121 +++++++++++++++++++++++++++++++++++++++++-
 xen/include/public/arch-arm.h |   7 +++
 2 files changed, 126 insertions(+), 2 deletions(-)

diff --git a/tools/libs/light/libxl_arm.c b/tools/libs/light/libxl_arm.c
index 7dee2afd4b..866e58c66b 100644
--- a/tools/libs/light/libxl_arm.c
+++ b/tools/libs/light/libxl_arm.c
@@ -8,6 +8,46 @@
 #include <assert.h>
 #include <xen/device_tree_defs.h>
 
+/*
+ * There is no clear requirements for the total size of Virtio MMIO region.
+ * The size of control registers is 0x100 and device-specific configuration
+ * registers starts at the offset 0x100, however it's size depends on the device
+ * and the driver. Pick the biggest known size at the moment to cover most
+ * of the devices (also consider allowing the user to configure the size via
+ * config file for the one not conforming with the proposed value).
+ */
+#define VIRTIO_MMIO_DEV_SIZE   xen_mk_ullong(0x200)
+
+static uint64_t alloc_virtio_mmio_base(libxl__gc *gc, uint64_t *virtio_mmio_base)
+{
+    uint64_t base = *virtio_mmio_base;
+
+    /* Make sure we have enough reserved resources */
+    if (base + VIRTIO_MMIO_DEV_SIZE >
+        GUEST_VIRTIO_MMIO_BASE + GUEST_VIRTIO_MMIO_SIZE) {
+        LOG(ERROR, "Ran out of reserved range for Virtio MMIO BASE 0x%"PRIx64"\n",
+            base);
+        return 0;
+    }
+    *virtio_mmio_base += VIRTIO_MMIO_DEV_SIZE;
+
+    return base;
+}
+
+static uint32_t alloc_virtio_mmio_irq(libxl__gc *gc, uint32_t *virtio_mmio_irq)
+{
+    uint32_t irq = *virtio_mmio_irq;
+
+    /* Make sure we have enough reserved resources */
+    if (irq > GUEST_VIRTIO_MMIO_SPI_LAST) {
+        LOG(ERROR, "Ran out of reserved range for Virtio MMIO IRQ %u\n", irq);
+        return 0;
+    }
+    (*virtio_mmio_irq)++;
+
+    return irq;
+}
+
 static const char *gicv_to_string(libxl_gic_version gic_version)
 {
     switch (gic_version) {
@@ -26,8 +66,10 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc,
 {
     uint32_t nr_spis = 0;
     unsigned int i;
-    uint32_t vuart_irq;
-    bool vuart_enabled = false;
+    uint32_t vuart_irq, virtio_irq = 0;
+    bool vuart_enabled = false, virtio_enabled = false;
+    uint64_t virtio_mmio_base = GUEST_VIRTIO_MMIO_BASE;
+    uint32_t virtio_mmio_irq = GUEST_VIRTIO_MMIO_SPI_FIRST;
 
     /*
      * If pl011 vuart is enabled then increment the nr_spis to allow allocation
@@ -39,6 +81,35 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc,
         vuart_enabled = true;
     }
 
+    for (i = 0; i < d_config->num_disks; i++) {
+        libxl_device_disk *disk = &d_config->disks[i];
+
+        if (disk->specification == LIBXL_DISK_SPECIFICATION_VIRTIO) {
+            disk->base = alloc_virtio_mmio_base(gc, &virtio_mmio_base);
+            if (!disk->base)
+                return ERROR_FAIL;
+
+            disk->irq = alloc_virtio_mmio_irq(gc, &virtio_mmio_irq);
+            if (!disk->irq)
+                return ERROR_FAIL;
+
+            if (virtio_irq < disk->irq)
+                virtio_irq = disk->irq;
+            virtio_enabled = true;
+
+            LOG(DEBUG, "Allocate Virtio MMIO params for Vdev %s: IRQ %u BASE 0x%"PRIx64,
+                disk->vdev, disk->irq, disk->base);
+        }
+    }
+
+    /*
+     * Every virtio-mmio device uses one emulated SPI. If Virtio devices are
+     * present, make sure that we allocate enough SPIs for them.
+     * The resulting "nr_spis" needs to cover the highest possible SPI.
+     */
+    if (virtio_enabled)
+        nr_spis = max(nr_spis, virtio_irq - 32 + 1);
+
     for (i = 0; i < d_config->b_info.num_irqs; i++) {
         uint32_t irq = d_config->b_info.irqs[i];
         uint32_t spi;
@@ -58,6 +129,13 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc,
             return ERROR_FAIL;
         }
 
+        /* The same check as for vpl011 */
+        if (virtio_enabled &&
+            (irq >= GUEST_VIRTIO_MMIO_SPI_FIRST && irq <= virtio_irq)) {
+            LOG(ERROR, "Physical IRQ %u conflicting with Virtio MMIO IRQ range\n", irq);
+            return ERROR_FAIL;
+        }
+
         if (irq < 32)
             continue;
 
@@ -787,6 +865,37 @@ static int make_vpci_node(libxl__gc *gc, void *fdt,
     return 0;
 }
 
+
+static int make_virtio_mmio_node(libxl__gc *gc, void *fdt,
+                                 uint64_t base, uint32_t irq)
+{
+    int res;
+    gic_interrupt intr;
+    const char *name = GCSPRINTF("virtio@%"PRIx64, base);
+
+    res = fdt_begin_node(fdt, name);
+    if (res) return res;
+
+    res = fdt_property_compat(gc, fdt, 1, "virtio,mmio");
+    if (res) return res;
+
+    res = fdt_property_regs(gc, fdt, GUEST_ROOT_ADDRESS_CELLS, GUEST_ROOT_SIZE_CELLS,
+                            1, base, VIRTIO_MMIO_DEV_SIZE);
+    if (res) return res;
+
+    set_interrupt(intr, irq, 0xf, DT_IRQ_TYPE_EDGE_RISING);
+    res = fdt_property_interrupts(gc, fdt, &intr, 1);
+    if (res) return res;
+
+    res = fdt_property(fdt, "dma-coherent", NULL, 0);
+    if (res) return res;
+
+    res = fdt_end_node(fdt);
+    if (res) return res;
+
+    return 0;
+}
+
 static const struct arch_info *get_arch_info(libxl__gc *gc,
                                              const struct xc_dom_image *dom)
 {
@@ -988,6 +1097,7 @@ static int libxl__prepare_dtb(libxl__gc *gc, libxl_domain_config *d_config,
     size_t fdt_size = 0;
     int pfdt_size = 0;
     libxl_domain_build_info *const info = &d_config->b_info;
+    unsigned int i;
 
     const libxl_version_info *vers;
     const struct arch_info *ainfo;
@@ -1094,6 +1204,13 @@ next_resize:
         if (d_config->num_pcidevs)
             FDT( make_vpci_node(gc, fdt, ainfo, dom) );
 
+        for (i = 0; i < d_config->num_disks; i++) {
+            libxl_device_disk *disk = &d_config->disks[i];
+
+            if (disk->specification == LIBXL_DISK_SPECIFICATION_VIRTIO)
+                FDT( make_virtio_mmio_node(gc, fdt, disk->base, disk->irq) );
+        }
+
         if (pfdt)
             FDT( copy_partial_fdt(gc, fdt, pfdt) );
 
diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h
index ab05fe12b0..c8b6058d3a 100644
--- a/xen/include/public/arch-arm.h
+++ b/xen/include/public/arch-arm.h
@@ -407,6 +407,10 @@ typedef uint64_t xen_callback_t;
 
 /* Physical Address Space */
 
+/* Virtio MMIO mappings */
+#define GUEST_VIRTIO_MMIO_BASE   xen_mk_ullong(0x02000000)
+#define GUEST_VIRTIO_MMIO_SIZE   xen_mk_ullong(0x00100000)
+
 /*
  * vGIC mappings: Only one set of mapping is used by the guest.
  * Therefore they can overlap.
@@ -493,6 +497,9 @@ typedef uint64_t xen_callback_t;
 
 #define GUEST_VPL011_SPI        32
 
+#define GUEST_VIRTIO_MMIO_SPI_FIRST   33
+#define GUEST_VIRTIO_MMIO_SPI_LAST    43
+
 /* PSCI functions */
 #define PSCI_cpu_suspend 0
 #define PSCI_cpu_off     1
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 04 16:44:24 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Aug 2022 16:44:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380602.614827 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJdxQ-0000pk-3b; Thu, 04 Aug 2022 16:44:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380602.614827; Thu, 04 Aug 2022 16: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 1oJdxQ-0000pd-17; Thu, 04 Aug 2022 16:44:24 +0000
Received: by outflank-mailman (input) for mailman id 380602;
 Thu, 04 Aug 2022 16:44:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdxO-0000pS-Du
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:44:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdxO-0000So-B3
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdxO-0000Pg-AH
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:44:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=peEW4cj4moPnTRak7pQ+3qz3US29xiCMMQghdS9Oxds=; b=wsyU1GeT5G7Dgs0wDneNb7w6O+
	6wmLR5EGYmMXnEcjM97ImmD5DMx8PeN6S4wL1XwjypiUNPt6ZsrE5KwrPmdDq241BPvdL9+uZKC3z
	wSUZ6jY33e10ucHhibHRRLMg5d+ytAm8ko2RnaC+ReAG7ZQ/X986iwG4DCzgHVPWzl8U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libxl/arm: Create specific IOMMU node to be referred by virtio-mmio device
Message-Id: <E1oJdxO-0000Pg-AH@xenbits.xenproject.org>
Date: Thu, 04 Aug 2022 16:44:22 +0000

commit ca45d3cb4586372909f350e54482246f994e1bc7
Author:     Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
AuthorDate: Fri Jul 15 22:20:26 2022 +0300
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Jul 28 19:26:37 2022 +0100

    libxl/arm: Create specific IOMMU node to be referred by virtio-mmio device
    
    Reuse generic IOMMU device tree bindings to communicate Xen specific
    information for the virtio devices for which the restricted memory
    access using Xen grant mappings need to be enabled.
    
    Insert "iommus" property pointed to the IOMMU node with "xen,grant-dma"
    compatible to all virtio devices which backends are going to run in
    non-hardware domains (which are non-trusted by default).
    
    Based on device-tree binding from Linux:
    Documentation/devicetree/bindings/iommu/xen,grant-dma.yaml
    
    The example of generated nodes:
    
    xen_iommu {
        compatible = "xen,grant-dma";
        #iommu-cells = <0x01>;
        phandle = <0xfde9>;
    };
    
    virtio@2000000 {
        compatible = "virtio,mmio";
        reg = <0x00 0x2000000 0x00 0x200>;
        interrupts = <0x00 0x01 0xf01>;
        interrupt-parent = <0xfde8>;
        dma-coherent;
        iommus = <0xfde9 0x01>;
    };
    
    virtio@2000200 {
        compatible = "virtio,mmio";
        reg = <0x00 0x2000200 0x00 0x200>;
        interrupts = <0x00 0x02 0xf01>;
        interrupt-parent = <0xfde8>;
        dma-coherent;
        iommus = <0xfde9 0x01>;
    };
    
    Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/libs/light/libxl_arm.c          | 49 ++++++++++++++++++++++++++++++++---
 xen/include/public/device_tree_defs.h |  3 ++-
 2 files changed, 48 insertions(+), 4 deletions(-)

diff --git a/tools/libs/light/libxl_arm.c b/tools/libs/light/libxl_arm.c
index 866e58c66b..1a3ac1646e 100644
--- a/tools/libs/light/libxl_arm.c
+++ b/tools/libs/light/libxl_arm.c
@@ -865,9 +865,32 @@ static int make_vpci_node(libxl__gc *gc, void *fdt,
     return 0;
 }
 
+static int make_xen_iommu_node(libxl__gc *gc, void *fdt)
+{
+    int res;
+
+    /* See Linux Documentation/devicetree/bindings/iommu/xen,grant-dma.yaml */
+    res = fdt_begin_node(fdt, "xen_iommu");
+    if (res) return res;
+
+    res = fdt_property_compat(gc, fdt, 1, "xen,grant-dma");
+    if (res) return res;
+
+    res = fdt_property_cell(fdt, "#iommu-cells", 1);
+    if (res) return res;
+
+    res = fdt_property_cell(fdt, "phandle", GUEST_PHANDLE_IOMMU);
+    if (res) return res;
+
+    res = fdt_end_node(fdt);
+    if (res) return res;
+
+    return 0;
+}
 
 static int make_virtio_mmio_node(libxl__gc *gc, void *fdt,
-                                 uint64_t base, uint32_t irq)
+                                 uint64_t base, uint32_t irq,
+                                 uint32_t backend_domid)
 {
     int res;
     gic_interrupt intr;
@@ -890,6 +913,16 @@ static int make_virtio_mmio_node(libxl__gc *gc, void *fdt,
     res = fdt_property(fdt, "dma-coherent", NULL, 0);
     if (res) return res;
 
+    if (backend_domid != LIBXL_TOOLSTACK_DOMID) {
+        uint32_t iommus_prop[2];
+
+        iommus_prop[0] = cpu_to_fdt32(GUEST_PHANDLE_IOMMU);
+        iommus_prop[1] = cpu_to_fdt32(backend_domid);
+
+        res = fdt_property(fdt, "iommus", iommus_prop, sizeof(iommus_prop));
+        if (res) return res;
+    }
+
     res = fdt_end_node(fdt);
     if (res) return res;
 
@@ -1097,6 +1130,7 @@ static int libxl__prepare_dtb(libxl__gc *gc, libxl_domain_config *d_config,
     size_t fdt_size = 0;
     int pfdt_size = 0;
     libxl_domain_build_info *const info = &d_config->b_info;
+    bool iommu_created;
     unsigned int i;
 
     const libxl_version_info *vers;
@@ -1204,11 +1238,20 @@ next_resize:
         if (d_config->num_pcidevs)
             FDT( make_vpci_node(gc, fdt, ainfo, dom) );
 
+        iommu_created = false;
         for (i = 0; i < d_config->num_disks; i++) {
             libxl_device_disk *disk = &d_config->disks[i];
 
-            if (disk->specification == LIBXL_DISK_SPECIFICATION_VIRTIO)
-                FDT( make_virtio_mmio_node(gc, fdt, disk->base, disk->irq) );
+            if (disk->specification == LIBXL_DISK_SPECIFICATION_VIRTIO) {
+                if (disk->backend_domid != LIBXL_TOOLSTACK_DOMID &&
+                    !iommu_created) {
+                    FDT( make_xen_iommu_node(gc, fdt) );
+                    iommu_created = true;
+                }
+
+                FDT( make_virtio_mmio_node(gc, fdt, disk->base, disk->irq,
+                                           disk->backend_domid) );
+            }
         }
 
         if (pfdt)
diff --git a/xen/include/public/device_tree_defs.h b/xen/include/public/device_tree_defs.h
index 209d43de3f..228daafe81 100644
--- a/xen/include/public/device_tree_defs.h
+++ b/xen/include/public/device_tree_defs.h
@@ -4,9 +4,10 @@
 #if defined(__XEN__) || defined(__XEN_TOOLS__)
 /*
  * The device tree compiler (DTC) is allocating the phandle from 1 to
- * onwards. Reserve a high value for the GIC phandle.
+ * onwards. Reserve high values for the specific phandles.
  */
 #define GUEST_PHANDLE_GIC (65000)
+#define GUEST_PHANDLE_IOMMU (GUEST_PHANDLE_GIC + 1)
 
 #define GUEST_ROOT_ADDRESS_CELLS 2
 #define GUEST_ROOT_SIZE_CELLS 2
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 04 16:44:34 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Aug 2022 16:44:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380603.614832 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJdxa-0000sE-59; Thu, 04 Aug 2022 16:44:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380603.614832; Thu, 04 Aug 2022 16: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 1oJdxa-0000s6-2Y; Thu, 04 Aug 2022 16:44:34 +0000
Received: by outflank-mailman (input) for mailman id 380603;
 Thu, 04 Aug 2022 16:44:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdxY-0000rq-FK
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:44:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdxY-0000Sz-E4
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdxY-0000Q9-DQ
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:44:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rrg5i4/mbEJ3R2L7KcD3ReEgSiMhCZRyg4AkTwKWnOE=; b=pWkxP4/87XtSfbwGY5xclAopvN
	ul6PfUt5hhPbncaOZeCd5lD+EqLJQ31Yd/d7n7BS0c5qzOv4WOswoj7oZlt/zUvYEGbrGA8sbmyT/
	Z1hbm8GniEKgvzeP+niHgUYSquS3RziAiALtcyx0ipJ09jGlF5wNdeoBW8BCumEpcInQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: Remove XEN_CONFIG_EXPERT leftovers
Message-Id: <E1oJdxY-0000Q9-DQ@xenbits.xenproject.org>
Date: Thu, 04 Aug 2022 16:44:32 +0000

commit 37339ba9ef46cf55e077ca50235279f058b01779
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Thu Jul 28 10:58:55 2022 +0300
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Thu Jul 28 16:02:48 2022 -0700

    automation: Remove XEN_CONFIG_EXPERT leftovers
    
    The EXPERT config option cannot anymore be selected via the environmental
    variable XEN_CONFIG_EXPERT. Remove stale references to XEN_CONFIG_EXPERT
    from the automation code.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/build/README.md      | 3 ---
 automation/scripts/build        | 4 ++--
 automation/scripts/containerize | 1 -
 3 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/automation/build/README.md b/automation/build/README.md
index 2137957408..00305eed03 100644
--- a/automation/build/README.md
+++ b/automation/build/README.md
@@ -65,9 +65,6 @@ understands.
 - CONTAINER_NO_PULL: If set to 1, the script will not pull from docker hub.
   This is useful when testing container locally.
 
-- XEN_CONFIG_EXPERT: If this is defined in your shell it will be
-  automatically passed through to the container.
-
 If your docker host has Linux kernel > 4.11, and you want to use containers
 that run old glibc (for example, CentOS 6 or SLES11SP4), you may need to add
 
diff --git a/automation/scripts/build b/automation/scripts/build
index 281f8b1fcc..21b3bc57c8 100755
--- a/automation/scripts/build
+++ b/automation/scripts/build
@@ -91,6 +91,6 @@ for cfg in `ls ${cfg_dir}`; do
     echo "Building $cfg"
     make -j$(nproc) -C xen clean
     rm -f xen/.config
-    make -C xen KBUILD_DEFCONFIG=../../../../${cfg_dir}/${cfg} XEN_CONFIG_EXPERT=y defconfig
-    make -j$(nproc) -C xen XEN_CONFIG_EXPERT=y
+    make -C xen KBUILD_DEFCONFIG=../../../../${cfg_dir}/${cfg} defconfig
+    make -j$(nproc) -C xen
 done
diff --git a/automation/scripts/containerize b/automation/scripts/containerize
index 8992c67278..9d4beca4fa 100755
--- a/automation/scripts/containerize
+++ b/automation/scripts/containerize
@@ -101,7 +101,6 @@ exec ${docker_cmd} run \
     -v "${CONTAINER_PATH}":/build:rw${selinux} \
     -v "${HOME}/.ssh":/root/.ssh:ro \
     ${SSH_AUTH_DIR:+-v "${SSH_AUTH_DIR}":/tmp/ssh-agent${selinux}} \
-    ${XEN_CONFIG_EXPERT:+-e XEN_CONFIG_EXPERT=${XEN_CONFIG_EXPERT}} \
     ${CONTAINER_ARGS} \
     -${termint}i --rm -- \
     ${CONTAINER} \
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 04 16:44:44 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Aug 2022 16:44:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380604.614836 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJdxk-0000v8-70; Thu, 04 Aug 2022 16:44:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380604.614836; Thu, 04 Aug 2022 16: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 1oJdxk-0000uz-4I; Thu, 04 Aug 2022 16:44:44 +0000
Received: by outflank-mailman (input) for mailman id 380604;
 Thu, 04 Aug 2022 16:44:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdxi-0000un-IC
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:44:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdxi-0000TA-HK
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:44:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdxi-0000Qr-GL
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:44:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=t/lcyb4/ipa8M/UYCd/lsGxNf/KKc7nvu63n2XAYzwI=; b=BU2SWs5p2xQwN7InkDKjBtJcc4
	nR0VwJySAYFpgA1oMJ9HzueNM6HzDWGFfpD/i90bJ1r2Y9pzPW1evZ0GFKzj1zAVjRmWsfjT1sXKz
	Bw+RfZI02qPX1FgBS+GkuDlcX5aMDAyCPF5ZUekybGHpjHeICqIe4LYzAewijRjIAwdo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: arm64: Create a test job for testing static allocation on qemu
Message-Id: <E1oJdxi-0000Qr-GL@xenbits.xenproject.org>
Date: Thu, 04 Aug 2022 16:44:42 +0000

commit 108e6f282d2c2b8442ac9e1487e6fd7865cd6ede
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Thu Jul 28 10:58:56 2022 +0300
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Thu Jul 28 16:17:46 2022 -0700

    automation: arm64: Create a test job for testing static allocation on qemu
    
    Enable CONFIG_STATIC_MEMORY in the existing arm64 build.
    
    Create a new test job, called qemu-smoke-arm64-gcc-staticmem.
    
    Adjust qemu-smoke-arm64.sh script to accomodate the static memory test as a
    new test variant. The test variant is determined based on the first argument
    passed to the script. For testing static memory, the argument is 'static-mem'.
    
    The test configures DOM1 with a static memory region and adds a check in the
    init script.
    The check consists in comparing the contents of the /proc/device-tree
    memory entry with the static memory range with which DOM1 was configured.
    If the memory layout is correct, a message gets printed by DOM1.
    
    At the end of the qemu run, the script searches for the specific message
    in the logs and fails if not found.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Penny Zheng <penny.zheng@arm.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/gitlab-ci/test.yaml         | 18 ++++++++++++++++++
 automation/scripts/build               | 10 +++++++++-
 automation/scripts/qemu-smoke-arm64.sh | 27 ++++++++++++++++++++++++++-
 3 files changed, 53 insertions(+), 2 deletions(-)

diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index 26bdbcc3ea..6f9f64a8da 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -80,6 +80,24 @@ qemu-smoke-arm64-gcc:
   tags:
     - arm64
 
+qemu-smoke-arm64-gcc-staticmem:
+  extends: .test-jobs-common
+  variables:
+    CONTAINER: debian:unstable-arm64v8
+  script:
+    - ./automation/scripts/qemu-smoke-arm64.sh static-mem 2>&1 | tee qemu-smoke-arm64.log
+  needs:
+    - debian-unstable-gcc-arm64
+    - kernel-5.9.9-arm64-export
+    - qemu-system-aarch64-6.0.0-arm64-export
+  artifacts:
+    paths:
+      - smoke.serial
+      - '*.log'
+    when: always
+  tags:
+    - arm64
+
 qemu-smoke-arm32-gcc:
   extends: .test-jobs-common
   variables:
diff --git a/automation/scripts/build b/automation/scripts/build
index 21b3bc57c8..2b9f2d2b54 100755
--- a/automation/scripts/build
+++ b/automation/scripts/build
@@ -15,7 +15,15 @@ if [[ "${RANDCONFIG}" == "y" ]]; then
     make -j$(nproc) -C xen KCONFIG_ALLCONFIG=tools/kconfig/allrandom.config randconfig
     hypervisor_only="y"
 else
-    make -j$(nproc) -C xen defconfig
+    if [[ "${XEN_TARGET_ARCH}" = "arm64" ]]; then
+        echo "
+CONFIG_EXPERT=y
+CONFIG_UNSUPPORTED=y
+CONFIG_STATIC_MEMORY=y" > xen/.config
+        make -j$(nproc) -C xen olddefconfig
+    else
+        make -j$(nproc) -C xen defconfig
+    fi
 fi
 
 # Save the config file before building because build failure causes the script
diff --git a/automation/scripts/qemu-smoke-arm64.sh b/automation/scripts/qemu-smoke-arm64.sh
index 53086a5ac7..898398196a 100755
--- a/automation/scripts/qemu-smoke-arm64.sh
+++ b/automation/scripts/qemu-smoke-arm64.sh
@@ -2,6 +2,25 @@
 
 set -ex
 
+test_variant=$1
+
+passed="BusyBox"
+check=""
+
+if [[ "${test_variant}" == "static-mem" ]]; then
+    # Memory range that is statically allocated to DOM1
+    domu_base="50000000"
+    domu_size="10000000"
+    passed="${test_variant} test passed"
+    check="
+current=\$(hexdump -e '16/1 \"%02x\"' /proc/device-tree/memory@${domu_base}/reg 2>/dev/null)
+expected=$(printf \"%016x%016x\" 0x${domu_base} 0x${domu_size})
+if [[ \"\${expected}\" == \"\${current}\" ]]; then
+	echo \"${passed}\"
+fi
+"
+fi
+
 # Install QEMU
 export DEBIAN_FRONTENT=noninteractive
 apt-get -qy update
@@ -43,6 +62,7 @@ echo "#!/bin/sh
 mount -t proc proc /proc
 mount -t sysfs sysfs /sys
 mount -t devtmpfs devtmpfs /dev
+${check}
 /bin/sh" > initrd/init
 chmod +x initrd/init
 cd initrd
@@ -68,6 +88,11 @@ DOMU_MEM[0]="256"
 LOAD_CMD="tftpb"
 UBOOT_SOURCE="boot.source"
 UBOOT_SCRIPT="boot.scr"' > binaries/config
+
+if [[ "${test_variant}" == "static-mem" ]]; then
+    echo -e "\nDOMU_STATIC_MEM[0]=\"0x${domu_base} 0x${domu_size}\"" >> binaries/config
+fi
+
 rm -rf imagebuilder
 git clone https://gitlab.com/ViryaOS/imagebuilder
 bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/config
@@ -89,5 +114,5 @@ timeout -k 1 240 \
     -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin |& tee smoke.serial
 
 set -e
-(grep -q "^BusyBox" smoke.serial && grep -q "DOM1: BusyBox" smoke.serial) || exit 1
+(grep -q "^BusyBox" smoke.serial && grep -q "DOM1: ${passed}" smoke.serial) || exit 1
 exit 0
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 04 16:44:54 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Aug 2022 16:44:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380605.614842 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJdxu-0000yS-9l; Thu, 04 Aug 2022 16:44:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380605.614842; Thu, 04 Aug 2022 16: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 1oJdxu-0000yK-5k; Thu, 04 Aug 2022 16:44:54 +0000
Received: by outflank-mailman (input) for mailman id 380605;
 Thu, 04 Aug 2022 16:44:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdxs-0000xx-Ld
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:44:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdxs-0000TO-Kc
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:44:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdxs-0000RK-K0
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:44:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xyVjqvILuYKH+UQ8hrxC58gzWZrOl/5TCnKGXLmT5k8=; b=hI1fbtWTp9qKEVLzeKLG7eapjV
	c6/ztC8FujG07bhGIr+rHv8MKuaRRIWaeRKEXUMvKhxlRywaI+qX5gUaO1MFPiye7Y++JCHifBfiD
	C5GaoPwg+rx1wNC1xR7+LdwTx9Qs8ZBGN7gl3/UK+qzEWv2iiDwf4uYjiJzxVMXsr6YA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: properly handle get_page() failing
Message-Id: <E1oJdxs-0000RK-K0@xenbits.xenproject.org>
Date: Thu, 04 Aug 2022 16:44:52 +0000

commit 3629759626ac7201a670a8a2d4d4a536e7443575
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jul 29 08:48:26 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jul 29 08:48:26 2022 +0200

    x86/shadow: properly handle get_page() failing
    
    We should not blindly (in a release build) insert the new entry in the
    hash if a reference to the guest page cannot be obtained, or else an
    excess reference would be put when removing the hash entry again. Crash
    the domain in that case instead. The sole caller doesn't further care
    about the state of the guest page: All it does is return the
    corresponding shadow page (which was obtained successfully before) to
    its caller.
    
    To compensate we further need to adjust hash removal: Since the shadow
    page already has had its backlink set, domain cleanup code would try to
    destroy the shadow, and hence still cause a put_page() without
    corresponding get_page(). Leverage that the failed get_page() leads to
    no hash insertion, making shadow_hash_delete() no longer assume it will
    find the requested entry. Instead return back whether the entry was
    found. This way delete_shadow_status() can avoid calling put_page() in
    the problem scenario.
    
    For the other caller of shadow_hash_delete() simply reinstate the
    otherwise dropped assertion at the call site.
    
    While touching the conditionals in {set,delete}_shadow_status() anyway,
    also switch around their two pre-existing parts, to have the cheap one
    first (frequently allowing to avoid evaluation of the expensive - due to
    evaluate_nospec() - one altogether).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/mm/shadow/common.c  | 10 ++++++----
 xen/arch/x86/mm/shadow/multi.c   |  8 +++++++-
 xen/arch/x86/mm/shadow/private.h | 19 ++++++++++---------
 3 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index c37c3bb077..0fd00a2f96 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -1581,7 +1581,7 @@ void shadow_hash_insert(struct domain *d, unsigned long n, unsigned int t,
     sh_hash_audit_bucket(d, key);
 }
 
-void shadow_hash_delete(struct domain *d, unsigned long n, unsigned int t,
+bool shadow_hash_delete(struct domain *d, unsigned long n, unsigned int t,
                         mfn_t smfn)
 /* Excise the mapping (n,t)->smfn from the hash table */
 {
@@ -1606,10 +1606,8 @@ void shadow_hash_delete(struct domain *d, unsigned long n, unsigned int t,
     {
         /* Need to search for the one we want */
         x = d->arch.paging.shadow.hash_table[key];
-        while ( 1 )
+        while ( x )
         {
-            ASSERT(x); /* We can't have hit the end, since our target is
-                        * still in the chain somehwere... */
             if ( next_shadow(x) == sp )
             {
                 x->next_shadow = sp->next_shadow;
@@ -1617,10 +1615,14 @@ void shadow_hash_delete(struct domain *d, unsigned long n, unsigned int t,
             }
             x = next_shadow(x);
         }
+        if ( !x )
+            return false;
     }
     set_next_shadow(sp, NULL);
 
     sh_hash_audit_bucket(d, key);
+
+    return true;
 }
 
 typedef int (*hash_vcpu_callback_t)(struct vcpu *v, mfn_t smfn, mfn_t other_mfn);
diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index b0b1c31ee0..869d7baed0 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -132,7 +132,13 @@ delete_fl1_shadow_status(struct domain *d, gfn_t gfn, mfn_t smfn)
     SHADOW_PRINTK("gfn=%"SH_PRI_gfn", type=%08x, smfn=%"PRI_mfn"\n",
                    gfn_x(gfn), SH_type_fl1_shadow, mfn_x(smfn));
     ASSERT(mfn_to_page(smfn)->u.sh.head);
-    shadow_hash_delete(d, gfn_x(gfn), SH_type_fl1_shadow, smfn);
+    if ( !shadow_hash_delete(d, gfn_x(gfn), SH_type_fl1_shadow, smfn) )
+    {
+        printk(XENLOG_G_ERR
+               "%pd: %"PRI_gfn":FL1 hash entry not found for %"PRI_mfn"\n",
+               d, gfn_x(gfn), mfn_x(smfn));
+        domain_crash(d);
+    }
 }
 
 
diff --git a/xen/arch/x86/mm/shadow/private.h b/xen/arch/x86/mm/shadow/private.h
index 3dc024e30f..3a74f45362 100644
--- a/xen/arch/x86/mm/shadow/private.h
+++ b/xen/arch/x86/mm/shadow/private.h
@@ -375,7 +375,7 @@ shadow_size(unsigned int shadow_type)
 mfn_t shadow_hash_lookup(struct domain *d, unsigned long n, unsigned int t);
 void  shadow_hash_insert(struct domain *d,
                          unsigned long n, unsigned int t, mfn_t smfn);
-void  shadow_hash_delete(struct domain *d,
+bool  shadow_hash_delete(struct domain *d,
                          unsigned long n, unsigned int t, mfn_t smfn);
 
 /* shadow promotion */
@@ -773,18 +773,19 @@ static inline void
 set_shadow_status(struct domain *d, mfn_t gmfn, u32 shadow_type, mfn_t smfn)
 /* Put a shadow into the hash table */
 {
-    int res;
-
     SHADOW_PRINTK("d%d gmfn=%lx, type=%08x, smfn=%lx\n",
                   d->domain_id, mfn_x(gmfn), shadow_type, mfn_x(smfn));
 
     ASSERT(mfn_to_page(smfn)->u.sh.head);
 
     /* 32-bit PV guests don't own their l4 pages so can't get_page them */
-    if ( !is_pv_32bit_domain(d) || shadow_type != SH_type_l4_64_shadow )
+    if ( (shadow_type != SH_type_l4_64_shadow || !is_pv_32bit_domain(d)) &&
+         !get_page(mfn_to_page(gmfn), d) )
     {
-        res = get_page(mfn_to_page(gmfn), d);
-        ASSERT(res == 1);
+        printk(XENLOG_G_ERR "%pd: cannot get page for MFN %" PRI_mfn "\n",
+               d, mfn_x(gmfn));
+        domain_crash(d);
+        return;
     }
 
     shadow_hash_insert(d, mfn_x(gmfn), shadow_type, smfn);
@@ -797,9 +798,9 @@ delete_shadow_status(struct domain *d, mfn_t gmfn, u32 shadow_type, mfn_t smfn)
     SHADOW_PRINTK("d%d gmfn=%"PRI_mfn", type=%08x, smfn=%"PRI_mfn"\n",
                   d->domain_id, mfn_x(gmfn), shadow_type, mfn_x(smfn));
     ASSERT(mfn_to_page(smfn)->u.sh.head);
-    shadow_hash_delete(d, mfn_x(gmfn), shadow_type, smfn);
-    /* 32-bit PV guests don't own their l4 pages; see set_shadow_status */
-    if ( !is_pv_32bit_domain(d) || shadow_type != SH_type_l4_64_shadow )
+    if ( shadow_hash_delete(d, mfn_x(gmfn), shadow_type, smfn) &&
+         /* 32-bit PV guests don't own their l4 pages; see set_shadow_status */
+         (shadow_type != SH_type_l4_64_shadow || !is_pv_32bit_domain(d)) )
         put_page(mfn_to_page(gmfn));
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 04 16:45:04 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Aug 2022 16:45:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380606.614845 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJdy4-00011c-Cz; Thu, 04 Aug 2022 16:45:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380606.614845; Thu, 04 Aug 2022 16: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 1oJdy4-00011U-96; Thu, 04 Aug 2022 16:45:04 +0000
Received: by outflank-mailman (input) for mailman id 380606;
 Thu, 04 Aug 2022 16:45:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdy2-000116-OW
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:45:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdy2-0000U6-Na
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:45:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdy2-0000S6-N3
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:45:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zHeX4CbQomiDq5M7QlmSnaBLUYO14Ylc6kNZje223C0=; b=sCsklefqgzeUA66KsCSkD/XhPb
	DznqyG8UbQUfQ9QTTReUbzZYZvNBOFa16cnMbBthMrY6+IdaHzRzBjYvZF7kVtYqSPUKc1pXu471r
	1IP6S+tjaWqFK6It/eYBAazHte7+QWp2/OR8SjwlTN5de9Ywb/emvNpYfFd+Iije7RWM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: exclude HVM-only code from sh_remove_shadows() when !HVM
Message-Id: <E1oJdy2-0000S6-N3@xenbits.xenproject.org>
Date: Thu, 04 Aug 2022 16:45:02 +0000

commit 8a3b89e4307da260675483bb86fc06cc62ed7c08
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jul 29 08:49:06 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jul 29 08:49:06 2022 +0200

    x86/shadow: exclude HVM-only code from sh_remove_shadows() when !HVM
    
    In my (debug) build this amounts to well over 500 bytes of dead code.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/mm/shadow/common.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index 0fd00a2f96..ca4afb74e4 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -2240,10 +2240,12 @@ void sh_remove_shadows(struct domain *d, mfn_t gmfn, int fast, int all)
     }                                                                   \
 } while (0)
 
+#ifdef CONFIG_HVM
     DO_UNSHADOW(SH_type_l2_32_shadow);
     DO_UNSHADOW(SH_type_l1_32_shadow);
     DO_UNSHADOW(SH_type_l2_pae_shadow);
     DO_UNSHADOW(SH_type_l1_pae_shadow);
+#endif
     DO_UNSHADOW(SH_type_l4_64_shadow);
     DO_UNSHADOW(SH_type_l3_64_shadow);
     DO_UNSHADOW(SH_type_l2h_64_shadow);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 04 16:45:14 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Aug 2022 16:45:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380607.614849 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJdyE-00014O-E1; Thu, 04 Aug 2022 16:45:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380607.614849; Thu, 04 Aug 2022 16:45:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJdyE-00014G-Aq; Thu, 04 Aug 2022 16:45:14 +0000
Received: by outflank-mailman (input) for mailman id 380607;
 Thu, 04 Aug 2022 16:45:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdyC-000145-S5
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:45:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdyC-0000UG-RD
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:45:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdyC-0000Sc-QT
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:45:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=gpVETBbCFtGke7WYVIQTCtNg3b2WWtwsgiTDYi2Y19M=; b=Wj/HivtATqzf8gsuqqo5ViST9x
	cURdwGnlIzG50x0bfI9zi0IfKf6PwOYhdAXKCTGsKSlSCv+wqnPzZya/pJ439RBVLPM8c0k53aWTo
	K0KCsZqFqdjv1jIK3sjdhybGRcZV1efSb+U4394Aq05ulYfwtc1K4l6bZlWgYVXIIN00=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: don't open-code shadow_remove_all_shadows()
Message-Id: <E1oJdyC-0000Sc-QT@xenbits.xenproject.org>
Date: Thu, 04 Aug 2022 16:45:12 +0000

commit 5b04fe78646a8222626996113c9d1e598cb84831
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jul 29 08:49:48 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jul 29 08:49:48 2022 +0200

    x86/shadow: don't open-code shadow_remove_all_shadows()
    
    Let's use the existing inline wrapper instead of repeating respective
    commentary at every site.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/mm/shadow/common.c | 2 +-
 xen/arch/x86/mm/shadow/hvm.c    | 2 +-
 xen/arch/x86/mm/shadow/multi.c  | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index ca4afb74e4..0247f0c84e 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -389,7 +389,7 @@ static int oos_remove_write_access(struct vcpu *v, mfn_t gmfn,
          * the page.  If that doesn't work either, the guest is granting
          * his pagetables and must be killed after all.
          * This will flush the tlb, so we can return with no worries. */
-        sh_remove_shadows(d, gmfn, 0 /* Be thorough */, 1 /* Must succeed */);
+        shadow_remove_all_shadows(d, gmfn);
         return 1;
     }
 
diff --git a/xen/arch/x86/mm/shadow/hvm.c b/xen/arch/x86/mm/shadow/hvm.c
index 27dd99f1a1..9438a1a7ad 100644
--- a/xen/arch/x86/mm/shadow/hvm.c
+++ b/xen/arch/x86/mm/shadow/hvm.c
@@ -783,7 +783,7 @@ sh_remove_all_shadows_and_parents(struct domain *d, mfn_t gmfn)
 /* Even harsher: this is a HVM page that we thing is no longer a pagetable.
  * Unshadow it, and recursively unshadow pages that reference it. */
 {
-    sh_remove_shadows(d, gmfn, 0, 1);
+    shadow_remove_all_shadows(d, gmfn);
     /* XXX TODO:
      * Rework this hashtable walker to return a linked-list of all
      * the shadows it modified, then do breadth-first recursion
diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index 869d7baed0..8626cebc3d 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -2637,7 +2637,7 @@ static int cf_check sh_page_fault(
         SHADOW_PRINTK("user-mode fault to PT, unshadowing mfn %#lx\n",
                       mfn_x(gmfn));
         perfc_incr(shadow_fault_emulate_failed);
-        sh_remove_shadows(d, gmfn, 0 /* thorough */, 1 /* must succeed */);
+        shadow_remove_all_shadows(d, gmfn);
         trace_shadow_emulate_other(TRC_SHADOW_EMULATE_UNSHADOW_USER,
                                       va, gfn);
         goto done;
@@ -2723,7 +2723,7 @@ static int cf_check sh_page_fault(
             v->arch.paging.last_write_emul_ok = 0;
         }
 #endif
-        sh_remove_shadows(d, gmfn, 0 /* thorough */, 1 /* must succeed */);
+        shadow_remove_all_shadows(d, gmfn);
         trace_shadow_emulate_other(TRC_SHADOW_EMULATE_UNSHADOW_EVTINJ,
                                    va, gfn);
         return EXCRET_fault_fixed;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 04 16:45:24 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Aug 2022 16:45:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380608.614852 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJdyO-00016j-F7; Thu, 04 Aug 2022 16:45:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380608.614852; Thu, 04 Aug 2022 16:45: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 1oJdyO-00016b-CN; Thu, 04 Aug 2022 16:45:24 +0000
Received: by outflank-mailman (input) for mailman id 380608;
 Thu, 04 Aug 2022 16:45:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdyM-00016Q-VM
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:45:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdyM-0000VU-UV
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:45:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdyM-0000T1-Ti
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:45:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=mlwofkrsymhgowft4k417c8bSyQ97yYy9w57De7I+qQ=; b=kWEymJUrJHVN2Nzkf0C97O6T2T
	F18fJ6nR+kByAWBLOZiF0JWC5HE6dGAnoC5062AYjTyNW167fDd2Lv6sBgWEwnKzMJYrzO9Flb5GV
	abSlDgdnpcagZF7fgraLjDi0S161DPPF4SNe3Mz7P7bXqgLEByRln3Bc7Z9SeuQ0X4Z8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: drop CONFIG_HVM conditionals from sh_update_cr3()
Message-Id: <E1oJdyM-0000T1-Ti@xenbits.xenproject.org>
Date: Thu, 04 Aug 2022 16:45:22 +0000

commit 9ff3231f955cee4d62c7be6a03d061c037d7ca69
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jul 29 08:50:25 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jul 29 08:50:25 2022 +0200

    x86/shadow: drop CONFIG_HVM conditionals from sh_update_cr3()
    
    Now that we're not building multi.c anymore for 2 and 3 guest levels
    when !HVM, there's no point in having these conditionals anymore. (As
    somewhat a special case, the last of the removed conditionals really
    builds on shadow_mode_external() always returning false when !HVM.) This
    way the code becomes a tiny bit more readable.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/mm/shadow/multi.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index 8626cebc3d..e10de449f1 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -3233,7 +3233,7 @@ static void cf_check sh_update_cr3(struct vcpu *v, int do_locking, bool noflush)
 {
     struct domain *d = v->domain;
     mfn_t gmfn;
-#if GUEST_PAGING_LEVELS == 3 && defined(CONFIG_HVM)
+#if GUEST_PAGING_LEVELS == 3
     const guest_l3e_t *gl3e;
     unsigned int i, guest_idx;
 #endif
@@ -3284,7 +3284,7 @@ static void cf_check sh_update_cr3(struct vcpu *v, int do_locking, bool noflush)
 #endif
         gmfn = pagetable_get_mfn(v->arch.guest_table);
 
-#if GUEST_PAGING_LEVELS == 3 && defined(CONFIG_HVM)
+#if GUEST_PAGING_LEVELS == 3
     /*
      * On PAE guests we don't use a mapping of the guest's own top-level
      * table.  We cache the current state of that table and shadow that,
@@ -3326,8 +3326,6 @@ static void cf_check sh_update_cr3(struct vcpu *v, int do_locking, bool noflush)
                   !VM_ASSIST(d, m2p_strict) )
             fill_ro_mpt(smfn);
     }
-#elif !defined(CONFIG_HVM)
-    ASSERT_UNREACHABLE();
 #elif GUEST_PAGING_LEVELS == 3
     /* PAE guests have four shadow_table entries, based on the
      * current values of the guest's four l3es. */
@@ -3378,8 +3376,6 @@ static void cf_check sh_update_cr3(struct vcpu *v, int do_locking, bool noflush)
 #error This should never happen
 #endif
 
-
-#ifdef CONFIG_HVM
     ///
     /// v->arch.paging.shadow.l3table
     ///
@@ -3405,7 +3401,6 @@ static void cf_check sh_update_cr3(struct vcpu *v, int do_locking, bool noflush)
             }
         }
 #endif /* SHADOW_PAGING_LEVELS == 3 */
-#endif /* CONFIG_HVM */
 
     ///
     /// v->arch.cr3
@@ -3424,8 +3419,6 @@ static void cf_check sh_update_cr3(struct vcpu *v, int do_locking, bool noflush)
     }
 #endif
 
-
-#ifdef CONFIG_HVM
     ///
     /// v->arch.hvm.hw_cr[3]
     ///
@@ -3442,7 +3435,6 @@ static void cf_check sh_update_cr3(struct vcpu *v, int do_locking, bool noflush)
 #endif
         hvm_update_guest_cr3(v, noflush);
     }
-#endif /* CONFIG_HVM */
 
     /* Fix up the linear pagetable mappings */
     sh_update_linear_entries(v);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 04 16:45:34 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Aug 2022 16:45:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380609.614856 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJdyY-00019s-GY; Thu, 04 Aug 2022 16:45:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380609.614856; Thu, 04 Aug 2022 16:45: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 1oJdyY-00019k-Do; Thu, 04 Aug 2022 16:45:34 +0000
Received: by outflank-mailman (input) for mailman id 380609;
 Thu, 04 Aug 2022 16:45:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdyX-00019S-24
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:45:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdyX-0000WK-1B
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:45:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdyX-0000Ts-0W
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:45:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=TdwRPZXaJXhd0s3+JV2ssAFyf1K0jW71/Fg1FTEKGA8=; b=lxGGxPnbjxR1Eu9X0T1EG0JPLW
	7SYA1SVqqu6ERoQv7xZUyELEvupfawTAMsQ1B9UXc/4LGWixPT0WntDJPc5CXEKUlKNwvFgxTJYkx
	UX+Y7vIaCGHQMnFsKyefvQ7TkINqDC0AKL1Dacq7z+U6+yN/RC+pqHbN5HCobxJW1nXA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xsm/dummy: fix MISRA C 2012 Directive 4.10 violation
Message-Id: <E1oJdyX-0000Ts-0W@xenbits.xenproject.org>
Date: Thu, 04 Aug 2022 16:45:33 +0000

commit 124f138b37d595294b3100349e26ffb3f1df7b13
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Fri Jul 29 08:50:58 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jul 29 08:50:58 2022 +0200

    xsm/dummy: fix MISRA C 2012 Directive 4.10 violation
    
    Protect header file from being included more than once by adding ifndef guard.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/include/xsm/dummy.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h
index 77f27e7163..8671af1ba4 100644
--- a/xen/include/xsm/dummy.h
+++ b/xen/include/xsm/dummy.h
@@ -15,6 +15,9 @@
  *  value of action.
  */
 
+#ifndef __XEN_XSM_DUMMY_H__
+#define __XEN_XSM_DUMMY_H__
+
 #include <xen/sched.h>
 #include <xsm/xsm.h>
 #include <public/hvm/params.h>
@@ -843,3 +846,5 @@ static XSM_INLINE int cf_check xsm_domain_resource_map(
     XSM_ASSERT_ACTION(XSM_DM_PRIV);
     return xsm_default_action(action, current->domain, d);
 }
+
+#endif /* __XEN_XSM_DUMMY_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 04 16:45:44 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Aug 2022 16:45:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380610.614859 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJdyi-0001E8-Hm; Thu, 04 Aug 2022 16:45:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380610.614859; Thu, 04 Aug 2022 16:45: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 1oJdyi-0001E1-FI; Thu, 04 Aug 2022 16:45:44 +0000
Received: by outflank-mailman (input) for mailman id 380610;
 Thu, 04 Aug 2022 16:45:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdyh-0001D3-53
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:45:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdyh-0000WV-47
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:45:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdyh-0000UN-3R
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:45:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=2fVGzlZovCOcyWTWqGEx9iFdJ2B9gl3nkhOalo4P8D8=; b=bxaqxxESicxfSGyFrZVBaW9s3T
	aOQU1XF16ngJl1CisRc9Zav33w767q8y5C+R1oa+RvQkXfO7+rqPHF02jHUQ1DYgRius6nWcXLNKd
	PzGGXN3MEKpAM3uQotLguuplzLCRbRmYrUmaM4Qe7tYyuxfYn/DZ6UF2kzd2OzpMOZXc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] arm/atomic: fix MISRA C 2012 Rule 20.7 violation
Message-Id: <E1oJdyh-0000UN-3R@xenbits.xenproject.org>
Date: Thu, 04 Aug 2022 16:45:43 +0000

commit 062790aca6b1faea62c9ed2737c3791efb0d0f4c
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Fri Jul 29 08:51:31 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jul 29 08:51:31 2022 +0200

    arm/atomic: fix MISRA C 2012 Rule 20.7 violation
    
    The macro parameter 'p' is used as an expression and needs to be enclosed in
    parentheses.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/include/asm/atomic.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/include/asm/atomic.h b/xen/arch/arm/include/asm/atomic.h
index ac2798d095..1f60c28b1b 100644
--- a/xen/arch/arm/include/asm/atomic.h
+++ b/xen/arch/arm/include/asm/atomic.h
@@ -123,15 +123,15 @@ static always_inline void write_atomic_size(volatile void *p,
 }
 
 #define read_atomic(p) ({                                               \
-    union { typeof(*p) val; char c[0]; } x_;                            \
-    read_atomic_size(p, x_.c, sizeof(*p));                              \
+    union { typeof(*(p)) val; char c[0]; } x_;                          \
+    read_atomic_size(p, x_.c, sizeof(*(p)));                            \
     x_.val;                                                             \
 })
 
 #define write_atomic(p, x)                                              \
     do {                                                                \
-        typeof(*p) x_ = (x);                                            \
-        write_atomic_size(p, &x_, sizeof(*p));                          \
+        typeof(*(p)) x_ = (x);                                          \
+        write_atomic_size(p, &x_, sizeof(*(p)));                        \
     } while ( false )
 
 #define add_sized(p, x) ({                                              \
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 04 16:45:54 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Aug 2022 16:45:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380611.614864 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJdys-0001Gi-JP; Thu, 04 Aug 2022 16:45:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380611.614864; Thu, 04 Aug 2022 16:45: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 1oJdys-0001Ga-Go; Thu, 04 Aug 2022 16:45:54 +0000
Received: by outflank-mailman (input) for mailman id 380611;
 Thu, 04 Aug 2022 16:45:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdyr-0001GN-7v
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:45:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdyr-0000Wh-70
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:45:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdyr-0000Uo-6T
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:45:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BS2bTM2fni+B1jm7sIMxHjPL+WixkEH2m7wViICf8Qk=; b=4PPNYGgqndUZ/2tJdAyxegxBoP
	b9rjW1PpdsznQD9dH2i0UgSE6WdxHj1BetBOtN2s2mm/6Nmcb2zpbVjVP7EiAf1EKuZ0+LI5nqbqK
	PuLTTX3KTzZd4sdlogY0cG0WFhjZfbJ085NKY0R+YQmmvW3Mz21A6UmN5pqfEzmolOR4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: Remove most of the *_VIRT_END defines
Message-Id: <E1oJdyr-0000Uo-6T@xenbits.xenproject.org>
Date: Thu, 04 Aug 2022 16:45:53 +0000

commit 6dc9a1fe982f52c709ed03df8fdc6d58c4d96826
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Fri Jul 29 22:41:43 2022 +0100
Commit:     Julien Grall <julien@xen.org>
CommitDate: Fri Jul 29 23:03:22 2022 +0100

    xen/arm: Remove most of the *_VIRT_END defines
    
    At the moment, *_VIRT_END may either point to the address after the end
    or the last address of the region.
    
    The lack of consistency make quite difficult to reason with them.
    
    Furthermore, there is a risk of overflow in the case where the address
    points past to the end. I am not aware of any cases, so this is only a
    latent bug.
    
    Start to solve the problem by removing all the *_VIRT_END exclusively used
    by the Arm code and add *_VIRT_SIZE when it is not present.
    
    Take the opportunity to rename BOOT_FDT_SLOT_SIZE to BOOT_FDT_VIRT_SIZE
    for better consistency and use _AT(vaddr_t, ).
    
    Also take the opportunity to fix the coding style of the comment touched
    in mm.c.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Tested-By: Luca Fancellu <luca.fancellu@arm.com>
---
 xen/arch/arm/include/asm/config.h | 18 ++++++++----------
 xen/arch/arm/livepatch.c          |  2 +-
 xen/arch/arm/mm.c                 | 13 ++++++++-----
 3 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/xen/arch/arm/include/asm/config.h b/xen/arch/arm/include/asm/config.h
index 3e2a55a910..66db618b34 100644
--- a/xen/arch/arm/include/asm/config.h
+++ b/xen/arch/arm/include/asm/config.h
@@ -111,12 +111,11 @@
 #define FIXMAP_ADDR(n)        (_AT(vaddr_t,0x00400000) + (n) * PAGE_SIZE)
 
 #define BOOT_FDT_VIRT_START    _AT(vaddr_t,0x00600000)
-#define BOOT_FDT_SLOT_SIZE     MB(4)
-#define BOOT_FDT_VIRT_END      (BOOT_FDT_VIRT_START + BOOT_FDT_SLOT_SIZE)
+#define BOOT_FDT_VIRT_SIZE     _AT(vaddr_t, MB(4))
 
 #ifdef CONFIG_LIVEPATCH
 #define LIVEPATCH_VMAP_START   _AT(vaddr_t,0x00a00000)
-#define LIVEPATCH_VMAP_END     (LIVEPATCH_VMAP_START + MB(2))
+#define LIVEPATCH_VMAP_SIZE    _AT(vaddr_t, MB(2))
 #endif
 
 #define HYPERVISOR_VIRT_START  XEN_VIRT_START
@@ -132,18 +131,18 @@
 #define FRAMETABLE_VIRT_END    (FRAMETABLE_VIRT_START + FRAMETABLE_SIZE - 1)
 
 #define VMAP_VIRT_START        _AT(vaddr_t,0x10000000)
+#define VMAP_VIRT_SIZE         _AT(vaddr_t, GB(1) - MB(256))
 
 #define XENHEAP_VIRT_START     _AT(vaddr_t,0x40000000)
-#define XENHEAP_VIRT_END       _AT(vaddr_t,0x7fffffff)
-#define DOMHEAP_VIRT_START     _AT(vaddr_t,0x80000000)
-#define DOMHEAP_VIRT_END       _AT(vaddr_t,0xffffffff)
+#define XENHEAP_VIRT_SIZE      _AT(vaddr_t, GB(1))
 
-#define VMAP_VIRT_END    XENHEAP_VIRT_START
+#define DOMHEAP_VIRT_START     _AT(vaddr_t,0x80000000)
+#define DOMHEAP_VIRT_SIZE      _AT(vaddr_t, GB(2))
 
 #define DOMHEAP_ENTRIES        1024  /* 1024 2MB mapping slots */
 
 /* Number of domheap pagetable pages required at the second level (2MB mappings) */
-#define DOMHEAP_SECOND_PAGES ((DOMHEAP_VIRT_END - DOMHEAP_VIRT_START + 1) >> FIRST_SHIFT)
+#define DOMHEAP_SECOND_PAGES (DOMHEAP_VIRT_SIZE >> FIRST_SHIFT)
 
 #else /* ARM_64 */
 
@@ -152,12 +151,11 @@
 #define SLOT0_ENTRY_SIZE  SLOT0(1)
 
 #define VMAP_VIRT_START  GB(1)
-#define VMAP_VIRT_END    (VMAP_VIRT_START + GB(1))
+#define VMAP_VIRT_SIZE   GB(1)
 
 #define FRAMETABLE_VIRT_START  GB(32)
 #define FRAMETABLE_SIZE        GB(32)
 #define FRAMETABLE_NR          (FRAMETABLE_SIZE / sizeof(*frame_table))
-#define FRAMETABLE_VIRT_END    (FRAMETABLE_VIRT_START + FRAMETABLE_SIZE - 1)
 
 #define DIRECTMAP_VIRT_START   SLOT0(256)
 #define DIRECTMAP_SIZE         (SLOT0_ENTRY_SIZE * (265-256))
diff --git a/xen/arch/arm/livepatch.c b/xen/arch/arm/livepatch.c
index 75e8adcfd6..57abc746e6 100644
--- a/xen/arch/arm/livepatch.c
+++ b/xen/arch/arm/livepatch.c
@@ -175,7 +175,7 @@ void __init arch_livepatch_init(void)
     void *start, *end;
 
     start = (void *)LIVEPATCH_VMAP_START;
-    end = (void *)LIVEPATCH_VMAP_END;
+    end = start + LIVEPATCH_VMAP_SIZE;
 
     vm_init_type(VMAP_XEN, start, end);
 
diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 56fd084586..0177bc6b34 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -128,9 +128,11 @@ static DEFINE_PAGE_TABLE(xen_first);
 /* xen_pgtable == root of the trie (zeroeth level on 64-bit, first on 32-bit) */
 static DEFINE_PER_CPU(lpae_t *, xen_pgtable);
 #define THIS_CPU_PGTABLE this_cpu(xen_pgtable)
-/* xen_dommap == pages used by map_domain_page, these pages contain
+/*
+ * xen_dommap == pages used by map_domain_page, these pages contain
  * the second level pagetables which map the domheap region
- * DOMHEAP_VIRT_START...DOMHEAP_VIRT_END in 2MB chunks. */
+ * starting at DOMHEAP_VIRT_START in 2MB chunks.
+ */
 static DEFINE_PER_CPU(lpae_t *, xen_dommap);
 /* Root of the trie for cpu0, other CPU's PTs are dynamically allocated */
 static DEFINE_PAGE_TABLE(cpu0_pgtable);
@@ -476,7 +478,7 @@ mfn_t domain_page_map_to_mfn(const void *ptr)
     int slot = (va - DOMHEAP_VIRT_START) >> SECOND_SHIFT;
     unsigned long offset = (va>>THIRD_SHIFT) & XEN_PT_LPAE_ENTRY_MASK;
 
-    if ( va >= VMAP_VIRT_START && va < VMAP_VIRT_END )
+    if ( (va >= VMAP_VIRT_START) && ((va - VMAP_VIRT_START) < VMAP_VIRT_SIZE) )
         return virt_to_mfn(va);
 
     ASSERT(slot >= 0 && slot < DOMHEAP_ENTRIES);
@@ -570,7 +572,8 @@ void __init remove_early_mappings(void)
     int rc;
 
     /* destroy the _PAGE_BLOCK mapping */
-    rc = modify_xen_mappings(BOOT_FDT_VIRT_START, BOOT_FDT_VIRT_END,
+    rc = modify_xen_mappings(BOOT_FDT_VIRT_START,
+                             BOOT_FDT_VIRT_START + BOOT_FDT_VIRT_SIZE,
                              _PAGE_BLOCK);
     BUG_ON(rc);
 }
@@ -850,7 +853,7 @@ void __init setup_frametable_mappings(paddr_t ps, paddr_t pe)
 
 void *__init arch_vmap_virt_end(void)
 {
-    return (void *)VMAP_VIRT_END;
+    return (void *)(VMAP_VIRT_START + VMAP_VIRT_SIZE);
 }
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 04 16:46:04 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Aug 2022 16:46:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380612.614868 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJdz2-0001Jr-La; Thu, 04 Aug 2022 16:46:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380612.614868; Thu, 04 Aug 2022 16:46: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 1oJdz2-0001Jk-IX; Thu, 04 Aug 2022 16:46:04 +0000
Received: by outflank-mailman (input) for mailman id 380612;
 Thu, 04 Aug 2022 16:46:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdz1-0001JZ-Av
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:46:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdz1-0000X2-A5
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:46:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdz1-0000VV-9T
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:46:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=RbhzH0fmgg1wBvWkDT0V7174yXTK0Qrm5KkEUqCVoks=; b=GtbVeEPYEvnY+OiyOODYeq5rVc
	PjtR6PXAV+SioryjZw0k5FJc+2vsQopMt5BgdN2qWx/oihMDSfQkjh5TpczlTdpbDEYC/FhedxJIW
	Y8BDdp1MejLNAnNgSZ3ZrfvG0EcbGB/CzdJqq951WVPvu2I5Ki6mgEW6Bi1mglQLd7LE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm32: mm: Consolidate the domheap mappings initialization
Message-Id: <E1oJdz1-0000VV-9T@xenbits.xenproject.org>
Date: Thu, 04 Aug 2022 16:46:03 +0000

commit 04248b82f9621c511f3d5502ce74df7122ed157e
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Fri Jul 29 22:48:16 2022 +0100
Commit:     Julien Grall <julien@xen.org>
CommitDate: Fri Jul 29 23:03:22 2022 +0100

    xen/arm32: mm: Consolidate the domheap mappings initialization
    
    At the moment, the domheap mappings initialization is done separately for
    the boot CPU and secondary CPUs. The main difference is for the former
    the pages are part of Xen binary whilst for the latter they are
    dynamically allocated.
    
    It would be good to have a single helper so it is easier to rework
    on the domheap is initialized.
    
    For CPU0, we still need to use pre-allocated pages because the
    allocators may use domain_map_page(), so we need to have the domheap
    area ready first. But we can still delay the initialization to setup_mm().
    
    Introduce a new helper init_domheap_mappings() that will be called
    from setup_mm() for the boot CPU and from init_secondary_pagetables()
    for secondary CPUs.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Tested-by: Luca Fancellu <luca.fancellu@arm.com>
---
 xen/arch/arm/include/asm/arm32/mm.h |  2 +
 xen/arch/arm/mm.c                   | 92 ++++++++++++++++++++++++-------------
 xen/arch/arm/setup.c                |  8 ++++
 3 files changed, 71 insertions(+), 31 deletions(-)

diff --git a/xen/arch/arm/include/asm/arm32/mm.h b/xen/arch/arm/include/asm/arm32/mm.h
index 6b039d9cea..575373aeb9 100644
--- a/xen/arch/arm/include/asm/arm32/mm.h
+++ b/xen/arch/arm/include/asm/arm32/mm.h
@@ -10,6 +10,8 @@ static inline bool arch_mfns_in_directmap(unsigned long mfn, unsigned long nr)
     return false;
 }
 
+bool init_domheap_mappings(unsigned int cpu);
+
 #endif /* __ARM_ARM32_MM_H__ */
 
 /*
diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 0177bc6b34..a36f047f50 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -372,6 +372,58 @@ void clear_fixmap(unsigned int map)
 }
 
 #ifdef CONFIG_DOMAIN_PAGE
+/*
+ * Prepare the area that will be used to map domheap pages. They are
+ * mapped in 2MB chunks, so we need to allocate the page-tables up to
+ * the 2nd level.
+ *
+ * The caller should make sure the root page-table for @cpu has been
+ * allocated.
+ */
+bool init_domheap_mappings(unsigned int cpu)
+{
+    unsigned int order = get_order_from_pages(DOMHEAP_SECOND_PAGES);
+    lpae_t *root = per_cpu(xen_pgtable, cpu);
+    unsigned int i, first_idx;
+    lpae_t *domheap;
+    mfn_t mfn;
+
+    ASSERT(root);
+    ASSERT(!per_cpu(xen_dommap, cpu));
+
+    /*
+     * The domheap for cpu0 is initialized before the heap is initialized.
+     * So we need to use pre-allocated pages.
+     */
+    if ( !cpu )
+        domheap = cpu0_dommap;
+    else
+        domheap = alloc_xenheap_pages(order, 0);
+
+    if ( !domheap )
+        return false;
+
+    /* Ensure the domheap has no stray mappings */
+    memset(domheap, 0, DOMHEAP_SECOND_PAGES * PAGE_SIZE);
+
+    /*
+     * Update the first level mapping to reference the local CPUs
+     * domheap mapping pages.
+     */
+    mfn = virt_to_mfn(domheap);
+    first_idx = first_table_offset(DOMHEAP_VIRT_START);
+    for ( i = 0; i < DOMHEAP_SECOND_PAGES; i++ )
+    {
+        lpae_t pte = mfn_to_xen_entry(mfn_add(mfn, i), MT_NORMAL);
+        pte.pt.table = 1;
+        write_pte(&root[first_idx + i], pte);
+    }
+
+    per_cpu(xen_dommap, cpu) = domheap;
+
+    return true;
+}
+
 void *map_domain_page_global(mfn_t mfn)
 {
     return vmap(&mfn, 1);
@@ -633,16 +685,6 @@ void __init setup_pagetables(unsigned long boot_phys_offset)
         p[i].pt.xn = 0;
     }
 
-#ifdef CONFIG_ARM_32
-    for ( i = 0; i < DOMHEAP_SECOND_PAGES; i++ )
-    {
-        p[first_table_offset(DOMHEAP_VIRT_START+i*FIRST_SIZE)]
-            = pte_of_xenaddr((uintptr_t)(cpu0_dommap +
-                                         i * XEN_PT_LPAE_ENTRIES));
-        p[first_table_offset(DOMHEAP_VIRT_START+i*FIRST_SIZE)].pt.table = 1;
-    }
-#endif
-
     /* Break up the Xen mapping into 4k pages and protect them separately. */
     for ( i = 0; i < XEN_PT_LPAE_ENTRIES; i++ )
     {
@@ -686,7 +728,6 @@ void __init setup_pagetables(unsigned long boot_phys_offset)
 
 #ifdef CONFIG_ARM_32
     per_cpu(xen_pgtable, 0) = cpu0_pgtable;
-    per_cpu(xen_dommap, 0) = cpu0_dommap;
 #endif
 }
 
@@ -719,39 +760,28 @@ int init_secondary_pagetables(int cpu)
 #else
 int init_secondary_pagetables(int cpu)
 {
-    lpae_t *first, *domheap, pte;
-    int i;
+    lpae_t *first;
 
     first = alloc_xenheap_page(); /* root == first level on 32-bit 3-level trie */
-    domheap = alloc_xenheap_pages(get_order_from_pages(DOMHEAP_SECOND_PAGES), 0);
 
-    if ( domheap == NULL || first == NULL )
+    if ( !first )
     {
-        printk("Not enough free memory for secondary CPU%d pagetables\n", cpu);
-        free_xenheap_pages(domheap, get_order_from_pages(DOMHEAP_SECOND_PAGES));
-        free_xenheap_page(first);
+        printk("CPU%u: Unable to allocate the first page-table\n", cpu);
         return -ENOMEM;
     }
 
     /* Initialise root pagetable from root of boot tables */
     memcpy(first, cpu0_pgtable, PAGE_SIZE);
+    per_cpu(xen_pgtable, cpu) = first;
 
-    /* Ensure the domheap has no stray mappings */
-    memset(domheap, 0, DOMHEAP_SECOND_PAGES*PAGE_SIZE);
-
-    /* Update the first level mapping to reference the local CPUs
-     * domheap mapping pages. */
-    for ( i = 0; i < DOMHEAP_SECOND_PAGES; i++ )
+    if ( !init_domheap_mappings(cpu) )
     {
-        pte = mfn_to_xen_entry(virt_to_mfn(domheap + i * XEN_PT_LPAE_ENTRIES),
-                               MT_NORMAL);
-        pte.pt.table = 1;
-        write_pte(&first[first_table_offset(DOMHEAP_VIRT_START+i*FIRST_SIZE)], pte);
+        printk("CPU%u: Unable to prepare the domheap page-tables\n", cpu);
+        per_cpu(xen_pgtable, cpu) = NULL;
+        free_xenheap_page(first);
+        return -ENOMEM;
     }
 
-    per_cpu(xen_pgtable, cpu) = first;
-    per_cpu(xen_dommap, cpu) = domheap;
-
     clear_boot_pagetables();
 
     /* Set init_ttbr for this CPU coming up */
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 85ff956ec2..068e84b103 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -783,6 +783,14 @@ static void __init setup_mm(void)
     setup_frametable_mappings(ram_start, ram_end);
     max_page = PFN_DOWN(ram_end);
 
+    /*
+     * The allocators may need to use map_domain_page() (such as for
+     * scrubbing pages). So we need to prepare the domheap area first.
+     */
+    if ( !init_domheap_mappings(smp_processor_id()) )
+        panic("CPU%u: Unable to prepare the domheap page-tables\n",
+              smp_processor_id());
+
     /* Add xenheap memory that was not already added to the boot allocator. */
     init_xenheap_pages(mfn_to_maddr(xenheap_mfn_start),
                        mfn_to_maddr(xenheap_mfn_end));
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 04 16:46:14 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Aug 2022 16:46:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380613.614872 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJdzC-0001NN-Pm; Thu, 04 Aug 2022 16:46:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380613.614872; Thu, 04 Aug 2022 16:46: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 1oJdzC-0001NF-N5; Thu, 04 Aug 2022 16:46:14 +0000
Received: by outflank-mailman (input) for mailman id 380613;
 Thu, 04 Aug 2022 16:46:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdzB-0001My-E7
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:46:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdzB-0000X6-DJ
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:46:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdzB-0000Vw-Cf
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:46:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Csrh01/S6FF/RlmDj/n053PDxFAlutSmjVYviFW4AIU=; b=u5xafHObIPJlwrXFST177q1ERI
	6nfxJoTcC5yMZ0jzArmdifBCwT9NGp8aqF1e01MsG0QL48WMCorns4UJPBsTTa7g7Hz5maRzBSS6H
	XA1O824MpLceGR38lgQbN0KqA1vfr4K1WpzRvgy4XTLHKYN/fWaUV6WxUAkbzplmHs6s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen: Rename CONFIG_DOMAIN_PAGE to CONFIG_ARCH_MAP_DOMAIN_PAGE and...
Message-Id: <E1oJdzB-0000Vw-Cf@xenbits.xenproject.org>
Date: Thu, 04 Aug 2022 16:46:13 +0000

commit 8417757310cdad9b20902a39eea671d7cce8d396
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Fri Jul 29 22:53:10 2022 +0100
Commit:     Julien Grall <julien@xen.org>
CommitDate: Fri Jul 29 23:03:22 2022 +0100

    xen: Rename CONFIG_DOMAIN_PAGE to CONFIG_ARCH_MAP_DOMAIN_PAGE and...
    
    move it to Kconfig.
    
    The define CONFIG_DOMAIN_PAGE indicates whether the architecture provide
    helpers to map/unmap a domain page. Rename it to CONFIG_ARCH_MAP_DOMAIN_PAGE
    so it is clearer that support for domain page is not something that
    can be disabled in Xen.
    
    Take the opportunity to move CONFIG_MAP_DOMAIN_PAGE to Kconfig as this
    will soon be necessary to use it in the Makefile.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com> #arm part
---
 xen/arch/arm/Kconfig              | 1 +
 xen/arch/arm/include/asm/config.h | 1 -
 xen/arch/arm/mm.c                 | 4 ++--
 xen/arch/x86/Kconfig              | 1 +
 xen/arch/x86/include/asm/config.h | 1 -
 xen/common/Kconfig                | 3 +++
 xen/include/xen/domain_page.h     | 6 +++---
 7 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
index be9eff0141..33e004d702 100644
--- a/xen/arch/arm/Kconfig
+++ b/xen/arch/arm/Kconfig
@@ -1,6 +1,7 @@
 config ARM_32
 	def_bool y
 	depends on "$(ARCH)" = "arm32"
+	select ARCH_MAP_DOMAIN_PAGE
 
 config ARM_64
 	def_bool y
diff --git a/xen/arch/arm/include/asm/config.h b/xen/arch/arm/include/asm/config.h
index 66db618b34..2fafb9f228 100644
--- a/xen/arch/arm/include/asm/config.h
+++ b/xen/arch/arm/include/asm/config.h
@@ -122,7 +122,6 @@
 
 #ifdef CONFIG_ARM_32
 
-#define CONFIG_DOMAIN_PAGE 1
 #define CONFIG_SEPARATE_XENHEAP 1
 
 #define FRAMETABLE_VIRT_START  _AT(vaddr_t,0x02000000)
diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index a36f047f50..1423bdd700 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -194,7 +194,7 @@ static void __init __maybe_unused build_assertions(void)
 #endif
     BUILD_BUG_ON(first_table_offset(XEN_VIRT_START));
     BUILD_BUG_ON(second_linear_offset(XEN_VIRT_START) >= XEN_PT_LPAE_ENTRIES);
-#ifdef CONFIG_DOMAIN_PAGE
+#ifdef CONFIG_ARCH_MAP_DOMAIN_PAGE
     BUILD_BUG_ON(DOMHEAP_VIRT_START & ~FIRST_MASK);
 #endif
     /*
@@ -371,7 +371,7 @@ void clear_fixmap(unsigned int map)
     BUG_ON(res != 0);
 }
 
-#ifdef CONFIG_DOMAIN_PAGE
+#ifdef CONFIG_ARCH_MAP_DOMAIN_PAGE
 /*
  * Prepare the area that will be used to map domheap pages. They are
  * mapped in 2MB chunks, so we need to allocate the page-tables up to
diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index 6bed72b791..6a7825f4ba 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -8,6 +8,7 @@ config X86
 	select ACPI_LEGACY_TABLES_LOOKUP
 	select ACPI_NUMA
 	select ALTERNATIVE_CALL
+	select ARCH_MAP_DOMAIN_PAGE
 	select ARCH_SUPPORTS_INT128
 	select CORE_PARKING
 	select HAS_ALTERNATIVE
diff --git a/xen/arch/x86/include/asm/config.h b/xen/arch/x86/include/asm/config.h
index 07bcd15831..fbc4bb3416 100644
--- a/xen/arch/x86/include/asm/config.h
+++ b/xen/arch/x86/include/asm/config.h
@@ -22,7 +22,6 @@
 #define CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS 1
 #define CONFIG_DISCONTIGMEM 1
 #define CONFIG_NUMA_EMU 1
-#define CONFIG_DOMAIN_PAGE 1
 
 #define CONFIG_PAGEALLOC_MAX_ORDER (2 * PAGETABLE_ORDER)
 #define CONFIG_DOMU_MAX_ORDER      PAGETABLE_ORDER
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index 41a67891bc..f1ea3199c8 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -25,6 +25,9 @@ config GRANT_TABLE
 config ALTERNATIVE_CALL
 	bool
 
+config ARCH_MAP_DOMAIN_PAGE
+	bool
+
 config HAS_ALTERNATIVE
 	bool
 
diff --git a/xen/include/xen/domain_page.h b/xen/include/xen/domain_page.h
index a182d33b67..149b217b96 100644
--- a/xen/include/xen/domain_page.h
+++ b/xen/include/xen/domain_page.h
@@ -17,7 +17,7 @@
 void clear_domain_page(mfn_t mfn);
 void copy_domain_page(mfn_t dst, const mfn_t src);
 
-#ifdef CONFIG_DOMAIN_PAGE
+#ifdef CONFIG_ARCH_MAP_DOMAIN_PAGE
 
 /*
  * Map a given page frame, returning the mapped virtual address. The page is
@@ -51,7 +51,7 @@ static inline void *__map_domain_page_global(const struct page_info *pg)
     return map_domain_page_global(page_to_mfn(pg));
 }
 
-#else /* !CONFIG_DOMAIN_PAGE */
+#else /* !CONFIG_ARCH_MAP_DOMAIN_PAGE */
 
 #define map_domain_page(mfn)                __mfn_to_virt(mfn_x(mfn))
 #define __map_domain_page(pg)               page_to_virt(pg)
@@ -70,7 +70,7 @@ static inline void *__map_domain_page_global(const struct page_info *pg)
 
 static inline void unmap_domain_page_global(const void *va) {};
 
-#endif /* !CONFIG_DOMAIN_PAGE */
+#endif /* !CONFIG_ARCH_MAP_DOMAIN_PAGE */
 
 #define UNMAP_DOMAIN_PAGE(p) do {   \
     unmap_domain_page(p);           \
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 04 16:46:23 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Aug 2022 16:46:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380614.614875 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJdzL-0001PU-RK; Thu, 04 Aug 2022 16:46:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380614.614875; Thu, 04 Aug 2022 16:46: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 1oJdzL-0001PP-OY; Thu, 04 Aug 2022 16:46:23 +0000
Received: by outflank-mailman (input) for mailman id 380614;
 Thu, 04 Aug 2022 16:46:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdzL-0001PI-HA
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:46:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdzL-0000XT-GG
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:46:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdzL-0000WL-Fl
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:46:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vqWV6Ksffsy+clYJebK0zPNzyyWTZ3i6bV0zaJBcmXQ=; b=p0tisUXZ3v+fNtPUK346Lf1Fdk
	8LID5kQ69idcG+gJlS+UZK4YyLIzN6mD37gOLnuAoxMKHZrRvMp68F9BmzqzBcweL2bT/UFDrBRsB
	2zJy8WpXHOkHuMfGtoynqkSvNVsJ2pS/IkUxFS40W+9/PMAqocLsZ31SdPl03N6uVGrs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: mm: Move domain_{,un}map_* helpers in a separate file
Message-Id: <E1oJdzL-0000WL-Fl@xenbits.xenproject.org>
Date: Thu, 04 Aug 2022 16:46:23 +0000

commit 68b01ef0b3c182d207bff01dd3e20d287668c855
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Fri Jul 29 22:59:01 2022 +0100
Commit:     Julien Grall <julien@xen.org>
CommitDate: Fri Jul 29 23:03:22 2022 +0100

    xen/arm: mm: Move domain_{,un}map_* helpers in a separate file
    
    The file xen/arch/mm.c has been growing quite a lot. It now contains
    various independent part of the MM subsytem.
    
    One of them is the helpers to map/unmap a page which is only used
    by arm32 and protected by CONFIG_ARCH_MAP_DOMAIN_PAGE. Move them in a
    new file xen/arch/arm/domain_page.c.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/arch/arm/Makefile               |   1 +
 xen/arch/arm/domain_page.c          | 193 +++++++++++++++++++++++++++++++++++
 xen/arch/arm/include/asm/arm32/mm.h |   6 ++
 xen/arch/arm/include/asm/lpae.h     |  17 ++++
 xen/arch/arm/mm.c                   | 198 +-----------------------------------
 5 files changed, 219 insertions(+), 196 deletions(-)

diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index bb7a6151c1..4d076b278b 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -17,6 +17,7 @@ obj-y += device.o
 obj-$(CONFIG_IOREQ_SERVER) += dm.o
 obj-y += domain.o
 obj-y += domain_build.init.o
+obj-$(CONFIG_ARCH_MAP_DOMAIN_PAGE) += domain_page.o
 obj-y += domctl.o
 obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
 obj-y += efi/
diff --git a/xen/arch/arm/domain_page.c b/xen/arch/arm/domain_page.c
new file mode 100644
index 0000000000..71182575f9
--- /dev/null
+++ b/xen/arch/arm/domain_page.c
@@ -0,0 +1,193 @@
+#include <xen/mm.h>
+#include <xen/pmap.h>
+#include <xen/vmap.h>
+
+/* Override macros from asm/page.h to make them work with mfn_t */
+#undef virt_to_mfn
+#define virt_to_mfn(va) _mfn(__virt_to_mfn(va))
+
+/* cpu0's domheap page tables */
+static DEFINE_PAGE_TABLES(cpu0_dommap, DOMHEAP_SECOND_PAGES);
+
+/*
+ * xen_dommap == pages used by map_domain_page, these pages contain
+ * the second level pagetables which map the domheap region
+ * starting at DOMHEAP_VIRT_START in 2MB chunks.
+ */
+static DEFINE_PER_CPU(lpae_t *, xen_dommap);
+
+/*
+ * Prepare the area that will be used to map domheap pages. They are
+ * mapped in 2MB chunks, so we need to allocate the page-tables up to
+ * the 2nd level.
+ *
+ * The caller should make sure the root page-table for @cpu has been
+ * allocated.
+ */
+bool init_domheap_mappings(unsigned int cpu)
+{
+    unsigned int order = get_order_from_pages(DOMHEAP_SECOND_PAGES);
+    lpae_t *root = per_cpu(xen_pgtable, cpu);
+    unsigned int i, first_idx;
+    lpae_t *domheap;
+    mfn_t mfn;
+
+    ASSERT(root);
+    ASSERT(!per_cpu(xen_dommap, cpu));
+
+    /*
+     * The domheap for cpu0 is initialized before the heap is initialized.
+     * So we need to use pre-allocated pages.
+     */
+    if ( !cpu )
+        domheap = cpu0_dommap;
+    else
+        domheap = alloc_xenheap_pages(order, 0);
+
+    if ( !domheap )
+        return false;
+
+    /* Ensure the domheap has no stray mappings */
+    memset(domheap, 0, DOMHEAP_SECOND_PAGES * PAGE_SIZE);
+
+    /*
+     * Update the first level mapping to reference the local CPUs
+     * domheap mapping pages.
+     */
+    mfn = virt_to_mfn(domheap);
+    first_idx = first_table_offset(DOMHEAP_VIRT_START);
+    for ( i = 0; i < DOMHEAP_SECOND_PAGES; i++ )
+    {
+        lpae_t pte = mfn_to_xen_entry(mfn_add(mfn, i), MT_NORMAL);
+        pte.pt.table = 1;
+        write_pte(&root[first_idx + i], pte);
+    }
+
+    per_cpu(xen_dommap, cpu) = domheap;
+
+    return true;
+}
+
+void *map_domain_page_global(mfn_t mfn)
+{
+    return vmap(&mfn, 1);
+}
+
+void unmap_domain_page_global(const void *va)
+{
+    vunmap(va);
+}
+
+/* Map a page of domheap memory */
+void *map_domain_page(mfn_t mfn)
+{
+    unsigned long flags;
+    lpae_t *map = this_cpu(xen_dommap);
+    unsigned long slot_mfn = mfn_x(mfn) & ~XEN_PT_LPAE_ENTRY_MASK;
+    vaddr_t va;
+    lpae_t pte;
+    int i, slot;
+
+    local_irq_save(flags);
+
+    /* The map is laid out as an open-addressed hash table where each
+     * entry is a 2MB superpage pte.  We use the available bits of each
+     * PTE as a reference count; when the refcount is zero the slot can
+     * be reused. */
+    for ( slot = (slot_mfn >> XEN_PT_LPAE_SHIFT) % DOMHEAP_ENTRIES, i = 0;
+          i < DOMHEAP_ENTRIES;
+          slot = (slot + 1) % DOMHEAP_ENTRIES, i++ )
+    {
+        if ( map[slot].pt.avail < 0xf &&
+             map[slot].pt.base == slot_mfn &&
+             map[slot].pt.valid )
+        {
+            /* This slot already points to the right place; reuse it */
+            map[slot].pt.avail++;
+            break;
+        }
+        else if ( map[slot].pt.avail == 0 )
+        {
+            /* Commandeer this 2MB slot */
+            pte = mfn_to_xen_entry(_mfn(slot_mfn), MT_NORMAL);
+            pte.pt.avail = 1;
+            write_pte(map + slot, pte);
+            break;
+        }
+
+    }
+    /* If the map fills up, the callers have misbehaved. */
+    BUG_ON(i == DOMHEAP_ENTRIES);
+
+#ifndef NDEBUG
+    /* Searching the hash could get slow if the map starts filling up.
+     * Cross that bridge when we come to it */
+    {
+        static int max_tries = 32;
+        if ( i >= max_tries )
+        {
+            dprintk(XENLOG_WARNING, "Domheap map is filling: %i tries\n", i);
+            max_tries *= 2;
+        }
+    }
+#endif
+
+    local_irq_restore(flags);
+
+    va = (DOMHEAP_VIRT_START
+          + (slot << SECOND_SHIFT)
+          + ((mfn_x(mfn) & XEN_PT_LPAE_ENTRY_MASK) << THIRD_SHIFT));
+
+    /*
+     * We may not have flushed this specific subpage at map time,
+     * since we only flush the 4k page not the superpage
+     */
+    flush_xen_tlb_range_va_local(va, PAGE_SIZE);
+
+    return (void *)va;
+}
+
+/* Release a mapping taken with map_domain_page() */
+void unmap_domain_page(const void *va)
+{
+    unsigned long flags;
+    lpae_t *map = this_cpu(xen_dommap);
+    int slot = ((unsigned long) va - DOMHEAP_VIRT_START) >> SECOND_SHIFT;
+
+    if ( !va )
+        return;
+
+    local_irq_save(flags);
+
+    ASSERT(slot >= 0 && slot < DOMHEAP_ENTRIES);
+    ASSERT(map[slot].pt.avail != 0);
+
+    map[slot].pt.avail--;
+
+    local_irq_restore(flags);
+}
+
+mfn_t domain_page_map_to_mfn(const void *ptr)
+{
+    unsigned long va = (unsigned long)ptr;
+    lpae_t *map = this_cpu(xen_dommap);
+    int slot = (va - DOMHEAP_VIRT_START) >> SECOND_SHIFT;
+    unsigned long offset = (va>>THIRD_SHIFT) & XEN_PT_LPAE_ENTRY_MASK;
+
+    if ( (va >= VMAP_VIRT_START) && ((va - VMAP_VIRT_START) < VMAP_VIRT_SIZE) )
+        return virt_to_mfn(va);
+
+    ASSERT(slot >= 0 && slot < DOMHEAP_ENTRIES);
+    ASSERT(map[slot].pt.avail != 0);
+
+    return mfn_add(lpae_get_mfn(map[slot]), offset);
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/arch/arm/include/asm/arm32/mm.h b/xen/arch/arm/include/asm/arm32/mm.h
index 575373aeb9..8bfc906e71 100644
--- a/xen/arch/arm/include/asm/arm32/mm.h
+++ b/xen/arch/arm/include/asm/arm32/mm.h
@@ -1,6 +1,12 @@
 #ifndef __ARM_ARM32_MM_H__
 #define __ARM_ARM32_MM_H__
 
+#include <xen/percpu.h>
+
+#include <asm/lpae.h>
+
+DECLARE_PER_CPU(lpae_t *, xen_pgtable);
+
 /*
  * Only a limited amount of RAM, called xenheap, is always mapped on ARM32.
  * For convenience always return false.
diff --git a/xen/arch/arm/include/asm/lpae.h b/xen/arch/arm/include/asm/lpae.h
index fc19cbd847..3fdd5d0de2 100644
--- a/xen/arch/arm/include/asm/lpae.h
+++ b/xen/arch/arm/include/asm/lpae.h
@@ -261,6 +261,23 @@ lpae_t mfn_to_xen_entry(mfn_t mfn, unsigned int attr);
 #define third_table_offset(va)  TABLE_OFFSET(third_linear_offset(va))
 #define zeroeth_table_offset(va)  TABLE_OFFSET(zeroeth_linear_offset(va))
 
+/*
+ * Macros to define page-tables:
+ *  - DEFINE_BOOT_PAGE_TABLE is used to define page-table that are used
+ *  in assembly code before BSS is zeroed.
+ *  - DEFINE_PAGE_TABLE{,S} are used to define one or multiple
+ *  page-tables to be used after BSS is zeroed (typically they are only used
+ *  in C).
+ */
+#define DEFINE_BOOT_PAGE_TABLE(name)                                          \
+lpae_t __aligned(PAGE_SIZE) __section(".data.page_aligned")                   \
+    name[XEN_PT_LPAE_ENTRIES]
+
+#define DEFINE_PAGE_TABLES(name, nr)                    \
+lpae_t __aligned(PAGE_SIZE) name[XEN_PT_LPAE_ENTRIES * (nr)]
+
+#define DEFINE_PAGE_TABLE(name) DEFINE_PAGE_TABLES(name, 1)
+
 #endif /* __ARM_LPAE_H__ */
 
 /*
diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 1423bdd700..77bec199e7 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -57,23 +57,6 @@ mm_printk(const char *fmt, ...) {}
     } while (0)
 #endif
 
-/*
- * Macros to define page-tables:
- *  - DEFINE_BOOT_PAGE_TABLE is used to define page-table that are used
- *  in assembly code before BSS is zeroed.
- *  - DEFINE_PAGE_TABLE{,S} are used to define one or multiple
- *  page-tables to be used after BSS is zeroed (typically they are only used
- *  in C).
- */
-#define DEFINE_BOOT_PAGE_TABLE(name)                                          \
-lpae_t __aligned(PAGE_SIZE) __section(".data.page_aligned")                   \
-    name[XEN_PT_LPAE_ENTRIES]
-
-#define DEFINE_PAGE_TABLES(name, nr)                    \
-lpae_t __aligned(PAGE_SIZE) name[XEN_PT_LPAE_ENTRIES * (nr)]
-
-#define DEFINE_PAGE_TABLE(name) DEFINE_PAGE_TABLES(name, 1)
-
 /* Static start-of-day pagetables that we use before the allocators
  * are up. These are used by all CPUs during bringup before switching
  * to the CPUs own pagetables.
@@ -110,7 +93,7 @@ DEFINE_BOOT_PAGE_TABLE(boot_third);
 /* Main runtime page tables */
 
 /*
- * For arm32 xen_pgtable and xen_dommap are per-PCPU and are allocated before
+ * For arm32 xen_pgtable are per-PCPU and are allocated before
  * bringing up each CPU. For arm64 xen_pgtable is common to all PCPUs.
  *
  * xen_second, xen_fixmap and xen_xenmap are always shared between all
@@ -126,18 +109,10 @@ static DEFINE_PAGE_TABLE(xen_first);
 #define HYP_PT_ROOT_LEVEL 1
 /* Per-CPU pagetable pages */
 /* xen_pgtable == root of the trie (zeroeth level on 64-bit, first on 32-bit) */
-static DEFINE_PER_CPU(lpae_t *, xen_pgtable);
+DEFINE_PER_CPU(lpae_t *, xen_pgtable);
 #define THIS_CPU_PGTABLE this_cpu(xen_pgtable)
-/*
- * xen_dommap == pages used by map_domain_page, these pages contain
- * the second level pagetables which map the domheap region
- * starting at DOMHEAP_VIRT_START in 2MB chunks.
- */
-static DEFINE_PER_CPU(lpae_t *, xen_dommap);
 /* Root of the trie for cpu0, other CPU's PTs are dynamically allocated */
 static DEFINE_PAGE_TABLE(cpu0_pgtable);
-/* cpu0's domheap page tables */
-static DEFINE_PAGE_TABLES(cpu0_dommap, DOMHEAP_SECOND_PAGES);
 #endif
 
 /* Common pagetable leaves */
@@ -371,175 +346,6 @@ void clear_fixmap(unsigned int map)
     BUG_ON(res != 0);
 }
 
-#ifdef CONFIG_ARCH_MAP_DOMAIN_PAGE
-/*
- * Prepare the area that will be used to map domheap pages. They are
- * mapped in 2MB chunks, so we need to allocate the page-tables up to
- * the 2nd level.
- *
- * The caller should make sure the root page-table for @cpu has been
- * allocated.
- */
-bool init_domheap_mappings(unsigned int cpu)
-{
-    unsigned int order = get_order_from_pages(DOMHEAP_SECOND_PAGES);
-    lpae_t *root = per_cpu(xen_pgtable, cpu);
-    unsigned int i, first_idx;
-    lpae_t *domheap;
-    mfn_t mfn;
-
-    ASSERT(root);
-    ASSERT(!per_cpu(xen_dommap, cpu));
-
-    /*
-     * The domheap for cpu0 is initialized before the heap is initialized.
-     * So we need to use pre-allocated pages.
-     */
-    if ( !cpu )
-        domheap = cpu0_dommap;
-    else
-        domheap = alloc_xenheap_pages(order, 0);
-
-    if ( !domheap )
-        return false;
-
-    /* Ensure the domheap has no stray mappings */
-    memset(domheap, 0, DOMHEAP_SECOND_PAGES * PAGE_SIZE);
-
-    /*
-     * Update the first level mapping to reference the local CPUs
-     * domheap mapping pages.
-     */
-    mfn = virt_to_mfn(domheap);
-    first_idx = first_table_offset(DOMHEAP_VIRT_START);
-    for ( i = 0; i < DOMHEAP_SECOND_PAGES; i++ )
-    {
-        lpae_t pte = mfn_to_xen_entry(mfn_add(mfn, i), MT_NORMAL);
-        pte.pt.table = 1;
-        write_pte(&root[first_idx + i], pte);
-    }
-
-    per_cpu(xen_dommap, cpu) = domheap;
-
-    return true;
-}
-
-void *map_domain_page_global(mfn_t mfn)
-{
-    return vmap(&mfn, 1);
-}
-
-void unmap_domain_page_global(const void *va)
-{
-    vunmap(va);
-}
-
-/* Map a page of domheap memory */
-void *map_domain_page(mfn_t mfn)
-{
-    unsigned long flags;
-    lpae_t *map = this_cpu(xen_dommap);
-    unsigned long slot_mfn = mfn_x(mfn) & ~XEN_PT_LPAE_ENTRY_MASK;
-    vaddr_t va;
-    lpae_t pte;
-    int i, slot;
-
-    local_irq_save(flags);
-
-    /* The map is laid out as an open-addressed hash table where each
-     * entry is a 2MB superpage pte.  We use the available bits of each
-     * PTE as a reference count; when the refcount is zero the slot can
-     * be reused. */
-    for ( slot = (slot_mfn >> XEN_PT_LPAE_SHIFT) % DOMHEAP_ENTRIES, i = 0;
-          i < DOMHEAP_ENTRIES;
-          slot = (slot + 1) % DOMHEAP_ENTRIES, i++ )
-    {
-        if ( map[slot].pt.avail < 0xf &&
-             map[slot].pt.base == slot_mfn &&
-             map[slot].pt.valid )
-        {
-            /* This slot already points to the right place; reuse it */
-            map[slot].pt.avail++;
-            break;
-        }
-        else if ( map[slot].pt.avail == 0 )
-        {
-            /* Commandeer this 2MB slot */
-            pte = mfn_to_xen_entry(_mfn(slot_mfn), MT_NORMAL);
-            pte.pt.avail = 1;
-            write_pte(map + slot, pte);
-            break;
-        }
-
-    }
-    /* If the map fills up, the callers have misbehaved. */
-    BUG_ON(i == DOMHEAP_ENTRIES);
-
-#ifndef NDEBUG
-    /* Searching the hash could get slow if the map starts filling up.
-     * Cross that bridge when we come to it */
-    {
-        static int max_tries = 32;
-        if ( i >= max_tries )
-        {
-            dprintk(XENLOG_WARNING, "Domheap map is filling: %i tries\n", i);
-            max_tries *= 2;
-        }
-    }
-#endif
-
-    local_irq_restore(flags);
-
-    va = (DOMHEAP_VIRT_START
-          + (slot << SECOND_SHIFT)
-          + ((mfn_x(mfn) & XEN_PT_LPAE_ENTRY_MASK) << THIRD_SHIFT));
-
-    /*
-     * We may not have flushed this specific subpage at map time,
-     * since we only flush the 4k page not the superpage
-     */
-    flush_xen_tlb_range_va_local(va, PAGE_SIZE);
-
-    return (void *)va;
-}
-
-/* Release a mapping taken with map_domain_page() */
-void unmap_domain_page(const void *va)
-{
-    unsigned long flags;
-    lpae_t *map = this_cpu(xen_dommap);
-    int slot = ((unsigned long) va - DOMHEAP_VIRT_START) >> SECOND_SHIFT;
-
-    if ( !va )
-        return;
-
-    local_irq_save(flags);
-
-    ASSERT(slot >= 0 && slot < DOMHEAP_ENTRIES);
-    ASSERT(map[slot].pt.avail != 0);
-
-    map[slot].pt.avail--;
-
-    local_irq_restore(flags);
-}
-
-mfn_t domain_page_map_to_mfn(const void *ptr)
-{
-    unsigned long va = (unsigned long)ptr;
-    lpae_t *map = this_cpu(xen_dommap);
-    int slot = (va - DOMHEAP_VIRT_START) >> SECOND_SHIFT;
-    unsigned long offset = (va>>THIRD_SHIFT) & XEN_PT_LPAE_ENTRY_MASK;
-
-    if ( (va >= VMAP_VIRT_START) && ((va - VMAP_VIRT_START) < VMAP_VIRT_SIZE) )
-        return virt_to_mfn(va);
-
-    ASSERT(slot >= 0 && slot < DOMHEAP_ENTRIES);
-    ASSERT(map[slot].pt.avail != 0);
-
-    return mfn_add(lpae_get_mfn(map[slot]), offset);
-}
-#endif
-
 void flush_page_to_ram(unsigned long mfn, bool sync_icache)
 {
     void *v = map_domain_page(_mfn(mfn));
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 04 16:46:34 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Aug 2022 16:46:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380615.614880 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJdzW-0001VX-Sv; Thu, 04 Aug 2022 16:46:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380615.614880; Thu, 04 Aug 2022 16:46: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 1oJdzW-0001VP-QB; Thu, 04 Aug 2022 16:46:34 +0000
Received: by outflank-mailman (input) for mailman id 380615;
 Thu, 04 Aug 2022 16:46:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdzV-0001SM-K2
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:46:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdzV-0000Xh-JC
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:46:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdzV-0000Wu-Id
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:46:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZUFN/KDboZIHjxAelE3I83Gn7MPMDU4Rax83xPGdY9g=; b=oOXS/sZuntzj3hknn4YpGtL51A
	ctnwvm7fk3P9/GUWQgJJc7BvlECDMrfHX8+fWq5gXViXtaLZIRcqyqMw46GW8T9otBHrlEwOaYCDy
	ON7E/bYjM7mPvh3B6e0PFpkoUP+sdOxND/OcIQ9L6WgEGPKpj/RGW5MoFRjbAz/TkuV8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: mm: Reduce the area that xen_second covers
Message-Id: <E1oJdzV-0000Wu-Id@xenbits.xenproject.org>
Date: Thu, 04 Aug 2022 16:46:33 +0000

commit 7451fdeb696df1fec33d7e5d6de8fa6676afee27
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Fri Jul 29 22:59:49 2022 +0100
Commit:     Julien Grall <julien@xen.org>
CommitDate: Fri Jul 29 23:03:22 2022 +0100

    xen/arm: mm: Reduce the area that xen_second covers
    
    At the moment, xen_second is used to cover the first 2GB of the
    virtual address space. With the recent rework of the page-tables,
    only the first 1GB region (where Xen resides) is effectively used.
    
    In addition to that, I would like to reshuffle the memory layout.
    So Xen mappings may not be anymore in the first 2GB of the virtual
    address space.
    
    Therefore, rework xen_second so it only covers the 1GB region where
    Xen will reside.
    
    With this change, xen_second doesn't cover anymore the xenheap area
    on arm32. So, we first need to add memory to the boot allocator before
    setting up the xenheap mappings.
    
    Take the opportunity to update the comments on top of xen_fixmap and
    xen_xenmap.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/arch/arm/mm.c    | 32 +++++++++++---------------------
 xen/arch/arm/setup.c | 13 +++++++++++--
 2 files changed, 22 insertions(+), 23 deletions(-)

diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 77bec199e7..b42cddb1b4 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -116,17 +116,14 @@ static DEFINE_PAGE_TABLE(cpu0_pgtable);
 #endif
 
 /* Common pagetable leaves */
-/* Second level page tables.
- *
- * The second-level table is 2 contiguous pages long, and covers all
- * addresses from 0 to 0x7fffffff. Offsets into it are calculated
- * with second_linear_offset(), not second_table_offset().
- */
-static DEFINE_PAGE_TABLES(xen_second, 2);
-/* First level page table used for fixmap */
+/* Second level page table used to cover Xen virtual address space */
+static DEFINE_PAGE_TABLE(xen_second);
+/* Third level page table used for fixmap */
 DEFINE_BOOT_PAGE_TABLE(xen_fixmap);
-/* First level page table used to map Xen itself with the XN bit set
- * as appropriate. */
+/*
+ * Third level page table used to map Xen itself with the XN bit set
+ * as appropriate.
+ */
 static DEFINE_PAGE_TABLE(xen_xenmap);
 
 /* Non-boot CPUs use this to find the correct pagetables. */
@@ -168,7 +165,6 @@ static void __init __maybe_unused build_assertions(void)
     BUILD_BUG_ON(zeroeth_table_offset(XEN_VIRT_START));
 #endif
     BUILD_BUG_ON(first_table_offset(XEN_VIRT_START));
-    BUILD_BUG_ON(second_linear_offset(XEN_VIRT_START) >= XEN_PT_LPAE_ENTRIES);
 #ifdef CONFIG_ARCH_MAP_DOMAIN_PAGE
     BUILD_BUG_ON(DOMHEAP_VIRT_START & ~FIRST_MASK);
 #endif
@@ -482,14 +478,10 @@ void __init setup_pagetables(unsigned long boot_phys_offset)
     p = (void *) cpu0_pgtable;
 #endif
 
-    /* Initialise first level entries, to point to second level entries */
-    for ( i = 0; i < 2; i++)
-    {
-        p[i] = pte_of_xenaddr((uintptr_t)(xen_second +
-                                          i * XEN_PT_LPAE_ENTRIES));
-        p[i].pt.table = 1;
-        p[i].pt.xn = 0;
-    }
+    /* Map xen second level page-table */
+    p[0] = pte_of_xenaddr((uintptr_t)(xen_second));
+    p[0].pt.table = 1;
+    p[0].pt.xn = 0;
 
     /* Break up the Xen mapping into 4k pages and protect them separately. */
     for ( i = 0; i < XEN_PT_LPAE_ENTRIES; i++ )
@@ -618,8 +610,6 @@ void __init setup_xenheap_mappings(unsigned long base_mfn,
 
     /* Record where the xenheap is, for translation routines. */
     xenheap_virt_end = XENHEAP_VIRT_START + nr_mfns * PAGE_SIZE;
-    xenheap_mfn_start = _mfn(base_mfn);
-    xenheap_mfn_end = _mfn(base_mfn + nr_mfns);
 }
 #else /* CONFIG_ARM_64 */
 void __init setup_xenheap_mappings(unsigned long base_mfn,
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 068e84b103..500307edc0 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -774,11 +774,20 @@ static void __init setup_mm(void)
            opt_xenheap_megabytes ? ", from command-line" : "");
     printk("Dom heap: %lu pages\n", domheap_pages);
 
-    setup_xenheap_mappings((e >> PAGE_SHIFT) - xenheap_pages, xenheap_pages);
+    /*
+     * We need some memory to allocate the page-tables used for the
+     * xenheap mappings. So populate the boot allocator first.
+     *
+     * This requires us to set xenheap_mfn_{start, end} first so the Xenheap
+     * region can be avoided.
+     */
+    xenheap_mfn_start = _mfn((e >> PAGE_SHIFT) - xenheap_pages);
+    xenheap_mfn_end = mfn_add(xenheap_mfn_start, xenheap_pages);
 
-    /* Add non-xenheap memory */
     populate_boot_allocator();
 
+    setup_xenheap_mappings(mfn_x(xenheap_mfn_start), xenheap_pages);
+
     /* Frame table covers all of RAM region, including holes */
     setup_frametable_mappings(ram_start, ram_end);
     max_page = PFN_DOWN(ram_end);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 04 16:46:45 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Aug 2022 16:46:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380616.614883 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJdzg-0001Ye-W5; Thu, 04 Aug 2022 16:46:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380616.614883; Thu, 04 Aug 2022 16:46: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 1oJdzg-0001YV-TV; Thu, 04 Aug 2022 16:46:44 +0000
Received: by outflank-mailman (input) for mailman id 380616;
 Thu, 04 Aug 2022 16:46:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdzf-0001YI-N0
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:46:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdzf-0000Xr-M4
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:46:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdzf-0000XN-LX
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:46:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6z5eVR360sPZG49wqQErZkLh2uWLd8vRz+YkESh/HHk=; b=jNYxjypFpevYrXJSkf9otI0ju7
	jPgkuYdwJmR+Bu2x6/PPvqN1zN6GEU5R3Sd+1A+bQMC1k+TspvDsMpxsCDOKjyjZVfQd/IqwPJHlF
	LRk+ByKku3cWxRgFAy8fGS+SkkYSphCtOO4GLbE6ESzTXBToCPCJ0hDN8bo+Ze2JgVW0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: domain: Fix MISRA C 2012 Rule 8.7 violation
Message-Id: <E1oJdzf-0000XN-LX@xenbits.xenproject.org>
Date: Thu, 04 Aug 2022 16:46:43 +0000

commit 2ce6a719a0cbfec5b57a2d257123146be1853f4a
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Thu Jul 28 19:21:51 2022 +0300
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Jul 29 16:01:10 2022 -0700

    xen/arm: domain: Fix MISRA C 2012 Rule 8.7 violation
    
    The function idle_loop() is referenced only in domain.c.
    Change its linkage from external to internal by adding the storage-class
    specifier static to its definitions.
    
    Add the function as a 'fake' input operand to the inline assembly statement,
    to make the compiler aware that the function is used.
    Fake means that the function is not actually used as an operand by the asm code.
    That is because there is not a suitable gcc arm32 asm constraint for labels.
    
    Declare return_to_new_vcpu32() and return_to_new_vcpu64() that are also
    referenced by this inline asm statement.
    
    Also, this patch resolves indirectly a MISRA C 2012 Rule 8.4 violation warning.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    [add noreturn]
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/arch/arm/domain.c              | 5 ++++-
 xen/arch/arm/include/asm/current.h | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index 2f8eaab7b5..2cd481979c 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -63,7 +63,7 @@ static void do_idle(void)
     rcu_idle_exit(cpu);
 }
 
-void idle_loop(void)
+static void noreturn idle_loop(void)
 {
     unsigned int cpu = smp_processor_id();
 
@@ -331,6 +331,9 @@ static void schedule_tail(struct vcpu *prev)
     update_vcpu_system_time(current);
 }
 
+extern void noreturn return_to_new_vcpu32(void);
+extern void noreturn return_to_new_vcpu64(void);
+
 static void continue_new_vcpu(struct vcpu *prev)
 {
     current->arch.actlr = READ_SYSREG(ACTLR_EL1);
diff --git a/xen/arch/arm/include/asm/current.h b/xen/arch/arm/include/asm/current.h
index 73e81458e5..6973eeb1d1 100644
--- a/xen/arch/arm/include/asm/current.h
+++ b/xen/arch/arm/include/asm/current.h
@@ -45,7 +45,7 @@ static inline struct cpu_info *get_cpu_info(void)
 #define guest_cpu_user_regs() (&get_cpu_info()->guest_cpu_user_regs)
 
 #define switch_stack_and_jump(stack, fn) do {                           \
-    asm volatile ("mov sp,%0; b " STR(fn) : : "r" (stack) : "memory" ); \
+    asm volatile ("mov sp,%0; b " STR(fn) : : "r" (stack), "X" (fn) : "memory" ); \
     unreachable();                                                      \
 } while ( false )
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 04 16:46:55 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Aug 2022 16:46:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380617.614888 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJdzr-0001bt-1T; Thu, 04 Aug 2022 16:46:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380617.614888; Thu, 04 Aug 2022 16:46:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJdzq-0001bl-Uy; Thu, 04 Aug 2022 16:46:54 +0000
Received: by outflank-mailman (input) for mailman id 380617;
 Thu, 04 Aug 2022 16:46:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdzp-0001be-Pk
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:46:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdzp-0000Y3-Or
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:46:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdzp-0000Xm-OK
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:46:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KgbgBdgw3vCor3pN4iFYOniLeW1ZBKZCFYXntCYd9xc=; b=U5oQebrcRgfEQ+cD6G00ZEe63G
	ZL9BsugiNdQ64w7PzNy/6hEFauj8sM1qehAdfZQTtrCbFG2XZsZ8U+jE0b2aJdK4YbB+Dppv4sUB7
	JnkbPgIqtgLXUJHMnHfQ7VQp6+IfhBs1gYArwuZpSPSUeNo03NOUIByQEB7EFEr7NOsc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: qemu-smoke-arm64.sh: Remove some stale comments
Message-Id: <E1oJdzp-0000Xm-OK@xenbits.xenproject.org>
Date: Thu, 04 Aug 2022 16:46:53 +0000

commit d7cb99c378c759c2f00fb1ee33e65a4379cf334f
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Fri Jul 29 17:52:27 2022 +0300
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Jul 29 16:25:44 2022 -0700

    automation: qemu-smoke-arm64.sh: Remove some stale comments
    
    Remove comment "# Install QEMU" because qemu is not installed, it is taken
    from a test-artifacts container.
    
    Change comment "# Busybox Dom0" to "# Busybox" because busybox is not used
    only for the Dom0 but also for the DomU.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/scripts/qemu-smoke-arm64.sh | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/automation/scripts/qemu-smoke-arm64.sh b/automation/scripts/qemu-smoke-arm64.sh
index 898398196a..f483a2ffc1 100755
--- a/automation/scripts/qemu-smoke-arm64.sh
+++ b/automation/scripts/qemu-smoke-arm64.sh
@@ -21,7 +21,6 @@ fi
 "
 fi
 
-# Install QEMU
 export DEBIAN_FRONTENT=noninteractive
 apt-get -qy update
 apt-get -qy install --no-install-recommends u-boot-qemu \
@@ -44,7 +43,7 @@ sed 's/compatible = "arm,pl061.*/status = "disabled";/g' binaries/virt-gicv3.dts
 dtc -I dts -O dtb binaries/virt-gicv3-edited.dts > binaries/virt-gicv3.dtb
 
 
-# Busybox Dom0
+# Busybox
 mkdir -p initrd
 mkdir -p initrd/bin
 mkdir -p initrd/sbin
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 04 16:47:05 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Aug 2022 16:47:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380618.614892 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJe01-0001ej-2v; Thu, 04 Aug 2022 16:47:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380618.614892; Thu, 04 Aug 2022 16:47:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJe01-0001eb-0D; Thu, 04 Aug 2022 16:47:05 +0000
Received: by outflank-mailman (input) for mailman id 380618;
 Thu, 04 Aug 2022 16:47:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdzz-0001eG-ST
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:47:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdzz-0000YX-Rb
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:47:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJdzz-0000YK-R6
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:47:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=IyxJY6oCwMJuZwBNILlJ79jqSGce8Wh6MUnngQ4AxNw=; b=o+tUvbxarvAaD6QKfY/q6ZK34D
	eD1OEKiiRJWh1KteQNT5jgfpqPujMEDIVLpN6GGqFSjEgC4ly9PtAkgZYTSDu/o+eim/B5n4nv0oV
	MHVcPALtPTKe5ka2O51y+NElQ4MYBod+noGGsTJlN5SC8suQplUzwawJpZFo5ZvANnrQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: qemu-smoke-arm64.sh: Rename the device tree to avoid confusion
Message-Id: <E1oJdzz-0000YK-R6@xenbits.xenproject.org>
Date: Thu, 04 Aug 2022 16:47:03 +0000

commit 1971609550024e1567788088aa24026845b5523c
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Fri Jul 29 17:52:28 2022 +0300
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Jul 29 16:25:44 2022 -0700

    automation: qemu-smoke-arm64.sh: Rename the device tree to avoid confusion
    
    Rename the device tree from virt-gicv3 to virt-gicv2 to avoid confusion
    since the version of the generic interrupt controller used for this test
    is the v2 and not the v3.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/scripts/qemu-smoke-arm64.sh | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/automation/scripts/qemu-smoke-arm64.sh b/automation/scripts/qemu-smoke-arm64.sh
index f483a2ffc1..7ac82b2278 100755
--- a/automation/scripts/qemu-smoke-arm64.sh
+++ b/automation/scripts/qemu-smoke-arm64.sh
@@ -36,11 +36,11 @@ curl -fsSLO https://github.com/qemu/qemu/raw/v5.2.0/pc-bios/efi-virtio.rom
    -machine virtualization=true \
    -cpu cortex-a57 -machine type=virt \
    -m 1024 -display none \
-   -machine dumpdtb=binaries/virt-gicv3.dtb
+   -machine dumpdtb=binaries/virt-gicv2.dtb
 # XXX disable pl061 to avoid Linux crash
-dtc -I dtb -O dts binaries/virt-gicv3.dtb > binaries/virt-gicv3.dts
-sed 's/compatible = "arm,pl061.*/status = "disabled";/g' binaries/virt-gicv3.dts > binaries/virt-gicv3-edited.dts
-dtc -I dts -O dtb binaries/virt-gicv3-edited.dts > binaries/virt-gicv3.dtb
+dtc -I dtb -O dts binaries/virt-gicv2.dtb > binaries/virt-gicv2.dts
+sed 's/compatible = "arm,pl061.*/status = "disabled";/g' binaries/virt-gicv2.dts > binaries/virt-gicv2-edited.dts
+dtc -I dts -O dtb binaries/virt-gicv2-edited.dts > binaries/virt-gicv2.dtb
 
 
 # Busybox
@@ -73,7 +73,7 @@ cd ..
 echo 'MEMORY_START="0x40000000"
 MEMORY_END="0x80000000"
 
-DEVICE_TREE="virt-gicv3.dtb"
+DEVICE_TREE="virt-gicv2.dtb"
 XEN="xen"
 DOM0_KERNEL="Image"
 DOM0_RAMDISK="initrd"
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 04 16:47:15 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Aug 2022 16:47:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380619.614896 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJe0B-0001hR-4R; Thu, 04 Aug 2022 16:47:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380619.614896; Thu, 04 Aug 2022 16:47:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJe0B-0001hJ-1j; Thu, 04 Aug 2022 16:47:15 +0000
Received: by outflank-mailman (input) for mailman id 380619;
 Thu, 04 Aug 2022 16:47:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJe09-0001hA-V5
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:47:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJe09-0000Yi-UJ
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:47:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJe09-0000Yj-To
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:47:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=AJZwvzhroDLKu2RttZMQ++hPCcuBi3IF5JVOeHfnLm4=; b=hEBwvOFCpQZTZuxjqW+NBIUtaS
	CsbMPOoV9zGV5ZYC9nSY1dhAvxWCKVFGjqAJIwT5YtnQBmtcbODiwbozkHujjfJ3WTOoNAEo9jFX3
	VbuEgMR5Uaq5opADCLZwanXCiqmuVpdpVF1AKxVT/bEoxGujJqZATA4j1hwTjLnEOaqM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: qemu-smoke-arm64.sh: Fix the number of cpus in the device tree
Message-Id: <E1oJe09-0000Yj-To@xenbits.xenproject.org>
Date: Thu, 04 Aug 2022 16:47:13 +0000

commit 9dc3f006a831cd20d531123f097e3de176ac3cae
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Fri Jul 29 17:52:29 2022 +0300
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Jul 29 16:25:45 2022 -0700

    automation: qemu-smoke-arm64.sh: Fix the number of cpus in the device tree
    
    Qemu VM is configured with 2 cpus but the device tree passed has only 1.
    Generate a device tree with 2 cpus.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/scripts/qemu-smoke-arm64.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/automation/scripts/qemu-smoke-arm64.sh b/automation/scripts/qemu-smoke-arm64.sh
index 7ac82b2278..b48a20988f 100755
--- a/automation/scripts/qemu-smoke-arm64.sh
+++ b/automation/scripts/qemu-smoke-arm64.sh
@@ -35,7 +35,7 @@ curl -fsSLO https://github.com/qemu/qemu/raw/v5.2.0/pc-bios/efi-virtio.rom
 ./binaries/qemu-system-aarch64 \
    -machine virtualization=true \
    -cpu cortex-a57 -machine type=virt \
-   -m 1024 -display none \
+   -m 1024 -smp 2 -display none \
    -machine dumpdtb=binaries/virt-gicv2.dtb
 # XXX disable pl061 to avoid Linux crash
 dtc -I dtb -O dts binaries/virt-gicv2.dtb > binaries/virt-gicv2.dts
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 04 16:47:25 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Aug 2022 16:47:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380620.614900 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJe0L-0001kL-61; Thu, 04 Aug 2022 16:47:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380620.614900; Thu, 04 Aug 2022 16:47:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJe0L-0001kD-3B; Thu, 04 Aug 2022 16:47:25 +0000
Received: by outflank-mailman (input) for mailman id 380620;
 Thu, 04 Aug 2022 16:47:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJe0K-0001k3-1l
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:47:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJe0K-0000Z8-0u
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:47:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJe0K-0000ZL-0N
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:47:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xJvarxOWDJBEGAGrWNFQ3AMHYtQSNjynK4gkjD8R3NE=; b=KCus6AF+OFbtjKv5O205nNV4pc
	6xiYoNyWlGa8Rmf+uRmfMqlzv3pBQXFFgDvLldwv7W13EhhwIRnDWMSJfUhp48KMFduaew++4zIhE
	EBZUhXpZw+6oNXOzLrBCMwZc8k/MwcKTxZCG/BDKDT1wfpWQWRisD2987FxR5cfmcg6A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/efi: efibind: fix MISRA C 2012 Directive 4.10 violation
Message-Id: <E1oJe0K-0000ZL-0N@xenbits.xenproject.org>
Date: Thu, 04 Aug 2022 16:47:24 +0000

commit 4d96a4fe2ac08cc93f2e7eca56120792363cb950
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Mon Aug 1 15:21:18 2022 +0300
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Aug 1 17:16:56 2022 -0700

    xen/efi: efibind: fix MISRA C 2012 Directive 4.10 violation
    
    Prevent header file from being included more than once by adding ifndef guard.
    
    In order to be close to gnu-efi code
    - for x86_64, use the same guard
    - for arm64, that there is no guard in gnu-efi, for consistency,
    use a similar format and position to the x86_64 guard
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/arch/arm/include/asm/arm64/efibind.h  | 5 ++++-
 xen/arch/x86/include/asm/x86_64/efibind.h | 4 +++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/include/asm/arm64/efibind.h b/xen/arch/arm/include/asm/arm64/efibind.h
index 2b0bf40bf2..8b43bb8495 100644
--- a/xen/arch/arm/include/asm/arm64/efibind.h
+++ b/xen/arch/arm/include/asm/arm64/efibind.h
@@ -16,7 +16,8 @@ Abstract:
 Revision History
 
 --*/
-
+#ifndef AARCH64_EFI_BIND
+#define AARCH64_EFI_BIND
 #ifndef __GNUC__
 #pragma pack()
 #endif
@@ -205,6 +206,8 @@ typedef uint64_t   UINTN;
 
 #endif
 
+#endif
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/x86/include/asm/x86_64/efibind.h b/xen/arch/x86/include/asm/x86_64/efibind.h
index ddcfae07ec..e23cd16cb6 100644
--- a/xen/arch/x86/include/asm/x86_64/efibind.h
+++ b/xen/arch/x86/include/asm/x86_64/efibind.h
@@ -16,7 +16,8 @@ Abstract:
 Revision History
 
 --*/
-
+#ifndef X86_64_EFI_BIND
+#define X86_64_EFI_BIND
 #ifndef __GNUC__
 #pragma pack()
 #endif
@@ -278,3 +279,4 @@ typedef uint64_t   UINTN;
 #pragma warning ( disable : 4731 )  // Suppress warnings about modification of EBP
 #endif
 
+#endif
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 04 16:47:35 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Aug 2022 16:47:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380621.614904 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJe0V-0001mx-7e; Thu, 04 Aug 2022 16:47:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380621.614904; Thu, 04 Aug 2022 16:47:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJe0V-0001mq-53; Thu, 04 Aug 2022 16:47:35 +0000
Received: by outflank-mailman (input) for mailman id 380621;
 Thu, 04 Aug 2022 16:47:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJe0U-0001mj-4X
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:47:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJe0U-0000ZI-3j
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:47:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJe0U-0000Zk-3G
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:47:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=v9Vdxd0+GZihYWMxM1q5+tfUCPlWMFgKJPpiR7l2/m8=; b=z8YosxaAKco0hlWgo7wADuWLHb
	2HbiNL83rinJn03kk4rkUClPOzcuJ49/x6ZUdwcaLb5Z0sx+ts++V46icmOaqtRRof3qOyetolmZL
	dgrbFJgmmKXA/DZ4OBRMvNMQV6X5+HYiNs71e4zGJA7LKYX4Y+5xrGNOaQXuIV74rYQk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] arm/vgic-v3: fix virq offset in the rank when storing irouter
Message-Id: <E1oJe0U-0000Zk-3G@xenbits.xenproject.org>
Date: Thu, 04 Aug 2022 16:47:34 +0000

commit 800f21499e0ec112771ce1e94490ca5811578bc2
Author:     Hongda Deng <Hongda.Deng@arm.com>
AuthorDate: Fri Jul 29 16:36:02 2022 +0800
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Wed Aug 3 10:07:34 2022 +0100

    arm/vgic-v3: fix virq offset in the rank when storing irouter
    
    When vGIC performs irouter registers emulation, to get the target vCPU
    via virq conveniently, Xen doesn't store the irouter value directly,
    instead it will use the value (affinities) in irouter to calculate the
    target vCPU, and then save the target vCPU in irq rank->vcpu[offset].
    
    When vGIC tries to get the target vCPU, it first calculates the target
    vCPU index via
      int target = read_atomic(&rank->vcpu[virq & INTERRUPT_RANK_MASK]);
    and then it gets the target vCPU via
      v->domain->vcpu[target];
    
    When vGIC tries to store irouter for one virq, the target vCPU index
    in the rank is computed as
      offset &= virq & INTERRUPT_RANK_MASK;
    finally it gets the target vCPU via
      d->vcpu[read_atomic(&rank->vcpu[offset])];
    
    There is a difference between them while getting the target vCPU index
    in the rank. Actually (virq & INTERRUPT_RANK_MASK) would already get
    the target vCPU index in the rank, it's wrong to add '&' before '=' when
    calculate the offset.
    
    For example, the target vCPU index in the rank should be 6 for virq 38,
    but vGIC will get offset=0 when vGIC stores the irouter for this virq,
    and finally vGIC will access the wrong target vCPU index in the rank
    when updating the irouter.
    
    Fixes: 5d495f4349b5 ("xen/arm: vgic: Optimize the way to store the target vCPU in the rank")
    Signed-off-by: Hongda Deng <Hongda.Deng@arm.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/vgic-v3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/vgic-v3.c b/xen/arch/arm/vgic-v3.c
index e4ba9a6476..7fb99a9ff2 100644
--- a/xen/arch/arm/vgic-v3.c
+++ b/xen/arch/arm/vgic-v3.c
@@ -135,7 +135,7 @@ static void vgic_store_irouter(struct domain *d, struct vgic_irq_rank *rank,
     ASSERT(virq >= 32);
 
     /* Get the index in the rank */
-    offset &= virq & INTERRUPT_RANK_MASK;
+    offset = virq & INTERRUPT_RANK_MASK;
 
     new_vcpu = vgic_v3_irouter_to_vcpu(d, irouter);
     old_vcpu = d->vcpu[read_atomic(&rank->vcpu[offset])];
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 04 16:47:45 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Aug 2022 16:47:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380622.614907 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJe0f-0001pn-9X; Thu, 04 Aug 2022 16:47:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380622.614907; Thu, 04 Aug 2022 16:47: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 1oJe0f-0001pg-6e; Thu, 04 Aug 2022 16:47:45 +0000
Received: by outflank-mailman (input) for mailman id 380622;
 Thu, 04 Aug 2022 16:47:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJe0e-0001pV-8a
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:47:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJe0e-0000ZT-7f
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:47:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJe0e-0000aB-6y
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:47:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rgP/RmxzO3McHEBToWoetJScOC53oZWQlqDUx7HlCBg=; b=wtU8wbv3zbDfoNrr1sxdZx+/ZL
	WqkllKlTnvnSHwU5RyS0k9dVRnPo7k6ZuuFQkEe3DP1qC+1PdRwDkdSGiKIBm70eFknNhaZxEoEKk
	PqZt/q/ZdHLxznz+WzmHSjHvgqWNMIGEY8ngRJEG1AO9jxyUkNMKpAXMGfCC2FJoyTgM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] evtchn: convert domain event lock to an r/w one
Message-Id: <E1oJe0e-0000aB-6y@xenbits.xenproject.org>
Date: Thu, 04 Aug 2022 16:47:44 +0000

commit 9875c69c4b7decf0c1d2bc493e590ade2880fa5e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Aug 3 12:10:26 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Aug 3 12:10:26 2022 +0200

    evtchn: convert domain event lock to an r/w one
    
    Especially for the use in evtchn_move_pirqs() (called when moving a vCPU
    across pCPU-s) and the ones in EOI handling in PCI pass-through code,
    serializing perhaps an entire domain isn't helpful when no state (which
    isn't e.g. further protected by the per-channel lock) changes.
    
    Unfortunately this implies dropping of lock profiling for this lock,
    until r/w locks may get enabled for such functionality.
    
    While ->notify_vcpu_id is now meant to be consistently updated with the
    per-channel lock held, an extension applies to ECS_PIRQ: The field is
    also guaranteed to not change with the per-domain event lock held for
    writing. Therefore the link_pirq_port() call from evtchn_bind_pirq()
    could in principle be moved out of the per-channel locked regions, but
    this further code churn didn't seem worth it.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/arch/x86/domain.c                 |  4 +-
 xen/arch/x86/hvm/hvm.c                |  4 +-
 xen/arch/x86/hvm/irq.c                |  4 +-
 xen/arch/x86/hvm/vioapic.c            |  4 +-
 xen/arch/x86/hvm/vmsi.c               | 12 ++---
 xen/arch/x86/io_apic.c                |  4 +-
 xen/arch/x86/irq.c                    | 32 ++++++-------
 xen/arch/x86/physdev.c                | 22 ++++-----
 xen/arch/x86/pv/shim.c                | 10 ++--
 xen/common/event_channel.c            | 86 +++++++++++++++++------------------
 xen/common/event_fifo.c               | 10 ++--
 xen/drivers/passthrough/vtd/x86/hvm.c |  4 +-
 xen/drivers/passthrough/x86/hvm.c     | 58 +++++++++++------------
 xen/include/xen/sched.h               |  2 +-
 xen/xsm/flask/flask_op.c              |  4 +-
 15 files changed, 130 insertions(+), 130 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 532b87e8af..15e7e77201 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -967,7 +967,7 @@ int arch_domain_soft_reset(struct domain *d)
     if ( !is_hvm_domain(d) )
         return -EINVAL;
 
-    spin_lock(&d->event_lock);
+    write_lock(&d->event_lock);
     for ( i = 0; i < d->nr_pirqs ; i++ )
     {
         if ( domain_pirq_to_emuirq(d, i) != IRQ_UNBOUND )
@@ -977,7 +977,7 @@ int arch_domain_soft_reset(struct domain *d)
                 break;
         }
     }
-    spin_unlock(&d->event_lock);
+    write_unlock(&d->event_lock);
 
     if ( ret )
         return ret;
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index bb996b4c42..0dd320a6a9 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -492,9 +492,9 @@ void hvm_migrate_pirqs(struct vcpu *v)
     if ( !is_iommu_enabled(d) || !hvm_domain_irq(d)->dpci )
        return;
 
-    spin_lock(&d->event_lock);
+    read_lock(&d->event_lock);
     pt_pirq_iterate(d, migrate_pirq, v);
-    spin_unlock(&d->event_lock);
+    read_unlock(&d->event_lock);
 }
 
 static bool hvm_get_pending_event(struct vcpu *v, struct x86_event *info)
diff --git a/xen/arch/x86/hvm/irq.c b/xen/arch/x86/hvm/irq.c
index 19252448cb..858ab5b248 100644
--- a/xen/arch/x86/hvm/irq.c
+++ b/xen/arch/x86/hvm/irq.c
@@ -404,9 +404,9 @@ int hvm_inject_msi(struct domain *d, uint64_t addr, uint32_t data)
             {
                 int rc;
 
-                spin_lock(&d->event_lock);
+                write_lock(&d->event_lock);
                 rc = map_domain_emuirq_pirq(d, pirq, IRQ_MSI_EMU);
-                spin_unlock(&d->event_lock);
+                write_unlock(&d->event_lock);
                 if ( rc )
                     return rc;
                 info = pirq_info(d, pirq);
diff --git a/xen/arch/x86/hvm/vioapic.c b/xen/arch/x86/hvm/vioapic.c
index d5d5b02421..cb7f440160 100644
--- a/xen/arch/x86/hvm/vioapic.c
+++ b/xen/arch/x86/hvm/vioapic.c
@@ -203,9 +203,9 @@ static int vioapic_hwdom_map_gsi(unsigned int gsi, unsigned int trig,
     {
         gprintk(XENLOG_WARNING, "vioapic: error binding GSI %u: %d\n",
                 gsi, ret);
-        spin_lock(&currd->event_lock);
+        write_lock(&currd->event_lock);
         unmap_domain_pirq(currd, pirq);
-        spin_unlock(&currd->event_lock);
+        write_unlock(&currd->event_lock);
     }
     pcidevs_unlock();
 
diff --git a/xen/arch/x86/hvm/vmsi.c b/xen/arch/x86/hvm/vmsi.c
index d4a8c953e2..198fbd6708 100644
--- a/xen/arch/x86/hvm/vmsi.c
+++ b/xen/arch/x86/hvm/vmsi.c
@@ -467,7 +467,7 @@ int msixtbl_pt_register(struct domain *d, struct pirq *pirq, uint64_t gtable)
     int r = -EINVAL;
 
     ASSERT(pcidevs_locked());
-    ASSERT(spin_is_locked(&d->event_lock));
+    ASSERT(rw_is_write_locked(&d->event_lock));
 
     if ( !msixtbl_initialised(d) )
         return -ENODEV;
@@ -537,7 +537,7 @@ void msixtbl_pt_unregister(struct domain *d, struct pirq *pirq)
     struct msixtbl_entry *entry;
 
     ASSERT(pcidevs_locked());
-    ASSERT(spin_is_locked(&d->event_lock));
+    ASSERT(rw_is_write_locked(&d->event_lock));
 
     if ( !msixtbl_initialised(d) )
         return;
@@ -591,13 +591,13 @@ void msixtbl_pt_cleanup(struct domain *d)
     if ( !msixtbl_initialised(d) )
         return;
 
-    spin_lock(&d->event_lock);
+    write_lock(&d->event_lock);
 
     list_for_each_entry_safe( entry, temp,
                               &d->arch.hvm.msixtbl_list, list )
         del_msixtbl_entry(entry);
 
-    spin_unlock(&d->event_lock);
+    write_unlock(&d->event_lock);
 }
 
 void msix_write_completion(struct vcpu *v)
@@ -811,9 +811,9 @@ static void vpci_msi_disable(const struct pci_dev *pdev, int pirq,
         ASSERT(!rc);
     }
 
-    spin_lock(&pdev->domain->event_lock);
+    write_lock(&pdev->domain->event_lock);
     unmap_domain_pirq(pdev->domain, pirq);
-    spin_unlock(&pdev->domain->event_lock);
+    write_unlock(&pdev->domain->event_lock);
     pcidevs_unlock();
 }
 
diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index c086f40f63..9b8a972cf5 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -2457,10 +2457,10 @@ int ioapic_guest_write(unsigned long physbase, unsigned int reg, u32 val)
     }
     if ( pirq >= 0 )
     {
-        spin_lock(&hardware_domain->event_lock);
+        write_lock(&hardware_domain->event_lock);
         ret = map_domain_pirq(hardware_domain, pirq, irq,
                               MAP_PIRQ_TYPE_GSI, NULL);
-        spin_unlock(&hardware_domain->event_lock);
+        write_unlock(&hardware_domain->event_lock);
         if ( ret < 0 )
             return ret;
     }
diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c
index de30ee7779..fea901bfb1 100644
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -1550,7 +1550,7 @@ int pirq_guest_bind(struct vcpu *v, struct pirq *pirq, int will_share)
     unsigned int        max_nr_guests = will_share ? irq_max_guests : 1;
     int                 rc = 0;
 
-    WARN_ON(!spin_is_locked(&v->domain->event_lock));
+    WARN_ON(!rw_is_write_locked(&v->domain->event_lock));
     BUG_ON(!local_irq_is_enabled());
 
  retry:
@@ -1764,7 +1764,7 @@ void pirq_guest_unbind(struct domain *d, struct pirq *pirq)
     struct irq_desc *desc;
     int irq = 0;
 
-    WARN_ON(!spin_is_locked(&d->event_lock));
+    WARN_ON(!rw_is_write_locked(&d->event_lock));
 
     BUG_ON(!local_irq_is_enabled());
     desc = pirq_spin_lock_irq_desc(pirq, NULL);
@@ -1801,7 +1801,7 @@ static bool pirq_guest_force_unbind(struct domain *d, struct pirq *pirq)
     unsigned int i;
     bool bound = false;
 
-    WARN_ON(!spin_is_locked(&d->event_lock));
+    WARN_ON(!rw_is_write_locked(&d->event_lock));
 
     BUG_ON(!local_irq_is_enabled());
     desc = pirq_spin_lock_irq_desc(pirq, NULL);
@@ -2043,7 +2043,7 @@ int get_free_pirq(struct domain *d, int type)
 {
     int i;
 
-    ASSERT(spin_is_locked(&d->event_lock));
+    ASSERT(rw_is_write_locked(&d->event_lock));
 
     if ( type == MAP_PIRQ_TYPE_GSI )
     {
@@ -2068,7 +2068,7 @@ int get_free_pirqs(struct domain *d, unsigned int nr)
 {
     unsigned int i, found = 0;
 
-    ASSERT(spin_is_locked(&d->event_lock));
+    ASSERT(rw_is_write_locked(&d->event_lock));
 
     for ( i = d->nr_pirqs - 1; i >= nr_irqs_gsi; --i )
         if ( is_free_pirq(d, pirq_info(d, i)) )
@@ -2096,7 +2096,7 @@ int map_domain_pirq(
     DECLARE_BITMAP(prepared, MAX_MSI_IRQS) = {};
     DECLARE_BITMAP(granted, MAX_MSI_IRQS) = {};
 
-    ASSERT(spin_is_locked(&d->event_lock));
+    ASSERT(rw_is_write_locked(&d->event_lock));
 
     if ( !irq_access_permitted(current->domain, irq))
         return -EPERM;
@@ -2314,7 +2314,7 @@ int unmap_domain_pirq(struct domain *d, int pirq)
         return -EINVAL;
 
     ASSERT(pcidevs_locked());
-    ASSERT(spin_is_locked(&d->event_lock));
+    ASSERT(rw_is_write_locked(&d->event_lock));
 
     info = pirq_info(d, pirq);
     if ( !info || (irq = info->arch.irq) <= 0 )
@@ -2420,13 +2420,13 @@ void free_domain_pirqs(struct domain *d)
     int i;
 
     pcidevs_lock();
-    spin_lock(&d->event_lock);
+    write_lock(&d->event_lock);
 
     for ( i = 0; i < d->nr_pirqs; i++ )
         if ( domain_pirq_to_irq(d, i) > 0 )
             unmap_domain_pirq(d, i);
 
-    spin_unlock(&d->event_lock);
+    write_unlock(&d->event_lock);
     pcidevs_unlock();
 }
 
@@ -2669,7 +2669,7 @@ int map_domain_emuirq_pirq(struct domain *d, int pirq, int emuirq)
     int old_emuirq = IRQ_UNBOUND, old_pirq = IRQ_UNBOUND;
     struct pirq *info;
 
-    ASSERT(spin_is_locked(&d->event_lock));
+    ASSERT(rw_is_write_locked(&d->event_lock));
 
     if ( !is_hvm_domain(d) )
         return -EINVAL;
@@ -2735,7 +2735,7 @@ int unmap_domain_pirq_emuirq(struct domain *d, int pirq)
     if ( (pirq < 0) || (pirq >= d->nr_pirqs) )
         return -EINVAL;
 
-    ASSERT(spin_is_locked(&d->event_lock));
+    ASSERT(rw_is_write_locked(&d->event_lock));
 
     emuirq = domain_pirq_to_emuirq(d, pirq);
     if ( emuirq == IRQ_UNBOUND )
@@ -2783,7 +2783,7 @@ static int allocate_pirq(struct domain *d, int index, int pirq, int irq,
 {
     int current_pirq;
 
-    ASSERT(spin_is_locked(&d->event_lock));
+    ASSERT(rw_is_write_locked(&d->event_lock));
     current_pirq = domain_irq_to_pirq(d, irq);
     if ( pirq < 0 )
     {
@@ -2855,7 +2855,7 @@ int allocate_and_map_gsi_pirq(struct domain *d, int index, int *pirq_p)
     }
 
     /* Verify or get pirq. */
-    spin_lock(&d->event_lock);
+    write_lock(&d->event_lock);
     pirq = allocate_pirq(d, index, *pirq_p, irq, MAP_PIRQ_TYPE_GSI, NULL);
     if ( pirq < 0 )
     {
@@ -2868,7 +2868,7 @@ int allocate_and_map_gsi_pirq(struct domain *d, int index, int *pirq_p)
         *pirq_p = pirq;
 
  done:
-    spin_unlock(&d->event_lock);
+    write_unlock(&d->event_lock);
 
     return ret;
 }
@@ -2909,7 +2909,7 @@ int allocate_and_map_msi_pirq(struct domain *d, int index, int *pirq_p,
 
     pcidevs_lock();
     /* Verify or get pirq. */
-    spin_lock(&d->event_lock);
+    write_lock(&d->event_lock);
     pirq = allocate_pirq(d, index, *pirq_p, irq, type, &msi->entry_nr);
     if ( pirq < 0 )
     {
@@ -2922,7 +2922,7 @@ int allocate_and_map_msi_pirq(struct domain *d, int index, int *pirq_p,
         *pirq_p = pirq;
 
  done:
-    spin_unlock(&d->event_lock);
+    write_unlock(&d->event_lock);
     pcidevs_unlock();
     if ( ret )
     {
diff --git a/xen/arch/x86/physdev.c b/xen/arch/x86/physdev.c
index ea38be8b79..3837926728 100644
--- a/xen/arch/x86/physdev.c
+++ b/xen/arch/x86/physdev.c
@@ -34,7 +34,7 @@ static int physdev_hvm_map_pirq(
 
     ASSERT(!is_hardware_domain(d));
 
-    spin_lock(&d->event_lock);
+    write_lock(&d->event_lock);
     switch ( type )
     {
     case MAP_PIRQ_TYPE_GSI: {
@@ -84,7 +84,7 @@ static int physdev_hvm_map_pirq(
         break;
     }
 
-    spin_unlock(&d->event_lock);
+    write_unlock(&d->event_lock);
     return ret;
 }
 
@@ -154,18 +154,18 @@ int physdev_unmap_pirq(domid_t domid, int pirq)
 
     if ( is_hvm_domain(d) && has_pirq(d) )
     {
-        spin_lock(&d->event_lock);
+        write_lock(&d->event_lock);
         if ( domain_pirq_to_emuirq(d, pirq) != IRQ_UNBOUND )
             ret = unmap_domain_pirq_emuirq(d, pirq);
-        spin_unlock(&d->event_lock);
+        write_unlock(&d->event_lock);
         if ( domid == DOMID_SELF || ret )
             goto free_domain;
     }
 
     pcidevs_lock();
-    spin_lock(&d->event_lock);
+    write_lock(&d->event_lock);
     ret = unmap_domain_pirq(d, pirq);
-    spin_unlock(&d->event_lock);
+    write_unlock(&d->event_lock);
     pcidevs_unlock();
 
  free_domain:
@@ -192,10 +192,10 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
         ret = -EINVAL;
         if ( eoi.irq >= currd->nr_pirqs )
             break;
-        spin_lock(&currd->event_lock);
+        read_lock(&currd->event_lock);
         pirq = pirq_info(currd, eoi.irq);
         if ( !pirq ) {
-            spin_unlock(&currd->event_lock);
+            read_unlock(&currd->event_lock);
             break;
         }
         if ( currd->arch.auto_unmask )
@@ -214,7 +214,7 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
                     && hvm_irq->gsi_assert_count[gsi] )
                 send_guest_pirq(currd, pirq);
         }
-        spin_unlock(&currd->event_lock);
+        read_unlock(&currd->event_lock);
         ret = 0;
         break;
     }
@@ -578,7 +578,7 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
         if ( copy_from_guest(&out, arg, 1) != 0 )
             break;
 
-        spin_lock(&currd->event_lock);
+        write_lock(&currd->event_lock);
 
         ret = get_free_pirq(currd, out.type);
         if ( ret >= 0 )
@@ -591,7 +591,7 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
                 ret = -ENOMEM;
         }
 
-        spin_unlock(&currd->event_lock);
+        write_unlock(&currd->event_lock);
 
         if ( ret >= 0 )
         {
diff --git a/xen/arch/x86/pv/shim.c b/xen/arch/x86/pv/shim.c
index 2b74fea181..49ce4f93f2 100644
--- a/xen/arch/x86/pv/shim.c
+++ b/xen/arch/x86/pv/shim.c
@@ -431,7 +431,7 @@ long pv_shim_event_channel_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
         if ( rc )                                                           \
             break;                                                          \
                                                                             \
-        spin_lock(&d->event_lock);                                          \
+        write_lock(&d->event_lock);                                         \
         rc = evtchn_allocate_port(d, op.port_field);                        \
         if ( rc )                                                           \
         {                                                                   \
@@ -440,7 +440,7 @@ long pv_shim_event_channel_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
         }                                                                   \
         else                                                                \
             evtchn_reserve(d, op.port_field);                               \
-        spin_unlock(&d->event_lock);                                        \
+        write_unlock(&d->event_lock);                                       \
                                                                             \
         if ( !rc && __copy_to_guest(arg, &op, 1) )                          \
             rc = -EFAULT;                                                   \
@@ -568,11 +568,11 @@ long pv_shim_event_channel_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
         if ( rc )
             break;
 
-        spin_lock(&d->event_lock);
+        write_lock(&d->event_lock);
         rc = evtchn_allocate_port(d, ipi.port);
         if ( rc )
         {
-            spin_unlock(&d->event_lock);
+            write_unlock(&d->event_lock);
 
             close.port = ipi.port;
             BUG_ON(xen_hypercall_event_channel_op(EVTCHNOP_close, &close));
@@ -581,7 +581,7 @@ long pv_shim_event_channel_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 
         evtchn_assign_vcpu(d, ipi.port, ipi.vcpu);
         evtchn_reserve(d, ipi.port);
-        spin_unlock(&d->event_lock);
+        write_unlock(&d->event_lock);
 
         if ( __copy_to_guest(arg, &ipi, 1) )
             rc = -EFAULT;
diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index e25fa91913..c2c6f8c151 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -301,7 +301,7 @@ int evtchn_alloc_unbound(evtchn_alloc_unbound_t *alloc)
     if ( d == NULL )
         return -ESRCH;
 
-    spin_lock(&d->event_lock);
+    write_lock(&d->event_lock);
 
     if ( (port = get_free_port(d)) < 0 )
         ERROR_EXIT_DOM(port, d);
@@ -324,7 +324,7 @@ int evtchn_alloc_unbound(evtchn_alloc_unbound_t *alloc)
 
  out:
     check_free_port(d, port);
-    spin_unlock(&d->event_lock);
+    write_unlock(&d->event_lock);
     rcu_unlock_domain(d);
 
     return rc;
@@ -361,14 +361,14 @@ static int evtchn_bind_interdomain(evtchn_bind_interdomain_t *bind)
     /* Avoid deadlock by first acquiring lock of domain with smaller id. */
     if ( ld < rd )
     {
-        spin_lock(&ld->event_lock);
-        spin_lock(&rd->event_lock);
+        write_lock(&ld->event_lock);
+        write_lock(&rd->event_lock);
     }
     else
     {
         if ( ld != rd )
-            spin_lock(&rd->event_lock);
-        spin_lock(&ld->event_lock);
+            write_lock(&rd->event_lock);
+        write_lock(&ld->event_lock);
     }
 
     if ( (lport = get_free_port(ld)) < 0 )
@@ -409,9 +409,9 @@ static int evtchn_bind_interdomain(evtchn_bind_interdomain_t *bind)
 
  out:
     check_free_port(ld, lport);
-    spin_unlock(&ld->event_lock);
+    write_unlock(&ld->event_lock);
     if ( ld != rd )
-        spin_unlock(&rd->event_lock);
+        write_unlock(&rd->event_lock);
     
     rcu_unlock_domain(rd);
 
@@ -442,7 +442,7 @@ int evtchn_bind_virq(evtchn_bind_virq_t *bind, evtchn_port_t port)
     if ( (v = domain_vcpu(d, vcpu)) == NULL )
         return -ENOENT;
 
-    spin_lock(&d->event_lock);
+    write_lock(&d->event_lock);
 
     if ( read_atomic(&v->virq_to_evtchn[virq]) )
         ERROR_EXIT(-EEXIST);
@@ -483,7 +483,7 @@ int evtchn_bind_virq(evtchn_bind_virq_t *bind, evtchn_port_t port)
     write_atomic(&v->virq_to_evtchn[virq], port);
 
  out:
-    spin_unlock(&d->event_lock);
+    write_unlock(&d->event_lock);
 
     return rc;
 }
@@ -499,7 +499,7 @@ static int evtchn_bind_ipi(evtchn_bind_ipi_t *bind)
     if ( domain_vcpu(d, vcpu) == NULL )
         return -ENOENT;
 
-    spin_lock(&d->event_lock);
+    write_lock(&d->event_lock);
 
     if ( (port = get_free_port(d)) < 0 )
         ERROR_EXIT(port);
@@ -517,7 +517,7 @@ static int evtchn_bind_ipi(evtchn_bind_ipi_t *bind)
     bind->port = port;
 
  out:
-    spin_unlock(&d->event_lock);
+    write_unlock(&d->event_lock);
 
     return rc;
 }
@@ -563,7 +563,7 @@ static int evtchn_bind_pirq(evtchn_bind_pirq_t *bind)
     if ( !is_hvm_domain(d) && !pirq_access_permitted(d, pirq) )
         return -EPERM;
 
-    spin_lock(&d->event_lock);
+    write_lock(&d->event_lock);
 
     if ( pirq_to_evtchn(d, pirq) != 0 )
         ERROR_EXIT(-EEXIST);
@@ -603,7 +603,7 @@ static int evtchn_bind_pirq(evtchn_bind_pirq_t *bind)
 
  out:
     check_free_port(d, port);
-    spin_unlock(&d->event_lock);
+    write_unlock(&d->event_lock);
 
     return rc;
 }
@@ -619,7 +619,7 @@ int evtchn_close(struct domain *d1, int port1, bool guest)
         return -EINVAL;
 
  again:
-    spin_lock(&d1->event_lock);
+    write_lock(&d1->event_lock);
 
     /* Guest cannot close a Xen-attached event channel. */
     if ( unlikely(consumer_is_xen(chn1)) && guest )
@@ -682,13 +682,11 @@ int evtchn_close(struct domain *d1, int port1, bool guest)
             rcu_lock_domain(d2);
 
             if ( d1 < d2 )
-            {
-                spin_lock(&d2->event_lock);
-            }
+                write_lock(&d2->event_lock);
             else if ( d1 != d2 )
             {
-                spin_unlock(&d1->event_lock);
-                spin_lock(&d2->event_lock);
+                write_unlock(&d1->event_lock);
+                write_lock(&d2->event_lock);
                 goto again;
             }
         }
@@ -733,11 +731,11 @@ int evtchn_close(struct domain *d1, int port1, bool guest)
     if ( d2 != NULL )
     {
         if ( d1 != d2 )
-            spin_unlock(&d2->event_lock);
+            write_unlock(&d2->event_lock);
         rcu_unlock_domain(d2);
     }
 
-    spin_unlock(&d1->event_lock);
+    write_unlock(&d1->event_lock);
 
     return rc;
 }
@@ -977,7 +975,7 @@ int evtchn_status(evtchn_status_t *status)
         return -EINVAL;
     }
 
-    spin_lock(&d->event_lock);
+    read_lock(&d->event_lock);
 
     if ( consumer_is_xen(chn) )
     {
@@ -1023,7 +1021,7 @@ int evtchn_status(evtchn_status_t *status)
     status->vcpu = chn->notify_vcpu_id;
 
  out:
-    spin_unlock(&d->event_lock);
+    read_unlock(&d->event_lock);
     rcu_unlock_domain(d);
 
     return rc;
@@ -1045,7 +1043,7 @@ int evtchn_bind_vcpu(evtchn_port_t port, unsigned int vcpu_id)
     if ( !chn )
         return -EINVAL;
 
-    spin_lock(&d->event_lock);
+    write_lock(&d->event_lock);
 
     /* Guest cannot re-bind a Xen-attached event channel. */
     if ( unlikely(consumer_is_xen(chn)) )
@@ -1081,7 +1079,7 @@ int evtchn_bind_vcpu(evtchn_port_t port, unsigned int vcpu_id)
     }
 
  out:
-    spin_unlock(&d->event_lock);
+    write_unlock(&d->event_lock);
 
     return rc;
 }
@@ -1125,7 +1123,7 @@ int evtchn_reset(struct domain *d, bool resuming)
     if ( d != current->domain && !d->controller_pause_count )
         return -EINVAL;
 
-    spin_lock(&d->event_lock);
+    write_lock(&d->event_lock);
 
     /*
      * If we are resuming, then start where we stopped. Otherwise, check
@@ -1136,7 +1134,7 @@ int evtchn_reset(struct domain *d, bool resuming)
     if ( i > d->next_evtchn )
         d->next_evtchn = i;
 
-    spin_unlock(&d->event_lock);
+    write_unlock(&d->event_lock);
 
     if ( !i )
         return -EBUSY;
@@ -1148,14 +1146,14 @@ int evtchn_reset(struct domain *d, bool resuming)
         /* NB: Choice of frequency is arbitrary. */
         if ( !(i & 0x3f) && hypercall_preempt_check() )
         {
-            spin_lock(&d->event_lock);
+            write_lock(&d->event_lock);
             d->next_evtchn = i;
-            spin_unlock(&d->event_lock);
+            write_unlock(&d->event_lock);
             return -ERESTART;
         }
     }
 
-    spin_lock(&d->event_lock);
+    write_lock(&d->event_lock);
 
     d->next_evtchn = 0;
 
@@ -1168,7 +1166,7 @@ int evtchn_reset(struct domain *d, bool resuming)
         evtchn_2l_init(d);
     }
 
-    spin_unlock(&d->event_lock);
+    write_unlock(&d->event_lock);
 
     return rc;
 }
@@ -1360,7 +1358,7 @@ int alloc_unbound_xen_event_channel(
     struct evtchn *chn;
     int            port, rc;
 
-    spin_lock(&ld->event_lock);
+    write_lock(&ld->event_lock);
 
     port = rc = get_free_port(ld);
     if ( rc < 0 )
@@ -1388,7 +1386,7 @@ int alloc_unbound_xen_event_channel(
 
  out:
     check_free_port(ld, port);
-    spin_unlock(&ld->event_lock);
+    write_unlock(&ld->event_lock);
 
     return rc < 0 ? rc : port;
 }
@@ -1399,7 +1397,7 @@ void free_xen_event_channel(struct domain *d, int port)
     {
         /*
          * Make sure ->is_dying is read /after/ ->valid_evtchns, pairing
-         * with the spin_barrier() and BUG_ON() in evtchn_destroy().
+         * with the kind-of-barrier and BUG_ON() in evtchn_destroy().
          */
         smp_rmb();
         BUG_ON(!d->is_dying);
@@ -1419,7 +1417,7 @@ void notify_via_xen_event_channel(struct domain *ld, int lport)
     {
         /*
          * Make sure ->is_dying is read /after/ ->valid_evtchns, pairing
-         * with the spin_barrier() and BUG_ON() in evtchn_destroy().
+         * with the kind-of-barrier and BUG_ON() in evtchn_destroy().
          */
         smp_rmb();
         ASSERT(ld->is_dying);
@@ -1474,7 +1472,8 @@ int evtchn_init(struct domain *d, unsigned int max_port)
         return -ENOMEM;
     d->valid_evtchns = EVTCHNS_PER_BUCKET;
 
-    spin_lock_init_prof(d, event_lock);
+    rwlock_init(&d->event_lock);
+
     if ( get_free_port(d) != 0 )
     {
         free_evtchn_bucket(d, d->evtchn);
@@ -1499,9 +1498,10 @@ int evtchn_destroy(struct domain *d)
 {
     unsigned int i;
 
-    /* After this barrier no new event-channel allocations can occur. */
+    /* After this kind-of-barrier no new event-channel allocations can occur. */
     BUG_ON(!d->is_dying);
-    spin_barrier(&d->event_lock);
+    read_lock(&d->event_lock);
+    read_unlock(&d->event_lock);
 
     /* Close all existing event channels. */
     for ( i = d->valid_evtchns; --i; )
@@ -1559,13 +1559,13 @@ void evtchn_move_pirqs(struct vcpu *v)
     unsigned int port;
     struct evtchn *chn;
 
-    spin_lock(&d->event_lock);
+    read_lock(&d->event_lock);
     for ( port = v->pirq_evtchn_head; port; port = chn->u.pirq.next_port )
     {
         chn = evtchn_from_port(d, port);
         pirq_set_affinity(d, chn->u.pirq.irq, mask);
     }
-    spin_unlock(&d->event_lock);
+    read_unlock(&d->event_lock);
 }
 
 
@@ -1578,7 +1578,7 @@ static void domain_dump_evtchn_info(struct domain *d)
            "Polling vCPUs: {%*pbl}\n"
            "    port [p/m/s]\n", d->domain_id, d->max_vcpus, d->poll_mask);
 
-    spin_lock(&d->event_lock);
+    read_lock(&d->event_lock);
 
     for ( port = 1; ; ++port )
     {
@@ -1627,7 +1627,7 @@ static void domain_dump_evtchn_info(struct domain *d)
         }
     }
 
-    spin_unlock(&d->event_lock);
+    read_unlock(&d->event_lock);
 }
 
 static void cf_check dump_evtchn_info(unsigned char key)
diff --git a/xen/common/event_fifo.c b/xen/common/event_fifo.c
index 0766358e9e..6cebc3868a 100644
--- a/xen/common/event_fifo.c
+++ b/xen/common/event_fifo.c
@@ -602,7 +602,7 @@ int evtchn_fifo_init_control(struct evtchn_init_control *init_control)
     if ( offset & (8 - 1) )
         return -EINVAL;
 
-    spin_lock(&d->event_lock);
+    write_lock(&d->event_lock);
 
     /*
      * If this is the first control block, setup an empty event array
@@ -638,13 +638,13 @@ int evtchn_fifo_init_control(struct evtchn_init_control *init_control)
     else
         rc = map_control_block(v, gfn, offset);
 
-    spin_unlock(&d->event_lock);
+    write_unlock(&d->event_lock);
 
     return rc;
 
  error:
     evtchn_fifo_destroy(d);
-    spin_unlock(&d->event_lock);
+    write_unlock(&d->event_lock);
     return rc;
 }
 
@@ -697,9 +697,9 @@ int evtchn_fifo_expand_array(const struct evtchn_expand_array *expand_array)
     if ( !d->evtchn_fifo )
         return -EOPNOTSUPP;
 
-    spin_lock(&d->event_lock);
+    write_lock(&d->event_lock);
     rc = add_page_to_event_array(d, expand_array->array_gfn);
-    spin_unlock(&d->event_lock);
+    write_unlock(&d->event_lock);
 
     return rc;
 }
diff --git a/xen/drivers/passthrough/vtd/x86/hvm.c b/xen/drivers/passthrough/vtd/x86/hvm.c
index 132d252d1c..bc776cf7da 100644
--- a/xen/drivers/passthrough/vtd/x86/hvm.c
+++ b/xen/drivers/passthrough/vtd/x86/hvm.c
@@ -51,7 +51,7 @@ void hvm_dpci_isairq_eoi(struct domain *d, unsigned int isairq)
     if ( !is_iommu_enabled(d) )
         return;
 
-    spin_lock(&d->event_lock);
+    write_lock(&d->event_lock);
 
     dpci = domain_get_irq_dpci(d);
 
@@ -60,5 +60,5 @@ void hvm_dpci_isairq_eoi(struct domain *d, unsigned int isairq)
         /* Multiple mirq may be mapped to one isa irq */
         pt_pirq_iterate(d, _hvm_dpci_isairq_eoi, (void *)(long)isairq);
     }
-    spin_unlock(&d->event_lock);
+    write_unlock(&d->event_lock);
 }
diff --git a/xen/drivers/passthrough/x86/hvm.c b/xen/drivers/passthrough/x86/hvm.c
index 35b4938ab2..a16e0e5344 100644
--- a/xen/drivers/passthrough/x86/hvm.c
+++ b/xen/drivers/passthrough/x86/hvm.c
@@ -117,7 +117,7 @@ static void pt_pirq_softirq_reset(struct hvm_pirq_dpci *pirq_dpci)
 {
     struct domain *d = pirq_dpci->dom;
 
-    ASSERT(spin_is_locked(&d->event_lock));
+    ASSERT(rw_is_write_locked(&d->event_lock));
 
     switch ( cmpxchg(&pirq_dpci->state, 1 << STATE_SCHED, 0) )
     {
@@ -229,7 +229,7 @@ int pt_irq_create_bind(
         return -EINVAL;
 
  restart:
-    spin_lock(&d->event_lock);
+    write_lock(&d->event_lock);
 
     hvm_irq_dpci = domain_get_irq_dpci(d);
     if ( !hvm_irq_dpci && !is_hardware_domain(d) )
@@ -245,7 +245,7 @@ int pt_irq_create_bind(
         hvm_irq_dpci = xzalloc(struct hvm_irq_dpci);
         if ( hvm_irq_dpci == NULL )
         {
-            spin_unlock(&d->event_lock);
+            write_unlock(&d->event_lock);
             return -ENOMEM;
         }
         for ( i = 0; i < NR_HVM_DOMU_IRQS; i++ )
@@ -257,7 +257,7 @@ int pt_irq_create_bind(
     info = pirq_get_info(d, pirq);
     if ( !info )
     {
-        spin_unlock(&d->event_lock);
+        write_unlock(&d->event_lock);
         return -ENOMEM;
     }
     pirq_dpci = pirq_dpci(info);
@@ -272,7 +272,7 @@ int pt_irq_create_bind(
      */
     if ( pt_pirq_softirq_active(pirq_dpci) )
     {
-        spin_unlock(&d->event_lock);
+        write_unlock(&d->event_lock);
         cpu_relax();
         goto restart;
     }
@@ -330,7 +330,7 @@ int pt_irq_create_bind(
                 pirq_dpci->dom = NULL;
                 pirq_dpci->flags = 0;
                 pirq_cleanup_check(info, d);
-                spin_unlock(&d->event_lock);
+                write_unlock(&d->event_lock);
                 return rc;
             }
         }
@@ -340,7 +340,7 @@ int pt_irq_create_bind(
 
             if ( (pirq_dpci->flags & mask) != mask )
             {
-                spin_unlock(&d->event_lock);
+                write_unlock(&d->event_lock);
                 return -EBUSY;
             }
 
@@ -364,7 +364,7 @@ int pt_irq_create_bind(
 
         dest_vcpu_id = hvm_girq_dest_2_vcpu_id(d, dest, dest_mode);
         pirq_dpci->gmsi.dest_vcpu_id = dest_vcpu_id;
-        spin_unlock(&d->event_lock);
+        write_unlock(&d->event_lock);
 
         pirq_dpci->gmsi.posted = false;
         vcpu = (dest_vcpu_id >= 0) ? d->vcpu[dest_vcpu_id] : NULL;
@@ -424,7 +424,7 @@ int pt_irq_create_bind(
 
             if ( !digl || !girq )
             {
-                spin_unlock(&d->event_lock);
+                write_unlock(&d->event_lock);
                 xfree(girq);
                 xfree(digl);
                 return -ENOMEM;
@@ -451,7 +451,7 @@ int pt_irq_create_bind(
             if ( pt_irq_bind->irq_type != PT_IRQ_TYPE_PCI ||
                  pirq >= hvm_domain_irq(d)->nr_gsis )
             {
-                spin_unlock(&d->event_lock);
+                write_unlock(&d->event_lock);
 
                 return -EINVAL;
             }
@@ -487,7 +487,7 @@ int pt_irq_create_bind(
 
                     if ( mask < 0 || trigger_mode < 0 )
                     {
-                        spin_unlock(&d->event_lock);
+                        write_unlock(&d->event_lock);
 
                         ASSERT_UNREACHABLE();
                         return -EINVAL;
@@ -530,14 +530,14 @@ int pt_irq_create_bind(
                 }
                 pirq_dpci->flags = 0;
                 pirq_cleanup_check(info, d);
-                spin_unlock(&d->event_lock);
+                write_unlock(&d->event_lock);
                 xfree(girq);
                 xfree(digl);
                 return rc;
             }
         }
 
-        spin_unlock(&d->event_lock);
+        write_unlock(&d->event_lock);
 
         if ( iommu_verbose )
         {
@@ -555,7 +555,7 @@ int pt_irq_create_bind(
     }
 
     default:
-        spin_unlock(&d->event_lock);
+        write_unlock(&d->event_lock);
         return -EOPNOTSUPP;
     }
 
@@ -608,13 +608,13 @@ int pt_irq_destroy_bind(
         return -EOPNOTSUPP;
     }
 
-    spin_lock(&d->event_lock);
+    write_lock(&d->event_lock);
 
     hvm_irq_dpci = domain_get_irq_dpci(d);
 
     if ( !hvm_irq_dpci && !is_hardware_domain(d) )
     {
-        spin_unlock(&d->event_lock);
+        write_unlock(&d->event_lock);
         return -EINVAL;
     }
 
@@ -647,7 +647,7 @@ int pt_irq_destroy_bind(
 
         if ( girq )
         {
-            spin_unlock(&d->event_lock);
+            write_unlock(&d->event_lock);
             return -EINVAL;
         }
 
@@ -689,7 +689,7 @@ int pt_irq_destroy_bind(
         pirq_cleanup_check(pirq, d);
     }
 
-    spin_unlock(&d->event_lock);
+    write_unlock(&d->event_lock);
 
     if ( what && iommu_verbose )
     {
@@ -733,7 +733,7 @@ int pt_pirq_iterate(struct domain *d,
     unsigned int pirq = 0, n, i;
     struct pirq *pirqs[8];
 
-    ASSERT(spin_is_locked(&d->event_lock));
+    ASSERT(rw_is_locked(&d->event_lock));
 
     do {
         n = radix_tree_gang_lookup(&d->pirq_tree, (void **)pirqs, pirq,
@@ -818,9 +818,9 @@ void hvm_dpci_msi_eoi(struct domain *d, int vector)
          (!hvm_domain_irq(d)->dpci && !is_hardware_domain(d)) )
        return;
 
-    spin_lock(&d->event_lock);
+    read_lock(&d->event_lock);
     pt_pirq_iterate(d, _hvm_dpci_msi_eoi, (void *)(long)vector);
-    spin_unlock(&d->event_lock);
+    read_unlock(&d->event_lock);
 }
 
 static void hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci)
@@ -831,7 +831,7 @@ static void hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci)
         return;
     }
 
-    spin_lock(&d->event_lock);
+    write_lock(&d->event_lock);
     if ( test_and_clear_bool(pirq_dpci->masked) )
     {
         struct pirq *pirq = dpci_pirq(pirq_dpci);
@@ -875,7 +875,7 @@ static void hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci)
     }
 
  out:
-    spin_unlock(&d->event_lock);
+    write_unlock(&d->event_lock);
 }
 
 static void hvm_pirq_eoi(struct pirq *pirq)
@@ -935,7 +935,7 @@ void hvm_dpci_eoi(struct domain *d, unsigned int guest_gsi)
 
     if ( is_hardware_domain(d) )
     {
-        spin_lock(&d->event_lock);
+        write_lock(&d->event_lock);
         hvm_gsi_eoi(d, guest_gsi);
         goto unlock;
     }
@@ -946,7 +946,7 @@ void hvm_dpci_eoi(struct domain *d, unsigned int guest_gsi)
         return;
     }
 
-    spin_lock(&d->event_lock);
+    write_lock(&d->event_lock);
     hvm_irq_dpci = domain_get_irq_dpci(d);
 
     if ( !hvm_irq_dpci )
@@ -956,7 +956,7 @@ void hvm_dpci_eoi(struct domain *d, unsigned int guest_gsi)
         __hvm_dpci_eoi(d, girq);
 
 unlock:
-    spin_unlock(&d->event_lock);
+    write_unlock(&d->event_lock);
 }
 
 static int cf_check pci_clean_dpci_irq(
@@ -991,7 +991,7 @@ int arch_pci_clean_pirqs(struct domain *d)
     if ( !is_hvm_domain(d) )
         return 0;
 
-    spin_lock(&d->event_lock);
+    write_lock(&d->event_lock);
     hvm_irq_dpci = domain_get_irq_dpci(d);
     if ( hvm_irq_dpci != NULL )
     {
@@ -999,14 +999,14 @@ int arch_pci_clean_pirqs(struct domain *d)
 
         if ( ret )
         {
-            spin_unlock(&d->event_lock);
+            write_unlock(&d->event_lock);
             return ret;
         }
 
         hvm_domain_irq(d)->dpci = NULL;
         free_hvm_irq_dpci(hvm_irq_dpci);
     }
-    spin_unlock(&d->event_lock);
+    write_unlock(&d->event_lock);
 
     return 0;
 }
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index b9515eb497..e2b3b6daa3 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -429,7 +429,7 @@ struct domain
     unsigned int     xen_evtchns;
     /* Port to resume from in evtchn_reset(), when in a continuation. */
     unsigned int     next_evtchn;
-    spinlock_t       event_lock;
+    rwlock_t         event_lock;
     const struct evtchn_port_ops *evtchn_port_ops;
     struct evtchn_fifo_domain *evtchn_fifo;
 
diff --git a/xen/xsm/flask/flask_op.c b/xen/xsm/flask/flask_op.c
index eb16e289c3..d319466c6b 100644
--- a/xen/xsm/flask/flask_op.c
+++ b/xen/xsm/flask/flask_op.c
@@ -530,7 +530,7 @@ static int flask_get_peer_sid(struct xen_flask_peersid *arg)
     struct evtchn *chn;
     struct domain_security_struct *dsec;
 
-    spin_lock(&d->event_lock);
+    read_lock(&d->event_lock);
 
     if ( !port_is_valid(d, arg->evtchn) )
         goto out;
@@ -548,7 +548,7 @@ static int flask_get_peer_sid(struct xen_flask_peersid *arg)
     rv = 0;
 
  out:
-    spin_unlock(&d->event_lock);
+    read_unlock(&d->event_lock);
     return rv;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 04 16:47:55 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Aug 2022 16:47:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380623.614912 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJe0p-0001tD-EB; Thu, 04 Aug 2022 16:47:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380623.614912; Thu, 04 Aug 2022 16:47: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 1oJe0p-0001t5-BV; Thu, 04 Aug 2022 16:47:55 +0000
Received: by outflank-mailman (input) for mailman id 380623;
 Thu, 04 Aug 2022 16:47:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJe0o-0001sz-BL
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:47:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJe0o-0000Zg-AZ
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:47:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJe0o-0000ac-9z
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:47:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rg6Iy1bPzamBjMlyZOEDJcFWYjNtvQGdwsNjofFTTfQ=; b=Mxwdek97RGpAaY7QrA47ZpwohO
	hgNlSHWen0Mp9X8HpN4SXXeOuRKvDVMDu3qcbtcS4Nit+2dFbWamvr3jPX9f+8YyhWSm7Q7vorf+r
	oyZy7wTdNZ264uRXVSSNm6WeIPDCQ2MprOYp4pmW9QDY97TREI8IzRyDwz2JWTkL+xYY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/ocaml: do not run ocamldep during make clean
Message-Id: <E1oJe0o-0000ac-9z@xenbits.xenproject.org>
Date: Thu, 04 Aug 2022 16:47:54 +0000

commit 2f2b76d47c5bcd9323a2acac8ba365013af34141
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Wed Aug 3 12:13:39 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Aug 3 12:13:39 2022 +0200

    tools/ocaml: do not run ocamldep during make clean
    
    Trying to include .ocamldep.make will cause it to be generated if it
    doesn't exist.
    We do not want this during make clean: we would remove it anyway.
    
    Speeds up make clean.
    
    Before (measured on f732240fd3bac25116151db5ddeb7203b62e85ce, July 2022):
    ```
    Parsing /home/edwin/xen2/tools/ocaml/libs/xl/../../../../tools/libs/light/libxl_types.idl
    Parsing /home/edwin/xen2/tools/ocaml/libs/xl/../../../../tools/libs/light/libxl_types.idl
    Parsing /home/edwin/xen2/tools/ocaml/libs/xl/../../../../tools/libs/light/libxl_types.idl
    Parsing /home/edwin/xen2/tools/ocaml/libs/xl/../../../../tools/libs/light/libxl_types.idl
    Parsing /home/edwin/xen2/tools/ocaml/libs/xl/../../../../tools/libs/light/libxl_types.idl
    
     Performance counter stats for 'make clean -j8 -s' (5 runs):
    
                4.2233 +- 0.0208 seconds time elapsed  ( +-  0.49% )
    ```
    
    After:
    ```
    perf stat -r 5 --null make clean -j8 -s
    
     Performance counter stats for 'make clean -j8 -s' (5 runs):
    
                2.7325 +- 0.0138 seconds time elapsed  ( +-  0.51% )
    ```
    
    No functional change.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/Makefile.rules | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/ocaml/Makefile.rules b/tools/ocaml/Makefile.rules
index 7e4db457a1..d368308d9b 100644
--- a/tools/ocaml/Makefile.rules
+++ b/tools/ocaml/Makefile.rules
@@ -44,8 +44,10 @@ META: META.in
 
 ALL_OCAML_OBJ_SOURCES=$(addsuffix .ml, $(ALL_OCAML_OBJS))
 
+ifneq ($(MAKECMDGOALS),clean)
 .ocamldep.make: $(ALL_OCAML_OBJ_SOURCES) Makefile $(OCAML_TOPLEVEL)/Makefile.rules
 	$(call quiet-command, $(OCAMLDEP) $(ALL_OCAML_OBJ_SOURCES) *.mli $o,MLDEP,)
+endif
 
 clean: $(CLEAN_HOOKS)
 	$(Q)rm -f .*.d *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot *.spot *.spit $(LIBS) $(PROGRAMS) $(GENERATED_FILES) .ocamldep.make META
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 04 16:48:05 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Aug 2022 16:48:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380624.614916 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJe0z-0001w1-Gf; Thu, 04 Aug 2022 16:48:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380624.614916; Thu, 04 Aug 2022 16:48: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 1oJe0z-0001vs-D9; Thu, 04 Aug 2022 16:48:05 +0000
Received: by outflank-mailman (input) for mailman id 380624;
 Thu, 04 Aug 2022 16:48:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJe0y-0001vi-ES
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:48:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJe0y-0000a3-DV
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:48:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJe0y-0000bD-Ct
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:48:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=TarL9ZdsmjcWzgd90K5YbUsa10t+IxeJYyLv+GE12y0=; b=quQcI4KhYEW3I3BSjYSLSsdVlJ
	vKpaf0flzyaJkctQy9C40vc0Lj+0rfCa5Y+3mBo0RH9Ueo8oA1bnJlOaDFmikqlIanHC2U9OMpw0T
	kVc7s4VkH6IVCFgt4u/Cp31hfiaz2BtqaSA39a57X8j5Qyf23Iy6ndPhm1eMTXdpWYr4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] sched: dom0_vcpus_pin should only affect dom0
Message-Id: <E1oJe0y-0000bD-Ct@xenbits.xenproject.org>
Date: Thu, 04 Aug 2022 16:48:04 +0000

commit 01ca29f0b17a50a94b0e232ba276c32e95d80ae3
Author:     Dario Faggioli <dfaggioli@suse.com>
AuthorDate: Wed Aug 3 12:14:01 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Aug 3 12:14:01 2022 +0200

    sched: dom0_vcpus_pin should only affect dom0
    
    If dom0_vcpus_pin is used, make sure the pinning is only done for
    dom0 vcpus, instead of for the hardware domain (which might not be
    dom0 at all!).
    
    Suggested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/sched/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c
index f689b55783..a066c629cb 100644
--- a/xen/common/sched/core.c
+++ b/xen/common/sched/core.c
@@ -575,7 +575,7 @@ int sched_init_vcpu(struct vcpu *v)
      * Initialize affinity settings. The idler, and potentially
      * domain-0 VCPUs, are pinned onto their respective physical CPUs.
      */
-    if ( is_idle_domain(d) || (is_hardware_domain(d) && opt_dom0_vcpus_pin) )
+    if ( is_idle_domain(d) || (d->domain_id == 0 && opt_dom0_vcpus_pin) )
         sched_set_affinity(unit, cpumask_of(processor), &cpumask_all);
     else
         sched_set_affinity(unit, &cpumask_all, &cpumask_all);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 04 16:55:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Aug 2022 16:55:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380625.614920 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJe7m-0002pi-0x; Thu, 04 Aug 2022 16:55:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380625.614920; Thu, 04 Aug 2022 16:55:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJe7l-0002pa-UM; Thu, 04 Aug 2022 16:55:05 +0000
Received: by outflank-mailman (input) for mailman id 380625;
 Thu, 04 Aug 2022 16:55:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJe7k-0002pU-Q7
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:55:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJe7k-0000g2-Mv
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJe7k-0005W4-Ly
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:55:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=mD5Kcg9YGgFqvoHwEuIF7V13SV42KC+cO2Prof2PzZw=; b=SS2SUBW8spLR8HjK2N+HTY8vd2
	5jCQ/O12GMCe8wVYxnQUmAy0PQMgOH13TLn5DB50xRSPdvRYm4y1t0D00l9wS09owMaQuqsDAnyLf
	giBSx+MK5rHQkf27UM2FhM22sx/7b3JVY/8Yh9Mt/lqipFYkgPDMj1pwzbY8Rl006fqY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] doc: Add git commands to generate Fixes
Message-Id: <E1oJe7k-0005W4-Ly@xenbits.xenproject.org>
Date: Thu, 04 Aug 2022 16:55:04 +0000

commit 8a5116371da0505c9b716a9ad5df8a3b8b4c5ae4
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Wed Aug 3 15:43:04 2022 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Aug 4 17:48:01 2022 +0100

    doc: Add git commands to generate Fixes
    
    Add git commands examples that can be used to generate fixes and how to
    use the pretty configuration for git.
    This should make it easier for contributors to have the right format.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 docs/process/sending-patches.pandoc | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/docs/process/sending-patches.pandoc b/docs/process/sending-patches.pandoc
index 7ff7826c99..2e74c3b57e 100644
--- a/docs/process/sending-patches.pandoc
+++ b/docs/process/sending-patches.pandoc
@@ -102,6 +102,10 @@ E.g.:
 
     Fixes: 67d01cdb5518 ("x86: infrastructure to allow converting certain indirect calls to direct ones")
 
+If git was configured as explained earlier, this can be retrieved using
+``git log --pretty=fixes`` otherwise ``git log --abbrev=12 --oneline`` will
+give the proper tag and commit-id.
+
 ### Backport:
 
 A backport tag is an optional tag in the commit message to request a
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 04 16:55:16 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Aug 2022 16:55:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380626.614924 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJe7w-0002rg-2G; Thu, 04 Aug 2022 16:55:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380626.614924; Thu, 04 Aug 2022 16:55:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJe7v-0002rY-Vt; Thu, 04 Aug 2022 16:55:15 +0000
Received: by outflank-mailman (input) for mailman id 380626;
 Thu, 04 Aug 2022 16:55:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJe7u-0002rM-Rn
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:55:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJe7u-0000gD-Q2
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:55:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJe7u-00063q-PI
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 16:55:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=eM+7f24JSbkE1SCpnjVc+7KxHnFptoTi2K0v317IPMU=; b=p49bZYVoaCLNgIfO1F4i6g2LwA
	TDUCYEEAMJmtm91j4jNpNYocpBqIAOLVDtG9/zgICX+CkmoxJHzU0IPFAGtB9ouuumXPkKKNeJZNW
	D7TdCiELjuzbIoXLphZO2F6gF2M2EH/7q7XzP9vCbZAxmM+lfkr4H8eDMk2sKOTyDMKM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools: use $(PYTHON) to call cppcheck tools
Message-Id: <E1oJe7u-00063q-PI@xenbits.xenproject.org>
Date: Thu, 04 Aug 2022 16:55:14 +0000

commit 7c5b25c3038abc2dc8353f56ed67d2c4fcd43d79
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Wed Aug 3 12:57:02 2022 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Aug 4 17:49:25 2022 +0100

    tools: use $(PYTHON) to call cppcheck tools
    
    When calling python tools to convert misra documentation or merge
    cppcheck xml files, use $(PYTHON).
    While there fix misra document conversion script to be executable.
    
    Fixes: 57caa5375321 ("xen: Add MISRA support to cppcheck make rule")
    Fixes: 43aa3f6e72d3 ("xen/build: Add cppcheck and cppcheck-html make rules")
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/Makefile                   | 4 ++--
 xen/tools/convert_misra_doc.py | 0
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/Makefile b/xen/Makefile
index 3d926e1015..69b4dc960f 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -703,7 +703,7 @@ cmd_cppcheck_xml = $(CPPCHECK) -v -q --xml $(CPPCHECKFLAGS) \
                    --output-file=$@ $<
 
 quiet_cmd_merge_cppcheck_reports = CPPCHECK-MERGE $@
-cmd_merge_cppcheck_reports = $(srctree)/tools/merge_cppcheck_reports.py $^ $@
+cmd_merge_cppcheck_reports = $(PYTHON) $(srctree)/tools/merge_cppcheck_reports.py $^ $@
 
 quiet_cmd_cppcheck_html = CPPCHECK-HTML $<
 cmd_cppcheck_html = $(CPPCHECK_HTMLREPORT) --file=$< --source-dir=$(srctree) \
@@ -742,7 +742,7 @@ cppcheck-version:
 # cppcheck in json format including the list of rules to ignore.
 #
 cppcheck-misra.txt: $(XEN_ROOT)/docs/misra/rules.rst $(srctree)/tools/convert_misra_doc.py
-	$(Q)$(srctree)/tools/convert_misra_doc.py -i $< -o $@ -j $(@:.txt=.json)
+	$(Q)$(PYTHON) $(srctree)/tools/convert_misra_doc.py -i $< -o $@ -j $(@:.txt=.json)
 
 # convert_misra_doc is generating both files.
 cppcheck-misra.json: cppcheck-misra.txt
diff --git a/xen/tools/convert_misra_doc.py b/xen/tools/convert_misra_doc.py
old mode 100644
new mode 100755
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 04 21:44:10 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Aug 2022 21:44:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380725.615052 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJidQ-0003Df-EQ; Thu, 04 Aug 2022 21:44:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380725.615052; Thu, 04 Aug 2022 21:44:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJidQ-0003DX-BV; Thu, 04 Aug 2022 21:44:04 +0000
Received: by outflank-mailman (input) for mailman id 380725;
 Thu, 04 Aug 2022 21:44:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJidO-0003DR-BI
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 21:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJidO-0006YK-9U
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 21:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJidO-0003BB-8S
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 21:44:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5Ax3Ztp/yXkbhBbgBXOvrdBMHbdmo31UMJM/z51+mKg=; b=MVTk2wAQPS6xzL8YfczCCIvsaL
	WynW63EVENry6pD8dU5QkwsHI1FSl2egcU6S7jKFPs0krIXNnbE00bR7z8I9GkIQvDx2d71Bx486U
	WKwWP5/NrXQDoYwbW/bu6C4MqMrEXpVTJoKRAlS4OBQ9UwAmxkLA8p6JKErzyUm+PLqE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] tools/libxl: env variable to signal whether disk/nic backend is trusted
Message-Id: <E1oJidO-0003BB-8S@xenbits.xenproject.org>
Date: Thu, 04 Aug 2022 21:44:02 +0000

commit 6689cab2bcc066f063abe6ded0043f1eeb211207
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Aug 3 12:38:36 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Aug 3 12:38:36 2022 +0200

    tools/libxl: env variable to signal whether disk/nic backend is trusted
    
    Introduce support in libxl for fetching the default backend trusted
    option for disk and nic devices.
    
    Users can set LIBXL_{DISK,NIC}_BACKEND_UNTRUSTED environment variable
    to notify libxl of whether the backends for disk and nic devices
    should be trusted.  Such information is passed into the frontend so it
    can take the appropriate measures.
    
    This is part of XSA-403.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 docs/man/xl.1.pod.in          | 18 ++++++++++++++++++
 tools/libs/light/libxl_disk.c |  5 +++++
 tools/libs/light/libxl_nic.c  |  7 +++++++
 3 files changed, 30 insertions(+)

diff --git a/docs/man/xl.1.pod.in b/docs/man/xl.1.pod.in
index e2176bd696..45e1430aeb 100644
--- a/docs/man/xl.1.pod.in
+++ b/docs/man/xl.1.pod.in
@@ -1946,6 +1946,24 @@ shows the decimal value. For non-linear mode, it shows hexadecimal value.
 
 =back
 
+=head1 ENVIRONMENT
+
+=over 4
+
+=item B<LIBXL_DISK_BACKEND_UNTRUSTED>
+
+Set this environment variable to "1" to suggest to the guest that the disk
+backend shouldn't be trusted. If the variable is absent or set to "0", the
+backend will be trusted.
+
+=item B<LIBXL_NIC_BACKEND_UNTRUSTED>
+
+Set this environment variable to "1" to suggest to the guest that the network
+backend shouldn't be trusted. If the variable is absent or set to "0", the
+backend will be trusted.
+
+=back
+
 =head1 IGNORED FOR COMPATIBILITY WITH XM
 
 xl is mostly command-line compatible with the old xm utility used with
diff --git a/tools/libs/light/libxl_disk.c b/tools/libs/light/libxl_disk.c
index 93936d0dd0..67d1cc1857 100644
--- a/tools/libs/light/libxl_disk.c
+++ b/tools/libs/light/libxl_disk.c
@@ -246,6 +246,7 @@ static void device_disk_add(libxl__egc *egc, uint32_t domid,
     libxl_domain_config d_config;
     libxl_device_disk disk_saved;
     libxl__flock *lock = NULL;
+    const char *envvar;
 
     libxl_domain_config_init(&d_config);
     libxl_device_disk_init(&disk_saved);
@@ -395,6 +396,10 @@ static void device_disk_add(libxl__egc *egc, uint32_t domid,
         flexarray_append(front, GCSPRINTF("%d", device->devid));
         flexarray_append(front, "device-type");
         flexarray_append(front, disk->is_cdrom ? "cdrom" : "disk");
+        flexarray_append(front, "trusted");
+        envvar = getenv("LIBXL_DISK_BACKEND_UNTRUSTED");
+        /* Set "trusted=1" if envvar missing or is "0". */
+        flexarray_append(front, !envvar || !strcmp("0", envvar) ? "1" : "0");
 
         /*
          * Old PV kernel disk frontends before 2.6.26 rely on tool stack to
diff --git a/tools/libs/light/libxl_nic.c b/tools/libs/light/libxl_nic.c
index 0b9e70c9d1..f87890d1d6 100644
--- a/tools/libs/light/libxl_nic.c
+++ b/tools/libs/light/libxl_nic.c
@@ -132,6 +132,8 @@ static int libxl__set_xenstore_nic(libxl__gc *gc, uint32_t domid,
                                    flexarray_t *back, flexarray_t *front,
                                    flexarray_t *ro_front)
 {
+    const char *envvar;
+
     flexarray_grow(back, 2);
 
     if (nic->script)
@@ -255,6 +257,11 @@ static int libxl__set_xenstore_nic(libxl__gc *gc, uint32_t domid,
     flexarray_append(back, "hotplug-status");
     flexarray_append(back, "");
 
+    flexarray_append(front, "trusted");
+    envvar = getenv("LIBXL_NIC_BACKEND_UNTRUSTED");
+    /* Set "trusted=1" if envvar missing or is "0". */
+    flexarray_append(front, !envvar || !strcmp("0", envvar) ? "1" : "0");
+
     return 0;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Aug 04 21:44:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Aug 2022 21:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380726.615056 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJidZ-0003FO-Fw; Thu, 04 Aug 2022 21:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380726.615056; Thu, 04 Aug 2022 21:44:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJidZ-0003FG-D6; Thu, 04 Aug 2022 21:44:13 +0000
Received: by outflank-mailman (input) for mailman id 380726;
 Thu, 04 Aug 2022 21:44:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJidY-0003F6-EO
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 21:44:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJidY-0006YO-Cn
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 21:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJidY-0003Bk-Bo
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 21:44:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3umxf3WJX19EeyTbcdYursZ4KvU1eAxcQF2LMDGioiM=; b=c0KCZAmjEnOVMngAnHPL+uOg5T
	v5zglUN8GHbBLgQCwG+1nEeyAdO72iNy5Lwl4n560LAEnF3MQHNte59wkldbWhaO8VK+PreGGhTXI
	Sw6Dk+BVm7ZQCPGIpfmaQ9Wiy7yPaa41imhNnvzZqtpmafAkfmcJOd1rSVc0PoCJl8cI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86/msr: fix X2APIC_LAST
Message-Id: <E1oJidY-0003Bk-Bo@xenbits.xenproject.org>
Date: Thu, 04 Aug 2022 21:44:12 +0000

commit 89fe6d0edea841d1d2690cf3f5173e334c687823
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Wed Aug 3 12:39:13 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Aug 3 12:39:13 2022 +0200

    x86/msr: fix X2APIC_LAST
    
    The latest Intel manual now says the X2APIC reserved range is only
    0x800 to 0x8ff (NOT 0xbff).
    This changed between SDM 68 (Nov 2018) and SDM 69 (Jan 2019).
    The AMD manual documents 0x800-0x8ff too.
    
    There are non-X2APIC MSRs in the 0x900-0xbff range now:
    e.g. 0x981 is IA32_TME_CAPABILITY, an architectural MSR.
    
    The new MSR in this range appears to have been introduced in Icelake,
    so this commit should be backported to Xen versions supporting Icelake.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 13316827faadbb4f72ae6c625af9938d8f976f86
    master date: 2022-07-27 12:57:10 +0200
---
 xen/arch/x86/hvm/vmx/vmx.c      | 4 ++--
 xen/include/asm-x86/msr-index.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index a555930f8f..d429d76c18 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -3376,7 +3376,7 @@ void vmx_vlapic_msr_changed(struct vcpu *v)
             if ( cpu_has_vmx_apic_reg_virt )
             {
                 for ( msr = MSR_X2APIC_FIRST;
-                      msr <= MSR_X2APIC_FIRST + 0xff; msr++ )
+                      msr <= MSR_X2APIC_LAST; msr++ )
                     vmx_clear_msr_intercept(v, msr, VMX_MSR_R);
 
                 vmx_set_msr_intercept(v, MSR_X2APIC_PPR, VMX_MSR_R);
@@ -3397,7 +3397,7 @@ void vmx_vlapic_msr_changed(struct vcpu *v)
     if ( !(v->arch.hvm.vmx.secondary_exec_control &
            SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE) )
         for ( msr = MSR_X2APIC_FIRST;
-              msr <= MSR_X2APIC_FIRST + 0xff; msr++ )
+              msr <= MSR_X2APIC_LAST; msr++ )
             vmx_set_msr_intercept(v, msr, VMX_MSR_RW);
 
     vmx_update_secondary_exec_control(v);
diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h
index d3735e499e..3cb942eeac 100644
--- a/xen/include/asm-x86/msr-index.h
+++ b/xen/include/asm-x86/msr-index.h
@@ -135,7 +135,7 @@
 #define MSR_INTERRUPT_SSP_TABLE             0x000006a8
 
 #define MSR_X2APIC_FIRST                    0x00000800
-#define MSR_X2APIC_LAST                     0x00000bff
+#define MSR_X2APIC_LAST                     0x000008ff
 
 #define MSR_X2APIC_TPR                      0x00000808
 #define MSR_X2APIC_PPR                      0x0000080a
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Aug 04 21:44:23 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Aug 2022 21:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380727.615060 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJidj-0003IH-HS; Thu, 04 Aug 2022 21:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380727.615060; Thu, 04 Aug 2022 21:44:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJidj-0003I9-Eg; Thu, 04 Aug 2022 21:44:23 +0000
Received: by outflank-mailman (input) for mailman id 380727;
 Thu, 04 Aug 2022 21:44:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJidi-0003I1-Gn
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 21:44:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJidi-0006Yy-Fy
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 21:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJidi-0003CF-F3
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 21:44:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=DEuia3CNohdSiHEBXvFVfDljE8cJHvsusz3teFpwF5c=; b=de5fAcRytzj+p0N9EOwKKzhEBH
	quxSSiRDlEbiXrlTSqDousIGIN3ukEb+Qqn9SVg1fr1DfCatgLgoPUpx8lgzhjVbOntBUOYaOSyph
	MQD5IaB2rftci1o0MT18k2dGYWTmYfuWnDtjctCeNOQi+VEKMXcNZxZXOO3Iz5kxzgHw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] arm/its: enable LPIs before mapping the collection table
Message-Id: <E1oJidi-0003CF-F3@xenbits.xenproject.org>
Date: Thu, 04 Aug 2022 21:44:22 +0000

commit 271e9e860b7b5ee5fc01a8fd539aa7e1bcb096c6
Author:     Rahul Singh <rahul.singh@arm.com>
AuthorDate: Wed May 4 18:15:12 2022 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Aug 3 14:57:31 2022 -0700

    arm/its: enable LPIs before mapping the collection table
    
    When Xen boots on the platform that implements the GIC 600, ITS
    MAPC_LPI_OFF uncorrectable command error issue is observed.
    
    As per the GIC-600 TRM (Revision: r1p6) MAPC_LPI_OFF command error can
    be reported if the MAPC command has tried to map a collection to a core
    that does not have LPIs enabled. The definition of GICR.EnableLPIs
    also suggests enabling the LPIs before sending any ITS command that
    involves LPIs
    
    0b0 LPI support is disabled. Any doorbell interrupt generated as a
        result of a write to a virtual LPI register must be discarded,
        and any ITS translation requests or commands involving LPIs in
        this Redistributor are ignored.
    
    0b1 LPI support is enabled.
    
    To fix the MAPC command error issue, enable the LPIs using
    GICR_CTLR.EnableLPIs before mapping the collection table.
    
    gicv3_enable_lpis() is using writel_relaxed(), write to the GICR_CTLR
    register may not be visible before gicv3_its_setup_collection() send the
    MAPC command. Use wmb() after writel_relaxed() to make sure register
    write to enable LPIs is visible.
    
    Signed-off-by: Rahul Singh <rahul.singh@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    (cherry picked from commit 95604873ccf56eb81e96ed0dc8b4dec3278f40ca)
---
 xen/arch/arm/gic-v3.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
index 9a3a175ad7..9fbaaa44b4 100644
--- a/xen/arch/arm/gic-v3.c
+++ b/xen/arch/arm/gic-v3.c
@@ -701,6 +701,9 @@ static bool gicv3_enable_lpis(void)
     val = readl_relaxed(GICD_RDIST_BASE + GICR_CTLR);
     writel_relaxed(val | GICR_CTLR_ENABLE_LPIS, GICD_RDIST_BASE + GICR_CTLR);
 
+    /* Make sure the GIC has seen the above */
+    wmb();
+
     return true;
 }
 
@@ -818,11 +821,11 @@ static int gicv3_cpu_init(void)
     /* If the host has any ITSes, enable LPIs now. */
     if ( gicv3_its_host_has_its() )
     {
+        if ( !gicv3_enable_lpis() )
+            return -EBUSY;
         ret = gicv3_its_setup_collection(smp_processor_id());
         if ( ret )
             return ret;
-        if ( !gicv3_enable_lpis() )
-            return -EBUSY;
     }
 
     /* Set priority on PPI and SGI interrupts */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Aug 04 21:44:33 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Aug 2022 21:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380728.615065 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJidt-0003LD-Le; Thu, 04 Aug 2022 21:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380728.615065; Thu, 04 Aug 2022 21:44:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJidt-0003L5-Hh; Thu, 04 Aug 2022 21:44:33 +0000
Received: by outflank-mailman (input) for mailman id 380728;
 Thu, 04 Aug 2022 21:44:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJids-0003Ky-Jl
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 21:44:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJids-0006Z9-J6
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 21:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJids-0003D1-I9
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 21:44:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tDITFOr2KvdwUBO6SRyZ98rKgIm+h3V2DWnIwBxFegQ=; b=mPbrHRyO3stUdx2b35ALWhwIPJ
	2G3dqW8P9xcJI2HrjpzilNbMg6QpEIiKJTxWn7TAY8VUd2r0TuZe9aNTxmNw6cFh3J80ja0nHMcmv
	gS0k31sd602mi0ALWdA0CPC2iKoqpauB7Ybltke25NX1XDNivROIB+QsV8s5S0VPM5Tk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] xen/arm: p2m don't fall over on FEAT_LPA enabled hw
Message-Id: <E1oJids-0003D1-I9@xenbits.xenproject.org>
Date: Thu, 04 Aug 2022 21:44:32 +0000

commit fe02a5342d3ef372ac8eea12dcdbdf3ff7c47379
Author:     Alex Bennée <alex.bennee@linaro.org>
AuthorDate: Thu Apr 28 11:34:10 2022 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Aug 3 14:57:36 2022 -0700

    xen/arm: p2m don't fall over on FEAT_LPA enabled hw
    
    When we introduced FEAT_LPA to QEMU's -cpu max we discovered older
    kernels had a bug where the physical address was copied directly from
    ID_AA64MMFR0_EL1.PARange field. The early cpu_init code of Xen commits
    the same error by blindly copying across the max supported range.
    
    Unsurprisingly when the page tables aren't set up for these greater
    ranges hilarity ensues and the hypervisor crashes fairly early on in
    the boot-up sequence. This happens when we write to the control
    register in enable_mmu().
    
    Attempt to fix this the same way as the Linux kernel does by gating
    PARange to the maximum the hypervisor can handle. I also had to fix up
    code in p2m which panics when it sees an "invalid" entry in PARange.
    
    Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
    Cc: Richard Henderson <richard.henderson@linaro.org>
    Cc: Stefano Stabellini <sstabellini@kernel.org>
    Cc: Julien Grall <julien@xen.org>
    Cc: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
    Cc: Bertrand Marquis <bertrand.marquis@arm.com>
    Tested-by: Luca Fancellu <luca.fancellu@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    (cherry picked from commit 407b13a71e324aba76b11e5f66f59ce4a304a088)
---
 xen/arch/arm/arm64/head.S |  6 ++++++
 xen/arch/arm/p2m.c        | 10 +++++-----
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S
index aa1f88c764..057dd5d925 100644
--- a/xen/arch/arm/arm64/head.S
+++ b/xen/arch/arm/arm64/head.S
@@ -473,6 +473,12 @@ cpu_init:
         ldr   x0, =(TCR_RES1|TCR_SH0_IS|TCR_ORGN0_WBWA|TCR_IRGN0_WBWA|TCR_T0SZ(64-48))
         /* ID_AA64MMFR0_EL1[3:0] (PARange) corresponds to TCR_EL2[18:16] (PS) */
         mrs   x1, ID_AA64MMFR0_EL1
+        /* Limit to 48 bits, 256TB PA range (#5) */
+        ubfm  x1, x1, #0, #3
+        mov   x2, #5
+        cmp   x1, x2
+        csel  x1, x1, x2, lt
+
         bfi   x0, x1, #16, #3
 
         msr   tcr_el2, x0
diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index fb71fa4c1c..3349b464a3 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -32,10 +32,10 @@ static unsigned int __read_mostly max_vmid = MAX_VMID_8_BIT;
 #define P2M_ROOT_PAGES    (1<<P2M_ROOT_ORDER)
 
 /*
- * Set larger than any possible value, so the number of IPA bits can be
+ * Set to the maximum configured support for IPA bits, so the number of IPA bits can be
  * restricted by external entity (e.g. IOMMU).
  */
-unsigned int __read_mostly p2m_ipa_bits = 64;
+unsigned int __read_mostly p2m_ipa_bits = PADDR_BITS;
 
 /* Helpers to lookup the properties of each level */
 static const paddr_t level_masks[] =
@@ -2030,7 +2030,7 @@ void __init setup_virt_paging(void)
         unsigned int root_order; /* Page order of the root of the p2m */
         unsigned int sl0;    /* Desired SL0, maximum in comment */
     } pa_range_info[] = {
-        /* T0SZ minimum and SL0 maximum from ARM DDI 0487A.b Table D4-5 */
+        /* T0SZ minimum and SL0 maximum from ARM DDI 0487H.a Table D5-6 */
         /*      PA size, t0sz(min), root-order, sl0(max) */
         [0] = { 32,      32/*32*/,  0,          1 },
         [1] = { 36,      28/*28*/,  0,          1 },
@@ -2038,7 +2038,7 @@ void __init setup_virt_paging(void)
         [3] = { 42,      22/*22*/,  3,          1 },
         [4] = { 44,      20/*20*/,  0,          2 },
         [5] = { 48,      16/*16*/,  0,          2 },
-        [6] = { 0 }, /* Invalid */
+        [6] = { 52,      12/*12*/,  3,          3 },
         [7] = { 0 }  /* Invalid */
     };
 
@@ -2069,7 +2069,7 @@ void __init setup_virt_paging(void)
         }
     }
 
-    /* pa_range is 4 bits, but the defined encodings are only 3 bits */
+    /* pa_range is 4 bits but we don't support all modes */
     if ( pa_range >= ARRAY_SIZE(pa_range_info) || !pa_range_info[pa_range].pabits )
         panic("Unknown encoding of ID_AA64MMFR0_EL1.PARange %x\n", pa_range);
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Aug 04 21:44:43 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Aug 2022 21:44:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380729.615070 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJie3-0003Nk-ND; Thu, 04 Aug 2022 21:44:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380729.615070; Thu, 04 Aug 2022 21:44:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJie3-0003Nc-JM; Thu, 04 Aug 2022 21:44:43 +0000
Received: by outflank-mailman (input) for mailman id 380729;
 Thu, 04 Aug 2022 21:44:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJie2-0003NU-Mz
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 21:44:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJie2-0006ZK-M9
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 21:44:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJie2-0003Dy-L8
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 21:44:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PEMPCc0hL+l9BQpI/dBeIV/eSqR1W8+qXLXBrXVsPkU=; b=JN5mo1tDkP34affF9wMm1Sd8pC
	OAkZNK+dxoWj2sq2CFppw3RyjzOCC/+tXFhlEMIhtFph0U6H97verjKc1sCAF7FoI/ZQ/nJKc7VCi
	oIWDmOPyMOMLxZgv+N+/zAest55OZ7X8KBAfM6tmNOabd8teOuLtXNqmOmBzKwLc8wHQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] xen/arm: Avoid overflow using MIDR_IMPLEMENTOR_MASK
Message-Id: <E1oJie2-0003Dy-L8@xenbits.xenproject.org>
Date: Thu, 04 Aug 2022 21:44:42 +0000

commit 048185188fbae9d0e7d25992d8318be2a4a5a2cc
Author:     Michal Orzel <michal.orzel@arm.com>
AuthorDate: Thu May 5 13:59:06 2022 +0200
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Aug 3 14:57:43 2022 -0700

    xen/arm: Avoid overflow using MIDR_IMPLEMENTOR_MASK
    
    Value of macro MIDR_IMPLEMENTOR_MASK exceeds the range of integer
    and can lead to overflow. Currently there is no issue as it is used
    in an expression implicitly casted to u32 in MIDR_IS_CPU_MODEL_RANGE.
    To avoid possible problems, fix the macro.
    
    Signed-off-by: Michal Orzel <michal.orzel@arm.com>
    Link: https://lore.kernel.org/r/20220426070603.56031-1-michal.orzel@arm.com
    Acked-by: Catalin Marinas <catalin.marinas@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    (cherry picked from commit aa1cba100bff84b211f27639bd6efeaf7e701bcc)
---
 xen/include/asm-arm/processor.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h
index 852b5f3c24..7a1c4c4410 100644
--- a/xen/include/asm-arm/processor.h
+++ b/xen/include/asm-arm/processor.h
@@ -39,7 +39,7 @@
 #define MIDR_VARIANT(midr) \
     (((midr) & MIDR_VARIANT_MASK) >> MIDR_VARIANT_SHIFT)
 #define MIDR_IMPLEMENTOR_SHIFT  24
-#define MIDR_IMPLEMENTOR_MASK   (0xff << MIDR_IMPLEMENTOR_SHIFT)
+#define MIDR_IMPLEMENTOR_MASK   (0xffU << MIDR_IMPLEMENTOR_SHIFT)
 #define MIDR_IMPLEMENTOR(midr) \
     (((midr) & MIDR_IMPLEMENTOR_MASK) >> MIDR_IMPLEMENTOR_SHIFT)
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Aug 04 21:44:53 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Aug 2022 21:44:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380730.615072 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJieD-0003RR-Nk; Thu, 04 Aug 2022 21:44:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380730.615072; Thu, 04 Aug 2022 21:44:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJieD-0003RJ-Ku; Thu, 04 Aug 2022 21:44:53 +0000
Received: by outflank-mailman (input) for mailman id 380730;
 Thu, 04 Aug 2022 21:44:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJieC-0003RB-Q5
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 21:44:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJieC-0006ZY-PK
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 21:44:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJieC-0003EX-OK
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 21:44:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nfOvZUx47FVXblkxhtckLvdVW50X9P5Ulan48LKp6y0=; b=H4k0Y7R14mA6GhJK44IhfAVgp6
	Kp3crVNj+uQNGJycv1+c9xc4ZekoxzYbN6YY8b5odoytoYjcWC2j/5J1p1R8KnQ67/+2P4HuEvu/t
	ehTLdvOejYCYv6afQmmmad3SvEYE3TS8YQCm/xd7IP08C1WNLIwee21iC9FLI9/MBnIQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] xen/arm: traps: Fix reference to invalid erratum ID
Message-Id: <E1oJieC-0003EX-OK@xenbits.xenproject.org>
Date: Thu, 04 Aug 2022 21:44:52 +0000

commit 6f65040081b78662bf6ecde9a3b73ee04758d0e9
Author:     Michal Orzel <michal.orzel@arm.com>
AuthorDate: Fri Jun 10 10:33:56 2022 +0200
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Aug 3 14:57:48 2022 -0700

    xen/arm: traps: Fix reference to invalid erratum ID
    
    The correct erratum ID should be 834220.
    
    Fixes: 0a7ba2936457 ("xen/arm: arm64: Add Cortex-A57 erratum 834220 workaround")
    Signed-off-by: Michal Orzel <michal.orzel@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    (cherry picked from commit a6f7ed5fc7d5fb5001ef82db99d34bc8a85fc2b6)
---
 xen/arch/arm/traps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 219ab3c3fb..bbbd15e9fa 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -1862,7 +1862,7 @@ static inline bool hpfar_is_valid(bool s1ptw, uint8_t fsc)
      *  1. the stage 2 fault happen during a stage 1 page table walk
      *  (the bit ESR_EL2.S1PTW is set)
      *  2. the fault was due to a translation fault and the processor
-     *  does not carry erratum #8342220
+     *  does not carry erratum #834220
      *
      * Note that technically HPFAR is valid for other cases, but they
      * are currently not supported by Xen.
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Aug 04 21:45:03 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Aug 2022 21:45:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380731.615076 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJieN-0003UW-Po; Thu, 04 Aug 2022 21:45:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380731.615076; Thu, 04 Aug 2022 21:45: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 1oJieN-0003UP-Md; Thu, 04 Aug 2022 21:45:03 +0000
Received: by outflank-mailman (input) for mailman id 380731;
 Thu, 04 Aug 2022 21:45:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJieM-0003UD-Sv
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 21:45:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJieM-0006aD-SD
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 21:45:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJieM-0003FF-RV
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 21:45:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=h5qYzd/Cvv+e9LNeaIFF95GQSgJmAoFL6fjjlOGOFpU=; b=vlKxkwWUB7f6X9jfJngBU1Gb93
	GY3kKvtCiuX1UL/nk+4bAOYSwrAoHcLpYIty92keNmwHLStOQqjjIADCi5fmcgDMgpcSDDm2+VHgQ
	l2GbbNKSSZQFUhBB9boauNRCqD61ppq3iR/Fl5nF/J+oYsWqFB91wCiDxvnVzOXjObJQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] xen/arm: head: Add missing isb after writing to SCTLR_EL2/HSCTLR
Message-Id: <E1oJieM-0003FF-RV@xenbits.xenproject.org>
Date: Thu, 04 Aug 2022 21:45:02 +0000

commit 0d362e5ed3fa1b307834bcffbf7fd5341e32ebfd
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Sat Jul 16 15:34:07 2022 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Aug 3 14:57:53 2022 -0700

    xen/arm: head: Add missing isb after writing to SCTLR_EL2/HSCTLR
    
    Write to SCTLR_EL2/HSCTLR may not be visible until the next context
    synchronization. When initializing the CPU, we want the update to take
    effect right now. So add an isb afterwards.
    
    Spec references:
        - AArch64: D13.1.2 ARM DDI 0406C.d
        - AArch32 v8: G8.1.2 ARM DDI 0406C.d
        - AArch32 v7: B5.6.3 ARM DDI 0406C.d
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Michal Orzel <michal.orzel@arm.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    (cherry picked from commit 25424d1a6b7b7e875230aba77c2f044a4883e49a)
---
 xen/arch/arm/arm32/head.S | 1 +
 xen/arch/arm/arm64/head.S | 1 +
 2 files changed, 2 insertions(+)

diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S
index 7178865f48..854481f4f9 100644
--- a/xen/arch/arm/arm32/head.S
+++ b/xen/arch/arm/arm32/head.S
@@ -353,6 +353,7 @@ cpu_init_done:
 
         ldr   r0, =HSCTLR_SET
         mcr   CP32(r0, HSCTLR)
+        isb
 
         mov   pc, r5                        /* Return address is in r5 */
 ENDPROC(cpu_init)
diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S
index 057dd5d925..42a2177c53 100644
--- a/xen/arch/arm/arm64/head.S
+++ b/xen/arch/arm/arm64/head.S
@@ -485,6 +485,7 @@ cpu_init:
 
         ldr   x0, =SCTLR_EL2_SET
         msr   SCTLR_EL2, x0
+        isb
 
         /*
          * Ensure that any exceptions encountered at EL2
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Aug 04 21:45:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Aug 2022 21:45:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380732.615080 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJieX-0003X7-RW; Thu, 04 Aug 2022 21:45:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380732.615080; Thu, 04 Aug 2022 21:45: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 1oJieX-0003Wz-OZ; Thu, 04 Aug 2022 21:45:13 +0000
Received: by outflank-mailman (input) for mailman id 380732;
 Thu, 04 Aug 2022 21:45:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJieW-0003Wq-Vm
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 21:45:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJieW-0006aN-V4
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 21:45:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJieW-0003Fj-UL
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 21:45:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Y2qRZ9TrQyU0IU8rY4kW0IOJeEIYDInswDONGUGAocg=; b=TagfBQb+HFjYseMfjtrzHBVu9N
	0q/IZpq6OReEDkRtKcwTGTg1ch+WgJ/AkvkfQaPGTqtY7g6gIEbDug33YJLU7N+A9eQfHflbQEGO/
	jiwZ1DdgHLkOTDQT3guTG/lptzEwq9xBd4aOquJMoxc+aLQwi93M94axNxDXr27H5bvQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] arm/vgic-v3: fix virq offset in the rank when storing irouter
Message-Id: <E1oJieW-0003Fj-UL@xenbits.xenproject.org>
Date: Thu, 04 Aug 2022 21:45:12 +0000

commit 3050769a171a881b6225c98c750e1c5f92311081
Author:     Hongda Deng <Hongda.Deng@arm.com>
AuthorDate: Fri Jul 29 16:36:02 2022 +0800
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Aug 3 14:57:58 2022 -0700

    arm/vgic-v3: fix virq offset in the rank when storing irouter
    
    When vGIC performs irouter registers emulation, to get the target vCPU
    via virq conveniently, Xen doesn't store the irouter value directly,
    instead it will use the value (affinities) in irouter to calculate the
    target vCPU, and then save the target vCPU in irq rank->vcpu[offset].
    
    When vGIC tries to get the target vCPU, it first calculates the target
    vCPU index via
      int target = read_atomic(&rank->vcpu[virq & INTERRUPT_RANK_MASK]);
    and then it gets the target vCPU via
      v->domain->vcpu[target];
    
    When vGIC tries to store irouter for one virq, the target vCPU index
    in the rank is computed as
      offset &= virq & INTERRUPT_RANK_MASK;
    finally it gets the target vCPU via
      d->vcpu[read_atomic(&rank->vcpu[offset])];
    
    There is a difference between them while getting the target vCPU index
    in the rank. Actually (virq & INTERRUPT_RANK_MASK) would already get
    the target vCPU index in the rank, it's wrong to add '&' before '=' when
    calculate the offset.
    
    For example, the target vCPU index in the rank should be 6 for virq 38,
    but vGIC will get offset=0 when vGIC stores the irouter for this virq,
    and finally vGIC will access the wrong target vCPU index in the rank
    when updating the irouter.
    
    Fixes: 5d495f4349b5 ("xen/arm: vgic: Optimize the way to store the target vCPU in the rank")
    Signed-off-by: Hongda Deng <Hongda.Deng@arm.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    (cherry picked from commit 800f21499e0ec112771ce1e94490ca5811578bc2)
---
 xen/arch/arm/vgic-v3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/vgic-v3.c b/xen/arch/arm/vgic-v3.c
index 65bb7991a6..191cfd0959 100644
--- a/xen/arch/arm/vgic-v3.c
+++ b/xen/arch/arm/vgic-v3.c
@@ -135,7 +135,7 @@ static void vgic_store_irouter(struct domain *d, struct vgic_irq_rank *rank,
     ASSERT(virq >= 32);
 
     /* Get the index in the rank */
-    offset &= virq & INTERRUPT_RANK_MASK;
+    offset = virq & INTERRUPT_RANK_MASK;
 
     new_vcpu = vgic_v3_irouter_to_vcpu(d, irouter);
     old_vcpu = d->vcpu[read_atomic(&rank->vcpu[offset])];
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Aug 04 21:45:23 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Aug 2022 21:45:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380733.615083 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJieh-0003Zv-Sf; Thu, 04 Aug 2022 21:45:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380733.615083; Thu, 04 Aug 2022 21:45: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 1oJieh-0003Zo-Q6; Thu, 04 Aug 2022 21:45:23 +0000
Received: by outflank-mailman (input) for mailman id 380733;
 Thu, 04 Aug 2022 21:45:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJieh-0003Zb-2P
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 21:45:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJieh-0006bV-1g
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 21:45:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJieh-0003GC-0u
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 21:45:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=LtUqFqEej9kII+7kdRW7qdT5/GiTtVtobXcXYq10hL4=; b=pMxYSDAPFzoSnyjMzE4Fwodk7q
	B9siB3/x7LuOFvaFG62NTnOtS56bCj3jfHx7JJONDtaImmMIH2kfsJm9DIBAbPUECAvrDwxNqMW4R
	H8NXBT/YS8ldsMkZNSzNnDkqAnFA6nejAdDlww/6lmdfDV0WbqzB91LFfkxEBRCp/yl4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] xen/arm: avoid overflow when setting vtimer in context switch
Message-Id: <E1oJieh-0003GC-0u@xenbits.xenproject.org>
Date: Thu, 04 Aug 2022 21:45:23 +0000

commit 48e7440ec6eb6eb99011a549a649c44632f69edb
Author:     Jiamei Xie <jiamei.xie@arm.com>
AuthorDate: Wed Jul 6 16:25:58 2022 +0800
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Aug 3 14:58:04 2022 -0700

    xen/arm: avoid overflow when setting vtimer in context switch
    
    virt_vtimer_save() will calculate the next deadline when the vCPU is
    scheduled out. At the moment, Xen will use the following equation:
    
      virt_timer.cval + virt_time_base.offset - boot_count
    
    The three values are 64-bit and one (cval) is controlled by domain. In
    theory, it would be possible that the domain has started a long time
    after the system boot. So virt_time_base.offset - boot_count may be a
    large numbers.
    
    This means a domain may inadvertently set a cval so the result would
    overflow. Consequently, the deadline would be set very far in the
    future. This could result to loss of timer interrupts or the vCPU
    getting block "forever".
    
    One way to solve the problem, would be to separately
       1) compute when the domain was created in ns
       2) convert cval to ns
       3) Add 1 and 2 together
    
    The first part of the equation never change (the value is set/known at
    domain creation). So take the opportunity to store it in domain structure.
    
    Signed-off-by: Jiamei Xie <jiamei.xie@arm.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    (cherry picked from commit 6655eb81092a94e065fdcd0b47a1b1d69dc4e54c)
---
 xen/arch/arm/vtimer.c        | 9 ++++++---
 xen/include/asm-arm/domain.h | 1 +
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/xen/arch/arm/vtimer.c b/xen/arch/arm/vtimer.c
index 0196951af4..23198d0396 100644
--- a/xen/arch/arm/vtimer.c
+++ b/xen/arch/arm/vtimer.c
@@ -63,7 +63,9 @@ static void virt_timer_expired(void *data)
 int domain_vtimer_init(struct domain *d, struct xen_arch_domainconfig *config)
 {
     d->arch.virt_timer_base.offset = get_cycles();
-    d->time_offset.seconds = ticks_to_ns(d->arch.virt_timer_base.offset - boot_count);
+    d->arch.virt_timer_base.nanoseconds =
+        ticks_to_ns(d->arch.virt_timer_base.offset - boot_count);
+    d->time_offset.seconds = d->arch.virt_timer_base.nanoseconds;
     do_div(d->time_offset.seconds, 1000000000);
 
     config->clock_frequency = timer_dt_clock_frequency;
@@ -144,8 +146,9 @@ void virt_timer_save(struct vcpu *v)
     if ( (v->arch.virt_timer.ctl & CNTx_CTL_ENABLE) &&
          !(v->arch.virt_timer.ctl & CNTx_CTL_MASK))
     {
-        set_timer(&v->arch.virt_timer.timer, ticks_to_ns(v->arch.virt_timer.cval +
-                  v->domain->arch.virt_timer_base.offset - boot_count));
+        set_timer(&v->arch.virt_timer.timer,
+                  v->domain->arch.virt_timer_base.nanoseconds +
+                  ticks_to_ns(v->arch.virt_timer.cval));
     }
 }
 
diff --git a/xen/include/asm-arm/domain.h b/xen/include/asm-arm/domain.h
index 9b3647587a..7f8ddd3f5c 100644
--- a/xen/include/asm-arm/domain.h
+++ b/xen/include/asm-arm/domain.h
@@ -58,6 +58,7 @@ struct arch_domain
 
     struct {
         uint64_t offset;
+        s_time_t nanoseconds;
     } virt_timer_base;
 
     struct vgic_dist vgic;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Aug 04 21:45:33 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Aug 2022 21:45:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380734.615087 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJier-0003cd-UC; Thu, 04 Aug 2022 21:45:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380734.615087; Thu, 04 Aug 2022 21:45: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 1oJier-0003cW-Rd; Thu, 04 Aug 2022 21:45:33 +0000
Received: by outflank-mailman (input) for mailman id 380734;
 Thu, 04 Aug 2022 21:45:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJier-0003cP-5S
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 21:45:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJier-0006cR-4f
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 21:45:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJier-0003Gi-3h
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 21:45:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FwUUprQsnc5RIPNpPZAHe3hdPOtyk5qegsE+t8LmlI8=; b=HnwDAPZk8saJdxfjdqXcCSTK+2
	4/c/EaEwnWvfsiwt/0yxrOUE3e6KVG5pnRHVMJvIQTx3J/MuL/V3Mh2TkZiwrDflj1OwthvuE30Qe
	t79xWN52b984X+OEfHcKxuBFAortdagz4WZzKe0RzhTiK5YWkdIdhdYs2XthKsuOXco8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] xen/arm: Advertise workaround 1 if we apply 3
Message-Id: <E1oJier-0003Gi-3h@xenbits.xenproject.org>
Date: Thu, 04 Aug 2022 21:45:33 +0000

commit a0b823dca2ecb1b0b0d78dfa46bb7445b60ac8bd
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Tue May 3 10:38:30 2022 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Aug 3 14:58:08 2022 -0700

    xen/arm: Advertise workaround 1 if we apply 3
    
    SMCC_WORKAROUND_3 is handling both Spectre v2 and spectre BHB.
    So when a guest is asking if we support workaround 1, tell yes if we
    apply workaround 3 on exception entry as it handles it.
    
    This will allow guests not supporting Spectre BHB but impacted by
    spectre v2 to still handle it correctly.
    The modified behaviour is coherent with what the Linux kernel does in
    KVM for guests.
    
    While there use ARM_SMCCC_SUCCESS instead of 0 for the return code value
    for workaround detection to be coherent with Workaround 2 handling.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    (cherry picked from commit af570d1c90f1ed6040d724732f6c582383782e90)
---
 xen/arch/arm/vsmc.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/xen/arch/arm/vsmc.c b/xen/arch/arm/vsmc.c
index b633ff2fe8..676740ef15 100644
--- a/xen/arch/arm/vsmc.c
+++ b/xen/arch/arm/vsmc.c
@@ -104,8 +104,13 @@ static bool handle_arch(struct cpu_user_regs *regs)
         switch ( arch_func_id )
         {
         case ARM_SMCCC_ARCH_WORKAROUND_1_FID:
-            if ( cpus_have_cap(ARM_HARDEN_BRANCH_PREDICTOR) )
-                ret = 0;
+            /*
+             * Workaround 3 is also mitigating spectre v2 so advertise that we
+             * support Workaround 1 if we do Workaround 3 on exception entry.
+             */
+            if ( cpus_have_cap(ARM_HARDEN_BRANCH_PREDICTOR) ||
+                 cpus_have_cap(ARM_WORKAROUND_BHB_SMCC_3) )
+                ret = ARM_SMCCC_SUCCESS;
             break;
         case ARM_SMCCC_ARCH_WORKAROUND_2_FID:
             switch ( get_ssbd_state() )
@@ -126,7 +131,7 @@ static bool handle_arch(struct cpu_user_regs *regs)
             break;
         case ARM_SMCCC_ARCH_WORKAROUND_3_FID:
             if ( cpus_have_cap(ARM_WORKAROUND_BHB_SMCC_3) )
-                ret = 0;
+                ret = ARM_SMCCC_SUCCESS;
             break;
         }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Aug 04 21:45:44 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Aug 2022 21:45:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380735.615091 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJif2-0003hF-0s; Thu, 04 Aug 2022 21:45:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380735.615091; Thu, 04 Aug 2022 21:45: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 1oJif1-0003h7-UU; Thu, 04 Aug 2022 21:45:43 +0000
Received: by outflank-mailman (input) for mailman id 380735;
 Thu, 04 Aug 2022 21:45:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJif1-0003gP-8A
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 21:45:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJif1-0006cW-7V
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 21:45:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJif1-0003H7-6k
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 21:45:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ktVwRx/U6jimvOBEdJURFDogM7261xo0C0CC9BwBPmQ=; b=zN5nqkZCNPieojXW1+w4xxNn4l
	bZWW6G1Y3no9WvY2OJ5LgCqA9B3KglRnxPGGo7fibL0SA08m57bi2OqGutRNb96Z9+pENiuz4IobL
	QOcT06lVHpZFNc0GyBWbk0IMzkjsNkWwwGNI1gx5/QqvyERattqkDwfpBGuxR21EF2rY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] xen: arm: Don't use stop_cpu() in halt_this_cpu()
Message-Id: <E1oJif1-0003H7-6k@xenbits.xenproject.org>
Date: Thu, 04 Aug 2022 21:45:43 +0000

commit 48b67651746f3124b0d5d30147180f1238d2e9c6
Author:     Dmytro Semenets <dmytro_semenets@epam.com>
AuthorDate: Thu Jun 23 10:44:28 2022 +0300
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Aug 3 14:58:11 2022 -0700

    xen: arm: Don't use stop_cpu() in halt_this_cpu()
    
    When shutting down (or rebooting) the platform, Xen will call stop_cpu()
    on all the CPUs but one. The last CPU will then request the system to
    shutdown/restart.
    
    On platform using PSCI, stop_cpu() will call PSCI CPU off. Per the spec
    (section 5.5.2 DEN0022D.b), the call could return DENIED if the Trusted
    OS is resident on the CPU that is about to be turned off.
    
    As Xen doesn't migrate off the trusted OS (which BTW may not be
    migratable), it would be possible to hit the panic().
    
    In the ideal situation, Xen should migrate the trusted OS or make sure
    the CPU off is not called. However, when shutting down (or rebooting)
    the platform, it is pointless to try to turn off all the CPUs (per
    section 5.10.2, it is only required to put the core in a known state).
    
    So solve the problem by open-coding stop_cpu() in halt_this_cpu() and
    not call PSCI CPU off.
    
    Signed-off-by: Dmytro Semenets <dmytro_semenets@epam.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    (cherry picked from commit ee11f092b515bf3c926eaad053d12d3f2b6e593e)
---
 xen/arch/arm/shutdown.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/shutdown.c b/xen/arch/arm/shutdown.c
index 3dc6819d56..a9aea19e8e 100644
--- a/xen/arch/arm/shutdown.c
+++ b/xen/arch/arm/shutdown.c
@@ -8,7 +8,12 @@
 
 static void noreturn halt_this_cpu(void *arg)
 {
-    stop_cpu();
+    local_irq_disable();
+    /* Make sure the write happens before we sleep forever */
+    dsb(sy);
+    isb();
+    while ( 1 )
+        wfi();
 }
 
 void machine_halt(void)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Aug 04 21:45:57 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Aug 2022 21:45:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380736.615096 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJifF-0003kh-2a; Thu, 04 Aug 2022 21:45:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380736.615096; Thu, 04 Aug 2022 21:45:57 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJifE-0003kZ-W5; Thu, 04 Aug 2022 21:45:56 +0000
Received: by outflank-mailman (input) for mailman id 380736;
 Thu, 04 Aug 2022 21:45:56 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJifE-0003kP-68
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 21:45:56 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJifE-0006cg-5P
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 21:45:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJifE-0003QH-4b
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 21:45:56 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=uhf+X1Ms83RG6wfviweFNoMUOVYZr1O2dQYpsIptiC8=; b=AGBg6h9ru0ib2DOuLdY7plWOXH
	awPNgegIsenXYbGjSzMtAhirrcIa2mZJB96OeXY/pdChQv98z2I6lx3xrl/9VXNngLKKi/lnoIFc6
	ShjLMolIYJb+FXJY+1v0K2TmVndx7PX6ZAAXsEPHH4OUba7m6zN0owS8grapjNW5YqrU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/char: imx-lpuart: Fix MISRA C 2012 Rule 20.7 violation
Message-Id: <E1oJifE-0003QH-4b@xenbits.xenproject.org>
Date: Thu, 04 Aug 2022 21:45:56 +0000

commit 5b9eca17cb981a08738e9d9ec3d6b91113daeb0e
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Tue Aug 2 10:54:33 2022 +0300
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Thu Aug 4 14:37:22 2022 -0700

    xen/char: imx-lpuart: Fix MISRA C 2012 Rule 20.7 violation
    
    The macro parameter 'off' is used as an expression and it is good to be
    enclosed in parentheses to prevent against unintended expansion.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/drivers/char/imx-lpuart.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/char/imx-lpuart.c b/xen/drivers/char/imx-lpuart.c
index 2709136081..9c1f3b71a3 100644
--- a/xen/drivers/char/imx-lpuart.c
+++ b/xen/drivers/char/imx-lpuart.c
@@ -26,8 +26,8 @@
 #include <asm/imx-lpuart.h>
 #include <asm/io.h>
 
-#define imx_lpuart_read(uart, off)       readl((uart)->regs + off)
-#define imx_lpuart_write(uart, off, val) writel((val), (uart)->regs + off)
+#define imx_lpuart_read(uart, off)       readl((uart)->regs + (off))
+#define imx_lpuart_write(uart, off, val) writel((val), (uart)->regs + (off))
 
 static struct imx_lpuart {
     uint32_t baud, clock_hz, data_bits, parity, stop_bits, fifo_size;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 04 21:46:07 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Aug 2022 21:46:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380739.615111 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJifP-00043K-HN; Thu, 04 Aug 2022 21:46:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380739.615111; Thu, 04 Aug 2022 21:46:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJifP-00043F-EM; Thu, 04 Aug 2022 21:46:07 +0000
Received: by outflank-mailman (input) for mailman id 380739;
 Thu, 04 Aug 2022 21:46:06 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJifO-00042g-8z
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 21:46:06 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJifO-0006d2-8F
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 21:46:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJifO-0003Qz-7T
 for xen-changelog@lists.xenproject.org; Thu, 04 Aug 2022 21:46:06 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3ZxJodZNn/JHWK+4gOpSFxLSlelWJr6PrPUb6gwp5oo=; b=ZkP66qdvtsXTTr1LQXZ/F2+ApG
	1nTp6TC1KSJnSMx4O/SFJuhQseWfMbNAMlR401FsX+T5jrsfDFv4+wBP/kG9q53GxYERyVmyeYIki
	wXVTqO1aXwO/TtbefgQb4i4mO0kIs2Y0VfQMGECjsThTupuVoe6qU/4r20g0aw72pBhc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/char: mvebu-uart: Fix MISRA C 2012 Rule 20.7 violation
Message-Id: <E1oJifO-0003Qz-7T@xenbits.xenproject.org>
Date: Thu, 04 Aug 2022 21:46:06 +0000

commit 1f7543c039f6b9eb182f0395965b9d414ac774c4
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Wed Aug 3 10:09:58 2022 +0300
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Thu Aug 4 14:38:09 2022 -0700

    xen/char: mvebu-uart: Fix MISRA C 2012 Rule 20.7 violation
    
    The macro parameters 'off' and 'uart' are used as expressions and it is
    good to be enclosed in parentheses to prevent against unintended expansion.
    
    For the 'uart' case, in mvebu3700_write(), correct the second parentheses
    that seems to have been accidently misplaced.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/drivers/char/mvebu-uart.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/char/mvebu-uart.c b/xen/drivers/char/mvebu-uart.c
index 835d1ace3c..a00618b96f 100644
--- a/xen/drivers/char/mvebu-uart.c
+++ b/xen/drivers/char/mvebu-uart.c
@@ -64,8 +64,8 @@ static struct mvebu3700_uart {
     struct vuart_info vuart;
 } mvebu3700_com = {0};
 
-#define mvebu3700_read(uart, off)           readl((uart)->regs + off)
-#define mvebu3700_write(uart, off, val)     writel(val, (uart->regs) + off)
+#define mvebu3700_read(uart, off)           readl((uart)->regs + (off))
+#define mvebu3700_write(uart, off, val)     writel(val, (uart)->regs + (off))
 
 static void mvebu3700_uart_interrupt(int irq, void *data,
                                      struct cpu_user_regs *regs)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 05 06:44:14 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Aug 2022 06:44:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380832.615218 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJr42-0008VP-IV; Fri, 05 Aug 2022 06:44:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380832.615218; Fri, 05 Aug 2022 06: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 1oJr42-0008VH-Fe; Fri, 05 Aug 2022 06:44:06 +0000
Received: by outflank-mailman (input) for mailman id 380832;
 Fri, 05 Aug 2022 06:44:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJr40-0008V9-Lo
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 06:44:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJr40-0008SC-HU
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 06:44:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJr40-0004FK-Ga
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 06:44:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0ksP/wouQ/sbUd3K8N27r2hDzpR9WR9j3PhdWlwqRXw=; b=QErN90plO5ZA5aXTVfTFcdh7T2
	4aO0n68qV6Y5sG/YcKuZFngARE9BkVKIOLBu57KfRZ60G+a0PPz5Cix9R3KbEz3e8aLHfnjM0TyRY
	E3n/6XOcO0yJOF1ozzJRowMWpXzFL60xGHggjP+oSyREb4N2GgDLBU0r/+VM024J7DfQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xenstore: add documentation for new set/get-feature commands
Message-Id: <E1oJr40-0004FK-Ga@xenbits.xenproject.org>
Date: Fri, 05 Aug 2022 06:44:04 +0000

commit e2bd45f4ca498c877a0bac8457832b02db676ae5
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Aug 5 08:36:54 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Aug 5 08:36:54 2022 +0200

    tools/xenstore: add documentation for new set/get-feature commands
    
    Add documentation for two new Xenstore wire commands SET_FEATURE and
    GET_FEATURE used to set or query the Xenstore features visible in the
    ring page of a given domain.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 docs/misc/xenstore.txt | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/docs/misc/xenstore.txt b/docs/misc/xenstore.txt
index 334dc8b6fd..054247c404 100644
--- a/docs/misc/xenstore.txt
+++ b/docs/misc/xenstore.txt
@@ -320,6 +320,23 @@ SET_TARGET		<domid>|<tdomid>|
 
 	xenstored prevents the use of SET_TARGET other than by dom0.
 
+GET_FEATURE		[<domid>|]		<value>|
+SET_FEATURE		<domid>|<value>|
+	Returns or sets the contents of the "feature" field copied to
+	offset 2064 of the Xenstore ring page of the domain specified by
+	<domid>. <value> is a decimal number being a logical or of the
+	feature bits as defined in docs/misc/xenstore-ring.txt. Trying
+	to set a bit for a feature not being supported by the running
+	Xenstore will be denied. Providing no <domid> with the
+	GET_FEATURE command will return the features which are supported
+	by Xenstore.
+
+	SET_FEATURE for a domain will be rejected after the INTRODUCE
+	command for this domain has been sent to xenstored.
+
+	xenstored prevents the use of GET_FEATURE and SET_FEATURE other
+	than by dom0.
+
 ---------- Miscellaneous ----------
 
 CONTROL			<command>|[<parameters>|]
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 05 06:44:15 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Aug 2022 06:44:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380833.615222 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJr4B-00005N-K1; Fri, 05 Aug 2022 06:44:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380833.615222; Fri, 05 Aug 2022 06:44:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJr4B-00005F-H5; Fri, 05 Aug 2022 06:44:15 +0000
Received: by outflank-mailman (input) for mailman id 380833;
 Fri, 05 Aug 2022 06:44:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJr4A-000054-Lc
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 06:44:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJr4A-0008SG-Kn
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 06:44:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJr4A-0004Fw-Jq
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 06:44:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Jg5lAM96/5zg4vl7w8DoV20TEp61iacBNEs5m0zSYI8=; b=M7lA+BQs53NthVfI1HxT4la2fe
	X/PhdNj/fPCt1D4OxQUp+x0/hTRgkCaOyrwQ3VDs3EsReXD7bz5NehepiaE9PrUY5SxWMECXbArXu
	uF/Ot3HYaVYiMnOgspysEqrzkmYFD1YiCeBHDM4PxoyIhJsYO336DnIWa5qqdjblvPv0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/compiler: fix MISRA C 2012 Rule 20.7 violation
Message-Id: <E1oJr4A-0004Fw-Jq@xenbits.xenproject.org>
Date: Fri, 05 Aug 2022 06:44:14 +0000

commit 7177b2c3265a18722cd4a89542a28815f7b13622
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Fri Aug 5 08:37:13 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Aug 5 08:37:13 2022 +0200

    xen/compiler: fix MISRA C 2012 Rule 20.7 violation
    
    In __must_be_array(), the macro parameter 'a' is used as expression and
    therefore it is good to be enclosed in parentheses to prevent against
    unintended expansions.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/xen/compiler.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/include/xen/compiler.h b/xen/include/xen/compiler.h
index 933aec09a9..a563130334 100644
--- a/xen/include/xen/compiler.h
+++ b/xen/include/xen/compiler.h
@@ -123,7 +123,7 @@
 
 /* &a[0] degrades to a pointer: a different type from an array */
 #define __must_be_array(a) \
-  BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0])))
+  BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&(a)[0])))
 
 #ifdef CONFIG_CC_HAS_VISIBILITY_ATTRIBUTE
 /* Results in more efficient PIC code (no indirections through GOT or PLT). */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 05 06:44:25 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Aug 2022 06:44:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380834.615226 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJr4L-00008Q-LL; Fri, 05 Aug 2022 06:44:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380834.615226; Fri, 05 Aug 2022 06:44:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJr4L-00008I-Ie; Fri, 05 Aug 2022 06:44:25 +0000
Received: by outflank-mailman (input) for mailman id 380834;
 Fri, 05 Aug 2022 06:44:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJr4K-000087-OQ
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 06:44:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJr4K-0008SZ-NY
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 06:44:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJr4K-0004GL-Mq
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 06:44:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tRgMPj7TXg+GAM3OTpxABv14cSzt6N///KlJf9Sr1+A=; b=Y+9btdyCY10BlaCXgQKZVwWleW
	441q86ZQA0g0tPASIfWirMkHJ+brWjimXG51aGzQdbg9nRD8I0I/O/zdChu9+6nUmygKCgPRRgXMf
	Hix+R7kaIOE5HH1aE/ADlJSw9356swyImvzVMsuJ0u00Pq23I7v1+wZ1LZfWPVcRAWhs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/hypfs: check the return value of snprintf to avoid leaking stack accidently
Message-Id: <E1oJr4K-0004GL-Mq@xenbits.xenproject.org>
Date: Fri, 05 Aug 2022 06:44:24 +0000

commit 33bd9c91865b420adec02380c465e81031b0150a
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Fri Aug 5 08:38:23 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Aug 5 08:38:23 2022 +0200

    xen/hypfs: check the return value of snprintf to avoid leaking stack accidently
    
    The function snprintf() returns the number of characters that would have been
    written in the buffer if the buffer size had been sufficiently large,
    not counting the terminating null character.
    Hence, the value returned is not guaranteed to be smaller than the buffer size.
    Check the return value of snprintf() to prevent leaking stack contents to the
    guest by accident.
    
    Also, for debug builds, add an assertion to ensure that the assumption made on
    the size of the destination buffer still holds.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 xen/common/hypfs.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/common/hypfs.c b/xen/common/hypfs.c
index acd258edf2..cdf4ee0171 100644
--- a/xen/common/hypfs.c
+++ b/xen/common/hypfs.c
@@ -377,6 +377,11 @@ int hypfs_read_dyndir_id_entry(const struct hypfs_entry_dir *template,
     unsigned int e_namelen, e_len;
 
     e_namelen = snprintf(name, sizeof(name), template->e.name, id);
+    if ( e_namelen >= sizeof(name) )
+    {
+        ASSERT_UNREACHABLE();
+        return -ENOBUFS;
+    }
     e_len = DIRENTRY_SIZE(e_namelen);
     direntry.e.pad = 0;
     direntry.e.type = template->e.type;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 05 06:44:35 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Aug 2022 06:44:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.380835.615229 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJr4V-0000Bf-Ma; Fri, 05 Aug 2022 06:44:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 380835.615229; Fri, 05 Aug 2022 06: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 1oJr4V-0000BY-K7; Fri, 05 Aug 2022 06:44:35 +0000
Received: by outflank-mailman (input) for mailman id 380835;
 Fri, 05 Aug 2022 06:44:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJr4U-0000BS-Rd
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 06:44:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJr4U-0008T2-Qn
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 06:44:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJr4U-0004Gs-Pe
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 06:44:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=T4TX22FgsXAtLf3MvoZgdNbDj6PUmubE8WUpJFond+4=; b=iK+aH6j0TSyC1NpmhH+ulGy86D
	x4PZzURo85ifRf0zpEf5Rfq59oNeP/gCsOz9EnlJp1CL3bdCc5GYaXOXCkevBNMRKI5zt/N7DP4dH
	BRvRYobIQHSqb/TTrclB15uvoRK3j52AQnjjGPGmb0IBVyDcsH766CoQyL/38T185Gzs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] ChangeLog: mention IOMMU superpage support
Message-Id: <E1oJr4U-0004Gs-Pe@xenbits.xenproject.org>
Date: Fri, 05 Aug 2022 06:44:34 +0000

commit cc7410683db0a98758d03401b628ba8652c20c18
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Aug 5 08:39:02 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Aug 5 08:39:02 2022 +0200

    ChangeLog: mention IOMMU superpage support
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Henry Wang <Henry.Wang@arm.com>
---
 CHANGELOG.md | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6a7755d7b0..a87a193e15 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - On x86 "vga=current" can now be used together with GrUB2's gfxpayload setting. Note that
    this requires use of "multiboot2" (and "module2") as the GrUB commands loading Xen.
 
+### Added / support upgraded
+ - IOMMU superpage support on x86, affecting PV guests as well as HVM/PVH ones
+   when they don't share page tables with the CPU (HAP / EPT / NPT).
+
 ### Removed / support downgraded
  - dropped support for the (x86-only) "vesa-mtrr" and "vesa-remap" command line options
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 05 11:22:10 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Aug 2022 11:22:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.381074.615583 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJvP3-0000PZ-3D; Fri, 05 Aug 2022 11:22:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 381074.615583; Fri, 05 Aug 2022 11:22:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJvP3-0000PR-0P; Fri, 05 Aug 2022 11:22:05 +0000
Received: by outflank-mailman (input) for mailman id 381074;
 Fri, 05 Aug 2022 11:22:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJvP2-0000PL-4X
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 11:22:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJvP2-0006Hf-14
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 11:22:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJvP2-0002kh-03
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 11:22:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=lsm8bXHOMZb2BudoNaN9mfgMTU9nYelo5B4830GGRrs=; b=LaKvfXvDQzCQpeWguuJNY8UUuM
	AL6m3EydfyOM4Bx0svUnH3AL5n4WYpcxF/JBxcRy5mBwfQ7l3OJ1U/sFRGCZeGgrwkHulpY4gv2m+
	GNlARv3wRkNH7KB6UCb9WMpOO4O/s6cToPmGKJpJGmlLNr+GNu/9rtvQTCGx2Hssp6qw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/spec-ctrl: Use IST RSB protection for !SVM systems
Message-Id: <E1oJvP2-0002kh-03@xenbits.xenproject.org>
Date: Fri, 05 Aug 2022 11:22:04 +0000

commit e570e8d520ab542d8d35666b95cb3a0125b7b110
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Aug 2 14:30:30 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 5 12:16:24 2022 +0100

    x86/spec-ctrl: Use IST RSB protection for !SVM systems
    
    There is a corner case where a VT-x guest which manages to reliably trigger
    non-fatal #MC's could evade the rogue RSB speculation protections that were
    supposed to be in place.
    
    This is a lack of defence in depth; Xen does not architecturally execute more
    RET than CALL instructions, so an attacker would have to locate a different
    gadget (e.g. SpectreRSB) first to execute a transient path of excess RET
    instructions.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/spec_ctrl.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index 44e86f3d67..d2cd545973 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -1327,8 +1327,24 @@ void __init init_speculation_mitigations(void)
      * mappings.
      */
     if ( opt_rsb_hvm )
+    {
         setup_force_cpu_cap(X86_FEATURE_SC_RSB_HVM);
 
+        /*
+         * For SVM, Xen's RSB safety actions are performed before STGI, so
+         * behave atomically with respect to IST sources.
+         *
+         * For VT-x, NMIs are atomic with VMExit (the NMI gets queued but not
+         * delivered) whereas other IST sources are not atomic.  Specifically,
+         * #MC can hit ahead the RSB safety action in the vmexit path.
+         *
+         * Therefore, it is necessary for the IST logic to protect Xen against
+         * possible rogue RSB speculation.
+         */
+        if ( !cpu_has_svm )
+            default_spec_ctrl_flags |= SCF_ist_rsb;
+    }
+
     ibpb_calculations();
 
     /* Check whether Eager FPU should be enabled by default. */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 05 11:22:15 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Aug 2022 11:22:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.381075.615587 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJvPD-0000RV-4q; Fri, 05 Aug 2022 11:22:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 381075.615587; Fri, 05 Aug 2022 11:22:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJvPD-0000RN-1s; Fri, 05 Aug 2022 11:22:15 +0000
Received: by outflank-mailman (input) for mailman id 381075;
 Fri, 05 Aug 2022 11:22:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJvPC-0000RH-4q
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 11:22:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJvPC-0006Hk-42
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 11:22:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJvPC-0002l8-39
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 11:22:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=27RWRpicyBkXewq2k/oOCVgD21iOtfO7mhyc8CbLKYI=; b=pkRZm4+SFfkzfc+xqGnEUdeSO1
	T6wsZhN2yxIKlxupFelCtXfQ2+/h/Zt1DLlTwLDalx3o+mFoKhFS/gI4EoIPo7ICnsUcOwXsWb6wj
	06od5Mc7SrP14UkPR2QxmNV58Ft4SMi9b96nxNnoxFJe4YTmjrZKoLuKck4CahW+lbPA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/wait: Describe RSB safety
Message-Id: <E1oJvPC-0002l8-39@xenbits.xenproject.org>
Date: Fri, 05 Aug 2022 11:22:14 +0000

commit da74c951e4e58080583daaad373b0d38a3f8bc83
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jun 14 16:18:36 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 5 12:16:59 2022 +0100

    xen/wait: Describe RSB safety
    
    It turns out that we do in fact have RSB safety here, but not for obvious
    reasons.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/wait.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/xen/common/wait.c b/xen/common/wait.c
index e45345ede7..86d3b15419 100644
--- a/xen/common/wait.c
+++ b/xen/common/wait.c
@@ -209,6 +209,27 @@ void check_wakeup_from_wait(void)
             do_softirq();
     }
 
+    /*
+     * We are about to jump into a deeper call tree.  In principle, this risks
+     * executing more RET than CALL instructions, and underflowing the RSB.
+     *
+     * However, we are pinned to the same CPU as previously.  Therefore,
+     * either:
+     *
+     *   1) We've scheduled another vCPU in the meantime, and the context
+     *      switch path has (by default) issued IBPB which flushes the RSB, or
+     *
+     *   2) We're still in the same context.  Returning back to the deeper
+     *      call tree is resuming the execution path we left, and remains
+     *      balanced as far as that logic is concerned.
+     *
+     *      In fact, the path through the scheduler will execute more CALL
+     *      than RET instructions, making the RSB unbalanced in the safe
+     *      direction.
+     *
+     * Therefore, no actions are necessary here to maintain RSB safety.
+     */
+
     /*
      * Hand-rolled longjmp().
      *
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 05 13:33:09 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Aug 2022 13:33:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.381252.615852 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJxRn-0008JN-SZ; Fri, 05 Aug 2022 13:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 381252.615852; Fri, 05 Aug 2022 13:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJxRn-0008JE-PG; Fri, 05 Aug 2022 13:33:03 +0000
Received: by outflank-mailman (input) for mailman id 381252;
 Fri, 05 Aug 2022 13:33:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJxRm-0008J8-7f
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 13:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJxRm-0000UT-58
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 13:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJxRm-0001Ez-4A
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 13:33:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/+CJNFtSIoDW9PjwEMKkIFyVJU+EeKi67neEJu69bQA=; b=qPEs1g/6wagmEhiRvrFOBG/WqA
	LdYPcj5jL9egEZW1sYDPyRv9xe6btDH45tZQMdgMb50daG0kQPcAw4kUBmxpbpEAGT8ZIVF6u4xM8
	qhDdLUxE0PldCFLN4f8JwEtpRhuooXPVHVFxUlaE/PJJVPn6LbSuBK3SZ+sBoYDC3dck=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] doc: Add git commands to generate Fixes
Message-Id: <E1oJxRm-0001Ez-4A@xenbits.xenproject.org>
Date: Fri, 05 Aug 2022 13:33:02 +0000

commit 8a5116371da0505c9b716a9ad5df8a3b8b4c5ae4
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Wed Aug 3 15:43:04 2022 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Aug 4 17:48:01 2022 +0100

    doc: Add git commands to generate Fixes
    
    Add git commands examples that can be used to generate fixes and how to
    use the pretty configuration for git.
    This should make it easier for contributors to have the right format.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 docs/process/sending-patches.pandoc | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/docs/process/sending-patches.pandoc b/docs/process/sending-patches.pandoc
index 7ff7826c99..2e74c3b57e 100644
--- a/docs/process/sending-patches.pandoc
+++ b/docs/process/sending-patches.pandoc
@@ -102,6 +102,10 @@ E.g.:
 
     Fixes: 67d01cdb5518 ("x86: infrastructure to allow converting certain indirect calls to direct ones")
 
+If git was configured as explained earlier, this can be retrieved using
+``git log --pretty=fixes`` otherwise ``git log --abbrev=12 --oneline`` will
+give the proper tag and commit-id.
+
 ### Backport:
 
 A backport tag is an optional tag in the commit message to request a
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 05 13:33:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Aug 2022 13:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.381253.615856 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJxRx-0008L8-Tb; Fri, 05 Aug 2022 13:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 381253.615856; Fri, 05 Aug 2022 13: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 1oJxRx-0008L0-Qz; Fri, 05 Aug 2022 13:33:13 +0000
Received: by outflank-mailman (input) for mailman id 381253;
 Fri, 05 Aug 2022 13:33:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJxRw-0008Kp-98
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 13:33:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJxRw-0000UX-8H
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 13:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJxRw-0001Fy-7I
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 13:33:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nzGtiusYdgSDw3zAFHeQ65zH9NJ5sVGNxy0O+CgQ7EA=; b=2y74EcHyVTYXsw6Dc4whnNsmhC
	aUnv5skxLvYkdqRNC50Cye2e62aof9uysm9uzITZlI2jIaayM/q2N6RQUFT2WpGPfJK0g0sY4O5xn
	C3DC8bxkd7wTbxLKDs1x9UaEcUy+MhD5UKyaiv8Bpmh4gqVNq0xdBTrpbtsuT644yTjc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools: use $(PYTHON) to call cppcheck tools
Message-Id: <E1oJxRw-0001Fy-7I@xenbits.xenproject.org>
Date: Fri, 05 Aug 2022 13:33:12 +0000

commit 7c5b25c3038abc2dc8353f56ed67d2c4fcd43d79
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Wed Aug 3 12:57:02 2022 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Aug 4 17:49:25 2022 +0100

    tools: use $(PYTHON) to call cppcheck tools
    
    When calling python tools to convert misra documentation or merge
    cppcheck xml files, use $(PYTHON).
    While there fix misra document conversion script to be executable.
    
    Fixes: 57caa5375321 ("xen: Add MISRA support to cppcheck make rule")
    Fixes: 43aa3f6e72d3 ("xen/build: Add cppcheck and cppcheck-html make rules")
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/Makefile                   | 4 ++--
 xen/tools/convert_misra_doc.py | 0
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/Makefile b/xen/Makefile
index 3d926e1015..69b4dc960f 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -703,7 +703,7 @@ cmd_cppcheck_xml = $(CPPCHECK) -v -q --xml $(CPPCHECKFLAGS) \
                    --output-file=$@ $<
 
 quiet_cmd_merge_cppcheck_reports = CPPCHECK-MERGE $@
-cmd_merge_cppcheck_reports = $(srctree)/tools/merge_cppcheck_reports.py $^ $@
+cmd_merge_cppcheck_reports = $(PYTHON) $(srctree)/tools/merge_cppcheck_reports.py $^ $@
 
 quiet_cmd_cppcheck_html = CPPCHECK-HTML $<
 cmd_cppcheck_html = $(CPPCHECK_HTMLREPORT) --file=$< --source-dir=$(srctree) \
@@ -742,7 +742,7 @@ cppcheck-version:
 # cppcheck in json format including the list of rules to ignore.
 #
 cppcheck-misra.txt: $(XEN_ROOT)/docs/misra/rules.rst $(srctree)/tools/convert_misra_doc.py
-	$(Q)$(srctree)/tools/convert_misra_doc.py -i $< -o $@ -j $(@:.txt=.json)
+	$(Q)$(PYTHON) $(srctree)/tools/convert_misra_doc.py -i $< -o $@ -j $(@:.txt=.json)
 
 # convert_misra_doc is generating both files.
 cppcheck-misra.json: cppcheck-misra.txt
diff --git a/xen/tools/convert_misra_doc.py b/xen/tools/convert_misra_doc.py
old mode 100644
new mode 100755
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 05 13:33:24 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Aug 2022 13:33:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.381254.615860 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJxS7-0008Na-VH; Fri, 05 Aug 2022 13:33:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 381254.615860; Fri, 05 Aug 2022 13:33:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJxS7-0008NS-SQ; Fri, 05 Aug 2022 13:33:23 +0000
Received: by outflank-mailman (input) for mailman id 381254;
 Fri, 05 Aug 2022 13:33:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJxS6-0008NC-C4
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 13:33:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJxS6-0000Up-BG
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 13:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJxS6-0001GO-AL
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 13:33:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nCGewV1IEyBOn5jpMkBZBNqNZUn/Vwu9XekmMDR/db8=; b=AQfRoyUxDPUhinxaoFJ0/dQj2x
	hNBTpvI5PzodpEULidJpaJJ1RToq0i3dgJzzOa72V6c+KUAQvdcJvpMpLNO5q30SfHRAzfLrn6Izk
	hzpXJ+LriBcgZcEVmuBRzIIsZ6Op7ENFJxuqVaMd6jNpZuOe8sw9DCqFMGra2U43hfvc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/char: imx-lpuart: Fix MISRA C 2012 Rule 20.7 violation
Message-Id: <E1oJxS6-0001GO-AL@xenbits.xenproject.org>
Date: Fri, 05 Aug 2022 13:33:22 +0000

commit 5b9eca17cb981a08738e9d9ec3d6b91113daeb0e
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Tue Aug 2 10:54:33 2022 +0300
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Thu Aug 4 14:37:22 2022 -0700

    xen/char: imx-lpuart: Fix MISRA C 2012 Rule 20.7 violation
    
    The macro parameter 'off' is used as an expression and it is good to be
    enclosed in parentheses to prevent against unintended expansion.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/drivers/char/imx-lpuart.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/char/imx-lpuart.c b/xen/drivers/char/imx-lpuart.c
index 2709136081..9c1f3b71a3 100644
--- a/xen/drivers/char/imx-lpuart.c
+++ b/xen/drivers/char/imx-lpuart.c
@@ -26,8 +26,8 @@
 #include <asm/imx-lpuart.h>
 #include <asm/io.h>
 
-#define imx_lpuart_read(uart, off)       readl((uart)->regs + off)
-#define imx_lpuart_write(uart, off, val) writel((val), (uart)->regs + off)
+#define imx_lpuart_read(uart, off)       readl((uart)->regs + (off))
+#define imx_lpuart_write(uart, off, val) writel((val), (uart)->regs + (off))
 
 static struct imx_lpuart {
     uint32_t baud, clock_hz, data_bits, parity, stop_bits, fifo_size;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 05 13:33:34 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Aug 2022 13:33:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.381258.615875 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oJxSI-0000GS-DN; Fri, 05 Aug 2022 13:33:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 381258.615875; Fri, 05 Aug 2022 13: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 1oJxSI-0000GK-AQ; Fri, 05 Aug 2022 13:33:34 +0000
Received: by outflank-mailman (input) for mailman id 381258;
 Fri, 05 Aug 2022 13:33:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJxSG-0000FE-F1
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 13:33:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJxSG-0000VM-EH
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 13:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oJxSG-0001HL-DQ
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 13:33:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=g3V9XV1Ufw3WnEanm0qawDBBtBNCqLaE4TeIh0B9BUk=; b=rBwPvwhucMSbl2+iWCpES9jUdc
	/XgYP5OtoswJ8QxgdVliK+xOZkQu7uX7hRRSgyBmrABwA+clwJNQexafJ4kPVH8sIomBZvdqT3Gop
	SCb6Phd9sWFz3Y8lLdqonoRaoxfiJYcOovuIWnVL1lqmsFBqjc+l9xGlWRBFVooUnPoA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/char: mvebu-uart: Fix MISRA C 2012 Rule 20.7 violation
Message-Id: <E1oJxSG-0001HL-DQ@xenbits.xenproject.org>
Date: Fri, 05 Aug 2022 13:33:32 +0000

commit 1f7543c039f6b9eb182f0395965b9d414ac774c4
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Wed Aug 3 10:09:58 2022 +0300
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Thu Aug 4 14:38:09 2022 -0700

    xen/char: mvebu-uart: Fix MISRA C 2012 Rule 20.7 violation
    
    The macro parameters 'off' and 'uart' are used as expressions and it is
    good to be enclosed in parentheses to prevent against unintended expansion.
    
    For the 'uart' case, in mvebu3700_write(), correct the second parentheses
    that seems to have been accidently misplaced.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/drivers/char/mvebu-uart.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/char/mvebu-uart.c b/xen/drivers/char/mvebu-uart.c
index 835d1ace3c..a00618b96f 100644
--- a/xen/drivers/char/mvebu-uart.c
+++ b/xen/drivers/char/mvebu-uart.c
@@ -64,8 +64,8 @@ static struct mvebu3700_uart {
     struct vuart_info vuart;
 } mvebu3700_com = {0};
 
-#define mvebu3700_read(uart, off)           readl((uart)->regs + off)
-#define mvebu3700_write(uart, off, val)     writel(val, (uart->regs) + off)
+#define mvebu3700_read(uart, off)           readl((uart)->regs + (off))
+#define mvebu3700_write(uart, off, val)     writel(val, (uart)->regs + (off))
 
 static void mvebu3700_uart_interrupt(int irq, void *data,
                                      struct cpu_user_regs *regs)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 05 17:33:10 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Aug 2022 17:33:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.381438.616116 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oK1C5-0007Dg-LH; Fri, 05 Aug 2022 17:33:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 381438.616116; Fri, 05 Aug 2022 17:33:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oK1C5-0007DY-IQ; Fri, 05 Aug 2022 17:33:05 +0000
Received: by outflank-mailman (input) for mailman id 381438;
 Fri, 05 Aug 2022 17:33:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oK1C4-0007DS-7r
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 17:33:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oK1C4-00060k-32
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 17:33:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oK1C4-0002FF-0w
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 17:33:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=T4BEzpnjlY/rXXO0n2G62mBh/ZYI9DnPaGHeYtppL4o=; b=1w7CJrIPyUa5hB0gGFpeMXEKsY
	Ykx4rhRu3kontPhftu/dBT+pU+IcOBQeOQfzD+Q1kMiK/RDJ82VSux/11iWc84i/lbVcEKiK3ZPep
	gizxYu51rXAbemqVsQHYT8KTTbecVloFMsKB97cXn6GnTo1eadxwpXBP5PPX/Af9MPHY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/ocaml/*/Makefile: generate paths.ml from configure
Message-Id: <E1oK1C4-0002FF-0w@xenbits.xenproject.org>
Date: Fri, 05 Aug 2022 17:33:04 +0000

commit d91312bfe72f06bb1a555fcb19dfc3e7e141014d
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Fri Jul 29 18:53:25 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 5 17:30:08 2022 +0100

    tools/ocaml/*/Makefile: generate paths.ml from configure
    
    paths.ml contains various paths known to configure, and currently is generated
    via a Makefile rule.  Simplify this and generate it through configure, similar
    to how oxenstored.conf is generated from oxenstored.conf.in.
    
    This will allow to reuse the generated file more easily with Dune.
    
    No functional change.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/configure                   |  4 +++-
 tools/configure.ac                |  2 ++
 tools/ocaml/Makefile.rules        | 11 -----------
 tools/ocaml/libs/xs/Makefile      |  5 -----
 tools/ocaml/libs/xs/paths.ml.in   |  1 +
 tools/ocaml/xenstored/Makefile    |  5 -----
 tools/ocaml/xenstored/paths.ml.in |  4 ++++
 7 files changed, 10 insertions(+), 22 deletions(-)

diff --git a/tools/configure b/tools/configure
index a052c186a5..41deb7fb96 100755
--- a/tools/configure
+++ b/tools/configure
@@ -2453,7 +2453,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
-ac_config_files="$ac_config_files ../config/Tools.mk hotplug/FreeBSD/rc.d/xencommons hotplug/FreeBSD/rc.d/xendriverdomain hotplug/Linux/init.d/sysconfig.xencommons hotplug/Linux/init.d/sysconfig.xendomains hotplug/Linux/init.d/xen-watchdog hotplug/Linux/init.d/xencommons hotplug/Linux/init.d/xendomains hotplug/Linux/init.d/xendriverdomain hotplug/Linux/launch-xenstore hotplug/Linux/vif-setup hotplug/Linux/xen-hotplug-common.sh hotplug/Linux/xendomains hotplug/NetBSD/rc.d/xencommons hotplug/NetBSD/rc.d/xendriverdomain ocaml/xenstored/oxenstored.conf"
+ac_config_files="$ac_config_files ../config/Tools.mk hotplug/FreeBSD/rc.d/xencommons hotplug/FreeBSD/rc.d/xendriverdomain hotplug/Linux/init.d/sysconfig.xencommons hotplug/Linux/init.d/sysconfig.xendomains hotplug/Linux/init.d/xen-watchdog hotplug/Linux/init.d/xencommons hotplug/Linux/init.d/xendomains hotplug/Linux/init.d/xendriverdomain hotplug/Linux/launch-xenstore hotplug/Linux/vif-setup hotplug/Linux/xen-hotplug-common.sh hotplug/Linux/xendomains hotplug/NetBSD/rc.d/xencommons hotplug/NetBSD/rc.d/xendriverdomain ocaml/libs/xs/paths.ml ocaml/xenstored/paths.ml ocaml/xenstored/oxenstored.conf"
 
 ac_config_headers="$ac_config_headers config.h"
 
@@ -10935,6 +10935,8 @@ do
     "hotplug/Linux/xendomains") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/xendomains" ;;
     "hotplug/NetBSD/rc.d/xencommons") CONFIG_FILES="$CONFIG_FILES hotplug/NetBSD/rc.d/xencommons" ;;
     "hotplug/NetBSD/rc.d/xendriverdomain") CONFIG_FILES="$CONFIG_FILES hotplug/NetBSD/rc.d/xendriverdomain" ;;
+    "ocaml/libs/xs/paths.ml") CONFIG_FILES="$CONFIG_FILES ocaml/libs/xs/paths.ml" ;;
+    "ocaml/xenstored/paths.ml") CONFIG_FILES="$CONFIG_FILES ocaml/xenstored/paths.ml" ;;
     "ocaml/xenstored/oxenstored.conf") CONFIG_FILES="$CONFIG_FILES ocaml/xenstored/oxenstored.conf" ;;
     "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
     "hotplug/Linux/systemd/proc-xen.mount") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/systemd/proc-xen.mount" ;;
diff --git a/tools/configure.ac b/tools/configure.ac
index 1094d896fc..32cbe6bd3c 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -21,6 +21,8 @@ hotplug/Linux/xen-hotplug-common.sh
 hotplug/Linux/xendomains
 hotplug/NetBSD/rc.d/xencommons
 hotplug/NetBSD/rc.d/xendriverdomain
+ocaml/libs/xs/paths.ml
+ocaml/xenstored/paths.ml
 ocaml/xenstored/oxenstored.conf
 ])
 AC_CONFIG_HEADERS([config.h])
diff --git a/tools/ocaml/Makefile.rules b/tools/ocaml/Makefile.rules
index d368308d9b..0d3c6ac839 100644
--- a/tools/ocaml/Makefile.rules
+++ b/tools/ocaml/Makefile.rules
@@ -100,14 +100,3 @@ $(foreach lib,$(OCAML_LIBRARY),$(eval $(call OCAML_LIBRARY_template,$(lib))))
 $(foreach lib,$(OCAML_NOC_LIBRARY),$(eval $(call OCAML_NOC_LIBRARY_template,$(lib))))
 $(foreach p,$(OCAML_PROGRAM),$(eval $(call OCAML_PROGRAM_template,$(p))))
 $(foreach p,$(C_PROGRAM),$(eval $(call C_PROGRAM_template,$(p))))
-
-buildmakevars2module = $(eval $(call buildmakevars2module-closure,$(1)))
-define buildmakevars2module-closure
-    $(1): .phony
-	rm -f $(1).tmp; \
-	$(foreach var, $(BUILD_MAKE_VARS), \
-	          printf "let %s = \"%s\";;\n" \
-                      $(shell echo $(var) | tr '[:upper:]' '[:lower:]') \
-                      $($(var)) >>$(1).tmp;) \
-	$(call move-if-changed,$(1).tmp,$(1))
-endef
diff --git a/tools/ocaml/libs/xs/Makefile b/tools/ocaml/libs/xs/Makefile
index e934bbb550..e160e6a711 100644
--- a/tools/ocaml/libs/xs/Makefile
+++ b/tools/ocaml/libs/xs/Makefile
@@ -44,8 +44,3 @@ uninstall:
 	$(OCAMLFIND) remove -destdir $(OCAMLDESTDIR) xenstore
 
 include $(OCAML_TOPLEVEL)/Makefile.rules
-
-genpath-target = $(call buildmakevars2module,paths.ml)
-$(eval $(genpath-target))
-
-GENERATED_FILES += paths.ml
diff --git a/tools/ocaml/libs/xs/paths.ml.in b/tools/ocaml/libs/xs/paths.ml.in
new file mode 100644
index 0000000000..c067f8d012
--- /dev/null
+++ b/tools/ocaml/libs/xs/paths.ml.in
@@ -0,0 +1 @@
+let xen_run_stored = "@XEN_RUN_STORED@"
diff --git a/tools/ocaml/xenstored/Makefile b/tools/ocaml/xenstored/Makefile
index 0b5711b507..6f7333926e 100644
--- a/tools/ocaml/xenstored/Makefile
+++ b/tools/ocaml/xenstored/Makefile
@@ -93,8 +93,3 @@ uninstall:
 	rm -f $(DESTDIR)$(sbindir)/oxenstored
 
 include $(OCAML_TOPLEVEL)/Makefile.rules
-
-genpath-target = $(call buildmakevars2module,paths.ml)
-$(eval $(genpath-target))
-
-GENERATED_FILES += paths.ml
diff --git a/tools/ocaml/xenstored/paths.ml.in b/tools/ocaml/xenstored/paths.ml.in
new file mode 100644
index 0000000000..37949dc8f3
--- /dev/null
+++ b/tools/ocaml/xenstored/paths.ml.in
@@ -0,0 +1,4 @@
+let xen_log_dir = "@XEN_LOG_DIR@"
+let xen_config_dir = "@XEN_CONFIG_DIR@"
+let xen_run_dir = "@XEN_RUN_DIR@"
+let xen_run_stored = "@XEN_RUN_STORED@"
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 05 17:33:15 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Aug 2022 17:33:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.381439.616120 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oK1CF-0007Fg-MW; Fri, 05 Aug 2022 17:33:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 381439.616120; Fri, 05 Aug 2022 17:33:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oK1CF-0007FY-Jz; Fri, 05 Aug 2022 17:33:15 +0000
Received: by outflank-mailman (input) for mailman id 381439;
 Fri, 05 Aug 2022 17:33:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oK1CE-0007FL-73
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 17:33:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oK1CE-00060o-68
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 17:33:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oK1CE-0002G5-5I
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 17:33:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=mYJDtlgPaZkJvP3vhyW17fFPqBecFjWMX96HvNEtnss=; b=5TNo5q/Njz9hfzTIlDiaELuh9k
	hIMH4Fb83Yke4Wrjo64A/fG96z8qywNpslSGAqRqBcsY1JOqH6QZzNFIlCQI3Q0buCnsnQitTVWzv
	9zRnxTzso3iT+QbuMBi2MN1rZXTXIKp7WlmUOMB2eOSInRk0DODP/lz7oUjF5DdFRO7Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/ocaml: fix compiler warnings
Message-Id: <E1oK1CE-0002G5-5I@xenbits.xenproject.org>
Date: Fri, 05 Aug 2022 17:33:14 +0000

commit a0aeab27ee0e1e221181a3083908dc2d4e1553ee
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Fri Jul 29 18:53:28 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 5 17:30:57 2022 +0100

    tools/ocaml: fix compiler warnings
    
    Fix compiler warning about:
    * unused value
    * ambiguous documentation comment
    * non-principal type inference (compiler version dependent)
    
    No functional change.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/xenstored/connection.ml | 1 -
 tools/ocaml/xenstored/process.ml    | 5 +++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/ocaml/xenstored/connection.ml b/tools/ocaml/xenstored/connection.ml
index 65f99ea6f2..8602a14ed1 100644
--- a/tools/ocaml/xenstored/connection.ml
+++ b/tools/ocaml/xenstored/connection.ml
@@ -313,7 +313,6 @@ let is_bad con = match con.dom with None -> false | Some dom -> Domain.is_bad_do
 let has_extra_connection_data con =
 	let has_in = has_input con || has_partial_input con in
 	let has_out = has_output con in
-	let has_socket = con.dom = None in
 	let has_nondefault_perms = make_perm con.dom <> con.perm in
 	has_in || has_out
 	(* TODO: what about SIGTERM, should use systemd to store FDS
diff --git a/tools/ocaml/xenstored/process.ml b/tools/ocaml/xenstored/process.ml
index 27790d4a5c..86eed02413 100644
--- a/tools/ocaml/xenstored/process.ml
+++ b/tools/ocaml/xenstored/process.ml
@@ -59,7 +59,7 @@ let split_one_path data con =
 
 let process_watch t cons =
 	let oldroot = t.Transaction.oldroot in
-	let newroot = Store.get_root t.store in
+	let newroot = Store.get_root t.Transaction.store in
 	let ops = Transaction.get_paths t |> List.rev in
 	let do_op_watch op cons =
 		let recurse, oldroot, root = match (fst op) with
@@ -491,7 +491,7 @@ let transaction_replay c t doms cons =
 			ignore @@ Connection.end_transaction c tid None
 		)
 
-let do_watch con t _domains cons data =
+let do_watch con _t _domains cons data =
 	let (node, token) =
 		match (split None '\000' data) with
 		| [node; token; ""]   -> node, token
@@ -651,6 +651,7 @@ let maybe_ignore_transaction = function
 
 
 let () = Printexc.record_backtrace true
+
 (**
  * Nothrow guarantee.
  *)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 05 17:33:25 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Aug 2022 17:33:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.381440.616123 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oK1CP-0007IU-Oa; Fri, 05 Aug 2022 17:33:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 381440.616123; Fri, 05 Aug 2022 17:33: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 1oK1CP-0007IM-LR; Fri, 05 Aug 2022 17:33:25 +0000
Received: by outflank-mailman (input) for mailman id 381440;
 Fri, 05 Aug 2022 17:33:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oK1CO-0007I9-AJ
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 17:33:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oK1CO-00061C-9D
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 17:33:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oK1CO-0002H8-8K
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 17:33:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6ahlYYn8ZEkniwAGb6nVZWUg+PRI9T/UcR0srPau1/4=; b=kLcEfJDdqdvfYEzzhuhDzZfSFc
	T/01P5Vqjq/xEGIg6uUKDJk0GqPi6TT0h5ir35FbVQxC81VxuGYFuLvMLFiyGKaiI7tTcc+GTgstL
	+1Z2QOuCOtWp4lNCl9d+m32nDwfvBy2Z1+9d8kjGeh2giHaQex0TbBpHGqgRUICo2Xxw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/ocaml/libs/xb: hide type of Xb.t
Message-Id: <E1oK1CO-0002H8-8K@xenbits.xenproject.org>
Date: Fri, 05 Aug 2022 17:33:24 +0000

commit 7ade30a1451734d041363c750a65d322e25b47ba
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Fri Jul 29 18:53:29 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 5 17:31:59 2022 +0100

    tools/ocaml/libs/xb: hide type of Xb.t
    
    Hiding the type will make it easier to change the implementation
    in the future without breaking code that relies on it.
    
    No functional change.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/libs/xb/xb.ml           | 3 +++
 tools/ocaml/libs/xb/xb.mli          | 9 ++-------
 tools/ocaml/xenstored/connection.ml | 8 ++------
 3 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/tools/ocaml/libs/xb/xb.ml b/tools/ocaml/libs/xb/xb.ml
index 104d319d77..8404ddd8a6 100644
--- a/tools/ocaml/libs/xb/xb.ml
+++ b/tools/ocaml/libs/xb/xb.ml
@@ -196,6 +196,9 @@ let peek_output con = Queue.peek con.pkt_out
 let input_len con = Queue.length con.pkt_in
 let has_in_packet con = Queue.length con.pkt_in > 0
 let get_in_packet con = Queue.pop con.pkt_in
+let has_partial_input con = match con.partial_in with
+	| HaveHdr _ -> true
+	| NoHdr (n, _) -> n < Partial.header_size ()
 let has_more_input con =
 	match con.backend with
 	| Fd _         -> false
diff --git a/tools/ocaml/libs/xb/xb.mli b/tools/ocaml/libs/xb/xb.mli
index 3a00da6cdd..794e35bb34 100644
--- a/tools/ocaml/libs/xb/xb.mli
+++ b/tools/ocaml/libs/xb/xb.mli
@@ -66,13 +66,7 @@ type backend_mmap = {
 type backend_fd = { fd : Unix.file_descr; }
 type backend = Fd of backend_fd | Xenmmap of backend_mmap
 type partial_buf = HaveHdr of Partial.pkt | NoHdr of int * bytes
-type t = {
-  backend : backend;
-  pkt_in : Packet.t Queue.t;
-  pkt_out : Packet.t Queue.t;
-  mutable partial_in : partial_buf;
-  mutable partial_out : string;
-}
+type t
 val init_partial_in : unit -> partial_buf
 val reconnect : t -> unit
 val queue : t -> Packet.t -> unit
@@ -97,6 +91,7 @@ val has_output : t -> bool
 val peek_output : t -> Packet.t
 val input_len : t -> int
 val has_in_packet : t -> bool
+val has_partial_input : t -> bool
 val get_in_packet : t -> Packet.t
 val has_more_input : t -> bool
 val is_selectable : t -> bool
diff --git a/tools/ocaml/xenstored/connection.ml b/tools/ocaml/xenstored/connection.ml
index 8602a14ed1..64180bb2d5 100644
--- a/tools/ocaml/xenstored/connection.ml
+++ b/tools/ocaml/xenstored/connection.ml
@@ -125,9 +125,7 @@ let get_perm con =
 let set_target con target_domid =
 	con.perm <- Perms.Connection.set_target (get_perm con) ~perms:[Perms.READ; Perms.WRITE] target_domid
 
-let is_backend_mmap con = match con.xb.Xenbus.Xb.backend with
-	| Xenbus.Xb.Xenmmap _ -> true
-	| _ -> false
+let is_backend_mmap con = Xenbus.Xb.is_mmap con.xb
 
 let send_reply con tid rid ty data =
 	if (String.length data) > xenstore_payload_max && (is_backend_mmap con) then
@@ -280,9 +278,7 @@ let get_transaction con tid =
 
 let do_input con = Xenbus.Xb.input con.xb
 let has_input con = Xenbus.Xb.has_in_packet con.xb
-let has_partial_input con = match con.xb.Xenbus.Xb.partial_in with
-	| HaveHdr _ -> true
-	| NoHdr (n, _) -> n < Xenbus.Partial.header_size ()
+let has_partial_input con = Xenbus.Xb.has_partial_input con.xb
 let pop_in con = Xenbus.Xb.get_in_packet con.xb
 let has_more_input con = Xenbus.Xb.has_more_input con.xb
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 05 17:33:35 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Aug 2022 17:33:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.381441.616127 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oK1CZ-0007LQ-RF; Fri, 05 Aug 2022 17:33:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 381441.616127; Fri, 05 Aug 2022 17:33: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 1oK1CZ-0007LI-OY; Fri, 05 Aug 2022 17:33:35 +0000
Received: by outflank-mailman (input) for mailman id 381441;
 Fri, 05 Aug 2022 17:33:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oK1CY-0007L7-Ch
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 17:33:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oK1CY-00061c-Bn
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 17:33:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oK1CY-0002ID-BF
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 17:33:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=lukFM5wwdtYskC5GbqVdE+tmAmeRgKk5BiisX5f9NrY=; b=vbhnNS5SMEeaPQWehg/ThScKa3
	fQEd33J4Wl71HahNjj7J9126frf0wzQA97uDabyp5/67xeLT5b7XAZIogc1pGzSdb0RXK45mFfBkt
	+I8afUUtloXB7Z6wQ6VHnMO6UHj92SljSHANamvXH6tHJvEpxY0DNIJBfl1jPTovnc4M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation: disable xen,enhanced in qemu-smoke-arm64
Message-Id: <E1oK1CY-0002ID-BF@xenbits.xenproject.org>
Date: Fri, 05 Aug 2022 17:33:34 +0000

commit 6d6aee437e37fced0c49be97e08c30da873690fc
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Thu Jul 28 17:05:57 2022 -0700
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 5 17:44:59 2022 +0100

    automation: disable xen,enhanced in qemu-smoke-arm64
    
    Disable xen,enhanced because we don't use PV drivers in this test and
    also because the kernel used for testing is old and unpatched and would
    break if xen,enhanced is passed.
    
    This patch unbreaks gitlab-ci.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Ayan Kumar Halder <ayankuma@amd.com>
    Tested-by: Ayan Kumar Halder <ayankuma@amd.com>
---
 automation/scripts/qemu-smoke-arm64.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/automation/scripts/qemu-smoke-arm64.sh b/automation/scripts/qemu-smoke-arm64.sh
index b48a20988f..497dbee15f 100755
--- a/automation/scripts/qemu-smoke-arm64.sh
+++ b/automation/scripts/qemu-smoke-arm64.sh
@@ -83,6 +83,7 @@ NUM_DOMUS=1
 DOMU_KERNEL[0]="Image"
 DOMU_RAMDISK[0]="initrd"
 DOMU_MEM[0]="256"
+DOMU_ENHANCED[0]=0
 
 LOAD_CMD="tftpb"
 UBOOT_SOURCE="boot.source"
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 05 23:11:05 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Aug 2022 23:11:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.381623.616349 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oK6T8-0006s3-Fs; Fri, 05 Aug 2022 23:11:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 381623.616349; Fri, 05 Aug 2022 23:11:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oK6T8-0006rv-Ct; Fri, 05 Aug 2022 23:11:02 +0000
Received: by outflank-mailman (input) for mailman id 381623;
 Fri, 05 Aug 2022 23:11:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oK6T7-0006rl-IJ
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 23:11:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oK6T7-0004hk-HM
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 23:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oK6T7-00047r-GR
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 23:11:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cMHIdRDhcBOU2t3fyCX3/1sFOV/ZqXIOdqwMUO36FUc=; b=JffOLSd+SE0/tr+Yw6QhIrwYj1
	pjrt6gnN1FF9B/LAoL9oBufbQwjAsUXwnuuBvL1DfCwwqCOLVAbXw/3oA+0TVqCGfzoQD9mhOl6xu
	9+5b0dsppNAzT71TWrfIeSg987C/od323en756Z7fB6En4woiYLI4qn5a0lPGpNfiVUI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstore: add documentation for new set/get-feature commands
Message-Id: <E1oK6T7-00047r-GR@xenbits.xenproject.org>
Date: Fri, 05 Aug 2022 23:11:01 +0000

commit e2bd45f4ca498c877a0bac8457832b02db676ae5
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Aug 5 08:36:54 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Aug 5 08:36:54 2022 +0200

    tools/xenstore: add documentation for new set/get-feature commands
    
    Add documentation for two new Xenstore wire commands SET_FEATURE and
    GET_FEATURE used to set or query the Xenstore features visible in the
    ring page of a given domain.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 docs/misc/xenstore.txt | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/docs/misc/xenstore.txt b/docs/misc/xenstore.txt
index 334dc8b6fd..054247c404 100644
--- a/docs/misc/xenstore.txt
+++ b/docs/misc/xenstore.txt
@@ -320,6 +320,23 @@ SET_TARGET		<domid>|<tdomid>|
 
 	xenstored prevents the use of SET_TARGET other than by dom0.
 
+GET_FEATURE		[<domid>|]		<value>|
+SET_FEATURE		<domid>|<value>|
+	Returns or sets the contents of the "feature" field copied to
+	offset 2064 of the Xenstore ring page of the domain specified by
+	<domid>. <value> is a decimal number being a logical or of the
+	feature bits as defined in docs/misc/xenstore-ring.txt. Trying
+	to set a bit for a feature not being supported by the running
+	Xenstore will be denied. Providing no <domid> with the
+	GET_FEATURE command will return the features which are supported
+	by Xenstore.
+
+	SET_FEATURE for a domain will be rejected after the INTRODUCE
+	command for this domain has been sent to xenstored.
+
+	xenstored prevents the use of GET_FEATURE and SET_FEATURE other
+	than by dom0.
+
 ---------- Miscellaneous ----------
 
 CONTROL			<command>|[<parameters>|]
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 05 23:11:12 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Aug 2022 23:11:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.381624.616353 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oK6TI-0006uO-HU; Fri, 05 Aug 2022 23:11:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 381624.616353; Fri, 05 Aug 2022 23: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 1oK6TI-0006uG-EW; Fri, 05 Aug 2022 23:11:12 +0000
Received: by outflank-mailman (input) for mailman id 381624;
 Fri, 05 Aug 2022 23:11:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oK6TH-0006u8-L6
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 23:11:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oK6TH-0004i5-KH
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 23:11:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oK6TH-00048H-JU
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 23:11:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kAY7wkq+ykbp3aRs5zSfTvsGwpih5m6qYKN8sM2DdF8=; b=s8yUY409rYw/E+uBZHguzra7Nj
	xaH9r02hkMv6RJ6kM1959F9JxGnO9ji6gM9tduy9sbkOtECjboeTfJlXBEezf9KrNYRPSsg7JEnUu
	StETCj46UnDw/TLjOc3CUIi6tgpkATwOwFczdEr6KBkG1lKpBFw7PZm3RpRsJOBg9jS4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/compiler: fix MISRA C 2012 Rule 20.7 violation
Message-Id: <E1oK6TH-00048H-JU@xenbits.xenproject.org>
Date: Fri, 05 Aug 2022 23:11:11 +0000

commit 7177b2c3265a18722cd4a89542a28815f7b13622
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Fri Aug 5 08:37:13 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Aug 5 08:37:13 2022 +0200

    xen/compiler: fix MISRA C 2012 Rule 20.7 violation
    
    In __must_be_array(), the macro parameter 'a' is used as expression and
    therefore it is good to be enclosed in parentheses to prevent against
    unintended expansions.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/xen/compiler.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/include/xen/compiler.h b/xen/include/xen/compiler.h
index 933aec09a9..a563130334 100644
--- a/xen/include/xen/compiler.h
+++ b/xen/include/xen/compiler.h
@@ -123,7 +123,7 @@
 
 /* &a[0] degrades to a pointer: a different type from an array */
 #define __must_be_array(a) \
-  BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0])))
+  BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&(a)[0])))
 
 #ifdef CONFIG_CC_HAS_VISIBILITY_ATTRIBUTE
 /* Results in more efficient PIC code (no indirections through GOT or PLT). */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 05 23:11:23 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Aug 2022 23:11:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.381625.616357 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oK6TT-0006xa-Ii; Fri, 05 Aug 2022 23:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 381625.616357; Fri, 05 Aug 2022 23: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 1oK6TT-0006xS-G5; Fri, 05 Aug 2022 23:11:23 +0000
Received: by outflank-mailman (input) for mailman id 381625;
 Fri, 05 Aug 2022 23:11:21 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oK6TR-0006xI-Nx
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 23:11:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oK6TR-0004iJ-N9
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 23:11:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oK6TR-00048g-MN
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 23:11:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6r0DmsJbYWwyoft8icMiXnFjWFScRv39hz0tgs1jz0c=; b=NwDFu7BS4Q54JwsjlycOEGEA+Y
	rLVxbXiclW1a7g4c/8igyhevuEXIilFc2PWuRZB81GIr5MXqjQawNRiqlMRvcaQacJWtOaxB+Gz2r
	FHnnuZ4lXqPFddkBCyhLPs8DTblBAgvLkMoY4yIVwvmonebcVW90+vy6W4s+/7hGRK8g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/hypfs: check the return value of snprintf to avoid leaking stack accidently
Message-Id: <E1oK6TR-00048g-MN@xenbits.xenproject.org>
Date: Fri, 05 Aug 2022 23:11:21 +0000

commit 33bd9c91865b420adec02380c465e81031b0150a
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Fri Aug 5 08:38:23 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Aug 5 08:38:23 2022 +0200

    xen/hypfs: check the return value of snprintf to avoid leaking stack accidently
    
    The function snprintf() returns the number of characters that would have been
    written in the buffer if the buffer size had been sufficiently large,
    not counting the terminating null character.
    Hence, the value returned is not guaranteed to be smaller than the buffer size.
    Check the return value of snprintf() to prevent leaking stack contents to the
    guest by accident.
    
    Also, for debug builds, add an assertion to ensure that the assumption made on
    the size of the destination buffer still holds.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 xen/common/hypfs.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/common/hypfs.c b/xen/common/hypfs.c
index acd258edf2..cdf4ee0171 100644
--- a/xen/common/hypfs.c
+++ b/xen/common/hypfs.c
@@ -377,6 +377,11 @@ int hypfs_read_dyndir_id_entry(const struct hypfs_entry_dir *template,
     unsigned int e_namelen, e_len;
 
     e_namelen = snprintf(name, sizeof(name), template->e.name, id);
+    if ( e_namelen >= sizeof(name) )
+    {
+        ASSERT_UNREACHABLE();
+        return -ENOBUFS;
+    }
     e_len = DIRENTRY_SIZE(e_namelen);
     direntry.e.pad = 0;
     direntry.e.type = template->e.type;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 05 23:11:33 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Aug 2022 23:11:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.381627.616361 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oK6Td-000705-KK; Fri, 05 Aug 2022 23:11:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 381627.616361; Fri, 05 Aug 2022 23:11:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oK6Td-0006zx-Hc; Fri, 05 Aug 2022 23:11:33 +0000
Received: by outflank-mailman (input) for mailman id 381627;
 Fri, 05 Aug 2022 23:11:31 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oK6Tb-0006zk-RA
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 23:11:31 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oK6Tb-0004iW-QI
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 23:11:31 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oK6Tb-00049w-PI
 for xen-changelog@lists.xenproject.org; Fri, 05 Aug 2022 23:11:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=y9VsdBXxX+iwA5a4hLWSUDLbn811Os3Q5clhidu4Z6w=; b=EW0hMXpdWQU4SPIky7FdlvKPDB
	7sHWvd9r+V/sajQCTe2BtzIabQyB1navlBTris+ur5dYgqYlrYpBMisXwyN1ZmqKNEuHG57BV7pv0
	pI/mP6A5s1yar2LD7+t1ERnTzzoXR0mfp1Ph9B8CpFm3dxO16FAGAFQWpJy6qeZ4P3qA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] ChangeLog: mention IOMMU superpage support
Message-Id: <E1oK6Tb-00049w-PI@xenbits.xenproject.org>
Date: Fri, 05 Aug 2022 23:11:31 +0000

commit cc7410683db0a98758d03401b628ba8652c20c18
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Aug 5 08:39:02 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Aug 5 08:39:02 2022 +0200

    ChangeLog: mention IOMMU superpage support
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Henry Wang <Henry.Wang@arm.com>
---
 CHANGELOG.md | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6a7755d7b0..a87a193e15 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - On x86 "vga=current" can now be used together with GrUB2's gfxpayload setting. Note that
    this requires use of "multiboot2" (and "module2") as the GrUB commands loading Xen.
 
+### Added / support upgraded
+ - IOMMU superpage support on x86, affecting PV guests as well as HVM/PVH ones
+   when they don't share page tables with the CPU (HAP / EPT / NPT).
+
 ### Removed / support downgraded
  - dropped support for the (x86-only) "vesa-mtrr" and "vesa-remap" command line options
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 06 10:33:09 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Aug 2022 10:33:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.381814.616604 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oKH79-0000u0-GG; Sat, 06 Aug 2022 10:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 381814.616604; Sat, 06 Aug 2022 10:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oKH79-0000ts-DW; Sat, 06 Aug 2022 10:33:03 +0000
Received: by outflank-mailman (input) for mailman id 381814;
 Sat, 06 Aug 2022 10:33:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oKH77-0000tk-Mu
 for xen-changelog@lists.xenproject.org; Sat, 06 Aug 2022 10:33:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oKH77-0001LD-M6
 for xen-changelog@lists.xenproject.org; Sat, 06 Aug 2022 10:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oKH77-0003fZ-L0
 for xen-changelog@lists.xenproject.org; Sat, 06 Aug 2022 10:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=a5DYIn2h083XqjhZ6HCmH3ZPapiKRU427BGlWsSEIIg=; b=cXqTobQtqLIcmWIAwOreXW/+0t
	vhPLNZaS405zhcMiibgYsKOsloq1qi3rYRYLfJco/E2ZiiKuh5uowLz4GbfA7HoFKir2tWPIb9oot
	/rNcgMeAlkR0HPak0CpLIQ5ACPF9sxI4//oczAVIqMBIsbXV7MDRfkgvglW8CEj40xCA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/spec-ctrl: Use IST RSB protection for !SVM systems
Message-Id: <E1oKH77-0003fZ-L0@xenbits.xenproject.org>
Date: Sat, 06 Aug 2022 10:33:01 +0000

commit e570e8d520ab542d8d35666b95cb3a0125b7b110
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Aug 2 14:30:30 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 5 12:16:24 2022 +0100

    x86/spec-ctrl: Use IST RSB protection for !SVM systems
    
    There is a corner case where a VT-x guest which manages to reliably trigger
    non-fatal #MC's could evade the rogue RSB speculation protections that were
    supposed to be in place.
    
    This is a lack of defence in depth; Xen does not architecturally execute more
    RET than CALL instructions, so an attacker would have to locate a different
    gadget (e.g. SpectreRSB) first to execute a transient path of excess RET
    instructions.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/spec_ctrl.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index 44e86f3d67..d2cd545973 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -1327,8 +1327,24 @@ void __init init_speculation_mitigations(void)
      * mappings.
      */
     if ( opt_rsb_hvm )
+    {
         setup_force_cpu_cap(X86_FEATURE_SC_RSB_HVM);
 
+        /*
+         * For SVM, Xen's RSB safety actions are performed before STGI, so
+         * behave atomically with respect to IST sources.
+         *
+         * For VT-x, NMIs are atomic with VMExit (the NMI gets queued but not
+         * delivered) whereas other IST sources are not atomic.  Specifically,
+         * #MC can hit ahead the RSB safety action in the vmexit path.
+         *
+         * Therefore, it is necessary for the IST logic to protect Xen against
+         * possible rogue RSB speculation.
+         */
+        if ( !cpu_has_svm )
+            default_spec_ctrl_flags |= SCF_ist_rsb;
+    }
+
     ibpb_calculations();
 
     /* Check whether Eager FPU should be enabled by default. */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 06 10:33:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Aug 2022 10:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.381815.616608 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oKH7J-0000w8-Ht; Sat, 06 Aug 2022 10:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 381815.616608; Sat, 06 Aug 2022 10: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 1oKH7J-0000w0-F7; Sat, 06 Aug 2022 10:33:13 +0000
Received: by outflank-mailman (input) for mailman id 381815;
 Sat, 06 Aug 2022 10:33:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oKH7H-0000vV-Q9
 for xen-changelog@lists.xenproject.org; Sat, 06 Aug 2022 10:33:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oKH7H-0001LU-PQ
 for xen-changelog@lists.xenproject.org; Sat, 06 Aug 2022 10:33:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oKH7H-0003gG-O2
 for xen-changelog@lists.xenproject.org; Sat, 06 Aug 2022 10:33:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=w70FqY2gPbmb7yWNT9ETGMXjw5I38mMm9qYmChCcgPg=; b=5HeFT60b7ljcIpzopdxtnhFC7G
	O/OAQf2VbjROjPp4UKqXHEho7RusALs9jNAGsbRHf2/2gLrCr9SkKMEsv4MH+qJP8TaVvj2YAVF/u
	g+gNzmL8J6uoSO5HobqCjzjZvBgncGs5VA+5L4oxnVPGCIU0lCtAkz2HJ4g9TpEaxhFQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/wait: Describe RSB safety
Message-Id: <E1oKH7H-0003gG-O2@xenbits.xenproject.org>
Date: Sat, 06 Aug 2022 10:33:11 +0000

commit da74c951e4e58080583daaad373b0d38a3f8bc83
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jun 14 16:18:36 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 5 12:16:59 2022 +0100

    xen/wait: Describe RSB safety
    
    It turns out that we do in fact have RSB safety here, but not for obvious
    reasons.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/wait.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/xen/common/wait.c b/xen/common/wait.c
index e45345ede7..86d3b15419 100644
--- a/xen/common/wait.c
+++ b/xen/common/wait.c
@@ -209,6 +209,27 @@ void check_wakeup_from_wait(void)
             do_softirq();
     }
 
+    /*
+     * We are about to jump into a deeper call tree.  In principle, this risks
+     * executing more RET than CALL instructions, and underflowing the RSB.
+     *
+     * However, we are pinned to the same CPU as previously.  Therefore,
+     * either:
+     *
+     *   1) We've scheduled another vCPU in the meantime, and the context
+     *      switch path has (by default) issued IBPB which flushes the RSB, or
+     *
+     *   2) We're still in the same context.  Returning back to the deeper
+     *      call tree is resuming the execution path we left, and remains
+     *      balanced as far as that logic is concerned.
+     *
+     *      In fact, the path through the scheduler will execute more CALL
+     *      than RET instructions, making the RSB unbalanced in the safe
+     *      direction.
+     *
+     * Therefore, no actions are necessary here to maintain RSB safety.
+     */
+
     /*
      * Hand-rolled longjmp().
      *
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 06 10:33:23 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Aug 2022 10:33:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.381816.616612 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oKH7T-0000z7-Jc; Sat, 06 Aug 2022 10:33:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 381816.616612; Sat, 06 Aug 2022 10:33:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oKH7T-0000yx-Gk; Sat, 06 Aug 2022 10:33:23 +0000
Received: by outflank-mailman (input) for mailman id 381816;
 Sat, 06 Aug 2022 10:33:21 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oKH7R-0000yY-UV
 for xen-changelog@lists.xenproject.org; Sat, 06 Aug 2022 10:33:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oKH7R-0001Lo-Tm
 for xen-changelog@lists.xenproject.org; Sat, 06 Aug 2022 10:33:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oKH7R-0003hE-S3
 for xen-changelog@lists.xenproject.org; Sat, 06 Aug 2022 10:33:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MlZVtPPYfBQy9H+NDQuMCVD39N7x8LRAdYGV3zjWhhY=; b=2zYfgSB1qbD6fGFcCX0lMwjsT0
	S6dqwj5B8dIWvufccMdtxeBhTD6qcmSoh1O689DQYpQ5YKwm0xPFD9acHEdy0qNxFLif9GQzz6DbT
	gKMtoksg7/7GTNeTdXJQXlCKHY8jOeVRM8RLigKBcfCy1KJoS30VnmjlXDXEFVdsap9k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/ocaml/*/Makefile: generate paths.ml from configure
Message-Id: <E1oKH7R-0003hE-S3@xenbits.xenproject.org>
Date: Sat, 06 Aug 2022 10:33:21 +0000

commit d91312bfe72f06bb1a555fcb19dfc3e7e141014d
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Fri Jul 29 18:53:25 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 5 17:30:08 2022 +0100

    tools/ocaml/*/Makefile: generate paths.ml from configure
    
    paths.ml contains various paths known to configure, and currently is generated
    via a Makefile rule.  Simplify this and generate it through configure, similar
    to how oxenstored.conf is generated from oxenstored.conf.in.
    
    This will allow to reuse the generated file more easily with Dune.
    
    No functional change.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/configure                   |  4 +++-
 tools/configure.ac                |  2 ++
 tools/ocaml/Makefile.rules        | 11 -----------
 tools/ocaml/libs/xs/Makefile      |  5 -----
 tools/ocaml/libs/xs/paths.ml.in   |  1 +
 tools/ocaml/xenstored/Makefile    |  5 -----
 tools/ocaml/xenstored/paths.ml.in |  4 ++++
 7 files changed, 10 insertions(+), 22 deletions(-)

diff --git a/tools/configure b/tools/configure
index a052c186a5..41deb7fb96 100755
--- a/tools/configure
+++ b/tools/configure
@@ -2453,7 +2453,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
-ac_config_files="$ac_config_files ../config/Tools.mk hotplug/FreeBSD/rc.d/xencommons hotplug/FreeBSD/rc.d/xendriverdomain hotplug/Linux/init.d/sysconfig.xencommons hotplug/Linux/init.d/sysconfig.xendomains hotplug/Linux/init.d/xen-watchdog hotplug/Linux/init.d/xencommons hotplug/Linux/init.d/xendomains hotplug/Linux/init.d/xendriverdomain hotplug/Linux/launch-xenstore hotplug/Linux/vif-setup hotplug/Linux/xen-hotplug-common.sh hotplug/Linux/xendomains hotplug/NetBSD/rc.d/xencommons hotplug/NetBSD/rc.d/xendriverdomain ocaml/xenstored/oxenstored.conf"
+ac_config_files="$ac_config_files ../config/Tools.mk hotplug/FreeBSD/rc.d/xencommons hotplug/FreeBSD/rc.d/xendriverdomain hotplug/Linux/init.d/sysconfig.xencommons hotplug/Linux/init.d/sysconfig.xendomains hotplug/Linux/init.d/xen-watchdog hotplug/Linux/init.d/xencommons hotplug/Linux/init.d/xendomains hotplug/Linux/init.d/xendriverdomain hotplug/Linux/launch-xenstore hotplug/Linux/vif-setup hotplug/Linux/xen-hotplug-common.sh hotplug/Linux/xendomains hotplug/NetBSD/rc.d/xencommons hotplug/NetBSD/rc.d/xendriverdomain ocaml/libs/xs/paths.ml ocaml/xenstored/paths.ml ocaml/xenstored/oxenstored.conf"
 
 ac_config_headers="$ac_config_headers config.h"
 
@@ -10935,6 +10935,8 @@ do
     "hotplug/Linux/xendomains") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/xendomains" ;;
     "hotplug/NetBSD/rc.d/xencommons") CONFIG_FILES="$CONFIG_FILES hotplug/NetBSD/rc.d/xencommons" ;;
     "hotplug/NetBSD/rc.d/xendriverdomain") CONFIG_FILES="$CONFIG_FILES hotplug/NetBSD/rc.d/xendriverdomain" ;;
+    "ocaml/libs/xs/paths.ml") CONFIG_FILES="$CONFIG_FILES ocaml/libs/xs/paths.ml" ;;
+    "ocaml/xenstored/paths.ml") CONFIG_FILES="$CONFIG_FILES ocaml/xenstored/paths.ml" ;;
     "ocaml/xenstored/oxenstored.conf") CONFIG_FILES="$CONFIG_FILES ocaml/xenstored/oxenstored.conf" ;;
     "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
     "hotplug/Linux/systemd/proc-xen.mount") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/systemd/proc-xen.mount" ;;
diff --git a/tools/configure.ac b/tools/configure.ac
index 1094d896fc..32cbe6bd3c 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -21,6 +21,8 @@ hotplug/Linux/xen-hotplug-common.sh
 hotplug/Linux/xendomains
 hotplug/NetBSD/rc.d/xencommons
 hotplug/NetBSD/rc.d/xendriverdomain
+ocaml/libs/xs/paths.ml
+ocaml/xenstored/paths.ml
 ocaml/xenstored/oxenstored.conf
 ])
 AC_CONFIG_HEADERS([config.h])
diff --git a/tools/ocaml/Makefile.rules b/tools/ocaml/Makefile.rules
index d368308d9b..0d3c6ac839 100644
--- a/tools/ocaml/Makefile.rules
+++ b/tools/ocaml/Makefile.rules
@@ -100,14 +100,3 @@ $(foreach lib,$(OCAML_LIBRARY),$(eval $(call OCAML_LIBRARY_template,$(lib))))
 $(foreach lib,$(OCAML_NOC_LIBRARY),$(eval $(call OCAML_NOC_LIBRARY_template,$(lib))))
 $(foreach p,$(OCAML_PROGRAM),$(eval $(call OCAML_PROGRAM_template,$(p))))
 $(foreach p,$(C_PROGRAM),$(eval $(call C_PROGRAM_template,$(p))))
-
-buildmakevars2module = $(eval $(call buildmakevars2module-closure,$(1)))
-define buildmakevars2module-closure
-    $(1): .phony
-	rm -f $(1).tmp; \
-	$(foreach var, $(BUILD_MAKE_VARS), \
-	          printf "let %s = \"%s\";;\n" \
-                      $(shell echo $(var) | tr '[:upper:]' '[:lower:]') \
-                      $($(var)) >>$(1).tmp;) \
-	$(call move-if-changed,$(1).tmp,$(1))
-endef
diff --git a/tools/ocaml/libs/xs/Makefile b/tools/ocaml/libs/xs/Makefile
index e934bbb550..e160e6a711 100644
--- a/tools/ocaml/libs/xs/Makefile
+++ b/tools/ocaml/libs/xs/Makefile
@@ -44,8 +44,3 @@ uninstall:
 	$(OCAMLFIND) remove -destdir $(OCAMLDESTDIR) xenstore
 
 include $(OCAML_TOPLEVEL)/Makefile.rules
-
-genpath-target = $(call buildmakevars2module,paths.ml)
-$(eval $(genpath-target))
-
-GENERATED_FILES += paths.ml
diff --git a/tools/ocaml/libs/xs/paths.ml.in b/tools/ocaml/libs/xs/paths.ml.in
new file mode 100644
index 0000000000..c067f8d012
--- /dev/null
+++ b/tools/ocaml/libs/xs/paths.ml.in
@@ -0,0 +1 @@
+let xen_run_stored = "@XEN_RUN_STORED@"
diff --git a/tools/ocaml/xenstored/Makefile b/tools/ocaml/xenstored/Makefile
index 0b5711b507..6f7333926e 100644
--- a/tools/ocaml/xenstored/Makefile
+++ b/tools/ocaml/xenstored/Makefile
@@ -93,8 +93,3 @@ uninstall:
 	rm -f $(DESTDIR)$(sbindir)/oxenstored
 
 include $(OCAML_TOPLEVEL)/Makefile.rules
-
-genpath-target = $(call buildmakevars2module,paths.ml)
-$(eval $(genpath-target))
-
-GENERATED_FILES += paths.ml
diff --git a/tools/ocaml/xenstored/paths.ml.in b/tools/ocaml/xenstored/paths.ml.in
new file mode 100644
index 0000000000..37949dc8f3
--- /dev/null
+++ b/tools/ocaml/xenstored/paths.ml.in
@@ -0,0 +1,4 @@
+let xen_log_dir = "@XEN_LOG_DIR@"
+let xen_config_dir = "@XEN_CONFIG_DIR@"
+let xen_run_dir = "@XEN_RUN_DIR@"
+let xen_run_stored = "@XEN_RUN_STORED@"
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 06 10:33:33 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Aug 2022 10:33:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.381817.616615 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oKH7d-00011z-Nd; Sat, 06 Aug 2022 10:33:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 381817.616615; Sat, 06 Aug 2022 10:33:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oKH7d-00011r-L4; Sat, 06 Aug 2022 10:33:33 +0000
Received: by outflank-mailman (input) for mailman id 381817;
 Sat, 06 Aug 2022 10:33:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oKH7c-00011h-2o
 for xen-changelog@lists.xenproject.org; Sat, 06 Aug 2022 10:33:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oKH7c-0001Lz-0N
 for xen-changelog@lists.xenproject.org; Sat, 06 Aug 2022 10:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oKH7b-0003hi-Vq
 for xen-changelog@lists.xenproject.org; Sat, 06 Aug 2022 10:33:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3hyIp3C5VZHoBVmdYr4Ll7DX7siOQ0AvjUtk2/KzSOo=; b=nLdTTVhji3qVPjcidoNbbvUzKW
	zeq3tIDXcar87hA5fKVzmH2WIRDKn/gKmP3+JgWYEZapIPDb2BxFvgW8qb+nSCQ/Zqc2UOok5i0Cz
	8/LaU2VchAIux5zM91SD9+RxwUbG/Y/wKdLFUIfztDSpZLR9/KoZY4uP11kmpHCU+3UI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/ocaml: fix compiler warnings
Message-Id: <E1oKH7b-0003hi-Vq@xenbits.xenproject.org>
Date: Sat, 06 Aug 2022 10:33:31 +0000

commit a0aeab27ee0e1e221181a3083908dc2d4e1553ee
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Fri Jul 29 18:53:28 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 5 17:30:57 2022 +0100

    tools/ocaml: fix compiler warnings
    
    Fix compiler warning about:
    * unused value
    * ambiguous documentation comment
    * non-principal type inference (compiler version dependent)
    
    No functional change.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/xenstored/connection.ml | 1 -
 tools/ocaml/xenstored/process.ml    | 5 +++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/ocaml/xenstored/connection.ml b/tools/ocaml/xenstored/connection.ml
index 65f99ea6f2..8602a14ed1 100644
--- a/tools/ocaml/xenstored/connection.ml
+++ b/tools/ocaml/xenstored/connection.ml
@@ -313,7 +313,6 @@ let is_bad con = match con.dom with None -> false | Some dom -> Domain.is_bad_do
 let has_extra_connection_data con =
 	let has_in = has_input con || has_partial_input con in
 	let has_out = has_output con in
-	let has_socket = con.dom = None in
 	let has_nondefault_perms = make_perm con.dom <> con.perm in
 	has_in || has_out
 	(* TODO: what about SIGTERM, should use systemd to store FDS
diff --git a/tools/ocaml/xenstored/process.ml b/tools/ocaml/xenstored/process.ml
index 27790d4a5c..86eed02413 100644
--- a/tools/ocaml/xenstored/process.ml
+++ b/tools/ocaml/xenstored/process.ml
@@ -59,7 +59,7 @@ let split_one_path data con =
 
 let process_watch t cons =
 	let oldroot = t.Transaction.oldroot in
-	let newroot = Store.get_root t.store in
+	let newroot = Store.get_root t.Transaction.store in
 	let ops = Transaction.get_paths t |> List.rev in
 	let do_op_watch op cons =
 		let recurse, oldroot, root = match (fst op) with
@@ -491,7 +491,7 @@ let transaction_replay c t doms cons =
 			ignore @@ Connection.end_transaction c tid None
 		)
 
-let do_watch con t _domains cons data =
+let do_watch con _t _domains cons data =
 	let (node, token) =
 		match (split None '\000' data) with
 		| [node; token; ""]   -> node, token
@@ -651,6 +651,7 @@ let maybe_ignore_transaction = function
 
 
 let () = Printexc.record_backtrace true
+
 (**
  * Nothrow guarantee.
  *)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 06 10:33:43 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Aug 2022 10:33:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.381818.616620 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oKH7n-00014s-PG; Sat, 06 Aug 2022 10:33:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 381818.616620; Sat, 06 Aug 2022 10:33:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oKH7n-00014l-Ma; Sat, 06 Aug 2022 10:33:43 +0000
Received: by outflank-mailman (input) for mailman id 381818;
 Sat, 06 Aug 2022 10:33:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oKH7m-00014Z-4T
 for xen-changelog@lists.xenproject.org; Sat, 06 Aug 2022 10:33:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oKH7m-0001MB-3i
 for xen-changelog@lists.xenproject.org; Sat, 06 Aug 2022 10:33:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oKH7m-0003jk-2T
 for xen-changelog@lists.xenproject.org; Sat, 06 Aug 2022 10:33:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yL/mp2w/6lQReJwGnfE/rrvU4yHXGjtM6ChjtTu/fQ0=; b=H3ZyZqvh5LHzZ7sfjDBFpvLKa5
	sc9E/F4VjQ25y/2LO8KK4/yLsCgxjBx6NA2J0StB6Ggzo7xMflz1M+0pBWNpjD4K3hFBO2HtbxJEf
	H287gV3h7qHg/wepVIuRSQVQ1Aa4iAl/ByQ/pItah+mguMfDloMZm+8FBPYnaFFDEygs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/ocaml/libs/xb: hide type of Xb.t
Message-Id: <E1oKH7m-0003jk-2T@xenbits.xenproject.org>
Date: Sat, 06 Aug 2022 10:33:42 +0000

commit 7ade30a1451734d041363c750a65d322e25b47ba
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Fri Jul 29 18:53:29 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 5 17:31:59 2022 +0100

    tools/ocaml/libs/xb: hide type of Xb.t
    
    Hiding the type will make it easier to change the implementation
    in the future without breaking code that relies on it.
    
    No functional change.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/libs/xb/xb.ml           | 3 +++
 tools/ocaml/libs/xb/xb.mli          | 9 ++-------
 tools/ocaml/xenstored/connection.ml | 8 ++------
 3 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/tools/ocaml/libs/xb/xb.ml b/tools/ocaml/libs/xb/xb.ml
index 104d319d77..8404ddd8a6 100644
--- a/tools/ocaml/libs/xb/xb.ml
+++ b/tools/ocaml/libs/xb/xb.ml
@@ -196,6 +196,9 @@ let peek_output con = Queue.peek con.pkt_out
 let input_len con = Queue.length con.pkt_in
 let has_in_packet con = Queue.length con.pkt_in > 0
 let get_in_packet con = Queue.pop con.pkt_in
+let has_partial_input con = match con.partial_in with
+	| HaveHdr _ -> true
+	| NoHdr (n, _) -> n < Partial.header_size ()
 let has_more_input con =
 	match con.backend with
 	| Fd _         -> false
diff --git a/tools/ocaml/libs/xb/xb.mli b/tools/ocaml/libs/xb/xb.mli
index 3a00da6cdd..794e35bb34 100644
--- a/tools/ocaml/libs/xb/xb.mli
+++ b/tools/ocaml/libs/xb/xb.mli
@@ -66,13 +66,7 @@ type backend_mmap = {
 type backend_fd = { fd : Unix.file_descr; }
 type backend = Fd of backend_fd | Xenmmap of backend_mmap
 type partial_buf = HaveHdr of Partial.pkt | NoHdr of int * bytes
-type t = {
-  backend : backend;
-  pkt_in : Packet.t Queue.t;
-  pkt_out : Packet.t Queue.t;
-  mutable partial_in : partial_buf;
-  mutable partial_out : string;
-}
+type t
 val init_partial_in : unit -> partial_buf
 val reconnect : t -> unit
 val queue : t -> Packet.t -> unit
@@ -97,6 +91,7 @@ val has_output : t -> bool
 val peek_output : t -> Packet.t
 val input_len : t -> int
 val has_in_packet : t -> bool
+val has_partial_input : t -> bool
 val get_in_packet : t -> Packet.t
 val has_more_input : t -> bool
 val is_selectable : t -> bool
diff --git a/tools/ocaml/xenstored/connection.ml b/tools/ocaml/xenstored/connection.ml
index 8602a14ed1..64180bb2d5 100644
--- a/tools/ocaml/xenstored/connection.ml
+++ b/tools/ocaml/xenstored/connection.ml
@@ -125,9 +125,7 @@ let get_perm con =
 let set_target con target_domid =
 	con.perm <- Perms.Connection.set_target (get_perm con) ~perms:[Perms.READ; Perms.WRITE] target_domid
 
-let is_backend_mmap con = match con.xb.Xenbus.Xb.backend with
-	| Xenbus.Xb.Xenmmap _ -> true
-	| _ -> false
+let is_backend_mmap con = Xenbus.Xb.is_mmap con.xb
 
 let send_reply con tid rid ty data =
 	if (String.length data) > xenstore_payload_max && (is_backend_mmap con) then
@@ -280,9 +278,7 @@ let get_transaction con tid =
 
 let do_input con = Xenbus.Xb.input con.xb
 let has_input con = Xenbus.Xb.has_in_packet con.xb
-let has_partial_input con = match con.xb.Xenbus.Xb.partial_in with
-	| HaveHdr _ -> true
-	| NoHdr (n, _) -> n < Xenbus.Partial.header_size ()
+let has_partial_input con = Xenbus.Xb.has_partial_input con.xb
 let pop_in con = Xenbus.Xb.get_in_packet con.xb
 let has_more_input con = Xenbus.Xb.has_more_input con.xb
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 06 10:33:53 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Aug 2022 10:33:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.381819.616625 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oKH7x-00017p-RN; Sat, 06 Aug 2022 10:33:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 381819.616625; Sat, 06 Aug 2022 10:33:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oKH7x-00017h-O8; Sat, 06 Aug 2022 10:33:53 +0000
Received: by outflank-mailman (input) for mailman id 381819;
 Sat, 06 Aug 2022 10:33:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oKH7w-00017C-7A
 for xen-changelog@lists.xenproject.org; Sat, 06 Aug 2022 10:33:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oKH7w-0001Mb-6a
 for xen-changelog@lists.xenproject.org; Sat, 06 Aug 2022 10:33:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oKH7w-0003kI-5f
 for xen-changelog@lists.xenproject.org; Sat, 06 Aug 2022 10:33:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4p13xE/yXDVJFUH5Y2tX6qWkCvYgVRzo0uEFifzbybY=; b=Kb+jNzSucVPIEJhKinEQuiOIt/
	XsnX6hb0eBFRvd9xv1hd9G+1wLHYfDSjzifqRw3Nqt6lziKnO5A6NhwogCmMHYJlm5OUqpKh61ctG
	Og1zpR4rHPPXepQ+e24uQKkoKFrmK2cmzAYdBJGC9bRsYg+1Ffki40Y6jAWbroJg4Z8Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: disable xen,enhanced in qemu-smoke-arm64
Message-Id: <E1oKH7w-0003kI-5f@xenbits.xenproject.org>
Date: Sat, 06 Aug 2022 10:33:52 +0000

commit 6d6aee437e37fced0c49be97e08c30da873690fc
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Thu Jul 28 17:05:57 2022 -0700
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 5 17:44:59 2022 +0100

    automation: disable xen,enhanced in qemu-smoke-arm64
    
    Disable xen,enhanced because we don't use PV drivers in this test and
    also because the kernel used for testing is old and unpatched and would
    break if xen,enhanced is passed.
    
    This patch unbreaks gitlab-ci.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Ayan Kumar Halder <ayankuma@amd.com>
    Tested-by: Ayan Kumar Halder <ayankuma@amd.com>
---
 automation/scripts/qemu-smoke-arm64.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/automation/scripts/qemu-smoke-arm64.sh b/automation/scripts/qemu-smoke-arm64.sh
index b48a20988f..497dbee15f 100755
--- a/automation/scripts/qemu-smoke-arm64.sh
+++ b/automation/scripts/qemu-smoke-arm64.sh
@@ -83,6 +83,7 @@ NUM_DOMUS=1
 DOMU_KERNEL[0]="Image"
 DOMU_RAMDISK[0]="initrd"
 DOMU_MEM[0]="256"
+DOMU_ENHANCED[0]=0
 
 LOAD_CMD="tftpb"
 UBOOT_SOURCE="boot.source"
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Aug 08 22:44:10 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 08 Aug 2022 22:44:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.382618.617601 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oLBTh-00084Q-IY; Mon, 08 Aug 2022 22:44:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 382618.617601; Mon, 08 Aug 2022 22:44:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oLBTh-00084G-Fa; Mon, 08 Aug 2022 22:44:05 +0000
Received: by outflank-mailman (input) for mailman id 382618;
 Mon, 08 Aug 2022 22:44:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLBTg-00084A-LZ
 for xen-changelog@lists.xenproject.org; Mon, 08 Aug 2022 22:44:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLBTg-0008VQ-Jm
 for xen-changelog@lists.xenproject.org; Mon, 08 Aug 2022 22:44:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLBTg-0006mS-IY
 for xen-changelog@lists.xenproject.org; Mon, 08 Aug 2022 22:44:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=EMBlcwlq5jd0Umu2TR2QkCg7eKm/hC24d+CGELhuVHY=; b=VRfBW4fnP2ICdUa7c4Uf7mwdQY
	Voy62LA+6bgQaPxHLlVom3/tsImos+TIXmaq6ExWiNN39GwGhJawMDSQkCT5ijb4U59MrLN1A9YxL
	5PrBl//DZSgq5H4j/Oj6KXgK5dMkzc9kB8kBA+gfSfG5Pb63BG2eDE6yxdlbYJuTFQjI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation: qemu-smoke-arm64: Use kernel 5.19
Message-Id: <E1oLBTg-0006mS-IY@xenbits.xenproject.org>
Date: Mon, 08 Aug 2022 22:44:04 +0000

commit 40cd0e968fa33df090b64196fe0b0e87f376d4a4
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Mon Aug 8 21:39:51 2022 +0300
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Aug 8 15:32:25 2022 -0700

    automation: qemu-smoke-arm64: Use kernel 5.19
    
    Use kernel 5.19 to unblock testing dom0less enhanced.
    This kernel version has the necessary patches for deferring xenbus probe
    until xenstore is fully initialized.
    Also, build kernel with bridging and xen netback support enabled because
    it will be used for testing network connectivity between Dom0 and Dom1
    over a pv network interface.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/gitlab-ci/build.yaml                    | 11 +++++++
 automation/gitlab-ci/test.yaml                     |  4 +--
 .../tests-artifacts/kernel/5.19-arm64v8.dockerfile | 37 ++++++++++++++++++++++
 3 files changed, 50 insertions(+), 2 deletions(-)

diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 23b306e7d0..d2f75a090c 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -597,6 +597,17 @@ kernel-5.9.9-arm64-export:
   tags:
     - arm64
 
+kernel-5.19-arm64-export:
+  extends: .test-jobs-artifact-common
+  image: registry.gitlab.com/xen-project/xen/tests-artifacts/kernel:5.19-arm64v8
+  script:
+    - mkdir binaries && cp /Image binaries/Image
+  artifacts:
+    paths:
+      - binaries/Image
+  tags:
+    - arm64
+
 qemu-system-aarch64-6.0.0-arm64-export:
   extends: .test-jobs-artifact-common
   image: registry.gitlab.com/xen-project/xen/tests-artifacts/qemu-system-aarch64:6.0.0-arm64v8
diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index 6f9f64a8da..aa633fb655 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -70,7 +70,7 @@ qemu-smoke-arm64-gcc:
     - ./automation/scripts/qemu-smoke-arm64.sh 2>&1 | tee qemu-smoke-arm64.log
   needs:
     - debian-unstable-gcc-arm64
-    - kernel-5.9.9-arm64-export
+    - kernel-5.19-arm64-export
     - qemu-system-aarch64-6.0.0-arm64-export
   artifacts:
     paths:
@@ -88,7 +88,7 @@ qemu-smoke-arm64-gcc-staticmem:
     - ./automation/scripts/qemu-smoke-arm64.sh static-mem 2>&1 | tee qemu-smoke-arm64.log
   needs:
     - debian-unstable-gcc-arm64
-    - kernel-5.9.9-arm64-export
+    - kernel-5.19-arm64-export
     - qemu-system-aarch64-6.0.0-arm64-export
   artifacts:
     paths:
diff --git a/automation/tests-artifacts/kernel/5.19-arm64v8.dockerfile b/automation/tests-artifacts/kernel/5.19-arm64v8.dockerfile
new file mode 100644
index 0000000000..e445c1f03a
--- /dev/null
+++ b/automation/tests-artifacts/kernel/5.19-arm64v8.dockerfile
@@ -0,0 +1,37 @@
+FROM arm64v8/debian:unstable
+LABEL maintainer.name="The Xen Project" \
+      maintainer.email="xen-devel@lists.xenproject.org"
+
+ENV DEBIAN_FRONTEND=noninteractive
+ENV LINUX_VERSION=5.19
+ENV USER root
+
+RUN mkdir /build
+WORKDIR /build
+
+# build depends
+RUN apt-get update && \
+    apt-get --quiet --yes install \
+        build-essential \
+        libssl-dev \
+        bc \
+        curl \
+        flex \
+        bison \
+        && \
+    \
+    # Build the kernel
+    curl -fsSLO https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-"$LINUX_VERSION".tar.xz && \
+    tar xvJf linux-"$LINUX_VERSION".tar.xz && \
+    cd linux-"$LINUX_VERSION" && \
+    make defconfig && \
+    sed -i 's/CONFIG_IPV6=m/CONFIG_IPV6=y/g' .config && \
+    sed -i 's/CONFIG_BRIDGE=m/CONFIG_BRIDGE=y/g' .config && \
+    sed -i 's/# CONFIG_XEN_NETDEV_BACKEND is not set/CONFIG_XEN_NETDEV_BACKEND=y/g' .config && \
+    make -j$(nproc) Image.gz && \
+    cp arch/arm64/boot/Image / && \
+    cd /build && \
+    rm -rf linux-"$LINUX_VERSION"* && \
+    apt-get autoremove -y && \
+    apt-get clean && \
+    rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Aug 08 22:44:15 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 08 Aug 2022 22:44:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.382619.617605 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oLBTr-00086G-Jm; Mon, 08 Aug 2022 22:44:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 382619.617605; Mon, 08 Aug 2022 22:44:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oLBTr-000868-H8; Mon, 08 Aug 2022 22:44:15 +0000
Received: by outflank-mailman (input) for mailman id 382619;
 Mon, 08 Aug 2022 22:44:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLBTq-000862-Nj
 for xen-changelog@lists.xenproject.org; Mon, 08 Aug 2022 22:44:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLBTq-0008VX-Mx
 for xen-changelog@lists.xenproject.org; Mon, 08 Aug 2022 22:44:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLBTq-0006nG-Lz
 for xen-changelog@lists.xenproject.org; Mon, 08 Aug 2022 22:44:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tck4aspi5Cd/D/htYKewQ+KglstOHpasoX70Z7T4mAM=; b=jdbcVaCjHGtgW55h/VzyeWDvt5
	zvuyRrQImnnzAOnoThuJum3UDSeF2yfroC0t4zK7QYqz5yOAQaG3bmUc/zXlnjy0yfrEnfuvPVQSH
	V0HNlm1KuUj1fYfy+wPXFNK9nbbmY2Ytz47GqGklw3MysNDJgmBe95VZiLdTuoHvUFaw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation: qemu-smoke-arm64: Run ping test over a pv network interface
Message-Id: <E1oLBTq-0006nG-Lz@xenbits.xenproject.org>
Date: Mon, 08 Aug 2022 22:44:14 +0000

commit 89805b35ce6a0cf402563ebe2f09b03f27152474
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Mon Aug 8 21:39:52 2022 +0300
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Aug 8 15:34:12 2022 -0700

    automation: qemu-smoke-arm64: Run ping test over a pv network interface
    
    This patch modified the test in the following way
    - Dom0 is booted with an alpine linux rootfs with the xen tools.
    - Once Dom0 is booted, it starts xenstored, calls init-dom0less to setup
    the xenstore interface for the dom0less Dom1, setups the bridged network
    and attaches a pv network interface to Dom1.
    - In the meantime, Dom1 in its init script tries to assign an ip to eth0
    and ping Dom0,
    - If Dom1 manages to ping Dom0, it prints 'passed'.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/gitlab-ci/test.yaml         |  6 +++--
 automation/scripts/qemu-smoke-arm64.sh | 44 ++++++++++++++++++++++++++++++----
 2 files changed, 43 insertions(+), 7 deletions(-)

diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index aa633fb655..2eb6c3866e 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -69,7 +69,8 @@ qemu-smoke-arm64-gcc:
   script:
     - ./automation/scripts/qemu-smoke-arm64.sh 2>&1 | tee qemu-smoke-arm64.log
   needs:
-    - debian-unstable-gcc-arm64
+    - alpine-3.12-gcc-arm64
+    - alpine-3.12-arm64-rootfs-export
     - kernel-5.19-arm64-export
     - qemu-system-aarch64-6.0.0-arm64-export
   artifacts:
@@ -87,7 +88,8 @@ qemu-smoke-arm64-gcc-staticmem:
   script:
     - ./automation/scripts/qemu-smoke-arm64.sh static-mem 2>&1 | tee qemu-smoke-arm64.log
   needs:
-    - debian-unstable-gcc-arm64
+    - alpine-3.12-gcc-arm64
+    - alpine-3.12-arm64-rootfs-export
     - kernel-5.19-arm64-export
     - qemu-system-aarch64-6.0.0-arm64-export
   artifacts:
diff --git a/automation/scripts/qemu-smoke-arm64.sh b/automation/scripts/qemu-smoke-arm64.sh
index 497dbee15f..c80d9b2aee 100755
--- a/automation/scripts/qemu-smoke-arm64.sh
+++ b/automation/scripts/qemu-smoke-arm64.sh
@@ -4,8 +4,13 @@ set -ex
 
 test_variant=$1
 
-passed="BusyBox"
-check=""
+passed="passed"
+check="
+until ifconfig eth0 192.168.0.2 && ping -c 10 192.168.0.1; do
+    sleep 30
+done
+echo \"${passed}\"
+"
 
 if [[ "${test_variant}" == "static-mem" ]]; then
     # Memory range that is statically allocated to DOM1
@@ -68,6 +73,36 @@ cd initrd
 find . | cpio --create --format='newc' | gzip > ../binaries/initrd
 cd ..
 
+# DOM0 rootfs
+mkdir -p rootfs
+cd rootfs
+tar xzf ../binaries/initrd.tar.gz
+mkdir proc
+mkdir run
+mkdir srv
+mkdir sys
+rm var/run
+cp -ar ../binaries/dist/install/* .
+
+echo "#!/bin/bash
+
+export LD_LIBRARY_PATH=/usr/local/lib
+bash /etc/init.d/xencommons start
+
+/usr/local/lib/xen/bin/init-dom0less
+
+brctl addbr xenbr0
+brctl addif xenbr0 eth0
+ifconfig eth0 up
+ifconfig xenbr0 up
+ifconfig xenbr0 192.168.0.1
+
+xl network-attach 1 type=vif
+" > etc/local.d/xen.start
+chmod +x etc/local.d/xen.start
+echo "rc_verbose=yes" >> etc/rc.conf
+find . | cpio -H newc -o | gzip > ../binaries/dom0-rootfs.cpio.gz
+cd ..
 
 # ImageBuilder
 echo 'MEMORY_START="0x40000000"
@@ -76,14 +111,13 @@ MEMORY_END="0x80000000"
 DEVICE_TREE="virt-gicv2.dtb"
 XEN="xen"
 DOM0_KERNEL="Image"
-DOM0_RAMDISK="initrd"
+DOM0_RAMDISK="dom0-rootfs.cpio.gz"
 XEN_CMD="console=dtuart dom0_mem=512M"
 
 NUM_DOMUS=1
 DOMU_KERNEL[0]="Image"
 DOMU_RAMDISK[0]="initrd"
 DOMU_MEM[0]="256"
-DOMU_ENHANCED[0]=0
 
 LOAD_CMD="tftpb"
 UBOOT_SOURCE="boot.source"
@@ -114,5 +148,5 @@ timeout -k 1 240 \
     -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin |& tee smoke.serial
 
 set -e
-(grep -q "^BusyBox" smoke.serial && grep -q "DOM1: ${passed}" smoke.serial) || exit 1
+(grep -q "^Welcome to Alpine Linux" smoke.serial && grep -q "DOM1: ${passed}" smoke.serial) || exit 1
 exit 0
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Aug 09 09:55:12 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Aug 2022 09:55:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.382871.617919 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oLLx4-0000Ub-Dr; Tue, 09 Aug 2022 09:55:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 382871.617919; Tue, 09 Aug 2022 09:55:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oLLx4-0000UT-Ax; Tue, 09 Aug 2022 09:55:06 +0000
Received: by outflank-mailman (input) for mailman id 382871;
 Tue, 09 Aug 2022 09:55:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLLx3-0000UN-7d
 for xen-changelog@lists.xenproject.org; Tue, 09 Aug 2022 09:55:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLLx3-0003kF-14
 for xen-changelog@lists.xenproject.org; Tue, 09 Aug 2022 09:55:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLLx2-0000uZ-VS
 for xen-changelog@lists.xenproject.org; Tue, 09 Aug 2022 09:55:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=feOTbjUBcYdlgbGsSY7IuNFn3wymVB62lnaVSFQxFyc=; b=jQWY9o8klx5hP2ohoDPXKOUIT8
	I4XHHEHlL1zUVjWsUk8l3oUcW7wb3krxQcoTCRMntiV2LHOhW+BOnGvJUhwHtubStNfVRtG5SofDb
	WeiJLcYNrTSpW+pns8benr2s0jjAtzs5dpONd5IaS3POqU1W93TyXK2V78tjDetsIwSg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/kexec: Add the '.L_' prefix to is_* and call_* labels
Message-Id: <E1oLLx2-0000uZ-VS@xenbits.xenproject.org>
Date: Tue, 09 Aug 2022 09:55:04 +0000

commit f3eafc58f45448d0ce7c7544bdef50d6f0d7d3d6
Author:     Jane Malalane <jane.malalane@citrix.com>
AuthorDate: Tue Aug 9 11:49:43 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 9 11:49:43 2022 +0200

    x86/kexec: Add the '.L_' prefix to is_* and call_* labels
    
    These are local symbols and shouldn't be externally visible.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jane Malalane <jane.malalane@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/x86_64/kexec_reloc.S | 42 +++++++++++++++++++--------------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/xen/arch/x86/x86_64/kexec_reloc.S b/xen/arch/x86/x86_64/kexec_reloc.S
index 89316bc3a7..f4842025eb 100644
--- a/xen/arch/x86/x86_64/kexec_reloc.S
+++ b/xen/arch/x86/x86_64/kexec_reloc.S
@@ -40,10 +40,10 @@ ENTRY(kexec_reloc)
         movq    %rsi, %cr3
 
         /* Jump to identity mapped code. */
-        leaq    (identity_mapped - kexec_reloc)(%rdi), %rax
+        leaq    (.L_identity_mapped - kexec_reloc)(%rdi), %rax
         jmpq    *%rax
 
-identity_mapped:
+.L_identity_mapped:
         /*
          * Set cr0 to a known state:
          *  - Paging enabled
@@ -70,14 +70,14 @@ identity_mapped:
 
         /* Need to switch to 32-bit mode? */
         testq   $KEXEC_RELOC_FLAG_COMPAT, %r8
-        jnz     call_32_bit
+        jnz     .L_call_32_bit
 
-call_64_bit:
+.L_call_64_bit:
         /* Call the image entry point.  This should never return. */
         callq   *%rbp
         ud2
 
-call_32_bit:
+.L_call_32_bit:
         /* Setup IDT. */
         lidt    compat_mode_idt(%rip)
 
@@ -102,41 +102,41 @@ relocate_pages:
         xorl    %edi, %edi
         xorl    %esi, %esi
 
-next_entry: /* top, read another word for the indirection page */
+.L_next_entry: /* top, read another word for the indirection page */
 
         movq    (%rbx), %rcx
         addq    $8, %rbx
-is_dest:
+.L_is_dest:
         testb   $IND_DESTINATION, %cl
-        jz      is_ind
+        jz      .L_is_ind
         movq    %rcx, %rdi
         andq    $PAGE_MASK, %rdi
-        jmp     next_entry
-is_ind:
+        jmp     .L_next_entry
+.L_is_ind:
         testb   $IND_INDIRECTION, %cl
-        jz      is_done
+        jz      .L_is_done
         movq    %rcx, %rbx
         andq    $PAGE_MASK, %rbx
-        jmp     next_entry
-is_done:
+        jmp     .L_next_entry
+.L_is_done:
         testb   $IND_DONE, %cl
-        jnz     done
-is_source:
+        jnz     .L_done
+.L_is_source:
         testb   $IND_SOURCE, %cl
-        jz      is_zero
+        jz      .L_is_zero
         movq    %rcx, %rsi      /* For every source page do a copy */
         andq    $PAGE_MASK, %rsi
         movl    $(PAGE_SIZE / 8), %ecx
         rep movsq
-        jmp     next_entry
-is_zero:
+        jmp     .L_next_entry
+.L_is_zero:
         testb   $IND_ZERO, %cl
-        jz      next_entry
+        jz      .L_next_entry
         movl    $(PAGE_SIZE / 8), %ecx  /* Zero the destination page. */
         xorl    %eax, %eax
         rep stosq
-        jmp     next_entry
-done:
+        jmp     .L_next_entry
+.L_done:
         popq    %rbx
         ret
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Aug 09 09:55:16 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Aug 2022 09:55:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.382872.617922 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oLLxE-0000WL-Ey; Tue, 09 Aug 2022 09:55:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 382872.617922; Tue, 09 Aug 2022 09: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 1oLLxE-0000WD-CU; Tue, 09 Aug 2022 09:55:16 +0000
Received: by outflank-mailman (input) for mailman id 382872;
 Tue, 09 Aug 2022 09:55:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLLxD-0000W1-4b
 for xen-changelog@lists.xenproject.org; Tue, 09 Aug 2022 09:55:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLLxD-0003kg-3t
 for xen-changelog@lists.xenproject.org; Tue, 09 Aug 2022 09:55:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLLxD-0000v6-36
 for xen-changelog@lists.xenproject.org; Tue, 09 Aug 2022 09:55:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=qoi7/hkOZOlU/3LfuDs9x7Tz94swuJmkMuP38NwmtX4=; b=E2e0cNm/SagWEUIfhvF4D2KwWL
	mUXJ33qSKtvu1HllJEykTeD75i5+eWHZEsZGPyzIauM2ukS+90sFgfLanH0In129Qummm1itQPgRr
	HQybmyMXp+Kpij4HnByNzwwIy3cYgNanQen6NfU7B5Ct9mnzlr5lNjk0Yqngpx9x3gzU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/cpu: fix MISRA C 2012 Rule 20.7 violation
Message-Id: <E1oLLxD-0000v6-36@xenbits.xenproject.org>
Date: Tue, 09 Aug 2022 09:55:15 +0000

commit e99709a86d59b3a9319f7b00880abd23c62251f1
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Tue Aug 9 11:51:14 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 9 11:51:14 2022 +0200

    xen/cpu: fix MISRA C 2012 Rule 20.7 violation
    
    In MASK_DECLARE_ macros, the macro parameter 'x' is used as expression and
    therefore it is good to be enclosed in parentheses to prevent against
    unintended expansions.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    
    While there add the blanks missing around the + operators involved.
    
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/common/cpu.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/common/cpu.c b/xen/common/cpu.c
index b0b63cdb36..4bdb017b0e 100644
--- a/xen/common/cpu.c
+++ b/xen/common/cpu.c
@@ -25,10 +25,10 @@ const cpumask_t cpumask_all = {
  */
 
 /* cpu_bit_bitmap[0] is empty - so we can back into it */
-#define MASK_DECLARE_1(x) [x+1][0] = 1UL << (x)
-#define MASK_DECLARE_2(x) MASK_DECLARE_1(x), MASK_DECLARE_1(x+1)
-#define MASK_DECLARE_4(x) MASK_DECLARE_2(x), MASK_DECLARE_2(x+2)
-#define MASK_DECLARE_8(x) MASK_DECLARE_4(x), MASK_DECLARE_4(x+4)
+#define MASK_DECLARE_1(x) [(x) + 1][0] = 1UL << (x)
+#define MASK_DECLARE_2(x) MASK_DECLARE_1(x), MASK_DECLARE_1((x) + 1)
+#define MASK_DECLARE_4(x) MASK_DECLARE_2(x), MASK_DECLARE_2((x) + 2)
+#define MASK_DECLARE_8(x) MASK_DECLARE_4(x), MASK_DECLARE_4((x) + 4)
 
 const unsigned long cpu_bit_bitmap[BITS_PER_LONG+1][BITS_TO_LONGS(NR_CPUS)] = {
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Aug 09 09:55:26 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Aug 2022 09:55:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.382873.617927 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oLLxO-0000Yz-GS; Tue, 09 Aug 2022 09:55:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 382873.617927; Tue, 09 Aug 2022 09: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 1oLLxO-0000Ys-Dv; Tue, 09 Aug 2022 09:55:26 +0000
Received: by outflank-mailman (input) for mailman id 382873;
 Tue, 09 Aug 2022 09:55:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLLxN-0000Yk-7Z
 for xen-changelog@lists.xenproject.org; Tue, 09 Aug 2022 09:55:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLLxN-0003l1-6r
 for xen-changelog@lists.xenproject.org; Tue, 09 Aug 2022 09:55:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLLxN-0000vX-5x
 for xen-changelog@lists.xenproject.org; Tue, 09 Aug 2022 09:55:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=XPv/mq9fnATPxkq3wQwz7P6Q8Drc3olwD9REmVirzSA=; b=XPyq2z5pREevJ87Iupevy9Zj3j
	9lAOaP5pDxDbkWuuDIf65P8b2kJOMtXHvMbh0oO68qeN5tB5pBsJWnKA5Le/XR9ypvvXPPMz0y982
	Q527jb3YQF8jOHFolBfVcdLgGEZREXxmLhETsVeiQo9FqrfmMiaJzDMpYo7qvu54RXxI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/cpu: undefine MASK_DECLARE_ macros after their usage
Message-Id: <E1oLLxN-0000vX-5x@xenbits.xenproject.org>
Date: Tue, 09 Aug 2022 09:55:25 +0000

commit 5ee8b1841183bcac492324627fd0dc99b10fdc91
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Tue Aug 9 11:52:06 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 9 11:52:06 2022 +0200

    xen/cpu: undefine MASK_DECLARE_ macros after their usage
    
    MASK_DECLARE_ macros have only a limited scope. Remove their definitions
    immediately after their usage.
    
    Suggested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/common/cpu.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/common/cpu.c b/xen/common/cpu.c
index 4bdb017b0e..778b6820b7 100644
--- a/xen/common/cpu.c
+++ b/xen/common/cpu.c
@@ -40,6 +40,11 @@ const unsigned long cpu_bit_bitmap[BITS_PER_LONG+1][BITS_TO_LONGS(NR_CPUS)] = {
 #endif
 };
 
+#undef MASK_DECLARE_8
+#undef MASK_DECLARE_4
+#undef MASK_DECLARE_2
+#undef MASK_DECLARE_1
+
 static DEFINE_RWLOCK(cpu_add_remove_lock);
 
 bool get_cpu_maps(void)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Aug 09 09:55:36 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Aug 2022 09:55:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.382876.617931 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oLLxY-0000c9-IH; Tue, 09 Aug 2022 09:55:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 382876.617931; Tue, 09 Aug 2022 09:55:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oLLxY-0000c1-FU; Tue, 09 Aug 2022 09:55:36 +0000
Received: by outflank-mailman (input) for mailman id 382876;
 Tue, 09 Aug 2022 09:55:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLLxX-0000bt-AW
 for xen-changelog@lists.xenproject.org; Tue, 09 Aug 2022 09:55:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLLxX-0003lB-9s
 for xen-changelog@lists.xenproject.org; Tue, 09 Aug 2022 09:55:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLLxX-0000wJ-90
 for xen-changelog@lists.xenproject.org; Tue, 09 Aug 2022 09:55:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3BRODfkEAG6TIp6zaLKNzps4s0CJYldOfjMdf4Wz53s=; b=UpKZurXuO7qaN21etcFo/I/Xx5
	kaLqF4RVy9BmqC/2Ketkb0gV0T/aDrS0wjNsZq1JyqASIznU5y5BV2ih4As22UbHS9F1pKLBXSC1m
	qRx0IW9hmEUhraWHBvhgv3gNphLWST/ZZk3zopyt9Its0rQ9P1eu5EuDUOmSLHBcyLvk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] docs: correct x86 MCE command line option info
Message-Id: <E1oLLxX-0000wJ-90@xenbits.xenproject.org>
Date: Tue, 09 Aug 2022 09:55:35 +0000

commit 3caa5a3f03eef4ce7f010aea3af09bb8afde4298
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Aug 9 11:52:49 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 9 11:52:49 2022 +0200

    docs: correct x86 MCE command line option info
    
    Not even the types were correct, let alone defaults being spelled out or
    the purpose of the options actually mentioned in any way.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 docs/misc/xen-command-line.pandoc | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 21d632e83a..fa56e880b3 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -1691,10 +1691,23 @@ one pending bit to be allocated.
 Defaults to 20 bits (to cover at most 1048576 interrupts).
 
 ### mce (x86)
-> `= <integer>`
+> `= <boolean>`
+
+> Default: `true`
+
+Allows to disable the use of Machine Check Exceptions.  Note that doing
+so may result in silent shutdown of the system in case an event occurs
+which would have resulted in raising a Machine Check Exception.  Silent
+here is as far as Xen is concerned; firmware may offer to retrieve some
+collected data.
 
 ### mce_fb (Intel)
-> `= <integer>`
+> `= <boolean>`
+
+> Default: `false`
+
+Force broadcasting of Machine Check Exceptions, suppressing the use of
+Local MCE functionality available in newer Intel hardware.
 
 ### mce_verbosity (x86)
 > `= verbose`
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Aug 09 15:44:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Aug 2022 15:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.383019.618107 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oLROp-0008J5-21; Tue, 09 Aug 2022 15:44:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 383019.618107; Tue, 09 Aug 2022 15:44:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oLROo-0008Ix-Ur; Tue, 09 Aug 2022 15:44:06 +0000
Received: by outflank-mailman (input) for mailman id 383019;
 Tue, 09 Aug 2022 15:44:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLROm-0008Ir-NO
 for xen-changelog@lists.xenproject.org; Tue, 09 Aug 2022 15:44:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLROm-0001hl-Kj
 for xen-changelog@lists.xenproject.org; Tue, 09 Aug 2022 15:44:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLROm-0001wA-Jp
 for xen-changelog@lists.xenproject.org; Tue, 09 Aug 2022 15:44:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=YFU2Yzb3ZcH5+YBFprli8jofuGrNTQ7Kqo/RGIqwVBw=; b=GFiYCRdaWQvWmpAsVv+Ty9Okx7
	JGWLHyqLcnXfAy0GVlns5+iXgmoaZ9yqoHU94uQ/A3vC+yo4ltRe8dDr944tGHXvPf6q6vJcIon4w
	5zDxGZmK1TUjZnqTa10BT+5xN5Zvx/oDIhxMrAD1zXbDoCMz+G/dwneLaQlipIlI/PSU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: Expose more MSR_ARCH_CAPS to hwdom
Message-Id: <E1oLROm-0001wA-Jp@xenbits.xenproject.org>
Date: Tue, 09 Aug 2022 15:44:04 +0000

commit e83cd54611fec5b7a539fa1281a14319143490e6
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Tue Jul 19 16:08:15 2022 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Aug 9 16:35:25 2022 +0100

    x86: Expose more MSR_ARCH_CAPS to hwdom
    
    commit e46474278a0e ("x86/intel: Expose MSR_ARCH_CAPS to dom0") started
    exposing MSR_ARCH_CAPS to dom0.  More bits in MSR_ARCH_CAPS have since
    been defined, but they haven't been exposed.  Update the list to allow
    them through.
    
    As one example, this allows a Linux Dom0 to know that it has the
    appropriate microcode via FB_CLEAR.  Notably, and with the updated
    microcode, this changes dom0's
    /sys/devices/system/cpu/vulnerabilities/mmio_stale_data changes from:
    
      "Vulnerable: Clear CPU buffers attempted, no microcode; SMT Host state unknown"
    
    to:
    
      "Mitigation: Clear CPU buffers; SMT Host state unknown"
    
    This exposes the MMIO Stale Data and Intel Branch History Injection
    (BHI) controls as well as the page size change MCE issue bit.
    
    Fixes: commit 2ebe8fe9b7e0 ("x86/spec-ctrl: Enumeration for MMIO Stale Data controls")
    Fixes: commit cea9ae062295 ("x86/spec-ctrl: Enumeration for new Intel BHI controls")
    Fixes: commit 59e89cdabc71 ("x86/vtx: Disable executable EPT superpages to work around CVE-2018-12207")
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/msr.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 6206529162..170f041793 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -72,7 +72,9 @@ static void __init calculate_host_policy(void)
     mp->arch_caps.raw &=
         (ARCH_CAPS_RDCL_NO | ARCH_CAPS_IBRS_ALL | ARCH_CAPS_RSBA |
          ARCH_CAPS_SKIP_L1DFL | ARCH_CAPS_SSB_NO | ARCH_CAPS_MDS_NO |
-         ARCH_CAPS_IF_PSCHANGE_MC_NO | ARCH_CAPS_TSX_CTRL | ARCH_CAPS_TAA_NO);
+         ARCH_CAPS_IF_PSCHANGE_MC_NO | ARCH_CAPS_TSX_CTRL | ARCH_CAPS_TAA_NO |
+         ARCH_CAPS_SBDR_SSDP_NO | ARCH_CAPS_FBSDP_NO | ARCH_CAPS_PSDP_NO |
+         ARCH_CAPS_FB_CLEAR | ARCH_CAPS_RRSBA | ARCH_CAPS_BHI_NO);
 }
 
 static void __init calculate_pv_max_policy(void)
@@ -161,7 +163,10 @@ int init_domain_msr_policy(struct domain *d)
 
         mp->arch_caps.raw = val &
             (ARCH_CAPS_RDCL_NO | ARCH_CAPS_IBRS_ALL | ARCH_CAPS_RSBA |
-             ARCH_CAPS_SSB_NO | ARCH_CAPS_MDS_NO | ARCH_CAPS_TAA_NO);
+             ARCH_CAPS_SSB_NO | ARCH_CAPS_MDS_NO | ARCH_CAPS_IF_PSCHANGE_MC_NO |
+             ARCH_CAPS_TAA_NO | ARCH_CAPS_SBDR_SSDP_NO | ARCH_CAPS_FBSDP_NO |
+             ARCH_CAPS_PSDP_NO | ARCH_CAPS_FB_CLEAR | ARCH_CAPS_RRSBA |
+             ARCH_CAPS_BHI_NO);
     }
 
     d->arch.msr = mp;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Aug 09 21:55:10 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Aug 2022 21:55:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.383214.618343 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oLXBp-0003ru-GZ; Tue, 09 Aug 2022 21:55:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 383214.618343; Tue, 09 Aug 2022 21:55:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oLXBp-0003rk-CD; Tue, 09 Aug 2022 21:55:05 +0000
Received: by outflank-mailman (input) for mailman id 383214;
 Tue, 09 Aug 2022 21:55:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLXBo-0003re-0c
 for xen-changelog@lists.xenproject.org; Tue, 09 Aug 2022 21:55:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLXBn-0001oj-Vv
 for xen-changelog@lists.xenproject.org; Tue, 09 Aug 2022 21:55:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLXBn-0007Ex-TS
 for xen-changelog@lists.xenproject.org; Tue, 09 Aug 2022 21:55:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=EnCHYNFdtKNN6Vv4GTwM8MyegTwMQ4pBUkeg/T8JHpg=; b=U5rThEvb4r49PmC1eF9Vx68uzf
	EvFjSOObjJ01tn+TSOxq/NwZa+ns1rDjJloxmexQm5Xf2lYx9P03vcIEod8PQCxVWTpEYf4eq7zar
	azaUhazW38rjBtB2Var0pDigqkTNmNMGh71guhAthc8zJ7KrPcBxjjS7OYevsj3FIOtE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: regs: Fix MISRA C 2012 Rule 20.7 violation
Message-Id: <E1oLXBn-0007Ex-TS@xenbits.xenproject.org>
Date: Tue, 09 Aug 2022 21:55:03 +0000

commit ea2353a7fbdabeb5f698ac53579dec1c8ea9f77a
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Mon Aug 8 12:48:37 2022 +0300
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Aug 9 14:47:47 2022 -0700

    xen/arm: regs: Fix MISRA C 2012 Rule 20.7 violation
    
    In macro psr_mode(), the macro parameter 'm' is used as expression and
    therefore it is good to be enclosed in parentheses to prevent against
    unintended expansions.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Reviewed-by: Rahul Singh <rahul.singh@arm.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/include/asm/regs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/include/asm/regs.h b/xen/arch/arm/include/asm/regs.h
index 794721a103..0693a68131 100644
--- a/xen/arch/arm/include/asm/regs.h
+++ b/xen/arch/arm/include/asm/regs.h
@@ -11,7 +11,7 @@
 #include <asm/current.h>
 #include <asm/processor.h>
 
-#define psr_mode(psr,m) (((psr) & PSR_MODE_MASK) == m)
+#define psr_mode(psr,m) (((psr) & PSR_MODE_MASK) == (m))
 
 static inline bool regs_mode_is_32bit(const struct cpu_user_regs *regs)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Aug 09 23:44:04 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Aug 2022 23:44:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.383251.618386 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oLYtG-00079f-2F; Tue, 09 Aug 2022 23:44:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 383251.618386; Tue, 09 Aug 2022 23:44:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oLYtF-00079X-VH; Tue, 09 Aug 2022 23:44:01 +0000
Received: by outflank-mailman (input) for mailman id 383251;
 Tue, 09 Aug 2022 23:44:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLYtF-00079R-IT
 for xen-changelog@lists.xenproject.org; Tue, 09 Aug 2022 23:44:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLYtF-0003os-Hd
 for xen-changelog@lists.xenproject.org; Tue, 09 Aug 2022 23:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLYtF-0003lf-Gd
 for xen-changelog@lists.xenproject.org; Tue, 09 Aug 2022 23:44:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Ae+UQcRTJTSUcjHN/bAS6btq8pLMf8WPJDLqwVYnzi4=; b=UhPdelvDwo4HAy39BHoEIk+Qa+
	0poefA7GrTvuJUxDxS9XWmnjSheu3t97vO7AvVCTJJboNPwxbvrjHGe1S28nkkvekZLZ4NXCYH3mu
	fTGGTu/ucz0aL2gPQKdxme09RNd+tuFWgoTVNzAVEBprUFkhoZC5qEgmHlNsEN2yQNyU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: qemu-smoke-arm64: Use kernel 5.19
Message-Id: <E1oLYtF-0003lf-Gd@xenbits.xenproject.org>
Date: Tue, 09 Aug 2022 23:44:01 +0000

commit 40cd0e968fa33df090b64196fe0b0e87f376d4a4
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Mon Aug 8 21:39:51 2022 +0300
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Aug 8 15:32:25 2022 -0700

    automation: qemu-smoke-arm64: Use kernel 5.19
    
    Use kernel 5.19 to unblock testing dom0less enhanced.
    This kernel version has the necessary patches for deferring xenbus probe
    until xenstore is fully initialized.
    Also, build kernel with bridging and xen netback support enabled because
    it will be used for testing network connectivity between Dom0 and Dom1
    over a pv network interface.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/gitlab-ci/build.yaml                    | 11 +++++++
 automation/gitlab-ci/test.yaml                     |  4 +--
 .../tests-artifacts/kernel/5.19-arm64v8.dockerfile | 37 ++++++++++++++++++++++
 3 files changed, 50 insertions(+), 2 deletions(-)

diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 23b306e7d0..d2f75a090c 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -597,6 +597,17 @@ kernel-5.9.9-arm64-export:
   tags:
     - arm64
 
+kernel-5.19-arm64-export:
+  extends: .test-jobs-artifact-common
+  image: registry.gitlab.com/xen-project/xen/tests-artifacts/kernel:5.19-arm64v8
+  script:
+    - mkdir binaries && cp /Image binaries/Image
+  artifacts:
+    paths:
+      - binaries/Image
+  tags:
+    - arm64
+
 qemu-system-aarch64-6.0.0-arm64-export:
   extends: .test-jobs-artifact-common
   image: registry.gitlab.com/xen-project/xen/tests-artifacts/qemu-system-aarch64:6.0.0-arm64v8
diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index 6f9f64a8da..aa633fb655 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -70,7 +70,7 @@ qemu-smoke-arm64-gcc:
     - ./automation/scripts/qemu-smoke-arm64.sh 2>&1 | tee qemu-smoke-arm64.log
   needs:
     - debian-unstable-gcc-arm64
-    - kernel-5.9.9-arm64-export
+    - kernel-5.19-arm64-export
     - qemu-system-aarch64-6.0.0-arm64-export
   artifacts:
     paths:
@@ -88,7 +88,7 @@ qemu-smoke-arm64-gcc-staticmem:
     - ./automation/scripts/qemu-smoke-arm64.sh static-mem 2>&1 | tee qemu-smoke-arm64.log
   needs:
     - debian-unstable-gcc-arm64
-    - kernel-5.9.9-arm64-export
+    - kernel-5.19-arm64-export
     - qemu-system-aarch64-6.0.0-arm64-export
   artifacts:
     paths:
diff --git a/automation/tests-artifacts/kernel/5.19-arm64v8.dockerfile b/automation/tests-artifacts/kernel/5.19-arm64v8.dockerfile
new file mode 100644
index 0000000000..e445c1f03a
--- /dev/null
+++ b/automation/tests-artifacts/kernel/5.19-arm64v8.dockerfile
@@ -0,0 +1,37 @@
+FROM arm64v8/debian:unstable
+LABEL maintainer.name="The Xen Project" \
+      maintainer.email="xen-devel@lists.xenproject.org"
+
+ENV DEBIAN_FRONTEND=noninteractive
+ENV LINUX_VERSION=5.19
+ENV USER root
+
+RUN mkdir /build
+WORKDIR /build
+
+# build depends
+RUN apt-get update && \
+    apt-get --quiet --yes install \
+        build-essential \
+        libssl-dev \
+        bc \
+        curl \
+        flex \
+        bison \
+        && \
+    \
+    # Build the kernel
+    curl -fsSLO https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-"$LINUX_VERSION".tar.xz && \
+    tar xvJf linux-"$LINUX_VERSION".tar.xz && \
+    cd linux-"$LINUX_VERSION" && \
+    make defconfig && \
+    sed -i 's/CONFIG_IPV6=m/CONFIG_IPV6=y/g' .config && \
+    sed -i 's/CONFIG_BRIDGE=m/CONFIG_BRIDGE=y/g' .config && \
+    sed -i 's/# CONFIG_XEN_NETDEV_BACKEND is not set/CONFIG_XEN_NETDEV_BACKEND=y/g' .config && \
+    make -j$(nproc) Image.gz && \
+    cp arch/arm64/boot/Image / && \
+    cd /build && \
+    rm -rf linux-"$LINUX_VERSION"* && \
+    apt-get autoremove -y && \
+    apt-get clean && \
+    rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Aug 09 23:44:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Aug 2022 23:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.383252.618389 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oLYtR-0007CD-3T; Tue, 09 Aug 2022 23:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 383252.618389; Tue, 09 Aug 2022 23:44:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oLYtR-0007C6-0j; Tue, 09 Aug 2022 23:44:13 +0000
Received: by outflank-mailman (input) for mailman id 383252;
 Tue, 09 Aug 2022 23:44:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLYtP-0007Bt-M0
 for xen-changelog@lists.xenproject.org; Tue, 09 Aug 2022 23:44:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLYtP-0003p9-LA
 for xen-changelog@lists.xenproject.org; Tue, 09 Aug 2022 23:44:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLYtP-0003m7-Jg
 for xen-changelog@lists.xenproject.org; Tue, 09 Aug 2022 23:44:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=LCN4wITOKpnjVc400KicLt4aC3DjpFkrOWBhRAK1ZIE=; b=ezyzJ2cTNilS4hUqhTIW+ZNNpQ
	x/D6mygJvuoZ2g/XDpUWi52ib21vD5p6jeumBNJWo0bUs6CKiwdXvrJzbDorEnTuKLFcvgMk0pWkO
	WkJl+3lVSbmeJ59fxLUzYwRBiYeNiiECGCltuwAPKnCDHYlfBDrwRIlHJD4Ekj3BdAGw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: qemu-smoke-arm64: Run ping test over a pv network interface
Message-Id: <E1oLYtP-0003m7-Jg@xenbits.xenproject.org>
Date: Tue, 09 Aug 2022 23:44:11 +0000

commit 89805b35ce6a0cf402563ebe2f09b03f27152474
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Mon Aug 8 21:39:52 2022 +0300
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Aug 8 15:34:12 2022 -0700

    automation: qemu-smoke-arm64: Run ping test over a pv network interface
    
    This patch modified the test in the following way
    - Dom0 is booted with an alpine linux rootfs with the xen tools.
    - Once Dom0 is booted, it starts xenstored, calls init-dom0less to setup
    the xenstore interface for the dom0less Dom1, setups the bridged network
    and attaches a pv network interface to Dom1.
    - In the meantime, Dom1 in its init script tries to assign an ip to eth0
    and ping Dom0,
    - If Dom1 manages to ping Dom0, it prints 'passed'.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/gitlab-ci/test.yaml         |  6 +++--
 automation/scripts/qemu-smoke-arm64.sh | 44 ++++++++++++++++++++++++++++++----
 2 files changed, 43 insertions(+), 7 deletions(-)

diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index aa633fb655..2eb6c3866e 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -69,7 +69,8 @@ qemu-smoke-arm64-gcc:
   script:
     - ./automation/scripts/qemu-smoke-arm64.sh 2>&1 | tee qemu-smoke-arm64.log
   needs:
-    - debian-unstable-gcc-arm64
+    - alpine-3.12-gcc-arm64
+    - alpine-3.12-arm64-rootfs-export
     - kernel-5.19-arm64-export
     - qemu-system-aarch64-6.0.0-arm64-export
   artifacts:
@@ -87,7 +88,8 @@ qemu-smoke-arm64-gcc-staticmem:
   script:
     - ./automation/scripts/qemu-smoke-arm64.sh static-mem 2>&1 | tee qemu-smoke-arm64.log
   needs:
-    - debian-unstable-gcc-arm64
+    - alpine-3.12-gcc-arm64
+    - alpine-3.12-arm64-rootfs-export
     - kernel-5.19-arm64-export
     - qemu-system-aarch64-6.0.0-arm64-export
   artifacts:
diff --git a/automation/scripts/qemu-smoke-arm64.sh b/automation/scripts/qemu-smoke-arm64.sh
index 497dbee15f..c80d9b2aee 100755
--- a/automation/scripts/qemu-smoke-arm64.sh
+++ b/automation/scripts/qemu-smoke-arm64.sh
@@ -4,8 +4,13 @@ set -ex
 
 test_variant=$1
 
-passed="BusyBox"
-check=""
+passed="passed"
+check="
+until ifconfig eth0 192.168.0.2 && ping -c 10 192.168.0.1; do
+    sleep 30
+done
+echo \"${passed}\"
+"
 
 if [[ "${test_variant}" == "static-mem" ]]; then
     # Memory range that is statically allocated to DOM1
@@ -68,6 +73,36 @@ cd initrd
 find . | cpio --create --format='newc' | gzip > ../binaries/initrd
 cd ..
 
+# DOM0 rootfs
+mkdir -p rootfs
+cd rootfs
+tar xzf ../binaries/initrd.tar.gz
+mkdir proc
+mkdir run
+mkdir srv
+mkdir sys
+rm var/run
+cp -ar ../binaries/dist/install/* .
+
+echo "#!/bin/bash
+
+export LD_LIBRARY_PATH=/usr/local/lib
+bash /etc/init.d/xencommons start
+
+/usr/local/lib/xen/bin/init-dom0less
+
+brctl addbr xenbr0
+brctl addif xenbr0 eth0
+ifconfig eth0 up
+ifconfig xenbr0 up
+ifconfig xenbr0 192.168.0.1
+
+xl network-attach 1 type=vif
+" > etc/local.d/xen.start
+chmod +x etc/local.d/xen.start
+echo "rc_verbose=yes" >> etc/rc.conf
+find . | cpio -H newc -o | gzip > ../binaries/dom0-rootfs.cpio.gz
+cd ..
 
 # ImageBuilder
 echo 'MEMORY_START="0x40000000"
@@ -76,14 +111,13 @@ MEMORY_END="0x80000000"
 DEVICE_TREE="virt-gicv2.dtb"
 XEN="xen"
 DOM0_KERNEL="Image"
-DOM0_RAMDISK="initrd"
+DOM0_RAMDISK="dom0-rootfs.cpio.gz"
 XEN_CMD="console=dtuart dom0_mem=512M"
 
 NUM_DOMUS=1
 DOMU_KERNEL[0]="Image"
 DOMU_RAMDISK[0]="initrd"
 DOMU_MEM[0]="256"
-DOMU_ENHANCED[0]=0
 
 LOAD_CMD="tftpb"
 UBOOT_SOURCE="boot.source"
@@ -114,5 +148,5 @@ timeout -k 1 240 \
     -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin |& tee smoke.serial
 
 set -e
-(grep -q "^BusyBox" smoke.serial && grep -q "DOM1: ${passed}" smoke.serial) || exit 1
+(grep -q "^Welcome to Alpine Linux" smoke.serial && grep -q "DOM1: ${passed}" smoke.serial) || exit 1
 exit 0
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Aug 09 23:44:23 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Aug 2022 23:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.383253.618393 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oLYtb-0007FS-5A; Tue, 09 Aug 2022 23:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 383253.618393; Tue, 09 Aug 2022 23:44:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oLYtb-0007FK-2T; Tue, 09 Aug 2022 23:44:23 +0000
Received: by outflank-mailman (input) for mailman id 383253;
 Tue, 09 Aug 2022 23:44:21 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLYtZ-0007F5-QK
 for xen-changelog@lists.xenproject.org; Tue, 09 Aug 2022 23:44:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLYtZ-0003pq-PZ
 for xen-changelog@lists.xenproject.org; Tue, 09 Aug 2022 23:44:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLYtZ-0003oB-NK
 for xen-changelog@lists.xenproject.org; Tue, 09 Aug 2022 23:44:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=2N7oYhqPONr2iGvVdGcu5/YGL0noHFm+ebFD2bKLN1g=; b=zHAmrq2kw0qbijZGzttAPx2ruX
	xr8rtJT7zQlUGRBZehv2ZMws1l1qJ1ggoBd3nNpSO5TaKimib/65MqF5vvhpQuymuJu4tPQp37VSO
	h7anEl3Lt0Xy/mfkWw4Oi0VRuUSv41EqARcySclnRky32Jx0CHfhFwqgDS/KZNNgs47c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/kexec: Add the '.L_' prefix to is_* and call_* labels
Message-Id: <E1oLYtZ-0003oB-NK@xenbits.xenproject.org>
Date: Tue, 09 Aug 2022 23:44:21 +0000

commit f3eafc58f45448d0ce7c7544bdef50d6f0d7d3d6
Author:     Jane Malalane <jane.malalane@citrix.com>
AuthorDate: Tue Aug 9 11:49:43 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 9 11:49:43 2022 +0200

    x86/kexec: Add the '.L_' prefix to is_* and call_* labels
    
    These are local symbols and shouldn't be externally visible.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jane Malalane <jane.malalane@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/x86_64/kexec_reloc.S | 42 +++++++++++++++++++--------------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/xen/arch/x86/x86_64/kexec_reloc.S b/xen/arch/x86/x86_64/kexec_reloc.S
index 89316bc3a7..f4842025eb 100644
--- a/xen/arch/x86/x86_64/kexec_reloc.S
+++ b/xen/arch/x86/x86_64/kexec_reloc.S
@@ -40,10 +40,10 @@ ENTRY(kexec_reloc)
         movq    %rsi, %cr3
 
         /* Jump to identity mapped code. */
-        leaq    (identity_mapped - kexec_reloc)(%rdi), %rax
+        leaq    (.L_identity_mapped - kexec_reloc)(%rdi), %rax
         jmpq    *%rax
 
-identity_mapped:
+.L_identity_mapped:
         /*
          * Set cr0 to a known state:
          *  - Paging enabled
@@ -70,14 +70,14 @@ identity_mapped:
 
         /* Need to switch to 32-bit mode? */
         testq   $KEXEC_RELOC_FLAG_COMPAT, %r8
-        jnz     call_32_bit
+        jnz     .L_call_32_bit
 
-call_64_bit:
+.L_call_64_bit:
         /* Call the image entry point.  This should never return. */
         callq   *%rbp
         ud2
 
-call_32_bit:
+.L_call_32_bit:
         /* Setup IDT. */
         lidt    compat_mode_idt(%rip)
 
@@ -102,41 +102,41 @@ relocate_pages:
         xorl    %edi, %edi
         xorl    %esi, %esi
 
-next_entry: /* top, read another word for the indirection page */
+.L_next_entry: /* top, read another word for the indirection page */
 
         movq    (%rbx), %rcx
         addq    $8, %rbx
-is_dest:
+.L_is_dest:
         testb   $IND_DESTINATION, %cl
-        jz      is_ind
+        jz      .L_is_ind
         movq    %rcx, %rdi
         andq    $PAGE_MASK, %rdi
-        jmp     next_entry
-is_ind:
+        jmp     .L_next_entry
+.L_is_ind:
         testb   $IND_INDIRECTION, %cl
-        jz      is_done
+        jz      .L_is_done
         movq    %rcx, %rbx
         andq    $PAGE_MASK, %rbx
-        jmp     next_entry
-is_done:
+        jmp     .L_next_entry
+.L_is_done:
         testb   $IND_DONE, %cl
-        jnz     done
-is_source:
+        jnz     .L_done
+.L_is_source:
         testb   $IND_SOURCE, %cl
-        jz      is_zero
+        jz      .L_is_zero
         movq    %rcx, %rsi      /* For every source page do a copy */
         andq    $PAGE_MASK, %rsi
         movl    $(PAGE_SIZE / 8), %ecx
         rep movsq
-        jmp     next_entry
-is_zero:
+        jmp     .L_next_entry
+.L_is_zero:
         testb   $IND_ZERO, %cl
-        jz      next_entry
+        jz      .L_next_entry
         movl    $(PAGE_SIZE / 8), %ecx  /* Zero the destination page. */
         xorl    %eax, %eax
         rep stosq
-        jmp     next_entry
-done:
+        jmp     .L_next_entry
+.L_done:
         popq    %rbx
         ret
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Aug 09 23:44:33 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Aug 2022 23:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.383255.618399 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oLYtl-0007It-7k; Tue, 09 Aug 2022 23:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 383255.618399; Tue, 09 Aug 2022 23:44:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oLYtl-0007Il-3z; Tue, 09 Aug 2022 23:44:33 +0000
Received: by outflank-mailman (input) for mailman id 383255;
 Tue, 09 Aug 2022 23:44:31 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLYtj-0007Ia-TC
 for xen-changelog@lists.xenproject.org; Tue, 09 Aug 2022 23:44:31 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLYtj-0003px-SR
 for xen-changelog@lists.xenproject.org; Tue, 09 Aug 2022 23:44:31 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLYtj-0003oe-Ri
 for xen-changelog@lists.xenproject.org; Tue, 09 Aug 2022 23:44:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vMfiTg11vbl9Ds5HKYRi6xDHjtfn6Fm9f6gkuPmV7x8=; b=1LM9Ds5ahm9Rgz8q6ZdsRcSEj+
	/f0BQUPHcvbVwxtwugPcZscqQpTunJO2FzM6P2p3WCxHx2tFMzIL+gDUrmKy0ls+NiGO2nszs/Egs
	hqXJ/E3DW6YC2/SihBFLk4PCNrb3PgEvDL26VFSqD+AieZDveTPKLdcWxGxx77FmRSiM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/cpu: fix MISRA C 2012 Rule 20.7 violation
Message-Id: <E1oLYtj-0003oe-Ri@xenbits.xenproject.org>
Date: Tue, 09 Aug 2022 23:44:31 +0000

commit e99709a86d59b3a9319f7b00880abd23c62251f1
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Tue Aug 9 11:51:14 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 9 11:51:14 2022 +0200

    xen/cpu: fix MISRA C 2012 Rule 20.7 violation
    
    In MASK_DECLARE_ macros, the macro parameter 'x' is used as expression and
    therefore it is good to be enclosed in parentheses to prevent against
    unintended expansions.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    
    While there add the blanks missing around the + operators involved.
    
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/common/cpu.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/common/cpu.c b/xen/common/cpu.c
index b0b63cdb36..4bdb017b0e 100644
--- a/xen/common/cpu.c
+++ b/xen/common/cpu.c
@@ -25,10 +25,10 @@ const cpumask_t cpumask_all = {
  */
 
 /* cpu_bit_bitmap[0] is empty - so we can back into it */
-#define MASK_DECLARE_1(x) [x+1][0] = 1UL << (x)
-#define MASK_DECLARE_2(x) MASK_DECLARE_1(x), MASK_DECLARE_1(x+1)
-#define MASK_DECLARE_4(x) MASK_DECLARE_2(x), MASK_DECLARE_2(x+2)
-#define MASK_DECLARE_8(x) MASK_DECLARE_4(x), MASK_DECLARE_4(x+4)
+#define MASK_DECLARE_1(x) [(x) + 1][0] = 1UL << (x)
+#define MASK_DECLARE_2(x) MASK_DECLARE_1(x), MASK_DECLARE_1((x) + 1)
+#define MASK_DECLARE_4(x) MASK_DECLARE_2(x), MASK_DECLARE_2((x) + 2)
+#define MASK_DECLARE_8(x) MASK_DECLARE_4(x), MASK_DECLARE_4((x) + 4)
 
 const unsigned long cpu_bit_bitmap[BITS_PER_LONG+1][BITS_TO_LONGS(NR_CPUS)] = {
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Aug 09 23:44:43 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Aug 2022 23:44:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.383257.618401 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oLYtv-0007LU-8D; Tue, 09 Aug 2022 23:44:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 383257.618401; Tue, 09 Aug 2022 23:44:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oLYtv-0007LM-5V; Tue, 09 Aug 2022 23:44:43 +0000
Received: by outflank-mailman (input) for mailman id 383257;
 Tue, 09 Aug 2022 23:44:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLYtu-0007LC-0X
 for xen-changelog@lists.xenproject.org; Tue, 09 Aug 2022 23:44:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLYtt-0003q8-W6
 for xen-changelog@lists.xenproject.org; Tue, 09 Aug 2022 23:44:41 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLYtt-0003pP-UV
 for xen-changelog@lists.xenproject.org; Tue, 09 Aug 2022 23:44:41 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PPgGNtR7I2FAvTHLJh1eUYC7MsKytIBF0D0/m2lfsYA=; b=vwVXQ/z3+IAzkRwfZ+v8h9lnwg
	6mMwCdjqkojw3wKZSrjOrBx/vc2DA/Xcy65a92lZPcCqsz3M6XEEs0ssoh/vDLTr+xpI2mGpFwg9c
	KPq5hRljWVTHcoldq8reUQMbJKEiSfqaJEzdxFy4UHFIpGDL/JObhi68Ps3xKX2mnHOQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/cpu: undefine MASK_DECLARE_ macros after their usage
Message-Id: <E1oLYtt-0003pP-UV@xenbits.xenproject.org>
Date: Tue, 09 Aug 2022 23:44:41 +0000

commit 5ee8b1841183bcac492324627fd0dc99b10fdc91
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Tue Aug 9 11:52:06 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 9 11:52:06 2022 +0200

    xen/cpu: undefine MASK_DECLARE_ macros after their usage
    
    MASK_DECLARE_ macros have only a limited scope. Remove their definitions
    immediately after their usage.
    
    Suggested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/common/cpu.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/common/cpu.c b/xen/common/cpu.c
index 4bdb017b0e..778b6820b7 100644
--- a/xen/common/cpu.c
+++ b/xen/common/cpu.c
@@ -40,6 +40,11 @@ const unsigned long cpu_bit_bitmap[BITS_PER_LONG+1][BITS_TO_LONGS(NR_CPUS)] = {
 #endif
 };
 
+#undef MASK_DECLARE_8
+#undef MASK_DECLARE_4
+#undef MASK_DECLARE_2
+#undef MASK_DECLARE_1
+
 static DEFINE_RWLOCK(cpu_add_remove_lock);
 
 bool get_cpu_maps(void)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Aug 09 23:44:53 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Aug 2022 23:44:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.383260.618406 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oLYu5-0007Pu-Bq; Tue, 09 Aug 2022 23:44:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 383260.618406; Tue, 09 Aug 2022 23:44:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oLYu5-0007Ph-8J; Tue, 09 Aug 2022 23:44:53 +0000
Received: by outflank-mailman (input) for mailman id 383260;
 Tue, 09 Aug 2022 23:44:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLYu4-0007PV-3d
 for xen-changelog@lists.xenproject.org; Tue, 09 Aug 2022 23:44:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLYu4-0003qJ-2w
 for xen-changelog@lists.xenproject.org; Tue, 09 Aug 2022 23:44:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLYu4-0003pt-21
 for xen-changelog@lists.xenproject.org; Tue, 09 Aug 2022 23:44:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=evoJyEvTyh/wNSrT4lYnsndPfXr+lSwTstDvxWZnXn0=; b=Tv2yf8c13rtR5BeLf9MqRogAze
	6r240brrwSLvWylLI2spEuh9T5IhKwSDAduJBXnQYWAyQkHbKmI3qUWOV6lwMAGjfpOO+AbaMzOWL
	1IKR/WDY1ald6k186KhwHt3We+OAgsV61U2KVB7eOXYm2OztD4rkH62TCWYkBo7NfJX4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs: correct x86 MCE command line option info
Message-Id: <E1oLYu4-0003pt-21@xenbits.xenproject.org>
Date: Tue, 09 Aug 2022 23:44:52 +0000

commit 3caa5a3f03eef4ce7f010aea3af09bb8afde4298
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Aug 9 11:52:49 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 9 11:52:49 2022 +0200

    docs: correct x86 MCE command line option info
    
    Not even the types were correct, let alone defaults being spelled out or
    the purpose of the options actually mentioned in any way.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 docs/misc/xen-command-line.pandoc | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 21d632e83a..fa56e880b3 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -1691,10 +1691,23 @@ one pending bit to be allocated.
 Defaults to 20 bits (to cover at most 1048576 interrupts).
 
 ### mce (x86)
-> `= <integer>`
+> `= <boolean>`
+
+> Default: `true`
+
+Allows to disable the use of Machine Check Exceptions.  Note that doing
+so may result in silent shutdown of the system in case an event occurs
+which would have resulted in raising a Machine Check Exception.  Silent
+here is as far as Xen is concerned; firmware may offer to retrieve some
+collected data.
 
 ### mce_fb (Intel)
-> `= <integer>`
+> `= <boolean>`
+
+> Default: `false`
+
+Force broadcasting of Machine Check Exceptions, suppressing the use of
+Local MCE functionality available in newer Intel hardware.
 
 ### mce_verbosity (x86)
 > `= verbose`
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Aug 10 09:00:16 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Aug 2022 09:00:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.383451.618620 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oLhZM-0000ie-FX; Wed, 10 Aug 2022 09:00:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 383451.618620; Wed, 10 Aug 2022 09:00: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 1oLhZM-0000hp-Bz; Wed, 10 Aug 2022 09:00:04 +0000
Received: by outflank-mailman (input) for mailman id 383451;
 Wed, 10 Aug 2022 09:00:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLhZK-0000JI-9I
 for xen-changelog@lists.xenproject.org; Wed, 10 Aug 2022 09:00:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLhZK-0005E4-7C
 for xen-changelog@lists.xenproject.org; Wed, 10 Aug 2022 09:00:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLhZK-0007Ev-6B
 for xen-changelog@lists.xenproject.org; Wed, 10 Aug 2022 09:00:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wjP6p3EBuAjtRDKuRUmdB2wZYuvKxfsLmgym6brlLzs=; b=lqbvYDMGvWW593PecmCIzEUOor
	y2sDwly1E5sY17f32FAa/XsmYdYSWT7q9gNG3IaBGjX+CvHRM5QjPgQ8veOOKHjyTYOiwjjVClJ+R
	BJEXdRlGYRqun63+zdPxQrx0KRytei9O/JrSKzK/Q7/WkX19gENsrasKLhgfsEKQ+DkI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: Expose more MSR_ARCH_CAPS to hwdom
Message-Id: <E1oLhZK-0007Ev-6B@xenbits.xenproject.org>
Date: Wed, 10 Aug 2022 09:00:02 +0000

commit e83cd54611fec5b7a539fa1281a14319143490e6
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Tue Jul 19 16:08:15 2022 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Aug 9 16:35:25 2022 +0100

    x86: Expose more MSR_ARCH_CAPS to hwdom
    
    commit e46474278a0e ("x86/intel: Expose MSR_ARCH_CAPS to dom0") started
    exposing MSR_ARCH_CAPS to dom0.  More bits in MSR_ARCH_CAPS have since
    been defined, but they haven't been exposed.  Update the list to allow
    them through.
    
    As one example, this allows a Linux Dom0 to know that it has the
    appropriate microcode via FB_CLEAR.  Notably, and with the updated
    microcode, this changes dom0's
    /sys/devices/system/cpu/vulnerabilities/mmio_stale_data changes from:
    
      "Vulnerable: Clear CPU buffers attempted, no microcode; SMT Host state unknown"
    
    to:
    
      "Mitigation: Clear CPU buffers; SMT Host state unknown"
    
    This exposes the MMIO Stale Data and Intel Branch History Injection
    (BHI) controls as well as the page size change MCE issue bit.
    
    Fixes: commit 2ebe8fe9b7e0 ("x86/spec-ctrl: Enumeration for MMIO Stale Data controls")
    Fixes: commit cea9ae062295 ("x86/spec-ctrl: Enumeration for new Intel BHI controls")
    Fixes: commit 59e89cdabc71 ("x86/vtx: Disable executable EPT superpages to work around CVE-2018-12207")
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/msr.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 6206529162..170f041793 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -72,7 +72,9 @@ static void __init calculate_host_policy(void)
     mp->arch_caps.raw &=
         (ARCH_CAPS_RDCL_NO | ARCH_CAPS_IBRS_ALL | ARCH_CAPS_RSBA |
          ARCH_CAPS_SKIP_L1DFL | ARCH_CAPS_SSB_NO | ARCH_CAPS_MDS_NO |
-         ARCH_CAPS_IF_PSCHANGE_MC_NO | ARCH_CAPS_TSX_CTRL | ARCH_CAPS_TAA_NO);
+         ARCH_CAPS_IF_PSCHANGE_MC_NO | ARCH_CAPS_TSX_CTRL | ARCH_CAPS_TAA_NO |
+         ARCH_CAPS_SBDR_SSDP_NO | ARCH_CAPS_FBSDP_NO | ARCH_CAPS_PSDP_NO |
+         ARCH_CAPS_FB_CLEAR | ARCH_CAPS_RRSBA | ARCH_CAPS_BHI_NO);
 }
 
 static void __init calculate_pv_max_policy(void)
@@ -161,7 +163,10 @@ int init_domain_msr_policy(struct domain *d)
 
         mp->arch_caps.raw = val &
             (ARCH_CAPS_RDCL_NO | ARCH_CAPS_IBRS_ALL | ARCH_CAPS_RSBA |
-             ARCH_CAPS_SSB_NO | ARCH_CAPS_MDS_NO | ARCH_CAPS_TAA_NO);
+             ARCH_CAPS_SSB_NO | ARCH_CAPS_MDS_NO | ARCH_CAPS_IF_PSCHANGE_MC_NO |
+             ARCH_CAPS_TAA_NO | ARCH_CAPS_SBDR_SSDP_NO | ARCH_CAPS_FBSDP_NO |
+             ARCH_CAPS_PSDP_NO | ARCH_CAPS_FB_CLEAR | ARCH_CAPS_RRSBA |
+             ARCH_CAPS_BHI_NO);
     }
 
     d->arch.msr = mp;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Aug 10 20:44:10 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Aug 2022 20:44:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.384042.619303 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oLsYe-0007Fn-ND; Wed, 10 Aug 2022 20:44:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 384042.619303; Wed, 10 Aug 2022 20:44:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oLsYe-0007Fg-KD; Wed, 10 Aug 2022 20:44:04 +0000
Received: by outflank-mailman (input) for mailman id 384042;
 Wed, 10 Aug 2022 20:44:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLsYe-0007Fa-A1
 for xen-changelog@lists.xenproject.org; Wed, 10 Aug 2022 20:44:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLsYe-0001Jt-7h
 for xen-changelog@lists.xenproject.org; Wed, 10 Aug 2022 20:44:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oLsYe-0004rB-6o
 for xen-changelog@lists.xenproject.org; Wed, 10 Aug 2022 20:44:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=HEGwi2GDo1ZkRGBWB6Gwukd4lzXX1cbVqc7xZN4lNVg=; b=If+7jtRncHltto5PYgV28TAbLV
	AL83ASFVt8h2JNrfnWO1HgFeDsg2cVhGhyOMVlsPpC/SRD5WIWYtqY/QzvxgqMHREMaN0L+2RYEVA
	Iytxw73nAb3LEA1Mc2cJq/CkuWL5eXQoQkHhiXDzS3rPjZ3Mnp+9CUF537UTA4p4zGzE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: vreg: Fix MISRA C 2012 Rule 20.7 violation
Message-Id: <E1oLsYe-0004rB-6o@xenbits.xenproject.org>
Date: Wed, 10 Aug 2022 20:44:04 +0000

commit d7c3c845c44e097d6c980001e108da0bb84ed16f
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Tue Aug 9 12:30:48 2022 +0300
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Aug 10 13:35:31 2022 -0700

    xen/arm: vreg: Fix MISRA C 2012 Rule 20.7 violation
    
    In VREG_REG_HELPERS(), the macro parameter 'offmask' is used as expression and
    therefore it is good to be enclosed in parentheses to prevent against
    unintended expansions.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/include/asm/vreg.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/include/asm/vreg.h b/xen/arch/arm/include/asm/vreg.h
index fa2f4cdb17..f26a70d024 100644
--- a/xen/arch/arm/include/asm/vreg.h
+++ b/xen/arch/arm/include/asm/vreg.h
@@ -141,7 +141,7 @@ static inline void vreg_reg_clearbits(unsigned long *reg, register_t bits,
 static inline register_t vreg_reg##sz##_extract(uint##sz##_t reg,       \
                                                 const mmio_info_t *info)\
 {                                                                       \
-    return vreg_reg_extract(reg, info->gpa & offmask,                   \
+    return vreg_reg_extract(reg, info->gpa & (offmask),                 \
                             info->dabt.size);                           \
 }                                                                       \
                                                                         \
@@ -151,7 +151,7 @@ static inline void vreg_reg##sz##_update(uint##sz##_t *reg,             \
 {                                                                       \
     unsigned long tmp = *reg;                                           \
                                                                         \
-    vreg_reg_update(&tmp, val, info->gpa & offmask,                     \
+    vreg_reg_update(&tmp, val, info->gpa & (offmask),                   \
                     info->dabt.size);                                   \
                                                                         \
     *reg = tmp;                                                         \
@@ -163,7 +163,7 @@ static inline void vreg_reg##sz##_setbits(uint##sz##_t *reg,            \
 {                                                                       \
     unsigned long tmp = *reg;                                           \
                                                                         \
-    vreg_reg_setbits(&tmp, bits, info->gpa & offmask,                   \
+    vreg_reg_setbits(&tmp, bits, info->gpa & (offmask),                 \
                      info->dabt.size);                                  \
                                                                         \
     *reg = tmp;                                                         \
@@ -175,7 +175,7 @@ static inline void vreg_reg##sz##_clearbits(uint##sz##_t *reg,          \
 {                                                                       \
     unsigned long tmp = *reg;                                           \
                                                                         \
-    vreg_reg_clearbits(&tmp, bits, info->gpa & offmask,                 \
+    vreg_reg_clearbits(&tmp, bits, info->gpa & (offmask),               \
                        info->dabt.size);                                \
                                                                         \
     *reg = tmp;                                                         \
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 11 09:55:11 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 11 Aug 2022 09:55:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.384358.619710 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oM4u9-0006UW-Uq; Thu, 11 Aug 2022 09:55:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 384358.619710; Thu, 11 Aug 2022 09:55:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oM4u9-0006UP-SK; Thu, 11 Aug 2022 09:55:05 +0000
Received: by outflank-mailman (input) for mailman id 384358;
 Thu, 11 Aug 2022 09:55:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oM4u8-0006UJ-U1
 for xen-changelog@lists.xenproject.org; Thu, 11 Aug 2022 09:55:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oM4u8-0006Y7-Q2
 for xen-changelog@lists.xenproject.org; Thu, 11 Aug 2022 09:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oM4u8-0003NK-OS
 for xen-changelog@lists.xenproject.org; Thu, 11 Aug 2022 09:55:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=2lxsjVBHGOkDQGfzBRzHt7KvLoiMwUu9qU/oL9Xxm2k=; b=vDCE/zTOXpr3HAmIkl65W4VuCy
	z5efSHQ+JTYzCHZCim9BytiLRu5H42IIeC9YUTqNCjEzx9VxFpS2JFbX4OtW6i2zUjzRqPXZ6l92S
	+6ageJWcolghfGmCdbTPXda7FOXDJbOLeLT15gzpcOnrS4hMKNIZcC67UA/vj4qYiFew=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/CPUID: AVX512-FP16 definitions
Message-Id: <E1oM4u8-0003NK-OS@xenbits.xenproject.org>
Date: Thu, 11 Aug 2022 09:55:04 +0000

commit 4735553ec1d8b63aa08772ced1fac96131427f94
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Aug 11 11:45:23 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 11 11:45:23 2022 +0200

    x86/CPUID: AVX512-FP16 definitions
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/libs/light/libxl_cpuid.c              | 1 +
 tools/misc/xen-cpuid.c                      | 1 +
 xen/arch/x86/include/asm/cpufeature.h       | 1 +
 xen/include/public/arch-x86/cpufeatureset.h | 1 +
 xen/tools/gen-cpuid.py                      | 3 ++-
 5 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/tools/libs/light/libxl_cpuid.c b/tools/libs/light/libxl_cpuid.c
index f4735b1c13..d5a9b35774 100644
--- a/tools/libs/light/libxl_cpuid.c
+++ b/tools/libs/light/libxl_cpuid.c
@@ -221,6 +221,7 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
         {"serialize",    0x00000007,  0, CPUID_REG_EDX, 14,  1},
         {"tsxldtrk",     0x00000007,  0, CPUID_REG_EDX, 16,  1},
         {"cet-ibt",      0x00000007,  0, CPUID_REG_EDX, 20,  1},
+        {"avx512-fp16",  0x00000007,  0, CPUID_REG_EDX, 23,  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},
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index 1e6b077ba4..390ac1dafe 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -175,6 +175,7 @@ static const char *const str_7d0[32] =
     [16] = "tsxldtrk",
     [18] = "pconfig",
     [20] = "cet-ibt",
+    /* 22 */                [23] = "avx512-fp16",
 
     [26] = "ibrsb",         [27] = "stibp",
     [28] = "l1d-flush",     [29] = "arch-caps",
diff --git a/xen/arch/x86/include/asm/cpufeature.h b/xen/arch/x86/include/asm/cpufeature.h
index f2c6f255ac..a3ad9ebee4 100644
--- a/xen/arch/x86/include/asm/cpufeature.h
+++ b/xen/arch/x86/include/asm/cpufeature.h
@@ -138,6 +138,7 @@
 #define cpu_has_rtm_always_abort boot_cpu_has(X86_FEATURE_RTM_ALWAYS_ABORT)
 #define cpu_has_tsx_force_abort boot_cpu_has(X86_FEATURE_TSX_FORCE_ABORT)
 #define cpu_has_serialize       boot_cpu_has(X86_FEATURE_SERIALIZE)
+#define cpu_has_avx512_fp16     boot_cpu_has(X86_FEATURE_AVX512_FP16)
 #define cpu_has_arch_caps       boot_cpu_has(X86_FEATURE_ARCH_CAPS)
 
 /* CPUID level 0x00000007:1.eax */
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index c9c4683557..4b8925b7b8 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -282,6 +282,7 @@ XEN_CPUFEATURE(TSX_FORCE_ABORT, 9*32+13) /* MSR_TSX_FORCE_ABORT.RTM_ABORT */
 XEN_CPUFEATURE(SERIALIZE,     9*32+14) /*A  SERIALIZE insn */
 XEN_CPUFEATURE(TSXLDTRK,      9*32+16) /*a  TSX load tracking suspend/resume insns */
 XEN_CPUFEATURE(CET_IBT,       9*32+20) /*   CET - Indirect Branch Tracking */
+XEN_CPUFEATURE(AVX512_FP16,   9*32+23) /*   AVX512 FP16 instructions */
 XEN_CPUFEATURE(IBRSB,         9*32+26) /*A  IBRS and IBPB support (used by Intel) */
 XEN_CPUFEATURE(STIBP,         9*32+27) /*A  STIBP */
 XEN_CPUFEATURE(L1D_FLUSH,     9*32+28) /*S  MSR_FLUSH_CMD and L1D flush. */
diff --git a/xen/tools/gen-cpuid.py b/xen/tools/gen-cpuid.py
index e0e3f2f463..4f7c8d78cc 100755
--- a/xen/tools/gen-cpuid.py
+++ b/xen/tools/gen-cpuid.py
@@ -267,7 +267,8 @@ def crunch_numbers(state):
         # AVX512 extensions acting on vectors of bytes/words are made
         # dependents of AVX512BW (as to requiring wider than 16-bit mask
         # registers), despite the SDM not formally making this connection.
-        AVX512BW: [AVX512_VBMI, AVX512_VBMI2, AVX512_BITALG, AVX512_BF16],
+        AVX512BW: [AVX512_VBMI, AVX512_VBMI2, AVX512_BITALG, AVX512_BF16,
+                   AVX512_FP16],
 
         # Extensions with VEX/EVEX encodings keyed to a separate feature
         # flag are made dependents of their respective legacy feature.
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 11 09:55:16 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 11 Aug 2022 09:55:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.384359.619714 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oM4uK-0006WZ-0R; Thu, 11 Aug 2022 09:55:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 384359.619714; Thu, 11 Aug 2022 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 1oM4uJ-0006WP-Ts; Thu, 11 Aug 2022 09:55:15 +0000
Received: by outflank-mailman (input) for mailman id 384359;
 Thu, 11 Aug 2022 09:55:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oM4uI-0006WH-Tx
 for xen-changelog@lists.xenproject.org; Thu, 11 Aug 2022 09:55:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oM4uI-0006YH-TD
 for xen-changelog@lists.xenproject.org; Thu, 11 Aug 2022 09:55:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oM4uI-0003Np-SF
 for xen-changelog@lists.xenproject.org; Thu, 11 Aug 2022 09:55:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1fBK1GTgn6fT070MZ0MOKEGLptXfAY53BEbuie+ewKQ=; b=GIkKF9/u515dtW/5EEbYYV+qC7
	O62lpqFN86LdVXk5a7tv9TGbRsZwGVcBJh4gLU+AyC+ZmWaugfJECYbH9qM4oXB/O1DQaPa/y1rj3
	+GJXzunKz+S8uE7keHBd+Gjhs0H2L8pe7cnkaHSmVP3BJmhXYRgwf8ybXKEAz67XM6l0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/sched: setup dom0 vCPUs affinity only once
Message-Id: <E1oM4uI-0003Np-SF@xenbits.xenproject.org>
Date: Thu, 11 Aug 2022 09:55:14 +0000

commit c79e4d209be3ed2a6b8e97c35944786ed2a66b94
Author:     Dario Faggioli <dfaggioli@suse.com>
AuthorDate: Thu Aug 11 11:46:22 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 11 11:46:22 2022 +0200

    xen/sched: setup dom0 vCPUs affinity only once
    
    Right now, affinity for dom0 vCPUs is setup in two steps. This is a
    problem as, at least in Credit2, unit_insert() sees and uses the
    "intermediate" affinity, and place the vCPUs on CPUs where they cannot
    be run. And this in turn results in boot hangs, if the "dom0_nodes"
    parameter is used.
    
    Fix this by setting up the affinity properly once and for all, in
    sched_init_vcpu() called by create_vcpu().
    
    Note that, unless a soft-affinity is explicitly specified for dom0 (by
    using the relaxed mode of "dom0_nodes") we set it to the default, which
    is all CPUs, instead of computing it basing on hard affinity (if any).
    This is because hard and soft affinity should be considered as
    independent user controlled properties. In fact, if we dor derive dom0's
    soft-affinity from its boot-time hard-affinity, such computed value will
    continue to be used even if later the user changes the hard-affinity.
    And this could result in the vCPUs behaving differently than what the
    user wanted and expects.
    
    Fixes: dafd936dddbd ("Make credit2 the default scheduler")
    Reported-by: Olaf Hering <ohering@suse.de>
    Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/sched/core.c | 63 ++++++++++++++++++++++++++++++-------------------
 1 file changed, 39 insertions(+), 24 deletions(-)

diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c
index a066c629cb..ff1ddc7624 100644
--- a/xen/common/sched/core.c
+++ b/xen/common/sched/core.c
@@ -571,12 +571,46 @@ int sched_init_vcpu(struct vcpu *v)
         return 1;
     }
 
-    /*
-     * Initialize affinity settings. The idler, and potentially
-     * domain-0 VCPUs, are pinned onto their respective physical CPUs.
-     */
-    if ( is_idle_domain(d) || (d->domain_id == 0 && opt_dom0_vcpus_pin) )
+    if ( is_idle_domain(d) )
+    {
+        /* Idle vCPUs are always pinned onto their respective pCPUs */
+        sched_set_affinity(unit, cpumask_of(processor), &cpumask_all);
+    }
+    else if ( pv_shim && v->vcpu_id == 0 )
+    {
+        /*
+         * PV-shim: vcpus are pinned 1:1. Initially only 1 cpu is online,
+         * others will be dealt with when onlining them. This avoids pinning
+         * a vcpu to a not yet online cpu here.
+         */
+        sched_set_affinity(unit, cpumask_of(0), cpumask_of(0));
+    }
+    else if ( d->domain_id == 0 && opt_dom0_vcpus_pin )
+    {
+        /*
+         * If dom0_vcpus_pin is specified, dom0 vCPUs are pinned 1:1 to
+         * their respective pCPUs too.
+         */
         sched_set_affinity(unit, cpumask_of(processor), &cpumask_all);
+    }
+#ifdef CONFIG_X86
+    else if ( d->domain_id == 0 )
+    {
+        /*
+         * In absence of dom0_vcpus_pin instead, the hard and soft affinity of
+         * dom0 is controlled by the (x86 only) dom0_nodes parameter. At this
+         * point it has been parsed and decoded into the dom0_cpus mask.
+         *
+         * Note that we always honor what user explicitly requested, for both
+         * hard and soft affinity, without doing any dynamic computation of
+         * either of them.
+         */
+        if ( !dom0_affinity_relaxed )
+            sched_set_affinity(unit, &dom0_cpus, &cpumask_all);
+        else
+            sched_set_affinity(unit, &cpumask_all, &dom0_cpus);
+    }
+#endif
     else
         sched_set_affinity(unit, &cpumask_all, &cpumask_all);
 
@@ -3402,29 +3436,10 @@ void wait(void)
 void __init sched_setup_dom0_vcpus(struct domain *d)
 {
     unsigned int i;
-    struct sched_unit *unit;
 
     for ( i = 1; i < d->max_vcpus; i++ )
         vcpu_create(d, i);
 
-    /*
-     * PV-shim: vcpus are pinned 1:1.
-     * Initially only 1 cpu is online, others will be dealt with when
-     * onlining them. This avoids pinning a vcpu to a not yet online cpu here.
-     */
-    if ( pv_shim )
-        sched_set_affinity(d->vcpu[0]->sched_unit,
-                           cpumask_of(0), cpumask_of(0));
-    else
-    {
-        for_each_sched_unit ( d, unit )
-        {
-            if ( !opt_dom0_vcpus_pin && !dom0_affinity_relaxed )
-                sched_set_affinity(unit, &dom0_cpus, NULL);
-            sched_set_affinity(unit, NULL, &dom0_cpus);
-        }
-    }
-
     domain_update_node_affinity(d);
 }
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 11 09:55:26 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 11 Aug 2022 09:55:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.384360.619719 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oM4uU-0006Z2-2K; Thu, 11 Aug 2022 09:55:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 384360.619719; Thu, 11 Aug 2022 09: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 1oM4uT-0006Yv-VL; Thu, 11 Aug 2022 09:55:25 +0000
Received: by outflank-mailman (input) for mailman id 384360;
 Thu, 11 Aug 2022 09:55:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oM4uT-0006Yf-1O
 for xen-changelog@lists.xenproject.org; Thu, 11 Aug 2022 09:55:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oM4uT-0006YY-0g
 for xen-changelog@lists.xenproject.org; Thu, 11 Aug 2022 09:55:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oM4uS-0003OI-VS
 for xen-changelog@lists.xenproject.org; Thu, 11 Aug 2022 09:55:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=l5HaQ3fQSS4WonUsku954BF2dlpO7MGQlgkIfPU6ovs=; b=iJEC8dVzaxnuayvDG4Dfsbryow
	RNm5Zl8n/CRl35QYxfGkc+H8zTjR7ZOC6dYz6zmg9owCP2uzJEpkHKmNL6KoMNnKj6bkSXX+qPDK1
	MjQnHaYAkpsqKXQZEX094yKhV0BHZZfgtJFGEZyfUoHiCok9kHPoqFV+y2yF9GcviZF4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/libxl: Replace deprecated -sdl option on QEMU command line
Message-Id: <E1oM4uS-0003OI-VS@xenbits.xenproject.org>
Date: Thu, 11 Aug 2022 09:55:24 +0000

commit 41fcb3af8ad6d4c9f65a9d72798e6d18afec55ac
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Thu Aug 11 11:47:11 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 11 11:47:11 2022 +0200

    tools/libxl: Replace deprecated -sdl option on QEMU command line
    
    "-sdl" is deprecated upstream since 6695e4c0fd9e ("softmmu/vl:
    Deprecate the -sdl and -curses option"), QEMU v6.2, and the option is
    removed by 707d93d4abc6 ("ui: Remove deprecated options "-sdl" and
    "-curses""), in upcoming QEMU v7.1.
    
    Instead, use "-display sdl", available since 1472a95bab1e ("Introduce
    -display argument"), before QEMU v1.0.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Jason Andryuk <jandryuk@gmail.com>
---
 tools/libs/light/libxl_dm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libs/light/libxl_dm.c b/tools/libs/light/libxl_dm.c
index 1864ee30f0..04bf5d8563 100644
--- a/tools/libs/light/libxl_dm.c
+++ b/tools/libs/light/libxl_dm.c
@@ -1349,7 +1349,7 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
     flexarray_append_pair(dm_args, "-display", "none");
 
     if (sdl && !is_stubdom) {
-        flexarray_append(dm_args, "-sdl");
+        flexarray_append_pair(dm_args, "-display", "sdl");
         if (sdl->display)
             flexarray_append_pair(dm_envs, "DISPLAY", sdl->display);
         if (sdl->xauthority)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 11 09:55:36 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 11 Aug 2022 09:55:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.384361.619724 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oM4ue-0006by-40; Thu, 11 Aug 2022 09:55:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 384361.619724; Thu, 11 Aug 2022 09:55:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oM4ue-0006bp-0o; Thu, 11 Aug 2022 09:55:36 +0000
Received: by outflank-mailman (input) for mailman id 384361;
 Thu, 11 Aug 2022 09:55:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oM4ud-0006bh-4W
 for xen-changelog@lists.xenproject.org; Thu, 11 Aug 2022 09:55:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oM4ud-0006Yi-3x
 for xen-changelog@lists.xenproject.org; Thu, 11 Aug 2022 09:55:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oM4ud-0003Ol-2q
 for xen-changelog@lists.xenproject.org; Thu, 11 Aug 2022 09:55:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=lFqo38IrSTF7NXUfizvbU/Y4QNfpzBGLS5fsvwTKAjI=; b=UPl7jiIb72FKiA5tZXf0r+IDA3
	PUhcFvVaXkc4bXZq0wJciFRliHRypNyEgdSkqmkO8ls8r/C4WMjKvWvLBuOPy4zmireLMcAn7vHv/
	AKuAmcpGnhbnZ8+6/33q/Tku5ewn3TckwbcRjS3lAUeJdZP4PgpAd51Sv1FlE2iKrGXg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] arm/vgic: fix coding style in macro REG_RANK_INDEX()
Message-Id: <E1oM4ud-0003Ol-2q@xenbits.xenproject.org>
Date: Thu, 11 Aug 2022 09:55:35 +0000

commit fc9e089ad2d4739336c7b2553a325c9b6c02c40d
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Thu Aug 11 11:47:34 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 11 11:47:34 2022 +0200

    arm/vgic: fix coding style in macro REG_RANK_INDEX()
    
    Add parentheses around the macro parameter 's' to prevent against unintended
    expansions. This, also, resolves a MISRA C 2012 Rule 20.7 violation warning.
    
    Add white spaces around the subtraction operator.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/arch/arm/include/asm/vgic.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/include/asm/vgic.h b/xen/arch/arm/include/asm/vgic.h
index d2a9fc7d83..3d44868039 100644
--- a/xen/arch/arm/include/asm/vgic.h
+++ b/xen/arch/arm/include/asm/vgic.h
@@ -286,7 +286,7 @@ static inline paddr_t vgic_dist_base(const struct vgic_dist *vgic)
  * Offset of GICD_<FOO><n> with its rank, for GICD_<FOO> size <s> with
  * <b>-bits-per-interrupt.
  */
-#define REG_RANK_INDEX(b, n, s) ((((n) >> s) & ((b)-1)) % 32)
+#define REG_RANK_INDEX(b, n, s) ((((n) >> (s)) & ((b) - 1)) % 32)
 
 
 extern struct vcpu *vgic_get_target_vcpu(struct vcpu *v, unsigned int virq);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 11 09:55:46 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 11 Aug 2022 09:55:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.384364.619726 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oM4uo-0006eg-51; Thu, 11 Aug 2022 09:55:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 384364.619726; Thu, 11 Aug 2022 09: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 1oM4uo-0006eY-2E; Thu, 11 Aug 2022 09:55:46 +0000
Received: by outflank-mailman (input) for mailman id 384364;
 Thu, 11 Aug 2022 09:55:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oM4un-0006eS-7b
 for xen-changelog@lists.xenproject.org; Thu, 11 Aug 2022 09:55:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oM4un-0006Z8-6u
 for xen-changelog@lists.xenproject.org; Thu, 11 Aug 2022 09:55:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oM4un-0003PN-61
 for xen-changelog@lists.xenproject.org; Thu, 11 Aug 2022 09:55:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8kAJkFVedNlH9Ci7ra4TaK2SJDBw3Z1cxyUBgQddU4M=; b=unKFisn/d/MCbtGStfNcdnoEln
	K6bP69El/FeMg+J+3ERal3Heag5uLaPNo6oxc+pR5hAEitFd/ogcRNlEs0d2/+hb1dHTZ2jyU5NFz
	P4soO7OOwvCr1w0OM2724eBaQtyP9wH5rJjWDxm0MjnXiY2PQUK3ZbJKc0C6X0mSzXFw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] arm/gic: fix MISRA C 2012 Rule 20.7 violation
Message-Id: <E1oM4un-0003PN-61@xenbits.xenproject.org>
Date: Thu, 11 Aug 2022 09:55:45 +0000

commit 4a2217c97024ccaf92adb6a08f4d340a803af352
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Thu Aug 11 11:48:12 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 11 11:48:12 2022 +0200

    arm/gic: fix MISRA C 2012 Rule 20.7 violation
    
    In GIC_PRI_TO_GUEST(), add parentheses around the macro parameter 'pri' to
    prevent against unintended expansions and realign comment.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/include/asm/gic.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/include/asm/gic.h b/xen/arch/arm/include/asm/gic.h
index b3c6c67933..3692fae393 100644
--- a/xen/arch/arm/include/asm/gic.h
+++ b/xen/arch/arm/include/asm/gic.h
@@ -152,8 +152,8 @@
 #define GIC_PRI_IPI_ALL    ((GIC_PRI_IPI << 24) | (GIC_PRI_IPI << 16) |\
                             (GIC_PRI_IPI << 8) | GIC_PRI_IPI)
 
-#define GIC_PRI_TO_GUEST(pri) (pri >> 3) /* GICH_LR and GICH_VMCR only support
-                                            5 bits for guest irq priority */
+#define GIC_PRI_TO_GUEST(pri) ((pri) >> 3) /* GICH_LR and GICH_VMCR only support
+                                              5 bits for guest irq priority */
 
 #define GICH_LR_PENDING         1
 #define GICH_LR_ACTIVE          2
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 11 12:22:07 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 11 Aug 2022 12:22:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.384558.619956 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oM7CN-0006xX-A8; Thu, 11 Aug 2022 12:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 384558.619956; Thu, 11 Aug 2022 12:22:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oM7CN-0006xP-7F; Thu, 11 Aug 2022 12:22:03 +0000
Received: by outflank-mailman (input) for mailman id 384558;
 Thu, 11 Aug 2022 12:22:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oM7CL-0006xH-PP
 for xen-changelog@lists.xenproject.org; Thu, 11 Aug 2022 12:22:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oM7CL-0000gs-Od
 for xen-changelog@lists.xenproject.org; Thu, 11 Aug 2022 12:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oM7CL-0003Wq-MN
 for xen-changelog@lists.xenproject.org; Thu, 11 Aug 2022 12:22:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xci17Edsm3Zh/ytTHujd5J5rALIdIAQgro0Fi00VtpA=; b=Lxxzp31sizmlldno9i4MCRIvMc
	fF6gjZRqov+6kGwoVzVQSf1j0pDkLm/ChsWFjlT+epQeKsh2NUEfybr8vnqgYHRzEBw5mlwpWBSpc
	hMEf6K5yPuJDAvL9FK7trqx+IHrvIzD7UOywSByiSLVCyDJWyhrBinz+1IwPeEcgDNLI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: regs: Fix MISRA C 2012 Rule 20.7 violation
Message-Id: <E1oM7CL-0003Wq-MN@xenbits.xenproject.org>
Date: Thu, 11 Aug 2022 12:22:01 +0000

commit ea2353a7fbdabeb5f698ac53579dec1c8ea9f77a
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Mon Aug 8 12:48:37 2022 +0300
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Aug 9 14:47:47 2022 -0700

    xen/arm: regs: Fix MISRA C 2012 Rule 20.7 violation
    
    In macro psr_mode(), the macro parameter 'm' is used as expression and
    therefore it is good to be enclosed in parentheses to prevent against
    unintended expansions.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Reviewed-by: Rahul Singh <rahul.singh@arm.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/include/asm/regs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/include/asm/regs.h b/xen/arch/arm/include/asm/regs.h
index 794721a103..0693a68131 100644
--- a/xen/arch/arm/include/asm/regs.h
+++ b/xen/arch/arm/include/asm/regs.h
@@ -11,7 +11,7 @@
 #include <asm/current.h>
 #include <asm/processor.h>
 
-#define psr_mode(psr,m) (((psr) & PSR_MODE_MASK) == m)
+#define psr_mode(psr,m) (((psr) & PSR_MODE_MASK) == (m))
 
 static inline bool regs_mode_is_32bit(const struct cpu_user_regs *regs)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 11 12:22:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 11 Aug 2022 12:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.384559.619959 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oM7CX-000705-BI; Thu, 11 Aug 2022 12:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 384559.619959; Thu, 11 Aug 2022 12:22:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oM7CX-0006zv-8o; Thu, 11 Aug 2022 12:22:13 +0000
Received: by outflank-mailman (input) for mailman id 384559;
 Thu, 11 Aug 2022 12:22:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oM7CV-0006zn-Sb
 for xen-changelog@lists.xenproject.org; Thu, 11 Aug 2022 12:22:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oM7CV-0000h1-Rg
 for xen-changelog@lists.xenproject.org; Thu, 11 Aug 2022 12:22:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oM7CV-0003XG-Qh
 for xen-changelog@lists.xenproject.org; Thu, 11 Aug 2022 12:22:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Gp5MNErz11LgfHU6D6EVq78+cgFx97UQVO1vW7R6X7o=; b=D6kluJ41QypPbgQV960eTL73Ql
	YFBHqaaNbpEpA/WqfpiVOUHaWH2TMtjE67p+LgY7UIdwoRhG6slFGhGOVLLZJAiV7dhw43gKSJhJ6
	EnaTBoBpncXCi9nQhqK0ARdxrel4ZKe3KttxHHiOZR2VtgygLnIb7y2ou45+ZvVhHDHw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: vreg: Fix MISRA C 2012 Rule 20.7 violation
Message-Id: <E1oM7CV-0003XG-Qh@xenbits.xenproject.org>
Date: Thu, 11 Aug 2022 12:22:11 +0000

commit d7c3c845c44e097d6c980001e108da0bb84ed16f
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Tue Aug 9 12:30:48 2022 +0300
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Aug 10 13:35:31 2022 -0700

    xen/arm: vreg: Fix MISRA C 2012 Rule 20.7 violation
    
    In VREG_REG_HELPERS(), the macro parameter 'offmask' is used as expression and
    therefore it is good to be enclosed in parentheses to prevent against
    unintended expansions.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/include/asm/vreg.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/include/asm/vreg.h b/xen/arch/arm/include/asm/vreg.h
index fa2f4cdb17..f26a70d024 100644
--- a/xen/arch/arm/include/asm/vreg.h
+++ b/xen/arch/arm/include/asm/vreg.h
@@ -141,7 +141,7 @@ static inline void vreg_reg_clearbits(unsigned long *reg, register_t bits,
 static inline register_t vreg_reg##sz##_extract(uint##sz##_t reg,       \
                                                 const mmio_info_t *info)\
 {                                                                       \
-    return vreg_reg_extract(reg, info->gpa & offmask,                   \
+    return vreg_reg_extract(reg, info->gpa & (offmask),                 \
                             info->dabt.size);                           \
 }                                                                       \
                                                                         \
@@ -151,7 +151,7 @@ static inline void vreg_reg##sz##_update(uint##sz##_t *reg,             \
 {                                                                       \
     unsigned long tmp = *reg;                                           \
                                                                         \
-    vreg_reg_update(&tmp, val, info->gpa & offmask,                     \
+    vreg_reg_update(&tmp, val, info->gpa & (offmask),                   \
                     info->dabt.size);                                   \
                                                                         \
     *reg = tmp;                                                         \
@@ -163,7 +163,7 @@ static inline void vreg_reg##sz##_setbits(uint##sz##_t *reg,            \
 {                                                                       \
     unsigned long tmp = *reg;                                           \
                                                                         \
-    vreg_reg_setbits(&tmp, bits, info->gpa & offmask,                   \
+    vreg_reg_setbits(&tmp, bits, info->gpa & (offmask),                 \
                      info->dabt.size);                                  \
                                                                         \
     *reg = tmp;                                                         \
@@ -175,7 +175,7 @@ static inline void vreg_reg##sz##_clearbits(uint##sz##_t *reg,          \
 {                                                                       \
     unsigned long tmp = *reg;                                           \
                                                                         \
-    vreg_reg_clearbits(&tmp, bits, info->gpa & offmask,                 \
+    vreg_reg_clearbits(&tmp, bits, info->gpa & (offmask),               \
                        info->dabt.size);                                \
                                                                         \
     *reg = tmp;                                                         \
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 11 15:33:11 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 11 Aug 2022 15:33:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.384705.620135 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oMABF-0008Bp-AI; Thu, 11 Aug 2022 15:33:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 384705.620135; Thu, 11 Aug 2022 15:33:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oMABF-0008Bh-7M; Thu, 11 Aug 2022 15:33:05 +0000
Received: by outflank-mailman (input) for mailman id 384705;
 Thu, 11 Aug 2022 15:33:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMABE-0008Ap-91
 for xen-changelog@lists.xenproject.org; Thu, 11 Aug 2022 15:33:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMABE-00041v-5l
 for xen-changelog@lists.xenproject.org; Thu, 11 Aug 2022 15:33:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMABE-0004fM-2r
 for xen-changelog@lists.xenproject.org; Thu, 11 Aug 2022 15:33:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=gzagEcTssT0huSgnb6lFmjV7VFNZsJyT5W+u6LUc5h8=; b=MbD4uKMZU6HawrtFn7HCoyp3zp
	Eq0ksMssYDmNfUw5Wey9pjz6WRk+/JRLJBv2I7V9ifAiJCYPRadW/Z5YbvldecP7i+7URZSbyoBkb
	9JRXuXxhT6LROnH+QmXZusB2wh/uCcJ+LfRoINYU1/bvovfh1zMVrK8n9wAbG84dexXU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/spec-ctrl: Enumeration for PBRSB_NO
Message-Id: <E1oMABE-0004fM-2r@xenbits.xenproject.org>
Date: Thu, 11 Aug 2022 15:33:04 +0000

commit b874e47eb13feb75be3ee7b5dc4ae9c97d80d774
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jul 29 14:22:53 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Aug 11 16:19:50 2022 +0100

    x86/spec-ctrl: Enumeration for PBRSB_NO
    
    The PBRSB_NO bit indicates that the CPU is not vulnerable to the Post-Barrier
    RSB speculative vulnerability.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/msr-index.h | 1 +
 xen/arch/x86/msr.c                   | 5 +++--
 xen/arch/x86/spec_ctrl.c             | 3 ++-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/include/asm/msr-index.h b/xen/arch/x86/include/asm/msr-index.h
index 1a928ea6af..0a8852f3c2 100644
--- a/xen/arch/x86/include/asm/msr-index.h
+++ b/xen/arch/x86/include/asm/msr-index.h
@@ -84,6 +84,7 @@
 #define  ARCH_CAPS_FB_CLEAR_CTRL            (_AC(1, ULL) << 18)
 #define  ARCH_CAPS_RRSBA                    (_AC(1, ULL) << 19)
 #define  ARCH_CAPS_BHI_NO                   (_AC(1, ULL) << 20)
+#define  ARCH_CAPS_PBRSB_NO                 (_AC(1, ULL) << 24)
 
 #define MSR_FLUSH_CMD                       0x0000010b
 #define  FLUSH_CMD_L1D                      (_AC(1, ULL) <<  0)
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 170f041793..d2e2dc2a6b 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -74,7 +74,8 @@ static void __init calculate_host_policy(void)
          ARCH_CAPS_SKIP_L1DFL | ARCH_CAPS_SSB_NO | ARCH_CAPS_MDS_NO |
          ARCH_CAPS_IF_PSCHANGE_MC_NO | ARCH_CAPS_TSX_CTRL | ARCH_CAPS_TAA_NO |
          ARCH_CAPS_SBDR_SSDP_NO | ARCH_CAPS_FBSDP_NO | ARCH_CAPS_PSDP_NO |
-         ARCH_CAPS_FB_CLEAR | ARCH_CAPS_RRSBA | ARCH_CAPS_BHI_NO);
+         ARCH_CAPS_FB_CLEAR | ARCH_CAPS_RRSBA | ARCH_CAPS_BHI_NO |
+         ARCH_CAPS_PBRSB_NO);
 }
 
 static void __init calculate_pv_max_policy(void)
@@ -166,7 +167,7 @@ int init_domain_msr_policy(struct domain *d)
              ARCH_CAPS_SSB_NO | ARCH_CAPS_MDS_NO | ARCH_CAPS_IF_PSCHANGE_MC_NO |
              ARCH_CAPS_TAA_NO | ARCH_CAPS_SBDR_SSDP_NO | ARCH_CAPS_FBSDP_NO |
              ARCH_CAPS_PSDP_NO | ARCH_CAPS_FB_CLEAR | ARCH_CAPS_RRSBA |
-             ARCH_CAPS_BHI_NO);
+             ARCH_CAPS_BHI_NO | ARCH_CAPS_PBRSB_NO);
     }
 
     d->arch.msr = mp;
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index d2cd545973..160cc68086 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -419,7 +419,7 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
      * Hardware read-only information, stating immunity to certain issues, or
      * suggestions of which mitigation to use.
      */
-    printk("  Hardware hints:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
+    printk("  Hardware hints:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
            (caps & ARCH_CAPS_RDCL_NO)                        ? " RDCL_NO"        : "",
            (caps & ARCH_CAPS_IBRS_ALL)                       ? " IBRS_ALL"       : "",
            (caps & ARCH_CAPS_RSBA)                           ? " RSBA"           : "",
@@ -431,6 +431,7 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
            (caps & ARCH_CAPS_SBDR_SSDP_NO)                   ? " SBDR_SSDP_NO"   : "",
            (caps & ARCH_CAPS_FBSDP_NO)                       ? " FBSDP_NO"       : "",
            (caps & ARCH_CAPS_PSDP_NO)                        ? " PSDP_NO"        : "",
+           (caps & ARCH_CAPS_PBRSB_NO)                       ? " PBRSB_NO"       : "",
            (e8b  & cpufeat_mask(X86_FEATURE_IBRS_ALWAYS))    ? " IBRS_ALWAYS"    : "",
            (e8b  & cpufeat_mask(X86_FEATURE_STIBP_ALWAYS))   ? " STIBP_ALWAYS"   : "",
            (e8b  & cpufeat_mask(X86_FEATURE_IBRS_FAST))      ? " IBRS_FAST"      : "",
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 11 15:55:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 11 Aug 2022 15:55:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.384743.620183 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oMAWX-000421-R3; Thu, 11 Aug 2022 15:55:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 384743.620183; Thu, 11 Aug 2022 15:55:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oMAWX-00041t-OM; Thu, 11 Aug 2022 15:55:05 +0000
Received: by outflank-mailman (input) for mailman id 384743;
 Thu, 11 Aug 2022 15:55:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMAWW-00041n-VB
 for xen-changelog@lists.xenproject.org; Thu, 11 Aug 2022 15:55:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMAWW-0004Wv-TW
 for xen-changelog@lists.xenproject.org; Thu, 11 Aug 2022 15:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMAWW-0005od-Rz
 for xen-changelog@lists.xenproject.org; Thu, 11 Aug 2022 15:55:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nes3EFMO/pctgn0S5fRbDrhDxOApX1d/EVllL/7Qfxw=; b=FojwbeGSwm86i27uNJFxWjz1y2
	Yjfi+z7YxfuwwhsMcfGh0mCQP+fdmfU+x7L9vsxPBIgwN6bFHP6GjqKPCbgrkemq7lei+sqUT1rQ7
	DFJzxkWK4BU1EdItjRD/94bUPVCzQ0TC7pa5hV7kS6TonbRXvr5JECOzgzDDRB0LpzVE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/amd: only call setup_force_cpu_cap for boot CPU
Message-Id: <E1oMAWW-0005od-Rz@xenbits.xenproject.org>
Date: Thu, 11 Aug 2022 15:55:04 +0000

commit 31b41ce858c8bd5159212d40969f8e0b7124bbf0
Author:     Ross Lagerwall <ross.lagerwall@citrix.com>
AuthorDate: Thu Aug 11 17:44:26 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 11 17:44:26 2022 +0200

    x86/amd: only call setup_force_cpu_cap for boot CPU
    
    This should only be called for the boot CPU to avoid calling _init code
    after it has been unloaded.
    
    Fixes: 062868a5a8b4 ("x86/amd: Work around CLFLUSH ordering on older parts")
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/amd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/cpu/amd.c b/xen/arch/x86/cpu/amd.c
index 29c59bcba4..d5f8e5e899 100644
--- a/xen/arch/x86/cpu/amd.c
+++ b/xen/arch/x86/cpu/amd.c
@@ -845,7 +845,7 @@ static void cf_check init_amd(struct cpuinfo_x86 *c)
 	 * everything, including reads and writes to address, and
 	 * LFENCE/SFENCE instructions.
 	 */
-	if (!cpu_has_clflushopt)
+	if (c == &boot_cpu_data && !cpu_has_clflushopt)
 		setup_force_cpu_cap(X86_BUG_CLFLUSH_MFENCE);
 
 	switch(c->x86)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 11 15:55:15 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 11 Aug 2022 15:55:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.384744.620187 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oMAWh-00044I-SN; Thu, 11 Aug 2022 15:55:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 384744.620187; Thu, 11 Aug 2022 15: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 1oMAWh-00044A-Pn; Thu, 11 Aug 2022 15:55:15 +0000
Received: by outflank-mailman (input) for mailman id 384744;
 Thu, 11 Aug 2022 15:55:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMAWh-000444-2j
 for xen-changelog@lists.xenproject.org; Thu, 11 Aug 2022 15:55:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMAWh-0004XC-1Z
 for xen-changelog@lists.xenproject.org; Thu, 11 Aug 2022 15:55:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMAWg-0005pA-VY
 for xen-changelog@lists.xenproject.org; Thu, 11 Aug 2022 15:55:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hskYOapS9rLchnOOhrRfVaFOzPj1yhMJgFtAk6VTJ48=; b=Vs7yX7O4Fy1y+L6N8MDbYhyFaq
	gPO62WgEVb8ZaryN4mYc5L5Ezlt5hMI9A3oPxuT6iX8K/U7K1ZlNellMfEuXvTZa+BpHMCU0eqX0O
	XR109MjvgoEO2gUssigdv1GpdCI8xWrwwzBr16senR6jqj3XpcODt9MR1CKoh4IuxHZs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] build/x86: suppress GNU ld 2.39 warning about RWX load segments
Message-Id: <E1oMAWg-0005pA-VY@xenbits.xenproject.org>
Date: Thu, 11 Aug 2022 15:55:14 +0000

commit 3eb1865ae305772b558757904d81951e31de43de
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Aug 11 17:45:12 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 11 17:45:12 2022 +0200

    build/x86: suppress GNU ld 2.39 warning about RWX load segments
    
    Commit 68f5aac012b9 ("build: suppress future GNU ld warning about RWX
    load segments") didn't quite cover all the cases: Apparently I missed
    ones in the building of 32-bit helper objects because of only looking at
    incremental builds (where those wouldn't normally be re-built). Clone
    the workaround there to the specific Makefile in question.
    
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/boot/Makefile | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xen/arch/x86/boot/Makefile b/xen/arch/x86/boot/Makefile
index a5dd094836..1fb0ca02e8 100644
--- a/xen/arch/x86/boot/Makefile
+++ b/xen/arch/x86/boot/Makefile
@@ -24,6 +24,9 @@ CFLAGS_x86_32 += -I$(srctree)/include
 $(head-srcs:.S=.o): CFLAGS_stack_boundary :=
 $(head-srcs:.S=.o): XEN_CFLAGS := $(CFLAGS_x86_32) -fpic
 
+LDFLAGS_DIRECT-$(call ld-option,--warn-rwx-segments) := --no-warn-rwx-segments
+LDFLAGS_DIRECT += $(LDFLAGS_DIRECT-y)
+
 $(head-srcs): %.S: %.bin
 	(od -v -t x $< | tr -s ' ' | awk 'NR > 1 {print s} {s=$$0}' | \
 	sed 's/ /,0x/g' | sed 's/,0x$$//' | sed 's/^[0-9]*,/ .long /') >$@
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 12 06:44:09 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 12 Aug 2022 06:44:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.385295.620883 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oMOOr-0008IV-B6; Fri, 12 Aug 2022 06:44:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 385295.620883; Fri, 12 Aug 2022 06:44:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oMOOr-0008IN-7A; Fri, 12 Aug 2022 06:44:05 +0000
Received: by outflank-mailman (input) for mailman id 385295;
 Fri, 12 Aug 2022 06:44:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMOOq-0008IH-7h
 for xen-changelog@lists.xenproject.org; Fri, 12 Aug 2022 06:44:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMOOq-0003Vt-6w
 for xen-changelog@lists.xenproject.org; Fri, 12 Aug 2022 06:44:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMOOq-0004vw-5X
 for xen-changelog@lists.xenproject.org; Fri, 12 Aug 2022 06:44:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=qRM/O7D/6MJ8n1gktzIKG56xOzrgcMJYoqSrxDXo7P8=; b=RMMDKTRx9r9l2vPsWhiVU/834L
	V4WSLLq+XCG8+RhHaMXd5EH01WOlOmjFZksr4qbr3lrcOJzDayUx6pNyAO91JsALwb+VIRdSNegm4
	yK5nnDauHFdIs3FZX49c6KVHXa/ATvMKARx5o+lOCQT704+TlYoFCIaZafvpg6TSIlqc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] PCI: simplify (and thus correct) pci_get_pdev{,_by_domain}()
Message-Id: <E1oMOOq-0004vw-5X@xenbits.xenproject.org>
Date: Fri, 12 Aug 2022 06:44:04 +0000

commit 8cf6e0738906fc269af40135ed82a07815dd3b9c
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Aug 12 08:34:33 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Aug 12 08:34:33 2022 +0200

    PCI: simplify (and thus correct) pci_get_pdev{,_by_domain}()
    
    The last "wildcard" use of either function went away with f591755823a7
    ("IOMMU/PCI: don't let domain cleanup continue when device de-assignment
    failed"). Don't allow them to be called this way anymore. Besides
    simplifying the code this also fixes two bugs:
    
    1) When seg != -1, the outer loops should have been terminated after the
       first iteration, or else a device with the same BDF but on another
       segment could be found / returned.
    
    Reported-by: Rahul Singh <rahul.singh@arm.com>
    
    2) When seg == -1 calling get_pseg() is bogus. The function (taking a
       u16) would look for segment 0xffff, which might exist. If it exists,
       we might then find / return a wrong device.
    
    In pci_get_pdev_by_domain() also switch from using the per-segment list
    to using the per-domain one, with the exception of the hardware domain
    (see the code comment there).
    
    While there also constify "pseg" and drop "pdev"'s already previously
    unnecessary initializer.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Rahul Singh <rahul.singh@arm.com>
    Tested-by: Rahul Singh <rahul.singh@arm.com>
---
 xen/drivers/passthrough/pci.c | 61 ++++++++++++++++++-------------------------
 xen/include/xen/pci.h         |  6 ++---
 2 files changed, 29 insertions(+), 38 deletions(-)

diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index 938821e593..085cd82941 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -576,30 +576,19 @@ int __init pci_ro_device(int seg, int bus, int devfn)
     return 0;
 }
 
-struct pci_dev *pci_get_pdev(int seg, int bus, int devfn)
+struct pci_dev *pci_get_pdev(uint16_t seg, uint8_t bus, uint8_t devfn)
 {
-    struct pci_seg *pseg = get_pseg(seg);
-    struct pci_dev *pdev = NULL;
+    const struct pci_seg *pseg = get_pseg(seg);
+    struct pci_dev *pdev;
 
     ASSERT(pcidevs_locked());
-    ASSERT(seg != -1 || bus == -1);
-    ASSERT(bus != -1 || devfn == -1);
 
     if ( !pseg )
-    {
-        if ( seg == -1 )
-            radix_tree_gang_lookup(&pci_segments, (void **)&pseg, 0, 1);
-        if ( !pseg )
-            return NULL;
-    }
+        return NULL;
 
-    do {
-        list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
-            if ( (pdev->bus == bus || bus == -1) &&
-                 (pdev->devfn == devfn || devfn == -1) )
-                return pdev;
-    } while ( radix_tree_gang_lookup(&pci_segments, (void **)&pseg,
-                                     pseg->nr + 1, 1) );
+    list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
+        if ( pdev->bus == bus && pdev->devfn == devfn )
+            return pdev;
 
     return NULL;
 }
@@ -625,31 +614,33 @@ struct pci_dev *pci_get_real_pdev(int seg, int bus, int devfn)
     return pdev;
 }
 
-struct pci_dev *pci_get_pdev_by_domain(const struct domain *d, int seg,
-                                       int bus, int devfn)
+struct pci_dev *pci_get_pdev_by_domain(const struct domain *d, uint16_t seg,
+                                       uint8_t bus, uint8_t devfn)
 {
-    struct pci_seg *pseg = get_pseg(seg);
-    struct pci_dev *pdev = NULL;
-
-    ASSERT(seg != -1 || bus == -1);
-    ASSERT(bus != -1 || devfn == -1);
+    struct pci_dev *pdev;
 
-    if ( !pseg )
+    /*
+     * The hardware domain owns the majority of the devices in the system.
+     * When there are multiple segments, traversing the per-segment list is
+     * likely going to be faster, whereas for a single segment the difference
+     * shouldn't be that large.
+     */
+    if ( is_hardware_domain(d) )
     {
-        if ( seg == -1 )
-            radix_tree_gang_lookup(&pci_segments, (void **)&pseg, 0, 1);
+        const struct pci_seg *pseg = get_pseg(seg);
+
         if ( !pseg )
             return NULL;
-    }
 
-    do {
         list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
-            if ( (pdev->bus == bus || bus == -1) &&
-                 (pdev->devfn == devfn || devfn == -1) &&
-                 (pdev->domain == d) )
+            if ( pdev->bus == bus && pdev->devfn == devfn &&
+                 pdev->domain == d )
+                return pdev;
+    }
+    else
+        list_for_each_entry ( pdev, &d->pdev_list, domain_list )
+            if ( pdev->bus == bus && pdev->devfn == devfn )
                 return pdev;
-    } while ( radix_tree_gang_lookup(&pci_segments, (void **)&pseg,
-                                     pseg->nr + 1, 1) );
 
     return NULL;
 }
diff --git a/xen/include/xen/pci.h b/xen/include/xen/pci.h
index f34368643c..0eaa5f3938 100644
--- a/xen/include/xen/pci.h
+++ b/xen/include/xen/pci.h
@@ -177,10 +177,10 @@ int pci_add_device(u16 seg, u8 bus, u8 devfn,
 int pci_remove_device(u16 seg, u8 bus, u8 devfn);
 int pci_ro_device(int seg, int bus, int devfn);
 int pci_hide_device(unsigned int seg, unsigned int bus, unsigned int devfn);
-struct pci_dev *pci_get_pdev(int seg, int bus, int devfn);
+struct pci_dev *pci_get_pdev(uint16_t seg, uint8_t bus, uint8_t devfn);
 struct pci_dev *pci_get_real_pdev(int seg, int bus, int devfn);
-struct pci_dev *pci_get_pdev_by_domain(const struct domain *, int seg,
-                                       int bus, int devfn);
+struct pci_dev *pci_get_pdev_by_domain(const struct domain *, uint16_t seg,
+                                       uint8_t bus, uint8_t devfn);
 void pci_check_disable_device(u16 seg, u8 bus, u8 devfn);
 
 uint8_t pci_conf_read8(pci_sbdf_t sbdf, unsigned int reg);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 12 06:44:15 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 12 Aug 2022 06:44:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.385296.620887 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oMOP1-0008Kh-Cg; Fri, 12 Aug 2022 06:44:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 385296.620887; Fri, 12 Aug 2022 06:44:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oMOP1-0008KY-8r; Fri, 12 Aug 2022 06:44:15 +0000
Received: by outflank-mailman (input) for mailman id 385296;
 Fri, 12 Aug 2022 06:44:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMOP0-0008KS-B6
 for xen-changelog@lists.xenproject.org; Fri, 12 Aug 2022 06:44:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMOP0-0003W1-AO
 for xen-changelog@lists.xenproject.org; Fri, 12 Aug 2022 06:44:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMOP0-0004wk-9W
 for xen-changelog@lists.xenproject.org; Fri, 12 Aug 2022 06:44:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=r5Smj3EfJ36AzN/a8WJgrgU6oUjJAZuslUd0Qxcx68E=; b=DewZ9BzQzME2FGyD0pyPs/gJkr
	VUlsHRHWlE2PB6iPnH+2XjhxMIZVcFzpx5S0FtS+jC08Zcl0ox8xS3DSyDlb4E2gUCB+8AWBBczph
	6hJGTuUHF7a7cakS4M6otRL0k3IKXx9w95Nk6n4MSbRoO3nQv3JxGZnymJgh/Ti8ICRA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] PCI: fold pci_get_pdev{,_by_domain}()
Message-Id: <E1oMOP0-0004wk-9W@xenbits.xenproject.org>
Date: Fri, 12 Aug 2022 06:44:14 +0000

commit a37f9ea7a651fd798397a3db6dbf7939feeb43a8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Aug 12 08:37:09 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Aug 12 08:37:09 2022 +0200

    PCI: fold pci_get_pdev{,_by_domain}()
    
    Rename the latter, subsuming the functionality of the former when passed
    NULL as first argument.
    
    Since this requires touching all call sites anyway, take the opportunity
    and fold the remaining three parameters into a single pci_sbdf_t one.
    
    No functional change intended. In particular the locking related
    assertion needs to continue to be kept silent when a non-NULL domain
    pointer is passed - both vpci_read() and vpci_write() call the function
    without holding the lock (adding respective locking to vPCI [or finding
    an alternative to doing so] is the topic of a separate series).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Rahul Singh <rahul.singh@arm.com>
    Tested-by: Rahul Singh <rahul.singh@arm.com>
---
 xen/arch/x86/irq.c                       |  2 +-
 xen/arch/x86/msi.c                       |  9 +++---
 xen/arch/x86/pci.c                       |  2 +-
 xen/arch/x86/physdev.c                   |  5 ++--
 xen/common/sysctl.c                      |  2 +-
 xen/drivers/passthrough/amd/iommu_init.c |  5 ++--
 xen/drivers/passthrough/amd/iommu_map.c  |  2 +-
 xen/drivers/passthrough/pci.c            | 49 ++++++++++++--------------------
 xen/drivers/passthrough/vtd/quirks.c     |  2 +-
 xen/drivers/video/vga.c                  |  2 +-
 xen/drivers/vpci/vpci.c                  |  4 +--
 xen/include/xen/pci.h                    |  4 +--
 12 files changed, 37 insertions(+), 51 deletions(-)

diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c
index fea901bfb1..bf8b52d111 100644
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -2162,7 +2162,7 @@ int map_domain_pirq(
         if ( !cpu_has_apic )
             goto done;
 
-        pdev = pci_get_pdev_by_domain(d, msi->seg, msi->bus, msi->devfn);
+        pdev = pci_get_pdev(d, PCI_SBDF(msi->seg, msi->bus, msi->devfn));
         if ( !pdev )
             goto done;
 
diff --git a/xen/arch/x86/msi.c b/xen/arch/x86/msi.c
index 6be81e6c3b..62c4fbcfbe 100644
--- a/xen/arch/x86/msi.c
+++ b/xen/arch/x86/msi.c
@@ -683,7 +683,8 @@ static u64 read_pci_mem_bar(u16 seg, u8 bus, u8 slot, u8 func, u8 bir, int vf)
 
     if ( vf >= 0 )
     {
-        struct pci_dev *pdev = pci_get_pdev(seg, bus, PCI_DEVFN(slot, func));
+        struct pci_dev *pdev = pci_get_pdev(NULL,
+                                            PCI_SBDF(seg, bus, slot, func));
         unsigned int pos = pci_find_ext_capability(seg, bus,
                                                    PCI_DEVFN(slot, func),
                                                    PCI_EXT_CAP_ID_SRIOV);
@@ -1000,7 +1001,7 @@ static int __pci_enable_msi(struct msi_info *msi, struct msi_desc **desc)
     struct msi_desc *old_desc;
 
     ASSERT(pcidevs_locked());
-    pdev = pci_get_pdev(msi->seg, msi->bus, msi->devfn);
+    pdev = pci_get_pdev(NULL, PCI_SBDF(msi->seg, msi->bus, msi->devfn));
     if ( !pdev )
         return -ENODEV;
 
@@ -1055,7 +1056,7 @@ static int __pci_enable_msix(struct msi_info *msi, struct msi_desc **desc)
     struct msi_desc *old_desc;
 
     ASSERT(pcidevs_locked());
-    pdev = pci_get_pdev(msi->seg, msi->bus, msi->devfn);
+    pdev = pci_get_pdev(NULL, PCI_SBDF(msi->seg, msi->bus, msi->devfn));
     if ( !pdev || !pdev->msix )
         return -ENODEV;
 
@@ -1146,7 +1147,7 @@ int pci_prepare_msix(u16 seg, u8 bus, u8 devfn, bool off)
         return 0;
 
     pcidevs_lock();
-    pdev = pci_get_pdev(seg, bus, devfn);
+    pdev = pci_get_pdev(NULL, PCI_SBDF(seg, bus, devfn));
     if ( !pdev )
         rc = -ENODEV;
     else if ( pdev->msix->used_entries != !!off )
diff --git a/xen/arch/x86/pci.c b/xen/arch/x86/pci.c
index 9a2354e887..97b792e578 100644
--- a/xen/arch/x86/pci.c
+++ b/xen/arch/x86/pci.c
@@ -90,7 +90,7 @@ int pci_conf_write_intercept(unsigned int seg, unsigned int bdf,
 
     pcidevs_lock();
 
-    pdev = pci_get_pdev(seg, PCI_BUS(bdf), PCI_DEVFN(bdf));
+    pdev = pci_get_pdev(NULL, PCI_SBDF(seg, bdf));
     if ( pdev )
         rc = pci_msi_conf_write_intercept(pdev, reg, size, data);
 
diff --git a/xen/arch/x86/physdev.c b/xen/arch/x86/physdev.c
index 3837926728..3a50d9d0c9 100644
--- a/xen/arch/x86/physdev.c
+++ b/xen/arch/x86/physdev.c
@@ -531,7 +531,8 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
             break;
 
         pcidevs_lock();
-        pdev = pci_get_pdev(0, restore_msi.bus, restore_msi.devfn);
+        pdev = pci_get_pdev(NULL,
+                            PCI_SBDF(0, restore_msi.bus, restore_msi.devfn));
         ret = pdev ? pci_restore_msi_state(pdev) : -ENODEV;
         pcidevs_unlock();
         break;
@@ -546,7 +547,7 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
             break;
 
         pcidevs_lock();
-        pdev = pci_get_pdev(dev.seg, dev.bus, dev.devfn);
+        pdev = pci_get_pdev(NULL, PCI_SBDF(dev.seg, dev.bus, dev.devfn));
         ret = pdev ? pci_restore_msi_state(pdev) : -ENODEV;
         pcidevs_unlock();
         break;
diff --git a/xen/common/sysctl.c b/xen/common/sysctl.c
index 1ad3c29351..02505ab044 100644
--- a/xen/common/sysctl.c
+++ b/xen/common/sysctl.c
@@ -447,7 +447,7 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl)
             }
 
             pcidevs_lock();
-            pdev = pci_get_pdev(dev.seg, dev.bus, dev.devfn);
+            pdev = pci_get_pdev(NULL, PCI_SBDF(dev.seg, dev.bus, dev.devfn));
             if ( !pdev )
                 node = XEN_INVALID_DEV;
             else if ( pdev->node == NUMA_NO_NODE )
diff --git a/xen/drivers/passthrough/amd/iommu_init.c b/xen/drivers/passthrough/amd/iommu_init.c
index e2166f534f..14f8af7ea8 100644
--- a/xen/drivers/passthrough/amd/iommu_init.c
+++ b/xen/drivers/passthrough/amd/iommu_init.c
@@ -748,8 +748,7 @@ static bool_t __init set_iommu_interrupt_handler(struct amd_iommu *iommu)
     }
 
     pcidevs_lock();
-    iommu->msi.dev = pci_get_pdev(iommu->seg, PCI_BUS(iommu->bdf),
-                                  PCI_DEVFN(iommu->bdf));
+    iommu->msi.dev = pci_get_pdev(NULL, PCI_SBDF(iommu->seg, iommu->bdf));
     pcidevs_unlock();
     if ( !iommu->msi.dev )
     {
@@ -1286,7 +1285,7 @@ static int __init cf_check amd_iommu_setup_device_table(
                 if ( !pci_init )
                     continue;
                 pcidevs_lock();
-                pdev = pci_get_pdev(seg, PCI_BUS(bdf), PCI_DEVFN(bdf));
+                pdev = pci_get_pdev(NULL, PCI_SBDF(seg, bdf));
                 pcidevs_unlock();
             }
 
diff --git a/xen/drivers/passthrough/amd/iommu_map.c b/xen/drivers/passthrough/amd/iommu_map.c
index f2157e0043..993bac6f88 100644
--- a/xen/drivers/passthrough/amd/iommu_map.c
+++ b/xen/drivers/passthrough/amd/iommu_map.c
@@ -727,7 +727,7 @@ int cf_check amd_iommu_get_reserved_device_memory(
             const struct pci_dev *pdev;
 
             pcidevs_lock();
-            pdev = pci_get_pdev(seg, sbdf.bus, sbdf.devfn);
+            pdev = pci_get_pdev(NULL, sbdf);
             pcidevs_unlock();
 
             if ( pdev )
diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index 085cd82941..0722f8d571 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -576,23 +576,6 @@ int __init pci_ro_device(int seg, int bus, int devfn)
     return 0;
 }
 
-struct pci_dev *pci_get_pdev(uint16_t seg, uint8_t bus, uint8_t devfn)
-{
-    const struct pci_seg *pseg = get_pseg(seg);
-    struct pci_dev *pdev;
-
-    ASSERT(pcidevs_locked());
-
-    if ( !pseg )
-        return NULL;
-
-    list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
-        if ( pdev->bus == bus && pdev->devfn == devfn )
-            return pdev;
-
-    return NULL;
-}
-
 struct pci_dev *pci_get_real_pdev(int seg, int bus, int devfn)
 {
     struct pci_dev *pdev;
@@ -601,12 +584,12 @@ struct pci_dev *pci_get_real_pdev(int seg, int bus, int devfn)
     if ( seg < 0 || bus < 0 || devfn < 0 )
         return NULL;
 
-    for ( pdev = pci_get_pdev(seg, bus, devfn), stride = 4;
+    for ( pdev = pci_get_pdev(NULL, PCI_SBDF(seg, bus, devfn)), stride = 4;
           !pdev && stride; stride >>= 1 )
     {
         if ( !(devfn & (8 - stride)) )
             continue;
-        pdev = pci_get_pdev(seg, bus, devfn & ~(8 - stride));
+        pdev = pci_get_pdev(NULL, PCI_SBDF(seg, bus, devfn & ~(8 - stride)));
         if ( pdev && stride != pdev->phantom_stride )
             pdev = NULL;
     }
@@ -614,32 +597,33 @@ struct pci_dev *pci_get_real_pdev(int seg, int bus, int devfn)
     return pdev;
 }
 
-struct pci_dev *pci_get_pdev_by_domain(const struct domain *d, uint16_t seg,
-                                       uint8_t bus, uint8_t devfn)
+struct pci_dev *pci_get_pdev(const struct domain *d, pci_sbdf_t sbdf)
 {
     struct pci_dev *pdev;
 
+    ASSERT(d || pcidevs_locked());
+
     /*
      * The hardware domain owns the majority of the devices in the system.
      * When there are multiple segments, traversing the per-segment list is
      * likely going to be faster, whereas for a single segment the difference
      * shouldn't be that large.
      */
-    if ( is_hardware_domain(d) )
+    if ( !d || is_hardware_domain(d) )
     {
-        const struct pci_seg *pseg = get_pseg(seg);
+        const struct pci_seg *pseg = get_pseg(sbdf.seg);
 
         if ( !pseg )
             return NULL;
 
         list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
-            if ( pdev->bus == bus && pdev->devfn == devfn &&
-                 pdev->domain == d )
+            if ( pdev->sbdf.bdf == sbdf.bdf &&
+                 (!d || pdev->domain == d) )
                 return pdev;
     }
     else
         list_for_each_entry ( pdev, &d->pdev_list, domain_list )
-            if ( pdev->bus == bus && pdev->devfn == devfn )
+            if ( pdev->sbdf.bdf == sbdf.bdf )
                 return pdev;
 
     return NULL;
@@ -746,7 +730,9 @@ int pci_add_device(u16 seg, u8 bus, u8 devfn,
     else if ( info->is_virtfn )
     {
         pcidevs_lock();
-        pdev = pci_get_pdev(seg, info->physfn.bus, info->physfn.devfn);
+        pdev = pci_get_pdev(NULL,
+                            PCI_SBDF(seg, info->physfn.bus,
+                                     info->physfn.devfn));
         if ( pdev )
             pf_is_extfn = pdev->info.is_extfn;
         pcidevs_unlock();
@@ -924,7 +910,7 @@ static int deassign_device(struct domain *d, uint16_t seg, uint8_t bus,
         return -EINVAL;
 
     ASSERT(pcidevs_locked());
-    pdev = pci_get_pdev_by_domain(d, seg, bus, devfn);
+    pdev = pci_get_pdev(d, PCI_SBDF(seg, bus, devfn));
     if ( !pdev )
         return -ENODEV;
 
@@ -1201,7 +1187,8 @@ static int __hwdom_init cf_check _setup_hwdom_pci_devices(
     {
         for ( devfn = 0; devfn < 256; devfn++ )
         {
-            struct pci_dev *pdev = pci_get_pdev(pseg->nr, bus, devfn);
+            struct pci_dev *pdev = pci_get_pdev(NULL,
+                                                PCI_SBDF(pseg->nr, bus, devfn));
 
             if ( !pdev )
                 continue;
@@ -1475,7 +1462,7 @@ static int device_assigned(u16 seg, u8 bus, u8 devfn)
     int rc = 0;
 
     ASSERT(pcidevs_locked());
-    pdev = pci_get_pdev(seg, bus, devfn);
+    pdev = pci_get_pdev(NULL, PCI_SBDF(seg, bus, devfn));
 
     if ( !pdev )
         rc = -ENODEV;
@@ -1506,7 +1493,7 @@ static int assign_device(struct domain *d, u16 seg, u8 bus, u8 devfn, u32 flag)
 
     /* device_assigned() should already have cleared the device for assignment */
     ASSERT(pcidevs_locked());
-    pdev = pci_get_pdev(seg, bus, devfn);
+    pdev = pci_get_pdev(NULL, PCI_SBDF(seg, bus, devfn));
     ASSERT(pdev && (pdev->domain == hardware_domain ||
                     pdev->domain == dom_io));
 
diff --git a/xen/drivers/passthrough/vtd/quirks.c b/xen/drivers/passthrough/vtd/quirks.c
index 603ad41d5b..fcc8f73e8b 100644
--- a/xen/drivers/passthrough/vtd/quirks.c
+++ b/xen/drivers/passthrough/vtd/quirks.c
@@ -417,7 +417,7 @@ static int __must_check map_me_phantom_function(struct domain *domain,
     int rc;
 
     /* find ME VT-d engine base on a real ME device */
-    pdev = pci_get_pdev(0, 0, PCI_DEVFN(dev, 0));
+    pdev = pci_get_pdev(NULL, PCI_SBDF(0, 0, dev, 0));
     drhd = acpi_find_matched_drhd_unit(pdev);
 
     /* map or unmap ME phantom function */
diff --git a/xen/drivers/video/vga.c b/xen/drivers/video/vga.c
index d993e68d31..29a88e8241 100644
--- a/xen/drivers/video/vga.c
+++ b/xen/drivers/video/vga.c
@@ -118,7 +118,7 @@ void __init video_endboot(void)
                 u8 b = bus, df = devfn, sb;
 
                 pcidevs_lock();
-                pdev = pci_get_pdev(0, bus, devfn);
+                pdev = pci_get_pdev(NULL, PCI_SBDF(0, bus, devfn));
                 pcidevs_unlock();
 
                 if ( !pdev ||
diff --git a/xen/drivers/vpci/vpci.c b/xen/drivers/vpci/vpci.c
index 9fb3c05b2b..3467c0de86 100644
--- a/xen/drivers/vpci/vpci.c
+++ b/xen/drivers/vpci/vpci.c
@@ -325,7 +325,7 @@ uint32_t vpci_read(pci_sbdf_t sbdf, unsigned int reg, unsigned int size)
     }
 
     /* Find the PCI dev matching the address. */
-    pdev = pci_get_pdev_by_domain(d, sbdf.seg, sbdf.bus, sbdf.devfn);
+    pdev = pci_get_pdev(d, sbdf);
     if ( !pdev )
         return vpci_read_hw(sbdf, reg, size);
 
@@ -435,7 +435,7 @@ void vpci_write(pci_sbdf_t sbdf, unsigned int reg, unsigned int size,
      * Find the PCI dev matching the address.
      * Passthrough everything that's not trapped.
      */
-    pdev = pci_get_pdev_by_domain(d, sbdf.seg, sbdf.bus, sbdf.devfn);
+    pdev = pci_get_pdev(d, sbdf);
     if ( !pdev )
     {
         vpci_write_hw(sbdf, reg, size, data);
diff --git a/xen/include/xen/pci.h b/xen/include/xen/pci.h
index 0eaa5f3938..30fead8f7e 100644
--- a/xen/include/xen/pci.h
+++ b/xen/include/xen/pci.h
@@ -177,10 +177,8 @@ int pci_add_device(u16 seg, u8 bus, u8 devfn,
 int pci_remove_device(u16 seg, u8 bus, u8 devfn);
 int pci_ro_device(int seg, int bus, int devfn);
 int pci_hide_device(unsigned int seg, unsigned int bus, unsigned int devfn);
-struct pci_dev *pci_get_pdev(uint16_t seg, uint8_t bus, uint8_t devfn);
+struct pci_dev *pci_get_pdev(const struct domain *d, pci_sbdf_t sbdf);
 struct pci_dev *pci_get_real_pdev(int seg, int bus, int devfn);
-struct pci_dev *pci_get_pdev_by_domain(const struct domain *, uint16_t seg,
-                                       uint8_t bus, uint8_t devfn);
 void pci_check_disable_device(u16 seg, u8 bus, u8 devfn);
 
 uint8_t pci_conf_read8(pci_sbdf_t sbdf, unsigned int reg);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 12 06:44:25 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 12 Aug 2022 06:44:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.385298.620890 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oMOPB-0008OA-FF; Fri, 12 Aug 2022 06:44:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 385298.620890; Fri, 12 Aug 2022 06:44:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oMOPB-0008O2-Ca; Fri, 12 Aug 2022 06:44:25 +0000
Received: by outflank-mailman (input) for mailman id 385298;
 Fri, 12 Aug 2022 06:44:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMOPA-0008Nn-EH
 for xen-changelog@lists.xenproject.org; Fri, 12 Aug 2022 06:44:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMOPA-0003WI-DU
 for xen-changelog@lists.xenproject.org; Fri, 12 Aug 2022 06:44:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMOPA-0004yz-Cg
 for xen-changelog@lists.xenproject.org; Fri, 12 Aug 2022 06:44:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=UvdQ749dG1cInzu4mMBiSbpmsU5BtYisWKCENlC+zZk=; b=L5UOQqWTevm4/H4x6c+A/RGL6F
	S8P+QKDtepLZDtu7Ifj24I+KUdjSWzSur8JzpVwsvrOJsRzo5xP1dXs4NWTaOuERqMCf4Y8RPKV0l
	Dlvcyosmf/JgAVzjrmlz5iSXABYEGOS1RIS+BplCgoLk+pYPcG5WEpkOu4wIONkCluwo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] PCI: bring pci_get_real_pdev() in line with pci_get_pdev()
Message-Id: <E1oMOPA-0004yz-Cg@xenbits.xenproject.org>
Date: Fri, 12 Aug 2022 06:44:24 +0000

commit f5234f36335618c31963df260704524366f9bb95
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Aug 12 08:37:50 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Aug 12 08:37:50 2022 +0200

    PCI: bring pci_get_real_pdev() in line with pci_get_pdev()
    
    Fold the three parameters into a single pci_sbdf_t one.
    
    No functional change intended, despite the "(8 - stride)" ->
    "stride" replacement (not really sure why it was written the more
    complicated way originally).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Rahul Singh <rahul.singh@arm.com>
    Tested-by: Rahul Singh <rahul.singh@arm.com>
---
 xen/drivers/passthrough/amd/iommu_init.c |  3 +--
 xen/drivers/passthrough/pci.c            | 14 ++++++--------
 xen/include/xen/pci.h                    |  2 +-
 3 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/xen/drivers/passthrough/amd/iommu_init.c b/xen/drivers/passthrough/amd/iommu_init.c
index 14f8af7ea8..1f14aaf49e 100644
--- a/xen/drivers/passthrough/amd/iommu_init.c
+++ b/xen/drivers/passthrough/amd/iommu_init.c
@@ -639,8 +639,7 @@ static void cf_check parse_ppr_log_entry(struct amd_iommu *iommu, u32 entry[])
     struct pci_dev *pdev;
 
     pcidevs_lock();
-    pdev = pci_get_real_pdev(iommu->seg, PCI_BUS(device_id),
-                             PCI_DEVFN(device_id));
+    pdev = pci_get_real_pdev(PCI_SBDF(iommu->seg, device_id));
     pcidevs_unlock();
 
     if ( pdev )
diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index 0722f8d571..cdaf5c247f 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -576,20 +576,18 @@ int __init pci_ro_device(int seg, int bus, int devfn)
     return 0;
 }
 
-struct pci_dev *pci_get_real_pdev(int seg, int bus, int devfn)
+struct pci_dev *pci_get_real_pdev(pci_sbdf_t sbdf)
 {
     struct pci_dev *pdev;
     int stride;
 
-    if ( seg < 0 || bus < 0 || devfn < 0 )
-        return NULL;
-
-    for ( pdev = pci_get_pdev(NULL, PCI_SBDF(seg, bus, devfn)), stride = 4;
+    for ( pdev = pci_get_pdev(NULL, sbdf), stride = 4;
           !pdev && stride; stride >>= 1 )
     {
-        if ( !(devfn & (8 - stride)) )
+        if ( !(sbdf.devfn & stride) )
             continue;
-        pdev = pci_get_pdev(NULL, PCI_SBDF(seg, bus, devfn & ~(8 - stride)));
+        sbdf.devfn &= ~stride;
+        pdev = pci_get_pdev(NULL, sbdf);
         if ( pdev && stride != pdev->phantom_stride )
             pdev = NULL;
     }
@@ -1074,7 +1072,7 @@ void pci_check_disable_device(u16 seg, u8 bus, u8 devfn)
     u16 cword;
 
     pcidevs_lock();
-    pdev = pci_get_real_pdev(seg, bus, devfn);
+    pdev = pci_get_real_pdev(PCI_SBDF(seg, bus, devfn));
     if ( pdev )
     {
         if ( now < pdev->fault.time ||
diff --git a/xen/include/xen/pci.h b/xen/include/xen/pci.h
index 30fead8f7e..5975ca2f30 100644
--- a/xen/include/xen/pci.h
+++ b/xen/include/xen/pci.h
@@ -178,7 +178,7 @@ int pci_remove_device(u16 seg, u8 bus, u8 devfn);
 int pci_ro_device(int seg, int bus, int devfn);
 int pci_hide_device(unsigned int seg, unsigned int bus, unsigned int devfn);
 struct pci_dev *pci_get_pdev(const struct domain *d, pci_sbdf_t sbdf);
-struct pci_dev *pci_get_real_pdev(int seg, int bus, int devfn);
+struct pci_dev *pci_get_real_pdev(pci_sbdf_t sbdf);
 void pci_check_disable_device(u16 seg, u8 bus, u8 devfn);
 
 uint8_t pci_conf_read8(pci_sbdf_t sbdf, unsigned int reg);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 12 06:55:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 12 Aug 2022 06:55:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.385321.620915 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oMOZV-00024C-RL; Fri, 12 Aug 2022 06:55:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 385321.620915; Fri, 12 Aug 2022 06:55:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oMOZV-000244-OQ; Fri, 12 Aug 2022 06:55:05 +0000
Received: by outflank-mailman (input) for mailman id 385321;
 Fri, 12 Aug 2022 06:55:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMOZU-00023y-TL
 for xen-changelog@lists.xenproject.org; Fri, 12 Aug 2022 06:55:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMOZU-0003ik-R6
 for xen-changelog@lists.xenproject.org; Fri, 12 Aug 2022 06:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMOZU-0005SK-Pz
 for xen-changelog@lists.xenproject.org; Fri, 12 Aug 2022 06:55:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=2JmNy7691fLoMunme3ijQox7LTQ+EyA5ycBq8a6H0GY=; b=3YogVDyyhE9RD08butUoXpaFw/
	0yanJnCEa0gFH/Hl8E67tucxV8ZR7VywPIYtttl5yBGoQ2dN3Uxa2wESzxJKsTOnS4Nf+snEW9cB+
	KHPgIQtuNqezuwwCau6UhKAWX9OiZ9hSPXbMWlJ2tX04ythUZDtX/ZqQzmwX591Hvo1g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] config/x86: tidy {Free,Open}BSD LDFLAGS_DIRECT handling
Message-Id: <E1oMOZU-0005SK-Pz@xenbits.xenproject.org>
Date: Fri, 12 Aug 2022 06:55:04 +0000

commit 0c614af4a73b77baf1d711c68b8ee0278d7a97a6
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Aug 12 08:54:33 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Aug 12 08:54:33 2022 +0200

    config/x86: tidy {Free,Open}BSD LDFLAGS_DIRECT handling
    
    It's not clear why for x86-64 a different approach was used than the
    (shorter) one x86-32 has been using. Move the setting to the respective
    OS files and reuse x86-32's approach for x86-64, while at the same time
    using an OS-independent variable name (thus avoiding the indirection
    through $(XEN_OS)).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 config/FreeBSD.mk |  2 ++
 config/OpenBSD.mk |  2 ++
 config/x86_32.mk  |  4 +---
 config/x86_64.mk  | 10 +---------
 4 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/config/FreeBSD.mk b/config/FreeBSD.mk
index 98a5117e60..0062902b25 100644
--- a/config/FreeBSD.mk
+++ b/config/FreeBSD.mk
@@ -1,5 +1,7 @@
 include $(XEN_ROOT)/config/StdGNU.mk
 
+XEN_ELF_SUB_FLAVOR = _fbsd
+
 # No wget on FreeBSD base system
 WGET = ftp
 PKG_INSTALLDIR = ${prefix}/libdata/pkgconfig
diff --git a/config/OpenBSD.mk b/config/OpenBSD.mk
index b421a1c840..6a6bf304f0 100644
--- a/config/OpenBSD.mk
+++ b/config/OpenBSD.mk
@@ -1 +1,3 @@
 include $(XEN_ROOT)/config/StdGNU.mk
+
+XEN_ELF_SUB_FLAVOR = _obsd
diff --git a/config/x86_32.mk b/config/x86_32.mk
index 29d13f7773..bc96ff013d 100644
--- a/config/x86_32.mk
+++ b/config/x86_32.mk
@@ -8,8 +8,6 @@ CONFIG_XCUTILS := y
 CFLAGS += -m32 -march=i686
 
 # Use only if calling $(LD) directly.
-LDFLAGS_DIRECT_OpenBSD = _obsd
-LDFLAGS_DIRECT_FreeBSD = _fbsd
-LDFLAGS_DIRECT += -melf_i386$(LDFLAGS_DIRECT_$(XEN_OS))
+LDFLAGS_DIRECT += -melf_i386$(XEN_ELF_SUB_FLAVOR)
 
 IOEMU_CPU_ARCH ?= i386
diff --git a/config/x86_64.mk b/config/x86_64.mk
index 85fa27ca69..4afef44141 100644
--- a/config/x86_64.mk
+++ b/config/x86_64.mk
@@ -14,14 +14,6 @@ SunOS_LIBDIR = $(SunOS_LIBDIR_x86_64)
 EFI_DIR ?= /usr/lib64/efi
 
 # Use only if calling $(LD) directly.
-ifeq ($(XEN_OS),OpenBSD)
-LDFLAGS_DIRECT += -melf_x86_64_obsd
-else
-ifeq ($(XEN_OS),FreeBSD)
-LDFLAGS_DIRECT += -melf_x86_64_fbsd
-else
-LDFLAGS_DIRECT += -melf_x86_64
-endif
-endif
+LDFLAGS_DIRECT += -melf_x86_64$(XEN_ELF_SUB_FLAVOR)
 
 IOEMU_CPU_ARCH ?= x86_64
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 12 12:33:07 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 12 Aug 2022 12:33:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.385669.621339 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oMTqb-0002ha-9e; Fri, 12 Aug 2022 12:33:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 385669.621339; Fri, 12 Aug 2022 12:33:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oMTqb-0002hT-6x; Fri, 12 Aug 2022 12:33:05 +0000
Received: by outflank-mailman (input) for mailman id 385669;
 Fri, 12 Aug 2022 12:33:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMTqZ-0002gb-UO
 for xen-changelog@lists.xenproject.org; Fri, 12 Aug 2022 12:33:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMTqZ-0001jH-TY
 for xen-changelog@lists.xenproject.org; Fri, 12 Aug 2022 12:33:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMTqZ-000796-SY
 for xen-changelog@lists.xenproject.org; Fri, 12 Aug 2022 12:33:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Lk7ahy7JsvHsBBJpLs1Jg8KJov96bX53ED0o/m7sIwc=; b=s1xinjbsnvPHxVJOCCbM8IoNNt
	31yBj550kjblc9QB7HXAK2mNawZwp3xGLn4dBOAAx2wcQMLi5QFwd7U4bpArMqsMxzJK4zQOXs32K
	1eUN0v7ENKLg+qxykmSFJw5kGSOhYjGgdI19t1yaziLbDdI/fmsdoR9H60+JPPSDG59Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/msi: Switch msi_info to using pci_sbdf_t
Message-Id: <E1oMTqZ-000796-SY@xenbits.xenproject.org>
Date: Fri, 12 Aug 2022 12:33:03 +0000

commit 1af4e0189f4ef65cb43d79440d71867aad6d3d44
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Aug 11 17:12:22 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 12 13:25:40 2022 +0100

    x86/msi: Switch msi_info to using pci_sbdf_t
    
    This reorders the fields in msi_info, but removes all the under-the-hood
    parameter shuffling required to call pci_get_pdev().
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/vmsi.c        |  4 +---
 xen/arch/x86/include/asm/msi.h |  4 +---
 xen/arch/x86/irq.c             |  2 +-
 xen/arch/x86/msi.c             |  4 ++--
 xen/arch/x86/physdev.c         | 10 +++++-----
 xen/drivers/char/ns16550.c     |  4 ++--
 xen/xsm/flask/hooks.c          |  2 +-
 7 files changed, 13 insertions(+), 17 deletions(-)

diff --git a/xen/arch/x86/hvm/vmsi.c b/xen/arch/x86/hvm/vmsi.c
index 198fbd6708..75f92885dc 100644
--- a/xen/arch/x86/hvm/vmsi.c
+++ b/xen/arch/x86/hvm/vmsi.c
@@ -750,9 +750,7 @@ static int vpci_msi_enable(const struct pci_dev *pdev, unsigned int nr,
                            paddr_t table_base)
 {
     struct msi_info msi_info = {
-        .seg = pdev->seg,
-        .bus = pdev->bus,
-        .devfn = pdev->devfn,
+        .sbdf = pdev->sbdf,
         .table_base = table_base,
         .entry_nr = nr,
     };
diff --git a/xen/arch/x86/include/asm/msi.h b/xen/arch/x86/include/asm/msi.h
index 117379318f..fe670895ee 100644
--- a/xen/arch/x86/include/asm/msi.h
+++ b/xen/arch/x86/include/asm/msi.h
@@ -59,9 +59,7 @@
 #define FIX_MSIX_MAX_PAGES              512
 
 struct msi_info {
-    u16 seg;
-    u8 bus;
-    u8 devfn;
+    pci_sbdf_t sbdf;
     int irq;
     int entry_nr;
     uint64_t table_base;
diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c
index bf8b52d111..cd0c8a30a8 100644
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -2162,7 +2162,7 @@ int map_domain_pirq(
         if ( !cpu_has_apic )
             goto done;
 
-        pdev = pci_get_pdev(d, PCI_SBDF(msi->seg, msi->bus, msi->devfn));
+        pdev = pci_get_pdev(d, msi->sbdf);
         if ( !pdev )
             goto done;
 
diff --git a/xen/arch/x86/msi.c b/xen/arch/x86/msi.c
index 62c4fbcfbe..d0bf63df1d 100644
--- a/xen/arch/x86/msi.c
+++ b/xen/arch/x86/msi.c
@@ -1001,7 +1001,7 @@ static int __pci_enable_msi(struct msi_info *msi, struct msi_desc **desc)
     struct msi_desc *old_desc;
 
     ASSERT(pcidevs_locked());
-    pdev = pci_get_pdev(NULL, PCI_SBDF(msi->seg, msi->bus, msi->devfn));
+    pdev = pci_get_pdev(NULL, msi->sbdf);
     if ( !pdev )
         return -ENODEV;
 
@@ -1056,7 +1056,7 @@ static int __pci_enable_msix(struct msi_info *msi, struct msi_desc **desc)
     struct msi_desc *old_desc;
 
     ASSERT(pcidevs_locked());
-    pdev = pci_get_pdev(NULL, PCI_SBDF(msi->seg, msi->bus, msi->devfn));
+    pdev = pci_get_pdev(NULL, msi->sbdf);
     if ( !pdev || !pdev->msix )
         return -ENODEV;
 
diff --git a/xen/arch/x86/physdev.c b/xen/arch/x86/physdev.c
index 3a50d9d0c9..2f1d955a96 100644
--- a/xen/arch/x86/physdev.c
+++ b/xen/arch/x86/physdev.c
@@ -312,21 +312,21 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
         {
         case MAP_PIRQ_TYPE_MSI_SEG:
             map.type = MAP_PIRQ_TYPE_MSI;
-            msi.seg = map.bus >> 16;
+            msi.sbdf.seg = map.bus >> 16;
             break;
 
         case MAP_PIRQ_TYPE_MULTI_MSI:
             if ( map.table_base )
                 return -EINVAL;
-            msi.seg = map.bus >> 16;
+            msi.sbdf.seg = map.bus >> 16;
             break;
 
         default:
-            msi.seg = 0;
+            msi.sbdf.seg = 0;
             break;
         }
-        msi.bus = map.bus;
-        msi.devfn = map.devfn;
+        msi.sbdf.bus = map.bus;
+        msi.sbdf.devfn = map.devfn;
         msi.entry_nr = map.entry_nr;
         msi.table_base = map.table_base;
         ret = physdev_map_pirq(map.domid, map.type, &map.index, &map.pirq,
diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c
index cd3573e43d..01a05c9aa8 100644
--- a/xen/drivers/char/ns16550.c
+++ b/xen/drivers/char/ns16550.c
@@ -435,8 +435,8 @@ static void __init cf_check ns16550_init_postirq(struct serial_port *port)
         if ( uart->msi )
         {
             struct msi_info msi = {
-                .bus = uart->ps_bdf[0],
-                .devfn = PCI_DEVFN(uart->ps_bdf[1], uart->ps_bdf[2]),
+                .sbdf = PCI_SBDF(0, uart->ps_bdf[0], uart->ps_bdf[1],
+                                 uart->ps_bdf[2]),
                 .irq = rc = uart->irq,
                 .entry_nr = 1
             };
diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
index 8c9cd0f297..8bd56644ef 100644
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -918,7 +918,7 @@ static int flask_map_domain_msi (
 {
 #ifdef CONFIG_HAS_PCI_MSI
     const struct msi_info *msi = data;
-    uint32_t machine_bdf = (msi->seg << 16) | (msi->bus << 8) | msi->devfn;
+    uint32_t machine_bdf = msi->sbdf.sbdf;
 
     AVC_AUDIT_DATA_INIT(ad, DEV);
     ad->device = machine_bdf;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 12 15:11:07 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 12 Aug 2022 15:11:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.385753.621479 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oMWJT-00057Q-5f; Fri, 12 Aug 2022 15:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 385753.621479; Fri, 12 Aug 2022 15:11:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oMWJT-00057J-2x; Fri, 12 Aug 2022 15:11:03 +0000
Received: by outflank-mailman (input) for mailman id 385753;
 Fri, 12 Aug 2022 15:11:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMWJS-00056l-45
 for xen-changelog@lists.xenproject.org; Fri, 12 Aug 2022 15:11:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMWJS-0004UO-3E
 for xen-changelog@lists.xenproject.org; Fri, 12 Aug 2022 15:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMWJS-0006OB-1q
 for xen-changelog@lists.xenproject.org; Fri, 12 Aug 2022 15:11:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yPP5kWmZ7FmcTD2VxKvW4SOocRvWFqy2Hu4fgjaEsHs=; b=SOaNttzLNvu4vgngBhX80E/e8m
	xIL6aXcBt7Bs7zx0ADsEdnwALDNNj6DnC+xkRusP+lfQzGflRlnFyFzIzzwl0AIXoIQHf9Lai+Tf7
	oWLvRC/VmH8z6GAZNiUOEOBPS9P06iGgEWGb5df88kOpC6PPjg0rPSUS6Z5dtT+nHMeM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/CPUID: AVX512-FP16 definitions
Message-Id: <E1oMWJS-0006OB-1q@xenbits.xenproject.org>
Date: Fri, 12 Aug 2022 15:11:02 +0000

commit 4735553ec1d8b63aa08772ced1fac96131427f94
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Aug 11 11:45:23 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 11 11:45:23 2022 +0200

    x86/CPUID: AVX512-FP16 definitions
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/libs/light/libxl_cpuid.c              | 1 +
 tools/misc/xen-cpuid.c                      | 1 +
 xen/arch/x86/include/asm/cpufeature.h       | 1 +
 xen/include/public/arch-x86/cpufeatureset.h | 1 +
 xen/tools/gen-cpuid.py                      | 3 ++-
 5 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/tools/libs/light/libxl_cpuid.c b/tools/libs/light/libxl_cpuid.c
index f4735b1c13..d5a9b35774 100644
--- a/tools/libs/light/libxl_cpuid.c
+++ b/tools/libs/light/libxl_cpuid.c
@@ -221,6 +221,7 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
         {"serialize",    0x00000007,  0, CPUID_REG_EDX, 14,  1},
         {"tsxldtrk",     0x00000007,  0, CPUID_REG_EDX, 16,  1},
         {"cet-ibt",      0x00000007,  0, CPUID_REG_EDX, 20,  1},
+        {"avx512-fp16",  0x00000007,  0, CPUID_REG_EDX, 23,  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},
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index 1e6b077ba4..390ac1dafe 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -175,6 +175,7 @@ static const char *const str_7d0[32] =
     [16] = "tsxldtrk",
     [18] = "pconfig",
     [20] = "cet-ibt",
+    /* 22 */                [23] = "avx512-fp16",
 
     [26] = "ibrsb",         [27] = "stibp",
     [28] = "l1d-flush",     [29] = "arch-caps",
diff --git a/xen/arch/x86/include/asm/cpufeature.h b/xen/arch/x86/include/asm/cpufeature.h
index f2c6f255ac..a3ad9ebee4 100644
--- a/xen/arch/x86/include/asm/cpufeature.h
+++ b/xen/arch/x86/include/asm/cpufeature.h
@@ -138,6 +138,7 @@
 #define cpu_has_rtm_always_abort boot_cpu_has(X86_FEATURE_RTM_ALWAYS_ABORT)
 #define cpu_has_tsx_force_abort boot_cpu_has(X86_FEATURE_TSX_FORCE_ABORT)
 #define cpu_has_serialize       boot_cpu_has(X86_FEATURE_SERIALIZE)
+#define cpu_has_avx512_fp16     boot_cpu_has(X86_FEATURE_AVX512_FP16)
 #define cpu_has_arch_caps       boot_cpu_has(X86_FEATURE_ARCH_CAPS)
 
 /* CPUID level 0x00000007:1.eax */
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index c9c4683557..4b8925b7b8 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -282,6 +282,7 @@ XEN_CPUFEATURE(TSX_FORCE_ABORT, 9*32+13) /* MSR_TSX_FORCE_ABORT.RTM_ABORT */
 XEN_CPUFEATURE(SERIALIZE,     9*32+14) /*A  SERIALIZE insn */
 XEN_CPUFEATURE(TSXLDTRK,      9*32+16) /*a  TSX load tracking suspend/resume insns */
 XEN_CPUFEATURE(CET_IBT,       9*32+20) /*   CET - Indirect Branch Tracking */
+XEN_CPUFEATURE(AVX512_FP16,   9*32+23) /*   AVX512 FP16 instructions */
 XEN_CPUFEATURE(IBRSB,         9*32+26) /*A  IBRS and IBPB support (used by Intel) */
 XEN_CPUFEATURE(STIBP,         9*32+27) /*A  STIBP */
 XEN_CPUFEATURE(L1D_FLUSH,     9*32+28) /*S  MSR_FLUSH_CMD and L1D flush. */
diff --git a/xen/tools/gen-cpuid.py b/xen/tools/gen-cpuid.py
index e0e3f2f463..4f7c8d78cc 100755
--- a/xen/tools/gen-cpuid.py
+++ b/xen/tools/gen-cpuid.py
@@ -267,7 +267,8 @@ def crunch_numbers(state):
         # AVX512 extensions acting on vectors of bytes/words are made
         # dependents of AVX512BW (as to requiring wider than 16-bit mask
         # registers), despite the SDM not formally making this connection.
-        AVX512BW: [AVX512_VBMI, AVX512_VBMI2, AVX512_BITALG, AVX512_BF16],
+        AVX512BW: [AVX512_VBMI, AVX512_VBMI2, AVX512_BITALG, AVX512_BF16,
+                   AVX512_FP16],
 
         # Extensions with VEX/EVEX encodings keyed to a separate feature
         # flag are made dependents of their respective legacy feature.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 12 15:11:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 12 Aug 2022 15:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.385754.621482 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oMWJd-0005Cy-79; Fri, 12 Aug 2022 15:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 385754.621482; Fri, 12 Aug 2022 15: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 1oMWJd-0005Cq-4U; Fri, 12 Aug 2022 15:11:13 +0000
Received: by outflank-mailman (input) for mailman id 385754;
 Fri, 12 Aug 2022 15:11:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMWJc-0005CE-7U
 for xen-changelog@lists.xenproject.org; Fri, 12 Aug 2022 15:11:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMWJc-0004UU-6f
 for xen-changelog@lists.xenproject.org; Fri, 12 Aug 2022 15:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMWJc-0006Oc-5X
 for xen-changelog@lists.xenproject.org; Fri, 12 Aug 2022 15:11:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nRVVcyVEnBS5Z7MoHI8F0BkZL/SQ64ndXyRnCL2EkCo=; b=Piue3WUnptq8uOVZK6JkKpMPko
	qkzb9v11gPN7ZO5Pqw1mVCJe7fWbetauVQv7U+W96Op7wgOmyigBoOEDDDKBMk0YdADOCRBiN0eAJ
	LRMIgd4BsOknSBYUHGYdIRe239+DE4X12w7kR0OqH+YOTMFw0C/sjlMwJDbRHseY8uAc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/sched: setup dom0 vCPUs affinity only once
Message-Id: <E1oMWJc-0006Oc-5X@xenbits.xenproject.org>
Date: Fri, 12 Aug 2022 15:11:12 +0000

commit c79e4d209be3ed2a6b8e97c35944786ed2a66b94
Author:     Dario Faggioli <dfaggioli@suse.com>
AuthorDate: Thu Aug 11 11:46:22 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 11 11:46:22 2022 +0200

    xen/sched: setup dom0 vCPUs affinity only once
    
    Right now, affinity for dom0 vCPUs is setup in two steps. This is a
    problem as, at least in Credit2, unit_insert() sees and uses the
    "intermediate" affinity, and place the vCPUs on CPUs where they cannot
    be run. And this in turn results in boot hangs, if the "dom0_nodes"
    parameter is used.
    
    Fix this by setting up the affinity properly once and for all, in
    sched_init_vcpu() called by create_vcpu().
    
    Note that, unless a soft-affinity is explicitly specified for dom0 (by
    using the relaxed mode of "dom0_nodes") we set it to the default, which
    is all CPUs, instead of computing it basing on hard affinity (if any).
    This is because hard and soft affinity should be considered as
    independent user controlled properties. In fact, if we dor derive dom0's
    soft-affinity from its boot-time hard-affinity, such computed value will
    continue to be used even if later the user changes the hard-affinity.
    And this could result in the vCPUs behaving differently than what the
    user wanted and expects.
    
    Fixes: dafd936dddbd ("Make credit2 the default scheduler")
    Reported-by: Olaf Hering <ohering@suse.de>
    Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/sched/core.c | 63 ++++++++++++++++++++++++++++++-------------------
 1 file changed, 39 insertions(+), 24 deletions(-)

diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c
index a066c629cb..ff1ddc7624 100644
--- a/xen/common/sched/core.c
+++ b/xen/common/sched/core.c
@@ -571,12 +571,46 @@ int sched_init_vcpu(struct vcpu *v)
         return 1;
     }
 
-    /*
-     * Initialize affinity settings. The idler, and potentially
-     * domain-0 VCPUs, are pinned onto their respective physical CPUs.
-     */
-    if ( is_idle_domain(d) || (d->domain_id == 0 && opt_dom0_vcpus_pin) )
+    if ( is_idle_domain(d) )
+    {
+        /* Idle vCPUs are always pinned onto their respective pCPUs */
+        sched_set_affinity(unit, cpumask_of(processor), &cpumask_all);
+    }
+    else if ( pv_shim && v->vcpu_id == 0 )
+    {
+        /*
+         * PV-shim: vcpus are pinned 1:1. Initially only 1 cpu is online,
+         * others will be dealt with when onlining them. This avoids pinning
+         * a vcpu to a not yet online cpu here.
+         */
+        sched_set_affinity(unit, cpumask_of(0), cpumask_of(0));
+    }
+    else if ( d->domain_id == 0 && opt_dom0_vcpus_pin )
+    {
+        /*
+         * If dom0_vcpus_pin is specified, dom0 vCPUs are pinned 1:1 to
+         * their respective pCPUs too.
+         */
         sched_set_affinity(unit, cpumask_of(processor), &cpumask_all);
+    }
+#ifdef CONFIG_X86
+    else if ( d->domain_id == 0 )
+    {
+        /*
+         * In absence of dom0_vcpus_pin instead, the hard and soft affinity of
+         * dom0 is controlled by the (x86 only) dom0_nodes parameter. At this
+         * point it has been parsed and decoded into the dom0_cpus mask.
+         *
+         * Note that we always honor what user explicitly requested, for both
+         * hard and soft affinity, without doing any dynamic computation of
+         * either of them.
+         */
+        if ( !dom0_affinity_relaxed )
+            sched_set_affinity(unit, &dom0_cpus, &cpumask_all);
+        else
+            sched_set_affinity(unit, &cpumask_all, &dom0_cpus);
+    }
+#endif
     else
         sched_set_affinity(unit, &cpumask_all, &cpumask_all);
 
@@ -3402,29 +3436,10 @@ void wait(void)
 void __init sched_setup_dom0_vcpus(struct domain *d)
 {
     unsigned int i;
-    struct sched_unit *unit;
 
     for ( i = 1; i < d->max_vcpus; i++ )
         vcpu_create(d, i);
 
-    /*
-     * PV-shim: vcpus are pinned 1:1.
-     * Initially only 1 cpu is online, others will be dealt with when
-     * onlining them. This avoids pinning a vcpu to a not yet online cpu here.
-     */
-    if ( pv_shim )
-        sched_set_affinity(d->vcpu[0]->sched_unit,
-                           cpumask_of(0), cpumask_of(0));
-    else
-    {
-        for_each_sched_unit ( d, unit )
-        {
-            if ( !opt_dom0_vcpus_pin && !dom0_affinity_relaxed )
-                sched_set_affinity(unit, &dom0_cpus, NULL);
-            sched_set_affinity(unit, NULL, &dom0_cpus);
-        }
-    }
-
     domain_update_node_affinity(d);
 }
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 12 15:11:24 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 12 Aug 2022 15:11:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.385757.621487 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oMWJo-0005Os-8d; Fri, 12 Aug 2022 15:11:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 385757.621487; Fri, 12 Aug 2022 15:11:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oMWJo-0005Ol-64; Fri, 12 Aug 2022 15:11:24 +0000
Received: by outflank-mailman (input) for mailman id 385757;
 Fri, 12 Aug 2022 15:11:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMWJm-0005OQ-AO
 for xen-changelog@lists.xenproject.org; Fri, 12 Aug 2022 15:11:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMWJm-0004Uo-9d
 for xen-changelog@lists.xenproject.org; Fri, 12 Aug 2022 15:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMWJm-0006P5-8o
 for xen-changelog@lists.xenproject.org; Fri, 12 Aug 2022 15:11:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NZtcbPUCUdO+NXr330IblQYdp8NFG42sl4ePpQ5Z3Gw=; b=UUIY6H/s8elCBeBzy/CYrkqTL3
	0h5CuKnN0zSkb7lJWd+FedUnevL2zA/7hY0fckFSTohTgjzWD8pyFSGwwYlViWTtcg8iYmRO/mN0S
	uX6Ql08tyD3RWUvSuQf31XBSkEnIgnCfgWpxP7l3L0okHEKgR2RrzcHWLGoXwRrd0njs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/libxl: Replace deprecated -sdl option on QEMU command line
Message-Id: <E1oMWJm-0006P5-8o@xenbits.xenproject.org>
Date: Fri, 12 Aug 2022 15:11:22 +0000

commit 41fcb3af8ad6d4c9f65a9d72798e6d18afec55ac
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Thu Aug 11 11:47:11 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 11 11:47:11 2022 +0200

    tools/libxl: Replace deprecated -sdl option on QEMU command line
    
    "-sdl" is deprecated upstream since 6695e4c0fd9e ("softmmu/vl:
    Deprecate the -sdl and -curses option"), QEMU v6.2, and the option is
    removed by 707d93d4abc6 ("ui: Remove deprecated options "-sdl" and
    "-curses""), in upcoming QEMU v7.1.
    
    Instead, use "-display sdl", available since 1472a95bab1e ("Introduce
    -display argument"), before QEMU v1.0.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Jason Andryuk <jandryuk@gmail.com>
---
 tools/libs/light/libxl_dm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libs/light/libxl_dm.c b/tools/libs/light/libxl_dm.c
index 1864ee30f0..04bf5d8563 100644
--- a/tools/libs/light/libxl_dm.c
+++ b/tools/libs/light/libxl_dm.c
@@ -1349,7 +1349,7 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
     flexarray_append_pair(dm_args, "-display", "none");
 
     if (sdl && !is_stubdom) {
-        flexarray_append(dm_args, "-sdl");
+        flexarray_append_pair(dm_args, "-display", "sdl");
         if (sdl->display)
             flexarray_append_pair(dm_envs, "DISPLAY", sdl->display);
         if (sdl->xauthority)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 12 15:11:34 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 12 Aug 2022 15:11:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.385760.621491 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oMWJy-0005WP-AC; Fri, 12 Aug 2022 15:11:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 385760.621491; Fri, 12 Aug 2022 15: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 1oMWJy-0005WH-7V; Fri, 12 Aug 2022 15:11:34 +0000
Received: by outflank-mailman (input) for mailman id 385760;
 Fri, 12 Aug 2022 15:11:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMWJw-0005V4-DE
 for xen-changelog@lists.xenproject.org; Fri, 12 Aug 2022 15:11:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMWJw-0004Uz-CX
 for xen-changelog@lists.xenproject.org; Fri, 12 Aug 2022 15:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMWJw-0006PZ-Bm
 for xen-changelog@lists.xenproject.org; Fri, 12 Aug 2022 15:11:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=JIGvwLVQn57/iEdCgGzKCe105J35THeDXIgGVwf2PXc=; b=knRfTwUmuOrh4dWa4S2l+C10j5
	MUOiiVHSz8h/KumyViYdZ8E3qlEA+8WqpmhcMj8es3Tx/b1D6USY63lQKghIDvohqAoNwlXmoZFoG
	MdQZN+pFg2sBMmtsTEj+/QTzvieiADhNUw5GAJHV49XmaPv1aQhLYvBS1nmiPJtOgo5Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] arm/vgic: fix coding style in macro REG_RANK_INDEX()
Message-Id: <E1oMWJw-0006PZ-Bm@xenbits.xenproject.org>
Date: Fri, 12 Aug 2022 15:11:32 +0000

commit fc9e089ad2d4739336c7b2553a325c9b6c02c40d
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Thu Aug 11 11:47:34 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 11 11:47:34 2022 +0200

    arm/vgic: fix coding style in macro REG_RANK_INDEX()
    
    Add parentheses around the macro parameter 's' to prevent against unintended
    expansions. This, also, resolves a MISRA C 2012 Rule 20.7 violation warning.
    
    Add white spaces around the subtraction operator.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/arch/arm/include/asm/vgic.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/include/asm/vgic.h b/xen/arch/arm/include/asm/vgic.h
index d2a9fc7d83..3d44868039 100644
--- a/xen/arch/arm/include/asm/vgic.h
+++ b/xen/arch/arm/include/asm/vgic.h
@@ -286,7 +286,7 @@ static inline paddr_t vgic_dist_base(const struct vgic_dist *vgic)
  * Offset of GICD_<FOO><n> with its rank, for GICD_<FOO> size <s> with
  * <b>-bits-per-interrupt.
  */
-#define REG_RANK_INDEX(b, n, s) ((((n) >> s) & ((b)-1)) % 32)
+#define REG_RANK_INDEX(b, n, s) ((((n) >> (s)) & ((b) - 1)) % 32)
 
 
 extern struct vcpu *vgic_get_target_vcpu(struct vcpu *v, unsigned int virq);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 12 15:11:44 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 12 Aug 2022 15:11:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.385763.621495 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oMWK8-0005Zg-Bp; Fri, 12 Aug 2022 15:11:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 385763.621495; Fri, 12 Aug 2022 15:11:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oMWK8-0005ZY-92; Fri, 12 Aug 2022 15:11:44 +0000
Received: by outflank-mailman (input) for mailman id 385763;
 Fri, 12 Aug 2022 15:11:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMWK6-0005ZG-GA
 for xen-changelog@lists.xenproject.org; Fri, 12 Aug 2022 15:11:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMWK6-0004VC-FS
 for xen-changelog@lists.xenproject.org; Fri, 12 Aug 2022 15:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMWK6-0006Pz-Ef
 for xen-changelog@lists.xenproject.org; Fri, 12 Aug 2022 15:11:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=84bdClFfZHYV9X2X8Tzd9BaP8+y3UQjDRF6iT5rdizY=; b=lJ/N8BYw1vnyczhQvmNRBH1lw8
	PdlewWbJ0iyBc1p5nikZ6pyG6Ewn7tCdaUGPpBoOOsyAb1MLsLAvoSr3QN79HUQPowq/L2RM/me5E
	tL9cfUjwjbZVi6MIQv8Xwrt9WJZLUX5O4KqtMWMTRaAw9d+SlTcVucQBw+2zcT9eOFzU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] arm/gic: fix MISRA C 2012 Rule 20.7 violation
Message-Id: <E1oMWK6-0006Pz-Ef@xenbits.xenproject.org>
Date: Fri, 12 Aug 2022 15:11:42 +0000

commit 4a2217c97024ccaf92adb6a08f4d340a803af352
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Thu Aug 11 11:48:12 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 11 11:48:12 2022 +0200

    arm/gic: fix MISRA C 2012 Rule 20.7 violation
    
    In GIC_PRI_TO_GUEST(), add parentheses around the macro parameter 'pri' to
    prevent against unintended expansions and realign comment.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/include/asm/gic.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/include/asm/gic.h b/xen/arch/arm/include/asm/gic.h
index b3c6c67933..3692fae393 100644
--- a/xen/arch/arm/include/asm/gic.h
+++ b/xen/arch/arm/include/asm/gic.h
@@ -152,8 +152,8 @@
 #define GIC_PRI_IPI_ALL    ((GIC_PRI_IPI << 24) | (GIC_PRI_IPI << 16) |\
                             (GIC_PRI_IPI << 8) | GIC_PRI_IPI)
 
-#define GIC_PRI_TO_GUEST(pri) (pri >> 3) /* GICH_LR and GICH_VMCR only support
-                                            5 bits for guest irq priority */
+#define GIC_PRI_TO_GUEST(pri) ((pri) >> 3) /* GICH_LR and GICH_VMCR only support
+                                              5 bits for guest irq priority */
 
 #define GICH_LR_PENDING         1
 #define GICH_LR_ACTIVE          2
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 12 15:11:54 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 12 Aug 2022 15:11:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.385764.621499 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oMWKI-0005dF-EM; Fri, 12 Aug 2022 15:11:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 385764.621499; Fri, 12 Aug 2022 15: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 1oMWKI-0005d5-Bm; Fri, 12 Aug 2022 15:11:54 +0000
Received: by outflank-mailman (input) for mailman id 385764;
 Fri, 12 Aug 2022 15:11:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMWKG-0005cm-JQ
 for xen-changelog@lists.xenproject.org; Fri, 12 Aug 2022 15:11:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMWKG-0004VS-Ia
 for xen-changelog@lists.xenproject.org; Fri, 12 Aug 2022 15:11:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMWKG-0006QR-Hl
 for xen-changelog@lists.xenproject.org; Fri, 12 Aug 2022 15:11:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=uIs1/9+OTSzeBuGbLmjxy729/dLdZD8LiBEq+OJw9Es=; b=jq/uh9rQgeHfFD+qKa9pDNoTMF
	EA3domstJwPkCyKlvfzE1xUREMD8Je+4IsZbNHu10tT+SB025g6Q0kjXVovn6oRCEwX2COoSAvA+X
	WJWwnQmXe0DLus8q4NLISbYdJBtNu56d9m6vXfhODp/qs872I3ygzlSAfXGBa1uIqUs0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/spec-ctrl: Enumeration for PBRSB_NO
Message-Id: <E1oMWKG-0006QR-Hl@xenbits.xenproject.org>
Date: Fri, 12 Aug 2022 15:11:52 +0000

commit b874e47eb13feb75be3ee7b5dc4ae9c97d80d774
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jul 29 14:22:53 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Aug 11 16:19:50 2022 +0100

    x86/spec-ctrl: Enumeration for PBRSB_NO
    
    The PBRSB_NO bit indicates that the CPU is not vulnerable to the Post-Barrier
    RSB speculative vulnerability.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/msr-index.h | 1 +
 xen/arch/x86/msr.c                   | 5 +++--
 xen/arch/x86/spec_ctrl.c             | 3 ++-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/include/asm/msr-index.h b/xen/arch/x86/include/asm/msr-index.h
index 1a928ea6af..0a8852f3c2 100644
--- a/xen/arch/x86/include/asm/msr-index.h
+++ b/xen/arch/x86/include/asm/msr-index.h
@@ -84,6 +84,7 @@
 #define  ARCH_CAPS_FB_CLEAR_CTRL            (_AC(1, ULL) << 18)
 #define  ARCH_CAPS_RRSBA                    (_AC(1, ULL) << 19)
 #define  ARCH_CAPS_BHI_NO                   (_AC(1, ULL) << 20)
+#define  ARCH_CAPS_PBRSB_NO                 (_AC(1, ULL) << 24)
 
 #define MSR_FLUSH_CMD                       0x0000010b
 #define  FLUSH_CMD_L1D                      (_AC(1, ULL) <<  0)
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 170f041793..d2e2dc2a6b 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -74,7 +74,8 @@ static void __init calculate_host_policy(void)
          ARCH_CAPS_SKIP_L1DFL | ARCH_CAPS_SSB_NO | ARCH_CAPS_MDS_NO |
          ARCH_CAPS_IF_PSCHANGE_MC_NO | ARCH_CAPS_TSX_CTRL | ARCH_CAPS_TAA_NO |
          ARCH_CAPS_SBDR_SSDP_NO | ARCH_CAPS_FBSDP_NO | ARCH_CAPS_PSDP_NO |
-         ARCH_CAPS_FB_CLEAR | ARCH_CAPS_RRSBA | ARCH_CAPS_BHI_NO);
+         ARCH_CAPS_FB_CLEAR | ARCH_CAPS_RRSBA | ARCH_CAPS_BHI_NO |
+         ARCH_CAPS_PBRSB_NO);
 }
 
 static void __init calculate_pv_max_policy(void)
@@ -166,7 +167,7 @@ int init_domain_msr_policy(struct domain *d)
              ARCH_CAPS_SSB_NO | ARCH_CAPS_MDS_NO | ARCH_CAPS_IF_PSCHANGE_MC_NO |
              ARCH_CAPS_TAA_NO | ARCH_CAPS_SBDR_SSDP_NO | ARCH_CAPS_FBSDP_NO |
              ARCH_CAPS_PSDP_NO | ARCH_CAPS_FB_CLEAR | ARCH_CAPS_RRSBA |
-             ARCH_CAPS_BHI_NO);
+             ARCH_CAPS_BHI_NO | ARCH_CAPS_PBRSB_NO);
     }
 
     d->arch.msr = mp;
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index d2cd545973..160cc68086 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -419,7 +419,7 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
      * Hardware read-only information, stating immunity to certain issues, or
      * suggestions of which mitigation to use.
      */
-    printk("  Hardware hints:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
+    printk("  Hardware hints:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
            (caps & ARCH_CAPS_RDCL_NO)                        ? " RDCL_NO"        : "",
            (caps & ARCH_CAPS_IBRS_ALL)                       ? " IBRS_ALL"       : "",
            (caps & ARCH_CAPS_RSBA)                           ? " RSBA"           : "",
@@ -431,6 +431,7 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
            (caps & ARCH_CAPS_SBDR_SSDP_NO)                   ? " SBDR_SSDP_NO"   : "",
            (caps & ARCH_CAPS_FBSDP_NO)                       ? " FBSDP_NO"       : "",
            (caps & ARCH_CAPS_PSDP_NO)                        ? " PSDP_NO"        : "",
+           (caps & ARCH_CAPS_PBRSB_NO)                       ? " PBRSB_NO"       : "",
            (e8b  & cpufeat_mask(X86_FEATURE_IBRS_ALWAYS))    ? " IBRS_ALWAYS"    : "",
            (e8b  & cpufeat_mask(X86_FEATURE_STIBP_ALWAYS))   ? " STIBP_ALWAYS"   : "",
            (e8b  & cpufeat_mask(X86_FEATURE_IBRS_FAST))      ? " IBRS_FAST"      : "",
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 12 15:12:04 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 12 Aug 2022 15:12:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.385765.621503 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oMWKS-0005gN-G7; Fri, 12 Aug 2022 15:12:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 385765.621503; Fri, 12 Aug 2022 15: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 1oMWKS-0005gF-DK; Fri, 12 Aug 2022 15:12:04 +0000
Received: by outflank-mailman (input) for mailman id 385765;
 Fri, 12 Aug 2022 15:12:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMWKQ-0005fu-N0
 for xen-changelog@lists.xenproject.org; Fri, 12 Aug 2022 15:12:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMWKQ-0004W7-Lo
 for xen-changelog@lists.xenproject.org; Fri, 12 Aug 2022 15:12:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMWKQ-0006R2-Km
 for xen-changelog@lists.xenproject.org; Fri, 12 Aug 2022 15:12:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4W0eR39rZUT/v+lghVZ7knCIBMg9ukQqAMnZxjxT8Gk=; b=18KKYXsTVy/BYJzUvnKHpJ/scB
	kOEO59e2mC5oQL7F4VMz90yaAyWJBDSBV9A5fUfqUF6u4Cdah8prsf1adJqfE+0zTB6CpHJ/h97qp
	AuTNkba8mJgRm0mqs1Jz3RvMOfyoQ7cQE79023JVrviKyd4UJKPdscyu1qR4EKwisVrQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/amd: only call setup_force_cpu_cap for boot CPU
Message-Id: <E1oMWKQ-0006R2-Km@xenbits.xenproject.org>
Date: Fri, 12 Aug 2022 15:12:02 +0000

commit 31b41ce858c8bd5159212d40969f8e0b7124bbf0
Author:     Ross Lagerwall <ross.lagerwall@citrix.com>
AuthorDate: Thu Aug 11 17:44:26 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 11 17:44:26 2022 +0200

    x86/amd: only call setup_force_cpu_cap for boot CPU
    
    This should only be called for the boot CPU to avoid calling _init code
    after it has been unloaded.
    
    Fixes: 062868a5a8b4 ("x86/amd: Work around CLFLUSH ordering on older parts")
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/amd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/cpu/amd.c b/xen/arch/x86/cpu/amd.c
index 29c59bcba4..d5f8e5e899 100644
--- a/xen/arch/x86/cpu/amd.c
+++ b/xen/arch/x86/cpu/amd.c
@@ -845,7 +845,7 @@ static void cf_check init_amd(struct cpuinfo_x86 *c)
 	 * everything, including reads and writes to address, and
 	 * LFENCE/SFENCE instructions.
 	 */
-	if (!cpu_has_clflushopt)
+	if (c == &boot_cpu_data && !cpu_has_clflushopt)
 		setup_force_cpu_cap(X86_BUG_CLFLUSH_MFENCE);
 
 	switch(c->x86)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 12 15:12:14 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 12 Aug 2022 15:12:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.385766.621508 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oMWKc-0005jz-Hv; Fri, 12 Aug 2022 15:12:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 385766.621508; Fri, 12 Aug 2022 15: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 1oMWKc-0005jr-Ew; Fri, 12 Aug 2022 15:12:14 +0000
Received: by outflank-mailman (input) for mailman id 385766;
 Fri, 12 Aug 2022 15:12:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMWKa-0005jN-PQ
 for xen-changelog@lists.xenproject.org; Fri, 12 Aug 2022 15:12:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMWKa-0004WH-Oh
 for xen-changelog@lists.xenproject.org; Fri, 12 Aug 2022 15:12:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMWKa-0006RS-Nx
 for xen-changelog@lists.xenproject.org; Fri, 12 Aug 2022 15:12:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=C7/GMy67kZzHMpgUbAEHqsIAQzHY2abKn6RzfrPspUI=; b=yARnPRyb/q3UEy07Y4uQ/joCj5
	otZWuBq5o4eGP2iywblQG/CJTprhcLqPK1+3xengGOSoSG/E6knLJlDd1QU/VoxXPpuSMKeaZ4D1P
	F2pdMAkI4WRgrHBptX3uAQbtiveRlvmKw+LwN0r4Kw3PDxS0chSVQLTjEI8zgCwk9bLs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] build/x86: suppress GNU ld 2.39 warning about RWX load segments
Message-Id: <E1oMWKa-0006RS-Nx@xenbits.xenproject.org>
Date: Fri, 12 Aug 2022 15:12:12 +0000

commit 3eb1865ae305772b558757904d81951e31de43de
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Aug 11 17:45:12 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 11 17:45:12 2022 +0200

    build/x86: suppress GNU ld 2.39 warning about RWX load segments
    
    Commit 68f5aac012b9 ("build: suppress future GNU ld warning about RWX
    load segments") didn't quite cover all the cases: Apparently I missed
    ones in the building of 32-bit helper objects because of only looking at
    incremental builds (where those wouldn't normally be re-built). Clone
    the workaround there to the specific Makefile in question.
    
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/boot/Makefile | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xen/arch/x86/boot/Makefile b/xen/arch/x86/boot/Makefile
index a5dd094836..1fb0ca02e8 100644
--- a/xen/arch/x86/boot/Makefile
+++ b/xen/arch/x86/boot/Makefile
@@ -24,6 +24,9 @@ CFLAGS_x86_32 += -I$(srctree)/include
 $(head-srcs:.S=.o): CFLAGS_stack_boundary :=
 $(head-srcs:.S=.o): XEN_CFLAGS := $(CFLAGS_x86_32) -fpic
 
+LDFLAGS_DIRECT-$(call ld-option,--warn-rwx-segments) := --no-warn-rwx-segments
+LDFLAGS_DIRECT += $(LDFLAGS_DIRECT-y)
+
 $(head-srcs): %.S: %.bin
 	(od -v -t x $< | tr -s ' ' | awk 'NR > 1 {print s} {s=$$0}' | \
 	sed 's/ /,0x/g' | sed 's/,0x$$//' | sed 's/^[0-9]*,/ .long /') >$@
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 12 17:55:10 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 12 Aug 2022 17:55:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.385830.621587 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oMYsD-0007aP-Nz; Fri, 12 Aug 2022 17:55:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 385830.621587; Fri, 12 Aug 2022 17:55:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oMYsD-0007aH-KT; Fri, 12 Aug 2022 17:55:05 +0000
Received: by outflank-mailman (input) for mailman id 385830;
 Fri, 12 Aug 2022 17:55:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMYsD-0007aB-16
 for xen-changelog@lists.xenproject.org; Fri, 12 Aug 2022 17:55:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMYsC-0007me-Up
 for xen-changelog@lists.xenproject.org; Fri, 12 Aug 2022 17:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMYsC-0002YU-Tn
 for xen-changelog@lists.xenproject.org; Fri, 12 Aug 2022 17:55:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3jh97knmVriEct7F1BfnDBcjailfjc+x+lm6g4u+ktM=; b=LGlSfo0h5mJzKpy1woNT/L9Hi8
	MGaL/ETH57LZpzlUSVM9EA9gj84wvkFy/ng6N6Vgi7YdK0WvNRHPCEUkF787C2Vygs6BYW9h2Uzxe
	jlBOohD52NcIc/VZj0uknFNCjJDcf9K9t9Vzaecz80drSn9j2xvkwhbhvo5XqjDkbWes=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/build: Don't convert boot/{cmdline,head}.bin back to .S
Message-Id: <E1oMYsC-0002YU-Tn@xenbits.xenproject.org>
Date: Fri, 12 Aug 2022 17:55:04 +0000

commit 1ab7c128d9d16db5081501bf9786bdcf6e72b5e6
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Apr 14 10:33:05 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 12 18:48:34 2022 +0100

    x86/build: Don't convert boot/{cmdline,head}.bin back to .S
    
    There's no point wasting time converting binaries back to asm source.  Just
    use .incbin directly.  Explain in head.S what these binaries are.
    
    Also, explicitly align the blobs.  They contain 4-byte objects, and happen to
    be 4-byte aligned currently because of the position of `lret` and the size of
    cmdline.S but this is incredibly fragile.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/boot/Makefile | 12 +++---------
 xen/arch/x86/boot/head.S   | 10 ++++++++--
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/xen/arch/x86/boot/Makefile b/xen/arch/x86/boot/Makefile
index 1fb0ca02e8..672df50810 100644
--- a/xen/arch/x86/boot/Makefile
+++ b/xen/arch/x86/boot/Makefile
@@ -7,10 +7,8 @@ targets += $(head-srcs:.S=.o)
 
 head-srcs := $(addprefix $(obj)/, $(head-srcs))
 
-ifdef building_out_of_srctree
-$(obj)/head.o: CFLAGS-y += -iquote $(obj)
-endif
-$(obj)/head.o: $(head-srcs)
+$(obj)/head.o: AFLAGS-y += -Wa$(comma)-I$(obj)
+$(obj)/head.o: $(head-srcs:.S=.bin)
 
 CFLAGS_x86_32 := $(subst -m64,-m32 -march=i686,$(XEN_TREEWIDE_CFLAGS))
 $(call cc-options-add,CFLAGS_x86_32,CC,$(EMBEDDED_EXTRA_CFLAGS))
@@ -27,14 +25,10 @@ $(head-srcs:.S=.o): XEN_CFLAGS := $(CFLAGS_x86_32) -fpic
 LDFLAGS_DIRECT-$(call ld-option,--warn-rwx-segments) := --no-warn-rwx-segments
 LDFLAGS_DIRECT += $(LDFLAGS_DIRECT-y)
 
-$(head-srcs): %.S: %.bin
-	(od -v -t x $< | tr -s ' ' | awk 'NR > 1 {print s} {s=$$0}' | \
-	sed 's/ /,0x/g' | sed 's/,0x$$//' | sed 's/^[0-9]*,/ .long /') >$@
-
 %.bin: %.lnk
 	$(OBJCOPY) -j .text -O binary $< $@
 
 %.lnk: %.o $(src)/build32.lds
 	$(LD) $(subst x86_64,i386,$(LDFLAGS_DIRECT)) -N -T $(filter %.lds,$^) -o $@ $<
 
-clean-files := cmdline.S reloc.S *.lnk *.bin
+clean-files := *.lnk *.bin
diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index 3db47197b8..0fb7dd3029 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -777,11 +777,17 @@ trampoline_setup:
         /* Jump into the relocated trampoline. */
         lret
 
+        /*
+         * cmdline and reloc are written in C, and linked to be 32bit PIC with
+         * entrypoints at 0 and using the stdcall convention.
+         */
+        ALIGN
 cmdline_parse_early:
-#include "cmdline.S"
+        .incbin "cmdline.bin"
 
+        ALIGN
 reloc:
-#include "reloc.S"
+        .incbin "reloc.bin"
 
 ENTRY(trampoline_start)
 #include "trampoline.S"
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 12 17:55:15 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 12 Aug 2022 17:55:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.385831.621590 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oMYsN-0007cI-Ob; Fri, 12 Aug 2022 17:55:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 385831.621590; Fri, 12 Aug 2022 17: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 1oMYsN-0007c9-Lz; Fri, 12 Aug 2022 17:55:15 +0000
Received: by outflank-mailman (input) for mailman id 385831;
 Fri, 12 Aug 2022 17:55:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMYsN-0007c0-2R
 for xen-changelog@lists.xenproject.org; Fri, 12 Aug 2022 17:55:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMYsN-0007mu-1e
 for xen-changelog@lists.xenproject.org; Fri, 12 Aug 2022 17:55:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMYsN-0002Yy-0f
 for xen-changelog@lists.xenproject.org; Fri, 12 Aug 2022 17:55:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=2dXiDQO3EOxvNy4GswqGlV/YE7ph2I9UtS14DWit0Ak=; b=ScFi/Ys9SgbW/8hZNsTC/Pl7cQ
	FvlxcLIIqovvd1PZ6REn+yNNBr3pqVjSAsxUMkoa4OXZiRO8+HgqpZH2Mg4felm/doXhFu2oQoBi0
	YCIxHHXz+jIBvEBu94KbDl/tDiF7ECpnymyXAPoABIaXpFqaGgz5i8487nSeP9IBotd0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/build: Clean up boot/Makefile
Message-Id: <E1oMYsN-0002Yy-0f@xenbits.xenproject.org>
Date: Fri, 12 Aug 2022 17:55:15 +0000

commit 3dc26edbb5417d90d32df6aa70d7c4187dd9966e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Apr 14 11:47:47 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 12 18:48:39 2022 +0100

    x86/build: Clean up boot/Makefile
    
    There are no .S intermediate files, so rework in terms of head-bin-objs.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
---
 xen/arch/x86/boot/Makefile | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/boot/Makefile b/xen/arch/x86/boot/Makefile
index 672df50810..d6bc8fc084 100644
--- a/xen/arch/x86/boot/Makefile
+++ b/xen/arch/x86/boot/Makefile
@@ -1,14 +1,15 @@
 obj-bin-y += head.o
-head-srcs := cmdline.S reloc.S
 
-nocov-y += $(head-srcs:.S=.o)
-noubsan-y += $(head-srcs:.S=.o)
-targets += $(head-srcs:.S=.o)
+head-bin-objs := cmdline.o reloc.o
 
-head-srcs := $(addprefix $(obj)/, $(head-srcs))
+nocov-y   += $(head-bin-objs)
+noubsan-y += $(head-bin-objs)
+targets   += $(head-bin-objs)
+
+head-bin-objs := $(addprefix $(obj)/,$(head-bin-objs))
 
 $(obj)/head.o: AFLAGS-y += -Wa$(comma)-I$(obj)
-$(obj)/head.o: $(head-srcs:.S=.bin)
+$(obj)/head.o: $(head-bin-objs:.o=.bin)
 
 CFLAGS_x86_32 := $(subst -m64,-m32 -march=i686,$(XEN_TREEWIDE_CFLAGS))
 $(call cc-options-add,CFLAGS_x86_32,CC,$(EMBEDDED_EXTRA_CFLAGS))
@@ -19,8 +20,8 @@ endif
 CFLAGS_x86_32 += -I$(srctree)/include
 
 # override for 32bit binaries
-$(head-srcs:.S=.o): CFLAGS_stack_boundary :=
-$(head-srcs:.S=.o): XEN_CFLAGS := $(CFLAGS_x86_32) -fpic
+$(head-bin-objs): CFLAGS_stack_boundary :=
+$(head-bin-objs): XEN_CFLAGS := $(CFLAGS_x86_32) -fpic
 
 LDFLAGS_DIRECT-$(call ld-option,--warn-rwx-segments) := --no-warn-rwx-segments
 LDFLAGS_DIRECT += $(LDFLAGS_DIRECT-y)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sat Aug 13 03:44:07 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 13 Aug 2022 03:44:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.386179.622067 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oMi4A-00065W-N5; Sat, 13 Aug 2022 03:44:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 386179.622067; Sat, 13 Aug 2022 03:44:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oMi4A-00065O-K4; Sat, 13 Aug 2022 03:44:02 +0000
Received: by outflank-mailman (input) for mailman id 386179;
 Sat, 13 Aug 2022 03:44:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMi49-00065I-E0
 for xen-changelog@lists.xenproject.org; Sat, 13 Aug 2022 03:44:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMi49-0000bb-DC
 for xen-changelog@lists.xenproject.org; Sat, 13 Aug 2022 03:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMi49-0005AG-CO
 for xen-changelog@lists.xenproject.org; Sat, 13 Aug 2022 03:44:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NmtfcydzgkSYLUBLzvaXYoAXfLMH0Nh2XYJFWrW3jtU=; b=zzn1Rh4m6gJjeUGBp0m24WOvOg
	fi7qlXAaMRoTvZnqVD3J8agTBjfvAH9xgi1og4H4jhjtwRCsfjEHaWvGQxDHjZKx+hYXnSjXjwuQT
	WcqdJ4cAlSWOHXNBqwYw5+peaKccMUvNvZ8oqy8eD7nOPQv0zPBStw+BAfuJ5PGZgtjg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] PCI: simplify (and thus correct) pci_get_pdev{,_by_domain}()
Message-Id: <E1oMi49-0005AG-CO@xenbits.xenproject.org>
Date: Sat, 13 Aug 2022 03:44:01 +0000

commit 8cf6e0738906fc269af40135ed82a07815dd3b9c
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Aug 12 08:34:33 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Aug 12 08:34:33 2022 +0200

    PCI: simplify (and thus correct) pci_get_pdev{,_by_domain}()
    
    The last "wildcard" use of either function went away with f591755823a7
    ("IOMMU/PCI: don't let domain cleanup continue when device de-assignment
    failed"). Don't allow them to be called this way anymore. Besides
    simplifying the code this also fixes two bugs:
    
    1) When seg != -1, the outer loops should have been terminated after the
       first iteration, or else a device with the same BDF but on another
       segment could be found / returned.
    
    Reported-by: Rahul Singh <rahul.singh@arm.com>
    
    2) When seg == -1 calling get_pseg() is bogus. The function (taking a
       u16) would look for segment 0xffff, which might exist. If it exists,
       we might then find / return a wrong device.
    
    In pci_get_pdev_by_domain() also switch from using the per-segment list
    to using the per-domain one, with the exception of the hardware domain
    (see the code comment there).
    
    While there also constify "pseg" and drop "pdev"'s already previously
    unnecessary initializer.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Rahul Singh <rahul.singh@arm.com>
    Tested-by: Rahul Singh <rahul.singh@arm.com>
---
 xen/drivers/passthrough/pci.c | 61 ++++++++++++++++++-------------------------
 xen/include/xen/pci.h         |  6 ++---
 2 files changed, 29 insertions(+), 38 deletions(-)

diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index 938821e593..085cd82941 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -576,30 +576,19 @@ int __init pci_ro_device(int seg, int bus, int devfn)
     return 0;
 }
 
-struct pci_dev *pci_get_pdev(int seg, int bus, int devfn)
+struct pci_dev *pci_get_pdev(uint16_t seg, uint8_t bus, uint8_t devfn)
 {
-    struct pci_seg *pseg = get_pseg(seg);
-    struct pci_dev *pdev = NULL;
+    const struct pci_seg *pseg = get_pseg(seg);
+    struct pci_dev *pdev;
 
     ASSERT(pcidevs_locked());
-    ASSERT(seg != -1 || bus == -1);
-    ASSERT(bus != -1 || devfn == -1);
 
     if ( !pseg )
-    {
-        if ( seg == -1 )
-            radix_tree_gang_lookup(&pci_segments, (void **)&pseg, 0, 1);
-        if ( !pseg )
-            return NULL;
-    }
+        return NULL;
 
-    do {
-        list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
-            if ( (pdev->bus == bus || bus == -1) &&
-                 (pdev->devfn == devfn || devfn == -1) )
-                return pdev;
-    } while ( radix_tree_gang_lookup(&pci_segments, (void **)&pseg,
-                                     pseg->nr + 1, 1) );
+    list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
+        if ( pdev->bus == bus && pdev->devfn == devfn )
+            return pdev;
 
     return NULL;
 }
@@ -625,31 +614,33 @@ struct pci_dev *pci_get_real_pdev(int seg, int bus, int devfn)
     return pdev;
 }
 
-struct pci_dev *pci_get_pdev_by_domain(const struct domain *d, int seg,
-                                       int bus, int devfn)
+struct pci_dev *pci_get_pdev_by_domain(const struct domain *d, uint16_t seg,
+                                       uint8_t bus, uint8_t devfn)
 {
-    struct pci_seg *pseg = get_pseg(seg);
-    struct pci_dev *pdev = NULL;
-
-    ASSERT(seg != -1 || bus == -1);
-    ASSERT(bus != -1 || devfn == -1);
+    struct pci_dev *pdev;
 
-    if ( !pseg )
+    /*
+     * The hardware domain owns the majority of the devices in the system.
+     * When there are multiple segments, traversing the per-segment list is
+     * likely going to be faster, whereas for a single segment the difference
+     * shouldn't be that large.
+     */
+    if ( is_hardware_domain(d) )
     {
-        if ( seg == -1 )
-            radix_tree_gang_lookup(&pci_segments, (void **)&pseg, 0, 1);
+        const struct pci_seg *pseg = get_pseg(seg);
+
         if ( !pseg )
             return NULL;
-    }
 
-    do {
         list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
-            if ( (pdev->bus == bus || bus == -1) &&
-                 (pdev->devfn == devfn || devfn == -1) &&
-                 (pdev->domain == d) )
+            if ( pdev->bus == bus && pdev->devfn == devfn &&
+                 pdev->domain == d )
+                return pdev;
+    }
+    else
+        list_for_each_entry ( pdev, &d->pdev_list, domain_list )
+            if ( pdev->bus == bus && pdev->devfn == devfn )
                 return pdev;
-    } while ( radix_tree_gang_lookup(&pci_segments, (void **)&pseg,
-                                     pseg->nr + 1, 1) );
 
     return NULL;
 }
diff --git a/xen/include/xen/pci.h b/xen/include/xen/pci.h
index f34368643c..0eaa5f3938 100644
--- a/xen/include/xen/pci.h
+++ b/xen/include/xen/pci.h
@@ -177,10 +177,10 @@ int pci_add_device(u16 seg, u8 bus, u8 devfn,
 int pci_remove_device(u16 seg, u8 bus, u8 devfn);
 int pci_ro_device(int seg, int bus, int devfn);
 int pci_hide_device(unsigned int seg, unsigned int bus, unsigned int devfn);
-struct pci_dev *pci_get_pdev(int seg, int bus, int devfn);
+struct pci_dev *pci_get_pdev(uint16_t seg, uint8_t bus, uint8_t devfn);
 struct pci_dev *pci_get_real_pdev(int seg, int bus, int devfn);
-struct pci_dev *pci_get_pdev_by_domain(const struct domain *, int seg,
-                                       int bus, int devfn);
+struct pci_dev *pci_get_pdev_by_domain(const struct domain *, uint16_t seg,
+                                       uint8_t bus, uint8_t devfn);
 void pci_check_disable_device(u16 seg, u8 bus, u8 devfn);
 
 uint8_t pci_conf_read8(pci_sbdf_t sbdf, unsigned int reg);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 13 03:44:12 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 13 Aug 2022 03:44:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.386180.622071 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oMi4K-00067k-Or; Sat, 13 Aug 2022 03:44:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 386180.622071; Sat, 13 Aug 2022 03: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 1oMi4K-00067d-Lm; Sat, 13 Aug 2022 03:44:12 +0000
Received: by outflank-mailman (input) for mailman id 386180;
 Sat, 13 Aug 2022 03:44:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMi4J-00067O-I0
 for xen-changelog@lists.xenproject.org; Sat, 13 Aug 2022 03:44:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMi4J-0000c9-HC
 for xen-changelog@lists.xenproject.org; Sat, 13 Aug 2022 03:44:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMi4J-0005Af-Fk
 for xen-changelog@lists.xenproject.org; Sat, 13 Aug 2022 03:44:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=itrTMk0CsvC+NNVmBruS2QW5J04Nl4fcaUEsQ7nDAmk=; b=ZMCe33HbxX7tgw7cARM4sujFSn
	Q3A0hvy56CbxKlNYUF1unSWLKa1c4o2rXEDcdfxaRtHV2zNaohGfdudadXWRyeFOe8W3rG2wLwcvT
	HsPeOeEF5L++9RFO3gUHVBZY8GTlQy6JjICqVEG336ZLjsxnuEw7uS/cJV7SZZTyNgao=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] PCI: fold pci_get_pdev{,_by_domain}()
Message-Id: <E1oMi4J-0005Af-Fk@xenbits.xenproject.org>
Date: Sat, 13 Aug 2022 03:44:11 +0000

commit a37f9ea7a651fd798397a3db6dbf7939feeb43a8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Aug 12 08:37:09 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Aug 12 08:37:09 2022 +0200

    PCI: fold pci_get_pdev{,_by_domain}()
    
    Rename the latter, subsuming the functionality of the former when passed
    NULL as first argument.
    
    Since this requires touching all call sites anyway, take the opportunity
    and fold the remaining three parameters into a single pci_sbdf_t one.
    
    No functional change intended. In particular the locking related
    assertion needs to continue to be kept silent when a non-NULL domain
    pointer is passed - both vpci_read() and vpci_write() call the function
    without holding the lock (adding respective locking to vPCI [or finding
    an alternative to doing so] is the topic of a separate series).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Rahul Singh <rahul.singh@arm.com>
    Tested-by: Rahul Singh <rahul.singh@arm.com>
---
 xen/arch/x86/irq.c                       |  2 +-
 xen/arch/x86/msi.c                       |  9 +++---
 xen/arch/x86/pci.c                       |  2 +-
 xen/arch/x86/physdev.c                   |  5 ++--
 xen/common/sysctl.c                      |  2 +-
 xen/drivers/passthrough/amd/iommu_init.c |  5 ++--
 xen/drivers/passthrough/amd/iommu_map.c  |  2 +-
 xen/drivers/passthrough/pci.c            | 49 ++++++++++++--------------------
 xen/drivers/passthrough/vtd/quirks.c     |  2 +-
 xen/drivers/video/vga.c                  |  2 +-
 xen/drivers/vpci/vpci.c                  |  4 +--
 xen/include/xen/pci.h                    |  4 +--
 12 files changed, 37 insertions(+), 51 deletions(-)

diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c
index fea901bfb1..bf8b52d111 100644
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -2162,7 +2162,7 @@ int map_domain_pirq(
         if ( !cpu_has_apic )
             goto done;
 
-        pdev = pci_get_pdev_by_domain(d, msi->seg, msi->bus, msi->devfn);
+        pdev = pci_get_pdev(d, PCI_SBDF(msi->seg, msi->bus, msi->devfn));
         if ( !pdev )
             goto done;
 
diff --git a/xen/arch/x86/msi.c b/xen/arch/x86/msi.c
index 6be81e6c3b..62c4fbcfbe 100644
--- a/xen/arch/x86/msi.c
+++ b/xen/arch/x86/msi.c
@@ -683,7 +683,8 @@ static u64 read_pci_mem_bar(u16 seg, u8 bus, u8 slot, u8 func, u8 bir, int vf)
 
     if ( vf >= 0 )
     {
-        struct pci_dev *pdev = pci_get_pdev(seg, bus, PCI_DEVFN(slot, func));
+        struct pci_dev *pdev = pci_get_pdev(NULL,
+                                            PCI_SBDF(seg, bus, slot, func));
         unsigned int pos = pci_find_ext_capability(seg, bus,
                                                    PCI_DEVFN(slot, func),
                                                    PCI_EXT_CAP_ID_SRIOV);
@@ -1000,7 +1001,7 @@ static int __pci_enable_msi(struct msi_info *msi, struct msi_desc **desc)
     struct msi_desc *old_desc;
 
     ASSERT(pcidevs_locked());
-    pdev = pci_get_pdev(msi->seg, msi->bus, msi->devfn);
+    pdev = pci_get_pdev(NULL, PCI_SBDF(msi->seg, msi->bus, msi->devfn));
     if ( !pdev )
         return -ENODEV;
 
@@ -1055,7 +1056,7 @@ static int __pci_enable_msix(struct msi_info *msi, struct msi_desc **desc)
     struct msi_desc *old_desc;
 
     ASSERT(pcidevs_locked());
-    pdev = pci_get_pdev(msi->seg, msi->bus, msi->devfn);
+    pdev = pci_get_pdev(NULL, PCI_SBDF(msi->seg, msi->bus, msi->devfn));
     if ( !pdev || !pdev->msix )
         return -ENODEV;
 
@@ -1146,7 +1147,7 @@ int pci_prepare_msix(u16 seg, u8 bus, u8 devfn, bool off)
         return 0;
 
     pcidevs_lock();
-    pdev = pci_get_pdev(seg, bus, devfn);
+    pdev = pci_get_pdev(NULL, PCI_SBDF(seg, bus, devfn));
     if ( !pdev )
         rc = -ENODEV;
     else if ( pdev->msix->used_entries != !!off )
diff --git a/xen/arch/x86/pci.c b/xen/arch/x86/pci.c
index 9a2354e887..97b792e578 100644
--- a/xen/arch/x86/pci.c
+++ b/xen/arch/x86/pci.c
@@ -90,7 +90,7 @@ int pci_conf_write_intercept(unsigned int seg, unsigned int bdf,
 
     pcidevs_lock();
 
-    pdev = pci_get_pdev(seg, PCI_BUS(bdf), PCI_DEVFN(bdf));
+    pdev = pci_get_pdev(NULL, PCI_SBDF(seg, bdf));
     if ( pdev )
         rc = pci_msi_conf_write_intercept(pdev, reg, size, data);
 
diff --git a/xen/arch/x86/physdev.c b/xen/arch/x86/physdev.c
index 3837926728..3a50d9d0c9 100644
--- a/xen/arch/x86/physdev.c
+++ b/xen/arch/x86/physdev.c
@@ -531,7 +531,8 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
             break;
 
         pcidevs_lock();
-        pdev = pci_get_pdev(0, restore_msi.bus, restore_msi.devfn);
+        pdev = pci_get_pdev(NULL,
+                            PCI_SBDF(0, restore_msi.bus, restore_msi.devfn));
         ret = pdev ? pci_restore_msi_state(pdev) : -ENODEV;
         pcidevs_unlock();
         break;
@@ -546,7 +547,7 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
             break;
 
         pcidevs_lock();
-        pdev = pci_get_pdev(dev.seg, dev.bus, dev.devfn);
+        pdev = pci_get_pdev(NULL, PCI_SBDF(dev.seg, dev.bus, dev.devfn));
         ret = pdev ? pci_restore_msi_state(pdev) : -ENODEV;
         pcidevs_unlock();
         break;
diff --git a/xen/common/sysctl.c b/xen/common/sysctl.c
index 1ad3c29351..02505ab044 100644
--- a/xen/common/sysctl.c
+++ b/xen/common/sysctl.c
@@ -447,7 +447,7 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl)
             }
 
             pcidevs_lock();
-            pdev = pci_get_pdev(dev.seg, dev.bus, dev.devfn);
+            pdev = pci_get_pdev(NULL, PCI_SBDF(dev.seg, dev.bus, dev.devfn));
             if ( !pdev )
                 node = XEN_INVALID_DEV;
             else if ( pdev->node == NUMA_NO_NODE )
diff --git a/xen/drivers/passthrough/amd/iommu_init.c b/xen/drivers/passthrough/amd/iommu_init.c
index e2166f534f..14f8af7ea8 100644
--- a/xen/drivers/passthrough/amd/iommu_init.c
+++ b/xen/drivers/passthrough/amd/iommu_init.c
@@ -748,8 +748,7 @@ static bool_t __init set_iommu_interrupt_handler(struct amd_iommu *iommu)
     }
 
     pcidevs_lock();
-    iommu->msi.dev = pci_get_pdev(iommu->seg, PCI_BUS(iommu->bdf),
-                                  PCI_DEVFN(iommu->bdf));
+    iommu->msi.dev = pci_get_pdev(NULL, PCI_SBDF(iommu->seg, iommu->bdf));
     pcidevs_unlock();
     if ( !iommu->msi.dev )
     {
@@ -1286,7 +1285,7 @@ static int __init cf_check amd_iommu_setup_device_table(
                 if ( !pci_init )
                     continue;
                 pcidevs_lock();
-                pdev = pci_get_pdev(seg, PCI_BUS(bdf), PCI_DEVFN(bdf));
+                pdev = pci_get_pdev(NULL, PCI_SBDF(seg, bdf));
                 pcidevs_unlock();
             }
 
diff --git a/xen/drivers/passthrough/amd/iommu_map.c b/xen/drivers/passthrough/amd/iommu_map.c
index f2157e0043..993bac6f88 100644
--- a/xen/drivers/passthrough/amd/iommu_map.c
+++ b/xen/drivers/passthrough/amd/iommu_map.c
@@ -727,7 +727,7 @@ int cf_check amd_iommu_get_reserved_device_memory(
             const struct pci_dev *pdev;
 
             pcidevs_lock();
-            pdev = pci_get_pdev(seg, sbdf.bus, sbdf.devfn);
+            pdev = pci_get_pdev(NULL, sbdf);
             pcidevs_unlock();
 
             if ( pdev )
diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index 085cd82941..0722f8d571 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -576,23 +576,6 @@ int __init pci_ro_device(int seg, int bus, int devfn)
     return 0;
 }
 
-struct pci_dev *pci_get_pdev(uint16_t seg, uint8_t bus, uint8_t devfn)
-{
-    const struct pci_seg *pseg = get_pseg(seg);
-    struct pci_dev *pdev;
-
-    ASSERT(pcidevs_locked());
-
-    if ( !pseg )
-        return NULL;
-
-    list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
-        if ( pdev->bus == bus && pdev->devfn == devfn )
-            return pdev;
-
-    return NULL;
-}
-
 struct pci_dev *pci_get_real_pdev(int seg, int bus, int devfn)
 {
     struct pci_dev *pdev;
@@ -601,12 +584,12 @@ struct pci_dev *pci_get_real_pdev(int seg, int bus, int devfn)
     if ( seg < 0 || bus < 0 || devfn < 0 )
         return NULL;
 
-    for ( pdev = pci_get_pdev(seg, bus, devfn), stride = 4;
+    for ( pdev = pci_get_pdev(NULL, PCI_SBDF(seg, bus, devfn)), stride = 4;
           !pdev && stride; stride >>= 1 )
     {
         if ( !(devfn & (8 - stride)) )
             continue;
-        pdev = pci_get_pdev(seg, bus, devfn & ~(8 - stride));
+        pdev = pci_get_pdev(NULL, PCI_SBDF(seg, bus, devfn & ~(8 - stride)));
         if ( pdev && stride != pdev->phantom_stride )
             pdev = NULL;
     }
@@ -614,32 +597,33 @@ struct pci_dev *pci_get_real_pdev(int seg, int bus, int devfn)
     return pdev;
 }
 
-struct pci_dev *pci_get_pdev_by_domain(const struct domain *d, uint16_t seg,
-                                       uint8_t bus, uint8_t devfn)
+struct pci_dev *pci_get_pdev(const struct domain *d, pci_sbdf_t sbdf)
 {
     struct pci_dev *pdev;
 
+    ASSERT(d || pcidevs_locked());
+
     /*
      * The hardware domain owns the majority of the devices in the system.
      * When there are multiple segments, traversing the per-segment list is
      * likely going to be faster, whereas for a single segment the difference
      * shouldn't be that large.
      */
-    if ( is_hardware_domain(d) )
+    if ( !d || is_hardware_domain(d) )
     {
-        const struct pci_seg *pseg = get_pseg(seg);
+        const struct pci_seg *pseg = get_pseg(sbdf.seg);
 
         if ( !pseg )
             return NULL;
 
         list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
-            if ( pdev->bus == bus && pdev->devfn == devfn &&
-                 pdev->domain == d )
+            if ( pdev->sbdf.bdf == sbdf.bdf &&
+                 (!d || pdev->domain == d) )
                 return pdev;
     }
     else
         list_for_each_entry ( pdev, &d->pdev_list, domain_list )
-            if ( pdev->bus == bus && pdev->devfn == devfn )
+            if ( pdev->sbdf.bdf == sbdf.bdf )
                 return pdev;
 
     return NULL;
@@ -746,7 +730,9 @@ int pci_add_device(u16 seg, u8 bus, u8 devfn,
     else if ( info->is_virtfn )
     {
         pcidevs_lock();
-        pdev = pci_get_pdev(seg, info->physfn.bus, info->physfn.devfn);
+        pdev = pci_get_pdev(NULL,
+                            PCI_SBDF(seg, info->physfn.bus,
+                                     info->physfn.devfn));
         if ( pdev )
             pf_is_extfn = pdev->info.is_extfn;
         pcidevs_unlock();
@@ -924,7 +910,7 @@ static int deassign_device(struct domain *d, uint16_t seg, uint8_t bus,
         return -EINVAL;
 
     ASSERT(pcidevs_locked());
-    pdev = pci_get_pdev_by_domain(d, seg, bus, devfn);
+    pdev = pci_get_pdev(d, PCI_SBDF(seg, bus, devfn));
     if ( !pdev )
         return -ENODEV;
 
@@ -1201,7 +1187,8 @@ static int __hwdom_init cf_check _setup_hwdom_pci_devices(
     {
         for ( devfn = 0; devfn < 256; devfn++ )
         {
-            struct pci_dev *pdev = pci_get_pdev(pseg->nr, bus, devfn);
+            struct pci_dev *pdev = pci_get_pdev(NULL,
+                                                PCI_SBDF(pseg->nr, bus, devfn));
 
             if ( !pdev )
                 continue;
@@ -1475,7 +1462,7 @@ static int device_assigned(u16 seg, u8 bus, u8 devfn)
     int rc = 0;
 
     ASSERT(pcidevs_locked());
-    pdev = pci_get_pdev(seg, bus, devfn);
+    pdev = pci_get_pdev(NULL, PCI_SBDF(seg, bus, devfn));
 
     if ( !pdev )
         rc = -ENODEV;
@@ -1506,7 +1493,7 @@ static int assign_device(struct domain *d, u16 seg, u8 bus, u8 devfn, u32 flag)
 
     /* device_assigned() should already have cleared the device for assignment */
     ASSERT(pcidevs_locked());
-    pdev = pci_get_pdev(seg, bus, devfn);
+    pdev = pci_get_pdev(NULL, PCI_SBDF(seg, bus, devfn));
     ASSERT(pdev && (pdev->domain == hardware_domain ||
                     pdev->domain == dom_io));
 
diff --git a/xen/drivers/passthrough/vtd/quirks.c b/xen/drivers/passthrough/vtd/quirks.c
index 603ad41d5b..fcc8f73e8b 100644
--- a/xen/drivers/passthrough/vtd/quirks.c
+++ b/xen/drivers/passthrough/vtd/quirks.c
@@ -417,7 +417,7 @@ static int __must_check map_me_phantom_function(struct domain *domain,
     int rc;
 
     /* find ME VT-d engine base on a real ME device */
-    pdev = pci_get_pdev(0, 0, PCI_DEVFN(dev, 0));
+    pdev = pci_get_pdev(NULL, PCI_SBDF(0, 0, dev, 0));
     drhd = acpi_find_matched_drhd_unit(pdev);
 
     /* map or unmap ME phantom function */
diff --git a/xen/drivers/video/vga.c b/xen/drivers/video/vga.c
index d993e68d31..29a88e8241 100644
--- a/xen/drivers/video/vga.c
+++ b/xen/drivers/video/vga.c
@@ -118,7 +118,7 @@ void __init video_endboot(void)
                 u8 b = bus, df = devfn, sb;
 
                 pcidevs_lock();
-                pdev = pci_get_pdev(0, bus, devfn);
+                pdev = pci_get_pdev(NULL, PCI_SBDF(0, bus, devfn));
                 pcidevs_unlock();
 
                 if ( !pdev ||
diff --git a/xen/drivers/vpci/vpci.c b/xen/drivers/vpci/vpci.c
index 9fb3c05b2b..3467c0de86 100644
--- a/xen/drivers/vpci/vpci.c
+++ b/xen/drivers/vpci/vpci.c
@@ -325,7 +325,7 @@ uint32_t vpci_read(pci_sbdf_t sbdf, unsigned int reg, unsigned int size)
     }
 
     /* Find the PCI dev matching the address. */
-    pdev = pci_get_pdev_by_domain(d, sbdf.seg, sbdf.bus, sbdf.devfn);
+    pdev = pci_get_pdev(d, sbdf);
     if ( !pdev )
         return vpci_read_hw(sbdf, reg, size);
 
@@ -435,7 +435,7 @@ void vpci_write(pci_sbdf_t sbdf, unsigned int reg, unsigned int size,
      * Find the PCI dev matching the address.
      * Passthrough everything that's not trapped.
      */
-    pdev = pci_get_pdev_by_domain(d, sbdf.seg, sbdf.bus, sbdf.devfn);
+    pdev = pci_get_pdev(d, sbdf);
     if ( !pdev )
     {
         vpci_write_hw(sbdf, reg, size, data);
diff --git a/xen/include/xen/pci.h b/xen/include/xen/pci.h
index 0eaa5f3938..30fead8f7e 100644
--- a/xen/include/xen/pci.h
+++ b/xen/include/xen/pci.h
@@ -177,10 +177,8 @@ int pci_add_device(u16 seg, u8 bus, u8 devfn,
 int pci_remove_device(u16 seg, u8 bus, u8 devfn);
 int pci_ro_device(int seg, int bus, int devfn);
 int pci_hide_device(unsigned int seg, unsigned int bus, unsigned int devfn);
-struct pci_dev *pci_get_pdev(uint16_t seg, uint8_t bus, uint8_t devfn);
+struct pci_dev *pci_get_pdev(const struct domain *d, pci_sbdf_t sbdf);
 struct pci_dev *pci_get_real_pdev(int seg, int bus, int devfn);
-struct pci_dev *pci_get_pdev_by_domain(const struct domain *, uint16_t seg,
-                                       uint8_t bus, uint8_t devfn);
 void pci_check_disable_device(u16 seg, u8 bus, u8 devfn);
 
 uint8_t pci_conf_read8(pci_sbdf_t sbdf, unsigned int reg);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 13 03:44:22 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 13 Aug 2022 03:44:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.386181.622075 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oMi4U-0006B2-SV; Sat, 13 Aug 2022 03:44:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 386181.622075; Sat, 13 Aug 2022 03:44:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oMi4U-0006Au-Pp; Sat, 13 Aug 2022 03:44:22 +0000
Received: by outflank-mailman (input) for mailman id 386181;
 Sat, 13 Aug 2022 03:44:21 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMi4T-0006Ai-LR
 for xen-changelog@lists.xenproject.org; Sat, 13 Aug 2022 03:44:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMi4T-0000cU-Kj
 for xen-changelog@lists.xenproject.org; Sat, 13 Aug 2022 03:44:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMi4T-0005Ci-Jh
 for xen-changelog@lists.xenproject.org; Sat, 13 Aug 2022 03:44:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Ny+AmFHE7DGKMB6XYdntll0jFJQN0v96/G2+CyPQcKo=; b=5Lj1AlNNE4JFXFakhYCLTQzPf0
	bjPigqP6mRvvizZ9M65NSHZw8cCxSKGhuw23CP1Ul7Lt/XcQM9S9md8vzXpZOy8kGrBVep4qD7c4Z
	M4SRtrN6AM55CupDABwJyM5ANqu+102ebSeYy16VcikSUU2tx2a1Sy1zEnyarjoL1FIA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] PCI: bring pci_get_real_pdev() in line with pci_get_pdev()
Message-Id: <E1oMi4T-0005Ci-Jh@xenbits.xenproject.org>
Date: Sat, 13 Aug 2022 03:44:21 +0000

commit f5234f36335618c31963df260704524366f9bb95
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Aug 12 08:37:50 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Aug 12 08:37:50 2022 +0200

    PCI: bring pci_get_real_pdev() in line with pci_get_pdev()
    
    Fold the three parameters into a single pci_sbdf_t one.
    
    No functional change intended, despite the "(8 - stride)" ->
    "stride" replacement (not really sure why it was written the more
    complicated way originally).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Rahul Singh <rahul.singh@arm.com>
    Tested-by: Rahul Singh <rahul.singh@arm.com>
---
 xen/drivers/passthrough/amd/iommu_init.c |  3 +--
 xen/drivers/passthrough/pci.c            | 14 ++++++--------
 xen/include/xen/pci.h                    |  2 +-
 3 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/xen/drivers/passthrough/amd/iommu_init.c b/xen/drivers/passthrough/amd/iommu_init.c
index 14f8af7ea8..1f14aaf49e 100644
--- a/xen/drivers/passthrough/amd/iommu_init.c
+++ b/xen/drivers/passthrough/amd/iommu_init.c
@@ -639,8 +639,7 @@ static void cf_check parse_ppr_log_entry(struct amd_iommu *iommu, u32 entry[])
     struct pci_dev *pdev;
 
     pcidevs_lock();
-    pdev = pci_get_real_pdev(iommu->seg, PCI_BUS(device_id),
-                             PCI_DEVFN(device_id));
+    pdev = pci_get_real_pdev(PCI_SBDF(iommu->seg, device_id));
     pcidevs_unlock();
 
     if ( pdev )
diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index 0722f8d571..cdaf5c247f 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -576,20 +576,18 @@ int __init pci_ro_device(int seg, int bus, int devfn)
     return 0;
 }
 
-struct pci_dev *pci_get_real_pdev(int seg, int bus, int devfn)
+struct pci_dev *pci_get_real_pdev(pci_sbdf_t sbdf)
 {
     struct pci_dev *pdev;
     int stride;
 
-    if ( seg < 0 || bus < 0 || devfn < 0 )
-        return NULL;
-
-    for ( pdev = pci_get_pdev(NULL, PCI_SBDF(seg, bus, devfn)), stride = 4;
+    for ( pdev = pci_get_pdev(NULL, sbdf), stride = 4;
           !pdev && stride; stride >>= 1 )
     {
-        if ( !(devfn & (8 - stride)) )
+        if ( !(sbdf.devfn & stride) )
             continue;
-        pdev = pci_get_pdev(NULL, PCI_SBDF(seg, bus, devfn & ~(8 - stride)));
+        sbdf.devfn &= ~stride;
+        pdev = pci_get_pdev(NULL, sbdf);
         if ( pdev && stride != pdev->phantom_stride )
             pdev = NULL;
     }
@@ -1074,7 +1072,7 @@ void pci_check_disable_device(u16 seg, u8 bus, u8 devfn)
     u16 cword;
 
     pcidevs_lock();
-    pdev = pci_get_real_pdev(seg, bus, devfn);
+    pdev = pci_get_real_pdev(PCI_SBDF(seg, bus, devfn));
     if ( pdev )
     {
         if ( now < pdev->fault.time ||
diff --git a/xen/include/xen/pci.h b/xen/include/xen/pci.h
index 30fead8f7e..5975ca2f30 100644
--- a/xen/include/xen/pci.h
+++ b/xen/include/xen/pci.h
@@ -178,7 +178,7 @@ int pci_remove_device(u16 seg, u8 bus, u8 devfn);
 int pci_ro_device(int seg, int bus, int devfn);
 int pci_hide_device(unsigned int seg, unsigned int bus, unsigned int devfn);
 struct pci_dev *pci_get_pdev(const struct domain *d, pci_sbdf_t sbdf);
-struct pci_dev *pci_get_real_pdev(int seg, int bus, int devfn);
+struct pci_dev *pci_get_real_pdev(pci_sbdf_t sbdf);
 void pci_check_disable_device(u16 seg, u8 bus, u8 devfn);
 
 uint8_t pci_conf_read8(pci_sbdf_t sbdf, unsigned int reg);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 13 03:44:32 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 13 Aug 2022 03:44:32 +0000
Received: from list by lists.xenproject.org with outflank-mailman.386182.622081 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oMi4e-0006E7-V7; Sat, 13 Aug 2022 03:44:32 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 386182.622081; Sat, 13 Aug 2022 03:44:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oMi4e-0006Dx-RO; Sat, 13 Aug 2022 03:44:32 +0000
Received: by outflank-mailman (input) for mailman id 386182;
 Sat, 13 Aug 2022 03:44:31 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMi4d-0006Dp-P2
 for xen-changelog@lists.xenproject.org; Sat, 13 Aug 2022 03:44:31 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMi4d-0000ce-OI
 for xen-changelog@lists.xenproject.org; Sat, 13 Aug 2022 03:44:31 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMi4d-0005DC-Ml
 for xen-changelog@lists.xenproject.org; Sat, 13 Aug 2022 03:44:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ARv6rF3iTB4WF1RReb559Ckz/eI3JlAwNOP2d/FsY7o=; b=eeWU7AmnnsaJWKYpgOMPYTQZM3
	jQuD7DQwwk53WhDCCmfFNfcANrENEDvxk4pyoSeqAGZ7VUbNV2zSqkMLfV0udPYRW7AZBoAW1alv4
	oDwd4nYj2eN08O23iw0GzC98zBKnUI0COzWUOdSkma8xNvvmMd1daIxsUMj5eH6L9wKw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] config/x86: tidy {Free,Open}BSD LDFLAGS_DIRECT handling
Message-Id: <E1oMi4d-0005DC-Ml@xenbits.xenproject.org>
Date: Sat, 13 Aug 2022 03:44:31 +0000

commit 0c614af4a73b77baf1d711c68b8ee0278d7a97a6
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Aug 12 08:54:33 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Aug 12 08:54:33 2022 +0200

    config/x86: tidy {Free,Open}BSD LDFLAGS_DIRECT handling
    
    It's not clear why for x86-64 a different approach was used than the
    (shorter) one x86-32 has been using. Move the setting to the respective
    OS files and reuse x86-32's approach for x86-64, while at the same time
    using an OS-independent variable name (thus avoiding the indirection
    through $(XEN_OS)).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 config/FreeBSD.mk |  2 ++
 config/OpenBSD.mk |  2 ++
 config/x86_32.mk  |  4 +---
 config/x86_64.mk  | 10 +---------
 4 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/config/FreeBSD.mk b/config/FreeBSD.mk
index 98a5117e60..0062902b25 100644
--- a/config/FreeBSD.mk
+++ b/config/FreeBSD.mk
@@ -1,5 +1,7 @@
 include $(XEN_ROOT)/config/StdGNU.mk
 
+XEN_ELF_SUB_FLAVOR = _fbsd
+
 # No wget on FreeBSD base system
 WGET = ftp
 PKG_INSTALLDIR = ${prefix}/libdata/pkgconfig
diff --git a/config/OpenBSD.mk b/config/OpenBSD.mk
index b421a1c840..6a6bf304f0 100644
--- a/config/OpenBSD.mk
+++ b/config/OpenBSD.mk
@@ -1 +1,3 @@
 include $(XEN_ROOT)/config/StdGNU.mk
+
+XEN_ELF_SUB_FLAVOR = _obsd
diff --git a/config/x86_32.mk b/config/x86_32.mk
index 29d13f7773..bc96ff013d 100644
--- a/config/x86_32.mk
+++ b/config/x86_32.mk
@@ -8,8 +8,6 @@ CONFIG_XCUTILS := y
 CFLAGS += -m32 -march=i686
 
 # Use only if calling $(LD) directly.
-LDFLAGS_DIRECT_OpenBSD = _obsd
-LDFLAGS_DIRECT_FreeBSD = _fbsd
-LDFLAGS_DIRECT += -melf_i386$(LDFLAGS_DIRECT_$(XEN_OS))
+LDFLAGS_DIRECT += -melf_i386$(XEN_ELF_SUB_FLAVOR)
 
 IOEMU_CPU_ARCH ?= i386
diff --git a/config/x86_64.mk b/config/x86_64.mk
index 85fa27ca69..4afef44141 100644
--- a/config/x86_64.mk
+++ b/config/x86_64.mk
@@ -14,14 +14,6 @@ SunOS_LIBDIR = $(SunOS_LIBDIR_x86_64)
 EFI_DIR ?= /usr/lib64/efi
 
 # Use only if calling $(LD) directly.
-ifeq ($(XEN_OS),OpenBSD)
-LDFLAGS_DIRECT += -melf_x86_64_obsd
-else
-ifeq ($(XEN_OS),FreeBSD)
-LDFLAGS_DIRECT += -melf_x86_64_fbsd
-else
-LDFLAGS_DIRECT += -melf_x86_64
-endif
-endif
+LDFLAGS_DIRECT += -melf_x86_64$(XEN_ELF_SUB_FLAVOR)
 
 IOEMU_CPU_ARCH ?= x86_64
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 13 12:55:09 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 13 Aug 2022 12:55:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.386295.622228 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oMqfP-00040V-01; Sat, 13 Aug 2022 12:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 386295.622228; Sat, 13 Aug 2022 12:55:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oMqfO-00040N-Sx; Sat, 13 Aug 2022 12:55:02 +0000
Received: by outflank-mailman (input) for mailman id 386295;
 Sat, 13 Aug 2022 12:55:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMqfN-00040H-Jf
 for xen-changelog@lists.xenproject.org; Sat, 13 Aug 2022 12:55:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMqfN-0002fn-H2
 for xen-changelog@lists.xenproject.org; Sat, 13 Aug 2022 12:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMqfN-00056g-G1
 for xen-changelog@lists.xenproject.org; Sat, 13 Aug 2022 12:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PTpUAnmOVfEn5q3qa6o8CPCe2QdPduSNXGLuNZn/zSI=; b=3RwdSEH1HvGziXIs8p09mpH5/k
	34y8O2ReX5E0GKseq8H4p0kiR9Hj9uUy6o8/Tk0z/WCecxx24Knd/lXV31CnUA/fHRDWM3OzOYbIZ
	ojIdPHDiIGN+rwkoQ1F2RlS8dtMQUX4gTUUnPyRn1xMUwvT+wCgeAKmgx1H3mHRRyE/0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/msi: Switch msi_info to using pci_sbdf_t
Message-Id: <E1oMqfN-00056g-G1@xenbits.xenproject.org>
Date: Sat, 13 Aug 2022 12:55:01 +0000

commit 1af4e0189f4ef65cb43d79440d71867aad6d3d44
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Aug 11 17:12:22 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 12 13:25:40 2022 +0100

    x86/msi: Switch msi_info to using pci_sbdf_t
    
    This reorders the fields in msi_info, but removes all the under-the-hood
    parameter shuffling required to call pci_get_pdev().
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/vmsi.c        |  4 +---
 xen/arch/x86/include/asm/msi.h |  4 +---
 xen/arch/x86/irq.c             |  2 +-
 xen/arch/x86/msi.c             |  4 ++--
 xen/arch/x86/physdev.c         | 10 +++++-----
 xen/drivers/char/ns16550.c     |  4 ++--
 xen/xsm/flask/hooks.c          |  2 +-
 7 files changed, 13 insertions(+), 17 deletions(-)

diff --git a/xen/arch/x86/hvm/vmsi.c b/xen/arch/x86/hvm/vmsi.c
index 198fbd6708..75f92885dc 100644
--- a/xen/arch/x86/hvm/vmsi.c
+++ b/xen/arch/x86/hvm/vmsi.c
@@ -750,9 +750,7 @@ static int vpci_msi_enable(const struct pci_dev *pdev, unsigned int nr,
                            paddr_t table_base)
 {
     struct msi_info msi_info = {
-        .seg = pdev->seg,
-        .bus = pdev->bus,
-        .devfn = pdev->devfn,
+        .sbdf = pdev->sbdf,
         .table_base = table_base,
         .entry_nr = nr,
     };
diff --git a/xen/arch/x86/include/asm/msi.h b/xen/arch/x86/include/asm/msi.h
index 117379318f..fe670895ee 100644
--- a/xen/arch/x86/include/asm/msi.h
+++ b/xen/arch/x86/include/asm/msi.h
@@ -59,9 +59,7 @@
 #define FIX_MSIX_MAX_PAGES              512
 
 struct msi_info {
-    u16 seg;
-    u8 bus;
-    u8 devfn;
+    pci_sbdf_t sbdf;
     int irq;
     int entry_nr;
     uint64_t table_base;
diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c
index bf8b52d111..cd0c8a30a8 100644
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -2162,7 +2162,7 @@ int map_domain_pirq(
         if ( !cpu_has_apic )
             goto done;
 
-        pdev = pci_get_pdev(d, PCI_SBDF(msi->seg, msi->bus, msi->devfn));
+        pdev = pci_get_pdev(d, msi->sbdf);
         if ( !pdev )
             goto done;
 
diff --git a/xen/arch/x86/msi.c b/xen/arch/x86/msi.c
index 62c4fbcfbe..d0bf63df1d 100644
--- a/xen/arch/x86/msi.c
+++ b/xen/arch/x86/msi.c
@@ -1001,7 +1001,7 @@ static int __pci_enable_msi(struct msi_info *msi, struct msi_desc **desc)
     struct msi_desc *old_desc;
 
     ASSERT(pcidevs_locked());
-    pdev = pci_get_pdev(NULL, PCI_SBDF(msi->seg, msi->bus, msi->devfn));
+    pdev = pci_get_pdev(NULL, msi->sbdf);
     if ( !pdev )
         return -ENODEV;
 
@@ -1056,7 +1056,7 @@ static int __pci_enable_msix(struct msi_info *msi, struct msi_desc **desc)
     struct msi_desc *old_desc;
 
     ASSERT(pcidevs_locked());
-    pdev = pci_get_pdev(NULL, PCI_SBDF(msi->seg, msi->bus, msi->devfn));
+    pdev = pci_get_pdev(NULL, msi->sbdf);
     if ( !pdev || !pdev->msix )
         return -ENODEV;
 
diff --git a/xen/arch/x86/physdev.c b/xen/arch/x86/physdev.c
index 3a50d9d0c9..2f1d955a96 100644
--- a/xen/arch/x86/physdev.c
+++ b/xen/arch/x86/physdev.c
@@ -312,21 +312,21 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
         {
         case MAP_PIRQ_TYPE_MSI_SEG:
             map.type = MAP_PIRQ_TYPE_MSI;
-            msi.seg = map.bus >> 16;
+            msi.sbdf.seg = map.bus >> 16;
             break;
 
         case MAP_PIRQ_TYPE_MULTI_MSI:
             if ( map.table_base )
                 return -EINVAL;
-            msi.seg = map.bus >> 16;
+            msi.sbdf.seg = map.bus >> 16;
             break;
 
         default:
-            msi.seg = 0;
+            msi.sbdf.seg = 0;
             break;
         }
-        msi.bus = map.bus;
-        msi.devfn = map.devfn;
+        msi.sbdf.bus = map.bus;
+        msi.sbdf.devfn = map.devfn;
         msi.entry_nr = map.entry_nr;
         msi.table_base = map.table_base;
         ret = physdev_map_pirq(map.domid, map.type, &map.index, &map.pirq,
diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c
index cd3573e43d..01a05c9aa8 100644
--- a/xen/drivers/char/ns16550.c
+++ b/xen/drivers/char/ns16550.c
@@ -435,8 +435,8 @@ static void __init cf_check ns16550_init_postirq(struct serial_port *port)
         if ( uart->msi )
         {
             struct msi_info msi = {
-                .bus = uart->ps_bdf[0],
-                .devfn = PCI_DEVFN(uart->ps_bdf[1], uart->ps_bdf[2]),
+                .sbdf = PCI_SBDF(0, uart->ps_bdf[0], uart->ps_bdf[1],
+                                 uart->ps_bdf[2]),
                 .irq = rc = uart->irq,
                 .entry_nr = 1
             };
diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
index 8c9cd0f297..8bd56644ef 100644
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -918,7 +918,7 @@ static int flask_map_domain_msi (
 {
 #ifdef CONFIG_HAS_PCI_MSI
     const struct msi_info *msi = data;
-    uint32_t machine_bdf = (msi->seg << 16) | (msi->bus << 8) | msi->devfn;
+    uint32_t machine_bdf = msi->sbdf.sbdf;
 
     AVC_AUDIT_DATA_INIT(ad, DEV);
     ad->device = machine_bdf;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 13 12:55:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 13 Aug 2022 12:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.386296.622230 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oMqfZ-000428-0u; Sat, 13 Aug 2022 12:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 386296.622230; Sat, 13 Aug 2022 12:55:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oMqfY-000421-Ui; Sat, 13 Aug 2022 12:55:12 +0000
Received: by outflank-mailman (input) for mailman id 386296;
 Sat, 13 Aug 2022 12:55:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMqfX-00041p-Nd
 for xen-changelog@lists.xenproject.org; Sat, 13 Aug 2022 12:55:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMqfX-0002gS-M4
 for xen-changelog@lists.xenproject.org; Sat, 13 Aug 2022 12:55:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMqfX-000575-JG
 for xen-changelog@lists.xenproject.org; Sat, 13 Aug 2022 12:55:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=qpH1SQ5tqCFxc72jEPWi2io+8rHoGZymQvF45FTlD7s=; b=ZFEjzUQfrkVdxVXxGVLlLiRgPd
	/T/YH8V4IUJLfsv8N4XlnCXZ92G+b6Ti685Wk3pYlTdF83wxp0fkibDX/rm0UKhWEPUS++SkII04D
	GvLSBm8PkOihWKwBcFMYuJrncYgwqUGMXEcQEu2DnZ35TYPI1T7ubFQg3IGYqnEQFTxQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/build: Don't convert boot/{cmdline,head}.bin back to .S
Message-Id: <E1oMqfX-000575-JG@xenbits.xenproject.org>
Date: Sat, 13 Aug 2022 12:55:11 +0000

commit 1ab7c128d9d16db5081501bf9786bdcf6e72b5e6
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Apr 14 10:33:05 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 12 18:48:34 2022 +0100

    x86/build: Don't convert boot/{cmdline,head}.bin back to .S
    
    There's no point wasting time converting binaries back to asm source.  Just
    use .incbin directly.  Explain in head.S what these binaries are.
    
    Also, explicitly align the blobs.  They contain 4-byte objects, and happen to
    be 4-byte aligned currently because of the position of `lret` and the size of
    cmdline.S but this is incredibly fragile.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/boot/Makefile | 12 +++---------
 xen/arch/x86/boot/head.S   | 10 ++++++++--
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/xen/arch/x86/boot/Makefile b/xen/arch/x86/boot/Makefile
index 1fb0ca02e8..672df50810 100644
--- a/xen/arch/x86/boot/Makefile
+++ b/xen/arch/x86/boot/Makefile
@@ -7,10 +7,8 @@ targets += $(head-srcs:.S=.o)
 
 head-srcs := $(addprefix $(obj)/, $(head-srcs))
 
-ifdef building_out_of_srctree
-$(obj)/head.o: CFLAGS-y += -iquote $(obj)
-endif
-$(obj)/head.o: $(head-srcs)
+$(obj)/head.o: AFLAGS-y += -Wa$(comma)-I$(obj)
+$(obj)/head.o: $(head-srcs:.S=.bin)
 
 CFLAGS_x86_32 := $(subst -m64,-m32 -march=i686,$(XEN_TREEWIDE_CFLAGS))
 $(call cc-options-add,CFLAGS_x86_32,CC,$(EMBEDDED_EXTRA_CFLAGS))
@@ -27,14 +25,10 @@ $(head-srcs:.S=.o): XEN_CFLAGS := $(CFLAGS_x86_32) -fpic
 LDFLAGS_DIRECT-$(call ld-option,--warn-rwx-segments) := --no-warn-rwx-segments
 LDFLAGS_DIRECT += $(LDFLAGS_DIRECT-y)
 
-$(head-srcs): %.S: %.bin
-	(od -v -t x $< | tr -s ' ' | awk 'NR > 1 {print s} {s=$$0}' | \
-	sed 's/ /,0x/g' | sed 's/,0x$$//' | sed 's/^[0-9]*,/ .long /') >$@
-
 %.bin: %.lnk
 	$(OBJCOPY) -j .text -O binary $< $@
 
 %.lnk: %.o $(src)/build32.lds
 	$(LD) $(subst x86_64,i386,$(LDFLAGS_DIRECT)) -N -T $(filter %.lds,$^) -o $@ $<
 
-clean-files := cmdline.S reloc.S *.lnk *.bin
+clean-files := *.lnk *.bin
diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index 3db47197b8..0fb7dd3029 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -777,11 +777,17 @@ trampoline_setup:
         /* Jump into the relocated trampoline. */
         lret
 
+        /*
+         * cmdline and reloc are written in C, and linked to be 32bit PIC with
+         * entrypoints at 0 and using the stdcall convention.
+         */
+        ALIGN
 cmdline_parse_early:
-#include "cmdline.S"
+        .incbin "cmdline.bin"
 
+        ALIGN
 reloc:
-#include "reloc.S"
+        .incbin "reloc.bin"
 
 ENTRY(trampoline_start)
 #include "trampoline.S"
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 13 12:55:23 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 13 Aug 2022 12:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.386297.622234 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oMqfj-000450-2R; Sat, 13 Aug 2022 12:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 386297.622234; Sat, 13 Aug 2022 12:55:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oMqfi-00044s-WF; Sat, 13 Aug 2022 12:55:23 +0000
Received: by outflank-mailman (input) for mailman id 386297;
 Sat, 13 Aug 2022 12:55:21 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMqfh-00044I-Pl
 for xen-changelog@lists.xenproject.org; Sat, 13 Aug 2022 12:55:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMqfh-0002gl-P1
 for xen-changelog@lists.xenproject.org; Sat, 13 Aug 2022 12:55:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oMqfh-00057W-O0
 for xen-changelog@lists.xenproject.org; Sat, 13 Aug 2022 12:55:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=h90kcA1z0V9xoPRLD9o/HrTCAn7FgV7HolFC13n6CYo=; b=Xx6TUp8sZMgr4letp43K1PDU07
	2ZZp9Rz7X1VO5oGKZAE8yib5fOqqCgHxrF3ZEI6auqM3hJGKTqKTjn8hmDSt9dkuqEF/mdx4xdYvq
	75W/21WS+3kVm8rMCcioi5SBHtqz8ha2Q9JEU7nyXQr1pvVXHhAvObVrNhJN7jtSftEE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/build: Clean up boot/Makefile
Message-Id: <E1oMqfh-00057W-O0@xenbits.xenproject.org>
Date: Sat, 13 Aug 2022 12:55:21 +0000

commit 3dc26edbb5417d90d32df6aa70d7c4187dd9966e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Apr 14 11:47:47 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 12 18:48:39 2022 +0100

    x86/build: Clean up boot/Makefile
    
    There are no .S intermediate files, so rework in terms of head-bin-objs.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
---
 xen/arch/x86/boot/Makefile | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/boot/Makefile b/xen/arch/x86/boot/Makefile
index 672df50810..d6bc8fc084 100644
--- a/xen/arch/x86/boot/Makefile
+++ b/xen/arch/x86/boot/Makefile
@@ -1,14 +1,15 @@
 obj-bin-y += head.o
-head-srcs := cmdline.S reloc.S
 
-nocov-y += $(head-srcs:.S=.o)
-noubsan-y += $(head-srcs:.S=.o)
-targets += $(head-srcs:.S=.o)
+head-bin-objs := cmdline.o reloc.o
 
-head-srcs := $(addprefix $(obj)/, $(head-srcs))
+nocov-y   += $(head-bin-objs)
+noubsan-y += $(head-bin-objs)
+targets   += $(head-bin-objs)
+
+head-bin-objs := $(addprefix $(obj)/,$(head-bin-objs))
 
 $(obj)/head.o: AFLAGS-y += -Wa$(comma)-I$(obj)
-$(obj)/head.o: $(head-srcs:.S=.bin)
+$(obj)/head.o: $(head-bin-objs:.o=.bin)
 
 CFLAGS_x86_32 := $(subst -m64,-m32 -march=i686,$(XEN_TREEWIDE_CFLAGS))
 $(call cc-options-add,CFLAGS_x86_32,CC,$(EMBEDDED_EXTRA_CFLAGS))
@@ -19,8 +20,8 @@ endif
 CFLAGS_x86_32 += -I$(srctree)/include
 
 # override for 32bit binaries
-$(head-srcs:.S=.o): CFLAGS_stack_boundary :=
-$(head-srcs:.S=.o): XEN_CFLAGS := $(CFLAGS_x86_32) -fpic
+$(head-bin-objs): CFLAGS_stack_boundary :=
+$(head-bin-objs): XEN_CFLAGS := $(CFLAGS_x86_32) -fpic
 
 LDFLAGS_DIRECT-$(call ld-option,--warn-rwx-segments) := --no-warn-rwx-segments
 LDFLAGS_DIRECT += $(LDFLAGS_DIRECT-y)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Aug 15 07:00:12 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Aug 2022 07:00:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387048.623109 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNU51-0007xb-3x; Mon, 15 Aug 2022 07:00:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387048.623109; Mon, 15 Aug 2022 07: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 1oNU51-0007xS-0A; Mon, 15 Aug 2022 07:00:07 +0000
Received: by outflank-mailman (input) for mailman id 387048;
 Mon, 15 Aug 2022 07:00:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNU4z-0007sw-1p
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 07:00:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNU4z-0006S5-05
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 07:00:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNU4y-0002w7-VP
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 07:00:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ibjT0iJPaFqm9w14YZ1gXH3kWPnElLcaDb8Zldb51lo=; b=VRSg4gSkJ5ueqbACPeAfN0jMIn
	sNIWzri9xn8yLkaTvDoOHAw05z0baILfVH1nS1PgonFdUPHgu4l1t2n2Jk0Yb55NpqIVQERvvAOgs
	CMzb4bxwedyhxrisTeBrKha6aT1f8k9prw2+UlxQr51ETQp7Ni8/PAm9hWvc99mtQ9TU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/mm: re-arrange type check around _get_page_type()'s TLB flush
Message-Id: <E1oNU4y-0002w7-VP@xenbits.xenproject.org>
Date: Mon, 15 Aug 2022 07:00:04 +0000

commit 8eb15275cd5d945acbc0f70a358255dea94117cf
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Aug 15 08:53:11 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 08:53:11 2022 +0200

    x86/mm: re-arrange type check around _get_page_type()'s TLB flush
    
    Checks dependent on only d and x can be pulled out, thus allowing to
    skip the flush mask calculation.
    
    (Also-)Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/mm.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 40e132b9ba..db1817b691 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -3020,7 +3020,10 @@ static int _get_page_type(struct page_info *page, unsigned long type,
         if ( d && shadow_mode_enabled(d) )
             shadow_prepare_page_type_change(d, page);
 
-        if ( (x & PGT_type_mask) != type )
+        if ( (x & PGT_type_mask) != type &&
+             /* Shadow mode: track only writable pages. */
+             (!shadow_mode_enabled(d) ||
+              ((x & PGT_type_mask) == PGT_writable_page)) )
         {
             /*
              * On type change we check to flush stale TLB entries. It is
@@ -3035,10 +3038,7 @@ static int _get_page_type(struct page_info *page, unsigned long type,
             /* Don't flush if the timestamp is old enough */
             tlbflush_filter(mask, page->tlbflush_timestamp);
 
-            if ( unlikely(!cpumask_empty(mask)) &&
-                 /* Shadow mode: track only writable pages. */
-                 (!shadow_mode_enabled(d) ||
-                  ((x & PGT_type_mask) == PGT_writable_page)) )
+            if ( unlikely(!cpumask_empty(mask)) )
             {
                 perfc_incr(need_flush_tlb_flush);
                 /*
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Aug 15 07:00:16 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Aug 2022 07:00:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387049.623111 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNU5A-0007zS-4J; Mon, 15 Aug 2022 07:00:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387049.623111; Mon, 15 Aug 2022 07: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 1oNU5A-0007zL-1n; Mon, 15 Aug 2022 07:00:16 +0000
Received: by outflank-mailman (input) for mailman id 387049;
 Mon, 15 Aug 2022 07:00:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNU59-0007zC-3s
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 07:00:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNU59-0006SE-33
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 07:00:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNU59-0003yV-2G
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 07:00:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=N51XTYgDGyHeXoSEA9PL0w6CfOIqpZD0+ABYElUFVJQ=; b=1rfigqK/iDwwRKoJVd5S/d7SjT
	dG+L6eugAT8Fhmtf2LfKMztVrjFYnuFhHuUX1OprKULm8kL1MyisZlV0UQtgLSmjFNfQBqhLo3c4I
	VFTi9/qVxUKR3uq0wS306iYPapk2CZTuFAiA62tbNRg0queCKD7Ro5FXi2yo8RWPLLF8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/firmware/hvmloader: rework Makefile
Message-Id: <E1oNU59-0003yV-2G@xenbits.xenproject.org>
Date: Mon, 15 Aug 2022 07:00:15 +0000

commit f4caaef48e4e6d894d2d4831ea66445c976f0138
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Mon Aug 15 08:55:14 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 08:55:14 2022 +0200

    tools/firmware/hvmloader: rework Makefile
    
    Setup proper dependencies with libacpi so we don't need to run "make
    hvmloader" in the "all" target. ("build.o" new prerequisite isn't
    exactly proper but a side effect of building the $(DSDT_FILES) is to
    generate the "ssdt_*.h" needed by "build.o".)
    
    Make use if "-iquote" instead of a plain "-I".
    
    For "roms.inc" target, use "$(SHELL)" instead of plain "sh". And use
    full path to "mkhex" instead of a relative one. Lastly, add "-f" flag
    to "mv" to avoid a prompt in case the target already exist and we
    don't have write permission.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 tools/firmware/hvmloader/Makefile | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/tools/firmware/hvmloader/Makefile b/tools/firmware/hvmloader/Makefile
index b754220839..4f31c88161 100644
--- a/tools/firmware/hvmloader/Makefile
+++ b/tools/firmware/hvmloader/Makefile
@@ -60,8 +60,7 @@ ROMS += $(ROMBIOS_ROM) $(STDVGA_ROM) $(CIRRUSVGA_ROM)
 endif
 
 .PHONY: all
-all: acpi
-	$(MAKE) hvmloader
+all: hvmloader
 
 .PHONY: acpi
 acpi:
@@ -73,12 +72,18 @@ smbios.o: CFLAGS += -D__SMBIOS_DATE__="\"$(SMBIOS_REL_DATE)\""
 ACPI_PATH = ../../libacpi
 DSDT_FILES = dsdt_anycpu.c dsdt_15cpu.c dsdt_anycpu_qemu_xen.c
 ACPI_OBJS = $(patsubst %.c,%.o,$(DSDT_FILES)) build.o static_tables.o
-$(ACPI_OBJS): CFLAGS += -I. -DLIBACPI_STDUTILS=\"$(CURDIR)/util.h\"
+$(ACPI_OBJS): CFLAGS += -iquote . -DLIBACPI_STDUTILS=\"$(CURDIR)/util.h\"
 CFLAGS += -I$(ACPI_PATH)
 vpath build.c $(ACPI_PATH)
 vpath static_tables.c $(ACPI_PATH)
 OBJS += $(ACPI_OBJS)
 
+$(DSDT_FILES): acpi
+
+# Add DSDT_FILES as a prerequisite of "build.o" so that make will also
+# generate the "ssdt_*.h" headers needed by "build.o".
+build.o: $(DSDT_FILES)
+
 hvmloader: $(OBJS) hvmloader.lds
 	$(LD) $(LDFLAGS_DIRECT) -N -T hvmloader.lds -o $@ $(OBJS)
 
@@ -87,21 +92,21 @@ roms.inc: $(ROMS)
 
 ifneq ($(ROMBIOS_ROM),)
 	echo "#ifdef ROM_INCLUDE_ROMBIOS" >> $@.new
-	sh ../../misc/mkhex rombios $(ROMBIOS_ROM) >> $@.new
+	$(SHELL) $(XEN_ROOT)/tools/misc/mkhex rombios $(ROMBIOS_ROM) >> $@.new
 	echo "#endif" >> $@.new
 endif
 
 ifneq ($(STDVGA_ROM),)
 	echo "#ifdef ROM_INCLUDE_VGABIOS" >> $@.new
-	sh ../../misc/mkhex vgabios_stdvga $(STDVGA_ROM) >> $@.new
+	$(SHELL) $(XEN_ROOT)/tools/misc/mkhex vgabios_stdvga $(STDVGA_ROM) >> $@.new
 	echo "#endif" >> $@.new
 endif
 ifneq ($(CIRRUSVGA_ROM),)
 	echo "#ifdef ROM_INCLUDE_VGABIOS" >> $@.new
-	sh ../../misc/mkhex vgabios_cirrusvga $(CIRRUSVGA_ROM) >> $@.new
+	$(SHELL) $(XEN_ROOT)/tools/misc/mkhex vgabios_cirrusvga $(CIRRUSVGA_ROM) >> $@.new
 	echo "#endif" >> $@.new
 endif
-	mv $@.new $@
+	mv -f $@.new $@
 
 .PHONY: clean
 clean:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Aug 15 07:00:26 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Aug 2022 07:00:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387050.623116 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNU5K-00082A-60; Mon, 15 Aug 2022 07:00:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387050.623116; Mon, 15 Aug 2022 07: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 1oNU5K-000822-3O; Mon, 15 Aug 2022 07:00:26 +0000
Received: by outflank-mailman (input) for mailman id 387050;
 Mon, 15 Aug 2022 07:00:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNU5J-00081q-8e
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 07:00:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNU5J-0006SW-76
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 07:00:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNU5J-0003yz-5L
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 07:00:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=sI2eREtHO0bRsWYME/z+3VLFVtRqvGGjAanbzsKbfgc=; b=UDDw5LuNQ4lzkAgnbsQ+lO7QfT
	j5RSG2ZUffKRJyIp/e4HvTl9aytgPwuZl8rFGkfolV5kPPvSzGHeZiS8B73kuRMc1gKPLVbYeUhi7
	5SUqLMmiT7gxjIo0JWyf04ZYz3bgq3OlZkD08daUk5F8UzeiAlYZJOeWHrh0lHa9hOUI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/fuzz/x86_instruction_emulator: rework makefile
Message-Id: <E1oNU5J-0003yz-5L@xenbits.xenproject.org>
Date: Mon, 15 Aug 2022 07:00:25 +0000

commit 2d696fc3d02c9e7246f58d4199cb4ec4fd597fd1
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Mon Aug 15 08:55:16 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 08:55:16 2022 +0200

    tools/fuzz/x86_instruction_emulator: rework makefile
    
    Rework dependencies of all objects. We don't need to add dependencies
    for headers that $(CC) is capable of generating, we only need to
    include $(DEPS_INCLUDE). Some dependencies are still needed so make
    knows to generate symlinks for them.
    
    We remove the use of "vpath" for cpuid.c. While it works fine for now,
    when we will convert this makefile to subdirmk, vpath will not be
    usable. Also, "-iquote" is now needed to build "cpuid.o".
    
    Replace "-I." by "-iquote .", so it applies to double-quote includes
    only.
    
    Rather than checking if a symlink exist, always regenerate the
    symlink. So if the source tree changed location, the symlink is
    updated.
    
    Since we are creating a new .gitignore for the symlink, also move the
    entry to it.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 .gitignore                                     |  6 -----
 tools/fuzz/x86_instruction_emulator/.gitignore |  7 ++++++
 tools/fuzz/x86_instruction_emulator/Makefile   | 35 +++++++++++++-------------
 3 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/.gitignore b/.gitignore
index ed7bd8bdc7..ff1d668489 100644
--- a/.gitignore
+++ b/.gitignore
@@ -195,12 +195,6 @@ tools/flask/utils/flask-loadpolicy
 tools/flask/utils/flask-setenforce
 tools/flask/utils/flask-set-bool
 tools/flask/utils/flask-label-pci
-tools/fuzz/x86_instruction_emulator/asm
-tools/fuzz/x86_instruction_emulator/afl-harness
-tools/fuzz/x86_instruction_emulator/afl-harness-cov
-tools/fuzz/x86_instruction_emulator/wrappers.c
-tools/fuzz/x86_instruction_emulator/x86_emulate
-tools/fuzz/x86_instruction_emulator/x86-emulate.[ch]
 tools/helpers/init-xenstore-domain
 tools/helpers/xen-init-dom0
 tools/hotplug/common/hotplugpath.sh
diff --git a/tools/fuzz/x86_instruction_emulator/.gitignore b/tools/fuzz/x86_instruction_emulator/.gitignore
new file mode 100644
index 0000000000..65c3cf9702
--- /dev/null
+++ b/tools/fuzz/x86_instruction_emulator/.gitignore
@@ -0,0 +1,7 @@
+/asm
+/afl-harness
+/afl-harness-cov
+/cpuid.c
+/wrappers.c
+/x86_emulate
+/x86-emulate.[ch]
diff --git a/tools/fuzz/x86_instruction_emulator/Makefile b/tools/fuzz/x86_instruction_emulator/Makefile
index 1a6dbf94e1..13aa238503 100644
--- a/tools/fuzz/x86_instruction_emulator/Makefile
+++ b/tools/fuzz/x86_instruction_emulator/Makefile
@@ -9,32 +9,29 @@ x86-insn-fuzz-all:
 endif
 
 # Add libx86 to the build
-vpath %.c $(XEN_ROOT)/xen/lib/x86
+%.c: $(XEN_ROOT)/xen/lib/x86/%.c FORCE
+	ln -nsf $< $@
 
-x86_emulate:
-	[ -L $@ ] || ln -sf $(XEN_ROOT)/xen/arch/x86/$@
+x86_emulate: FORCE
+	ln -nsf $(XEN_ROOT)/xen/arch/x86/$@
 
 x86_emulate/%: x86_emulate ;
 
-x86-emulate.c x86-emulate.h wrappers.c: %:
-	[ -L $* ] || ln -sf $(XEN_ROOT)/tools/tests/x86_emulator/$*
+%.c: $(XEN_ROOT)/tools/tests/x86_emulator/%.c FORCE
+	ln -nsf $< $@
+%.h: $(XEN_ROOT)/tools/tests/x86_emulator/%.h FORCE
+	ln -nsf $< $@
 
-CFLAGS += $(CFLAGS_xeninclude) -D__XEN_TOOLS__ -I.
+CFLAGS += $(CFLAGS_xeninclude) -D__XEN_TOOLS__ -iquote .
+cpuid.o: CFLAGS += -iquote $(XEN_ROOT)/xen/lib/x86
 
 GCOV_FLAGS := --coverage
 %-cov.o: %.c
 	$(CC) -c $(CFLAGS) $(GCOV_FLAGS) $< -o $@
 
-x86.h := $(addprefix $(XEN_ROOT)/tools/include/xen/asm/,\
-                     x86-vendors.h x86-defns.h msr-index.h) \
-         $(addprefix $(XEN_ROOT)/tools/include/xen/lib/x86/, \
-                     cpuid.h cpuid-autogen.h)
-x86_emulate.h := x86-emulate.h x86_emulate/x86_emulate.h $(x86.h)
-
-# x86-emulate.c will be implicit for both
-x86-emulate.o x86-emulate-cov.o: x86_emulate/x86_emulate.c $(x86_emulate.h)
-
-fuzz-emul.o fuzz-emulate-cov.o cpuid.o wrappers.o: $(x86_emulate.h)
+x86-emulate.h: x86_emulate/x86_emulate.h
+x86-emulate.o x86-emulate-cov.o: x86-emulate.h x86_emulate/x86_emulate.c
+fuzz-emul.o fuzz-emul-cov.o wrappers.o: x86-emulate.h
 
 x86-insn-fuzzer.a: fuzz-emul.o x86-emulate.o cpuid.o
 	$(AR) rc $@ $^
@@ -51,11 +48,11 @@ all: x86-insn-fuzz-all
 
 .PHONY: distclean
 distclean: clean
-	rm -f x86_emulate x86-emulate.c x86-emulate.h
+	rm -f x86_emulate x86-emulate.c x86-emulate.h wrappers.c cpuid.c
 
 .PHONY: clean
 clean:
-	rm -f *.a *.o .*.d afl-harness afl-harness-cov *.gcda *.gcno *.gcov
+	rm -f *.a *.o $(DEPS_RM) afl-harness afl-harness-cov *.gcda *.gcno *.gcov
 
 .PHONY: install
 install: all
@@ -67,3 +64,5 @@ afl: afl-harness
 
 .PHONY: afl-cov
 afl-cov: afl-harness-cov
+
+-include $(DEPS_INCLUDE)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Aug 15 07:00:36 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Aug 2022 07:00:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387051.623120 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNU5U-00085A-7a; Mon, 15 Aug 2022 07:00:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387051.623120; Mon, 15 Aug 2022 07:00: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 1oNU5U-000852-4s; Mon, 15 Aug 2022 07:00:36 +0000
Received: by outflank-mailman (input) for mailman id 387051;
 Mon, 15 Aug 2022 07:00:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNU5T-00084v-Aw
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 07:00:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNU5T-0006Sg-AE
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 07:00:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNU5T-0003zr-9L
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 07:00:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rrkEp91IUh5E4EHGWFb5L2i5qxVdXkj7hcxyXi6f9kM=; b=mwMOcXPOS+Uh8FmDJqzFEfalZH
	LuPn+LY3gpV7ZgsdD1nHYKBqf9IbqR6ZX14bEO2z5g3EuA0IIr7m5JlDMTYin8ou2rtcNsakbXSwj
	a1bYCcLl+D812CsH2ATrAygVpGOXIchfGZF+VtpMtx22bNSWOW5UJxxpIH41IrAXOrzw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/hotplug: cleanup Makefiles
Message-Id: <E1oNU5T-0003zr-9L@xenbits.xenproject.org>
Date: Mon, 15 Aug 2022 07:00:35 +0000

commit 290a9b91d9c6411b97d0fef9fcdbf93d125071d3
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Mon Aug 15 08:55:19 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 08:55:19 2022 +0200

    tools/hotplug: cleanup Makefiles
    
    Remove "build" targets.
    
    Use simply expanded variables when recursively expanded variable
    aren't needed. (Use ":=" instead of "=".)
    
    Don't check if a directory already exist when installing, just create
    it.
    
    Fix $(HOTPLUGPATH), it shouldn't have any double-quote.
    
    Some reindentation.
    
    FreeBSD, "hotplugpath.sh" is already installed by common/.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
---
 tools/hotplug/FreeBSD/Makefile       | 11 +++--------
 tools/hotplug/Linux/Makefile         | 16 ++++++----------
 tools/hotplug/Linux/systemd/Makefile | 16 +++++++---------
 tools/hotplug/NetBSD/Makefile        |  9 +++------
 tools/hotplug/common/Makefile        | 16 ++++++----------
 5 files changed, 25 insertions(+), 43 deletions(-)

diff --git a/tools/hotplug/FreeBSD/Makefile b/tools/hotplug/FreeBSD/Makefile
index de9928cd86..a6552c9884 100644
--- a/tools/hotplug/FreeBSD/Makefile
+++ b/tools/hotplug/FreeBSD/Makefile
@@ -2,18 +2,15 @@ XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 # Xen script dir and scripts to go there.
-XEN_SCRIPTS = vif-bridge block
+XEN_SCRIPTS := vif-bridge block
 
-XEN_SCRIPT_DATA =
+XEN_SCRIPT_DATA :=
 
-XEN_RCD_PROG = rc.d/xencommons rc.d/xendriverdomain
+XEN_RCD_PROG := rc.d/xencommons rc.d/xendriverdomain
 
 .PHONY: all
 all:
 
-.PHONY: build
-build:
-
 .PHONY: install
 install: install-scripts install-rcd
 
@@ -44,12 +41,10 @@ install-rcd:
 	   do \
 	   $(INSTALL_PROG) $$i $(DESTDIR)$(INITD_DIR); \
 	done
-	$(INSTALL_DATA) ../common/hotplugpath.sh $(DESTDIR)$(XEN_SCRIPT_DIR)
 
 .PHONY: uninstall-rcd
 uninstall-rcd:
 	rm -f $(addprefix $(DESTDIR)$(INITD_DIR)/, $(XEN_RCD_PROG))
-	rm -f $(DESTDIR)$(XEN_SCRIPT_DIR)/hotplugpath.sh
 
 .PHONY: clean
 clean:
diff --git a/tools/hotplug/Linux/Makefile b/tools/hotplug/Linux/Makefile
index 0b1d111d7e..9a7b3a3515 100644
--- a/tools/hotplug/Linux/Makefile
+++ b/tools/hotplug/Linux/Makefile
@@ -2,7 +2,7 @@ XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 # Xen script dir and scripts to go there.
-XEN_SCRIPTS = vif-bridge
+XEN_SCRIPTS := vif-bridge
 XEN_SCRIPTS += vif-route
 XEN_SCRIPTS += vif-nat
 XEN_SCRIPTS += vif-openvswitch
@@ -22,16 +22,13 @@ XEN_SCRIPTS += launch-xenstore
 
 SUBDIRS-$(CONFIG_SYSTEMD) += systemd
 
-XEN_SCRIPT_DATA = xen-script-common.sh locking.sh logging.sh
+XEN_SCRIPT_DATA := xen-script-common.sh locking.sh logging.sh
 XEN_SCRIPT_DATA += xen-hotplug-common.sh xen-network-common.sh vif-common.sh
 XEN_SCRIPT_DATA += block-common.sh
 
 .PHONY: all
 all: subdirs-all
 
-.PHONY: build
-build:
-
 .PHONY: install
 install: install-initd install-scripts subdirs-install
 
@@ -41,9 +38,9 @@ uninstall: uninstall-initd uninstall-scripts subdirs-uninstall
 # See docs/misc/distro_mapping.txt for INITD_DIR location
 .PHONY: install-initd
 install-initd:
-	[ -d $(DESTDIR)$(INITD_DIR) ] || $(INSTALL_DIR) $(DESTDIR)$(INITD_DIR)
-	[ -d $(DESTDIR)$(SYSCONFIG_DIR) ] || $(INSTALL_DIR) $(DESTDIR)$(SYSCONFIG_DIR)
-	[ -d $(DESTDIR)$(LIBEXEC_BIN) ] || $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
+	$(INSTALL_DIR) $(DESTDIR)$(INITD_DIR)
+	$(INSTALL_DIR) $(DESTDIR)$(SYSCONFIG_DIR)
+	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
 	$(INSTALL_DATA) init.d/sysconfig.xendomains $(DESTDIR)$(SYSCONFIG_DIR)/xendomains
 	$(INSTALL_DATA) init.d/sysconfig.xencommons $(DESTDIR)$(SYSCONFIG_DIR)/xencommons
 	$(INSTALL_PROG) xendomains $(DESTDIR)$(LIBEXEC_BIN)
@@ -64,8 +61,7 @@ uninstall-initd:
 
 .PHONY: install-scripts
 install-scripts:
-	[ -d $(DESTDIR)$(XEN_SCRIPT_DIR) ] || \
-		$(INSTALL_DIR) $(DESTDIR)$(XEN_SCRIPT_DIR)
+	$(INSTALL_DIR) $(DESTDIR)$(XEN_SCRIPT_DIR)
 	set -e; for i in $(XEN_SCRIPTS); \
 	    do \
 	    $(INSTALL_PROG) $$i $(DESTDIR)$(XEN_SCRIPT_DIR); \
diff --git a/tools/hotplug/Linux/systemd/Makefile b/tools/hotplug/Linux/systemd/Makefile
index a5d41d86ef..26df2a43b1 100644
--- a/tools/hotplug/Linux/systemd/Makefile
+++ b/tools/hotplug/Linux/systemd/Makefile
@@ -1,12 +1,12 @@
 XEN_ROOT = $(CURDIR)/../../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-XEN_SYSTEMD_MODULES = xen.conf
+XEN_SYSTEMD_MODULES := xen.conf
 
-XEN_SYSTEMD_MOUNT =  proc-xen.mount
+XEN_SYSTEMD_MOUNT := proc-xen.mount
 XEN_SYSTEMD_MOUNT += var-lib-xenstored.mount
 
-XEN_SYSTEMD_SERVICE  = xenstored.service
+XEN_SYSTEMD_SERVICE := xenstored.service
 XEN_SYSTEMD_SERVICE += xenconsoled.service
 XEN_SYSTEMD_SERVICE += xen-qemu-dom0-disk-backend.service
 XEN_SYSTEMD_SERVICE += xendomains.service
@@ -14,7 +14,7 @@ XEN_SYSTEMD_SERVICE += xen-watchdog.service
 XEN_SYSTEMD_SERVICE += xen-init-dom0.service
 XEN_SYSTEMD_SERVICE += xendriverdomain.service
 
-ALL_XEN_SYSTEMD =	$(XEN_SYSTEMD_MODULES)  \
+ALL_XEN_SYSTEMD :=	$(XEN_SYSTEMD_MODULES)  \
 			$(XEN_SYSTEMD_MOUNT)	\
 			$(XEN_SYSTEMD_SERVICE)
 
@@ -30,10 +30,8 @@ distclean: clean
 
 .PHONY: install
 install: $(ALL_XEN_SYSTEMD)
-	[ -d $(DESTDIR)$(XEN_SYSTEMD_DIR) ] || \
-		$(INSTALL_DIR) $(DESTDIR)$(XEN_SYSTEMD_DIR)
-	[ -d $(DESTDIR)$(XEN_SYSTEMD_MODULES_LOAD) ] || \
-		$(INSTALL_DIR) $(DESTDIR)$(XEN_SYSTEMD_MODULES_LOAD)
+	$(INSTALL_DIR) $(DESTDIR)$(XEN_SYSTEMD_DIR)
+	$(INSTALL_DIR) $(DESTDIR)$(XEN_SYSTEMD_MODULES_LOAD)
 	$(INSTALL_DATA) *.service $(DESTDIR)$(XEN_SYSTEMD_DIR)
 	$(INSTALL_DATA) *.mount $(DESTDIR)$(XEN_SYSTEMD_DIR)
 	$(INSTALL_DATA) *.conf $(DESTDIR)$(XEN_SYSTEMD_MODULES_LOAD)
@@ -48,5 +46,5 @@ $(XEN_SYSTEMD_MODULES):
 	rm -f $@.tmp
 	for mod in $(LINUX_BACKEND_MODULES) ; do \
 		echo $$mod ; \
-		done > $@.tmp
+	done > $@.tmp
 	$(call move-if-changed,$@.tmp,$@)
diff --git a/tools/hotplug/NetBSD/Makefile b/tools/hotplug/NetBSD/Makefile
index f909ffa367..1cd3db2ccb 100644
--- a/tools/hotplug/NetBSD/Makefile
+++ b/tools/hotplug/NetBSD/Makefile
@@ -2,22 +2,19 @@ XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 # Xen script dir and scripts to go there.
-XEN_SCRIPTS =
+XEN_SCRIPTS :=
 XEN_SCRIPTS += locking.sh
 XEN_SCRIPTS += block
 XEN_SCRIPTS += vif-bridge
 XEN_SCRIPTS += vif-ip
 XEN_SCRIPTS += qemu-ifup
 
-XEN_SCRIPT_DATA =
-XEN_RCD_PROG = rc.d/xencommons rc.d/xendomains rc.d/xen-watchdog rc.d/xendriverdomain
+XEN_SCRIPT_DATA :=
+XEN_RCD_PROG := rc.d/xencommons rc.d/xendomains rc.d/xen-watchdog rc.d/xendriverdomain
 
 .PHONY: all
 all:
 
-.PHONY: build
-build:
-
 .PHONY: install
 install: install-scripts install-rcd
 
diff --git a/tools/hotplug/common/Makefile b/tools/hotplug/common/Makefile
index ef48bfacc9..e8a8dbea6c 100644
--- a/tools/hotplug/common/Makefile
+++ b/tools/hotplug/common/Makefile
@@ -1,22 +1,19 @@
 XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-HOTPLUGPATH="hotplugpath.sh"
+HOTPLUGPATH := hotplugpath.sh
 
 # OS-independent hotplug scripts go in this directory
 
 # Xen scripts to go there.
-XEN_SCRIPTS =
-XEN_SCRIPT_DATA = $(HOTPLUGPATH)
+XEN_SCRIPTS :=
+XEN_SCRIPT_DATA := $(HOTPLUGPATH)
 
 genpath-target = $(call buildmakevars2file,$(HOTPLUGPATH))
 $(eval $(genpath-target))
 
 .PHONY: all
-all: build
-
-.PHONY: build
-build: $(HOTPLUGPATH)
+all: $(HOTPLUGPATH)
 
 .PHONY: install
 install: install-scripts
@@ -25,9 +22,8 @@ install: install-scripts
 uninstall: uninstall-scripts
 
 .PHONY: install-scripts
-install-scripts: build
-	[ -d $(DESTDIR)$(XEN_SCRIPT_DIR) ] || \
-		$(INSTALL_DIR) $(DESTDIR)$(XEN_SCRIPT_DIR)
+install-scripts: all
+	$(INSTALL_DIR) $(DESTDIR)$(XEN_SCRIPT_DIR)
 	set -e; for i in $(XEN_SCRIPTS); \
 	   do \
 	   $(INSTALL_PROG) $$i $(DESTDIR)$(XEN_SCRIPT_DIR); \
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Aug 15 07:00:46 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Aug 2022 07:00:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387052.623124 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNU5e-00087f-95; Mon, 15 Aug 2022 07:00:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387052.623124; Mon, 15 Aug 2022 07:00: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 1oNU5e-00087X-6R; Mon, 15 Aug 2022 07:00:46 +0000
Received: by outflank-mailman (input) for mailman id 387052;
 Mon, 15 Aug 2022 07:00:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNU5d-00087D-ET
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 07:00:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNU5d-0006T6-Di
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 07:00:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNU5d-00040H-CQ
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 07:00:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=A4fJ7WVHwdufHiBkLtMhNkTybnaa3kV3pR7Lale6oe4=; b=DJjPnhO5gpvlzJYGlRMEjtHOh+
	FWGyHqcfN/VgrLocMg42Vq2joclmsw8xNOkRwGc2g9ZPWa7LVvPtD93WbKYdkOCvNWkSQkupHs24W
	BCci3NibHKagIpmaJ5RWZIvvpHFrwr6xkDbxeHsF2Iuxkq3x0BvZPa0uKcdVx+CkmhkE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/libfsimage: Cleanup makefiles
Message-Id: <E1oNU5d-00040H-CQ@xenbits.xenproject.org>
Date: Mon, 15 Aug 2022 07:00:45 +0000

commit 4aa436df4b0fad1b6cd66ccbbc94915c9d2696a6
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Mon Aug 15 08:55:21 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 08:55:21 2022 +0200

    tools/libfsimage: Cleanup makefiles
    
    Remove the need for "fs-*" targets by creating a "common.mk" which
    have flags that are common to libfsimage/common/ and the other
    libfsimages/*/ directories.
    
    In common.mk, make $(PIC_OBJS) a recursively expanded variable so it
    doesn't matter where $(LIB_SRCS-y) is defined, and remove the extra
    $(PIC_OBJS) from libfsimage/common/Makefile.
    
    Use a $(TARGETS) variable to list things to be built. And $(TARGETS)
    can be use in the clean target in common.mk.
    
    iso9660/:
        Remove the explicit dependency between fsys_iso9660.c and
        iso9660.h, this is handled automaticaly by the .*.d dependency files,
        and iso9660.h already exist.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
---
 tools/libfsimage/Rules.mk            | 26 ++++++++------------------
 tools/libfsimage/common.mk           | 11 +++++++++++
 tools/libfsimage/common/Makefile     | 11 +++--------
 tools/libfsimage/ext2fs-lib/Makefile |  9 ---------
 tools/libfsimage/ext2fs/Makefile     |  9 ---------
 tools/libfsimage/fat/Makefile        |  9 ---------
 tools/libfsimage/iso9660/Makefile    | 11 -----------
 tools/libfsimage/reiserfs/Makefile   |  9 ---------
 tools/libfsimage/ufs/Makefile        |  9 ---------
 tools/libfsimage/xfs/Makefile        |  9 ---------
 tools/libfsimage/zfs/Makefile        |  9 ---------
 11 files changed, 22 insertions(+), 100 deletions(-)

diff --git a/tools/libfsimage/Rules.mk b/tools/libfsimage/Rules.mk
index bb6d42abb4..cf37d6cb0d 100644
--- a/tools/libfsimage/Rules.mk
+++ b/tools/libfsimage/Rules.mk
@@ -1,25 +1,18 @@
-include $(XEN_ROOT)/tools/Rules.mk
-
-CFLAGS += -Wno-unknown-pragmas -I$(XEN_ROOT)/tools/libfsimage/common/ -DFSIMAGE_FSDIR=\"$(FSDIR)\"
-CFLAGS += -Werror -D_GNU_SOURCE
-LDFLAGS += -L../common/
-
-PIC_OBJS := $(patsubst %.c,%.opic,$(LIB_SRCS-y))
-
-FSDIR = $(libdir)/xenfsimage
+include $(XEN_ROOT)/tools/libfsimage/common.mk
 
 FSLIB = fsimage.so
+TARGETS += $(FSLIB)
 
-.PHONY: fs-all
-fs-all: $(FSLIB)
+.PHONY: all
+all: $(TARGETS)
 
-.PHONY: fs-install
-fs-install: fs-all
+.PHONY: install
+install: all
 	$(INSTALL_DIR) $(DESTDIR)$(FSDIR)/$(FS)
 	$(INSTALL_PROG) $(FSLIB) $(DESTDIR)$(FSDIR)/$(FS)
 
-.PHONY: fs-uninstall
-fs-uninstall:
+.PHONY: uninstall
+uninstall:
 	rm -f $(addprefix $(DESTDIR)$(FSDIR)/$(FS)/, $(FSLIB))
 	if [ -d $(DESTDIR)$(FSDIR)/$(FS) ]; then \
 		rmdir $(DESTDIR)$(FSDIR)/$(FS); \
@@ -28,7 +21,4 @@ fs-uninstall:
 $(FSLIB): $(PIC_OBJS)
 	$(CC) $(LDFLAGS) $(SHLIB_LDFLAGS) -o $@ $^ -lxenfsimage $(FS_LIBDEPS) $(APPEND_LDFLAGS)
 
-clean distclean::
-	rm -f $(PIC_OBJS) $(FSLIB) $(DEPS_RM)
-
 -include $(DEPS_INCLUDE)
diff --git a/tools/libfsimage/common.mk b/tools/libfsimage/common.mk
new file mode 100644
index 0000000000..77bc957f27
--- /dev/null
+++ b/tools/libfsimage/common.mk
@@ -0,0 +1,11 @@
+include $(XEN_ROOT)/tools/Rules.mk
+
+FSDIR := $(libdir)/xenfsimage
+CFLAGS += -Wno-unknown-pragmas -I$(XEN_ROOT)/tools/libfsimage/common/ -DFSIMAGE_FSDIR=\"$(FSDIR)\"
+CFLAGS += -Werror -D_GNU_SOURCE
+LDFLAGS += -L../common/
+
+PIC_OBJS = $(patsubst %.c,%.opic,$(LIB_SRCS-y))
+
+clean distclean::
+	rm -f $(PIC_OBJS) $(TARGETS) $(DEPS_RM)
diff --git a/tools/libfsimage/common/Makefile b/tools/libfsimage/common/Makefile
index 0c5a34baea..79f8cfd28e 100644
--- a/tools/libfsimage/common/Makefile
+++ b/tools/libfsimage/common/Makefile
@@ -1,5 +1,5 @@
 XEN_ROOT = $(CURDIR)/../../..
-include $(XEN_ROOT)/tools/libfsimage/Rules.mk
+include $(XEN_ROOT)/tools/libfsimage/common.mk
 
 MAJOR := $(shell $(XEN_ROOT)/version.sh $(XEN_ROOT)/xen/Makefile)
 MINOR = 0
@@ -13,12 +13,10 @@ LDFLAGS += $(PTHREAD_LDFLAGS)
 
 LIB_SRCS-y = fsimage.c fsimage_plugin.c fsimage_grub.c
 
-PIC_OBJS := $(patsubst %.c,%.opic,$(LIB_SRCS-y))
-
-LIB = libxenfsimage.so libxenfsimage.so.$(MAJOR) libxenfsimage.so.$(MAJOR).$(MINOR)
+TARGETS = libxenfsimage.so libxenfsimage.so.$(MAJOR) libxenfsimage.so.$(MAJOR).$(MINOR)
 
 .PHONY: all
-all: $(LIB)
+all: $(TARGETS)
 
 .PHONY: install
 install: all
@@ -40,9 +38,6 @@ uninstall:
 	rm -f $(DESTDIR)$(libdir)/libxenfsimage.so.$(MAJOR)
 	rm -f $(DESTDIR)$(libdir)/libxenfsimage.so.$(MAJOR).$(MINOR)
 
-clean distclean::
-	rm -f $(LIB)
-
 libxenfsimage.so: libxenfsimage.so.$(MAJOR)
 	ln -sf $< $@
 libxenfsimage.so.$(MAJOR): libxenfsimage.so.$(MAJOR).$(MINOR)
diff --git a/tools/libfsimage/ext2fs-lib/Makefile b/tools/libfsimage/ext2fs-lib/Makefile
index 431a79068e..b9b560df75 100644
--- a/tools/libfsimage/ext2fs-lib/Makefile
+++ b/tools/libfsimage/ext2fs-lib/Makefile
@@ -9,13 +9,4 @@ FS_LIBDEPS = $(EXTFS_LIBS)
 # Include configure output (config.h)
 CFLAGS += -include $(XEN_ROOT)/tools/config.h
 
-.PHONY: all
-all: fs-all
-
-.PHONY: install
-install: fs-install
-
-.PHONY: uninstall
-uninstall: fs-uninstall
-
 include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff --git a/tools/libfsimage/ext2fs/Makefile b/tools/libfsimage/ext2fs/Makefile
index c62ae359ac..fe01f98148 100644
--- a/tools/libfsimage/ext2fs/Makefile
+++ b/tools/libfsimage/ext2fs/Makefile
@@ -4,13 +4,4 @@ LIB_SRCS-y = fsys_ext2fs.c
 
 FS = ext2fs
 
-.PHONY: all
-all: fs-all
-
-.PHONY: install
-install: fs-install
-
-.PHONY: uninstall
-uninstall: fs-uninstall
-
 include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff --git a/tools/libfsimage/fat/Makefile b/tools/libfsimage/fat/Makefile
index 7ee5e7588d..58bcc0751d 100644
--- a/tools/libfsimage/fat/Makefile
+++ b/tools/libfsimage/fat/Makefile
@@ -4,13 +4,4 @@ LIB_SRCS-y = fsys_fat.c
 
 FS = fat
 
-.PHONY: all
-all: fs-all
-
-.PHONY: install
-install: fs-install
-
-.PHONY: uninstall
-uninstall: fs-uninstall
-
 include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff --git a/tools/libfsimage/iso9660/Makefile b/tools/libfsimage/iso9660/Makefile
index bc86baf2c0..acf3164046 100644
--- a/tools/libfsimage/iso9660/Makefile
+++ b/tools/libfsimage/iso9660/Makefile
@@ -4,15 +4,4 @@ LIB_SRCS-y = fsys_iso9660.c
 
 FS = iso9660
 
-.PHONY: all
-all: fs-all
-
-.PHONY: install
-install: fs-install
-
-.PHONY: uninstall
-uninstall: fs-uninstall
-
-fsys_iso9660.c: iso9660.h
-
 include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff --git a/tools/libfsimage/reiserfs/Makefile b/tools/libfsimage/reiserfs/Makefile
index 5acfedf25e..42b751e007 100644
--- a/tools/libfsimage/reiserfs/Makefile
+++ b/tools/libfsimage/reiserfs/Makefile
@@ -4,13 +4,4 @@ LIB_SRCS-y = fsys_reiserfs.c
 
 FS = reiserfs
 
-.PHONY: all
-all: fs-all
-
-.PHONY: install
-install: fs-install
-
-.PHONY: uninstall
-uninstall: fs-uninstall
-
 include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff --git a/tools/libfsimage/ufs/Makefile b/tools/libfsimage/ufs/Makefile
index f32b9178bd..cca4f0a588 100644
--- a/tools/libfsimage/ufs/Makefile
+++ b/tools/libfsimage/ufs/Makefile
@@ -4,13 +4,4 @@ LIB_SRCS-y = fsys_ufs.c
 
 FS = ufs
 
-.PHONY: all
-all: fs-all
-
-.PHONY: install
-install: fs-install
-
-.PHONY: uninstall
-uninstall: fs-uninstall
-
 include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff --git a/tools/libfsimage/xfs/Makefile b/tools/libfsimage/xfs/Makefile
index 54eeb6e35e..ebac7baf14 100644
--- a/tools/libfsimage/xfs/Makefile
+++ b/tools/libfsimage/xfs/Makefile
@@ -4,13 +4,4 @@ LIB_SRCS-y = fsys_xfs.c
 
 FS = xfs
 
-.PHONY: all
-all: fs-all
-
-.PHONY: install
-install: fs-install
-
-.PHONY: uninstall
-uninstall: fs-uninstall
-
 include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff --git a/tools/libfsimage/zfs/Makefile b/tools/libfsimage/zfs/Makefile
index 084e5ec08d..434a9c3580 100644
--- a/tools/libfsimage/zfs/Makefile
+++ b/tools/libfsimage/zfs/Makefile
@@ -28,13 +28,4 @@ LIB_SRCS-y = zfs_lzjb.c zfs_sha256.c zfs_fletcher.c fsi_zfs.c fsys_zfs.c
 
 FS = zfs
 
-.PHONY: all
-all: fs-all
-
-.PHONY: install
-install: fs-install
-
-.PHONY: uninstall
-uninstall: fs-uninstall
-
 include $(XEN_ROOT)/tools/libfsimage/Rules.mk
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Aug 15 07:00:56 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Aug 2022 07:00:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387053.623128 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNU5o-0008BE-CL; Mon, 15 Aug 2022 07:00:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387053.623128; Mon, 15 Aug 2022 07:00: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 1oNU5o-0008B5-9O; Mon, 15 Aug 2022 07:00:56 +0000
Received: by outflank-mailman (input) for mailman id 387053;
 Mon, 15 Aug 2022 07:00:55 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNU5n-0008Az-HC
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 07:00:55 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNU5n-0006TL-GU
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 07:00:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNU5n-00040p-Fl
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 07:00:55 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=DNt1uS6GDwEo0Rek6f4VgV8EflVqMQTuYWcCgwIcO8w=; b=VksKxNiu4uQPeE5UjvKO51TRPQ
	r+cb0gNmrx0nB3g5fR57NxvudTG3qP0qs8vycTdVVfssNkiMXts9Kwmm72BE5zlRUXvKDZDd0TJaX
	WNLlnUQraLZjx71WI4EyERQ6eTjHyddcBr5U7LS/MTzLYbw0WuLt0qKWRPD9+ntxYYhA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xenpaging: Rework makefile
Message-Id: <E1oNU5n-00040p-Fl@xenbits.xenproject.org>
Date: Mon, 15 Aug 2022 07:00:55 +0000

commit becde885384fd736a1c53af07bb5b0ab66fa8a46
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Mon Aug 15 08:55:23 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 08:55:23 2022 +0200

    tools/xenpaging: Rework makefile
    
    - Rename $(SRCS) to $(OBJS-y), we don't need to collect sources.
    - Rename $(IBINS) to $(TARGETS)
    - Stop cleaning "xen" and non-set variable $(LIB).
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
---
 tools/xenpaging/Makefile | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/tools/xenpaging/Makefile b/tools/xenpaging/Makefile
index 04743b335c..e2ed9eaa3f 100644
--- a/tools/xenpaging/Makefile
+++ b/tools/xenpaging/Makefile
@@ -5,33 +5,33 @@ CFLAGS += $(CFLAGS_libxentoollog) $(CFLAGS_libxenevtchn) $(CFLAGS_libxenctrl) $(
 LDLIBS += $(LDLIBS_libxentoollog) $(LDLIBS_libxenevtchn) $(LDLIBS_libxenctrl) $(LDLIBS_libxenstore) $(PTHREAD_LIBS)
 LDFLAGS += $(PTHREAD_LDFLAGS)
 
-POLICY    = default
+POLICY   := default
 
-SRC      :=
-SRCS     += file_ops.c xenpaging.c policy_$(POLICY).c
-SRCS     += pagein.c
+OBJS-y   := file_ops.o
+OBJS-y   += xenpaging.o
+OBJS-y   += policy_$(POLICY).o
+OBJS-y   += pagein.o
 
 CFLAGS   += -Werror
 CFLAGS   += -Wno-unused
 
-OBJS     = $(SRCS:.c=.o)
-IBINS    = xenpaging
+TARGETS := xenpaging
 
-all: $(IBINS)
+all: $(TARGETS)
 
-xenpaging: $(OBJS)
+xenpaging: $(OBJS-y)
 	$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS) $(APPEND_LDFLAGS)
 
 install: all
 	$(INSTALL_DIR) -m 0700 $(DESTDIR)$(XEN_PAGING_DIR)
 	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
-	$(INSTALL_PROG) $(IBINS) $(DESTDIR)$(LIBEXEC_BIN)
+	$(INSTALL_PROG) $(TARGETS) $(DESTDIR)$(LIBEXEC_BIN)
 
 uninstall:
-	rm -f $(addprefix $(DESTDIR)$(LIBEXEC_BIN)/, $(IBINS))
+	rm -f $(addprefix $(DESTDIR)$(LIBEXEC_BIN)/, $(TARGETS))
 
 clean:
-	rm -f *.o *~ $(DEPS_RM) xen TAGS $(IBINS) $(LIB)
+	rm -f *.o *~ $(DEPS_RM) TAGS $(TARGETS)
 
 distclean: clean
 
@@ -39,6 +39,6 @@ distclean: clean
 
 .PHONY: TAGS
 TAGS:
-	etags -t $(SRCS) *.h
+	etags -t *.c *.h
 
 -include $(DEPS_INCLUDE)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Aug 15 07:01:06 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Aug 2022 07:01:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387054.623132 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNU5y-0008FZ-Dj; Mon, 15 Aug 2022 07:01:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387054.623132; Mon, 15 Aug 2022 07:01: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 1oNU5y-0008FS-B4; Mon, 15 Aug 2022 07:01:06 +0000
Received: by outflank-mailman (input) for mailman id 387054;
 Mon, 15 Aug 2022 07:01:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNU5x-0008FB-KJ
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 07:01:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNU5x-0006Ti-JU
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 07:01:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNU5x-00041a-Ig
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 07:01:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CDRcsen7eJcIwBaTbPszAxznjGBCbq0EC41zjz3bB7o=; b=tQA+zL4uzZEmR9W9c+aPfjn424
	Sd3W305KnDUNU3YLTnwHCH5Iybbze+WwUSdM+47FyL+gPtfkGZNTABcAWFkF73wFgspljSCVtPYMa
	B4ZE0FkcrC4k7gGGCOtwTAm6NKmkdafoybhUUobGfUwVDEVeiDxDAuZ7WADYjbgNZuvk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xentop: rework makefile
Message-Id: <E1oNU5x-00041a-Ig@xenbits.xenproject.org>
Date: Mon, 15 Aug 2022 07:01:05 +0000

commit 73447cddf6637a07c8b9a8747ddea27288e8a63c
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Mon Aug 15 08:55:25 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 08:55:25 2022 +0200

    tools/xentop: rework makefile
    
    Add "xentop" to "TARGETS" because this variable will be useful later.
    
    Always define all the targets, even when configured with
    --disable-monitor, instead don't visit the subdirectory.
    This mean xentop/ isn't visited anymore during "make clean" that's how
    most other subdirs in the tools/ works.
    
    Also add missing "xentop" rules. It only works without it because we
    still have make's built-ins rules and variables, but fix this to not
    have to rely on them.
    
    Use $(TARGETS) with $(INSTALL_PROG), and thus install into the
    directory rather than spelling the program name.
    
    In the "clean" rule, use $(RM) and remove all "*.o" instead of just
    one object.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
---
 tools/Makefile        |  2 +-
 tools/xentop/Makefile | 21 +++++++++------------
 2 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/tools/Makefile b/tools/Makefile
index 79b4c7e3de..0c1d8b64a4 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -17,7 +17,7 @@ SUBDIRS-$(CONFIG_XCUTILS) += xcutils
 SUBDIRS-$(CONFIG_X86) += firmware
 SUBDIRS-y += console
 SUBDIRS-y += xenmon
-SUBDIRS-y += xentop
+SUBDIRS-$(XENSTAT_XENTOP) += xentop
 SUBDIRS-y += libfsimage
 SUBDIRS-$(CONFIG_Linux) += vchan
 
diff --git a/tools/xentop/Makefile b/tools/xentop/Makefile
index 0034114684..7bd96f34d5 100644
--- a/tools/xentop/Makefile
+++ b/tools/xentop/Makefile
@@ -13,36 +13,33 @@
 XEN_ROOT=$(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-ifneq ($(XENSTAT_XENTOP),y)
-.PHONY: all install xentop uninstall
-all install xentop uninstall:
-else
-
 CFLAGS += -DGCC_PRINTF -Werror $(CFLAGS_libxenstat)
 LDLIBS += $(LDLIBS_libxenstat) $(CURSES_LIBS) $(TINFO_LIBS) $(SOCKET_LIBS) -lm
 CFLAGS += -DHOST_$(XEN_OS)
 
 # Include configure output (config.h)
 CFLAGS += -include $(XEN_ROOT)/tools/config.h
-LDFLAGS += $(APPEND_LDFLAGS)
+
+TARGETS := xentop
 
 .PHONY: all
-all: xentop
+all: $(TARGETS)
+
+xentop: xentop.o
+	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS) $(APPEND_LDFLAGS)
 
 .PHONY: install
-install: xentop
+install: all
 	$(INSTALL_DIR) $(DESTDIR)$(sbindir)
-	$(INSTALL_PROG) xentop $(DESTDIR)$(sbindir)/xentop
+	$(INSTALL_PROG) $(TARGETS) $(DESTDIR)$(sbindir)
 
 .PHONY: uninstall
 uninstall:
 	rm -f $(DESTDIR)$(sbindir)/xentop
 
-endif
-
 .PHONY: clean
 clean:
-	rm -f xentop xentop.o $(DEPS_RM)
+	$(RM) *.o $(TARGETS) $(DEPS_RM)
 
 .PHONY: distclean
 distclean: clean
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Aug 15 07:01:16 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Aug 2022 07:01:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387055.623136 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNU68-0008Ik-FP; Mon, 15 Aug 2022 07:01:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387055.623136; Mon, 15 Aug 2022 07:01: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 1oNU68-0008Ic-Ch; Mon, 15 Aug 2022 07:01:16 +0000
Received: by outflank-mailman (input) for mailman id 387055;
 Mon, 15 Aug 2022 07:01:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNU67-0008IP-NN
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 07:01:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNU67-0006Tt-Mc
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 07:01:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNU67-000421-Ln
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 07:01:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MpJVDQdD3479xdcI+llcmCqyimH51aqj7atsuhRoG6M=; b=RdUlBxGVl0ZCqjO78LC4jy/h/r
	KeW+kiqby5CWBc87xQEO9ge1FK3aBIwoUV8A3Cw83yhT9tIwT8Oq+SeZX/hmnvm7mRCceEQaV2c0W
	LHYZ5EXAUIiHEJH3u985T7ZVrlwjw5XuPzzs4v6eOTsDeOFPX0zZus7dEP220EeTlCsE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] .gitignore: Cleanup ignores of tools/libs/*/{headers.chk,*.pc}
Message-Id: <E1oNU67-000421-Ln@xenbits.xenproject.org>
Date: Mon, 15 Aug 2022 07:01:15 +0000

commit 50f34b69c8145016116bd2909902f266def0b763
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Mon Aug 15 08:55:27 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 08:55:27 2022 +0200

    .gitignore: Cleanup ignores of tools/libs/*/{headers.chk,*.pc}
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 .gitignore            | 26 --------------------------
 tools/libs/.gitignore |  2 ++
 2 files changed, 2 insertions(+), 26 deletions(-)

diff --git a/.gitignore b/.gitignore
index ff1d668489..e3fe06cd13 100644
--- a/.gitignore
+++ b/.gitignore
@@ -106,26 +106,8 @@ tools/config.cache
 config/Tools.mk
 config/Stubdom.mk
 config/Docs.mk
-tools/libs/toolcore/headers.chk
-tools/libs/toolcore/xentoolcore.pc
-tools/libs/toollog/headers.chk
-tools/libs/toollog/xentoollog.pc
-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/ctrl/libxenctrl.map
-tools/libs/ctrl/xencontrol.pc
-tools/libs/foreignmemory/headers.chk
-tools/libs/foreignmemory/xenforeignmemory.pc
-tools/libs/devicemodel/headers.chk
-tools/libs/devicemodel/xendevicemodel.pc
 tools/libs/guest/libxenguest.map
-tools/libs/guest/xenguest.pc
 tools/libs/guest/xc_bitops.h
 tools/libs/guest/xc_core.h
 tools/libs/guest/xc_core_arm.h
@@ -145,21 +127,13 @@ tools/libs/light/testidl.c
 tools/libs/light/test_timedereg
 tools/libs/light/test_fdderegrace
 tools/libs/light/tmp.*
-tools/libs/light/xenlight.pc
-tools/libs/stat/headers.chk
 tools/libs/stat/libxenstat.map
-tools/libs/stat/xenstat.pc
-tools/libs/store/headers.chk
 tools/libs/store/list.h
 tools/libs/store/utils.h
-tools/libs/store/xenstore.pc
 tools/libs/store/xs_lib.c
-tools/libs/util/*.pc
 tools/libs/util/libxlu_cfg_y.output
 tools/libs/util/libxenutil.map
-tools/libs/vchan/headers.chk
 tools/libs/vchan/libxenvchan.map
-tools/libs/vchan/xenvchan.pc
 tools/debugger/gdb/gdb-6.2.1-linux-i386-xen/*
 tools/debugger/gdb/gdb-6.2.1/*
 tools/debugger/gdb/gdb-6.2.1.tar.bz2
diff --git a/tools/libs/.gitignore b/tools/libs/.gitignore
index 4a13126144..1ad7c7f0cb 100644
--- a/tools/libs/.gitignore
+++ b/tools/libs/.gitignore
@@ -1 +1,3 @@
+*/*.pc
+*/headers.chk
 */headers.lst
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Aug 15 07:01:26 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Aug 2022 07:01:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387057.623151 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNU6I-0000C2-Or; Mon, 15 Aug 2022 07:01:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387057.623151; Mon, 15 Aug 2022 07:01: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 1oNU6I-0000Bu-Lh; Mon, 15 Aug 2022 07:01:26 +0000
Received: by outflank-mailman (input) for mailman id 387057;
 Mon, 15 Aug 2022 07:01:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNU6H-0000BW-QE
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 07:01:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNU6H-0006UE-PS
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 07:01:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNU6H-00042U-Ok
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 07:01:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0AFIVVyXQbw50/iFDhE9EvCaP0Gw1yAxs99RUAk2z4I=; b=B4jDNs0PNyvo/3mLj7SY/OCXU3
	yWC60Rl2QOzR4x3yOXWnowG4B9408ewk4xZyOn39LrfZNVM73NhoETy4t8JYdHFp5JiO3nqAzOXoB
	lT6xCbOp2m4YqSYkcpsIKSugz5Errixi9XBe77b9lkQrcVnwF1ZvHXzONpH831jyQxkM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/libs/util: cleanup Makefile
Message-Id: <E1oNU6H-00042U-Ok@xenbits.xenproject.org>
Date: Mon, 15 Aug 2022 07:01:25 +0000

commit dda9c42bd7f0aa9be7cc692804d26d52e82be6f9
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Mon Aug 15 08:55:30 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 08:55:30 2022 +0200

    tools/libs/util: cleanup Makefile
    
    Remove -I. from CFLAGS, it isn't necessary.
    
    Removed $(AUTOSRCS), it isn't used.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 tools/libs/util/Makefile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tools/libs/util/Makefile b/tools/libs/util/Makefile
index ffe507b379..493d2e00be 100644
--- a/tools/libs/util/Makefile
+++ b/tools/libs/util/Makefile
@@ -11,7 +11,7 @@ OBJS-y += libxlu_pci.o
 
 CFLAGS += -Wno-format-zero-length -Wmissing-declarations \
 	-Wno-declaration-after-statement -Wformat-nonliteral
-CFLAGS += -I. $(CFLAGS_libxenctrl)
+CFLAGS += $(CFLAGS_libxenctrl)
 
 CFLAGS += $(PTHREAD_CFLAGS)
 LDFLAGS += $(PTHREAD_LDFLAGS)
@@ -29,7 +29,6 @@ ifeq ($(BISON),)
 endif
 
 AUTOINCS = libxlu_cfg_y.h libxlu_cfg_l.h libxlu_disk_l.h
-AUTOSRCS = libxlu_cfg_y.c libxlu_cfg_l.c
 
 LIBHEADER := libxlutil.h
 PKG_CONFIG_NAME := Xlutil
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Aug 15 07:01:36 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Aug 2022 07:01:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387058.623155 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNU6S-0000Ko-Qa; Mon, 15 Aug 2022 07:01:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387058.623155; Mon, 15 Aug 2022 07:01: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 1oNU6S-0000Kg-NP; Mon, 15 Aug 2022 07:01:36 +0000
Received: by outflank-mailman (input) for mailman id 387058;
 Mon, 15 Aug 2022 07:01:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNU6R-0000J5-TF
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 07:01:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNU6R-0006UJ-SY
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 07:01:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNU6R-000435-Rh
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 07:01:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=z4KMNc0BdILlvkpKo0KIH9F6XflZMO8/jHc30VvFyP4=; b=OAoGoHXSagyZvUj+n7bp/B7r5x
	VK3z14cPzEWDxot3NQ0Dzg4aeKxW3qn7gqRMBdzt/4jiIpIMSEqPzkB16Hjf+uUlLVbB5jfFCPEpK
	f4juAWrNT4b0bMLQ7epziNw6+mnLau/Ec1W4GZrFPBlPUbuPeKFvpLW1PAS+emXr634Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libs/libs.mk: Rename $(LIB) to $(TARGETS)
Message-Id: <E1oNU6R-000435-Rh@xenbits.xenproject.org>
Date: Mon, 15 Aug 2022 07:01:35 +0000

commit cccced3434dc68595941d26d0b6b79ccf2e953f8
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Mon Aug 15 08:55:32 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 08:55:32 2022 +0200

    libs/libs.mk: Rename $(LIB) to $(TARGETS)
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 tools/libs/libs.mk | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/libs/libs.mk b/tools/libs/libs.mk
index 58d8166b09..e02f91f95e 100644
--- a/tools/libs/libs.mk
+++ b/tools/libs/libs.mk
@@ -23,9 +23,9 @@ LDLIBS += $(foreach lib, $(USELIBS_$(LIBNAME)), $(LDLIBS_libxen$(lib)))
 PIC_OBJS := $(OBJS-y:.o=.opic)
 
 LIB_FILE_NAME = $(FILENAME_$(LIBNAME))
-LIB := lib$(LIB_FILE_NAME).a
+TARGETS := lib$(LIB_FILE_NAME).a
 ifneq ($(nosharedlibs),y)
-LIB += lib$(LIB_FILE_NAME).so
+TARGETS += lib$(LIB_FILE_NAME).so
 endif
 
 PKG_CONFIG ?= $(LIB_FILE_NAME).pc
@@ -55,7 +55,7 @@ $(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_INCLUDE)
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_LIBDIR = $(CURDIR)
 
 .PHONY: all
-all: headers.chk $(LIB) $(PKG_CONFIG_INST) $(PKG_CONFIG_LOCAL) libxen$(LIBNAME).map $(LIBHEADERS)
+all: headers.chk $(TARGETS) $(PKG_CONFIG_INST) $(PKG_CONFIG_LOCAL) libxen$(LIBNAME).map $(LIBHEADERS)
 
 ifneq ($(NO_HEADERS_CHK),y)
 headers.chk:
@@ -124,7 +124,7 @@ TAGS:
 
 .PHONY: clean
 clean::
-	rm -rf $(LIB) *~ $(DEPS_RM) $(OBJS-y) $(PIC_OBJS)
+	rm -rf $(TARGETS) *~ $(DEPS_RM) $(OBJS-y) $(PIC_OBJS)
 	rm -f lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR) lib$(LIB_FILE_NAME).so.$(MAJOR)
 	rm -f headers.chk headers.lst
 	rm -f $(PKG_CONFIG)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Aug 15 07:01:46 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Aug 2022 07:01:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387061.623158 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNU6c-0000SL-Ra; Mon, 15 Aug 2022 07:01:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387061.623158; Mon, 15 Aug 2022 07:01: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 1oNU6c-0000SE-P7; Mon, 15 Aug 2022 07:01:46 +0000
Received: by outflank-mailman (input) for mailman id 387061;
 Mon, 15 Aug 2022 07:01:46 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNU6b-0000Rx-W5
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 07:01:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNU6b-0006Ug-VP
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 07:01:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNU6b-00043U-Ui
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 07:01:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MN0KDFlA0thCtLjNEORhfTQQ4LfgukdjsJI8mlYrWdQ=; b=i8xH9RqFYugA/yedX0Gl8szSh/
	8+cTbKLVYgpwMSKVPucJV0g5vlm/muuWgSrcEXH9GFcHgCT428QsI9lNxYqKR8faHxsHw8x8wc4Qj
	T1OeYKUgkZgf0cNZlRfduOr0Ur5W/iyI1cwhuQnTwr1HAPFe10fSQ4qWfCGclLzYG0Gk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libs/libs.mk: Remove the need for $(PKG_CONFIG_INST)
Message-Id: <E1oNU6b-00043U-Ui@xenbits.xenproject.org>
Date: Mon, 15 Aug 2022 07:01:45 +0000

commit 5e49cfcaf03180209b5be79093349c1abd0d0269
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Mon Aug 15 08:55:34 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 08:55:34 2022 +0200

    libs/libs.mk: Remove the need for $(PKG_CONFIG_INST)
    
    We can simply use $(PKG_CONFIG) to set the parameters, and add it to
    $(TARGETS) as necessary.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 tools/libs/libs.mk | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/tools/libs/libs.mk b/tools/libs/libs.mk
index e02f91f95e..7aee449370 100644
--- a/tools/libs/libs.mk
+++ b/tools/libs/libs.mk
@@ -37,10 +37,10 @@ PKG_CONFIG_LIB := $(LIB_FILE_NAME)
 PKG_CONFIG_REQPRIV := $(subst $(space),$(comma),$(strip $(foreach lib,$(patsubst ctrl,control,$(USELIBS_$(LIBNAME))),xen$(lib))))
 
 ifneq ($(CONFIG_LIBXC_MINIOS),y)
-PKG_CONFIG_INST := $(PKG_CONFIG)
-$(PKG_CONFIG_INST): PKG_CONFIG_PREFIX = $(prefix)
-$(PKG_CONFIG_INST): PKG_CONFIG_INCDIR = $(includedir)
-$(PKG_CONFIG_INST): PKG_CONFIG_LIBDIR = $(libdir)
+TARGETS += $(PKG_CONFIG)
+$(PKG_CONFIG): PKG_CONFIG_PREFIX = $(prefix)
+$(PKG_CONFIG): PKG_CONFIG_INCDIR = $(includedir)
+$(PKG_CONFIG): PKG_CONFIG_LIBDIR = $(libdir)
 endif
 
 PKG_CONFIG_LOCAL := $(PKG_CONFIG_DIR)/$(PKG_CONFIG)
@@ -55,7 +55,7 @@ $(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_INCLUDE)
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_LIBDIR = $(CURDIR)
 
 .PHONY: all
-all: headers.chk $(TARGETS) $(PKG_CONFIG_INST) $(PKG_CONFIG_LOCAL) libxen$(LIBNAME).map $(LIBHEADERS)
+all: headers.chk $(TARGETS) $(PKG_CONFIG_LOCAL) libxen$(LIBNAME).map $(LIBHEADERS)
 
 ifneq ($(NO_HEADERS_CHK),y)
 headers.chk:
@@ -127,7 +127,6 @@ clean::
 	rm -rf $(TARGETS) *~ $(DEPS_RM) $(OBJS-y) $(PIC_OBJS)
 	rm -f lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR) lib$(LIB_FILE_NAME).so.$(MAJOR)
 	rm -f headers.chk headers.lst
-	rm -f $(PKG_CONFIG)
 
 .PHONY: distclean
 distclean: clean
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Aug 15 07:01:56 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Aug 2022 07:01:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387065.623163 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNU6m-0000XF-TJ; Mon, 15 Aug 2022 07:01:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387065.623163; Mon, 15 Aug 2022 07:01: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 1oNU6m-0000X8-Qd; Mon, 15 Aug 2022 07:01:56 +0000
Received: by outflank-mailman (input) for mailman id 387065;
 Mon, 15 Aug 2022 07:01:56 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNU6m-0000Wz-2j
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 07:01:56 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNU6m-0006Un-22
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 07:01:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNU6m-000447-1G
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 07:01:56 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=2rugjPmktE4IiiXfiCvBoWWkG6qGieez5X7B82x2+cE=; b=J7kc6nO9u7J3sEAbPezWrD4Ff7
	igJ5usg0tolqfrHLFS7xVeIWBfDqfnT1IckbFIkAhK3CZk8ed3W70tWaNH3C5UjuvY7DUOAjFqvgh
	PNHglquJHjayi7wetNt1O2wxkegIYh+HGFBh61S6CZuNVXqT08pd6tMDv1CwjSPzmB3k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libs/libs.mk: Rework target headers.chk dependencies
Message-Id: <E1oNU6m-000447-1G@xenbits.xenproject.org>
Date: Mon, 15 Aug 2022 07:01:56 +0000

commit 7547268c359eeef1a4d8e578c612e7cc9350992d
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Mon Aug 15 08:55:36 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 08:55:36 2022 +0200

    libs/libs.mk: Rework target headers.chk dependencies
    
    There is no need to call the "headers.chk" target when it isn't
    wanted, so it never need to be .PHONY.
    
    Also, there is no more reason to separate the prerequisites from the
    recipe.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 tools/libs/libs.mk | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/tools/libs/libs.mk b/tools/libs/libs.mk
index 7aee449370..f778a7df82 100644
--- a/tools/libs/libs.mk
+++ b/tools/libs/libs.mk
@@ -55,22 +55,20 @@ $(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_INCLUDE)
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_LIBDIR = $(CURDIR)
 
 .PHONY: all
-all: headers.chk $(TARGETS) $(PKG_CONFIG_LOCAL) libxen$(LIBNAME).map $(LIBHEADERS)
+all: $(TARGETS) $(PKG_CONFIG_LOCAL) libxen$(LIBNAME).map $(LIBHEADERS)
 
 ifneq ($(NO_HEADERS_CHK),y)
-headers.chk:
+all: headers.chk
+
+headers.chk: $(LIBHEADERS) $(AUTOINCS)
 	for i in $(filter %.h,$^); do \
 	    $(CC) -x c -ansi -Wall -Werror $(CFLAGS_xeninclude) \
 	          -S -o /dev/null $$i || exit 1; \
 	    echo $$i; \
 	done >$@.new
 	mv $@.new $@
-else
-.PHONY: headers.chk
 endif
 
-headers.chk: $(LIBHEADERS) $(AUTOINCS)
-
 headers.lst: FORCE
 	@{ set -e; $(foreach h,$(LIBHEADERS),echo $(h);) } > $@.tmp
 	@$(call move-if-changed,$@.tmp,$@)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Aug 15 08:00:10 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Aug 2022 08:00:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387109.623211 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNV13-0000NW-Ud; Mon, 15 Aug 2022 08:00:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387109.623211; Mon, 15 Aug 2022 08:00:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNV13-0000ND-OY; Mon, 15 Aug 2022 08:00:05 +0000
Received: by outflank-mailman (input) for mailman id 387109;
 Mon, 15 Aug 2022 08:00:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNV12-0000Cj-LP
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 08:00:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNV12-0007yl-JE
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 08:00:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNV12-0006p9-Fx
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 08:00:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=w+YTbKeIEOjkRQH3ozLd3+wdY150qJj4JpxJxEtT8vE=; b=u/uzIsCaQ7Pb4WhcH9ywOd/P7v
	j8xEAhXc41O1+vFMGa+C8pj02AVez2uT0T7Y1++uo85AWHr50s8bBEiT0Zg8pNmY7WeWko3jVMYOb
	KYs8VDk2no07xxR/2+L30hJrna6sVIOHTvgxbxV4ZWQW0sCrEL/bYcYWXVESbgl3bah4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] amd/msr: implement VIRT_SPEC_CTRL for HVM guests on top of SPEC_CTRL
Message-Id: <E1oNV12-0006p9-Fx@xenbits.xenproject.org>
Date: Mon, 15 Aug 2022 08:00:04 +0000

commit ebaaa72ee080c8774b1df5783220d4811159c327
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Aug 15 09:57:23 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 09:57:23 2022 +0200

    amd/msr: implement VIRT_SPEC_CTRL for HVM guests on top of SPEC_CTRL
    
    Use the logic to set shadow SPEC_CTRL values in order to implement
    support for VIRT_SPEC_CTRL (signaled by VIRT_SSBD CPUID flag) for HVM
    guests. This includes using the spec_ctrl vCPU MSR variable to store
    the guest set value of VIRT_SPEC_CTRL.SSBD, which will be OR'ed with
    any SPEC_CTRL values being set by the guest.
    
    On hardware having SPEC_CTRL VIRT_SPEC_CTRL will not be offered by
    default to guests. VIRT_SPEC_CTRL will only be part of the max CPUID
    policy so it can be enabled for compatibility purposes.
    
    Use '!' to annotate the feature in order to express that the presence
    of the bit is not directly tied to its value in the host policy.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpuid.c                        |  7 +++++++
 xen/arch/x86/hvm/hvm.c                      |  1 +
 xen/arch/x86/include/asm/msr.h              |  4 ++++
 xen/arch/x86/msr.c                          | 18 ++++++++++++++++++
 xen/arch/x86/spec_ctrl.c                    |  3 ++-
 xen/include/public/arch-x86/cpufeatureset.h |  2 +-
 6 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 7e0b395698..979dcf8164 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -550,6 +550,13 @@ static void __init calculate_hvm_max_policy(void)
         __clear_bit(X86_FEATURE_IBRSB, hvm_featureset);
         __clear_bit(X86_FEATURE_IBRS, hvm_featureset);
     }
+    else if ( boot_cpu_has(X86_FEATURE_AMD_SSBD) )
+        /*
+         * If SPEC_CTRL.SSBD is available VIRT_SPEC_CTRL.SSBD can be exposed
+         * and implemented using the former. Expose in the max policy only as
+         * the preference is for guests to use SPEC_CTRL.SSBD if available.
+         */
+        __set_bit(X86_FEATURE_VIRT_SSBD, hvm_featureset);
 
     /*
      * With VT-x, some features are only supported by Xen if dedicated
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 0dd320a6a9..6b5d585ed4 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -1337,6 +1337,7 @@ static const uint32_t msrs_to_send[] = {
     MSR_INTEL_MISC_FEATURES_ENABLES,
     MSR_IA32_BNDCFGS,
     MSR_IA32_XSS,
+    MSR_VIRT_SPEC_CTRL,
     MSR_AMD64_DR0_ADDRESS_MASK,
     MSR_AMD64_DR1_ADDRESS_MASK,
     MSR_AMD64_DR2_ADDRESS_MASK,
diff --git a/xen/arch/x86/include/asm/msr.h b/xen/arch/x86/include/asm/msr.h
index ce4fe51afe..ab6fbb5051 100644
--- a/xen/arch/x86/include/asm/msr.h
+++ b/xen/arch/x86/include/asm/msr.h
@@ -291,6 +291,7 @@ struct vcpu_msrs
 {
     /*
      * 0x00000048 - MSR_SPEC_CTRL
+     * 0xc001011f - MSR_VIRT_SPEC_CTRL (if X86_FEATURE_AMD_SSBD)
      *
      * For PV guests, this holds the guest kernel value.  It is accessed on
      * every entry/exit path.
@@ -306,6 +307,9 @@ struct vcpu_msrs
      * We must clear/restore Xen's value before/after VMRUN to avoid unduly
      * influencing the guest.  In order to support "behind the guest's back"
      * protections, we load this value (commonly 0) before VMRUN.
+     *
+     * Once of such "behind the guest's back" usages is setting SPEC_CTRL.SSBD
+     * if the guest sets VIRT_SPEC_CTRL.SSBD.
      */
     struct {
         uint32_t raw;
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index d2e2dc2a6b..2ae1fcfd5f 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -389,6 +389,13 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
                ? K8_HWCR_TSC_FREQ_SEL : 0;
         break;
 
+    case MSR_VIRT_SPEC_CTRL:
+        if ( !cp->extd.virt_ssbd )
+            goto gp_fault;
+
+        *val = msrs->spec_ctrl.raw & SPEC_CTRL_SSBD;
+        break;
+
     case MSR_AMD64_DE_CFG:
         if ( !(cp->x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON)) )
             goto gp_fault;
@@ -674,6 +681,17 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
             wrmsr_tsc_aux(val);
         break;
 
+    case MSR_VIRT_SPEC_CTRL:
+        if ( !cp->extd.virt_ssbd )
+            goto gp_fault;
+
+        /* Only supports SSBD bit, the rest are ignored. */
+        if ( val & SPEC_CTRL_SSBD )
+            msrs->spec_ctrl.raw |= SPEC_CTRL_SSBD;
+        else
+            msrs->spec_ctrl.raw &= ~SPEC_CTRL_SSBD;
+        break;
+
     case MSR_AMD64_DE_CFG:
         /*
          * OpenBSD 6.7 will panic if writing to DE_CFG triggers a #GP:
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index 160cc68086..96e7f0983a 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -509,12 +509,13 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
      * mitigation support for guests.
      */
 #ifdef CONFIG_HVM
-    printk("  Support for HVM VMs:%s%s%s%s%s%s\n",
+    printk("  Support for HVM VMs:%s%s%s%s%s%s%s\n",
            (boot_cpu_has(X86_FEATURE_SC_MSR_HVM) ||
             boot_cpu_has(X86_FEATURE_SC_RSB_HVM) ||
             boot_cpu_has(X86_FEATURE_IBPB_ENTRY_HVM) ||
             opt_eager_fpu || opt_md_clear_hvm)       ? ""               : " None",
            boot_cpu_has(X86_FEATURE_SC_MSR_HVM)      ? " MSR_SPEC_CTRL" : "",
+           boot_cpu_has(X86_FEATURE_SC_MSR_HVM)      ? " MSR_VIRT_SPEC_CTRL" : "",
            boot_cpu_has(X86_FEATURE_SC_RSB_HVM)      ? " RSB"           : "",
            opt_eager_fpu                             ? " EAGER_FPU"     : "",
            opt_md_clear_hvm                          ? " MD_CLEAR"      : "",
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 4b8925b7b8..42f48a8ae2 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -265,7 +265,7 @@ XEN_CPUFEATURE(IBRS_SAME_MODE, 8*32+19) /*S  IBRS provides same-mode protection
 XEN_CPUFEATURE(NO_LMSL,       8*32+20) /*S  EFER.LMSLE no longer supported. */
 XEN_CPUFEATURE(AMD_PPIN,      8*32+23) /*   Protected Processor Inventory Number */
 XEN_CPUFEATURE(AMD_SSBD,      8*32+24) /*S  MSR_SPEC_CTRL.SSBD available */
-XEN_CPUFEATURE(VIRT_SSBD,     8*32+25) /*   MSR_VIRT_SPEC_CTRL.SSBD */
+XEN_CPUFEATURE(VIRT_SSBD,     8*32+25) /*!  MSR_VIRT_SPEC_CTRL.SSBD */
 XEN_CPUFEATURE(SSB_NO,        8*32+26) /*A  Hardware not vulnerable to SSB */
 XEN_CPUFEATURE(PSFD,          8*32+28) /*S  MSR_SPEC_CTRL.PSFD */
 XEN_CPUFEATURE(BTC_NO,        8*32+29) /*A  Hardware not vulnerable to Branch Type Confusion */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Aug 15 08:00:16 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Aug 2022 08:00:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387110.623214 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNV1D-0000Uz-Vi; Mon, 15 Aug 2022 08:00:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387110.623214; Mon, 15 Aug 2022 08:00:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNV1D-0000Us-Sz; Mon, 15 Aug 2022 08:00:15 +0000
Received: by outflank-mailman (input) for mailman id 387110;
 Mon, 15 Aug 2022 08:00:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNV1C-0000Uk-NS
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 08:00:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNV1C-00084A-Mh
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 08:00:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNV1C-0006q7-Lm
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 08:00:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=AZEaEfd8DfQ1/EzTd73ky/GSgElbqOguOY3T4OvFHiA=; b=U984EMAkwW8C4JLyrdlkjEpKxl
	MeQp1owq3uIpdKVKxW9a+IrKMqb6pyE3seCt3tGeY5yQxnTljGERfCVovs8d4wInZW59DbPhNbhee
	bYZEwBZKOuAalpHDMXWiwSHDVu9WEdNCgNgkITAv1gHK3mdx1UlYJZB+f6kKWTPVDpRk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] amd/msr: allow passthrough of VIRT_SPEC_CTRL for HVM guests
Message-Id: <E1oNV1C-0006q7-Lm@xenbits.xenproject.org>
Date: Mon, 15 Aug 2022 08:00:14 +0000

commit a2eeaa6906101fbf322766f37f8f061dd36fe58d
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Aug 15 09:58:08 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 09:58:08 2022 +0200

    amd/msr: allow passthrough of VIRT_SPEC_CTRL for HVM guests
    
    Allow HVM guests access to MSR_VIRT_SPEC_CTRL if the platform Xen is
    running on has support for it.  This requires adding logic in the
    vm{entry,exit} paths for SVM in order to context switch between the
    hypervisor value and the guest one.  The added handlers for context
    switch will also be used for the legacy SSBD support.
    
    Introduce a new synthetic feature leaf (X86_FEATURE_VIRT_SC_MSR_HVM)
    to signal whether VIRT_SPEC_CTRL needs to be handled on guest
    vm{entry,exit}.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpuid.c                   | 14 ++++++++++++++
 xen/arch/x86/hvm/svm/entry.S           |  8 ++++++++
 xen/arch/x86/hvm/svm/svm.c             | 35 ++++++++++++++++++++++++++++++++++
 xen/arch/x86/include/asm/cpufeatures.h |  2 +-
 xen/arch/x86/include/asm/msr.h         | 10 ++++++++++
 xen/arch/x86/msr.c                     | 16 ++++++++++++----
 xen/arch/x86/spec_ctrl.c               |  9 ++++++++-
 7 files changed, 88 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 979dcf8164..a4a366ad84 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -541,6 +541,13 @@ static void __init calculate_hvm_max_policy(void)
          raw_cpuid_policy.basic.sep )
         __set_bit(X86_FEATURE_SEP, hvm_featureset);
 
+    /*
+     * VIRT_SSBD is exposed in the default policy as a result of
+     * VIRT_SC_MSR_HVM being set, it also needs exposing in the max policy.
+     */
+    if ( boot_cpu_has(X86_FEATURE_VIRT_SC_MSR_HVM) )
+        __set_bit(X86_FEATURE_VIRT_SSBD, hvm_featureset);
+
     /*
      * If Xen isn't virtualising MSR_SPEC_CTRL for HVM guests (functional
      * availability, or admin choice), hide the feature.
@@ -597,6 +604,13 @@ static void __init calculate_hvm_def_policy(void)
     guest_common_feature_adjustments(hvm_featureset);
     guest_common_default_feature_adjustments(hvm_featureset);
 
+    /*
+     * Only expose VIRT_SSBD if AMD_SSBD is not available, and thus
+     * VIRT_SC_MSR_HVM is set.
+     */
+    if ( boot_cpu_has(X86_FEATURE_VIRT_SC_MSR_HVM) )
+        __set_bit(X86_FEATURE_VIRT_SSBD, hvm_featureset);
+
     sanitise_featureset(hvm_featureset);
     cpuid_featureset_to_policy(hvm_featureset, p);
     recalculate_xstate(p);
diff --git a/xen/arch/x86/hvm/svm/entry.S b/xen/arch/x86/hvm/svm/entry.S
index a60d759f71..a26589aa9a 100644
--- a/xen/arch/x86/hvm/svm/entry.S
+++ b/xen/arch/x86/hvm/svm/entry.S
@@ -19,6 +19,8 @@
 
         .file "svm/entry.S"
 
+#include <xen/lib.h>
+
 #include <asm/asm_defns.h>
 #include <asm/page.h>
 
@@ -57,6 +59,9 @@ __UNLIKELY_END(nsvm_hap)
 
         clgi
 
+        ALTERNATIVE "", STR(call vmentry_virt_spec_ctrl), \
+                        X86_FEATURE_VIRT_SC_MSR_HVM
+
         /* WARNING! `ret`, `call *`, `jmp *` not safe beyond this point. */
         /* SPEC_CTRL_EXIT_TO_SVM       Req: b=curr %rsp=regs/cpuinfo, Clob: acd */
         .macro svm_vmentry_spec_ctrl
@@ -126,6 +131,9 @@ __UNLIKELY_END(nsvm_hap)
         ALTERNATIVE "", svm_vmexit_spec_ctrl, X86_FEATURE_SC_MSR_HVM
         /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */
 
+        ALTERNATIVE "", STR(call vmexit_virt_spec_ctrl), \
+                        X86_FEATURE_VIRT_SC_MSR_HVM
+
         /*
          * STGI is executed unconditionally, and is sufficiently serialising
          * to safely resolve any Spectre-v1 concerns in the above logic.
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 0849a9dc5f..53ce2edd35 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -52,6 +52,7 @@
 #include <asm/hvm/svm/svmdebug.h>
 #include <asm/hvm/svm/nestedsvm.h>
 #include <asm/hvm/nestedhvm.h>
+#include <asm/spec_ctrl.h>
 #include <asm/x86_emulate.h>
 #include <public/sched.h>
 #include <asm/hvm/vpt.h>
@@ -610,6 +611,16 @@ static void cf_check svm_cpuid_policy_changed(struct vcpu *v)
     svm_intercept_msr(v, MSR_SPEC_CTRL,
                       cp->extd.ibrs ? MSR_INTERCEPT_NONE : MSR_INTERCEPT_RW);
 
+    /*
+     * Always trap write accesses to VIRT_SPEC_CTRL in order to cache the guest
+     * setting and avoid having to perform a rdmsr on vmexit to get the guest
+     * setting even if VIRT_SSBD is offered to Xen itself.
+     */
+    svm_intercept_msr(v, MSR_VIRT_SPEC_CTRL,
+                      cp->extd.virt_ssbd && cpu_has_virt_ssbd &&
+                      !cpu_has_amd_ssbd ?
+                      MSR_INTERCEPT_WRITE : MSR_INTERCEPT_RW);
+
     /* Give access to MSR_PRED_CMD if the guest has been told about it. */
     svm_intercept_msr(v, MSR_PRED_CMD,
                       cp->extd.ibpb ? MSR_INTERCEPT_NONE : MSR_INTERCEPT_RW);
@@ -3105,6 +3116,30 @@ void svm_vmexit_handler(struct cpu_user_regs *regs)
     vmcb_set_vintr(vmcb, intr);
 }
 
+/* Called with GIF=0. */
+void vmexit_virt_spec_ctrl(void)
+{
+    unsigned int val = opt_ssbd ? SPEC_CTRL_SSBD : 0;
+
+    if ( val == current->arch.msrs->virt_spec_ctrl.raw )
+        return;
+
+    if ( cpu_has_virt_ssbd )
+        wrmsr(MSR_VIRT_SPEC_CTRL, val, 0);
+}
+
+/* Called with GIF=0. */
+void vmentry_virt_spec_ctrl(void)
+{
+    unsigned int val = current->arch.msrs->virt_spec_ctrl.raw;
+
+    if ( val == (opt_ssbd ? SPEC_CTRL_SSBD : 0) )
+        return;
+
+    if ( cpu_has_virt_ssbd )
+        wrmsr(MSR_VIRT_SPEC_CTRL, val, 0);
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/x86/include/asm/cpufeatures.h b/xen/arch/x86/include/asm/cpufeatures.h
index 672c9ee22b..3895de4faf 100644
--- a/xen/arch/x86/include/asm/cpufeatures.h
+++ b/xen/arch/x86/include/asm/cpufeatures.h
@@ -24,7 +24,7 @@ XEN_CPUFEATURE(APERFMPERF,        X86_SYNTH( 8)) /* APERFMPERF */
 XEN_CPUFEATURE(MFENCE_RDTSC,      X86_SYNTH( 9)) /* MFENCE synchronizes RDTSC */
 XEN_CPUFEATURE(XEN_SMEP,          X86_SYNTH(10)) /* SMEP gets used by Xen itself */
 XEN_CPUFEATURE(XEN_SMAP,          X86_SYNTH(11)) /* SMAP gets used by Xen itself */
-/* Bit 12 - unused. */
+XEN_CPUFEATURE(VIRT_SC_MSR_HVM,   X86_SYNTH(12)) /* MSR_VIRT_SPEC_CTRL exposed to HVM */
 XEN_CPUFEATURE(IND_THUNK_LFENCE,  X86_SYNTH(13)) /* Use IND_THUNK_LFENCE */
 XEN_CPUFEATURE(IND_THUNK_JMP,     X86_SYNTH(14)) /* Use IND_THUNK_JMP */
 XEN_CPUFEATURE(SC_NO_BRANCH_HARDEN, X86_SYNTH(15)) /* (Disable) Conditional branch hardening */
diff --git a/xen/arch/x86/include/asm/msr.h b/xen/arch/x86/include/asm/msr.h
index ab6fbb5051..de18e90b2e 100644
--- a/xen/arch/x86/include/asm/msr.h
+++ b/xen/arch/x86/include/asm/msr.h
@@ -375,6 +375,16 @@ struct vcpu_msrs
      */
     uint32_t tsc_aux;
 
+    /*
+     * 0xc001011f - MSR_VIRT_SPEC_CTRL (if !X86_FEATURE_AMD_SSBD)
+     *
+     * AMD only. Guest selected value, context switched on guest VM
+     * entry/exit.
+     */
+    struct {
+        uint32_t raw;
+    } virt_spec_ctrl;
+
     /*
      * 0xc00110{27,19-1b} MSR_AMD64_DR{0-3}_ADDRESS_MASK
      *
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 2ae1fcfd5f..95416995a5 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -393,7 +393,10 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
         if ( !cp->extd.virt_ssbd )
             goto gp_fault;
 
-        *val = msrs->spec_ctrl.raw & SPEC_CTRL_SSBD;
+        if ( cpu_has_amd_ssbd )
+            *val = msrs->spec_ctrl.raw & SPEC_CTRL_SSBD;
+        else
+            *val = msrs->virt_spec_ctrl.raw;
         break;
 
     case MSR_AMD64_DE_CFG:
@@ -686,10 +689,15 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
             goto gp_fault;
 
         /* Only supports SSBD bit, the rest are ignored. */
-        if ( val & SPEC_CTRL_SSBD )
-            msrs->spec_ctrl.raw |= SPEC_CTRL_SSBD;
+        if ( cpu_has_amd_ssbd )
+        {
+            if ( val & SPEC_CTRL_SSBD )
+                msrs->spec_ctrl.raw |= SPEC_CTRL_SSBD;
+            else
+                msrs->spec_ctrl.raw &= ~SPEC_CTRL_SSBD;
+        }
         else
-            msrs->spec_ctrl.raw &= ~SPEC_CTRL_SSBD;
+            msrs->virt_spec_ctrl.raw = val & SPEC_CTRL_SSBD;
         break;
 
     case MSR_AMD64_DE_CFG:
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index 96e7f0983a..ec44205309 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -513,9 +513,12 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
            (boot_cpu_has(X86_FEATURE_SC_MSR_HVM) ||
             boot_cpu_has(X86_FEATURE_SC_RSB_HVM) ||
             boot_cpu_has(X86_FEATURE_IBPB_ENTRY_HVM) ||
+            boot_cpu_has(X86_FEATURE_VIRT_SC_MSR_HVM) ||
             opt_eager_fpu || opt_md_clear_hvm)       ? ""               : " None",
            boot_cpu_has(X86_FEATURE_SC_MSR_HVM)      ? " MSR_SPEC_CTRL" : "",
-           boot_cpu_has(X86_FEATURE_SC_MSR_HVM)      ? " MSR_VIRT_SPEC_CTRL" : "",
+           (boot_cpu_has(X86_FEATURE_SC_MSR_HVM) ||
+            boot_cpu_has(X86_FEATURE_VIRT_SC_MSR_HVM)) ? " MSR_VIRT_SPEC_CTRL"
+                                                       : "",
            boot_cpu_has(X86_FEATURE_SC_RSB_HVM)      ? " RSB"           : "",
            opt_eager_fpu                             ? " EAGER_FPU"     : "",
            opt_md_clear_hvm                          ? " MD_CLEAR"      : "",
@@ -1240,6 +1243,10 @@ void __init init_speculation_mitigations(void)
             setup_force_cpu_cap(X86_FEATURE_SC_MSR_HVM);
     }
 
+    /* Support VIRT_SPEC_CTRL.SSBD if AMD_SSBD is not available. */
+    if ( opt_msr_sc_hvm && !cpu_has_amd_ssbd && cpu_has_virt_ssbd )
+        setup_force_cpu_cap(X86_FEATURE_VIRT_SC_MSR_HVM);
+
     /* Figure out default_xen_spec_ctrl. */
     if ( has_spec_ctrl && ibrs )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Aug 15 08:00:26 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Aug 2022 08:00:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387111.623218 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNV1O-0000fx-14; Mon, 15 Aug 2022 08:00:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387111.623218; Mon, 15 Aug 2022 08: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 1oNV1N-0000fp-Ui; Mon, 15 Aug 2022 08:00:25 +0000
Received: by outflank-mailman (input) for mailman id 387111;
 Mon, 15 Aug 2022 08:00:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNV1M-0000fR-Qj
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 08:00:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNV1M-00084L-Q4
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 08:00:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNV1M-0006qk-P9
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 08:00:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wV+tigz0P2JT/klXPIlx82/palFytDUCRhGvtm1a17w=; b=c9sdJu1eMlKTGHoMXn3TtIFIXp
	6HYxjlSZLjjrItPpVk0PlG15SObJKv0JoOaADwc63bnafGfYwsi+N1T0rJRXDJRjewTGKM6Ak2r8s
	3aMddQwmnuaoIlO/3+pSWzxI7pkLiYy7epQ+QtmCDh0dUQOcwmQrLUFo+VrgjoUQwxeM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] amd/msr: implement VIRT_SPEC_CTRL for HVM guests using legacy SSBD
Message-Id: <E1oNV1M-0006qk-P9@xenbits.xenproject.org>
Date: Mon, 15 Aug 2022 08:00:24 +0000

commit 646589ac148a2ff6bb222a6081b4d7b13ee468c0
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Aug 15 09:58:55 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 09:58:55 2022 +0200

    amd/msr: implement VIRT_SPEC_CTRL for HVM guests using legacy SSBD
    
    Expose VIRT_SSBD to guests if the hardware supports setting SSBD in
    the LS_CFG MSR (a.k.a. non-architectural way). Different AMD CPU
    families use different bits in LS_CFG, so exposing VIRT_SPEC_CTRL.SSBD
    allows for an unified way of exposing SSBD support to guests on AMD
    hardware that's compatible migration wise, regardless of what
    underlying mechanism is used to set SSBD.
    
    Note that on AMD Family 17h and Hygon Family 18h processors the value
    of SSBD in LS_CFG is shared between threads on the same core, so
    there's extra logic in order to synchronize the value and have SSBD
    set as long as one of the threads in the core requires it to be set.
    Such logic also requires extra storage for each thread state, which is
    allocated at initialization time.
    
    Do the context switching of the SSBD selection in LS_CFG between
    hypervisor and guest in the same handler that's already used to switch
    the value of VIRT_SPEC_CTRL.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Henry Wang <Henry.Wang@arm.com>
---
 CHANGELOG.md                   |   1 +
 xen/arch/x86/cpu/amd.c         | 121 +++++++++++++++++++++++++++++++++++------
 xen/arch/x86/hvm/svm/svm.c     |   4 ++
 xen/arch/x86/include/asm/amd.h |   4 ++
 xen/arch/x86/spec_ctrl.c       |   4 +-
 5 files changed, 116 insertions(+), 18 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index a87a193e15..5e4bae5f35 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 ### Added / support upgraded
  - IOMMU superpage support on x86, affecting PV guests as well as HVM/PVH ones
    when they don't share page tables with the CPU (HAP / EPT / NPT).
+ - Support VIRT_SSBD feature for HVM guests on AMD.
 
 ### Removed / support downgraded
  - dropped support for the (x86-only) "vesa-mtrr" and "vesa-remap" command line options
diff --git a/xen/arch/x86/cpu/amd.c b/xen/arch/x86/cpu/amd.c
index d5f8e5e899..98c52d0686 100644
--- a/xen/arch/x86/cpu/amd.c
+++ b/xen/arch/x86/cpu/amd.c
@@ -48,6 +48,7 @@ boolean_param("allow_unsafe", opt_allow_unsafe);
 
 /* Signal whether the ACPI C1E quirk is required. */
 bool __read_mostly amd_acpi_c1e_quirk;
+bool __ro_after_init amd_legacy_ssbd;
 
 static inline int rdmsr_amd_safe(unsigned int msr, unsigned int *lo,
 				 unsigned int *hi)
@@ -685,23 +686,10 @@ void amd_init_lfence(struct cpuinfo_x86 *c)
  * Refer to the AMD Speculative Store Bypass whitepaper:
  * https://developer.amd.com/wp-content/resources/124441_AMD64_SpeculativeStoreBypassDisable_Whitepaper_final.pdf
  */
-void amd_init_ssbd(const struct cpuinfo_x86 *c)
+static bool set_legacy_ssbd(const struct cpuinfo_x86 *c, bool enable)
 {
 	int bit = -1;
 
-	if (cpu_has_ssb_no)
-		return;
-
-	if (cpu_has_amd_ssbd) {
-		/* Handled by common MSR_SPEC_CTRL logic */
-		return;
-	}
-
-	if (cpu_has_virt_ssbd) {
-		wrmsrl(MSR_VIRT_SPEC_CTRL, opt_ssbd ? SPEC_CTRL_SSBD : 0);
-		return;
-	}
-
 	switch (c->x86) {
 	case 0x15: bit = 54; break;
 	case 0x16: bit = 33; break;
@@ -715,20 +703,119 @@ void amd_init_ssbd(const struct cpuinfo_x86 *c)
 		if (rdmsr_safe(MSR_AMD64_LS_CFG, val) ||
 		    ({
 			    val &= ~mask;
-			    if (opt_ssbd)
+			    if (enable)
 				    val |= mask;
 			    false;
 		    }) ||
 		    wrmsr_safe(MSR_AMD64_LS_CFG, val) ||
 		    ({
 			    rdmsrl(MSR_AMD64_LS_CFG, val);
-			    (val & mask) != (opt_ssbd * mask);
+			    (val & mask) != (enable * mask);
 		    }))
 			bit = -1;
 	}
 
-	if (bit < 0)
+	return bit >= 0;
+}
+
+void amd_init_ssbd(const struct cpuinfo_x86 *c)
+{
+	if (cpu_has_ssb_no)
+		return;
+
+	if (cpu_has_amd_ssbd) {
+		/* Handled by common MSR_SPEC_CTRL logic */
+		return;
+	}
+
+	if (cpu_has_virt_ssbd) {
+		wrmsrl(MSR_VIRT_SPEC_CTRL, opt_ssbd ? SPEC_CTRL_SSBD : 0);
+		return;
+	}
+
+	if (!set_legacy_ssbd(c, opt_ssbd)) {
 		printk_once(XENLOG_ERR "No SSBD controls available\n");
+		if (amd_legacy_ssbd)
+			panic("CPU feature mismatch: no legacy SSBD\n");
+	} else if (c == &boot_cpu_data)
+		amd_legacy_ssbd = true;
+}
+
+static struct ssbd_ls_cfg {
+    bool locked;
+    unsigned int count;
+} __cacheline_aligned *ssbd_ls_cfg;
+static unsigned int __ro_after_init ssbd_max_cores;
+#define AMD_FAM17H_MAX_SOCKETS 2
+
+bool __init amd_setup_legacy_ssbd(void)
+{
+	unsigned int i;
+
+	if ((boot_cpu_data.x86 != 0x17 && boot_cpu_data.x86 != 0x18) ||
+	    boot_cpu_data.x86_num_siblings <= 1)
+		return true;
+
+	/*
+	 * One could be forgiven for thinking that c->x86_max_cores is the
+	 * correct value to use here.
+	 *
+	 * However, that value is derived from the current configuration, and
+	 * c->cpu_core_id is sparse on all but the top end CPUs.  Derive
+	 * max_cpus from ApicIdCoreIdSize which will cover any sparseness.
+	 */
+	if (boot_cpu_data.extended_cpuid_level >= 0x80000008) {
+		ssbd_max_cores = 1u << MASK_EXTR(cpuid_ecx(0x80000008), 0xf000);
+		ssbd_max_cores /= boot_cpu_data.x86_num_siblings;
+	}
+	if (!ssbd_max_cores)
+		return false;
+
+	ssbd_ls_cfg = xzalloc_array(struct ssbd_ls_cfg,
+	                            ssbd_max_cores * AMD_FAM17H_MAX_SOCKETS);
+	if (!ssbd_ls_cfg)
+		return false;
+
+	if (opt_ssbd)
+		for (i = 0; i < ssbd_max_cores * AMD_FAM17H_MAX_SOCKETS; i++)
+			/* Set initial state, applies to any (hotplug) CPU. */
+			ssbd_ls_cfg[i].count = boot_cpu_data.x86_num_siblings;
+
+	return true;
+}
+
+/*
+ * Executed from GIF==0 context: avoid using BUG/ASSERT or other functionality
+ * that relies on exceptions as those are not expected to run in GIF==0
+ * context.
+ */
+void amd_set_legacy_ssbd(bool enable)
+{
+	const struct cpuinfo_x86 *c = &current_cpu_data;
+	struct ssbd_ls_cfg *status;
+
+	if ((c->x86 != 0x17 && c->x86 != 0x18) || c->x86_num_siblings <= 1) {
+		set_legacy_ssbd(c, enable);
+		return;
+	}
+
+	status = &ssbd_ls_cfg[c->phys_proc_id * ssbd_max_cores +
+	                      c->cpu_core_id];
+
+	/*
+	 * Open code a very simple spinlock: this function is used with GIF==0
+	 * and different IF values, so would trigger the checklock detector.
+	 * Instead of trying to workaround the detector, use a very simple lock
+	 * implementation: it's better to reduce the amount of code executed
+	 * with GIF==0.
+	 */
+	while (test_and_set_bool(status->locked))
+		cpu_relax();
+	status->count += enable ? 1 : -1;
+	if (enable ? status->count == 1 : !status->count)
+		set_legacy_ssbd(c, enable);
+	barrier();
+	write_atomic(&status->locked, false);
 }
 
 /*
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 53ce2edd35..1aeaabcb13 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -3126,6 +3126,8 @@ void vmexit_virt_spec_ctrl(void)
 
     if ( cpu_has_virt_ssbd )
         wrmsr(MSR_VIRT_SPEC_CTRL, val, 0);
+    else
+        amd_set_legacy_ssbd(val);
 }
 
 /* Called with GIF=0. */
@@ -3138,6 +3140,8 @@ void vmentry_virt_spec_ctrl(void)
 
     if ( cpu_has_virt_ssbd )
         wrmsr(MSR_VIRT_SPEC_CTRL, val, 0);
+    else
+        amd_set_legacy_ssbd(val);
 }
 
 /*
diff --git a/xen/arch/x86/include/asm/amd.h b/xen/arch/x86/include/asm/amd.h
index a82382e6bf..6a42f68542 100644
--- a/xen/arch/x86/include/asm/amd.h
+++ b/xen/arch/x86/include/asm/amd.h
@@ -151,4 +151,8 @@ void check_enable_amd_mmconf_dmi(void);
 extern bool amd_acpi_c1e_quirk;
 void amd_check_disable_c1e(unsigned int port, u8 value);
 
+extern bool amd_legacy_ssbd;
+bool amd_setup_legacy_ssbd(void);
+void amd_set_legacy_ssbd(bool enable);
+
 #endif /* __AMD_H__ */
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index ec44205309..4e53056624 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -22,6 +22,7 @@
 #include <xen/param.h>
 #include <xen/warning.h>
 
+#include <asm/amd.h>
 #include <asm/hvm/svm/svm.h>
 #include <asm/microcode.h>
 #include <asm/msr.h>
@@ -1244,7 +1245,8 @@ void __init init_speculation_mitigations(void)
     }
 
     /* Support VIRT_SPEC_CTRL.SSBD if AMD_SSBD is not available. */
-    if ( opt_msr_sc_hvm && !cpu_has_amd_ssbd && cpu_has_virt_ssbd )
+    if ( opt_msr_sc_hvm && !cpu_has_amd_ssbd &&
+         (cpu_has_virt_ssbd || (amd_legacy_ssbd && amd_setup_legacy_ssbd())) )
         setup_force_cpu_cap(X86_FEATURE_VIRT_SC_MSR_HVM);
 
     /* Figure out default_xen_spec_ctrl. */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Aug 15 13:55:12 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Aug 2022 13:55:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387493.623728 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNaYc-0008NT-HK; Mon, 15 Aug 2022 13:55:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387493.623728; Mon, 15 Aug 2022 13:55:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNaYc-0008NJ-EN; Mon, 15 Aug 2022 13:55:06 +0000
Received: by outflank-mailman (input) for mailman id 387493;
 Mon, 15 Aug 2022 13:55:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNaYa-0008ND-RF
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:55:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNaYa-00064O-OX
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNaYa-0007my-NX
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:55:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NZM6aUEUM4y+v/k01JrkHOrPtIGEdIStvlpi6bGGcHk=; b=6qqbDHjuPQ2Xavio3/SYFZunS9
	+lvcmtV9Bq4EUgEWW3g3cy15Qv2rf2L8p709BGGtJIgnnaz2d/1Bakx9NNd61V1f+Zfv9/Nd1Vt4H
	S/b7KsaC5tXnT0/So2zzCMKy1EuY8Aslu33f0eqjbVginyYFolefkXaiWr/00ht3VQXc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] x86/spec-ctrl: Use IST RSB protection for !SVM systems
Message-Id: <E1oNaYa-0007my-NX@xenbits.xenproject.org>
Date: Mon, 15 Aug 2022 13:55:04 +0000

commit 4e351880f68e50fe1479c36a30e0e4e03d160c34
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Aug 15 15:31:49 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 15:31:49 2022 +0200

    x86/spec-ctrl: Use IST RSB protection for !SVM systems
    
    There is a corner case where a VT-x guest which manages to reliably trigger
    non-fatal #MC's could evade the rogue RSB speculation protections that were
    supposed to be in place.
    
    This is a lack of defence in depth; Xen does not architecturally execute more
    RET than CALL instructions, so an attacker would have to locate a different
    gadget (e.g. SpectreRSB) first to execute a transient path of excess RET
    instructions.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: e570e8d520ab542d8d35666b95cb3a0125b7b110
    master date: 2022-08-05 12:16:24 +0100
---
 xen/arch/x86/spec_ctrl.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index 864233f4cf..50660f3e23 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -1326,8 +1326,24 @@ void __init init_speculation_mitigations(void)
      * mappings.
      */
     if ( opt_rsb_hvm )
+    {
         setup_force_cpu_cap(X86_FEATURE_SC_RSB_HVM);
 
+        /*
+         * For SVM, Xen's RSB safety actions are performed before STGI, so
+         * behave atomically with respect to IST sources.
+         *
+         * For VT-x, NMIs are atomic with VMExit (the NMI gets queued but not
+         * delivered) whereas other IST sources are not atomic.  Specifically,
+         * #MC can hit ahead the RSB safety action in the vmexit path.
+         *
+         * Therefore, it is necessary for the IST logic to protect Xen against
+         * possible rogue RSB speculation.
+         */
+        if ( !cpu_has_svm )
+            default_spec_ctrl_flags |= SCF_ist_rsb;
+    }
+
     ibpb_calculations();
 
     /* Check whether Eager FPU should be enabled by default. */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Mon Aug 15 13:55:16 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Aug 2022 13:55:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387494.623732 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNaYm-0008Pf-IU; Mon, 15 Aug 2022 13:55:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387494.623732; Mon, 15 Aug 2022 13:55:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNaYm-0008PX-Fs; Mon, 15 Aug 2022 13:55:16 +0000
Received: by outflank-mailman (input) for mailman id 387494;
 Mon, 15 Aug 2022 13:55:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNaYk-0008PK-Sc
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:55:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNaYk-00064X-Ro
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:55:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNaYk-0007ng-Qo
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:55:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QEwj5JyDIBppECsXO/uFLu6NQZ+97Fm6b2rtRbfKq1c=; b=G4IDAjgZVlF3XFpkmp75ts7lmz
	PJI2Zt4ej1bqHGGQAVYw7GBhU0w7I8+SSjUbS27IN2VXrXBBWD2m3fNvLBY4eAvc7iEptLwjVyEdu
	VueeY/Af+IIdusuyEY/EGPAx14CB5PHXVHhu4eTLy0cr7Jk5z9nyK7+lKDgxhakY1FJk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] x86: Expose more MSR_ARCH_CAPS to hwdom
Message-Id: <E1oNaYk-0007ng-Qo@xenbits.xenproject.org>
Date: Mon, 15 Aug 2022 13:55:14 +0000

commit 2a362668cb4ad9a0784c4592968f881d7746ec0f
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Mon Aug 15 15:32:31 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 15:32:31 2022 +0200

    x86: Expose more MSR_ARCH_CAPS to hwdom
    
    commit e46474278a0e ("x86/intel: Expose MSR_ARCH_CAPS to dom0") started
    exposing MSR_ARCH_CAPS to dom0.  More bits in MSR_ARCH_CAPS have since
    been defined, but they haven't been exposed.  Update the list to allow
    them through.
    
    As one example, this allows a Linux Dom0 to know that it has the
    appropriate microcode via FB_CLEAR.  Notably, and with the updated
    microcode, this changes dom0's
    /sys/devices/system/cpu/vulnerabilities/mmio_stale_data changes from:
    
      "Vulnerable: Clear CPU buffers attempted, no microcode; SMT Host state unknown"
    
    to:
    
      "Mitigation: Clear CPU buffers; SMT Host state unknown"
    
    This exposes the MMIO Stale Data and Intel Branch History Injection
    (BHI) controls as well as the page size change MCE issue bit.
    
    Fixes: commit 2ebe8fe9b7e0 ("x86/spec-ctrl: Enumeration for MMIO Stale Data controls")
    Fixes: commit cea9ae062295 ("x86/spec-ctrl: Enumeration for new Intel BHI controls")
    Fixes: commit 59e89cdabc71 ("x86/vtx: Disable executable EPT superpages to work around CVE-2018-12207")
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: e83cd54611fec5b7a539fa1281a14319143490e6
    master date: 2022-08-09 16:35:25 +0100
---
 xen/arch/x86/msr.c              | 9 +++++++--
 xen/include/asm-x86/msr-index.h | 2 ++
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index da305c7aa4..103703dfc0 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -71,7 +71,9 @@ static void __init calculate_host_policy(void)
     mp->arch_caps.raw &=
         (ARCH_CAPS_RDCL_NO | ARCH_CAPS_IBRS_ALL | ARCH_CAPS_RSBA |
          ARCH_CAPS_SKIP_L1DFL | ARCH_CAPS_SSB_NO | ARCH_CAPS_MDS_NO |
-         ARCH_CAPS_IF_PSCHANGE_MC_NO | ARCH_CAPS_TSX_CTRL | ARCH_CAPS_TAA_NO);
+         ARCH_CAPS_IF_PSCHANGE_MC_NO | ARCH_CAPS_TSX_CTRL | ARCH_CAPS_TAA_NO |
+         ARCH_CAPS_SBDR_SSDP_NO | ARCH_CAPS_FBSDP_NO | ARCH_CAPS_PSDP_NO |
+         ARCH_CAPS_FB_CLEAR | ARCH_CAPS_RRSBA | ARCH_CAPS_BHI_NO);
 }
 
 static void __init calculate_pv_max_policy(void)
@@ -160,7 +162,10 @@ int init_domain_msr_policy(struct domain *d)
 
         mp->arch_caps.raw = val &
             (ARCH_CAPS_RDCL_NO | ARCH_CAPS_IBRS_ALL | ARCH_CAPS_RSBA |
-             ARCH_CAPS_SSB_NO | ARCH_CAPS_MDS_NO | ARCH_CAPS_TAA_NO);
+             ARCH_CAPS_SSB_NO | ARCH_CAPS_MDS_NO | ARCH_CAPS_IF_PSCHANGE_MC_NO |
+             ARCH_CAPS_TAA_NO | ARCH_CAPS_SBDR_SSDP_NO | ARCH_CAPS_FBSDP_NO |
+             ARCH_CAPS_PSDP_NO | ARCH_CAPS_FB_CLEAR | ARCH_CAPS_RRSBA |
+             ARCH_CAPS_BHI_NO);
     }
 
     d->arch.msr = mp;
diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h
index 3cb942eeac..c601d88993 100644
--- a/xen/include/asm-x86/msr-index.h
+++ b/xen/include/asm-x86/msr-index.h
@@ -71,6 +71,8 @@
 #define  ARCH_CAPS_PSDP_NO                  (_AC(1, ULL) << 15)
 #define  ARCH_CAPS_FB_CLEAR                 (_AC(1, ULL) << 17)
 #define  ARCH_CAPS_FB_CLEAR_CTRL            (_AC(1, ULL) << 18)
+#define  ARCH_CAPS_RRSBA                    (_AC(1, ULL) << 19)
+#define  ARCH_CAPS_BHI_NO                   (_AC(1, ULL) << 20)
 
 #define MSR_FLUSH_CMD                       0x0000010b
 #define  FLUSH_CMD_L1D                      (_AC(1, ULL) <<  0)
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Mon Aug 15 13:55:26 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Aug 2022 13:55:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387495.623735 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNaYw-0008Sb-Jo; Mon, 15 Aug 2022 13:55:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387495.623735; Mon, 15 Aug 2022 13:55:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNaYw-0008SU-HJ; Mon, 15 Aug 2022 13:55:26 +0000
Received: by outflank-mailman (input) for mailman id 387495;
 Mon, 15 Aug 2022 13:55:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNaYu-0008SJ-Vr
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:55:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNaYu-00064p-V0
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:55:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNaYu-0007oD-UB
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:55:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4OVfhfywuPJH5w1e7cSPsbkf6MwQwd0EPI8IRZdw+gY=; b=B+a/onKZSF8QXfO8LtxFK+7ZjY
	i2I7FJkf4qOGSYeQin3dRY2aODgSCbU5mi0uxuck+RadXvZMwg0yML5J7pTmCgpANucGpqLUHhYna
	Fqw+uVTG/49YYd4a+ko/Tdes43dcyVrSj6oa2su05fLx5ySlrZzS9nkpIumc3lTakfMw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] xen/sched: setup dom0 vCPUs affinity only once
Message-Id: <E1oNaYu-0007oD-UB@xenbits.xenproject.org>
Date: Mon, 15 Aug 2022 13:55:24 +0000

commit 0f7eff5e0303aaf1d17d29fab7a34f0d50a241b0
Author:     Dario Faggioli <dfaggioli@suse.com>
AuthorDate: Mon Aug 15 15:33:09 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 15:33:09 2022 +0200

    xen/sched: setup dom0 vCPUs affinity only once
    
    Right now, affinity for dom0 vCPUs is setup in two steps. This is a
    problem as, at least in Credit2, unit_insert() sees and uses the
    "intermediate" affinity, and place the vCPUs on CPUs where they cannot
    be run. And this in turn results in boot hangs, if the "dom0_nodes"
    parameter is used.
    
    Fix this by setting up the affinity properly once and for all, in
    sched_init_vcpu() called by create_vcpu().
    
    Note that, unless a soft-affinity is explicitly specified for dom0 (by
    using the relaxed mode of "dom0_nodes") we set it to the default, which
    is all CPUs, instead of computing it basing on hard affinity (if any).
    This is because hard and soft affinity should be considered as
    independent user controlled properties. In fact, if we dor derive dom0's
    soft-affinity from its boot-time hard-affinity, such computed value will
    continue to be used even if later the user changes the hard-affinity.
    And this could result in the vCPUs behaving differently than what the
    user wanted and expects.
    
    Fixes: dafd936dddbd ("Make credit2 the default scheduler")
    Reported-by: Olaf Hering <ohering@suse.de>
    Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: c79e4d209be3ed2a6b8e97c35944786ed2a66b94
    master date: 2022-08-11 11:46:22 +0200
---
 xen/common/sched/core.c | 63 ++++++++++++++++++++++++++++++-------------------
 1 file changed, 39 insertions(+), 24 deletions(-)

diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c
index 8f4b1ca10d..f07bd2681f 100644
--- a/xen/common/sched/core.c
+++ b/xen/common/sched/core.c
@@ -571,12 +571,46 @@ int sched_init_vcpu(struct vcpu *v)
         return 1;
     }
 
-    /*
-     * Initialize affinity settings. The idler, and potentially
-     * domain-0 VCPUs, are pinned onto their respective physical CPUs.
-     */
-    if ( is_idle_domain(d) || (is_hardware_domain(d) && opt_dom0_vcpus_pin) )
+    if ( is_idle_domain(d) )
+    {
+        /* Idle vCPUs are always pinned onto their respective pCPUs */
+        sched_set_affinity(unit, cpumask_of(processor), &cpumask_all);
+    }
+    else if ( pv_shim && v->vcpu_id == 0 )
+    {
+        /*
+         * PV-shim: vcpus are pinned 1:1. Initially only 1 cpu is online,
+         * others will be dealt with when onlining them. This avoids pinning
+         * a vcpu to a not yet online cpu here.
+         */
+        sched_set_affinity(unit, cpumask_of(0), cpumask_of(0));
+    }
+    else if ( is_hardware_domain(d) && opt_dom0_vcpus_pin )
+    {
+        /*
+         * If dom0_vcpus_pin is specified, dom0 vCPUs are pinned 1:1 to
+         * their respective pCPUs too.
+         */
         sched_set_affinity(unit, cpumask_of(processor), &cpumask_all);
+    }
+#ifdef CONFIG_X86
+    else if ( d->domain_id == 0 )
+    {
+        /*
+         * In absence of dom0_vcpus_pin instead, the hard and soft affinity of
+         * dom0 is controlled by the (x86 only) dom0_nodes parameter. At this
+         * point it has been parsed and decoded into the dom0_cpus mask.
+         *
+         * Note that we always honor what user explicitly requested, for both
+         * hard and soft affinity, without doing any dynamic computation of
+         * either of them.
+         */
+        if ( !dom0_affinity_relaxed )
+            sched_set_affinity(unit, &dom0_cpus, &cpumask_all);
+        else
+            sched_set_affinity(unit, &cpumask_all, &dom0_cpus);
+    }
+#endif
     else
         sched_set_affinity(unit, &cpumask_all, &cpumask_all);
 
@@ -3386,29 +3420,10 @@ void wait(void)
 void __init sched_setup_dom0_vcpus(struct domain *d)
 {
     unsigned int i;
-    struct sched_unit *unit;
 
     for ( i = 1; i < d->max_vcpus; i++ )
         vcpu_create(d, i);
 
-    /*
-     * PV-shim: vcpus are pinned 1:1.
-     * Initially only 1 cpu is online, others will be dealt with when
-     * onlining them. This avoids pinning a vcpu to a not yet online cpu here.
-     */
-    if ( pv_shim )
-        sched_set_affinity(d->vcpu[0]->sched_unit,
-                           cpumask_of(0), cpumask_of(0));
-    else
-    {
-        for_each_sched_unit ( d, unit )
-        {
-            if ( !opt_dom0_vcpus_pin && !dom0_affinity_relaxed )
-                sched_set_affinity(unit, &dom0_cpus, NULL);
-            sched_set_affinity(unit, NULL, &dom0_cpus);
-        }
-    }
-
     domain_update_node_affinity(d);
 }
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Mon Aug 15 13:55:36 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Aug 2022 13:55:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387496.623741 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNaZ6-0008V6-Lq; Mon, 15 Aug 2022 13:55:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387496.623741; Mon, 15 Aug 2022 13:55:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNaZ6-0008Uw-It; Mon, 15 Aug 2022 13:55:36 +0000
Received: by outflank-mailman (input) for mailman id 387496;
 Mon, 15 Aug 2022 13:55:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNaZ5-0008Ug-2x
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:55:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNaZ5-00064z-27
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:55:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNaZ5-0007ok-17
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:55:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=dt/+2vQxjXBieTP1LpP6cqLoiWDlUEM2WUjz0/6gPrU=; b=dTWELceVP5bKnVu6Q13Js7cVQe
	h2gwjTThfxO+9v6AVQU3Wk8rWoxWe6zvC4mbBYkwBsgkIKjRVJyqPMO/W0rteOCQzxBNpdNM4c1He
	oqRyF6QjX4byT6+EvgRv7yR6dAjUhuhGpwH96/4HHq7u2Agr75XaPLdYnXclLIW+k5t8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] tools/libxl: Replace deprecated -sdl option on QEMU command line
Message-Id: <E1oNaZ5-0007ok-17@xenbits.xenproject.org>
Date: Mon, 15 Aug 2022 13:55:35 +0000

commit e6a760b8b1ce844f171594ce19856bf7e51b0509
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Mon Aug 15 15:34:07 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 15:34:07 2022 +0200

    tools/libxl: Replace deprecated -sdl option on QEMU command line
    
    "-sdl" is deprecated upstream since 6695e4c0fd9e ("softmmu/vl:
    Deprecate the -sdl and -curses option"), QEMU v6.2, and the option is
    removed by 707d93d4abc6 ("ui: Remove deprecated options "-sdl" and
    "-curses""), in upcoming QEMU v7.1.
    
    Instead, use "-display sdl", available since 1472a95bab1e ("Introduce
    -display argument"), before QEMU v1.0.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Jason Andryuk <jandryuk@gmail.com>
    master commit: 41fcb3af8ad6d4c9f65a9d72798e6d18afec55ac
    master date: 2022-08-11 11:47:11 +0200
---
 tools/libs/light/libxl_dm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libs/light/libxl_dm.c b/tools/libs/light/libxl_dm.c
index 1864ee30f0..04bf5d8563 100644
--- a/tools/libs/light/libxl_dm.c
+++ b/tools/libs/light/libxl_dm.c
@@ -1349,7 +1349,7 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
     flexarray_append_pair(dm_args, "-display", "none");
 
     if (sdl && !is_stubdom) {
-        flexarray_append(dm_args, "-sdl");
+        flexarray_append_pair(dm_args, "-display", "sdl");
         if (sdl->display)
             flexarray_append_pair(dm_envs, "DISPLAY", sdl->display);
         if (sdl->xauthority)
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Mon Aug 15 13:55:46 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Aug 2022 13:55:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387497.623744 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNaZG-00006I-My; Mon, 15 Aug 2022 13:55:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387497.623744; Mon, 15 Aug 2022 13:55:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNaZG-00006A-KM; Mon, 15 Aug 2022 13:55:46 +0000
Received: by outflank-mailman (input) for mailman id 387497;
 Mon, 15 Aug 2022 13:55:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNaZF-00005s-6P
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:55:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNaZF-00065V-5b
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:55:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNaZF-0007pA-4S
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:55:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=n+IQRFya6IL5oy1AiSVrk0+ZWt+NWaP+zvY269hV7q0=; b=BpW0XKzNSKJ5m4CWYiQRbVkRWo
	D3E9L/cci92VN4VzvfSZzZ60H5NvTUUaRVKEKJ76WDlyBsoq83175FccGydMoiIAX1piyKX003b97
	qvDnYYALqOhdyoZyJwHoZZDiZXAVQkBvDjXyGLqqjGDmGOrcKIzgddUPOsUsZP7LZcpo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] x86/spec-ctrl: Enumeration for PBRSB_NO
Message-Id: <E1oNaZF-0007pA-4S@xenbits.xenproject.org>
Date: Mon, 15 Aug 2022 13:55:45 +0000

commit 940fc00e02cbc8a202b3a072b9e33a3fe74da809
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Aug 15 15:34:30 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 15:34:30 2022 +0200

    x86/spec-ctrl: Enumeration for PBRSB_NO
    
    The PBRSB_NO bit indicates that the CPU is not vulnerable to the Post-Barrier
    RSB speculative vulnerability.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b874e47eb13feb75be3ee7b5dc4ae9c97d80d774
    master date: 2022-08-11 16:19:50 +0100
---
 xen/arch/x86/msr.c              | 5 +++--
 xen/arch/x86/spec_ctrl.c        | 3 ++-
 xen/include/asm-x86/msr-index.h | 1 +
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 103703dfc0..cc8fe76203 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -73,7 +73,8 @@ static void __init calculate_host_policy(void)
          ARCH_CAPS_SKIP_L1DFL | ARCH_CAPS_SSB_NO | ARCH_CAPS_MDS_NO |
          ARCH_CAPS_IF_PSCHANGE_MC_NO | ARCH_CAPS_TSX_CTRL | ARCH_CAPS_TAA_NO |
          ARCH_CAPS_SBDR_SSDP_NO | ARCH_CAPS_FBSDP_NO | ARCH_CAPS_PSDP_NO |
-         ARCH_CAPS_FB_CLEAR | ARCH_CAPS_RRSBA | ARCH_CAPS_BHI_NO);
+         ARCH_CAPS_FB_CLEAR | ARCH_CAPS_RRSBA | ARCH_CAPS_BHI_NO |
+         ARCH_CAPS_PBRSB_NO);
 }
 
 static void __init calculate_pv_max_policy(void)
@@ -165,7 +166,7 @@ int init_domain_msr_policy(struct domain *d)
              ARCH_CAPS_SSB_NO | ARCH_CAPS_MDS_NO | ARCH_CAPS_IF_PSCHANGE_MC_NO |
              ARCH_CAPS_TAA_NO | ARCH_CAPS_SBDR_SSDP_NO | ARCH_CAPS_FBSDP_NO |
              ARCH_CAPS_PSDP_NO | ARCH_CAPS_FB_CLEAR | ARCH_CAPS_RRSBA |
-             ARCH_CAPS_BHI_NO);
+             ARCH_CAPS_BHI_NO | ARCH_CAPS_PBRSB_NO);
     }
 
     d->arch.msr = mp;
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index 50660f3e23..0f4bad3d3a 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -419,7 +419,7 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
      * Hardware read-only information, stating immunity to certain issues, or
      * suggestions of which mitigation to use.
      */
-    printk("  Hardware hints:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
+    printk("  Hardware hints:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
            (caps & ARCH_CAPS_RDCL_NO)                        ? " RDCL_NO"        : "",
            (caps & ARCH_CAPS_IBRS_ALL)                       ? " IBRS_ALL"       : "",
            (caps & ARCH_CAPS_RSBA)                           ? " RSBA"           : "",
@@ -431,6 +431,7 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
            (caps & ARCH_CAPS_SBDR_SSDP_NO)                   ? " SBDR_SSDP_NO"   : "",
            (caps & ARCH_CAPS_FBSDP_NO)                       ? " FBSDP_NO"       : "",
            (caps & ARCH_CAPS_PSDP_NO)                        ? " PSDP_NO"        : "",
+           (caps & ARCH_CAPS_PBRSB_NO)                       ? " PBRSB_NO"       : "",
            (e8b  & cpufeat_mask(X86_FEATURE_IBRS_ALWAYS))    ? " IBRS_ALWAYS"    : "",
            (e8b  & cpufeat_mask(X86_FEATURE_STIBP_ALWAYS))   ? " STIBP_ALWAYS"   : "",
            (e8b  & cpufeat_mask(X86_FEATURE_IBRS_FAST))      ? " IBRS_FAST"      : "",
diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h
index c601d88993..60c0bc7571 100644
--- a/xen/include/asm-x86/msr-index.h
+++ b/xen/include/asm-x86/msr-index.h
@@ -73,6 +73,7 @@
 #define  ARCH_CAPS_FB_CLEAR_CTRL            (_AC(1, ULL) << 18)
 #define  ARCH_CAPS_RRSBA                    (_AC(1, ULL) << 19)
 #define  ARCH_CAPS_BHI_NO                   (_AC(1, ULL) << 20)
+#define  ARCH_CAPS_PBRSB_NO                 (_AC(1, ULL) << 24)
 
 #define MSR_FLUSH_CMD                       0x0000010b
 #define  FLUSH_CMD_L1D                      (_AC(1, ULL) <<  0)
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Mon Aug 15 13:55:56 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Aug 2022 13:55:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387498.623749 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNaZQ-00009L-Oh; Mon, 15 Aug 2022 13:55:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387498.623749; Mon, 15 Aug 2022 13:55:56 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNaZQ-00009D-Lo; Mon, 15 Aug 2022 13:55:56 +0000
Received: by outflank-mailman (input) for mailman id 387498;
 Mon, 15 Aug 2022 13:55:55 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNaZP-00008y-9C
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:55:55 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNaZP-00065i-8R
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:55:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNaZP-0007pb-7o
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:55:55 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=RD8kLqiYkBOG1CbDkpbG+9LxqMi14iRddXsSp0B1N1k=; b=ADmPEU80zHGLzVbTogsJRB1uFA
	1x2V0jS6Or4FDZ+tXB+WV7za90b7mI2AkjiI36+BR7X2SaVa94jByCmb055yJruIhF/r791S1tZzG
	e8+Du05iVFxp5d+vsgePL/YdMqNlGzhEAgkMUzYzekng+6zWqMltkjivS+c0REYiQtSk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] x86/amd: only call setup_force_cpu_cap for boot CPU
Message-Id: <E1oNaZP-0007pb-7o@xenbits.xenproject.org>
Date: Mon, 15 Aug 2022 13:55:55 +0000

commit 9123e60c0b9de1c78e8b807c80f0ea60aba37979
Author:     Ross Lagerwall <ross.lagerwall@citrix.com>
AuthorDate: Mon Aug 15 15:35:10 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 15:35:10 2022 +0200

    x86/amd: only call setup_force_cpu_cap for boot CPU
    
    This should only be called for the boot CPU to avoid calling _init code
    after it has been unloaded.
    
    Fixes: 062868a5a8b4 ("x86/amd: Work around CLFLUSH ordering on older parts")
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 31b41ce858c8bd5159212d40969f8e0b7124bbf0
    master date: 2022-08-11 17:44:26 +0200
---
 xen/arch/x86/cpu/amd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/cpu/amd.c b/xen/arch/x86/cpu/amd.c
index 37ac84ddd7..9635eee619 100644
--- a/xen/arch/x86/cpu/amd.c
+++ b/xen/arch/x86/cpu/amd.c
@@ -845,7 +845,7 @@ static void init_amd(struct cpuinfo_x86 *c)
 	 * everything, including reads and writes to address, and
 	 * LFENCE/SFENCE instructions.
 	 */
-	if (!cpu_has_clflushopt)
+	if (c == &boot_cpu_data && !cpu_has_clflushopt)
 		setup_force_cpu_cap(X86_BUG_CLFLUSH_MFENCE);
 
 	switch(c->x86)
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Mon Aug 15 13:56:06 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Aug 2022 13:56:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387499.623752 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNaZa-0000CH-QD; Mon, 15 Aug 2022 13:56:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387499.623752; Mon, 15 Aug 2022 13:56:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNaZa-0000C9-NI; Mon, 15 Aug 2022 13:56:06 +0000
Received: by outflank-mailman (input) for mailman id 387499;
 Mon, 15 Aug 2022 13:56:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNaZZ-0000C1-C8
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:56:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNaZZ-000665-BK
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:56:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNaZZ-0007qH-Aa
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:56:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZNaRkTFp3ZIzGi46Ri3n9Ti2oUZDg0HQEjqxny21Tck=; b=YdDFTi+mBzBvvif/dEc7v+Cij5
	rnScZ5YUA909WinUrzhtjWm4HkXB1FR3DvlYPwGJWlj17UJVXih44KwRdEU+kmndU4XP4klnYraWU
	VwB1RRhxWoxYWMRyKic/Wbl6ual8UVxwhUKuEyJfnAZse0z35IRivF/mpstxjUzH81kU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] build/x86: suppress GNU ld 2.39 warning about RWX load segments
Message-Id: <E1oNaZZ-0007qH-Aa@xenbits.xenproject.org>
Date: Mon, 15 Aug 2022 13:56:05 +0000

commit 3fd9a7d59523fb0555d0e89b11eeea5d53d2c54c
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Aug 15 15:36:06 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 15:36:06 2022 +0200

    build/x86: suppress GNU ld 2.39 warning about RWX load segments
    
    Commit 68f5aac012b9 ("build: suppress future GNU ld warning about RWX
    load segments") didn't quite cover all the cases: Apparently I missed
    ones in the building of 32-bit helper objects because of only looking at
    incremental builds (where those wouldn't normally be re-built). Clone
    the workaround there to the specific Makefile in question.
    
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 3eb1865ae305772b558757904d81951e31de43de
    master date: 2022-08-11 17:45:12 +0200
---
 xen/arch/x86/boot/build32.mk | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xen/arch/x86/boot/build32.mk b/xen/arch/x86/boot/build32.mk
index e90680cd9f..d2fae5cf9e 100644
--- a/xen/arch/x86/boot/build32.mk
+++ b/xen/arch/x86/boot/build32.mk
@@ -8,6 +8,9 @@ CFLAGS += -Werror -fno-builtin -g0 -msoft-float
 CFLAGS += -I$(BASEDIR)/include
 CFLAGS := $(filter-out -flto,$(CFLAGS)) 
 
+LDFLAGS_DIRECT-$(shell $(LD) -v --warn-rwx-segments >/dev/null 2>&1 && echo y) := --no-warn-rwx-segments
+LDFLAGS_DIRECT += $(LDFLAGS_DIRECT-y)
+
 # NB. awk invocation is a portable alternative to 'head -n -1'
 %.S: %.bin
 	(od -v -t x $< | tr -s ' ' | awk 'NR > 1 {print s} {s=$$0}' | \
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Mon Aug 15 13:56:16 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Aug 2022 13:56:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387500.623755 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNaZk-0000Fw-Sq; Mon, 15 Aug 2022 13:56:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387500.623755; Mon, 15 Aug 2022 13: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 1oNaZk-0000Fn-QD; Mon, 15 Aug 2022 13:56:16 +0000
Received: by outflank-mailman (input) for mailman id 387500;
 Mon, 15 Aug 2022 13:56:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNaZj-0000FU-Ez
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:56:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNaZj-00066F-EJ
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:56:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNaZj-0007qi-DW
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:56:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZkZ/QbH1UnagBegEFVDpHMeADpAH9iXg3GZtWTmQMMM=; b=cHcgHMApnPJcYeXsloRxVdC+b3
	ZUirbbmI0Fhxn4k3eudYOwLfTNGpXl9+m9hWOb8cZh28DJn5rxKxqZfcVmqvL6Zf8+58TykXnsKfL
	zTcXn4xLOBVHyMYHbXeOjQ1Zd9fLLoGrkdlBxI0YpAX5S51upBQGe6lmy7Nt44HZzF3w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] PCI: simplify (and thus correct) pci_get_pdev{,_by_domain}()
Message-Id: <E1oNaZj-0007qi-DW@xenbits.xenproject.org>
Date: Mon, 15 Aug 2022 13:56:15 +0000

commit 2abe83f9d91e6411b5b42a3d5d01593e83c2bf9f
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Aug 15 15:36:56 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 15:36:56 2022 +0200

    PCI: simplify (and thus correct) pci_get_pdev{,_by_domain}()
    
    The last "wildcard" use of either function went away with f591755823a7
    ("IOMMU/PCI: don't let domain cleanup continue when device de-assignment
    failed"). Don't allow them to be called this way anymore. Besides
    simplifying the code this also fixes two bugs:
    
    1) When seg != -1, the outer loops should have been terminated after the
       first iteration, or else a device with the same BDF but on another
       segment could be found / returned.
    
    Reported-by: Rahul Singh <rahul.singh@arm.com>
    
    2) When seg == -1 calling get_pseg() is bogus. The function (taking a
       u16) would look for segment 0xffff, which might exist. If it exists,
       we might then find / return a wrong device.
    
    In pci_get_pdev_by_domain() also switch from using the per-segment list
    to using the per-domain one, with the exception of the hardware domain
    (see the code comment there).
    
    While there also constify "pseg" and drop "pdev"'s already previously
    unnecessary initializer.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Rahul Singh <rahul.singh@arm.com>
    Tested-by: Rahul Singh <rahul.singh@arm.com>
    master commit: 8cf6e0738906fc269af40135ed82a07815dd3b9c
    master date: 2022-08-12 08:34:33 +0200
---
 xen/drivers/passthrough/pci.c | 61 ++++++++++++++++++-------------------------
 xen/include/xen/pci.h         |  6 ++---
 2 files changed, 29 insertions(+), 38 deletions(-)

diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index e0491c908f..da4ecda814 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -507,30 +507,19 @@ int __init pci_ro_device(int seg, int bus, int devfn)
     return 0;
 }
 
-struct pci_dev *pci_get_pdev(int seg, int bus, int devfn)
+struct pci_dev *pci_get_pdev(uint16_t seg, uint8_t bus, uint8_t devfn)
 {
-    struct pci_seg *pseg = get_pseg(seg);
-    struct pci_dev *pdev = NULL;
+    const struct pci_seg *pseg = get_pseg(seg);
+    struct pci_dev *pdev;
 
     ASSERT(pcidevs_locked());
-    ASSERT(seg != -1 || bus == -1);
-    ASSERT(bus != -1 || devfn == -1);
 
     if ( !pseg )
-    {
-        if ( seg == -1 )
-            radix_tree_gang_lookup(&pci_segments, (void **)&pseg, 0, 1);
-        if ( !pseg )
-            return NULL;
-    }
+        return NULL;
 
-    do {
-        list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
-            if ( (pdev->bus == bus || bus == -1) &&
-                 (pdev->devfn == devfn || devfn == -1) )
-                return pdev;
-    } while ( radix_tree_gang_lookup(&pci_segments, (void **)&pseg,
-                                     pseg->nr + 1, 1) );
+    list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
+        if ( pdev->bus == bus && pdev->devfn == devfn )
+            return pdev;
 
     return NULL;
 }
@@ -556,31 +545,33 @@ struct pci_dev *pci_get_real_pdev(int seg, int bus, int devfn)
     return pdev;
 }
 
-struct pci_dev *pci_get_pdev_by_domain(const struct domain *d, int seg,
-                                       int bus, int devfn)
+struct pci_dev *pci_get_pdev_by_domain(const struct domain *d, uint16_t seg,
+                                       uint8_t bus, uint8_t devfn)
 {
-    struct pci_seg *pseg = get_pseg(seg);
-    struct pci_dev *pdev = NULL;
-
-    ASSERT(seg != -1 || bus == -1);
-    ASSERT(bus != -1 || devfn == -1);
+    struct pci_dev *pdev;
 
-    if ( !pseg )
+    /*
+     * The hardware domain owns the majority of the devices in the system.
+     * When there are multiple segments, traversing the per-segment list is
+     * likely going to be faster, whereas for a single segment the difference
+     * shouldn't be that large.
+     */
+    if ( is_hardware_domain(d) )
     {
-        if ( seg == -1 )
-            radix_tree_gang_lookup(&pci_segments, (void **)&pseg, 0, 1);
+        const struct pci_seg *pseg = get_pseg(seg);
+
         if ( !pseg )
             return NULL;
-    }
 
-    do {
         list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
-            if ( (pdev->bus == bus || bus == -1) &&
-                 (pdev->devfn == devfn || devfn == -1) &&
-                 (pdev->domain == d) )
+            if ( pdev->bus == bus && pdev->devfn == devfn &&
+                 pdev->domain == d )
+                return pdev;
+    }
+    else
+        list_for_each_entry ( pdev, &d->pdev_list, domain_list )
+            if ( pdev->bus == bus && pdev->devfn == devfn )
                 return pdev;
-    } while ( radix_tree_gang_lookup(&pci_segments, (void **)&pseg,
-                                     pseg->nr + 1, 1) );
 
     return NULL;
 }
diff --git a/xen/include/xen/pci.h b/xen/include/xen/pci.h
index b6d7e454f8..ac3880e686 100644
--- a/xen/include/xen/pci.h
+++ b/xen/include/xen/pci.h
@@ -169,10 +169,10 @@ int pci_add_device(u16 seg, u8 bus, u8 devfn,
 int pci_remove_device(u16 seg, u8 bus, u8 devfn);
 int pci_ro_device(int seg, int bus, int devfn);
 int pci_hide_device(unsigned int seg, unsigned int bus, unsigned int devfn);
-struct pci_dev *pci_get_pdev(int seg, int bus, int devfn);
+struct pci_dev *pci_get_pdev(uint16_t seg, uint8_t bus, uint8_t devfn);
 struct pci_dev *pci_get_real_pdev(int seg, int bus, int devfn);
-struct pci_dev *pci_get_pdev_by_domain(const struct domain *, int seg,
-                                       int bus, int devfn);
+struct pci_dev *pci_get_pdev_by_domain(const struct domain *, uint16_t seg,
+                                       uint8_t bus, uint8_t devfn);
 void pci_check_disable_device(u16 seg, u8 bus, u8 devfn);
 
 uint8_t pci_conf_read8(pci_sbdf_t sbdf, unsigned int reg);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Mon Aug 15 13:56:27 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Aug 2022 13:56:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387501.623760 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNaZv-0000JH-UM; Mon, 15 Aug 2022 13:56:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387501.623760; Mon, 15 Aug 2022 13: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 1oNaZv-0000J9-Rj; Mon, 15 Aug 2022 13:56:27 +0000
Received: by outflank-mailman (input) for mailman id 387501;
 Mon, 15 Aug 2022 13:56:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNaZt-0000Ie-U4
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:56:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNaZt-00066X-TG
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:56:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNaZt-0007sQ-SP
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:56:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=iUPP0JEtqisztHLTdr20pYi7mlIWqNR2oWuUHPz7kSI=; b=utmS4uA3X7FXuE9Pl29yyBMxsN
	Fz8s7w/Fj+MYgkbxmKxznWCjPpKCEEMsdRhEjj5M9Xb0OSOnVCkv/w844HAYKQx7pvB2N+if+KCAE
	+QwJk88uZ7q0LRNYtyCwwD65GPzS5ABzKHZ+qoW7TY19/jd6NRg67Tdow3rG/2geyue0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] x86/spec-ctrl: Use IST RSB protection for !SVM systems
Message-Id: <E1oNaZt-0007sQ-SP@xenbits.xenproject.org>
Date: Mon, 15 Aug 2022 13:56:25 +0000

commit 8ae0b4d1331c14fb9e30a42987c0152c9b00f530
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Aug 15 15:40:05 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 15:40:05 2022 +0200

    x86/spec-ctrl: Use IST RSB protection for !SVM systems
    
    There is a corner case where a VT-x guest which manages to reliably trigger
    non-fatal #MC's could evade the rogue RSB speculation protections that were
    supposed to be in place.
    
    This is a lack of defence in depth; Xen does not architecturally execute more
    RET than CALL instructions, so an attacker would have to locate a different
    gadget (e.g. SpectreRSB) first to execute a transient path of excess RET
    instructions.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: e570e8d520ab542d8d35666b95cb3a0125b7b110
    master date: 2022-08-05 12:16:24 +0100
---
 xen/arch/x86/spec_ctrl.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index f7b0251c42..ac73806eac 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -1279,8 +1279,24 @@ void __init init_speculation_mitigations(void)
      * mappings.
      */
     if ( opt_rsb_hvm )
+    {
         setup_force_cpu_cap(X86_FEATURE_SC_RSB_HVM);
 
+        /*
+         * For SVM, Xen's RSB safety actions are performed before STGI, so
+         * behave atomically with respect to IST sources.
+         *
+         * For VT-x, NMIs are atomic with VMExit (the NMI gets queued but not
+         * delivered) whereas other IST sources are not atomic.  Specifically,
+         * #MC can hit ahead the RSB safety action in the vmexit path.
+         *
+         * Therefore, it is necessary for the IST logic to protect Xen against
+         * possible rogue RSB speculation.
+         */
+        if ( !cpu_has_svm )
+            default_spec_ctrl_flags |= SCF_ist_rsb;
+    }
+
     ibpb_calculations();
 
     /* Check whether Eager FPU should be enabled by default. */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Mon Aug 15 13:56:38 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Aug 2022 13:56:38 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387502.623764 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNaa5-0000Lz-W1; Mon, 15 Aug 2022 13:56:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387502.623764; Mon, 15 Aug 2022 13:56:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNaa5-0000Lr-TH; Mon, 15 Aug 2022 13:56:37 +0000
Received: by outflank-mailman (input) for mailman id 387502;
 Mon, 15 Aug 2022 13:56:36 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNaa4-0000Le-0j
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:56:36 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNaa4-00066b-02
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:56:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNaa3-0007sr-VY
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:56:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NIXjTN0SpW4JPDaUfPmbm/YiB8kz5ktmUvpBC3QOtHQ=; b=UGgkcOgq7B6zH027pVT3BuCLw7
	W3IcH7YlICutxPFO2VS03JH/bfbxFCOGec43e3nWxVQzSJGUN8+HaWKI+f5v9Y/izDoz41I6wKZ96
	ayBWfhcPqUs4rYfeHkEzVFkL20HCyxVXJFzsNg67iqKixu1KDtfWjDixpXdvtk1++pFY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] x86: Expose more MSR_ARCH_CAPS to hwdom
Message-Id: <E1oNaa3-0007sr-VY@xenbits.xenproject.org>
Date: Mon, 15 Aug 2022 13:56:35 +0000

commit 5efcae1eb30ff24e100954e00889a568c1745ea1
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Mon Aug 15 15:40:47 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 15:40:47 2022 +0200

    x86: Expose more MSR_ARCH_CAPS to hwdom
    
    commit e46474278a0e ("x86/intel: Expose MSR_ARCH_CAPS to dom0") started
    exposing MSR_ARCH_CAPS to dom0.  More bits in MSR_ARCH_CAPS have since
    been defined, but they haven't been exposed.  Update the list to allow
    them through.
    
    As one example, this allows a Linux Dom0 to know that it has the
    appropriate microcode via FB_CLEAR.  Notably, and with the updated
    microcode, this changes dom0's
    /sys/devices/system/cpu/vulnerabilities/mmio_stale_data changes from:
    
      "Vulnerable: Clear CPU buffers attempted, no microcode; SMT Host state unknown"
    
    to:
    
      "Mitigation: Clear CPU buffers; SMT Host state unknown"
    
    This exposes the MMIO Stale Data and Intel Branch History Injection
    (BHI) controls as well as the page size change MCE issue bit.
    
    Fixes: commit 2ebe8fe9b7e0 ("x86/spec-ctrl: Enumeration for MMIO Stale Data controls")
    Fixes: commit cea9ae062295 ("x86/spec-ctrl: Enumeration for new Intel BHI controls")
    Fixes: commit 59e89cdabc71 ("x86/vtx: Disable executable EPT superpages to work around CVE-2018-12207")
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: e83cd54611fec5b7a539fa1281a14319143490e6
    master date: 2022-08-09 16:35:25 +0100
---
 xen/arch/x86/msr.c              | 5 ++++-
 xen/include/asm-x86/msr-index.h | 2 ++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 0739d00e74..aa9face9aa 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -145,7 +145,10 @@ int init_domain_msr_policy(struct domain *d)
 
         mp->arch_caps.raw = val &
             (ARCH_CAPS_RDCL_NO | ARCH_CAPS_IBRS_ALL | ARCH_CAPS_RSBA |
-             ARCH_CAPS_SSB_NO | ARCH_CAPS_MDS_NO | ARCH_CAPS_TAA_NO);
+             ARCH_CAPS_SSB_NO | ARCH_CAPS_MDS_NO | ARCH_CAPS_IF_PSCHANGE_MC_NO |
+             ARCH_CAPS_TAA_NO | ARCH_CAPS_SBDR_SSDP_NO | ARCH_CAPS_FBSDP_NO |
+             ARCH_CAPS_PSDP_NO | ARCH_CAPS_FB_CLEAR | ARCH_CAPS_RRSBA |
+             ARCH_CAPS_BHI_NO);
     }
 
     d->arch.msr = mp;
diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h
index f1b2cf5460..49ca1f1845 100644
--- a/xen/include/asm-x86/msr-index.h
+++ b/xen/include/asm-x86/msr-index.h
@@ -64,6 +64,8 @@
 #define  ARCH_CAPS_PSDP_NO                  (_AC(1, ULL) << 15)
 #define  ARCH_CAPS_FB_CLEAR                 (_AC(1, ULL) << 17)
 #define  ARCH_CAPS_FB_CLEAR_CTRL            (_AC(1, ULL) << 18)
+#define  ARCH_CAPS_RRSBA                    (_AC(1, ULL) << 19)
+#define  ARCH_CAPS_BHI_NO                   (_AC(1, ULL) << 20)
 
 #define MSR_FLUSH_CMD                       0x0000010b
 #define  FLUSH_CMD_L1D                      (_AC(1, ULL) <<  0)
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Mon Aug 15 13:56:48 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Aug 2022 13:56:48 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387503.623768 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNaaG-0000OY-1N; Mon, 15 Aug 2022 13:56:48 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387503.623768; Mon, 15 Aug 2022 13:56:48 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNaaF-0000OQ-Uo; Mon, 15 Aug 2022 13:56:47 +0000
Received: by outflank-mailman (input) for mailman id 387503;
 Mon, 15 Aug 2022 13:56:46 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNaaE-0000OI-40
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:56:46 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNaaE-00066v-38
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:56:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNaaE-0007tm-2S
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:56:46 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ATCVUMPv2bl0ncSVH4kxIi17oo8E4px3aWicfs8nPrw=; b=Lnf7R7qtGLtsUWg87dVMg/PO70
	dlK3zzJbSc4SgNk23onVtXjYIqIiN5a4UJtWBirWBwZZbsFaavIJ7GWHGgm8cfLXkS5xw+3xkDhYo
	2QMuOrWAOk6+XGush628/uoAYrhuWicJQwznnJ516nbFpY3JqjvxtM00qEJ1sjYtNJ8A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] xen/sched: setup dom0 vCPUs affinity only once
Message-Id: <E1oNaaE-0007tm-2S@xenbits.xenproject.org>
Date: Mon, 15 Aug 2022 13:56:46 +0000

commit 1e31848cdd8d2ff3cb76f364f04f9771f9b3a8b1
Author:     Dario Faggioli <dfaggioli@suse.com>
AuthorDate: Mon Aug 15 15:41:25 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 15:41:25 2022 +0200

    xen/sched: setup dom0 vCPUs affinity only once
    
    Right now, affinity for dom0 vCPUs is setup in two steps. This is a
    problem as, at least in Credit2, unit_insert() sees and uses the
    "intermediate" affinity, and place the vCPUs on CPUs where they cannot
    be run. And this in turn results in boot hangs, if the "dom0_nodes"
    parameter is used.
    
    Fix this by setting up the affinity properly once and for all, in
    sched_init_vcpu() called by create_vcpu().
    
    Note that, unless a soft-affinity is explicitly specified for dom0 (by
    using the relaxed mode of "dom0_nodes") we set it to the default, which
    is all CPUs, instead of computing it basing on hard affinity (if any).
    This is because hard and soft affinity should be considered as
    independent user controlled properties. In fact, if we dor derive dom0's
    soft-affinity from its boot-time hard-affinity, such computed value will
    continue to be used even if later the user changes the hard-affinity.
    And this could result in the vCPUs behaving differently than what the
    user wanted and expects.
    
    Fixes: dafd936dddbd ("Make credit2 the default scheduler")
    Reported-by: Olaf Hering <ohering@suse.de>
    Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: c79e4d209be3ed2a6b8e97c35944786ed2a66b94
    master date: 2022-08-11 11:46:22 +0200
---
 xen/common/sched/core.c | 63 ++++++++++++++++++++++++++++++-------------------
 1 file changed, 39 insertions(+), 24 deletions(-)

diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c
index 8f4b1ca10d..f07bd2681f 100644
--- a/xen/common/sched/core.c
+++ b/xen/common/sched/core.c
@@ -571,12 +571,46 @@ int sched_init_vcpu(struct vcpu *v)
         return 1;
     }
 
-    /*
-     * Initialize affinity settings. The idler, and potentially
-     * domain-0 VCPUs, are pinned onto their respective physical CPUs.
-     */
-    if ( is_idle_domain(d) || (is_hardware_domain(d) && opt_dom0_vcpus_pin) )
+    if ( is_idle_domain(d) )
+    {
+        /* Idle vCPUs are always pinned onto their respective pCPUs */
+        sched_set_affinity(unit, cpumask_of(processor), &cpumask_all);
+    }
+    else if ( pv_shim && v->vcpu_id == 0 )
+    {
+        /*
+         * PV-shim: vcpus are pinned 1:1. Initially only 1 cpu is online,
+         * others will be dealt with when onlining them. This avoids pinning
+         * a vcpu to a not yet online cpu here.
+         */
+        sched_set_affinity(unit, cpumask_of(0), cpumask_of(0));
+    }
+    else if ( is_hardware_domain(d) && opt_dom0_vcpus_pin )
+    {
+        /*
+         * If dom0_vcpus_pin is specified, dom0 vCPUs are pinned 1:1 to
+         * their respective pCPUs too.
+         */
         sched_set_affinity(unit, cpumask_of(processor), &cpumask_all);
+    }
+#ifdef CONFIG_X86
+    else if ( d->domain_id == 0 )
+    {
+        /*
+         * In absence of dom0_vcpus_pin instead, the hard and soft affinity of
+         * dom0 is controlled by the (x86 only) dom0_nodes parameter. At this
+         * point it has been parsed and decoded into the dom0_cpus mask.
+         *
+         * Note that we always honor what user explicitly requested, for both
+         * hard and soft affinity, without doing any dynamic computation of
+         * either of them.
+         */
+        if ( !dom0_affinity_relaxed )
+            sched_set_affinity(unit, &dom0_cpus, &cpumask_all);
+        else
+            sched_set_affinity(unit, &cpumask_all, &dom0_cpus);
+    }
+#endif
     else
         sched_set_affinity(unit, &cpumask_all, &cpumask_all);
 
@@ -3386,29 +3420,10 @@ void wait(void)
 void __init sched_setup_dom0_vcpus(struct domain *d)
 {
     unsigned int i;
-    struct sched_unit *unit;
 
     for ( i = 1; i < d->max_vcpus; i++ )
         vcpu_create(d, i);
 
-    /*
-     * PV-shim: vcpus are pinned 1:1.
-     * Initially only 1 cpu is online, others will be dealt with when
-     * onlining them. This avoids pinning a vcpu to a not yet online cpu here.
-     */
-    if ( pv_shim )
-        sched_set_affinity(d->vcpu[0]->sched_unit,
-                           cpumask_of(0), cpumask_of(0));
-    else
-    {
-        for_each_sched_unit ( d, unit )
-        {
-            if ( !opt_dom0_vcpus_pin && !dom0_affinity_relaxed )
-                sched_set_affinity(unit, &dom0_cpus, NULL);
-            sched_set_affinity(unit, NULL, &dom0_cpus);
-        }
-    }
-
     domain_update_node_affinity(d);
 }
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Mon Aug 15 13:56:58 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Aug 2022 13:56:58 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387504.623772 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNaaQ-0000RH-31; Mon, 15 Aug 2022 13:56:58 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387504.623772; Mon, 15 Aug 2022 13: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 1oNaaQ-0000R9-05; Mon, 15 Aug 2022 13:56:58 +0000
Received: by outflank-mailman (input) for mailman id 387504;
 Mon, 15 Aug 2022 13:56:56 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNaaO-0000Qh-6r
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:56:56 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNaaO-000678-67
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:56:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNaaO-0007uZ-5U
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:56:56 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=f+xQptARrNZXFKN2uy4Bptkbulvst5z4v0/QLbLVPcY=; b=tFGeOOclROJZGN8bO0pUAXZF1M
	vAAxlzoIZLClanm7Ycy+mVUHzUkIUfx0PSjIMX1DpunJ6hdLeX+f3yocOmy8j0UbubsLl/x/s3a0P
	fGOwP+dy7xusRb5LHwfA0kR6ABd9r3QAX6ns4ROITMsokfviijZvb8Lwg/ERMLlyrvIk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] tools/libxl: Replace deprecated -sdl option on QEMU command line
Message-Id: <E1oNaaO-0007uZ-5U@xenbits.xenproject.org>
Date: Mon, 15 Aug 2022 13:56:56 +0000

commit c373ad3d084614a93c55e25dc20e70ffc7574971
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Mon Aug 15 15:42:09 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 15:42:09 2022 +0200

    tools/libxl: Replace deprecated -sdl option on QEMU command line
    
    "-sdl" is deprecated upstream since 6695e4c0fd9e ("softmmu/vl:
    Deprecate the -sdl and -curses option"), QEMU v6.2, and the option is
    removed by 707d93d4abc6 ("ui: Remove deprecated options "-sdl" and
    "-curses""), in upcoming QEMU v7.1.
    
    Instead, use "-display sdl", available since 1472a95bab1e ("Introduce
    -display argument"), before QEMU v1.0.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Jason Andryuk <jandryuk@gmail.com>
    master commit: 41fcb3af8ad6d4c9f65a9d72798e6d18afec55ac
    master date: 2022-08-11 11:47:11 +0200
---
 tools/libs/light/libxl_dm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libs/light/libxl_dm.c b/tools/libs/light/libxl_dm.c
index 24f6e73b0a..ae5f35e0c3 100644
--- a/tools/libs/light/libxl_dm.c
+++ b/tools/libs/light/libxl_dm.c
@@ -1349,7 +1349,7 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
     flexarray_append_pair(dm_args, "-display", "none");
 
     if (sdl && !is_stubdom) {
-        flexarray_append(dm_args, "-sdl");
+        flexarray_append_pair(dm_args, "-display", "sdl");
         if (sdl->display)
             flexarray_append_pair(dm_envs, "DISPLAY", sdl->display);
         if (sdl->xauthority)
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Mon Aug 15 13:57:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Aug 2022 13:57:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387505.623776 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNaaa-0000Ty-4t; Mon, 15 Aug 2022 13:57:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387505.623776; Mon, 15 Aug 2022 13: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 1oNaaa-0000Tq-1f; Mon, 15 Aug 2022 13:57:08 +0000
Received: by outflank-mailman (input) for mailman id 387505;
 Mon, 15 Aug 2022 13:57:06 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNaaY-0000Tf-9x
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:57:06 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNaaY-00067R-98
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:57:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNaaY-0007vS-8J
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:57:06 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=JK8kW4B06dLo9sXLxSdasl8U8ZAxMtZJKd42yStPbIY=; b=IG3fepj3N9rBRf1JR22BOD9lCl
	P2i7hvuSpaMqyH8hlcE89eF0EULTX7SuWY48afeJiHcdkaoxzp10shrK1ATd2ktsSqr+zhguvvjhZ
	PkQQ7cozeb7f4TcKh9tloJ7GKcYLxVt75zyadoR1fEwA9sf/edNqJ7KSNecrG72jNzv8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] x86/spec-ctrl: Enumeration for PBRSB_NO
Message-Id: <E1oNaaY-0007vS-8J@xenbits.xenproject.org>
Date: Mon, 15 Aug 2022 13:57:06 +0000

commit fba0c22e79922085c46527eb1391123aadfb24d1
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Aug 15 15:42:31 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 15:42:31 2022 +0200

    x86/spec-ctrl: Enumeration for PBRSB_NO
    
    The PBRSB_NO bit indicates that the CPU is not vulnerable to the Post-Barrier
    RSB speculative vulnerability.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b874e47eb13feb75be3ee7b5dc4ae9c97d80d774
    master date: 2022-08-11 16:19:50 +0100
---
 xen/arch/x86/msr.c              | 2 +-
 xen/arch/x86/spec_ctrl.c        | 3 ++-
 xen/include/asm-x86/msr-index.h | 1 +
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index aa9face9aa..9bced8d36c 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -148,7 +148,7 @@ int init_domain_msr_policy(struct domain *d)
              ARCH_CAPS_SSB_NO | ARCH_CAPS_MDS_NO | ARCH_CAPS_IF_PSCHANGE_MC_NO |
              ARCH_CAPS_TAA_NO | ARCH_CAPS_SBDR_SSDP_NO | ARCH_CAPS_FBSDP_NO |
              ARCH_CAPS_PSDP_NO | ARCH_CAPS_FB_CLEAR | ARCH_CAPS_RRSBA |
-             ARCH_CAPS_BHI_NO);
+             ARCH_CAPS_BHI_NO | ARCH_CAPS_PBRSB_NO);
     }
 
     d->arch.msr = mp;
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index ac73806eac..3ff602bd02 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -419,7 +419,7 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
      * Hardware read-only information, stating immunity to certain issues, or
      * suggestions of which mitigation to use.
      */
-    printk("  Hardware hints:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
+    printk("  Hardware hints:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
            (caps & ARCH_CAPS_RDCL_NO)                        ? " RDCL_NO"        : "",
            (caps & ARCH_CAPS_IBRS_ALL)                       ? " IBRS_ALL"       : "",
            (caps & ARCH_CAPS_RSBA)                           ? " RSBA"           : "",
@@ -431,6 +431,7 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
            (caps & ARCH_CAPS_SBDR_SSDP_NO)                   ? " SBDR_SSDP_NO"   : "",
            (caps & ARCH_CAPS_FBSDP_NO)                       ? " FBSDP_NO"       : "",
            (caps & ARCH_CAPS_PSDP_NO)                        ? " PSDP_NO"        : "",
+           (caps & ARCH_CAPS_PBRSB_NO)                       ? " PBRSB_NO"       : "",
            (e8b  & cpufeat_mask(X86_FEATURE_IBRS_ALWAYS))    ? " IBRS_ALWAYS"    : "",
            (e8b  & cpufeat_mask(X86_FEATURE_STIBP_ALWAYS))   ? " STIBP_ALWAYS"   : "",
            (e8b  & cpufeat_mask(X86_FEATURE_IBRS_FAST))      ? " IBRS_FAST"      : "",
diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h
index 49ca1f1845..5a830f76a8 100644
--- a/xen/include/asm-x86/msr-index.h
+++ b/xen/include/asm-x86/msr-index.h
@@ -66,6 +66,7 @@
 #define  ARCH_CAPS_FB_CLEAR_CTRL            (_AC(1, ULL) << 18)
 #define  ARCH_CAPS_RRSBA                    (_AC(1, ULL) << 19)
 #define  ARCH_CAPS_BHI_NO                   (_AC(1, ULL) << 20)
+#define  ARCH_CAPS_PBRSB_NO                 (_AC(1, ULL) << 24)
 
 #define MSR_FLUSH_CMD                       0x0000010b
 #define  FLUSH_CMD_L1D                      (_AC(1, ULL) <<  0)
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Mon Aug 15 13:57:17 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Aug 2022 13:57:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387506.623780 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNaaj-0000Xa-8j; Mon, 15 Aug 2022 13:57:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387506.623780; Mon, 15 Aug 2022 13:57:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNaaj-0000XQ-5r; Mon, 15 Aug 2022 13:57:17 +0000
Received: by outflank-mailman (input) for mailman id 387506;
 Mon, 15 Aug 2022 13:57:16 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNaai-0000XI-Cq
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:57:16 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNaai-00067X-C2
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:57:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNaai-0007vr-BE
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:57:16 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=V+3/TuEcI0iZUE80h3Uz+MDE791zY6mq7LRSx5BgJQo=; b=NijUp1JdIJVjC4YqeXAq6eQnvk
	ZVm47B/KdMAm+3vbDRkIvPEGyeIisqZzaQP9hJDq4dUULCBkRSxHJlFwNgnAuOwPzmb59QiaRcgsH
	9+NovZTenVaz/nG/+apUJpgxqd5/mG8fwC9aAu8gvQV777rxNUyA2eByI1m1PB3cuSao=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] x86/amd: only call setup_force_cpu_cap for boot CPU
Message-Id: <E1oNaai-0007vr-BE@xenbits.xenproject.org>
Date: Mon, 15 Aug 2022 13:57:16 +0000

commit 104a54a307b08945365faf6d285cd5a02f94a80f
Author:     Ross Lagerwall <ross.lagerwall@citrix.com>
AuthorDate: Mon Aug 15 15:43:08 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 15:43:08 2022 +0200

    x86/amd: only call setup_force_cpu_cap for boot CPU
    
    This should only be called for the boot CPU to avoid calling _init code
    after it has been unloaded.
    
    Fixes: 062868a5a8b4 ("x86/amd: Work around CLFLUSH ordering on older parts")
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 31b41ce858c8bd5159212d40969f8e0b7124bbf0
    master date: 2022-08-11 17:44:26 +0200
---
 xen/arch/x86/cpu/amd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/cpu/amd.c b/xen/arch/x86/cpu/amd.c
index 60dbe61a61..a8d2fb8a15 100644
--- a/xen/arch/x86/cpu/amd.c
+++ b/xen/arch/x86/cpu/amd.c
@@ -820,7 +820,7 @@ static void init_amd(struct cpuinfo_x86 *c)
 	 * everything, including reads and writes to address, and
 	 * LFENCE/SFENCE instructions.
 	 */
-	if (!cpu_has_clflushopt)
+	if (c == &boot_cpu_data && !cpu_has_clflushopt)
 		setup_force_cpu_cap(X86_BUG_CLFLUSH_MFENCE);
 
 	switch(c->x86)
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Mon Aug 15 13:57:27 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Aug 2022 13:57:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387507.623783 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNaat-0000aC-9z; Mon, 15 Aug 2022 13:57:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387507.623783; Mon, 15 Aug 2022 13:57:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNaat-0000a4-7P; Mon, 15 Aug 2022 13:57:27 +0000
Received: by outflank-mailman (input) for mailman id 387507;
 Mon, 15 Aug 2022 13:57:26 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNaas-0000Zw-H0
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:57:26 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNaas-00067h-GA
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:57:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNaas-0007wJ-E8
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:57:26 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=HKRKyvO7WDegtGJ/J+4AKurLVHHkP+m+uqUGGcHSQnM=; b=VRLzZpvpyZExMC9p3TWG7yPMYP
	+pyDBgdDY8+psqXaFzXVO96YfSRCFRGQtjUc0qrH366RDjrFgYMnmSeQW5Dfqmou+r6w0fVOLYOrj
	JAV4jzs6MpKkL7D6VfkzOjrNedlg3TIbnk0uwb2eDfv3XngNM1rc/IDaOWnAdUYpsjow=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] build/x86: suppress GNU ld 2.39 warning about RWX load segments
Message-Id: <E1oNaas-0007wJ-E8@xenbits.xenproject.org>
Date: Mon, 15 Aug 2022 13:57:26 +0000

commit a075900cf768fe45f270b6f1d09c4e99281da142
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Aug 15 15:43:56 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 15:43:56 2022 +0200

    build/x86: suppress GNU ld 2.39 warning about RWX load segments
    
    Commit 68f5aac012b9 ("build: suppress future GNU ld warning about RWX
    load segments") didn't quite cover all the cases: Apparently I missed
    ones in the building of 32-bit helper objects because of only looking at
    incremental builds (where those wouldn't normally be re-built). Clone
    the workaround there to the specific Makefile in question.
    
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 3eb1865ae305772b558757904d81951e31de43de
    master date: 2022-08-11 17:45:12 +0200
---
 xen/arch/x86/boot/build32.mk | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xen/arch/x86/boot/build32.mk b/xen/arch/x86/boot/build32.mk
index e90680cd9f..d2fae5cf9e 100644
--- a/xen/arch/x86/boot/build32.mk
+++ b/xen/arch/x86/boot/build32.mk
@@ -8,6 +8,9 @@ CFLAGS += -Werror -fno-builtin -g0 -msoft-float
 CFLAGS += -I$(BASEDIR)/include
 CFLAGS := $(filter-out -flto,$(CFLAGS)) 
 
+LDFLAGS_DIRECT-$(shell $(LD) -v --warn-rwx-segments >/dev/null 2>&1 && echo y) := --no-warn-rwx-segments
+LDFLAGS_DIRECT += $(LDFLAGS_DIRECT-y)
+
 # NB. awk invocation is a portable alternative to 'head -n -1'
 %.S: %.bin
 	(od -v -t x $< | tr -s ' ' | awk 'NR > 1 {print s} {s=$$0}' | \
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Mon Aug 15 13:57:37 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Aug 2022 13:57:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387508.623788 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNab3-0000cu-Bk; Mon, 15 Aug 2022 13:57:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387508.623788; Mon, 15 Aug 2022 13:57:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNab3-0000cm-8p; Mon, 15 Aug 2022 13:57:37 +0000
Received: by outflank-mailman (input) for mailman id 387508;
 Mon, 15 Aug 2022 13:57:36 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNab2-0000cX-LM
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:57:36 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNab2-00067l-Ip
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:57:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNab2-0007wm-IF
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 13:57:36 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=bGXhMWNfqcTOIIRI74v6xskj/JiRpxzIipuseYu3iCY=; b=EGNyev1DH1yeCT//lh84L+x3wi
	v5rWEdazuOPmh0Ieu4MP6A5TpoRdEanol7XYDDj0MTBsxrB+jP1IGsYxT+iHUUORJHGPghjf7MWUP
	rwhb+bQ1oaNQ34j5K7k53/PhByVQVibyPfrgLvSgHtlstywmT09BAqKe2eoN8BPIT5Zw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] PCI: simplify (and thus correct) pci_get_pdev{,_by_domain}()
Message-Id: <E1oNab2-0007wm-IF@xenbits.xenproject.org>
Date: Mon, 15 Aug 2022 13:57:36 +0000

commit 9acedc3c58c31930737edbe212f2ccf437a0b757
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Aug 15 15:44:23 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 15:44:23 2022 +0200

    PCI: simplify (and thus correct) pci_get_pdev{,_by_domain}()
    
    The last "wildcard" use of either function went away with f591755823a7
    ("IOMMU/PCI: don't let domain cleanup continue when device de-assignment
    failed"). Don't allow them to be called this way anymore. Besides
    simplifying the code this also fixes two bugs:
    
    1) When seg != -1, the outer loops should have been terminated after the
       first iteration, or else a device with the same BDF but on another
       segment could be found / returned.
    
    Reported-by: Rahul Singh <rahul.singh@arm.com>
    
    2) When seg == -1 calling get_pseg() is bogus. The function (taking a
       u16) would look for segment 0xffff, which might exist. If it exists,
       we might then find / return a wrong device.
    
    In pci_get_pdev_by_domain() also switch from using the per-segment list
    to using the per-domain one, with the exception of the hardware domain
    (see the code comment there).
    
    While there also constify "pseg" and drop "pdev"'s already previously
    unnecessary initializer.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Rahul Singh <rahul.singh@arm.com>
    Tested-by: Rahul Singh <rahul.singh@arm.com>
    master commit: 8cf6e0738906fc269af40135ed82a07815dd3b9c
    master date: 2022-08-12 08:34:33 +0200
---
 xen/drivers/passthrough/pci.c | 61 ++++++++++++++++++-------------------------
 xen/include/xen/pci.h         |  6 ++---
 2 files changed, 29 insertions(+), 38 deletions(-)

diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index bbacbe41da..9b81b941c8 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -528,30 +528,19 @@ int __init pci_ro_device(int seg, int bus, int devfn)
     return 0;
 }
 
-struct pci_dev *pci_get_pdev(int seg, int bus, int devfn)
+struct pci_dev *pci_get_pdev(uint16_t seg, uint8_t bus, uint8_t devfn)
 {
-    struct pci_seg *pseg = get_pseg(seg);
-    struct pci_dev *pdev = NULL;
+    const struct pci_seg *pseg = get_pseg(seg);
+    struct pci_dev *pdev;
 
     ASSERT(pcidevs_locked());
-    ASSERT(seg != -1 || bus == -1);
-    ASSERT(bus != -1 || devfn == -1);
 
     if ( !pseg )
-    {
-        if ( seg == -1 )
-            radix_tree_gang_lookup(&pci_segments, (void **)&pseg, 0, 1);
-        if ( !pseg )
-            return NULL;
-    }
+        return NULL;
 
-    do {
-        list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
-            if ( (pdev->bus == bus || bus == -1) &&
-                 (pdev->devfn == devfn || devfn == -1) )
-                return pdev;
-    } while ( radix_tree_gang_lookup(&pci_segments, (void **)&pseg,
-                                     pseg->nr + 1, 1) );
+    list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
+        if ( pdev->bus == bus && pdev->devfn == devfn )
+            return pdev;
 
     return NULL;
 }
@@ -577,31 +566,33 @@ struct pci_dev *pci_get_real_pdev(int seg, int bus, int devfn)
     return pdev;
 }
 
-struct pci_dev *pci_get_pdev_by_domain(const struct domain *d, int seg,
-                                       int bus, int devfn)
+struct pci_dev *pci_get_pdev_by_domain(const struct domain *d, uint16_t seg,
+                                       uint8_t bus, uint8_t devfn)
 {
-    struct pci_seg *pseg = get_pseg(seg);
-    struct pci_dev *pdev = NULL;
-
-    ASSERT(seg != -1 || bus == -1);
-    ASSERT(bus != -1 || devfn == -1);
+    struct pci_dev *pdev;
 
-    if ( !pseg )
+    /*
+     * The hardware domain owns the majority of the devices in the system.
+     * When there are multiple segments, traversing the per-segment list is
+     * likely going to be faster, whereas for a single segment the difference
+     * shouldn't be that large.
+     */
+    if ( is_hardware_domain(d) )
     {
-        if ( seg == -1 )
-            radix_tree_gang_lookup(&pci_segments, (void **)&pseg, 0, 1);
+        const struct pci_seg *pseg = get_pseg(seg);
+
         if ( !pseg )
             return NULL;
-    }
 
-    do {
         list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
-            if ( (pdev->bus == bus || bus == -1) &&
-                 (pdev->devfn == devfn || devfn == -1) &&
-                 (pdev->domain == d) )
+            if ( pdev->bus == bus && pdev->devfn == devfn &&
+                 pdev->domain == d )
+                return pdev;
+    }
+    else
+        list_for_each_entry ( pdev, &d->pdev_list, domain_list )
+            if ( pdev->bus == bus && pdev->devfn == devfn )
                 return pdev;
-    } while ( radix_tree_gang_lookup(&pci_segments, (void **)&pseg,
-                                     pseg->nr + 1, 1) );
 
     return NULL;
 }
diff --git a/xen/include/xen/pci.h b/xen/include/xen/pci.h
index 8e3d4d9454..cd238ae852 100644
--- a/xen/include/xen/pci.h
+++ b/xen/include/xen/pci.h
@@ -166,10 +166,10 @@ int pci_add_device(u16 seg, u8 bus, u8 devfn,
 int pci_remove_device(u16 seg, u8 bus, u8 devfn);
 int pci_ro_device(int seg, int bus, int devfn);
 int pci_hide_device(unsigned int seg, unsigned int bus, unsigned int devfn);
-struct pci_dev *pci_get_pdev(int seg, int bus, int devfn);
+struct pci_dev *pci_get_pdev(uint16_t seg, uint8_t bus, uint8_t devfn);
 struct pci_dev *pci_get_real_pdev(int seg, int bus, int devfn);
-struct pci_dev *pci_get_pdev_by_domain(const struct domain *, int seg,
-                                       int bus, int devfn);
+struct pci_dev *pci_get_pdev_by_domain(const struct domain *, uint16_t seg,
+                                       uint8_t bus, uint8_t devfn);
 void pci_check_disable_device(u16 seg, u8 bus, u8 devfn);
 
 uint8_t pci_conf_read8(pci_sbdf_t sbdf, unsigned int reg);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Mon Aug 15 14:22:10 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Aug 2022 14:22:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387509.623792 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNayk-0003O0-2p; Mon, 15 Aug 2022 14:22:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387509.623792; Mon, 15 Aug 2022 14:22:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNayj-0003Ns-Vr; Mon, 15 Aug 2022 14:22:05 +0000
Received: by outflank-mailman (input) for mailman id 387509;
 Mon, 15 Aug 2022 14:22:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNayi-0003Nk-Rd
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 14:22:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNayi-0006dd-Oi
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 14:22:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNayi-0000zG-K2
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 14:22:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=DISVO4A3NxEpmV+WXgIt0XMHf465Gv/C9KknmTRei4I=; b=dJXTCyacNaebnzbVzqGYxOIxdt
	W+neHBVVHd9P4tOxst1qE3qZ+fMm4wgDQdtSYZWIaLG9FE1yvAi1KkVjXNWQqO/rZbEqnfUHNrY8D
	Rb15nKsZ+0K2O9ukQjnqYqHBiIthxleHuzI+vu0Male492VMsF2WoIS9pWkasp/Qz9sw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] x86/amd: only call setup_force_cpu_cap for boot CPU
Message-Id: <E1oNayi-0000zG-K2@xenbits.xenproject.org>
Date: Mon, 15 Aug 2022 14:22:04 +0000

commit 4ed063a71bf9ec291a1b71d0b7b36c0416ca544d
Author:     Ross Lagerwall <ross.lagerwall@citrix.com>
AuthorDate: Mon Aug 15 16:12:13 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 16:12:13 2022 +0200

    x86/amd: only call setup_force_cpu_cap for boot CPU
    
    This should only be called for the boot CPU to avoid calling _init code
    after it has been unloaded.
    
    Fixes: 062868a5a8b4 ("x86/amd: Work around CLFLUSH ordering on older parts")
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 31b41ce858c8bd5159212d40969f8e0b7124bbf0
    master date: 2022-08-11 17:44:26 +0200
---
 xen/arch/x86/cpu/amd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/cpu/amd.c b/xen/arch/x86/cpu/amd.c
index f50f91f81e..b670ab6cd1 100644
--- a/xen/arch/x86/cpu/amd.c
+++ b/xen/arch/x86/cpu/amd.c
@@ -820,7 +820,7 @@ static void init_amd(struct cpuinfo_x86 *c)
 	 * everything, including reads and writes to address, and
 	 * LFENCE/SFENCE instructions.
 	 */
-	if (!cpu_has_clflushopt)
+	if (c == &boot_cpu_data && !cpu_has_clflushopt)
 		setup_force_cpu_cap(X86_BUG_CLFLUSH_MFENCE);
 
 	switch(c->x86)
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Mon Aug 15 14:22:16 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Aug 2022 14:22:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387510.623795 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNayu-0003Q2-3j; Mon, 15 Aug 2022 14:22:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387510.623795; Mon, 15 Aug 2022 14:22:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNayu-0003Pv-17; Mon, 15 Aug 2022 14:22:16 +0000
Received: by outflank-mailman (input) for mailman id 387510;
 Mon, 15 Aug 2022 14:22:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNayt-0003Pj-1O
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 14:22:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNayt-0006dp-0Y
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 14:22:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNays-00010F-Vt
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 14:22:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=m9PIPxKcFCitiy+YxNQ2xi5l9pweGLhVVvTAPsoNjoE=; b=5eAc02XG0EjnkhMQS/YrVeaMSt
	L0/6EHO/ma2MsSyi2OHExjtw3mBV4gBtMAeO0epWrez1sjFqxMrnXqNCISkrarhj/SI+xnIi2HOdi
	CvUmsUle/abKxdM+GLQJQ4sMG/RUtyDNmrIJUCjpAoyIW1wX1gB+Sf21zp4hShvhIzLk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.13] x86/amd: only call setup_force_cpu_cap for boot CPU
Message-Id: <E1oNays-00010F-Vt@xenbits.xenproject.org>
Date: Mon, 15 Aug 2022 14:22:14 +0000

commit bde3b13043e31fd757c44bcec182b0ff1fe36d22
Author:     Ross Lagerwall <ross.lagerwall@citrix.com>
AuthorDate: Mon Aug 15 16:13:54 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 16:13:54 2022 +0200

    x86/amd: only call setup_force_cpu_cap for boot CPU
    
    This should only be called for the boot CPU to avoid calling _init code
    after it has been unloaded.
    
    Fixes: 062868a5a8b4 ("x86/amd: Work around CLFLUSH ordering on older parts")
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 31b41ce858c8bd5159212d40969f8e0b7124bbf0
    master date: 2022-08-11 17:44:26 +0200
---
 xen/arch/x86/cpu/amd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/cpu/amd.c b/xen/arch/x86/cpu/amd.c
index e9530d581b..959790575a 100644
--- a/xen/arch/x86/cpu/amd.c
+++ b/xen/arch/x86/cpu/amd.c
@@ -705,7 +705,7 @@ static void init_amd(struct cpuinfo_x86 *c)
 	 * everything, including reads and writes to address, and
 	 * LFENCE/SFENCE instructions.
 	 */
-	if (!cpu_has_clflushopt)
+	if (c == &boot_cpu_data && !cpu_has_clflushopt)
 		setup_force_cpu_cap(X86_BUG_CLFLUSH_MFENCE);
 
 	switch(c->x86)
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Mon Aug 15 20:55:07 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Aug 2022 20:55:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387818.624216 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNh70-00020h-Pz; Mon, 15 Aug 2022 20:55:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387818.624216; Mon, 15 Aug 2022 20:55:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNh70-00020Y-NP; Mon, 15 Aug 2022 20:55:02 +0000
Received: by outflank-mailman (input) for mailman id 387818;
 Mon, 15 Aug 2022 20:55:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNh6z-00020Q-LO
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 20:55:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNh6z-0005k2-KY
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 20:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNh6z-0007jR-J4
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 20:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ppVW3Rd6R++XLuH8fc23RKruFVfkXlWUJlJ/shbDkxY=; b=6j4OWDuVbZ0Y9kcg6z1mdTzZsq
	faE+nxflFnPUomfOTXMiu/aUy7BBo6FlBWIiySoUTOo6hir3eVpu5fK2BR76LoZOQ4aYkduxoWv6y
	cGiYECjuTb7UTkgVNw6g3kjO8KsQZSEN6024VhDEzxvg30x1pfYE8IApA+9m08+onE5w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/mm: re-arrange type check around _get_page_type()'s TLB flush
Message-Id: <E1oNh6z-0007jR-J4@xenbits.xenproject.org>
Date: Mon, 15 Aug 2022 20:55:01 +0000

commit 8eb15275cd5d945acbc0f70a358255dea94117cf
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Aug 15 08:53:11 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 08:53:11 2022 +0200

    x86/mm: re-arrange type check around _get_page_type()'s TLB flush
    
    Checks dependent on only d and x can be pulled out, thus allowing to
    skip the flush mask calculation.
    
    (Also-)Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/mm.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 40e132b9ba..db1817b691 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -3020,7 +3020,10 @@ static int _get_page_type(struct page_info *page, unsigned long type,
         if ( d && shadow_mode_enabled(d) )
             shadow_prepare_page_type_change(d, page);
 
-        if ( (x & PGT_type_mask) != type )
+        if ( (x & PGT_type_mask) != type &&
+             /* Shadow mode: track only writable pages. */
+             (!shadow_mode_enabled(d) ||
+              ((x & PGT_type_mask) == PGT_writable_page)) )
         {
             /*
              * On type change we check to flush stale TLB entries. It is
@@ -3035,10 +3038,7 @@ static int _get_page_type(struct page_info *page, unsigned long type,
             /* Don't flush if the timestamp is old enough */
             tlbflush_filter(mask, page->tlbflush_timestamp);
 
-            if ( unlikely(!cpumask_empty(mask)) &&
-                 /* Shadow mode: track only writable pages. */
-                 (!shadow_mode_enabled(d) ||
-                  ((x & PGT_type_mask) == PGT_writable_page)) )
+            if ( unlikely(!cpumask_empty(mask)) )
             {
                 perfc_incr(need_flush_tlb_flush);
                 /*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Aug 15 20:55:12 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Aug 2022 20:55:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387819.624221 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNh7A-000232-RZ; Mon, 15 Aug 2022 20:55:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387819.624221; Mon, 15 Aug 2022 20:55:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNh7A-00022u-Oz; Mon, 15 Aug 2022 20:55:12 +0000
Received: by outflank-mailman (input) for mailman id 387819;
 Mon, 15 Aug 2022 20:55:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNh79-00022e-OP
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 20:55:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNh79-0005kC-Nb
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 20:55:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNh79-0007jy-Me
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 20:55:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Db78QJnJU8MJAZLiu6FmvHoASQa+WPh5A6mItsi4/6Y=; b=OrYVS8OOLNUoiE4fAXfJa4a4Nd
	hZSIKxaX79GWUlhrQT8gl3uVdumSPnccuf/FK3C5RrfiB3E0s5Hc+f2WzAmrAH5lBeDHKIexGR+Ws
	88bHo08oRyR8zdc8suF9rI89l0JIKL9eWHElDJILu1m4e95ir1P6xHA5ZmsfZUmAAONU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/firmware/hvmloader: rework Makefile
Message-Id: <E1oNh79-0007jy-Me@xenbits.xenproject.org>
Date: Mon, 15 Aug 2022 20:55:11 +0000

commit f4caaef48e4e6d894d2d4831ea66445c976f0138
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Mon Aug 15 08:55:14 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 08:55:14 2022 +0200

    tools/firmware/hvmloader: rework Makefile
    
    Setup proper dependencies with libacpi so we don't need to run "make
    hvmloader" in the "all" target. ("build.o" new prerequisite isn't
    exactly proper but a side effect of building the $(DSDT_FILES) is to
    generate the "ssdt_*.h" needed by "build.o".)
    
    Make use if "-iquote" instead of a plain "-I".
    
    For "roms.inc" target, use "$(SHELL)" instead of plain "sh". And use
    full path to "mkhex" instead of a relative one. Lastly, add "-f" flag
    to "mv" to avoid a prompt in case the target already exist and we
    don't have write permission.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 tools/firmware/hvmloader/Makefile | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/tools/firmware/hvmloader/Makefile b/tools/firmware/hvmloader/Makefile
index b754220839..4f31c88161 100644
--- a/tools/firmware/hvmloader/Makefile
+++ b/tools/firmware/hvmloader/Makefile
@@ -60,8 +60,7 @@ ROMS += $(ROMBIOS_ROM) $(STDVGA_ROM) $(CIRRUSVGA_ROM)
 endif
 
 .PHONY: all
-all: acpi
-	$(MAKE) hvmloader
+all: hvmloader
 
 .PHONY: acpi
 acpi:
@@ -73,12 +72,18 @@ smbios.o: CFLAGS += -D__SMBIOS_DATE__="\"$(SMBIOS_REL_DATE)\""
 ACPI_PATH = ../../libacpi
 DSDT_FILES = dsdt_anycpu.c dsdt_15cpu.c dsdt_anycpu_qemu_xen.c
 ACPI_OBJS = $(patsubst %.c,%.o,$(DSDT_FILES)) build.o static_tables.o
-$(ACPI_OBJS): CFLAGS += -I. -DLIBACPI_STDUTILS=\"$(CURDIR)/util.h\"
+$(ACPI_OBJS): CFLAGS += -iquote . -DLIBACPI_STDUTILS=\"$(CURDIR)/util.h\"
 CFLAGS += -I$(ACPI_PATH)
 vpath build.c $(ACPI_PATH)
 vpath static_tables.c $(ACPI_PATH)
 OBJS += $(ACPI_OBJS)
 
+$(DSDT_FILES): acpi
+
+# Add DSDT_FILES as a prerequisite of "build.o" so that make will also
+# generate the "ssdt_*.h" headers needed by "build.o".
+build.o: $(DSDT_FILES)
+
 hvmloader: $(OBJS) hvmloader.lds
 	$(LD) $(LDFLAGS_DIRECT) -N -T hvmloader.lds -o $@ $(OBJS)
 
@@ -87,21 +92,21 @@ roms.inc: $(ROMS)
 
 ifneq ($(ROMBIOS_ROM),)
 	echo "#ifdef ROM_INCLUDE_ROMBIOS" >> $@.new
-	sh ../../misc/mkhex rombios $(ROMBIOS_ROM) >> $@.new
+	$(SHELL) $(XEN_ROOT)/tools/misc/mkhex rombios $(ROMBIOS_ROM) >> $@.new
 	echo "#endif" >> $@.new
 endif
 
 ifneq ($(STDVGA_ROM),)
 	echo "#ifdef ROM_INCLUDE_VGABIOS" >> $@.new
-	sh ../../misc/mkhex vgabios_stdvga $(STDVGA_ROM) >> $@.new
+	$(SHELL) $(XEN_ROOT)/tools/misc/mkhex vgabios_stdvga $(STDVGA_ROM) >> $@.new
 	echo "#endif" >> $@.new
 endif
 ifneq ($(CIRRUSVGA_ROM),)
 	echo "#ifdef ROM_INCLUDE_VGABIOS" >> $@.new
-	sh ../../misc/mkhex vgabios_cirrusvga $(CIRRUSVGA_ROM) >> $@.new
+	$(SHELL) $(XEN_ROOT)/tools/misc/mkhex vgabios_cirrusvga $(CIRRUSVGA_ROM) >> $@.new
 	echo "#endif" >> $@.new
 endif
-	mv $@.new $@
+	mv -f $@.new $@
 
 .PHONY: clean
 clean:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Aug 15 20:55:22 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Aug 2022 20:55:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387820.624225 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNh7K-000278-UT; Mon, 15 Aug 2022 20:55:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387820.624225; Mon, 15 Aug 2022 20:55:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNh7K-000270-Ri; Mon, 15 Aug 2022 20:55:22 +0000
Received: by outflank-mailman (input) for mailman id 387820;
 Mon, 15 Aug 2022 20:55:21 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNh7J-00026n-Re
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 20:55:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNh7J-0005kS-Qt
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 20:55:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNh7J-0007kP-Pz
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 20:55:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=g9ss/+y5o/dSQHK+6z8gGrvfPgxtcxlMI5aycQciLx8=; b=DzntWCOOnfHEIX8omDp8ce2RrM
	qULb9FD417Jqr4VBKb560oqA+zjgjLGiT4HYALIMbOu3m1B70SrxXdMTuMNmkRzFhegLyb+H60xc9
	nUJDN8K8bb6P41scUkVRjHhxPquL3p/gxgk+e1iRtpmMW7zNj9osovPS9TI1y1j2OPhI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/fuzz/x86_instruction_emulator: rework makefile
Message-Id: <E1oNh7J-0007kP-Pz@xenbits.xenproject.org>
Date: Mon, 15 Aug 2022 20:55:21 +0000

commit 2d696fc3d02c9e7246f58d4199cb4ec4fd597fd1
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Mon Aug 15 08:55:16 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 08:55:16 2022 +0200

    tools/fuzz/x86_instruction_emulator: rework makefile
    
    Rework dependencies of all objects. We don't need to add dependencies
    for headers that $(CC) is capable of generating, we only need to
    include $(DEPS_INCLUDE). Some dependencies are still needed so make
    knows to generate symlinks for them.
    
    We remove the use of "vpath" for cpuid.c. While it works fine for now,
    when we will convert this makefile to subdirmk, vpath will not be
    usable. Also, "-iquote" is now needed to build "cpuid.o".
    
    Replace "-I." by "-iquote .", so it applies to double-quote includes
    only.
    
    Rather than checking if a symlink exist, always regenerate the
    symlink. So if the source tree changed location, the symlink is
    updated.
    
    Since we are creating a new .gitignore for the symlink, also move the
    entry to it.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 .gitignore                                     |  6 -----
 tools/fuzz/x86_instruction_emulator/.gitignore |  7 ++++++
 tools/fuzz/x86_instruction_emulator/Makefile   | 35 +++++++++++++-------------
 3 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/.gitignore b/.gitignore
index ed7bd8bdc7..ff1d668489 100644
--- a/.gitignore
+++ b/.gitignore
@@ -195,12 +195,6 @@ tools/flask/utils/flask-loadpolicy
 tools/flask/utils/flask-setenforce
 tools/flask/utils/flask-set-bool
 tools/flask/utils/flask-label-pci
-tools/fuzz/x86_instruction_emulator/asm
-tools/fuzz/x86_instruction_emulator/afl-harness
-tools/fuzz/x86_instruction_emulator/afl-harness-cov
-tools/fuzz/x86_instruction_emulator/wrappers.c
-tools/fuzz/x86_instruction_emulator/x86_emulate
-tools/fuzz/x86_instruction_emulator/x86-emulate.[ch]
 tools/helpers/init-xenstore-domain
 tools/helpers/xen-init-dom0
 tools/hotplug/common/hotplugpath.sh
diff --git a/tools/fuzz/x86_instruction_emulator/.gitignore b/tools/fuzz/x86_instruction_emulator/.gitignore
new file mode 100644
index 0000000000..65c3cf9702
--- /dev/null
+++ b/tools/fuzz/x86_instruction_emulator/.gitignore
@@ -0,0 +1,7 @@
+/asm
+/afl-harness
+/afl-harness-cov
+/cpuid.c
+/wrappers.c
+/x86_emulate
+/x86-emulate.[ch]
diff --git a/tools/fuzz/x86_instruction_emulator/Makefile b/tools/fuzz/x86_instruction_emulator/Makefile
index 1a6dbf94e1..13aa238503 100644
--- a/tools/fuzz/x86_instruction_emulator/Makefile
+++ b/tools/fuzz/x86_instruction_emulator/Makefile
@@ -9,32 +9,29 @@ x86-insn-fuzz-all:
 endif
 
 # Add libx86 to the build
-vpath %.c $(XEN_ROOT)/xen/lib/x86
+%.c: $(XEN_ROOT)/xen/lib/x86/%.c FORCE
+	ln -nsf $< $@
 
-x86_emulate:
-	[ -L $@ ] || ln -sf $(XEN_ROOT)/xen/arch/x86/$@
+x86_emulate: FORCE
+	ln -nsf $(XEN_ROOT)/xen/arch/x86/$@
 
 x86_emulate/%: x86_emulate ;
 
-x86-emulate.c x86-emulate.h wrappers.c: %:
-	[ -L $* ] || ln -sf $(XEN_ROOT)/tools/tests/x86_emulator/$*
+%.c: $(XEN_ROOT)/tools/tests/x86_emulator/%.c FORCE
+	ln -nsf $< $@
+%.h: $(XEN_ROOT)/tools/tests/x86_emulator/%.h FORCE
+	ln -nsf $< $@
 
-CFLAGS += $(CFLAGS_xeninclude) -D__XEN_TOOLS__ -I.
+CFLAGS += $(CFLAGS_xeninclude) -D__XEN_TOOLS__ -iquote .
+cpuid.o: CFLAGS += -iquote $(XEN_ROOT)/xen/lib/x86
 
 GCOV_FLAGS := --coverage
 %-cov.o: %.c
 	$(CC) -c $(CFLAGS) $(GCOV_FLAGS) $< -o $@
 
-x86.h := $(addprefix $(XEN_ROOT)/tools/include/xen/asm/,\
-                     x86-vendors.h x86-defns.h msr-index.h) \
-         $(addprefix $(XEN_ROOT)/tools/include/xen/lib/x86/, \
-                     cpuid.h cpuid-autogen.h)
-x86_emulate.h := x86-emulate.h x86_emulate/x86_emulate.h $(x86.h)
-
-# x86-emulate.c will be implicit for both
-x86-emulate.o x86-emulate-cov.o: x86_emulate/x86_emulate.c $(x86_emulate.h)
-
-fuzz-emul.o fuzz-emulate-cov.o cpuid.o wrappers.o: $(x86_emulate.h)
+x86-emulate.h: x86_emulate/x86_emulate.h
+x86-emulate.o x86-emulate-cov.o: x86-emulate.h x86_emulate/x86_emulate.c
+fuzz-emul.o fuzz-emul-cov.o wrappers.o: x86-emulate.h
 
 x86-insn-fuzzer.a: fuzz-emul.o x86-emulate.o cpuid.o
 	$(AR) rc $@ $^
@@ -51,11 +48,11 @@ all: x86-insn-fuzz-all
 
 .PHONY: distclean
 distclean: clean
-	rm -f x86_emulate x86-emulate.c x86-emulate.h
+	rm -f x86_emulate x86-emulate.c x86-emulate.h wrappers.c cpuid.c
 
 .PHONY: clean
 clean:
-	rm -f *.a *.o .*.d afl-harness afl-harness-cov *.gcda *.gcno *.gcov
+	rm -f *.a *.o $(DEPS_RM) afl-harness afl-harness-cov *.gcda *.gcno *.gcov
 
 .PHONY: install
 install: all
@@ -67,3 +64,5 @@ afl: afl-harness
 
 .PHONY: afl-cov
 afl-cov: afl-harness-cov
+
+-include $(DEPS_INCLUDE)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Aug 15 20:55:33 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Aug 2022 20:55:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387821.624229 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNh7U-0002AY-W0; Mon, 15 Aug 2022 20:55:32 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387821.624229; Mon, 15 Aug 2022 20:55:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNh7U-0002AO-TA; Mon, 15 Aug 2022 20:55:32 +0000
Received: by outflank-mailman (input) for mailman id 387821;
 Mon, 15 Aug 2022 20:55:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNh7T-0002AA-Un
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 20:55:31 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNh7T-0005kt-U2
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 20:55:31 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNh7T-0007ko-T6
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 20:55:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Ne6iBpRmSAIfMiJhJ8SEy2OvLG0HMe6jLCOpAQ2ptqo=; b=X2UItGwrU52PU2Wk+KwjaPR7xi
	wPqyNV+xqF1m41qrja6CafIfwwbsJAG5qgC066lylumlrQ8eRCoTItegMbvCqBvw9TmKSAgdqKZVt
	KclzKPx73Y7GICB1fIh42kH/1y63khMovT/UYw/v8goBFzo6JmnbiPWYGhip2NRMSANM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/hotplug: cleanup Makefiles
Message-Id: <E1oNh7T-0007ko-T6@xenbits.xenproject.org>
Date: Mon, 15 Aug 2022 20:55:31 +0000

commit 290a9b91d9c6411b97d0fef9fcdbf93d125071d3
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Mon Aug 15 08:55:19 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 08:55:19 2022 +0200

    tools/hotplug: cleanup Makefiles
    
    Remove "build" targets.
    
    Use simply expanded variables when recursively expanded variable
    aren't needed. (Use ":=" instead of "=".)
    
    Don't check if a directory already exist when installing, just create
    it.
    
    Fix $(HOTPLUGPATH), it shouldn't have any double-quote.
    
    Some reindentation.
    
    FreeBSD, "hotplugpath.sh" is already installed by common/.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
---
 tools/hotplug/FreeBSD/Makefile       | 11 +++--------
 tools/hotplug/Linux/Makefile         | 16 ++++++----------
 tools/hotplug/Linux/systemd/Makefile | 16 +++++++---------
 tools/hotplug/NetBSD/Makefile        |  9 +++------
 tools/hotplug/common/Makefile        | 16 ++++++----------
 5 files changed, 25 insertions(+), 43 deletions(-)

diff --git a/tools/hotplug/FreeBSD/Makefile b/tools/hotplug/FreeBSD/Makefile
index de9928cd86..a6552c9884 100644
--- a/tools/hotplug/FreeBSD/Makefile
+++ b/tools/hotplug/FreeBSD/Makefile
@@ -2,18 +2,15 @@ XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 # Xen script dir and scripts to go there.
-XEN_SCRIPTS = vif-bridge block
+XEN_SCRIPTS := vif-bridge block
 
-XEN_SCRIPT_DATA =
+XEN_SCRIPT_DATA :=
 
-XEN_RCD_PROG = rc.d/xencommons rc.d/xendriverdomain
+XEN_RCD_PROG := rc.d/xencommons rc.d/xendriverdomain
 
 .PHONY: all
 all:
 
-.PHONY: build
-build:
-
 .PHONY: install
 install: install-scripts install-rcd
 
@@ -44,12 +41,10 @@ install-rcd:
 	   do \
 	   $(INSTALL_PROG) $$i $(DESTDIR)$(INITD_DIR); \
 	done
-	$(INSTALL_DATA) ../common/hotplugpath.sh $(DESTDIR)$(XEN_SCRIPT_DIR)
 
 .PHONY: uninstall-rcd
 uninstall-rcd:
 	rm -f $(addprefix $(DESTDIR)$(INITD_DIR)/, $(XEN_RCD_PROG))
-	rm -f $(DESTDIR)$(XEN_SCRIPT_DIR)/hotplugpath.sh
 
 .PHONY: clean
 clean:
diff --git a/tools/hotplug/Linux/Makefile b/tools/hotplug/Linux/Makefile
index 0b1d111d7e..9a7b3a3515 100644
--- a/tools/hotplug/Linux/Makefile
+++ b/tools/hotplug/Linux/Makefile
@@ -2,7 +2,7 @@ XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 # Xen script dir and scripts to go there.
-XEN_SCRIPTS = vif-bridge
+XEN_SCRIPTS := vif-bridge
 XEN_SCRIPTS += vif-route
 XEN_SCRIPTS += vif-nat
 XEN_SCRIPTS += vif-openvswitch
@@ -22,16 +22,13 @@ XEN_SCRIPTS += launch-xenstore
 
 SUBDIRS-$(CONFIG_SYSTEMD) += systemd
 
-XEN_SCRIPT_DATA = xen-script-common.sh locking.sh logging.sh
+XEN_SCRIPT_DATA := xen-script-common.sh locking.sh logging.sh
 XEN_SCRIPT_DATA += xen-hotplug-common.sh xen-network-common.sh vif-common.sh
 XEN_SCRIPT_DATA += block-common.sh
 
 .PHONY: all
 all: subdirs-all
 
-.PHONY: build
-build:
-
 .PHONY: install
 install: install-initd install-scripts subdirs-install
 
@@ -41,9 +38,9 @@ uninstall: uninstall-initd uninstall-scripts subdirs-uninstall
 # See docs/misc/distro_mapping.txt for INITD_DIR location
 .PHONY: install-initd
 install-initd:
-	[ -d $(DESTDIR)$(INITD_DIR) ] || $(INSTALL_DIR) $(DESTDIR)$(INITD_DIR)
-	[ -d $(DESTDIR)$(SYSCONFIG_DIR) ] || $(INSTALL_DIR) $(DESTDIR)$(SYSCONFIG_DIR)
-	[ -d $(DESTDIR)$(LIBEXEC_BIN) ] || $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
+	$(INSTALL_DIR) $(DESTDIR)$(INITD_DIR)
+	$(INSTALL_DIR) $(DESTDIR)$(SYSCONFIG_DIR)
+	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
 	$(INSTALL_DATA) init.d/sysconfig.xendomains $(DESTDIR)$(SYSCONFIG_DIR)/xendomains
 	$(INSTALL_DATA) init.d/sysconfig.xencommons $(DESTDIR)$(SYSCONFIG_DIR)/xencommons
 	$(INSTALL_PROG) xendomains $(DESTDIR)$(LIBEXEC_BIN)
@@ -64,8 +61,7 @@ uninstall-initd:
 
 .PHONY: install-scripts
 install-scripts:
-	[ -d $(DESTDIR)$(XEN_SCRIPT_DIR) ] || \
-		$(INSTALL_DIR) $(DESTDIR)$(XEN_SCRIPT_DIR)
+	$(INSTALL_DIR) $(DESTDIR)$(XEN_SCRIPT_DIR)
 	set -e; for i in $(XEN_SCRIPTS); \
 	    do \
 	    $(INSTALL_PROG) $$i $(DESTDIR)$(XEN_SCRIPT_DIR); \
diff --git a/tools/hotplug/Linux/systemd/Makefile b/tools/hotplug/Linux/systemd/Makefile
index a5d41d86ef..26df2a43b1 100644
--- a/tools/hotplug/Linux/systemd/Makefile
+++ b/tools/hotplug/Linux/systemd/Makefile
@@ -1,12 +1,12 @@
 XEN_ROOT = $(CURDIR)/../../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-XEN_SYSTEMD_MODULES = xen.conf
+XEN_SYSTEMD_MODULES := xen.conf
 
-XEN_SYSTEMD_MOUNT =  proc-xen.mount
+XEN_SYSTEMD_MOUNT := proc-xen.mount
 XEN_SYSTEMD_MOUNT += var-lib-xenstored.mount
 
-XEN_SYSTEMD_SERVICE  = xenstored.service
+XEN_SYSTEMD_SERVICE := xenstored.service
 XEN_SYSTEMD_SERVICE += xenconsoled.service
 XEN_SYSTEMD_SERVICE += xen-qemu-dom0-disk-backend.service
 XEN_SYSTEMD_SERVICE += xendomains.service
@@ -14,7 +14,7 @@ XEN_SYSTEMD_SERVICE += xen-watchdog.service
 XEN_SYSTEMD_SERVICE += xen-init-dom0.service
 XEN_SYSTEMD_SERVICE += xendriverdomain.service
 
-ALL_XEN_SYSTEMD =	$(XEN_SYSTEMD_MODULES)  \
+ALL_XEN_SYSTEMD :=	$(XEN_SYSTEMD_MODULES)  \
 			$(XEN_SYSTEMD_MOUNT)	\
 			$(XEN_SYSTEMD_SERVICE)
 
@@ -30,10 +30,8 @@ distclean: clean
 
 .PHONY: install
 install: $(ALL_XEN_SYSTEMD)
-	[ -d $(DESTDIR)$(XEN_SYSTEMD_DIR) ] || \
-		$(INSTALL_DIR) $(DESTDIR)$(XEN_SYSTEMD_DIR)
-	[ -d $(DESTDIR)$(XEN_SYSTEMD_MODULES_LOAD) ] || \
-		$(INSTALL_DIR) $(DESTDIR)$(XEN_SYSTEMD_MODULES_LOAD)
+	$(INSTALL_DIR) $(DESTDIR)$(XEN_SYSTEMD_DIR)
+	$(INSTALL_DIR) $(DESTDIR)$(XEN_SYSTEMD_MODULES_LOAD)
 	$(INSTALL_DATA) *.service $(DESTDIR)$(XEN_SYSTEMD_DIR)
 	$(INSTALL_DATA) *.mount $(DESTDIR)$(XEN_SYSTEMD_DIR)
 	$(INSTALL_DATA) *.conf $(DESTDIR)$(XEN_SYSTEMD_MODULES_LOAD)
@@ -48,5 +46,5 @@ $(XEN_SYSTEMD_MODULES):
 	rm -f $@.tmp
 	for mod in $(LINUX_BACKEND_MODULES) ; do \
 		echo $$mod ; \
-		done > $@.tmp
+	done > $@.tmp
 	$(call move-if-changed,$@.tmp,$@)
diff --git a/tools/hotplug/NetBSD/Makefile b/tools/hotplug/NetBSD/Makefile
index f909ffa367..1cd3db2ccb 100644
--- a/tools/hotplug/NetBSD/Makefile
+++ b/tools/hotplug/NetBSD/Makefile
@@ -2,22 +2,19 @@ XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 # Xen script dir and scripts to go there.
-XEN_SCRIPTS =
+XEN_SCRIPTS :=
 XEN_SCRIPTS += locking.sh
 XEN_SCRIPTS += block
 XEN_SCRIPTS += vif-bridge
 XEN_SCRIPTS += vif-ip
 XEN_SCRIPTS += qemu-ifup
 
-XEN_SCRIPT_DATA =
-XEN_RCD_PROG = rc.d/xencommons rc.d/xendomains rc.d/xen-watchdog rc.d/xendriverdomain
+XEN_SCRIPT_DATA :=
+XEN_RCD_PROG := rc.d/xencommons rc.d/xendomains rc.d/xen-watchdog rc.d/xendriverdomain
 
 .PHONY: all
 all:
 
-.PHONY: build
-build:
-
 .PHONY: install
 install: install-scripts install-rcd
 
diff --git a/tools/hotplug/common/Makefile b/tools/hotplug/common/Makefile
index ef48bfacc9..e8a8dbea6c 100644
--- a/tools/hotplug/common/Makefile
+++ b/tools/hotplug/common/Makefile
@@ -1,22 +1,19 @@
 XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-HOTPLUGPATH="hotplugpath.sh"
+HOTPLUGPATH := hotplugpath.sh
 
 # OS-independent hotplug scripts go in this directory
 
 # Xen scripts to go there.
-XEN_SCRIPTS =
-XEN_SCRIPT_DATA = $(HOTPLUGPATH)
+XEN_SCRIPTS :=
+XEN_SCRIPT_DATA := $(HOTPLUGPATH)
 
 genpath-target = $(call buildmakevars2file,$(HOTPLUGPATH))
 $(eval $(genpath-target))
 
 .PHONY: all
-all: build
-
-.PHONY: build
-build: $(HOTPLUGPATH)
+all: $(HOTPLUGPATH)
 
 .PHONY: install
 install: install-scripts
@@ -25,9 +22,8 @@ install: install-scripts
 uninstall: uninstall-scripts
 
 .PHONY: install-scripts
-install-scripts: build
-	[ -d $(DESTDIR)$(XEN_SCRIPT_DIR) ] || \
-		$(INSTALL_DIR) $(DESTDIR)$(XEN_SCRIPT_DIR)
+install-scripts: all
+	$(INSTALL_DIR) $(DESTDIR)$(XEN_SCRIPT_DIR)
 	set -e; for i in $(XEN_SCRIPTS); \
 	   do \
 	   $(INSTALL_PROG) $$i $(DESTDIR)$(XEN_SCRIPT_DIR); \
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Aug 15 20:55:43 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Aug 2022 20:55:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387822.624233 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNh7f-0002DH-1M; Mon, 15 Aug 2022 20:55:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387822.624233; Mon, 15 Aug 2022 20:55:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNh7e-0002D9-Uj; Mon, 15 Aug 2022 20:55:42 +0000
Received: by outflank-mailman (input) for mailman id 387822;
 Mon, 15 Aug 2022 20:55:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNh7e-0002Cz-5N
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 20:55:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNh7e-0005l3-4e
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 20:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNh7e-0007lM-05
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 20:55:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZA7JuB2Gn+QMFSdvz3lxAJcBnwCEkMpEYLzW77v73O8=; b=UweZIwp+Wrz+OOZW/0YL1dwaKw
	+l8husK2LX4O8AJe3KRU8AmgPNvu3UzJr7ugbdnSnbvI0PT+FOg1a1uYxPGt+cOAIc7vqetphVOfh
	+KaSZuMrn8hthflP/2jfD6+339HDIN1Y9ScjN/moUPY1juqzT0pXaEFt3aReXk/rT/t0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/libfsimage: Cleanup makefiles
Message-Id: <E1oNh7e-0007lM-05@xenbits.xenproject.org>
Date: Mon, 15 Aug 2022 20:55:42 +0000

commit 4aa436df4b0fad1b6cd66ccbbc94915c9d2696a6
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Mon Aug 15 08:55:21 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 08:55:21 2022 +0200

    tools/libfsimage: Cleanup makefiles
    
    Remove the need for "fs-*" targets by creating a "common.mk" which
    have flags that are common to libfsimage/common/ and the other
    libfsimages/*/ directories.
    
    In common.mk, make $(PIC_OBJS) a recursively expanded variable so it
    doesn't matter where $(LIB_SRCS-y) is defined, and remove the extra
    $(PIC_OBJS) from libfsimage/common/Makefile.
    
    Use a $(TARGETS) variable to list things to be built. And $(TARGETS)
    can be use in the clean target in common.mk.
    
    iso9660/:
        Remove the explicit dependency between fsys_iso9660.c and
        iso9660.h, this is handled automaticaly by the .*.d dependency files,
        and iso9660.h already exist.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
---
 tools/libfsimage/Rules.mk            | 26 ++++++++------------------
 tools/libfsimage/common.mk           | 11 +++++++++++
 tools/libfsimage/common/Makefile     | 11 +++--------
 tools/libfsimage/ext2fs-lib/Makefile |  9 ---------
 tools/libfsimage/ext2fs/Makefile     |  9 ---------
 tools/libfsimage/fat/Makefile        |  9 ---------
 tools/libfsimage/iso9660/Makefile    | 11 -----------
 tools/libfsimage/reiserfs/Makefile   |  9 ---------
 tools/libfsimage/ufs/Makefile        |  9 ---------
 tools/libfsimage/xfs/Makefile        |  9 ---------
 tools/libfsimage/zfs/Makefile        |  9 ---------
 11 files changed, 22 insertions(+), 100 deletions(-)

diff --git a/tools/libfsimage/Rules.mk b/tools/libfsimage/Rules.mk
index bb6d42abb4..cf37d6cb0d 100644
--- a/tools/libfsimage/Rules.mk
+++ b/tools/libfsimage/Rules.mk
@@ -1,25 +1,18 @@
-include $(XEN_ROOT)/tools/Rules.mk
-
-CFLAGS += -Wno-unknown-pragmas -I$(XEN_ROOT)/tools/libfsimage/common/ -DFSIMAGE_FSDIR=\"$(FSDIR)\"
-CFLAGS += -Werror -D_GNU_SOURCE
-LDFLAGS += -L../common/
-
-PIC_OBJS := $(patsubst %.c,%.opic,$(LIB_SRCS-y))
-
-FSDIR = $(libdir)/xenfsimage
+include $(XEN_ROOT)/tools/libfsimage/common.mk
 
 FSLIB = fsimage.so
+TARGETS += $(FSLIB)
 
-.PHONY: fs-all
-fs-all: $(FSLIB)
+.PHONY: all
+all: $(TARGETS)
 
-.PHONY: fs-install
-fs-install: fs-all
+.PHONY: install
+install: all
 	$(INSTALL_DIR) $(DESTDIR)$(FSDIR)/$(FS)
 	$(INSTALL_PROG) $(FSLIB) $(DESTDIR)$(FSDIR)/$(FS)
 
-.PHONY: fs-uninstall
-fs-uninstall:
+.PHONY: uninstall
+uninstall:
 	rm -f $(addprefix $(DESTDIR)$(FSDIR)/$(FS)/, $(FSLIB))
 	if [ -d $(DESTDIR)$(FSDIR)/$(FS) ]; then \
 		rmdir $(DESTDIR)$(FSDIR)/$(FS); \
@@ -28,7 +21,4 @@ fs-uninstall:
 $(FSLIB): $(PIC_OBJS)
 	$(CC) $(LDFLAGS) $(SHLIB_LDFLAGS) -o $@ $^ -lxenfsimage $(FS_LIBDEPS) $(APPEND_LDFLAGS)
 
-clean distclean::
-	rm -f $(PIC_OBJS) $(FSLIB) $(DEPS_RM)
-
 -include $(DEPS_INCLUDE)
diff --git a/tools/libfsimage/common.mk b/tools/libfsimage/common.mk
new file mode 100644
index 0000000000..77bc957f27
--- /dev/null
+++ b/tools/libfsimage/common.mk
@@ -0,0 +1,11 @@
+include $(XEN_ROOT)/tools/Rules.mk
+
+FSDIR := $(libdir)/xenfsimage
+CFLAGS += -Wno-unknown-pragmas -I$(XEN_ROOT)/tools/libfsimage/common/ -DFSIMAGE_FSDIR=\"$(FSDIR)\"
+CFLAGS += -Werror -D_GNU_SOURCE
+LDFLAGS += -L../common/
+
+PIC_OBJS = $(patsubst %.c,%.opic,$(LIB_SRCS-y))
+
+clean distclean::
+	rm -f $(PIC_OBJS) $(TARGETS) $(DEPS_RM)
diff --git a/tools/libfsimage/common/Makefile b/tools/libfsimage/common/Makefile
index 0c5a34baea..79f8cfd28e 100644
--- a/tools/libfsimage/common/Makefile
+++ b/tools/libfsimage/common/Makefile
@@ -1,5 +1,5 @@
 XEN_ROOT = $(CURDIR)/../../..
-include $(XEN_ROOT)/tools/libfsimage/Rules.mk
+include $(XEN_ROOT)/tools/libfsimage/common.mk
 
 MAJOR := $(shell $(XEN_ROOT)/version.sh $(XEN_ROOT)/xen/Makefile)
 MINOR = 0
@@ -13,12 +13,10 @@ LDFLAGS += $(PTHREAD_LDFLAGS)
 
 LIB_SRCS-y = fsimage.c fsimage_plugin.c fsimage_grub.c
 
-PIC_OBJS := $(patsubst %.c,%.opic,$(LIB_SRCS-y))
-
-LIB = libxenfsimage.so libxenfsimage.so.$(MAJOR) libxenfsimage.so.$(MAJOR).$(MINOR)
+TARGETS = libxenfsimage.so libxenfsimage.so.$(MAJOR) libxenfsimage.so.$(MAJOR).$(MINOR)
 
 .PHONY: all
-all: $(LIB)
+all: $(TARGETS)
 
 .PHONY: install
 install: all
@@ -40,9 +38,6 @@ uninstall:
 	rm -f $(DESTDIR)$(libdir)/libxenfsimage.so.$(MAJOR)
 	rm -f $(DESTDIR)$(libdir)/libxenfsimage.so.$(MAJOR).$(MINOR)
 
-clean distclean::
-	rm -f $(LIB)
-
 libxenfsimage.so: libxenfsimage.so.$(MAJOR)
 	ln -sf $< $@
 libxenfsimage.so.$(MAJOR): libxenfsimage.so.$(MAJOR).$(MINOR)
diff --git a/tools/libfsimage/ext2fs-lib/Makefile b/tools/libfsimage/ext2fs-lib/Makefile
index 431a79068e..b9b560df75 100644
--- a/tools/libfsimage/ext2fs-lib/Makefile
+++ b/tools/libfsimage/ext2fs-lib/Makefile
@@ -9,13 +9,4 @@ FS_LIBDEPS = $(EXTFS_LIBS)
 # Include configure output (config.h)
 CFLAGS += -include $(XEN_ROOT)/tools/config.h
 
-.PHONY: all
-all: fs-all
-
-.PHONY: install
-install: fs-install
-
-.PHONY: uninstall
-uninstall: fs-uninstall
-
 include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff --git a/tools/libfsimage/ext2fs/Makefile b/tools/libfsimage/ext2fs/Makefile
index c62ae359ac..fe01f98148 100644
--- a/tools/libfsimage/ext2fs/Makefile
+++ b/tools/libfsimage/ext2fs/Makefile
@@ -4,13 +4,4 @@ LIB_SRCS-y = fsys_ext2fs.c
 
 FS = ext2fs
 
-.PHONY: all
-all: fs-all
-
-.PHONY: install
-install: fs-install
-
-.PHONY: uninstall
-uninstall: fs-uninstall
-
 include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff --git a/tools/libfsimage/fat/Makefile b/tools/libfsimage/fat/Makefile
index 7ee5e7588d..58bcc0751d 100644
--- a/tools/libfsimage/fat/Makefile
+++ b/tools/libfsimage/fat/Makefile
@@ -4,13 +4,4 @@ LIB_SRCS-y = fsys_fat.c
 
 FS = fat
 
-.PHONY: all
-all: fs-all
-
-.PHONY: install
-install: fs-install
-
-.PHONY: uninstall
-uninstall: fs-uninstall
-
 include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff --git a/tools/libfsimage/iso9660/Makefile b/tools/libfsimage/iso9660/Makefile
index bc86baf2c0..acf3164046 100644
--- a/tools/libfsimage/iso9660/Makefile
+++ b/tools/libfsimage/iso9660/Makefile
@@ -4,15 +4,4 @@ LIB_SRCS-y = fsys_iso9660.c
 
 FS = iso9660
 
-.PHONY: all
-all: fs-all
-
-.PHONY: install
-install: fs-install
-
-.PHONY: uninstall
-uninstall: fs-uninstall
-
-fsys_iso9660.c: iso9660.h
-
 include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff --git a/tools/libfsimage/reiserfs/Makefile b/tools/libfsimage/reiserfs/Makefile
index 5acfedf25e..42b751e007 100644
--- a/tools/libfsimage/reiserfs/Makefile
+++ b/tools/libfsimage/reiserfs/Makefile
@@ -4,13 +4,4 @@ LIB_SRCS-y = fsys_reiserfs.c
 
 FS = reiserfs
 
-.PHONY: all
-all: fs-all
-
-.PHONY: install
-install: fs-install
-
-.PHONY: uninstall
-uninstall: fs-uninstall
-
 include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff --git a/tools/libfsimage/ufs/Makefile b/tools/libfsimage/ufs/Makefile
index f32b9178bd..cca4f0a588 100644
--- a/tools/libfsimage/ufs/Makefile
+++ b/tools/libfsimage/ufs/Makefile
@@ -4,13 +4,4 @@ LIB_SRCS-y = fsys_ufs.c
 
 FS = ufs
 
-.PHONY: all
-all: fs-all
-
-.PHONY: install
-install: fs-install
-
-.PHONY: uninstall
-uninstall: fs-uninstall
-
 include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff --git a/tools/libfsimage/xfs/Makefile b/tools/libfsimage/xfs/Makefile
index 54eeb6e35e..ebac7baf14 100644
--- a/tools/libfsimage/xfs/Makefile
+++ b/tools/libfsimage/xfs/Makefile
@@ -4,13 +4,4 @@ LIB_SRCS-y = fsys_xfs.c
 
 FS = xfs
 
-.PHONY: all
-all: fs-all
-
-.PHONY: install
-install: fs-install
-
-.PHONY: uninstall
-uninstall: fs-uninstall
-
 include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff --git a/tools/libfsimage/zfs/Makefile b/tools/libfsimage/zfs/Makefile
index 084e5ec08d..434a9c3580 100644
--- a/tools/libfsimage/zfs/Makefile
+++ b/tools/libfsimage/zfs/Makefile
@@ -28,13 +28,4 @@ LIB_SRCS-y = zfs_lzjb.c zfs_sha256.c zfs_fletcher.c fsi_zfs.c fsys_zfs.c
 
 FS = zfs
 
-.PHONY: all
-all: fs-all
-
-.PHONY: install
-install: fs-install
-
-.PHONY: uninstall
-uninstall: fs-uninstall
-
 include $(XEN_ROOT)/tools/libfsimage/Rules.mk
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Aug 15 20:55:54 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Aug 2022 20:55:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387823.624238 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNh7q-0002GE-3m; Mon, 15 Aug 2022 20:55:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387823.624238; Mon, 15 Aug 2022 20: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 1oNh7q-0002G6-0B; Mon, 15 Aug 2022 20:55:54 +0000
Received: by outflank-mailman (input) for mailman id 387823;
 Mon, 15 Aug 2022 20:55:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNh7o-0002Fd-8i
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 20:55:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNh7o-0005lZ-7v
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 20:55:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNh7o-0007ll-6u
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 20:55:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=emiKFF7I1vIKPwbPDyRwtk06pkJDo0cUOc1nwKqtZg0=; b=s7j2XJcdHUhtcKbzx2aoEa5Wi5
	RyTHVsKJR7ryCRIkS7SvtrJpYSZTr7ZbnApTCjbXLPhwNf0+Q1noCliELx8ckzVLj5oDmNxcH9kwb
	P1VjoLi4L6VeUWSp/plsFlOJ8ML4MsImH4O1aGYYdbZQaogThNjPNIw8AHUV6FSuMJj0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenpaging: Rework makefile
Message-Id: <E1oNh7o-0007ll-6u@xenbits.xenproject.org>
Date: Mon, 15 Aug 2022 20:55:52 +0000

commit becde885384fd736a1c53af07bb5b0ab66fa8a46
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Mon Aug 15 08:55:23 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 08:55:23 2022 +0200

    tools/xenpaging: Rework makefile
    
    - Rename $(SRCS) to $(OBJS-y), we don't need to collect sources.
    - Rename $(IBINS) to $(TARGETS)
    - Stop cleaning "xen" and non-set variable $(LIB).
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
---
 tools/xenpaging/Makefile | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/tools/xenpaging/Makefile b/tools/xenpaging/Makefile
index 04743b335c..e2ed9eaa3f 100644
--- a/tools/xenpaging/Makefile
+++ b/tools/xenpaging/Makefile
@@ -5,33 +5,33 @@ CFLAGS += $(CFLAGS_libxentoollog) $(CFLAGS_libxenevtchn) $(CFLAGS_libxenctrl) $(
 LDLIBS += $(LDLIBS_libxentoollog) $(LDLIBS_libxenevtchn) $(LDLIBS_libxenctrl) $(LDLIBS_libxenstore) $(PTHREAD_LIBS)
 LDFLAGS += $(PTHREAD_LDFLAGS)
 
-POLICY    = default
+POLICY   := default
 
-SRC      :=
-SRCS     += file_ops.c xenpaging.c policy_$(POLICY).c
-SRCS     += pagein.c
+OBJS-y   := file_ops.o
+OBJS-y   += xenpaging.o
+OBJS-y   += policy_$(POLICY).o
+OBJS-y   += pagein.o
 
 CFLAGS   += -Werror
 CFLAGS   += -Wno-unused
 
-OBJS     = $(SRCS:.c=.o)
-IBINS    = xenpaging
+TARGETS := xenpaging
 
-all: $(IBINS)
+all: $(TARGETS)
 
-xenpaging: $(OBJS)
+xenpaging: $(OBJS-y)
 	$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS) $(APPEND_LDFLAGS)
 
 install: all
 	$(INSTALL_DIR) -m 0700 $(DESTDIR)$(XEN_PAGING_DIR)
 	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
-	$(INSTALL_PROG) $(IBINS) $(DESTDIR)$(LIBEXEC_BIN)
+	$(INSTALL_PROG) $(TARGETS) $(DESTDIR)$(LIBEXEC_BIN)
 
 uninstall:
-	rm -f $(addprefix $(DESTDIR)$(LIBEXEC_BIN)/, $(IBINS))
+	rm -f $(addprefix $(DESTDIR)$(LIBEXEC_BIN)/, $(TARGETS))
 
 clean:
-	rm -f *.o *~ $(DEPS_RM) xen TAGS $(IBINS) $(LIB)
+	rm -f *.o *~ $(DEPS_RM) TAGS $(TARGETS)
 
 distclean: clean
 
@@ -39,6 +39,6 @@ distclean: clean
 
 .PHONY: TAGS
 TAGS:
-	etags -t $(SRCS) *.h
+	etags -t *.c *.h
 
 -include $(DEPS_INCLUDE)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Aug 15 20:56:04 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Aug 2022 20:56:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387824.624241 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNh80-0002Jc-7D; Mon, 15 Aug 2022 20:56:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387824.624241; Mon, 15 Aug 2022 20: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 1oNh80-0002JT-4T; Mon, 15 Aug 2022 20:56:04 +0000
Received: by outflank-mailman (input) for mailman id 387824;
 Mon, 15 Aug 2022 20:56:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNh7y-0002JL-C8
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 20:56:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNh7y-0005lw-Av
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 20:56:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNh7y-0007mP-A4
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 20:56:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=I02s/UcfUShlN/X7cfa39/QgDfwmutJuIMjWfnVo6kY=; b=LmkzIR61m1KYF356E1g4VvMasv
	DY61I2LGMDHPHGUM6jJ4u9nc/ozPEIHHx7UJx/5Z+s4pLj6DT5vLB3jJTY+8+MJ1g4dvwMslG292X
	HSbYDuIvxqPgAz4Xuw5IchtpMdA8fLAK8NJRQDvO3TQYtouEd3AeEP6+x2R+WAmxOq9E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xentop: rework makefile
Message-Id: <E1oNh7y-0007mP-A4@xenbits.xenproject.org>
Date: Mon, 15 Aug 2022 20:56:02 +0000

commit 73447cddf6637a07c8b9a8747ddea27288e8a63c
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Mon Aug 15 08:55:25 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 08:55:25 2022 +0200

    tools/xentop: rework makefile
    
    Add "xentop" to "TARGETS" because this variable will be useful later.
    
    Always define all the targets, even when configured with
    --disable-monitor, instead don't visit the subdirectory.
    This mean xentop/ isn't visited anymore during "make clean" that's how
    most other subdirs in the tools/ works.
    
    Also add missing "xentop" rules. It only works without it because we
    still have make's built-ins rules and variables, but fix this to not
    have to rely on them.
    
    Use $(TARGETS) with $(INSTALL_PROG), and thus install into the
    directory rather than spelling the program name.
    
    In the "clean" rule, use $(RM) and remove all "*.o" instead of just
    one object.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
---
 tools/Makefile        |  2 +-
 tools/xentop/Makefile | 21 +++++++++------------
 2 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/tools/Makefile b/tools/Makefile
index 79b4c7e3de..0c1d8b64a4 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -17,7 +17,7 @@ SUBDIRS-$(CONFIG_XCUTILS) += xcutils
 SUBDIRS-$(CONFIG_X86) += firmware
 SUBDIRS-y += console
 SUBDIRS-y += xenmon
-SUBDIRS-y += xentop
+SUBDIRS-$(XENSTAT_XENTOP) += xentop
 SUBDIRS-y += libfsimage
 SUBDIRS-$(CONFIG_Linux) += vchan
 
diff --git a/tools/xentop/Makefile b/tools/xentop/Makefile
index 0034114684..7bd96f34d5 100644
--- a/tools/xentop/Makefile
+++ b/tools/xentop/Makefile
@@ -13,36 +13,33 @@
 XEN_ROOT=$(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-ifneq ($(XENSTAT_XENTOP),y)
-.PHONY: all install xentop uninstall
-all install xentop uninstall:
-else
-
 CFLAGS += -DGCC_PRINTF -Werror $(CFLAGS_libxenstat)
 LDLIBS += $(LDLIBS_libxenstat) $(CURSES_LIBS) $(TINFO_LIBS) $(SOCKET_LIBS) -lm
 CFLAGS += -DHOST_$(XEN_OS)
 
 # Include configure output (config.h)
 CFLAGS += -include $(XEN_ROOT)/tools/config.h
-LDFLAGS += $(APPEND_LDFLAGS)
+
+TARGETS := xentop
 
 .PHONY: all
-all: xentop
+all: $(TARGETS)
+
+xentop: xentop.o
+	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS) $(APPEND_LDFLAGS)
 
 .PHONY: install
-install: xentop
+install: all
 	$(INSTALL_DIR) $(DESTDIR)$(sbindir)
-	$(INSTALL_PROG) xentop $(DESTDIR)$(sbindir)/xentop
+	$(INSTALL_PROG) $(TARGETS) $(DESTDIR)$(sbindir)
 
 .PHONY: uninstall
 uninstall:
 	rm -f $(DESTDIR)$(sbindir)/xentop
 
-endif
-
 .PHONY: clean
 clean:
-	rm -f xentop xentop.o $(DEPS_RM)
+	$(RM) *.o $(TARGETS) $(DEPS_RM)
 
 .PHONY: distclean
 distclean: clean
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Aug 15 20:56:14 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Aug 2022 20:56:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387825.624246 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNh8A-0002MF-A4; Mon, 15 Aug 2022 20:56:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387825.624246; Mon, 15 Aug 2022 20: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 1oNh8A-0002M7-6A; Mon, 15 Aug 2022 20:56:14 +0000
Received: by outflank-mailman (input) for mailman id 387825;
 Mon, 15 Aug 2022 20:56:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNh88-0002Lu-EZ
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 20:56:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNh88-0005m6-Dp
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 20:56:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNh88-0007ms-D4
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 20:56:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/CdYDTEs7Tvx9c3rwMaGhMhD/ZVQp6AJEV62lqslVrg=; b=7FUFJ6aQFC2WvqT0ET7N5x3nVn
	8r/qYXku7JfLFlmF5qP7b1VaMBNaOBC4g1XbzhlXRtbHvQjrCxBHjh8Yquy6KgRmSOk2fmIK/jGxk
	H9h8cZi+tBu3Q0EvW+DRsMcrbOq7CMZ2J1Vc2dYvte9L3p+xPsRklKuXsIrJIzAcuGto=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] .gitignore: Cleanup ignores of tools/libs/*/{headers.chk,*.pc}
Message-Id: <E1oNh88-0007ms-D4@xenbits.xenproject.org>
Date: Mon, 15 Aug 2022 20:56:12 +0000

commit 50f34b69c8145016116bd2909902f266def0b763
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Mon Aug 15 08:55:27 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 08:55:27 2022 +0200

    .gitignore: Cleanup ignores of tools/libs/*/{headers.chk,*.pc}
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 .gitignore            | 26 --------------------------
 tools/libs/.gitignore |  2 ++
 2 files changed, 2 insertions(+), 26 deletions(-)

diff --git a/.gitignore b/.gitignore
index ff1d668489..e3fe06cd13 100644
--- a/.gitignore
+++ b/.gitignore
@@ -106,26 +106,8 @@ tools/config.cache
 config/Tools.mk
 config/Stubdom.mk
 config/Docs.mk
-tools/libs/toolcore/headers.chk
-tools/libs/toolcore/xentoolcore.pc
-tools/libs/toollog/headers.chk
-tools/libs/toollog/xentoollog.pc
-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/ctrl/libxenctrl.map
-tools/libs/ctrl/xencontrol.pc
-tools/libs/foreignmemory/headers.chk
-tools/libs/foreignmemory/xenforeignmemory.pc
-tools/libs/devicemodel/headers.chk
-tools/libs/devicemodel/xendevicemodel.pc
 tools/libs/guest/libxenguest.map
-tools/libs/guest/xenguest.pc
 tools/libs/guest/xc_bitops.h
 tools/libs/guest/xc_core.h
 tools/libs/guest/xc_core_arm.h
@@ -145,21 +127,13 @@ tools/libs/light/testidl.c
 tools/libs/light/test_timedereg
 tools/libs/light/test_fdderegrace
 tools/libs/light/tmp.*
-tools/libs/light/xenlight.pc
-tools/libs/stat/headers.chk
 tools/libs/stat/libxenstat.map
-tools/libs/stat/xenstat.pc
-tools/libs/store/headers.chk
 tools/libs/store/list.h
 tools/libs/store/utils.h
-tools/libs/store/xenstore.pc
 tools/libs/store/xs_lib.c
-tools/libs/util/*.pc
 tools/libs/util/libxlu_cfg_y.output
 tools/libs/util/libxenutil.map
-tools/libs/vchan/headers.chk
 tools/libs/vchan/libxenvchan.map
-tools/libs/vchan/xenvchan.pc
 tools/debugger/gdb/gdb-6.2.1-linux-i386-xen/*
 tools/debugger/gdb/gdb-6.2.1/*
 tools/debugger/gdb/gdb-6.2.1.tar.bz2
diff --git a/tools/libs/.gitignore b/tools/libs/.gitignore
index 4a13126144..1ad7c7f0cb 100644
--- a/tools/libs/.gitignore
+++ b/tools/libs/.gitignore
@@ -1 +1,3 @@
+*/*.pc
+*/headers.chk
 */headers.lst
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Aug 15 20:56:24 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Aug 2022 20:56:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387826.624249 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNh8K-0002Pf-AO; Mon, 15 Aug 2022 20:56:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387826.624249; Mon, 15 Aug 2022 20: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 1oNh8K-0002PX-7b; Mon, 15 Aug 2022 20:56:24 +0000
Received: by outflank-mailman (input) for mailman id 387826;
 Mon, 15 Aug 2022 20:56:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNh8I-0002Ou-HT
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 20:56:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNh8I-0005mH-Gn
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 20:56:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNh8I-0007na-Fr
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 20:56:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=srtu7DFRM6x42WRCypjRwaSIE9Ul5+jgag6iZB4wd2o=; b=gLl0er+HIbolhrxqfrRDNbQEiX
	Nx6rpFQzZcWqboiAoU4+XAR5aAdqUnbvMzzrA9mWC72LdO9tLUhEGPcy2L9dlyQPoDGTVZ+kKJyHX
	Diuq1C8KmoAt0LNXNkurgYpBnKB4t5rXtxhfG5arg0i73E//rGVxIqoMuTkdoRzzc398=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/libs/util: cleanup Makefile
Message-Id: <E1oNh8I-0007na-Fr@xenbits.xenproject.org>
Date: Mon, 15 Aug 2022 20:56:22 +0000

commit dda9c42bd7f0aa9be7cc692804d26d52e82be6f9
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Mon Aug 15 08:55:30 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 08:55:30 2022 +0200

    tools/libs/util: cleanup Makefile
    
    Remove -I. from CFLAGS, it isn't necessary.
    
    Removed $(AUTOSRCS), it isn't used.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 tools/libs/util/Makefile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tools/libs/util/Makefile b/tools/libs/util/Makefile
index ffe507b379..493d2e00be 100644
--- a/tools/libs/util/Makefile
+++ b/tools/libs/util/Makefile
@@ -11,7 +11,7 @@ OBJS-y += libxlu_pci.o
 
 CFLAGS += -Wno-format-zero-length -Wmissing-declarations \
 	-Wno-declaration-after-statement -Wformat-nonliteral
-CFLAGS += -I. $(CFLAGS_libxenctrl)
+CFLAGS += $(CFLAGS_libxenctrl)
 
 CFLAGS += $(PTHREAD_CFLAGS)
 LDFLAGS += $(PTHREAD_LDFLAGS)
@@ -29,7 +29,6 @@ ifeq ($(BISON),)
 endif
 
 AUTOINCS = libxlu_cfg_y.h libxlu_cfg_l.h libxlu_disk_l.h
-AUTOSRCS = libxlu_cfg_y.c libxlu_cfg_l.c
 
 LIBHEADER := libxlutil.h
 PKG_CONFIG_NAME := Xlutil
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Aug 15 20:56:34 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Aug 2022 20:56:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387827.624253 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNh8U-0002SL-C0; Mon, 15 Aug 2022 20:56:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387827.624253; Mon, 15 Aug 2022 20: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 1oNh8U-0002SE-9G; Mon, 15 Aug 2022 20:56:34 +0000
Received: by outflank-mailman (input) for mailman id 387827;
 Mon, 15 Aug 2022 20:56:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNh8S-0002Rx-KG
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 20:56:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNh8S-0005mL-Jf
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 20:56:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNh8S-0007o1-It
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 20:56:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1xgS7dQpvkOlS3Q5yW1XivYF7r0/QiCNvQUPYR5QJ5c=; b=XXmbV1dES0ykMJ1b8mVl73AQiO
	E/1UFCEGIhHm7W8w9CJilCV1cunhMxQB4/d46EmVPkHyNzo459o4MPSafeWVTEh9or4yliQXS0yfp
	lzST7/ud8NjwQqzZf+VPDwECQrKl6qViSpgNWRVHRxsCanKqGygsJDblAB44b49ddsYA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libs/libs.mk: Rename $(LIB) to $(TARGETS)
Message-Id: <E1oNh8S-0007o1-It@xenbits.xenproject.org>
Date: Mon, 15 Aug 2022 20:56:32 +0000

commit cccced3434dc68595941d26d0b6b79ccf2e953f8
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Mon Aug 15 08:55:32 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 08:55:32 2022 +0200

    libs/libs.mk: Rename $(LIB) to $(TARGETS)
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 tools/libs/libs.mk | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/libs/libs.mk b/tools/libs/libs.mk
index 58d8166b09..e02f91f95e 100644
--- a/tools/libs/libs.mk
+++ b/tools/libs/libs.mk
@@ -23,9 +23,9 @@ LDLIBS += $(foreach lib, $(USELIBS_$(LIBNAME)), $(LDLIBS_libxen$(lib)))
 PIC_OBJS := $(OBJS-y:.o=.opic)
 
 LIB_FILE_NAME = $(FILENAME_$(LIBNAME))
-LIB := lib$(LIB_FILE_NAME).a
+TARGETS := lib$(LIB_FILE_NAME).a
 ifneq ($(nosharedlibs),y)
-LIB += lib$(LIB_FILE_NAME).so
+TARGETS += lib$(LIB_FILE_NAME).so
 endif
 
 PKG_CONFIG ?= $(LIB_FILE_NAME).pc
@@ -55,7 +55,7 @@ $(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_INCLUDE)
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_LIBDIR = $(CURDIR)
 
 .PHONY: all
-all: headers.chk $(LIB) $(PKG_CONFIG_INST) $(PKG_CONFIG_LOCAL) libxen$(LIBNAME).map $(LIBHEADERS)
+all: headers.chk $(TARGETS) $(PKG_CONFIG_INST) $(PKG_CONFIG_LOCAL) libxen$(LIBNAME).map $(LIBHEADERS)
 
 ifneq ($(NO_HEADERS_CHK),y)
 headers.chk:
@@ -124,7 +124,7 @@ TAGS:
 
 .PHONY: clean
 clean::
-	rm -rf $(LIB) *~ $(DEPS_RM) $(OBJS-y) $(PIC_OBJS)
+	rm -rf $(TARGETS) *~ $(DEPS_RM) $(OBJS-y) $(PIC_OBJS)
 	rm -f lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR) lib$(LIB_FILE_NAME).so.$(MAJOR)
 	rm -f headers.chk headers.lst
 	rm -f $(PKG_CONFIG)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Aug 15 20:56:44 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Aug 2022 20:56:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387828.624257 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNh8e-0002VN-DV; Mon, 15 Aug 2022 20:56:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387828.624257; Mon, 15 Aug 2022 20: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 1oNh8e-0002VF-Am; Mon, 15 Aug 2022 20:56:44 +0000
Received: by outflank-mailman (input) for mailman id 387828;
 Mon, 15 Aug 2022 20:56:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNh8c-0002Uz-NB
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 20:56:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNh8c-0005mP-MR
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 20:56:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNh8c-0007oS-Lf
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 20:56:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0W1sEQxGWFZZ8JMxRlUHRESpmis6/+A3AlsEoMmjVTc=; b=6NVebLiY/6Pld4pbF8rjQBRnwH
	k8x0Rmv2YlwwCmxPRrWWFZe8YDZEhoLbV/1RzKckrOExd/bPMufXHuTjyEBWJRFJoTtUJwc9icx1r
	xvoraLOkbM1acWPdoXzrUdhgXt2bzXDIhqZspe+/LtEd7zmfmMITuGSU0qB8nhipHYMc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libs/libs.mk: Remove the need for $(PKG_CONFIG_INST)
Message-Id: <E1oNh8c-0007oS-Lf@xenbits.xenproject.org>
Date: Mon, 15 Aug 2022 20:56:42 +0000

commit 5e49cfcaf03180209b5be79093349c1abd0d0269
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Mon Aug 15 08:55:34 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 08:55:34 2022 +0200

    libs/libs.mk: Remove the need for $(PKG_CONFIG_INST)
    
    We can simply use $(PKG_CONFIG) to set the parameters, and add it to
    $(TARGETS) as necessary.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 tools/libs/libs.mk | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/tools/libs/libs.mk b/tools/libs/libs.mk
index e02f91f95e..7aee449370 100644
--- a/tools/libs/libs.mk
+++ b/tools/libs/libs.mk
@@ -37,10 +37,10 @@ PKG_CONFIG_LIB := $(LIB_FILE_NAME)
 PKG_CONFIG_REQPRIV := $(subst $(space),$(comma),$(strip $(foreach lib,$(patsubst ctrl,control,$(USELIBS_$(LIBNAME))),xen$(lib))))
 
 ifneq ($(CONFIG_LIBXC_MINIOS),y)
-PKG_CONFIG_INST := $(PKG_CONFIG)
-$(PKG_CONFIG_INST): PKG_CONFIG_PREFIX = $(prefix)
-$(PKG_CONFIG_INST): PKG_CONFIG_INCDIR = $(includedir)
-$(PKG_CONFIG_INST): PKG_CONFIG_LIBDIR = $(libdir)
+TARGETS += $(PKG_CONFIG)
+$(PKG_CONFIG): PKG_CONFIG_PREFIX = $(prefix)
+$(PKG_CONFIG): PKG_CONFIG_INCDIR = $(includedir)
+$(PKG_CONFIG): PKG_CONFIG_LIBDIR = $(libdir)
 endif
 
 PKG_CONFIG_LOCAL := $(PKG_CONFIG_DIR)/$(PKG_CONFIG)
@@ -55,7 +55,7 @@ $(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_INCLUDE)
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_LIBDIR = $(CURDIR)
 
 .PHONY: all
-all: headers.chk $(TARGETS) $(PKG_CONFIG_INST) $(PKG_CONFIG_LOCAL) libxen$(LIBNAME).map $(LIBHEADERS)
+all: headers.chk $(TARGETS) $(PKG_CONFIG_LOCAL) libxen$(LIBNAME).map $(LIBHEADERS)
 
 ifneq ($(NO_HEADERS_CHK),y)
 headers.chk:
@@ -127,7 +127,6 @@ clean::
 	rm -rf $(TARGETS) *~ $(DEPS_RM) $(OBJS-y) $(PIC_OBJS)
 	rm -f lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR) lib$(LIB_FILE_NAME).so.$(MAJOR)
 	rm -f headers.chk headers.lst
-	rm -f $(PKG_CONFIG)
 
 .PHONY: distclean
 distclean: clean
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Aug 15 20:56:54 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 15 Aug 2022 20:56:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387829.624261 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNh8o-0002Xv-Ez; Mon, 15 Aug 2022 20:56:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387829.624261; Mon, 15 Aug 2022 20:56: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 1oNh8o-0002Xl-CE; Mon, 15 Aug 2022 20:56:54 +0000
Received: by outflank-mailman (input) for mailman id 387829;
 Mon, 15 Aug 2022 20:56:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNh8m-0002Xc-Pz
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 20:56:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNh8m-0005mt-PF
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 20:56:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNh8m-0007ov-OX
 for xen-changelog@lists.xenproject.org; Mon, 15 Aug 2022 20:56:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=M/sCAwXQ7NON18Um1bSyHOJrBmBTZ/ZrWmrQJrAswVY=; b=QDKLr0Doi9nKs//HzsPvydSwq0
	FOGsBLIDHsJ9AATHg5ZYp3QreSn/3+odzksTZuCJHsEPze4TEvrOIZg87W/BQ7t63sxiALVIk1b0x
	PGJ6UElbeTA38kVBtkTIH0yFSFm0L72dW4WUiSva17Vh/Quh+GfB5BZ/eC65AIQOruCc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libs/libs.mk: Rework target headers.chk dependencies
Message-Id: <E1oNh8m-0007ov-OX@xenbits.xenproject.org>
Date: Mon, 15 Aug 2022 20:56:52 +0000

commit 7547268c359eeef1a4d8e578c612e7cc9350992d
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Mon Aug 15 08:55:36 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 08:55:36 2022 +0200

    libs/libs.mk: Rework target headers.chk dependencies
    
    There is no need to call the "headers.chk" target when it isn't
    wanted, so it never need to be .PHONY.
    
    Also, there is no more reason to separate the prerequisites from the
    recipe.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 tools/libs/libs.mk | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/tools/libs/libs.mk b/tools/libs/libs.mk
index 7aee449370..f778a7df82 100644
--- a/tools/libs/libs.mk
+++ b/tools/libs/libs.mk
@@ -55,22 +55,20 @@ $(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_INCLUDE)
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_LIBDIR = $(CURDIR)
 
 .PHONY: all
-all: headers.chk $(TARGETS) $(PKG_CONFIG_LOCAL) libxen$(LIBNAME).map $(LIBHEADERS)
+all: $(TARGETS) $(PKG_CONFIG_LOCAL) libxen$(LIBNAME).map $(LIBHEADERS)
 
 ifneq ($(NO_HEADERS_CHK),y)
-headers.chk:
+all: headers.chk
+
+headers.chk: $(LIBHEADERS) $(AUTOINCS)
 	for i in $(filter %.h,$^); do \
 	    $(CC) -x c -ansi -Wall -Werror $(CFLAGS_xeninclude) \
 	          -S -o /dev/null $$i || exit 1; \
 	    echo $$i; \
 	done >$@.new
 	mv $@.new $@
-else
-.PHONY: headers.chk
 endif
 
-headers.chk: $(LIBHEADERS) $(AUTOINCS)
-
 headers.lst: FORCE
 	@{ set -e; $(foreach h,$(LIBHEADERS),echo $(h);) } > $@.tmp
 	@$(call move-if-changed,$@.tmp,$@)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Aug 16 06:44:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 16 Aug 2022 06:44:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387983.624481 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNqJ2-0007Mz-2W; Tue, 16 Aug 2022 06:44:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387983.624481; Tue, 16 Aug 2022 06:44:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNqJ1-0007Mr-Vv; Tue, 16 Aug 2022 06:44:03 +0000
Received: by outflank-mailman (input) for mailman id 387983;
 Tue, 16 Aug 2022 06:44:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNqJ0-0007Ma-5n
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 06:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNqJ0-0007Ik-51
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 06:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNqJ0-0000cD-3w
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 06:44:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7RXzgudf9F19l9jQ3CKrKWoXQLBnvaSJMwHuYv1NoLM=; b=L3HG05e98SAbZ60L+lKrzuEi0U
	PxZuIcAZR2Z4XHseyj9vSrF1/NLc0c67fghgewzWBOvS7wDg0n0vs7LX78s7ciVdi3cW2cNhB1+Kc
	Uzsy+479+qRuUdbs2QE8YMRBoXLWKDa2GYDSHCUQpr77y5aYYnRsvmBcCgpIu9kMk9g8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] x86/spec-ctrl: Use IST RSB protection for !SVM systems
Message-Id: <E1oNqJ0-0000cD-3w@xenbits.xenproject.org>
Date: Tue, 16 Aug 2022 06:44:02 +0000

commit 8ae0b4d1331c14fb9e30a42987c0152c9b00f530
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Aug 15 15:40:05 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 15:40:05 2022 +0200

    x86/spec-ctrl: Use IST RSB protection for !SVM systems
    
    There is a corner case where a VT-x guest which manages to reliably trigger
    non-fatal #MC's could evade the rogue RSB speculation protections that were
    supposed to be in place.
    
    This is a lack of defence in depth; Xen does not architecturally execute more
    RET than CALL instructions, so an attacker would have to locate a different
    gadget (e.g. SpectreRSB) first to execute a transient path of excess RET
    instructions.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: e570e8d520ab542d8d35666b95cb3a0125b7b110
    master date: 2022-08-05 12:16:24 +0100
---
 xen/arch/x86/spec_ctrl.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index f7b0251c42..ac73806eac 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -1279,8 +1279,24 @@ void __init init_speculation_mitigations(void)
      * mappings.
      */
     if ( opt_rsb_hvm )
+    {
         setup_force_cpu_cap(X86_FEATURE_SC_RSB_HVM);
 
+        /*
+         * For SVM, Xen's RSB safety actions are performed before STGI, so
+         * behave atomically with respect to IST sources.
+         *
+         * For VT-x, NMIs are atomic with VMExit (the NMI gets queued but not
+         * delivered) whereas other IST sources are not atomic.  Specifically,
+         * #MC can hit ahead the RSB safety action in the vmexit path.
+         *
+         * Therefore, it is necessary for the IST logic to protect Xen against
+         * possible rogue RSB speculation.
+         */
+        if ( !cpu_has_svm )
+            default_spec_ctrl_flags |= SCF_ist_rsb;
+    }
+
     ibpb_calculations();
 
     /* Check whether Eager FPU should be enabled by default. */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Aug 16 06:44:14 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 16 Aug 2022 06:44:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387986.624486 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNqJC-0007SK-53; Tue, 16 Aug 2022 06:44:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387986.624486; Tue, 16 Aug 2022 06: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 1oNqJC-0007SC-1K; Tue, 16 Aug 2022 06:44:14 +0000
Received: by outflank-mailman (input) for mailman id 387986;
 Tue, 16 Aug 2022 06:44:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNqJA-0007Rq-8n
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 06:44:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNqJA-0007Ip-7v
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 06:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNqJA-0000cc-7C
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 06:44:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=px/wmZoBl3Ft6R2e645LauhugF0RvF3x74TY0BN6t0g=; b=EgWSGfbNQkMxnZbBs1F6iDB7eC
	Y1kQxtgupdYlMC3JzzGTbLb2fRMCxpTjf5miBG24WQ0FpTe+y7ekUiOiy/a6c4c7U4w8Sv6gJ0XJI
	vS/+g42RLBFYEyknI/PhmfmTpRuGYg2jzB3X7Zbaznyv8Tg5Phg/utEv+MFsUPCNBI1M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] x86: Expose more MSR_ARCH_CAPS to hwdom
Message-Id: <E1oNqJA-0000cc-7C@xenbits.xenproject.org>
Date: Tue, 16 Aug 2022 06:44:12 +0000

commit 5efcae1eb30ff24e100954e00889a568c1745ea1
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Mon Aug 15 15:40:47 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 15:40:47 2022 +0200

    x86: Expose more MSR_ARCH_CAPS to hwdom
    
    commit e46474278a0e ("x86/intel: Expose MSR_ARCH_CAPS to dom0") started
    exposing MSR_ARCH_CAPS to dom0.  More bits in MSR_ARCH_CAPS have since
    been defined, but they haven't been exposed.  Update the list to allow
    them through.
    
    As one example, this allows a Linux Dom0 to know that it has the
    appropriate microcode via FB_CLEAR.  Notably, and with the updated
    microcode, this changes dom0's
    /sys/devices/system/cpu/vulnerabilities/mmio_stale_data changes from:
    
      "Vulnerable: Clear CPU buffers attempted, no microcode; SMT Host state unknown"
    
    to:
    
      "Mitigation: Clear CPU buffers; SMT Host state unknown"
    
    This exposes the MMIO Stale Data and Intel Branch History Injection
    (BHI) controls as well as the page size change MCE issue bit.
    
    Fixes: commit 2ebe8fe9b7e0 ("x86/spec-ctrl: Enumeration for MMIO Stale Data controls")
    Fixes: commit cea9ae062295 ("x86/spec-ctrl: Enumeration for new Intel BHI controls")
    Fixes: commit 59e89cdabc71 ("x86/vtx: Disable executable EPT superpages to work around CVE-2018-12207")
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: e83cd54611fec5b7a539fa1281a14319143490e6
    master date: 2022-08-09 16:35:25 +0100
---
 xen/arch/x86/msr.c              | 5 ++++-
 xen/include/asm-x86/msr-index.h | 2 ++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 0739d00e74..aa9face9aa 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -145,7 +145,10 @@ int init_domain_msr_policy(struct domain *d)
 
         mp->arch_caps.raw = val &
             (ARCH_CAPS_RDCL_NO | ARCH_CAPS_IBRS_ALL | ARCH_CAPS_RSBA |
-             ARCH_CAPS_SSB_NO | ARCH_CAPS_MDS_NO | ARCH_CAPS_TAA_NO);
+             ARCH_CAPS_SSB_NO | ARCH_CAPS_MDS_NO | ARCH_CAPS_IF_PSCHANGE_MC_NO |
+             ARCH_CAPS_TAA_NO | ARCH_CAPS_SBDR_SSDP_NO | ARCH_CAPS_FBSDP_NO |
+             ARCH_CAPS_PSDP_NO | ARCH_CAPS_FB_CLEAR | ARCH_CAPS_RRSBA |
+             ARCH_CAPS_BHI_NO);
     }
 
     d->arch.msr = mp;
diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h
index f1b2cf5460..49ca1f1845 100644
--- a/xen/include/asm-x86/msr-index.h
+++ b/xen/include/asm-x86/msr-index.h
@@ -64,6 +64,8 @@
 #define  ARCH_CAPS_PSDP_NO                  (_AC(1, ULL) << 15)
 #define  ARCH_CAPS_FB_CLEAR                 (_AC(1, ULL) << 17)
 #define  ARCH_CAPS_FB_CLEAR_CTRL            (_AC(1, ULL) << 18)
+#define  ARCH_CAPS_RRSBA                    (_AC(1, ULL) << 19)
+#define  ARCH_CAPS_BHI_NO                   (_AC(1, ULL) << 20)
 
 #define MSR_FLUSH_CMD                       0x0000010b
 #define  FLUSH_CMD_L1D                      (_AC(1, ULL) <<  0)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Aug 16 06:44:23 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 16 Aug 2022 06:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387989.624490 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNqJL-0007aE-7q; Tue, 16 Aug 2022 06:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387989.624490; Tue, 16 Aug 2022 06:44:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNqJL-0007a6-4s; Tue, 16 Aug 2022 06:44:23 +0000
Received: by outflank-mailman (input) for mailman id 387989;
 Tue, 16 Aug 2022 06:44:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNqJK-0007Zb-DH
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 06:44:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNqJK-0007Ju-CV
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 06:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNqJK-0000el-AD
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 06:44:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=IWGmaJslRQlPdHP2uEU6pttyd6+2agRlCh4ZXeF1exo=; b=o4G824jQQshL2kVfKE2otVQhSS
	DHNjDE/T4qAY0ZQMa8AbkD1Z/kIoawJpohoa3SpNmXSXECy889U1bfWBXl1dEDrEvIXo+iBTJn5Dy
	f8DtDXyOb+g+svRKWqg2DwE/ovPgqJeYDpD2Z/7oqP/D99i6O0UJAQJnlUBJIlpC3twg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] xen/sched: setup dom0 vCPUs affinity only once
Message-Id: <E1oNqJK-0000el-AD@xenbits.xenproject.org>
Date: Tue, 16 Aug 2022 06:44:22 +0000

commit 1e31848cdd8d2ff3cb76f364f04f9771f9b3a8b1
Author:     Dario Faggioli <dfaggioli@suse.com>
AuthorDate: Mon Aug 15 15:41:25 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 15:41:25 2022 +0200

    xen/sched: setup dom0 vCPUs affinity only once
    
    Right now, affinity for dom0 vCPUs is setup in two steps. This is a
    problem as, at least in Credit2, unit_insert() sees and uses the
    "intermediate" affinity, and place the vCPUs on CPUs where they cannot
    be run. And this in turn results in boot hangs, if the "dom0_nodes"
    parameter is used.
    
    Fix this by setting up the affinity properly once and for all, in
    sched_init_vcpu() called by create_vcpu().
    
    Note that, unless a soft-affinity is explicitly specified for dom0 (by
    using the relaxed mode of "dom0_nodes") we set it to the default, which
    is all CPUs, instead of computing it basing on hard affinity (if any).
    This is because hard and soft affinity should be considered as
    independent user controlled properties. In fact, if we dor derive dom0's
    soft-affinity from its boot-time hard-affinity, such computed value will
    continue to be used even if later the user changes the hard-affinity.
    And this could result in the vCPUs behaving differently than what the
    user wanted and expects.
    
    Fixes: dafd936dddbd ("Make credit2 the default scheduler")
    Reported-by: Olaf Hering <ohering@suse.de>
    Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: c79e4d209be3ed2a6b8e97c35944786ed2a66b94
    master date: 2022-08-11 11:46:22 +0200
---
 xen/common/sched/core.c | 63 ++++++++++++++++++++++++++++++-------------------
 1 file changed, 39 insertions(+), 24 deletions(-)

diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c
index 8f4b1ca10d..f07bd2681f 100644
--- a/xen/common/sched/core.c
+++ b/xen/common/sched/core.c
@@ -571,12 +571,46 @@ int sched_init_vcpu(struct vcpu *v)
         return 1;
     }
 
-    /*
-     * Initialize affinity settings. The idler, and potentially
-     * domain-0 VCPUs, are pinned onto their respective physical CPUs.
-     */
-    if ( is_idle_domain(d) || (is_hardware_domain(d) && opt_dom0_vcpus_pin) )
+    if ( is_idle_domain(d) )
+    {
+        /* Idle vCPUs are always pinned onto their respective pCPUs */
+        sched_set_affinity(unit, cpumask_of(processor), &cpumask_all);
+    }
+    else if ( pv_shim && v->vcpu_id == 0 )
+    {
+        /*
+         * PV-shim: vcpus are pinned 1:1. Initially only 1 cpu is online,
+         * others will be dealt with when onlining them. This avoids pinning
+         * a vcpu to a not yet online cpu here.
+         */
+        sched_set_affinity(unit, cpumask_of(0), cpumask_of(0));
+    }
+    else if ( is_hardware_domain(d) && opt_dom0_vcpus_pin )
+    {
+        /*
+         * If dom0_vcpus_pin is specified, dom0 vCPUs are pinned 1:1 to
+         * their respective pCPUs too.
+         */
         sched_set_affinity(unit, cpumask_of(processor), &cpumask_all);
+    }
+#ifdef CONFIG_X86
+    else if ( d->domain_id == 0 )
+    {
+        /*
+         * In absence of dom0_vcpus_pin instead, the hard and soft affinity of
+         * dom0 is controlled by the (x86 only) dom0_nodes parameter. At this
+         * point it has been parsed and decoded into the dom0_cpus mask.
+         *
+         * Note that we always honor what user explicitly requested, for both
+         * hard and soft affinity, without doing any dynamic computation of
+         * either of them.
+         */
+        if ( !dom0_affinity_relaxed )
+            sched_set_affinity(unit, &dom0_cpus, &cpumask_all);
+        else
+            sched_set_affinity(unit, &cpumask_all, &dom0_cpus);
+    }
+#endif
     else
         sched_set_affinity(unit, &cpumask_all, &cpumask_all);
 
@@ -3386,29 +3420,10 @@ void wait(void)
 void __init sched_setup_dom0_vcpus(struct domain *d)
 {
     unsigned int i;
-    struct sched_unit *unit;
 
     for ( i = 1; i < d->max_vcpus; i++ )
         vcpu_create(d, i);
 
-    /*
-     * PV-shim: vcpus are pinned 1:1.
-     * Initially only 1 cpu is online, others will be dealt with when
-     * onlining them. This avoids pinning a vcpu to a not yet online cpu here.
-     */
-    if ( pv_shim )
-        sched_set_affinity(d->vcpu[0]->sched_unit,
-                           cpumask_of(0), cpumask_of(0));
-    else
-    {
-        for_each_sched_unit ( d, unit )
-        {
-            if ( !opt_dom0_vcpus_pin && !dom0_affinity_relaxed )
-                sched_set_affinity(unit, &dom0_cpus, NULL);
-            sched_set_affinity(unit, NULL, &dom0_cpus);
-        }
-    }
-
     domain_update_node_affinity(d);
 }
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Aug 16 06:44:33 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 16 Aug 2022 06:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387991.624493 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNqJV-0007dN-90; Tue, 16 Aug 2022 06:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387991.624493; Tue, 16 Aug 2022 06:44:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNqJV-0007dF-6H; Tue, 16 Aug 2022 06:44:33 +0000
Received: by outflank-mailman (input) for mailman id 387991;
 Tue, 16 Aug 2022 06:44:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNqJU-0007cx-GS
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 06:44:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNqJU-0007K7-Fg
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 06:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNqJU-0000fB-Eh
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 06:44:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=pvy03tJxWF4ytVffxyYD3Ulp2KqArbNDadV5faQSQgc=; b=1y6Q/MCZllD/nQ9hL5v3TldjMN
	djQiJeZ8dpasrWbM5JuwaY69AM5QPZPRk0P6v5jqyVoRn3h+rvUqJD8Y7jyOoXnn0uO4oI8tVnO/0
	ORETSf9dIHw2vBj/rKHq4iN3pFm0T7uSDmuiSTx0avAyOotbFZzf2Lu+582JeL/gHXdU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] tools/libxl: Replace deprecated -sdl option on QEMU command line
Message-Id: <E1oNqJU-0000fB-Eh@xenbits.xenproject.org>
Date: Tue, 16 Aug 2022 06:44:32 +0000

commit c373ad3d084614a93c55e25dc20e70ffc7574971
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Mon Aug 15 15:42:09 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 15:42:09 2022 +0200

    tools/libxl: Replace deprecated -sdl option on QEMU command line
    
    "-sdl" is deprecated upstream since 6695e4c0fd9e ("softmmu/vl:
    Deprecate the -sdl and -curses option"), QEMU v6.2, and the option is
    removed by 707d93d4abc6 ("ui: Remove deprecated options "-sdl" and
    "-curses""), in upcoming QEMU v7.1.
    
    Instead, use "-display sdl", available since 1472a95bab1e ("Introduce
    -display argument"), before QEMU v1.0.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Jason Andryuk <jandryuk@gmail.com>
    master commit: 41fcb3af8ad6d4c9f65a9d72798e6d18afec55ac
    master date: 2022-08-11 11:47:11 +0200
---
 tools/libs/light/libxl_dm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libs/light/libxl_dm.c b/tools/libs/light/libxl_dm.c
index 24f6e73b0a..ae5f35e0c3 100644
--- a/tools/libs/light/libxl_dm.c
+++ b/tools/libs/light/libxl_dm.c
@@ -1349,7 +1349,7 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
     flexarray_append_pair(dm_args, "-display", "none");
 
     if (sdl && !is_stubdom) {
-        flexarray_append(dm_args, "-sdl");
+        flexarray_append_pair(dm_args, "-display", "sdl");
         if (sdl->display)
             flexarray_append_pair(dm_envs, "DISPLAY", sdl->display);
         if (sdl->xauthority)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Aug 16 06:44:43 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 16 Aug 2022 06:44:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387992.624496 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNqJf-0007gH-AF; Tue, 16 Aug 2022 06:44:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387992.624496; Tue, 16 Aug 2022 06:44:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNqJf-0007gA-7q; Tue, 16 Aug 2022 06:44:43 +0000
Received: by outflank-mailman (input) for mailman id 387992;
 Tue, 16 Aug 2022 06:44:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNqJe-0007g2-Jf
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 06:44:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNqJe-0007KK-Is
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 06:44:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNqJe-0000ft-Hy
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 06:44:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=uaGHFk1HZcruKXxwJN/Hivp4wHgQGOel5dNQFqz3JeQ=; b=KYAqe9zRWwWv3B2vWF2FBmFjaN
	J/Dl9Nv+EVcOzmbiuSWqWLa9XDbLFc76ByTrjphRmu1RTxepwjBDEj9fUAA496v9dzCL6ZwTwCj3z
	ohtjBDy3GMScntmeH9RdKzfTwX2X5g/7JPLr6Bmrge5EmK19AIo/Mh5bV474khM2cQdg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] x86/spec-ctrl: Enumeration for PBRSB_NO
Message-Id: <E1oNqJe-0000ft-Hy@xenbits.xenproject.org>
Date: Tue, 16 Aug 2022 06:44:42 +0000

commit fba0c22e79922085c46527eb1391123aadfb24d1
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Aug 15 15:42:31 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 15:42:31 2022 +0200

    x86/spec-ctrl: Enumeration for PBRSB_NO
    
    The PBRSB_NO bit indicates that the CPU is not vulnerable to the Post-Barrier
    RSB speculative vulnerability.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b874e47eb13feb75be3ee7b5dc4ae9c97d80d774
    master date: 2022-08-11 16:19:50 +0100
---
 xen/arch/x86/msr.c              | 2 +-
 xen/arch/x86/spec_ctrl.c        | 3 ++-
 xen/include/asm-x86/msr-index.h | 1 +
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index aa9face9aa..9bced8d36c 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -148,7 +148,7 @@ int init_domain_msr_policy(struct domain *d)
              ARCH_CAPS_SSB_NO | ARCH_CAPS_MDS_NO | ARCH_CAPS_IF_PSCHANGE_MC_NO |
              ARCH_CAPS_TAA_NO | ARCH_CAPS_SBDR_SSDP_NO | ARCH_CAPS_FBSDP_NO |
              ARCH_CAPS_PSDP_NO | ARCH_CAPS_FB_CLEAR | ARCH_CAPS_RRSBA |
-             ARCH_CAPS_BHI_NO);
+             ARCH_CAPS_BHI_NO | ARCH_CAPS_PBRSB_NO);
     }
 
     d->arch.msr = mp;
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index ac73806eac..3ff602bd02 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -419,7 +419,7 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
      * Hardware read-only information, stating immunity to certain issues, or
      * suggestions of which mitigation to use.
      */
-    printk("  Hardware hints:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
+    printk("  Hardware hints:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
            (caps & ARCH_CAPS_RDCL_NO)                        ? " RDCL_NO"        : "",
            (caps & ARCH_CAPS_IBRS_ALL)                       ? " IBRS_ALL"       : "",
            (caps & ARCH_CAPS_RSBA)                           ? " RSBA"           : "",
@@ -431,6 +431,7 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
            (caps & ARCH_CAPS_SBDR_SSDP_NO)                   ? " SBDR_SSDP_NO"   : "",
            (caps & ARCH_CAPS_FBSDP_NO)                       ? " FBSDP_NO"       : "",
            (caps & ARCH_CAPS_PSDP_NO)                        ? " PSDP_NO"        : "",
+           (caps & ARCH_CAPS_PBRSB_NO)                       ? " PBRSB_NO"       : "",
            (e8b  & cpufeat_mask(X86_FEATURE_IBRS_ALWAYS))    ? " IBRS_ALWAYS"    : "",
            (e8b  & cpufeat_mask(X86_FEATURE_STIBP_ALWAYS))   ? " STIBP_ALWAYS"   : "",
            (e8b  & cpufeat_mask(X86_FEATURE_IBRS_FAST))      ? " IBRS_FAST"      : "",
diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h
index 49ca1f1845..5a830f76a8 100644
--- a/xen/include/asm-x86/msr-index.h
+++ b/xen/include/asm-x86/msr-index.h
@@ -66,6 +66,7 @@
 #define  ARCH_CAPS_FB_CLEAR_CTRL            (_AC(1, ULL) << 18)
 #define  ARCH_CAPS_RRSBA                    (_AC(1, ULL) << 19)
 #define  ARCH_CAPS_BHI_NO                   (_AC(1, ULL) << 20)
+#define  ARCH_CAPS_PBRSB_NO                 (_AC(1, ULL) << 24)
 
 #define MSR_FLUSH_CMD                       0x0000010b
 #define  FLUSH_CMD_L1D                      (_AC(1, ULL) <<  0)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Aug 16 06:44:53 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 16 Aug 2022 06:44:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387993.624501 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNqJp-0007jG-C4; Tue, 16 Aug 2022 06:44:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387993.624501; Tue, 16 Aug 2022 06:44:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNqJp-0007j8-9K; Tue, 16 Aug 2022 06:44:53 +0000
Received: by outflank-mailman (input) for mailman id 387993;
 Tue, 16 Aug 2022 06:44:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNqJo-0007iz-MZ
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 06:44:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNqJo-0007Kj-Ll
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 06:44:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNqJo-0000gM-L3
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 06:44:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=F3TRpJGktCTHHWEIzM+FCdXOw+kpe+712xc7klPRNs8=; b=3I4c8M5xPLtENOp5MyYpAW2lhg
	VM5biZz+/FzSrGN04INQ3SUV6Q5lHbxlqUGkyeXpM6OhqiMOZOdbz+lqvU8RuTgsLOiMOPNdcyqZq
	1acXb2Tf030v/gkwVu+zSdpDVyJz528Ux3uCWvY3kLJYCE5bttRMiWz/LcD3QyLefn/k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] x86/amd: only call setup_force_cpu_cap for boot CPU
Message-Id: <E1oNqJo-0000gM-L3@xenbits.xenproject.org>
Date: Tue, 16 Aug 2022 06:44:52 +0000

commit 104a54a307b08945365faf6d285cd5a02f94a80f
Author:     Ross Lagerwall <ross.lagerwall@citrix.com>
AuthorDate: Mon Aug 15 15:43:08 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 15:43:08 2022 +0200

    x86/amd: only call setup_force_cpu_cap for boot CPU
    
    This should only be called for the boot CPU to avoid calling _init code
    after it has been unloaded.
    
    Fixes: 062868a5a8b4 ("x86/amd: Work around CLFLUSH ordering on older parts")
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 31b41ce858c8bd5159212d40969f8e0b7124bbf0
    master date: 2022-08-11 17:44:26 +0200
---
 xen/arch/x86/cpu/amd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/cpu/amd.c b/xen/arch/x86/cpu/amd.c
index 60dbe61a61..a8d2fb8a15 100644
--- a/xen/arch/x86/cpu/amd.c
+++ b/xen/arch/x86/cpu/amd.c
@@ -820,7 +820,7 @@ static void init_amd(struct cpuinfo_x86 *c)
 	 * everything, including reads and writes to address, and
 	 * LFENCE/SFENCE instructions.
 	 */
-	if (!cpu_has_clflushopt)
+	if (c == &boot_cpu_data && !cpu_has_clflushopt)
 		setup_force_cpu_cap(X86_BUG_CLFLUSH_MFENCE);
 
 	switch(c->x86)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Aug 16 06:45:03 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 16 Aug 2022 06:45:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387994.624505 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNqJz-0007m6-Dk; Tue, 16 Aug 2022 06:45:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387994.624505; Tue, 16 Aug 2022 06:45: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 1oNqJz-0007ly-Ax; Tue, 16 Aug 2022 06:45:03 +0000
Received: by outflank-mailman (input) for mailman id 387994;
 Tue, 16 Aug 2022 06:45:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNqJy-0007lo-PK
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 06:45:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNqJy-0007Mo-OZ
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 06:45:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNqJy-0000qk-Nt
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 06:45:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hypufD/wL6sETpNcsDTJWtAeQmlSY9CFMPEowg1pvPg=; b=t+4dHlGlVgS1oxyz4kF4Uvvx0b
	E//5it+KIrd7RbeWbE810sq8E62kfhfO4azZrJ7G3QQ/sOqDsaM9dcNsnhXUcVgGD/W2jepBSuii0
	TNog65LrIMADum9IZmMW5EBKDbbmcmqso1ARointWV1VgBmReBDVUm9n5kgGrNdszFls=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] build/x86: suppress GNU ld 2.39 warning about RWX load segments
Message-Id: <E1oNqJy-0000qk-Nt@xenbits.xenproject.org>
Date: Tue, 16 Aug 2022 06:45:02 +0000

commit a075900cf768fe45f270b6f1d09c4e99281da142
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Aug 15 15:43:56 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 15:43:56 2022 +0200

    build/x86: suppress GNU ld 2.39 warning about RWX load segments
    
    Commit 68f5aac012b9 ("build: suppress future GNU ld warning about RWX
    load segments") didn't quite cover all the cases: Apparently I missed
    ones in the building of 32-bit helper objects because of only looking at
    incremental builds (where those wouldn't normally be re-built). Clone
    the workaround there to the specific Makefile in question.
    
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 3eb1865ae305772b558757904d81951e31de43de
    master date: 2022-08-11 17:45:12 +0200
---
 xen/arch/x86/boot/build32.mk | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xen/arch/x86/boot/build32.mk b/xen/arch/x86/boot/build32.mk
index e90680cd9f..d2fae5cf9e 100644
--- a/xen/arch/x86/boot/build32.mk
+++ b/xen/arch/x86/boot/build32.mk
@@ -8,6 +8,9 @@ CFLAGS += -Werror -fno-builtin -g0 -msoft-float
 CFLAGS += -I$(BASEDIR)/include
 CFLAGS := $(filter-out -flto,$(CFLAGS)) 
 
+LDFLAGS_DIRECT-$(shell $(LD) -v --warn-rwx-segments >/dev/null 2>&1 && echo y) := --no-warn-rwx-segments
+LDFLAGS_DIRECT += $(LDFLAGS_DIRECT-y)
+
 # NB. awk invocation is a portable alternative to 'head -n -1'
 %.S: %.bin
 	(od -v -t x $< | tr -s ' ' | awk 'NR > 1 {print s} {s=$$0}' | \
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Aug 16 06:45:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 16 Aug 2022 06:45:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.387995.624509 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNqK9-0007ot-FC; Tue, 16 Aug 2022 06:45:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 387995.624509; Tue, 16 Aug 2022 06:45: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 1oNqK9-0007ol-CU; Tue, 16 Aug 2022 06:45:13 +0000
Received: by outflank-mailman (input) for mailman id 387995;
 Tue, 16 Aug 2022 06:45:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNqK8-0007ob-SY
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 06:45:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNqK8-0007N3-Ro
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 06:45:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNqK8-0000rE-Qs
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 06:45:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=51B0jXVjanLTX7ViHZtN+c5uRF7eQ+oY9zHXNfEzf0Q=; b=WhbyjUEv5tgNzjXmooN3oe9Ai4
	fHefRZWMl4PIuQVeVJYEBqpc7smQHTyC7Skl3TNcd0/JmAcMXkZaXtZIMwdTujlohqnxBI9wlqlwN
	i9QquXtsxnCwj27FmQn/qSD7A2S+ZYh/xg8KDJ1AwudOLWVGCyLZB4q/TqKO2KBUxTW8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] PCI: simplify (and thus correct) pci_get_pdev{,_by_domain}()
Message-Id: <E1oNqK8-0000rE-Qs@xenbits.xenproject.org>
Date: Tue, 16 Aug 2022 06:45:12 +0000

commit 9acedc3c58c31930737edbe212f2ccf437a0b757
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Aug 15 15:44:23 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 15:44:23 2022 +0200

    PCI: simplify (and thus correct) pci_get_pdev{,_by_domain}()
    
    The last "wildcard" use of either function went away with f591755823a7
    ("IOMMU/PCI: don't let domain cleanup continue when device de-assignment
    failed"). Don't allow them to be called this way anymore. Besides
    simplifying the code this also fixes two bugs:
    
    1) When seg != -1, the outer loops should have been terminated after the
       first iteration, or else a device with the same BDF but on another
       segment could be found / returned.
    
    Reported-by: Rahul Singh <rahul.singh@arm.com>
    
    2) When seg == -1 calling get_pseg() is bogus. The function (taking a
       u16) would look for segment 0xffff, which might exist. If it exists,
       we might then find / return a wrong device.
    
    In pci_get_pdev_by_domain() also switch from using the per-segment list
    to using the per-domain one, with the exception of the hardware domain
    (see the code comment there).
    
    While there also constify "pseg" and drop "pdev"'s already previously
    unnecessary initializer.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Rahul Singh <rahul.singh@arm.com>
    Tested-by: Rahul Singh <rahul.singh@arm.com>
    master commit: 8cf6e0738906fc269af40135ed82a07815dd3b9c
    master date: 2022-08-12 08:34:33 +0200
---
 xen/drivers/passthrough/pci.c | 61 ++++++++++++++++++-------------------------
 xen/include/xen/pci.h         |  6 ++---
 2 files changed, 29 insertions(+), 38 deletions(-)

diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index bbacbe41da..9b81b941c8 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -528,30 +528,19 @@ int __init pci_ro_device(int seg, int bus, int devfn)
     return 0;
 }
 
-struct pci_dev *pci_get_pdev(int seg, int bus, int devfn)
+struct pci_dev *pci_get_pdev(uint16_t seg, uint8_t bus, uint8_t devfn)
 {
-    struct pci_seg *pseg = get_pseg(seg);
-    struct pci_dev *pdev = NULL;
+    const struct pci_seg *pseg = get_pseg(seg);
+    struct pci_dev *pdev;
 
     ASSERT(pcidevs_locked());
-    ASSERT(seg != -1 || bus == -1);
-    ASSERT(bus != -1 || devfn == -1);
 
     if ( !pseg )
-    {
-        if ( seg == -1 )
-            radix_tree_gang_lookup(&pci_segments, (void **)&pseg, 0, 1);
-        if ( !pseg )
-            return NULL;
-    }
+        return NULL;
 
-    do {
-        list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
-            if ( (pdev->bus == bus || bus == -1) &&
-                 (pdev->devfn == devfn || devfn == -1) )
-                return pdev;
-    } while ( radix_tree_gang_lookup(&pci_segments, (void **)&pseg,
-                                     pseg->nr + 1, 1) );
+    list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
+        if ( pdev->bus == bus && pdev->devfn == devfn )
+            return pdev;
 
     return NULL;
 }
@@ -577,31 +566,33 @@ struct pci_dev *pci_get_real_pdev(int seg, int bus, int devfn)
     return pdev;
 }
 
-struct pci_dev *pci_get_pdev_by_domain(const struct domain *d, int seg,
-                                       int bus, int devfn)
+struct pci_dev *pci_get_pdev_by_domain(const struct domain *d, uint16_t seg,
+                                       uint8_t bus, uint8_t devfn)
 {
-    struct pci_seg *pseg = get_pseg(seg);
-    struct pci_dev *pdev = NULL;
-
-    ASSERT(seg != -1 || bus == -1);
-    ASSERT(bus != -1 || devfn == -1);
+    struct pci_dev *pdev;
 
-    if ( !pseg )
+    /*
+     * The hardware domain owns the majority of the devices in the system.
+     * When there are multiple segments, traversing the per-segment list is
+     * likely going to be faster, whereas for a single segment the difference
+     * shouldn't be that large.
+     */
+    if ( is_hardware_domain(d) )
     {
-        if ( seg == -1 )
-            radix_tree_gang_lookup(&pci_segments, (void **)&pseg, 0, 1);
+        const struct pci_seg *pseg = get_pseg(seg);
+
         if ( !pseg )
             return NULL;
-    }
 
-    do {
         list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
-            if ( (pdev->bus == bus || bus == -1) &&
-                 (pdev->devfn == devfn || devfn == -1) &&
-                 (pdev->domain == d) )
+            if ( pdev->bus == bus && pdev->devfn == devfn &&
+                 pdev->domain == d )
+                return pdev;
+    }
+    else
+        list_for_each_entry ( pdev, &d->pdev_list, domain_list )
+            if ( pdev->bus == bus && pdev->devfn == devfn )
                 return pdev;
-    } while ( radix_tree_gang_lookup(&pci_segments, (void **)&pseg,
-                                     pseg->nr + 1, 1) );
 
     return NULL;
 }
diff --git a/xen/include/xen/pci.h b/xen/include/xen/pci.h
index 8e3d4d9454..cd238ae852 100644
--- a/xen/include/xen/pci.h
+++ b/xen/include/xen/pci.h
@@ -166,10 +166,10 @@ int pci_add_device(u16 seg, u8 bus, u8 devfn,
 int pci_remove_device(u16 seg, u8 bus, u8 devfn);
 int pci_ro_device(int seg, int bus, int devfn);
 int pci_hide_device(unsigned int seg, unsigned int bus, unsigned int devfn);
-struct pci_dev *pci_get_pdev(int seg, int bus, int devfn);
+struct pci_dev *pci_get_pdev(uint16_t seg, uint8_t bus, uint8_t devfn);
 struct pci_dev *pci_get_real_pdev(int seg, int bus, int devfn);
-struct pci_dev *pci_get_pdev_by_domain(const struct domain *, int seg,
-                                       int bus, int devfn);
+struct pci_dev *pci_get_pdev_by_domain(const struct domain *, uint16_t seg,
+                                       uint8_t bus, uint8_t devfn);
 void pci_check_disable_device(u16 seg, u8 bus, u8 devfn);
 
 uint8_t pci_conf_read8(pci_sbdf_t sbdf, unsigned int reg);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Aug 16 07:55:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 16 Aug 2022 07:55:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.388065.624601 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNrPj-0002Fk-LQ; Tue, 16 Aug 2022 07:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 388065.624601; Tue, 16 Aug 2022 07:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNrPj-0002Fd-Ii; Tue, 16 Aug 2022 07:55:03 +0000
Received: by outflank-mailman (input) for mailman id 388065;
 Tue, 16 Aug 2022 07:55:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNrPh-0002FX-KB
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 07:55:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNrPh-0000Da-JF
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 07:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNrPh-0005t8-He
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 07:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=AMmQ7rQ3eqjk20njHEo6pFXo4+JfBDjyYptxmJ+fpHs=; b=SQhfrVoolOwb699lqCkdw1GbOE
	kxVETJGeX7JoxDTOuahx+10+mRQgtdX3ilr43FNTvSY+nWKNRE6TDeHG5MLOMH+sU4DzFWoHwUFy8
	WrpJ48mXq8rkerTFzAajRUGh2xrk+MxgUqSKqV9KIBVWM8i3gMFpCRhCQvEK0ANx7Gs4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.13] x86/amd: only call setup_force_cpu_cap for boot CPU
Message-Id: <E1oNrPh-0005t8-He@xenbits.xenproject.org>
Date: Tue, 16 Aug 2022 07:55:01 +0000

commit bde3b13043e31fd757c44bcec182b0ff1fe36d22
Author:     Ross Lagerwall <ross.lagerwall@citrix.com>
AuthorDate: Mon Aug 15 16:13:54 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 16:13:54 2022 +0200

    x86/amd: only call setup_force_cpu_cap for boot CPU
    
    This should only be called for the boot CPU to avoid calling _init code
    after it has been unloaded.
    
    Fixes: 062868a5a8b4 ("x86/amd: Work around CLFLUSH ordering on older parts")
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 31b41ce858c8bd5159212d40969f8e0b7124bbf0
    master date: 2022-08-11 17:44:26 +0200
---
 xen/arch/x86/cpu/amd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/cpu/amd.c b/xen/arch/x86/cpu/amd.c
index e9530d581b..959790575a 100644
--- a/xen/arch/x86/cpu/amd.c
+++ b/xen/arch/x86/cpu/amd.c
@@ -705,7 +705,7 @@ static void init_amd(struct cpuinfo_x86 *c)
 	 * everything, including reads and writes to address, and
 	 * LFENCE/SFENCE instructions.
 	 */
-	if (!cpu_has_clflushopt)
+	if (c == &boot_cpu_data && !cpu_has_clflushopt)
 		setup_force_cpu_cap(X86_BUG_CLFLUSH_MFENCE);
 
 	switch(c->x86)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Aug 16 08:44:06 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 16 Aug 2022 08:44:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.388089.624626 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNsB9-00004z-Tr; Tue, 16 Aug 2022 08:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 388089.624626; Tue, 16 Aug 2022 08:44:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNsB9-00004s-R1; Tue, 16 Aug 2022 08:44:03 +0000
Received: by outflank-mailman (input) for mailman id 388089;
 Tue, 16 Aug 2022 08:44:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNsB8-0008WQ-3i
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 08:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNsB8-0001b4-2y
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 08:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNsB8-0008Mh-27
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 08:44:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5v9cCF7UiEE1GrgYLVWrlIAlGZq7boz3N4pxShjOJaQ=; b=MkWTgfXpylWbAvyKwS4jFClOCu
	hXYOuXs8CVMDmTszhJRFxTRGMv+gXEYQgQCxBVf1Thj42VAu6vehRkEj2b4jV69Wf1tdHQrCupVbN
	9MpthXCt2RDCTPtAysAfsxbgqyx1CoWKubgnsND1bLcTuUWVkco8UpGKkTnOeiV1qI1Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86/spec-ctrl: Use IST RSB protection for !SVM systems
Message-Id: <E1oNsB8-0008Mh-27@xenbits.xenproject.org>
Date: Tue, 16 Aug 2022 08:44:02 +0000

commit 4e351880f68e50fe1479c36a30e0e4e03d160c34
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Aug 15 15:31:49 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 15:31:49 2022 +0200

    x86/spec-ctrl: Use IST RSB protection for !SVM systems
    
    There is a corner case where a VT-x guest which manages to reliably trigger
    non-fatal #MC's could evade the rogue RSB speculation protections that were
    supposed to be in place.
    
    This is a lack of defence in depth; Xen does not architecturally execute more
    RET than CALL instructions, so an attacker would have to locate a different
    gadget (e.g. SpectreRSB) first to execute a transient path of excess RET
    instructions.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: e570e8d520ab542d8d35666b95cb3a0125b7b110
    master date: 2022-08-05 12:16:24 +0100
---
 xen/arch/x86/spec_ctrl.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index 864233f4cf..50660f3e23 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -1326,8 +1326,24 @@ void __init init_speculation_mitigations(void)
      * mappings.
      */
     if ( opt_rsb_hvm )
+    {
         setup_force_cpu_cap(X86_FEATURE_SC_RSB_HVM);
 
+        /*
+         * For SVM, Xen's RSB safety actions are performed before STGI, so
+         * behave atomically with respect to IST sources.
+         *
+         * For VT-x, NMIs are atomic with VMExit (the NMI gets queued but not
+         * delivered) whereas other IST sources are not atomic.  Specifically,
+         * #MC can hit ahead the RSB safety action in the vmexit path.
+         *
+         * Therefore, it is necessary for the IST logic to protect Xen against
+         * possible rogue RSB speculation.
+         */
+        if ( !cpu_has_svm )
+            default_spec_ctrl_flags |= SCF_ist_rsb;
+    }
+
     ibpb_calculations();
 
     /* Check whether Eager FPU should be enabled by default. */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Aug 16 08:44:14 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 16 Aug 2022 08:44:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.388090.624631 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNsBJ-00007c-VP; Tue, 16 Aug 2022 08:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 388090.624631; Tue, 16 Aug 2022 08:44:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNsBJ-00007V-Sc; Tue, 16 Aug 2022 08:44:13 +0000
Received: by outflank-mailman (input) for mailman id 388090;
 Tue, 16 Aug 2022 08:44:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNsBI-00007G-6t
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 08:44:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNsBI-0001bH-68
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 08:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNsBI-0008NB-59
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 08:44:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=2laz7CpQBnYicbDng8TBwURqoaI+AOubra8v2uQgXGI=; b=iIetBMjCSjahwEF/DJLSi7COas
	MxOY///8E9WcrKgbvFwzcVBwFQcIcqGLEP+gQha/Rsyc2AcI+vGvd3mF9nSjvcLLkl29rJtYJk7AN
	CL44LNJwsNh8iKXZC3MKj4Eh+XOjQGlTD/rBqG8HU5YPPHDvNz2sHvOPsZhX6Z4wyZe0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86: Expose more MSR_ARCH_CAPS to hwdom
Message-Id: <E1oNsBI-0008NB-59@xenbits.xenproject.org>
Date: Tue, 16 Aug 2022 08:44:12 +0000

commit 2a362668cb4ad9a0784c4592968f881d7746ec0f
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Mon Aug 15 15:32:31 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 15:32:31 2022 +0200

    x86: Expose more MSR_ARCH_CAPS to hwdom
    
    commit e46474278a0e ("x86/intel: Expose MSR_ARCH_CAPS to dom0") started
    exposing MSR_ARCH_CAPS to dom0.  More bits in MSR_ARCH_CAPS have since
    been defined, but they haven't been exposed.  Update the list to allow
    them through.
    
    As one example, this allows a Linux Dom0 to know that it has the
    appropriate microcode via FB_CLEAR.  Notably, and with the updated
    microcode, this changes dom0's
    /sys/devices/system/cpu/vulnerabilities/mmio_stale_data changes from:
    
      "Vulnerable: Clear CPU buffers attempted, no microcode; SMT Host state unknown"
    
    to:
    
      "Mitigation: Clear CPU buffers; SMT Host state unknown"
    
    This exposes the MMIO Stale Data and Intel Branch History Injection
    (BHI) controls as well as the page size change MCE issue bit.
    
    Fixes: commit 2ebe8fe9b7e0 ("x86/spec-ctrl: Enumeration for MMIO Stale Data controls")
    Fixes: commit cea9ae062295 ("x86/spec-ctrl: Enumeration for new Intel BHI controls")
    Fixes: commit 59e89cdabc71 ("x86/vtx: Disable executable EPT superpages to work around CVE-2018-12207")
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: e83cd54611fec5b7a539fa1281a14319143490e6
    master date: 2022-08-09 16:35:25 +0100
---
 xen/arch/x86/msr.c              | 9 +++++++--
 xen/include/asm-x86/msr-index.h | 2 ++
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index da305c7aa4..103703dfc0 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -71,7 +71,9 @@ static void __init calculate_host_policy(void)
     mp->arch_caps.raw &=
         (ARCH_CAPS_RDCL_NO | ARCH_CAPS_IBRS_ALL | ARCH_CAPS_RSBA |
          ARCH_CAPS_SKIP_L1DFL | ARCH_CAPS_SSB_NO | ARCH_CAPS_MDS_NO |
-         ARCH_CAPS_IF_PSCHANGE_MC_NO | ARCH_CAPS_TSX_CTRL | ARCH_CAPS_TAA_NO);
+         ARCH_CAPS_IF_PSCHANGE_MC_NO | ARCH_CAPS_TSX_CTRL | ARCH_CAPS_TAA_NO |
+         ARCH_CAPS_SBDR_SSDP_NO | ARCH_CAPS_FBSDP_NO | ARCH_CAPS_PSDP_NO |
+         ARCH_CAPS_FB_CLEAR | ARCH_CAPS_RRSBA | ARCH_CAPS_BHI_NO);
 }
 
 static void __init calculate_pv_max_policy(void)
@@ -160,7 +162,10 @@ int init_domain_msr_policy(struct domain *d)
 
         mp->arch_caps.raw = val &
             (ARCH_CAPS_RDCL_NO | ARCH_CAPS_IBRS_ALL | ARCH_CAPS_RSBA |
-             ARCH_CAPS_SSB_NO | ARCH_CAPS_MDS_NO | ARCH_CAPS_TAA_NO);
+             ARCH_CAPS_SSB_NO | ARCH_CAPS_MDS_NO | ARCH_CAPS_IF_PSCHANGE_MC_NO |
+             ARCH_CAPS_TAA_NO | ARCH_CAPS_SBDR_SSDP_NO | ARCH_CAPS_FBSDP_NO |
+             ARCH_CAPS_PSDP_NO | ARCH_CAPS_FB_CLEAR | ARCH_CAPS_RRSBA |
+             ARCH_CAPS_BHI_NO);
     }
 
     d->arch.msr = mp;
diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h
index 3cb942eeac..c601d88993 100644
--- a/xen/include/asm-x86/msr-index.h
+++ b/xen/include/asm-x86/msr-index.h
@@ -71,6 +71,8 @@
 #define  ARCH_CAPS_PSDP_NO                  (_AC(1, ULL) << 15)
 #define  ARCH_CAPS_FB_CLEAR                 (_AC(1, ULL) << 17)
 #define  ARCH_CAPS_FB_CLEAR_CTRL            (_AC(1, ULL) << 18)
+#define  ARCH_CAPS_RRSBA                    (_AC(1, ULL) << 19)
+#define  ARCH_CAPS_BHI_NO                   (_AC(1, ULL) << 20)
 
 #define MSR_FLUSH_CMD                       0x0000010b
 #define  FLUSH_CMD_L1D                      (_AC(1, ULL) <<  0)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Aug 16 08:44:25 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 16 Aug 2022 08:44:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.388091.624635 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNsBU-0000AS-0h; Tue, 16 Aug 2022 08:44:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 388091.624635; Tue, 16 Aug 2022 08:44:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNsBT-0000AK-UD; Tue, 16 Aug 2022 08:44:23 +0000
Received: by outflank-mailman (input) for mailman id 388091;
 Tue, 16 Aug 2022 08:44:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNsBS-0000A1-9w
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 08:44:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNsBS-0001bS-9D
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 08:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNsBS-0008PL-8K
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 08:44:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nemQ8+lCG3B6NbpwhpLCa0CFgSlVyE98m/NqKtveYAw=; b=bY13RGcBzsDeTqFr+Dw4StaI07
	5GKYMpTUv8xBXwgfocvLCrOblWLCW5yNMXUY3ney/06+i76glxA1So0EETs+xJjf/Mvv5x8uowxc9
	5PrANktCvLTAB9og7scV/VT/QPGpkd4UyMZCD+cJF5z5BVoJ0tYEnj9T4PNZAwnIXUe8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] xen/sched: setup dom0 vCPUs affinity only once
Message-Id: <E1oNsBS-0008PL-8K@xenbits.xenproject.org>
Date: Tue, 16 Aug 2022 08:44:22 +0000

commit 0f7eff5e0303aaf1d17d29fab7a34f0d50a241b0
Author:     Dario Faggioli <dfaggioli@suse.com>
AuthorDate: Mon Aug 15 15:33:09 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 15:33:09 2022 +0200

    xen/sched: setup dom0 vCPUs affinity only once
    
    Right now, affinity for dom0 vCPUs is setup in two steps. This is a
    problem as, at least in Credit2, unit_insert() sees and uses the
    "intermediate" affinity, and place the vCPUs on CPUs where they cannot
    be run. And this in turn results in boot hangs, if the "dom0_nodes"
    parameter is used.
    
    Fix this by setting up the affinity properly once and for all, in
    sched_init_vcpu() called by create_vcpu().
    
    Note that, unless a soft-affinity is explicitly specified for dom0 (by
    using the relaxed mode of "dom0_nodes") we set it to the default, which
    is all CPUs, instead of computing it basing on hard affinity (if any).
    This is because hard and soft affinity should be considered as
    independent user controlled properties. In fact, if we dor derive dom0's
    soft-affinity from its boot-time hard-affinity, such computed value will
    continue to be used even if later the user changes the hard-affinity.
    And this could result in the vCPUs behaving differently than what the
    user wanted and expects.
    
    Fixes: dafd936dddbd ("Make credit2 the default scheduler")
    Reported-by: Olaf Hering <ohering@suse.de>
    Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: c79e4d209be3ed2a6b8e97c35944786ed2a66b94
    master date: 2022-08-11 11:46:22 +0200
---
 xen/common/sched/core.c | 63 ++++++++++++++++++++++++++++++-------------------
 1 file changed, 39 insertions(+), 24 deletions(-)

diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c
index 8f4b1ca10d..f07bd2681f 100644
--- a/xen/common/sched/core.c
+++ b/xen/common/sched/core.c
@@ -571,12 +571,46 @@ int sched_init_vcpu(struct vcpu *v)
         return 1;
     }
 
-    /*
-     * Initialize affinity settings. The idler, and potentially
-     * domain-0 VCPUs, are pinned onto their respective physical CPUs.
-     */
-    if ( is_idle_domain(d) || (is_hardware_domain(d) && opt_dom0_vcpus_pin) )
+    if ( is_idle_domain(d) )
+    {
+        /* Idle vCPUs are always pinned onto their respective pCPUs */
+        sched_set_affinity(unit, cpumask_of(processor), &cpumask_all);
+    }
+    else if ( pv_shim && v->vcpu_id == 0 )
+    {
+        /*
+         * PV-shim: vcpus are pinned 1:1. Initially only 1 cpu is online,
+         * others will be dealt with when onlining them. This avoids pinning
+         * a vcpu to a not yet online cpu here.
+         */
+        sched_set_affinity(unit, cpumask_of(0), cpumask_of(0));
+    }
+    else if ( is_hardware_domain(d) && opt_dom0_vcpus_pin )
+    {
+        /*
+         * If dom0_vcpus_pin is specified, dom0 vCPUs are pinned 1:1 to
+         * their respective pCPUs too.
+         */
         sched_set_affinity(unit, cpumask_of(processor), &cpumask_all);
+    }
+#ifdef CONFIG_X86
+    else if ( d->domain_id == 0 )
+    {
+        /*
+         * In absence of dom0_vcpus_pin instead, the hard and soft affinity of
+         * dom0 is controlled by the (x86 only) dom0_nodes parameter. At this
+         * point it has been parsed and decoded into the dom0_cpus mask.
+         *
+         * Note that we always honor what user explicitly requested, for both
+         * hard and soft affinity, without doing any dynamic computation of
+         * either of them.
+         */
+        if ( !dom0_affinity_relaxed )
+            sched_set_affinity(unit, &dom0_cpus, &cpumask_all);
+        else
+            sched_set_affinity(unit, &cpumask_all, &dom0_cpus);
+    }
+#endif
     else
         sched_set_affinity(unit, &cpumask_all, &cpumask_all);
 
@@ -3386,29 +3420,10 @@ void wait(void)
 void __init sched_setup_dom0_vcpus(struct domain *d)
 {
     unsigned int i;
-    struct sched_unit *unit;
 
     for ( i = 1; i < d->max_vcpus; i++ )
         vcpu_create(d, i);
 
-    /*
-     * PV-shim: vcpus are pinned 1:1.
-     * Initially only 1 cpu is online, others will be dealt with when
-     * onlining them. This avoids pinning a vcpu to a not yet online cpu here.
-     */
-    if ( pv_shim )
-        sched_set_affinity(d->vcpu[0]->sched_unit,
-                           cpumask_of(0), cpumask_of(0));
-    else
-    {
-        for_each_sched_unit ( d, unit )
-        {
-            if ( !opt_dom0_vcpus_pin && !dom0_affinity_relaxed )
-                sched_set_affinity(unit, &dom0_cpus, NULL);
-            sched_set_affinity(unit, NULL, &dom0_cpus);
-        }
-    }
-
     domain_update_node_affinity(d);
 }
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Aug 16 08:44:34 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 16 Aug 2022 08:44:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.388092.624639 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNsBe-0000Da-2F; Tue, 16 Aug 2022 08:44:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 388092.624639; Tue, 16 Aug 2022 08: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 1oNsBd-0000DS-Vn; Tue, 16 Aug 2022 08:44:33 +0000
Received: by outflank-mailman (input) for mailman id 388092;
 Tue, 16 Aug 2022 08:44:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNsBc-0000DA-D3
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 08:44:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNsBc-0001bc-CJ
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 08:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNsBc-0008Ps-BU
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 08:44:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yA2Y5UbzHFCc0m3C6GhdDObXg+wh9en1QnHyWLyJp8A=; b=a+a3cdHnw5GM6GpIvACOJjISVV
	ipjTAfQl2c5n4SwgF5r9pYD6txzoAvO9Ny3bx7ooHV1VS9qi2R0LBPkJpzSaD2ceRdqX4C1IgJCNQ
	yRaFO/wFv4hmxrx2qNU/7XA+3WAM+103pZBnLgavFHBAq+NX/5EWPJV3JeoI/G4anu0M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] tools/libxl: Replace deprecated -sdl option on QEMU command line
Message-Id: <E1oNsBc-0008Ps-BU@xenbits.xenproject.org>
Date: Tue, 16 Aug 2022 08:44:32 +0000

commit e6a760b8b1ce844f171594ce19856bf7e51b0509
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Mon Aug 15 15:34:07 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 15:34:07 2022 +0200

    tools/libxl: Replace deprecated -sdl option on QEMU command line
    
    "-sdl" is deprecated upstream since 6695e4c0fd9e ("softmmu/vl:
    Deprecate the -sdl and -curses option"), QEMU v6.2, and the option is
    removed by 707d93d4abc6 ("ui: Remove deprecated options "-sdl" and
    "-curses""), in upcoming QEMU v7.1.
    
    Instead, use "-display sdl", available since 1472a95bab1e ("Introduce
    -display argument"), before QEMU v1.0.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Jason Andryuk <jandryuk@gmail.com>
    master commit: 41fcb3af8ad6d4c9f65a9d72798e6d18afec55ac
    master date: 2022-08-11 11:47:11 +0200
---
 tools/libs/light/libxl_dm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libs/light/libxl_dm.c b/tools/libs/light/libxl_dm.c
index 1864ee30f0..04bf5d8563 100644
--- a/tools/libs/light/libxl_dm.c
+++ b/tools/libs/light/libxl_dm.c
@@ -1349,7 +1349,7 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
     flexarray_append_pair(dm_args, "-display", "none");
 
     if (sdl && !is_stubdom) {
-        flexarray_append(dm_args, "-sdl");
+        flexarray_append_pair(dm_args, "-display", "sdl");
         if (sdl->display)
             flexarray_append_pair(dm_envs, "DISPLAY", sdl->display);
         if (sdl->xauthority)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Aug 16 08:44:44 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 16 Aug 2022 08:44:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.388093.624643 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNsBo-0000Gg-3l; Tue, 16 Aug 2022 08:44:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 388093.624643; Tue, 16 Aug 2022 08: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 1oNsBo-0000GY-10; Tue, 16 Aug 2022 08:44:44 +0000
Received: by outflank-mailman (input) for mailman id 388093;
 Tue, 16 Aug 2022 08:44:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNsBm-0000GO-Fq
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 08:44:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNsBm-0001bm-F8
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 08:44:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNsBm-0008Qa-EV
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 08:44:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+rSwAHc1CSOqWpJDojwKbrqYtQlrpAUwVEIhwIGAOxI=; b=gCPO3vrdbYLnuWV4WbAmOkNdBL
	P6otbJ8JYcrmShk13UDZQeFgijNZkxlX0C1av83X84KoHPnYlB1cb45oKfEuRKZT5VCUQejQie13Q
	4hrp0Nrkiz/R1pg/VccMkDb6WtxcdGVK647EBV6isSxooxoqSsIyssj0oZWONusm+2Sw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86/spec-ctrl: Enumeration for PBRSB_NO
Message-Id: <E1oNsBm-0008Qa-EV@xenbits.xenproject.org>
Date: Tue, 16 Aug 2022 08:44:42 +0000

commit 940fc00e02cbc8a202b3a072b9e33a3fe74da809
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Aug 15 15:34:30 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 15:34:30 2022 +0200

    x86/spec-ctrl: Enumeration for PBRSB_NO
    
    The PBRSB_NO bit indicates that the CPU is not vulnerable to the Post-Barrier
    RSB speculative vulnerability.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b874e47eb13feb75be3ee7b5dc4ae9c97d80d774
    master date: 2022-08-11 16:19:50 +0100
---
 xen/arch/x86/msr.c              | 5 +++--
 xen/arch/x86/spec_ctrl.c        | 3 ++-
 xen/include/asm-x86/msr-index.h | 1 +
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 103703dfc0..cc8fe76203 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -73,7 +73,8 @@ static void __init calculate_host_policy(void)
          ARCH_CAPS_SKIP_L1DFL | ARCH_CAPS_SSB_NO | ARCH_CAPS_MDS_NO |
          ARCH_CAPS_IF_PSCHANGE_MC_NO | ARCH_CAPS_TSX_CTRL | ARCH_CAPS_TAA_NO |
          ARCH_CAPS_SBDR_SSDP_NO | ARCH_CAPS_FBSDP_NO | ARCH_CAPS_PSDP_NO |
-         ARCH_CAPS_FB_CLEAR | ARCH_CAPS_RRSBA | ARCH_CAPS_BHI_NO);
+         ARCH_CAPS_FB_CLEAR | ARCH_CAPS_RRSBA | ARCH_CAPS_BHI_NO |
+         ARCH_CAPS_PBRSB_NO);
 }
 
 static void __init calculate_pv_max_policy(void)
@@ -165,7 +166,7 @@ int init_domain_msr_policy(struct domain *d)
              ARCH_CAPS_SSB_NO | ARCH_CAPS_MDS_NO | ARCH_CAPS_IF_PSCHANGE_MC_NO |
              ARCH_CAPS_TAA_NO | ARCH_CAPS_SBDR_SSDP_NO | ARCH_CAPS_FBSDP_NO |
              ARCH_CAPS_PSDP_NO | ARCH_CAPS_FB_CLEAR | ARCH_CAPS_RRSBA |
-             ARCH_CAPS_BHI_NO);
+             ARCH_CAPS_BHI_NO | ARCH_CAPS_PBRSB_NO);
     }
 
     d->arch.msr = mp;
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index 50660f3e23..0f4bad3d3a 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -419,7 +419,7 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
      * Hardware read-only information, stating immunity to certain issues, or
      * suggestions of which mitigation to use.
      */
-    printk("  Hardware hints:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
+    printk("  Hardware hints:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
            (caps & ARCH_CAPS_RDCL_NO)                        ? " RDCL_NO"        : "",
            (caps & ARCH_CAPS_IBRS_ALL)                       ? " IBRS_ALL"       : "",
            (caps & ARCH_CAPS_RSBA)                           ? " RSBA"           : "",
@@ -431,6 +431,7 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
            (caps & ARCH_CAPS_SBDR_SSDP_NO)                   ? " SBDR_SSDP_NO"   : "",
            (caps & ARCH_CAPS_FBSDP_NO)                       ? " FBSDP_NO"       : "",
            (caps & ARCH_CAPS_PSDP_NO)                        ? " PSDP_NO"        : "",
+           (caps & ARCH_CAPS_PBRSB_NO)                       ? " PBRSB_NO"       : "",
            (e8b  & cpufeat_mask(X86_FEATURE_IBRS_ALWAYS))    ? " IBRS_ALWAYS"    : "",
            (e8b  & cpufeat_mask(X86_FEATURE_STIBP_ALWAYS))   ? " STIBP_ALWAYS"   : "",
            (e8b  & cpufeat_mask(X86_FEATURE_IBRS_FAST))      ? " IBRS_FAST"      : "",
diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h
index c601d88993..60c0bc7571 100644
--- a/xen/include/asm-x86/msr-index.h
+++ b/xen/include/asm-x86/msr-index.h
@@ -73,6 +73,7 @@
 #define  ARCH_CAPS_FB_CLEAR_CTRL            (_AC(1, ULL) << 18)
 #define  ARCH_CAPS_RRSBA                    (_AC(1, ULL) << 19)
 #define  ARCH_CAPS_BHI_NO                   (_AC(1, ULL) << 20)
+#define  ARCH_CAPS_PBRSB_NO                 (_AC(1, ULL) << 24)
 
 #define MSR_FLUSH_CMD                       0x0000010b
 #define  FLUSH_CMD_L1D                      (_AC(1, ULL) <<  0)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Aug 16 08:44:54 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 16 Aug 2022 08:44:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.388094.624647 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNsBy-0000Ju-5m; Tue, 16 Aug 2022 08:44:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 388094.624647; Tue, 16 Aug 2022 08: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 1oNsBy-0000Jl-2a; Tue, 16 Aug 2022 08:44:54 +0000
Received: by outflank-mailman (input) for mailman id 388094;
 Tue, 16 Aug 2022 08:44:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNsBw-0000JX-Ig
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 08:44:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNsBw-0001bw-Hs
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 08:44:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNsBw-0008Qz-HF
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 08:44:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4zbxJ4HKbb4IJNYuaU7U24egIGIGsbtT5mO9RfU50MM=; b=mEMY4X2mvVJlYf9nfTUPRpi7Sp
	aIVr5ys3bJ5VYxg5eqUjlp6E5oynz3cWC408lxkfHH9d8YogjvWZ3DBS5ul1LwHDIU9TWgVFHEqr5
	0JI3BJeOHIftilMucguKTsaV76tfxO6RzewzjJtojhA8uaOUUrGEMzGhjNSdDxyTwLFk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86/amd: only call setup_force_cpu_cap for boot CPU
Message-Id: <E1oNsBw-0008Qz-HF@xenbits.xenproject.org>
Date: Tue, 16 Aug 2022 08:44:52 +0000

commit 9123e60c0b9de1c78e8b807c80f0ea60aba37979
Author:     Ross Lagerwall <ross.lagerwall@citrix.com>
AuthorDate: Mon Aug 15 15:35:10 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 15:35:10 2022 +0200

    x86/amd: only call setup_force_cpu_cap for boot CPU
    
    This should only be called for the boot CPU to avoid calling _init code
    after it has been unloaded.
    
    Fixes: 062868a5a8b4 ("x86/amd: Work around CLFLUSH ordering on older parts")
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 31b41ce858c8bd5159212d40969f8e0b7124bbf0
    master date: 2022-08-11 17:44:26 +0200
---
 xen/arch/x86/cpu/amd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/cpu/amd.c b/xen/arch/x86/cpu/amd.c
index 37ac84ddd7..9635eee619 100644
--- a/xen/arch/x86/cpu/amd.c
+++ b/xen/arch/x86/cpu/amd.c
@@ -845,7 +845,7 @@ static void init_amd(struct cpuinfo_x86 *c)
 	 * everything, including reads and writes to address, and
 	 * LFENCE/SFENCE instructions.
 	 */
-	if (!cpu_has_clflushopt)
+	if (c == &boot_cpu_data && !cpu_has_clflushopt)
 		setup_force_cpu_cap(X86_BUG_CLFLUSH_MFENCE);
 
 	switch(c->x86)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Aug 16 08:45:04 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 16 Aug 2022 08:45:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.388095.624651 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNsC8-0000N0-99; Tue, 16 Aug 2022 08:45:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 388095.624651; Tue, 16 Aug 2022 08: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 1oNsC8-0000Ms-62; Tue, 16 Aug 2022 08:45:04 +0000
Received: by outflank-mailman (input) for mailman id 388095;
 Tue, 16 Aug 2022 08:45:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNsC6-0000Mh-LM
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 08:45:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNsC6-0001eD-KZ
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 08:45:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNsC6-0008Rd-Jz
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 08:45:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KD45t7/F0/rlySI8Sj0W71un6atu285mPTZGaZgeYLk=; b=3DA2htjajRIjkfAza8K1pC3rlf
	PUxQognYM6LZ8XliMAhvy6VrwMDkGSH4GIVXQn8Wxxv5ApL6J6pOP8+OE7iHPCuhG40PsFR9U+k1X
	quFfeqk+6mexR8svdjTDpEqFaYADlv+ST5AgRXaBe3f/htora794+S9+SAvaR8nk8NF0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] build/x86: suppress GNU ld 2.39 warning about RWX load segments
Message-Id: <E1oNsC6-0008Rd-Jz@xenbits.xenproject.org>
Date: Tue, 16 Aug 2022 08:45:02 +0000

commit 3fd9a7d59523fb0555d0e89b11eeea5d53d2c54c
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Aug 15 15:36:06 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 15:36:06 2022 +0200

    build/x86: suppress GNU ld 2.39 warning about RWX load segments
    
    Commit 68f5aac012b9 ("build: suppress future GNU ld warning about RWX
    load segments") didn't quite cover all the cases: Apparently I missed
    ones in the building of 32-bit helper objects because of only looking at
    incremental builds (where those wouldn't normally be re-built). Clone
    the workaround there to the specific Makefile in question.
    
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 3eb1865ae305772b558757904d81951e31de43de
    master date: 2022-08-11 17:45:12 +0200
---
 xen/arch/x86/boot/build32.mk | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xen/arch/x86/boot/build32.mk b/xen/arch/x86/boot/build32.mk
index e90680cd9f..d2fae5cf9e 100644
--- a/xen/arch/x86/boot/build32.mk
+++ b/xen/arch/x86/boot/build32.mk
@@ -8,6 +8,9 @@ CFLAGS += -Werror -fno-builtin -g0 -msoft-float
 CFLAGS += -I$(BASEDIR)/include
 CFLAGS := $(filter-out -flto,$(CFLAGS)) 
 
+LDFLAGS_DIRECT-$(shell $(LD) -v --warn-rwx-segments >/dev/null 2>&1 && echo y) := --no-warn-rwx-segments
+LDFLAGS_DIRECT += $(LDFLAGS_DIRECT-y)
+
 # NB. awk invocation is a portable alternative to 'head -n -1'
 %.S: %.bin
 	(od -v -t x $< | tr -s ' ' | awk 'NR > 1 {print s} {s=$$0}' | \
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Aug 16 08:45:14 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 16 Aug 2022 08:45:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.388096.624655 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNsCI-0000Pp-AW; Tue, 16 Aug 2022 08:45:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 388096.624655; Tue, 16 Aug 2022 08:45:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNsCI-0000Pi-7Y; Tue, 16 Aug 2022 08:45:14 +0000
Received: by outflank-mailman (input) for mailman id 388096;
 Tue, 16 Aug 2022 08:45:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNsCG-0000PN-ON
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 08:45:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNsCG-0001eM-Ne
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 08:45:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNsCG-0008SE-Mk
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 08:45:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=oSlrKmjTcjux3OodLOcVEGJ6D6Fty4ajL996TUbFjXg=; b=DKSewFUz+QhK5VqAQKJfeifSkw
	ha0AY/0zFNzc/rlvAx7QbpVQn0TdNaJR7ET2GxedaBKHFQQF+hdO6Vbrld8zHyEfS0Tz84jg2iivF
	E+10DtQ6e4cbBbBp7Z9pBJ2/hJBvhnODx/WOhLDBfwAjYboKb7HhUwVP5qvI3ZLZP6YE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] PCI: simplify (and thus correct) pci_get_pdev{,_by_domain}()
Message-Id: <E1oNsCG-0008SE-Mk@xenbits.xenproject.org>
Date: Tue, 16 Aug 2022 08:45:12 +0000

commit 2abe83f9d91e6411b5b42a3d5d01593e83c2bf9f
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Aug 15 15:36:56 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 15:36:56 2022 +0200

    PCI: simplify (and thus correct) pci_get_pdev{,_by_domain}()
    
    The last "wildcard" use of either function went away with f591755823a7
    ("IOMMU/PCI: don't let domain cleanup continue when device de-assignment
    failed"). Don't allow them to be called this way anymore. Besides
    simplifying the code this also fixes two bugs:
    
    1) When seg != -1, the outer loops should have been terminated after the
       first iteration, or else a device with the same BDF but on another
       segment could be found / returned.
    
    Reported-by: Rahul Singh <rahul.singh@arm.com>
    
    2) When seg == -1 calling get_pseg() is bogus. The function (taking a
       u16) would look for segment 0xffff, which might exist. If it exists,
       we might then find / return a wrong device.
    
    In pci_get_pdev_by_domain() also switch from using the per-segment list
    to using the per-domain one, with the exception of the hardware domain
    (see the code comment there).
    
    While there also constify "pseg" and drop "pdev"'s already previously
    unnecessary initializer.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Rahul Singh <rahul.singh@arm.com>
    Tested-by: Rahul Singh <rahul.singh@arm.com>
    master commit: 8cf6e0738906fc269af40135ed82a07815dd3b9c
    master date: 2022-08-12 08:34:33 +0200
---
 xen/drivers/passthrough/pci.c | 61 ++++++++++++++++++-------------------------
 xen/include/xen/pci.h         |  6 ++---
 2 files changed, 29 insertions(+), 38 deletions(-)

diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index e0491c908f..da4ecda814 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -507,30 +507,19 @@ int __init pci_ro_device(int seg, int bus, int devfn)
     return 0;
 }
 
-struct pci_dev *pci_get_pdev(int seg, int bus, int devfn)
+struct pci_dev *pci_get_pdev(uint16_t seg, uint8_t bus, uint8_t devfn)
 {
-    struct pci_seg *pseg = get_pseg(seg);
-    struct pci_dev *pdev = NULL;
+    const struct pci_seg *pseg = get_pseg(seg);
+    struct pci_dev *pdev;
 
     ASSERT(pcidevs_locked());
-    ASSERT(seg != -1 || bus == -1);
-    ASSERT(bus != -1 || devfn == -1);
 
     if ( !pseg )
-    {
-        if ( seg == -1 )
-            radix_tree_gang_lookup(&pci_segments, (void **)&pseg, 0, 1);
-        if ( !pseg )
-            return NULL;
-    }
+        return NULL;
 
-    do {
-        list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
-            if ( (pdev->bus == bus || bus == -1) &&
-                 (pdev->devfn == devfn || devfn == -1) )
-                return pdev;
-    } while ( radix_tree_gang_lookup(&pci_segments, (void **)&pseg,
-                                     pseg->nr + 1, 1) );
+    list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
+        if ( pdev->bus == bus && pdev->devfn == devfn )
+            return pdev;
 
     return NULL;
 }
@@ -556,31 +545,33 @@ struct pci_dev *pci_get_real_pdev(int seg, int bus, int devfn)
     return pdev;
 }
 
-struct pci_dev *pci_get_pdev_by_domain(const struct domain *d, int seg,
-                                       int bus, int devfn)
+struct pci_dev *pci_get_pdev_by_domain(const struct domain *d, uint16_t seg,
+                                       uint8_t bus, uint8_t devfn)
 {
-    struct pci_seg *pseg = get_pseg(seg);
-    struct pci_dev *pdev = NULL;
-
-    ASSERT(seg != -1 || bus == -1);
-    ASSERT(bus != -1 || devfn == -1);
+    struct pci_dev *pdev;
 
-    if ( !pseg )
+    /*
+     * The hardware domain owns the majority of the devices in the system.
+     * When there are multiple segments, traversing the per-segment list is
+     * likely going to be faster, whereas for a single segment the difference
+     * shouldn't be that large.
+     */
+    if ( is_hardware_domain(d) )
     {
-        if ( seg == -1 )
-            radix_tree_gang_lookup(&pci_segments, (void **)&pseg, 0, 1);
+        const struct pci_seg *pseg = get_pseg(seg);
+
         if ( !pseg )
             return NULL;
-    }
 
-    do {
         list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
-            if ( (pdev->bus == bus || bus == -1) &&
-                 (pdev->devfn == devfn || devfn == -1) &&
-                 (pdev->domain == d) )
+            if ( pdev->bus == bus && pdev->devfn == devfn &&
+                 pdev->domain == d )
+                return pdev;
+    }
+    else
+        list_for_each_entry ( pdev, &d->pdev_list, domain_list )
+            if ( pdev->bus == bus && pdev->devfn == devfn )
                 return pdev;
-    } while ( radix_tree_gang_lookup(&pci_segments, (void **)&pseg,
-                                     pseg->nr + 1, 1) );
 
     return NULL;
 }
diff --git a/xen/include/xen/pci.h b/xen/include/xen/pci.h
index b6d7e454f8..ac3880e686 100644
--- a/xen/include/xen/pci.h
+++ b/xen/include/xen/pci.h
@@ -169,10 +169,10 @@ int pci_add_device(u16 seg, u8 bus, u8 devfn,
 int pci_remove_device(u16 seg, u8 bus, u8 devfn);
 int pci_ro_device(int seg, int bus, int devfn);
 int pci_hide_device(unsigned int seg, unsigned int bus, unsigned int devfn);
-struct pci_dev *pci_get_pdev(int seg, int bus, int devfn);
+struct pci_dev *pci_get_pdev(uint16_t seg, uint8_t bus, uint8_t devfn);
 struct pci_dev *pci_get_real_pdev(int seg, int bus, int devfn);
-struct pci_dev *pci_get_pdev_by_domain(const struct domain *, int seg,
-                                       int bus, int devfn);
+struct pci_dev *pci_get_pdev_by_domain(const struct domain *, uint16_t seg,
+                                       uint8_t bus, uint8_t devfn);
 void pci_check_disable_device(u16 seg, u8 bus, u8 devfn);
 
 uint8_t pci_conf_read8(pci_sbdf_t sbdf, unsigned int reg);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Aug 16 09:33:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 16 Aug 2022 09:33:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.388135.624708 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNswb-0007On-QW; Tue, 16 Aug 2022 09:33:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 388135.624708; Tue, 16 Aug 2022 09:33:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNswb-0007Og-Nt; Tue, 16 Aug 2022 09:33:05 +0000
Received: by outflank-mailman (input) for mailman id 388135;
 Tue, 16 Aug 2022 09:33:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNswa-0007Nm-4i
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 09:33:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNswa-0002SM-2V
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 09:33:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNswa-00032D-1Z
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 09:33:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=2UP52PeCcey2ip4rkXPgX8AeM1PReZJGUSufka3OjaM=; b=TQFUx/1vuLYsGwC1OYVP+cT4vr
	EdZLRDHcAuoiqNyuPvpu//I9tq/3pjFjVb33wzJOemxcIeAEs0ourF+rm3tScDbC/PnWbVoa/xYFG
	Si/I6yUlTnxScZqIH2Q1V2KyzhU9S5tMqpa1Jk/huu3pEWkXsJT/vdWLlWxQkdQju4Uw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/flask/utils: list build targets in $(TARGETS)
Message-Id: <E1oNswa-00032D-1Z@xenbits.xenproject.org>
Date: Tue, 16 Aug 2022 09:33:04 +0000

commit e450af698fc606828bf839c2d782a82e256e9715
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Tue Aug 16 11:18:39 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 16 11:18:39 2022 +0200

    tools/flask/utils: list build targets in $(TARGETS)
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Henry Wang <Henry.Wang@arm.com>
    Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 tools/flask/utils/Makefile | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/flask/utils/Makefile b/tools/flask/utils/Makefile
index db567b13dc..6be134142a 100644
--- a/tools/flask/utils/Makefile
+++ b/tools/flask/utils/Makefile
@@ -4,10 +4,10 @@ include $(XEN_ROOT)/tools/Rules.mk
 CFLAGS += -Werror
 CFLAGS += $(CFLAGS_libxenctrl)
 
-CLIENTS := flask-loadpolicy flask-setenforce flask-getenforce flask-label-pci flask-get-bool flask-set-bool
+TARGETS := flask-loadpolicy flask-setenforce flask-getenforce flask-label-pci flask-get-bool flask-set-bool
 
 .PHONY: all
-all: $(CLIENTS)
+all: $(TARGETS)
 
 flask-loadpolicy: loadpolicy.o
 	$(CC) $(LDFLAGS) $< $(LDLIBS) $(LDLIBS_libxenctrl) -o $@
@@ -29,7 +29,7 @@ flask-set-bool: set-bool.o
 
 .PHONY: clean
 clean:
-	$(RM) *.o $(CLIENTS) $(DEPS_RM)
+	$(RM) *.o $(TARGETS) $(DEPS_RM)
 
 .PHONY: distclean
 distclean: clean
@@ -37,10 +37,10 @@ distclean: clean
 .PHONY: install
 install: all
 	$(INSTALL_DIR) $(DESTDIR)$(sbindir)
-	$(INSTALL_PROG) $(CLIENTS) $(DESTDIR)$(sbindir)
+	$(INSTALL_PROG) $(TARGETS) $(DESTDIR)$(sbindir)
 
 .PHONY: uninstall
 uninstall:
-	rm -f $(addprefix $(DESTDIR)$(sbindir)/, $(CLIENTS))
+	rm -f $(addprefix $(DESTDIR)$(sbindir)/, $(TARGETS))
 
 -include $(DEPS_INCLUDE)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Aug 16 09:33:15 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 16 Aug 2022 09:33:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.388136.624713 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNswl-0007Qw-Sl; Tue, 16 Aug 2022 09:33:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 388136.624713; Tue, 16 Aug 2022 09:33:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNswl-0007Qo-Pd; Tue, 16 Aug 2022 09:33:15 +0000
Received: by outflank-mailman (input) for mailman id 388136;
 Tue, 16 Aug 2022 09:33:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNswk-0007Qa-6X
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 09:33:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNswk-0002SX-5k
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 09:33:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNswk-00032s-4x
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 09:33:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=EPFqi35qmz2EHvpcccNH51a/mis3MCANKglAig5JbkA=; b=Csf3yEm+U8MSt6CP9uZiZ/GbEt
	zUenHMxlWho/nKzWIZeHF3mlVqhXqrxnGMzyakls1pRgl2QeFrZWS+wgLq+VG4+v8O+T4/5F7DYrG
	SccG+L96McrHV8jQG39h3eY4yyOD/njuGWvGN0p9YG6qrbOELZXhnnzVOpNe8oisrISo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] drivers/char: add support for USB3 DbC debugger
Message-Id: <E1oNswk-00032s-4x@xenbits.xenproject.org>
Date: Tue, 16 Aug 2022 09:33:14 +0000

commit 791f216361f36437a6a5db005366d71c57afc881
Author:     Connor Davis <davisc@ainfosec.com>
AuthorDate: Tue Aug 16 11:20:01 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 16 11:20:01 2022 +0200

    drivers/char: add support for USB3 DbC debugger
    
    [Connor]
    Xue is a cross-platform USB 3 debugger that drives the Debug
    Capability (DbC) of xHCI-compliant host controllers. This patch
    implements the operations needed for xue to initialize the host
    controller's DbC and communicate with it. It also implements a struct
    uart_driver that uses xue as a backend. Note that only target -> host
    communication is supported for now. To use Xue as a console, add
    'console=dbgp dbgp=xhci' to the command line.
    
    [Marek]
    The Xue driver is taken from https://github.com/connojd/xue and heavily
    refactored to fit into Xen code base. Major changes include:
    - rename to xhci_dbc
    - drop support for non-Xen systems
    - drop xue_ops abstraction
    - use Xen's native helper functions for PCI access
    - move all the code to xue.c, drop "inline"
    - build for x86 only
    - annotate functions with cf_check
    - adjust for Xen's code style
    
    At this stage, only the first xHCI is considered, and only output is
    supported. Later patches add support for choosing specific device, and
    input handling.
    The driver is initiallized before memory allocator works, so all the
    transfer buffers (about 230KiB of them) are allocated statically and will
    use memory even if XUE console is not selected. The driver can be
    disabled build time to reclaim this memory.
    Most of this memory is shared with the controller via DMA. Later patch
    will adjust structures placement to avoid anything else to be placed on
    those DMA-reachable pages. This also means str_buf cannot use static
    initializer, without reserving (at least) a whole page page in .data (or
    more, when combined with other structures).
    
    Signed-off-by: Connor Davis <davisc@ainfosec.com>
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 docs/misc/xen-command-line.pandoc |    5 +
 xen/arch/x86/include/asm/fixmap.h |    4 +
 xen/arch/x86/setup.c              |    1 +
 xen/drivers/char/Kconfig          |    9 +
 xen/drivers/char/Makefile         |    1 +
 xen/drivers/char/xhci-dbc.c       | 1029 +++++++++++++++++++++++++++++++++++++
 xen/include/xen/serial.h          |    5 +
 7 files changed, 1054 insertions(+)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index fa56e880b3..cbfd163813 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -721,10 +721,15 @@ Available alternatives, with their meaning, are:
 
 ### dbgp
 > `= ehci[ <integer> | @pci<bus>:<slot>.<func> ]`
+> `= xhci`
 
 Specify the USB controller to use, either by instance number (when going
 over the PCI busses sequentially) or by PCI device (must be on segment 0).
 
+Use `ehci` for EHCI debug port, use `xhci` for XHCI debug capability (output
+only). XHCI driver will wait indefinitely for the debug host to connect - make
+sure the cable is connected.
+
 ### debug_stack_lines
 > `= <integer>`
 
diff --git a/xen/arch/x86/include/asm/fixmap.h b/xen/arch/x86/include/asm/fixmap.h
index 20746afd0a..bc39ffe896 100644
--- a/xen/arch/x86/include/asm/fixmap.h
+++ b/xen/arch/x86/include/asm/fixmap.h
@@ -25,6 +25,8 @@
 #include <asm/msi.h>
 #include <acpi/apei.h>
 
+#define MAX_XHCI_PAGES 16
+
 /*
  * Here we define all the compile-time 'special' virtual
  * addresses. The point is to have a constant address at
@@ -43,6 +45,8 @@ enum fixed_addresses {
     FIX_COM_BEGIN,
     FIX_COM_END,
     FIX_EHCI_DBGP,
+    FIX_XHCI_BEGIN,
+    FIX_XHCI_END = FIX_XHCI_BEGIN + MAX_XHCI_PAGES - 1,
 #ifdef CONFIG_XEN_GUEST
     FIX_PV_CONSOLE,
     FIX_XEN_SHARED_INFO,
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index f08b07b8de..e05189f649 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -950,6 +950,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
     ns16550.irq     = 3;
     ns16550_init(1, &ns16550);
     ehci_dbgp_init();
+    xhci_dbc_uart_init();
     console_init_preirq();
 
     if ( pvh_boot )
diff --git a/xen/drivers/char/Kconfig b/xen/drivers/char/Kconfig
index dec58bc993..06350c3873 100644
--- a/xen/drivers/char/Kconfig
+++ b/xen/drivers/char/Kconfig
@@ -84,3 +84,12 @@ config SERIAL_TX_BUFSIZE
 	  the nearest power of 2.
 
 	  Default value is 16384 (16kiB).
+
+config XHCI
+	bool "XHCI DbC UART driver"
+	depends on X86
+	help
+	  This selects the USB based XHCI debug capability to be usable as a UART.
+	  Enabling this option makes Xen use extra ~230KiB memory, even if XHCI UART
+	  is not selected.
+	  If you have an x86 based system with USB3, say Y.
diff --git a/xen/drivers/char/Makefile b/xen/drivers/char/Makefile
index 14e67cf072..e7e374775d 100644
--- a/xen/drivers/char/Makefile
+++ b/xen/drivers/char/Makefile
@@ -8,6 +8,7 @@ obj-$(CONFIG_HAS_MVEBU) += mvebu-uart.o
 obj-$(CONFIG_HAS_OMAP) += omap-uart.o
 obj-$(CONFIG_HAS_SCIF) += scif-uart.o
 obj-$(CONFIG_HAS_EHCI) += ehci-dbgp.o
+obj-$(CONFIG_XHCI) += xhci-dbc.o
 obj-$(CONFIG_HAS_IMX_LPUART) += imx-lpuart.o
 obj-$(CONFIG_ARM) += arm-uart.o
 obj-y += serial.o
diff --git a/xen/drivers/char/xhci-dbc.c b/xen/drivers/char/xhci-dbc.c
new file mode 100644
index 0000000000..a16c81b9e7
--- /dev/null
+++ b/xen/drivers/char/xhci-dbc.c
@@ -0,0 +1,1029 @@
+/*
+ * drivers/char/xhci-dbc.c
+ *
+ * Xen port for the xue debugger
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Copyright (c) 2019 Assured Information Security.
+ */
+
+#include <xen/delay.h>
+#include <xen/mm.h>
+#include <xen/param.h>
+#include <xen/serial.h>
+#include <xen/timer.h>
+#include <xen/types.h>
+#include <asm/fixmap.h>
+#include <asm/io.h>
+#include <asm/string.h>
+#include <asm/system.h>
+
+/* uncomment to have dbc_uart_dump() debug function */
+/* #define DBC_DEBUG 1 */
+
+#define DBC_POLL_INTERVAL 100 /* us */
+
+#define DBC_PAGE_SIZE 4096U
+
+/* Supported xHC PCI configurations */
+#define DBC_XHC_CLASSC 0xC0330U
+
+/* DbC idVendor and idProduct */
+#define DBC_DBC_VENDOR 0x1D6B
+#define DBC_DBC_PRODUCT 0x0010
+#define DBC_DBC_PROTOCOL 0x0000
+
+#define DBC_DOORBELL_TARGET_SHIFT 8
+#define DBC_DOORBELL_TARGET_MASK (0xFF << DBC_DOORBELL_TARGET_SHIFT)
+
+/* DCCTRL fields */
+#define DBC_CTRL_DCR 0
+#define DBC_CTRL_HOT 2
+#define DBC_CTRL_HIT 3
+#define DBC_CTRL_DRC 4
+#define DBC_CTRL_DCE 31
+
+/* DCPORTSC fields */
+#define DBC_PSC_PED 1
+#define DBC_PSC_CSC 17
+#define DBC_PSC_PRC 21
+#define DBC_PSC_PLC 22
+#define DBC_PSC_CEC 23
+
+#define DBC_PSC_ACK_MASK                                                       \
+    ((1UL << DBC_PSC_CSC) | (1UL << DBC_PSC_PRC) | (1UL << DBC_PSC_PLC) |      \
+     (1UL << DBC_PSC_CEC))
+
+#define dbc_debug(...) printk("dbc debug: " __VA_ARGS__)
+#define dbc_alert(...) printk("dbc alert: " __VA_ARGS__)
+#define dbc_error(...) printk("dbc error: " __VA_ARGS__)
+
+/******************************************************************************
+ * TRB ring (summarized from the manual):
+ *
+ * TRB rings are circular queues of TRBs shared between the xHC and the driver.
+ * Each ring has one producer and one consumer. The DbC has one event
+ * ring and two transfer rings; one IN and one OUT.
+ *
+ * The DbC hardware is the producer on the event ring, and
+ * dbc driver is the consumer. This means that event TRBs are read-only from
+ * the dbc driver.
+ *
+ * OTOH, dbc drive is the producer of transfer TRBs on the two transfer
+ * rings, so dbc driver enqueues transfers, and the hardware dequeues
+ * them. The dequeue pointer of a transfer ring is read by
+ * dbc driver by examining the latest transfer event TRB on the event ring. The
+ * transfer event TRB contains the address of the transfer TRB that generated
+ * the event.
+ *
+ * To make each transfer ring circular, the last TRB must be a link TRB, which
+ * points to the beginning of the next queue. Note that this implementation
+ * does not support multiple segments, so each link TRB points back to the
+ * beginning of its own segment.
+ ******************************************************************************/
+
+/* TRB types */
+enum {
+    XHCI_TRB_NORM = 1,
+    XHCI_TRB_LINK = 6,
+    XHCI_TRB_TFRE = 32,
+    XHCI_TRB_PSCE = 34
+};
+
+/* TRB completion codes */
+enum {
+    XHCI_TRB_CC_SUCCESS = 1,
+    XHCI_TRB_CC_TRB_ERR = 5,
+};
+
+/* DbC endpoint types */
+enum {
+    XHCI_EP_BULK_OUT = 2,
+    XHCI_EP_BULK_IN = 6,
+};
+
+/* DMA/MMIO structures */
+struct xhci_trb {
+    uint64_t params;
+    uint32_t status;
+    uint32_t ctrl;
+};
+
+/* log2(sizeof(struct xhci_trb)) */
+#define XHCI_TRB_SHIFT 4
+
+struct xhci_erst_segment {
+    uint64_t base;
+    uint16_t size;
+    uint8_t rsvdz[6];
+};
+
+/* Arbitrary length, must fit every DBC_STRING_* */
+#define MAX_STRING_LENGTH 16
+
+#define DBC_STRINGS_COUNT 4
+#define DBC_STRING_LANGID "\x09\x04"
+#define DBC_STRING_MANUFACTURER "Xen"
+#define DBC_STRING_PRODUCT "Debug console"
+#define DBC_STRING_SERIAL "0"
+
+#define XHCI_DT_STRING 3
+
+struct xhci_string_descriptor {
+    uint8_t size;
+    uint8_t type;
+    uint16_t string[MAX_STRING_LENGTH];
+};
+
+#define DBC_CTX_SIZE 16
+#define DBC_CTX_BYTES (DBC_CTX_SIZE * 4)
+
+struct xhci_dbc_ctx {
+    union {
+        uint32_t info[DBC_CTX_SIZE];
+        struct {
+            uint64_t string0_ptr;
+            uint64_t manufacturer_ptr;
+            uint64_t product_ptr;
+            uint64_t serial_ptr;
+            uint8_t string0_size;
+            uint8_t manufacturer_size;
+            uint8_t product_size;
+            uint8_t serial_size;
+        };
+    };
+    uint32_t ep_out[DBC_CTX_SIZE];
+    uint32_t ep_in[DBC_CTX_SIZE];
+};
+
+struct dbc_reg {
+    uint32_t id;
+    uint32_t db;
+    uint32_t erstsz;
+    uint32_t rsvdz;
+    uint64_t erstba;
+    uint64_t erdp;
+    uint32_t ctrl;
+    uint32_t st;
+    uint32_t portsc;
+    uint32_t rsvdp;
+    uint64_t cp;
+    uint32_t ddi1;
+    uint32_t ddi2;
+};
+
+#define DBC_TRB_MAX_TFR (DBC_PAGE_SIZE << 4)
+#define DBC_TRB_PER_PAGE (DBC_PAGE_SIZE / sizeof(struct xhci_trb))
+
+/* Defines the size in bytes of TRB rings as 2^DBC_TRB_RING_ORDER * 4096 */
+#ifndef DBC_TRB_RING_ORDER
+#define DBC_TRB_RING_ORDER 4
+#endif
+#define DBC_TRB_RING_CAP (DBC_TRB_PER_PAGE * (1 << DBC_TRB_RING_ORDER))
+#define DBC_TRB_RING_BYTES (DBC_TRB_RING_CAP * sizeof(struct xhci_trb))
+#define DBC_TRB_RING_MASK (DBC_TRB_RING_BYTES - 1U)
+
+struct xhci_trb_ring {
+    struct xhci_trb *trb; /* Array of TRBs */
+    uint32_t enq; /* The offset of the enqueue ptr */
+    uint32_t deq; /* The offset of the dequeue ptr */
+    uint8_t cyc; /* Cycle state toggled on each wrap-around */
+    uint8_t db; /* Doorbell target */
+    uint64_t dma; /* Physical address (for the device) */
+};
+
+#define DBC_DB_OUT 0x0
+#define DBC_DB_IN 0x1
+#define DBC_DB_INVAL 0xFF
+
+/* Defines the size in bytes of work rings as 2^DBC_WORK_RING_ORDER * 4096 */
+#ifndef DBC_WORK_RING_ORDER
+#define DBC_WORK_RING_ORDER 3
+#endif
+#define DBC_WORK_RING_CAP (DBC_PAGE_SIZE * (1 << DBC_WORK_RING_ORDER))
+#define DBC_WORK_RING_BYTES DBC_WORK_RING_CAP
+
+#if DBC_WORK_RING_CAP > DBC_TRB_MAX_TFR
+#error "DBC_WORK_RING_ORDER must be at most 4"
+#endif
+
+struct dbc_work_ring {
+    uint8_t *buf;
+    uint32_t enq;
+    uint32_t deq;
+    uint64_t dma;
+};
+
+struct dbc {
+    struct dbc_reg __iomem *dbc_reg;
+    struct xhci_dbc_ctx *dbc_ctx;
+    struct xhci_erst_segment *dbc_erst;
+    struct xhci_trb_ring dbc_ering;
+    struct xhci_trb_ring dbc_oring;
+    struct xhci_trb_ring dbc_iring;
+    struct dbc_work_ring dbc_owork;
+    struct xhci_string_descriptor *dbc_str;
+
+    pci_sbdf_t sbdf;
+    uint64_t xhc_mmio_phys;
+    uint64_t xhc_dbc_offset;
+    void __iomem *xhc_mmio;
+
+    bool open;
+};
+
+static void *dbc_sys_map_xhc(uint64_t phys, size_t size)
+{
+    size_t i;
+
+    if ( size != MAX_XHCI_PAGES * PAGE_SIZE )
+        return NULL;
+
+    for ( i = FIX_XHCI_END; i >= FIX_XHCI_BEGIN; i-- )
+    {
+        set_fixmap_nocache(i, phys);
+        phys += PAGE_SIZE;
+    }
+
+    /*
+     * The fixmap grows downward, so the lowest virt is
+     * at the highest index
+     */
+    return fix_to_virt(FIX_XHCI_END);
+}
+
+static bool __init dbc_init_xhc(struct dbc *dbc)
+{
+    uint32_t bar0;
+    uint64_t bar1;
+    uint64_t bar_val;
+    uint64_t bar_size;
+    uint64_t devfn;
+    uint16_t cmd;
+    size_t xhc_mmio_size;
+
+    /*
+     * Search PCI bus 0 for the xHC. All the host controllers supported so far
+     * are part of the chipset and are on bus 0.
+     */
+    for ( devfn = 0; devfn < 256; devfn++ )
+    {
+        pci_sbdf_t sbdf = PCI_SBDF(0, 0, devfn);
+        uint8_t hdr = pci_conf_read8(sbdf, PCI_HEADER_TYPE);
+
+        if ( hdr == 0 || hdr == 0x80 )
+        {
+            if ( (pci_conf_read32(sbdf, PCI_CLASS_REVISION) >> 8) == DBC_XHC_CLASSC )
+            {
+                dbc->sbdf = sbdf;
+                break;
+            }
+        }
+    }
+
+    if ( !dbc->sbdf.sbdf )
+    {
+        dbc_error("Compatible xHC not found on bus 0\n");
+        return false;
+    }
+
+    /* ...we found it, so parse the BAR and map the registers */
+    bar0 = pci_conf_read32(dbc->sbdf, PCI_BASE_ADDRESS_0);
+    bar1 = pci_conf_read32(dbc->sbdf, PCI_BASE_ADDRESS_1);
+
+    /* IO BARs not allowed; BAR must be 64-bit */
+    if ( (bar0 & PCI_BASE_ADDRESS_SPACE) != PCI_BASE_ADDRESS_SPACE_MEMORY ||
+         (bar0 & PCI_BASE_ADDRESS_MEM_TYPE_MASK) != PCI_BASE_ADDRESS_MEM_TYPE_64 )
+        return false;
+
+    bar_val = (bar1 << 32) | (bar0 & PCI_BASE_ADDRESS_MEM_MASK);
+    if ( !bar_val || !(bar_val + (bar_val & -bar_val)) )
+    {
+        dbc_error("firmware initialization of MMIO BAR required\n");
+        return false;
+    }
+
+    cmd = pci_conf_read16(dbc->sbdf, PCI_COMMAND);
+    pci_conf_write16(dbc->sbdf, PCI_COMMAND, cmd & ~PCI_COMMAND_MEMORY);
+
+    pci_conf_write32(dbc->sbdf, PCI_BASE_ADDRESS_0, 0xFFFFFFFF);
+    pci_conf_write32(dbc->sbdf, PCI_BASE_ADDRESS_1, 0xFFFFFFFF);
+    bar_size = pci_conf_read32(dbc->sbdf, PCI_BASE_ADDRESS_0);
+    bar_size |= (uint64_t)pci_conf_read32(dbc->sbdf, PCI_BASE_ADDRESS_1) << 32;
+    xhc_mmio_size = ~(bar_size & PCI_BASE_ADDRESS_MEM_MASK) + 1;
+    pci_conf_write32(dbc->sbdf, PCI_BASE_ADDRESS_0, bar0);
+    pci_conf_write32(dbc->sbdf, PCI_BASE_ADDRESS_1, bar1);
+
+    pci_conf_write16(dbc->sbdf, PCI_COMMAND, cmd);
+
+    dbc->xhc_mmio_phys = (bar0 & PCI_BASE_ADDRESS_MEM_MASK) | (bar1 << 32);
+    dbc->xhc_mmio = dbc_sys_map_xhc(dbc->xhc_mmio_phys, xhc_mmio_size);
+
+    if ( dbc->xhc_mmio == NULL )
+        return false;
+
+    if ( (cmd & PCI_COMMAND_MEMORY) == 0 )
+        pci_conf_write16(dbc->sbdf, PCI_COMMAND, cmd | PCI_COMMAND_MEMORY);
+
+    return true;
+}
+
+/**
+ * The first register of the debug capability is found by traversing the
+ * host controller's capability list (xcap) until a capability
+ * with ID = 0xA is found. The xHCI capability list begins at address
+ * mmio + (HCCPARAMS1[31:16] << 2).
+ */
+static struct dbc_reg __iomem *xhci_find_dbc(struct dbc *dbc)
+{
+    const uint32_t __iomem *xcap;
+    uint32_t xcap_val;
+    uint32_t next;
+    uint32_t id = 0;
+    const void __iomem *mmio = dbc->xhc_mmio;
+    const uint32_t __iomem *hccp1 = mmio + 0x10;
+    const uint32_t DBC_ID = 0xA;
+    int ttl = 48;
+
+    xcap = mmio;
+    /*
+     * This is initially an offset to the first capability. All the offsets
+     * (both in HCCP1 and then next capability pointer) are dword-based.
+     */
+    next = (readl(hccp1) & 0xFFFF0000) >> 16;
+
+    while ( id != DBC_ID && next && ttl-- )
+    {
+        xcap += next;
+        xcap_val = readl(xcap);
+        id = xcap_val & 0xFF;
+        next = (xcap_val & 0xFF00) >> 8;
+    }
+
+    if ( id != DBC_ID )
+        return NULL;
+
+    dbc->xhc_dbc_offset = (uint64_t)xcap - (uint64_t)mmio;
+    return (struct dbc_reg __iomem *)xcap;
+}
+
+/**
+ * Fields with the same interpretation for every TRB type (section 4.11.1).
+ * These are the fields defined in the TRB template, minus the ENT bit. That
+ * bit is the toggle cycle bit in link TRBs, so it shouldn't be in the
+ * template.
+ */
+static uint32_t xhci_trb_cyc(const struct xhci_trb *trb)
+{
+    return trb->ctrl & 0x1;
+}
+
+static uint32_t xhci_trb_type(const struct xhci_trb *trb)
+{
+    return (trb->ctrl & 0xFC00) >> 10;
+}
+
+static void xhci_trb_set_cyc(struct xhci_trb *trb, uint32_t c)
+{
+    trb->ctrl &= ~0x1U;
+    trb->ctrl |= c;
+}
+
+static void xhci_trb_set_type(struct xhci_trb *trb, uint32_t t)
+{
+    trb->ctrl &= ~0xFC00U;
+    trb->ctrl |= (t << 10);
+}
+
+/* Fields for normal TRBs */
+static void xhci_trb_norm_set_buf(struct xhci_trb *trb, uint64_t addr)
+{
+    trb->params = addr;
+}
+
+static void xhci_trb_norm_set_len(struct xhci_trb *trb, uint32_t len)
+{
+    trb->status &= ~0x1FFFFU;
+    trb->status |= len;
+}
+
+static void xhci_trb_norm_set_ioc(struct xhci_trb *trb)
+{
+    trb->ctrl |= 0x20;
+}
+
+/**
+ * Fields for Transfer Event TRBs (see section 6.4.2.1). Note that event
+ * TRBs are read-only from software
+ */
+static uint64_t xhci_trb_tfre_ptr(const struct xhci_trb *trb)
+{
+    return trb->params;
+}
+
+/* Fields for link TRBs (section 6.4.4.1) */
+static void xhci_trb_link_set_rsp(struct xhci_trb *trb, uint64_t rsp)
+{
+    trb->params = rsp;
+}
+
+static void xhci_trb_link_set_tc(struct xhci_trb *trb)
+{
+    trb->ctrl |= 0x2;
+}
+
+static void xhci_trb_ring_init(const struct dbc *dbc,
+                              struct xhci_trb_ring *ring, int producer,
+                              int doorbell)
+{
+    memset(ring->trb, 0, DBC_TRB_RING_CAP * sizeof(ring->trb[0]));
+
+    ring->enq = 0;
+    ring->deq = 0;
+    ring->cyc = 1;
+    ring->db = (uint8_t)doorbell;
+    ring->dma = virt_to_maddr(ring->trb);
+
+    /*
+     * Producer implies transfer ring, so we have to place a
+     * link TRB at the end that points back to trb[0]
+     */
+    if ( producer )
+    {
+        struct xhci_trb *trb = &ring->trb[DBC_TRB_RING_CAP - 1];
+        xhci_trb_set_type(trb, XHCI_TRB_LINK);
+        xhci_trb_link_set_tc(trb);
+        xhci_trb_link_set_rsp(trb, virt_to_maddr(ring->trb));
+    }
+}
+
+static bool xhci_trb_ring_full(const struct xhci_trb_ring *ring)
+{
+    return ((ring->enq + 1) & (DBC_TRB_RING_CAP - 1)) == ring->deq;
+}
+
+static bool dbc_work_ring_full(const struct dbc_work_ring *ring)
+{
+    return ((ring->enq + 1) & (DBC_WORK_RING_CAP - 1)) == ring->deq;
+}
+
+static unsigned int dbc_work_ring_size(const struct dbc_work_ring *ring)
+{
+    if ( ring->enq >= ring->deq )
+        return ring->enq - ring->deq;
+
+    return DBC_WORK_RING_CAP - ring->deq + ring->enq;
+}
+
+static void dbc_push_trb(struct dbc *dbc, struct xhci_trb_ring *ring,
+                         uint64_t dma, uint64_t len)
+{
+    struct xhci_trb trb;
+
+    if ( ring->enq == DBC_TRB_RING_CAP - 1 )
+    {
+        /*
+         * We have to make sure the xHC processes the link TRB in order
+         * for wrap-around to work properly. We do this by marking the
+         * xHC as owner of the link TRB by setting the TRB's cycle bit
+         * (just like with normal TRBs).
+         */
+        struct xhci_trb *link = &ring->trb[ring->enq];
+        xhci_trb_set_cyc(link, ring->cyc);
+
+        ring->enq = 0;
+        ring->cyc ^= 1;
+    }
+
+    trb.params = 0;
+    trb.status = 0;
+    trb.ctrl = 0;
+
+    xhci_trb_set_type(&trb, XHCI_TRB_NORM);
+    xhci_trb_set_cyc(&trb, ring->cyc);
+
+    xhci_trb_norm_set_buf(&trb, dma);
+    xhci_trb_norm_set_len(&trb, (uint32_t)len);
+    xhci_trb_norm_set_ioc(&trb);
+
+    ring->trb[ring->enq++] = trb;
+    cache_flush(&ring->trb[ring->enq - 1], sizeof(trb));
+}
+
+static unsigned int dbc_push_work(struct dbc *dbc, struct dbc_work_ring *ring,
+                             const char *buf, unsigned int len)
+{
+    unsigned int i = 0;
+    unsigned int end, start = ring->enq;
+
+    while ( !dbc_work_ring_full(ring) && i < len )
+    {
+        ring->buf[ring->enq] = buf[i++];
+        ring->enq = (ring->enq + 1) & (DBC_WORK_RING_CAP - 1);
+    }
+
+    end = ring->enq;
+
+    if ( end > start )
+        cache_flush(&ring->buf[start], end - start);
+    else if ( i > 0 )
+    {
+        cache_flush(&ring->buf[start], DBC_WORK_RING_CAP - start);
+        cache_flush(&ring->buf[0], end);
+    }
+
+    return i;
+}
+
+/*
+ * Note that if IN transfer support is added, then this
+ * will need to be changed; it assumes an OUT transfer ring only
+ */
+static void dbc_pop_events(struct dbc *dbc)
+{
+    struct dbc_reg *reg = dbc->dbc_reg;
+    struct xhci_trb_ring *er = &dbc->dbc_ering;
+    struct xhci_trb_ring *tr = &dbc->dbc_oring;
+    struct xhci_trb *event = &er->trb[er->deq];
+    uint64_t erdp = readq(&reg->erdp);
+    uint32_t portsc;
+    uint64_t event_ptr;
+    unsigned int trb_idx;
+
+    BUILD_BUG_ON((1 << XHCI_TRB_SHIFT) != sizeof(struct xhci_trb));
+
+    rmb();
+
+    while ( xhci_trb_cyc(event) == er->cyc )
+    {
+        switch (xhci_trb_type(event))
+        {
+        case XHCI_TRB_TFRE:
+            event_ptr = xhci_trb_tfre_ptr(event);
+            /*
+             * trb_idx is just completed TRB, so set the dequeue ptr one
+             * position further.
+             */
+            if ( event_ptr - tr->dma < DBC_TRB_RING_BYTES )
+            {
+                trb_idx = (event_ptr - tr->dma) >> XHCI_TRB_SHIFT;
+                tr->deq = (trb_idx + 1) & (DBC_TRB_RING_CAP - 1);
+            }
+            else
+                dbc_alert("event: TRB 0x%lx not found in any ring\n",
+                          event_ptr);
+            break;
+        case XHCI_TRB_PSCE:
+            portsc = readl(&reg->portsc);
+            portsc |= DBC_PSC_ACK_MASK & portsc;
+            writel(portsc, &reg->portsc);
+            break;
+        default:
+            break;
+        }
+
+        er->cyc = (er->deq == DBC_TRB_RING_CAP - 1) ? er->cyc ^ 1 : er->cyc;
+        er->deq = (er->deq + 1) & (DBC_TRB_RING_CAP - 1);
+        event = &er->trb[er->deq];
+    }
+
+    erdp = er->dma + (er->deq << XHCI_TRB_SHIFT);
+    wmb();
+    writeq(erdp, &reg->erdp);
+}
+
+/**
+ * dbc_init_ep
+ *
+ * Initializes the endpoint as specified in sections 7.6.3.2 and 7.6.9.2.
+ * Each endpoint is Bulk, so the MaxPStreams, LSA, HID, CErr, FE,
+ * Interval, Mult, and Max ESIT Payload fields are all 0.
+ *
+ * Max packet size: 1024
+ * Max burst size: debug mbs (from dbc_reg->ctrl register)
+ * EP type: 2 for OUT bulk, 6 for IN bulk
+ * TR dequeue ptr: physical base address of transfer ring
+ * Avg TRB length: software defined (see 4.14.1.1 for suggested defaults)
+ */
+static void dbc_init_ep(uint32_t *ep, uint64_t mbs, uint32_t type,
+                        uint64_t ring_dma)
+{
+    memset(ep, 0, DBC_CTX_BYTES);
+
+    ep[1] = (1024 << 16) | ((uint32_t)mbs << 8) | (type << 3);
+    ep[2] = (ring_dma & 0xFFFFFFFF) | 1;
+    ep[3] = ring_dma >> 32;
+    ep[4] = 3 * 1024;
+}
+
+static void dbc_init_string_single(struct xhci_string_descriptor *string,
+                                   const char *ascii_str,
+                                   uint64_t *str_ptr,
+                                   uint8_t *str_size_ptr)
+{
+    size_t i, len = strlen(ascii_str);
+
+    string->size = offsetof(typeof(*string), string) + len * 2;
+    string->type = XHCI_DT_STRING;
+    /* ASCII to UTF16 conversion */
+    for ( i = 0; i < len; i++ )
+        string->string[i] = ascii_str[i];
+    *str_ptr = virt_to_maddr(string);
+    *str_size_ptr = string->size;
+}
+
+/* Initialize the DbC info with USB string descriptor addresses */
+static void dbc_init_strings(struct dbc *dbc, uint32_t *info)
+{
+    BUILD_BUG_ON(sizeof(DBC_STRING_LANGID) > MAX_STRING_LENGTH);
+    BUILD_BUG_ON(sizeof(DBC_STRING_MANUFACTURER) > MAX_STRING_LENGTH);
+    BUILD_BUG_ON(sizeof(DBC_STRING_PRODUCT) > MAX_STRING_LENGTH);
+    BUILD_BUG_ON(sizeof(DBC_STRING_SERIAL) > MAX_STRING_LENGTH);
+
+    dbc_init_string_single(&dbc->dbc_str[0], DBC_STRING_LANGID,
+                           &dbc->dbc_ctx->string0_ptr,
+                           &dbc->dbc_ctx->string0_size);
+    dbc_init_string_single(&dbc->dbc_str[1], DBC_STRING_MANUFACTURER,
+                           &dbc->dbc_ctx->manufacturer_ptr,
+                           &dbc->dbc_ctx->manufacturer_size);
+    dbc_init_string_single(&dbc->dbc_str[2], DBC_STRING_PRODUCT,
+                           &dbc->dbc_ctx->product_ptr,
+                           &dbc->dbc_ctx->product_size);
+    dbc_init_string_single(&dbc->dbc_str[3], DBC_STRING_SERIAL,
+                           &dbc->dbc_ctx->serial_ptr,
+                           &dbc->dbc_ctx->serial_size);
+}
+
+static void dbc_enable_dbc(struct dbc *dbc)
+{
+    struct dbc_reg *reg = dbc->dbc_reg;
+
+    wmb();
+    writel(readl(&reg->ctrl) | (1U << DBC_CTRL_DCE), &reg->ctrl);
+    wmb();
+
+    while ( (readl(&reg->ctrl) & (1U << DBC_CTRL_DCE)) == 0 )
+        cpu_relax();
+
+    wmb();
+    writel(readl(&reg->portsc) | (1U << DBC_PSC_PED), &reg->portsc);
+    wmb();
+
+    while ( (readl(&reg->ctrl) & (1U << DBC_CTRL_DCR)) == 0 )
+        cpu_relax();
+}
+
+static void dbc_disable_dbc(struct dbc *dbc)
+{
+    struct dbc_reg *reg = dbc->dbc_reg;
+
+    writel(readl(&reg->portsc) & ~(1U << DBC_PSC_PED), &reg->portsc);
+    wmb();
+    writel(readl(&reg->ctrl) & ~(1U << DBC_CTRL_DCE), &reg->ctrl);
+
+    while ( readl(&reg->ctrl) & (1U << DBC_CTRL_DCE) )
+        cpu_relax();
+}
+
+static int dbc_init_dbc(struct dbc *dbc)
+{
+    uint64_t erdp = 0;
+    uint64_t mbs = 0;
+    uint16_t cmd;
+    struct dbc_reg *reg = xhci_find_dbc(dbc);
+
+    if ( !reg )
+        return 0;
+
+    dbc->dbc_reg = reg;
+    dbc_disable_dbc(dbc);
+
+    xhci_trb_ring_init(dbc, &dbc->dbc_ering, 0, DBC_DB_INVAL);
+    xhci_trb_ring_init(dbc, &dbc->dbc_oring, 1, DBC_DB_OUT);
+    xhci_trb_ring_init(dbc, &dbc->dbc_iring, 1, DBC_DB_IN);
+
+    erdp = virt_to_maddr(dbc->dbc_ering.trb);
+    if ( !erdp )
+        return 0;
+
+    memset(dbc->dbc_erst, 0, sizeof(*dbc->dbc_erst));
+    dbc->dbc_erst->base = erdp;
+    dbc->dbc_erst->size = DBC_TRB_RING_CAP;
+
+    mbs = (readl(&reg->ctrl) & 0xFF0000) >> 16;
+
+    memset(dbc->dbc_ctx, 0, sizeof(*dbc->dbc_ctx));
+    dbc_init_strings(dbc, dbc->dbc_ctx->info);
+    dbc_init_ep(dbc->dbc_ctx->ep_out, mbs, XHCI_EP_BULK_OUT,
+                dbc->dbc_oring.dma);
+    dbc_init_ep(dbc->dbc_ctx->ep_in, mbs, XHCI_EP_BULK_IN,
+                dbc->dbc_iring.dma);
+
+    writel(1, &reg->erstsz);
+    writeq(virt_to_maddr(dbc->dbc_erst), &reg->erstba);
+    writeq(erdp, &reg->erdp);
+    writeq(virt_to_maddr(dbc->dbc_ctx), &reg->cp);
+    writel((DBC_DBC_VENDOR << 16) | DBC_DBC_PROTOCOL, &reg->ddi1);
+    writel(DBC_DBC_PRODUCT, &reg->ddi2);
+
+    cache_flush(dbc->dbc_ctx, sizeof(*dbc->dbc_ctx));
+    cache_flush(dbc->dbc_erst, sizeof(*dbc->dbc_erst));
+    cache_flush(dbc->dbc_ering.trb, DBC_TRB_RING_BYTES);
+    cache_flush(dbc->dbc_oring.trb, DBC_TRB_RING_BYTES);
+    cache_flush(dbc->dbc_iring.trb, DBC_TRB_RING_BYTES);
+    cache_flush(dbc->dbc_owork.buf, DBC_WORK_RING_BYTES);
+
+    cmd = pci_conf_read16(dbc->sbdf, PCI_COMMAND);
+    pci_conf_write16(dbc->sbdf, PCI_COMMAND, cmd | PCI_COMMAND_MASTER);
+
+    return 1;
+}
+
+static void dbc_init_work_ring(struct dbc *dbc,
+                               struct dbc_work_ring *wrk)
+{
+    wrk->enq = 0;
+    wrk->deq = 0;
+    wrk->dma = virt_to_maddr(wrk->buf);
+}
+
+/**
+ * Initialize the DbC and enable it for transfers. First map in the DbC
+ * registers from the host controller's MMIO region. Then allocate and map
+ * DMA for the event and transfer rings. Finally, enable the DbC for
+ * the host to enumerate. On success, the DbC is ready to send packets.
+ *
+ * @param dbc the dbc to open (!= NULL)
+ * @return true iff dbc_open succeeded
+ */
+static bool __init dbc_open(struct dbc *dbc)
+{
+    if ( !dbc )
+        return false;
+
+    if ( !dbc_init_xhc(dbc) )
+        return false;
+
+    if ( !dbc_init_dbc(dbc) )
+        return false;
+
+    dbc_init_work_ring(dbc, &dbc->dbc_owork);
+    dbc_enable_dbc(dbc);
+    dbc->open = true;
+
+    return true;
+}
+
+/*
+ * Ensure DbC is still running, handle events, and possibly re-enable if cable
+ * was re-plugged. Returns true if DbC is operational.
+ */
+static bool dbc_ensure_running(struct dbc *dbc)
+{
+    struct dbc_reg *reg = dbc->dbc_reg;
+    uint32_t ctrl;
+
+    dbc_pop_events(dbc);
+
+    ctrl = readl(&reg->ctrl);
+    if ( !(ctrl & (1U << DBC_CTRL_DCR)) )
+    {
+        return false;
+    }
+
+    if ( ctrl & (1U << DBC_CTRL_DRC) )
+    {
+        writel(ctrl | (1U << DBC_CTRL_DRC), &reg->ctrl);
+        writel(readl(&reg->portsc) | (1U << DBC_PSC_PED), &reg->portsc);
+        wmb();
+    }
+
+    return true;
+}
+
+/**
+ * Commit the pending transfer TRBs to the DbC. This notifies
+ * the DbC of any previously-queued data on the work ring and
+ * rings the doorbell.
+ *
+ * @param dbc the dbc to flush
+ * @param trb the ring containing the TRBs to transfer
+ * @param wrk the work ring containing data to be flushed
+ */
+static void dbc_flush(struct dbc *dbc, struct xhci_trb_ring *trb,
+                      struct dbc_work_ring *wrk)
+{
+    struct dbc_reg *reg = dbc->dbc_reg;
+    uint32_t db = (readl(&reg->db) & ~DBC_DOORBELL_TARGET_MASK) |
+                  (trb->db << DBC_DOORBELL_TARGET_SHIFT);
+
+    if ( xhci_trb_ring_full(trb) )
+        return;
+
+    if ( wrk->enq == wrk->deq )
+        return;
+    else if ( wrk->enq > wrk->deq )
+    {
+        dbc_push_trb(dbc, trb, wrk->dma + wrk->deq, wrk->enq - wrk->deq);
+        wrk->deq = wrk->enq;
+    }
+    else
+    {
+        dbc_push_trb(dbc, trb, wrk->dma + wrk->deq,
+                     DBC_WORK_RING_CAP - wrk->deq);
+        wrk->deq = 0;
+        if ( wrk->enq > 0 && !xhci_trb_ring_full(trb) )
+        {
+            dbc_push_trb(dbc, trb, wrk->dma, wrk->enq);
+            wrk->deq = wrk->enq;
+        }
+    }
+
+    wmb();
+    writel(db, &reg->db);
+}
+
+/**
+ * Queue a single character to the DbC. A transfer TRB will be created
+ * if the character is a newline and the DbC will be notified that data is
+ * available for writing to the debug host.
+ *
+ * @param dbc the dbc to write to
+ * @param c the character to write
+ * @return the number of bytes written
+ */
+static int64_t dbc_putc(struct dbc *dbc, char c)
+{
+    if ( !dbc_push_work(dbc, &dbc->dbc_owork, &c, 1) )
+        return 0;
+
+    if ( !dbc_ensure_running(dbc) )
+        return 1;
+
+    if ( c == '\n' )
+        dbc_flush(dbc, &dbc->dbc_oring, &dbc->dbc_owork);
+
+    return 1;
+}
+
+struct dbc_uart {
+    struct dbc dbc;
+    struct timer timer;
+    spinlock_t *lock;
+};
+
+static struct dbc_uart dbc_uart;
+
+static void cf_check dbc_uart_poll(void *data)
+{
+    struct serial_port *port = data;
+    struct dbc_uart *uart = port->uart;
+    struct dbc *dbc = &uart->dbc;
+    unsigned long flags = 0;
+
+    if ( spin_trylock_irqsave(&port->tx_lock, flags) )
+    {
+        if ( dbc_ensure_running(dbc) )
+            dbc_flush(dbc, &dbc->dbc_oring, &dbc->dbc_owork);
+        spin_unlock_irqrestore(&port->tx_lock, flags);
+    }
+
+    serial_tx_interrupt(port, guest_cpu_user_regs());
+    set_timer(&uart->timer, NOW() + MICROSECS(DBC_POLL_INTERVAL));
+}
+
+static void __init cf_check dbc_uart_init_preirq(struct serial_port *port)
+{
+    struct dbc_uart *uart = port->uart;
+    uart->lock = &port->tx_lock;
+}
+
+static void __init cf_check dbc_uart_init_postirq(struct serial_port *port)
+{
+    struct dbc_uart *uart = port->uart;
+
+    serial_async_transmit(port);
+    init_timer(&uart->timer, dbc_uart_poll, port, 0);
+    set_timer(&uart->timer, NOW() + MILLISECS(1));
+
+    if ( pci_ro_device(0, uart->dbc.sbdf.bus, uart->dbc.sbdf.devfn) )
+        printk(XENLOG_WARNING
+               "Failed to mark read-only %pp used for XHCI console\n",
+               &uart->dbc.sbdf);
+}
+
+static int cf_check dbc_uart_tx_ready(struct serial_port *port)
+{
+    struct dbc_uart *uart = port->uart;
+    struct dbc *dbc = &uart->dbc;
+
+    return DBC_WORK_RING_CAP - dbc_work_ring_size(&dbc->dbc_owork);
+}
+
+static void cf_check dbc_uart_putc(struct serial_port *port, char c)
+{
+    struct dbc_uart *uart = port->uart;
+    dbc_putc(&uart->dbc, c);
+}
+
+static void cf_check dbc_uart_flush(struct serial_port *port)
+{
+    s_time_t goal;
+    struct dbc_uart *uart = port->uart;
+    struct dbc *dbc = &uart->dbc;
+
+    if ( dbc_ensure_running(dbc) )
+        dbc_flush(dbc, &dbc->dbc_oring, &dbc->dbc_owork);
+
+    goal = NOW() + MICROSECS(DBC_POLL_INTERVAL);
+    if ( uart->timer.expires > goal )
+        set_timer(&uart->timer, goal);
+}
+
+static struct uart_driver dbc_uart_driver = {
+    .init_preirq = dbc_uart_init_preirq,
+    .init_postirq = dbc_uart_init_postirq,
+    .tx_ready = dbc_uart_tx_ready,
+    .putc = dbc_uart_putc,
+    .flush = dbc_uart_flush,
+};
+
+/* Those are accessed via DMA. */
+static struct xhci_trb evt_trb[DBC_TRB_RING_CAP];
+static struct xhci_trb out_trb[DBC_TRB_RING_CAP];
+static struct xhci_trb in_trb[DBC_TRB_RING_CAP];
+static struct xhci_erst_segment erst __aligned(16);
+static struct xhci_dbc_ctx ctx __aligned(16);
+static uint8_t out_wrk_buf[DBC_WORK_RING_CAP];
+static struct xhci_string_descriptor str_buf[DBC_STRINGS_COUNT];
+
+static char __initdata opt_dbgp[30];
+
+string_param("dbgp", opt_dbgp);
+
+void __init xhci_dbc_uart_init(void)
+{
+    struct dbc_uart *uart = &dbc_uart;
+    struct dbc *dbc = &uart->dbc;
+
+    if ( strncmp(opt_dbgp, "xhci", 4) )
+        return;
+
+    memset(dbc, 0, sizeof(*dbc));
+
+    dbc->dbc_ctx = &ctx;
+    dbc->dbc_erst = &erst;
+    dbc->dbc_ering.trb = evt_trb;
+    dbc->dbc_oring.trb = out_trb;
+    dbc->dbc_iring.trb = in_trb;
+    dbc->dbc_owork.buf = out_wrk_buf;
+    dbc->dbc_str = str_buf;
+
+    if ( dbc_open(dbc) )
+        serial_register_uart(SERHND_DBGP, &dbc_uart_driver, &dbc_uart);
+}
+
+#ifdef DBC_DEBUG
+static void dbc_dump(struct dbc *dbc)
+{
+    struct dbc_reg *r = dbc->dbc_reg;
+
+    dbc_debug("XHCI DBC DUMP:\n");
+    dbc_debug("    ctrl: 0x%x stat: 0x%x psc: 0x%x\n",
+              readl(&r->ctrl), readl(&r->st), readl(&r->portsc));
+    dbc_debug("    id: 0x%x, db: 0x%x\n",
+              readl(&r->id), readl(&r->db));
+    dbc_debug("    erstsz: %u, erstba: 0x%lx\n",
+              readl(&r->erstsz), readq(&r->erstba));
+    dbc_debug("    erdp: 0x%lx, cp: 0x%lx\n",
+              readq(&r->erdp), readq(&r->cp));
+    dbc_debug("    ddi1: 0x%x, ddi2: 0x%x\n",
+              readl(&r->ddi1), readl(&r->ddi2));
+    dbc_debug("    erstba == virt_to_dma(erst): %d\n",
+              readq(&r->erstba) == virt_to_maddr(dbc->dbc_erst));
+    dbc_debug("    erdp == virt_to_dma(erst[0].base): %d\n",
+              readq(&r->erdp) == dbc->dbc_erst[0].base);
+    dbc_debug("    cp == virt_to_dma(ctx): %d\n",
+              readq(&r->cp) == virt_to_maddr(dbc->dbc_ctx));
+}
+
+static void dbc_uart_dump(void)
+{
+    struct dbc_uart *uart = &dbc_uart;
+    struct dbc *dbc = &uart->dbc;
+
+    dbc_dump(dbc);
+}
+#endif
diff --git a/xen/include/xen/serial.h b/xen/include/xen/serial.h
index 6548f0b0a9..181e026967 100644
--- a/xen/include/xen/serial.h
+++ b/xen/include/xen/serial.h
@@ -171,6 +171,11 @@ struct ns16550_defaults {
 };
 void ns16550_init(int index, struct ns16550_defaults *defaults);
 void ehci_dbgp_init(void);
+#ifdef CONFIG_XHCI
+void xhci_dbc_uart_init(void);
+#else
+static void inline xhci_dbc_uart_init(void) {};
+#endif
 
 void arm_uart_init(void);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Aug 16 09:33:25 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 16 Aug 2022 09:33:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.388137.624716 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNswu-0007UK-WA; Tue, 16 Aug 2022 09:33:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 388137.624716; Tue, 16 Aug 2022 09:33:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNswu-0007UC-Tg; Tue, 16 Aug 2022 09:33:24 +0000
Received: by outflank-mailman (input) for mailman id 388137;
 Tue, 16 Aug 2022 09:33:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNswu-0007Tl-9c
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 09:33:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNswu-0002Sk-8q
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 09:33:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNswu-00033N-82
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 09:33:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=++2gtL9UDOfC3fGlnP7Fj572U+WMj5QljhWrZnXeaPU=; b=RGq+mucebPuV61KwlmrG28drJp
	d06b5Y86i+i2AXp68YYnFR91dC0hAdDdXDL6ItnwhpTjRPy6nOVjs9PSQ/wTgRsBZaZ8I9uSFPG/f
	i7+zLh8++VW9KsL+FWZ6fB7BocAd3XjNS1pwUFjtG2gnfy4xg4BeTAmXoT2VEH/DEN1s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] drivers/char: reset XHCI ports when initializing dbc
Message-Id: <E1oNswu-00033N-82@xenbits.xenproject.org>
Date: Tue, 16 Aug 2022 09:33:24 +0000

commit 3a669ea835f5100b7945da7b89d461883e3add01
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Tue Aug 16 11:22:18 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 16 11:22:18 2022 +0200

    drivers/char: reset XHCI ports when initializing dbc
    
    Reset ports, to force host system to re-enumerate devices. Otheriwse it
    will require the cable to be re-plugged, or will wait in the
    "configuring" state indefinitely.
    
    Trick and code copied from Linux:
    drivers/usb/early/xhci-dbc.c:xdbc_start()->xdbc_reset_debug_port()
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/char/xhci-dbc.c | 75 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 75 insertions(+)

diff --git a/xen/drivers/char/xhci-dbc.c b/xen/drivers/char/xhci-dbc.c
index a16c81b9e7..8c9dfa6cfc 100644
--- a/xen/drivers/char/xhci-dbc.c
+++ b/xen/drivers/char/xhci-dbc.c
@@ -66,6 +66,10 @@
     ((1UL << DBC_PSC_CSC) | (1UL << DBC_PSC_PRC) | (1UL << DBC_PSC_PLC) |      \
      (1UL << DBC_PSC_CEC))
 
+#define XHC_EXT_PORT_MAJOR(x)  (((x) >> 24) & 0xff)
+#define PORT_RESET             (1 << 4)
+#define PORT_CONNECT           (1 << 0)
+
 #define dbc_debug(...) printk("dbc debug: " __VA_ARGS__)
 #define dbc_alert(...) printk("dbc alert: " __VA_ARGS__)
 #define dbc_error(...) printk("dbc error: " __VA_ARGS__)
@@ -666,6 +670,73 @@ static void dbc_init_strings(struct dbc *dbc, uint32_t *info)
                            &dbc->dbc_ctx->serial_size);
 }
 
+static void dbc_do_reset_debug_port(struct dbc *dbc,
+                                    unsigned int id, unsigned int count)
+{
+    uint32_t __iomem *ops_reg;
+    uint32_t __iomem *portsc;
+    uint32_t val, cap_length;
+    unsigned int i;
+
+    cap_length = readl(dbc->xhc_mmio) & 0xff;
+    ops_reg = dbc->xhc_mmio + cap_length;
+
+    id--;
+    for ( i = id; i < (id + count); i++ )
+    {
+        portsc = ops_reg + 0x100 + i * 0x4;
+        val = readl(portsc);
+        if ( !(val & PORT_CONNECT) )
+            writel(val | PORT_RESET, portsc);
+    }
+}
+
+static void dbc_reset_debug_port(struct dbc *dbc)
+{
+    uint32_t val, port_offset, port_count;
+    uint32_t __iomem *xcap;
+    uint32_t xcap_val;
+    uint32_t next;
+    uint32_t id;
+    uint8_t __iomem *mmio = (uint8_t *)dbc->xhc_mmio;
+    uint32_t __iomem *hccp1 = (uint32_t *)(mmio + 0x10);
+    const uint32_t PROTOCOL_ID = 0x2;
+    int ttl = 48;
+
+    xcap = (uint32_t *)dbc->xhc_mmio;
+    /*
+     * This is initially an offset to the first capability. All the offsets
+     * (both in HCCP1 and then next capability pointer are dword-based.
+     */
+    next = (readl(hccp1) & 0xFFFF0000) >> 16;
+
+    /*
+     * Look for "supported protocol" capability, major revision 3.
+     * There may be multiple of them.
+     */
+    while ( next && ttl-- )
+    {
+        xcap += next;
+        xcap_val = readl(xcap);
+        id = xcap_val & 0xFF;
+        next = (xcap_val & 0xFF00) >> 8;
+
+        if ( id != PROTOCOL_ID )
+            continue;
+
+        if ( XHC_EXT_PORT_MAJOR(xcap_val) != 0x3 )
+            continue;
+
+        /* extract ports offset and count from the capability structure */
+        val = readl(xcap + 2);
+        port_offset = val & 0xff;
+        port_count = (val >> 8) & 0xff;
+
+        /* and reset them all */
+        dbc_do_reset_debug_port(dbc, port_offset, port_count);
+    }
+}
+
 static void dbc_enable_dbc(struct dbc *dbc)
 {
     struct dbc_reg *reg = dbc->dbc_reg;
@@ -677,6 +748,10 @@ static void dbc_enable_dbc(struct dbc *dbc)
     while ( (readl(&reg->ctrl) & (1U << DBC_CTRL_DCE)) == 0 )
         cpu_relax();
 
+    /* reset ports on initial open, to force re-enumerating by the host */
+    if ( !dbc->open )
+        dbc_reset_debug_port(dbc);
+
     wmb();
     writel(readl(&reg->portsc) | (1U << DBC_PSC_PED), &reg->portsc);
     wmb();
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Aug 16 09:33:35 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 16 Aug 2022 09:33:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.388138.624721 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNsx5-0007XP-1n; Tue, 16 Aug 2022 09:33:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 388138.624721; Tue, 16 Aug 2022 09:33: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 1oNsx4-0007XH-VD; Tue, 16 Aug 2022 09:33:34 +0000
Received: by outflank-mailman (input) for mailman id 388138;
 Tue, 16 Aug 2022 09:33:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNsx4-0007X5-Dy
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 09:33:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNsx4-0002Su-DH
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 09:33:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNsx4-00033o-BB
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 09:33:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7PKw5d4/WOpvjEZeXPG08cjBSrI4+77eM3Wu3FO6Uw8=; b=QVuYGOXXcoogmepdaU94OuBW/s
	HsSwUs4/cWuOJywOvxaenFWCTX00kfbWM35u2sjHw6zex3PeKXCuS+5ahWYj4jK5Ht1dVQIM2YHDC
	5oIQqjguOoxDi/NwpMmCFG/iJ7E2rlAnjk74UoJnHtYFefedL3VLv6b/NfVvc3adSNbA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] drivers/char: add support for selecting specific xhci
Message-Id: <E1oNsx4-00033o-BB@xenbits.xenproject.org>
Date: Tue, 16 Aug 2022 09:33:34 +0000

commit deb23751e11a559ca9b9b4c2dc355e2f5250c0d2
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Tue Aug 16 11:22:54 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 16 11:22:54 2022 +0200

    drivers/char: add support for selecting specific xhci
    
    Handle parameters similar to dbgp=ehci.
    
    Implement this by not resettting dbc->sbdf again in dbc_init_xhc(), but
    using a value found there if non-zero. Additionally, add xue->xhc_num to
    select n-th controller.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 docs/misc/xen-command-line.pandoc |  2 +-
 xen/drivers/char/xhci-dbc.c       | 59 +++++++++++++++++++++++++++++++--------
 2 files changed, 48 insertions(+), 13 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index cbfd163813..9a79385a37 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -721,7 +721,7 @@ Available alternatives, with their meaning, are:
 
 ### dbgp
 > `= ehci[ <integer> | @pci<bus>:<slot>.<func> ]`
-> `= xhci`
+> `= xhci[ <integer> | @pci<bus>:<slot>.<func> ]`
 
 Specify the USB controller to use, either by instance number (when going
 over the PCI busses sequentially) or by PCI device (must be on segment 0).
diff --git a/xen/drivers/char/xhci-dbc.c b/xen/drivers/char/xhci-dbc.c
index 8c9dfa6cfc..ca7d4a6213 100644
--- a/xen/drivers/char/xhci-dbc.c
+++ b/xen/drivers/char/xhci-dbc.c
@@ -246,6 +246,7 @@ struct dbc {
     void __iomem *xhc_mmio;
 
     bool open;
+    unsigned int xhc_num; /* look for n-th xhc */
 };
 
 static void *dbc_sys_map_xhc(uint64_t phys, size_t size)
@@ -278,24 +279,37 @@ static bool __init dbc_init_xhc(struct dbc *dbc)
     uint16_t cmd;
     size_t xhc_mmio_size;
 
-    /*
-     * Search PCI bus 0 for the xHC. All the host controllers supported so far
-     * are part of the chipset and are on bus 0.
-     */
-    for ( devfn = 0; devfn < 256; devfn++ )
+    if ( dbc->sbdf.sbdf == 0 )
     {
-        pci_sbdf_t sbdf = PCI_SBDF(0, 0, devfn);
-        uint8_t hdr = pci_conf_read8(sbdf, PCI_HEADER_TYPE);
-
-        if ( hdr == 0 || hdr == 0x80 )
+        /*
+         * Search PCI bus 0 for the xHC. All the host controllers supported so
+         * far are part of the chipset and are on bus 0.
+         */
+        for ( devfn = 0; devfn < 256; devfn++ )
         {
-            if ( (pci_conf_read32(sbdf, PCI_CLASS_REVISION) >> 8) == DBC_XHC_CLASSC )
+            pci_sbdf_t sbdf = PCI_SBDF(0, 0, devfn);
+            uint8_t hdr = pci_conf_read8(sbdf, PCI_HEADER_TYPE);
+
+            if ( hdr == 0 || hdr == 0x80 )
             {
-                dbc->sbdf = sbdf;
-                break;
+                if ( (pci_conf_read32(sbdf, PCI_CLASS_REVISION) >> 8) ==
+                     DBC_XHC_CLASSC )
+                {
+                    if ( dbc->xhc_num-- )
+                        continue;
+                    dbc->sbdf = sbdf;
+                    break;
+                }
             }
         }
     }
+    else
+    {
+        /* Verify if selected device is really xHC */
+        if ( (pci_conf_read32(dbc->sbdf, PCI_CLASS_REVISION) >> 8) !=
+             DBC_XHC_CLASSC )
+            dbc->sbdf.sbdf = 0;
+    }
 
     if ( !dbc->sbdf.sbdf )
     {
@@ -1052,12 +1066,33 @@ void __init xhci_dbc_uart_init(void)
 {
     struct dbc_uart *uart = &dbc_uart;
     struct dbc *dbc = &uart->dbc;
+    const char *e;
 
     if ( strncmp(opt_dbgp, "xhci", 4) )
         return;
 
     memset(dbc, 0, sizeof(*dbc));
 
+    if ( isdigit(opt_dbgp[4]) )
+    {
+        dbc->xhc_num = simple_strtoul(opt_dbgp + 4, &e, 10);
+    }
+    else if ( strncmp(opt_dbgp + 4, "@pci", 4) == 0 )
+    {
+        unsigned int bus, slot, func;
+
+        e = parse_pci(opt_dbgp + 8, NULL, &bus, &slot, &func);
+        if ( !e || *e )
+        {
+            printk(XENLOG_ERR
+                   "Invalid dbgp= PCI device spec: '%s'\n",
+                   opt_dbgp + 8);
+            return;
+        }
+
+        dbc->sbdf = PCI_SBDF(0, bus, slot, func);
+    }
+
     dbc->dbc_ctx = &ctx;
     dbc->dbc_erst = &erst;
     dbc->dbc_ering.trb = evt_trb;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Aug 16 09:33:45 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 16 Aug 2022 09:33:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.388139.624725 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNsxF-0007aL-33; Tue, 16 Aug 2022 09:33:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 388139.624725; Tue, 16 Aug 2022 09:33: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 1oNsxF-0007aE-0P; Tue, 16 Aug 2022 09:33:45 +0000
Received: by outflank-mailman (input) for mailman id 388139;
 Tue, 16 Aug 2022 09:33:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNsxE-0007a5-Gn
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 09:33:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNsxE-0002T4-G6
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 09:33:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNsxE-00034L-FO
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 09:33:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=A4DbsqF6NMNOw9tEgRpkX/as9lNpz5bs0g9/98Y57JA=; b=bRN04sHqslzaPRjMtTyHnwd0SM
	DkeG2rvDwrotup5W/sSV00uJZhZRSNTcyAhQSTakDzBVRkdl5i3ScnxXoFTfMOdi8O5iF6dsnUsSL
	2dID66wsaAzzOHlhZzERef63wE7L1ngiqucwFlC/GGucGXl2iLfPuS5C2tKOIybxsYn0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] drivers/char: make serial_parse_handle take const argument
Message-Id: <E1oNsxE-00034L-FO@xenbits.xenproject.org>
Date: Tue, 16 Aug 2022 09:33:44 +0000

commit ee8d9d0c1c1a8cef8ebcae16e0f574542d319e26
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Tue Aug 16 11:23:26 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 16 11:23:26 2022 +0200

    drivers/char: make serial_parse_handle take const argument
    
    It doesn't modify it, and it will be necessary in a subsequent patch.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/char/serial.c | 2 +-
 xen/include/xen/serial.h  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/char/serial.c b/xen/drivers/char/serial.c
index f6c944bd30..47899222ce 100644
--- a/xen/drivers/char/serial.c
+++ b/xen/drivers/char/serial.c
@@ -301,7 +301,7 @@ char serial_getc(int handle)
     return c & 0x7f;
 }
 
-int __init serial_parse_handle(char *conf)
+int __init serial_parse_handle(const char *conf)
 {
     int handle, flags = 0;
 
diff --git a/xen/include/xen/serial.h b/xen/include/xen/serial.h
index 181e026967..4cd4ae5e6f 100644
--- a/xen/include/xen/serial.h
+++ b/xen/include/xen/serial.h
@@ -109,7 +109,7 @@ void serial_init_postirq(void);
 void serial_endboot(void);
 
 /* Takes a config string and creates a numeric handle on the COM port. */
-int serial_parse_handle(char *conf);
+int serial_parse_handle(const char *conf);
 
 /* Transmit a single character via the specified COM port. */
 void serial_putc(int handle, char c);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Aug 16 09:33:55 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 16 Aug 2022 09:33:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.388140.624729 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNsxP-0007d5-4g; Tue, 16 Aug 2022 09:33:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 388140.624729; Tue, 16 Aug 2022 09:33:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNsxP-0007cx-1s; Tue, 16 Aug 2022 09:33:55 +0000
Received: by outflank-mailman (input) for mailman id 388140;
 Tue, 16 Aug 2022 09:33:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNsxO-0007cp-Jj
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 09:33:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNsxO-0002TY-J0
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 09:33:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNsxO-00034r-IL
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 09:33:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8v+1JV3eyCyWc76FrjI7loyyGPdXsgrHgtVqLr5YPnE=; b=AEILOnZsEUOSTKKULlJVCYlwv8
	2Xs7dPD1RBkXpD+bRfZYREQhYb5tKrktT7xEDnNDef7GAwo1mmmsolotf+cShQ7Xn8wj1I6Z6J9MI
	DMehVqAXC6EWqA+/QE7wfFH1UkjFMazRC0mo1JByB2Ug8a+uLw1iNy7KAemBwg3Dg/Yg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: rename PGC_reserved to PGC_static
Message-Id: <E1oNsxO-00034r-IL@xenbits.xenproject.org>
Date: Tue, 16 Aug 2022 09:33:54 +0000

commit 283abca2997141ea780fc86ca9524b1d837243d3
Author:     Penny Zheng <penny.zheng@arm.com>
AuthorDate: Tue Aug 16 11:23:56 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 16 11:23:56 2022 +0200

    xen/arm: rename PGC_reserved to PGC_static
    
    PGC_reserved could be ambiguous, and we have to tell what the pages are
    reserved for, so this commit intends to rename PGC_reserved to
    PGC_static, which clearly indicates the page is reserved for static
    memory.
    
    Signed-off-by: Penny Zheng <penny.zheng@arm.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/include/asm/mm.h |  6 +++---
 xen/common/page_alloc.c       | 22 +++++++++++-----------
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/xen/arch/arm/include/asm/mm.h b/xen/arch/arm/include/asm/mm.h
index 6c0a3c789f..da25251cda 100644
--- a/xen/arch/arm/include/asm/mm.h
+++ b/xen/arch/arm/include/asm/mm.h
@@ -121,9 +121,9 @@ struct page_info
   /* Page is Xen heap? */
 #define _PGC_xen_heap     PG_shift(2)
 #define PGC_xen_heap      PG_mask(1, 2)
-  /* Page is reserved */
-#define _PGC_reserved     PG_shift(3)
-#define PGC_reserved      PG_mask(1, 3)
+  /* Page is static memory */
+#define _PGC_static    PG_shift(3)
+#define PGC_static     PG_mask(1, 3)
 /* ... */
 /* Page is broken? */
 #define _PGC_broken       PG_shift(7)
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 8bdaffeb3d..00fa24e330 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -151,8 +151,8 @@
 #define p2m_pod_offline_or_broken_replace(pg) BUG_ON(pg != NULL)
 #endif
 
-#ifndef PGC_reserved
-#define PGC_reserved 0
+#ifndef PGC_static
+#define PGC_static 0
 #endif
 
 #ifndef PGT_TYPE_INFO_INITIALIZER
@@ -2342,7 +2342,7 @@ int assign_pages(
 
         for ( i = 0; i < nr; i++ )
         {
-            ASSERT(!(pg[i].count_info & ~(PGC_extra | PGC_reserved)));
+            ASSERT(!(pg[i].count_info & ~(PGC_extra | PGC_static)));
             if ( pg[i].count_info & PGC_extra )
                 extra_pages++;
         }
@@ -2402,7 +2402,7 @@ int assign_pages(
         page_set_owner(&pg[i], d);
         smp_wmb(); /* Domain pointer must be visible before updating refcnt. */
         pg[i].count_info =
-            (pg[i].count_info & (PGC_extra | PGC_reserved)) | PGC_allocated | 1;
+            (pg[i].count_info & (PGC_extra | PGC_static)) | PGC_allocated | 1;
 
         page_list_add_tail(&pg[i], page_to_list(d, &pg[i]));
     }
@@ -2708,8 +2708,8 @@ void __init free_staticmem_pages(struct page_info *pg, unsigned long nr_mfns,
             scrub_one_page(pg);
         }
 
-        /* In case initializing page of static memory, mark it PGC_reserved. */
-        pg[i].count_info |= PGC_reserved;
+        /* In case initializing page of static memory, mark it PGC_static. */
+        pg[i].count_info |= PGC_static;
     }
 }
 
@@ -2738,8 +2738,8 @@ static struct page_info * __init acquire_staticmem_pages(mfn_t smfn,
 
     for ( i = 0; i < nr_mfns; i++ )
     {
-        /* The page should be reserved and not yet allocated. */
-        if ( pg[i].count_info != (PGC_state_free | PGC_reserved) )
+        /* The page should be static and not yet allocated. */
+        if ( pg[i].count_info != (PGC_state_free | PGC_static) )
         {
             printk(XENLOG_ERR
                    "pg[%lu] Static MFN %"PRI_mfn" c=%#lx t=%#x\n",
@@ -2753,10 +2753,10 @@ static struct page_info * __init acquire_staticmem_pages(mfn_t smfn,
                                 &tlbflush_timestamp);
 
         /*
-         * Preserve flag PGC_reserved and change page state
+         * Preserve flag PGC_static and change page state
          * to PGC_state_inuse.
          */
-        pg[i].count_info = PGC_reserved | PGC_state_inuse;
+        pg[i].count_info = PGC_static | PGC_state_inuse;
         /* Initialise fields which have other uses for free pages. */
         pg[i].u.inuse.type_info = PGT_TYPE_INFO_INITIALIZER;
         page_set_owner(&pg[i], NULL);
@@ -2778,7 +2778,7 @@ static struct page_info * __init acquire_staticmem_pages(mfn_t smfn,
 
  out_err:
     while ( i-- )
-        pg[i].count_info = PGC_reserved | PGC_state_free;
+        pg[i].count_info = PGC_static | PGC_state_free;
 
     spin_unlock(&heap_lock);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Aug 16 13:22:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 16 Aug 2022 13:22:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.388312.624931 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNwWB-0005Xv-BB; Tue, 16 Aug 2022 13:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 388312.624931; Tue, 16 Aug 2022 13:22:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNwWB-0005Xo-8H; Tue, 16 Aug 2022 13:22:03 +0000
Received: by outflank-mailman (input) for mailman id 388312;
 Tue, 16 Aug 2022 13:22:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNwW9-0005Xi-Hm
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 13:22:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNwW9-0006VQ-EL
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 13:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNwW9-0005Pc-DL
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 13:22:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=uJEZTFnZ9hmud+q65Y3KPW2MLmNDZI0ECtW2jMdzbPs=; b=wNv047OyIrLrb3l7YwdohurcDW
	BKf6tpWWVoP7gtDtMo7f/5BsqsKmn36QV+cndkZXLtJYZlpHmH5EC3ftuFv/DsUlldIrdXoE2sz+5
	T17ZwQ/xdBMF/VwEcQ6lTcj5REcxtMFuNX54W1FA+N/YLzTR0w9mUQuFNGz4YiwEC3rk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] x86/amd: only call setup_force_cpu_cap for boot CPU
Message-Id: <E1oNwW9-0005Pc-DL@xenbits.xenproject.org>
Date: Tue, 16 Aug 2022 13:22:01 +0000

commit 4ed063a71bf9ec291a1b71d0b7b36c0416ca544d
Author:     Ross Lagerwall <ross.lagerwall@citrix.com>
AuthorDate: Mon Aug 15 16:12:13 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 16:12:13 2022 +0200

    x86/amd: only call setup_force_cpu_cap for boot CPU
    
    This should only be called for the boot CPU to avoid calling _init code
    after it has been unloaded.
    
    Fixes: 062868a5a8b4 ("x86/amd: Work around CLFLUSH ordering on older parts")
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 31b41ce858c8bd5159212d40969f8e0b7124bbf0
    master date: 2022-08-11 17:44:26 +0200
---
 xen/arch/x86/cpu/amd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/cpu/amd.c b/xen/arch/x86/cpu/amd.c
index f50f91f81e..b670ab6cd1 100644
--- a/xen/arch/x86/cpu/amd.c
+++ b/xen/arch/x86/cpu/amd.c
@@ -820,7 +820,7 @@ static void init_amd(struct cpuinfo_x86 *c)
 	 * everything, including reads and writes to address, and
 	 * LFENCE/SFENCE instructions.
 	 */
-	if (!cpu_has_clflushopt)
+	if (c == &boot_cpu_data && !cpu_has_clflushopt)
 		setup_force_cpu_cap(X86_BUG_CLFLUSH_MFENCE);
 
 	switch(c->x86)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Tue Aug 16 16:44:10 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 16 Aug 2022 16:44:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.388409.625043 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNzff-0004c1-80; Tue, 16 Aug 2022 16:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 388409.625043; Tue, 16 Aug 2022 16:44:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNzff-0004bt-4u; Tue, 16 Aug 2022 16:44:03 +0000
Received: by outflank-mailman (input) for mailman id 388409;
 Tue, 16 Aug 2022 16:44:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNzfe-0004bn-0t
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 16:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNzfd-00025f-UZ
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 16:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNzfd-0006Xc-TZ
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 16:44:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=02+Unb5/0yFxWQQQo5WmqvLsAy8UsEOfjPbshOg3juo=; b=EnZSFJ92haGM2nSvuJZhi9JoLE
	M+9cVad6f7rNtHIbaiLcxj7lj8ejMNrKrkuip61xC1lN4t/G30qOZfza7GFXFb7l7Jgmmkr830pxr
	p4HTjTbM3IvdnOqoiw7PxJMW3O/CY80kNgV+GYK562kofFFL7/qV6/BwJF3UoC0HAwmw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] amd/msr: implement VIRT_SPEC_CTRL for HVM guests on top of SPEC_CTRL
Message-Id: <E1oNzfd-0006Xc-TZ@xenbits.xenproject.org>
Date: Tue, 16 Aug 2022 16:44:01 +0000

commit ebaaa72ee080c8774b1df5783220d4811159c327
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Aug 15 09:57:23 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 09:57:23 2022 +0200

    amd/msr: implement VIRT_SPEC_CTRL for HVM guests on top of SPEC_CTRL
    
    Use the logic to set shadow SPEC_CTRL values in order to implement
    support for VIRT_SPEC_CTRL (signaled by VIRT_SSBD CPUID flag) for HVM
    guests. This includes using the spec_ctrl vCPU MSR variable to store
    the guest set value of VIRT_SPEC_CTRL.SSBD, which will be OR'ed with
    any SPEC_CTRL values being set by the guest.
    
    On hardware having SPEC_CTRL VIRT_SPEC_CTRL will not be offered by
    default to guests. VIRT_SPEC_CTRL will only be part of the max CPUID
    policy so it can be enabled for compatibility purposes.
    
    Use '!' to annotate the feature in order to express that the presence
    of the bit is not directly tied to its value in the host policy.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpuid.c                        |  7 +++++++
 xen/arch/x86/hvm/hvm.c                      |  1 +
 xen/arch/x86/include/asm/msr.h              |  4 ++++
 xen/arch/x86/msr.c                          | 18 ++++++++++++++++++
 xen/arch/x86/spec_ctrl.c                    |  3 ++-
 xen/include/public/arch-x86/cpufeatureset.h |  2 +-
 6 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 7e0b395698..979dcf8164 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -550,6 +550,13 @@ static void __init calculate_hvm_max_policy(void)
         __clear_bit(X86_FEATURE_IBRSB, hvm_featureset);
         __clear_bit(X86_FEATURE_IBRS, hvm_featureset);
     }
+    else if ( boot_cpu_has(X86_FEATURE_AMD_SSBD) )
+        /*
+         * If SPEC_CTRL.SSBD is available VIRT_SPEC_CTRL.SSBD can be exposed
+         * and implemented using the former. Expose in the max policy only as
+         * the preference is for guests to use SPEC_CTRL.SSBD if available.
+         */
+        __set_bit(X86_FEATURE_VIRT_SSBD, hvm_featureset);
 
     /*
      * With VT-x, some features are only supported by Xen if dedicated
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 0dd320a6a9..6b5d585ed4 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -1337,6 +1337,7 @@ static const uint32_t msrs_to_send[] = {
     MSR_INTEL_MISC_FEATURES_ENABLES,
     MSR_IA32_BNDCFGS,
     MSR_IA32_XSS,
+    MSR_VIRT_SPEC_CTRL,
     MSR_AMD64_DR0_ADDRESS_MASK,
     MSR_AMD64_DR1_ADDRESS_MASK,
     MSR_AMD64_DR2_ADDRESS_MASK,
diff --git a/xen/arch/x86/include/asm/msr.h b/xen/arch/x86/include/asm/msr.h
index ce4fe51afe..ab6fbb5051 100644
--- a/xen/arch/x86/include/asm/msr.h
+++ b/xen/arch/x86/include/asm/msr.h
@@ -291,6 +291,7 @@ struct vcpu_msrs
 {
     /*
      * 0x00000048 - MSR_SPEC_CTRL
+     * 0xc001011f - MSR_VIRT_SPEC_CTRL (if X86_FEATURE_AMD_SSBD)
      *
      * For PV guests, this holds the guest kernel value.  It is accessed on
      * every entry/exit path.
@@ -306,6 +307,9 @@ struct vcpu_msrs
      * We must clear/restore Xen's value before/after VMRUN to avoid unduly
      * influencing the guest.  In order to support "behind the guest's back"
      * protections, we load this value (commonly 0) before VMRUN.
+     *
+     * Once of such "behind the guest's back" usages is setting SPEC_CTRL.SSBD
+     * if the guest sets VIRT_SPEC_CTRL.SSBD.
      */
     struct {
         uint32_t raw;
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index d2e2dc2a6b..2ae1fcfd5f 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -389,6 +389,13 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
                ? K8_HWCR_TSC_FREQ_SEL : 0;
         break;
 
+    case MSR_VIRT_SPEC_CTRL:
+        if ( !cp->extd.virt_ssbd )
+            goto gp_fault;
+
+        *val = msrs->spec_ctrl.raw & SPEC_CTRL_SSBD;
+        break;
+
     case MSR_AMD64_DE_CFG:
         if ( !(cp->x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON)) )
             goto gp_fault;
@@ -674,6 +681,17 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
             wrmsr_tsc_aux(val);
         break;
 
+    case MSR_VIRT_SPEC_CTRL:
+        if ( !cp->extd.virt_ssbd )
+            goto gp_fault;
+
+        /* Only supports SSBD bit, the rest are ignored. */
+        if ( val & SPEC_CTRL_SSBD )
+            msrs->spec_ctrl.raw |= SPEC_CTRL_SSBD;
+        else
+            msrs->spec_ctrl.raw &= ~SPEC_CTRL_SSBD;
+        break;
+
     case MSR_AMD64_DE_CFG:
         /*
          * OpenBSD 6.7 will panic if writing to DE_CFG triggers a #GP:
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index 160cc68086..96e7f0983a 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -509,12 +509,13 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
      * mitigation support for guests.
      */
 #ifdef CONFIG_HVM
-    printk("  Support for HVM VMs:%s%s%s%s%s%s\n",
+    printk("  Support for HVM VMs:%s%s%s%s%s%s%s\n",
            (boot_cpu_has(X86_FEATURE_SC_MSR_HVM) ||
             boot_cpu_has(X86_FEATURE_SC_RSB_HVM) ||
             boot_cpu_has(X86_FEATURE_IBPB_ENTRY_HVM) ||
             opt_eager_fpu || opt_md_clear_hvm)       ? ""               : " None",
            boot_cpu_has(X86_FEATURE_SC_MSR_HVM)      ? " MSR_SPEC_CTRL" : "",
+           boot_cpu_has(X86_FEATURE_SC_MSR_HVM)      ? " MSR_VIRT_SPEC_CTRL" : "",
            boot_cpu_has(X86_FEATURE_SC_RSB_HVM)      ? " RSB"           : "",
            opt_eager_fpu                             ? " EAGER_FPU"     : "",
            opt_md_clear_hvm                          ? " MD_CLEAR"      : "",
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 4b8925b7b8..42f48a8ae2 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -265,7 +265,7 @@ XEN_CPUFEATURE(IBRS_SAME_MODE, 8*32+19) /*S  IBRS provides same-mode protection
 XEN_CPUFEATURE(NO_LMSL,       8*32+20) /*S  EFER.LMSLE no longer supported. */
 XEN_CPUFEATURE(AMD_PPIN,      8*32+23) /*   Protected Processor Inventory Number */
 XEN_CPUFEATURE(AMD_SSBD,      8*32+24) /*S  MSR_SPEC_CTRL.SSBD available */
-XEN_CPUFEATURE(VIRT_SSBD,     8*32+25) /*   MSR_VIRT_SPEC_CTRL.SSBD */
+XEN_CPUFEATURE(VIRT_SSBD,     8*32+25) /*!  MSR_VIRT_SPEC_CTRL.SSBD */
 XEN_CPUFEATURE(SSB_NO,        8*32+26) /*A  Hardware not vulnerable to SSB */
 XEN_CPUFEATURE(PSFD,          8*32+28) /*S  MSR_SPEC_CTRL.PSFD */
 XEN_CPUFEATURE(BTC_NO,        8*32+29) /*A  Hardware not vulnerable to Branch Type Confusion */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Aug 16 16:44:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 16 Aug 2022 16:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.388410.625046 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNzfp-0004dw-9Q; Tue, 16 Aug 2022 16:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 388410.625046; Tue, 16 Aug 2022 16:44:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNzfp-0004do-6W; Tue, 16 Aug 2022 16:44:13 +0000
Received: by outflank-mailman (input) for mailman id 388410;
 Tue, 16 Aug 2022 16:44:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNzfo-0004dd-2k
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 16:44:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNzfo-00025j-1t
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 16:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNzfo-0006Y5-0u
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 16:44:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1O5DTSO/aAe1mmdf59RSzz7Vm47iXwqF8LgyXFyBABw=; b=p/FG4SxNaKzFEMUa2AhXegSaXs
	ETsD0fjpUivXtEVCZX4jcHQDgfMCPeOPkHv02HdCJ4UPgPxVWbXhgmpLVmuNQHCNM3n9i/gG8Ap0J
	EI20ZjWcxs+6Xp0jM8B4YRbGJv4Xz+G2VRb+m5Lnxo+6pGD4h6a8raEQJsbLIW3/vrCY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] amd/msr: allow passthrough of VIRT_SPEC_CTRL for HVM guests
Message-Id: <E1oNzfo-0006Y5-0u@xenbits.xenproject.org>
Date: Tue, 16 Aug 2022 16:44:12 +0000

commit a2eeaa6906101fbf322766f37f8f061dd36fe58d
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Aug 15 09:58:08 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 09:58:08 2022 +0200

    amd/msr: allow passthrough of VIRT_SPEC_CTRL for HVM guests
    
    Allow HVM guests access to MSR_VIRT_SPEC_CTRL if the platform Xen is
    running on has support for it.  This requires adding logic in the
    vm{entry,exit} paths for SVM in order to context switch between the
    hypervisor value and the guest one.  The added handlers for context
    switch will also be used for the legacy SSBD support.
    
    Introduce a new synthetic feature leaf (X86_FEATURE_VIRT_SC_MSR_HVM)
    to signal whether VIRT_SPEC_CTRL needs to be handled on guest
    vm{entry,exit}.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpuid.c                   | 14 ++++++++++++++
 xen/arch/x86/hvm/svm/entry.S           |  8 ++++++++
 xen/arch/x86/hvm/svm/svm.c             | 35 ++++++++++++++++++++++++++++++++++
 xen/arch/x86/include/asm/cpufeatures.h |  2 +-
 xen/arch/x86/include/asm/msr.h         | 10 ++++++++++
 xen/arch/x86/msr.c                     | 16 ++++++++++++----
 xen/arch/x86/spec_ctrl.c               |  9 ++++++++-
 7 files changed, 88 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 979dcf8164..a4a366ad84 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -541,6 +541,13 @@ static void __init calculate_hvm_max_policy(void)
          raw_cpuid_policy.basic.sep )
         __set_bit(X86_FEATURE_SEP, hvm_featureset);
 
+    /*
+     * VIRT_SSBD is exposed in the default policy as a result of
+     * VIRT_SC_MSR_HVM being set, it also needs exposing in the max policy.
+     */
+    if ( boot_cpu_has(X86_FEATURE_VIRT_SC_MSR_HVM) )
+        __set_bit(X86_FEATURE_VIRT_SSBD, hvm_featureset);
+
     /*
      * If Xen isn't virtualising MSR_SPEC_CTRL for HVM guests (functional
      * availability, or admin choice), hide the feature.
@@ -597,6 +604,13 @@ static void __init calculate_hvm_def_policy(void)
     guest_common_feature_adjustments(hvm_featureset);
     guest_common_default_feature_adjustments(hvm_featureset);
 
+    /*
+     * Only expose VIRT_SSBD if AMD_SSBD is not available, and thus
+     * VIRT_SC_MSR_HVM is set.
+     */
+    if ( boot_cpu_has(X86_FEATURE_VIRT_SC_MSR_HVM) )
+        __set_bit(X86_FEATURE_VIRT_SSBD, hvm_featureset);
+
     sanitise_featureset(hvm_featureset);
     cpuid_featureset_to_policy(hvm_featureset, p);
     recalculate_xstate(p);
diff --git a/xen/arch/x86/hvm/svm/entry.S b/xen/arch/x86/hvm/svm/entry.S
index a60d759f71..a26589aa9a 100644
--- a/xen/arch/x86/hvm/svm/entry.S
+++ b/xen/arch/x86/hvm/svm/entry.S
@@ -19,6 +19,8 @@
 
         .file "svm/entry.S"
 
+#include <xen/lib.h>
+
 #include <asm/asm_defns.h>
 #include <asm/page.h>
 
@@ -57,6 +59,9 @@ __UNLIKELY_END(nsvm_hap)
 
         clgi
 
+        ALTERNATIVE "", STR(call vmentry_virt_spec_ctrl), \
+                        X86_FEATURE_VIRT_SC_MSR_HVM
+
         /* WARNING! `ret`, `call *`, `jmp *` not safe beyond this point. */
         /* SPEC_CTRL_EXIT_TO_SVM       Req: b=curr %rsp=regs/cpuinfo, Clob: acd */
         .macro svm_vmentry_spec_ctrl
@@ -126,6 +131,9 @@ __UNLIKELY_END(nsvm_hap)
         ALTERNATIVE "", svm_vmexit_spec_ctrl, X86_FEATURE_SC_MSR_HVM
         /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */
 
+        ALTERNATIVE "", STR(call vmexit_virt_spec_ctrl), \
+                        X86_FEATURE_VIRT_SC_MSR_HVM
+
         /*
          * STGI is executed unconditionally, and is sufficiently serialising
          * to safely resolve any Spectre-v1 concerns in the above logic.
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 0849a9dc5f..53ce2edd35 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -52,6 +52,7 @@
 #include <asm/hvm/svm/svmdebug.h>
 #include <asm/hvm/svm/nestedsvm.h>
 #include <asm/hvm/nestedhvm.h>
+#include <asm/spec_ctrl.h>
 #include <asm/x86_emulate.h>
 #include <public/sched.h>
 #include <asm/hvm/vpt.h>
@@ -610,6 +611,16 @@ static void cf_check svm_cpuid_policy_changed(struct vcpu *v)
     svm_intercept_msr(v, MSR_SPEC_CTRL,
                       cp->extd.ibrs ? MSR_INTERCEPT_NONE : MSR_INTERCEPT_RW);
 
+    /*
+     * Always trap write accesses to VIRT_SPEC_CTRL in order to cache the guest
+     * setting and avoid having to perform a rdmsr on vmexit to get the guest
+     * setting even if VIRT_SSBD is offered to Xen itself.
+     */
+    svm_intercept_msr(v, MSR_VIRT_SPEC_CTRL,
+                      cp->extd.virt_ssbd && cpu_has_virt_ssbd &&
+                      !cpu_has_amd_ssbd ?
+                      MSR_INTERCEPT_WRITE : MSR_INTERCEPT_RW);
+
     /* Give access to MSR_PRED_CMD if the guest has been told about it. */
     svm_intercept_msr(v, MSR_PRED_CMD,
                       cp->extd.ibpb ? MSR_INTERCEPT_NONE : MSR_INTERCEPT_RW);
@@ -3105,6 +3116,30 @@ void svm_vmexit_handler(struct cpu_user_regs *regs)
     vmcb_set_vintr(vmcb, intr);
 }
 
+/* Called with GIF=0. */
+void vmexit_virt_spec_ctrl(void)
+{
+    unsigned int val = opt_ssbd ? SPEC_CTRL_SSBD : 0;
+
+    if ( val == current->arch.msrs->virt_spec_ctrl.raw )
+        return;
+
+    if ( cpu_has_virt_ssbd )
+        wrmsr(MSR_VIRT_SPEC_CTRL, val, 0);
+}
+
+/* Called with GIF=0. */
+void vmentry_virt_spec_ctrl(void)
+{
+    unsigned int val = current->arch.msrs->virt_spec_ctrl.raw;
+
+    if ( val == (opt_ssbd ? SPEC_CTRL_SSBD : 0) )
+        return;
+
+    if ( cpu_has_virt_ssbd )
+        wrmsr(MSR_VIRT_SPEC_CTRL, val, 0);
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/x86/include/asm/cpufeatures.h b/xen/arch/x86/include/asm/cpufeatures.h
index 672c9ee22b..3895de4faf 100644
--- a/xen/arch/x86/include/asm/cpufeatures.h
+++ b/xen/arch/x86/include/asm/cpufeatures.h
@@ -24,7 +24,7 @@ XEN_CPUFEATURE(APERFMPERF,        X86_SYNTH( 8)) /* APERFMPERF */
 XEN_CPUFEATURE(MFENCE_RDTSC,      X86_SYNTH( 9)) /* MFENCE synchronizes RDTSC */
 XEN_CPUFEATURE(XEN_SMEP,          X86_SYNTH(10)) /* SMEP gets used by Xen itself */
 XEN_CPUFEATURE(XEN_SMAP,          X86_SYNTH(11)) /* SMAP gets used by Xen itself */
-/* Bit 12 - unused. */
+XEN_CPUFEATURE(VIRT_SC_MSR_HVM,   X86_SYNTH(12)) /* MSR_VIRT_SPEC_CTRL exposed to HVM */
 XEN_CPUFEATURE(IND_THUNK_LFENCE,  X86_SYNTH(13)) /* Use IND_THUNK_LFENCE */
 XEN_CPUFEATURE(IND_THUNK_JMP,     X86_SYNTH(14)) /* Use IND_THUNK_JMP */
 XEN_CPUFEATURE(SC_NO_BRANCH_HARDEN, X86_SYNTH(15)) /* (Disable) Conditional branch hardening */
diff --git a/xen/arch/x86/include/asm/msr.h b/xen/arch/x86/include/asm/msr.h
index ab6fbb5051..de18e90b2e 100644
--- a/xen/arch/x86/include/asm/msr.h
+++ b/xen/arch/x86/include/asm/msr.h
@@ -375,6 +375,16 @@ struct vcpu_msrs
      */
     uint32_t tsc_aux;
 
+    /*
+     * 0xc001011f - MSR_VIRT_SPEC_CTRL (if !X86_FEATURE_AMD_SSBD)
+     *
+     * AMD only. Guest selected value, context switched on guest VM
+     * entry/exit.
+     */
+    struct {
+        uint32_t raw;
+    } virt_spec_ctrl;
+
     /*
      * 0xc00110{27,19-1b} MSR_AMD64_DR{0-3}_ADDRESS_MASK
      *
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 2ae1fcfd5f..95416995a5 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -393,7 +393,10 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
         if ( !cp->extd.virt_ssbd )
             goto gp_fault;
 
-        *val = msrs->spec_ctrl.raw & SPEC_CTRL_SSBD;
+        if ( cpu_has_amd_ssbd )
+            *val = msrs->spec_ctrl.raw & SPEC_CTRL_SSBD;
+        else
+            *val = msrs->virt_spec_ctrl.raw;
         break;
 
     case MSR_AMD64_DE_CFG:
@@ -686,10 +689,15 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
             goto gp_fault;
 
         /* Only supports SSBD bit, the rest are ignored. */
-        if ( val & SPEC_CTRL_SSBD )
-            msrs->spec_ctrl.raw |= SPEC_CTRL_SSBD;
+        if ( cpu_has_amd_ssbd )
+        {
+            if ( val & SPEC_CTRL_SSBD )
+                msrs->spec_ctrl.raw |= SPEC_CTRL_SSBD;
+            else
+                msrs->spec_ctrl.raw &= ~SPEC_CTRL_SSBD;
+        }
         else
-            msrs->spec_ctrl.raw &= ~SPEC_CTRL_SSBD;
+            msrs->virt_spec_ctrl.raw = val & SPEC_CTRL_SSBD;
         break;
 
     case MSR_AMD64_DE_CFG:
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index 96e7f0983a..ec44205309 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -513,9 +513,12 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
            (boot_cpu_has(X86_FEATURE_SC_MSR_HVM) ||
             boot_cpu_has(X86_FEATURE_SC_RSB_HVM) ||
             boot_cpu_has(X86_FEATURE_IBPB_ENTRY_HVM) ||
+            boot_cpu_has(X86_FEATURE_VIRT_SC_MSR_HVM) ||
             opt_eager_fpu || opt_md_clear_hvm)       ? ""               : " None",
            boot_cpu_has(X86_FEATURE_SC_MSR_HVM)      ? " MSR_SPEC_CTRL" : "",
-           boot_cpu_has(X86_FEATURE_SC_MSR_HVM)      ? " MSR_VIRT_SPEC_CTRL" : "",
+           (boot_cpu_has(X86_FEATURE_SC_MSR_HVM) ||
+            boot_cpu_has(X86_FEATURE_VIRT_SC_MSR_HVM)) ? " MSR_VIRT_SPEC_CTRL"
+                                                       : "",
            boot_cpu_has(X86_FEATURE_SC_RSB_HVM)      ? " RSB"           : "",
            opt_eager_fpu                             ? " EAGER_FPU"     : "",
            opt_md_clear_hvm                          ? " MD_CLEAR"      : "",
@@ -1240,6 +1243,10 @@ void __init init_speculation_mitigations(void)
             setup_force_cpu_cap(X86_FEATURE_SC_MSR_HVM);
     }
 
+    /* Support VIRT_SPEC_CTRL.SSBD if AMD_SSBD is not available. */
+    if ( opt_msr_sc_hvm && !cpu_has_amd_ssbd && cpu_has_virt_ssbd )
+        setup_force_cpu_cap(X86_FEATURE_VIRT_SC_MSR_HVM);
+
     /* Figure out default_xen_spec_ctrl. */
     if ( has_spec_ctrl && ibrs )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Aug 16 16:44:24 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 16 Aug 2022 16:44:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.388411.625051 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oNzg0-0004gT-BG; Tue, 16 Aug 2022 16:44:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 388411.625051; Tue, 16 Aug 2022 16: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 1oNzg0-0004gL-8B; Tue, 16 Aug 2022 16:44:24 +0000
Received: by outflank-mailman (input) for mailman id 388411;
 Tue, 16 Aug 2022 16:44:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNzfy-0004g5-5s
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 16:44:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNzfy-000265-55
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 16:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oNzfy-0006aC-4I
 for xen-changelog@lists.xenproject.org; Tue, 16 Aug 2022 16:44:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=mDPL0cCxV9K2H8pVPx4KWoPTRaSo5kKqLeAes3QWipY=; b=q6+snwpKvywBh6sTEk8fjRxbT1
	fhudT7sdpe3zNlGH3pPoMf8/mWvGrp3Pjv+mFOGH59PzZLAJcKVqE+46Ly/EzQH0VWC+0chrWpUE+
	Yoft38t/b3jCGSglIXXqCBjq69tYTFOifSj7as1Rc8LGk3SZwklKekqX4EN4oIV3ZMtI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] amd/msr: implement VIRT_SPEC_CTRL for HVM guests using legacy SSBD
Message-Id: <E1oNzfy-0006aC-4I@xenbits.xenproject.org>
Date: Tue, 16 Aug 2022 16:44:22 +0000

commit 646589ac148a2ff6bb222a6081b4d7b13ee468c0
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Aug 15 09:58:55 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 15 09:58:55 2022 +0200

    amd/msr: implement VIRT_SPEC_CTRL for HVM guests using legacy SSBD
    
    Expose VIRT_SSBD to guests if the hardware supports setting SSBD in
    the LS_CFG MSR (a.k.a. non-architectural way). Different AMD CPU
    families use different bits in LS_CFG, so exposing VIRT_SPEC_CTRL.SSBD
    allows for an unified way of exposing SSBD support to guests on AMD
    hardware that's compatible migration wise, regardless of what
    underlying mechanism is used to set SSBD.
    
    Note that on AMD Family 17h and Hygon Family 18h processors the value
    of SSBD in LS_CFG is shared between threads on the same core, so
    there's extra logic in order to synchronize the value and have SSBD
    set as long as one of the threads in the core requires it to be set.
    Such logic also requires extra storage for each thread state, which is
    allocated at initialization time.
    
    Do the context switching of the SSBD selection in LS_CFG between
    hypervisor and guest in the same handler that's already used to switch
    the value of VIRT_SPEC_CTRL.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Henry Wang <Henry.Wang@arm.com>
---
 CHANGELOG.md                   |   1 +
 xen/arch/x86/cpu/amd.c         | 121 +++++++++++++++++++++++++++++++++++------
 xen/arch/x86/hvm/svm/svm.c     |   4 ++
 xen/arch/x86/include/asm/amd.h |   4 ++
 xen/arch/x86/spec_ctrl.c       |   4 +-
 5 files changed, 116 insertions(+), 18 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index a87a193e15..5e4bae5f35 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 ### Added / support upgraded
  - IOMMU superpage support on x86, affecting PV guests as well as HVM/PVH ones
    when they don't share page tables with the CPU (HAP / EPT / NPT).
+ - Support VIRT_SSBD feature for HVM guests on AMD.
 
 ### Removed / support downgraded
  - dropped support for the (x86-only) "vesa-mtrr" and "vesa-remap" command line options
diff --git a/xen/arch/x86/cpu/amd.c b/xen/arch/x86/cpu/amd.c
index d5f8e5e899..98c52d0686 100644
--- a/xen/arch/x86/cpu/amd.c
+++ b/xen/arch/x86/cpu/amd.c
@@ -48,6 +48,7 @@ boolean_param("allow_unsafe", opt_allow_unsafe);
 
 /* Signal whether the ACPI C1E quirk is required. */
 bool __read_mostly amd_acpi_c1e_quirk;
+bool __ro_after_init amd_legacy_ssbd;
 
 static inline int rdmsr_amd_safe(unsigned int msr, unsigned int *lo,
 				 unsigned int *hi)
@@ -685,23 +686,10 @@ void amd_init_lfence(struct cpuinfo_x86 *c)
  * Refer to the AMD Speculative Store Bypass whitepaper:
  * https://developer.amd.com/wp-content/resources/124441_AMD64_SpeculativeStoreBypassDisable_Whitepaper_final.pdf
  */
-void amd_init_ssbd(const struct cpuinfo_x86 *c)
+static bool set_legacy_ssbd(const struct cpuinfo_x86 *c, bool enable)
 {
 	int bit = -1;
 
-	if (cpu_has_ssb_no)
-		return;
-
-	if (cpu_has_amd_ssbd) {
-		/* Handled by common MSR_SPEC_CTRL logic */
-		return;
-	}
-
-	if (cpu_has_virt_ssbd) {
-		wrmsrl(MSR_VIRT_SPEC_CTRL, opt_ssbd ? SPEC_CTRL_SSBD : 0);
-		return;
-	}
-
 	switch (c->x86) {
 	case 0x15: bit = 54; break;
 	case 0x16: bit = 33; break;
@@ -715,20 +703,119 @@ void amd_init_ssbd(const struct cpuinfo_x86 *c)
 		if (rdmsr_safe(MSR_AMD64_LS_CFG, val) ||
 		    ({
 			    val &= ~mask;
-			    if (opt_ssbd)
+			    if (enable)
 				    val |= mask;
 			    false;
 		    }) ||
 		    wrmsr_safe(MSR_AMD64_LS_CFG, val) ||
 		    ({
 			    rdmsrl(MSR_AMD64_LS_CFG, val);
-			    (val & mask) != (opt_ssbd * mask);
+			    (val & mask) != (enable * mask);
 		    }))
 			bit = -1;
 	}
 
-	if (bit < 0)
+	return bit >= 0;
+}
+
+void amd_init_ssbd(const struct cpuinfo_x86 *c)
+{
+	if (cpu_has_ssb_no)
+		return;
+
+	if (cpu_has_amd_ssbd) {
+		/* Handled by common MSR_SPEC_CTRL logic */
+		return;
+	}
+
+	if (cpu_has_virt_ssbd) {
+		wrmsrl(MSR_VIRT_SPEC_CTRL, opt_ssbd ? SPEC_CTRL_SSBD : 0);
+		return;
+	}
+
+	if (!set_legacy_ssbd(c, opt_ssbd)) {
 		printk_once(XENLOG_ERR "No SSBD controls available\n");
+		if (amd_legacy_ssbd)
+			panic("CPU feature mismatch: no legacy SSBD\n");
+	} else if (c == &boot_cpu_data)
+		amd_legacy_ssbd = true;
+}
+
+static struct ssbd_ls_cfg {
+    bool locked;
+    unsigned int count;
+} __cacheline_aligned *ssbd_ls_cfg;
+static unsigned int __ro_after_init ssbd_max_cores;
+#define AMD_FAM17H_MAX_SOCKETS 2
+
+bool __init amd_setup_legacy_ssbd(void)
+{
+	unsigned int i;
+
+	if ((boot_cpu_data.x86 != 0x17 && boot_cpu_data.x86 != 0x18) ||
+	    boot_cpu_data.x86_num_siblings <= 1)
+		return true;
+
+	/*
+	 * One could be forgiven for thinking that c->x86_max_cores is the
+	 * correct value to use here.
+	 *
+	 * However, that value is derived from the current configuration, and
+	 * c->cpu_core_id is sparse on all but the top end CPUs.  Derive
+	 * max_cpus from ApicIdCoreIdSize which will cover any sparseness.
+	 */
+	if (boot_cpu_data.extended_cpuid_level >= 0x80000008) {
+		ssbd_max_cores = 1u << MASK_EXTR(cpuid_ecx(0x80000008), 0xf000);
+		ssbd_max_cores /= boot_cpu_data.x86_num_siblings;
+	}
+	if (!ssbd_max_cores)
+		return false;
+
+	ssbd_ls_cfg = xzalloc_array(struct ssbd_ls_cfg,
+	                            ssbd_max_cores * AMD_FAM17H_MAX_SOCKETS);
+	if (!ssbd_ls_cfg)
+		return false;
+
+	if (opt_ssbd)
+		for (i = 0; i < ssbd_max_cores * AMD_FAM17H_MAX_SOCKETS; i++)
+			/* Set initial state, applies to any (hotplug) CPU. */
+			ssbd_ls_cfg[i].count = boot_cpu_data.x86_num_siblings;
+
+	return true;
+}
+
+/*
+ * Executed from GIF==0 context: avoid using BUG/ASSERT or other functionality
+ * that relies on exceptions as those are not expected to run in GIF==0
+ * context.
+ */
+void amd_set_legacy_ssbd(bool enable)
+{
+	const struct cpuinfo_x86 *c = &current_cpu_data;
+	struct ssbd_ls_cfg *status;
+
+	if ((c->x86 != 0x17 && c->x86 != 0x18) || c->x86_num_siblings <= 1) {
+		set_legacy_ssbd(c, enable);
+		return;
+	}
+
+	status = &ssbd_ls_cfg[c->phys_proc_id * ssbd_max_cores +
+	                      c->cpu_core_id];
+
+	/*
+	 * Open code a very simple spinlock: this function is used with GIF==0
+	 * and different IF values, so would trigger the checklock detector.
+	 * Instead of trying to workaround the detector, use a very simple lock
+	 * implementation: it's better to reduce the amount of code executed
+	 * with GIF==0.
+	 */
+	while (test_and_set_bool(status->locked))
+		cpu_relax();
+	status->count += enable ? 1 : -1;
+	if (enable ? status->count == 1 : !status->count)
+		set_legacy_ssbd(c, enable);
+	barrier();
+	write_atomic(&status->locked, false);
 }
 
 /*
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 53ce2edd35..1aeaabcb13 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -3126,6 +3126,8 @@ void vmexit_virt_spec_ctrl(void)
 
     if ( cpu_has_virt_ssbd )
         wrmsr(MSR_VIRT_SPEC_CTRL, val, 0);
+    else
+        amd_set_legacy_ssbd(val);
 }
 
 /* Called with GIF=0. */
@@ -3138,6 +3140,8 @@ void vmentry_virt_spec_ctrl(void)
 
     if ( cpu_has_virt_ssbd )
         wrmsr(MSR_VIRT_SPEC_CTRL, val, 0);
+    else
+        amd_set_legacy_ssbd(val);
 }
 
 /*
diff --git a/xen/arch/x86/include/asm/amd.h b/xen/arch/x86/include/asm/amd.h
index a82382e6bf..6a42f68542 100644
--- a/xen/arch/x86/include/asm/amd.h
+++ b/xen/arch/x86/include/asm/amd.h
@@ -151,4 +151,8 @@ void check_enable_amd_mmconf_dmi(void);
 extern bool amd_acpi_c1e_quirk;
 void amd_check_disable_c1e(unsigned int port, u8 value);
 
+extern bool amd_legacy_ssbd;
+bool amd_setup_legacy_ssbd(void);
+void amd_set_legacy_ssbd(bool enable);
+
 #endif /* __AMD_H__ */
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index ec44205309..4e53056624 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -22,6 +22,7 @@
 #include <xen/param.h>
 #include <xen/warning.h>
 
+#include <asm/amd.h>
 #include <asm/hvm/svm/svm.h>
 #include <asm/microcode.h>
 #include <asm/msr.h>
@@ -1244,7 +1245,8 @@ void __init init_speculation_mitigations(void)
     }
 
     /* Support VIRT_SPEC_CTRL.SSBD if AMD_SSBD is not available. */
-    if ( opt_msr_sc_hvm && !cpu_has_amd_ssbd && cpu_has_virt_ssbd )
+    if ( opt_msr_sc_hvm && !cpu_has_amd_ssbd &&
+         (cpu_has_virt_ssbd || (amd_legacy_ssbd && amd_setup_legacy_ssbd())) )
         setup_force_cpu_cap(X86_FEATURE_VIRT_SC_MSR_HVM);
 
     /* Figure out default_xen_spec_ctrl. */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Aug 17 02:22:07 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 17 Aug 2022 02:22:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.388612.625302 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oO8h0-00013X-MZ; Wed, 17 Aug 2022 02:22:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 388612.625302; Wed, 17 Aug 2022 02:22:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oO8h0-00013O-Jh; Wed, 17 Aug 2022 02:22:02 +0000
Received: by outflank-mailman (input) for mailman id 388612;
 Wed, 17 Aug 2022 02:22:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oO8gz-00013I-Pi
 for xen-changelog@lists.xenproject.org; Wed, 17 Aug 2022 02:22:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oO8gz-0002zQ-Nl
 for xen-changelog@lists.xenproject.org; Wed, 17 Aug 2022 02:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oO8gz-0004VP-My
 for xen-changelog@lists.xenproject.org; Wed, 17 Aug 2022 02:22:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+iADr+m7VvIRlfYBdcqjiOvF1LkfOHN0qo/RfkP1LlI=; b=vNHARwfAU2UCnGOstChFq72Hbp
	OoQDV7JOk17gN6k6yAvy+IqvFzENDST8u+5xE+F8dnZzbvvHriWcfWULuBSdsAt468NaH1Q9yH7+e
	HjKsncGHiEyki3AJJNES07u0WaQ/mpHtmctIDhp6KkD8rFdxj+2LIUBE3iRyDOPgkTes=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/flask/utils: list build targets in $(TARGETS)
Message-Id: <E1oO8gz-0004VP-My@xenbits.xenproject.org>
Date: Wed, 17 Aug 2022 02:22:01 +0000

commit e450af698fc606828bf839c2d782a82e256e9715
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Tue Aug 16 11:18:39 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 16 11:18:39 2022 +0200

    tools/flask/utils: list build targets in $(TARGETS)
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Henry Wang <Henry.Wang@arm.com>
    Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 tools/flask/utils/Makefile | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/flask/utils/Makefile b/tools/flask/utils/Makefile
index db567b13dc..6be134142a 100644
--- a/tools/flask/utils/Makefile
+++ b/tools/flask/utils/Makefile
@@ -4,10 +4,10 @@ include $(XEN_ROOT)/tools/Rules.mk
 CFLAGS += -Werror
 CFLAGS += $(CFLAGS_libxenctrl)
 
-CLIENTS := flask-loadpolicy flask-setenforce flask-getenforce flask-label-pci flask-get-bool flask-set-bool
+TARGETS := flask-loadpolicy flask-setenforce flask-getenforce flask-label-pci flask-get-bool flask-set-bool
 
 .PHONY: all
-all: $(CLIENTS)
+all: $(TARGETS)
 
 flask-loadpolicy: loadpolicy.o
 	$(CC) $(LDFLAGS) $< $(LDLIBS) $(LDLIBS_libxenctrl) -o $@
@@ -29,7 +29,7 @@ flask-set-bool: set-bool.o
 
 .PHONY: clean
 clean:
-	$(RM) *.o $(CLIENTS) $(DEPS_RM)
+	$(RM) *.o $(TARGETS) $(DEPS_RM)
 
 .PHONY: distclean
 distclean: clean
@@ -37,10 +37,10 @@ distclean: clean
 .PHONY: install
 install: all
 	$(INSTALL_DIR) $(DESTDIR)$(sbindir)
-	$(INSTALL_PROG) $(CLIENTS) $(DESTDIR)$(sbindir)
+	$(INSTALL_PROG) $(TARGETS) $(DESTDIR)$(sbindir)
 
 .PHONY: uninstall
 uninstall:
-	rm -f $(addprefix $(DESTDIR)$(sbindir)/, $(CLIENTS))
+	rm -f $(addprefix $(DESTDIR)$(sbindir)/, $(TARGETS))
 
 -include $(DEPS_INCLUDE)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Aug 17 02:22:12 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 17 Aug 2022 02:22:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.388613.625305 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oO8hA-00015f-Ny; Wed, 17 Aug 2022 02:22:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 388613.625305; Wed, 17 Aug 2022 02: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 1oO8hA-00015Y-LH; Wed, 17 Aug 2022 02:22:12 +0000
Received: by outflank-mailman (input) for mailman id 388613;
 Wed, 17 Aug 2022 02:22:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oO8h9-00015Q-SK
 for xen-changelog@lists.xenproject.org; Wed, 17 Aug 2022 02:22:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oO8h9-0002zv-Ra
 for xen-changelog@lists.xenproject.org; Wed, 17 Aug 2022 02:22:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oO8h9-0004Vo-QU
 for xen-changelog@lists.xenproject.org; Wed, 17 Aug 2022 02:22:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=W4enauxNeNNQhG0op8Iq5ZN2TmBuhbmYyM35ZCHH4bA=; b=pJs64YXRcRKL7O/J4r7zcpxAd1
	cj3uV1BjaL+8LypWVLO5eQ/4iWVF0pXt5dE8NkvOLFyK4OEuS2cB7CpYSSRTEyv+704wB4hxYWe3x
	mYzbmfr48Ri64s4n7KSduC94ZCpL8yQhHDFrqf+wryOheBejHsiz+G7RQOuq7+2PyRaI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] drivers/char: add support for USB3 DbC debugger
Message-Id: <E1oO8h9-0004Vo-QU@xenbits.xenproject.org>
Date: Wed, 17 Aug 2022 02:22:11 +0000

commit 791f216361f36437a6a5db005366d71c57afc881
Author:     Connor Davis <davisc@ainfosec.com>
AuthorDate: Tue Aug 16 11:20:01 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 16 11:20:01 2022 +0200

    drivers/char: add support for USB3 DbC debugger
    
    [Connor]
    Xue is a cross-platform USB 3 debugger that drives the Debug
    Capability (DbC) of xHCI-compliant host controllers. This patch
    implements the operations needed for xue to initialize the host
    controller's DbC and communicate with it. It also implements a struct
    uart_driver that uses xue as a backend. Note that only target -> host
    communication is supported for now. To use Xue as a console, add
    'console=dbgp dbgp=xhci' to the command line.
    
    [Marek]
    The Xue driver is taken from https://github.com/connojd/xue and heavily
    refactored to fit into Xen code base. Major changes include:
    - rename to xhci_dbc
    - drop support for non-Xen systems
    - drop xue_ops abstraction
    - use Xen's native helper functions for PCI access
    - move all the code to xue.c, drop "inline"
    - build for x86 only
    - annotate functions with cf_check
    - adjust for Xen's code style
    
    At this stage, only the first xHCI is considered, and only output is
    supported. Later patches add support for choosing specific device, and
    input handling.
    The driver is initiallized before memory allocator works, so all the
    transfer buffers (about 230KiB of them) are allocated statically and will
    use memory even if XUE console is not selected. The driver can be
    disabled build time to reclaim this memory.
    Most of this memory is shared with the controller via DMA. Later patch
    will adjust structures placement to avoid anything else to be placed on
    those DMA-reachable pages. This also means str_buf cannot use static
    initializer, without reserving (at least) a whole page page in .data (or
    more, when combined with other structures).
    
    Signed-off-by: Connor Davis <davisc@ainfosec.com>
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 docs/misc/xen-command-line.pandoc |    5 +
 xen/arch/x86/include/asm/fixmap.h |    4 +
 xen/arch/x86/setup.c              |    1 +
 xen/drivers/char/Kconfig          |    9 +
 xen/drivers/char/Makefile         |    1 +
 xen/drivers/char/xhci-dbc.c       | 1029 +++++++++++++++++++++++++++++++++++++
 xen/include/xen/serial.h          |    5 +
 7 files changed, 1054 insertions(+)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index fa56e880b3..cbfd163813 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -721,10 +721,15 @@ Available alternatives, with their meaning, are:
 
 ### dbgp
 > `= ehci[ <integer> | @pci<bus>:<slot>.<func> ]`
+> `= xhci`
 
 Specify the USB controller to use, either by instance number (when going
 over the PCI busses sequentially) or by PCI device (must be on segment 0).
 
+Use `ehci` for EHCI debug port, use `xhci` for XHCI debug capability (output
+only). XHCI driver will wait indefinitely for the debug host to connect - make
+sure the cable is connected.
+
 ### debug_stack_lines
 > `= <integer>`
 
diff --git a/xen/arch/x86/include/asm/fixmap.h b/xen/arch/x86/include/asm/fixmap.h
index 20746afd0a..bc39ffe896 100644
--- a/xen/arch/x86/include/asm/fixmap.h
+++ b/xen/arch/x86/include/asm/fixmap.h
@@ -25,6 +25,8 @@
 #include <asm/msi.h>
 #include <acpi/apei.h>
 
+#define MAX_XHCI_PAGES 16
+
 /*
  * Here we define all the compile-time 'special' virtual
  * addresses. The point is to have a constant address at
@@ -43,6 +45,8 @@ enum fixed_addresses {
     FIX_COM_BEGIN,
     FIX_COM_END,
     FIX_EHCI_DBGP,
+    FIX_XHCI_BEGIN,
+    FIX_XHCI_END = FIX_XHCI_BEGIN + MAX_XHCI_PAGES - 1,
 #ifdef CONFIG_XEN_GUEST
     FIX_PV_CONSOLE,
     FIX_XEN_SHARED_INFO,
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index f08b07b8de..e05189f649 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -950,6 +950,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
     ns16550.irq     = 3;
     ns16550_init(1, &ns16550);
     ehci_dbgp_init();
+    xhci_dbc_uart_init();
     console_init_preirq();
 
     if ( pvh_boot )
diff --git a/xen/drivers/char/Kconfig b/xen/drivers/char/Kconfig
index dec58bc993..06350c3873 100644
--- a/xen/drivers/char/Kconfig
+++ b/xen/drivers/char/Kconfig
@@ -84,3 +84,12 @@ config SERIAL_TX_BUFSIZE
 	  the nearest power of 2.
 
 	  Default value is 16384 (16kiB).
+
+config XHCI
+	bool "XHCI DbC UART driver"
+	depends on X86
+	help
+	  This selects the USB based XHCI debug capability to be usable as a UART.
+	  Enabling this option makes Xen use extra ~230KiB memory, even if XHCI UART
+	  is not selected.
+	  If you have an x86 based system with USB3, say Y.
diff --git a/xen/drivers/char/Makefile b/xen/drivers/char/Makefile
index 14e67cf072..e7e374775d 100644
--- a/xen/drivers/char/Makefile
+++ b/xen/drivers/char/Makefile
@@ -8,6 +8,7 @@ obj-$(CONFIG_HAS_MVEBU) += mvebu-uart.o
 obj-$(CONFIG_HAS_OMAP) += omap-uart.o
 obj-$(CONFIG_HAS_SCIF) += scif-uart.o
 obj-$(CONFIG_HAS_EHCI) += ehci-dbgp.o
+obj-$(CONFIG_XHCI) += xhci-dbc.o
 obj-$(CONFIG_HAS_IMX_LPUART) += imx-lpuart.o
 obj-$(CONFIG_ARM) += arm-uart.o
 obj-y += serial.o
diff --git a/xen/drivers/char/xhci-dbc.c b/xen/drivers/char/xhci-dbc.c
new file mode 100644
index 0000000000..a16c81b9e7
--- /dev/null
+++ b/xen/drivers/char/xhci-dbc.c
@@ -0,0 +1,1029 @@
+/*
+ * drivers/char/xhci-dbc.c
+ *
+ * Xen port for the xue debugger
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Copyright (c) 2019 Assured Information Security.
+ */
+
+#include <xen/delay.h>
+#include <xen/mm.h>
+#include <xen/param.h>
+#include <xen/serial.h>
+#include <xen/timer.h>
+#include <xen/types.h>
+#include <asm/fixmap.h>
+#include <asm/io.h>
+#include <asm/string.h>
+#include <asm/system.h>
+
+/* uncomment to have dbc_uart_dump() debug function */
+/* #define DBC_DEBUG 1 */
+
+#define DBC_POLL_INTERVAL 100 /* us */
+
+#define DBC_PAGE_SIZE 4096U
+
+/* Supported xHC PCI configurations */
+#define DBC_XHC_CLASSC 0xC0330U
+
+/* DbC idVendor and idProduct */
+#define DBC_DBC_VENDOR 0x1D6B
+#define DBC_DBC_PRODUCT 0x0010
+#define DBC_DBC_PROTOCOL 0x0000
+
+#define DBC_DOORBELL_TARGET_SHIFT 8
+#define DBC_DOORBELL_TARGET_MASK (0xFF << DBC_DOORBELL_TARGET_SHIFT)
+
+/* DCCTRL fields */
+#define DBC_CTRL_DCR 0
+#define DBC_CTRL_HOT 2
+#define DBC_CTRL_HIT 3
+#define DBC_CTRL_DRC 4
+#define DBC_CTRL_DCE 31
+
+/* DCPORTSC fields */
+#define DBC_PSC_PED 1
+#define DBC_PSC_CSC 17
+#define DBC_PSC_PRC 21
+#define DBC_PSC_PLC 22
+#define DBC_PSC_CEC 23
+
+#define DBC_PSC_ACK_MASK                                                       \
+    ((1UL << DBC_PSC_CSC) | (1UL << DBC_PSC_PRC) | (1UL << DBC_PSC_PLC) |      \
+     (1UL << DBC_PSC_CEC))
+
+#define dbc_debug(...) printk("dbc debug: " __VA_ARGS__)
+#define dbc_alert(...) printk("dbc alert: " __VA_ARGS__)
+#define dbc_error(...) printk("dbc error: " __VA_ARGS__)
+
+/******************************************************************************
+ * TRB ring (summarized from the manual):
+ *
+ * TRB rings are circular queues of TRBs shared between the xHC and the driver.
+ * Each ring has one producer and one consumer. The DbC has one event
+ * ring and two transfer rings; one IN and one OUT.
+ *
+ * The DbC hardware is the producer on the event ring, and
+ * dbc driver is the consumer. This means that event TRBs are read-only from
+ * the dbc driver.
+ *
+ * OTOH, dbc drive is the producer of transfer TRBs on the two transfer
+ * rings, so dbc driver enqueues transfers, and the hardware dequeues
+ * them. The dequeue pointer of a transfer ring is read by
+ * dbc driver by examining the latest transfer event TRB on the event ring. The
+ * transfer event TRB contains the address of the transfer TRB that generated
+ * the event.
+ *
+ * To make each transfer ring circular, the last TRB must be a link TRB, which
+ * points to the beginning of the next queue. Note that this implementation
+ * does not support multiple segments, so each link TRB points back to the
+ * beginning of its own segment.
+ ******************************************************************************/
+
+/* TRB types */
+enum {
+    XHCI_TRB_NORM = 1,
+    XHCI_TRB_LINK = 6,
+    XHCI_TRB_TFRE = 32,
+    XHCI_TRB_PSCE = 34
+};
+
+/* TRB completion codes */
+enum {
+    XHCI_TRB_CC_SUCCESS = 1,
+    XHCI_TRB_CC_TRB_ERR = 5,
+};
+
+/* DbC endpoint types */
+enum {
+    XHCI_EP_BULK_OUT = 2,
+    XHCI_EP_BULK_IN = 6,
+};
+
+/* DMA/MMIO structures */
+struct xhci_trb {
+    uint64_t params;
+    uint32_t status;
+    uint32_t ctrl;
+};
+
+/* log2(sizeof(struct xhci_trb)) */
+#define XHCI_TRB_SHIFT 4
+
+struct xhci_erst_segment {
+    uint64_t base;
+    uint16_t size;
+    uint8_t rsvdz[6];
+};
+
+/* Arbitrary length, must fit every DBC_STRING_* */
+#define MAX_STRING_LENGTH 16
+
+#define DBC_STRINGS_COUNT 4
+#define DBC_STRING_LANGID "\x09\x04"
+#define DBC_STRING_MANUFACTURER "Xen"
+#define DBC_STRING_PRODUCT "Debug console"
+#define DBC_STRING_SERIAL "0"
+
+#define XHCI_DT_STRING 3
+
+struct xhci_string_descriptor {
+    uint8_t size;
+    uint8_t type;
+    uint16_t string[MAX_STRING_LENGTH];
+};
+
+#define DBC_CTX_SIZE 16
+#define DBC_CTX_BYTES (DBC_CTX_SIZE * 4)
+
+struct xhci_dbc_ctx {
+    union {
+        uint32_t info[DBC_CTX_SIZE];
+        struct {
+            uint64_t string0_ptr;
+            uint64_t manufacturer_ptr;
+            uint64_t product_ptr;
+            uint64_t serial_ptr;
+            uint8_t string0_size;
+            uint8_t manufacturer_size;
+            uint8_t product_size;
+            uint8_t serial_size;
+        };
+    };
+    uint32_t ep_out[DBC_CTX_SIZE];
+    uint32_t ep_in[DBC_CTX_SIZE];
+};
+
+struct dbc_reg {
+    uint32_t id;
+    uint32_t db;
+    uint32_t erstsz;
+    uint32_t rsvdz;
+    uint64_t erstba;
+    uint64_t erdp;
+    uint32_t ctrl;
+    uint32_t st;
+    uint32_t portsc;
+    uint32_t rsvdp;
+    uint64_t cp;
+    uint32_t ddi1;
+    uint32_t ddi2;
+};
+
+#define DBC_TRB_MAX_TFR (DBC_PAGE_SIZE << 4)
+#define DBC_TRB_PER_PAGE (DBC_PAGE_SIZE / sizeof(struct xhci_trb))
+
+/* Defines the size in bytes of TRB rings as 2^DBC_TRB_RING_ORDER * 4096 */
+#ifndef DBC_TRB_RING_ORDER
+#define DBC_TRB_RING_ORDER 4
+#endif
+#define DBC_TRB_RING_CAP (DBC_TRB_PER_PAGE * (1 << DBC_TRB_RING_ORDER))
+#define DBC_TRB_RING_BYTES (DBC_TRB_RING_CAP * sizeof(struct xhci_trb))
+#define DBC_TRB_RING_MASK (DBC_TRB_RING_BYTES - 1U)
+
+struct xhci_trb_ring {
+    struct xhci_trb *trb; /* Array of TRBs */
+    uint32_t enq; /* The offset of the enqueue ptr */
+    uint32_t deq; /* The offset of the dequeue ptr */
+    uint8_t cyc; /* Cycle state toggled on each wrap-around */
+    uint8_t db; /* Doorbell target */
+    uint64_t dma; /* Physical address (for the device) */
+};
+
+#define DBC_DB_OUT 0x0
+#define DBC_DB_IN 0x1
+#define DBC_DB_INVAL 0xFF
+
+/* Defines the size in bytes of work rings as 2^DBC_WORK_RING_ORDER * 4096 */
+#ifndef DBC_WORK_RING_ORDER
+#define DBC_WORK_RING_ORDER 3
+#endif
+#define DBC_WORK_RING_CAP (DBC_PAGE_SIZE * (1 << DBC_WORK_RING_ORDER))
+#define DBC_WORK_RING_BYTES DBC_WORK_RING_CAP
+
+#if DBC_WORK_RING_CAP > DBC_TRB_MAX_TFR
+#error "DBC_WORK_RING_ORDER must be at most 4"
+#endif
+
+struct dbc_work_ring {
+    uint8_t *buf;
+    uint32_t enq;
+    uint32_t deq;
+    uint64_t dma;
+};
+
+struct dbc {
+    struct dbc_reg __iomem *dbc_reg;
+    struct xhci_dbc_ctx *dbc_ctx;
+    struct xhci_erst_segment *dbc_erst;
+    struct xhci_trb_ring dbc_ering;
+    struct xhci_trb_ring dbc_oring;
+    struct xhci_trb_ring dbc_iring;
+    struct dbc_work_ring dbc_owork;
+    struct xhci_string_descriptor *dbc_str;
+
+    pci_sbdf_t sbdf;
+    uint64_t xhc_mmio_phys;
+    uint64_t xhc_dbc_offset;
+    void __iomem *xhc_mmio;
+
+    bool open;
+};
+
+static void *dbc_sys_map_xhc(uint64_t phys, size_t size)
+{
+    size_t i;
+
+    if ( size != MAX_XHCI_PAGES * PAGE_SIZE )
+        return NULL;
+
+    for ( i = FIX_XHCI_END; i >= FIX_XHCI_BEGIN; i-- )
+    {
+        set_fixmap_nocache(i, phys);
+        phys += PAGE_SIZE;
+    }
+
+    /*
+     * The fixmap grows downward, so the lowest virt is
+     * at the highest index
+     */
+    return fix_to_virt(FIX_XHCI_END);
+}
+
+static bool __init dbc_init_xhc(struct dbc *dbc)
+{
+    uint32_t bar0;
+    uint64_t bar1;
+    uint64_t bar_val;
+    uint64_t bar_size;
+    uint64_t devfn;
+    uint16_t cmd;
+    size_t xhc_mmio_size;
+
+    /*
+     * Search PCI bus 0 for the xHC. All the host controllers supported so far
+     * are part of the chipset and are on bus 0.
+     */
+    for ( devfn = 0; devfn < 256; devfn++ )
+    {
+        pci_sbdf_t sbdf = PCI_SBDF(0, 0, devfn);
+        uint8_t hdr = pci_conf_read8(sbdf, PCI_HEADER_TYPE);
+
+        if ( hdr == 0 || hdr == 0x80 )
+        {
+            if ( (pci_conf_read32(sbdf, PCI_CLASS_REVISION) >> 8) == DBC_XHC_CLASSC )
+            {
+                dbc->sbdf = sbdf;
+                break;
+            }
+        }
+    }
+
+    if ( !dbc->sbdf.sbdf )
+    {
+        dbc_error("Compatible xHC not found on bus 0\n");
+        return false;
+    }
+
+    /* ...we found it, so parse the BAR and map the registers */
+    bar0 = pci_conf_read32(dbc->sbdf, PCI_BASE_ADDRESS_0);
+    bar1 = pci_conf_read32(dbc->sbdf, PCI_BASE_ADDRESS_1);
+
+    /* IO BARs not allowed; BAR must be 64-bit */
+    if ( (bar0 & PCI_BASE_ADDRESS_SPACE) != PCI_BASE_ADDRESS_SPACE_MEMORY ||
+         (bar0 & PCI_BASE_ADDRESS_MEM_TYPE_MASK) != PCI_BASE_ADDRESS_MEM_TYPE_64 )
+        return false;
+
+    bar_val = (bar1 << 32) | (bar0 & PCI_BASE_ADDRESS_MEM_MASK);
+    if ( !bar_val || !(bar_val + (bar_val & -bar_val)) )
+    {
+        dbc_error("firmware initialization of MMIO BAR required\n");
+        return false;
+    }
+
+    cmd = pci_conf_read16(dbc->sbdf, PCI_COMMAND);
+    pci_conf_write16(dbc->sbdf, PCI_COMMAND, cmd & ~PCI_COMMAND_MEMORY);
+
+    pci_conf_write32(dbc->sbdf, PCI_BASE_ADDRESS_0, 0xFFFFFFFF);
+    pci_conf_write32(dbc->sbdf, PCI_BASE_ADDRESS_1, 0xFFFFFFFF);
+    bar_size = pci_conf_read32(dbc->sbdf, PCI_BASE_ADDRESS_0);
+    bar_size |= (uint64_t)pci_conf_read32(dbc->sbdf, PCI_BASE_ADDRESS_1) << 32;
+    xhc_mmio_size = ~(bar_size & PCI_BASE_ADDRESS_MEM_MASK) + 1;
+    pci_conf_write32(dbc->sbdf, PCI_BASE_ADDRESS_0, bar0);
+    pci_conf_write32(dbc->sbdf, PCI_BASE_ADDRESS_1, bar1);
+
+    pci_conf_write16(dbc->sbdf, PCI_COMMAND, cmd);
+
+    dbc->xhc_mmio_phys = (bar0 & PCI_BASE_ADDRESS_MEM_MASK) | (bar1 << 32);
+    dbc->xhc_mmio = dbc_sys_map_xhc(dbc->xhc_mmio_phys, xhc_mmio_size);
+
+    if ( dbc->xhc_mmio == NULL )
+        return false;
+
+    if ( (cmd & PCI_COMMAND_MEMORY) == 0 )
+        pci_conf_write16(dbc->sbdf, PCI_COMMAND, cmd | PCI_COMMAND_MEMORY);
+
+    return true;
+}
+
+/**
+ * The first register of the debug capability is found by traversing the
+ * host controller's capability list (xcap) until a capability
+ * with ID = 0xA is found. The xHCI capability list begins at address
+ * mmio + (HCCPARAMS1[31:16] << 2).
+ */
+static struct dbc_reg __iomem *xhci_find_dbc(struct dbc *dbc)
+{
+    const uint32_t __iomem *xcap;
+    uint32_t xcap_val;
+    uint32_t next;
+    uint32_t id = 0;
+    const void __iomem *mmio = dbc->xhc_mmio;
+    const uint32_t __iomem *hccp1 = mmio + 0x10;
+    const uint32_t DBC_ID = 0xA;
+    int ttl = 48;
+
+    xcap = mmio;
+    /*
+     * This is initially an offset to the first capability. All the offsets
+     * (both in HCCP1 and then next capability pointer) are dword-based.
+     */
+    next = (readl(hccp1) & 0xFFFF0000) >> 16;
+
+    while ( id != DBC_ID && next && ttl-- )
+    {
+        xcap += next;
+        xcap_val = readl(xcap);
+        id = xcap_val & 0xFF;
+        next = (xcap_val & 0xFF00) >> 8;
+    }
+
+    if ( id != DBC_ID )
+        return NULL;
+
+    dbc->xhc_dbc_offset = (uint64_t)xcap - (uint64_t)mmio;
+    return (struct dbc_reg __iomem *)xcap;
+}
+
+/**
+ * Fields with the same interpretation for every TRB type (section 4.11.1).
+ * These are the fields defined in the TRB template, minus the ENT bit. That
+ * bit is the toggle cycle bit in link TRBs, so it shouldn't be in the
+ * template.
+ */
+static uint32_t xhci_trb_cyc(const struct xhci_trb *trb)
+{
+    return trb->ctrl & 0x1;
+}
+
+static uint32_t xhci_trb_type(const struct xhci_trb *trb)
+{
+    return (trb->ctrl & 0xFC00) >> 10;
+}
+
+static void xhci_trb_set_cyc(struct xhci_trb *trb, uint32_t c)
+{
+    trb->ctrl &= ~0x1U;
+    trb->ctrl |= c;
+}
+
+static void xhci_trb_set_type(struct xhci_trb *trb, uint32_t t)
+{
+    trb->ctrl &= ~0xFC00U;
+    trb->ctrl |= (t << 10);
+}
+
+/* Fields for normal TRBs */
+static void xhci_trb_norm_set_buf(struct xhci_trb *trb, uint64_t addr)
+{
+    trb->params = addr;
+}
+
+static void xhci_trb_norm_set_len(struct xhci_trb *trb, uint32_t len)
+{
+    trb->status &= ~0x1FFFFU;
+    trb->status |= len;
+}
+
+static void xhci_trb_norm_set_ioc(struct xhci_trb *trb)
+{
+    trb->ctrl |= 0x20;
+}
+
+/**
+ * Fields for Transfer Event TRBs (see section 6.4.2.1). Note that event
+ * TRBs are read-only from software
+ */
+static uint64_t xhci_trb_tfre_ptr(const struct xhci_trb *trb)
+{
+    return trb->params;
+}
+
+/* Fields for link TRBs (section 6.4.4.1) */
+static void xhci_trb_link_set_rsp(struct xhci_trb *trb, uint64_t rsp)
+{
+    trb->params = rsp;
+}
+
+static void xhci_trb_link_set_tc(struct xhci_trb *trb)
+{
+    trb->ctrl |= 0x2;
+}
+
+static void xhci_trb_ring_init(const struct dbc *dbc,
+                              struct xhci_trb_ring *ring, int producer,
+                              int doorbell)
+{
+    memset(ring->trb, 0, DBC_TRB_RING_CAP * sizeof(ring->trb[0]));
+
+    ring->enq = 0;
+    ring->deq = 0;
+    ring->cyc = 1;
+    ring->db = (uint8_t)doorbell;
+    ring->dma = virt_to_maddr(ring->trb);
+
+    /*
+     * Producer implies transfer ring, so we have to place a
+     * link TRB at the end that points back to trb[0]
+     */
+    if ( producer )
+    {
+        struct xhci_trb *trb = &ring->trb[DBC_TRB_RING_CAP - 1];
+        xhci_trb_set_type(trb, XHCI_TRB_LINK);
+        xhci_trb_link_set_tc(trb);
+        xhci_trb_link_set_rsp(trb, virt_to_maddr(ring->trb));
+    }
+}
+
+static bool xhci_trb_ring_full(const struct xhci_trb_ring *ring)
+{
+    return ((ring->enq + 1) & (DBC_TRB_RING_CAP - 1)) == ring->deq;
+}
+
+static bool dbc_work_ring_full(const struct dbc_work_ring *ring)
+{
+    return ((ring->enq + 1) & (DBC_WORK_RING_CAP - 1)) == ring->deq;
+}
+
+static unsigned int dbc_work_ring_size(const struct dbc_work_ring *ring)
+{
+    if ( ring->enq >= ring->deq )
+        return ring->enq - ring->deq;
+
+    return DBC_WORK_RING_CAP - ring->deq + ring->enq;
+}
+
+static void dbc_push_trb(struct dbc *dbc, struct xhci_trb_ring *ring,
+                         uint64_t dma, uint64_t len)
+{
+    struct xhci_trb trb;
+
+    if ( ring->enq == DBC_TRB_RING_CAP - 1 )
+    {
+        /*
+         * We have to make sure the xHC processes the link TRB in order
+         * for wrap-around to work properly. We do this by marking the
+         * xHC as owner of the link TRB by setting the TRB's cycle bit
+         * (just like with normal TRBs).
+         */
+        struct xhci_trb *link = &ring->trb[ring->enq];
+        xhci_trb_set_cyc(link, ring->cyc);
+
+        ring->enq = 0;
+        ring->cyc ^= 1;
+    }
+
+    trb.params = 0;
+    trb.status = 0;
+    trb.ctrl = 0;
+
+    xhci_trb_set_type(&trb, XHCI_TRB_NORM);
+    xhci_trb_set_cyc(&trb, ring->cyc);
+
+    xhci_trb_norm_set_buf(&trb, dma);
+    xhci_trb_norm_set_len(&trb, (uint32_t)len);
+    xhci_trb_norm_set_ioc(&trb);
+
+    ring->trb[ring->enq++] = trb;
+    cache_flush(&ring->trb[ring->enq - 1], sizeof(trb));
+}
+
+static unsigned int dbc_push_work(struct dbc *dbc, struct dbc_work_ring *ring,
+                             const char *buf, unsigned int len)
+{
+    unsigned int i = 0;
+    unsigned int end, start = ring->enq;
+
+    while ( !dbc_work_ring_full(ring) && i < len )
+    {
+        ring->buf[ring->enq] = buf[i++];
+        ring->enq = (ring->enq + 1) & (DBC_WORK_RING_CAP - 1);
+    }
+
+    end = ring->enq;
+
+    if ( end > start )
+        cache_flush(&ring->buf[start], end - start);
+    else if ( i > 0 )
+    {
+        cache_flush(&ring->buf[start], DBC_WORK_RING_CAP - start);
+        cache_flush(&ring->buf[0], end);
+    }
+
+    return i;
+}
+
+/*
+ * Note that if IN transfer support is added, then this
+ * will need to be changed; it assumes an OUT transfer ring only
+ */
+static void dbc_pop_events(struct dbc *dbc)
+{
+    struct dbc_reg *reg = dbc->dbc_reg;
+    struct xhci_trb_ring *er = &dbc->dbc_ering;
+    struct xhci_trb_ring *tr = &dbc->dbc_oring;
+    struct xhci_trb *event = &er->trb[er->deq];
+    uint64_t erdp = readq(&reg->erdp);
+    uint32_t portsc;
+    uint64_t event_ptr;
+    unsigned int trb_idx;
+
+    BUILD_BUG_ON((1 << XHCI_TRB_SHIFT) != sizeof(struct xhci_trb));
+
+    rmb();
+
+    while ( xhci_trb_cyc(event) == er->cyc )
+    {
+        switch (xhci_trb_type(event))
+        {
+        case XHCI_TRB_TFRE:
+            event_ptr = xhci_trb_tfre_ptr(event);
+            /*
+             * trb_idx is just completed TRB, so set the dequeue ptr one
+             * position further.
+             */
+            if ( event_ptr - tr->dma < DBC_TRB_RING_BYTES )
+            {
+                trb_idx = (event_ptr - tr->dma) >> XHCI_TRB_SHIFT;
+                tr->deq = (trb_idx + 1) & (DBC_TRB_RING_CAP - 1);
+            }
+            else
+                dbc_alert("event: TRB 0x%lx not found in any ring\n",
+                          event_ptr);
+            break;
+        case XHCI_TRB_PSCE:
+            portsc = readl(&reg->portsc);
+            portsc |= DBC_PSC_ACK_MASK & portsc;
+            writel(portsc, &reg->portsc);
+            break;
+        default:
+            break;
+        }
+
+        er->cyc = (er->deq == DBC_TRB_RING_CAP - 1) ? er->cyc ^ 1 : er->cyc;
+        er->deq = (er->deq + 1) & (DBC_TRB_RING_CAP - 1);
+        event = &er->trb[er->deq];
+    }
+
+    erdp = er->dma + (er->deq << XHCI_TRB_SHIFT);
+    wmb();
+    writeq(erdp, &reg->erdp);
+}
+
+/**
+ * dbc_init_ep
+ *
+ * Initializes the endpoint as specified in sections 7.6.3.2 and 7.6.9.2.
+ * Each endpoint is Bulk, so the MaxPStreams, LSA, HID, CErr, FE,
+ * Interval, Mult, and Max ESIT Payload fields are all 0.
+ *
+ * Max packet size: 1024
+ * Max burst size: debug mbs (from dbc_reg->ctrl register)
+ * EP type: 2 for OUT bulk, 6 for IN bulk
+ * TR dequeue ptr: physical base address of transfer ring
+ * Avg TRB length: software defined (see 4.14.1.1 for suggested defaults)
+ */
+static void dbc_init_ep(uint32_t *ep, uint64_t mbs, uint32_t type,
+                        uint64_t ring_dma)
+{
+    memset(ep, 0, DBC_CTX_BYTES);
+
+    ep[1] = (1024 << 16) | ((uint32_t)mbs << 8) | (type << 3);
+    ep[2] = (ring_dma & 0xFFFFFFFF) | 1;
+    ep[3] = ring_dma >> 32;
+    ep[4] = 3 * 1024;
+}
+
+static void dbc_init_string_single(struct xhci_string_descriptor *string,
+                                   const char *ascii_str,
+                                   uint64_t *str_ptr,
+                                   uint8_t *str_size_ptr)
+{
+    size_t i, len = strlen(ascii_str);
+
+    string->size = offsetof(typeof(*string), string) + len * 2;
+    string->type = XHCI_DT_STRING;
+    /* ASCII to UTF16 conversion */
+    for ( i = 0; i < len; i++ )
+        string->string[i] = ascii_str[i];
+    *str_ptr = virt_to_maddr(string);
+    *str_size_ptr = string->size;
+}
+
+/* Initialize the DbC info with USB string descriptor addresses */
+static void dbc_init_strings(struct dbc *dbc, uint32_t *info)
+{
+    BUILD_BUG_ON(sizeof(DBC_STRING_LANGID) > MAX_STRING_LENGTH);
+    BUILD_BUG_ON(sizeof(DBC_STRING_MANUFACTURER) > MAX_STRING_LENGTH);
+    BUILD_BUG_ON(sizeof(DBC_STRING_PRODUCT) > MAX_STRING_LENGTH);
+    BUILD_BUG_ON(sizeof(DBC_STRING_SERIAL) > MAX_STRING_LENGTH);
+
+    dbc_init_string_single(&dbc->dbc_str[0], DBC_STRING_LANGID,
+                           &dbc->dbc_ctx->string0_ptr,
+                           &dbc->dbc_ctx->string0_size);
+    dbc_init_string_single(&dbc->dbc_str[1], DBC_STRING_MANUFACTURER,
+                           &dbc->dbc_ctx->manufacturer_ptr,
+                           &dbc->dbc_ctx->manufacturer_size);
+    dbc_init_string_single(&dbc->dbc_str[2], DBC_STRING_PRODUCT,
+                           &dbc->dbc_ctx->product_ptr,
+                           &dbc->dbc_ctx->product_size);
+    dbc_init_string_single(&dbc->dbc_str[3], DBC_STRING_SERIAL,
+                           &dbc->dbc_ctx->serial_ptr,
+                           &dbc->dbc_ctx->serial_size);
+}
+
+static void dbc_enable_dbc(struct dbc *dbc)
+{
+    struct dbc_reg *reg = dbc->dbc_reg;
+
+    wmb();
+    writel(readl(&reg->ctrl) | (1U << DBC_CTRL_DCE), &reg->ctrl);
+    wmb();
+
+    while ( (readl(&reg->ctrl) & (1U << DBC_CTRL_DCE)) == 0 )
+        cpu_relax();
+
+    wmb();
+    writel(readl(&reg->portsc) | (1U << DBC_PSC_PED), &reg->portsc);
+    wmb();
+
+    while ( (readl(&reg->ctrl) & (1U << DBC_CTRL_DCR)) == 0 )
+        cpu_relax();
+}
+
+static void dbc_disable_dbc(struct dbc *dbc)
+{
+    struct dbc_reg *reg = dbc->dbc_reg;
+
+    writel(readl(&reg->portsc) & ~(1U << DBC_PSC_PED), &reg->portsc);
+    wmb();
+    writel(readl(&reg->ctrl) & ~(1U << DBC_CTRL_DCE), &reg->ctrl);
+
+    while ( readl(&reg->ctrl) & (1U << DBC_CTRL_DCE) )
+        cpu_relax();
+}
+
+static int dbc_init_dbc(struct dbc *dbc)
+{
+    uint64_t erdp = 0;
+    uint64_t mbs = 0;
+    uint16_t cmd;
+    struct dbc_reg *reg = xhci_find_dbc(dbc);
+
+    if ( !reg )
+        return 0;
+
+    dbc->dbc_reg = reg;
+    dbc_disable_dbc(dbc);
+
+    xhci_trb_ring_init(dbc, &dbc->dbc_ering, 0, DBC_DB_INVAL);
+    xhci_trb_ring_init(dbc, &dbc->dbc_oring, 1, DBC_DB_OUT);
+    xhci_trb_ring_init(dbc, &dbc->dbc_iring, 1, DBC_DB_IN);
+
+    erdp = virt_to_maddr(dbc->dbc_ering.trb);
+    if ( !erdp )
+        return 0;
+
+    memset(dbc->dbc_erst, 0, sizeof(*dbc->dbc_erst));
+    dbc->dbc_erst->base = erdp;
+    dbc->dbc_erst->size = DBC_TRB_RING_CAP;
+
+    mbs = (readl(&reg->ctrl) & 0xFF0000) >> 16;
+
+    memset(dbc->dbc_ctx, 0, sizeof(*dbc->dbc_ctx));
+    dbc_init_strings(dbc, dbc->dbc_ctx->info);
+    dbc_init_ep(dbc->dbc_ctx->ep_out, mbs, XHCI_EP_BULK_OUT,
+                dbc->dbc_oring.dma);
+    dbc_init_ep(dbc->dbc_ctx->ep_in, mbs, XHCI_EP_BULK_IN,
+                dbc->dbc_iring.dma);
+
+    writel(1, &reg->erstsz);
+    writeq(virt_to_maddr(dbc->dbc_erst), &reg->erstba);
+    writeq(erdp, &reg->erdp);
+    writeq(virt_to_maddr(dbc->dbc_ctx), &reg->cp);
+    writel((DBC_DBC_VENDOR << 16) | DBC_DBC_PROTOCOL, &reg->ddi1);
+    writel(DBC_DBC_PRODUCT, &reg->ddi2);
+
+    cache_flush(dbc->dbc_ctx, sizeof(*dbc->dbc_ctx));
+    cache_flush(dbc->dbc_erst, sizeof(*dbc->dbc_erst));
+    cache_flush(dbc->dbc_ering.trb, DBC_TRB_RING_BYTES);
+    cache_flush(dbc->dbc_oring.trb, DBC_TRB_RING_BYTES);
+    cache_flush(dbc->dbc_iring.trb, DBC_TRB_RING_BYTES);
+    cache_flush(dbc->dbc_owork.buf, DBC_WORK_RING_BYTES);
+
+    cmd = pci_conf_read16(dbc->sbdf, PCI_COMMAND);
+    pci_conf_write16(dbc->sbdf, PCI_COMMAND, cmd | PCI_COMMAND_MASTER);
+
+    return 1;
+}
+
+static void dbc_init_work_ring(struct dbc *dbc,
+                               struct dbc_work_ring *wrk)
+{
+    wrk->enq = 0;
+    wrk->deq = 0;
+    wrk->dma = virt_to_maddr(wrk->buf);
+}
+
+/**
+ * Initialize the DbC and enable it for transfers. First map in the DbC
+ * registers from the host controller's MMIO region. Then allocate and map
+ * DMA for the event and transfer rings. Finally, enable the DbC for
+ * the host to enumerate. On success, the DbC is ready to send packets.
+ *
+ * @param dbc the dbc to open (!= NULL)
+ * @return true iff dbc_open succeeded
+ */
+static bool __init dbc_open(struct dbc *dbc)
+{
+    if ( !dbc )
+        return false;
+
+    if ( !dbc_init_xhc(dbc) )
+        return false;
+
+    if ( !dbc_init_dbc(dbc) )
+        return false;
+
+    dbc_init_work_ring(dbc, &dbc->dbc_owork);
+    dbc_enable_dbc(dbc);
+    dbc->open = true;
+
+    return true;
+}
+
+/*
+ * Ensure DbC is still running, handle events, and possibly re-enable if cable
+ * was re-plugged. Returns true if DbC is operational.
+ */
+static bool dbc_ensure_running(struct dbc *dbc)
+{
+    struct dbc_reg *reg = dbc->dbc_reg;
+    uint32_t ctrl;
+
+    dbc_pop_events(dbc);
+
+    ctrl = readl(&reg->ctrl);
+    if ( !(ctrl & (1U << DBC_CTRL_DCR)) )
+    {
+        return false;
+    }
+
+    if ( ctrl & (1U << DBC_CTRL_DRC) )
+    {
+        writel(ctrl | (1U << DBC_CTRL_DRC), &reg->ctrl);
+        writel(readl(&reg->portsc) | (1U << DBC_PSC_PED), &reg->portsc);
+        wmb();
+    }
+
+    return true;
+}
+
+/**
+ * Commit the pending transfer TRBs to the DbC. This notifies
+ * the DbC of any previously-queued data on the work ring and
+ * rings the doorbell.
+ *
+ * @param dbc the dbc to flush
+ * @param trb the ring containing the TRBs to transfer
+ * @param wrk the work ring containing data to be flushed
+ */
+static void dbc_flush(struct dbc *dbc, struct xhci_trb_ring *trb,
+                      struct dbc_work_ring *wrk)
+{
+    struct dbc_reg *reg = dbc->dbc_reg;
+    uint32_t db = (readl(&reg->db) & ~DBC_DOORBELL_TARGET_MASK) |
+                  (trb->db << DBC_DOORBELL_TARGET_SHIFT);
+
+    if ( xhci_trb_ring_full(trb) )
+        return;
+
+    if ( wrk->enq == wrk->deq )
+        return;
+    else if ( wrk->enq > wrk->deq )
+    {
+        dbc_push_trb(dbc, trb, wrk->dma + wrk->deq, wrk->enq - wrk->deq);
+        wrk->deq = wrk->enq;
+    }
+    else
+    {
+        dbc_push_trb(dbc, trb, wrk->dma + wrk->deq,
+                     DBC_WORK_RING_CAP - wrk->deq);
+        wrk->deq = 0;
+        if ( wrk->enq > 0 && !xhci_trb_ring_full(trb) )
+        {
+            dbc_push_trb(dbc, trb, wrk->dma, wrk->enq);
+            wrk->deq = wrk->enq;
+        }
+    }
+
+    wmb();
+    writel(db, &reg->db);
+}
+
+/**
+ * Queue a single character to the DbC. A transfer TRB will be created
+ * if the character is a newline and the DbC will be notified that data is
+ * available for writing to the debug host.
+ *
+ * @param dbc the dbc to write to
+ * @param c the character to write
+ * @return the number of bytes written
+ */
+static int64_t dbc_putc(struct dbc *dbc, char c)
+{
+    if ( !dbc_push_work(dbc, &dbc->dbc_owork, &c, 1) )
+        return 0;
+
+    if ( !dbc_ensure_running(dbc) )
+        return 1;
+
+    if ( c == '\n' )
+        dbc_flush(dbc, &dbc->dbc_oring, &dbc->dbc_owork);
+
+    return 1;
+}
+
+struct dbc_uart {
+    struct dbc dbc;
+    struct timer timer;
+    spinlock_t *lock;
+};
+
+static struct dbc_uart dbc_uart;
+
+static void cf_check dbc_uart_poll(void *data)
+{
+    struct serial_port *port = data;
+    struct dbc_uart *uart = port->uart;
+    struct dbc *dbc = &uart->dbc;
+    unsigned long flags = 0;
+
+    if ( spin_trylock_irqsave(&port->tx_lock, flags) )
+    {
+        if ( dbc_ensure_running(dbc) )
+            dbc_flush(dbc, &dbc->dbc_oring, &dbc->dbc_owork);
+        spin_unlock_irqrestore(&port->tx_lock, flags);
+    }
+
+    serial_tx_interrupt(port, guest_cpu_user_regs());
+    set_timer(&uart->timer, NOW() + MICROSECS(DBC_POLL_INTERVAL));
+}
+
+static void __init cf_check dbc_uart_init_preirq(struct serial_port *port)
+{
+    struct dbc_uart *uart = port->uart;
+    uart->lock = &port->tx_lock;
+}
+
+static void __init cf_check dbc_uart_init_postirq(struct serial_port *port)
+{
+    struct dbc_uart *uart = port->uart;
+
+    serial_async_transmit(port);
+    init_timer(&uart->timer, dbc_uart_poll, port, 0);
+    set_timer(&uart->timer, NOW() + MILLISECS(1));
+
+    if ( pci_ro_device(0, uart->dbc.sbdf.bus, uart->dbc.sbdf.devfn) )
+        printk(XENLOG_WARNING
+               "Failed to mark read-only %pp used for XHCI console\n",
+               &uart->dbc.sbdf);
+}
+
+static int cf_check dbc_uart_tx_ready(struct serial_port *port)
+{
+    struct dbc_uart *uart = port->uart;
+    struct dbc *dbc = &uart->dbc;
+
+    return DBC_WORK_RING_CAP - dbc_work_ring_size(&dbc->dbc_owork);
+}
+
+static void cf_check dbc_uart_putc(struct serial_port *port, char c)
+{
+    struct dbc_uart *uart = port->uart;
+    dbc_putc(&uart->dbc, c);
+}
+
+static void cf_check dbc_uart_flush(struct serial_port *port)
+{
+    s_time_t goal;
+    struct dbc_uart *uart = port->uart;
+    struct dbc *dbc = &uart->dbc;
+
+    if ( dbc_ensure_running(dbc) )
+        dbc_flush(dbc, &dbc->dbc_oring, &dbc->dbc_owork);
+
+    goal = NOW() + MICROSECS(DBC_POLL_INTERVAL);
+    if ( uart->timer.expires > goal )
+        set_timer(&uart->timer, goal);
+}
+
+static struct uart_driver dbc_uart_driver = {
+    .init_preirq = dbc_uart_init_preirq,
+    .init_postirq = dbc_uart_init_postirq,
+    .tx_ready = dbc_uart_tx_ready,
+    .putc = dbc_uart_putc,
+    .flush = dbc_uart_flush,
+};
+
+/* Those are accessed via DMA. */
+static struct xhci_trb evt_trb[DBC_TRB_RING_CAP];
+static struct xhci_trb out_trb[DBC_TRB_RING_CAP];
+static struct xhci_trb in_trb[DBC_TRB_RING_CAP];
+static struct xhci_erst_segment erst __aligned(16);
+static struct xhci_dbc_ctx ctx __aligned(16);
+static uint8_t out_wrk_buf[DBC_WORK_RING_CAP];
+static struct xhci_string_descriptor str_buf[DBC_STRINGS_COUNT];
+
+static char __initdata opt_dbgp[30];
+
+string_param("dbgp", opt_dbgp);
+
+void __init xhci_dbc_uart_init(void)
+{
+    struct dbc_uart *uart = &dbc_uart;
+    struct dbc *dbc = &uart->dbc;
+
+    if ( strncmp(opt_dbgp, "xhci", 4) )
+        return;
+
+    memset(dbc, 0, sizeof(*dbc));
+
+    dbc->dbc_ctx = &ctx;
+    dbc->dbc_erst = &erst;
+    dbc->dbc_ering.trb = evt_trb;
+    dbc->dbc_oring.trb = out_trb;
+    dbc->dbc_iring.trb = in_trb;
+    dbc->dbc_owork.buf = out_wrk_buf;
+    dbc->dbc_str = str_buf;
+
+    if ( dbc_open(dbc) )
+        serial_register_uart(SERHND_DBGP, &dbc_uart_driver, &dbc_uart);
+}
+
+#ifdef DBC_DEBUG
+static void dbc_dump(struct dbc *dbc)
+{
+    struct dbc_reg *r = dbc->dbc_reg;
+
+    dbc_debug("XHCI DBC DUMP:\n");
+    dbc_debug("    ctrl: 0x%x stat: 0x%x psc: 0x%x\n",
+              readl(&r->ctrl), readl(&r->st), readl(&r->portsc));
+    dbc_debug("    id: 0x%x, db: 0x%x\n",
+              readl(&r->id), readl(&r->db));
+    dbc_debug("    erstsz: %u, erstba: 0x%lx\n",
+              readl(&r->erstsz), readq(&r->erstba));
+    dbc_debug("    erdp: 0x%lx, cp: 0x%lx\n",
+              readq(&r->erdp), readq(&r->cp));
+    dbc_debug("    ddi1: 0x%x, ddi2: 0x%x\n",
+              readl(&r->ddi1), readl(&r->ddi2));
+    dbc_debug("    erstba == virt_to_dma(erst): %d\n",
+              readq(&r->erstba) == virt_to_maddr(dbc->dbc_erst));
+    dbc_debug("    erdp == virt_to_dma(erst[0].base): %d\n",
+              readq(&r->erdp) == dbc->dbc_erst[0].base);
+    dbc_debug("    cp == virt_to_dma(ctx): %d\n",
+              readq(&r->cp) == virt_to_maddr(dbc->dbc_ctx));
+}
+
+static void dbc_uart_dump(void)
+{
+    struct dbc_uart *uart = &dbc_uart;
+    struct dbc *dbc = &uart->dbc;
+
+    dbc_dump(dbc);
+}
+#endif
diff --git a/xen/include/xen/serial.h b/xen/include/xen/serial.h
index 6548f0b0a9..181e026967 100644
--- a/xen/include/xen/serial.h
+++ b/xen/include/xen/serial.h
@@ -171,6 +171,11 @@ struct ns16550_defaults {
 };
 void ns16550_init(int index, struct ns16550_defaults *defaults);
 void ehci_dbgp_init(void);
+#ifdef CONFIG_XHCI
+void xhci_dbc_uart_init(void);
+#else
+static void inline xhci_dbc_uart_init(void) {};
+#endif
 
 void arm_uart_init(void);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Aug 17 02:22:23 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 17 Aug 2022 02:22:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.388614.625310 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oO8hL-000197-RI; Wed, 17 Aug 2022 02:22:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 388614.625310; Wed, 17 Aug 2022 02: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 1oO8hL-000190-OU; Wed, 17 Aug 2022 02:22:23 +0000
Received: by outflank-mailman (input) for mailman id 388614;
 Wed, 17 Aug 2022 02:22:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oO8hK-00018p-06
 for xen-changelog@lists.xenproject.org; Wed, 17 Aug 2022 02:22:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oO8hJ-000307-Vb
 for xen-changelog@lists.xenproject.org; Wed, 17 Aug 2022 02:22:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oO8hJ-0004Wf-Tp
 for xen-changelog@lists.xenproject.org; Wed, 17 Aug 2022 02:22:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=aSOy2nOXEuRk4AjHpAuq6s8t6zrQCy6LRMAMhsLbdHo=; b=q6OWhzXNuOnsqLOMFKjxQgdCeX
	w38/t4mlrW3iWPcg445QpavCIg8hJjxtMTnCG/M1g7j2cCyu0xzxi9pPHYIS7hokgYiwWo5th8ZTH
	e6A17gK9zV+swaOx1Ely1wvZn7tzTEg31xHOwK4g+gro0iCzboP2GqcVyMRokUGOTjBc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] drivers/char: reset XHCI ports when initializing dbc
Message-Id: <E1oO8hJ-0004Wf-Tp@xenbits.xenproject.org>
Date: Wed, 17 Aug 2022 02:22:21 +0000

commit 3a669ea835f5100b7945da7b89d461883e3add01
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Tue Aug 16 11:22:18 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 16 11:22:18 2022 +0200

    drivers/char: reset XHCI ports when initializing dbc
    
    Reset ports, to force host system to re-enumerate devices. Otheriwse it
    will require the cable to be re-plugged, or will wait in the
    "configuring" state indefinitely.
    
    Trick and code copied from Linux:
    drivers/usb/early/xhci-dbc.c:xdbc_start()->xdbc_reset_debug_port()
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/char/xhci-dbc.c | 75 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 75 insertions(+)

diff --git a/xen/drivers/char/xhci-dbc.c b/xen/drivers/char/xhci-dbc.c
index a16c81b9e7..8c9dfa6cfc 100644
--- a/xen/drivers/char/xhci-dbc.c
+++ b/xen/drivers/char/xhci-dbc.c
@@ -66,6 +66,10 @@
     ((1UL << DBC_PSC_CSC) | (1UL << DBC_PSC_PRC) | (1UL << DBC_PSC_PLC) |      \
      (1UL << DBC_PSC_CEC))
 
+#define XHC_EXT_PORT_MAJOR(x)  (((x) >> 24) & 0xff)
+#define PORT_RESET             (1 << 4)
+#define PORT_CONNECT           (1 << 0)
+
 #define dbc_debug(...) printk("dbc debug: " __VA_ARGS__)
 #define dbc_alert(...) printk("dbc alert: " __VA_ARGS__)
 #define dbc_error(...) printk("dbc error: " __VA_ARGS__)
@@ -666,6 +670,73 @@ static void dbc_init_strings(struct dbc *dbc, uint32_t *info)
                            &dbc->dbc_ctx->serial_size);
 }
 
+static void dbc_do_reset_debug_port(struct dbc *dbc,
+                                    unsigned int id, unsigned int count)
+{
+    uint32_t __iomem *ops_reg;
+    uint32_t __iomem *portsc;
+    uint32_t val, cap_length;
+    unsigned int i;
+
+    cap_length = readl(dbc->xhc_mmio) & 0xff;
+    ops_reg = dbc->xhc_mmio + cap_length;
+
+    id--;
+    for ( i = id; i < (id + count); i++ )
+    {
+        portsc = ops_reg + 0x100 + i * 0x4;
+        val = readl(portsc);
+        if ( !(val & PORT_CONNECT) )
+            writel(val | PORT_RESET, portsc);
+    }
+}
+
+static void dbc_reset_debug_port(struct dbc *dbc)
+{
+    uint32_t val, port_offset, port_count;
+    uint32_t __iomem *xcap;
+    uint32_t xcap_val;
+    uint32_t next;
+    uint32_t id;
+    uint8_t __iomem *mmio = (uint8_t *)dbc->xhc_mmio;
+    uint32_t __iomem *hccp1 = (uint32_t *)(mmio + 0x10);
+    const uint32_t PROTOCOL_ID = 0x2;
+    int ttl = 48;
+
+    xcap = (uint32_t *)dbc->xhc_mmio;
+    /*
+     * This is initially an offset to the first capability. All the offsets
+     * (both in HCCP1 and then next capability pointer are dword-based.
+     */
+    next = (readl(hccp1) & 0xFFFF0000) >> 16;
+
+    /*
+     * Look for "supported protocol" capability, major revision 3.
+     * There may be multiple of them.
+     */
+    while ( next && ttl-- )
+    {
+        xcap += next;
+        xcap_val = readl(xcap);
+        id = xcap_val & 0xFF;
+        next = (xcap_val & 0xFF00) >> 8;
+
+        if ( id != PROTOCOL_ID )
+            continue;
+
+        if ( XHC_EXT_PORT_MAJOR(xcap_val) != 0x3 )
+            continue;
+
+        /* extract ports offset and count from the capability structure */
+        val = readl(xcap + 2);
+        port_offset = val & 0xff;
+        port_count = (val >> 8) & 0xff;
+
+        /* and reset them all */
+        dbc_do_reset_debug_port(dbc, port_offset, port_count);
+    }
+}
+
 static void dbc_enable_dbc(struct dbc *dbc)
 {
     struct dbc_reg *reg = dbc->dbc_reg;
@@ -677,6 +748,10 @@ static void dbc_enable_dbc(struct dbc *dbc)
     while ( (readl(&reg->ctrl) & (1U << DBC_CTRL_DCE)) == 0 )
         cpu_relax();
 
+    /* reset ports on initial open, to force re-enumerating by the host */
+    if ( !dbc->open )
+        dbc_reset_debug_port(dbc);
+
     wmb();
     writel(readl(&reg->portsc) | (1U << DBC_PSC_PED), &reg->portsc);
     wmb();
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Aug 17 02:22:33 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 17 Aug 2022 02:22:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.388615.625314 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oO8hV-0001BZ-Sq; Wed, 17 Aug 2022 02:22:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 388615.625314; Wed, 17 Aug 2022 02: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 1oO8hV-0001BR-QB; Wed, 17 Aug 2022 02:22:33 +0000
Received: by outflank-mailman (input) for mailman id 388615;
 Wed, 17 Aug 2022 02:22:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oO8hU-0001B5-4O
 for xen-changelog@lists.xenproject.org; Wed, 17 Aug 2022 02:22:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oO8hU-00030H-2d
 for xen-changelog@lists.xenproject.org; Wed, 17 Aug 2022 02:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oO8hU-0004X6-1e
 for xen-changelog@lists.xenproject.org; Wed, 17 Aug 2022 02:22:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vheevAGj5+klrt9SZy1jOiQOUUbdm4vvG5oz3HowmLc=; b=SSssNpHD1IlSHHl7NMHJCz5JCg
	QgYr8AmA1aDpsMvvtaNq5nOnKpEvw1uvUJG6d7f9/o9kYelMiG+XNdXBSDmJYwp//9udpOfT/zKbZ
	ayr+WcjSBYjTIn98KQ1UVJ8jM9EBuHSGSnKhqai5M1jib1diaCDbnb40BBUcBMv6QZT4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] drivers/char: add support for selecting specific xhci
Message-Id: <E1oO8hU-0004X6-1e@xenbits.xenproject.org>
Date: Wed, 17 Aug 2022 02:22:32 +0000

commit deb23751e11a559ca9b9b4c2dc355e2f5250c0d2
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Tue Aug 16 11:22:54 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 16 11:22:54 2022 +0200

    drivers/char: add support for selecting specific xhci
    
    Handle parameters similar to dbgp=ehci.
    
    Implement this by not resettting dbc->sbdf again in dbc_init_xhc(), but
    using a value found there if non-zero. Additionally, add xue->xhc_num to
    select n-th controller.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 docs/misc/xen-command-line.pandoc |  2 +-
 xen/drivers/char/xhci-dbc.c       | 59 +++++++++++++++++++++++++++++++--------
 2 files changed, 48 insertions(+), 13 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index cbfd163813..9a79385a37 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -721,7 +721,7 @@ Available alternatives, with their meaning, are:
 
 ### dbgp
 > `= ehci[ <integer> | @pci<bus>:<slot>.<func> ]`
-> `= xhci`
+> `= xhci[ <integer> | @pci<bus>:<slot>.<func> ]`
 
 Specify the USB controller to use, either by instance number (when going
 over the PCI busses sequentially) or by PCI device (must be on segment 0).
diff --git a/xen/drivers/char/xhci-dbc.c b/xen/drivers/char/xhci-dbc.c
index 8c9dfa6cfc..ca7d4a6213 100644
--- a/xen/drivers/char/xhci-dbc.c
+++ b/xen/drivers/char/xhci-dbc.c
@@ -246,6 +246,7 @@ struct dbc {
     void __iomem *xhc_mmio;
 
     bool open;
+    unsigned int xhc_num; /* look for n-th xhc */
 };
 
 static void *dbc_sys_map_xhc(uint64_t phys, size_t size)
@@ -278,24 +279,37 @@ static bool __init dbc_init_xhc(struct dbc *dbc)
     uint16_t cmd;
     size_t xhc_mmio_size;
 
-    /*
-     * Search PCI bus 0 for the xHC. All the host controllers supported so far
-     * are part of the chipset and are on bus 0.
-     */
-    for ( devfn = 0; devfn < 256; devfn++ )
+    if ( dbc->sbdf.sbdf == 0 )
     {
-        pci_sbdf_t sbdf = PCI_SBDF(0, 0, devfn);
-        uint8_t hdr = pci_conf_read8(sbdf, PCI_HEADER_TYPE);
-
-        if ( hdr == 0 || hdr == 0x80 )
+        /*
+         * Search PCI bus 0 for the xHC. All the host controllers supported so
+         * far are part of the chipset and are on bus 0.
+         */
+        for ( devfn = 0; devfn < 256; devfn++ )
         {
-            if ( (pci_conf_read32(sbdf, PCI_CLASS_REVISION) >> 8) == DBC_XHC_CLASSC )
+            pci_sbdf_t sbdf = PCI_SBDF(0, 0, devfn);
+            uint8_t hdr = pci_conf_read8(sbdf, PCI_HEADER_TYPE);
+
+            if ( hdr == 0 || hdr == 0x80 )
             {
-                dbc->sbdf = sbdf;
-                break;
+                if ( (pci_conf_read32(sbdf, PCI_CLASS_REVISION) >> 8) ==
+                     DBC_XHC_CLASSC )
+                {
+                    if ( dbc->xhc_num-- )
+                        continue;
+                    dbc->sbdf = sbdf;
+                    break;
+                }
             }
         }
     }
+    else
+    {
+        /* Verify if selected device is really xHC */
+        if ( (pci_conf_read32(dbc->sbdf, PCI_CLASS_REVISION) >> 8) !=
+             DBC_XHC_CLASSC )
+            dbc->sbdf.sbdf = 0;
+    }
 
     if ( !dbc->sbdf.sbdf )
     {
@@ -1052,12 +1066,33 @@ void __init xhci_dbc_uart_init(void)
 {
     struct dbc_uart *uart = &dbc_uart;
     struct dbc *dbc = &uart->dbc;
+    const char *e;
 
     if ( strncmp(opt_dbgp, "xhci", 4) )
         return;
 
     memset(dbc, 0, sizeof(*dbc));
 
+    if ( isdigit(opt_dbgp[4]) )
+    {
+        dbc->xhc_num = simple_strtoul(opt_dbgp + 4, &e, 10);
+    }
+    else if ( strncmp(opt_dbgp + 4, "@pci", 4) == 0 )
+    {
+        unsigned int bus, slot, func;
+
+        e = parse_pci(opt_dbgp + 8, NULL, &bus, &slot, &func);
+        if ( !e || *e )
+        {
+            printk(XENLOG_ERR
+                   "Invalid dbgp= PCI device spec: '%s'\n",
+                   opt_dbgp + 8);
+            return;
+        }
+
+        dbc->sbdf = PCI_SBDF(0, bus, slot, func);
+    }
+
     dbc->dbc_ctx = &ctx;
     dbc->dbc_erst = &erst;
     dbc->dbc_ering.trb = evt_trb;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Aug 17 02:22:43 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 17 Aug 2022 02:22:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.388616.625318 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oO8hf-0001Ev-UT; Wed, 17 Aug 2022 02:22:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 388616.625318; Wed, 17 Aug 2022 02: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 1oO8hf-0001En-Rj; Wed, 17 Aug 2022 02:22:43 +0000
Received: by outflank-mailman (input) for mailman id 388616;
 Wed, 17 Aug 2022 02:22:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oO8he-0001ER-7t
 for xen-changelog@lists.xenproject.org; Wed, 17 Aug 2022 02:22:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oO8he-00030T-75
 for xen-changelog@lists.xenproject.org; Wed, 17 Aug 2022 02:22:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oO8he-0004Xb-4q
 for xen-changelog@lists.xenproject.org; Wed, 17 Aug 2022 02:22:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=F9P4xKn0uOUHuM5ueSuKTQSgQcvT+rsMfiqSdTYuL28=; b=Hy8P7RqC2kgPxGdC/u6eadO674
	sfaVpqJ6b7yK0ut7b4sXsfHCrQ7GKLN5/NO8oqpVkWzHyqyI/zGp+0vI6X1Ooiw/PvPFHqzwuvIDT
	DJUkdiyyoY1q77N8QSOSLaa53xTlRxAblb9ctqNLbGYWNa5eo2kDIlYaVrKR1VboHMmM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] drivers/char: make serial_parse_handle take const argument
Message-Id: <E1oO8he-0004Xb-4q@xenbits.xenproject.org>
Date: Wed, 17 Aug 2022 02:22:42 +0000

commit ee8d9d0c1c1a8cef8ebcae16e0f574542d319e26
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Tue Aug 16 11:23:26 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 16 11:23:26 2022 +0200

    drivers/char: make serial_parse_handle take const argument
    
    It doesn't modify it, and it will be necessary in a subsequent patch.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/char/serial.c | 2 +-
 xen/include/xen/serial.h  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/char/serial.c b/xen/drivers/char/serial.c
index f6c944bd30..47899222ce 100644
--- a/xen/drivers/char/serial.c
+++ b/xen/drivers/char/serial.c
@@ -301,7 +301,7 @@ char serial_getc(int handle)
     return c & 0x7f;
 }
 
-int __init serial_parse_handle(char *conf)
+int __init serial_parse_handle(const char *conf)
 {
     int handle, flags = 0;
 
diff --git a/xen/include/xen/serial.h b/xen/include/xen/serial.h
index 181e026967..4cd4ae5e6f 100644
--- a/xen/include/xen/serial.h
+++ b/xen/include/xen/serial.h
@@ -109,7 +109,7 @@ void serial_init_postirq(void);
 void serial_endboot(void);
 
 /* Takes a config string and creates a numeric handle on the COM port. */
-int serial_parse_handle(char *conf);
+int serial_parse_handle(const char *conf);
 
 /* Transmit a single character via the specified COM port. */
 void serial_putc(int handle, char c);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Aug 17 02:22:54 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 17 Aug 2022 02:22:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.388617.625322 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oO8hp-0001Hp-Vp; Wed, 17 Aug 2022 02:22:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 388617.625322; Wed, 17 Aug 2022 02: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 1oO8hp-0001Hh-TB; Wed, 17 Aug 2022 02:22:53 +0000
Received: by outflank-mailman (input) for mailman id 388617;
 Wed, 17 Aug 2022 02:22:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oO8ho-0001HK-Ax
 for xen-changelog@lists.xenproject.org; Wed, 17 Aug 2022 02:22:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oO8ho-00030d-AG
 for xen-changelog@lists.xenproject.org; Wed, 17 Aug 2022 02:22:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oO8ho-0004YI-9O
 for xen-changelog@lists.xenproject.org; Wed, 17 Aug 2022 02:22:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=OOQbLOhst5s4z2eUhU82XU735Cpjw2Zk4mC3VO1xPzw=; b=09LPuzbfFHB8VDh3YeW593G4z9
	G/6XxoksVve9C1b1jp6/I+obTE9TL2W/rBpow4M9m6hDsWR2kxOxGUZh5bhgtUeHW2aqzJF0vu+/p
	Nr5vNg05x7dxmyDhBC6STHlBNwDd1yq+8ORE2gqoWGBOQEktG5i0nwZcgpDIDAobTzLs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: rename PGC_reserved to PGC_static
Message-Id: <E1oO8ho-0004YI-9O@xenbits.xenproject.org>
Date: Wed, 17 Aug 2022 02:22:52 +0000

commit 283abca2997141ea780fc86ca9524b1d837243d3
Author:     Penny Zheng <penny.zheng@arm.com>
AuthorDate: Tue Aug 16 11:23:56 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 16 11:23:56 2022 +0200

    xen/arm: rename PGC_reserved to PGC_static
    
    PGC_reserved could be ambiguous, and we have to tell what the pages are
    reserved for, so this commit intends to rename PGC_reserved to
    PGC_static, which clearly indicates the page is reserved for static
    memory.
    
    Signed-off-by: Penny Zheng <penny.zheng@arm.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/include/asm/mm.h |  6 +++---
 xen/common/page_alloc.c       | 22 +++++++++++-----------
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/xen/arch/arm/include/asm/mm.h b/xen/arch/arm/include/asm/mm.h
index 6c0a3c789f..da25251cda 100644
--- a/xen/arch/arm/include/asm/mm.h
+++ b/xen/arch/arm/include/asm/mm.h
@@ -121,9 +121,9 @@ struct page_info
   /* Page is Xen heap? */
 #define _PGC_xen_heap     PG_shift(2)
 #define PGC_xen_heap      PG_mask(1, 2)
-  /* Page is reserved */
-#define _PGC_reserved     PG_shift(3)
-#define PGC_reserved      PG_mask(1, 3)
+  /* Page is static memory */
+#define _PGC_static    PG_shift(3)
+#define PGC_static     PG_mask(1, 3)
 /* ... */
 /* Page is broken? */
 #define _PGC_broken       PG_shift(7)
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 8bdaffeb3d..00fa24e330 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -151,8 +151,8 @@
 #define p2m_pod_offline_or_broken_replace(pg) BUG_ON(pg != NULL)
 #endif
 
-#ifndef PGC_reserved
-#define PGC_reserved 0
+#ifndef PGC_static
+#define PGC_static 0
 #endif
 
 #ifndef PGT_TYPE_INFO_INITIALIZER
@@ -2342,7 +2342,7 @@ int assign_pages(
 
         for ( i = 0; i < nr; i++ )
         {
-            ASSERT(!(pg[i].count_info & ~(PGC_extra | PGC_reserved)));
+            ASSERT(!(pg[i].count_info & ~(PGC_extra | PGC_static)));
             if ( pg[i].count_info & PGC_extra )
                 extra_pages++;
         }
@@ -2402,7 +2402,7 @@ int assign_pages(
         page_set_owner(&pg[i], d);
         smp_wmb(); /* Domain pointer must be visible before updating refcnt. */
         pg[i].count_info =
-            (pg[i].count_info & (PGC_extra | PGC_reserved)) | PGC_allocated | 1;
+            (pg[i].count_info & (PGC_extra | PGC_static)) | PGC_allocated | 1;
 
         page_list_add_tail(&pg[i], page_to_list(d, &pg[i]));
     }
@@ -2708,8 +2708,8 @@ void __init free_staticmem_pages(struct page_info *pg, unsigned long nr_mfns,
             scrub_one_page(pg);
         }
 
-        /* In case initializing page of static memory, mark it PGC_reserved. */
-        pg[i].count_info |= PGC_reserved;
+        /* In case initializing page of static memory, mark it PGC_static. */
+        pg[i].count_info |= PGC_static;
     }
 }
 
@@ -2738,8 +2738,8 @@ static struct page_info * __init acquire_staticmem_pages(mfn_t smfn,
 
     for ( i = 0; i < nr_mfns; i++ )
     {
-        /* The page should be reserved and not yet allocated. */
-        if ( pg[i].count_info != (PGC_state_free | PGC_reserved) )
+        /* The page should be static and not yet allocated. */
+        if ( pg[i].count_info != (PGC_state_free | PGC_static) )
         {
             printk(XENLOG_ERR
                    "pg[%lu] Static MFN %"PRI_mfn" c=%#lx t=%#x\n",
@@ -2753,10 +2753,10 @@ static struct page_info * __init acquire_staticmem_pages(mfn_t smfn,
                                 &tlbflush_timestamp);
 
         /*
-         * Preserve flag PGC_reserved and change page state
+         * Preserve flag PGC_static and change page state
          * to PGC_state_inuse.
          */
-        pg[i].count_info = PGC_reserved | PGC_state_inuse;
+        pg[i].count_info = PGC_static | PGC_state_inuse;
         /* Initialise fields which have other uses for free pages. */
         pg[i].u.inuse.type_info = PGT_TYPE_INFO_INITIALIZER;
         page_set_owner(&pg[i], NULL);
@@ -2778,7 +2778,7 @@ static struct page_info * __init acquire_staticmem_pages(mfn_t smfn,
 
  out_err:
     while ( i-- )
-        pg[i].count_info = PGC_reserved | PGC_state_free;
+        pg[i].count_info = PGC_static | PGC_state_free;
 
     spin_unlock(&heap_lock);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Aug 17 12:11:10 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 17 Aug 2022 12:11:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.388887.625655 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oOHt3-0005Du-DS; Wed, 17 Aug 2022 12:11:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 388887.625655; Wed, 17 Aug 2022 12:11:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oOHt3-0005Dm-AZ; Wed, 17 Aug 2022 12:11:05 +0000
Received: by outflank-mailman (input) for mailman id 388887;
 Wed, 17 Aug 2022 12:11:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oOHt2-0005Dg-7F
 for xen-changelog@lists.xenproject.org; Wed, 17 Aug 2022 12:11:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oOHt2-0005yq-5U
 for xen-changelog@lists.xenproject.org; Wed, 17 Aug 2022 12:11:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oOHt2-0000Ms-4S
 for xen-changelog@lists.xenproject.org; Wed, 17 Aug 2022 12:11:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tV4yU4i0MPVRDrFHz5Z3y/vuWE1nRZURaImkxvllzTM=; b=qWP3XMBUsG/D/zNEOziVVtREy+
	az2lW+fhY0tjKI3fTJwhdOYyGRcozPqkUEKLFQ+lLwARNZw588r16/FzGb+GUYpkILIFPkxKZHxmy
	FrXEOZM4NsjfTXEIxyl97xeX3vUy4CzkFqIaAoD/0TGy/mu58lLNzPO20TWnQEdYE3pE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/traps: Make nmi_show_execution_state() more useful
Message-Id: <E1oOHt2-0000Ms-4S@xenbits.xenproject.org>
Date: Wed, 17 Aug 2022 12:11:04 +0000

commit 0f2611c524385f7bffeee67635a488a5a29b6ba4
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Aug 12 18:25:55 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Aug 17 12:50:48 2022 +0100

    x86/traps: Make nmi_show_execution_state() more useful
    
     * Always emit current.  It's critically important.
     * Do not render (0000000000000000) for the symbol in guest context.  It's
       just line-noise.  Instead, explicitly identify which Xen vs guest context.
     * Try to tabulate the data, because there is often lots of it.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/traps.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index b713ef7e77..7207390118 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -767,9 +767,13 @@ static int cf_check nmi_show_execution_state(
 
     if ( opt_show_all )
         show_execution_state(regs);
+    else if ( guest_mode(regs) )
+        printk(XENLOG_ERR "CPU%d\t%pv\t%04x:%p in guest\n",
+               cpu, current, regs->cs, _p(regs->rip));
     else
-        printk(XENLOG_ERR "CPU%d @ %04x:%08lx (%pS)\n", cpu, regs->cs,
-               regs->rip, guest_mode(regs) ? NULL : _p(regs->rip));
+        printk(XENLOG_ERR "CPU%d\t%pv\t%04x:%p in Xen: %pS\n",
+               cpu, current, regs->cs, _p(regs->rip), _p(regs->rip));
+
     cpumask_clear_cpu(cpu, &show_state_mask);
 
     return 1;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Aug 17 15:44:10 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 17 Aug 2022 15:44:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.389099.625915 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oOLDB-0004lA-F3; Wed, 17 Aug 2022 15:44:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 389099.625915; Wed, 17 Aug 2022 15:44:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oOLDB-0004l2-C2; Wed, 17 Aug 2022 15:44:05 +0000
Received: by outflank-mailman (input) for mailman id 389099;
 Wed, 17 Aug 2022 15:44:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oOLDA-0004kw-Ef
 for xen-changelog@lists.xenproject.org; Wed, 17 Aug 2022 15:44:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oOLDA-0001LF-D0
 for xen-changelog@lists.xenproject.org; Wed, 17 Aug 2022 15:44:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oOLDA-00027d-Bv
 for xen-changelog@lists.xenproject.org; Wed, 17 Aug 2022 15:44:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Wa/0Wr2YtJTCYhxF97YRtC29ys9aDgFB7aayg5csBOs=; b=xcXZQq+zlIoz9+6F3W+gQLHhxb
	tpEjvb8X2Y87Wi/s4el4xm+CsGTw81sHUu0UPesUb67UleMOeHOInQqG3wHVOJ2wbtDhZb6WCgTRB
	XVlL39QmdRGZ2CRJhsGql35dgTUDtxBz5vol2TPvbAo3YighxFhTaAc17WlEJ/zIyd+4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] build: Fix missing MAKEFLAGS --no-print-directory
Message-Id: <E1oOLDA-00027d-Bv@xenbits.xenproject.org>
Date: Wed, 17 Aug 2022 15:44:04 +0000

commit f2beaf876dce590ee9937b79cd3498f2fe9f661c
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Wed Aug 17 16:21:06 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Aug 17 16:35:33 2022 +0100

    build: Fix missing MAKEFLAGS --no-print-directory
    
    While we already have "--no-print-directory" added to the make flags
    in some cases, there's one case where the flags is missing, when doing
    an out-of-tree build with O=, e.g.
        cd xen; make O=build
    
    Without it, we just have loads of "Entering directory" and "Leaving
    directory" with the same directory.
    
    The comment and location in the Makefile are copied from Linux.
    
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/Makefile | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/Makefile b/xen/Makefile
index 69b4dc960f..106aff6a07 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -186,6 +186,11 @@ endif # root-make-done
 # We process the rest of the Makefile if this is the final invocation of make
 ifeq ($(need-sub-make),)
 
+# Do not print "Entering directory ...",
+# but we want to display it when entering to the output directory
+# so that IDEs/editors are able to understand relative filenames.
+MAKEFLAGS += --no-print-directory
+
 ifeq ($(abs_srctree),$(abs_objtree))
     # building in the source tree
     srctree := .
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 18 06:55:10 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 18 Aug 2022 06:55:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.389317.626133 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oOZQl-0005MX-FU; Thu, 18 Aug 2022 06:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 389317.626133; Thu, 18 Aug 2022 06:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oOZQl-0005MP-Bi; Thu, 18 Aug 2022 06:55:03 +0000
Received: by outflank-mailman (input) for mailman id 389317;
 Thu, 18 Aug 2022 06:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oOZQk-0005MJ-0d
 for xen-changelog@lists.xenproject.org; Thu, 18 Aug 2022 06:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oOZQj-0000f5-QX
 for xen-changelog@lists.xenproject.org; Thu, 18 Aug 2022 06:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oOZQj-0000RR-PN
 for xen-changelog@lists.xenproject.org; Thu, 18 Aug 2022 06:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fqc0MepIk4fg4poBhtdfCLJmQeBRINeUbZfHh8clBe4=; b=q4Fty1cv/voDl+F7vQY57gU1r5
	qeI9AHA2gW/DbvglSyu1klWvonYS7FYcsmX2lWIaKHmYOTWpaNuskklTyim514nEhthzXdkibSjao
	aYBmpRUfjNZl4S7nhg0VMqSf2siQ45B09vtwGvq2yR3DQpLjSxasJMmhCoC5sGPeVKbc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/traps: Make nmi_show_execution_state() more useful
Message-Id: <E1oOZQj-0000RR-PN@xenbits.xenproject.org>
Date: Thu, 18 Aug 2022 06:55:01 +0000

commit 0f2611c524385f7bffeee67635a488a5a29b6ba4
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Aug 12 18:25:55 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Aug 17 12:50:48 2022 +0100

    x86/traps: Make nmi_show_execution_state() more useful
    
     * Always emit current.  It's critically important.
     * Do not render (0000000000000000) for the symbol in guest context.  It's
       just line-noise.  Instead, explicitly identify which Xen vs guest context.
     * Try to tabulate the data, because there is often lots of it.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/traps.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index b713ef7e77..7207390118 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -767,9 +767,13 @@ static int cf_check nmi_show_execution_state(
 
     if ( opt_show_all )
         show_execution_state(regs);
+    else if ( guest_mode(regs) )
+        printk(XENLOG_ERR "CPU%d\t%pv\t%04x:%p in guest\n",
+               cpu, current, regs->cs, _p(regs->rip));
     else
-        printk(XENLOG_ERR "CPU%d @ %04x:%08lx (%pS)\n", cpu, regs->cs,
-               regs->rip, guest_mode(regs) ? NULL : _p(regs->rip));
+        printk(XENLOG_ERR "CPU%d\t%pv\t%04x:%p in Xen: %pS\n",
+               cpu, current, regs->cs, _p(regs->rip), _p(regs->rip));
+
     cpumask_clear_cpu(cpu, &show_state_mask);
 
     return 1;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 18 07:33:09 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 18 Aug 2022 07:33:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.389333.626159 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oOa1Z-0001pY-Lu; Thu, 18 Aug 2022 07:33:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 389333.626159; Thu, 18 Aug 2022 07:33:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oOa1Z-0001pO-Ij; Thu, 18 Aug 2022 07:33:05 +0000
Received: by outflank-mailman (input) for mailman id 389333;
 Thu, 18 Aug 2022 07:33:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oOa1Y-0001ol-K3
 for xen-changelog@lists.xenproject.org; Thu, 18 Aug 2022 07:33:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oOa1Y-0001Iy-HV
 for xen-changelog@lists.xenproject.org; Thu, 18 Aug 2022 07:33:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oOa1Y-0003qk-G3
 for xen-changelog@lists.xenproject.org; Thu, 18 Aug 2022 07:33:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hBRIJKRql+nvj38UTO2Gxb6zI4DA4uQPR2m5bADm8is=; b=y5NVNEjL1+Z6UfAYJ2FsQqFzXy
	Oj6FPhArKT0FCJHPd8NqzABMawlPiBX4FX28PEojrDxV4C84ectigKAUmbOlwIgaZ9rU+Z2wQZUCa
	fFTWlW/JCzLtoS7KG0A9Dqj7oR7IdrXbtr67KQulXlnyWhlbKz8zjcw3k415VRFNXfeM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/libxl: Replace deprecated -soundhw on QEMU command line
Message-Id: <E1oOa1Y-0003qk-G3@xenbits.xenproject.org>
Date: Thu, 18 Aug 2022 07:33:04 +0000

commit 62ca138c2c052187783aca3957d3f47c4dcfd683
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Thu Aug 18 09:25:50 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 18 09:25:50 2022 +0200

    tools/libxl: Replace deprecated -soundhw on QEMU command line
    
    -soundhw is deprecated since 825ff02911c9 ("audio: add soundhw
    deprecation notice"), QEMU v5.1, and is been remove for upcoming v7.1
    by 039a68373c45 ("introduce -audio as a replacement for -soundhw").
    
    Instead we can just add the sound card with "-device", for most option
    that "-soundhw" could handle. "-device" is an option that existed
    before QEMU 1.0, and could already be used to add audio hardware.
    
    The list of possible option for libxl's "soundhw" is taken the list
    from QEMU 7.0.
    
    The list of options for "soundhw" are listed in order of preference in
    the manual. The first three (hda, ac97, es1370) are PCI devices and
    easy to test on Linux, and the last four are ISA devices which doesn't
    seems to work out of the box on linux.
    
    The sound card 'pcspk' isn't listed even if it used to be accepted by
    '-soundhw' because QEMU crash when trying to add it to a Xen domain.
    Also, it wouldn't work with "-device" might need to be "-machine
    pcspk-audiodev=default" instead.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Jason Andryuk <jandryuk@gmail.com>
---
 docs/man/xl.cfg.5.pod.in                  |  6 +++---
 tools/libs/light/libxl_dm.c               | 19 ++++++++++++++++++-
 tools/libs/light/libxl_types_internal.idl | 10 ++++++++++
 3 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in
index 6d98d73d76..b2901e04cf 100644
--- a/docs/man/xl.cfg.5.pod.in
+++ b/docs/man/xl.cfg.5.pod.in
@@ -2555,9 +2555,9 @@ The form serial=DEVICE is also accepted for backwards compatibility.
 
 =item B<soundhw="DEVICE">
 
-Select the virtual sound card to expose to the guest. The valid
-devices are defined by the device model configuration, please see the
-B<qemu(1)> manpage for details. The default is not to export any sound
+Select the virtual sound card to expose to the guest. The valid devices are
+B<hda>, B<ac97>, B<es1370>, B<adlib>, B<cs4231a>, B<gus>, B<sb16> if there are
+available with the device model QEMU. The default is not to export any sound
 device.
 
 =item B<vkb_device=BOOLEAN>
diff --git a/tools/libs/light/libxl_dm.c b/tools/libs/light/libxl_dm.c
index 04bf5d8563..fc264a3a13 100644
--- a/tools/libs/light/libxl_dm.c
+++ b/tools/libs/light/libxl_dm.c
@@ -1204,6 +1204,7 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
     uint64_t ram_size;
     const char *path, *chardev;
     bool is_stubdom = libxl_defbool_val(b_info->device_model_stubdomain);
+    int rc;
 
     dm_args = flexarray_make(gc, 16, 1);
     dm_envs = flexarray_make(gc, 16, 1);
@@ -1531,7 +1532,23 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
             }
         }
         if (b_info->u.hvm.soundhw) {
-            flexarray_vappend(dm_args, "-soundhw", b_info->u.hvm.soundhw, NULL);
+            libxl__qemu_soundhw soundhw;
+
+            rc = libxl__qemu_soundhw_from_string(b_info->u.hvm.soundhw, &soundhw);
+            if (rc) {
+                LOGD(ERROR, guest_domid, "Unknown soundhw option '%s'", b_info->u.hvm.soundhw);
+                return ERROR_INVAL;
+            }
+
+            switch (soundhw) {
+            case LIBXL__QEMU_SOUNDHW_HDA:
+                flexarray_vappend(dm_args, "-device", "intel-hda",
+                                  "-device", "hda-duplex", NULL);
+                break;
+            default:
+                flexarray_append_pair(dm_args, "-device",
+                                      (char*)libxl__qemu_soundhw_to_string(soundhw));
+            }
         }
         if (!libxl__acpi_defbool_val(b_info)) {
             flexarray_append(dm_args, "-no-acpi");
diff --git a/tools/libs/light/libxl_types_internal.idl b/tools/libs/light/libxl_types_internal.idl
index 8f71980aec..fb0f4f23d7 100644
--- a/tools/libs/light/libxl_types_internal.idl
+++ b/tools/libs/light/libxl_types_internal.idl
@@ -56,3 +56,13 @@ libxl__device_action = Enumeration("device_action", [
     (1, "ADD"),
     (2, "REMOVE"),
     ])
+
+libxl__qemu_soundhw = Enumeration("qemu_soundhw", [
+    (1, "ac97"),
+    (2, "adlib"),
+    (3, "cs4231a"),
+    (4, "es1370"),
+    (5, "gus"),
+    (6, "hda"),
+    (7, "sb16"),
+    ])
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 18 07:33:15 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 18 Aug 2022 07:33:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.389334.626162 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oOa1j-0001rP-Mq; Thu, 18 Aug 2022 07:33:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 389334.626162; Thu, 18 Aug 2022 07:33:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oOa1j-0001rH-KG; Thu, 18 Aug 2022 07:33:15 +0000
Received: by outflank-mailman (input) for mailman id 389334;
 Thu, 18 Aug 2022 07:33:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oOa1i-0001r5-LP
 for xen-changelog@lists.xenproject.org; Thu, 18 Aug 2022 07:33:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oOa1i-0001JC-Kb
 for xen-changelog@lists.xenproject.org; Thu, 18 Aug 2022 07:33:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oOa1i-0003rH-Jg
 for xen-changelog@lists.xenproject.org; Thu, 18 Aug 2022 07:33:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=U3mD5RNuVx1g8i8z78cnp1lLzOrrO//rL9+H7jFnDtY=; b=iN45x2pFZR5W8rNcuxZVMNTUuA
	N1VxeNilu3oMZRHkohn2AoNUwJIdTaHfm4YNEURQWIfigGrRExaoQ2vUf7+L6EjcW1fPdm5g1MFYx
	3JdR9n0HF356PkY/QbniDWPowm4Ce8GArhNqdKmrZ/8/mPD+Jfa4QFEBXB0RBZbUrpUM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/shadow: slightly consolidate sh_unshadow_for_p2m_change() (part I)
Message-Id: <E1oOa1i-0003rH-Jg@xenbits.xenproject.org>
Date: Thu, 18 Aug 2022 07:33:14 +0000

commit 0caf699e69d79f54b94191e2f84956713c4be0da
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Aug 18 09:28:05 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 18 09:28:05 2022 +0200

    x86/shadow: slightly consolidate sh_unshadow_for_p2m_change() (part I)
    
    Replace a p2m_is_ram() check in the 2M case by an explicit _PAGE_PRESENT
    one, to make more obvious that the subsequent l1e_get_mfn() actually
    retrieves something that really is an MFN. It doesn't really matter
    whether it's RAM, as the subsequent comparison with the original MFN is
    going to lead to zapping of everything except the "same MFN again" case.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/shadow/hvm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm/shadow/hvm.c b/xen/arch/x86/mm/shadow/hvm.c
index 9438a1a7ad..fbfae450a0 100644
--- a/xen/arch/x86/mm/shadow/hvm.c
+++ b/xen/arch/x86/mm/shadow/hvm.c
@@ -856,7 +856,7 @@ static void cf_check sh_unshadow_for_p2m_change(
             for ( i = 0; i < L1_PAGETABLE_ENTRIES; i++ )
             {
                 if ( !npte ||
-                     !p2m_is_ram(p2m_flags_to_type(l1e_get_flags(npte[i]))) ||
+                     !(l1e_get_flags(npte[i]) & _PAGE_PRESENT) ||
                      !mfn_eq(l1e_get_mfn(npte[i]), omfn) )
                 {
                     /* This GFN->MFN mapping has gone away */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 18 07:33:25 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 18 Aug 2022 07:33:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.389335.626166 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oOa1t-0001u1-Oo; Thu, 18 Aug 2022 07:33:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 389335.626166; Thu, 18 Aug 2022 07:33: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 1oOa1t-0001tu-Lm; Thu, 18 Aug 2022 07:33:25 +0000
Received: by outflank-mailman (input) for mailman id 389335;
 Thu, 18 Aug 2022 07:33:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oOa1s-0001tn-OR
 for xen-changelog@lists.xenproject.org; Thu, 18 Aug 2022 07:33:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oOa1s-0001Jf-Ng
 for xen-changelog@lists.xenproject.org; Thu, 18 Aug 2022 07:33:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oOa1s-0003rz-Mo
 for xen-changelog@lists.xenproject.org; Thu, 18 Aug 2022 07:33:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=2m41IMWdNZa4Kx+i90cIhX8nx4hlQ/T8FhKK3lauzkk=; b=JyorI/TTdUQLQLKPfNMrYBPQN2
	qjistQ46lmFLNDdMK9uDbUsXtlKqcjO6EKWNCjXN6aNd60+WpF4a22l5r97xuKyRTmwB+X5+WP9Sm
	sk0d5pRsNSzBE4q5kSmrNLrllpCVhbvRPzkRtACi0RZuQ9NzpQ+QlRkh0iWXZ5AMW7uA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/shadow: slightly consolidate sh_unshadow_for_p2m_change() (part II)
Message-Id: <E1oOa1s-0003rz-Mo@xenbits.xenproject.org>
Date: Thu, 18 Aug 2022 07:33:24 +0000

commit 241702e064604dbb3e0d9b731aa8f45be448243b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Aug 18 09:28:38 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 18 09:28:38 2022 +0200

    x86/shadow: slightly consolidate sh_unshadow_for_p2m_change() (part II)
    
    Pull common checks out of the switch(). This includes extending a
    _PAGE_PRESENT check to L1 as well, which presumably was deemed redundant
    with p2m_is_valid() || p2m_is_grant(), but I think we are better off
    being explicit in all cases. Note that for L2 (or higher) the grant
    check isn't strictly necessary, as grants are only ever single pages.
    Leave a respective assertion.
    
    With _PAGE_PRESENT checked uniformly, the suspicious mfn_valid(omfn)
    checks can be dropped rather than moved/folded - if anything we'd need
    to compare against INVALID_MFN, but that won't come out of l1e_get_mfn().
    
    For L1 replace the moved out condition with a PTE comparison: There's
    no need for any update or flushing when the two match.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/shadow/hvm.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/hvm.c b/xen/arch/x86/mm/shadow/hvm.c
index fbfae450a0..0c670551f7 100644
--- a/xen/arch/x86/mm/shadow/hvm.c
+++ b/xen/arch/x86/mm/shadow/hvm.c
@@ -810,19 +810,27 @@ static void cf_check sh_unshadow_for_p2m_change(
     if ( unlikely(!d->arch.paging.shadow.total_pages) )
         return;
 
+    /* Only previously present / valid entries need processing. */
+    if ( !(oflags & _PAGE_PRESENT) ||
+         (!p2m_is_valid(p2mt) && !p2m_is_grant(p2mt)) )
+        return;
+
     switch ( level )
     {
     default:
         /*
          * The following assertion is to make sure we don't step on 1GB host
-         * page support of HVM guest.
+         * page support of HVM guest. Plus we rely on ->set_entry() to never
+         * be called with orders above PAGE_ORDER_2M, not even to install
+         * non-present entries (which in principle ought to be fine even
+         * without respective large page support).
          */
-        ASSERT(!((oflags & _PAGE_PRESENT) && (oflags & _PAGE_PSE)));
+        ASSERT(!(oflags & _PAGE_PSE));
         break;
 
     /* If we're removing an MFN from the p2m, remove it from the shadows too */
     case 1:
-        if ( (p2m_is_valid(p2mt) || p2m_is_grant(p2mt)) && mfn_valid(omfn) )
+        if ( l1e_get_intpte(old) != l1e_get_intpte(new) )
         {
             sh_remove_all_shadows_and_parents(d, omfn);
             if ( sh_remove_all_mappings(d, omfn, _gfn(gfn)) )
@@ -836,10 +844,11 @@ static void cf_check sh_unshadow_for_p2m_change(
      * scheme, that's OK, but otherwise they must be unshadowed.
      */
     case 2:
-        if ( !(oflags & _PAGE_PRESENT) || !(oflags & _PAGE_PSE) )
+        if ( !(oflags & _PAGE_PSE) )
             break;
 
-        if ( p2m_is_valid(p2mt) && mfn_valid(omfn) )
+        ASSERT(!p2m_is_grant(p2mt));
+
         {
             unsigned int i;
             mfn_t nmfn = l1e_get_mfn(new);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 18 07:33:35 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 18 Aug 2022 07:33:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.389336.626170 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oOa23-0001wZ-QP; Thu, 18 Aug 2022 07:33:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 389336.626170; Thu, 18 Aug 2022 07:33: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 1oOa23-0001wR-NZ; Thu, 18 Aug 2022 07:33:35 +0000
Received: by outflank-mailman (input) for mailman id 389336;
 Thu, 18 Aug 2022 07:33:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oOa22-0001wI-RZ
 for xen-changelog@lists.xenproject.org; Thu, 18 Aug 2022 07:33:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oOa22-0001Jp-Qb
 for xen-changelog@lists.xenproject.org; Thu, 18 Aug 2022 07:33:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oOa22-0003sU-Po
 for xen-changelog@lists.xenproject.org; Thu, 18 Aug 2022 07:33:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+BbBh6nlzh1c62upRIcMWnl3AKvkVpogt0HC0XhiGzI=; b=aUO7HB+klnfaF/alMuVy/LjzbY
	BQkjhKUCYWKLq3dcmQ4j48O8PymObcZajglTHa28LDw4qHpveHFIvhV4fv6zRtQl5gxg0jrOtCi31
	s2ERncEu3f649Nt+It+/NMYwVePMiRU6O4H7NGT6SgV07pZZF/Z+tOgyyf4mEj/E7Pm0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/shadow: slightly consolidate sh_unshadow_for_p2m_change() (part III)
Message-Id: <E1oOa22-0003sU-Po@xenbits.xenproject.org>
Date: Thu, 18 Aug 2022 07:33:34 +0000

commit 6270081c57978ff32d76d8eb11196fd217f7af2d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Aug 18 09:29:04 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 18 09:29:04 2022 +0200

    x86/shadow: slightly consolidate sh_unshadow_for_p2m_change() (part III)
    
    In preparation for reactivating the presently dead 2M page path of the
    function, also deal with the case of replacing an L1 page table all in
    one go. Note that the prior comparing of MFNs to bypass the removal of
    shadows was insufficient (but kind of benign, for being dead code so
    far) - at the very least the R/W bit also needs considering there (to be
    on the safe side, compare the full [virtual] PTEs).
    
    While adjusting the first conditional in the loop for the use of the new
    local variable "nflags", also drop mfn_valid(): If anything we'd need to
    compare against INVALID_MFN, but that won't come out of l1e_get_mfn().
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/shadow/hvm.c | 53 ++++++++++++++++++++++++++++++++------------
 1 file changed, 39 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/hvm.c b/xen/arch/x86/mm/shadow/hvm.c
index 0c670551f7..c084bc8ed7 100644
--- a/xen/arch/x86/mm/shadow/hvm.c
+++ b/xen/arch/x86/mm/shadow/hvm.c
@@ -844,40 +844,65 @@ static void cf_check sh_unshadow_for_p2m_change(
      * scheme, that's OK, but otherwise they must be unshadowed.
      */
     case 2:
-        if ( !(oflags & _PAGE_PSE) )
-            break;
-
-        ASSERT(!p2m_is_grant(p2mt));
-
         {
             unsigned int i;
             mfn_t nmfn = l1e_get_mfn(new);
-            l1_pgentry_t *npte = NULL;
+            unsigned int nflags = l1e_get_flags(new);
+            l1_pgentry_t *npte = NULL, *opte = NULL;
 
+            BUILD_BUG_ON(_PAGE_PAT != _PAGE_PSE);
+
+            if ( !(nflags & _PAGE_PRESENT) )
+                nmfn = INVALID_MFN;
             /* If we're replacing a superpage with a normal L1 page, map it */
-            if ( (l1e_get_flags(new) & _PAGE_PRESENT) &&
-                 !(l1e_get_flags(new) & _PAGE_PSE) &&
-                 mfn_valid(nmfn) )
+            else if ( !(nflags & _PAGE_PSE) )
                 npte = map_domain_page(nmfn);
+            else if ( !(mfn_x(nmfn) & (_PAGE_PSE_PAT >> PAGE_SHIFT)) )
+                nflags &= ~_PAGE_PSE;
+            else
+                nmfn = mfn_add(nmfn, -(long)(_PAGE_PSE_PAT >> PAGE_SHIFT));
+
+            /* If we're replacing a normal L1 page, map it as well. */
+            if ( !(oflags & _PAGE_PSE) )
+                opte = map_domain_page(omfn);
+            else if ( !(mfn_x(omfn) & (_PAGE_PSE_PAT >> PAGE_SHIFT)) )
+                oflags &= ~_PAGE_PSE;
+            else
+                omfn = mfn_add(omfn, -(long)(_PAGE_PSE_PAT >> PAGE_SHIFT));
 
             gfn &= ~(L1_PAGETABLE_ENTRIES - 1);
 
             for ( i = 0; i < L1_PAGETABLE_ENTRIES; i++ )
             {
-                if ( !npte ||
-                     !(l1e_get_flags(npte[i]) & _PAGE_PRESENT) ||
-                     !mfn_eq(l1e_get_mfn(npte[i]), omfn) )
+                if ( opte )
+                {
+                    oflags = l1e_get_flags(opte[i]);
+                    if ( !(oflags & _PAGE_PRESENT) )
+                        continue;
+                    omfn = l1e_get_mfn(opte[i]);
+                }
+
+                if ( npte )
+                {
+                    nflags = l1e_get_flags(npte[i]);
+                    nmfn = nflags & _PAGE_PRESENT
+                           ? l1e_get_mfn(npte[i]) : INVALID_MFN;
+                }
+
+                if ( !mfn_eq(nmfn, omfn) || nflags != oflags )
                 {
                     /* This GFN->MFN mapping has gone away */
                     sh_remove_all_shadows_and_parents(d, omfn);
                     if ( sh_remove_all_mappings(d, omfn, _gfn(gfn + i)) )
                         flush = true;
                 }
+
                 omfn = mfn_add(omfn, 1);
+                nmfn = mfn_add(nmfn, !mfn_eq(nmfn, INVALID_MFN));
             }
 
-            if ( npte )
-                unmap_domain_page(npte);
+            unmap_domain_page(opte);
+            unmap_domain_page(npte);
         }
 
         break;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 18 07:33:45 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 18 Aug 2022 07:33:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.389337.626174 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oOa2D-0001zx-TG; Thu, 18 Aug 2022 07:33:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 389337.626174; Thu, 18 Aug 2022 07:33: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 1oOa2D-0001zp-QQ; Thu, 18 Aug 2022 07:33:45 +0000
Received: by outflank-mailman (input) for mailman id 389337;
 Thu, 18 Aug 2022 07:33:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oOa2C-0001zb-UR
 for xen-changelog@lists.xenproject.org; Thu, 18 Aug 2022 07:33:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oOa2C-0001Jz-Tg
 for xen-changelog@lists.xenproject.org; Thu, 18 Aug 2022 07:33:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oOa2C-0003sx-Sy
 for xen-changelog@lists.xenproject.org; Thu, 18 Aug 2022 07:33:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=dP73G5+xckNblhF/RW6cZ0PH7NhqF3nWPTRPgr3IXv4=; b=x803rFaGilCVTKyYMc+ptpk4Yh
	OIUANQFRNI2TV1nVrlTkn1gNQF9fKUFFbJBhHd//OV5PFFKyjyJ7bke/nU2YtHW+frcAQPUgzfmKA
	UhBBXtPIJh/KOebLcvOJi8qto4eoqsjSsYeYOEcBTXmOcXaCKRlMnrR6LPrfH6I8mvf0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/P2M: allow 2M superpage use for shadowed guests
Message-Id: <E1oOa2C-0003sx-Sy@xenbits.xenproject.org>
Date: Thu, 18 Aug 2022 07:33:44 +0000

commit f2d947ac0738098ec2f52a17448df7e2acd64ff9
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Aug 18 09:29:34 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 18 09:29:34 2022 +0200

    x86/P2M: allow 2M superpage use for shadowed guests
    
    For guests in shadow mode the P2M table gets used only by software. The
    only place where it matters whether superpages in the P2M can be dealt
    with is sh_unshadow_for_p2m_change(): The table is never made accessible
    to hardware for address translation, and the only checks of _PAGE_PSE in
    P2M entries in shadow code are in this function (all others are against
    guest page table entries). That function has been capable of handling
    them even before commit 0ca1669871f8a ("P2M: check whether hap mode is
    enabled before using 2mb pages") disabled 2M use in this case for
    dubious reasons ("potential errors when hap is disabled").
    
    While doing this, move "order" into more narrow scope and replace the
    local variable "d" by a new "hap" one.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/p2m.c | 24 +++++++++---------------
 1 file changed, 9 insertions(+), 15 deletions(-)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index a2446f0c41..a405ee5fde 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -403,28 +403,22 @@ struct page_info *p2m_get_page_from_gfn(
 int p2m_set_entry(struct p2m_domain *p2m, gfn_t gfn, mfn_t mfn,
                   unsigned int page_order, p2m_type_t p2mt, p2m_access_t p2ma)
 {
-    struct domain *d = p2m->domain;
+    bool hap = hap_enabled(p2m->domain);
     unsigned long todo = 1ul << page_order;
-    unsigned int order;
     int set_rc, rc = 0;
 
     ASSERT(gfn_locked_by_me(p2m, gfn));
 
     while ( todo )
     {
-        if ( hap_enabled(d) )
-        {
-            unsigned long fn_mask = !mfn_eq(mfn, INVALID_MFN) ? mfn_x(mfn) : 0;
-
-            fn_mask |= gfn_x(gfn) | todo;
-
-            order = (!(fn_mask & ((1ul << PAGE_ORDER_1G) - 1)) &&
-                     hap_has_1gb) ? PAGE_ORDER_1G :
-                    (!(fn_mask & ((1ul << PAGE_ORDER_2M) - 1)) &&
-                     hap_has_2mb) ? PAGE_ORDER_2M : PAGE_ORDER_4K;
-        }
-        else
-            order = 0;
+        unsigned long fn_mask = (!mfn_eq(mfn, INVALID_MFN) ? mfn_x(mfn) : 0) |
+                                gfn_x(gfn) | todo;
+        unsigned int order = (!(fn_mask & ((1ul << PAGE_ORDER_1G) - 1)) &&
+                              hap && hap_has_1gb)
+                             ? PAGE_ORDER_1G
+                             : (!(fn_mask & ((1ul << PAGE_ORDER_2M) - 1)) &&
+                                (!hap || hap_has_2mb))
+                               ? PAGE_ORDER_2M : PAGE_ORDER_4K;
 
         set_rc = p2m->set_entry(p2m, gfn, mfn, order, p2mt, p2ma, -1);
         if ( set_rc )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 18 07:33:56 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 18 Aug 2022 07:33:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.389338.626179 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oOa2N-00023P-Vu; Thu, 18 Aug 2022 07:33:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 389338.626179; Thu, 18 Aug 2022 07:33:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oOa2N-00023H-S0; Thu, 18 Aug 2022 07:33:55 +0000
Received: by outflank-mailman (input) for mailman id 389338;
 Thu, 18 Aug 2022 07:33:55 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oOa2N-000238-1V
 for xen-changelog@lists.xenproject.org; Thu, 18 Aug 2022 07:33:55 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oOa2N-0001KA-0k
 for xen-changelog@lists.xenproject.org; Thu, 18 Aug 2022 07:33:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oOa2M-0003tM-Vp
 for xen-changelog@lists.xenproject.org; Thu, 18 Aug 2022 07:33:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ccpRKyU6/3EzgNn4wG3a+8v321vE7G0pazksDrIHToI=; b=44FEtR+8MyLCNDSFL1stex4y25
	K8SsqAFiqtrpxGDQgrCHuQ3IAD6GXxU9T7ihSFzIyyNejXNuDroCIF8fR1owWrYRnT1seIlS3pIfL
	yXIiwNglGweN7Hro5tltxRnjTNjEZvrNE5oSvnTuSYstwd2thPkJXLrQb6LY9bo/+cnM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/entry: move .init.text section higher up in the code for readability
Message-Id: <E1oOa2M-0003tM-Vp@xenbits.xenproject.org>
Date: Thu, 18 Aug 2022 07:33:54 +0000

commit fe3f50726e878c81985e28282927d151a0d49de5
Author:     Jane Malalane <jane.malalane@citrix.com>
AuthorDate: Thu Aug 18 09:30:10 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 18 09:30:10 2022 +0200

    x86/entry: move .init.text section higher up in the code for readability
    
    .init.text is a small section currently located amongst .text.entry
    code. Move it above .text.entry.
    
    This has no functional change but makes the code a bit more readable.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jane Malalane <jane.malalane@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/x86_64/entry.S | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index 26bf2f1941..9b34150bc7 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -140,6 +140,15 @@ process_trap:
         call create_bounce_frame
         jmp  test_all_events
 
+        .section .init.text, "ax", @progbits
+ENTRY(early_page_fault)
+        ENDBR64
+        movl  $TRAP_page_fault, 4(%rsp)
+        SAVE_ALL
+        movq  %rsp, %rdi
+        call  do_early_page_fault
+        jmp   restore_all_xen
+
         .section .text.entry, "ax", @progbits
 
 /* %rbx: struct vcpu, interrupts disabled */
@@ -982,16 +991,6 @@ ENTRY(double_fault)
         call  do_double_fault
         BUG   /* do_double_fault() shouldn't return. */
 
-        .pushsection .init.text, "ax", @progbits
-ENTRY(early_page_fault)
-        ENDBR64
-        movl  $TRAP_page_fault,4(%rsp)
-        SAVE_ALL
-        movq  %rsp,%rdi
-        call  do_early_page_fault
-        jmp   restore_all_xen
-        .popsection
-
 ENTRY(nmi)
         ENDBR64
         pushq $0
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 18 07:34:06 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 18 Aug 2022 07:34:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.389339.626182 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oOa2Y-00026A-0M; Thu, 18 Aug 2022 07:34:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 389339.626182; Thu, 18 Aug 2022 07:34:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oOa2X-000260-Th; Thu, 18 Aug 2022 07:34:05 +0000
Received: by outflank-mailman (input) for mailman id 389339;
 Thu, 18 Aug 2022 07:34:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oOa2X-00025s-4W
 for xen-changelog@lists.xenproject.org; Thu, 18 Aug 2022 07:34:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oOa2X-0001KX-3g
 for xen-changelog@lists.xenproject.org; Thu, 18 Aug 2022 07:34:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oOa2X-0003u4-2x
 for xen-changelog@lists.xenproject.org; Thu, 18 Aug 2022 07:34:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ctnQajqTReiRIm/tW5IdAqsBPZ6VTk1u7/O7OsNzdUo=; b=RLnAHnPpH+5ZWBZwnTkJxRKtTR
	27B4G0jo5YmZ7RGGg9yz6FgAjEgVWDcXNxv//4NqIZTGhoSb9NQ0qKIhzCb+uDxu7NcIRxseoRZGu
	9JLL4IpF6vxTBnsH625MGk73CkLuC4kYmHsHaCvWoLm+hs4KjyR5XNO1H4oOlCruJFsg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: rework hypercall argument count table instantiation & use
Message-Id: <E1oOa2X-0003u4-2x@xenbits.xenproject.org>
Date: Thu, 18 Aug 2022 07:34:05 +0000

commit 6c987150cf71976b5dd16b5f736dd5b0c6f6aee8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Aug 18 09:30:41 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 18 09:30:41 2022 +0200

    x86: rework hypercall argument count table instantiation & use
    
    The initial observation were duplicate symbols that our checking warns
    about. Instead of merely renaming one or both pair(s) of symbols,
    reduce #ifdef-ary at the same time by moving the instantiation of the
    arrays into a macro. While doing the conversion also stop open-coding
    array_access_nospec().
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 xen/arch/x86/hvm/hypercall.c         |  9 ++-------
 xen/arch/x86/include/asm/hypercall.h | 19 +++++++------------
 xen/arch/x86/pv/hypercall.c          | 11 ++---------
 3 files changed, 11 insertions(+), 28 deletions(-)

diff --git a/xen/arch/x86/hvm/hypercall.c b/xen/arch/x86/hvm/hypercall.c
index 29d1ca7a13..405d0a95af 100644
--- a/xen/arch/x86/hvm/hypercall.c
+++ b/xen/arch/x86/hvm/hypercall.c
@@ -111,11 +111,6 @@ long hvm_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
         return compat_physdev_op(cmd, arg);
 }
 
-#ifndef NDEBUG
-static const unsigned char hypercall_args_64[] = hypercall_args_hvm64;
-static const unsigned char hypercall_args_32[] = hypercall_args_hvm32;
-#endif
-
 int hvm_hypercall(struct cpu_user_regs *regs)
 {
     struct vcpu *curr = current;
@@ -177,7 +172,7 @@ int hvm_hypercall(struct cpu_user_regs *regs)
                             regs->r10, regs->r8);
 
         if ( !curr->hcall_preempted && regs->rax != -ENOSYS )
-            clobber_regs(regs, get_nargs(hypercall_args_64, eax));
+            clobber_regs(regs, eax, hvm, 64);
     }
     else
     {
@@ -190,7 +185,7 @@ int hvm_hypercall(struct cpu_user_regs *regs)
         curr->hcall_compat = false;
 
         if ( !curr->hcall_preempted && regs->eax != -ENOSYS )
-            clobber_regs32(regs, get_nargs(hypercall_args_32, eax));
+            clobber_regs(regs, eax, hvm, 32);
     }
 
     hvmemul_cache_restore(curr, token);
diff --git a/xen/arch/x86/include/asm/hypercall.h b/xen/arch/x86/include/asm/hypercall.h
index ab8bd12e60..ec2edc771e 100644
--- a/xen/arch/x86/include/asm/hypercall.h
+++ b/xen/arch/x86/include/asm/hypercall.h
@@ -43,18 +43,8 @@ compat_common_vcpu_op(
 
 #endif /* CONFIG_COMPAT */
 
-#ifndef NDEBUG
-static inline unsigned int _get_nargs(const unsigned char *tbl, unsigned int c)
-{
-    return tbl[c];
-}
-#define get_nargs(t, c) _get_nargs(t, array_index_nospec(c, ARRAY_SIZE(t)))
-#else
-#define get_nargs(tbl, c) 0
-#endif
-
-static inline void clobber_regs(struct cpu_user_regs *regs,
-                                unsigned int nargs)
+static inline void clobber_regs64(struct cpu_user_regs *regs,
+                                  unsigned int nargs)
 {
 #ifndef NDEBUG
     /* Deliberately corrupt used parameter regs. */
@@ -85,4 +75,9 @@ static inline void clobber_regs32(struct cpu_user_regs *regs,
 #endif
 }
 
+#define clobber_regs(r, n, t, b) ({ \
+    static const unsigned char t ## b[] = hypercall_args_ ## t ## b; \
+    clobber_regs ## b(r, array_access_nospec(t ## b, n)); \
+})
+
 #endif /* __ASM_X86_HYPERCALL_H__ */
diff --git a/xen/arch/x86/pv/hypercall.c b/xen/arch/x86/pv/hypercall.c
index bf64bb41bb..2eedfbfae8 100644
--- a/xen/arch/x86/pv/hypercall.c
+++ b/xen/arch/x86/pv/hypercall.c
@@ -27,13 +27,6 @@
 #include <asm/multicall.h>
 #include <irq_vectors.h>
 
-#ifndef NDEBUG
-static const unsigned char hypercall_args_64[] = hypercall_args_pv64;
-#ifdef CONFIG_PV32
-static const unsigned char hypercall_args_32[] = hypercall_args_pv32;
-#endif
-#endif
-
 /* Forced inline to cause 'compat' to be evaluated at compile time. */
 static void always_inline
 _pv_hypercall(struct cpu_user_regs *regs, bool compat)
@@ -65,7 +58,7 @@ _pv_hypercall(struct cpu_user_regs *regs, bool compat)
         call_handlers_pv64(eax, regs->rax, rdi, rsi, rdx, r10, r8);
 
         if ( !curr->hcall_preempted && regs->rax != -ENOSYS )
-            clobber_regs(regs, get_nargs(hypercall_args_64, eax));
+            clobber_regs(regs, eax, pv, 64);
     }
 #ifdef CONFIG_PV32
     else
@@ -90,7 +83,7 @@ _pv_hypercall(struct cpu_user_regs *regs, bool compat)
         curr->hcall_compat = false;
 
         if ( !curr->hcall_preempted && regs->eax != -ENOSYS )
-            clobber_regs32(regs, get_nargs(hypercall_args_32, eax));
+            clobber_regs(regs, eax, pv, 32);
     }
 #endif /* CONFIG_PV32 */
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 18 11:55:11 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 18 Aug 2022 11:55:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.389500.626450 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oOe77-0007px-Qm; Thu, 18 Aug 2022 11:55:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 389500.626450; Thu, 18 Aug 2022 11:55:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oOe77-0007pp-OD; Thu, 18 Aug 2022 11:55:05 +0000
Received: by outflank-mailman (input) for mailman id 389500;
 Thu, 18 Aug 2022 11:55:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oOe76-0007pj-7M
 for xen-changelog@lists.xenproject.org; Thu, 18 Aug 2022 11:55:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oOe76-0006hT-5g
 for xen-changelog@lists.xenproject.org; Thu, 18 Aug 2022 11:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oOe76-0007qB-4d
 for xen-changelog@lists.xenproject.org; Thu, 18 Aug 2022 11:55:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zc1H6hzyrL8XpDVJ9sEo7Qm9vyHn6m2goW2pjchCuNY=; b=TpYiiYdA+4uHisfsVT+zLPWDh1
	KBF4eDHGMmy2DRqnrNZYWSIh49dhvvTKx6YU5E3DNe5xVN4ELFVQh0NARW4+mn6RUhtabxfUJ1sP+
	aCTf2huz7v1H8YfRFYiAmKOcHOqrJf0IQ/Veg2yxxu/MAj18ijEVvzB8jLoC5hPgPgRQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] update Xen version to 4.16.2
Message-Id: <E1oOe76-0007qB-4d@xenbits.xenproject.org>
Date: Thu, 18 Aug 2022 11:55:04 +0000

commit cea5ed49bb5716698a11312a3f38bc8865cd1e67
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Aug 18 13:47:46 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 18 13:47:46 2022 +0200

    update Xen version to 4.16.2
---
 Config.mk    | 6 +++---
 xen/Makefile | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Config.mk b/Config.mk
index 5909d3a451..46de3cd1e0 100644
--- a/Config.mk
+++ b/Config.mk
@@ -238,15 +238,15 @@ SEABIOS_UPSTREAM_URL ?= git://xenbits.xen.org/seabios.git
 MINIOS_UPSTREAM_URL ?= git://xenbits.xen.org/mini-os.git
 endif
 OVMF_UPSTREAM_REVISION ?= 7b4a99be8a39c12d3a7fc4b8db9f0eab4ac688d5
-QEMU_UPSTREAM_REVISION ?= qemu-xen-4.16.1
-MINIOS_UPSTREAM_REVISION ?= xen-RELEASE-4.16.1
+QEMU_UPSTREAM_REVISION ?= qemu-xen-4.16.2
+MINIOS_UPSTREAM_REVISION ?= xen-RELEASE-4.16.2
 
 SEABIOS_UPSTREAM_REVISION ?= rel-1.14.0
 
 ETHERBOOT_NICS ?= rtl8139 8086100e
 
 
-QEMU_TRADITIONAL_REVISION ?= xen-4.16.1
+QEMU_TRADITIONAL_REVISION ?= xen-4.16.2
 
 # Specify which qemu-dm to use. This may be `ioemu' to use the old
 # Mercurial in-tree version, or a local directory, or a git URL.
diff --git a/xen/Makefile b/xen/Makefile
index 971028eda2..76d0a3ff25 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -2,7 +2,7 @@
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 16
-export XEN_EXTRAVERSION ?= .2-pre$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .2$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Aug 18 21:55:09 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 18 Aug 2022 21:55:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.389813.626952 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oOnTj-0006br-Hn; Thu, 18 Aug 2022 21:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 389813.626952; Thu, 18 Aug 2022 21:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oOnTj-0006bk-En; Thu, 18 Aug 2022 21:55:03 +0000
Received: by outflank-mailman (input) for mailman id 389813;
 Thu, 18 Aug 2022 21:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oOnTi-0006bO-9H
 for xen-changelog@lists.xenproject.org; Thu, 18 Aug 2022 21:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oOnTi-0000ze-6p
 for xen-changelog@lists.xenproject.org; Thu, 18 Aug 2022 21:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oOnTi-0007Nf-5Q
 for xen-changelog@lists.xenproject.org; Thu, 18 Aug 2022 21:55:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5X73r5uiukQi9cNNdJ8xXmqDA+MSXNeIagoN+u+Xwew=; b=Ib4IjConA0dvHPjm7PnnkBXQ70
	uhQLLNM8Q9PNuzp9QjI6XqvPVa5HWYWUO8D863oCntt/Yc7vKaDo2ODRcThhpo3N4QEm4mNz18Bm+
	Knja7R9qUkjYBCsnG8evZxjGLwlSq+8M6JCbFtQRqV8VJ9oYx6dSyT3xAsAcn/MP5xVU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] build: Fix missing MAKEFLAGS --no-print-directory
Message-Id: <E1oOnTi-0007Nf-5Q@xenbits.xenproject.org>
Date: Thu, 18 Aug 2022 21:55:02 +0000

commit f2beaf876dce590ee9937b79cd3498f2fe9f661c
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Wed Aug 17 16:21:06 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Aug 17 16:35:33 2022 +0100

    build: Fix missing MAKEFLAGS --no-print-directory
    
    While we already have "--no-print-directory" added to the make flags
    in some cases, there's one case where the flags is missing, when doing
    an out-of-tree build with O=, e.g.
        cd xen; make O=build
    
    Without it, we just have loads of "Entering directory" and "Leaving
    directory" with the same directory.
    
    The comment and location in the Makefile are copied from Linux.
    
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/Makefile | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/Makefile b/xen/Makefile
index 69b4dc960f..106aff6a07 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -186,6 +186,11 @@ endif # root-make-done
 # We process the rest of the Makefile if this is the final invocation of make
 ifeq ($(need-sub-make),)
 
+# Do not print "Entering directory ...",
+# but we want to display it when entering to the output directory
+# so that IDEs/editors are able to understand relative filenames.
+MAKEFLAGS += --no-print-directory
+
 ifeq ($(abs_srctree),$(abs_objtree))
     # building in the source tree
     srctree := .
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 19 02:33:06 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Aug 2022 02:33:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.389911.627073 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oOrol-0003pf-F3; Fri, 19 Aug 2022 02:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 389911.627073; Fri, 19 Aug 2022 02:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oOrol-0003pX-C8; Fri, 19 Aug 2022 02:33:03 +0000
Received: by outflank-mailman (input) for mailman id 389911;
 Fri, 19 Aug 2022 02:33:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oOroj-0003pR-L3
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 02:33:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oOroj-00054d-Gx
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 02:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oOroj-0004Bi-FQ
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 02:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NXWz2pWhKuzxRevhHyOB+Ka4BFFVMQ1eJxWF9cHnjdU=; b=asj92K2L60shTdS0DVFmuL2BC0
	ndh3YRns5vo0UV/ydKmmkMirAGqETsFK2kBBHZAM7DCmko71MZ9uH8jHcdsr3MeC9fS3xwr5nk/7p
	1O1ilpeUXWtWmvZ6sWpsKiE5PAksmYwjNPPFZ/0oqPaOf4pOCZVJfHc+TeijClFz32tk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] update Xen version to 4.16.2
Message-Id: <E1oOroj-0004Bi-FQ@xenbits.xenproject.org>
Date: Fri, 19 Aug 2022 02:33:01 +0000

commit cea5ed49bb5716698a11312a3f38bc8865cd1e67
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Aug 18 13:47:46 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 18 13:47:46 2022 +0200

    update Xen version to 4.16.2
---
 Config.mk    | 6 +++---
 xen/Makefile | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Config.mk b/Config.mk
index 5909d3a451..46de3cd1e0 100644
--- a/Config.mk
+++ b/Config.mk
@@ -238,15 +238,15 @@ SEABIOS_UPSTREAM_URL ?= git://xenbits.xen.org/seabios.git
 MINIOS_UPSTREAM_URL ?= git://xenbits.xen.org/mini-os.git
 endif
 OVMF_UPSTREAM_REVISION ?= 7b4a99be8a39c12d3a7fc4b8db9f0eab4ac688d5
-QEMU_UPSTREAM_REVISION ?= qemu-xen-4.16.1
-MINIOS_UPSTREAM_REVISION ?= xen-RELEASE-4.16.1
+QEMU_UPSTREAM_REVISION ?= qemu-xen-4.16.2
+MINIOS_UPSTREAM_REVISION ?= xen-RELEASE-4.16.2
 
 SEABIOS_UPSTREAM_REVISION ?= rel-1.14.0
 
 ETHERBOOT_NICS ?= rtl8139 8086100e
 
 
-QEMU_TRADITIONAL_REVISION ?= xen-4.16.1
+QEMU_TRADITIONAL_REVISION ?= xen-4.16.2
 
 # Specify which qemu-dm to use. This may be `ioemu' to use the old
 # Mercurial in-tree version, or a local directory, or a git URL.
diff --git a/xen/Makefile b/xen/Makefile
index 971028eda2..76d0a3ff25 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -2,7 +2,7 @@
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 16
-export XEN_EXTRAVERSION ?= .2-pre$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .2$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Aug 19 08:00:10 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Aug 2022 08:00:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.390094.627303 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oOwvF-0004qs-LQ; Fri, 19 Aug 2022 08:00:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 390094.627303; Fri, 19 Aug 2022 08:00:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oOwvF-0004qY-Hx; Fri, 19 Aug 2022 08:00:05 +0000
Received: by outflank-mailman (input) for mailman id 390094;
 Fri, 19 Aug 2022 08:00:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oOwvE-0004bg-8z
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 08:00:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oOwvE-0003Ov-8A
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 08:00:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oOwvE-0004oS-78
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 08:00:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kJashR7FSTdyHxxttKoji54PTE0ELk/3L3bxCl/kz8I=; b=2OFZM2S2MokXG73lk9W9ujqQ/D
	iuHFgf9sV0wDM7RR2lyrwA8/84b/5ZLguFFAbVeDMxkfUVg7tLzNfyZWXXc8PVHze6KCbAPafpF+a
	EVbs54uqzjiE/TV7bFRmNXTAq8y+UDhp80aGRWMgmIicQWfiUJs4BVaUZb+YvYcIO1GU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] console/client: properly use time_t in get_pty_fd()
Message-Id: <E1oOwvE-0004oS-78@xenbits.xenproject.org>
Date: Fri, 19 Aug 2022 08:00:04 +0000

commit 2891f116e798a20ad35ab10e5a3c7f0c51156d81
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Aug 19 09:58:14 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Aug 19 09:58:14 2022 +0200

    console/client: properly use time_t in get_pty_fd()
    
    "int" is not a suitable type to hold time()'s return value.
    
    Coverity ID: 1509376
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/console/client/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/console/client/main.c b/tools/console/client/main.c
index ada6728caa..1a6fa162f7 100644
--- a/tools/console/client/main.c
+++ b/tools/console/client/main.c
@@ -102,7 +102,7 @@ static int get_pty_fd(struct xs_handle *xs, char *path, int seconds)
 	struct timeval tv;
 	fd_set watch_fdset;
 	int xs_fd = xs_fileno(xs), pty_fd = -1;
-	int start, now;
+	time_t start, now;
 	unsigned int len = 0;
 	char *pty_path, **watch_paths;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 19 08:00:15 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Aug 2022 08:00:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.390096.627308 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oOwvP-00057c-N7; Fri, 19 Aug 2022 08:00:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 390096.627308; Fri, 19 Aug 2022 08:00:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oOwvP-00057U-Jd; Fri, 19 Aug 2022 08:00:15 +0000
Received: by outflank-mailman (input) for mailman id 390096;
 Fri, 19 Aug 2022 08:00:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oOwvO-00057G-DB
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 08:00:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oOwvO-0003UK-CK
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 08:00:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oOwvO-0004pd-AE
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 08:00:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3RMK+i11nbrdLXIDMEP+mO6hsXuB/oYqdqibqj762JM=; b=EiIlvidzfM16vNi4dxBKP2zN/E
	yb57ODzy6ZrCO18cgDSnjN8p8+thfwPwMzbkWQzfr2BZlpQzjKRzr9A+2neRpT16nMPBsDCk6OsqT
	Gdb0Ov2ki4Ndc1dSj9vvRT7oVsxZ2QgXPs/wYGCjo2gGSOwEmy5p6cNboOoqAAcukDfw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libxl: use time_t for qmp_synchronous_send()'s last parameter
Message-Id: <E1oOwvO-0004pd-AE@xenbits.xenproject.org>
Date: Fri, 19 Aug 2022 08:00:14 +0000

commit 6c0a14d324fc9f6b603e4dfbf90c5fd74227edf3
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Aug 19 09:58:34 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Aug 19 09:58:34 2022 +0200

    libxl: use time_t for qmp_synchronous_send()'s last parameter
    
    "int" is not a suitable type to hold / receive "time_t" values.
    
    The parameter is presently unused, so no functional change.
    
    Coverity ID: 1509377
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Acked-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/libs/light/libxl_qmp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libs/light/libxl_qmp.c b/tools/libs/light/libxl_qmp.c
index 6b0cd607d8..84740bd4b3 100644
--- a/tools/libs/light/libxl_qmp.c
+++ b/tools/libs/light/libxl_qmp.c
@@ -582,7 +582,7 @@ out:
 static int qmp_synchronous_send(libxl__qmp_handler *qmp, const char *cmd,
                                 libxl__json_object *args,
                                 qmp_callback_t callback, void *opaque,
-                                int ask_timeout)
+                                time_t ask_timeout)
 {
     int id = 0;
     int ret = 0;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 19 12:22:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Aug 2022 12:22:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.390292.627626 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oP10l-0003bj-FQ; Fri, 19 Aug 2022 12:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 390292.627626; Fri, 19 Aug 2022 12:22:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oP10l-0003bb-C8; Fri, 19 Aug 2022 12:22:03 +0000
Received: by outflank-mailman (input) for mailman id 390292;
 Fri, 19 Aug 2022 12:22:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oP10j-0003bH-QH
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 12:22:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oP10j-0008BS-PU
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 12:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oP10j-0008QM-Oa
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 12:22:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NGtRKD/4zlGoiKcxQpYjSkULYzgpPGJjmVn/3fQUgHo=; b=iQh6neuZw88bU//NmsrSF+B1yk
	X9CauhqU8R07Ql3hFU7gVJQJyB6bhKWDijuJvfe0VpR+R6xcxxRZiloTOwy6tAlVFNEEXVK6nUpiF
	CvwdsBfsDCvX6e8xwtUNpcdZqTQaIWMHjh6CkV0lRYgvwTJbePYAYy42dWaDqGsP1g/Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/libxl: Replace deprecated -soundhw on QEMU command line
Message-Id: <E1oP10j-0008QM-Oa@xenbits.xenproject.org>
Date: Fri, 19 Aug 2022 12:22:01 +0000

commit 62ca138c2c052187783aca3957d3f47c4dcfd683
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Thu Aug 18 09:25:50 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 18 09:25:50 2022 +0200

    tools/libxl: Replace deprecated -soundhw on QEMU command line
    
    -soundhw is deprecated since 825ff02911c9 ("audio: add soundhw
    deprecation notice"), QEMU v5.1, and is been remove for upcoming v7.1
    by 039a68373c45 ("introduce -audio as a replacement for -soundhw").
    
    Instead we can just add the sound card with "-device", for most option
    that "-soundhw" could handle. "-device" is an option that existed
    before QEMU 1.0, and could already be used to add audio hardware.
    
    The list of possible option for libxl's "soundhw" is taken the list
    from QEMU 7.0.
    
    The list of options for "soundhw" are listed in order of preference in
    the manual. The first three (hda, ac97, es1370) are PCI devices and
    easy to test on Linux, and the last four are ISA devices which doesn't
    seems to work out of the box on linux.
    
    The sound card 'pcspk' isn't listed even if it used to be accepted by
    '-soundhw' because QEMU crash when trying to add it to a Xen domain.
    Also, it wouldn't work with "-device" might need to be "-machine
    pcspk-audiodev=default" instead.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Jason Andryuk <jandryuk@gmail.com>
---
 docs/man/xl.cfg.5.pod.in                  |  6 +++---
 tools/libs/light/libxl_dm.c               | 19 ++++++++++++++++++-
 tools/libs/light/libxl_types_internal.idl | 10 ++++++++++
 3 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in
index 6d98d73d76..b2901e04cf 100644
--- a/docs/man/xl.cfg.5.pod.in
+++ b/docs/man/xl.cfg.5.pod.in
@@ -2555,9 +2555,9 @@ The form serial=DEVICE is also accepted for backwards compatibility.
 
 =item B<soundhw="DEVICE">
 
-Select the virtual sound card to expose to the guest. The valid
-devices are defined by the device model configuration, please see the
-B<qemu(1)> manpage for details. The default is not to export any sound
+Select the virtual sound card to expose to the guest. The valid devices are
+B<hda>, B<ac97>, B<es1370>, B<adlib>, B<cs4231a>, B<gus>, B<sb16> if there are
+available with the device model QEMU. The default is not to export any sound
 device.
 
 =item B<vkb_device=BOOLEAN>
diff --git a/tools/libs/light/libxl_dm.c b/tools/libs/light/libxl_dm.c
index 04bf5d8563..fc264a3a13 100644
--- a/tools/libs/light/libxl_dm.c
+++ b/tools/libs/light/libxl_dm.c
@@ -1204,6 +1204,7 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
     uint64_t ram_size;
     const char *path, *chardev;
     bool is_stubdom = libxl_defbool_val(b_info->device_model_stubdomain);
+    int rc;
 
     dm_args = flexarray_make(gc, 16, 1);
     dm_envs = flexarray_make(gc, 16, 1);
@@ -1531,7 +1532,23 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
             }
         }
         if (b_info->u.hvm.soundhw) {
-            flexarray_vappend(dm_args, "-soundhw", b_info->u.hvm.soundhw, NULL);
+            libxl__qemu_soundhw soundhw;
+
+            rc = libxl__qemu_soundhw_from_string(b_info->u.hvm.soundhw, &soundhw);
+            if (rc) {
+                LOGD(ERROR, guest_domid, "Unknown soundhw option '%s'", b_info->u.hvm.soundhw);
+                return ERROR_INVAL;
+            }
+
+            switch (soundhw) {
+            case LIBXL__QEMU_SOUNDHW_HDA:
+                flexarray_vappend(dm_args, "-device", "intel-hda",
+                                  "-device", "hda-duplex", NULL);
+                break;
+            default:
+                flexarray_append_pair(dm_args, "-device",
+                                      (char*)libxl__qemu_soundhw_to_string(soundhw));
+            }
         }
         if (!libxl__acpi_defbool_val(b_info)) {
             flexarray_append(dm_args, "-no-acpi");
diff --git a/tools/libs/light/libxl_types_internal.idl b/tools/libs/light/libxl_types_internal.idl
index 8f71980aec..fb0f4f23d7 100644
--- a/tools/libs/light/libxl_types_internal.idl
+++ b/tools/libs/light/libxl_types_internal.idl
@@ -56,3 +56,13 @@ libxl__device_action = Enumeration("device_action", [
     (1, "ADD"),
     (2, "REMOVE"),
     ])
+
+libxl__qemu_soundhw = Enumeration("qemu_soundhw", [
+    (1, "ac97"),
+    (2, "adlib"),
+    (3, "cs4231a"),
+    (4, "es1370"),
+    (5, "gus"),
+    (6, "hda"),
+    (7, "sb16"),
+    ])
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 19 12:22:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Aug 2022 12:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.390293.627632 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oP10v-0003lT-HL; Fri, 19 Aug 2022 12:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 390293.627632; Fri, 19 Aug 2022 12:22:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oP10v-0003lG-Dj; Fri, 19 Aug 2022 12:22:13 +0000
Received: by outflank-mailman (input) for mailman id 390293;
 Fri, 19 Aug 2022 12:22:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oP10t-0003i9-TG
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 12:22:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oP10t-0008BZ-SS
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 12:22:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oP10t-0008Qt-RY
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 12:22:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1aRdPP5udo/EhM/gVHsqnm+hPvhSWFS48Ju0iGg7hhI=; b=smw+5UpN+nYPGHOhazQ8ynXqXF
	LW/VqmbA08n+j8cDZYJiLFDRM/D9+0QlCNDJYIz06vD9R2AjCGSB5E1GvnAAwwcyBrrRv8LCUwmwx
	Ij0aVKJ8wwNNhN+GAJSqvaR5Zz5V5O2gRV+pNoKx2yfLzQVlooY5sHlZ2OU4sUwtM0Bc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: slightly consolidate sh_unshadow_for_p2m_change() (part I)
Message-Id: <E1oP10t-0008Qt-RY@xenbits.xenproject.org>
Date: Fri, 19 Aug 2022 12:22:11 +0000

commit 0caf699e69d79f54b94191e2f84956713c4be0da
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Aug 18 09:28:05 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 18 09:28:05 2022 +0200

    x86/shadow: slightly consolidate sh_unshadow_for_p2m_change() (part I)
    
    Replace a p2m_is_ram() check in the 2M case by an explicit _PAGE_PRESENT
    one, to make more obvious that the subsequent l1e_get_mfn() actually
    retrieves something that really is an MFN. It doesn't really matter
    whether it's RAM, as the subsequent comparison with the original MFN is
    going to lead to zapping of everything except the "same MFN again" case.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/shadow/hvm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm/shadow/hvm.c b/xen/arch/x86/mm/shadow/hvm.c
index 9438a1a7ad..fbfae450a0 100644
--- a/xen/arch/x86/mm/shadow/hvm.c
+++ b/xen/arch/x86/mm/shadow/hvm.c
@@ -856,7 +856,7 @@ static void cf_check sh_unshadow_for_p2m_change(
             for ( i = 0; i < L1_PAGETABLE_ENTRIES; i++ )
             {
                 if ( !npte ||
-                     !p2m_is_ram(p2m_flags_to_type(l1e_get_flags(npte[i]))) ||
+                     !(l1e_get_flags(npte[i]) & _PAGE_PRESENT) ||
                      !mfn_eq(l1e_get_mfn(npte[i]), omfn) )
                 {
                     /* This GFN->MFN mapping has gone away */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 19 12:22:23 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Aug 2022 12:22:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.390296.627635 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oP115-0003qb-IE; Fri, 19 Aug 2022 12:22:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 390296.627635; Fri, 19 Aug 2022 12: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 1oP115-0003qT-FC; Fri, 19 Aug 2022 12:22:23 +0000
Received: by outflank-mailman (input) for mailman id 390296;
 Fri, 19 Aug 2022 12:22:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oP113-0003qC-WB
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 12:22:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oP113-0008Bp-VS
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 12:22:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oP113-0008RI-UZ
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 12:22:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ELXQdHhu7VIhskXGy6SMyG+vHfUYVWU8xSDRcdT2rIY=; b=12AOEp4AUXnm707ThafDrmldOT
	JprUDiEVMa/Ppjt+2JetARuuaSGezHXxCjVdgqMs9S4lJCtM5Sy4K+jIkA4MCP3p0CkU7vef6lls3
	RUQ0C3v8flBqIpHGs0RfWY9o0ydXTolZ9Oguk4NWzsdZVIjlQvn2OZ1DYwwouSoeEkZM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: slightly consolidate sh_unshadow_for_p2m_change() (part II)
Message-Id: <E1oP113-0008RI-UZ@xenbits.xenproject.org>
Date: Fri, 19 Aug 2022 12:22:21 +0000

commit 241702e064604dbb3e0d9b731aa8f45be448243b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Aug 18 09:28:38 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 18 09:28:38 2022 +0200

    x86/shadow: slightly consolidate sh_unshadow_for_p2m_change() (part II)
    
    Pull common checks out of the switch(). This includes extending a
    _PAGE_PRESENT check to L1 as well, which presumably was deemed redundant
    with p2m_is_valid() || p2m_is_grant(), but I think we are better off
    being explicit in all cases. Note that for L2 (or higher) the grant
    check isn't strictly necessary, as grants are only ever single pages.
    Leave a respective assertion.
    
    With _PAGE_PRESENT checked uniformly, the suspicious mfn_valid(omfn)
    checks can be dropped rather than moved/folded - if anything we'd need
    to compare against INVALID_MFN, but that won't come out of l1e_get_mfn().
    
    For L1 replace the moved out condition with a PTE comparison: There's
    no need for any update or flushing when the two match.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/shadow/hvm.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/hvm.c b/xen/arch/x86/mm/shadow/hvm.c
index fbfae450a0..0c670551f7 100644
--- a/xen/arch/x86/mm/shadow/hvm.c
+++ b/xen/arch/x86/mm/shadow/hvm.c
@@ -810,19 +810,27 @@ static void cf_check sh_unshadow_for_p2m_change(
     if ( unlikely(!d->arch.paging.shadow.total_pages) )
         return;
 
+    /* Only previously present / valid entries need processing. */
+    if ( !(oflags & _PAGE_PRESENT) ||
+         (!p2m_is_valid(p2mt) && !p2m_is_grant(p2mt)) )
+        return;
+
     switch ( level )
     {
     default:
         /*
          * The following assertion is to make sure we don't step on 1GB host
-         * page support of HVM guest.
+         * page support of HVM guest. Plus we rely on ->set_entry() to never
+         * be called with orders above PAGE_ORDER_2M, not even to install
+         * non-present entries (which in principle ought to be fine even
+         * without respective large page support).
          */
-        ASSERT(!((oflags & _PAGE_PRESENT) && (oflags & _PAGE_PSE)));
+        ASSERT(!(oflags & _PAGE_PSE));
         break;
 
     /* If we're removing an MFN from the p2m, remove it from the shadows too */
     case 1:
-        if ( (p2m_is_valid(p2mt) || p2m_is_grant(p2mt)) && mfn_valid(omfn) )
+        if ( l1e_get_intpte(old) != l1e_get_intpte(new) )
         {
             sh_remove_all_shadows_and_parents(d, omfn);
             if ( sh_remove_all_mappings(d, omfn, _gfn(gfn)) )
@@ -836,10 +844,11 @@ static void cf_check sh_unshadow_for_p2m_change(
      * scheme, that's OK, but otherwise they must be unshadowed.
      */
     case 2:
-        if ( !(oflags & _PAGE_PRESENT) || !(oflags & _PAGE_PSE) )
+        if ( !(oflags & _PAGE_PSE) )
             break;
 
-        if ( p2m_is_valid(p2mt) && mfn_valid(omfn) )
+        ASSERT(!p2m_is_grant(p2mt));
+
         {
             unsigned int i;
             mfn_t nmfn = l1e_get_mfn(new);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 19 12:22:33 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Aug 2022 12:22:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.390297.627638 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oP11F-0003us-JU; Fri, 19 Aug 2022 12:22:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 390297.627638; Fri, 19 Aug 2022 12: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 1oP11F-0003uk-Gg; Fri, 19 Aug 2022 12:22:33 +0000
Received: by outflank-mailman (input) for mailman id 390297;
 Fri, 19 Aug 2022 12:22:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oP11E-0003uN-2z
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 12:22:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oP11E-0008Bz-1x
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 12:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oP11E-0008Rl-1E
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 12:22:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tJBJ5Pgp3CQ3fIfLTNsMiHoU3sSqSKd5hrfJc6EM1po=; b=p8zgLUz8dLKWQ70va07N53f2ro
	acC9mFtFVxKn95hWz2e4w+4Et6XZVpWxB4aAkJFkE1CbtJ3nEkH3+ai0UesW799FxoUuNLvxUj7I0
	UjjQo9GZwyyhyPiOyNLfJkinxO2rI81Bu+TA1ynaAe2IoU2mfhkC1ElhtC8LK81qIfr8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: slightly consolidate sh_unshadow_for_p2m_change() (part III)
Message-Id: <E1oP11E-0008Rl-1E@xenbits.xenproject.org>
Date: Fri, 19 Aug 2022 12:22:32 +0000

commit 6270081c57978ff32d76d8eb11196fd217f7af2d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Aug 18 09:29:04 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 18 09:29:04 2022 +0200

    x86/shadow: slightly consolidate sh_unshadow_for_p2m_change() (part III)
    
    In preparation for reactivating the presently dead 2M page path of the
    function, also deal with the case of replacing an L1 page table all in
    one go. Note that the prior comparing of MFNs to bypass the removal of
    shadows was insufficient (but kind of benign, for being dead code so
    far) - at the very least the R/W bit also needs considering there (to be
    on the safe side, compare the full [virtual] PTEs).
    
    While adjusting the first conditional in the loop for the use of the new
    local variable "nflags", also drop mfn_valid(): If anything we'd need to
    compare against INVALID_MFN, but that won't come out of l1e_get_mfn().
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/shadow/hvm.c | 53 ++++++++++++++++++++++++++++++++------------
 1 file changed, 39 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/hvm.c b/xen/arch/x86/mm/shadow/hvm.c
index 0c670551f7..c084bc8ed7 100644
--- a/xen/arch/x86/mm/shadow/hvm.c
+++ b/xen/arch/x86/mm/shadow/hvm.c
@@ -844,40 +844,65 @@ static void cf_check sh_unshadow_for_p2m_change(
      * scheme, that's OK, but otherwise they must be unshadowed.
      */
     case 2:
-        if ( !(oflags & _PAGE_PSE) )
-            break;
-
-        ASSERT(!p2m_is_grant(p2mt));
-
         {
             unsigned int i;
             mfn_t nmfn = l1e_get_mfn(new);
-            l1_pgentry_t *npte = NULL;
+            unsigned int nflags = l1e_get_flags(new);
+            l1_pgentry_t *npte = NULL, *opte = NULL;
 
+            BUILD_BUG_ON(_PAGE_PAT != _PAGE_PSE);
+
+            if ( !(nflags & _PAGE_PRESENT) )
+                nmfn = INVALID_MFN;
             /* If we're replacing a superpage with a normal L1 page, map it */
-            if ( (l1e_get_flags(new) & _PAGE_PRESENT) &&
-                 !(l1e_get_flags(new) & _PAGE_PSE) &&
-                 mfn_valid(nmfn) )
+            else if ( !(nflags & _PAGE_PSE) )
                 npte = map_domain_page(nmfn);
+            else if ( !(mfn_x(nmfn) & (_PAGE_PSE_PAT >> PAGE_SHIFT)) )
+                nflags &= ~_PAGE_PSE;
+            else
+                nmfn = mfn_add(nmfn, -(long)(_PAGE_PSE_PAT >> PAGE_SHIFT));
+
+            /* If we're replacing a normal L1 page, map it as well. */
+            if ( !(oflags & _PAGE_PSE) )
+                opte = map_domain_page(omfn);
+            else if ( !(mfn_x(omfn) & (_PAGE_PSE_PAT >> PAGE_SHIFT)) )
+                oflags &= ~_PAGE_PSE;
+            else
+                omfn = mfn_add(omfn, -(long)(_PAGE_PSE_PAT >> PAGE_SHIFT));
 
             gfn &= ~(L1_PAGETABLE_ENTRIES - 1);
 
             for ( i = 0; i < L1_PAGETABLE_ENTRIES; i++ )
             {
-                if ( !npte ||
-                     !(l1e_get_flags(npte[i]) & _PAGE_PRESENT) ||
-                     !mfn_eq(l1e_get_mfn(npte[i]), omfn) )
+                if ( opte )
+                {
+                    oflags = l1e_get_flags(opte[i]);
+                    if ( !(oflags & _PAGE_PRESENT) )
+                        continue;
+                    omfn = l1e_get_mfn(opte[i]);
+                }
+
+                if ( npte )
+                {
+                    nflags = l1e_get_flags(npte[i]);
+                    nmfn = nflags & _PAGE_PRESENT
+                           ? l1e_get_mfn(npte[i]) : INVALID_MFN;
+                }
+
+                if ( !mfn_eq(nmfn, omfn) || nflags != oflags )
                 {
                     /* This GFN->MFN mapping has gone away */
                     sh_remove_all_shadows_and_parents(d, omfn);
                     if ( sh_remove_all_mappings(d, omfn, _gfn(gfn + i)) )
                         flush = true;
                 }
+
                 omfn = mfn_add(omfn, 1);
+                nmfn = mfn_add(nmfn, !mfn_eq(nmfn, INVALID_MFN));
             }
 
-            if ( npte )
-                unmap_domain_page(npte);
+            unmap_domain_page(opte);
+            unmap_domain_page(npte);
         }
 
         break;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 19 12:22:43 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Aug 2022 12:22:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.390300.627643 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oP11P-0003zq-Ku; Fri, 19 Aug 2022 12:22:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 390300.627643; Fri, 19 Aug 2022 12: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 1oP11P-0003zg-I5; Fri, 19 Aug 2022 12:22:43 +0000
Received: by outflank-mailman (input) for mailman id 390300;
 Fri, 19 Aug 2022 12:22:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oP11O-0003zO-5i
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 12:22:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oP11O-0008CT-4y
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 12:22:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oP11O-0008SQ-46
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 12:22:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/R2UCgNyBJ3fH5m0sH5qwPGW9h1YwwvGuG1FJ+FyL1c=; b=aaE9gIrv3qp5KDe/5PecbwQ9cW
	SrfwxnyIcsjvuQ5C1ha8n/8pSa0PJrnLN2s/2m9JzEekc8JIXTat2/9tJZojCMW5SWEA7c5i30I+t
	mWlgqZPy9HX/vi2vP9YTkbR+j2Aq+jo1Hw0ZprZicnEEodlj4Ec6EhVjaawDM4YGJ9Lk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/P2M: allow 2M superpage use for shadowed guests
Message-Id: <E1oP11O-0008SQ-46@xenbits.xenproject.org>
Date: Fri, 19 Aug 2022 12:22:42 +0000

commit f2d947ac0738098ec2f52a17448df7e2acd64ff9
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Aug 18 09:29:34 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 18 09:29:34 2022 +0200

    x86/P2M: allow 2M superpage use for shadowed guests
    
    For guests in shadow mode the P2M table gets used only by software. The
    only place where it matters whether superpages in the P2M can be dealt
    with is sh_unshadow_for_p2m_change(): The table is never made accessible
    to hardware for address translation, and the only checks of _PAGE_PSE in
    P2M entries in shadow code are in this function (all others are against
    guest page table entries). That function has been capable of handling
    them even before commit 0ca1669871f8a ("P2M: check whether hap mode is
    enabled before using 2mb pages") disabled 2M use in this case for
    dubious reasons ("potential errors when hap is disabled").
    
    While doing this, move "order" into more narrow scope and replace the
    local variable "d" by a new "hap" one.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/p2m.c | 24 +++++++++---------------
 1 file changed, 9 insertions(+), 15 deletions(-)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index a2446f0c41..a405ee5fde 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -403,28 +403,22 @@ struct page_info *p2m_get_page_from_gfn(
 int p2m_set_entry(struct p2m_domain *p2m, gfn_t gfn, mfn_t mfn,
                   unsigned int page_order, p2m_type_t p2mt, p2m_access_t p2ma)
 {
-    struct domain *d = p2m->domain;
+    bool hap = hap_enabled(p2m->domain);
     unsigned long todo = 1ul << page_order;
-    unsigned int order;
     int set_rc, rc = 0;
 
     ASSERT(gfn_locked_by_me(p2m, gfn));
 
     while ( todo )
     {
-        if ( hap_enabled(d) )
-        {
-            unsigned long fn_mask = !mfn_eq(mfn, INVALID_MFN) ? mfn_x(mfn) : 0;
-
-            fn_mask |= gfn_x(gfn) | todo;
-
-            order = (!(fn_mask & ((1ul << PAGE_ORDER_1G) - 1)) &&
-                     hap_has_1gb) ? PAGE_ORDER_1G :
-                    (!(fn_mask & ((1ul << PAGE_ORDER_2M) - 1)) &&
-                     hap_has_2mb) ? PAGE_ORDER_2M : PAGE_ORDER_4K;
-        }
-        else
-            order = 0;
+        unsigned long fn_mask = (!mfn_eq(mfn, INVALID_MFN) ? mfn_x(mfn) : 0) |
+                                gfn_x(gfn) | todo;
+        unsigned int order = (!(fn_mask & ((1ul << PAGE_ORDER_1G) - 1)) &&
+                              hap && hap_has_1gb)
+                             ? PAGE_ORDER_1G
+                             : (!(fn_mask & ((1ul << PAGE_ORDER_2M) - 1)) &&
+                                (!hap || hap_has_2mb))
+                               ? PAGE_ORDER_2M : PAGE_ORDER_4K;
 
         set_rc = p2m->set_entry(p2m, gfn, mfn, order, p2mt, p2ma, -1);
         if ( set_rc )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 19 12:22:53 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Aug 2022 12:22:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.390301.627646 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oP11Z-000432-MT; Fri, 19 Aug 2022 12:22:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 390301.627646; Fri, 19 Aug 2022 12: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 1oP11Z-00042v-JX; Fri, 19 Aug 2022 12:22:53 +0000
Received: by outflank-mailman (input) for mailman id 390301;
 Fri, 19 Aug 2022 12:22:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oP11Y-00042e-8Q
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 12:22:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oP11Y-0008Cd-7k
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 12:22:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oP11Y-0008Sp-71
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 12:22:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=RhPpsG9vKJobPWGBMuuMtoQ3SMKc0oiWz1KuPLypDDc=; b=Z95yMkyHys8LH5e0LqW3+X/hz/
	eLNSjWly3moJ8IJKVDFffyT1b8mVuffwV4UWv/o3+dc06ZNE5BhTE4XJXyetBqn3+3C09do8WcstJ
	KrhJqxzWX+EUSvIqFnGAFRB5DvAN6Ia3Cv1z555biz1IgM/Zpl5JnSRu4OgyMr8+0Nrk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/entry: move .init.text section higher up in the code for readability
Message-Id: <E1oP11Y-0008Sp-71@xenbits.xenproject.org>
Date: Fri, 19 Aug 2022 12:22:52 +0000

commit fe3f50726e878c81985e28282927d151a0d49de5
Author:     Jane Malalane <jane.malalane@citrix.com>
AuthorDate: Thu Aug 18 09:30:10 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 18 09:30:10 2022 +0200

    x86/entry: move .init.text section higher up in the code for readability
    
    .init.text is a small section currently located amongst .text.entry
    code. Move it above .text.entry.
    
    This has no functional change but makes the code a bit more readable.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jane Malalane <jane.malalane@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/x86_64/entry.S | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index 26bf2f1941..9b34150bc7 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -140,6 +140,15 @@ process_trap:
         call create_bounce_frame
         jmp  test_all_events
 
+        .section .init.text, "ax", @progbits
+ENTRY(early_page_fault)
+        ENDBR64
+        movl  $TRAP_page_fault, 4(%rsp)
+        SAVE_ALL
+        movq  %rsp, %rdi
+        call  do_early_page_fault
+        jmp   restore_all_xen
+
         .section .text.entry, "ax", @progbits
 
 /* %rbx: struct vcpu, interrupts disabled */
@@ -982,16 +991,6 @@ ENTRY(double_fault)
         call  do_double_fault
         BUG   /* do_double_fault() shouldn't return. */
 
-        .pushsection .init.text, "ax", @progbits
-ENTRY(early_page_fault)
-        ENDBR64
-        movl  $TRAP_page_fault,4(%rsp)
-        SAVE_ALL
-        movq  %rsp,%rdi
-        call  do_early_page_fault
-        jmp   restore_all_xen
-        .popsection
-
 ENTRY(nmi)
         ENDBR64
         pushq $0
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 19 12:23:03 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Aug 2022 12:23:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.390302.627652 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oP11j-00047n-T8; Fri, 19 Aug 2022 12:23:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 390302.627652; Fri, 19 Aug 2022 12: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 1oP11j-00047e-N1; Fri, 19 Aug 2022 12:23:03 +0000
Received: by outflank-mailman (input) for mailman id 390302;
 Fri, 19 Aug 2022 12:23:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oP11i-00046d-BZ
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 12:23:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oP11i-0008D7-Am
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 12:23:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oP11i-0008TS-9v
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 12:23:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vZXhwQurkeNYdEZvPq9r5AMbicM+j2wRxkVsYwdBAfc=; b=Bb5I7MCiVv3YEB5gfQu8n/v0DU
	EuuDAxFTU4iKSRLv3FBFIJu+o4m6Yr+LT3g3uDAQS2ThBq/jaaGwbTBIleoKgkfGDSxHu4d4bziHr
	Z3U9ZAzLGVnTXeO4Vpl3PmYDWT4cr/GecmL3z5OEAAE9UgfiU1gxPqBBOxjrCkWEbcy0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: rework hypercall argument count table instantiation & use
Message-Id: <E1oP11i-0008TS-9v@xenbits.xenproject.org>
Date: Fri, 19 Aug 2022 12:23:02 +0000

commit 6c987150cf71976b5dd16b5f736dd5b0c6f6aee8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Aug 18 09:30:41 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 18 09:30:41 2022 +0200

    x86: rework hypercall argument count table instantiation & use
    
    The initial observation were duplicate symbols that our checking warns
    about. Instead of merely renaming one or both pair(s) of symbols,
    reduce #ifdef-ary at the same time by moving the instantiation of the
    arrays into a macro. While doing the conversion also stop open-coding
    array_access_nospec().
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 xen/arch/x86/hvm/hypercall.c         |  9 ++-------
 xen/arch/x86/include/asm/hypercall.h | 19 +++++++------------
 xen/arch/x86/pv/hypercall.c          | 11 ++---------
 3 files changed, 11 insertions(+), 28 deletions(-)

diff --git a/xen/arch/x86/hvm/hypercall.c b/xen/arch/x86/hvm/hypercall.c
index 29d1ca7a13..405d0a95af 100644
--- a/xen/arch/x86/hvm/hypercall.c
+++ b/xen/arch/x86/hvm/hypercall.c
@@ -111,11 +111,6 @@ long hvm_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
         return compat_physdev_op(cmd, arg);
 }
 
-#ifndef NDEBUG
-static const unsigned char hypercall_args_64[] = hypercall_args_hvm64;
-static const unsigned char hypercall_args_32[] = hypercall_args_hvm32;
-#endif
-
 int hvm_hypercall(struct cpu_user_regs *regs)
 {
     struct vcpu *curr = current;
@@ -177,7 +172,7 @@ int hvm_hypercall(struct cpu_user_regs *regs)
                             regs->r10, regs->r8);
 
         if ( !curr->hcall_preempted && regs->rax != -ENOSYS )
-            clobber_regs(regs, get_nargs(hypercall_args_64, eax));
+            clobber_regs(regs, eax, hvm, 64);
     }
     else
     {
@@ -190,7 +185,7 @@ int hvm_hypercall(struct cpu_user_regs *regs)
         curr->hcall_compat = false;
 
         if ( !curr->hcall_preempted && regs->eax != -ENOSYS )
-            clobber_regs32(regs, get_nargs(hypercall_args_32, eax));
+            clobber_regs(regs, eax, hvm, 32);
     }
 
     hvmemul_cache_restore(curr, token);
diff --git a/xen/arch/x86/include/asm/hypercall.h b/xen/arch/x86/include/asm/hypercall.h
index ab8bd12e60..ec2edc771e 100644
--- a/xen/arch/x86/include/asm/hypercall.h
+++ b/xen/arch/x86/include/asm/hypercall.h
@@ -43,18 +43,8 @@ compat_common_vcpu_op(
 
 #endif /* CONFIG_COMPAT */
 
-#ifndef NDEBUG
-static inline unsigned int _get_nargs(const unsigned char *tbl, unsigned int c)
-{
-    return tbl[c];
-}
-#define get_nargs(t, c) _get_nargs(t, array_index_nospec(c, ARRAY_SIZE(t)))
-#else
-#define get_nargs(tbl, c) 0
-#endif
-
-static inline void clobber_regs(struct cpu_user_regs *regs,
-                                unsigned int nargs)
+static inline void clobber_regs64(struct cpu_user_regs *regs,
+                                  unsigned int nargs)
 {
 #ifndef NDEBUG
     /* Deliberately corrupt used parameter regs. */
@@ -85,4 +75,9 @@ static inline void clobber_regs32(struct cpu_user_regs *regs,
 #endif
 }
 
+#define clobber_regs(r, n, t, b) ({ \
+    static const unsigned char t ## b[] = hypercall_args_ ## t ## b; \
+    clobber_regs ## b(r, array_access_nospec(t ## b, n)); \
+})
+
 #endif /* __ASM_X86_HYPERCALL_H__ */
diff --git a/xen/arch/x86/pv/hypercall.c b/xen/arch/x86/pv/hypercall.c
index bf64bb41bb..2eedfbfae8 100644
--- a/xen/arch/x86/pv/hypercall.c
+++ b/xen/arch/x86/pv/hypercall.c
@@ -27,13 +27,6 @@
 #include <asm/multicall.h>
 #include <irq_vectors.h>
 
-#ifndef NDEBUG
-static const unsigned char hypercall_args_64[] = hypercall_args_pv64;
-#ifdef CONFIG_PV32
-static const unsigned char hypercall_args_32[] = hypercall_args_pv32;
-#endif
-#endif
-
 /* Forced inline to cause 'compat' to be evaluated at compile time. */
 static void always_inline
 _pv_hypercall(struct cpu_user_regs *regs, bool compat)
@@ -65,7 +58,7 @@ _pv_hypercall(struct cpu_user_regs *regs, bool compat)
         call_handlers_pv64(eax, regs->rax, rdi, rsi, rdx, r10, r8);
 
         if ( !curr->hcall_preempted && regs->rax != -ENOSYS )
-            clobber_regs(regs, get_nargs(hypercall_args_64, eax));
+            clobber_regs(regs, eax, pv, 64);
     }
 #ifdef CONFIG_PV32
     else
@@ -90,7 +83,7 @@ _pv_hypercall(struct cpu_user_regs *regs, bool compat)
         curr->hcall_compat = false;
 
         if ( !curr->hcall_preempted && regs->eax != -ENOSYS )
-            clobber_regs32(regs, get_nargs(hypercall_args_32, eax));
+            clobber_regs(regs, eax, pv, 32);
     }
 #endif /* CONFIG_PV32 */
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 19 19:33:11 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Aug 2022 19:33:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.390425.627836 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oP7ju-0003EB-DM; Fri, 19 Aug 2022 19:33:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 390425.627836; Fri, 19 Aug 2022 19:33:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oP7ju-0003E3-AJ; Fri, 19 Aug 2022 19:33:06 +0000
Received: by outflank-mailman (input) for mailman id 390425;
 Fri, 19 Aug 2022 19:33:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oP7js-0003Cr-8y
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 19:33:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oP7js-0007tv-6Z
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 19:33:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oP7js-0000cD-5U
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 19:33:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Jdk6FUG+7z4ceGv0PRKmpIhLl7dKIAOMSEIPTxv5fhw=; b=F2ETBY4wcgZ1HltRhfcjDCoGXe
	aX0/AEiyvrerZWy+8FCjQeuo7VkYmLtuX4mW0Jglqddd4qT9wgraMlhwKOZERjdl1cFhf90LyFsV/
	VwywyUSQZu/ngcxi0m3Pqqi6lWItrYtCwA07+lMEFl7uiGESP7QzCe8E3pNkzQIYKPxQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] Temporarily revert "amd/msr: implement VIRT_SPEC_CTRL for HVM guests using legacy SSBD"
Message-Id: <E1oP7js-0000cD-5U@xenbits.xenproject.org>
Date: Fri, 19 Aug 2022 19:33:04 +0000

commit c254f3b45c7fc8b050a6b6290d9bd7203417b994
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Fri Aug 19 20:15:22 2022 +0100
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Fri Aug 19 20:15:22 2022 +0100

    Temporarily revert "amd/msr: implement VIRT_SPEC_CTRL for HVM guests using legacy SSBD"
    
    A person tagged in commit 646589ac148a2ff6bb222a6081b4d7b13ee468c0
    claims the tag is in accurate; revert this commit so that we can
    re-commit it again with the tag corrected.
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
---
 CHANGELOG.md                   |   1 -
 xen/arch/x86/cpu/amd.c         | 121 ++++++-----------------------------------
 xen/arch/x86/hvm/svm/svm.c     |   4 --
 xen/arch/x86/include/asm/amd.h |   4 --
 xen/arch/x86/spec_ctrl.c       |   4 +-
 5 files changed, 18 insertions(+), 116 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5e4bae5f35..a87a193e15 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,7 +13,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 ### Added / support upgraded
  - IOMMU superpage support on x86, affecting PV guests as well as HVM/PVH ones
    when they don't share page tables with the CPU (HAP / EPT / NPT).
- - Support VIRT_SSBD feature for HVM guests on AMD.
 
 ### Removed / support downgraded
  - dropped support for the (x86-only) "vesa-mtrr" and "vesa-remap" command line options
diff --git a/xen/arch/x86/cpu/amd.c b/xen/arch/x86/cpu/amd.c
index 98c52d0686..d5f8e5e899 100644
--- a/xen/arch/x86/cpu/amd.c
+++ b/xen/arch/x86/cpu/amd.c
@@ -48,7 +48,6 @@ boolean_param("allow_unsafe", opt_allow_unsafe);
 
 /* Signal whether the ACPI C1E quirk is required. */
 bool __read_mostly amd_acpi_c1e_quirk;
-bool __ro_after_init amd_legacy_ssbd;
 
 static inline int rdmsr_amd_safe(unsigned int msr, unsigned int *lo,
 				 unsigned int *hi)
@@ -686,10 +685,23 @@ void amd_init_lfence(struct cpuinfo_x86 *c)
  * Refer to the AMD Speculative Store Bypass whitepaper:
  * https://developer.amd.com/wp-content/resources/124441_AMD64_SpeculativeStoreBypassDisable_Whitepaper_final.pdf
  */
-static bool set_legacy_ssbd(const struct cpuinfo_x86 *c, bool enable)
+void amd_init_ssbd(const struct cpuinfo_x86 *c)
 {
 	int bit = -1;
 
+	if (cpu_has_ssb_no)
+		return;
+
+	if (cpu_has_amd_ssbd) {
+		/* Handled by common MSR_SPEC_CTRL logic */
+		return;
+	}
+
+	if (cpu_has_virt_ssbd) {
+		wrmsrl(MSR_VIRT_SPEC_CTRL, opt_ssbd ? SPEC_CTRL_SSBD : 0);
+		return;
+	}
+
 	switch (c->x86) {
 	case 0x15: bit = 54; break;
 	case 0x16: bit = 33; break;
@@ -703,119 +715,20 @@ static bool set_legacy_ssbd(const struct cpuinfo_x86 *c, bool enable)
 		if (rdmsr_safe(MSR_AMD64_LS_CFG, val) ||
 		    ({
 			    val &= ~mask;
-			    if (enable)
+			    if (opt_ssbd)
 				    val |= mask;
 			    false;
 		    }) ||
 		    wrmsr_safe(MSR_AMD64_LS_CFG, val) ||
 		    ({
 			    rdmsrl(MSR_AMD64_LS_CFG, val);
-			    (val & mask) != (enable * mask);
+			    (val & mask) != (opt_ssbd * mask);
 		    }))
 			bit = -1;
 	}
 
-	return bit >= 0;
-}
-
-void amd_init_ssbd(const struct cpuinfo_x86 *c)
-{
-	if (cpu_has_ssb_no)
-		return;
-
-	if (cpu_has_amd_ssbd) {
-		/* Handled by common MSR_SPEC_CTRL logic */
-		return;
-	}
-
-	if (cpu_has_virt_ssbd) {
-		wrmsrl(MSR_VIRT_SPEC_CTRL, opt_ssbd ? SPEC_CTRL_SSBD : 0);
-		return;
-	}
-
-	if (!set_legacy_ssbd(c, opt_ssbd)) {
+	if (bit < 0)
 		printk_once(XENLOG_ERR "No SSBD controls available\n");
-		if (amd_legacy_ssbd)
-			panic("CPU feature mismatch: no legacy SSBD\n");
-	} else if (c == &boot_cpu_data)
-		amd_legacy_ssbd = true;
-}
-
-static struct ssbd_ls_cfg {
-    bool locked;
-    unsigned int count;
-} __cacheline_aligned *ssbd_ls_cfg;
-static unsigned int __ro_after_init ssbd_max_cores;
-#define AMD_FAM17H_MAX_SOCKETS 2
-
-bool __init amd_setup_legacy_ssbd(void)
-{
-	unsigned int i;
-
-	if ((boot_cpu_data.x86 != 0x17 && boot_cpu_data.x86 != 0x18) ||
-	    boot_cpu_data.x86_num_siblings <= 1)
-		return true;
-
-	/*
-	 * One could be forgiven for thinking that c->x86_max_cores is the
-	 * correct value to use here.
-	 *
-	 * However, that value is derived from the current configuration, and
-	 * c->cpu_core_id is sparse on all but the top end CPUs.  Derive
-	 * max_cpus from ApicIdCoreIdSize which will cover any sparseness.
-	 */
-	if (boot_cpu_data.extended_cpuid_level >= 0x80000008) {
-		ssbd_max_cores = 1u << MASK_EXTR(cpuid_ecx(0x80000008), 0xf000);
-		ssbd_max_cores /= boot_cpu_data.x86_num_siblings;
-	}
-	if (!ssbd_max_cores)
-		return false;
-
-	ssbd_ls_cfg = xzalloc_array(struct ssbd_ls_cfg,
-	                            ssbd_max_cores * AMD_FAM17H_MAX_SOCKETS);
-	if (!ssbd_ls_cfg)
-		return false;
-
-	if (opt_ssbd)
-		for (i = 0; i < ssbd_max_cores * AMD_FAM17H_MAX_SOCKETS; i++)
-			/* Set initial state, applies to any (hotplug) CPU. */
-			ssbd_ls_cfg[i].count = boot_cpu_data.x86_num_siblings;
-
-	return true;
-}
-
-/*
- * Executed from GIF==0 context: avoid using BUG/ASSERT or other functionality
- * that relies on exceptions as those are not expected to run in GIF==0
- * context.
- */
-void amd_set_legacy_ssbd(bool enable)
-{
-	const struct cpuinfo_x86 *c = &current_cpu_data;
-	struct ssbd_ls_cfg *status;
-
-	if ((c->x86 != 0x17 && c->x86 != 0x18) || c->x86_num_siblings <= 1) {
-		set_legacy_ssbd(c, enable);
-		return;
-	}
-
-	status = &ssbd_ls_cfg[c->phys_proc_id * ssbd_max_cores +
-	                      c->cpu_core_id];
-
-	/*
-	 * Open code a very simple spinlock: this function is used with GIF==0
-	 * and different IF values, so would trigger the checklock detector.
-	 * Instead of trying to workaround the detector, use a very simple lock
-	 * implementation: it's better to reduce the amount of code executed
-	 * with GIF==0.
-	 */
-	while (test_and_set_bool(status->locked))
-		cpu_relax();
-	status->count += enable ? 1 : -1;
-	if (enable ? status->count == 1 : !status->count)
-		set_legacy_ssbd(c, enable);
-	barrier();
-	write_atomic(&status->locked, false);
 }
 
 /*
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 1aeaabcb13..53ce2edd35 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -3126,8 +3126,6 @@ void vmexit_virt_spec_ctrl(void)
 
     if ( cpu_has_virt_ssbd )
         wrmsr(MSR_VIRT_SPEC_CTRL, val, 0);
-    else
-        amd_set_legacy_ssbd(val);
 }
 
 /* Called with GIF=0. */
@@ -3140,8 +3138,6 @@ void vmentry_virt_spec_ctrl(void)
 
     if ( cpu_has_virt_ssbd )
         wrmsr(MSR_VIRT_SPEC_CTRL, val, 0);
-    else
-        amd_set_legacy_ssbd(val);
 }
 
 /*
diff --git a/xen/arch/x86/include/asm/amd.h b/xen/arch/x86/include/asm/amd.h
index 6a42f68542..a82382e6bf 100644
--- a/xen/arch/x86/include/asm/amd.h
+++ b/xen/arch/x86/include/asm/amd.h
@@ -151,8 +151,4 @@ void check_enable_amd_mmconf_dmi(void);
 extern bool amd_acpi_c1e_quirk;
 void amd_check_disable_c1e(unsigned int port, u8 value);
 
-extern bool amd_legacy_ssbd;
-bool amd_setup_legacy_ssbd(void);
-void amd_set_legacy_ssbd(bool enable);
-
 #endif /* __AMD_H__ */
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index 4e53056624..ec44205309 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -22,7 +22,6 @@
 #include <xen/param.h>
 #include <xen/warning.h>
 
-#include <asm/amd.h>
 #include <asm/hvm/svm/svm.h>
 #include <asm/microcode.h>
 #include <asm/msr.h>
@@ -1245,8 +1244,7 @@ void __init init_speculation_mitigations(void)
     }
 
     /* Support VIRT_SPEC_CTRL.SSBD if AMD_SSBD is not available. */
-    if ( opt_msr_sc_hvm && !cpu_has_amd_ssbd &&
-         (cpu_has_virt_ssbd || (amd_legacy_ssbd && amd_setup_legacy_ssbd())) )
+    if ( opt_msr_sc_hvm && !cpu_has_amd_ssbd && cpu_has_virt_ssbd )
         setup_force_cpu_cap(X86_FEATURE_VIRT_SC_MSR_HVM);
 
     /* Figure out default_xen_spec_ctrl. */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 19 19:33:15 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Aug 2022 19:33:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.390426.627840 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oP7k3-0003Hi-ET; Fri, 19 Aug 2022 19:33:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 390426.627840; Fri, 19 Aug 2022 19:33:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oP7k3-0003Hb-Bv; Fri, 19 Aug 2022 19:33:15 +0000
Received: by outflank-mailman (input) for mailman id 390426;
 Fri, 19 Aug 2022 19:33:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oP7k2-0003HD-Ah
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 19:33:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oP7k2-0007u1-A2
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 19:33:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oP7k2-0000cl-8t
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 19:33:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=pCP2VXlix62CxVVwjD/yQpm5JaSF2cH1MvQ2dpYnfOA=; b=1pn4Plfc2Yy/GNTjQECZdfknfw
	TSqVhW4A/NjFaez2J/yzfaYP7bqurVYbVCUxk72PWO/ttLmeQMHvJgxH/GBZ1EPW9ViUgC/leK21p
	wuhAU0QnFPuNCiSvRcoByPmWBlnHutxdymZFaVvV96GoQSx7zovYXXKftmTc+KdAkhZc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] Temporarily revert "amd/msr: allow passthrough of VIRT_SPEC_CTRL for HVM guests"
Message-Id: <E1oP7k2-0000cl-8t@xenbits.xenproject.org>
Date: Fri, 19 Aug 2022 19:33:14 +0000

commit bc7f400b968fa3f660c26bdc53f5efa394bbfcd1
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Fri Aug 19 20:17:30 2022 +0100
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Fri Aug 19 20:21:57 2022 +0100

    Temporarily revert "amd/msr: allow passthrough of VIRT_SPEC_CTRL for HVM guests"
    
    A person tagged in commit a2eeaa6906101fbf322766f37f8f061dd36fe58d
    claims the tag is in accurate; revert this commit so that we can
    re-commit it again with the tag corrected.
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
---
 xen/arch/x86/cpuid.c                   | 14 --------------
 xen/arch/x86/hvm/svm/entry.S           |  8 --------
 xen/arch/x86/hvm/svm/svm.c             | 35 ----------------------------------
 xen/arch/x86/include/asm/cpufeatures.h |  2 +-
 xen/arch/x86/include/asm/msr.h         | 10 ----------
 xen/arch/x86/msr.c                     | 16 ++++------------
 xen/arch/x86/spec_ctrl.c               |  9 +--------
 7 files changed, 6 insertions(+), 88 deletions(-)

diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index a4a366ad84..979dcf8164 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -541,13 +541,6 @@ static void __init calculate_hvm_max_policy(void)
          raw_cpuid_policy.basic.sep )
         __set_bit(X86_FEATURE_SEP, hvm_featureset);
 
-    /*
-     * VIRT_SSBD is exposed in the default policy as a result of
-     * VIRT_SC_MSR_HVM being set, it also needs exposing in the max policy.
-     */
-    if ( boot_cpu_has(X86_FEATURE_VIRT_SC_MSR_HVM) )
-        __set_bit(X86_FEATURE_VIRT_SSBD, hvm_featureset);
-
     /*
      * If Xen isn't virtualising MSR_SPEC_CTRL for HVM guests (functional
      * availability, or admin choice), hide the feature.
@@ -604,13 +597,6 @@ static void __init calculate_hvm_def_policy(void)
     guest_common_feature_adjustments(hvm_featureset);
     guest_common_default_feature_adjustments(hvm_featureset);
 
-    /*
-     * Only expose VIRT_SSBD if AMD_SSBD is not available, and thus
-     * VIRT_SC_MSR_HVM is set.
-     */
-    if ( boot_cpu_has(X86_FEATURE_VIRT_SC_MSR_HVM) )
-        __set_bit(X86_FEATURE_VIRT_SSBD, hvm_featureset);
-
     sanitise_featureset(hvm_featureset);
     cpuid_featureset_to_policy(hvm_featureset, p);
     recalculate_xstate(p);
diff --git a/xen/arch/x86/hvm/svm/entry.S b/xen/arch/x86/hvm/svm/entry.S
index a26589aa9a..a60d759f71 100644
--- a/xen/arch/x86/hvm/svm/entry.S
+++ b/xen/arch/x86/hvm/svm/entry.S
@@ -19,8 +19,6 @@
 
         .file "svm/entry.S"
 
-#include <xen/lib.h>
-
 #include <asm/asm_defns.h>
 #include <asm/page.h>
 
@@ -59,9 +57,6 @@ __UNLIKELY_END(nsvm_hap)
 
         clgi
 
-        ALTERNATIVE "", STR(call vmentry_virt_spec_ctrl), \
-                        X86_FEATURE_VIRT_SC_MSR_HVM
-
         /* WARNING! `ret`, `call *`, `jmp *` not safe beyond this point. */
         /* SPEC_CTRL_EXIT_TO_SVM       Req: b=curr %rsp=regs/cpuinfo, Clob: acd */
         .macro svm_vmentry_spec_ctrl
@@ -131,9 +126,6 @@ __UNLIKELY_END(nsvm_hap)
         ALTERNATIVE "", svm_vmexit_spec_ctrl, X86_FEATURE_SC_MSR_HVM
         /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */
 
-        ALTERNATIVE "", STR(call vmexit_virt_spec_ctrl), \
-                        X86_FEATURE_VIRT_SC_MSR_HVM
-
         /*
          * STGI is executed unconditionally, and is sufficiently serialising
          * to safely resolve any Spectre-v1 concerns in the above logic.
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 53ce2edd35..0849a9dc5f 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -52,7 +52,6 @@
 #include <asm/hvm/svm/svmdebug.h>
 #include <asm/hvm/svm/nestedsvm.h>
 #include <asm/hvm/nestedhvm.h>
-#include <asm/spec_ctrl.h>
 #include <asm/x86_emulate.h>
 #include <public/sched.h>
 #include <asm/hvm/vpt.h>
@@ -611,16 +610,6 @@ static void cf_check svm_cpuid_policy_changed(struct vcpu *v)
     svm_intercept_msr(v, MSR_SPEC_CTRL,
                       cp->extd.ibrs ? MSR_INTERCEPT_NONE : MSR_INTERCEPT_RW);
 
-    /*
-     * Always trap write accesses to VIRT_SPEC_CTRL in order to cache the guest
-     * setting and avoid having to perform a rdmsr on vmexit to get the guest
-     * setting even if VIRT_SSBD is offered to Xen itself.
-     */
-    svm_intercept_msr(v, MSR_VIRT_SPEC_CTRL,
-                      cp->extd.virt_ssbd && cpu_has_virt_ssbd &&
-                      !cpu_has_amd_ssbd ?
-                      MSR_INTERCEPT_WRITE : MSR_INTERCEPT_RW);
-
     /* Give access to MSR_PRED_CMD if the guest has been told about it. */
     svm_intercept_msr(v, MSR_PRED_CMD,
                       cp->extd.ibpb ? MSR_INTERCEPT_NONE : MSR_INTERCEPT_RW);
@@ -3116,30 +3105,6 @@ void svm_vmexit_handler(struct cpu_user_regs *regs)
     vmcb_set_vintr(vmcb, intr);
 }
 
-/* Called with GIF=0. */
-void vmexit_virt_spec_ctrl(void)
-{
-    unsigned int val = opt_ssbd ? SPEC_CTRL_SSBD : 0;
-
-    if ( val == current->arch.msrs->virt_spec_ctrl.raw )
-        return;
-
-    if ( cpu_has_virt_ssbd )
-        wrmsr(MSR_VIRT_SPEC_CTRL, val, 0);
-}
-
-/* Called with GIF=0. */
-void vmentry_virt_spec_ctrl(void)
-{
-    unsigned int val = current->arch.msrs->virt_spec_ctrl.raw;
-
-    if ( val == (opt_ssbd ? SPEC_CTRL_SSBD : 0) )
-        return;
-
-    if ( cpu_has_virt_ssbd )
-        wrmsr(MSR_VIRT_SPEC_CTRL, val, 0);
-}
-
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/x86/include/asm/cpufeatures.h b/xen/arch/x86/include/asm/cpufeatures.h
index 3895de4faf..672c9ee22b 100644
--- a/xen/arch/x86/include/asm/cpufeatures.h
+++ b/xen/arch/x86/include/asm/cpufeatures.h
@@ -24,7 +24,7 @@ XEN_CPUFEATURE(APERFMPERF,        X86_SYNTH( 8)) /* APERFMPERF */
 XEN_CPUFEATURE(MFENCE_RDTSC,      X86_SYNTH( 9)) /* MFENCE synchronizes RDTSC */
 XEN_CPUFEATURE(XEN_SMEP,          X86_SYNTH(10)) /* SMEP gets used by Xen itself */
 XEN_CPUFEATURE(XEN_SMAP,          X86_SYNTH(11)) /* SMAP gets used by Xen itself */
-XEN_CPUFEATURE(VIRT_SC_MSR_HVM,   X86_SYNTH(12)) /* MSR_VIRT_SPEC_CTRL exposed to HVM */
+/* Bit 12 - unused. */
 XEN_CPUFEATURE(IND_THUNK_LFENCE,  X86_SYNTH(13)) /* Use IND_THUNK_LFENCE */
 XEN_CPUFEATURE(IND_THUNK_JMP,     X86_SYNTH(14)) /* Use IND_THUNK_JMP */
 XEN_CPUFEATURE(SC_NO_BRANCH_HARDEN, X86_SYNTH(15)) /* (Disable) Conditional branch hardening */
diff --git a/xen/arch/x86/include/asm/msr.h b/xen/arch/x86/include/asm/msr.h
index de18e90b2e..ab6fbb5051 100644
--- a/xen/arch/x86/include/asm/msr.h
+++ b/xen/arch/x86/include/asm/msr.h
@@ -375,16 +375,6 @@ struct vcpu_msrs
      */
     uint32_t tsc_aux;
 
-    /*
-     * 0xc001011f - MSR_VIRT_SPEC_CTRL (if !X86_FEATURE_AMD_SSBD)
-     *
-     * AMD only. Guest selected value, context switched on guest VM
-     * entry/exit.
-     */
-    struct {
-        uint32_t raw;
-    } virt_spec_ctrl;
-
     /*
      * 0xc00110{27,19-1b} MSR_AMD64_DR{0-3}_ADDRESS_MASK
      *
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 95416995a5..2ae1fcfd5f 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -393,10 +393,7 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
         if ( !cp->extd.virt_ssbd )
             goto gp_fault;
 
-        if ( cpu_has_amd_ssbd )
-            *val = msrs->spec_ctrl.raw & SPEC_CTRL_SSBD;
-        else
-            *val = msrs->virt_spec_ctrl.raw;
+        *val = msrs->spec_ctrl.raw & SPEC_CTRL_SSBD;
         break;
 
     case MSR_AMD64_DE_CFG:
@@ -689,15 +686,10 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
             goto gp_fault;
 
         /* Only supports SSBD bit, the rest are ignored. */
-        if ( cpu_has_amd_ssbd )
-        {
-            if ( val & SPEC_CTRL_SSBD )
-                msrs->spec_ctrl.raw |= SPEC_CTRL_SSBD;
-            else
-                msrs->spec_ctrl.raw &= ~SPEC_CTRL_SSBD;
-        }
+        if ( val & SPEC_CTRL_SSBD )
+            msrs->spec_ctrl.raw |= SPEC_CTRL_SSBD;
         else
-            msrs->virt_spec_ctrl.raw = val & SPEC_CTRL_SSBD;
+            msrs->spec_ctrl.raw &= ~SPEC_CTRL_SSBD;
         break;
 
     case MSR_AMD64_DE_CFG:
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index ec44205309..96e7f0983a 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -513,12 +513,9 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
            (boot_cpu_has(X86_FEATURE_SC_MSR_HVM) ||
             boot_cpu_has(X86_FEATURE_SC_RSB_HVM) ||
             boot_cpu_has(X86_FEATURE_IBPB_ENTRY_HVM) ||
-            boot_cpu_has(X86_FEATURE_VIRT_SC_MSR_HVM) ||
             opt_eager_fpu || opt_md_clear_hvm)       ? ""               : " None",
            boot_cpu_has(X86_FEATURE_SC_MSR_HVM)      ? " MSR_SPEC_CTRL" : "",
-           (boot_cpu_has(X86_FEATURE_SC_MSR_HVM) ||
-            boot_cpu_has(X86_FEATURE_VIRT_SC_MSR_HVM)) ? " MSR_VIRT_SPEC_CTRL"
-                                                       : "",
+           boot_cpu_has(X86_FEATURE_SC_MSR_HVM)      ? " MSR_VIRT_SPEC_CTRL" : "",
            boot_cpu_has(X86_FEATURE_SC_RSB_HVM)      ? " RSB"           : "",
            opt_eager_fpu                             ? " EAGER_FPU"     : "",
            opt_md_clear_hvm                          ? " MD_CLEAR"      : "",
@@ -1243,10 +1240,6 @@ void __init init_speculation_mitigations(void)
             setup_force_cpu_cap(X86_FEATURE_SC_MSR_HVM);
     }
 
-    /* Support VIRT_SPEC_CTRL.SSBD if AMD_SSBD is not available. */
-    if ( opt_msr_sc_hvm && !cpu_has_amd_ssbd && cpu_has_virt_ssbd )
-        setup_force_cpu_cap(X86_FEATURE_VIRT_SC_MSR_HVM);
-
     /* Figure out default_xen_spec_ctrl. */
     if ( has_spec_ctrl && ibrs )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 19 19:33:25 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Aug 2022 19:33:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.390428.627844 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oP7kD-0003Qu-GI; Fri, 19 Aug 2022 19:33:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 390428.627844; Fri, 19 Aug 2022 19:33: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 1oP7kD-0003Qn-De; Fri, 19 Aug 2022 19:33:25 +0000
Received: by outflank-mailman (input) for mailman id 390428;
 Fri, 19 Aug 2022 19:33:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oP7kC-0003PG-Ey
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 19:33:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oP7kC-0007uK-EF
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 19:33:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oP7kC-0000dD-CN
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 19:33:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=RY8R6yjl6wCN0i5m80WGfYUK1FmVpSSwgDMS2/u3q6s=; b=RVZf+25MT5/MiQDmYqZFI+QfQ8
	07hlKzCjoGYOFPbexwWfyiQp49/XBEPbGfZ4NEbJHcl3RoKvhqiljnss1EfUkxS4L0oHvhnDPRVLO
	FWeIuT55DgRJ7UlS4mYP7HcNVCc5fMeQ4PDWjguK584gTvUMeG7WVlfExbPM1DPGurn0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] Temporarily revert "amd/msr: implement VIRT_SPEC_CTRL for HVM guests on top of SPEC_CTRL"
Message-Id: <E1oP7kC-0000dD-CN@xenbits.xenproject.org>
Date: Fri, 19 Aug 2022 19:33:24 +0000

commit 8c5d17f5a48ea2cd4cac27b6ae414c0946d4eda8
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Fri Aug 19 20:18:46 2022 +0100
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Fri Aug 19 20:22:10 2022 +0100

    Temporarily revert "amd/msr: implement VIRT_SPEC_CTRL for HVM guests on top of SPEC_CTRL"
    
    A person tagged in commit ebaaa72ee080c8774b1df5783220d4811159c327
    claims the tag is in accurate; revert this commit so that we can
    re-commit it again with the tag corrected.
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
---
 xen/arch/x86/cpuid.c                        |  7 -------
 xen/arch/x86/hvm/hvm.c                      |  1 -
 xen/arch/x86/include/asm/msr.h              |  4 ----
 xen/arch/x86/msr.c                          | 18 ------------------
 xen/arch/x86/spec_ctrl.c                    |  3 +--
 xen/include/public/arch-x86/cpufeatureset.h |  2 +-
 6 files changed, 2 insertions(+), 33 deletions(-)

diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 979dcf8164..7e0b395698 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -550,13 +550,6 @@ static void __init calculate_hvm_max_policy(void)
         __clear_bit(X86_FEATURE_IBRSB, hvm_featureset);
         __clear_bit(X86_FEATURE_IBRS, hvm_featureset);
     }
-    else if ( boot_cpu_has(X86_FEATURE_AMD_SSBD) )
-        /*
-         * If SPEC_CTRL.SSBD is available VIRT_SPEC_CTRL.SSBD can be exposed
-         * and implemented using the former. Expose in the max policy only as
-         * the preference is for guests to use SPEC_CTRL.SSBD if available.
-         */
-        __set_bit(X86_FEATURE_VIRT_SSBD, hvm_featureset);
 
     /*
      * With VT-x, some features are only supported by Xen if dedicated
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 6b5d585ed4..0dd320a6a9 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -1337,7 +1337,6 @@ static const uint32_t msrs_to_send[] = {
     MSR_INTEL_MISC_FEATURES_ENABLES,
     MSR_IA32_BNDCFGS,
     MSR_IA32_XSS,
-    MSR_VIRT_SPEC_CTRL,
     MSR_AMD64_DR0_ADDRESS_MASK,
     MSR_AMD64_DR1_ADDRESS_MASK,
     MSR_AMD64_DR2_ADDRESS_MASK,
diff --git a/xen/arch/x86/include/asm/msr.h b/xen/arch/x86/include/asm/msr.h
index ab6fbb5051..ce4fe51afe 100644
--- a/xen/arch/x86/include/asm/msr.h
+++ b/xen/arch/x86/include/asm/msr.h
@@ -291,7 +291,6 @@ struct vcpu_msrs
 {
     /*
      * 0x00000048 - MSR_SPEC_CTRL
-     * 0xc001011f - MSR_VIRT_SPEC_CTRL (if X86_FEATURE_AMD_SSBD)
      *
      * For PV guests, this holds the guest kernel value.  It is accessed on
      * every entry/exit path.
@@ -307,9 +306,6 @@ struct vcpu_msrs
      * We must clear/restore Xen's value before/after VMRUN to avoid unduly
      * influencing the guest.  In order to support "behind the guest's back"
      * protections, we load this value (commonly 0) before VMRUN.
-     *
-     * Once of such "behind the guest's back" usages is setting SPEC_CTRL.SSBD
-     * if the guest sets VIRT_SPEC_CTRL.SSBD.
      */
     struct {
         uint32_t raw;
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 2ae1fcfd5f..d2e2dc2a6b 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -389,13 +389,6 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
                ? K8_HWCR_TSC_FREQ_SEL : 0;
         break;
 
-    case MSR_VIRT_SPEC_CTRL:
-        if ( !cp->extd.virt_ssbd )
-            goto gp_fault;
-
-        *val = msrs->spec_ctrl.raw & SPEC_CTRL_SSBD;
-        break;
-
     case MSR_AMD64_DE_CFG:
         if ( !(cp->x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON)) )
             goto gp_fault;
@@ -681,17 +674,6 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
             wrmsr_tsc_aux(val);
         break;
 
-    case MSR_VIRT_SPEC_CTRL:
-        if ( !cp->extd.virt_ssbd )
-            goto gp_fault;
-
-        /* Only supports SSBD bit, the rest are ignored. */
-        if ( val & SPEC_CTRL_SSBD )
-            msrs->spec_ctrl.raw |= SPEC_CTRL_SSBD;
-        else
-            msrs->spec_ctrl.raw &= ~SPEC_CTRL_SSBD;
-        break;
-
     case MSR_AMD64_DE_CFG:
         /*
          * OpenBSD 6.7 will panic if writing to DE_CFG triggers a #GP:
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index 96e7f0983a..160cc68086 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -509,13 +509,12 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
      * mitigation support for guests.
      */
 #ifdef CONFIG_HVM
-    printk("  Support for HVM VMs:%s%s%s%s%s%s%s\n",
+    printk("  Support for HVM VMs:%s%s%s%s%s%s\n",
            (boot_cpu_has(X86_FEATURE_SC_MSR_HVM) ||
             boot_cpu_has(X86_FEATURE_SC_RSB_HVM) ||
             boot_cpu_has(X86_FEATURE_IBPB_ENTRY_HVM) ||
             opt_eager_fpu || opt_md_clear_hvm)       ? ""               : " None",
            boot_cpu_has(X86_FEATURE_SC_MSR_HVM)      ? " MSR_SPEC_CTRL" : "",
-           boot_cpu_has(X86_FEATURE_SC_MSR_HVM)      ? " MSR_VIRT_SPEC_CTRL" : "",
            boot_cpu_has(X86_FEATURE_SC_RSB_HVM)      ? " RSB"           : "",
            opt_eager_fpu                             ? " EAGER_FPU"     : "",
            opt_md_clear_hvm                          ? " MD_CLEAR"      : "",
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 42f48a8ae2..4b8925b7b8 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -265,7 +265,7 @@ XEN_CPUFEATURE(IBRS_SAME_MODE, 8*32+19) /*S  IBRS provides same-mode protection
 XEN_CPUFEATURE(NO_LMSL,       8*32+20) /*S  EFER.LMSLE no longer supported. */
 XEN_CPUFEATURE(AMD_PPIN,      8*32+23) /*   Protected Processor Inventory Number */
 XEN_CPUFEATURE(AMD_SSBD,      8*32+24) /*S  MSR_SPEC_CTRL.SSBD available */
-XEN_CPUFEATURE(VIRT_SSBD,     8*32+25) /*!  MSR_VIRT_SPEC_CTRL.SSBD */
+XEN_CPUFEATURE(VIRT_SSBD,     8*32+25) /*   MSR_VIRT_SPEC_CTRL.SSBD */
 XEN_CPUFEATURE(SSB_NO,        8*32+26) /*A  Hardware not vulnerable to SSB */
 XEN_CPUFEATURE(PSFD,          8*32+28) /*S  MSR_SPEC_CTRL.PSFD */
 XEN_CPUFEATURE(BTC_NO,        8*32+29) /*A  Hardware not vulnerable to Branch Type Confusion */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 19 19:33:35 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Aug 2022 19:33:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.390430.627849 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oP7kN-0003ZG-JU; Fri, 19 Aug 2022 19:33:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 390430.627849; Fri, 19 Aug 2022 19:33: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 1oP7kN-0003Z8-Gm; Fri, 19 Aug 2022 19:33:35 +0000
Received: by outflank-mailman (input) for mailman id 390430;
 Fri, 19 Aug 2022 19:33:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oP7kM-0003Yp-JX
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 19:33:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oP7kM-0007uU-Is
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 19:33:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oP7kM-0000dk-Gd
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 19:33:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=LyENfKXu+dDhLyw5s0Feb3D+UyUEzKOMsFHGPl/b5EE=; b=D2kcYozgRWLl69o6gjjzg/NaIX
	hHm9answDz6Fqv4ikrgRhVARd3VzVZ9+gZ5pSCpUvyggLbBJUwVrp3IsxZ4KFxEq3F4a2vAGHbhmn
	cvUfksDDFcD8DnW4zwQ8o5vopkJL0lMor65Ra6C8pf22Cnl3ayDeNKBDF2Ockcpyth14=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] amd/msr: implement VIRT_SPEC_CTRL for HVM guests on top of SPEC_CTRL
Message-Id: <E1oP7kM-0000dk-Gd@xenbits.xenproject.org>
Date: Fri, 19 Aug 2022 19:33:34 +0000

commit 8ffd5496f46425f73771200f2b51087b794be553
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Aug 15 09:57:23 2022 +0200
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Fri Aug 19 20:22:22 2022 +0100

    amd/msr: implement VIRT_SPEC_CTRL for HVM guests on top of SPEC_CTRL
    
    Use the logic to set shadow SPEC_CTRL values in order to implement
    support for VIRT_SPEC_CTRL (signaled by VIRT_SSBD CPUID flag) for HVM
    guests. This includes using the spec_ctrl vCPU MSR variable to store
    the guest set value of VIRT_SPEC_CTRL.SSBD, which will be OR'ed with
    any SPEC_CTRL values being set by the guest.
    
    On hardware having SPEC_CTRL VIRT_SPEC_CTRL will not be offered by
    default to guests. VIRT_SPEC_CTRL will only be part of the max CPUID
    policy so it can be enabled for compatibility purposes.
    
    Use '!' to annotate the feature in order to express that the presence
    of the bit is not directly tied to its value in the host policy.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    
    Re-commited with a tag removed.
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
---
 xen/arch/x86/cpuid.c                        |  7 +++++++
 xen/arch/x86/hvm/hvm.c                      |  1 +
 xen/arch/x86/include/asm/msr.h              |  4 ++++
 xen/arch/x86/msr.c                          | 18 ++++++++++++++++++
 xen/arch/x86/spec_ctrl.c                    |  3 ++-
 xen/include/public/arch-x86/cpufeatureset.h |  2 +-
 6 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 7e0b395698..979dcf8164 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -550,6 +550,13 @@ static void __init calculate_hvm_max_policy(void)
         __clear_bit(X86_FEATURE_IBRSB, hvm_featureset);
         __clear_bit(X86_FEATURE_IBRS, hvm_featureset);
     }
+    else if ( boot_cpu_has(X86_FEATURE_AMD_SSBD) )
+        /*
+         * If SPEC_CTRL.SSBD is available VIRT_SPEC_CTRL.SSBD can be exposed
+         * and implemented using the former. Expose in the max policy only as
+         * the preference is for guests to use SPEC_CTRL.SSBD if available.
+         */
+        __set_bit(X86_FEATURE_VIRT_SSBD, hvm_featureset);
 
     /*
      * With VT-x, some features are only supported by Xen if dedicated
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 0dd320a6a9..6b5d585ed4 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -1337,6 +1337,7 @@ static const uint32_t msrs_to_send[] = {
     MSR_INTEL_MISC_FEATURES_ENABLES,
     MSR_IA32_BNDCFGS,
     MSR_IA32_XSS,
+    MSR_VIRT_SPEC_CTRL,
     MSR_AMD64_DR0_ADDRESS_MASK,
     MSR_AMD64_DR1_ADDRESS_MASK,
     MSR_AMD64_DR2_ADDRESS_MASK,
diff --git a/xen/arch/x86/include/asm/msr.h b/xen/arch/x86/include/asm/msr.h
index ce4fe51afe..ab6fbb5051 100644
--- a/xen/arch/x86/include/asm/msr.h
+++ b/xen/arch/x86/include/asm/msr.h
@@ -291,6 +291,7 @@ struct vcpu_msrs
 {
     /*
      * 0x00000048 - MSR_SPEC_CTRL
+     * 0xc001011f - MSR_VIRT_SPEC_CTRL (if X86_FEATURE_AMD_SSBD)
      *
      * For PV guests, this holds the guest kernel value.  It is accessed on
      * every entry/exit path.
@@ -306,6 +307,9 @@ struct vcpu_msrs
      * We must clear/restore Xen's value before/after VMRUN to avoid unduly
      * influencing the guest.  In order to support "behind the guest's back"
      * protections, we load this value (commonly 0) before VMRUN.
+     *
+     * Once of such "behind the guest's back" usages is setting SPEC_CTRL.SSBD
+     * if the guest sets VIRT_SPEC_CTRL.SSBD.
      */
     struct {
         uint32_t raw;
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index d2e2dc2a6b..2ae1fcfd5f 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -389,6 +389,13 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
                ? K8_HWCR_TSC_FREQ_SEL : 0;
         break;
 
+    case MSR_VIRT_SPEC_CTRL:
+        if ( !cp->extd.virt_ssbd )
+            goto gp_fault;
+
+        *val = msrs->spec_ctrl.raw & SPEC_CTRL_SSBD;
+        break;
+
     case MSR_AMD64_DE_CFG:
         if ( !(cp->x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON)) )
             goto gp_fault;
@@ -674,6 +681,17 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
             wrmsr_tsc_aux(val);
         break;
 
+    case MSR_VIRT_SPEC_CTRL:
+        if ( !cp->extd.virt_ssbd )
+            goto gp_fault;
+
+        /* Only supports SSBD bit, the rest are ignored. */
+        if ( val & SPEC_CTRL_SSBD )
+            msrs->spec_ctrl.raw |= SPEC_CTRL_SSBD;
+        else
+            msrs->spec_ctrl.raw &= ~SPEC_CTRL_SSBD;
+        break;
+
     case MSR_AMD64_DE_CFG:
         /*
          * OpenBSD 6.7 will panic if writing to DE_CFG triggers a #GP:
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index 160cc68086..96e7f0983a 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -509,12 +509,13 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
      * mitigation support for guests.
      */
 #ifdef CONFIG_HVM
-    printk("  Support for HVM VMs:%s%s%s%s%s%s\n",
+    printk("  Support for HVM VMs:%s%s%s%s%s%s%s\n",
            (boot_cpu_has(X86_FEATURE_SC_MSR_HVM) ||
             boot_cpu_has(X86_FEATURE_SC_RSB_HVM) ||
             boot_cpu_has(X86_FEATURE_IBPB_ENTRY_HVM) ||
             opt_eager_fpu || opt_md_clear_hvm)       ? ""               : " None",
            boot_cpu_has(X86_FEATURE_SC_MSR_HVM)      ? " MSR_SPEC_CTRL" : "",
+           boot_cpu_has(X86_FEATURE_SC_MSR_HVM)      ? " MSR_VIRT_SPEC_CTRL" : "",
            boot_cpu_has(X86_FEATURE_SC_RSB_HVM)      ? " RSB"           : "",
            opt_eager_fpu                             ? " EAGER_FPU"     : "",
            opt_md_clear_hvm                          ? " MD_CLEAR"      : "",
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 4b8925b7b8..42f48a8ae2 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -265,7 +265,7 @@ XEN_CPUFEATURE(IBRS_SAME_MODE, 8*32+19) /*S  IBRS provides same-mode protection
 XEN_CPUFEATURE(NO_LMSL,       8*32+20) /*S  EFER.LMSLE no longer supported. */
 XEN_CPUFEATURE(AMD_PPIN,      8*32+23) /*   Protected Processor Inventory Number */
 XEN_CPUFEATURE(AMD_SSBD,      8*32+24) /*S  MSR_SPEC_CTRL.SSBD available */
-XEN_CPUFEATURE(VIRT_SSBD,     8*32+25) /*   MSR_VIRT_SPEC_CTRL.SSBD */
+XEN_CPUFEATURE(VIRT_SSBD,     8*32+25) /*!  MSR_VIRT_SPEC_CTRL.SSBD */
 XEN_CPUFEATURE(SSB_NO,        8*32+26) /*A  Hardware not vulnerable to SSB */
 XEN_CPUFEATURE(PSFD,          8*32+28) /*S  MSR_SPEC_CTRL.PSFD */
 XEN_CPUFEATURE(BTC_NO,        8*32+29) /*A  Hardware not vulnerable to Branch Type Confusion */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 19 19:33:45 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Aug 2022 19:33:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.390433.627854 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oP7kX-0003de-LQ; Fri, 19 Aug 2022 19:33:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 390433.627854; Fri, 19 Aug 2022 19:33: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 1oP7kX-0003dU-IJ; Fri, 19 Aug 2022 19:33:45 +0000
Received: by outflank-mailman (input) for mailman id 390433;
 Fri, 19 Aug 2022 19:33:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oP7kW-0003dB-Nj
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 19:33:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oP7kW-0007ue-M8
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 19:33:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oP7kW-0000eY-LA
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 19:33:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=bdvfSEq92uSASFmXrVpFTdp89t1MBTimF4NmH6RIFGc=; b=Ccs1UCrT9yL72zk+0S82Nv/fjx
	xdzytVEPzCKv8kVQ8TBM7xuB/uPx6mFu/BHtxK8KtF+gBucIYa2fQKlOv+sxzQhLsdHFNeuFyhlUu
	IZi+IQK6WAQYY9iE+nkCfpFK8un74w3Xm/BxUVuGNNKEuAwVQDKSpdYM8yAOIM8Xgtz0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] amd/msr: allow passthrough of VIRT_SPEC_CTRL for HVM guests
Message-Id: <E1oP7kW-0000eY-LA@xenbits.xenproject.org>
Date: Fri, 19 Aug 2022 19:33:44 +0000

commit 15f3a67e7e05d268dee24337e1688ea6675a5036
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Aug 15 09:58:08 2022 +0200
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Fri Aug 19 20:23:21 2022 +0100

    amd/msr: allow passthrough of VIRT_SPEC_CTRL for HVM guests
    
    Allow HVM guests access to MSR_VIRT_SPEC_CTRL if the platform Xen is
    running on has support for it.  This requires adding logic in the
    vm{entry,exit} paths for SVM in order to context switch between the
    hypervisor value and the guest one.  The added handlers for context
    switch will also be used for the legacy SSBD support.
    
    Introduce a new synthetic feature leaf (X86_FEATURE_VIRT_SC_MSR_HVM)
    to signal whether VIRT_SPEC_CTRL needs to be handled on guest
    vm{entry,exit}.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    
    Re-commited with a tag removed.
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
---
 xen/arch/x86/cpuid.c                   | 14 ++++++++++++++
 xen/arch/x86/hvm/svm/entry.S           |  8 ++++++++
 xen/arch/x86/hvm/svm/svm.c             | 35 ++++++++++++++++++++++++++++++++++
 xen/arch/x86/include/asm/cpufeatures.h |  2 +-
 xen/arch/x86/include/asm/msr.h         | 10 ++++++++++
 xen/arch/x86/msr.c                     | 16 ++++++++++++----
 xen/arch/x86/spec_ctrl.c               |  9 ++++++++-
 7 files changed, 88 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 979dcf8164..a4a366ad84 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -541,6 +541,13 @@ static void __init calculate_hvm_max_policy(void)
          raw_cpuid_policy.basic.sep )
         __set_bit(X86_FEATURE_SEP, hvm_featureset);
 
+    /*
+     * VIRT_SSBD is exposed in the default policy as a result of
+     * VIRT_SC_MSR_HVM being set, it also needs exposing in the max policy.
+     */
+    if ( boot_cpu_has(X86_FEATURE_VIRT_SC_MSR_HVM) )
+        __set_bit(X86_FEATURE_VIRT_SSBD, hvm_featureset);
+
     /*
      * If Xen isn't virtualising MSR_SPEC_CTRL for HVM guests (functional
      * availability, or admin choice), hide the feature.
@@ -597,6 +604,13 @@ static void __init calculate_hvm_def_policy(void)
     guest_common_feature_adjustments(hvm_featureset);
     guest_common_default_feature_adjustments(hvm_featureset);
 
+    /*
+     * Only expose VIRT_SSBD if AMD_SSBD is not available, and thus
+     * VIRT_SC_MSR_HVM is set.
+     */
+    if ( boot_cpu_has(X86_FEATURE_VIRT_SC_MSR_HVM) )
+        __set_bit(X86_FEATURE_VIRT_SSBD, hvm_featureset);
+
     sanitise_featureset(hvm_featureset);
     cpuid_featureset_to_policy(hvm_featureset, p);
     recalculate_xstate(p);
diff --git a/xen/arch/x86/hvm/svm/entry.S b/xen/arch/x86/hvm/svm/entry.S
index a60d759f71..a26589aa9a 100644
--- a/xen/arch/x86/hvm/svm/entry.S
+++ b/xen/arch/x86/hvm/svm/entry.S
@@ -19,6 +19,8 @@
 
         .file "svm/entry.S"
 
+#include <xen/lib.h>
+
 #include <asm/asm_defns.h>
 #include <asm/page.h>
 
@@ -57,6 +59,9 @@ __UNLIKELY_END(nsvm_hap)
 
         clgi
 
+        ALTERNATIVE "", STR(call vmentry_virt_spec_ctrl), \
+                        X86_FEATURE_VIRT_SC_MSR_HVM
+
         /* WARNING! `ret`, `call *`, `jmp *` not safe beyond this point. */
         /* SPEC_CTRL_EXIT_TO_SVM       Req: b=curr %rsp=regs/cpuinfo, Clob: acd */
         .macro svm_vmentry_spec_ctrl
@@ -126,6 +131,9 @@ __UNLIKELY_END(nsvm_hap)
         ALTERNATIVE "", svm_vmexit_spec_ctrl, X86_FEATURE_SC_MSR_HVM
         /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */
 
+        ALTERNATIVE "", STR(call vmexit_virt_spec_ctrl), \
+                        X86_FEATURE_VIRT_SC_MSR_HVM
+
         /*
          * STGI is executed unconditionally, and is sufficiently serialising
          * to safely resolve any Spectre-v1 concerns in the above logic.
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 0849a9dc5f..53ce2edd35 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -52,6 +52,7 @@
 #include <asm/hvm/svm/svmdebug.h>
 #include <asm/hvm/svm/nestedsvm.h>
 #include <asm/hvm/nestedhvm.h>
+#include <asm/spec_ctrl.h>
 #include <asm/x86_emulate.h>
 #include <public/sched.h>
 #include <asm/hvm/vpt.h>
@@ -610,6 +611,16 @@ static void cf_check svm_cpuid_policy_changed(struct vcpu *v)
     svm_intercept_msr(v, MSR_SPEC_CTRL,
                       cp->extd.ibrs ? MSR_INTERCEPT_NONE : MSR_INTERCEPT_RW);
 
+    /*
+     * Always trap write accesses to VIRT_SPEC_CTRL in order to cache the guest
+     * setting and avoid having to perform a rdmsr on vmexit to get the guest
+     * setting even if VIRT_SSBD is offered to Xen itself.
+     */
+    svm_intercept_msr(v, MSR_VIRT_SPEC_CTRL,
+                      cp->extd.virt_ssbd && cpu_has_virt_ssbd &&
+                      !cpu_has_amd_ssbd ?
+                      MSR_INTERCEPT_WRITE : MSR_INTERCEPT_RW);
+
     /* Give access to MSR_PRED_CMD if the guest has been told about it. */
     svm_intercept_msr(v, MSR_PRED_CMD,
                       cp->extd.ibpb ? MSR_INTERCEPT_NONE : MSR_INTERCEPT_RW);
@@ -3105,6 +3116,30 @@ void svm_vmexit_handler(struct cpu_user_regs *regs)
     vmcb_set_vintr(vmcb, intr);
 }
 
+/* Called with GIF=0. */
+void vmexit_virt_spec_ctrl(void)
+{
+    unsigned int val = opt_ssbd ? SPEC_CTRL_SSBD : 0;
+
+    if ( val == current->arch.msrs->virt_spec_ctrl.raw )
+        return;
+
+    if ( cpu_has_virt_ssbd )
+        wrmsr(MSR_VIRT_SPEC_CTRL, val, 0);
+}
+
+/* Called with GIF=0. */
+void vmentry_virt_spec_ctrl(void)
+{
+    unsigned int val = current->arch.msrs->virt_spec_ctrl.raw;
+
+    if ( val == (opt_ssbd ? SPEC_CTRL_SSBD : 0) )
+        return;
+
+    if ( cpu_has_virt_ssbd )
+        wrmsr(MSR_VIRT_SPEC_CTRL, val, 0);
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/x86/include/asm/cpufeatures.h b/xen/arch/x86/include/asm/cpufeatures.h
index 672c9ee22b..3895de4faf 100644
--- a/xen/arch/x86/include/asm/cpufeatures.h
+++ b/xen/arch/x86/include/asm/cpufeatures.h
@@ -24,7 +24,7 @@ XEN_CPUFEATURE(APERFMPERF,        X86_SYNTH( 8)) /* APERFMPERF */
 XEN_CPUFEATURE(MFENCE_RDTSC,      X86_SYNTH( 9)) /* MFENCE synchronizes RDTSC */
 XEN_CPUFEATURE(XEN_SMEP,          X86_SYNTH(10)) /* SMEP gets used by Xen itself */
 XEN_CPUFEATURE(XEN_SMAP,          X86_SYNTH(11)) /* SMAP gets used by Xen itself */
-/* Bit 12 - unused. */
+XEN_CPUFEATURE(VIRT_SC_MSR_HVM,   X86_SYNTH(12)) /* MSR_VIRT_SPEC_CTRL exposed to HVM */
 XEN_CPUFEATURE(IND_THUNK_LFENCE,  X86_SYNTH(13)) /* Use IND_THUNK_LFENCE */
 XEN_CPUFEATURE(IND_THUNK_JMP,     X86_SYNTH(14)) /* Use IND_THUNK_JMP */
 XEN_CPUFEATURE(SC_NO_BRANCH_HARDEN, X86_SYNTH(15)) /* (Disable) Conditional branch hardening */
diff --git a/xen/arch/x86/include/asm/msr.h b/xen/arch/x86/include/asm/msr.h
index ab6fbb5051..de18e90b2e 100644
--- a/xen/arch/x86/include/asm/msr.h
+++ b/xen/arch/x86/include/asm/msr.h
@@ -375,6 +375,16 @@ struct vcpu_msrs
      */
     uint32_t tsc_aux;
 
+    /*
+     * 0xc001011f - MSR_VIRT_SPEC_CTRL (if !X86_FEATURE_AMD_SSBD)
+     *
+     * AMD only. Guest selected value, context switched on guest VM
+     * entry/exit.
+     */
+    struct {
+        uint32_t raw;
+    } virt_spec_ctrl;
+
     /*
      * 0xc00110{27,19-1b} MSR_AMD64_DR{0-3}_ADDRESS_MASK
      *
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 2ae1fcfd5f..95416995a5 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -393,7 +393,10 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
         if ( !cp->extd.virt_ssbd )
             goto gp_fault;
 
-        *val = msrs->spec_ctrl.raw & SPEC_CTRL_SSBD;
+        if ( cpu_has_amd_ssbd )
+            *val = msrs->spec_ctrl.raw & SPEC_CTRL_SSBD;
+        else
+            *val = msrs->virt_spec_ctrl.raw;
         break;
 
     case MSR_AMD64_DE_CFG:
@@ -686,10 +689,15 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
             goto gp_fault;
 
         /* Only supports SSBD bit, the rest are ignored. */
-        if ( val & SPEC_CTRL_SSBD )
-            msrs->spec_ctrl.raw |= SPEC_CTRL_SSBD;
+        if ( cpu_has_amd_ssbd )
+        {
+            if ( val & SPEC_CTRL_SSBD )
+                msrs->spec_ctrl.raw |= SPEC_CTRL_SSBD;
+            else
+                msrs->spec_ctrl.raw &= ~SPEC_CTRL_SSBD;
+        }
         else
-            msrs->spec_ctrl.raw &= ~SPEC_CTRL_SSBD;
+            msrs->virt_spec_ctrl.raw = val & SPEC_CTRL_SSBD;
         break;
 
     case MSR_AMD64_DE_CFG:
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index 96e7f0983a..ec44205309 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -513,9 +513,12 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
            (boot_cpu_has(X86_FEATURE_SC_MSR_HVM) ||
             boot_cpu_has(X86_FEATURE_SC_RSB_HVM) ||
             boot_cpu_has(X86_FEATURE_IBPB_ENTRY_HVM) ||
+            boot_cpu_has(X86_FEATURE_VIRT_SC_MSR_HVM) ||
             opt_eager_fpu || opt_md_clear_hvm)       ? ""               : " None",
            boot_cpu_has(X86_FEATURE_SC_MSR_HVM)      ? " MSR_SPEC_CTRL" : "",
-           boot_cpu_has(X86_FEATURE_SC_MSR_HVM)      ? " MSR_VIRT_SPEC_CTRL" : "",
+           (boot_cpu_has(X86_FEATURE_SC_MSR_HVM) ||
+            boot_cpu_has(X86_FEATURE_VIRT_SC_MSR_HVM)) ? " MSR_VIRT_SPEC_CTRL"
+                                                       : "",
            boot_cpu_has(X86_FEATURE_SC_RSB_HVM)      ? " RSB"           : "",
            opt_eager_fpu                             ? " EAGER_FPU"     : "",
            opt_md_clear_hvm                          ? " MD_CLEAR"      : "",
@@ -1240,6 +1243,10 @@ void __init init_speculation_mitigations(void)
             setup_force_cpu_cap(X86_FEATURE_SC_MSR_HVM);
     }
 
+    /* Support VIRT_SPEC_CTRL.SSBD if AMD_SSBD is not available. */
+    if ( opt_msr_sc_hvm && !cpu_has_amd_ssbd && cpu_has_virt_ssbd )
+        setup_force_cpu_cap(X86_FEATURE_VIRT_SC_MSR_HVM);
+
     /* Figure out default_xen_spec_ctrl. */
     if ( has_spec_ctrl && ibrs )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 19 19:33:55 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Aug 2022 19:33:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.390434.627857 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oP7kh-0003hD-Mb; Fri, 19 Aug 2022 19:33:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 390434.627857; Fri, 19 Aug 2022 19:33:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oP7kh-0003h6-Jq; Fri, 19 Aug 2022 19:33:55 +0000
Received: by outflank-mailman (input) for mailman id 390434;
 Fri, 19 Aug 2022 19:33:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oP7kg-0003gy-R1
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 19:33:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oP7kg-0007v5-QJ
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 19:33:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oP7kg-0000f1-Oc
 for xen-changelog@lists.xenproject.org; Fri, 19 Aug 2022 19:33:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zyjR+OEIP4561CqeWp2ME7yZ7LpovmH7G1kqVlPbuNA=; b=oXmrQBJ/AziksOBBypskkwwjhH
	KUL4YKMOhSUqGwU7yRvruC0mSgB956afb83JDyBYomXSoUg44iRjfxiLxMBpK2zwonGLjxpGMoM75
	wAZdaqN9QPvzRvwWyi5k93cM2+IT6RiE/oRQdRgqBGA5DUwShyVAaupTNICYZHv3pia8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] amd/msr: implement VIRT_SPEC_CTRL for HVM guests using legacy SSBD
Message-Id: <E1oP7kg-0000f1-Oc@xenbits.xenproject.org>
Date: Fri, 19 Aug 2022 19:33:54 +0000

commit f6cd15188e097de1eb04855eb790a5f51c3ad71a
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Aug 15 09:58:55 2022 +0200
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Fri Aug 19 20:23:43 2022 +0100

    amd/msr: implement VIRT_SPEC_CTRL for HVM guests using legacy SSBD
    
    Expose VIRT_SSBD to guests if the hardware supports setting SSBD in
    the LS_CFG MSR (a.k.a. non-architectural way). Different AMD CPU
    families use different bits in LS_CFG, so exposing VIRT_SPEC_CTRL.SSBD
    allows for an unified way of exposing SSBD support to guests on AMD
    hardware that's compatible migration wise, regardless of what
    underlying mechanism is used to set SSBD.
    
    Note that on AMD Family 17h and Hygon Family 18h processors the value
    of SSBD in LS_CFG is shared between threads on the same core, so
    there's extra logic in order to synchronize the value and have SSBD
    set as long as one of the threads in the core requires it to be set.
    Such logic also requires extra storage for each thread state, which is
    allocated at initialization time.
    
    Do the context switching of the SSBD selection in LS_CFG between
    hypervisor and guest in the same handler that's already used to switch
    the value of VIRT_SPEC_CTRL.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Henry Wang <Henry.Wang@arm.com>
    
    Re-commited with a tag removed.
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
---
 CHANGELOG.md                   |   1 +
 xen/arch/x86/cpu/amd.c         | 121 +++++++++++++++++++++++++++++++++++------
 xen/arch/x86/hvm/svm/svm.c     |   4 ++
 xen/arch/x86/include/asm/amd.h |   4 ++
 xen/arch/x86/spec_ctrl.c       |   4 +-
 5 files changed, 116 insertions(+), 18 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index a87a193e15..5e4bae5f35 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 ### Added / support upgraded
  - IOMMU superpage support on x86, affecting PV guests as well as HVM/PVH ones
    when they don't share page tables with the CPU (HAP / EPT / NPT).
+ - Support VIRT_SSBD feature for HVM guests on AMD.
 
 ### Removed / support downgraded
  - dropped support for the (x86-only) "vesa-mtrr" and "vesa-remap" command line options
diff --git a/xen/arch/x86/cpu/amd.c b/xen/arch/x86/cpu/amd.c
index d5f8e5e899..98c52d0686 100644
--- a/xen/arch/x86/cpu/amd.c
+++ b/xen/arch/x86/cpu/amd.c
@@ -48,6 +48,7 @@ boolean_param("allow_unsafe", opt_allow_unsafe);
 
 /* Signal whether the ACPI C1E quirk is required. */
 bool __read_mostly amd_acpi_c1e_quirk;
+bool __ro_after_init amd_legacy_ssbd;
 
 static inline int rdmsr_amd_safe(unsigned int msr, unsigned int *lo,
 				 unsigned int *hi)
@@ -685,23 +686,10 @@ void amd_init_lfence(struct cpuinfo_x86 *c)
  * Refer to the AMD Speculative Store Bypass whitepaper:
  * https://developer.amd.com/wp-content/resources/124441_AMD64_SpeculativeStoreBypassDisable_Whitepaper_final.pdf
  */
-void amd_init_ssbd(const struct cpuinfo_x86 *c)
+static bool set_legacy_ssbd(const struct cpuinfo_x86 *c, bool enable)
 {
 	int bit = -1;
 
-	if (cpu_has_ssb_no)
-		return;
-
-	if (cpu_has_amd_ssbd) {
-		/* Handled by common MSR_SPEC_CTRL logic */
-		return;
-	}
-
-	if (cpu_has_virt_ssbd) {
-		wrmsrl(MSR_VIRT_SPEC_CTRL, opt_ssbd ? SPEC_CTRL_SSBD : 0);
-		return;
-	}
-
 	switch (c->x86) {
 	case 0x15: bit = 54; break;
 	case 0x16: bit = 33; break;
@@ -715,20 +703,119 @@ void amd_init_ssbd(const struct cpuinfo_x86 *c)
 		if (rdmsr_safe(MSR_AMD64_LS_CFG, val) ||
 		    ({
 			    val &= ~mask;
-			    if (opt_ssbd)
+			    if (enable)
 				    val |= mask;
 			    false;
 		    }) ||
 		    wrmsr_safe(MSR_AMD64_LS_CFG, val) ||
 		    ({
 			    rdmsrl(MSR_AMD64_LS_CFG, val);
-			    (val & mask) != (opt_ssbd * mask);
+			    (val & mask) != (enable * mask);
 		    }))
 			bit = -1;
 	}
 
-	if (bit < 0)
+	return bit >= 0;
+}
+
+void amd_init_ssbd(const struct cpuinfo_x86 *c)
+{
+	if (cpu_has_ssb_no)
+		return;
+
+	if (cpu_has_amd_ssbd) {
+		/* Handled by common MSR_SPEC_CTRL logic */
+		return;
+	}
+
+	if (cpu_has_virt_ssbd) {
+		wrmsrl(MSR_VIRT_SPEC_CTRL, opt_ssbd ? SPEC_CTRL_SSBD : 0);
+		return;
+	}
+
+	if (!set_legacy_ssbd(c, opt_ssbd)) {
 		printk_once(XENLOG_ERR "No SSBD controls available\n");
+		if (amd_legacy_ssbd)
+			panic("CPU feature mismatch: no legacy SSBD\n");
+	} else if (c == &boot_cpu_data)
+		amd_legacy_ssbd = true;
+}
+
+static struct ssbd_ls_cfg {
+    bool locked;
+    unsigned int count;
+} __cacheline_aligned *ssbd_ls_cfg;
+static unsigned int __ro_after_init ssbd_max_cores;
+#define AMD_FAM17H_MAX_SOCKETS 2
+
+bool __init amd_setup_legacy_ssbd(void)
+{
+	unsigned int i;
+
+	if ((boot_cpu_data.x86 != 0x17 && boot_cpu_data.x86 != 0x18) ||
+	    boot_cpu_data.x86_num_siblings <= 1)
+		return true;
+
+	/*
+	 * One could be forgiven for thinking that c->x86_max_cores is the
+	 * correct value to use here.
+	 *
+	 * However, that value is derived from the current configuration, and
+	 * c->cpu_core_id is sparse on all but the top end CPUs.  Derive
+	 * max_cpus from ApicIdCoreIdSize which will cover any sparseness.
+	 */
+	if (boot_cpu_data.extended_cpuid_level >= 0x80000008) {
+		ssbd_max_cores = 1u << MASK_EXTR(cpuid_ecx(0x80000008), 0xf000);
+		ssbd_max_cores /= boot_cpu_data.x86_num_siblings;
+	}
+	if (!ssbd_max_cores)
+		return false;
+
+	ssbd_ls_cfg = xzalloc_array(struct ssbd_ls_cfg,
+	                            ssbd_max_cores * AMD_FAM17H_MAX_SOCKETS);
+	if (!ssbd_ls_cfg)
+		return false;
+
+	if (opt_ssbd)
+		for (i = 0; i < ssbd_max_cores * AMD_FAM17H_MAX_SOCKETS; i++)
+			/* Set initial state, applies to any (hotplug) CPU. */
+			ssbd_ls_cfg[i].count = boot_cpu_data.x86_num_siblings;
+
+	return true;
+}
+
+/*
+ * Executed from GIF==0 context: avoid using BUG/ASSERT or other functionality
+ * that relies on exceptions as those are not expected to run in GIF==0
+ * context.
+ */
+void amd_set_legacy_ssbd(bool enable)
+{
+	const struct cpuinfo_x86 *c = &current_cpu_data;
+	struct ssbd_ls_cfg *status;
+
+	if ((c->x86 != 0x17 && c->x86 != 0x18) || c->x86_num_siblings <= 1) {
+		set_legacy_ssbd(c, enable);
+		return;
+	}
+
+	status = &ssbd_ls_cfg[c->phys_proc_id * ssbd_max_cores +
+	                      c->cpu_core_id];
+
+	/*
+	 * Open code a very simple spinlock: this function is used with GIF==0
+	 * and different IF values, so would trigger the checklock detector.
+	 * Instead of trying to workaround the detector, use a very simple lock
+	 * implementation: it's better to reduce the amount of code executed
+	 * with GIF==0.
+	 */
+	while (test_and_set_bool(status->locked))
+		cpu_relax();
+	status->count += enable ? 1 : -1;
+	if (enable ? status->count == 1 : !status->count)
+		set_legacy_ssbd(c, enable);
+	barrier();
+	write_atomic(&status->locked, false);
 }
 
 /*
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 53ce2edd35..1aeaabcb13 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -3126,6 +3126,8 @@ void vmexit_virt_spec_ctrl(void)
 
     if ( cpu_has_virt_ssbd )
         wrmsr(MSR_VIRT_SPEC_CTRL, val, 0);
+    else
+        amd_set_legacy_ssbd(val);
 }
 
 /* Called with GIF=0. */
@@ -3138,6 +3140,8 @@ void vmentry_virt_spec_ctrl(void)
 
     if ( cpu_has_virt_ssbd )
         wrmsr(MSR_VIRT_SPEC_CTRL, val, 0);
+    else
+        amd_set_legacy_ssbd(val);
 }
 
 /*
diff --git a/xen/arch/x86/include/asm/amd.h b/xen/arch/x86/include/asm/amd.h
index a82382e6bf..6a42f68542 100644
--- a/xen/arch/x86/include/asm/amd.h
+++ b/xen/arch/x86/include/asm/amd.h
@@ -151,4 +151,8 @@ void check_enable_amd_mmconf_dmi(void);
 extern bool amd_acpi_c1e_quirk;
 void amd_check_disable_c1e(unsigned int port, u8 value);
 
+extern bool amd_legacy_ssbd;
+bool amd_setup_legacy_ssbd(void);
+void amd_set_legacy_ssbd(bool enable);
+
 #endif /* __AMD_H__ */
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index ec44205309..4e53056624 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -22,6 +22,7 @@
 #include <xen/param.h>
 #include <xen/warning.h>
 
+#include <asm/amd.h>
 #include <asm/hvm/svm/svm.h>
 #include <asm/microcode.h>
 #include <asm/msr.h>
@@ -1244,7 +1245,8 @@ void __init init_speculation_mitigations(void)
     }
 
     /* Support VIRT_SPEC_CTRL.SSBD if AMD_SSBD is not available. */
-    if ( opt_msr_sc_hvm && !cpu_has_amd_ssbd && cpu_has_virt_ssbd )
+    if ( opt_msr_sc_hvm && !cpu_has_amd_ssbd &&
+         (cpu_has_virt_ssbd || (amd_legacy_ssbd && amd_setup_legacy_ssbd())) )
         setup_force_cpu_cap(X86_FEATURE_VIRT_SC_MSR_HVM);
 
     /* Figure out default_xen_spec_ctrl. */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sat Aug 20 03:33:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 20 Aug 2022 03:33:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.390636.628121 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oPFEN-0002wQ-2F; Sat, 20 Aug 2022 03:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 390636.628121; Sat, 20 Aug 2022 03:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oPFEM-0002wG-VK; Sat, 20 Aug 2022 03:33:02 +0000
Received: by outflank-mailman (input) for mailman id 390636;
 Sat, 20 Aug 2022 03:33:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oPFEL-0002wA-Ry
 for xen-changelog@lists.xenproject.org; Sat, 20 Aug 2022 03:33:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oPFEL-0007Ez-Or
 for xen-changelog@lists.xenproject.org; Sat, 20 Aug 2022 03:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oPFEL-0005KC-Nq
 for xen-changelog@lists.xenproject.org; Sat, 20 Aug 2022 03:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=LXIz+ke1sGlWD/qvmzwssNgG4Dc2F5EOkg5q3mUm2Iw=; b=MwxFPEb0kXwxYRr3IdKh/q96cK
	0mXDK2Zis30wuhQSHREXFuIHNuf4e+Zte2i3fKMBMP/pIdbJaL+JaYfyslHzp6Rc3fI97MVJx7FCd
	f6XfTT7sOpcdCvXbV0J522NLLKrbON09H+KwjNXDwBy0styzTuWk7d22wtlpoYgXb4HM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] console/client: properly use time_t in get_pty_fd()
Message-Id: <E1oPFEL-0005KC-Nq@xenbits.xenproject.org>
Date: Sat, 20 Aug 2022 03:33:01 +0000

commit 2891f116e798a20ad35ab10e5a3c7f0c51156d81
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Aug 19 09:58:14 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Aug 19 09:58:14 2022 +0200

    console/client: properly use time_t in get_pty_fd()
    
    "int" is not a suitable type to hold time()'s return value.
    
    Coverity ID: 1509376
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/console/client/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/console/client/main.c b/tools/console/client/main.c
index ada6728caa..1a6fa162f7 100644
--- a/tools/console/client/main.c
+++ b/tools/console/client/main.c
@@ -102,7 +102,7 @@ static int get_pty_fd(struct xs_handle *xs, char *path, int seconds)
 	struct timeval tv;
 	fd_set watch_fdset;
 	int xs_fd = xs_fileno(xs), pty_fd = -1;
-	int start, now;
+	time_t start, now;
 	unsigned int len = 0;
 	char *pty_path, **watch_paths;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 20 03:33:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 20 Aug 2022 03:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.390637.628124 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oPFEX-0002zs-3H; Sat, 20 Aug 2022 03:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 390637.628124; Sat, 20 Aug 2022 03:33:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oPFEX-0002zl-0Y; Sat, 20 Aug 2022 03:33:13 +0000
Received: by outflank-mailman (input) for mailman id 390637;
 Sat, 20 Aug 2022 03:33:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oPFEV-0002zb-Sq
 for xen-changelog@lists.xenproject.org; Sat, 20 Aug 2022 03:33:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oPFEV-0007F3-S8
 for xen-changelog@lists.xenproject.org; Sat, 20 Aug 2022 03:33:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oPFEV-0005Kf-RA
 for xen-changelog@lists.xenproject.org; Sat, 20 Aug 2022 03:33:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nMLDtP22UfBrUH7HYUgK4Fq0VN6FSmV3qYimkq9fvSo=; b=Umw8ONdZSyXi0LLSta0/cCXixt
	cnzW7FO9SEj4T+8l/nMRec8DuK3GxNFNTZ++M12C/BGVfnunAn1Bt/eS5OB+k5RVVk7A72waPbAXf
	ThdGTgN0lLWZpR04n1Wgx3ofPi5BSALNDmCAfjr2Nt6siwoC14mbX0bcIjYXqJvDTzcA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libxl: use time_t for qmp_synchronous_send()'s last parameter
Message-Id: <E1oPFEV-0005Kf-RA@xenbits.xenproject.org>
Date: Sat, 20 Aug 2022 03:33:11 +0000

commit 6c0a14d324fc9f6b603e4dfbf90c5fd74227edf3
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Aug 19 09:58:34 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Aug 19 09:58:34 2022 +0200

    libxl: use time_t for qmp_synchronous_send()'s last parameter
    
    "int" is not a suitable type to hold / receive "time_t" values.
    
    The parameter is presently unused, so no functional change.
    
    Coverity ID: 1509377
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Acked-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/libs/light/libxl_qmp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libs/light/libxl_qmp.c b/tools/libs/light/libxl_qmp.c
index 6b0cd607d8..84740bd4b3 100644
--- a/tools/libs/light/libxl_qmp.c
+++ b/tools/libs/light/libxl_qmp.c
@@ -582,7 +582,7 @@ out:
 static int qmp_synchronous_send(libxl__qmp_handler *qmp, const char *cmd,
                                 libxl__json_object *args,
                                 qmp_callback_t callback, void *opaque,
-                                int ask_timeout)
+                                time_t ask_timeout)
 {
     int id = 0;
     int ret = 0;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 20 16:00:10 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 20 Aug 2022 16:00:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.390823.628402 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oPQtH-0003ck-9o; Sat, 20 Aug 2022 16:00:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 390823.628402; Sat, 20 Aug 2022 16:00:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oPQtH-0003c3-6Q; Sat, 20 Aug 2022 16:00:03 +0000
Received: by outflank-mailman (input) for mailman id 390823;
 Sat, 20 Aug 2022 16:00:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oPQtG-00031I-2U
 for xen-changelog@lists.xenproject.org; Sat, 20 Aug 2022 16:00:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oPQtF-0004Vc-R0
 for xen-changelog@lists.xenproject.org; Sat, 20 Aug 2022 16:00:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oPQtF-0005vc-Py
 for xen-changelog@lists.xenproject.org; Sat, 20 Aug 2022 16:00:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=EgYfLLpU+ghz4YRRH8KqUsoycWnTZV9heaFBvx8XEEw=; b=OwzBX3qLp4Cn4Y46qy0Xku6+CL
	HyePAyXs7x8a+u1yTXzyOnMFZRlzD/buvBWXt3ctcaPOskxzuG9Wu/3Jyc2EM0rxe+yxbBPBpkgnb
	gdKdD/gw1aaE4acAlOT25jHs9reachoHPasvsk9Q4YJ827txhH0fmWXiv1dXse6ivpUA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Temporarily revert "amd/msr: implement VIRT_SPEC_CTRL for HVM guests using legacy SSBD"
Message-Id: <E1oPQtF-0005vc-Py@xenbits.xenproject.org>
Date: Sat, 20 Aug 2022 16:00:01 +0000

commit c254f3b45c7fc8b050a6b6290d9bd7203417b994
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Fri Aug 19 20:15:22 2022 +0100
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Fri Aug 19 20:15:22 2022 +0100

    Temporarily revert "amd/msr: implement VIRT_SPEC_CTRL for HVM guests using legacy SSBD"
    
    A person tagged in commit 646589ac148a2ff6bb222a6081b4d7b13ee468c0
    claims the tag is in accurate; revert this commit so that we can
    re-commit it again with the tag corrected.
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
---
 CHANGELOG.md                   |   1 -
 xen/arch/x86/cpu/amd.c         | 121 ++++++-----------------------------------
 xen/arch/x86/hvm/svm/svm.c     |   4 --
 xen/arch/x86/include/asm/amd.h |   4 --
 xen/arch/x86/spec_ctrl.c       |   4 +-
 5 files changed, 18 insertions(+), 116 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5e4bae5f35..a87a193e15 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,7 +13,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 ### Added / support upgraded
  - IOMMU superpage support on x86, affecting PV guests as well as HVM/PVH ones
    when they don't share page tables with the CPU (HAP / EPT / NPT).
- - Support VIRT_SSBD feature for HVM guests on AMD.
 
 ### Removed / support downgraded
  - dropped support for the (x86-only) "vesa-mtrr" and "vesa-remap" command line options
diff --git a/xen/arch/x86/cpu/amd.c b/xen/arch/x86/cpu/amd.c
index 98c52d0686..d5f8e5e899 100644
--- a/xen/arch/x86/cpu/amd.c
+++ b/xen/arch/x86/cpu/amd.c
@@ -48,7 +48,6 @@ boolean_param("allow_unsafe", opt_allow_unsafe);
 
 /* Signal whether the ACPI C1E quirk is required. */
 bool __read_mostly amd_acpi_c1e_quirk;
-bool __ro_after_init amd_legacy_ssbd;
 
 static inline int rdmsr_amd_safe(unsigned int msr, unsigned int *lo,
 				 unsigned int *hi)
@@ -686,10 +685,23 @@ void amd_init_lfence(struct cpuinfo_x86 *c)
  * Refer to the AMD Speculative Store Bypass whitepaper:
  * https://developer.amd.com/wp-content/resources/124441_AMD64_SpeculativeStoreBypassDisable_Whitepaper_final.pdf
  */
-static bool set_legacy_ssbd(const struct cpuinfo_x86 *c, bool enable)
+void amd_init_ssbd(const struct cpuinfo_x86 *c)
 {
 	int bit = -1;
 
+	if (cpu_has_ssb_no)
+		return;
+
+	if (cpu_has_amd_ssbd) {
+		/* Handled by common MSR_SPEC_CTRL logic */
+		return;
+	}
+
+	if (cpu_has_virt_ssbd) {
+		wrmsrl(MSR_VIRT_SPEC_CTRL, opt_ssbd ? SPEC_CTRL_SSBD : 0);
+		return;
+	}
+
 	switch (c->x86) {
 	case 0x15: bit = 54; break;
 	case 0x16: bit = 33; break;
@@ -703,119 +715,20 @@ static bool set_legacy_ssbd(const struct cpuinfo_x86 *c, bool enable)
 		if (rdmsr_safe(MSR_AMD64_LS_CFG, val) ||
 		    ({
 			    val &= ~mask;
-			    if (enable)
+			    if (opt_ssbd)
 				    val |= mask;
 			    false;
 		    }) ||
 		    wrmsr_safe(MSR_AMD64_LS_CFG, val) ||
 		    ({
 			    rdmsrl(MSR_AMD64_LS_CFG, val);
-			    (val & mask) != (enable * mask);
+			    (val & mask) != (opt_ssbd * mask);
 		    }))
 			bit = -1;
 	}
 
-	return bit >= 0;
-}
-
-void amd_init_ssbd(const struct cpuinfo_x86 *c)
-{
-	if (cpu_has_ssb_no)
-		return;
-
-	if (cpu_has_amd_ssbd) {
-		/* Handled by common MSR_SPEC_CTRL logic */
-		return;
-	}
-
-	if (cpu_has_virt_ssbd) {
-		wrmsrl(MSR_VIRT_SPEC_CTRL, opt_ssbd ? SPEC_CTRL_SSBD : 0);
-		return;
-	}
-
-	if (!set_legacy_ssbd(c, opt_ssbd)) {
+	if (bit < 0)
 		printk_once(XENLOG_ERR "No SSBD controls available\n");
-		if (amd_legacy_ssbd)
-			panic("CPU feature mismatch: no legacy SSBD\n");
-	} else if (c == &boot_cpu_data)
-		amd_legacy_ssbd = true;
-}
-
-static struct ssbd_ls_cfg {
-    bool locked;
-    unsigned int count;
-} __cacheline_aligned *ssbd_ls_cfg;
-static unsigned int __ro_after_init ssbd_max_cores;
-#define AMD_FAM17H_MAX_SOCKETS 2
-
-bool __init amd_setup_legacy_ssbd(void)
-{
-	unsigned int i;
-
-	if ((boot_cpu_data.x86 != 0x17 && boot_cpu_data.x86 != 0x18) ||
-	    boot_cpu_data.x86_num_siblings <= 1)
-		return true;
-
-	/*
-	 * One could be forgiven for thinking that c->x86_max_cores is the
-	 * correct value to use here.
-	 *
-	 * However, that value is derived from the current configuration, and
-	 * c->cpu_core_id is sparse on all but the top end CPUs.  Derive
-	 * max_cpus from ApicIdCoreIdSize which will cover any sparseness.
-	 */
-	if (boot_cpu_data.extended_cpuid_level >= 0x80000008) {
-		ssbd_max_cores = 1u << MASK_EXTR(cpuid_ecx(0x80000008), 0xf000);
-		ssbd_max_cores /= boot_cpu_data.x86_num_siblings;
-	}
-	if (!ssbd_max_cores)
-		return false;
-
-	ssbd_ls_cfg = xzalloc_array(struct ssbd_ls_cfg,
-	                            ssbd_max_cores * AMD_FAM17H_MAX_SOCKETS);
-	if (!ssbd_ls_cfg)
-		return false;
-
-	if (opt_ssbd)
-		for (i = 0; i < ssbd_max_cores * AMD_FAM17H_MAX_SOCKETS; i++)
-			/* Set initial state, applies to any (hotplug) CPU. */
-			ssbd_ls_cfg[i].count = boot_cpu_data.x86_num_siblings;
-
-	return true;
-}
-
-/*
- * Executed from GIF==0 context: avoid using BUG/ASSERT or other functionality
- * that relies on exceptions as those are not expected to run in GIF==0
- * context.
- */
-void amd_set_legacy_ssbd(bool enable)
-{
-	const struct cpuinfo_x86 *c = &current_cpu_data;
-	struct ssbd_ls_cfg *status;
-
-	if ((c->x86 != 0x17 && c->x86 != 0x18) || c->x86_num_siblings <= 1) {
-		set_legacy_ssbd(c, enable);
-		return;
-	}
-
-	status = &ssbd_ls_cfg[c->phys_proc_id * ssbd_max_cores +
-	                      c->cpu_core_id];
-
-	/*
-	 * Open code a very simple spinlock: this function is used with GIF==0
-	 * and different IF values, so would trigger the checklock detector.
-	 * Instead of trying to workaround the detector, use a very simple lock
-	 * implementation: it's better to reduce the amount of code executed
-	 * with GIF==0.
-	 */
-	while (test_and_set_bool(status->locked))
-		cpu_relax();
-	status->count += enable ? 1 : -1;
-	if (enable ? status->count == 1 : !status->count)
-		set_legacy_ssbd(c, enable);
-	barrier();
-	write_atomic(&status->locked, false);
 }
 
 /*
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 1aeaabcb13..53ce2edd35 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -3126,8 +3126,6 @@ void vmexit_virt_spec_ctrl(void)
 
     if ( cpu_has_virt_ssbd )
         wrmsr(MSR_VIRT_SPEC_CTRL, val, 0);
-    else
-        amd_set_legacy_ssbd(val);
 }
 
 /* Called with GIF=0. */
@@ -3140,8 +3138,6 @@ void vmentry_virt_spec_ctrl(void)
 
     if ( cpu_has_virt_ssbd )
         wrmsr(MSR_VIRT_SPEC_CTRL, val, 0);
-    else
-        amd_set_legacy_ssbd(val);
 }
 
 /*
diff --git a/xen/arch/x86/include/asm/amd.h b/xen/arch/x86/include/asm/amd.h
index 6a42f68542..a82382e6bf 100644
--- a/xen/arch/x86/include/asm/amd.h
+++ b/xen/arch/x86/include/asm/amd.h
@@ -151,8 +151,4 @@ void check_enable_amd_mmconf_dmi(void);
 extern bool amd_acpi_c1e_quirk;
 void amd_check_disable_c1e(unsigned int port, u8 value);
 
-extern bool amd_legacy_ssbd;
-bool amd_setup_legacy_ssbd(void);
-void amd_set_legacy_ssbd(bool enable);
-
 #endif /* __AMD_H__ */
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index 4e53056624..ec44205309 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -22,7 +22,6 @@
 #include <xen/param.h>
 #include <xen/warning.h>
 
-#include <asm/amd.h>
 #include <asm/hvm/svm/svm.h>
 #include <asm/microcode.h>
 #include <asm/msr.h>
@@ -1245,8 +1244,7 @@ void __init init_speculation_mitigations(void)
     }
 
     /* Support VIRT_SPEC_CTRL.SSBD if AMD_SSBD is not available. */
-    if ( opt_msr_sc_hvm && !cpu_has_amd_ssbd &&
-         (cpu_has_virt_ssbd || (amd_legacy_ssbd && amd_setup_legacy_ssbd())) )
+    if ( opt_msr_sc_hvm && !cpu_has_amd_ssbd && cpu_has_virt_ssbd )
         setup_force_cpu_cap(X86_FEATURE_VIRT_SC_MSR_HVM);
 
     /* Figure out default_xen_spec_ctrl. */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 20 16:00:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 20 Aug 2022 16:00:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.390824.628406 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oPQtR-0004Br-B5; Sat, 20 Aug 2022 16:00:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 390824.628406; Sat, 20 Aug 2022 16: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 1oPQtR-0004Bj-88; Sat, 20 Aug 2022 16:00:13 +0000
Received: by outflank-mailman (input) for mailman id 390824;
 Sat, 20 Aug 2022 16:00:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oPQtQ-0004BX-04
 for xen-changelog@lists.xenproject.org; Sat, 20 Aug 2022 16:00:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oPQtP-0004oy-VT
 for xen-changelog@lists.xenproject.org; Sat, 20 Aug 2022 16:00:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oPQtP-0005x1-Tg
 for xen-changelog@lists.xenproject.org; Sat, 20 Aug 2022 16:00:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZXUYvD+oh5BnUxtq0mhvvUCZt/fcHXjsEvq3mQeMJcQ=; b=SgNvwLGyGxRaFzYQtoGVDRKFMZ
	LalYSlg49s6D3WMNYN+zfWmRU1rKErSMCII4oCjvEhw+xf7HT+SPnubQ6ImHfmvB0jCwJGxWj1FmD
	QWzJJTjCUjasUwRLlC1CdlIMWY3ZZZXDPyjyPxyPjy6rWRx5wQhIdrlwK8WhV2nCA9i0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Temporarily revert "amd/msr: allow passthrough of VIRT_SPEC_CTRL for HVM guests"
Message-Id: <E1oPQtP-0005x1-Tg@xenbits.xenproject.org>
Date: Sat, 20 Aug 2022 16:00:11 +0000

commit bc7f400b968fa3f660c26bdc53f5efa394bbfcd1
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Fri Aug 19 20:17:30 2022 +0100
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Fri Aug 19 20:21:57 2022 +0100

    Temporarily revert "amd/msr: allow passthrough of VIRT_SPEC_CTRL for HVM guests"
    
    A person tagged in commit a2eeaa6906101fbf322766f37f8f061dd36fe58d
    claims the tag is in accurate; revert this commit so that we can
    re-commit it again with the tag corrected.
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
---
 xen/arch/x86/cpuid.c                   | 14 --------------
 xen/arch/x86/hvm/svm/entry.S           |  8 --------
 xen/arch/x86/hvm/svm/svm.c             | 35 ----------------------------------
 xen/arch/x86/include/asm/cpufeatures.h |  2 +-
 xen/arch/x86/include/asm/msr.h         | 10 ----------
 xen/arch/x86/msr.c                     | 16 ++++------------
 xen/arch/x86/spec_ctrl.c               |  9 +--------
 7 files changed, 6 insertions(+), 88 deletions(-)

diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index a4a366ad84..979dcf8164 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -541,13 +541,6 @@ static void __init calculate_hvm_max_policy(void)
          raw_cpuid_policy.basic.sep )
         __set_bit(X86_FEATURE_SEP, hvm_featureset);
 
-    /*
-     * VIRT_SSBD is exposed in the default policy as a result of
-     * VIRT_SC_MSR_HVM being set, it also needs exposing in the max policy.
-     */
-    if ( boot_cpu_has(X86_FEATURE_VIRT_SC_MSR_HVM) )
-        __set_bit(X86_FEATURE_VIRT_SSBD, hvm_featureset);
-
     /*
      * If Xen isn't virtualising MSR_SPEC_CTRL for HVM guests (functional
      * availability, or admin choice), hide the feature.
@@ -604,13 +597,6 @@ static void __init calculate_hvm_def_policy(void)
     guest_common_feature_adjustments(hvm_featureset);
     guest_common_default_feature_adjustments(hvm_featureset);
 
-    /*
-     * Only expose VIRT_SSBD if AMD_SSBD is not available, and thus
-     * VIRT_SC_MSR_HVM is set.
-     */
-    if ( boot_cpu_has(X86_FEATURE_VIRT_SC_MSR_HVM) )
-        __set_bit(X86_FEATURE_VIRT_SSBD, hvm_featureset);
-
     sanitise_featureset(hvm_featureset);
     cpuid_featureset_to_policy(hvm_featureset, p);
     recalculate_xstate(p);
diff --git a/xen/arch/x86/hvm/svm/entry.S b/xen/arch/x86/hvm/svm/entry.S
index a26589aa9a..a60d759f71 100644
--- a/xen/arch/x86/hvm/svm/entry.S
+++ b/xen/arch/x86/hvm/svm/entry.S
@@ -19,8 +19,6 @@
 
         .file "svm/entry.S"
 
-#include <xen/lib.h>
-
 #include <asm/asm_defns.h>
 #include <asm/page.h>
 
@@ -59,9 +57,6 @@ __UNLIKELY_END(nsvm_hap)
 
         clgi
 
-        ALTERNATIVE "", STR(call vmentry_virt_spec_ctrl), \
-                        X86_FEATURE_VIRT_SC_MSR_HVM
-
         /* WARNING! `ret`, `call *`, `jmp *` not safe beyond this point. */
         /* SPEC_CTRL_EXIT_TO_SVM       Req: b=curr %rsp=regs/cpuinfo, Clob: acd */
         .macro svm_vmentry_spec_ctrl
@@ -131,9 +126,6 @@ __UNLIKELY_END(nsvm_hap)
         ALTERNATIVE "", svm_vmexit_spec_ctrl, X86_FEATURE_SC_MSR_HVM
         /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */
 
-        ALTERNATIVE "", STR(call vmexit_virt_spec_ctrl), \
-                        X86_FEATURE_VIRT_SC_MSR_HVM
-
         /*
          * STGI is executed unconditionally, and is sufficiently serialising
          * to safely resolve any Spectre-v1 concerns in the above logic.
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 53ce2edd35..0849a9dc5f 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -52,7 +52,6 @@
 #include <asm/hvm/svm/svmdebug.h>
 #include <asm/hvm/svm/nestedsvm.h>
 #include <asm/hvm/nestedhvm.h>
-#include <asm/spec_ctrl.h>
 #include <asm/x86_emulate.h>
 #include <public/sched.h>
 #include <asm/hvm/vpt.h>
@@ -611,16 +610,6 @@ static void cf_check svm_cpuid_policy_changed(struct vcpu *v)
     svm_intercept_msr(v, MSR_SPEC_CTRL,
                       cp->extd.ibrs ? MSR_INTERCEPT_NONE : MSR_INTERCEPT_RW);
 
-    /*
-     * Always trap write accesses to VIRT_SPEC_CTRL in order to cache the guest
-     * setting and avoid having to perform a rdmsr on vmexit to get the guest
-     * setting even if VIRT_SSBD is offered to Xen itself.
-     */
-    svm_intercept_msr(v, MSR_VIRT_SPEC_CTRL,
-                      cp->extd.virt_ssbd && cpu_has_virt_ssbd &&
-                      !cpu_has_amd_ssbd ?
-                      MSR_INTERCEPT_WRITE : MSR_INTERCEPT_RW);
-
     /* Give access to MSR_PRED_CMD if the guest has been told about it. */
     svm_intercept_msr(v, MSR_PRED_CMD,
                       cp->extd.ibpb ? MSR_INTERCEPT_NONE : MSR_INTERCEPT_RW);
@@ -3116,30 +3105,6 @@ void svm_vmexit_handler(struct cpu_user_regs *regs)
     vmcb_set_vintr(vmcb, intr);
 }
 
-/* Called with GIF=0. */
-void vmexit_virt_spec_ctrl(void)
-{
-    unsigned int val = opt_ssbd ? SPEC_CTRL_SSBD : 0;
-
-    if ( val == current->arch.msrs->virt_spec_ctrl.raw )
-        return;
-
-    if ( cpu_has_virt_ssbd )
-        wrmsr(MSR_VIRT_SPEC_CTRL, val, 0);
-}
-
-/* Called with GIF=0. */
-void vmentry_virt_spec_ctrl(void)
-{
-    unsigned int val = current->arch.msrs->virt_spec_ctrl.raw;
-
-    if ( val == (opt_ssbd ? SPEC_CTRL_SSBD : 0) )
-        return;
-
-    if ( cpu_has_virt_ssbd )
-        wrmsr(MSR_VIRT_SPEC_CTRL, val, 0);
-}
-
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/x86/include/asm/cpufeatures.h b/xen/arch/x86/include/asm/cpufeatures.h
index 3895de4faf..672c9ee22b 100644
--- a/xen/arch/x86/include/asm/cpufeatures.h
+++ b/xen/arch/x86/include/asm/cpufeatures.h
@@ -24,7 +24,7 @@ XEN_CPUFEATURE(APERFMPERF,        X86_SYNTH( 8)) /* APERFMPERF */
 XEN_CPUFEATURE(MFENCE_RDTSC,      X86_SYNTH( 9)) /* MFENCE synchronizes RDTSC */
 XEN_CPUFEATURE(XEN_SMEP,          X86_SYNTH(10)) /* SMEP gets used by Xen itself */
 XEN_CPUFEATURE(XEN_SMAP,          X86_SYNTH(11)) /* SMAP gets used by Xen itself */
-XEN_CPUFEATURE(VIRT_SC_MSR_HVM,   X86_SYNTH(12)) /* MSR_VIRT_SPEC_CTRL exposed to HVM */
+/* Bit 12 - unused. */
 XEN_CPUFEATURE(IND_THUNK_LFENCE,  X86_SYNTH(13)) /* Use IND_THUNK_LFENCE */
 XEN_CPUFEATURE(IND_THUNK_JMP,     X86_SYNTH(14)) /* Use IND_THUNK_JMP */
 XEN_CPUFEATURE(SC_NO_BRANCH_HARDEN, X86_SYNTH(15)) /* (Disable) Conditional branch hardening */
diff --git a/xen/arch/x86/include/asm/msr.h b/xen/arch/x86/include/asm/msr.h
index de18e90b2e..ab6fbb5051 100644
--- a/xen/arch/x86/include/asm/msr.h
+++ b/xen/arch/x86/include/asm/msr.h
@@ -375,16 +375,6 @@ struct vcpu_msrs
      */
     uint32_t tsc_aux;
 
-    /*
-     * 0xc001011f - MSR_VIRT_SPEC_CTRL (if !X86_FEATURE_AMD_SSBD)
-     *
-     * AMD only. Guest selected value, context switched on guest VM
-     * entry/exit.
-     */
-    struct {
-        uint32_t raw;
-    } virt_spec_ctrl;
-
     /*
      * 0xc00110{27,19-1b} MSR_AMD64_DR{0-3}_ADDRESS_MASK
      *
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 95416995a5..2ae1fcfd5f 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -393,10 +393,7 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
         if ( !cp->extd.virt_ssbd )
             goto gp_fault;
 
-        if ( cpu_has_amd_ssbd )
-            *val = msrs->spec_ctrl.raw & SPEC_CTRL_SSBD;
-        else
-            *val = msrs->virt_spec_ctrl.raw;
+        *val = msrs->spec_ctrl.raw & SPEC_CTRL_SSBD;
         break;
 
     case MSR_AMD64_DE_CFG:
@@ -689,15 +686,10 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
             goto gp_fault;
 
         /* Only supports SSBD bit, the rest are ignored. */
-        if ( cpu_has_amd_ssbd )
-        {
-            if ( val & SPEC_CTRL_SSBD )
-                msrs->spec_ctrl.raw |= SPEC_CTRL_SSBD;
-            else
-                msrs->spec_ctrl.raw &= ~SPEC_CTRL_SSBD;
-        }
+        if ( val & SPEC_CTRL_SSBD )
+            msrs->spec_ctrl.raw |= SPEC_CTRL_SSBD;
         else
-            msrs->virt_spec_ctrl.raw = val & SPEC_CTRL_SSBD;
+            msrs->spec_ctrl.raw &= ~SPEC_CTRL_SSBD;
         break;
 
     case MSR_AMD64_DE_CFG:
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index ec44205309..96e7f0983a 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -513,12 +513,9 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
            (boot_cpu_has(X86_FEATURE_SC_MSR_HVM) ||
             boot_cpu_has(X86_FEATURE_SC_RSB_HVM) ||
             boot_cpu_has(X86_FEATURE_IBPB_ENTRY_HVM) ||
-            boot_cpu_has(X86_FEATURE_VIRT_SC_MSR_HVM) ||
             opt_eager_fpu || opt_md_clear_hvm)       ? ""               : " None",
            boot_cpu_has(X86_FEATURE_SC_MSR_HVM)      ? " MSR_SPEC_CTRL" : "",
-           (boot_cpu_has(X86_FEATURE_SC_MSR_HVM) ||
-            boot_cpu_has(X86_FEATURE_VIRT_SC_MSR_HVM)) ? " MSR_VIRT_SPEC_CTRL"
-                                                       : "",
+           boot_cpu_has(X86_FEATURE_SC_MSR_HVM)      ? " MSR_VIRT_SPEC_CTRL" : "",
            boot_cpu_has(X86_FEATURE_SC_RSB_HVM)      ? " RSB"           : "",
            opt_eager_fpu                             ? " EAGER_FPU"     : "",
            opt_md_clear_hvm                          ? " MD_CLEAR"      : "",
@@ -1243,10 +1240,6 @@ void __init init_speculation_mitigations(void)
             setup_force_cpu_cap(X86_FEATURE_SC_MSR_HVM);
     }
 
-    /* Support VIRT_SPEC_CTRL.SSBD if AMD_SSBD is not available. */
-    if ( opt_msr_sc_hvm && !cpu_has_amd_ssbd && cpu_has_virt_ssbd )
-        setup_force_cpu_cap(X86_FEATURE_VIRT_SC_MSR_HVM);
-
     /* Figure out default_xen_spec_ctrl. */
     if ( has_spec_ctrl && ibrs )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 20 16:00:23 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 20 Aug 2022 16:00:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.390825.628411 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oPQtb-0004HO-Dj; Sat, 20 Aug 2022 16:00:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 390825.628411; Sat, 20 Aug 2022 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 1oPQtb-0004HH-9l; Sat, 20 Aug 2022 16:00:23 +0000
Received: by outflank-mailman (input) for mailman id 390825;
 Sat, 20 Aug 2022 16:00:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oPQta-0004H3-4v
 for xen-changelog@lists.xenproject.org; Sat, 20 Aug 2022 16:00:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oPQta-0004pF-4D
 for xen-changelog@lists.xenproject.org; Sat, 20 Aug 2022 16:00:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oPQta-0005yC-1u
 for xen-changelog@lists.xenproject.org; Sat, 20 Aug 2022 16:00:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tJThanjNP4bXHbGKSkDBQW7x1C9M0sKb+maB5T3JC28=; b=VyP7FLBMaHTjcKXLqIIQE5kr+v
	nTTf0PFk3YN/ZnvIdH85tqOLQ9PM5RgGPa9zsy0iqGtFxk/jdb1AeRZAqJB9HOuKt3SthQG0533GG
	L/VhwjJZ0Z81TzU7Z6Gnm9+kZB5/uv41c7dlboKJV8PlcC7YsPB70QMf9coK/4NSpBPo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Temporarily revert "amd/msr: implement VIRT_SPEC_CTRL for HVM guests on top of SPEC_CTRL"
Message-Id: <E1oPQta-0005yC-1u@xenbits.xenproject.org>
Date: Sat, 20 Aug 2022 16:00:22 +0000

commit 8c5d17f5a48ea2cd4cac27b6ae414c0946d4eda8
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Fri Aug 19 20:18:46 2022 +0100
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Fri Aug 19 20:22:10 2022 +0100

    Temporarily revert "amd/msr: implement VIRT_SPEC_CTRL for HVM guests on top of SPEC_CTRL"
    
    A person tagged in commit ebaaa72ee080c8774b1df5783220d4811159c327
    claims the tag is in accurate; revert this commit so that we can
    re-commit it again with the tag corrected.
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
---
 xen/arch/x86/cpuid.c                        |  7 -------
 xen/arch/x86/hvm/hvm.c                      |  1 -
 xen/arch/x86/include/asm/msr.h              |  4 ----
 xen/arch/x86/msr.c                          | 18 ------------------
 xen/arch/x86/spec_ctrl.c                    |  3 +--
 xen/include/public/arch-x86/cpufeatureset.h |  2 +-
 6 files changed, 2 insertions(+), 33 deletions(-)

diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 979dcf8164..7e0b395698 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -550,13 +550,6 @@ static void __init calculate_hvm_max_policy(void)
         __clear_bit(X86_FEATURE_IBRSB, hvm_featureset);
         __clear_bit(X86_FEATURE_IBRS, hvm_featureset);
     }
-    else if ( boot_cpu_has(X86_FEATURE_AMD_SSBD) )
-        /*
-         * If SPEC_CTRL.SSBD is available VIRT_SPEC_CTRL.SSBD can be exposed
-         * and implemented using the former. Expose in the max policy only as
-         * the preference is for guests to use SPEC_CTRL.SSBD if available.
-         */
-        __set_bit(X86_FEATURE_VIRT_SSBD, hvm_featureset);
 
     /*
      * With VT-x, some features are only supported by Xen if dedicated
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 6b5d585ed4..0dd320a6a9 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -1337,7 +1337,6 @@ static const uint32_t msrs_to_send[] = {
     MSR_INTEL_MISC_FEATURES_ENABLES,
     MSR_IA32_BNDCFGS,
     MSR_IA32_XSS,
-    MSR_VIRT_SPEC_CTRL,
     MSR_AMD64_DR0_ADDRESS_MASK,
     MSR_AMD64_DR1_ADDRESS_MASK,
     MSR_AMD64_DR2_ADDRESS_MASK,
diff --git a/xen/arch/x86/include/asm/msr.h b/xen/arch/x86/include/asm/msr.h
index ab6fbb5051..ce4fe51afe 100644
--- a/xen/arch/x86/include/asm/msr.h
+++ b/xen/arch/x86/include/asm/msr.h
@@ -291,7 +291,6 @@ struct vcpu_msrs
 {
     /*
      * 0x00000048 - MSR_SPEC_CTRL
-     * 0xc001011f - MSR_VIRT_SPEC_CTRL (if X86_FEATURE_AMD_SSBD)
      *
      * For PV guests, this holds the guest kernel value.  It is accessed on
      * every entry/exit path.
@@ -307,9 +306,6 @@ struct vcpu_msrs
      * We must clear/restore Xen's value before/after VMRUN to avoid unduly
      * influencing the guest.  In order to support "behind the guest's back"
      * protections, we load this value (commonly 0) before VMRUN.
-     *
-     * Once of such "behind the guest's back" usages is setting SPEC_CTRL.SSBD
-     * if the guest sets VIRT_SPEC_CTRL.SSBD.
      */
     struct {
         uint32_t raw;
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 2ae1fcfd5f..d2e2dc2a6b 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -389,13 +389,6 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
                ? K8_HWCR_TSC_FREQ_SEL : 0;
         break;
 
-    case MSR_VIRT_SPEC_CTRL:
-        if ( !cp->extd.virt_ssbd )
-            goto gp_fault;
-
-        *val = msrs->spec_ctrl.raw & SPEC_CTRL_SSBD;
-        break;
-
     case MSR_AMD64_DE_CFG:
         if ( !(cp->x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON)) )
             goto gp_fault;
@@ -681,17 +674,6 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
             wrmsr_tsc_aux(val);
         break;
 
-    case MSR_VIRT_SPEC_CTRL:
-        if ( !cp->extd.virt_ssbd )
-            goto gp_fault;
-
-        /* Only supports SSBD bit, the rest are ignored. */
-        if ( val & SPEC_CTRL_SSBD )
-            msrs->spec_ctrl.raw |= SPEC_CTRL_SSBD;
-        else
-            msrs->spec_ctrl.raw &= ~SPEC_CTRL_SSBD;
-        break;
-
     case MSR_AMD64_DE_CFG:
         /*
          * OpenBSD 6.7 will panic if writing to DE_CFG triggers a #GP:
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index 96e7f0983a..160cc68086 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -509,13 +509,12 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
      * mitigation support for guests.
      */
 #ifdef CONFIG_HVM
-    printk("  Support for HVM VMs:%s%s%s%s%s%s%s\n",
+    printk("  Support for HVM VMs:%s%s%s%s%s%s\n",
            (boot_cpu_has(X86_FEATURE_SC_MSR_HVM) ||
             boot_cpu_has(X86_FEATURE_SC_RSB_HVM) ||
             boot_cpu_has(X86_FEATURE_IBPB_ENTRY_HVM) ||
             opt_eager_fpu || opt_md_clear_hvm)       ? ""               : " None",
            boot_cpu_has(X86_FEATURE_SC_MSR_HVM)      ? " MSR_SPEC_CTRL" : "",
-           boot_cpu_has(X86_FEATURE_SC_MSR_HVM)      ? " MSR_VIRT_SPEC_CTRL" : "",
            boot_cpu_has(X86_FEATURE_SC_RSB_HVM)      ? " RSB"           : "",
            opt_eager_fpu                             ? " EAGER_FPU"     : "",
            opt_md_clear_hvm                          ? " MD_CLEAR"      : "",
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 42f48a8ae2..4b8925b7b8 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -265,7 +265,7 @@ XEN_CPUFEATURE(IBRS_SAME_MODE, 8*32+19) /*S  IBRS provides same-mode protection
 XEN_CPUFEATURE(NO_LMSL,       8*32+20) /*S  EFER.LMSLE no longer supported. */
 XEN_CPUFEATURE(AMD_PPIN,      8*32+23) /*   Protected Processor Inventory Number */
 XEN_CPUFEATURE(AMD_SSBD,      8*32+24) /*S  MSR_SPEC_CTRL.SSBD available */
-XEN_CPUFEATURE(VIRT_SSBD,     8*32+25) /*!  MSR_VIRT_SPEC_CTRL.SSBD */
+XEN_CPUFEATURE(VIRT_SSBD,     8*32+25) /*   MSR_VIRT_SPEC_CTRL.SSBD */
 XEN_CPUFEATURE(SSB_NO,        8*32+26) /*A  Hardware not vulnerable to SSB */
 XEN_CPUFEATURE(PSFD,          8*32+28) /*S  MSR_SPEC_CTRL.PSFD */
 XEN_CPUFEATURE(BTC_NO,        8*32+29) /*A  Hardware not vulnerable to Branch Type Confusion */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 20 16:00:33 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 20 Aug 2022 16:00:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.390826.628414 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oPQtl-0004PI-E2; Sat, 20 Aug 2022 16:00:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 390826.628414; Sat, 20 Aug 2022 16:00:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oPQtl-0004PB-BM; Sat, 20 Aug 2022 16:00:33 +0000
Received: by outflank-mailman (input) for mailman id 390826;
 Sat, 20 Aug 2022 16:00:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oPQtk-0004P2-9i
 for xen-changelog@lists.xenproject.org; Sat, 20 Aug 2022 16:00:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oPQtk-0004pP-8x
 for xen-changelog@lists.xenproject.org; Sat, 20 Aug 2022 16:00:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oPQtk-0005z3-6h
 for xen-changelog@lists.xenproject.org; Sat, 20 Aug 2022 16:00:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ept5/4oz5BPog+8FBprNTHpNCleDRsb4lRZsDyJcGv8=; b=wA2nrFL8XwLcq5ixmcKqBttY/J
	wJjneNgzs0+ZaaZo7wYssyjwx0AmD6wIBFXOYvgO2uKtSYEdPQxsjsW4tSKgqE9ub3buRJZ4wnFNT
	mWADNNRNk0AnV0XiMuh4LvMaZFVhGw2n7K6mdX/5/5D5CO+9MPve1xQbRWqel73OG/Wg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] amd/msr: implement VIRT_SPEC_CTRL for HVM guests on top of SPEC_CTRL
Message-Id: <E1oPQtk-0005z3-6h@xenbits.xenproject.org>
Date: Sat, 20 Aug 2022 16:00:32 +0000

commit 8ffd5496f46425f73771200f2b51087b794be553
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Aug 15 09:57:23 2022 +0200
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Fri Aug 19 20:22:22 2022 +0100

    amd/msr: implement VIRT_SPEC_CTRL for HVM guests on top of SPEC_CTRL
    
    Use the logic to set shadow SPEC_CTRL values in order to implement
    support for VIRT_SPEC_CTRL (signaled by VIRT_SSBD CPUID flag) for HVM
    guests. This includes using the spec_ctrl vCPU MSR variable to store
    the guest set value of VIRT_SPEC_CTRL.SSBD, which will be OR'ed with
    any SPEC_CTRL values being set by the guest.
    
    On hardware having SPEC_CTRL VIRT_SPEC_CTRL will not be offered by
    default to guests. VIRT_SPEC_CTRL will only be part of the max CPUID
    policy so it can be enabled for compatibility purposes.
    
    Use '!' to annotate the feature in order to express that the presence
    of the bit is not directly tied to its value in the host policy.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    
    Re-commited with a tag removed.
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
---
 xen/arch/x86/cpuid.c                        |  7 +++++++
 xen/arch/x86/hvm/hvm.c                      |  1 +
 xen/arch/x86/include/asm/msr.h              |  4 ++++
 xen/arch/x86/msr.c                          | 18 ++++++++++++++++++
 xen/arch/x86/spec_ctrl.c                    |  3 ++-
 xen/include/public/arch-x86/cpufeatureset.h |  2 +-
 6 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 7e0b395698..979dcf8164 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -550,6 +550,13 @@ static void __init calculate_hvm_max_policy(void)
         __clear_bit(X86_FEATURE_IBRSB, hvm_featureset);
         __clear_bit(X86_FEATURE_IBRS, hvm_featureset);
     }
+    else if ( boot_cpu_has(X86_FEATURE_AMD_SSBD) )
+        /*
+         * If SPEC_CTRL.SSBD is available VIRT_SPEC_CTRL.SSBD can be exposed
+         * and implemented using the former. Expose in the max policy only as
+         * the preference is for guests to use SPEC_CTRL.SSBD if available.
+         */
+        __set_bit(X86_FEATURE_VIRT_SSBD, hvm_featureset);
 
     /*
      * With VT-x, some features are only supported by Xen if dedicated
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 0dd320a6a9..6b5d585ed4 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -1337,6 +1337,7 @@ static const uint32_t msrs_to_send[] = {
     MSR_INTEL_MISC_FEATURES_ENABLES,
     MSR_IA32_BNDCFGS,
     MSR_IA32_XSS,
+    MSR_VIRT_SPEC_CTRL,
     MSR_AMD64_DR0_ADDRESS_MASK,
     MSR_AMD64_DR1_ADDRESS_MASK,
     MSR_AMD64_DR2_ADDRESS_MASK,
diff --git a/xen/arch/x86/include/asm/msr.h b/xen/arch/x86/include/asm/msr.h
index ce4fe51afe..ab6fbb5051 100644
--- a/xen/arch/x86/include/asm/msr.h
+++ b/xen/arch/x86/include/asm/msr.h
@@ -291,6 +291,7 @@ struct vcpu_msrs
 {
     /*
      * 0x00000048 - MSR_SPEC_CTRL
+     * 0xc001011f - MSR_VIRT_SPEC_CTRL (if X86_FEATURE_AMD_SSBD)
      *
      * For PV guests, this holds the guest kernel value.  It is accessed on
      * every entry/exit path.
@@ -306,6 +307,9 @@ struct vcpu_msrs
      * We must clear/restore Xen's value before/after VMRUN to avoid unduly
      * influencing the guest.  In order to support "behind the guest's back"
      * protections, we load this value (commonly 0) before VMRUN.
+     *
+     * Once of such "behind the guest's back" usages is setting SPEC_CTRL.SSBD
+     * if the guest sets VIRT_SPEC_CTRL.SSBD.
      */
     struct {
         uint32_t raw;
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index d2e2dc2a6b..2ae1fcfd5f 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -389,6 +389,13 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
                ? K8_HWCR_TSC_FREQ_SEL : 0;
         break;
 
+    case MSR_VIRT_SPEC_CTRL:
+        if ( !cp->extd.virt_ssbd )
+            goto gp_fault;
+
+        *val = msrs->spec_ctrl.raw & SPEC_CTRL_SSBD;
+        break;
+
     case MSR_AMD64_DE_CFG:
         if ( !(cp->x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON)) )
             goto gp_fault;
@@ -674,6 +681,17 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
             wrmsr_tsc_aux(val);
         break;
 
+    case MSR_VIRT_SPEC_CTRL:
+        if ( !cp->extd.virt_ssbd )
+            goto gp_fault;
+
+        /* Only supports SSBD bit, the rest are ignored. */
+        if ( val & SPEC_CTRL_SSBD )
+            msrs->spec_ctrl.raw |= SPEC_CTRL_SSBD;
+        else
+            msrs->spec_ctrl.raw &= ~SPEC_CTRL_SSBD;
+        break;
+
     case MSR_AMD64_DE_CFG:
         /*
          * OpenBSD 6.7 will panic if writing to DE_CFG triggers a #GP:
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index 160cc68086..96e7f0983a 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -509,12 +509,13 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
      * mitigation support for guests.
      */
 #ifdef CONFIG_HVM
-    printk("  Support for HVM VMs:%s%s%s%s%s%s\n",
+    printk("  Support for HVM VMs:%s%s%s%s%s%s%s\n",
            (boot_cpu_has(X86_FEATURE_SC_MSR_HVM) ||
             boot_cpu_has(X86_FEATURE_SC_RSB_HVM) ||
             boot_cpu_has(X86_FEATURE_IBPB_ENTRY_HVM) ||
             opt_eager_fpu || opt_md_clear_hvm)       ? ""               : " None",
            boot_cpu_has(X86_FEATURE_SC_MSR_HVM)      ? " MSR_SPEC_CTRL" : "",
+           boot_cpu_has(X86_FEATURE_SC_MSR_HVM)      ? " MSR_VIRT_SPEC_CTRL" : "",
            boot_cpu_has(X86_FEATURE_SC_RSB_HVM)      ? " RSB"           : "",
            opt_eager_fpu                             ? " EAGER_FPU"     : "",
            opt_md_clear_hvm                          ? " MD_CLEAR"      : "",
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 4b8925b7b8..42f48a8ae2 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -265,7 +265,7 @@ XEN_CPUFEATURE(IBRS_SAME_MODE, 8*32+19) /*S  IBRS provides same-mode protection
 XEN_CPUFEATURE(NO_LMSL,       8*32+20) /*S  EFER.LMSLE no longer supported. */
 XEN_CPUFEATURE(AMD_PPIN,      8*32+23) /*   Protected Processor Inventory Number */
 XEN_CPUFEATURE(AMD_SSBD,      8*32+24) /*S  MSR_SPEC_CTRL.SSBD available */
-XEN_CPUFEATURE(VIRT_SSBD,     8*32+25) /*   MSR_VIRT_SPEC_CTRL.SSBD */
+XEN_CPUFEATURE(VIRT_SSBD,     8*32+25) /*!  MSR_VIRT_SPEC_CTRL.SSBD */
 XEN_CPUFEATURE(SSB_NO,        8*32+26) /*A  Hardware not vulnerable to SSB */
 XEN_CPUFEATURE(PSFD,          8*32+28) /*S  MSR_SPEC_CTRL.PSFD */
 XEN_CPUFEATURE(BTC_NO,        8*32+29) /*A  Hardware not vulnerable to Branch Type Confusion */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 20 16:00:43 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 20 Aug 2022 16:00:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.390827.628419 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oPQtv-0004SP-IG; Sat, 20 Aug 2022 16:00:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 390827.628419; Sat, 20 Aug 2022 16:00:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oPQtv-0004SI-EI; Sat, 20 Aug 2022 16:00:43 +0000
Received: by outflank-mailman (input) for mailman id 390827;
 Sat, 20 Aug 2022 16:00:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oPQtu-0004S9-Cz
 for xen-changelog@lists.xenproject.org; Sat, 20 Aug 2022 16:00:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oPQtu-0004pa-CE
 for xen-changelog@lists.xenproject.org; Sat, 20 Aug 2022 16:00:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oPQtu-0005zy-BN
 for xen-changelog@lists.xenproject.org; Sat, 20 Aug 2022 16:00:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3iR51a6a4iuBoo4ARfSTq5hKhwXwPN4hyoOId/PFBSY=; b=J8X/2UWJTMBv4LGtwe++VF7RFH
	GiIcL51UaiABy5Wu/8aJSKHmBnnI60bwkxRs+x9IBkvyak3JwBRG4WoAiS8BAwHcHGB27lXFb0uXy
	WOto5g3BIelu0dRmZZjudNOWdkkkXcSaO0aGlsS66JE3WBiSryUZC0IqJlyc83NOk3Ac=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] amd/msr: allow passthrough of VIRT_SPEC_CTRL for HVM guests
Message-Id: <E1oPQtu-0005zy-BN@xenbits.xenproject.org>
Date: Sat, 20 Aug 2022 16:00:42 +0000

commit 15f3a67e7e05d268dee24337e1688ea6675a5036
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Aug 15 09:58:08 2022 +0200
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Fri Aug 19 20:23:21 2022 +0100

    amd/msr: allow passthrough of VIRT_SPEC_CTRL for HVM guests
    
    Allow HVM guests access to MSR_VIRT_SPEC_CTRL if the platform Xen is
    running on has support for it.  This requires adding logic in the
    vm{entry,exit} paths for SVM in order to context switch between the
    hypervisor value and the guest one.  The added handlers for context
    switch will also be used for the legacy SSBD support.
    
    Introduce a new synthetic feature leaf (X86_FEATURE_VIRT_SC_MSR_HVM)
    to signal whether VIRT_SPEC_CTRL needs to be handled on guest
    vm{entry,exit}.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    
    Re-commited with a tag removed.
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
---
 xen/arch/x86/cpuid.c                   | 14 ++++++++++++++
 xen/arch/x86/hvm/svm/entry.S           |  8 ++++++++
 xen/arch/x86/hvm/svm/svm.c             | 35 ++++++++++++++++++++++++++++++++++
 xen/arch/x86/include/asm/cpufeatures.h |  2 +-
 xen/arch/x86/include/asm/msr.h         | 10 ++++++++++
 xen/arch/x86/msr.c                     | 16 ++++++++++++----
 xen/arch/x86/spec_ctrl.c               |  9 ++++++++-
 7 files changed, 88 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 979dcf8164..a4a366ad84 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -541,6 +541,13 @@ static void __init calculate_hvm_max_policy(void)
          raw_cpuid_policy.basic.sep )
         __set_bit(X86_FEATURE_SEP, hvm_featureset);
 
+    /*
+     * VIRT_SSBD is exposed in the default policy as a result of
+     * VIRT_SC_MSR_HVM being set, it also needs exposing in the max policy.
+     */
+    if ( boot_cpu_has(X86_FEATURE_VIRT_SC_MSR_HVM) )
+        __set_bit(X86_FEATURE_VIRT_SSBD, hvm_featureset);
+
     /*
      * If Xen isn't virtualising MSR_SPEC_CTRL for HVM guests (functional
      * availability, or admin choice), hide the feature.
@@ -597,6 +604,13 @@ static void __init calculate_hvm_def_policy(void)
     guest_common_feature_adjustments(hvm_featureset);
     guest_common_default_feature_adjustments(hvm_featureset);
 
+    /*
+     * Only expose VIRT_SSBD if AMD_SSBD is not available, and thus
+     * VIRT_SC_MSR_HVM is set.
+     */
+    if ( boot_cpu_has(X86_FEATURE_VIRT_SC_MSR_HVM) )
+        __set_bit(X86_FEATURE_VIRT_SSBD, hvm_featureset);
+
     sanitise_featureset(hvm_featureset);
     cpuid_featureset_to_policy(hvm_featureset, p);
     recalculate_xstate(p);
diff --git a/xen/arch/x86/hvm/svm/entry.S b/xen/arch/x86/hvm/svm/entry.S
index a60d759f71..a26589aa9a 100644
--- a/xen/arch/x86/hvm/svm/entry.S
+++ b/xen/arch/x86/hvm/svm/entry.S
@@ -19,6 +19,8 @@
 
         .file "svm/entry.S"
 
+#include <xen/lib.h>
+
 #include <asm/asm_defns.h>
 #include <asm/page.h>
 
@@ -57,6 +59,9 @@ __UNLIKELY_END(nsvm_hap)
 
         clgi
 
+        ALTERNATIVE "", STR(call vmentry_virt_spec_ctrl), \
+                        X86_FEATURE_VIRT_SC_MSR_HVM
+
         /* WARNING! `ret`, `call *`, `jmp *` not safe beyond this point. */
         /* SPEC_CTRL_EXIT_TO_SVM       Req: b=curr %rsp=regs/cpuinfo, Clob: acd */
         .macro svm_vmentry_spec_ctrl
@@ -126,6 +131,9 @@ __UNLIKELY_END(nsvm_hap)
         ALTERNATIVE "", svm_vmexit_spec_ctrl, X86_FEATURE_SC_MSR_HVM
         /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */
 
+        ALTERNATIVE "", STR(call vmexit_virt_spec_ctrl), \
+                        X86_FEATURE_VIRT_SC_MSR_HVM
+
         /*
          * STGI is executed unconditionally, and is sufficiently serialising
          * to safely resolve any Spectre-v1 concerns in the above logic.
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 0849a9dc5f..53ce2edd35 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -52,6 +52,7 @@
 #include <asm/hvm/svm/svmdebug.h>
 #include <asm/hvm/svm/nestedsvm.h>
 #include <asm/hvm/nestedhvm.h>
+#include <asm/spec_ctrl.h>
 #include <asm/x86_emulate.h>
 #include <public/sched.h>
 #include <asm/hvm/vpt.h>
@@ -610,6 +611,16 @@ static void cf_check svm_cpuid_policy_changed(struct vcpu *v)
     svm_intercept_msr(v, MSR_SPEC_CTRL,
                       cp->extd.ibrs ? MSR_INTERCEPT_NONE : MSR_INTERCEPT_RW);
 
+    /*
+     * Always trap write accesses to VIRT_SPEC_CTRL in order to cache the guest
+     * setting and avoid having to perform a rdmsr on vmexit to get the guest
+     * setting even if VIRT_SSBD is offered to Xen itself.
+     */
+    svm_intercept_msr(v, MSR_VIRT_SPEC_CTRL,
+                      cp->extd.virt_ssbd && cpu_has_virt_ssbd &&
+                      !cpu_has_amd_ssbd ?
+                      MSR_INTERCEPT_WRITE : MSR_INTERCEPT_RW);
+
     /* Give access to MSR_PRED_CMD if the guest has been told about it. */
     svm_intercept_msr(v, MSR_PRED_CMD,
                       cp->extd.ibpb ? MSR_INTERCEPT_NONE : MSR_INTERCEPT_RW);
@@ -3105,6 +3116,30 @@ void svm_vmexit_handler(struct cpu_user_regs *regs)
     vmcb_set_vintr(vmcb, intr);
 }
 
+/* Called with GIF=0. */
+void vmexit_virt_spec_ctrl(void)
+{
+    unsigned int val = opt_ssbd ? SPEC_CTRL_SSBD : 0;
+
+    if ( val == current->arch.msrs->virt_spec_ctrl.raw )
+        return;
+
+    if ( cpu_has_virt_ssbd )
+        wrmsr(MSR_VIRT_SPEC_CTRL, val, 0);
+}
+
+/* Called with GIF=0. */
+void vmentry_virt_spec_ctrl(void)
+{
+    unsigned int val = current->arch.msrs->virt_spec_ctrl.raw;
+
+    if ( val == (opt_ssbd ? SPEC_CTRL_SSBD : 0) )
+        return;
+
+    if ( cpu_has_virt_ssbd )
+        wrmsr(MSR_VIRT_SPEC_CTRL, val, 0);
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/x86/include/asm/cpufeatures.h b/xen/arch/x86/include/asm/cpufeatures.h
index 672c9ee22b..3895de4faf 100644
--- a/xen/arch/x86/include/asm/cpufeatures.h
+++ b/xen/arch/x86/include/asm/cpufeatures.h
@@ -24,7 +24,7 @@ XEN_CPUFEATURE(APERFMPERF,        X86_SYNTH( 8)) /* APERFMPERF */
 XEN_CPUFEATURE(MFENCE_RDTSC,      X86_SYNTH( 9)) /* MFENCE synchronizes RDTSC */
 XEN_CPUFEATURE(XEN_SMEP,          X86_SYNTH(10)) /* SMEP gets used by Xen itself */
 XEN_CPUFEATURE(XEN_SMAP,          X86_SYNTH(11)) /* SMAP gets used by Xen itself */
-/* Bit 12 - unused. */
+XEN_CPUFEATURE(VIRT_SC_MSR_HVM,   X86_SYNTH(12)) /* MSR_VIRT_SPEC_CTRL exposed to HVM */
 XEN_CPUFEATURE(IND_THUNK_LFENCE,  X86_SYNTH(13)) /* Use IND_THUNK_LFENCE */
 XEN_CPUFEATURE(IND_THUNK_JMP,     X86_SYNTH(14)) /* Use IND_THUNK_JMP */
 XEN_CPUFEATURE(SC_NO_BRANCH_HARDEN, X86_SYNTH(15)) /* (Disable) Conditional branch hardening */
diff --git a/xen/arch/x86/include/asm/msr.h b/xen/arch/x86/include/asm/msr.h
index ab6fbb5051..de18e90b2e 100644
--- a/xen/arch/x86/include/asm/msr.h
+++ b/xen/arch/x86/include/asm/msr.h
@@ -375,6 +375,16 @@ struct vcpu_msrs
      */
     uint32_t tsc_aux;
 
+    /*
+     * 0xc001011f - MSR_VIRT_SPEC_CTRL (if !X86_FEATURE_AMD_SSBD)
+     *
+     * AMD only. Guest selected value, context switched on guest VM
+     * entry/exit.
+     */
+    struct {
+        uint32_t raw;
+    } virt_spec_ctrl;
+
     /*
      * 0xc00110{27,19-1b} MSR_AMD64_DR{0-3}_ADDRESS_MASK
      *
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 2ae1fcfd5f..95416995a5 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -393,7 +393,10 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
         if ( !cp->extd.virt_ssbd )
             goto gp_fault;
 
-        *val = msrs->spec_ctrl.raw & SPEC_CTRL_SSBD;
+        if ( cpu_has_amd_ssbd )
+            *val = msrs->spec_ctrl.raw & SPEC_CTRL_SSBD;
+        else
+            *val = msrs->virt_spec_ctrl.raw;
         break;
 
     case MSR_AMD64_DE_CFG:
@@ -686,10 +689,15 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
             goto gp_fault;
 
         /* Only supports SSBD bit, the rest are ignored. */
-        if ( val & SPEC_CTRL_SSBD )
-            msrs->spec_ctrl.raw |= SPEC_CTRL_SSBD;
+        if ( cpu_has_amd_ssbd )
+        {
+            if ( val & SPEC_CTRL_SSBD )
+                msrs->spec_ctrl.raw |= SPEC_CTRL_SSBD;
+            else
+                msrs->spec_ctrl.raw &= ~SPEC_CTRL_SSBD;
+        }
         else
-            msrs->spec_ctrl.raw &= ~SPEC_CTRL_SSBD;
+            msrs->virt_spec_ctrl.raw = val & SPEC_CTRL_SSBD;
         break;
 
     case MSR_AMD64_DE_CFG:
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index 96e7f0983a..ec44205309 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -513,9 +513,12 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
            (boot_cpu_has(X86_FEATURE_SC_MSR_HVM) ||
             boot_cpu_has(X86_FEATURE_SC_RSB_HVM) ||
             boot_cpu_has(X86_FEATURE_IBPB_ENTRY_HVM) ||
+            boot_cpu_has(X86_FEATURE_VIRT_SC_MSR_HVM) ||
             opt_eager_fpu || opt_md_clear_hvm)       ? ""               : " None",
            boot_cpu_has(X86_FEATURE_SC_MSR_HVM)      ? " MSR_SPEC_CTRL" : "",
-           boot_cpu_has(X86_FEATURE_SC_MSR_HVM)      ? " MSR_VIRT_SPEC_CTRL" : "",
+           (boot_cpu_has(X86_FEATURE_SC_MSR_HVM) ||
+            boot_cpu_has(X86_FEATURE_VIRT_SC_MSR_HVM)) ? " MSR_VIRT_SPEC_CTRL"
+                                                       : "",
            boot_cpu_has(X86_FEATURE_SC_RSB_HVM)      ? " RSB"           : "",
            opt_eager_fpu                             ? " EAGER_FPU"     : "",
            opt_md_clear_hvm                          ? " MD_CLEAR"      : "",
@@ -1240,6 +1243,10 @@ void __init init_speculation_mitigations(void)
             setup_force_cpu_cap(X86_FEATURE_SC_MSR_HVM);
     }
 
+    /* Support VIRT_SPEC_CTRL.SSBD if AMD_SSBD is not available. */
+    if ( opt_msr_sc_hvm && !cpu_has_amd_ssbd && cpu_has_virt_ssbd )
+        setup_force_cpu_cap(X86_FEATURE_VIRT_SC_MSR_HVM);
+
     /* Figure out default_xen_spec_ctrl. */
     if ( has_spec_ctrl && ibrs )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 20 16:00:53 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 20 Aug 2022 16:00:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.390828.628422 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oPQu5-0004VS-Iz; Sat, 20 Aug 2022 16:00:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 390828.628422; Sat, 20 Aug 2022 16:00: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 1oPQu5-0004VK-G0; Sat, 20 Aug 2022 16:00:53 +0000
Received: by outflank-mailman (input) for mailman id 390828;
 Sat, 20 Aug 2022 16:00:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oPQu4-0004V4-Gs
 for xen-changelog@lists.xenproject.org; Sat, 20 Aug 2022 16:00:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oPQu4-0004pn-GD
 for xen-changelog@lists.xenproject.org; Sat, 20 Aug 2022 16:00:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oPQu4-000610-Er
 for xen-changelog@lists.xenproject.org; Sat, 20 Aug 2022 16:00:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BPY9/0ITQ7rw+NsjxgMGmFZU/EurkYgYEuc05Ycr6KY=; b=tjhKZKRWmCBxPIpV90QGzk1z/i
	fOhSkHSMbPQfDxHleThSJjKNzk3VEp+CxzIUSthiD4GWm2CcaiZJ6SJ5o2aGtJW3Syfjr/9APHQgQ
	s0b7vjPLhYmdgm8VlBhW4iX0iu24CzvGp3KF2ixpbM3QKujQ9GAhLDSPrz0D0bMQZx8Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] amd/msr: implement VIRT_SPEC_CTRL for HVM guests using legacy SSBD
Message-Id: <E1oPQu4-000610-Er@xenbits.xenproject.org>
Date: Sat, 20 Aug 2022 16:00:52 +0000

commit f6cd15188e097de1eb04855eb790a5f51c3ad71a
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Aug 15 09:58:55 2022 +0200
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Fri Aug 19 20:23:43 2022 +0100

    amd/msr: implement VIRT_SPEC_CTRL for HVM guests using legacy SSBD
    
    Expose VIRT_SSBD to guests if the hardware supports setting SSBD in
    the LS_CFG MSR (a.k.a. non-architectural way). Different AMD CPU
    families use different bits in LS_CFG, so exposing VIRT_SPEC_CTRL.SSBD
    allows for an unified way of exposing SSBD support to guests on AMD
    hardware that's compatible migration wise, regardless of what
    underlying mechanism is used to set SSBD.
    
    Note that on AMD Family 17h and Hygon Family 18h processors the value
    of SSBD in LS_CFG is shared between threads on the same core, so
    there's extra logic in order to synchronize the value and have SSBD
    set as long as one of the threads in the core requires it to be set.
    Such logic also requires extra storage for each thread state, which is
    allocated at initialization time.
    
    Do the context switching of the SSBD selection in LS_CFG between
    hypervisor and guest in the same handler that's already used to switch
    the value of VIRT_SPEC_CTRL.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Henry Wang <Henry.Wang@arm.com>
    
    Re-commited with a tag removed.
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
---
 CHANGELOG.md                   |   1 +
 xen/arch/x86/cpu/amd.c         | 121 +++++++++++++++++++++++++++++++++++------
 xen/arch/x86/hvm/svm/svm.c     |   4 ++
 xen/arch/x86/include/asm/amd.h |   4 ++
 xen/arch/x86/spec_ctrl.c       |   4 +-
 5 files changed, 116 insertions(+), 18 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index a87a193e15..5e4bae5f35 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 ### Added / support upgraded
  - IOMMU superpage support on x86, affecting PV guests as well as HVM/PVH ones
    when they don't share page tables with the CPU (HAP / EPT / NPT).
+ - Support VIRT_SSBD feature for HVM guests on AMD.
 
 ### Removed / support downgraded
  - dropped support for the (x86-only) "vesa-mtrr" and "vesa-remap" command line options
diff --git a/xen/arch/x86/cpu/amd.c b/xen/arch/x86/cpu/amd.c
index d5f8e5e899..98c52d0686 100644
--- a/xen/arch/x86/cpu/amd.c
+++ b/xen/arch/x86/cpu/amd.c
@@ -48,6 +48,7 @@ boolean_param("allow_unsafe", opt_allow_unsafe);
 
 /* Signal whether the ACPI C1E quirk is required. */
 bool __read_mostly amd_acpi_c1e_quirk;
+bool __ro_after_init amd_legacy_ssbd;
 
 static inline int rdmsr_amd_safe(unsigned int msr, unsigned int *lo,
 				 unsigned int *hi)
@@ -685,23 +686,10 @@ void amd_init_lfence(struct cpuinfo_x86 *c)
  * Refer to the AMD Speculative Store Bypass whitepaper:
  * https://developer.amd.com/wp-content/resources/124441_AMD64_SpeculativeStoreBypassDisable_Whitepaper_final.pdf
  */
-void amd_init_ssbd(const struct cpuinfo_x86 *c)
+static bool set_legacy_ssbd(const struct cpuinfo_x86 *c, bool enable)
 {
 	int bit = -1;
 
-	if (cpu_has_ssb_no)
-		return;
-
-	if (cpu_has_amd_ssbd) {
-		/* Handled by common MSR_SPEC_CTRL logic */
-		return;
-	}
-
-	if (cpu_has_virt_ssbd) {
-		wrmsrl(MSR_VIRT_SPEC_CTRL, opt_ssbd ? SPEC_CTRL_SSBD : 0);
-		return;
-	}
-
 	switch (c->x86) {
 	case 0x15: bit = 54; break;
 	case 0x16: bit = 33; break;
@@ -715,20 +703,119 @@ void amd_init_ssbd(const struct cpuinfo_x86 *c)
 		if (rdmsr_safe(MSR_AMD64_LS_CFG, val) ||
 		    ({
 			    val &= ~mask;
-			    if (opt_ssbd)
+			    if (enable)
 				    val |= mask;
 			    false;
 		    }) ||
 		    wrmsr_safe(MSR_AMD64_LS_CFG, val) ||
 		    ({
 			    rdmsrl(MSR_AMD64_LS_CFG, val);
-			    (val & mask) != (opt_ssbd * mask);
+			    (val & mask) != (enable * mask);
 		    }))
 			bit = -1;
 	}
 
-	if (bit < 0)
+	return bit >= 0;
+}
+
+void amd_init_ssbd(const struct cpuinfo_x86 *c)
+{
+	if (cpu_has_ssb_no)
+		return;
+
+	if (cpu_has_amd_ssbd) {
+		/* Handled by common MSR_SPEC_CTRL logic */
+		return;
+	}
+
+	if (cpu_has_virt_ssbd) {
+		wrmsrl(MSR_VIRT_SPEC_CTRL, opt_ssbd ? SPEC_CTRL_SSBD : 0);
+		return;
+	}
+
+	if (!set_legacy_ssbd(c, opt_ssbd)) {
 		printk_once(XENLOG_ERR "No SSBD controls available\n");
+		if (amd_legacy_ssbd)
+			panic("CPU feature mismatch: no legacy SSBD\n");
+	} else if (c == &boot_cpu_data)
+		amd_legacy_ssbd = true;
+}
+
+static struct ssbd_ls_cfg {
+    bool locked;
+    unsigned int count;
+} __cacheline_aligned *ssbd_ls_cfg;
+static unsigned int __ro_after_init ssbd_max_cores;
+#define AMD_FAM17H_MAX_SOCKETS 2
+
+bool __init amd_setup_legacy_ssbd(void)
+{
+	unsigned int i;
+
+	if ((boot_cpu_data.x86 != 0x17 && boot_cpu_data.x86 != 0x18) ||
+	    boot_cpu_data.x86_num_siblings <= 1)
+		return true;
+
+	/*
+	 * One could be forgiven for thinking that c->x86_max_cores is the
+	 * correct value to use here.
+	 *
+	 * However, that value is derived from the current configuration, and
+	 * c->cpu_core_id is sparse on all but the top end CPUs.  Derive
+	 * max_cpus from ApicIdCoreIdSize which will cover any sparseness.
+	 */
+	if (boot_cpu_data.extended_cpuid_level >= 0x80000008) {
+		ssbd_max_cores = 1u << MASK_EXTR(cpuid_ecx(0x80000008), 0xf000);
+		ssbd_max_cores /= boot_cpu_data.x86_num_siblings;
+	}
+	if (!ssbd_max_cores)
+		return false;
+
+	ssbd_ls_cfg = xzalloc_array(struct ssbd_ls_cfg,
+	                            ssbd_max_cores * AMD_FAM17H_MAX_SOCKETS);
+	if (!ssbd_ls_cfg)
+		return false;
+
+	if (opt_ssbd)
+		for (i = 0; i < ssbd_max_cores * AMD_FAM17H_MAX_SOCKETS; i++)
+			/* Set initial state, applies to any (hotplug) CPU. */
+			ssbd_ls_cfg[i].count = boot_cpu_data.x86_num_siblings;
+
+	return true;
+}
+
+/*
+ * Executed from GIF==0 context: avoid using BUG/ASSERT or other functionality
+ * that relies on exceptions as those are not expected to run in GIF==0
+ * context.
+ */
+void amd_set_legacy_ssbd(bool enable)
+{
+	const struct cpuinfo_x86 *c = &current_cpu_data;
+	struct ssbd_ls_cfg *status;
+
+	if ((c->x86 != 0x17 && c->x86 != 0x18) || c->x86_num_siblings <= 1) {
+		set_legacy_ssbd(c, enable);
+		return;
+	}
+
+	status = &ssbd_ls_cfg[c->phys_proc_id * ssbd_max_cores +
+	                      c->cpu_core_id];
+
+	/*
+	 * Open code a very simple spinlock: this function is used with GIF==0
+	 * and different IF values, so would trigger the checklock detector.
+	 * Instead of trying to workaround the detector, use a very simple lock
+	 * implementation: it's better to reduce the amount of code executed
+	 * with GIF==0.
+	 */
+	while (test_and_set_bool(status->locked))
+		cpu_relax();
+	status->count += enable ? 1 : -1;
+	if (enable ? status->count == 1 : !status->count)
+		set_legacy_ssbd(c, enable);
+	barrier();
+	write_atomic(&status->locked, false);
 }
 
 /*
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 53ce2edd35..1aeaabcb13 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -3126,6 +3126,8 @@ void vmexit_virt_spec_ctrl(void)
 
     if ( cpu_has_virt_ssbd )
         wrmsr(MSR_VIRT_SPEC_CTRL, val, 0);
+    else
+        amd_set_legacy_ssbd(val);
 }
 
 /* Called with GIF=0. */
@@ -3138,6 +3140,8 @@ void vmentry_virt_spec_ctrl(void)
 
     if ( cpu_has_virt_ssbd )
         wrmsr(MSR_VIRT_SPEC_CTRL, val, 0);
+    else
+        amd_set_legacy_ssbd(val);
 }
 
 /*
diff --git a/xen/arch/x86/include/asm/amd.h b/xen/arch/x86/include/asm/amd.h
index a82382e6bf..6a42f68542 100644
--- a/xen/arch/x86/include/asm/amd.h
+++ b/xen/arch/x86/include/asm/amd.h
@@ -151,4 +151,8 @@ void check_enable_amd_mmconf_dmi(void);
 extern bool amd_acpi_c1e_quirk;
 void amd_check_disable_c1e(unsigned int port, u8 value);
 
+extern bool amd_legacy_ssbd;
+bool amd_setup_legacy_ssbd(void);
+void amd_set_legacy_ssbd(bool enable);
+
 #endif /* __AMD_H__ */
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index ec44205309..4e53056624 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -22,6 +22,7 @@
 #include <xen/param.h>
 #include <xen/warning.h>
 
+#include <asm/amd.h>
 #include <asm/hvm/svm/svm.h>
 #include <asm/microcode.h>
 #include <asm/msr.h>
@@ -1244,7 +1245,8 @@ void __init init_speculation_mitigations(void)
     }
 
     /* Support VIRT_SPEC_CTRL.SSBD if AMD_SSBD is not available. */
-    if ( opt_msr_sc_hvm && !cpu_has_amd_ssbd && cpu_has_virt_ssbd )
+    if ( opt_msr_sc_hvm && !cpu_has_amd_ssbd &&
+         (cpu_has_virt_ssbd || (amd_legacy_ssbd && amd_setup_legacy_ssbd())) )
         setup_force_cpu_cap(X86_FEATURE_VIRT_SC_MSR_HVM);
 
     /* Figure out default_xen_spec_ctrl. */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Aug 22 08:11:10 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 22 Aug 2022 08:11:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.391217.628940 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oQ2WX-0002GU-Cj; Mon, 22 Aug 2022 08:11:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 391217.628940; Mon, 22 Aug 2022 08:11:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oQ2WX-0002GM-9t; Mon, 22 Aug 2022 08:11:05 +0000
Received: by outflank-mailman (input) for mailman id 391217;
 Mon, 22 Aug 2022 08:11:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQ2WW-0002GA-42
 for xen-changelog@lists.xenproject.org; Mon, 22 Aug 2022 08:11:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQ2WW-00064s-3B
 for xen-changelog@lists.xenproject.org; Mon, 22 Aug 2022 08:11:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQ2WW-0007VM-0w
 for xen-changelog@lists.xenproject.org; Mon, 22 Aug 2022 08:11:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hgObi2V1ekfm05lzuUepcIEQnfRcO7cG/K6JxXo86/I=; b=ZLMIg9DA7ZJ+CPxNzYLKBw8Bvb
	f6A5Dsz+TcDdJZUtIf89X9/cQSFjJRKhpeeZ/KrtlKPJit8lzB9jgGc5Vm/0nV67c1eImHHg+wFE8
	qNRDcsottYDsrhdNafpRkMnpLCT5iXUVDZs85H/xwrXkLyr8Db6/yn+cdZCTxuGulmmg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] arm/domain: fix comment for arch_set_info_guest
Message-Id: <E1oQ2WW-0007VM-0w@xenbits.xenproject.org>
Date: Mon, 22 Aug 2022 08:11:04 +0000

commit 58ce731faca28cb08f7c1b8c79b59fed47d0b2c2
Author:     Luca Fancellu <luca.fancellu@arm.com>
AuthorDate: Fri Aug 5 14:08:00 2022 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Mon Aug 22 09:08:15 2022 +0100

    arm/domain: fix comment for arch_set_info_guest
    
    The function arch_set_info_guest is not reached anymore through
    VCPUOP_initialise on arm, update the comment.
    
    Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/domain.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index 2cd481979c..13df91c401 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -885,9 +885,8 @@ static int is_guest_pv64_psr(uint64_t psr)
 #endif
 
 /*
- * Initialise VCPU state. The context can be supplied by either the
- * toolstack (XEN_DOMCTL_setvcpucontext) or the guest
- * (VCPUOP_initialise) and therefore must be properly validated.
+ * Initialise vCPU state. The context may be supplied by an external entity, so
+ * we need to validate it.
  */
 int arch_set_info_guest(
     struct vcpu *v, vcpu_guest_context_u c)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Aug 22 10:22:11 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 22 Aug 2022 10:22:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.391337.629103 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oQ4ZI-00061r-Th; Mon, 22 Aug 2022 10:22:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 391337.629103; Mon, 22 Aug 2022 10:22: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 1oQ4ZI-00061f-QA; Mon, 22 Aug 2022 10:22:04 +0000
Received: by outflank-mailman (input) for mailman id 391337;
 Mon, 22 Aug 2022 10:22:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQ4ZI-00061Z-25
 for xen-changelog@lists.xenproject.org; Mon, 22 Aug 2022 10:22:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQ4ZH-0008PA-Ug
 for xen-changelog@lists.xenproject.org; Mon, 22 Aug 2022 10:22:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQ4ZH-00056S-Tg
 for xen-changelog@lists.xenproject.org; Mon, 22 Aug 2022 10:22:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=aLnygZZNhP5YXOzIZKtgud9RxXx9RVzTzPao5zcSO4A=; b=NdwIRbJ+pqx1hlUnPdoW5sNeo0
	Bg+g23ZVNns77vLs+bK4MSb/p6g6OUca7pUTMlV7//oszBf1VXTDhobCKaIAsQATlLAqfkUoK4VKQ
	VdXSOrkLy0APwB32hmIc0RYNJIF4HGkcpu6JnInHChfk1EmQnLrpuz94y9V9wDqlFcTg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools: Introduce $(xenlibs-rpath,..) to replace $(SHDEPS_lib*)
Message-Id: <E1oQ4ZH-00056S-Tg@xenbits.xenproject.org>
Date: Mon, 22 Aug 2022 10:22:03 +0000

commit d2b396d47bd9071232c103501aadb32d7b83fdbb
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Mon Aug 22 12:09:05 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 22 12:09:05 2022 +0200

    tools: Introduce $(xenlibs-rpath,..) to replace $(SHDEPS_lib*)
    
    This patch introduce a new macro $(xenlibs-dependencies,) to generate
    a list of all the xen library that a library is list against, and they
    are listed only once. We use the side effect of $(sort ) which remove
    duplicates.
    
    This is used by another macro $(xenlibs-rpath,) which is to replace
    $(SHDEPS_libxen*).
    
    In libs.mk, we don't need to $(sort ) SHLIB_lib* anymore as this was used
    to remove duplicates and they are no more duplicates.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 tools/Rules.mk     | 29 ++++++++++++++++-------------
 tools/libs/libs.mk |  2 +-
 2 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/tools/Rules.mk b/tools/Rules.mk
index 47424935ba..23979ed254 100644
--- a/tools/Rules.mk
+++ b/tools/Rules.mk
@@ -61,13 +61,8 @@ endif
 #           public headers. Users of libfoo are therefore transitively
 #           using libbaz's header but not linking against libbaz.
 #
-# SHDEPS_libfoo: Flags for linking recursive dependencies of
-#                libfoo. Must contain SHLIB for every library which
-#                libfoo links against. So must contain both
-#                $(SHLIB_libbar) and $(SHLIB_libbaz).
-#
 # SHLIB_libfoo: Flags for recursively linking against libfoo. Must
-#               contains SHDEPS_libfoo and:
+#               contains $(call xenlibs-rpath,foo) and:
 #                   -Wl,-rpath-link=<directory containing libfoo.so>
 #
 # CFLAGS_libfoo: Flags for compiling against libfoo. Must add the
@@ -79,23 +74,31 @@ endif
 #                libfoo.
 #
 # LDLIBS_libfoo: Flags for linking against libfoo. Must contain
-#                $(SHDEPS_libfoo) and the path to libfoo.so
+#                $(call xenlibs-rpath,foo) and the path to libfoo.so
 #
 # Consumers of libfoo should include $(CFLAGS_libfoo) and
 # $(LDLIBS_libfoo) in their appropriate directories. They should not
 # include any CFLAGS or LDLIBS relating to libbar or libbaz unless
 # they use those libraries directly (not via libfoo) too.
-#
-# Consumers of libfoo should not directly use $(SHDEPS_libfoo) or
-# $(SHLIB_libfoo)
+
+# Give the list of Xen library that the libraries in $(1) are linked against,
+# directly or indirectly.
+define xenlibs-dependencies
+    $(sort $(foreach lib,$(1), \
+        $(USELIBS_$(lib)) $(call xenlibs-dependencies,$(USELIBS_$(lib)))))
+endef
+
+# Flags for linking recursive dependencies of Xen libraries in $(1)
+define xenlibs-rpath
+    $(addprefix -Wl$(comma)-rpath-link=$(XEN_ROOT)/tools/libs/,$(call xenlibs-dependencies,$(1)))
+endef
 
 define LIB_defs
  FILENAME_$(1) ?= xen$(1)
  XEN_libxen$(1) = $$(XEN_ROOT)/tools/libs/$(1)
  CFLAGS_libxen$(1) = $$(CFLAGS_xeninclude)
- SHDEPS_libxen$(1) = $$(foreach use,$$(USELIBS_$(1)),$$(SHLIB_libxen$$(use)))
- LDLIBS_libxen$(1) = $$(SHDEPS_libxen$(1)) $$(XEN_libxen$(1))/lib$$(FILENAME_$(1))$$(libextension)
- SHLIB_libxen$(1) = $$(SHDEPS_libxen$(1)) -Wl,-rpath-link=$$(XEN_libxen$(1))
+ SHLIB_libxen$(1) = $$(call xenlibs-rpath,$(1)) -Wl,-rpath-link=$$(XEN_libxen$(1))
+ LDLIBS_libxen$(1) = $$(call xenlibs-rpath,$(1)) $$(XEN_libxen$(1))/lib$$(FILENAME_$(1))$$(libextension)
 endef
 
 $(foreach lib,$(LIBS_LIBS),$(eval $(call LIB_defs,$(lib))))
diff --git a/tools/libs/libs.mk b/tools/libs/libs.mk
index f778a7df82..d7e1274249 100644
--- a/tools/libs/libs.mk
+++ b/tools/libs/libs.mk
@@ -32,7 +32,7 @@ PKG_CONFIG ?= $(LIB_FILE_NAME).pc
 PKG_CONFIG_NAME ?= Xen$(LIBNAME)
 PKG_CONFIG_DESC ?= The $(PKG_CONFIG_NAME) library for Xen hypervisor
 PKG_CONFIG_VERSION := $(MAJOR).$(MINOR)
-PKG_CONFIG_USELIBS := $(sort $(SHLIB_libxen$(LIBNAME)))
+PKG_CONFIG_USELIBS := $(SHLIB_libxen$(LIBNAME))
 PKG_CONFIG_LIB := $(LIB_FILE_NAME)
 PKG_CONFIG_REQPRIV := $(subst $(space),$(comma),$(strip $(foreach lib,$(patsubst ctrl,control,$(USELIBS_$(LIBNAME))),xen$(lib))))
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Aug 22 10:22:15 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 22 Aug 2022 10:22:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.391338.629108 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oQ4ZS-00063P-VW; Mon, 22 Aug 2022 10:22:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 391338.629108; Mon, 22 Aug 2022 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 1oQ4ZS-00063H-Rh; Mon, 22 Aug 2022 10:22:14 +0000
Received: by outflank-mailman (input) for mailman id 391338;
 Mon, 22 Aug 2022 10:22:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQ4ZS-00063B-2I
 for xen-changelog@lists.xenproject.org; Mon, 22 Aug 2022 10:22:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQ4ZS-0008PG-1V
 for xen-changelog@lists.xenproject.org; Mon, 22 Aug 2022 10:22:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQ4ZS-00056u-0U
 for xen-changelog@lists.xenproject.org; Mon, 22 Aug 2022 10:22:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=qGb6hc/G0RRgb4ywa8HK0wfqibCuiZ/U80aRbwnwZdU=; b=qUBPsA+e5Lg7bMWjA+jncLjzFY
	2WCsWsFzJHrfY9DfP6er2Sq6QpElvEwtDweFy3gWV0WJsxGGer0m6P2u7RnkQbvT6fhsv4WLLoJMh
	LMU7dgK9MHvGH2IoFDnqIbEJ4E7xDS/c71vnYoUphJNbszdBcF8a8tTEjb1mAPl3/qEc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools: Introduce $(xenlibs-ldlibs, ) macro
Message-Id: <E1oQ4ZS-00056u-0U@xenbits.xenproject.org>
Date: Mon, 22 Aug 2022 10:22:14 +0000

commit 7f2a5e368e54884b032982b5394b8ffc3ace5a8a
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Mon Aug 22 12:09:07 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 22 12:09:07 2022 +0200

    tools: Introduce $(xenlibs-ldlibs, ) macro
    
    This can be used when linking against multiple in-tree Xen libraries,
    and avoid duplicated flags. It can be used instead of multiple
    $(LDLIBS_libxen*).
    
    For now, replace the open-coding in libs.mk.
    
    The macro $(xenlibs-libs, ) will be useful later when only the path to
    the libraries is wanted (e.g. for checking for dependencies).
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 tools/Rules.mk     | 16 ++++++++++++++--
 tools/libs/libs.mk |  2 +-
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/tools/Rules.mk b/tools/Rules.mk
index 23979ed254..ce77dd2eb1 100644
--- a/tools/Rules.mk
+++ b/tools/Rules.mk
@@ -93,12 +93,24 @@ define xenlibs-rpath
     $(addprefix -Wl$(comma)-rpath-link=$(XEN_ROOT)/tools/libs/,$(call xenlibs-dependencies,$(1)))
 endef
 
+# Provide a path for each library in $(1)
+define xenlibs-libs
+    $(foreach lib,$(1), \
+        $(XEN_ROOT)/tools/libs/$(lib)/lib$(FILENAME_$(lib))$(libextension))
+endef
+
+# Flags for linking against all Xen libraries listed in $(1)
+define xenlibs-ldlibs
+    $(call xenlibs-rpath,$(1)) $(call xenlibs-libs,$(1)) \
+    $(foreach lib,$(1),$(xenlibs-ldlibs-$(lib)))
+endef
+
 define LIB_defs
  FILENAME_$(1) ?= xen$(1)
  XEN_libxen$(1) = $$(XEN_ROOT)/tools/libs/$(1)
  CFLAGS_libxen$(1) = $$(CFLAGS_xeninclude)
  SHLIB_libxen$(1) = $$(call xenlibs-rpath,$(1)) -Wl,-rpath-link=$$(XEN_libxen$(1))
- LDLIBS_libxen$(1) = $$(call xenlibs-rpath,$(1)) $$(XEN_libxen$(1))/lib$$(FILENAME_$(1))$$(libextension)
+ LDLIBS_libxen$(1) = $$(call xenlibs-ldlibs,$(1))
 endef
 
 $(foreach lib,$(LIBS_LIBS),$(eval $(call LIB_defs,$(lib))))
@@ -108,7 +120,7 @@ $(foreach lib,$(LIBS_LIBS),$(eval $(call LIB_defs,$(lib))))
 CFLAGS_libxenctrl += -D__XEN_TOOLS__
 
 ifeq ($(CONFIG_Linux),y)
-LDLIBS_libxenstore += -ldl
+xenlibs-ldlibs-store := -ldl
 endif
 
 CFLAGS_libxenlight += $(CFLAGS_libxenctrl)
diff --git a/tools/libs/libs.mk b/tools/libs/libs.mk
index d7e1274249..2b8e7a6128 100644
--- a/tools/libs/libs.mk
+++ b/tools/libs/libs.mk
@@ -18,7 +18,7 @@ CFLAGS   += -Werror -Wmissing-prototypes
 CFLAGS   += $(CFLAGS_xeninclude)
 CFLAGS   += $(foreach lib, $(USELIBS_$(LIBNAME)), $(CFLAGS_libxen$(lib)))
 
-LDLIBS += $(foreach lib, $(USELIBS_$(LIBNAME)), $(LDLIBS_libxen$(lib)))
+LDLIBS += $(call xenlibs-ldlibs,$(USELIBS_$(LIBNAME)))
 
 PIC_OBJS := $(OBJS-y:.o=.opic)
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Aug 22 10:22:25 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 22 Aug 2022 10:22:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.391339.629110 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oQ4Zc-00066Q-Vg; Mon, 22 Aug 2022 10:22:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 391339.629110; Mon, 22 Aug 2022 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 1oQ4Zc-00066I-TB; Mon, 22 Aug 2022 10:22:24 +0000
Received: by outflank-mailman (input) for mailman id 391339;
 Mon, 22 Aug 2022 10:22:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQ4Zc-000662-5E
 for xen-changelog@lists.xenproject.org; Mon, 22 Aug 2022 10:22:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQ4Zc-0008PY-4Y
 for xen-changelog@lists.xenproject.org; Mon, 22 Aug 2022 10:22:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQ4Zc-00057N-3U
 for xen-changelog@lists.xenproject.org; Mon, 22 Aug 2022 10:22:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=W1Qb8/eW/ILYcJ3QsnRF1J+WuJwcG2yXbTur9+rFy74=; b=lvFer4RGXfgvj6KvJPEfsFHhsq
	kL1dLYLGOhbcDEG74BHskr9FBWQdzNoWVhBv2HdLfICo20solI58ECj6bDoRyHMAqg1EOdjaHrj3W
	cuL416FDgIJ804gxqwl76XDnmDkROHszrta2O1gHeRG5lNlZWTSWRmORqVJMzc6VBWog=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/helper: Cleanup Makefile
Message-Id: <E1oQ4Zc-00057N-3U@xenbits.xenproject.org>
Date: Mon, 22 Aug 2022 10:22:24 +0000

commit e7928439226f8cba2fdef7cbc86a747c4ec1e2b5
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Mon Aug 22 12:09:10 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 22 12:09:10 2022 +0200

    tools/helper: Cleanup Makefile
    
    Use $(TARGETS) to collect targets. Use := for the first target instead
    of +=.
    Collect library to link against in $(LDLIBS).
    Remove extra "-f" flags that is already part of $(RM).
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Tested-by: Luca Fancellu <luca.fancellu@arm.com>
---
 tools/helpers/Makefile | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/tools/helpers/Makefile b/tools/helpers/Makefile
index 8d78ab1e90..09590eb5b6 100644
--- a/tools/helpers/Makefile
+++ b/tools/helpers/Makefile
@@ -5,13 +5,13 @@
 XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-PROGS += xen-init-dom0
+TARGETS := xen-init-dom0
 ifeq ($(CONFIG_Linux),y)
 ifeq ($(CONFIG_X86),y)
-PROGS += init-xenstore-domain
+TARGETS += init-xenstore-domain
 endif
 ifeq ($(CONFIG_ARM),y)
-PROGS += init-dom0less
+TARGETS += init-dom0less
 endif
 endif
 
@@ -20,6 +20,7 @@ $(XEN_INIT_DOM0_OBJS): CFLAGS += $(CFLAGS_libxentoollog)
 $(XEN_INIT_DOM0_OBJS): CFLAGS += $(CFLAGS_libxenstore)
 $(XEN_INIT_DOM0_OBJS): CFLAGS += $(CFLAGS_libxenlight)
 $(XEN_INIT_DOM0_OBJS): CFLAGS += $(CFLAGS_libxenctrl)
+xen-init-dom0: LDLIBS += $(call xenlibs-ldlibs,ctrl toollog store light)
 
 INIT_XENSTORE_DOMAIN_OBJS = init-xenstore-domain.o init-dom-json.o
 $(INIT_XENSTORE_DOMAIN_OBJS): CFLAGS += $(CFLAGS_libxentoollog)
@@ -28,6 +29,7 @@ $(INIT_XENSTORE_DOMAIN_OBJS): CFLAGS += $(CFLAGS_libxenctrl)
 $(INIT_XENSTORE_DOMAIN_OBJS): CFLAGS += $(CFLAGS_libxenstore)
 $(INIT_XENSTORE_DOMAIN_OBJS): CFLAGS += $(CFLAGS_libxenlight)
 $(INIT_XENSTORE_DOMAIN_OBJS): CFLAGS += -include $(XEN_ROOT)/tools/config.h
+init-xenstore-domain: LDLIBS += $(call xenlibs-ldlibs,toollog store ctrl guest light)
 
 INIT_DOM0LESS_OBJS = init-dom0less.o init-dom-json.o
 $(INIT_DOM0LESS_OBJS): CFLAGS += $(CFLAGS_libxentoollog)
@@ -35,30 +37,31 @@ $(INIT_DOM0LESS_OBJS): CFLAGS += $(CFLAGS_libxenstore)
 $(INIT_DOM0LESS_OBJS): CFLAGS += $(CFLAGS_libxenlight)
 $(INIT_DOM0LESS_OBJS): CFLAGS += $(CFLAGS_libxenctrl)
 $(INIT_DOM0LESS_OBJS): CFLAGS += $(CFLAGS_libxenevtchn)
+init-dom0less: LDLIBS += $(call xenlibs-ldlibs,ctrl evtchn toollog store light guest foreignmemory)
 
 .PHONY: all
-all: $(PROGS)
+all: $(TARGETS)
 
 xen-init-dom0: $(XEN_INIT_DOM0_OBJS)
-	$(CC) $(LDFLAGS) -o $@ $(XEN_INIT_DOM0_OBJS) $(LDLIBS_libxenctrl) $(LDLIBS_libxentoollog) $(LDLIBS_libxenstore) $(LDLIBS_libxenlight) $(APPEND_LDFLAGS)
+	$(CC) $(LDFLAGS) -o $@ $(XEN_INIT_DOM0_OBJS) $(LDLIBS) $(APPEND_LDFLAGS)
 
 init-xenstore-domain: $(INIT_XENSTORE_DOMAIN_OBJS)
-	$(CC) $(LDFLAGS) -o $@ $(INIT_XENSTORE_DOMAIN_OBJS) $(LDLIBS_libxentoollog) $(LDLIBS_libxenstore) $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenlight) $(APPEND_LDFLAGS)
+	$(CC) $(LDFLAGS) -o $@ $(INIT_XENSTORE_DOMAIN_OBJS) $(LDLIBS) $(APPEND_LDFLAGS)
 
 init-dom0less: $(INIT_DOM0LESS_OBJS)
-	$(CC) $(LDFLAGS) -o $@ $(INIT_DOM0LESS_OBJS) $(LDLIBS_libxenctrl) $(LDLIBS_libxenevtchn) $(LDLIBS_libxentoollog) $(LDLIBS_libxenstore) $(LDLIBS_libxenlight) $(LDLIBS_libxenguest) $(LDLIBS_libxenforeignmemory) $(APPEND_LDFLAGS)
+	$(CC) $(LDFLAGS) -o $@ $(INIT_DOM0LESS_OBJS) $(LDLIBS) $(APPEND_LDFLAGS)
 
 .PHONY: install
 install: all
 	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
-	for i in $(PROGS); do $(INSTALL_PROG) $$i $(DESTDIR)$(LIBEXEC_BIN); done
+	for i in $(TARGETS); do $(INSTALL_PROG) $$i $(DESTDIR)$(LIBEXEC_BIN); done
 
 .PHONY: uninstall
 uninstall:
-	for i in $(PROGS); do rm -f $(DESTDIR)$(LIBEXEC_BIN)/$$i; done
+	for i in $(TARGETS); do rm -f $(DESTDIR)$(LIBEXEC_BIN)/$$i; done
 
 .PHONY: clean
 clean:
-	$(RM) -f *.o $(PROGS) $(DEPS_RM)
+	$(RM) *.o $(TARGETS) $(DEPS_RM)
 
 distclean: clean
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Aug 22 10:22:35 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 22 Aug 2022 10:22:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.391340.629115 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oQ4Zn-00068h-1M; Mon, 22 Aug 2022 10:22:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 391340.629115; Mon, 22 Aug 2022 10:22:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oQ4Zm-00068Z-Ue; Mon, 22 Aug 2022 10:22:34 +0000
Received: by outflank-mailman (input) for mailman id 391340;
 Mon, 22 Aug 2022 10:22:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQ4Zm-00068R-89
 for xen-changelog@lists.xenproject.org; Mon, 22 Aug 2022 10:22:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQ4Zm-0008Pz-7Q
 for xen-changelog@lists.xenproject.org; Mon, 22 Aug 2022 10:22:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQ4Zm-00057o-6W
 for xen-changelog@lists.xenproject.org; Mon, 22 Aug 2022 10:22:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=VkbLXhPCWBfpY0xGB4h+CWGVQh1RARxkdsjyc/BrkX8=; b=PJsRUey74q9wzwHe9oq+CAqEwR
	xFomg4MI5hOQitlpEFYBS1XWnsJ8Jwd9bB0V4Xi/KYdHEh00XfSN8gbaAfk/uJnH2D8pav0zhEo0r
	iE7obL6B3cWAjRxSqdmRVK8tHWb55q7OylfRsMGV1ApQlmHn/MzqjXgtE1d3fpOTXCO0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/console: Use $(xenlibs-ldlibs,)
Message-Id: <E1oQ4Zm-00057o-6W@xenbits.xenproject.org>
Date: Mon, 22 Aug 2022 10:22:34 +0000

commit f4036c96de6423c769a6dab237977ebdf90dbc22
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Mon Aug 22 12:09:13 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 22 12:09:13 2022 +0200

    tools/console: Use $(xenlibs-ldlibs,)
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
---
 tools/console/client/Makefile | 3 +--
 tools/console/daemon/Makefile | 6 +-----
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/tools/console/client/Makefile b/tools/console/client/Makefile
index 44176c6d93..e2f2554f92 100644
--- a/tools/console/client/Makefile
+++ b/tools/console/client/Makefile
@@ -6,8 +6,7 @@ CFLAGS += $(CFLAGS_libxenctrl)
 CFLAGS += $(CFLAGS_libxenstore)
 CFLAGS += -include $(XEN_ROOT)/tools/config.h
 
-LDLIBS += $(LDLIBS_libxenctrl)
-LDLIBS += $(LDLIBS_libxenstore)
+LDLIBS += $(call xenlibs-ldlibs,ctrl store)
 LDLIBS += $(SOCKET_LIBS)
 
 OBJS-y := main.o
diff --git a/tools/console/daemon/Makefile b/tools/console/daemon/Makefile
index 0f004f0b14..99bb33b6a2 100644
--- a/tools/console/daemon/Makefile
+++ b/tools/console/daemon/Makefile
@@ -10,11 +10,7 @@ CFLAGS += $(CFLAGS_libxenforeignmemory)
 CFLAGS-$(CONFIG_ARM) += -DCONFIG_ARM
 CFLAGS += -include $(XEN_ROOT)/tools/config.h
 
-LDLIBS += $(LDLIBS_libxenctrl)
-LDLIBS += $(LDLIBS_libxenstore)
-LDLIBS += $(LDLIBS_libxenevtchn)
-LDLIBS += $(LDLIBS_libxengnttab)
-LDLIBS += $(LDLIBS_libxenforeignmemory)
+LDLIBS += $(call xenlibs-ldlibs,ctrl store evtchn gnttab foreignmemory)
 LDLIBS += $(SOCKET_LIBS)
 LDLIBS += $(UTIL_LIBS)
 LDLIBS += -lrt
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Aug 22 10:22:45 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 22 Aug 2022 10:22:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.391341.629119 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oQ4Zx-0006B5-2Z; Mon, 22 Aug 2022 10:22:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 391341.629119; Mon, 22 Aug 2022 10:22:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oQ4Zw-0006Ax-WF; Mon, 22 Aug 2022 10:22:45 +0000
Received: by outflank-mailman (input) for mailman id 391341;
 Mon, 22 Aug 2022 10:22:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQ4Zw-0006Am-BA
 for xen-changelog@lists.xenproject.org; Mon, 22 Aug 2022 10:22:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQ4Zw-0008QD-AV
 for xen-changelog@lists.xenproject.org; Mon, 22 Aug 2022 10:22:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQ4Zw-00058H-9T
 for xen-changelog@lists.xenproject.org; Mon, 22 Aug 2022 10:22:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6QMKX8gZhqgLEnRx8vL8kBbIZJjD1NUlA2iKbpVD/E0=; b=qlBFl6HR1rKV5K7cLLcRt4ypzN
	y0EjnssKduhjMS4DzrdwTYDBgTaKmCSw6m7px+QZ6uA1CUZ4OMdgPh33286d/61y9PWTh937taPf6
	AZqTflPg67gsfCJCHdBeOE4V8CINLEZwU2v4vYvOAst1sBXVcbvCyEaV29U0/FMN9BYE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xenbaked: properly use time_t in dump_stats()
Message-Id: <E1oQ4Zw-00058H-9T@xenbits.xenproject.org>
Date: Mon, 22 Aug 2022 10:22:44 +0000

commit 722a61dbb5010507693593243dbba311d4e9c0b5
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Aug 22 12:10:00 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 22 12:10:00 2022 +0200

    xenbaked: properly use time_t in dump_stats()
    
    "int" is not a suitable type to convert time()'s return value to. Avoid
    casts and other extra fiddling by using difftime(), on the assumption
    that the overhead of using "double" doesn't matter here.
    
    Coverity ID: 1509374
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/xenmon/xenbaked.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/tools/xenmon/xenbaked.c b/tools/xenmon/xenbaked.c
index 7591de7c60..4dddbd20e2 100644
--- a/tools/xenmon/xenbaked.c
+++ b/tools/xenmon/xenbaked.c
@@ -230,11 +230,7 @@ static void check_gotten_sum(void)
 static void dump_stats(void) 
 {
     stat_map_t *smt = stat_map;
-    time_t end_time, run_time;
-
-    time(&end_time);
-
-    run_time = end_time - start_time;
+    double run_time = difftime(time(NULL), start_time);
 
     printf("Event counts:\n");
     while (smt->text != NULL) {
@@ -242,13 +238,11 @@ static void dump_stats(void)
         smt++;
     }
 
-    printf("processed %d total records in %d seconds (%ld per second)\n",
-           rec_count, (int)run_time,
-           run_time ? (long)(rec_count/run_time) : 0L);
+    printf("processed %d total records in %.0f seconds (%.0f per second)\n",
+           rec_count, run_time, run_time ? rec_count / run_time : 0);
 
-    printf("woke up %d times in %d seconds (%ld per second)\n",
-           wakeups, (int) run_time,
-           run_time ? (long)(wakeups/run_time) : 0L);
+    printf("woke up %d times in %.0f seconds (%.0f per second)\n",
+           wakeups, run_time, run_time ? wakeups / run_time : 0);
 
     check_gotten_sum();
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Aug 22 10:22:55 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 22 Aug 2022 10:22:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.391343.629123 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oQ4a7-0006EJ-4F; Mon, 22 Aug 2022 10:22:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 391343.629123; Mon, 22 Aug 2022 10:22:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oQ4a7-0006EC-1S; Mon, 22 Aug 2022 10:22:55 +0000
Received: by outflank-mailman (input) for mailman id 391343;
 Mon, 22 Aug 2022 10:22:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQ4a6-0006E2-EE
 for xen-changelog@lists.xenproject.org; Mon, 22 Aug 2022 10:22:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQ4a6-0008QP-DX
 for xen-changelog@lists.xenproject.org; Mon, 22 Aug 2022 10:22:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQ4a6-00058g-CT
 for xen-changelog@lists.xenproject.org; Mon, 22 Aug 2022 10:22:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=gTgM35nrWcrWN4BHfzXgTZhVnL5V3MgZP/wXf5zfBs4=; b=hPj/RzTGHdRJ2bdK0AohGqumw2
	raUBj1Em6MF/suMs2R8SMRwWsB+mqZwTbQwAUOW1LIVFho9suAgPg+XDiy//Wu9VeTn1LTMoNss0w
	p03MZxF5vJVmu9PKa2Wu9mXsM8IDFOpgxydIKCuDNerIAkHj3kmLKJLhdDpFzr2N1kew=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/elf: fix MISRA C 2012 Rule 20.7 violations
Message-Id: <E1oQ4a6-00058g-CT@xenbits.xenproject.org>
Date: Mon, 22 Aug 2022 10:22:54 +0000

commit c5659ef2dab3b4f538615e46a4990eea3101917c
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Mon Aug 22 12:10:28 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 22 12:10:28 2022 +0200

    xen/elf: fix MISRA C 2012 Rule 20.7 violations
    
    In macros ELF32_ST_TYPE() and ELF64_ST_TYPE(), add parentheses around the
    macro parameter to prevent against unintended expansions.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/include/xen/elfstructs.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/include/xen/elfstructs.h b/xen/include/xen/elfstructs.h
index 616ebf9269..06e6f87c3d 100644
--- a/xen/include/xen/elfstructs.h
+++ b/xen/include/xen/elfstructs.h
@@ -305,11 +305,11 @@ typedef struct {
 
 /* Extract symbol info - st_info */
 #define ELF32_ST_BIND(x)	((x) >> 4)
-#define ELF32_ST_TYPE(x)	(((unsigned int) x) & 0xf)
+#define ELF32_ST_TYPE(x)	(((unsigned int)(x)) & 0xf)
 #define ELF32_ST_INFO(b,t)	(((b) << 4) + ((t) & 0xf))
 
 #define ELF64_ST_BIND(x)	((x) >> 4)
-#define ELF64_ST_TYPE(x)	(((unsigned int) x) & 0xf)
+#define ELF64_ST_TYPE(x)	(((unsigned int)(x)) & 0xf)
 #define ELF64_ST_INFO(b,t)	(((b) << 4) + ((t) & 0xf))
 
 /* Symbol Binding - ELF32_ST_BIND - st_info */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Aug 22 10:23:05 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 22 Aug 2022 10:23:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.391344.629128 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oQ4aH-0006Jp-8I; Mon, 22 Aug 2022 10:23:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 391344.629128; Mon, 22 Aug 2022 10:23:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oQ4aH-0006Jh-4P; Mon, 22 Aug 2022 10:23:05 +0000
Received: by outflank-mailman (input) for mailman id 391344;
 Mon, 22 Aug 2022 10:23:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQ4aG-0006JG-HF
 for xen-changelog@lists.xenproject.org; Mon, 22 Aug 2022 10:23:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQ4aG-0008Qt-GU
 for xen-changelog@lists.xenproject.org; Mon, 22 Aug 2022 10:23:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQ4aG-00059I-FY
 for xen-changelog@lists.xenproject.org; Mon, 22 Aug 2022 10:23:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tIKglJzkrdp+j2KJqiJh2/DMur9Kf6Z1MMmJIf3DccI=; b=cmhjPtbNsaKW/RUzFR9wV+Qskg
	b4daUadN5pNoudFcx+7CsyBO/udH3RaYvbJf2Q2UJK5iiiLQlkpSiM8gJI1rv2EKAmxHbgZMzNjTX
	mtjzh84ebDHZkYsDwQYgl1VlYmWPmNjyuOfvpv0PG9+Iomm3RQNOTb5InBDmx+Pam2mY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/rbtree: fix MISRA C 2012 Rule 20.7 violation
Message-Id: <E1oQ4aG-00059I-FY@xenbits.xenproject.org>
Date: Mon, 22 Aug 2022 10:23:04 +0000

commit 696ee5ca9f4e2256e76056cf72a72001a9748f4c
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Mon Aug 22 12:11:45 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 22 12:11:45 2022 +0200

    xen/rbtree: fix MISRA C 2012 Rule 20.7 violation
    
    In macro __rb_parent(), add parentheses around the macro parameter to prevent
    against unintended expansions.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/lib/rbtree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/lib/rbtree.c b/xen/lib/rbtree.c
index 85a4f20313..eb418baabb 100644
--- a/xen/lib/rbtree.c
+++ b/xen/lib/rbtree.c
@@ -46,7 +46,7 @@
 #define		RB_RED		0
 #define		RB_BLACK	1
 
-#define __rb_parent(pc)    ((struct rb_node *)(pc & ~3))
+#define __rb_parent(pc)    ((struct rb_node *)((pc) & ~3))
 
 #define __rb_color(pc)     ((pc) & 1)
 #define __rb_is_black(pc)  __rb_color(pc)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Aug 23 11:33:11 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 23 Aug 2022 11:33:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.391919.629953 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oQS9Z-0002r0-RE; Tue, 23 Aug 2022 11:33:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 391919.629953; Tue, 23 Aug 2022 11:33:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oQS9Z-0002qs-N8; Tue, 23 Aug 2022 11:33:05 +0000
Received: by outflank-mailman (input) for mailman id 391919;
 Tue, 23 Aug 2022 11:33:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQS9Y-0002q0-8C
 for xen-changelog@lists.xenproject.org; Tue, 23 Aug 2022 11:33:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQS9Y-0001jl-5p
 for xen-changelog@lists.xenproject.org; Tue, 23 Aug 2022 11:33:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQS9Y-0004ZR-4g
 for xen-changelog@lists.xenproject.org; Tue, 23 Aug 2022 11:33:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+WDlw26ztxes3tgss3TBQVCBn/fvt250i/jym/ZoBUw=; b=YybdbjPlPG2sZ/S3XMKAyuZjJw
	FAMAnrUPuGQUqMqQqb+1HwPzUhsKYyIZNannRufOeJ8LOSGgl5xcE5hiv+pb/ReQ09yxd/PZld96K
	SzpWDp6gt/RR6n4uTWuKLAHNtr6PIEKtMNzn+aGt0Jeua0JG2xswTA/Hz58/nC16nrOg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/entry: Fix !PV build
Message-Id: <E1oQS9Y-0004ZR-4g@xenbits.xenproject.org>
Date: Tue, 23 Aug 2022 11:33:04 +0000

commit 8d9006cf4152cb8ef360ee12c4a1477992bbf85a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Aug 22 13:46:39 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Aug 23 12:22:05 2022 +0100

    x86/entry: Fix !PV build
    
    early_page_fault() needs to outside of #ifdef CONFIG_PV
    
    Spotted by Gitlab CI.
    
    Fixes: fe3f50726e87 ("x86/entry: move .init.text section higher up in the code for readability")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/x86_64/entry.S | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index 9b34150bc7..ae01285181 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -140,15 +140,6 @@ process_trap:
         call create_bounce_frame
         jmp  test_all_events
 
-        .section .init.text, "ax", @progbits
-ENTRY(early_page_fault)
-        ENDBR64
-        movl  $TRAP_page_fault, 4(%rsp)
-        SAVE_ALL
-        movq  %rsp, %rdi
-        call  do_early_page_fault
-        jmp   restore_all_xen
-
         .section .text.entry, "ax", @progbits
 
 /* %rbx: struct vcpu, interrupts disabled */
@@ -655,6 +646,15 @@ ret_from_intr:
         jmp   restore_all_xen
 #endif
 
+        .section .init.text, "ax", @progbits
+ENTRY(early_page_fault)
+        ENDBR64
+        movl  $TRAP_page_fault, 4(%rsp)
+        SAVE_ALL
+        movq  %rsp, %rdi
+        call  do_early_page_fault
+        jmp   restore_all_xen
+
         .section .text.entry, "ax", @progbits
 
         ALIGN
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Aug 23 11:33:15 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 23 Aug 2022 11:33:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.391920.629956 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oQS9j-0002tF-RP; Tue, 23 Aug 2022 11:33:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 391920.629956; Tue, 23 Aug 2022 11:33:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oQS9j-0002t7-Oq; Tue, 23 Aug 2022 11:33:15 +0000
Received: by outflank-mailman (input) for mailman id 391920;
 Tue, 23 Aug 2022 11:33:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQS9i-0002sy-Bl
 for xen-changelog@lists.xenproject.org; Tue, 23 Aug 2022 11:33:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQS9i-0001jp-Au
 for xen-changelog@lists.xenproject.org; Tue, 23 Aug 2022 11:33:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQS9i-0004Zv-8Z
 for xen-changelog@lists.xenproject.org; Tue, 23 Aug 2022 11:33:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tkyLdbWb2vewd8C8S/+4UwfuqosnHvTbQtptnovlwnM=; b=Arg/K4v1l30Tl67VYDKWULNUaA
	qEVvhemKhH6Rbr0TOs1mp8o1e54zYE5mr4QIizoQFhhuk+iGKifQs8UDMV+0tXlLVW1jwDpN4hgnJ
	hu5di81MnLusGk6MlOh+n82dNT7CDiEDpYmEAn3tv0TjVmwpP+FLW+K3Clzzzuvg368o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/domain: Fix struct domain memory corruption when building PV guests
Message-Id: <E1oQS9i-0004Zv-8Z@xenbits.xenproject.org>
Date: Tue, 23 Aug 2022 11:33:14 +0000

commit 399bcbf281bd936d1eff7f7d1054ab49115c3a44
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Aug 22 22:17:18 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Aug 23 12:22:05 2022 +0100

    x86/domain: Fix struct domain memory corruption when building PV guests
    
    arch_domain_create() can't blindly write into d->arch.hvm union.  Move the
    logic into hvm_domain_initialise(), which involves passing config down.
    
    Fixes: 2ce11ce249a3 ("x86/HVM: allow per-domain usage of hardware virtualized APIC")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/domain.c              | 8 +-------
 xen/arch/x86/hvm/hvm.c             | 9 ++++++++-
 xen/arch/x86/include/asm/hvm/hvm.h | 3 ++-
 3 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 15e7e77201..41e1e3f272 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -853,7 +853,7 @@ int arch_domain_create(struct domain *d,
 
     if ( is_hvm_domain(d) )
     {
-        if ( (rc = hvm_domain_initialise(d)) != 0 )
+        if ( (rc = hvm_domain_initialise(d, config)) != 0 )
             goto fail;
     }
     else if ( is_pv_domain(d) )
@@ -885,12 +885,6 @@ int arch_domain_create(struct domain *d,
 
     d->arch.msr_relaxed = config->arch.misc_flags & XEN_X86_MSR_RELAXED;
 
-    d->arch.hvm.assisted_xapic =
-        config->arch.misc_flags & XEN_X86_ASSISTED_XAPIC;
-
-    d->arch.hvm.assisted_x2apic =
-        config->arch.misc_flags & XEN_X86_ASSISTED_X2APIC;
-
     spec_ctrl_init_domain(d);
 
     return 0;
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 6b5d585ed4..44b432ec5a 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -576,7 +576,8 @@ static int cf_check hvm_print_line(
     return X86EMUL_OKAY;
 }
 
-int hvm_domain_initialise(struct domain *d)
+int hvm_domain_initialise(struct domain *d,
+                          const struct xen_domctl_createdomain *config)
 {
     unsigned int nr_gsis;
     int rc;
@@ -597,6 +598,12 @@ int hvm_domain_initialise(struct domain *d)
     INIT_LIST_HEAD(&d->arch.hvm.mmcfg_regions);
     INIT_LIST_HEAD(&d->arch.hvm.msix_tables);
 
+    d->arch.hvm.assisted_xapic =
+        config->arch.misc_flags & XEN_X86_ASSISTED_XAPIC;
+
+    d->arch.hvm.assisted_x2apic =
+        config->arch.misc_flags & XEN_X86_ASSISTED_X2APIC;
+
     rc = create_perdomain_mapping(d, PERDOMAIN_VIRT_START, 0, NULL, NULL);
     if ( rc )
         goto fail;
diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
index 03096f31ef..66836122e8 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -259,7 +259,8 @@ extern s8 hvm_port80_allowed;
 extern const struct hvm_function_table *start_svm(void);
 extern const struct hvm_function_table *start_vmx(void);
 
-int hvm_domain_initialise(struct domain *d);
+int hvm_domain_initialise(struct domain *d,
+                          const struct xen_domctl_createdomain *config);
 void hvm_domain_relinquish_resources(struct domain *d);
 void hvm_domain_destroy(struct domain *d);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Aug 23 13:22:06 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 23 Aug 2022 13:22:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.391972.630036 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oQTr1-0001Li-FQ; Tue, 23 Aug 2022 13:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 391972.630036; Tue, 23 Aug 2022 13:22:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oQTr1-0001Lb-Ch; Tue, 23 Aug 2022 13:22:03 +0000
Received: by outflank-mailman (input) for mailman id 391972;
 Tue, 23 Aug 2022 13:22:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQTr0-0001LR-49
 for xen-changelog@lists.xenproject.org; Tue, 23 Aug 2022 13:22:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQTr0-0003dP-3M
 for xen-changelog@lists.xenproject.org; Tue, 23 Aug 2022 13:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQTr0-0001Gg-2S
 for xen-changelog@lists.xenproject.org; Tue, 23 Aug 2022 13:22:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fQ6WB+F97Smlcq7DfR3Pc2hX5A4wj696SeEDdWPLiFs=; b=1Ky9kGps3TTf4DyMpVLn7jSjyT
	c3QyCivbHswsn/gqUQyT9ugl8DsF3B0b/nHGXI61jhgXkbBvEtze6hj14V0zQsxj7oRSh3EEWm1QZ
	NqX16nkOK6ojeMZUGjzY3WMBQVVVcugSc0lQgbpzE2xx43OCb3F6zutxBWvfJ/wQwnlU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] arm/domain: fix comment for arch_set_info_guest
Message-Id: <E1oQTr0-0001Gg-2S@xenbits.xenproject.org>
Date: Tue, 23 Aug 2022 13:22:02 +0000

commit 58ce731faca28cb08f7c1b8c79b59fed47d0b2c2
Author:     Luca Fancellu <luca.fancellu@arm.com>
AuthorDate: Fri Aug 5 14:08:00 2022 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Mon Aug 22 09:08:15 2022 +0100

    arm/domain: fix comment for arch_set_info_guest
    
    The function arch_set_info_guest is not reached anymore through
    VCPUOP_initialise on arm, update the comment.
    
    Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/domain.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index 2cd481979c..13df91c401 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -885,9 +885,8 @@ static int is_guest_pv64_psr(uint64_t psr)
 #endif
 
 /*
- * Initialise VCPU state. The context can be supplied by either the
- * toolstack (XEN_DOMCTL_setvcpucontext) or the guest
- * (VCPUOP_initialise) and therefore must be properly validated.
+ * Initialise vCPU state. The context may be supplied by an external entity, so
+ * we need to validate it.
  */
 int arch_set_info_guest(
     struct vcpu *v, vcpu_guest_context_u c)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Aug 23 13:22:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 23 Aug 2022 13:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.391973.630041 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oQTrB-0001O1-Gw; Tue, 23 Aug 2022 13:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 391973.630041; Tue, 23 Aug 2022 13: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 1oQTrB-0001Nt-EF; Tue, 23 Aug 2022 13:22:13 +0000
Received: by outflank-mailman (input) for mailman id 391973;
 Tue, 23 Aug 2022 13:22:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQTrA-0001Na-7N
 for xen-changelog@lists.xenproject.org; Tue, 23 Aug 2022 13:22:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQTrA-0003dd-6b
 for xen-changelog@lists.xenproject.org; Tue, 23 Aug 2022 13:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQTrA-0001H5-5d
 for xen-changelog@lists.xenproject.org; Tue, 23 Aug 2022 13:22:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=sflJBDw++g4hxhlYIyMgxlbYjmFq2gP7rgwG/bF3XiU=; b=w1d/0jzTa+KnJ4/yzwkfjLXL3h
	DHFfgB81+bRUc32/PPY9bDrT0XVAeUXcRGGW+8+QO+8yo/oTl7bNLXFoEmvh7GvKuf1ro4AwWhPE0
	Jn1bFIni+UBV3uE4JWbmoqLN2CXQvMMA3jZRtPRYcxty3FrZNFBBpHltw5S9DOa8sx5w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools: Introduce $(xenlibs-rpath,..) to replace $(SHDEPS_lib*)
Message-Id: <E1oQTrA-0001H5-5d@xenbits.xenproject.org>
Date: Tue, 23 Aug 2022 13:22:12 +0000

commit d2b396d47bd9071232c103501aadb32d7b83fdbb
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Mon Aug 22 12:09:05 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 22 12:09:05 2022 +0200

    tools: Introduce $(xenlibs-rpath,..) to replace $(SHDEPS_lib*)
    
    This patch introduce a new macro $(xenlibs-dependencies,) to generate
    a list of all the xen library that a library is list against, and they
    are listed only once. We use the side effect of $(sort ) which remove
    duplicates.
    
    This is used by another macro $(xenlibs-rpath,) which is to replace
    $(SHDEPS_libxen*).
    
    In libs.mk, we don't need to $(sort ) SHLIB_lib* anymore as this was used
    to remove duplicates and they are no more duplicates.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 tools/Rules.mk     | 29 ++++++++++++++++-------------
 tools/libs/libs.mk |  2 +-
 2 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/tools/Rules.mk b/tools/Rules.mk
index 47424935ba..23979ed254 100644
--- a/tools/Rules.mk
+++ b/tools/Rules.mk
@@ -61,13 +61,8 @@ endif
 #           public headers. Users of libfoo are therefore transitively
 #           using libbaz's header but not linking against libbaz.
 #
-# SHDEPS_libfoo: Flags for linking recursive dependencies of
-#                libfoo. Must contain SHLIB for every library which
-#                libfoo links against. So must contain both
-#                $(SHLIB_libbar) and $(SHLIB_libbaz).
-#
 # SHLIB_libfoo: Flags for recursively linking against libfoo. Must
-#               contains SHDEPS_libfoo and:
+#               contains $(call xenlibs-rpath,foo) and:
 #                   -Wl,-rpath-link=<directory containing libfoo.so>
 #
 # CFLAGS_libfoo: Flags for compiling against libfoo. Must add the
@@ -79,23 +74,31 @@ endif
 #                libfoo.
 #
 # LDLIBS_libfoo: Flags for linking against libfoo. Must contain
-#                $(SHDEPS_libfoo) and the path to libfoo.so
+#                $(call xenlibs-rpath,foo) and the path to libfoo.so
 #
 # Consumers of libfoo should include $(CFLAGS_libfoo) and
 # $(LDLIBS_libfoo) in their appropriate directories. They should not
 # include any CFLAGS or LDLIBS relating to libbar or libbaz unless
 # they use those libraries directly (not via libfoo) too.
-#
-# Consumers of libfoo should not directly use $(SHDEPS_libfoo) or
-# $(SHLIB_libfoo)
+
+# Give the list of Xen library that the libraries in $(1) are linked against,
+# directly or indirectly.
+define xenlibs-dependencies
+    $(sort $(foreach lib,$(1), \
+        $(USELIBS_$(lib)) $(call xenlibs-dependencies,$(USELIBS_$(lib)))))
+endef
+
+# Flags for linking recursive dependencies of Xen libraries in $(1)
+define xenlibs-rpath
+    $(addprefix -Wl$(comma)-rpath-link=$(XEN_ROOT)/tools/libs/,$(call xenlibs-dependencies,$(1)))
+endef
 
 define LIB_defs
  FILENAME_$(1) ?= xen$(1)
  XEN_libxen$(1) = $$(XEN_ROOT)/tools/libs/$(1)
  CFLAGS_libxen$(1) = $$(CFLAGS_xeninclude)
- SHDEPS_libxen$(1) = $$(foreach use,$$(USELIBS_$(1)),$$(SHLIB_libxen$$(use)))
- LDLIBS_libxen$(1) = $$(SHDEPS_libxen$(1)) $$(XEN_libxen$(1))/lib$$(FILENAME_$(1))$$(libextension)
- SHLIB_libxen$(1) = $$(SHDEPS_libxen$(1)) -Wl,-rpath-link=$$(XEN_libxen$(1))
+ SHLIB_libxen$(1) = $$(call xenlibs-rpath,$(1)) -Wl,-rpath-link=$$(XEN_libxen$(1))
+ LDLIBS_libxen$(1) = $$(call xenlibs-rpath,$(1)) $$(XEN_libxen$(1))/lib$$(FILENAME_$(1))$$(libextension)
 endef
 
 $(foreach lib,$(LIBS_LIBS),$(eval $(call LIB_defs,$(lib))))
diff --git a/tools/libs/libs.mk b/tools/libs/libs.mk
index f778a7df82..d7e1274249 100644
--- a/tools/libs/libs.mk
+++ b/tools/libs/libs.mk
@@ -32,7 +32,7 @@ PKG_CONFIG ?= $(LIB_FILE_NAME).pc
 PKG_CONFIG_NAME ?= Xen$(LIBNAME)
 PKG_CONFIG_DESC ?= The $(PKG_CONFIG_NAME) library for Xen hypervisor
 PKG_CONFIG_VERSION := $(MAJOR).$(MINOR)
-PKG_CONFIG_USELIBS := $(sort $(SHLIB_libxen$(LIBNAME)))
+PKG_CONFIG_USELIBS := $(SHLIB_libxen$(LIBNAME))
 PKG_CONFIG_LIB := $(LIB_FILE_NAME)
 PKG_CONFIG_REQPRIV := $(subst $(space),$(comma),$(strip $(foreach lib,$(patsubst ctrl,control,$(USELIBS_$(LIBNAME))),xen$(lib))))
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Aug 23 13:22:23 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 23 Aug 2022 13:22:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.391975.630045 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oQTrL-0001Qt-IK; Tue, 23 Aug 2022 13:22:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 391975.630045; Tue, 23 Aug 2022 13: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 1oQTrL-0001Ql-Fi; Tue, 23 Aug 2022 13:22:23 +0000
Received: by outflank-mailman (input) for mailman id 391975;
 Tue, 23 Aug 2022 13:22:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQTrK-0001Qa-AG
 for xen-changelog@lists.xenproject.org; Tue, 23 Aug 2022 13:22:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQTrK-0003do-9W
 for xen-changelog@lists.xenproject.org; Tue, 23 Aug 2022 13:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQTrK-0001HU-8f
 for xen-changelog@lists.xenproject.org; Tue, 23 Aug 2022 13:22:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=YpHR1Mn+7eHdxpur/QYOIs7xrR/tImT8QtYNyCyBBXU=; b=BwjPM4J/pQ6maMABYlTFoCg6VC
	CM4n5smHzlssiBoiC/sjZWv1j3L7lZpmQlSFZHrk6bOfFeeDFgjNapXwu+0URjpnc4k6Xo4PQMnAQ
	ym3f3xGmEGkRqxHpyeHM6he6tZmjMejZFLOO79NfyoBZjSRZYTVMknCIZJzLWedyIrvg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools: Introduce $(xenlibs-ldlibs, ) macro
Message-Id: <E1oQTrK-0001HU-8f@xenbits.xenproject.org>
Date: Tue, 23 Aug 2022 13:22:22 +0000

commit 7f2a5e368e54884b032982b5394b8ffc3ace5a8a
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Mon Aug 22 12:09:07 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 22 12:09:07 2022 +0200

    tools: Introduce $(xenlibs-ldlibs, ) macro
    
    This can be used when linking against multiple in-tree Xen libraries,
    and avoid duplicated flags. It can be used instead of multiple
    $(LDLIBS_libxen*).
    
    For now, replace the open-coding in libs.mk.
    
    The macro $(xenlibs-libs, ) will be useful later when only the path to
    the libraries is wanted (e.g. for checking for dependencies).
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 tools/Rules.mk     | 16 ++++++++++++++--
 tools/libs/libs.mk |  2 +-
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/tools/Rules.mk b/tools/Rules.mk
index 23979ed254..ce77dd2eb1 100644
--- a/tools/Rules.mk
+++ b/tools/Rules.mk
@@ -93,12 +93,24 @@ define xenlibs-rpath
     $(addprefix -Wl$(comma)-rpath-link=$(XEN_ROOT)/tools/libs/,$(call xenlibs-dependencies,$(1)))
 endef
 
+# Provide a path for each library in $(1)
+define xenlibs-libs
+    $(foreach lib,$(1), \
+        $(XEN_ROOT)/tools/libs/$(lib)/lib$(FILENAME_$(lib))$(libextension))
+endef
+
+# Flags for linking against all Xen libraries listed in $(1)
+define xenlibs-ldlibs
+    $(call xenlibs-rpath,$(1)) $(call xenlibs-libs,$(1)) \
+    $(foreach lib,$(1),$(xenlibs-ldlibs-$(lib)))
+endef
+
 define LIB_defs
  FILENAME_$(1) ?= xen$(1)
  XEN_libxen$(1) = $$(XEN_ROOT)/tools/libs/$(1)
  CFLAGS_libxen$(1) = $$(CFLAGS_xeninclude)
  SHLIB_libxen$(1) = $$(call xenlibs-rpath,$(1)) -Wl,-rpath-link=$$(XEN_libxen$(1))
- LDLIBS_libxen$(1) = $$(call xenlibs-rpath,$(1)) $$(XEN_libxen$(1))/lib$$(FILENAME_$(1))$$(libextension)
+ LDLIBS_libxen$(1) = $$(call xenlibs-ldlibs,$(1))
 endef
 
 $(foreach lib,$(LIBS_LIBS),$(eval $(call LIB_defs,$(lib))))
@@ -108,7 +120,7 @@ $(foreach lib,$(LIBS_LIBS),$(eval $(call LIB_defs,$(lib))))
 CFLAGS_libxenctrl += -D__XEN_TOOLS__
 
 ifeq ($(CONFIG_Linux),y)
-LDLIBS_libxenstore += -ldl
+xenlibs-ldlibs-store := -ldl
 endif
 
 CFLAGS_libxenlight += $(CFLAGS_libxenctrl)
diff --git a/tools/libs/libs.mk b/tools/libs/libs.mk
index d7e1274249..2b8e7a6128 100644
--- a/tools/libs/libs.mk
+++ b/tools/libs/libs.mk
@@ -18,7 +18,7 @@ CFLAGS   += -Werror -Wmissing-prototypes
 CFLAGS   += $(CFLAGS_xeninclude)
 CFLAGS   += $(foreach lib, $(USELIBS_$(LIBNAME)), $(CFLAGS_libxen$(lib)))
 
-LDLIBS += $(foreach lib, $(USELIBS_$(LIBNAME)), $(LDLIBS_libxen$(lib)))
+LDLIBS += $(call xenlibs-ldlibs,$(USELIBS_$(LIBNAME)))
 
 PIC_OBJS := $(OBJS-y:.o=.opic)
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Aug 23 13:22:33 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 23 Aug 2022 13:22:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.391976.630048 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oQTrV-0001Tg-Jg; Tue, 23 Aug 2022 13:22:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 391976.630048; Tue, 23 Aug 2022 13: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 1oQTrV-0001TZ-HB; Tue, 23 Aug 2022 13:22:33 +0000
Received: by outflank-mailman (input) for mailman id 391976;
 Tue, 23 Aug 2022 13:22:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQTrU-0001TO-D1
 for xen-changelog@lists.xenproject.org; Tue, 23 Aug 2022 13:22:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQTrU-0003dy-CG
 for xen-changelog@lists.xenproject.org; Tue, 23 Aug 2022 13:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQTrU-0001Ht-BV
 for xen-changelog@lists.xenproject.org; Tue, 23 Aug 2022 13:22:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yJRY7BGNGSsuRdyjWSlVaDuJIzpWVzWoPcl16xuKPtg=; b=cNMTl2pBnvGFwrOXlq1UB4NfOn
	O58C2DWoV2gFJCMf9TIdsls1+FCp5eJ5UHx8foiv7HU1utswQmHdQ3IS01d15/JLYY+nl/1xkyZnZ
	KMQgbg1Etg3hqc3RUEfgpuOLDAntf1dwCPA/KefTLPIjs6nKANdX7YRGTZ1yfR7dy6EM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/helper: Cleanup Makefile
Message-Id: <E1oQTrU-0001Ht-BV@xenbits.xenproject.org>
Date: Tue, 23 Aug 2022 13:22:32 +0000

commit e7928439226f8cba2fdef7cbc86a747c4ec1e2b5
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Mon Aug 22 12:09:10 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 22 12:09:10 2022 +0200

    tools/helper: Cleanup Makefile
    
    Use $(TARGETS) to collect targets. Use := for the first target instead
    of +=.
    Collect library to link against in $(LDLIBS).
    Remove extra "-f" flags that is already part of $(RM).
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Tested-by: Luca Fancellu <luca.fancellu@arm.com>
---
 tools/helpers/Makefile | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/tools/helpers/Makefile b/tools/helpers/Makefile
index 8d78ab1e90..09590eb5b6 100644
--- a/tools/helpers/Makefile
+++ b/tools/helpers/Makefile
@@ -5,13 +5,13 @@
 XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-PROGS += xen-init-dom0
+TARGETS := xen-init-dom0
 ifeq ($(CONFIG_Linux),y)
 ifeq ($(CONFIG_X86),y)
-PROGS += init-xenstore-domain
+TARGETS += init-xenstore-domain
 endif
 ifeq ($(CONFIG_ARM),y)
-PROGS += init-dom0less
+TARGETS += init-dom0less
 endif
 endif
 
@@ -20,6 +20,7 @@ $(XEN_INIT_DOM0_OBJS): CFLAGS += $(CFLAGS_libxentoollog)
 $(XEN_INIT_DOM0_OBJS): CFLAGS += $(CFLAGS_libxenstore)
 $(XEN_INIT_DOM0_OBJS): CFLAGS += $(CFLAGS_libxenlight)
 $(XEN_INIT_DOM0_OBJS): CFLAGS += $(CFLAGS_libxenctrl)
+xen-init-dom0: LDLIBS += $(call xenlibs-ldlibs,ctrl toollog store light)
 
 INIT_XENSTORE_DOMAIN_OBJS = init-xenstore-domain.o init-dom-json.o
 $(INIT_XENSTORE_DOMAIN_OBJS): CFLAGS += $(CFLAGS_libxentoollog)
@@ -28,6 +29,7 @@ $(INIT_XENSTORE_DOMAIN_OBJS): CFLAGS += $(CFLAGS_libxenctrl)
 $(INIT_XENSTORE_DOMAIN_OBJS): CFLAGS += $(CFLAGS_libxenstore)
 $(INIT_XENSTORE_DOMAIN_OBJS): CFLAGS += $(CFLAGS_libxenlight)
 $(INIT_XENSTORE_DOMAIN_OBJS): CFLAGS += -include $(XEN_ROOT)/tools/config.h
+init-xenstore-domain: LDLIBS += $(call xenlibs-ldlibs,toollog store ctrl guest light)
 
 INIT_DOM0LESS_OBJS = init-dom0less.o init-dom-json.o
 $(INIT_DOM0LESS_OBJS): CFLAGS += $(CFLAGS_libxentoollog)
@@ -35,30 +37,31 @@ $(INIT_DOM0LESS_OBJS): CFLAGS += $(CFLAGS_libxenstore)
 $(INIT_DOM0LESS_OBJS): CFLAGS += $(CFLAGS_libxenlight)
 $(INIT_DOM0LESS_OBJS): CFLAGS += $(CFLAGS_libxenctrl)
 $(INIT_DOM0LESS_OBJS): CFLAGS += $(CFLAGS_libxenevtchn)
+init-dom0less: LDLIBS += $(call xenlibs-ldlibs,ctrl evtchn toollog store light guest foreignmemory)
 
 .PHONY: all
-all: $(PROGS)
+all: $(TARGETS)
 
 xen-init-dom0: $(XEN_INIT_DOM0_OBJS)
-	$(CC) $(LDFLAGS) -o $@ $(XEN_INIT_DOM0_OBJS) $(LDLIBS_libxenctrl) $(LDLIBS_libxentoollog) $(LDLIBS_libxenstore) $(LDLIBS_libxenlight) $(APPEND_LDFLAGS)
+	$(CC) $(LDFLAGS) -o $@ $(XEN_INIT_DOM0_OBJS) $(LDLIBS) $(APPEND_LDFLAGS)
 
 init-xenstore-domain: $(INIT_XENSTORE_DOMAIN_OBJS)
-	$(CC) $(LDFLAGS) -o $@ $(INIT_XENSTORE_DOMAIN_OBJS) $(LDLIBS_libxentoollog) $(LDLIBS_libxenstore) $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenlight) $(APPEND_LDFLAGS)
+	$(CC) $(LDFLAGS) -o $@ $(INIT_XENSTORE_DOMAIN_OBJS) $(LDLIBS) $(APPEND_LDFLAGS)
 
 init-dom0less: $(INIT_DOM0LESS_OBJS)
-	$(CC) $(LDFLAGS) -o $@ $(INIT_DOM0LESS_OBJS) $(LDLIBS_libxenctrl) $(LDLIBS_libxenevtchn) $(LDLIBS_libxentoollog) $(LDLIBS_libxenstore) $(LDLIBS_libxenlight) $(LDLIBS_libxenguest) $(LDLIBS_libxenforeignmemory) $(APPEND_LDFLAGS)
+	$(CC) $(LDFLAGS) -o $@ $(INIT_DOM0LESS_OBJS) $(LDLIBS) $(APPEND_LDFLAGS)
 
 .PHONY: install
 install: all
 	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
-	for i in $(PROGS); do $(INSTALL_PROG) $$i $(DESTDIR)$(LIBEXEC_BIN); done
+	for i in $(TARGETS); do $(INSTALL_PROG) $$i $(DESTDIR)$(LIBEXEC_BIN); done
 
 .PHONY: uninstall
 uninstall:
-	for i in $(PROGS); do rm -f $(DESTDIR)$(LIBEXEC_BIN)/$$i; done
+	for i in $(TARGETS); do rm -f $(DESTDIR)$(LIBEXEC_BIN)/$$i; done
 
 .PHONY: clean
 clean:
-	$(RM) -f *.o $(PROGS) $(DEPS_RM)
+	$(RM) *.o $(TARGETS) $(DEPS_RM)
 
 distclean: clean
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Aug 23 13:22:43 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 23 Aug 2022 13:22:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.391977.630053 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oQTrf-0001Wj-LC; Tue, 23 Aug 2022 13:22:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 391977.630053; Tue, 23 Aug 2022 13: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 1oQTrf-0001Wb-Ib; Tue, 23 Aug 2022 13:22:43 +0000
Received: by outflank-mailman (input) for mailman id 391977;
 Tue, 23 Aug 2022 13:22:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQTre-0001WL-G4
 for xen-changelog@lists.xenproject.org; Tue, 23 Aug 2022 13:22:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQTre-0003eO-FJ
 for xen-changelog@lists.xenproject.org; Tue, 23 Aug 2022 13:22:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQTre-0001IK-EE
 for xen-changelog@lists.xenproject.org; Tue, 23 Aug 2022 13:22:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=bfhtSP1vbN5EhZ+oyLBTGfUxVPokCcZbEjvMOlycRZQ=; b=WWvEeySjQxFPropO4tmWnGxbOH
	z6K7Ed3s857ICHiamkLhhUIoffAZasU0gPNA6H8jeJo+oime6wezMmmfGCI2qqjf+5izPnNbC+lt1
	Qq4mv39V+ymf7pq9YjplaFPrXPGqE1BefwXc49gHhl27QKNiIUZH04dOaScLTnYbc4gI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/console: Use $(xenlibs-ldlibs,)
Message-Id: <E1oQTre-0001IK-EE@xenbits.xenproject.org>
Date: Tue, 23 Aug 2022 13:22:42 +0000

commit f4036c96de6423c769a6dab237977ebdf90dbc22
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Mon Aug 22 12:09:13 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 22 12:09:13 2022 +0200

    tools/console: Use $(xenlibs-ldlibs,)
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
---
 tools/console/client/Makefile | 3 +--
 tools/console/daemon/Makefile | 6 +-----
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/tools/console/client/Makefile b/tools/console/client/Makefile
index 44176c6d93..e2f2554f92 100644
--- a/tools/console/client/Makefile
+++ b/tools/console/client/Makefile
@@ -6,8 +6,7 @@ CFLAGS += $(CFLAGS_libxenctrl)
 CFLAGS += $(CFLAGS_libxenstore)
 CFLAGS += -include $(XEN_ROOT)/tools/config.h
 
-LDLIBS += $(LDLIBS_libxenctrl)
-LDLIBS += $(LDLIBS_libxenstore)
+LDLIBS += $(call xenlibs-ldlibs,ctrl store)
 LDLIBS += $(SOCKET_LIBS)
 
 OBJS-y := main.o
diff --git a/tools/console/daemon/Makefile b/tools/console/daemon/Makefile
index 0f004f0b14..99bb33b6a2 100644
--- a/tools/console/daemon/Makefile
+++ b/tools/console/daemon/Makefile
@@ -10,11 +10,7 @@ CFLAGS += $(CFLAGS_libxenforeignmemory)
 CFLAGS-$(CONFIG_ARM) += -DCONFIG_ARM
 CFLAGS += -include $(XEN_ROOT)/tools/config.h
 
-LDLIBS += $(LDLIBS_libxenctrl)
-LDLIBS += $(LDLIBS_libxenstore)
-LDLIBS += $(LDLIBS_libxenevtchn)
-LDLIBS += $(LDLIBS_libxengnttab)
-LDLIBS += $(LDLIBS_libxenforeignmemory)
+LDLIBS += $(call xenlibs-ldlibs,ctrl store evtchn gnttab foreignmemory)
 LDLIBS += $(SOCKET_LIBS)
 LDLIBS += $(UTIL_LIBS)
 LDLIBS += -lrt
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Aug 23 13:22:53 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 23 Aug 2022 13:22:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.391978.630058 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oQTrp-0001Zc-Mz; Tue, 23 Aug 2022 13:22:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 391978.630058; Tue, 23 Aug 2022 13: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 1oQTrp-0001ZU-K0; Tue, 23 Aug 2022 13:22:53 +0000
Received: by outflank-mailman (input) for mailman id 391978;
 Tue, 23 Aug 2022 13:22:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQTro-0001ZM-Iu
 for xen-changelog@lists.xenproject.org; Tue, 23 Aug 2022 13:22:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQTro-0003eY-ID
 for xen-changelog@lists.xenproject.org; Tue, 23 Aug 2022 13:22:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQTro-0001Il-HO
 for xen-changelog@lists.xenproject.org; Tue, 23 Aug 2022 13:22:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Y11+sKg9uFLGOs44glWfyxpWXBmAXYc74XTdYAOW4Is=; b=0mi2RlNX8qOEUwAYFCngEpm9+e
	H5Gc/7TRqg3H4e6qw8DONTYHIgFTlVh4NjeURMSEUc9hdNacLOdE3BaO2lYCS9aJV133A6KE4cY5j
	uqopXZZgKXRr3+41xFzWKopBv58pTUon0fyVPO4/xEEsTT+pCV/SUZXnyejtMyLCaPeE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xenbaked: properly use time_t in dump_stats()
Message-Id: <E1oQTro-0001Il-HO@xenbits.xenproject.org>
Date: Tue, 23 Aug 2022 13:22:52 +0000

commit 722a61dbb5010507693593243dbba311d4e9c0b5
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Aug 22 12:10:00 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 22 12:10:00 2022 +0200

    xenbaked: properly use time_t in dump_stats()
    
    "int" is not a suitable type to convert time()'s return value to. Avoid
    casts and other extra fiddling by using difftime(), on the assumption
    that the overhead of using "double" doesn't matter here.
    
    Coverity ID: 1509374
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/xenmon/xenbaked.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/tools/xenmon/xenbaked.c b/tools/xenmon/xenbaked.c
index 7591de7c60..4dddbd20e2 100644
--- a/tools/xenmon/xenbaked.c
+++ b/tools/xenmon/xenbaked.c
@@ -230,11 +230,7 @@ static void check_gotten_sum(void)
 static void dump_stats(void) 
 {
     stat_map_t *smt = stat_map;
-    time_t end_time, run_time;
-
-    time(&end_time);
-
-    run_time = end_time - start_time;
+    double run_time = difftime(time(NULL), start_time);
 
     printf("Event counts:\n");
     while (smt->text != NULL) {
@@ -242,13 +238,11 @@ static void dump_stats(void)
         smt++;
     }
 
-    printf("processed %d total records in %d seconds (%ld per second)\n",
-           rec_count, (int)run_time,
-           run_time ? (long)(rec_count/run_time) : 0L);
+    printf("processed %d total records in %.0f seconds (%.0f per second)\n",
+           rec_count, run_time, run_time ? rec_count / run_time : 0);
 
-    printf("woke up %d times in %d seconds (%ld per second)\n",
-           wakeups, (int) run_time,
-           run_time ? (long)(wakeups/run_time) : 0L);
+    printf("woke up %d times in %.0f seconds (%.0f per second)\n",
+           wakeups, run_time, run_time ? wakeups / run_time : 0);
 
     check_gotten_sum();
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Aug 23 13:23:04 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 23 Aug 2022 13:23:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.391979.630060 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oQTs0-0001dD-Oa; Tue, 23 Aug 2022 13:23:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 391979.630060; Tue, 23 Aug 2022 13:23:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oQTs0-0001d6-Lb; Tue, 23 Aug 2022 13:23:04 +0000
Received: by outflank-mailman (input) for mailman id 391979;
 Tue, 23 Aug 2022 13:23:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQTry-0001bc-Lu
 for xen-changelog@lists.xenproject.org; Tue, 23 Aug 2022 13:23:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQTry-0003f3-L9
 for xen-changelog@lists.xenproject.org; Tue, 23 Aug 2022 13:23:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQTry-0001JL-KF
 for xen-changelog@lists.xenproject.org; Tue, 23 Aug 2022 13:23:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Ue6tfAm4iX4yH/JNBxcplpJM+lBG6/OiObbiFwO4bhk=; b=KVtPraBC8IIuyyXcTshe/y64H4
	bqoLdy2o75x9JMUdXtcvVTs47OEoC0H7X6ETExrOzEEnVeHxg+ohF7xPrLIKHTQQscBvG08SukVCo
	YAnbYTeLWSNZ6LkBtL05LFoS5n4Q6d4WAbfZLdiY4S5BFZyVFKvoh0RvLaDDaOJT/SqU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/elf: fix MISRA C 2012 Rule 20.7 violations
Message-Id: <E1oQTry-0001JL-KF@xenbits.xenproject.org>
Date: Tue, 23 Aug 2022 13:23:02 +0000

commit c5659ef2dab3b4f538615e46a4990eea3101917c
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Mon Aug 22 12:10:28 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 22 12:10:28 2022 +0200

    xen/elf: fix MISRA C 2012 Rule 20.7 violations
    
    In macros ELF32_ST_TYPE() and ELF64_ST_TYPE(), add parentheses around the
    macro parameter to prevent against unintended expansions.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/include/xen/elfstructs.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/include/xen/elfstructs.h b/xen/include/xen/elfstructs.h
index 616ebf9269..06e6f87c3d 100644
--- a/xen/include/xen/elfstructs.h
+++ b/xen/include/xen/elfstructs.h
@@ -305,11 +305,11 @@ typedef struct {
 
 /* Extract symbol info - st_info */
 #define ELF32_ST_BIND(x)	((x) >> 4)
-#define ELF32_ST_TYPE(x)	(((unsigned int) x) & 0xf)
+#define ELF32_ST_TYPE(x)	(((unsigned int)(x)) & 0xf)
 #define ELF32_ST_INFO(b,t)	(((b) << 4) + ((t) & 0xf))
 
 #define ELF64_ST_BIND(x)	((x) >> 4)
-#define ELF64_ST_TYPE(x)	(((unsigned int) x) & 0xf)
+#define ELF64_ST_TYPE(x)	(((unsigned int)(x)) & 0xf)
 #define ELF64_ST_INFO(b,t)	(((b) << 4) + ((t) & 0xf))
 
 /* Symbol Binding - ELF32_ST_BIND - st_info */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Aug 23 13:23:14 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 23 Aug 2022 13:23:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.391980.630064 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oQTsA-0001h2-SN; Tue, 23 Aug 2022 13:23:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 391980.630064; Tue, 23 Aug 2022 13:23:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oQTsA-0001gu-Pd; Tue, 23 Aug 2022 13:23:14 +0000
Received: by outflank-mailman (input) for mailman id 391980;
 Tue, 23 Aug 2022 13:23:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQTs8-0001gj-Oo
 for xen-changelog@lists.xenproject.org; Tue, 23 Aug 2022 13:23:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQTs8-0003fF-O6
 for xen-changelog@lists.xenproject.org; Tue, 23 Aug 2022 13:23:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQTs8-0001Jm-NB
 for xen-changelog@lists.xenproject.org; Tue, 23 Aug 2022 13:23:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MNGf/yHWKOYKSiox7vAYvk4yedhRaHyb+CVzIrBXVMg=; b=oVSO+2OpNT1CO/0gUn1WO6In0o
	r5u5HCmlwQgFuKay+4gWkSMxoMvS/R14c6KWOs6Qigbgk25k8c0mAbs9skC9Q3MZs1qoIMgzhEP2x
	GZJDlGA4g57/6gkF3tRyuv/fNB/VNxM/SKQtyOWsozLZ63WL+4L2rwMu/0COBsEUsJtc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/rbtree: fix MISRA C 2012 Rule 20.7 violation
Message-Id: <E1oQTs8-0001Jm-NB@xenbits.xenproject.org>
Date: Tue, 23 Aug 2022 13:23:12 +0000

commit 696ee5ca9f4e2256e76056cf72a72001a9748f4c
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Mon Aug 22 12:11:45 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 22 12:11:45 2022 +0200

    xen/rbtree: fix MISRA C 2012 Rule 20.7 violation
    
    In macro __rb_parent(), add parentheses around the macro parameter to prevent
    against unintended expansions.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/lib/rbtree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/lib/rbtree.c b/xen/lib/rbtree.c
index 85a4f20313..eb418baabb 100644
--- a/xen/lib/rbtree.c
+++ b/xen/lib/rbtree.c
@@ -46,7 +46,7 @@
 #define		RB_RED		0
 #define		RB_BLACK	1
 
-#define __rb_parent(pc)    ((struct rb_node *)(pc & ~3))
+#define __rb_parent(pc)    ((struct rb_node *)((pc) & ~3))
 
 #define __rb_color(pc)     ((pc) & 1)
 #define __rb_is_black(pc)  __rb_color(pc)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Aug 24 08:55:11 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Aug 2022 08:55:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.392293.630537 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oQmAE-0005Cz-Dm; Wed, 24 Aug 2022 08:55:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 392293.630537; Wed, 24 Aug 2022 08:55:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oQmAE-0005Cr-B8; Wed, 24 Aug 2022 08:55:06 +0000
Received: by outflank-mailman (input) for mailman id 392293;
 Wed, 24 Aug 2022 08:55:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQmAC-0005Cl-Td
 for xen-changelog@lists.xenproject.org; Wed, 24 Aug 2022 08:55:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQmAC-0008UX-Qo
 for xen-changelog@lists.xenproject.org; Wed, 24 Aug 2022 08:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQmAC-000804-Ph
 for xen-changelog@lists.xenproject.org; Wed, 24 Aug 2022 08:55:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wvRq8LeK60WbZfd2560mzxBckSIaLr+dZ8XUOKX/CXo=; b=JD2DdIkk/wbOB0ua6n2uOnxwZK
	Ta/nikC4GD4ukgvQeWBd+6OdhhvwCW8R9/LwA7dUj/Ti6HpelO1WU6YhN9cl3Vbk8k9i10R3P+z9T
	Jm2dPcq9/0qPhBPgymVCdWTIqATYSiiJubapKk+XiMTrr0IhnnNE4378sSowumOwOH/I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: smmu: Set s2cr to type fault when the devices are deassigned
Message-Id: <E1oQmAC-000804-Ph@xenbits.xenproject.org>
Date: Wed, 24 Aug 2022 08:55:04 +0000

commit fc151829bac48f05a307bfd5ad450b3c0ae2a808
Author:     Rahul Singh <rahul.singh@arm.com>
AuthorDate: Thu Aug 11 16:42:04 2022 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Wed Aug 24 09:46:59 2022 +0100

    xen/arm: smmu: Set s2cr to type fault when the devices are deassigned
    
    When devices are deassigned/assigned, SMMU global fault is observed
    because SMEs are freed in detach function and not allocated again when
    the device is assigned back to the guest.
    
    Don't free the SMEs when devices are deassigned, set the s2cr to type
    fault. This way the SMMU will generate a fault if a DMA access is done
    by a device not assigned to a guest.
    
    Remove the arm_smmu_master_free_smes() as this is not needed anymore,
    arm_smmu_write_s2cr() will be used to set the s2cr to type fault.
    
    Fixes: 0435784cc75d ("xen/arm: smmuv1: Intelligent SMR allocation")
    Signed-off-by: Rahul Singh <rahul.singh@arm.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/drivers/passthrough/arm/smmu.c | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/xen/drivers/passthrough/arm/smmu.c b/xen/drivers/passthrough/arm/smmu.c
index 69511683b4..0a514821b3 100644
--- a/xen/drivers/passthrough/arm/smmu.c
+++ b/xen/drivers/passthrough/arm/smmu.c
@@ -1598,21 +1598,6 @@ out_err:
 	return ret;
 }
 
-static void arm_smmu_master_free_smes(struct arm_smmu_master_cfg *cfg)
-{
-    struct arm_smmu_device *smmu = cfg->smmu;
-	int i, idx;
-	struct iommu_fwspec *fwspec = arm_smmu_get_fwspec(cfg);
-
-	spin_lock(&smmu->stream_map_lock);
-	for_each_cfg_sme(cfg, i, idx, fwspec->num_ids) {
-		if (arm_smmu_free_sme(smmu, idx))
-			arm_smmu_write_sme(smmu, idx);
-		cfg->smendx[i] = INVALID_SMENDX;
-	}
-	spin_unlock(&smmu->stream_map_lock);
-}
-
 static int arm_smmu_domain_add_master(struct arm_smmu_domain *smmu_domain,
 				      struct arm_smmu_master_cfg *cfg)
 {
@@ -1635,6 +1620,21 @@ static int arm_smmu_domain_add_master(struct arm_smmu_domain *smmu_domain,
 	return 0;
 }
 
+static void arm_smmu_domain_remove_master(
+				const struct arm_smmu_domain *smmu_domain,
+				struct arm_smmu_master_cfg *cfg)
+{
+	uint32_t i, idx;
+	struct arm_smmu_device *smmu = smmu_domain->smmu;
+	struct arm_smmu_s2cr *s2cr = smmu->s2crs;
+	const struct iommu_fwspec *fwspec = arm_smmu_get_fwspec(cfg);
+
+	for_each_cfg_sme(cfg, i, idx, fwspec->num_ids) {
+		s2cr[idx] = s2cr_init_val;
+		arm_smmu_write_s2cr(smmu, idx);
+	}
+}
+
 static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev)
 {
 	int ret;
@@ -1684,10 +1684,11 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev)
 
 static void arm_smmu_detach_dev(struct iommu_domain *domain, struct device *dev)
 {
+	struct arm_smmu_domain *smmu_domain = domain->priv;
 	struct arm_smmu_master_cfg *cfg = find_smmu_master_cfg(dev);
 
 	if (cfg)
-		arm_smmu_master_free_smes(cfg);
+		arm_smmu_domain_remove_master(smmu_domain, cfg);
 
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Aug 24 09:55:07 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Aug 2022 09:55:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.392348.630640 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oQn6H-0007Un-52; Wed, 24 Aug 2022 09:55:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 392348.630640; Wed, 24 Aug 2022 09:55:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oQn6H-0007Uf-1k; Wed, 24 Aug 2022 09:55:05 +0000
Received: by outflank-mailman (input) for mailman id 392348;
 Wed, 24 Aug 2022 09:55:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQn6G-0007UX-FJ
 for xen-changelog@lists.xenproject.org; Wed, 24 Aug 2022 09:55:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQn6G-00019G-De
 for xen-changelog@lists.xenproject.org; Wed, 24 Aug 2022 09:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQn6G-0002Nq-Cz
 for xen-changelog@lists.xenproject.org; Wed, 24 Aug 2022 09:55:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nUXAhRtzWfYDq8wdt0HLIcs6PlWL8deKNG931zvd/R4=; b=JMHl8sDQxzMfmbyL1qxwRCJcNd
	ypAXlCY2W39AZjxr86eEIYKnDx5D3yAB1BCmO1GdnMdD5chxSBP26HQZcWkbOXf1Y5Y5PRI9qLcx0
	9HbyoaZ+ydCIDM0Q/2l7TNjsmMjzz5gQlCCKKKEXhRFSM7RRfClio+t5AIiOvpRntd4Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen: do not merge reserved pages in free_heap_pages()
Message-Id: <E1oQn6G-0002Nq-Cz@xenbits.xenproject.org>
Date: Wed, 24 Aug 2022 09:55:04 +0000

commit 7d3f8a2a26f2fd9c4d830820b8ad68af4e91f409
Author:     Penny Zheng <Penny.Zheng@arm.com>
AuthorDate: Tue Aug 16 10:36:52 2022 +0800
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Wed Aug 24 10:36:20 2022 +0100

    xen: do not merge reserved pages in free_heap_pages()
    
    The code in free_heap_pages() will try to merge pages with the
    successor/predecessor if pages are suitably aligned. So if the pages
    reserved are right next to the pages given to the heap allocator,
    free_heap_pages() will merge them, and give the reserved pages to heap
    allocator accidentally as a result.
    
    So in order to avoid the above scenario, this commit updates free_heap_pages()
    to check whether the predecessor and/or successor has PGC_static set,
    when trying to merge the about-to-be-freed chunk with the predecessor
    and/or successor.
    
    Suggested-by: Julien Grall <jgrall@amazon.com>
    Signed-off-by: Penny Zheng <penny.zheng@arm.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/page_alloc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 00fa24e330..bfd4150be7 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -1483,6 +1483,7 @@ static void free_heap_pages(
             /* Merge with predecessor block? */
             if ( !mfn_valid(page_to_mfn(predecessor)) ||
                  !page_state_is(predecessor, free) ||
+                 (predecessor->count_info & PGC_static) ||
                  (PFN_ORDER(predecessor) != order) ||
                  (phys_to_nid(page_to_maddr(predecessor)) != node) )
                 break;
@@ -1506,6 +1507,7 @@ static void free_heap_pages(
             /* Merge with successor block? */
             if ( !mfn_valid(page_to_mfn(successor)) ||
                  !page_state_is(successor, free) ||
+                 (successor->count_info & PGC_static) ||
                  (PFN_ORDER(successor) != order) ||
                  (phys_to_nid(page_to_maddr(successor)) != node) )
                 break;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Aug 24 09:55:15 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Aug 2022 09:55:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.392351.630644 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oQn6R-0007Za-64; Wed, 24 Aug 2022 09:55:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 392351.630644; Wed, 24 Aug 2022 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 1oQn6R-0007ZS-3N; Wed, 24 Aug 2022 09:55:15 +0000
Received: by outflank-mailman (input) for mailman id 392351;
 Wed, 24 Aug 2022 09:55:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQn6Q-0007ZG-HM
 for xen-changelog@lists.xenproject.org; Wed, 24 Aug 2022 09:55:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQn6Q-00019W-Gf
 for xen-changelog@lists.xenproject.org; Wed, 24 Aug 2022 09:55:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQn6Q-0002OH-Fs
 for xen-changelog@lists.xenproject.org; Wed, 24 Aug 2022 09:55:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9PNI5uSPhf5/hNLFZ7COfwKZwV04q3Pp1c5dG7wnxFA=; b=bPV4667q7iD1LtQ0E9pBezHgRm
	p674URArdRzk3aNXT/GEKfaCSDBndmqaPQkGNJHO9nyqCyb91OXYbTfs7br5ujblDvANcqgjpfmxq
	RjaMI2F+9TmzBhqtWoq1Zti9KVLwFhR7yh9Y2tMpqp9zMV8oIStFNa/5vIXN2PUj7FNY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen: add field "flags" to cover all internal CDF_XXX
Message-Id: <E1oQn6Q-0002OH-Fs@xenbits.xenproject.org>
Date: Wed, 24 Aug 2022 09:55:14 +0000

commit 8ac5bb92f3175a5442e962dd0e4be637119838dd
Author:     Penny Zheng <Penny.Zheng@arm.com>
AuthorDate: Tue Aug 16 10:36:53 2022 +0800
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Wed Aug 24 10:36:20 2022 +0100

    xen: add field "flags" to cover all internal CDF_XXX
    
    With more and more CDF_xxx internal flags in and to save the space, this
    commit introduces a new field "flags" in struct domain to store CDF_*
    internal flags directly.
    
    Another new CDF_xxx will be introduced in the next patch.
    
    Signed-off-by: Penny Zheng <penny.zheng@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/domain.c             | 2 --
 xen/arch/arm/include/asm/domain.h | 3 +--
 xen/common/domain.c               | 3 +++
 xen/include/xen/sched.h           | 3 +++
 4 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index 13df91c401..2d6253181a 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -712,8 +712,6 @@ int arch_domain_create(struct domain *d,
     ioreq_domain_init(d);
 #endif
 
-    d->arch.directmap = flags & CDF_directmap;
-
     /* p2m_init relies on some value initialized by the IOMMU subsystem */
     if ( (rc = iommu_domain_init(d, config->iommu_opts)) != 0 )
         goto fail;
diff --git a/xen/arch/arm/include/asm/domain.h b/xen/arch/arm/include/asm/domain.h
index cd9ce19b4b..26a8348eed 100644
--- a/xen/arch/arm/include/asm/domain.h
+++ b/xen/arch/arm/include/asm/domain.h
@@ -29,7 +29,7 @@ enum domain_type {
 #define is_64bit_domain(d) (0)
 #endif
 
-#define is_domain_direct_mapped(d) (d)->arch.directmap
+#define is_domain_direct_mapped(d) ((d)->cdf & CDF_directmap)
 
 /*
  * Is the domain using the host memory layout?
@@ -104,7 +104,6 @@ struct arch_domain
     void *tee;
 #endif
 
-    bool directmap;
 }  __cacheline_aligned;
 
 struct arch_vcpu
diff --git a/xen/common/domain.c b/xen/common/domain.c
index 618410e3b2..7062393e37 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -567,6 +567,9 @@ struct domain *domain_create(domid_t domid,
     /* Sort out our idea of is_system_domain(). */
     d->domain_id = domid;
 
+    /* Holding CDF_* internal flags. */
+    d->cdf = flags;
+
     /* Debug sanity. */
     ASSERT(is_system_domain(d) ? config == NULL : config != NULL);
 
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index e2b3b6daa3..1cf629e7ec 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -596,6 +596,9 @@ struct domain
         struct ioreq_server     *server[MAX_NR_IOREQ_SERVERS];
     } ioreq_server;
 #endif
+
+    /* Holding CDF_* constant. Internal flags for domain creation. */
+    unsigned int cdf;
 };
 
 static inline struct page_list_head *page_to_list(
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Aug 24 12:33:10 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Aug 2022 12:33:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.392524.630923 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oQpZB-0003SM-CN; Wed, 24 Aug 2022 12:33:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 392524.630923; Wed, 24 Aug 2022 12:33:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oQpZB-0003SE-9b; Wed, 24 Aug 2022 12:33:05 +0000
Received: by outflank-mailman (input) for mailman id 392524;
 Wed, 24 Aug 2022 12:33:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQpZA-0003Ru-Jl
 for xen-changelog@lists.xenproject.org; Wed, 24 Aug 2022 12:33:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQpZA-00041h-HV
 for xen-changelog@lists.xenproject.org; Wed, 24 Aug 2022 12:33:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQpZA-0001Yh-GX
 for xen-changelog@lists.xenproject.org; Wed, 24 Aug 2022 12:33:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hFpA2PJBPoa+Awnt10icPTSdKJOJzJ1qnatTtP12IIo=; b=Wbok0LY/dApZKidysLxXi4ejaS
	AZfgEDQvu6QSfIa4xC7d0d9i4PgnhoKr85pc+cKsas/vFber+BxTOw/SSL0JryEcKEfnRevcPICCp
	GHAocz5V0CdGaItYlMatj3p5HxPX6Ai/KgVWat/3ssG/YI33+DxBKnJ/6CKp+XtQD5cs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] arm/gic_v3_its: fix MISRA C 2012 Rule 20.7 violations
Message-Id: <E1oQpZA-0001Yh-GX@xenbits.xenproject.org>
Date: Wed, 24 Aug 2022 12:33:04 +0000

commit 335f3f62b6026774aec822bf28743297b5ba03a4
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Wed Aug 24 14:21:26 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Aug 24 14:21:26 2022 +0200

    arm/gic_v3_its: fix MISRA C 2012 Rule 20.7 violations
    
    In macros GITS_TYPER_DEVICE_ID_BITS(), GITS_TYPER_EVENT_ID_BITS() and
    GITS_BASER_ENTRY_SIZE(), add parentheses around the macro parameter to
    prevent against unintended expansions.
    Realign subsequent lines, if any.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/include/asm/gic_v3_its.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/xen/arch/arm/include/asm/gic_v3_its.h b/xen/arch/arm/include/asm/gic_v3_its.h
index 94e5cb99c5..168617097f 100644
--- a/xen/arch/arm/include/asm/gic_v3_its.h
+++ b/xen/arch/arm/include/asm/gic_v3_its.h
@@ -46,13 +46,13 @@
 #define GITS_TYPER_PTA                  BIT(19, UL)
 #define GITS_TYPER_DEVIDS_SHIFT         13
 #define GITS_TYPER_DEVIDS_MASK          (0x1fUL << GITS_TYPER_DEVIDS_SHIFT)
-#define GITS_TYPER_DEVICE_ID_BITS(r)    (((r & GITS_TYPER_DEVIDS_MASK) >> \
-                                               GITS_TYPER_DEVIDS_SHIFT) + 1)
+#define GITS_TYPER_DEVICE_ID_BITS(r)    ((((r) & GITS_TYPER_DEVIDS_MASK) >> \
+                                                 GITS_TYPER_DEVIDS_SHIFT) + 1)
 
 #define GITS_TYPER_IDBITS_SHIFT         8
 #define GITS_TYPER_IDBITS_MASK          (0x1fUL << GITS_TYPER_IDBITS_SHIFT)
-#define GITS_TYPER_EVENT_ID_BITS(r)     (((r & GITS_TYPER_IDBITS_MASK) >> \
-                                               GITS_TYPER_IDBITS_SHIFT) + 1)
+#define GITS_TYPER_EVENT_ID_BITS(r)     ((((r) & GITS_TYPER_IDBITS_MASK) >> \
+                                                 GITS_TYPER_IDBITS_SHIFT) + 1)
 
 #define GITS_TYPER_ITT_SIZE_SHIFT       4
 #define GITS_TYPER_ITT_SIZE_MASK        (0xfUL << GITS_TYPER_ITT_SIZE_SHIFT)
@@ -75,7 +75,7 @@
 #define GITS_BASER_TYPE_RESERVED7       7UL
 #define GITS_BASER_ENTRY_SIZE_SHIFT     48
 #define GITS_BASER_ENTRY_SIZE(reg)                                       \
-                        (((reg >> GITS_BASER_ENTRY_SIZE_SHIFT) & 0x1f) + 1)
+                        ((((reg) >> GITS_BASER_ENTRY_SIZE_SHIFT) & 0x1f) + 1)
 #define GITS_BASER_SHAREABILITY_SHIFT   10
 #define GITS_BASER_PAGE_SIZE_SHIFT      8
 #define GITS_BASER_SIZE_MASK            0xff
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Aug 24 12:33:15 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Aug 2022 12:33:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.392525.630926 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oQpZL-0003UJ-Dh; Wed, 24 Aug 2022 12:33:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 392525.630926; Wed, 24 Aug 2022 12:33:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oQpZL-0003UB-B7; Wed, 24 Aug 2022 12:33:15 +0000
Received: by outflank-mailman (input) for mailman id 392525;
 Wed, 24 Aug 2022 12:33:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQpZK-0003U5-LC
 for xen-changelog@lists.xenproject.org; Wed, 24 Aug 2022 12:33:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQpZK-00041l-KU
 for xen-changelog@lists.xenproject.org; Wed, 24 Aug 2022 12:33:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQpZK-0001ZD-JV
 for xen-changelog@lists.xenproject.org; Wed, 24 Aug 2022 12:33:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zB9vYekq4y47NKcSNmWGaeuublAx2bYUiofw7PLgP5E=; b=B2oybcxvVh7YrS8CXe3U6VFOd+
	LO4QwXp0sLe+0hvVqvOnlwB8XhXTA/XRhiV7Oo1qxbOxNWkdUL6F0IaBPu2RuB/mWwPkYXLyEy8LR
	apZUhxSjzGjMw6kNGBIwlxdnEtsGv4iYyqdAfewthqpKwskCh3iEBajmliKrmbxsaxVU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] arm/vgic: fix MISRA C 2012 Rule 20.7 violation
Message-Id: <E1oQpZK-0001ZD-JV@xenbits.xenproject.org>
Date: Wed, 24 Aug 2022 12:33:14 +0000

commit 7bb36cbb932da8599b8d57b984fa0e858a8ef7ce
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Wed Aug 24 14:22:29 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Aug 24 14:22:29 2022 +0200

    arm/vgic: fix MISRA C 2012 Rule 20.7 violation
    
    In macro VGIC_V3_LR_INDEX(), add parentheses around the macro parameter
    to prevent against unintended expansions.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/include/asm/new_vgic.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/include/asm/new_vgic.h b/xen/arch/arm/include/asm/new_vgic.h
index ab57fcd91d..b7fa9ab11a 100644
--- a/xen/arch/arm/include/asm/new_vgic.h
+++ b/xen/arch/arm/include/asm/new_vgic.h
@@ -43,7 +43,7 @@ enum vgic_type {
 
 #define VGIC_V2_MAX_LRS         (1 << 6)
 #define VGIC_V3_MAX_LRS         16
-#define VGIC_V3_LR_INDEX(lr)    (VGIC_V3_MAX_LRS - 1 - lr)
+#define VGIC_V3_LR_INDEX(lr)    (VGIC_V3_MAX_LRS - 1 - (lr))
 
 #define VGIC_CONFIG_EDGE        false
 #define VGIC_CONFIG_LEVEL       true
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Aug 24 12:33:25 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Aug 2022 12:33:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.392526.630931 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oQpZV-0003XI-Fc; Wed, 24 Aug 2022 12:33:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 392526.630931; Wed, 24 Aug 2022 12:33: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 1oQpZV-0003X8-Ca; Wed, 24 Aug 2022 12:33:25 +0000
Received: by outflank-mailman (input) for mailman id 392526;
 Wed, 24 Aug 2022 12:33:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQpZU-0003Wz-Po
 for xen-changelog@lists.xenproject.org; Wed, 24 Aug 2022 12:33:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQpZU-000425-NQ
 for xen-changelog@lists.xenproject.org; Wed, 24 Aug 2022 12:33:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQpZU-0001Ze-MW
 for xen-changelog@lists.xenproject.org; Wed, 24 Aug 2022 12:33:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ddtcRzU1dN9STSCwe527701gIDFzWOO5XcFr1MqFdgY=; b=UBScNQeK7MbaVDYRHHycceUSa0
	6tyB4bcwOfSQVGH6kdtGDIswGRI1MxhVxOWaU8TT7esNHzAm0aoFRcRJpieMy/ttYnJRjdJLBWNve
	J4KqRGN6bL7/8S0E4U0UMSRNUHlgjQjBHw05fbBMwL1P22BJxeYzun0Lrwk5+EVN1+C8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] arm/processor: fix MISRA C 2012 Rule 20.7 violations
Message-Id: <E1oQpZU-0001Ze-MW@xenbits.xenproject.org>
Date: Wed, 24 Aug 2022 12:33:24 +0000

commit 1d5b8c434dea074fce0f4cf796bd5169c341a806
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Wed Aug 24 14:23:00 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Aug 24 14:23:00 2022 +0200

    arm/processor: fix MISRA C 2012 Rule 20.7 violations
    
    In macros MPIDR_LEVEL_SHIFT() and MPIDR_AFFINITY_LEVEL(), add parentheses
    around the macro parameters 'level' and 'mpidr', respectively, to prevent
    against unintended expansions.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/include/asm/processor.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/include/asm/processor.h b/xen/arch/arm/include/asm/processor.h
index 55f56b33bc..1dd81d7d52 100644
--- a/xen/arch/arm/include/asm/processor.h
+++ b/xen/arch/arm/include/asm/processor.h
@@ -127,10 +127,10 @@
 #define MPIDR_LEVEL_MASK        ((1 << MPIDR_LEVEL_BITS) - 1)
 
 #define MPIDR_LEVEL_SHIFT(level) \
-         (((1 << level) >> 1) << MPIDR_LEVEL_BITS_SHIFT)
+         (((1 << (level)) >> 1) << MPIDR_LEVEL_BITS_SHIFT)
 
 #define MPIDR_AFFINITY_LEVEL(mpidr, level) \
-         ((mpidr >> MPIDR_LEVEL_SHIFT(level)) & MPIDR_LEVEL_MASK)
+         (((mpidr) >> MPIDR_LEVEL_SHIFT(level)) & MPIDR_LEVEL_MASK)
 
 #define AFFINITY_MASK(level)    ~((_AC(0x1,UL) << MPIDR_LEVEL_SHIFT(level)) - 1)
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Aug 24 12:33:35 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Aug 2022 12:33:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.392527.630935 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oQpZf-0003a7-Gt; Wed, 24 Aug 2022 12:33:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 392527.630935; Wed, 24 Aug 2022 12:33: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 1oQpZf-0003Zz-E2; Wed, 24 Aug 2022 12:33:35 +0000
Received: by outflank-mailman (input) for mailman id 392527;
 Wed, 24 Aug 2022 12:33:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQpZe-0003Zs-Qx
 for xen-changelog@lists.xenproject.org; Wed, 24 Aug 2022 12:33:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQpZe-00042H-QD
 for xen-changelog@lists.xenproject.org; Wed, 24 Aug 2022 12:33:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQpZe-0001aB-PY
 for xen-changelog@lists.xenproject.org; Wed, 24 Aug 2022 12:33:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=XAGzXH5pDKF0k0PRYqDaE77Bw28Zg5TDiPww7tY8zPE=; b=2A1G6A57Y2cxmidRpi1JHAMdOd
	sfekNCX76n1s41Xhpjf0oG9KA5aGSuNOlx8ltkqQThrHsias/SzkIBzQXkfHNfg2K4YO9ffZqTfmv
	R4x8KnJFNkk2VEY69+gRu46IuUank0xdzuFliqj2dQoS/5WhRSKD1qH7aapnhoQtK+v0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/CPUID: surface suitable value in EBX of XSTATE subleaf 1
Message-Id: <E1oQpZe-0001aB-PY@xenbits.xenproject.org>
Date: Wed, 24 Aug 2022 12:33:34 +0000

commit c3bd0b83ea5b7c0da6542687436042eeea1e7909
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Aug 24 14:23:59 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Aug 24 14:23:59 2022 +0200

    x86/CPUID: surface suitable value in EBX of XSTATE subleaf 1
    
    While the SDM isn't very clear about this, our present behavior make
    Linux 5.19 unhappy. As of commit 8ad7e8f69695 ("x86/fpu/xsave: Support
    XSAVEC in the kernel") they're using this CPUID output also to size
    the compacted area used by XSAVEC. Getting back zero there isn't really
    liked, yet for PV that's the default on capable hardware: XSAVES isn't
    exposed to PV domains.
    
    Considering that the size reported is that of the compacted save area,
    I view Linux'es assumption as appropriate (short of the SDM properly
    considering the case). Therefore we need to populate the field also when
    only XSAVEC is supported for a guest.
    
    Fixes: 460b9a4b3630 ("x86/xsaves: enable xsaves/xrstors for hvm guest")
    Fixes: 8d050ed1097c ("x86: don't expose XSAVES capability to PV guests")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/cpuid.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index a4a366ad84..822f9ace10 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -1142,7 +1142,7 @@ void guest_cpuid(const struct vcpu *v, uint32_t leaf,
         switch ( subleaf )
         {
         case 1:
-            if ( p->xstate.xsaves )
+            if ( p->xstate.xsavec || p->xstate.xsaves )
             {
                 /*
                  * TODO: Figure out what to do for XSS state.  VT-x manages
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Aug 24 13:55:07 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Aug 2022 13:55:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.392664.631158 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oQqqV-0005oD-R9; Wed, 24 Aug 2022 13:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 392664.631158; Wed, 24 Aug 2022 13:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oQqqV-0005o5-OC; Wed, 24 Aug 2022 13:55:03 +0000
Received: by outflank-mailman (input) for mailman id 392664;
 Wed, 24 Aug 2022 13:55:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQqqT-0005no-SF
 for xen-changelog@lists.xenproject.org; Wed, 24 Aug 2022 13:55:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQqqT-0005XN-RV
 for xen-changelog@lists.xenproject.org; Wed, 24 Aug 2022 13:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQqqT-0005E7-Qb
 for xen-changelog@lists.xenproject.org; Wed, 24 Aug 2022 13:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=p/hm9HaFvW+Euiuu63P+NLfJ+5LMG3W2Vg2gVsvqMmc=; b=4mLAL1oTADxiAAEeMMrKtAsqP2
	7qXWZOmXv2em9fUSu3AKfcSP+NPmuacbrbykd7/A2tXt98yM0Ozr1xTSOdUvlHSnhwKHhItIndrkB
	DztkcmKMh2hEED4EqWJ2KpViR73z0MshmMOWu15xPih/xZdgn7+votti6DfNrhQGe74I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/entry: Fix !PV build
Message-Id: <E1oQqqT-0005E7-Qb@xenbits.xenproject.org>
Date: Wed, 24 Aug 2022 13:55:01 +0000

commit 8d9006cf4152cb8ef360ee12c4a1477992bbf85a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Aug 22 13:46:39 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Aug 23 12:22:05 2022 +0100

    x86/entry: Fix !PV build
    
    early_page_fault() needs to outside of #ifdef CONFIG_PV
    
    Spotted by Gitlab CI.
    
    Fixes: fe3f50726e87 ("x86/entry: move .init.text section higher up in the code for readability")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/x86_64/entry.S | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index 9b34150bc7..ae01285181 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -140,15 +140,6 @@ process_trap:
         call create_bounce_frame
         jmp  test_all_events
 
-        .section .init.text, "ax", @progbits
-ENTRY(early_page_fault)
-        ENDBR64
-        movl  $TRAP_page_fault, 4(%rsp)
-        SAVE_ALL
-        movq  %rsp, %rdi
-        call  do_early_page_fault
-        jmp   restore_all_xen
-
         .section .text.entry, "ax", @progbits
 
 /* %rbx: struct vcpu, interrupts disabled */
@@ -655,6 +646,15 @@ ret_from_intr:
         jmp   restore_all_xen
 #endif
 
+        .section .init.text, "ax", @progbits
+ENTRY(early_page_fault)
+        ENDBR64
+        movl  $TRAP_page_fault, 4(%rsp)
+        SAVE_ALL
+        movq  %rsp, %rdi
+        call  do_early_page_fault
+        jmp   restore_all_xen
+
         .section .text.entry, "ax", @progbits
 
         ALIGN
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Aug 24 13:55:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Aug 2022 13:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.392665.631162 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oQqqf-0005rI-SG; Wed, 24 Aug 2022 13:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 392665.631162; Wed, 24 Aug 2022 13:55:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oQqqf-0005rA-Pi; Wed, 24 Aug 2022 13:55:13 +0000
Received: by outflank-mailman (input) for mailman id 392665;
 Wed, 24 Aug 2022 13:55:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQqqe-0005qm-0A
 for xen-changelog@lists.xenproject.org; Wed, 24 Aug 2022 13:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQqqd-0005Xj-Ve
 for xen-changelog@lists.xenproject.org; Wed, 24 Aug 2022 13:55:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oQqqd-0005Eq-U1
 for xen-changelog@lists.xenproject.org; Wed, 24 Aug 2022 13:55:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=HWw2eonJK0eNWKtbfiKdrlufsGpeCOmUUPz6xmpQcMw=; b=J8eRfEMV2uaeZqebvu7pO3XELz
	DSvxoGuwhQNDNH2vUXXlz1AaA4LqspgVnKhhoHUoFliiVUl3RHaiXN50EkKy649bLBG9UxuBQrlE+
	mcGc0ley7LsqeF2EeYSFLf2CXSwdUYPCGK0xlGCJ5AoDXVZmKX3vp7tDq+PhXRKrDLwA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/domain: Fix struct domain memory corruption when building PV guests
Message-Id: <E1oQqqd-0005Eq-U1@xenbits.xenproject.org>
Date: Wed, 24 Aug 2022 13:55:11 +0000

commit 399bcbf281bd936d1eff7f7d1054ab49115c3a44
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Aug 22 22:17:18 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Aug 23 12:22:05 2022 +0100

    x86/domain: Fix struct domain memory corruption when building PV guests
    
    arch_domain_create() can't blindly write into d->arch.hvm union.  Move the
    logic into hvm_domain_initialise(), which involves passing config down.
    
    Fixes: 2ce11ce249a3 ("x86/HVM: allow per-domain usage of hardware virtualized APIC")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/domain.c              | 8 +-------
 xen/arch/x86/hvm/hvm.c             | 9 ++++++++-
 xen/arch/x86/include/asm/hvm/hvm.h | 3 ++-
 3 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 15e7e77201..41e1e3f272 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -853,7 +853,7 @@ int arch_domain_create(struct domain *d,
 
     if ( is_hvm_domain(d) )
     {
-        if ( (rc = hvm_domain_initialise(d)) != 0 )
+        if ( (rc = hvm_domain_initialise(d, config)) != 0 )
             goto fail;
     }
     else if ( is_pv_domain(d) )
@@ -885,12 +885,6 @@ int arch_domain_create(struct domain *d,
 
     d->arch.msr_relaxed = config->arch.misc_flags & XEN_X86_MSR_RELAXED;
 
-    d->arch.hvm.assisted_xapic =
-        config->arch.misc_flags & XEN_X86_ASSISTED_XAPIC;
-
-    d->arch.hvm.assisted_x2apic =
-        config->arch.misc_flags & XEN_X86_ASSISTED_X2APIC;
-
     spec_ctrl_init_domain(d);
 
     return 0;
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 6b5d585ed4..44b432ec5a 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -576,7 +576,8 @@ static int cf_check hvm_print_line(
     return X86EMUL_OKAY;
 }
 
-int hvm_domain_initialise(struct domain *d)
+int hvm_domain_initialise(struct domain *d,
+                          const struct xen_domctl_createdomain *config)
 {
     unsigned int nr_gsis;
     int rc;
@@ -597,6 +598,12 @@ int hvm_domain_initialise(struct domain *d)
     INIT_LIST_HEAD(&d->arch.hvm.mmcfg_regions);
     INIT_LIST_HEAD(&d->arch.hvm.msix_tables);
 
+    d->arch.hvm.assisted_xapic =
+        config->arch.misc_flags & XEN_X86_ASSISTED_XAPIC;
+
+    d->arch.hvm.assisted_x2apic =
+        config->arch.misc_flags & XEN_X86_ASSISTED_X2APIC;
+
     rc = create_perdomain_mapping(d, PERDOMAIN_VIRT_START, 0, NULL, NULL);
     if ( rc )
         goto fail;
diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
index 03096f31ef..66836122e8 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -259,7 +259,8 @@ extern s8 hvm_port80_allowed;
 extern const struct hvm_function_table *start_svm(void);
 extern const struct hvm_function_table *start_vmx(void);
 
-int hvm_domain_initialise(struct domain *d);
+int hvm_domain_initialise(struct domain *d,
+                          const struct xen_domctl_createdomain *config);
 void hvm_domain_relinquish_resources(struct domain *d);
 void hvm_domain_destroy(struct domain *d);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 25 00:33:06 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Aug 2022 00:33:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.392988.631661 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oR0nt-0007Ji-UW; Thu, 25 Aug 2022 00:33:01 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 392988.631661; Thu, 25 Aug 2022 00:33: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 1oR0nt-0007Ja-Rk; Thu, 25 Aug 2022 00:33:01 +0000
Received: by outflank-mailman (input) for mailman id 392988;
 Thu, 25 Aug 2022 00:33:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oR0nt-0007JS-E4
 for xen-changelog@lists.xenproject.org; Thu, 25 Aug 2022 00:33:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oR0nt-0001IP-DB
 for xen-changelog@lists.xenproject.org; Thu, 25 Aug 2022 00:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oR0nt-0004r4-BK
 for xen-changelog@lists.xenproject.org; Thu, 25 Aug 2022 00:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=dZWcbf0Nny1hssBgKcO2WKiMwdSy1zZmOKp7eYeIdvo=; b=C7OF6mZXSfhNP7NPDCm/jmt2OB
	2ZAawXhSeV4Ob/c4l3Sqfev8kQWznEGHGdslB87HPkHVzTkrIHL0trukPXq07zLZt2sbqB73xMQVS
	QciEnCPiRJenCf3folCbZXyHMeId6utNeQDzUTYvatuJnrH3GwTBUIQmXnT4t7vZcU0w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: smmu: Set s2cr to type fault when the devices are deassigned
Message-Id: <E1oR0nt-0004r4-BK@xenbits.xenproject.org>
Date: Thu, 25 Aug 2022 00:33:01 +0000

commit fc151829bac48f05a307bfd5ad450b3c0ae2a808
Author:     Rahul Singh <rahul.singh@arm.com>
AuthorDate: Thu Aug 11 16:42:04 2022 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Wed Aug 24 09:46:59 2022 +0100

    xen/arm: smmu: Set s2cr to type fault when the devices are deassigned
    
    When devices are deassigned/assigned, SMMU global fault is observed
    because SMEs are freed in detach function and not allocated again when
    the device is assigned back to the guest.
    
    Don't free the SMEs when devices are deassigned, set the s2cr to type
    fault. This way the SMMU will generate a fault if a DMA access is done
    by a device not assigned to a guest.
    
    Remove the arm_smmu_master_free_smes() as this is not needed anymore,
    arm_smmu_write_s2cr() will be used to set the s2cr to type fault.
    
    Fixes: 0435784cc75d ("xen/arm: smmuv1: Intelligent SMR allocation")
    Signed-off-by: Rahul Singh <rahul.singh@arm.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/drivers/passthrough/arm/smmu.c | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/xen/drivers/passthrough/arm/smmu.c b/xen/drivers/passthrough/arm/smmu.c
index 69511683b4..0a514821b3 100644
--- a/xen/drivers/passthrough/arm/smmu.c
+++ b/xen/drivers/passthrough/arm/smmu.c
@@ -1598,21 +1598,6 @@ out_err:
 	return ret;
 }
 
-static void arm_smmu_master_free_smes(struct arm_smmu_master_cfg *cfg)
-{
-    struct arm_smmu_device *smmu = cfg->smmu;
-	int i, idx;
-	struct iommu_fwspec *fwspec = arm_smmu_get_fwspec(cfg);
-
-	spin_lock(&smmu->stream_map_lock);
-	for_each_cfg_sme(cfg, i, idx, fwspec->num_ids) {
-		if (arm_smmu_free_sme(smmu, idx))
-			arm_smmu_write_sme(smmu, idx);
-		cfg->smendx[i] = INVALID_SMENDX;
-	}
-	spin_unlock(&smmu->stream_map_lock);
-}
-
 static int arm_smmu_domain_add_master(struct arm_smmu_domain *smmu_domain,
 				      struct arm_smmu_master_cfg *cfg)
 {
@@ -1635,6 +1620,21 @@ static int arm_smmu_domain_add_master(struct arm_smmu_domain *smmu_domain,
 	return 0;
 }
 
+static void arm_smmu_domain_remove_master(
+				const struct arm_smmu_domain *smmu_domain,
+				struct arm_smmu_master_cfg *cfg)
+{
+	uint32_t i, idx;
+	struct arm_smmu_device *smmu = smmu_domain->smmu;
+	struct arm_smmu_s2cr *s2cr = smmu->s2crs;
+	const struct iommu_fwspec *fwspec = arm_smmu_get_fwspec(cfg);
+
+	for_each_cfg_sme(cfg, i, idx, fwspec->num_ids) {
+		s2cr[idx] = s2cr_init_val;
+		arm_smmu_write_s2cr(smmu, idx);
+	}
+}
+
 static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev)
 {
 	int ret;
@@ -1684,10 +1684,11 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev)
 
 static void arm_smmu_detach_dev(struct iommu_domain *domain, struct device *dev)
 {
+	struct arm_smmu_domain *smmu_domain = domain->priv;
 	struct arm_smmu_master_cfg *cfg = find_smmu_master_cfg(dev);
 
 	if (cfg)
-		arm_smmu_master_free_smes(cfg);
+		arm_smmu_domain_remove_master(smmu_domain, cfg);
 
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 25 12:00:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Aug 2022 12:00:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.393345.632240 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oRBWl-0007t2-TH; Thu, 25 Aug 2022 12:00:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 393345.632240; Thu, 25 Aug 2022 12:00:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oRBWl-0007sa-Pm; Thu, 25 Aug 2022 12:00:03 +0000
Received: by outflank-mailman (input) for mailman id 393345;
 Thu, 25 Aug 2022 12:00:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oRBWk-0007gB-DJ
 for xen-changelog@lists.xenproject.org; Thu, 25 Aug 2022 12:00:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oRBWk-0005EV-Ba
 for xen-changelog@lists.xenproject.org; Thu, 25 Aug 2022 12:00:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oRBWk-0002zQ-A3
 for xen-changelog@lists.xenproject.org; Thu, 25 Aug 2022 12:00:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vhVb2HYLkIwoKO38yRotcn0g/Hn2CTonZku6ZvAVDGw=; b=twZib5TAuXx62t2SsnA3mnu9XD
	RoqkP+sEw1Epd67QfjCMQOx607bD8rhqBdM7yuHE1oBNzQRqw8ju/QVbZ2a+0T34BkvZfVtN7oYYv
	hIfl5sOjoZRnm2OvK4yNMnS8LA3LZxOvqSSTDJ9DUhJirEAfVXJZ4byxlI61CzswNa44=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen: do not merge reserved pages in free_heap_pages()
Message-Id: <E1oRBWk-0002zQ-A3@xenbits.xenproject.org>
Date: Thu, 25 Aug 2022 12:00:02 +0000

commit 7d3f8a2a26f2fd9c4d830820b8ad68af4e91f409
Author:     Penny Zheng <Penny.Zheng@arm.com>
AuthorDate: Tue Aug 16 10:36:52 2022 +0800
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Wed Aug 24 10:36:20 2022 +0100

    xen: do not merge reserved pages in free_heap_pages()
    
    The code in free_heap_pages() will try to merge pages with the
    successor/predecessor if pages are suitably aligned. So if the pages
    reserved are right next to the pages given to the heap allocator,
    free_heap_pages() will merge them, and give the reserved pages to heap
    allocator accidentally as a result.
    
    So in order to avoid the above scenario, this commit updates free_heap_pages()
    to check whether the predecessor and/or successor has PGC_static set,
    when trying to merge the about-to-be-freed chunk with the predecessor
    and/or successor.
    
    Suggested-by: Julien Grall <jgrall@amazon.com>
    Signed-off-by: Penny Zheng <penny.zheng@arm.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/page_alloc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 00fa24e330..bfd4150be7 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -1483,6 +1483,7 @@ static void free_heap_pages(
             /* Merge with predecessor block? */
             if ( !mfn_valid(page_to_mfn(predecessor)) ||
                  !page_state_is(predecessor, free) ||
+                 (predecessor->count_info & PGC_static) ||
                  (PFN_ORDER(predecessor) != order) ||
                  (phys_to_nid(page_to_maddr(predecessor)) != node) )
                 break;
@@ -1506,6 +1507,7 @@ static void free_heap_pages(
             /* Merge with successor block? */
             if ( !mfn_valid(page_to_mfn(successor)) ||
                  !page_state_is(successor, free) ||
+                 (successor->count_info & PGC_static) ||
                  (PFN_ORDER(successor) != order) ||
                  (phys_to_nid(page_to_maddr(successor)) != node) )
                 break;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 25 12:00:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Aug 2022 12:00:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.393347.632245 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oRBWv-000089-Uq; Thu, 25 Aug 2022 12:00:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 393347.632245; Thu, 25 Aug 2022 12: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 1oRBWv-000080-RQ; Thu, 25 Aug 2022 12:00:13 +0000
Received: by outflank-mailman (input) for mailman id 393347;
 Thu, 25 Aug 2022 12:00:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oRBWu-00007Q-Fp
 for xen-changelog@lists.xenproject.org; Thu, 25 Aug 2022 12:00:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oRBWu-0005F4-F1
 for xen-changelog@lists.xenproject.org; Thu, 25 Aug 2022 12:00:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oRBWu-00030r-E0
 for xen-changelog@lists.xenproject.org; Thu, 25 Aug 2022 12:00:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Rl6Rc9Ls+YMSV6JuPnVDpeHwoGNP9x6iCDJ4DYWTnqs=; b=nAORilk6H1NHqPQ+jshFHFuE65
	JjrqCBRq9FPspoanyNRLF2VhxyOuT9UMNB+QMiI4H59n7hd1vok9aaVjFwKFLtBUv4piCcbgl9yii
	msGoyW8MvnZRr0kfmOQoY5B4+Kx5jmMmRg/wa0iOjcbohvdx3LvgrQA706aZdBAK2J6M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen: add field "flags" to cover all internal CDF_XXX
Message-Id: <E1oRBWu-00030r-E0@xenbits.xenproject.org>
Date: Thu, 25 Aug 2022 12:00:12 +0000

commit 8ac5bb92f3175a5442e962dd0e4be637119838dd
Author:     Penny Zheng <Penny.Zheng@arm.com>
AuthorDate: Tue Aug 16 10:36:53 2022 +0800
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Wed Aug 24 10:36:20 2022 +0100

    xen: add field "flags" to cover all internal CDF_XXX
    
    With more and more CDF_xxx internal flags in and to save the space, this
    commit introduces a new field "flags" in struct domain to store CDF_*
    internal flags directly.
    
    Another new CDF_xxx will be introduced in the next patch.
    
    Signed-off-by: Penny Zheng <penny.zheng@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/domain.c             | 2 --
 xen/arch/arm/include/asm/domain.h | 3 +--
 xen/common/domain.c               | 3 +++
 xen/include/xen/sched.h           | 3 +++
 4 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index 13df91c401..2d6253181a 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -712,8 +712,6 @@ int arch_domain_create(struct domain *d,
     ioreq_domain_init(d);
 #endif
 
-    d->arch.directmap = flags & CDF_directmap;
-
     /* p2m_init relies on some value initialized by the IOMMU subsystem */
     if ( (rc = iommu_domain_init(d, config->iommu_opts)) != 0 )
         goto fail;
diff --git a/xen/arch/arm/include/asm/domain.h b/xen/arch/arm/include/asm/domain.h
index cd9ce19b4b..26a8348eed 100644
--- a/xen/arch/arm/include/asm/domain.h
+++ b/xen/arch/arm/include/asm/domain.h
@@ -29,7 +29,7 @@ enum domain_type {
 #define is_64bit_domain(d) (0)
 #endif
 
-#define is_domain_direct_mapped(d) (d)->arch.directmap
+#define is_domain_direct_mapped(d) ((d)->cdf & CDF_directmap)
 
 /*
  * Is the domain using the host memory layout?
@@ -104,7 +104,6 @@ struct arch_domain
     void *tee;
 #endif
 
-    bool directmap;
 }  __cacheline_aligned;
 
 struct arch_vcpu
diff --git a/xen/common/domain.c b/xen/common/domain.c
index 618410e3b2..7062393e37 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -567,6 +567,9 @@ struct domain *domain_create(domid_t domid,
     /* Sort out our idea of is_system_domain(). */
     d->domain_id = domid;
 
+    /* Holding CDF_* internal flags. */
+    d->cdf = flags;
+
     /* Debug sanity. */
     ASSERT(is_system_domain(d) ? config == NULL : config != NULL);
 
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index e2b3b6daa3..1cf629e7ec 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -596,6 +596,9 @@ struct domain
         struct ioreq_server     *server[MAX_NR_IOREQ_SERVERS];
     } ioreq_server;
 #endif
+
+    /* Holding CDF_* constant. Internal flags for domain creation. */
+    unsigned int cdf;
 };
 
 static inline struct page_list_head *page_to_list(
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 25 12:00:24 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Aug 2022 12:00:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.393353.632248 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oRBX5-0000HV-W9; Thu, 25 Aug 2022 12:00:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 393353.632248; Thu, 25 Aug 2022 12: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 1oRBX5-0000HL-TA; Thu, 25 Aug 2022 12:00:23 +0000
Received: by outflank-mailman (input) for mailman id 393353;
 Thu, 25 Aug 2022 12:00:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oRBX4-0000EE-IH
 for xen-changelog@lists.xenproject.org; Thu, 25 Aug 2022 12:00:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oRBX4-0005FY-Hg
 for xen-changelog@lists.xenproject.org; Thu, 25 Aug 2022 12:00:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oRBX4-000320-H1
 for xen-changelog@lists.xenproject.org; Thu, 25 Aug 2022 12:00:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fjdJGM/OwftUFmWjHcNIAlVc8ymhCmepfAXTG33rs+Q=; b=NzXv6otPvoovKtoC9i0K0qXcL1
	D8ZtcQJhcI3x5ro8EgFngE9piyovcJ0gBiU730PlbCyC5uGJwVb0Qz4iLl7CHifST+a6cR5TsJ3fm
	reLSLgLcbXAycxAPpct1CUZC5ij35Fbhd3dS6XikxFYrYvR2DkmRRM/xsXbFRQLJ2imU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] arm/gic_v3_its: fix MISRA C 2012 Rule 20.7 violations
Message-Id: <E1oRBX4-000320-H1@xenbits.xenproject.org>
Date: Thu, 25 Aug 2022 12:00:22 +0000

commit 335f3f62b6026774aec822bf28743297b5ba03a4
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Wed Aug 24 14:21:26 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Aug 24 14:21:26 2022 +0200

    arm/gic_v3_its: fix MISRA C 2012 Rule 20.7 violations
    
    In macros GITS_TYPER_DEVICE_ID_BITS(), GITS_TYPER_EVENT_ID_BITS() and
    GITS_BASER_ENTRY_SIZE(), add parentheses around the macro parameter to
    prevent against unintended expansions.
    Realign subsequent lines, if any.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/include/asm/gic_v3_its.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/xen/arch/arm/include/asm/gic_v3_its.h b/xen/arch/arm/include/asm/gic_v3_its.h
index 94e5cb99c5..168617097f 100644
--- a/xen/arch/arm/include/asm/gic_v3_its.h
+++ b/xen/arch/arm/include/asm/gic_v3_its.h
@@ -46,13 +46,13 @@
 #define GITS_TYPER_PTA                  BIT(19, UL)
 #define GITS_TYPER_DEVIDS_SHIFT         13
 #define GITS_TYPER_DEVIDS_MASK          (0x1fUL << GITS_TYPER_DEVIDS_SHIFT)
-#define GITS_TYPER_DEVICE_ID_BITS(r)    (((r & GITS_TYPER_DEVIDS_MASK) >> \
-                                               GITS_TYPER_DEVIDS_SHIFT) + 1)
+#define GITS_TYPER_DEVICE_ID_BITS(r)    ((((r) & GITS_TYPER_DEVIDS_MASK) >> \
+                                                 GITS_TYPER_DEVIDS_SHIFT) + 1)
 
 #define GITS_TYPER_IDBITS_SHIFT         8
 #define GITS_TYPER_IDBITS_MASK          (0x1fUL << GITS_TYPER_IDBITS_SHIFT)
-#define GITS_TYPER_EVENT_ID_BITS(r)     (((r & GITS_TYPER_IDBITS_MASK) >> \
-                                               GITS_TYPER_IDBITS_SHIFT) + 1)
+#define GITS_TYPER_EVENT_ID_BITS(r)     ((((r) & GITS_TYPER_IDBITS_MASK) >> \
+                                                 GITS_TYPER_IDBITS_SHIFT) + 1)
 
 #define GITS_TYPER_ITT_SIZE_SHIFT       4
 #define GITS_TYPER_ITT_SIZE_MASK        (0xfUL << GITS_TYPER_ITT_SIZE_SHIFT)
@@ -75,7 +75,7 @@
 #define GITS_BASER_TYPE_RESERVED7       7UL
 #define GITS_BASER_ENTRY_SIZE_SHIFT     48
 #define GITS_BASER_ENTRY_SIZE(reg)                                       \
-                        (((reg >> GITS_BASER_ENTRY_SIZE_SHIFT) & 0x1f) + 1)
+                        ((((reg) >> GITS_BASER_ENTRY_SIZE_SHIFT) & 0x1f) + 1)
 #define GITS_BASER_SHAREABILITY_SHIFT   10
 #define GITS_BASER_PAGE_SIZE_SHIFT      8
 #define GITS_BASER_SIZE_MASK            0xff
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 25 12:00:34 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Aug 2022 12:00:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.393356.632252 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oRBXG-0000PI-1d; Thu, 25 Aug 2022 12:00:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 393356.632252; Thu, 25 Aug 2022 12: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 1oRBXF-0000PB-V4; Thu, 25 Aug 2022 12:00:33 +0000
Received: by outflank-mailman (input) for mailman id 393356;
 Thu, 25 Aug 2022 12:00:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oRBXE-0000Ob-MW
 for xen-changelog@lists.xenproject.org; Thu, 25 Aug 2022 12:00:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oRBXE-0005Fm-Lm
 for xen-changelog@lists.xenproject.org; Thu, 25 Aug 2022 12:00:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oRBXE-00032k-Jk
 for xen-changelog@lists.xenproject.org; Thu, 25 Aug 2022 12:00:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Zxm1MbZGEVw6UKFJBVk8SEGSUuBKTnMUWncIJ7NFBaI=; b=Qd+8xLWHBwFMZm7tR5BfJkUD91
	ByVG4lgIdYrnfrTvIK4JqscG4Wuyr0doP0/Y9GocfokyWd5xr6UlSorCGRm55KeJsEwhNkJrPFeHJ
	OtDDjQtld9AFMXn1raknyiD6wWVud3rKyAa5amEKHyc5R25qtAtrZ9CIGKwDnvVuV9/8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] arm/vgic: fix MISRA C 2012 Rule 20.7 violation
Message-Id: <E1oRBXE-00032k-Jk@xenbits.xenproject.org>
Date: Thu, 25 Aug 2022 12:00:32 +0000

commit 7bb36cbb932da8599b8d57b984fa0e858a8ef7ce
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Wed Aug 24 14:22:29 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Aug 24 14:22:29 2022 +0200

    arm/vgic: fix MISRA C 2012 Rule 20.7 violation
    
    In macro VGIC_V3_LR_INDEX(), add parentheses around the macro parameter
    to prevent against unintended expansions.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/include/asm/new_vgic.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/include/asm/new_vgic.h b/xen/arch/arm/include/asm/new_vgic.h
index ab57fcd91d..b7fa9ab11a 100644
--- a/xen/arch/arm/include/asm/new_vgic.h
+++ b/xen/arch/arm/include/asm/new_vgic.h
@@ -43,7 +43,7 @@ enum vgic_type {
 
 #define VGIC_V2_MAX_LRS         (1 << 6)
 #define VGIC_V3_MAX_LRS         16
-#define VGIC_V3_LR_INDEX(lr)    (VGIC_V3_MAX_LRS - 1 - lr)
+#define VGIC_V3_LR_INDEX(lr)    (VGIC_V3_MAX_LRS - 1 - (lr))
 
 #define VGIC_CONFIG_EDGE        false
 #define VGIC_CONFIG_LEVEL       true
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 25 12:00:44 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Aug 2022 12:00:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.393357.632256 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oRBXQ-0000SW-3D; Thu, 25 Aug 2022 12:00:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 393357.632256; Thu, 25 Aug 2022 12: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 1oRBXQ-0000SO-0a; Thu, 25 Aug 2022 12:00:44 +0000
Received: by outflank-mailman (input) for mailman id 393357;
 Thu, 25 Aug 2022 12:00:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oRBXO-0000S9-QG
 for xen-changelog@lists.xenproject.org; Thu, 25 Aug 2022 12:00:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oRBXO-0005Fw-Of
 for xen-changelog@lists.xenproject.org; Thu, 25 Aug 2022 12:00:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oRBXO-00033h-No
 for xen-changelog@lists.xenproject.org; Thu, 25 Aug 2022 12:00:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=v0h/4eoo/I1QzhYLMMV3WNKwrsJLuBeYOp/7cjB9+2w=; b=GK72k41XXxilg/NGIylKRFGNDq
	TFVFL57+u4RtHs8iPJGP8nEealLyvWqFvDE+ZT6MjwrqPreqfTpTM8VwsONQMJQub3tS3bWT4S7qm
	ZQNBZ2qPHG4eesrBxA+KeDqHIr8BhbPjX8eKXbOl+Fueub5dIUDYCVKz23uwVkTbpie0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] arm/processor: fix MISRA C 2012 Rule 20.7 violations
Message-Id: <E1oRBXO-00033h-No@xenbits.xenproject.org>
Date: Thu, 25 Aug 2022 12:00:42 +0000

commit 1d5b8c434dea074fce0f4cf796bd5169c341a806
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Wed Aug 24 14:23:00 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Aug 24 14:23:00 2022 +0200

    arm/processor: fix MISRA C 2012 Rule 20.7 violations
    
    In macros MPIDR_LEVEL_SHIFT() and MPIDR_AFFINITY_LEVEL(), add parentheses
    around the macro parameters 'level' and 'mpidr', respectively, to prevent
    against unintended expansions.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/include/asm/processor.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/include/asm/processor.h b/xen/arch/arm/include/asm/processor.h
index 55f56b33bc..1dd81d7d52 100644
--- a/xen/arch/arm/include/asm/processor.h
+++ b/xen/arch/arm/include/asm/processor.h
@@ -127,10 +127,10 @@
 #define MPIDR_LEVEL_MASK        ((1 << MPIDR_LEVEL_BITS) - 1)
 
 #define MPIDR_LEVEL_SHIFT(level) \
-         (((1 << level) >> 1) << MPIDR_LEVEL_BITS_SHIFT)
+         (((1 << (level)) >> 1) << MPIDR_LEVEL_BITS_SHIFT)
 
 #define MPIDR_AFFINITY_LEVEL(mpidr, level) \
-         ((mpidr >> MPIDR_LEVEL_SHIFT(level)) & MPIDR_LEVEL_MASK)
+         (((mpidr) >> MPIDR_LEVEL_SHIFT(level)) & MPIDR_LEVEL_MASK)
 
 #define AFFINITY_MASK(level)    ~((_AC(0x1,UL) << MPIDR_LEVEL_SHIFT(level)) - 1)
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 25 12:00:54 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Aug 2022 12:00:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.393358.632260 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oRBXa-0000WI-4o; Thu, 25 Aug 2022 12:00:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 393358.632260; Thu, 25 Aug 2022 12:00:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oRBXa-0000WA-1z; Thu, 25 Aug 2022 12:00:54 +0000
Received: by outflank-mailman (input) for mailman id 393358;
 Thu, 25 Aug 2022 12:00:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oRBXY-0000Vm-SL
 for xen-changelog@lists.xenproject.org; Thu, 25 Aug 2022 12:00:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oRBXY-0005GI-Re
 for xen-changelog@lists.xenproject.org; Thu, 25 Aug 2022 12:00:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oRBXY-00034i-Qp
 for xen-changelog@lists.xenproject.org; Thu, 25 Aug 2022 12:00:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=p4eXwDHu7nNE34NXQMbHuqzB67uIj9OrWVY7Jq/LTkY=; b=r6f1FLe839ZjPAJ7l5LhdQ8pGO
	wLdXS+a7XDBI8BZRLa6Qt+mDhpajZJwojvXxr2tXzPGnGZqH4GFUwsHhG3nPAFkzXXthkdg/Wx9jo
	lHDZg3djcpoKE/u2OewZSQxm8CsSmBrRCf+r1d2b4ybSwPc/7SWTA6dG7tMxK6pvEP5M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/CPUID: surface suitable value in EBX of XSTATE subleaf 1
Message-Id: <E1oRBXY-00034i-Qp@xenbits.xenproject.org>
Date: Thu, 25 Aug 2022 12:00:52 +0000

commit c3bd0b83ea5b7c0da6542687436042eeea1e7909
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Aug 24 14:23:59 2022 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Aug 24 14:23:59 2022 +0200

    x86/CPUID: surface suitable value in EBX of XSTATE subleaf 1
    
    While the SDM isn't very clear about this, our present behavior make
    Linux 5.19 unhappy. As of commit 8ad7e8f69695 ("x86/fpu/xsave: Support
    XSAVEC in the kernel") they're using this CPUID output also to size
    the compacted area used by XSAVEC. Getting back zero there isn't really
    liked, yet for PV that's the default on capable hardware: XSAVES isn't
    exposed to PV domains.
    
    Considering that the size reported is that of the compacted save area,
    I view Linux'es assumption as appropriate (short of the SDM properly
    considering the case). Therefore we need to populate the field also when
    only XSAVEC is supported for a guest.
    
    Fixes: 460b9a4b3630 ("x86/xsaves: enable xsaves/xrstors for hvm guest")
    Fixes: 8d050ed1097c ("x86: don't expose XSAVES capability to PV guests")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/cpuid.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index a4a366ad84..822f9ace10 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -1142,7 +1142,7 @@ void guest_cpuid(const struct vcpu *v, uint32_t leaf,
         switch ( subleaf )
         {
         case 1:
-            if ( p->xstate.xsaves )
+            if ( p->xstate.xsavec || p->xstate.xsaves )
             {
                 /*
                  * TODO: Figure out what to do for XSS state.  VT-x manages
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 25 14:44:09 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Aug 2022 14:44:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.393482.632462 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oRE5V-0001Ed-KB; Thu, 25 Aug 2022 14:44:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 393482.632462; Thu, 25 Aug 2022 14:44:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oRE5V-0001EV-HN; Thu, 25 Aug 2022 14:44:05 +0000
Received: by outflank-mailman (input) for mailman id 393482;
 Thu, 25 Aug 2022 14:44:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oRE5U-0001EP-IJ
 for xen-changelog@lists.xenproject.org; Thu, 25 Aug 2022 14:44:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oRE5U-0008MT-GU
 for xen-changelog@lists.xenproject.org; Thu, 25 Aug 2022 14:44:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oRE5U-0002xs-Eg
 for xen-changelog@lists.xenproject.org; Thu, 25 Aug 2022 14:44:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=A0TuZMk/rJq+b80aDeY/k0nCKPLk0ls3PHZ5wTKDSyM=; b=Z/6J/CPQKc/wiJn40m3vfRD5NS
	YeDtIrMioCLZvpalw9D+oHAnI3eEw1siYyZbrOoG8Wmjf0HAKUe+NT9gxrQ++KrSb1RTtWaWgCd6e
	I+1nOIhrUQcqhXa9r2BHDRK9fZhYtkaoRuO+VKtnNbVjqDEphz/t+oYUiJ+qUy+GJGcw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] Arm32: correct string.h functions for "int" -> "unsigned char" conversion
Message-Id: <E1oRE5U-0002xs-Eg@xenbits.xenproject.org>
Date: Thu, 25 Aug 2022 14:44:04 +0000

commit cbb35e72802f3a285c382a995ef647b59e5caf2f
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Aug 24 14:33:06 2022 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Aug 25 15:35:21 2022 +0100

    Arm32: correct string.h functions for "int" -> "unsigned char" conversion
    
    While Arm64 does so uniformly, for Arm32 only strchr() currently handles
    this properly. Add the necessary conversion also to strrchr(), memchr(),
    and memset().
    
    As to the placement in memset(): Putting the new insn at the beginning
    of the function is apparently deemed more "obvious". It could be placed
    later, as the code reachable without ever making it to the "1" label
    only ever does byte stores.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/arch/arm/arm32/lib/memchr.S  | 1 +
 xen/arch/arm/arm32/lib/memset.S  | 1 +
 xen/arch/arm/arm32/lib/strrchr.S | 1 +
 3 files changed, 3 insertions(+)

diff --git a/xen/arch/arm/arm32/lib/memchr.S b/xen/arch/arm/arm32/lib/memchr.S
index 7dae4ab6a6..f38374a43e 100644
--- a/xen/arch/arm/arm32/lib/memchr.S
+++ b/xen/arch/arm/arm32/lib/memchr.S
@@ -14,6 +14,7 @@
 	.text
 	.align	5
 ENTRY(memchr)
+	and	r1, r1, #0xff
 1:	subs	r2, r2, #1
 	bmi	2f
 	ldrb	r3, [r0], #1
diff --git a/xen/arch/arm/arm32/lib/memset.S b/xen/arch/arm/arm32/lib/memset.S
index 5a1dadf767..ce82c45910 100644
--- a/xen/arch/arm/arm32/lib/memset.S
+++ b/xen/arch/arm/arm32/lib/memset.S
@@ -15,6 +15,7 @@
 	.align	5
 
 ENTRY(memset)
+	and	r1, r1, #0xff
 	ands	r3, r0, #3		@ 1 unaligned?
 	mov	ip, r0			@ preserve r0 as return value
 	bne	6f			@ 1
diff --git a/xen/arch/arm/arm32/lib/strrchr.S b/xen/arch/arm/arm32/lib/strrchr.S
index ec4d40de5e..374ce3e59d 100644
--- a/xen/arch/arm/arm32/lib/strrchr.S
+++ b/xen/arch/arm/arm32/lib/strrchr.S
@@ -14,6 +14,7 @@
 		.text
 		.align	5
 ENTRY(strrchr)
+		and	r1, r1, #0xff
 		mov	r3, #0
 1:		ldrb	r2, [r0], #1
 		teq	r2, r1
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 26 13:22:06 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Aug 2022 13:22:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.393891.633081 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oRZHe-0006kX-Iq; Fri, 26 Aug 2022 13:22:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 393891.633081; Fri, 26 Aug 2022 13:22:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oRZHe-0006kP-FN; Fri, 26 Aug 2022 13:22:02 +0000
Received: by outflank-mailman (input) for mailman id 393891;
 Fri, 26 Aug 2022 13:22:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oRZHd-0006kJ-VG
 for xen-changelog@lists.xenproject.org; Fri, 26 Aug 2022 13:22:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oRZHd-0000vX-US
 for xen-changelog@lists.xenproject.org; Fri, 26 Aug 2022 13:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oRZHd-0003VB-TY
 for xen-changelog@lists.xenproject.org; Fri, 26 Aug 2022 13:22:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=iBnjw4dERS7yvVDABRkzvdeNjg3ff5LsRcpj+Uwzo/4=; b=UMWxAD0AIcEcCNrCbbRx1Qi79U
	hsox5ez37k7ZlXgZW4b5I0LZF7PP98J0CgiZpIWRdE2OoJq5vnr8QI8Y7BOn4Wnpm9ShpoZ7Q0UpB
	xSFMdQMzpFwbJxTMZOXmRpdYU00rEWSmBXe2LXUmFLm/gFFCFb76PqGudq2v6V+CBVX0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Arm32: correct string.h functions for "int" -> "unsigned char" conversion
Message-Id: <E1oRZHd-0003VB-TY@xenbits.xenproject.org>
Date: Fri, 26 Aug 2022 13:22:01 +0000

commit cbb35e72802f3a285c382a995ef647b59e5caf2f
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Aug 24 14:33:06 2022 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Aug 25 15:35:21 2022 +0100

    Arm32: correct string.h functions for "int" -> "unsigned char" conversion
    
    While Arm64 does so uniformly, for Arm32 only strchr() currently handles
    this properly. Add the necessary conversion also to strrchr(), memchr(),
    and memset().
    
    As to the placement in memset(): Putting the new insn at the beginning
    of the function is apparently deemed more "obvious". It could be placed
    later, as the code reachable without ever making it to the "1" label
    only ever does byte stores.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/arch/arm/arm32/lib/memchr.S  | 1 +
 xen/arch/arm/arm32/lib/memset.S  | 1 +
 xen/arch/arm/arm32/lib/strrchr.S | 1 +
 3 files changed, 3 insertions(+)

diff --git a/xen/arch/arm/arm32/lib/memchr.S b/xen/arch/arm/arm32/lib/memchr.S
index 7dae4ab6a6..f38374a43e 100644
--- a/xen/arch/arm/arm32/lib/memchr.S
+++ b/xen/arch/arm/arm32/lib/memchr.S
@@ -14,6 +14,7 @@
 	.text
 	.align	5
 ENTRY(memchr)
+	and	r1, r1, #0xff
 1:	subs	r2, r2, #1
 	bmi	2f
 	ldrb	r3, [r0], #1
diff --git a/xen/arch/arm/arm32/lib/memset.S b/xen/arch/arm/arm32/lib/memset.S
index 5a1dadf767..ce82c45910 100644
--- a/xen/arch/arm/arm32/lib/memset.S
+++ b/xen/arch/arm/arm32/lib/memset.S
@@ -15,6 +15,7 @@
 	.align	5
 
 ENTRY(memset)
+	and	r1, r1, #0xff
 	ands	r3, r0, #3		@ 1 unaligned?
 	mov	ip, r0			@ preserve r0 as return value
 	bne	6f			@ 1
diff --git a/xen/arch/arm/arm32/lib/strrchr.S b/xen/arch/arm/arm32/lib/strrchr.S
index ec4d40de5e..374ce3e59d 100644
--- a/xen/arch/arm/arm32/lib/strrchr.S
+++ b/xen/arch/arm/arm32/lib/strrchr.S
@@ -14,6 +14,7 @@
 		.text
 		.align	5
 ENTRY(strrchr)
+		and	r1, r1, #0xff
 		mov	r3, #0
 1:		ldrb	r2, [r0], #1
 		teq	r2, r1
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Aug 31 19:00:12 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 31 Aug 2022 19:00:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.396004.635935 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oTSwY-0002Ze-7F; Wed, 31 Aug 2022 19:00:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 396004.635935; Wed, 31 Aug 2022 19:00:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oTSwY-0002ZX-3s; Wed, 31 Aug 2022 19:00:06 +0000
Received: by outflank-mailman (input) for mailman id 396004;
 Wed, 31 Aug 2022 19:00:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oTSwW-0002Jw-6n
 for xen-changelog@lists.xenproject.org; Wed, 31 Aug 2022 19:00:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oTSwW-00058h-5e
 for xen-changelog@lists.xenproject.org; Wed, 31 Aug 2022 19:00:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oTSwW-0003Ey-4e
 for xen-changelog@lists.xenproject.org; Wed, 31 Aug 2022 19:00:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=AcDgDGwqdZXQFaU06nK2f1GSJKLo2CyRowOgharym4Y=; b=TDkTQDIzPHq7c8f4DmqdyUuHSL
	zE0TESzPBnpTcOUmLBkv3tlhbkJ3CCKOJtQQrJsTk/FzkxE9goF3m+O3FnqnheE71jWrO9gNF6vGk
	kL3Mc9n3pHSRba1jGk2xddClvJzZBxtKYpUhPfTEvf7n5TLs/y4xWzWenIc2S0ERN8XA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: Support properly __ro_after_init on Arm
Message-Id: <E1oTSwW-0003Ey-4e@xenbits.xenproject.org>
Date: Wed, 31 Aug 2022 19:00:04 +0000

commit ace403022358b736755e3042e949540e775c65f1
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Aug 16 19:59:54 2022 +0100
Commit:     Julien Grall <julien@xen.org>
CommitDate: Wed Aug 31 19:53:06 2022 +0100

    xen/arm: Support properly __ro_after_init on Arm
    
    __ro_after_init was introduced recently to prevent modifying
    some variables after init.
    
    At the moment, on Arm, the variables will still be accessible
    because the region permission is not updated.
    
    Address that by moving the sections .data.ro_after_init
    out of .data and then map the region read-only once we finish
    to boot.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Penny Zheng <penny.zheng@arm.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Tested-by: Henry Wang <Henry.Wang@arm.com>
---
 xen/arch/arm/include/asm/setup.h |  2 ++
 xen/arch/arm/setup.c             | 14 ++++++++++++++
 xen/arch/arm/xen.lds.S           |  7 +++++++
 3 files changed, 23 insertions(+)

diff --git a/xen/arch/arm/include/asm/setup.h b/xen/arch/arm/include/asm/setup.h
index 2bb01ecfa8..5815ccf8c5 100644
--- a/xen/arch/arm/include/asm/setup.h
+++ b/xen/arch/arm/include/asm/setup.h
@@ -137,6 +137,8 @@ u32 device_tree_get_u32(const void *fdt, int node,
 int map_range_to_domain(const struct dt_device_node *dev,
                         u64 addr, u64 len, void *data);
 
+extern const char __ro_after_init_start[], __ro_after_init_end[];
+
 #endif
 /*
  * Local variables:
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 500307edc0..6e0398f3f6 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -75,10 +75,24 @@ domid_t __read_mostly max_init_domid;
 
 static __used void init_done(void)
 {
+    int rc;
+
     /* Must be done past setting system_state. */
     unregister_init_virtual_region();
 
     free_init_memory();
+
+    /*
+     * We have finished booting. Mark the section .data.ro_after_init
+     * read-only.
+     */
+    rc = modify_xen_mappings((unsigned long)&__ro_after_init_start,
+                             (unsigned long)&__ro_after_init_end,
+                             PAGE_HYPERVISOR_RO);
+    if ( rc )
+        panic("Unable to mark the .data.ro_after_init section read-only (rc = %d)\n",
+              rc);
+
     startup_cpu_idle_loop();
 }
 
diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S
index 1e986e211f..92c2984052 100644
--- a/xen/arch/arm/xen.lds.S
+++ b/xen/arch/arm/xen.lds.S
@@ -83,6 +83,13 @@ SECTIONS
   _erodata = .;                /* End of read-only data */
 
   . = ALIGN(PAGE_SIZE);
+  .data.ro_after_init : {
+      __ro_after_init_start = .;
+      *(.data.ro_after_init)
+      . = ALIGN(PAGE_SIZE);
+      __ro_after_init_end = .;
+  } : text
+
   .data.read_mostly : {
        /* Exception table */
        __start___ex_table = .;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Aug 31 19:22:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 31 Aug 2022 19:22:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.396024.635972 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oTTHq-0006ET-G3; Wed, 31 Aug 2022 19:22:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 396024.635972; Wed, 31 Aug 2022 19:22:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oTTHq-0006EM-D6; Wed, 31 Aug 2022 19:22:06 +0000
Received: by outflank-mailman (input) for mailman id 396024;
 Wed, 31 Aug 2022 19:22:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oTTHo-0006E9-Vt
 for xen-changelog@lists.xenproject.org; Wed, 31 Aug 2022 19:22:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oTTHo-0005UV-V2
 for xen-changelog@lists.xenproject.org; Wed, 31 Aug 2022 19:22:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oTTHo-0004Mu-UA
 for xen-changelog@lists.xenproject.org; Wed, 31 Aug 2022 19:22:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zeYMSZL2yCzA3Zq6CbVmSstNL1DSQkkweAtuSLUatRQ=; b=HtF/gLXWUuGQjzVceRARwESTdD
	zra9vPyOyOuEM3ErVbFRfsL6Mi9y7YozSPFf5cLOSebz/UV7GssndQCUHUh1EDjMtdiErDokYHeVv
	eRkmA1WavFy0SeXMvLjqwmm9dHohVUvCO2o18WyhaOxS+ljbj/knW/e5zQqv2A5LygPE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm64: head: Don't set x22 and update the documentation
Message-Id: <E1oTTHo-0004Mu-UA@xenbits.xenproject.org>
Date: Wed, 31 Aug 2022 19:22:04 +0000

commit 471721c341cb56487324410f501b7f012d313e0e
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Fri Aug 12 20:24:40 2022 +0100
Commit:     Julien Grall <julien@xen.org>
CommitDate: Wed Aug 31 20:10:47 2022 +0100

    xen/arm64: head: Don't set x22 and update the documentation
    
    Since commit 7e14a47e7c73 ("xen/arm64: head Rework and document
    launch()"), the boot code is setting x22 but not read it.
    
    So remove the two instructions setting x22 and update the documentation
    to show x22 has no specific purpose.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Wei Chen <Wei.Chen@arm.com>
---
 xen/arch/arm/arm64/head.S | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S
index 1babcc65d7..26cc7705f5 100644
--- a/xen/arch/arm/arm64/head.S
+++ b/xen/arch/arm/arm64/head.S
@@ -71,7 +71,7 @@
  *  x19 - paddr(start)
  *  x20 - phys offset
  *  x21 - DTB address (boot cpu only)
- *  x22 - is_secondary_cpu
+ *  x22 -
  *  x23 - UART address
  *  x24 -
  *  x25 -
@@ -305,8 +305,6 @@ real_start_efi:
 #endif
         PRINT("- Boot CPU booting -\r\n")
 
-        mov   x22, #0                /* x22 := is_secondary_cpu */
-
         bl    check_cpu_mode
         bl    cpu_init
         bl    create_page_tables
@@ -345,8 +343,6 @@ GLOBAL(init_secondary)
         adr   x19, start             /* x19 := paddr (start) */
         sub   x20, x19, x0           /* x20 := phys-offset */
 
-        mov   x22, #1                /* x22 := is_secondary_cpu */
-
         mrs   x0, mpidr_el1
         ldr   x13, =(~MPIDR_HWID_MASK)
         bic   x24, x0, x13           /* Mask out flags to get CPU ID */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Aug 31 19:22:16 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 31 Aug 2022 19:22:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.396025.635976 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oTTI0-0006Ie-HK; Wed, 31 Aug 2022 19:22:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 396025.635976; Wed, 31 Aug 2022 19:22:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oTTI0-0006IV-Ec; Wed, 31 Aug 2022 19:22:16 +0000
Received: by outflank-mailman (input) for mailman id 396025;
 Wed, 31 Aug 2022 19:22:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oTTHz-0006I3-2g
 for xen-changelog@lists.xenproject.org; Wed, 31 Aug 2022 19:22:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oTTHz-0005Ui-1q
 for xen-changelog@lists.xenproject.org; Wed, 31 Aug 2022 19:22:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oTTHz-0004NR-0o
 for xen-changelog@lists.xenproject.org; Wed, 31 Aug 2022 19:22:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9lQzUh5fUk9Df3BYZLvqJqKzgcE/GvFhTJBEicoJy8E=; b=GO4IO+6HfF7de6xjmfge6yVN9u
	bR9ToBIqOxugBG8WgpU4oxKYjWZQ+24hBRrh1Rv/ZJ1P6bqPx4m07Cg+2fyI060ahUu3/u868NLBI
	lewjdyK1FW0wUCnBe1TKTk4dgUTN+qvOuqqMbIq2hYK04JY5jpYt0Rzih+11fJ4/31FY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm64: head: Introduce get_table_slot() and use it
Message-Id: <E1oTTHz-0004NR-0o@xenbits.xenproject.org>
Date: Wed, 31 Aug 2022 19:22:15 +0000

commit 0f94a5a7fb5fbf50979227b54f82577f8bb51b65
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Fri Aug 12 20:24:41 2022 +0100
Commit:     Julien Grall <julien@xen.org>
CommitDate: Wed Aug 31 20:16:04 2022 +0100

    xen/arm64: head: Introduce get_table_slot() and use it
    
    There are a few places in the code that need to find the slot
    at a given page-table level.
    
    So create a new macro get_table_slot() for that. This will reduce
    the effort to figure out whether the code is doing the right thing.
    
    Take the opportunity to use 'ubfx'. The only benefits is reducing
    the number of instructions from 2 to 1.
    
    The new macro is used everywhere we need to compute the slot. This
    requires to tweak the parameter of create_table_entry() to pass
    a level rather than shift.
    
    Note, for slot 0 the code is currently skipping the masking part. While
    this is fine, it is safer to mask it as technically slot 0 only covers
    bit 48 - 39 bit (assuming 4KB page granularity).
    
    Take the opportunity to correct the comment when finding the second
    slot for the identity mapping (we are computing the second slot
    rather than first).
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Wei Chen <Wei.Chen@arm.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/arch/arm/arm64/head.S | 55 ++++++++++++++++++++++++++---------------------
 1 file changed, 30 insertions(+), 25 deletions(-)

diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S
index 26cc7705f5..ad014716db 100644
--- a/xen/arch/arm/arm64/head.S
+++ b/xen/arch/arm/arm64/head.S
@@ -493,13 +493,24 @@ cpu_init:
         ret
 ENDPROC(cpu_init)
 
+/*
+ * Macro to find the slot number at a given page-table level
+ *
+ * slot:     slot computed
+ * virt:     virtual address
+ * lvl:      page-table level
+ */
+.macro get_table_slot, slot, virt, lvl
+        ubfx  \slot, \virt, #XEN_PT_LEVEL_SHIFT(\lvl), #XEN_PT_LPAE_SHIFT
+.endm
+
 /*
  * Macro to create a page table entry in \ptbl to \tbl
  *
  * ptbl:    table symbol where the entry will be created
  * tbl:     table symbol to point to
  * virt:    virtual address
- * shift:   #imm page table shift
+ * lvl:     page-table level
  * tmp1:    scratch register
  * tmp2:    scratch register
  * tmp3:    scratch register
@@ -511,9 +522,8 @@ ENDPROC(cpu_init)
  *
  * Note that all parameters using registers should be distinct.
  */
-.macro create_table_entry, ptbl, tbl, virt, shift, tmp1, tmp2, tmp3
-        lsr   \tmp1, \virt, #\shift
-        and   \tmp1, \tmp1, #XEN_PT_LPAE_ENTRY_MASK/* \tmp1 := slot in \tlb */
+.macro create_table_entry, ptbl, tbl, virt, lvl, tmp1, tmp2, tmp3
+        get_table_slot \tmp1, \virt, \lvl   /* \tmp1 := slot in \tlb */
 
         load_paddr \tmp2, \tbl
         mov   \tmp3, #PT_PT                 /* \tmp3 := right for linear PT */
@@ -544,8 +554,7 @@ ENDPROC(cpu_init)
 .macro create_mapping_entry, ptbl, virt, phys, tmp1, tmp2, tmp3, type=PT_MEM_L3
         and   \tmp3, \phys, #THIRD_MASK     /* \tmp3 := PAGE_ALIGNED(phys) */
 
-        lsr   \tmp1, \virt, #THIRD_SHIFT
-        and   \tmp1, \tmp1, #XEN_PT_LPAE_ENTRY_MASK/* \tmp1 := slot in \tlb */
+        get_table_slot \tmp1, \virt, 3      /* \tmp1 := slot in \tlb */
 
         mov   \tmp2, #\type                 /* \tmp2 := right for section PT */
         orr   \tmp2, \tmp2, \tmp3           /*          + PAGE_ALIGNED(phys) */
@@ -573,9 +582,9 @@ ENDPROC(cpu_init)
 create_page_tables:
         /* Prepare the page-tables for mapping Xen */
         ldr   x0, =XEN_VIRT_START
-        create_table_entry boot_pgtable, boot_first, x0, ZEROETH_SHIFT, x1, x2, x3
-        create_table_entry boot_first, boot_second, x0, FIRST_SHIFT, x1, x2, x3
-        create_table_entry boot_second, boot_third, x0, SECOND_SHIFT, x1, x2, x3
+        create_table_entry boot_pgtable, boot_first, x0, 0, x1, x2, x3
+        create_table_entry boot_first, boot_second, x0, 1, x1, x2, x3
+        create_table_entry boot_second, boot_third, x0, 2, x1, x2, x3
 
         /* Map Xen */
         adr_l x4, boot_third
@@ -612,10 +621,10 @@ create_page_tables:
          * XEN_ZEROETH_SLOT, then the 1:1 mapping will use its own set of
          * page-tables from the first level.
          */
-        lsr   x0, x19, #ZEROETH_SHIFT   /* x0 := zeroeth slot */
+        get_table_slot x0, x19, 0       /* x0 := zeroeth slot */
         cmp   x0, #XEN_ZEROETH_SLOT
         beq   1f
-        create_table_entry boot_pgtable, boot_first_id, x19, ZEROETH_SHIFT, x0, x1, x2
+        create_table_entry boot_pgtable, boot_first_id, x19, 0, x0, x1, x2
         b     link_from_first_id
 
 1:
@@ -624,11 +633,10 @@ create_page_tables:
          * then the 1:1 mapping will use its own set of page-tables from
          * the second level.
          */
-        lsr   x0, x19, #FIRST_SHIFT
-        and   x0, x0, #XEN_PT_LPAE_ENTRY_MASK  /* x0 := first slot */
+        get_table_slot x0, x19, 1      /* x0 := first slot */
         cmp   x0, #XEN_FIRST_SLOT
         beq   1f
-        create_table_entry boot_first, boot_second_id, x19, FIRST_SHIFT, x0, x1, x2
+        create_table_entry boot_first, boot_second_id, x19, 1, x0, x1, x2
         b     link_from_second_id
 
 1:
@@ -638,17 +646,16 @@ create_page_tables:
          * third level. For slot XEN_SECOND_SLOT, Xen is not yet able to handle
          * it.
          */
-        lsr   x0, x19, #SECOND_SHIFT
-        and   x0, x0, #XEN_PT_LPAE_ENTRY_MASK  /* x0 := first slot */
+        get_table_slot x0, x19, 2     /* x0 := second slot */
         cmp   x0, #XEN_SECOND_SLOT
         beq   virtphys_clash
-        create_table_entry boot_second, boot_third_id, x19, SECOND_SHIFT, x0, x1, x2
+        create_table_entry boot_second, boot_third_id, x19, 2, x0, x1, x2
         b     link_from_third_id
 
 link_from_first_id:
-        create_table_entry boot_first_id, boot_second_id, x19, FIRST_SHIFT, x0, x1, x2
+        create_table_entry boot_first_id, boot_second_id, x19, 1, x0, x1, x2
 link_from_second_id:
-        create_table_entry boot_second_id, boot_third_id, x19, SECOND_SHIFT, x0, x1, x2
+        create_table_entry boot_second_id, boot_third_id, x19, 2, x0, x1, x2
 link_from_third_id:
         create_mapping_entry boot_third_id, x19, x19, x0, x1, x2
         ret
@@ -705,7 +712,7 @@ remove_identity_mapping:
          * Find the zeroeth slot used. Remove the entry from zeroeth
          * table if the slot is not XEN_ZEROETH_SLOT.
          */
-        lsr   x1, x19, #ZEROETH_SHIFT   /* x1 := zeroeth slot */
+        get_table_slot x1, x19, 0       /* x1 := zeroeth slot */
         cmp   x1, #XEN_ZEROETH_SLOT
         beq   1f
         /* It is not in slot XEN_ZEROETH_SLOT, remove the entry. */
@@ -718,8 +725,7 @@ remove_identity_mapping:
          * Find the first slot used. Remove the entry for the first
          * table if the slot is not XEN_FIRST_SLOT.
          */
-        lsr   x1, x19, #FIRST_SHIFT
-        and   x1, x1, #XEN_PT_LPAE_ENTRY_MASK  /* x1 := first slot */
+        get_table_slot x1, x19, 1       /* x1 := first slot */
         cmp   x1, #XEN_FIRST_SLOT
         beq   1f
         /* It is not in slot XEN_FIRST_SLOT, remove the entry. */
@@ -732,8 +738,7 @@ remove_identity_mapping:
          * Find the second slot used. Remove the entry for the first
          * table if the slot is not XEN_SECOND_SLOT.
          */
-        lsr   x1, x19, #SECOND_SHIFT
-        and   x1, x1, #XEN_PT_LPAE_ENTRY_MASK  /* x1 := first slot */
+        get_table_slot x1, x19, 2       /* x1 := second slot */
         cmp   x1, #XEN_SECOND_SLOT
         beq   identity_mapping_removed
         /* It is not in slot 1, remove the entry */
@@ -771,7 +776,7 @@ setup_fixmap:
 #endif
         /* Map fixmap into boot_second */
         ldr   x0, =FIXMAP_ADDR(0)
-        create_table_entry boot_second, xen_fixmap, x0, SECOND_SHIFT, x1, x2, x3
+        create_table_entry boot_second, xen_fixmap, x0, 2, x1, x2, x3
         /* Ensure any page table updates made above have occurred. */
         dsb   nshst
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Aug 31 19:22:26 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 31 Aug 2022 19:22:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.396026.635980 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oTTIA-0006LU-It; Wed, 31 Aug 2022 19:22:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 396026.635980; Wed, 31 Aug 2022 19:22:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oTTIA-0006LM-GD; Wed, 31 Aug 2022 19:22:26 +0000
Received: by outflank-mailman (input) for mailman id 396026;
 Wed, 31 Aug 2022 19:22:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oTTI9-0006L8-6c
 for xen-changelog@lists.xenproject.org; Wed, 31 Aug 2022 19:22:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oTTI9-0005Us-5u
 for xen-changelog@lists.xenproject.org; Wed, 31 Aug 2022 19:22:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oTTI9-0004OD-4R
 for xen-changelog@lists.xenproject.org; Wed, 31 Aug 2022 19:22:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=13f6M0siKTmERyZbFplUbxqP4FIXAgvpNxMEOnHVLKQ=; b=0GEfzJbN+hOh7qdJp7btidPygM
	Yv/e1TSvvl/HDNF2FyM94wkWrGGK/CXsTedK6scUFFS/VwGzeC7JrE33wZImu3A5X7cZB01CXMmJg
	+7NVpykVEQMFlOfua6WCVV7C/l8JBPwfwUVP8KG2j80zJEurZ19EnxW0NxzDyfSpqUP4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm32: head: Introduce get_table_slot() and use it
Message-Id: <E1oTTI9-0004OD-4R@xenbits.xenproject.org>
Date: Wed, 31 Aug 2022 19:22:25 +0000

commit f93f7f70deca381e232968dc21da16522f28da6a
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Fri Aug 12 20:24:42 2022 +0100
Commit:     Julien Grall <julien@xen.org>
CommitDate: Wed Aug 31 20:16:22 2022 +0100

    xen/arm32: head: Introduce get_table_slot() and use it
    
    There are a few places in the code that need to find the slot at a
    given page-table level.
    
    So create a new macro get_table_slot() for that. This will reduce
    the effort to figure out whether the code is doing the right thing.
    
    The new macro is using 'ubfx' (or 'lsr' for the first level) rather
    than the existing sequence (mov_w, lsr, and) because it doesn't require
    a scratch register and reduce the number of instructions (4 -> 1).
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Tested-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Wei Chen <Wei.Chen@arm.com>
---
 xen/arch/arm/arm32/head.S | 56 +++++++++++++++++++++++++++--------------------
 1 file changed, 32 insertions(+), 24 deletions(-)

diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S
index 46d93bebba..50f6fa4eb3 100644
--- a/xen/arch/arm/arm32/head.S
+++ b/xen/arch/arm/arm32/head.S
@@ -358,13 +358,31 @@ cpu_init_done:
         mov   pc, r5                        /* Return address is in r5 */
 ENDPROC(cpu_init)
 
+/*
+ * Macro to find the slot number at a given page-table level
+ *
+ * slot:     slot computed
+ * virt:     virtual address
+ * lvl:      page-table level
+ *
+ * Note that ubxf is unpredictable when the end bit is above 32-bit. So we
+ * can't use it for first level offset.
+ */
+.macro get_table_slot, slot, virt, lvl
+    .if \lvl == 1
+        lsr   \slot, \virt, #XEN_PT_LEVEL_SHIFT(\lvl)
+    .else
+        ubfx  \slot, \virt, #XEN_PT_LEVEL_SHIFT(\lvl), #XEN_PT_LPAE_SHIFT
+    .endif
+.endm
+
 /*
  * Macro to create a page table entry in \ptbl to \tbl
  *
  * ptbl:    table symbol where the entry will be created
  * tbl:     table symbol to point to
  * virt:    virtual address
- * shift:   #imm page table shift
+ * lvl:     page-table level
  * mmu:     Is the MMU turned on/off. If not specified it will be off
  *
  * Preserves \virt
@@ -374,11 +392,9 @@ ENDPROC(cpu_init)
  *
  * Note that \virt should be in a register other than r1 - r4
  */
-.macro create_table_entry, ptbl, tbl, virt, shift, mmu=0
-        lsr   r1, \virt, #\shift
-        mov_w r2, XEN_PT_LPAE_ENTRY_MASK
-        and   r1, r1, r2             /* r1 := slot in \tlb */
-        lsl   r1, r1, #3             /* r1 := slot offset in \tlb */
+.macro create_table_entry, ptbl, tbl, virt, lvl, mmu=0
+        get_table_slot r1, \virt, \lvl  /* r1 := slot in \tlb */
+        lsl   r1, r1, #3                /* r1 := slot offset in \tlb */
 
         load_paddr r4, \tbl
 
@@ -448,8 +464,8 @@ ENDPROC(cpu_init)
 create_page_tables:
         /* Prepare the page-tables for mapping Xen */
         ldr   r0, =XEN_VIRT_START
-        create_table_entry boot_pgtable, boot_second, r0, FIRST_SHIFT
-        create_table_entry boot_second, boot_third, r0, SECOND_SHIFT
+        create_table_entry boot_pgtable, boot_second, r0, 1
+        create_table_entry boot_second, boot_third, r0, 2
 
         /* Setup boot_third: */
         adr_l r4, boot_third, mmu=0
@@ -486,12 +502,10 @@ create_page_tables:
          * then the 1:1 mapping will use its own set of page-tables from
          * the second level.
          */
-        lsr   r1, r9, #FIRST_SHIFT
-        mov_w r0, XEN_PT_LPAE_ENTRY_MASK
-        and   r1, r1, r0              /* r1 := first slot */
+        get_table_slot r1, r9, 1     /* r1 := first slot */
         cmp   r1, #XEN_FIRST_SLOT
         beq   1f
-        create_table_entry boot_pgtable, boot_second_id, r9, FIRST_SHIFT
+        create_table_entry boot_pgtable, boot_second_id, r9, 1
         b     link_from_second_id
 
 1:
@@ -501,16 +515,14 @@ create_page_tables:
          * third level. For slot XEN_SECOND_SLOT, Xen is not yet able to handle
          * it.
          */
-        lsr   r1, r9, #SECOND_SHIFT
-        mov_w r0, XEN_PT_LPAE_ENTRY_MASK
-        and   r1, r1, r0             /* r1 := second slot */
+        get_table_slot r1, r9, 2     /* r1 := second slot */
         cmp   r1, #XEN_SECOND_SLOT
         beq   virtphys_clash
-        create_table_entry boot_second, boot_third_id, r9, SECOND_SHIFT
+        create_table_entry boot_second, boot_third_id, r9, 2
         b     link_from_third_id
 
 link_from_second_id:
-        create_table_entry boot_second_id, boot_third_id, r9, SECOND_SHIFT
+        create_table_entry boot_second_id, boot_third_id, r9, 2
 link_from_third_id:
         create_mapping_entry boot_third_id, r9, r9
         mov   pc, lr
@@ -571,9 +583,7 @@ remove_identity_mapping:
          * Find the first slot used. Remove the entry for the first
          * table if the slot is not XEN_FIRST_SLOT.
          */
-        lsr   r1, r9, #FIRST_SHIFT
-        mov_w r0, XEN_PT_LPAE_ENTRY_MASK
-        and   r1, r1, r0              /* r1 := first slot */
+        get_table_slot r1, r9, 1     /* r1 := first slot */
         cmp   r1, #XEN_FIRST_SLOT
         beq   1f
         /* It is not in slot 0, remove the entry */
@@ -587,9 +597,7 @@ remove_identity_mapping:
          * Find the second slot used. Remove the entry for the first
          * table if the slot is not XEN_SECOND_SLOT.
          */
-        lsr   r1, r9, #SECOND_SHIFT
-        mov_w r0, XEN_PT_LPAE_ENTRY_MASK
-        and   r1, r1, r0             /* r1 := second slot */
+        get_table_slot r1, r9, 2     /* r1 := second slot */
         cmp   r1, #XEN_SECOND_SLOT
         beq   identity_mapping_removed
         /* It is not in slot 1, remove the entry */
@@ -628,7 +636,7 @@ setup_fixmap:
 #endif
         /* Map fixmap into boot_second */
         mov_w r0, FIXMAP_ADDR(0)
-        create_table_entry boot_second, xen_fixmap, r0, SECOND_SHIFT, mmu=1
+        create_table_entry boot_second, xen_fixmap, r0, 2, mmu=1
         /* Ensure any page table updates made above have occurred. */
         dsb   nshst
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Aug 31 19:22:36 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 31 Aug 2022 19:22:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.396027.635984 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oTTIK-0006O0-Ka; Wed, 31 Aug 2022 19:22:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 396027.635984; Wed, 31 Aug 2022 19:22:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oTTIK-0006Ns-Hi; Wed, 31 Aug 2022 19:22:36 +0000
Received: by outflank-mailman (input) for mailman id 396027;
 Wed, 31 Aug 2022 19:22:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oTTIJ-0006Ng-9c
 for xen-changelog@lists.xenproject.org; Wed, 31 Aug 2022 19:22:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oTTIJ-0005V6-8s
 for xen-changelog@lists.xenproject.org; Wed, 31 Aug 2022 19:22:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oTTIJ-0004Og-7w
 for xen-changelog@lists.xenproject.org; Wed, 31 Aug 2022 19:22:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kMyJF7rKqbWeSodxCPFx6GDOSVB0/aN8XIytYdK6z0g=; b=CeMzvuX88dWQF2rYh20WAn6qQ1
	ENz7HcZFCylc3qfe+DMkNxwvNBg3OgWDr6Pxbw+Kzn4DF1/NvFn6RDzd5f1uNLR2CZFmvuwL0u61v
	MbdTm0cBUFwzQw2BzxQaRbOOVyW9q4GdEcMi6xIw9eoiZofWMdtSL1YxsSHYf3MuQEr8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm32: heap: Rework adr_l so it doesn't rely on where Xen is loaded
Message-Id: <E1oTTIJ-0004Og-7w@xenbits.xenproject.org>
Date: Wed, 31 Aug 2022 19:22:35 +0000

commit a571c1aab5a11a238eb190d20390435d49cdd50b
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Fri Aug 12 20:24:43 2022 +0100
Commit:     Julien Grall <julien@xen.org>
CommitDate: Wed Aug 31 20:16:22 2022 +0100

    xen/arm32: heap: Rework adr_l so it doesn't rely on where Xen is loaded
    
    At the moment, the macro addr_l needs to know whether the caller
    is running with the MMU on. This is fine today because there are
    only two possible cases:
     1) MMU off
     2) MMU on and linked to the virtual address
    
    This is still cumbersome to use for the developer as they need
    to know if the MMU is on.
    
    Thankfully, Linux developpers came up with a great way to allow
    adr_l to work within the range +/- 4GB of PC by emitting a PC-relative
    reference [1].
    
    Re-use the same approach on Arm and drop the parameter 'mmu'.
    
    [1] 0b1674638a5c ("ARM: assembler: introduce adr_l, ldr_l and str_l macros")
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/arm32/head.S | 38 +++++++++++++++-----------------------
 1 file changed, 15 insertions(+), 23 deletions(-)

diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S
index 50f6fa4eb3..27d02ac8d6 100644
--- a/xen/arch/arm/arm32/head.S
+++ b/xen/arch/arm/arm32/head.S
@@ -49,20 +49,16 @@
 .endm
 
 /*
- * There are no easy way to have a PC relative address within the range
- * +/- 4GB of the PC.
+ * Pseudo-op for PC relative adr <reg>, <symbol> where <symbol> is
+ * within the range +/- 4GB of the PC.
  *
- * This macro workaround it by asking the user to tell whether the MMU
- * has been turned on or not.
- *
- * When the MMU is turned off, we need to apply the physical offset
- * (r10) in order to find the associated physical address.
+ * @dst: destination register
+ * @sym: name of the symbol
  */
-.macro adr_l, dst, sym, mmu
-        ldr   \dst, =\sym
-        .if \mmu == 0
-        add   \dst, \dst, r10
-        .endif
+.macro adr_l, dst, sym
+        mov_w \dst, \sym - .Lpc\@
+        .set  .Lpc\@, .+ 8          /* PC bias */
+        add   \dst, \dst, pc
 .endm
 
 .macro load_paddr rb, sym
@@ -383,7 +379,6 @@ ENDPROC(cpu_init)
  * tbl:     table symbol to point to
  * virt:    virtual address
  * lvl:     page-table level
- * mmu:     Is the MMU turned on/off. If not specified it will be off
  *
  * Preserves \virt
  * Clobbers r1 - r4
@@ -392,7 +387,7 @@ ENDPROC(cpu_init)
  *
  * Note that \virt should be in a register other than r1 - r4
  */
-.macro create_table_entry, ptbl, tbl, virt, lvl, mmu=0
+.macro create_table_entry, ptbl, tbl, virt, lvl
         get_table_slot r1, \virt, \lvl  /* r1 := slot in \tlb */
         lsl   r1, r1, #3                /* r1 := slot offset in \tlb */
 
@@ -402,7 +397,7 @@ ENDPROC(cpu_init)
         orr   r2, r2, r4             /*           + \tlb paddr */
         mov   r3, #0
 
-        adr_l r4, \ptbl, \mmu
+        adr_l r4, \ptbl
 
         strd  r2, r3, [r4, r1]
 .endm
@@ -415,17 +410,14 @@ ENDPROC(cpu_init)
  * virt:    virtual address
  * phys:    physical address
  * type:    mapping type. If not specified it will be normal memory (PT_MEM_L3)
- * mmu:     Is the MMU turned on/off. If not specified it will be off
  *
  * Preserves \virt, \phys
  * Clobbers r1 - r4
  *
- * * Also use r10 for the phys offset.
- *
  * Note that \virt and \paddr should be in other registers than r1 - r4
  * and be distinct.
  */
-.macro create_mapping_entry, ptbl, virt, phys, type=PT_MEM_L3, mmu=0
+.macro create_mapping_entry, ptbl, virt, phys, type=PT_MEM_L3
         mov_w r2, XEN_PT_LPAE_ENTRY_MASK
         lsr   r1, \virt, #THIRD_SHIFT
         and   r1, r1, r2             /* r1 := slot in \tlb */
@@ -438,7 +430,7 @@ ENDPROC(cpu_init)
         orr   r2, r2, r4             /*          + PAGE_ALIGNED(phys) */
         mov   r3, #0
 
-        adr_l r4, \ptbl, \mmu
+        adr_l r4, \ptbl
 
         strd  r2, r3, [r4, r1]
 .endm
@@ -468,7 +460,7 @@ create_page_tables:
         create_table_entry boot_second, boot_third, r0, 2
 
         /* Setup boot_third: */
-        adr_l r4, boot_third, mmu=0
+        adr_l r4, boot_third
 
         lsr   r2, r9, #THIRD_SHIFT  /* Base address for 4K mapping */
         lsl   r2, r2, #THIRD_SHIFT
@@ -632,11 +624,11 @@ setup_fixmap:
 #if defined(CONFIG_EARLY_PRINTK)
         /* Add UART to the fixmap table */
         ldr   r0, =EARLY_UART_VIRTUAL_ADDRESS
-        create_mapping_entry xen_fixmap, r0, r11, type=PT_DEV_L3, mmu=1
+        create_mapping_entry xen_fixmap, r0, r11, type=PT_DEV_L3
 #endif
         /* Map fixmap into boot_second */
         mov_w r0, FIXMAP_ADDR(0)
-        create_table_entry boot_second, xen_fixmap, r0, 2, mmu=1
+        create_table_entry boot_second, xen_fixmap, r0, 2
         /* Ensure any page table updates made above have occurred. */
         dsb   nshst
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Aug 31 19:22:46 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 31 Aug 2022 19:22:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.396028.635988 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oTTIU-0006RH-Nk; Wed, 31 Aug 2022 19:22:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 396028.635988; Wed, 31 Aug 2022 19:22:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oTTIU-0006RA-LB; Wed, 31 Aug 2022 19:22:46 +0000
Received: by outflank-mailman (input) for mailman id 396028;
 Wed, 31 Aug 2022 19:22:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oTTIT-0006Qy-Dm
 for xen-changelog@lists.xenproject.org; Wed, 31 Aug 2022 19:22:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oTTIT-0005VG-Bf
 for xen-changelog@lists.xenproject.org; Wed, 31 Aug 2022 19:22:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oTTIT-0004P5-Ar
 for xen-changelog@lists.xenproject.org; Wed, 31 Aug 2022 19:22:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=D4WmJdsobNH8bQxKP2LBDxWA2D+0s+sv6J1vg/z/KV4=; b=QRhrjEckVa8k5TPTpu1xYJg5Gt
	3xmgNNptwoNw8yPbFZKwlQPcQBeRhIjr1aKIZheXPpEllAtLMFt5cDNfBNSwC/MAd4aN29MFZ40j7
	U/e7VYhF5Uu+CZ8MYKb9zu/UiP+ais4SJucAC+GjRc01YLUvvbydCgFNgE/DkiFgx8EE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm32: head: Move earlyprintk messages to .rodata.str
Message-Id: <E1oTTIT-0004P5-Ar@xenbits.xenproject.org>
Date: Wed, 31 Aug 2022 19:22:45 +0000

commit 3babad2af858630b9196b89681a54d4360d39025
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Fri Aug 12 20:24:44 2022 +0100
Commit:     Julien Grall <julien@xen.org>
CommitDate: Wed Aug 31 20:16:22 2022 +0100

    xen/arm32: head: Move earlyprintk messages to .rodata.str
    
    At the moment, the strings are in text right after each use because
    the instruction 'adr' has specific requirement on the location
    and the compiler will forbid cross section label.
    
    The macro 'adr_l' was recently reworked so the caller doesn't need
    to know whether the MMU is on. This makes it easier to use where
    instructions can be run in both context.
    
    This also means that the strings don't need to be part of .text
    anymore. So move them to .rodata.str.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jiamei Xie <jiamei.xie@arm.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Tested-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Wei Chen <Wei.Chen@arm.com>
---
 xen/arch/arm/arm32/head.S | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S
index 27d02ac8d6..a558c2a687 100644
--- a/xen/arch/arm/arm32/head.S
+++ b/xen/arch/arm/arm32/head.S
@@ -93,13 +93,10 @@
  */
 #define PRINT(_s)           \
         mov   r3, lr       ;\
-        adr   r0, 98f      ;\
+        adr_l r0, 98f      ;\
         bl    puts         ;\
         mov   lr, r3       ;\
-        b     99f          ;\
-98:     .asciz _s          ;\
-        .align 2           ;\
-99:
+        RODATA_STR(98, _s)
 
 /*
  * Macro to print the value of register \rb
@@ -736,7 +733,7 @@ ENDPROC(puts)
  * Clobbers r0-r3
  */
 putn:
-        adr   r1, hex
+        adr_l r1, hex
         mov   r3, #8
 1:
         early_uart_ready r11, r2
@@ -749,8 +746,7 @@ putn:
         mov   pc, lr
 ENDPROC(putn)
 
-hex:    .ascii "0123456789abcdef"
-        .align 2
+RODATA_STR(hex, "0123456789abcdef")
 
 #else  /* CONFIG_EARLY_PRINTK */
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Aug 31 19:22:56 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 31 Aug 2022 19:22:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.396029.635994 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oTTIe-0006UA-QG; Wed, 31 Aug 2022 19:22:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 396029.635994; Wed, 31 Aug 2022 19:22:56 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oTTIe-0006U0-Mj; Wed, 31 Aug 2022 19:22:56 +0000
Received: by outflank-mailman (input) for mailman id 396029;
 Wed, 31 Aug 2022 19:22:55 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oTTId-0006Tg-FE
 for xen-changelog@lists.xenproject.org; Wed, 31 Aug 2022 19:22:55 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oTTId-0005Vg-ET
 for xen-changelog@lists.xenproject.org; Wed, 31 Aug 2022 19:22:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oTTId-0004PU-Dg
 for xen-changelog@lists.xenproject.org; Wed, 31 Aug 2022 19:22:55 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=2meBpamhbj3R9LbKuQxYIrh2t8dRlIJH1j1atIqlcL4=; b=LEncDYXwOs0DOxSem1wKkpEZUu
	r3yL2rB8Niec8mmkx4OXApUA33X7xoRr6jRcJlkK6Q4Pkhmm1J0Bm6W1zvnNHbbmMcoiuXrO/GrM2
	w5MvEctto295qhTMqIPyEhnBiZpva/ibw3WHhPO0ZfxwS4WuhSJeXDq6gfKUsTZfxEYk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: Tweak the dump page-table walk output
Message-Id: <E1oTTId-0004PU-Dg@xenbits.xenproject.org>
Date: Wed, 31 Aug 2022 19:22:55 +0000

commit e1710891c72b513dea8e24a3e0d8969a91a4fa39
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Fri Aug 12 20:24:45 2022 +0100
Commit:     Julien Grall <julien@xen.org>
CommitDate: Wed Aug 31 20:16:22 2022 +0100

    xen/arm: Tweak the dump page-table walk output
    
    Currently the output is looking like:
    
    (XEN) 1ST[0x1] = 0x000000004015ff7f
    (XEN) 2ND[0x1f] = 0x00500000bfe00f7d
    
    The content of the entries are not aligned making a bit trickier to
    read (I appreciate this is a matter of taste).
    
    Align the values by forcing the index to be always printed using
    3 characters (enough to cover 512 in hexadecimal).
    
    New output:
    
    (XEN) 1ST[0x001] = 0x000000004015ff7f
    (XEN) 2ND[0x01f] = 0x00500000bfe00f7d
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Henry Wang <Henry.Wang@arm.com>
---
 xen/arch/arm/mm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index b42cddb1b4..c81c706c8b 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -234,7 +234,7 @@ void dump_pt_walk(paddr_t ttbr, paddr_t addr,
 
         pte = mapping[offsets[level]];
 
-        printk("%s[0x%x] = 0x%"PRIpaddr"\n",
+        printk("%s[0x%03x] = 0x%"PRIpaddr"\n",
                level_strs[level], offsets[level], pte.bits);
 
         if ( level == 3 || !pte.walk.valid || !pte.walk.table )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Aug 31 19:23:06 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 31 Aug 2022 19:23:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.396030.635995 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1oTTIo-0006YO-Qr; Wed, 31 Aug 2022 19:23:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 396030.635995; Wed, 31 Aug 2022 19: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 1oTTIo-0006YH-OF; Wed, 31 Aug 2022 19:23:06 +0000
Received: by outflank-mailman (input) for mailman id 396030;
 Wed, 31 Aug 2022 19:23:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oTTIn-0006Y8-I3
 for xen-changelog@lists.xenproject.org; Wed, 31 Aug 2022 19:23:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oTTIn-0005WA-HG
 for xen-changelog@lists.xenproject.org; Wed, 31 Aug 2022 19:23:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1oTTIn-0004Q4-GW
 for xen-changelog@lists.xenproject.org; Wed, 31 Aug 2022 19:23:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5ha03ByJBnWVWc4dagQ/NmyWONGQguczVI2Ttl9BoDA=; b=05V5fCiZboaKkU1vDSHrS1G+7Z
	eoRHTpi+VS6itBfvAOpRWwHZJ6e8rk2dvWljs59eIBqVyYyY113NWjwFqofiVvpB88AaX9rutgzJi
	vksq3NaeYAW1BSgRW59P2fhaQe8iXPlXNdvOP/Pq3163khsXqHB1Uh0n1tCU8Rs+F3IE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm32: traps: Dump more information for hypervisor data abort
Message-Id: <E1oTTIn-0004Q4-GW@xenbits.xenproject.org>
Date: Wed, 31 Aug 2022 19:23:05 +0000

commit e997d055929665b12246e89eb092dc79c65de9a4
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Fri Aug 12 20:24:48 2022 +0100
Commit:     Julien Grall <julien@xen.org>
CommitDate: Wed Aug 31 20:16:22 2022 +0100

    xen/arm32: traps: Dump more information for hypervisor data abort
    
    Unlike arm64, on arm32 there are no extra information dumped (e.g.
    page table walk) for hypervisor data abort.
    
    For data abort, the HSR will be set properly and so call
    do_trap_hyp_sync() instead of do_unexpected_trap() on arm32 to have
    the print the same information as arm64.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/arch/arm/arm32/traps.c       | 2 +-
 xen/arch/arm/include/asm/traps.h | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/arm32/traps.c b/xen/arch/arm/arm32/traps.c
index a4ce2b92d9..a2fc1c22cb 100644
--- a/xen/arch/arm/arm32/traps.c
+++ b/xen/arch/arm/arm32/traps.c
@@ -81,7 +81,7 @@ void do_trap_data_abort(struct cpu_user_regs *regs)
     if ( VABORT_GEN_BY_GUEST(regs) )
         do_trap_guest_serror(regs);
     else
-        do_unexpected_trap("Data Abort", regs);
+        do_trap_hyp_sync(regs);
 }
 
 void finalize_instr_emulation(const struct instr_details *instr)
diff --git a/xen/arch/arm/include/asm/traps.h b/xen/arch/arm/include/asm/traps.h
index 08bc0b484c..883dae368e 100644
--- a/xen/arch/arm/include/asm/traps.h
+++ b/xen/arch/arm/include/asm/traps.h
@@ -73,6 +73,7 @@ int do_bug_frame(const struct cpu_user_regs *regs, vaddr_t pc);
 
 void noreturn do_unexpected_trap(const char *msg,
                                  const struct cpu_user_regs *regs);
+void do_trap_hyp_sync(struct cpu_user_regs *regs);
 
 /* Functions for pending virtual abort checking window. */
 void abort_guest_exit_start(void);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


