Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package xen for openSUSE:Factory checked in 
at 2021-04-23 17:49:38
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/xen (Old)
 and      /work/SRC/openSUSE:Factory/.xen.new.12324 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "xen"

Fri Apr 23 17:49:38 2021 rev:301 rq:886799 version:4.14.1_16

Changes:
--------
--- /work/SRC/openSUSE:Factory/xen/xen.changes  2021-03-21 23:19:27.340720399 
+0100
+++ /work/SRC/openSUSE:Factory/.xen.new.12324/xen.changes       2021-04-23 
17:49:41.650698085 +0200
@@ -1,0 +2,19 @@
+Mon Apr 19 12:03:30 MDT 2021 - carn...@suse.com
+
+- bsc#1180491 - "Panic on CPU 0: IO-APIC + timer doesn't work!"
+  60787714-x86-HPET-avoid-legacy-replacement-mode.patch
+  60787714-x86-HPET-factor-legacy-replacement-mode-enabling.patch
+- Upstream bug fixes (bsc#1027519)
+  60410127-gcc11-adjust-rijndaelEncrypt.patch
+  60422428-x86-shadow-avoid-fast-fault-path.patch
+  604b9070-VT-d-disable-QI-IR-before-init.patch
+  60535c11-libxl-domain-soft-reset.patch (Replaces xsa368.patch)
+  60700077-x86-vpt-avoid-pt_migrate-rwlock.patch
+
+-------------------------------------------------------------------
+Thu Mar 25 10:10:10 UTC 2021 - oher...@suse.de
+
+- bsc#1137251 - Restore changes for xen-dom0-modules.service which
+  were silently removed on 2019-10-17
+
+-------------------------------------------------------------------
@@ -23,2 +42,2 @@
-- bsc#1183072 - VUL-0: xen: HVM soft-reset crashes toolstack (XSA-368)
-  Also resolves,
+- bsc#1183072 - VUL-0: CVE-2021-28687: xen: HVM soft-reset crashes
+  toolstack (XSA-368). Also resolves,

Old:
----
  xsa368.patch

New:
----
  60410127-gcc11-adjust-rijndaelEncrypt.patch
  60422428-x86-shadow-avoid-fast-fault-path.patch
  604b9070-VT-d-disable-QI-IR-before-init.patch
  60535c11-libxl-domain-soft-reset.patch
  60700077-x86-vpt-avoid-pt_migrate-rwlock.patch
  60787714-x86-HPET-avoid-legacy-replacement-mode.patch
  60787714-x86-HPET-factor-legacy-replacement-mode-enabling.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ xen.spec ++++++
--- /var/tmp/diff_new_pack.L3j0Cr/_old  2021-04-23 17:49:43.218700781 +0200
+++ /var/tmp/diff_new_pack.L3j0Cr/_new  2021-04-23 17:49:43.222700788 +0200
@@ -130,7 +130,7 @@
 %endif
 Provides:       installhint(reboot-needed)
 
-Version:        4.14.1_14
+Version:        4.14.1_16
 Release:        0
 Summary:        Xen Virtualization: Hypervisor (aka VMM aka Microkernel)
 License:        GPL-2.0-only
@@ -186,7 +186,13 @@
 Patch16:        602e5abb-gnttab-bypass-IOMMU-when-mapping-own-grant.patch
 Patch17:        602ffae9-tools-libs-light-fix-xl-save--c-handling.patch
 Patch18:        6037b02e-x86-EFI-suppress-ld-2-36-base-relocs.patch
-Patch200:       xsa368.patch
+Patch19:        60410127-gcc11-adjust-rijndaelEncrypt.patch
+Patch20:        60422428-x86-shadow-avoid-fast-fault-path.patch
+Patch21:        604b9070-VT-d-disable-QI-IR-before-init.patch
+Patch22:        60535c11-libxl-domain-soft-reset.patch
+Patch23:        60700077-x86-vpt-avoid-pt_migrate-rwlock.patch
+Patch24:        60787714-x86-HPET-factor-legacy-replacement-mode-enabling.patch
+Patch25:        60787714-x86-HPET-avoid-legacy-replacement-mode.patch
 # libxc
 Patch300:       libxc-sr-3cccdae45242dab27198b8e150be0c85acd5d3c9.patch
 Patch301:       libxc-sr-readv_exact.patch
@@ -901,10 +907,35 @@
        echo -n > $conf
 done
 `"
+> mods
 for mod in $mods
 do
-       echo "ExecStart=-/bin/sh -c 'modprobe $mod || :'" >> 
%{buildroot}/%{_unitdir}/${bn}
+       # load by alias, if possible, to handle pvops and xenlinux
+       alias="$mod"
+       case "$mod" in
+               xen-evtchn) ;;
+               xen-gntdev) ;;
+               xen-gntalloc) ;;
+               xen-blkback) alias='xen-backend:vbd' ;;
+               xen-netback) alias='xen-backend:vif' ;;
+               xen-pciback) alias='xen-backend:pci' ;;
+               evtchn) unset alias ;;
+               gntdev) unset alias ;;
+               netbk) alias='xen-backend:vif' ;;
+               blkbk) alias='xen-backend:vbd' ;;
+               xen-scsibk) unset alias ;;
+               usbbk) unset alias ;;
+               pciback) alias='xen-backend:pci' ;;
+               xen-acpi-processor) ;;
+               blktap2) unset alias ;;
+               *) ;;
+       esac
+       if test -n "${alias}"
+       then
+               echo "ExecStart=-/bin/sh -c 'modprobe $alias || :'" >> mods
+       fi
 done
+sort -u mods | tee -a %{buildroot}/%{_unitdir}/${bn}
 rm -rfv %{buildroot}/%{_initddir}
 install -m644 %SOURCE35 %{buildroot}/%{_fillupdir}/sysconfig.pciback
 

++++++ 60410127-gcc11-adjust-rijndaelEncrypt.patch ++++++
# Commit c6ad5a701b9a6df443a6c98d9e7201c958bbcafc
# Date 2021-03-04 16:47:51 +0100
# Author Jan Beulich <jbeul...@suse.com>
# Committer Jan Beulich <jbeul...@suse.com>
crypto: adjust rijndaelEncrypt() prototype for gcc11

The upcoming release complains, not entirely unreasonably:

In file included from rijndael.c:33:
.../xen/include/crypto/rijndael.h:55:53: note: previously declared as 'const 
unsigned char[]'
   55 | void    rijndaelEncrypt(const unsigned int [], int, const unsigned char 
[],
      |                                                     
^~~~~~~~~~~~~~~~~~~~~~
rijndael.c:865:8: error: argument 4 of type 'u8[16]' {aka 'unsigned char[16]'} 
with mismatched bound [-Werror=array-parameter=]
  865 |     u8 ct[16])
      |     ~~~^~~~~~
In file included from rijndael.c:33:
.../xen/include/crypto/rijndael.h:56:13: note: previously declared as 'unsigned 
char[]'
   56 |             unsigned char []);
      |             ^~~~~~~~~~~~~~~~

Simply declare the correct array dimensions right away. This then allows
compilers to apply checking at call sites, which seems desirable anyway.

For the moment I'm leaving untouched the disagreement between u8/u32
used in the function definition and unsigned {char,int} used in the
declaration, as making this consistent would call for touching further
functions.

Reported-by: Charles Arnold <carn...@suse.com>
Signed-off-by: Jan Beulich <jbeul...@suse.com>
Reviewed-by: Julien Grall <jgr...@amazon.com>

--- a/xen/include/crypto/rijndael.h
+++ b/xen/include/crypto/rijndael.h
@@ -52,7 +52,7 @@ void   rijndael_encrypt(rijndael_ctx *, c
 
 int    rijndaelKeySetupEnc(unsigned int [], const unsigned char [], int);
 int    rijndaelKeySetupDec(unsigned int [], const unsigned char [], int);
-void   rijndaelEncrypt(const unsigned int [], int, const unsigned char [],
-           unsigned char []);
+void   rijndaelEncrypt(const unsigned int [], int, const unsigned char [16],
+           unsigned char [16]);
 
 #endif /* __RIJNDAEL_H */
++++++ 60422428-x86-shadow-avoid-fast-fault-path.patch ++++++
# Commit 9318fdf757ec234f0ee6c5cd381326b2f581d065
# Date 2021-03-05 13:29:28 +0100
# Author Jan Beulich <jbeul...@suse.com>
# Committer Jan Beulich <jbeul...@suse.com>
x86/shadow: suppress "fast fault path" optimization without reserved bits

When none of the physical address bits in PTEs are reserved, we can't
create any 4k (leaf) PTEs which would trigger reserved bit faults. Hence
the present SHOPT_FAST_FAULT_PATH machinery needs to be suppressed in
this case, which is most easily achieved by never creating any magic
entries.

To compensate a little, eliminate sh_write_p2m_entry_post()'s impact on
such hardware.

While at it, also avoid using an MMIO magic entry when that would
truncate the incoming GFN.

Requested-by: Andrew Cooper <andrew.coop...@citrix.com>
Signed-off-by: Jan Beulich <jbeul...@suse.com>
Acked-by: Tim Deegan <t...@xen.org>

# Commit 60c0444fae2148452f9ed0b7c49af1fa41f8f522
# Date 2021-03-08 10:41:50 +0100
# Author Jan Beulich <jbeul...@suse.com>
# Committer Jan Beulich <jbeul...@suse.com>
x86/shadow: suppress "fast fault path" optimization when running virtualized

We can't make correctness of our own behavior dependent upon a
hypervisor underneath us correctly telling us the true physical address
with hardware uses. Without knowing this, we can't be certain reserved
bit faults can actually be observed. Therefore, besides evaluating the
number of address bits when deciding whether to use the optimization,
also check whether we're running virtualized ourselves. (Note that since
we may get migrated when running virtualized, the number of address bits
may also change.)

Requested-by: Andrew Cooper <andrew.coop...@citrix.com>
Signed-off-by: Jan Beulich <jbeul...@suse.com>
Acked-by: Andrew Cooper <andrew.coop...@citrix.com>
Acked-by: Tim Deegan <t...@xen.org>

--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -530,7 +530,8 @@ _sh_propagate(struct vcpu *v,
     {
         /* Guest l1e maps emulated MMIO space */
         *sp = sh_l1e_mmio(target_gfn, gflags);
-        d->arch.paging.shadow.has_fast_mmio_entries = true;
+        if ( sh_l1e_is_magic(*sp) )
+            d->arch.paging.shadow.has_fast_mmio_entries = true;
         goto done;
     }
 
--- a/xen/arch/x86/mm/shadow/types.h
+++ b/xen/arch/x86/mm/shadow/types.h
@@ -290,24 +290,41 @@ void sh_destroy_monitor_table(struct vcp
  * pagetables.
  *
  * This is only feasible for PAE and 64bit Xen: 32-bit non-PAE PTEs don't
- * have reserved bits that we can use for this.
+ * have reserved bits that we can use for this.  And even there it can only
+ * be used if we can be certain the processor doesn't use all 52 address bits.
  */
 
 #define SH_L1E_MAGIC 0xffffffff00000001ULL
+
+static inline bool sh_have_pte_rsvd_bits(void)
+{
+    return paddr_bits < PADDR_BITS && !cpu_has_hypervisor;
+}
+
 static inline bool sh_l1e_is_magic(shadow_l1e_t sl1e)
 {
     return (sl1e.l1 & SH_L1E_MAGIC) == SH_L1E_MAGIC;
 }
 
 /* Guest not present: a single magic value */
-static inline shadow_l1e_t sh_l1e_gnp(void)
+static inline shadow_l1e_t sh_l1e_gnp_raw(void)
 {
     return (shadow_l1e_t){ -1ULL };
 }
 
+static inline shadow_l1e_t sh_l1e_gnp(void)
+{
+    /*
+     * On systems with no reserved physical address bits we can't engage the
+     * fast fault path.
+     */
+    return sh_have_pte_rsvd_bits() ? sh_l1e_gnp_raw()
+                                   : shadow_l1e_empty();
+}
+
 static inline bool sh_l1e_is_gnp(shadow_l1e_t sl1e)
 {
-    return sl1e.l1 == sh_l1e_gnp().l1;
+    return sl1e.l1 == sh_l1e_gnp_raw().l1;
 }
 
 /*
@@ -322,9 +339,14 @@ static inline bool sh_l1e_is_gnp(shadow_
 
 static inline shadow_l1e_t sh_l1e_mmio(gfn_t gfn, u32 gflags)
 {
-    return (shadow_l1e_t) { (SH_L1E_MMIO_MAGIC
-                             | MASK_INSR(gfn_x(gfn), SH_L1E_MMIO_GFN_MASK)
-                             | (gflags & (_PAGE_USER|_PAGE_RW))) };
+    unsigned long gfn_val = MASK_INSR(gfn_x(gfn), SH_L1E_MMIO_GFN_MASK);
+
+    if ( !sh_have_pte_rsvd_bits() ||
+         gfn_x(gfn) != MASK_EXTR(gfn_val, SH_L1E_MMIO_GFN_MASK) )
+        return shadow_l1e_empty();
+
+    return (shadow_l1e_t) { (SH_L1E_MMIO_MAGIC | gfn_val |
+                             (gflags & (_PAGE_USER | _PAGE_RW))) };
 }
 
 static inline bool sh_l1e_is_mmio(shadow_l1e_t sl1e)
++++++ 604b9070-VT-d-disable-QI-IR-before-init.patch ++++++
# Commit 04181c6fb543db01f635227c7681ced4073109ba
# Date 2021-03-12 17:01:52 +0100
# Author Igor Druzhinin <igor.druzhi...@citrix.com>
# Committer Jan Beulich <jbeul...@suse.com>
vtd: make sure QI/IR are disabled before initialisation

BIOS might pass control to Xen leaving QI and/or IR in enabled and/or
partially configured state. In case of x2APIC code path where EIM is
enabled early in boot - those are correctly disabled by Xen before any
attempt to configure. But for xAPIC that step is missing which was
proven to cause QI initialization failures on some ICX based platforms
where QI is left pre-enabled and partially configured by BIOS. That
problem becomes hard to avoid since those platforms are shipped with
x2APIC opt out being advertised by default at the same time by firmware.

Unify the behaviour between x2APIC and xAPIC code paths keeping that in
line with what Linux does.

Signed-off-by: Igor Druzhinin <igor.druzhi...@citrix.com>
Reviewed-by: Jan Beulich <jbeul...@suse.com>
Reviewed-by: Kevin Tian <kevin.t...@intel.com>

--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -46,7 +46,7 @@ static bool __read_mostly tdt_enabled;
 static bool __initdata tdt_enable = true;
 boolean_param("tdt", tdt_enable);
 
-static bool __read_mostly iommu_x2apic_enabled;
+bool __read_mostly iommu_x2apic_enabled;
 
 static struct {
     int active;
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -2121,7 +2121,7 @@ static int __must_check init_vtd_hw(void
     u32 sts;
 
     /*
-     * Basic VT-d HW init: set VT-d interrupt, clear VT-d faults.  
+     * Basic VT-d HW init: set VT-d interrupt, clear VT-d faults, etc.
      */
     for_each_drhd_unit ( drhd )
     {
@@ -2131,6 +2131,16 @@ static int __must_check init_vtd_hw(void
 
         clear_fault_bits(iommu);
 
+        /*
+         * Disable interrupt remapping and queued invalidation if
+         * already enabled by BIOS in case we've not initialized it yet.
+         */
+        if ( !iommu_x2apic_enabled )
+        {
+            disable_intremap(iommu);
+            disable_qinval(iommu);
+        }
+
         spin_lock_irqsave(&iommu->register_lock, flags);
         sts = dmar_readl(iommu->reg, DMAR_FECTL_REG);
         sts &= ~DMA_FECTL_IM;
--- a/xen/include/asm-x86/apic.h
+++ b/xen/include/asm-x86/apic.h
@@ -24,6 +24,7 @@ enum apic_mode {
     APIC_MODE_X2APIC    /* x2APIC mode - common for large MP machines */
 };
 
+extern bool iommu_x2apic_enabled;
 extern u8 apic_verbosity;
 extern bool directed_eoi_enabled;
 
++++++ 60535c11-libxl-domain-soft-reset.patch ++++++
# Commit dae3c3e8b257cd27d6b35a467a34bf79a6650340
# Date 2021-03-18 14:56:33 +0100
# Author Anthony PERARD <anthony.per...@citrix.com>
# Committer Jan Beulich <jbeul...@suse.com>
libxl: Fix domain soft reset state handling

In do_domain_soft_reset(), a `libxl__domain_suspend_state' is used
without been properly initialised and disposed of. This lead do a
abort() in libxl due to the `dsps.qmp' state been used before been
initialised:
    libxl__ev_qmp_send: Assertion `ev->state == qmp_state_disconnected || 
ev->state == qmp_state_connected' failed.

Once initialised, `dsps' also needs to be disposed of as the `qmp'
state might still be in the `Connected' state in the callback for
libxl__domain_suspend_device_model(). So this patch adds
libxl__domain_suspend_dispose() which can be called from the two
places where we need to dispose of `dsps'.

This is XSA-368.

Reported-by: Olaf Hering <o...@aepfle.de>
Signed-off-by: Anthony PERARD <anthony.per...@citrix.com>
Reviewed-by: Ian Jackson <i...@xenproject.org>
Tested-by: Olaf Hering <o...@aepfle.de>

--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -2174,9 +2174,7 @@ static int do_domain_soft_reset(libxl_ct
     state->console_tty = libxl__strdup(gc, console_tty);
 
     dss->ao = ao;
-    dss->domid = dss->dsps.domid = domid;
-    dss->dsps.dm_savefile = GCSPRINTF(LIBXL_DEVICE_MODEL_SAVE_FILE".%d",
-                                      domid);
+    dss->domid = domid;
 
     rc = libxl__save_emulator_xenstore_data(dss, &srs->toolstack_buf,
                                             &srs->toolstack_len);
@@ -2186,6 +2184,11 @@ static int do_domain_soft_reset(libxl_ct
     }
 
     dss->dsps.ao = ao;
+    dss->dsps.domid = domid;
+    dss->dsps.live = false;
+    rc = libxl__domain_suspend_init(egc, &dss->dsps, d_config->b_info.type);
+    if (rc)
+        goto out;
     dss->dsps.callback_device_model_done = soft_reset_dm_suspended;
     libxl__domain_suspend_device_model(egc, &dss->dsps); /* must be last */
 
@@ -2204,6 +2207,8 @@ static void soft_reset_dm_suspended(libx
         CONTAINER_OF(dsps, *srs, dss.dsps);
     libxl__app_domain_create_state *cdcs = &srs->cdcs;
 
+    libxl__domain_suspend_dispose(gc, dsps);
+
     /*
      * Ask all backends to disconnect by removing the domain from
      * xenstore. On the creation path the domain will be introduced to
--- a/tools/libxl/libxl_dom_suspend.c
+++ b/tools/libxl/libxl_dom_suspend.c
@@ -67,6 +67,16 @@ out:
     return rc;
 }
 
+void libxl__domain_suspend_dispose(libxl__gc *gc,
+                                   libxl__domain_suspend_state  *dsps)
+{
+    libxl__xswait_stop(gc, &dsps->pvcontrol);
+    libxl__ev_evtchn_cancel(gc, &dsps->guest_evtchn);
+    libxl__ev_xswatch_deregister(gc, &dsps->guest_watch);
+    libxl__ev_time_deregister(gc, &dsps->guest_timeout);
+    libxl__ev_qmp_dispose(gc, &dsps->qmp);
+}
+
 /*----- callbacks, called by xc_domain_save -----*/
 
 void libxl__domain_suspend_device_model(libxl__egc *egc,
@@ -388,10 +398,7 @@ static void domain_suspend_common_done(l
 {
     EGC_GC;
     assert(!libxl__xswait_inuse(&dsps->pvcontrol));
-    libxl__ev_evtchn_cancel(gc, &dsps->guest_evtchn);
-    libxl__ev_xswatch_deregister(gc, &dsps->guest_watch);
-    libxl__ev_time_deregister(gc, &dsps->guest_timeout);
-    libxl__ev_qmp_dispose(gc, &dsps->qmp);
+    libxl__domain_suspend_dispose(gc, dsps);
     dsps->callback_common_done(egc, dsps, rc);
 }
 
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -3615,6 +3615,8 @@ struct libxl__domain_suspend_state {
 int libxl__domain_suspend_init(libxl__egc *egc,
                                libxl__domain_suspend_state *dsps,
                                libxl_domain_type type);
+void libxl__domain_suspend_dispose(libxl__gc *gc,
+                                   libxl__domain_suspend_state  *dsps);
 
 /* calls dsps->callback_device_model_done when done
  * may synchronously calls this callback */
++++++ 60700077-x86-vpt-avoid-pt_migrate-rwlock.patch ++++++
# Commit 1f3d87c7512975274cc45c40097b05550eba1ac9
# Date 2021-04-09 09:21:27 +0200
# Author Boris Ostrovsky <boris.ostrov...@oracle.com>
# Committer Jan Beulich <jbeul...@suse.com>
x86/vpt: do not take pt_migrate rwlock in some cases

Commit 8e76aef72820 ("x86/vpt: fix race when migrating timers between
vCPUs") addressed XSA-336 by introducing a per-domain rwlock that was
intended to protect periodic timer during VCPU migration. Since such
migration is an infrequent event no performance impact was expected.

Unfortunately this turned out not to be the case: on a fairly large
guest (92 VCPUs) we've observed as much as 40% TPCC performance
regression with some guest kernels. Further investigation pointed to
pt_migrate read lock taken in pt_update_irq() as the largest contributor
to this regression. With large number of VCPUs and large number of VMEXITs
(from where pt_update_irq() is always called) the update of an atomic in
read_lock() is thought to be the main cause.

Stephen Brennan analyzed locking pattern and classified lock users as
follows:

1. Functions which read (maybe write) all periodic_time instances attached
to a particular vCPU. These are functions which use pt_vcpu_lock() such
as pt_restore_timer(), pt_save_timer(), etc.
2. Functions which want to modify a particular periodic_time object.
These functions lock whichever vCPU the periodic_time is attached to, but
since the vCPU could be modified without holding any lock, they are
vulnerable to XSA-336. Functions in this group use pt_lock(), such as
pt_timer_fn() or destroy_periodic_time().
3. Functions which not only want to modify the periodic_time, but also
would like to modify the =vcpu= fields. These are create_periodic_time()
or pt_adjust_vcpu(). They create XSA-336 conditions for group 2, but we
can't simply hold 2 vcpu locks due to the deadlock risk.

Roger then pointed out that group 1 functions don't really need to hold
the pt_migrate rwlock and that instead groups 2 and 3 should hold per-vcpu
lock whenever they modify per-vcpu timer lists.

Suggested-by: Stephen Brennan <stephen.s.bren...@oracle.com>
Suggested-by: Roger Pau Monn?? <roger....@citrix.com>
Signed-off-by: Boris Ostrovsky <boris.ostrov...@oracle.com>
Reviewed-by: Roger Pau Monn?? <roger....@citrix.com>
Reviewed-by: Stephen Brennan <stephen.s.bren...@oracle.com>

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

Commit e1de4c196a2e ("x86/timer: Fix boot on Intel systems using ITSSPRC
static PIT clock gating") was reported to cause boot failures on certain
AMD Ryzen systems.

Refine the fix to do nothing in the default case, and only attempt to
configure legacy replacement mode if IRQ0 is found to not be working.  If
legacy replacement mode doesn't help, undo it before falling back to other IRQ
routing configurations.

In addition, introduce a "hpet" command line option so this heuristic
can be overridden.  Since it makes little sense to introduce just
"hpet=legacy-replacement", also allow for a boolean argument as well as
"broadcast" to replace the separate "hpetbroadcast" option.

Reported-by: Fr??d??ric Pierret frederic.pier...@qubes-os.org
Signed-off-by: Jan Beulich <jbeul...@suse.com>
Signed-off-by: Andrew Cooper <andrew.coop...@citrix.com>
Reviewed-by: Roger Pau Monn?? <roger....@citrix.com>
Reviewed-by: Jan Beulich <jbeul...@suse.com>
Tested-by: Fr??d??ric Pierret <frederic.pier...@qubes-os.org>

--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -1221,9 +1221,42 @@ supported. See docs/misc/arm/big.LITTLE.
 When the hmp-unsafe option is disabled (default), CPUs that are not
 identical to the boot CPU will be parked and not used by Xen.
 
+### hpet
+    = List of [ <bool> | broadcast=<bool> | legacy-replacement=<bool> ]
+
+    Applicability: x86
+
+Controls Xen's use of the system's High Precision Event Timer.  By default,
+Xen will use an HPET when available and not subject to errata.  Use of the
+HPET can be disabled by specifying `hpet=0`.
+
+ * The `broadcast` boolean is disabled by default, but forces Xen to keep
+   using the broadcast for CPUs in deep C-states even when an RTC interrupt is
+   enabled.  This then also affects raising of the RTC interrupt.
+
+ * The `legacy-replacement` boolean allows for control over whether Legacy
+   Replacement mode is enabled.
+
+   Legacy Replacement mode is intended for hardware which does not have an
+   8254 PIT, and allows the HPET to be configured into a compatible mode.
+   Intel chipsets from Skylake/ApolloLake onwards can turn the PIT off for
+   power saving reasons, and there is no platform-agnostic mechanism for
+   discovering this.
+
+   By default, Xen will not change hardware configuration, unless the PIT
+   appears to be absent, at which point Xen will try to enable Legacy
+   Replacement mode before falling back to pre-IO-APIC interrupt routing
+   options.
+
+   This behaviour can be inhibited by specifying `legacy-replacement=0`.
+   Alternatively, this mode can be enabled unconditionally (if available) by
+   specifying `legacy-replacement=1`.
+
 ### hpetbroadcast (x86)
 > `= <boolean>`
 
+Deprecated alternative of `hpet=broadcast`.
+
 ### hvm_debug (x86)
 > `= <integer>`
 
--- a/xen/arch/x86/hpet.c
+++ b/xen/arch/x86/hpet.c
@@ -52,6 +52,8 @@ static unsigned int __read_mostly num_hp
 DEFINE_PER_CPU(struct hpet_event_channel *, cpu_bc_channel);
 
 unsigned long __initdata hpet_address;
+int8_t __initdata opt_hpet_legacy_replacement = -1;
+static bool __initdata opt_hpet = true;
 u8 __initdata hpet_blockid;
 u8 __initdata hpet_flags;
 
@@ -63,6 +65,32 @@ u8 __initdata hpet_flags;
 static bool __initdata force_hpet_broadcast;
 boolean_param("hpetbroadcast", force_hpet_broadcast);
 
+static int __init parse_hpet_param(const char *s)
+{
+    const char *ss;
+    int val, rc = 0;
+
+    do {
+        ss = strchr(s, ',');
+        if ( !ss )
+            ss = strchr(s, '\0');
+
+        if ( (val = parse_bool(s, ss)) >= 0 )
+            opt_hpet = val;
+        else if ( (val = parse_boolean("broadcast", s, ss)) >= 0 )
+            force_hpet_broadcast = val;
+        else if ( (val = parse_boolean("legacy-replacement", s, ss)) >= 0 )
+            opt_hpet_legacy_replacement = val;
+        else
+            rc = -EINVAL;
+
+        s = ss + 1;
+    } while ( *ss );
+
+    return rc;
+}
+custom_param("hpet", parse_hpet_param);
+
 /*
  * Calculate a multiplication factor for scaled math, which is used to convert
  * nanoseconds based values to clock ticks:
@@ -765,6 +793,9 @@ int hpet_legacy_irq_tick(void)
 
 static u32 *hpet_boot_cfg;
 static uint64_t __initdata hpet_rate;
+static __initdata struct {
+    uint32_t cmp, cfg;
+} pre_legacy_c0;
 
 bool __init hpet_enable_legacy_replacement_mode(void)
 {
@@ -778,8 +809,11 @@ bool __init hpet_enable_legacy_replaceme
     /* Stop the main counter. */
     hpet_write32(cfg & ~HPET_CFG_ENABLE, HPET_CFG);
 
+    /* Stash channel 0's old CFG/CMP incase we need to undo. */
+    pre_legacy_c0.cfg = c0_cfg = hpet_read32(HPET_Tn_CFG(0));
+    pre_legacy_c0.cmp = hpet_read32(HPET_Tn_CMP(0));
+
     /* Reconfigure channel 0 to be 32bit periodic. */
-    c0_cfg = hpet_read32(HPET_Tn_CFG(0));
     c0_cfg |= (HPET_TN_ENABLE | HPET_TN_PERIODIC | HPET_TN_SETVAL |
                HPET_TN_32BIT);
     hpet_write32(c0_cfg, HPET_Tn_CFG(0));
@@ -825,17 +859,33 @@ bool __init hpet_enable_legacy_replaceme
     return true;
 }
 
+void __init hpet_disable_legacy_replacement_mode(void)
+{
+    unsigned int cfg = hpet_read32(HPET_CFG);
+
+    ASSERT(hpet_rate);
+
+    cfg &= ~(HPET_CFG_LEGACY | HPET_CFG_ENABLE);
+
+    /* Stop the main counter and disable legacy mode. */
+    hpet_write32(cfg, HPET_CFG);
+
+    /* Restore pre-Legacy Replacement Mode settings. */
+    hpet_write32(pre_legacy_c0.cfg, HPET_Tn_CFG(0));
+    hpet_write32(pre_legacy_c0.cmp, HPET_Tn_CMP(0));
+
+    /* Restart the main counter. */
+    hpet_write32(cfg | HPET_CFG_ENABLE, HPET_CFG);
+}
+
 u64 __init hpet_setup(void)
 {
     unsigned int hpet_id, hpet_period;
     unsigned int last, rem;
 
-    if ( hpet_rate )
+    if ( hpet_rate || !hpet_address || !opt_hpet )
         return hpet_rate;
 
-    if ( hpet_address == 0 )
-        return 0;
-
     set_fixmap_nocache(FIX_HPET_BASE, hpet_address);
 
     hpet_id = hpet_read32(HPET_ID);
@@ -862,19 +912,8 @@ u64 __init hpet_setup(void)
     if ( (rem * 2) > hpet_period )
         hpet_rate++;
 
-    /*
-     * Intel chipsets from Skylake/ApolloLake onwards can statically clock
-     * gate the 8259 PIT.  This option is enabled by default in slightly later
-     * systems, as turning the PIT off is a prerequisite to entering the C11
-     * power saving state.
-     *
-     * Xen currently depends on the legacy timer interrupt being active while
-     * IRQ routing is configured.
-     *
-     * Reconfigure the HPET into legacy mode to re-establish the timer
-     * interrupt.
-     */
-    hpet_enable_legacy_replacement_mode();
+    if ( opt_hpet_legacy_replacement > 0 )
+        hpet_enable_legacy_replacement_mode();
 
     return hpet_rate;
 }
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -29,6 +29,8 @@
 #include <xen/acpi.h>
 #include <xen/keyhandler.h>
 #include <xen/softirq.h>
+
+#include <asm/hpet.h>
 #include <asm/mc146818rtc.h>
 #include <asm/smp.h>
 #include <asm/desc.h>
@@ -1930,6 +1932,35 @@ static void __init check_timer(void)
             local_irq_restore(flags);
             return;
         }
+
+        /*
+         * Intel chipsets from Skylake/ApolloLake onwards can statically clock
+         * gate the 8254 PIT.  This option is enabled by default in slightly
+         * later systems, as turning the PIT off is a prerequisite to entering
+         * the C11 power saving state.
+         *
+         * Xen currently depends on the legacy timer interrupt being active
+         * while IRQ routing is configured.
+         *
+         * If the user hasn't made an explicit choice, attempt to reconfigure
+         * the HPET into legacy mode to re-establish the timer interrupt.
+         */
+        if ( opt_hpet_legacy_replacement < 0 &&
+             hpet_enable_legacy_replacement_mode() )
+        {
+            printk(XENLOG_ERR "..no 8254 timer found - trying HPET Legacy 
Replacement Mode\n");
+
+            if ( timer_irq_works() )
+            {
+                local_irq_restore(flags);
+                return;
+            }
+
+            /* Legacy Replacement mode hasn't helped.  Undo it. */
+            printk(XENLOG_ERR "..no HPET timer found - reverting Legacy 
Replacement Mode\n");
+            hpet_disable_legacy_replacement_mode();
+        }
+
         clear_IO_APIC_pin(apic1, pin1);
         printk(KERN_ERR "..MP-BIOS bug: 8254 timer not connected to "
                "IO-APIC\n");
--- a/xen/include/asm-x86/hpet.h
+++ b/xen/include/asm-x86/hpet.h
@@ -53,6 +53,7 @@
 extern unsigned long hpet_address;
 extern u8 hpet_blockid;
 extern u8 hpet_flags;
+extern int8_t opt_hpet_legacy_replacement;
 
 /*
  * Detect and initialise HPET hardware: return counter update frequency.
@@ -79,6 +80,12 @@ int hpet_legacy_irq_tick(void);
 bool hpet_enable_legacy_replacement_mode(void);
 
 /*
+ * Undo the effects of hpet_disable_legacy_replacement_mode().  Must not be
+ * called unless enable() returned true.
+ */
+void hpet_disable_legacy_replacement_mode(void);
+
+/*
  * Temporarily use an HPET event counter for timer interrupt handling,
  * rather than using the LAPIC timer. Used for Cx state entry.
  */
++++++ 60787714-x86-HPET-factor-legacy-replacement-mode-enabling.patch ++++++
# Commit 238168b5bcd27fec97704f6295fa5bf7a442eb6f
# Date 2021-04-15 18:25:40 +0100
# Author Andrew Cooper <andrew.coop...@citrix.com>
# Committer Andrew Cooper <andrew.coop...@citrix.com>
x86/hpet: Factor hpet_enable_legacy_replacement_mode() out of hpet_setup()

... in preparation to introduce a second caller.

No functional change.

Signed-off-by: Andrew Cooper <andrew.coop...@citrix.com>
Reviewed-by: Jan Beulich <jbeul...@suse.com>
Tested-by: Fr??d??ric Pierret <frederic.pier...@qubes-os.org>

--- a/xen/arch/x86/hpet.c
+++ b/xen/arch/x86/hpet.c
@@ -764,11 +764,70 @@ int hpet_legacy_irq_tick(void)
 }
 
 static u32 *hpet_boot_cfg;
+static uint64_t __initdata hpet_rate;
+
+bool __init hpet_enable_legacy_replacement_mode(void)
+{
+    unsigned int cfg, c0_cfg, ticks, count;
+
+    if ( !hpet_rate ||
+         !(hpet_read32(HPET_ID) & HPET_ID_LEGSUP) ||
+         ((cfg = hpet_read32(HPET_CFG)) & HPET_CFG_LEGACY) )
+        return false;
+
+    /* Stop the main counter. */
+    hpet_write32(cfg & ~HPET_CFG_ENABLE, HPET_CFG);
+
+    /* Reconfigure channel 0 to be 32bit periodic. */
+    c0_cfg = hpet_read32(HPET_Tn_CFG(0));
+    c0_cfg |= (HPET_TN_ENABLE | HPET_TN_PERIODIC | HPET_TN_SETVAL |
+               HPET_TN_32BIT);
+    hpet_write32(c0_cfg, HPET_Tn_CFG(0));
+
+    /*
+     * The exact period doesn't have to match a legacy PIT.  All we need
+     * is an interrupt queued up via the IO-APIC to check routing.
+     *
+     * Use HZ as the frequency.
+     */
+    ticks = ((SECONDS(1) / HZ) * div_sc(hpet_rate, SECONDS(1), 32)) >> 32;
+
+    count = hpet_read32(HPET_COUNTER);
+
+    /*
+     * HPET_TN_SETVAL above is atrociously documented in the spec.
+     *
+     * Periodic HPET channels have a main comparator register, and
+     * separate "accumulator" register.  Despite being named accumulator
+     * in the spec, this is not an accurate description of its behaviour
+     * or purpose.
+     *
+     * Each time an interrupt is generated, the "accumulator" register is
+     * re-added to the comparator set up the new period.
+     *
+     * Normally, writes to the CMP register update both registers.
+     * However, under these semantics, it is impossible to set up a
+     * periodic timer correctly without the main HPET counter being at 0.
+     *
+     * Instead, HPET_TN_SETVAL is a self-clearing control bit which we can
+     * use for periodic timers to mean that the second write to CMP
+     * updates the accumulator only, and not the absolute comparator
+     * value.
+     *
+     * This lets us set a period when the main counter isn't at 0.
+     */
+    hpet_write32(count + ticks, HPET_Tn_CMP(0));
+    hpet_write32(ticks,         HPET_Tn_CMP(0));
+
+    /* Restart the main counter, and legacy mode. */
+    hpet_write32(cfg | HPET_CFG_ENABLE | HPET_CFG_LEGACY, HPET_CFG);
+
+    return true;
+}
 
 u64 __init hpet_setup(void)
 {
-    static u64 __initdata hpet_rate;
-    unsigned int hpet_id, hpet_period, hpet_cfg;
+    unsigned int hpet_id, hpet_period;
     unsigned int last, rem;
 
     if ( hpet_rate )
@@ -815,58 +874,7 @@ u64 __init hpet_setup(void)
      * Reconfigure the HPET into legacy mode to re-establish the timer
      * interrupt.
      */
-    if ( hpet_id & HPET_ID_LEGSUP &&
-         !((hpet_cfg = hpet_read32(HPET_CFG)) & HPET_CFG_LEGACY) )
-    {
-        unsigned int c0_cfg, ticks, count;
-
-        /* Stop the main counter. */
-        hpet_write32(hpet_cfg & ~HPET_CFG_ENABLE, HPET_CFG);
-
-        /* Reconfigure channel 0 to be 32bit periodic. */
-        c0_cfg = hpet_read32(HPET_Tn_CFG(0));
-        c0_cfg |= (HPET_TN_ENABLE | HPET_TN_PERIODIC | HPET_TN_SETVAL |
-                   HPET_TN_32BIT);
-        hpet_write32(c0_cfg, HPET_Tn_CFG(0));
-
-        /*
-         * The exact period doesn't have to match a legacy PIT.  All we need
-         * is an interrupt queued up via the IO-APIC to check routing.
-         *
-         * Use HZ as the frequency.
-         */
-        ticks = ((SECONDS(1) / HZ) * div_sc(hpet_rate, SECONDS(1), 32)) >> 32;
-
-        count = hpet_read32(HPET_COUNTER);
-
-        /*
-         * HPET_TN_SETVAL above is atrociously documented in the spec.
-         *
-         * Periodic HPET channels have a main comparator register, and
-         * separate "accumulator" register.  Despite being named accumulator
-         * in the spec, this is not an accurate description of its behaviour
-         * or purpose.
-         *
-         * Each time an interrupt is generated, the "accumulator" register is
-         * re-added to the comparator set up the new period.
-         *
-         * Normally, writes to the CMP register update both registers.
-         * However, under these semantics, it is impossible to set up a
-         * periodic timer correctly without the main HPET counter being at 0.
-         *
-         * Instead, HPET_TN_SETVAL is a self-clearing control bit which we can
-         * use for periodic timers to mean that the second write to CMP
-         * updates the accumulator only, and not the absolute comparator
-         * value.
-         *
-         * This lets us set a period when the main counter isn't at 0.
-         */
-        hpet_write32(count + ticks, HPET_Tn_CMP(0));
-        hpet_write32(ticks,         HPET_Tn_CMP(0));
-
-        /* Restart the main counter, and legacy mode. */
-        hpet_write32(hpet_cfg | HPET_CFG_ENABLE | HPET_CFG_LEGACY, HPET_CFG);
-    }
+    hpet_enable_legacy_replacement_mode();
 
     return hpet_rate;
 }
--- a/xen/include/asm-x86/hpet.h
+++ b/xen/include/asm-x86/hpet.h
@@ -73,6 +73,12 @@ void hpet_disable(void);
 int hpet_legacy_irq_tick(void);
 
 /*
+ * Try to enable HPET Legacy Replacement mode.  Returns a boolean indicating
+ * whether the HPET configuration was changed.
+ */
+bool hpet_enable_legacy_replacement_mode(void);
+
+/*
  * Temporarily use an HPET event counter for timer interrupt handling,
  * rather than using the LAPIC timer. Used for Cx state entry.
  */
++++++ gcc11-fixes.patch ++++++
--- /var/tmp/diff_new_pack.L3j0Cr/_old  2021-04-23 17:49:43.430701145 +0200
+++ /var/tmp/diff_new_pack.L3j0Cr/_new  2021-04-23 17:49:43.430701145 +0200
@@ -68,20 +68,6 @@
       |          ^~~~~~
 
 
-For rijndael.c
-In file included from rijndael.c:33:
-/home/abuild/rpmbuild/BUILD/xen-4.14.1-testing/xen/include/crypto/rijndael.h:55:53:
 note: previously declared as 'const unsigned char[]'
-   55 | void    rijndaelEncrypt(const unsigned int [], int, const unsigned 
char [],
-      |                                                     
^~~~~~~~~~~~~~~~~~~~~~
-rijndael.c:865:8: error: argument 4 of type 'u8[16]' {aka 'unsigned char[16]'} 
with mismatched bound [-Werror=array-parameter=]
-  865 |     u8 ct[16])
-      |     ~~~^~~~~~
-In file included from rijndael.c:33:
-/home/abuild/rpmbuild/BUILD/xen-4.14.1-testing/xen/include/crypto/rijndael.h:56:13:
 note: previously declared as 'unsigned char[]'
-   56 |             unsigned char []);
-      |             ^~~~~~~~~~~~~~~~
-
-
 For x86_emulate/x86_emulate.c
 x86_emulate/x86_emulate.c:728:26: error: writing 1 byte into a region of size 
0 [-Werror=stringop-overflow=]
   728 |     (ptr)[0 - PFX_BYTES] = ext < ext_8f08 ? 0xc4 : 0x8f; \
@@ -92,8 +78,8 @@
 
 
 
---- xen-4.14.1-testing/tools/libs/foreignmemory/private.h.orig 2021-02-10 
11:04:05.230562677 -0700
-+++ xen-4.14.1-testing/tools/libs/foreignmemory/private.h      2021-02-10 
11:04:36.138561926 -0700
+--- trunk.orig/tools/libs/foreignmemory/private.h      2021-03-05 
12:35:57.802022411 +0100
++++ trunk/tools/libs/foreignmemory/private.h   2021-03-05 12:39:34.022154265 
+0100
 @@ -29,6 +29,9 @@ struct xenforeignmemory_handle {
  int osdep_xenforeignmemory_open(xenforeignmemory_handle *fmem);
  int osdep_xenforeignmemory_close(xenforeignmemory_handle *fmem);
@@ -104,8 +90,8 @@
  void *osdep_xenforeignmemory_map(xenforeignmemory_handle *fmem,
                                   uint32_t dom, void *addr,
                                   int prot, int flags, size_t num,
---- xen-4.14.1-testing/xen/arch/x86/mpparse.c.orig     2021-02-10 
11:18:01.174542374 -0700
-+++ xen-4.14.1-testing/xen/arch/x86/mpparse.c  2021-02-10 11:19:17.822540512 
-0700
+--- trunk.orig/xen/arch/x86/mpparse.c  2021-03-05 12:35:57.802022411 +0100
++++ trunk/xen/arch/x86/mpparse.c       2021-03-05 12:39:34.022154265 +0100
 @@ -709,6 +709,9 @@ static int __init smp_scan_config (unsig
        return 0;
  }
@@ -116,8 +102,8 @@
  static void __init efi_check_config(void)
  {
        struct intel_mp_floating *mpf;
---- xen-4.14.1-testing/xen/arch/x86/tboot.c.orig       2021-02-10 
11:27:38.882528343 -0700
-+++ xen-4.14.1-testing/xen/arch/x86/tboot.c    2021-02-10 11:34:00.442519076 
-0700
+--- trunk.orig/xen/arch/x86/tboot.c    2021-03-05 12:35:57.802022411 +0100
++++ trunk/xen/arch/x86/tboot.c 2021-03-05 12:39:34.022154265 +0100
 @@ -89,6 +89,9 @@ static void __init tboot_copy_memory(uns
      }
  }
@@ -138,8 +124,8 @@
  static void tboot_gen_frametable_integrity(const uint8_t key[TB_KEY_SIZE],
                                             vmac_t *mac)
  {
---- xen-4.14.1-testing/xen/arch/x86/x86_emulate/x86_emulate.c.orig     
2021-02-10 11:56:52.302485758 -0700
-+++ xen-4.14.1-testing/xen/arch/x86/x86_emulate/x86_emulate.c  2021-02-10 
11:57:58.338484154 -0700
+--- trunk.orig/xen/arch/x86/x86_emulate/x86_emulate.c  2021-03-05 
12:35:57.802022411 +0100
++++ trunk/xen/arch/x86/x86_emulate/x86_emulate.c       2021-03-05 
12:39:34.022154265 +0100
 @@ -722,6 +722,9 @@ union vex {
      buf_ + 3; \
  })
@@ -150,15 +136,3 @@
  #define copy_VEX(ptr, vex) ({ \
      if ( !mode_64bit() ) \
          (vex).reg |= 8; \
---- xen-4.14.1-testing/xen/include/crypto/rijndael.h   2021-02-10 
11:41:50.018507672 -0700
-+++ xen-4.14.1-testing/xen/include/crypto/rijndael.h   2021-02-26 
11:42:42.206506404 +0100
-@@ -52,7 +52,7 @@
- 
- int   rijndaelKeySetupEnc(unsigned int [], const unsigned char [], int);
- int   rijndaelKeySetupDec(unsigned int [], const unsigned char [], int);
--void  rijndaelEncrypt(const unsigned int [], int, const unsigned char [],
--          unsigned char []);
-+void  rijndaelEncrypt(const unsigned int [], int, const unsigned char [16],
-+          unsigned char [16]);
- 
- #endif /* __RIJNDAEL_H */

++++++ libxl.pvscsi.patch ++++++
--- /var/tmp/diff_new_pack.L3j0Cr/_old  2021-04-23 17:49:43.534701324 +0200
+++ /var/tmp/diff_new_pack.L3j0Cr/_new  2021-04-23 17:49:43.534701324 +0200
@@ -34,10 +34,10 @@
  tools/libxl/xl_cmdtable.c            |   15 
  16 files changed, 2326 insertions(+), 4 deletions(-)
 
-Index: xen-4.14.0-testing/docs/man/xl.cfg.5.pod.in
+Index: xen-4.14.1-testing/docs/man/xl.cfg.5.pod.in
 ===================================================================
---- xen-4.14.0-testing.orig/docs/man/xl.cfg.5.pod.in
-+++ xen-4.14.0-testing/docs/man/xl.cfg.5.pod.in
+--- xen-4.14.1-testing.orig/docs/man/xl.cfg.5.pod.in
++++ xen-4.14.1-testing/docs/man/xl.cfg.5.pod.in
 @@ -769,6 +769,62 @@ frontend to backend. It can be used as a
  For more information about the protocol, see
  https://xenbits.xenproject.org/docs/unstable/misc/pvcalls.html.
@@ -101,10 +101,10 @@
  =item B<vfb=[ "VFB_SPEC_STRING", "VFB_SPEC_STRING", ...]>
  
  Specifies the paravirtual framebuffer devices which should be supplied
-Index: xen-4.14.0-testing/docs/man/xl.1.pod.in
+Index: xen-4.14.1-testing/docs/man/xl.1.pod.in
 ===================================================================
---- xen-4.14.0-testing.orig/docs/man/xl.1.pod.in
-+++ xen-4.14.0-testing/docs/man/xl.1.pod.in
+--- xen-4.14.1-testing.orig/docs/man/xl.1.pod.in
++++ xen-4.14.1-testing/docs/man/xl.1.pod.in
 @@ -1591,6 +1591,24 @@ List virtual network interfaces for a do
  
  =back
@@ -130,10 +130,10 @@
  =head1 PCI PASS-THROUGH
  
  =over 4
-Index: xen-4.14.0-testing/tools/libxl/Makefile
+Index: xen-4.14.1-testing/tools/libxl/Makefile
 ===================================================================
---- xen-4.14.0-testing.orig/tools/libxl/Makefile
-+++ xen-4.14.0-testing/tools/libxl/Makefile
+--- xen-4.14.1-testing.orig/tools/libxl/Makefile
++++ xen-4.14.1-testing/tools/libxl/Makefile
 @@ -131,6 +131,7 @@ endif
  LIBXL_LIBS += -lyajl
  
@@ -150,10 +150,10 @@
        libxlu_disk_l.o libxlu_disk.o libxlu_vif.o libxlu_pci.o
  $(LIBXLU_OBJS): CFLAGS += $(CFLAGS_libxenctrl) # For xentoollog.h
  
-Index: xen-4.14.0-testing/tools/libxl/libxl.h
+Index: xen-4.14.1-testing/tools/libxl/libxl.h
 ===================================================================
---- xen-4.14.0-testing.orig/tools/libxl/libxl.h
-+++ xen-4.14.0-testing/tools/libxl/libxl.h
+--- xen-4.14.1-testing.orig/tools/libxl/libxl.h
++++ xen-4.14.1-testing/tools/libxl/libxl.h
 @@ -1134,6 +1134,13 @@ void libxl_mac_copy(libxl_ctx *ctx, libx
  #define LIBXL_HAVE_PCITOPOLOGY 1
  
@@ -210,10 +210,10 @@
  /* Virtual TPMs */
  int libxl_device_vtpm_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vtpm 
*vtpm,
                            const libxl_asyncop_how *ao_how)
-Index: xen-4.14.0-testing/tools/libxl/libxl_create.c
+Index: xen-4.14.1-testing/tools/libxl/libxl_create.c
 ===================================================================
---- xen-4.14.0-testing.orig/tools/libxl/libxl_create.c
-+++ xen-4.14.0-testing/tools/libxl/libxl_create.c
+--- xen-4.14.1-testing.orig/tools/libxl/libxl_create.c
++++ xen-4.14.1-testing/tools/libxl/libxl_create.c
 @@ -1811,6 +1811,7 @@ const libxl__device_type *device_type_tb
      &libxl__disk_devtype,
      &libxl__nic_devtype,
@@ -222,11 +222,11 @@
      &libxl__usbctrl_devtype,
      &libxl__usbdev_devtype,
      &libxl__pcidev_devtype,
-Index: xen-4.14.0-testing/tools/libxl/libxl_internal.h
+Index: xen-4.14.1-testing/tools/libxl/libxl_internal.h
 ===================================================================
---- xen-4.14.0-testing.orig/tools/libxl/libxl_internal.h
-+++ xen-4.14.0-testing/tools/libxl/libxl_internal.h
-@@ -3981,6 +3981,7 @@ extern const libxl__device_type libxl__v
+--- xen-4.14.1-testing.orig/tools/libxl/libxl_internal.h
++++ xen-4.14.1-testing/tools/libxl/libxl_internal.h
+@@ -3983,6 +3983,7 @@ extern const libxl__device_type libxl__v
  extern const libxl__device_type libxl__disk_devtype;
  extern const libxl__device_type libxl__nic_devtype;
  extern const libxl__device_type libxl__vtpm_devtype;
@@ -234,10 +234,10 @@
  extern const libxl__device_type libxl__usbctrl_devtype;
  extern const libxl__device_type libxl__usbdev_devtype;
  extern const libxl__device_type libxl__pcidev_devtype;
-Index: xen-4.14.0-testing/tools/libxl/libxl_types.idl
+Index: xen-4.14.1-testing/tools/libxl/libxl_types.idl
 ===================================================================
---- xen-4.14.0-testing.orig/tools/libxl/libxl_types.idl
-+++ xen-4.14.0-testing/tools/libxl/libxl_types.idl
+--- xen-4.14.1-testing.orig/tools/libxl/libxl_types.idl
++++ xen-4.14.1-testing/tools/libxl/libxl_types.idl
 @@ -934,6 +934,43 @@ libxl_device_vsnd = Struct("device_vsnd"
      ("pcms", Array(libxl_vsnd_pcm, "num_vsnd_pcms"))
      ])
@@ -312,10 +312,10 @@
  libxl_vtpminfo = Struct("vtpminfo", [
      ("backend", string),
      ("backend_id", uint32),
-Index: xen-4.14.0-testing/tools/libxl/libxl_types_internal.idl
+Index: xen-4.14.1-testing/tools/libxl/libxl_types_internal.idl
 ===================================================================
---- xen-4.14.0-testing.orig/tools/libxl/libxl_types_internal.idl
-+++ xen-4.14.0-testing/tools/libxl/libxl_types_internal.idl
+--- xen-4.14.1-testing.orig/tools/libxl/libxl_types_internal.idl
++++ xen-4.14.1-testing/tools/libxl/libxl_types_internal.idl
 @@ -32,6 +32,7 @@ libxl__device_kind = Enumeration("device
      (14, "PVCALLS"),
      (15, "VSND"),
@@ -324,10 +324,10 @@
      ])
  
  libxl__console_backend = Enumeration("console_backend", [
-Index: xen-4.14.0-testing/tools/libxl/libxl_vscsi.c
+Index: xen-4.14.1-testing/tools/libxl/libxl_vscsi.c
 ===================================================================
 --- /dev/null
-+++ xen-4.14.0-testing/tools/libxl/libxl_vscsi.c
++++ xen-4.14.1-testing/tools/libxl/libxl_vscsi.c
 @@ -0,0 +1,1185 @@
 +/*
 + * Copyright (C) 2016      SUSE Linux GmbH
@@ -1514,10 +1514,10 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-Index: xen-4.14.0-testing/tools/libxl/libxlu_vscsi.c
+Index: xen-4.14.1-testing/tools/libxl/libxlu_vscsi.c
 ===================================================================
 --- /dev/null
-+++ xen-4.14.0-testing/tools/libxl/libxlu_vscsi.c
++++ xen-4.14.1-testing/tools/libxl/libxlu_vscsi.c
 @@ -0,0 +1,668 @@
 +/*
 + * libxlu_vscsi.c - xl configuration file parsing: setup and helper functions
@@ -2187,10 +2187,10 @@
 +    return ERROR_INVAL;
 +}
 +#endif
-Index: xen-4.14.0-testing/tools/libxl/libxlutil.h
+Index: xen-4.14.1-testing/tools/libxl/libxlutil.h
 ===================================================================
---- xen-4.14.0-testing.orig/tools/libxl/libxlutil.h
-+++ xen-4.14.0-testing/tools/libxl/libxlutil.h
+--- xen-4.14.1-testing.orig/tools/libxl/libxlutil.h
++++ xen-4.14.1-testing/tools/libxl/libxlutil.h
 @@ -125,6 +125,25 @@ int xlu_rdm_parse(XLU_Config *cfg, libxl
  int xlu_vif_parse_rate(XLU_Config *cfg, const char *rate,
                         libxl_device_nic *nic);
@@ -2217,10 +2217,10 @@
  #endif /* LIBXLUTIL_H */
  
  /*
-Index: xen-4.14.0-testing/tools/xl/Makefile
+Index: xen-4.14.1-testing/tools/xl/Makefile
 ===================================================================
---- xen-4.14.0-testing.orig/tools/xl/Makefile
-+++ xen-4.14.0-testing/tools/xl/Makefile
+--- xen-4.14.1-testing.orig/tools/xl/Makefile
++++ xen-4.14.1-testing/tools/xl/Makefile
 @@ -18,7 +18,7 @@ CFLAGS_XL += -Wshadow
  XL_OBJS-$(CONFIG_X86) = xl_psr.o
  XL_OBJS = xl.o xl_cmdtable.o xl_sxp.o xl_utils.o $(XL_OBJS-y)
@@ -2230,10 +2230,10 @@
  XL_OBJS += xl_sched.o xl_pci.o xl_vcpu.o xl_cdrom.o xl_mem.o
  XL_OBJS += xl_info.o xl_console.o xl_misc.o
  XL_OBJS += xl_vmcontrol.o xl_saverestore.o xl_migrate.o
-Index: xen-4.14.0-testing/tools/xl/xl.h
+Index: xen-4.14.1-testing/tools/xl/xl.h
 ===================================================================
---- xen-4.14.0-testing.orig/tools/xl/xl.h
-+++ xen-4.14.0-testing/tools/xl/xl.h
+--- xen-4.14.1-testing.orig/tools/xl/xl.h
++++ xen-4.14.1-testing/tools/xl/xl.h
 @@ -166,6 +166,9 @@ int main_channellist(int argc, char **ar
  int main_blockattach(int argc, char **argv);
  int main_blocklist(int argc, char **argv);
@@ -2244,10 +2244,10 @@
  int main_vtpmattach(int argc, char **argv);
  int main_vtpmlist(int argc, char **argv);
  int main_vtpmdetach(int argc, char **argv);
-Index: xen-4.14.0-testing/tools/xl/xl_parse.c
+Index: xen-4.14.1-testing/tools/xl/xl_parse.c
 ===================================================================
---- xen-4.14.0-testing.orig/tools/xl/xl_parse.c
-+++ xen-4.14.0-testing/tools/xl/xl_parse.c
+--- xen-4.14.1-testing.orig/tools/xl/xl_parse.c
++++ xen-4.14.1-testing/tools/xl/xl_parse.c
 @@ -1212,7 +1212,8 @@ void parse_config_data(const char *confi
      long l, vcpus = 0;
      XLU_Config *config;
@@ -2276,10 +2276,10 @@
      if (!xlu_cfg_get_list(config, "vtpm", &vtpms, 0, 0)) {
          d_config->num_vtpms = 0;
          d_config->vtpms = NULL;
-Index: xen-4.14.0-testing/tools/xl/xl_vscsi.c
+Index: xen-4.14.1-testing/tools/xl/xl_vscsi.c
 ===================================================================
 --- /dev/null
-+++ xen-4.14.0-testing/tools/xl/xl_vscsi.c
++++ xen-4.14.1-testing/tools/xl/xl_vscsi.c
 @@ -0,0 +1,229 @@
 +/*
 + * Copyright 2009-2017 Citrix Ltd and other contributors
@@ -2510,10 +2510,10 @@
 +    return !!rc;
 +}
 +
-Index: xen-4.14.0-testing/tools/xl/xl_cmdtable.c
+Index: xen-4.14.1-testing/tools/xl/xl_cmdtable.c
 ===================================================================
---- xen-4.14.0-testing.orig/tools/xl/xl_cmdtable.c
-+++ xen-4.14.0-testing/tools/xl/xl_cmdtable.c
+--- xen-4.14.1-testing.orig/tools/xl/xl_cmdtable.c
++++ xen-4.14.1-testing/tools/xl/xl_cmdtable.c
 @@ -370,6 +370,21 @@ struct cmd_spec cmd_table[] = {
        "Destroy a domain's virtual block device",
        "<Domain> <DevId>",

++++++ libxl.set-migration-constraints-from-cmdline.patch ++++++
--- /var/tmp/diff_new_pack.L3j0Cr/_old  2021-04-23 17:49:43.542701338 +0200
+++ /var/tmp/diff_new_pack.L3j0Cr/_new  2021-04-23 17:49:43.542701338 +0200
@@ -89,8 +89,10 @@
  tools/libxl/xl_cmdtable.c        |   23 ++++++++++++++--------
  13 files changed, 156 insertions(+), 28 deletions(-)
 
---- a/docs/man/xl.1.pod.in
-+++ b/docs/man/xl.1.pod.in
+Index: xen-4.14.1-testing/docs/man/xl.1.pod.in
+===================================================================
+--- xen-4.14.1-testing.orig/docs/man/xl.1.pod.in
++++ xen-4.14.1-testing/docs/man/xl.1.pod.in
 @@ -497,6 +497,22 @@ such that it will be identical on the de
  configuration is overridden using the B<-C> option. Note that it is not
  possible to use this option for a 'localhost' migration.
@@ -114,8 +116,10 @@
  =back
  
  =item B<remus> [I<OPTIONS>] I<domain-id> I<host>
---- a/tools/libxc/include/xenguest.h
-+++ b/tools/libxc/include/xenguest.h
+Index: xen-4.14.1-testing/tools/libxc/include/xenguest.h
+===================================================================
+--- xen-4.14.1-testing.orig/tools/libxc/include/xenguest.h
++++ xen-4.14.1-testing/tools/libxc/include/xenguest.h
 @@ -26,6 +26,7 @@
  
  #define XCFLAGS_LIVE      (1 << 0)
@@ -146,8 +150,10 @@
  
  /* callbacks provided by xc_domain_restore */
  struct restore_callbacks {
---- a/tools/libxc/xc_nomigrate.c
-+++ b/tools/libxc/xc_nomigrate.c
+Index: xen-4.14.1-testing/tools/libxc/xc_nomigrate.c
+===================================================================
+--- xen-4.14.1-testing.orig/tools/libxc/xc_nomigrate.c
++++ xen-4.14.1-testing/tools/libxc/xc_nomigrate.c
 @@ -20,8 +20,10 @@
  #include <xenctrl.h>
  #include <xenguest.h>
@@ -160,8 +166,10 @@
                     xc_stream_type_t stream_type, int recv_fd)
  {
      errno = ENOSYS;
---- a/tools/libxc/xc_sr_save.c
-+++ b/tools/libxc/xc_sr_save.c
+Index: xen-4.14.1-testing/tools/libxc/xc_sr_save.c
+===================================================================
+--- xen-4.14.1-testing.orig/tools/libxc/xc_sr_save.c
++++ xen-4.14.1-testing/tools/libxc/xc_sr_save.c
 @@ -992,8 +992,62 @@ static int save(struct xc_sr_context *ct
      return rc;
  };
@@ -245,8 +253,10 @@
      if ( xc_domain_getinfo(xch, dom, 1, &ctx.dominfo) != 1 )
      {
          PERROR("Failed to get domain info");
---- a/tools/libxl/libxl.h
-+++ b/tools/libxl/libxl.h
+Index: xen-4.14.1-testing/tools/libxl/libxl.h
+===================================================================
+--- xen-4.14.1-testing.orig/tools/libxl/libxl.h
++++ xen-4.14.1-testing/tools/libxl/libxl.h
 @@ -1667,8 +1667,23 @@ int libxl_domain_suspend(libxl_ctx *ctx,
                           int flags, /* LIBXL_SUSPEND_* */
                           const libxl_asyncop_how *ao_how)
@@ -271,8 +281,10 @@
  
  /*
   * Only suspend domain, do not save its state to file, do not destroy it.
---- a/tools/libxl/libxl_dom_save.c
-+++ b/tools/libxl/libxl_dom_save.c
+Index: xen-4.14.1-testing/tools/libxl/libxl_dom_save.c
+===================================================================
+--- xen-4.14.1-testing.orig/tools/libxl/libxl_dom_save.c
++++ xen-4.14.1-testing/tools/libxl/libxl_dom_save.c
 @@ -409,7 +409,8 @@ void libxl__domain_save(libxl__egc *egc,
      if (rc) goto out;
  
@@ -283,8 +295,10 @@
  
      /* Disallow saving a guest with vNUMA configured because migration
       * stream does not preserve node information.
---- a/tools/libxl/libxl_domain.c
-+++ b/tools/libxl/libxl_domain.c
+Index: xen-4.14.1-testing/tools/libxl/libxl_domain.c
+===================================================================
+--- xen-4.14.1-testing.orig/tools/libxl/libxl_domain.c
++++ xen-4.14.1-testing/tools/libxl/libxl_domain.c
 @@ -505,8 +505,9 @@ static void domain_suspend_cb(libxl__egc
  
  }
@@ -335,9 +349,11 @@
  int libxl_domain_pause(libxl_ctx *ctx, uint32_t domid,
                         const libxl_asyncop_how *ao_how)
  {
---- a/tools/libxl/libxl_internal.h
-+++ b/tools/libxl/libxl_internal.h
-@@ -3641,6 +3641,9 @@ struct libxl__domain_save_state {
+Index: xen-4.14.1-testing/tools/libxl/libxl_internal.h
+===================================================================
+--- xen-4.14.1-testing.orig/tools/libxl/libxl_internal.h
++++ xen-4.14.1-testing/tools/libxl/libxl_internal.h
+@@ -3643,6 +3643,9 @@ struct libxl__domain_save_state {
      const libxl_domain_remus_info *remus;
      /* private */
      int rc;
@@ -347,8 +363,10 @@
      int xcflags;
      libxl__domain_suspend_state dsps;
      union {
---- a/tools/libxl/libxl_save_callout.c
-+++ b/tools/libxl/libxl_save_callout.c
+Index: xen-4.14.1-testing/tools/libxl/libxl_save_callout.c
+===================================================================
+--- xen-4.14.1-testing.orig/tools/libxl/libxl_save_callout.c
++++ xen-4.14.1-testing/tools/libxl/libxl_save_callout.c
 @@ -88,6 +88,7 @@ void libxl__xc_domain_save(libxl__egc *e
  
      const unsigned long argnums[] = {
@@ -357,8 +375,10 @@
          dss->checkpointed_stream,
      };
  
---- a/tools/libxl/libxl_save_helper.c
-+++ b/tools/libxl/libxl_save_helper.c
+Index: xen-4.14.1-testing/tools/libxl/libxl_save_helper.c
+===================================================================
+--- xen-4.14.1-testing.orig/tools/libxl/libxl_save_helper.c
++++ xen-4.14.1-testing/tools/libxl/libxl_save_helper.c
 @@ -250,6 +250,8 @@ int main(int argc, char **argv)
          uint32_t dom =                      strtoul(NEXTARG,0,10);
          uint32_t flags =                    strtoul(NEXTARG,0,10);
@@ -379,8 +399,10 @@
          complete(r);
  
      } else if (!strcmp(mode,"--restore-domain")) {
---- a/tools/xl/xl_cmdtable.c
-+++ b/tools/xl/xl_cmdtable.c
+Index: xen-4.14.1-testing/tools/xl/xl_cmdtable.c
+===================================================================
+--- xen-4.14.1-testing.orig/tools/xl/xl_cmdtable.c
++++ xen-4.14.1-testing/tools/xl/xl_cmdtable.c
 @@ -160,16 +160,22 @@ struct cmd_spec cmd_table[] = {
        &main_migrate, 0, 1,
        "Migrate a domain to another host",
@@ -414,8 +436,10 @@
      },
      { "restore",
        &main_restore, 0, 1,
---- a/tools/xl/xl_migrate.c
-+++ b/tools/xl/xl_migrate.c
+Index: xen-4.14.1-testing/tools/xl/xl_migrate.c
+===================================================================
+--- xen-4.14.1-testing.orig/tools/xl/xl_migrate.c
++++ xen-4.14.1-testing/tools/xl/xl_migrate.c
 @@ -178,6 +178,7 @@ static void migrate_do_preamble(int send
  
  static void migrate_domain(uint32_t domid, int preserve_domid,

++++++ x86-ioapic-ack-default.patch ++++++
--- /var/tmp/diff_new_pack.L3j0Cr/_old  2021-04-23 17:49:43.598701434 +0200
+++ /var/tmp/diff_new_pack.L3j0Cr/_new  2021-04-23 17:49:43.598701434 +0200
@@ -1,10 +1,8 @@
 Change default IO-APIC ack mode for single IO-APIC systems to old-style.
 
-Index: xen-4.14.0-testing/xen/arch/x86/io_apic.c
-===================================================================
---- xen-4.14.0-testing.orig/xen/arch/x86/io_apic.c
-+++ xen-4.14.0-testing/xen/arch/x86/io_apic.c
-@@ -2031,7 +2031,10 @@ void __init setup_IO_APIC(void)
+--- a/xen/arch/x86/io_apic.c
++++ b/xen/arch/x86/io_apic.c
+@@ -2062,7 +2062,10 @@ void __init setup_IO_APIC(void)
          io_apic_irqs = ~PIC_IRQS;
  
      printk("ENABLING IO-APIC IRQs\n");

Reply via email to