--- /dev/null
+From c0761c78053c3e57e5b95a271109c1d74bd5fc5e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 17 Dec 2020 11:54:01 +0100
+Subject: ASoC: Intel: haswell: Add missing pm_ops
+
+From: Cezary Rojewski <cezary.rojewski@intel.com>
+
+[ Upstream commit bb224c3e3e41d940612d4cc9573289cdbd5cb8f5 ]
+
+haswell machine board is missing pm_ops what prevents it from undergoing
+suspend-resume procedure successfully. Assign default snd_soc_pm_ops so
+this is no longer the case.
+
+Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
+Link: https://lore.kernel.org/r/20201217105401.27865-1-cezary.rojewski@intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/intel/boards/haswell.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/sound/soc/intel/boards/haswell.c b/sound/soc/intel/boards/haswell.c
+index 8158409921e02..c6007aa95fff1 100644
+--- a/sound/soc/intel/boards/haswell.c
++++ b/sound/soc/intel/boards/haswell.c
+@@ -197,6 +197,7 @@ static struct platform_driver haswell_audio = {
+ .probe = haswell_audio_probe,
+ .driver = {
+ .name = "haswell-audio",
++ .pm = &snd_soc_pm_ops,
+ },
+ };
+
+--
+2.27.0
+
--- /dev/null
+From bf13e86dbee060f4d5addb522df66b4aad8eee66 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 14 Dec 2020 18:18:11 +0100
+Subject: dm integrity: select CRYPTO_SKCIPHER
+
+From: Anthony Iliopoulos <ailiop@suse.com>
+
+[ Upstream commit f7b347acb5f6c29d9229bb64893d8b6a2c7949fb ]
+
+The integrity target relies on skcipher for encryption/decryption, but
+certain kernel configurations may not enable CRYPTO_SKCIPHER, leading to
+compilation errors due to unresolved symbols. Explicitly select
+CRYPTO_SKCIPHER for DM_INTEGRITY, since it is unconditionally dependent
+on it.
+
+Signed-off-by: Anthony Iliopoulos <ailiop@suse.com>
+Signed-off-by: Mike Snitzer <snitzer@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/md/Kconfig | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/md/Kconfig b/drivers/md/Kconfig
+index 4a249ee86364c..231b6a18ca272 100644
+--- a/drivers/md/Kconfig
++++ b/drivers/md/Kconfig
+@@ -508,6 +508,7 @@ config DM_INTEGRITY
+ select BLK_DEV_INTEGRITY
+ select DM_BUFIO
+ select CRYPTO
++ select CRYPTO_SKCIPHER
+ select ASYNC_XOR
+ ---help---
+ This device-mapper target emulates a block device that has
+--
+2.27.0
+
--- /dev/null
+From eb7ec5a8e43cece393b546ed2589074229711d41 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 13 Jan 2021 17:12:52 +1000
+Subject: drm/nouveau/bios: fix issue shadowing expansion ROMs
+
+From: Ben Skeggs <bskeggs@redhat.com>
+
+[ Upstream commit 402a89660e9dc880710b12773076a336c9dab3d7 ]
+
+This issue has generally been covered up by the presence of additional
+expansion ROMs after the ones we're interested in, with header fetches
+of subsequent images loading enough of the ROM to hide the issue.
+
+Noticed on GA102, which lacks a type 0x70 image compared to TU102,.
+
+[ 906.364197] nouveau 0000:09:00.0: bios: 00000000: type 00, 65024 bytes
+[ 906.381205] nouveau 0000:09:00.0: bios: 0000fe00: type 03, 91648 bytes
+[ 906.405213] nouveau 0000:09:00.0: bios: 00026400: type e0, 22016 bytes
+[ 906.410984] nouveau 0000:09:00.0: bios: 0002ba00: type e0, 366080 bytes
+
+vs
+
+[ 22.961901] nouveau 0000:09:00.0: bios: 00000000: type 00, 60416 bytes
+[ 22.984174] nouveau 0000:09:00.0: bios: 0000ec00: type 03, 71168 bytes
+[ 23.010446] nouveau 0000:09:00.0: bios: 00020200: type e0, 48128 bytes
+[ 23.028220] nouveau 0000:09:00.0: bios: 0002be00: type e0, 140800 bytes
+[ 23.080196] nouveau 0000:09:00.0: bios: 0004e400: type 70, 7168 bytes
+
+Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadow.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadow.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadow.c
+index 7deb81b6dbac6..4b571cc6bc70f 100644
+--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadow.c
++++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadow.c
+@@ -75,7 +75,7 @@ shadow_image(struct nvkm_bios *bios, int idx, u32 offset, struct shadow *mthd)
+ nvkm_debug(subdev, "%08x: type %02x, %d bytes\n",
+ image.base, image.type, image.size);
+
+- if (!shadow_fetch(bios, mthd, image.size)) {
++ if (!shadow_fetch(bios, mthd, image.base + image.size)) {
+ nvkm_debug(subdev, "%08x: fetch failed\n", image.base);
+ return 0;
+ }
+--
+2.27.0
+
--- /dev/null
+From 8d585e0f09a15097fe4addca82c47c238f5d0b3d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 13 Jan 2021 17:12:52 +1000
+Subject: drm/nouveau/i2c/gm200: increase width of aux semaphore owner fields
+
+From: Ben Skeggs <bskeggs@redhat.com>
+
+[ Upstream commit ba6e9ab0fcf3d76e3952deb12b5f993991621d9c ]
+
+Noticed while debugging GA102.
+
+Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgm200.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgm200.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgm200.c
+index edb6148cbca04..d0e80ad526845 100644
+--- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgm200.c
++++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgm200.c
+@@ -33,7 +33,7 @@ static void
+ gm200_i2c_aux_fini(struct gm200_i2c_aux *aux)
+ {
+ struct nvkm_device *device = aux->base.pad->i2c->subdev.device;
+- nvkm_mask(device, 0x00d954 + (aux->ch * 0x50), 0x00310000, 0x00000000);
++ nvkm_mask(device, 0x00d954 + (aux->ch * 0x50), 0x00710000, 0x00000000);
+ }
+
+ static int
+@@ -54,10 +54,10 @@ gm200_i2c_aux_init(struct gm200_i2c_aux *aux)
+ AUX_ERR(&aux->base, "begin idle timeout %08x", ctrl);
+ return -EBUSY;
+ }
+- } while (ctrl & 0x03010000);
++ } while (ctrl & 0x07010000);
+
+ /* set some magic, and wait up to 1ms for it to appear */
+- nvkm_mask(device, 0x00d954 + (aux->ch * 0x50), 0x00300000, ureq);
++ nvkm_mask(device, 0x00d954 + (aux->ch * 0x50), 0x00700000, ureq);
+ timeout = 1000;
+ do {
+ ctrl = nvkm_rd32(device, 0x00d954 + (aux->ch * 0x50));
+@@ -67,7 +67,7 @@ gm200_i2c_aux_init(struct gm200_i2c_aux *aux)
+ gm200_i2c_aux_fini(aux);
+ return -EBUSY;
+ }
+- } while ((ctrl & 0x03000000) != urep);
++ } while ((ctrl & 0x07000000) != urep);
+
+ return 0;
+ }
+--
+2.27.0
+
--- /dev/null
+From fe4d8b59599f782bcf552b2d0cc47f98ef71a8dd Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 13 Jan 2021 17:12:52 +1000
+Subject: drm/nouveau/privring: ack interrupts the same way as RM
+
+From: Ben Skeggs <bskeggs@redhat.com>
+
+[ Upstream commit e05e06cd34f5311f677294a08b609acfbc315236 ]
+
+Whatever it is that we were doing before doesn't work on Ampere.
+
+Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gf100.c | 10 +++++++---
+ drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gk104.c | 10 +++++++---
+ 2 files changed, 14 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gf100.c b/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gf100.c
+index d80dbc8f09b20..55a4ea4393c62 100644
+--- a/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gf100.c
++++ b/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gf100.c
+@@ -22,6 +22,7 @@
+ * Authors: Ben Skeggs
+ */
+ #include "priv.h"
++#include <subdev/timer.h>
+
+ static void
+ gf100_ibus_intr_hub(struct nvkm_subdev *ibus, int i)
+@@ -31,7 +32,6 @@ gf100_ibus_intr_hub(struct nvkm_subdev *ibus, int i)
+ u32 data = nvkm_rd32(device, 0x122124 + (i * 0x0400));
+ u32 stat = nvkm_rd32(device, 0x122128 + (i * 0x0400));
+ nvkm_debug(ibus, "HUB%d: %06x %08x (%08x)\n", i, addr, data, stat);
+- nvkm_mask(device, 0x122128 + (i * 0x0400), 0x00000200, 0x00000000);
+ }
+
+ static void
+@@ -42,7 +42,6 @@ gf100_ibus_intr_rop(struct nvkm_subdev *ibus, int i)
+ u32 data = nvkm_rd32(device, 0x124124 + (i * 0x0400));
+ u32 stat = nvkm_rd32(device, 0x124128 + (i * 0x0400));
+ nvkm_debug(ibus, "ROP%d: %06x %08x (%08x)\n", i, addr, data, stat);
+- nvkm_mask(device, 0x124128 + (i * 0x0400), 0x00000200, 0x00000000);
+ }
+
+ static void
+@@ -53,7 +52,6 @@ gf100_ibus_intr_gpc(struct nvkm_subdev *ibus, int i)
+ u32 data = nvkm_rd32(device, 0x128124 + (i * 0x0400));
+ u32 stat = nvkm_rd32(device, 0x128128 + (i * 0x0400));
+ nvkm_debug(ibus, "GPC%d: %06x %08x (%08x)\n", i, addr, data, stat);
+- nvkm_mask(device, 0x128128 + (i * 0x0400), 0x00000200, 0x00000000);
+ }
+
+ void
+@@ -90,6 +88,12 @@ gf100_ibus_intr(struct nvkm_subdev *ibus)
+ intr1 &= ~stat;
+ }
+ }
++
++ nvkm_mask(device, 0x121c4c, 0x0000003f, 0x00000002);
++ nvkm_msec(device, 2000,
++ if (!(nvkm_rd32(device, 0x121c4c) & 0x0000003f))
++ break;
++ );
+ }
+
+ static int
+diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gk104.c b/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gk104.c
+index 9025ed1bd2a99..4caf3ef087e1d 100644
+--- a/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gk104.c
++++ b/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gk104.c
+@@ -22,6 +22,7 @@
+ * Authors: Ben Skeggs
+ */
+ #include "priv.h"
++#include <subdev/timer.h>
+
+ static void
+ gk104_ibus_intr_hub(struct nvkm_subdev *ibus, int i)
+@@ -31,7 +32,6 @@ gk104_ibus_intr_hub(struct nvkm_subdev *ibus, int i)
+ u32 data = nvkm_rd32(device, 0x122124 + (i * 0x0800));
+ u32 stat = nvkm_rd32(device, 0x122128 + (i * 0x0800));
+ nvkm_debug(ibus, "HUB%d: %06x %08x (%08x)\n", i, addr, data, stat);
+- nvkm_mask(device, 0x122128 + (i * 0x0800), 0x00000200, 0x00000000);
+ }
+
+ static void
+@@ -42,7 +42,6 @@ gk104_ibus_intr_rop(struct nvkm_subdev *ibus, int i)
+ u32 data = nvkm_rd32(device, 0x124124 + (i * 0x0800));
+ u32 stat = nvkm_rd32(device, 0x124128 + (i * 0x0800));
+ nvkm_debug(ibus, "ROP%d: %06x %08x (%08x)\n", i, addr, data, stat);
+- nvkm_mask(device, 0x124128 + (i * 0x0800), 0x00000200, 0x00000000);
+ }
+
+ static void
+@@ -53,7 +52,6 @@ gk104_ibus_intr_gpc(struct nvkm_subdev *ibus, int i)
+ u32 data = nvkm_rd32(device, 0x128124 + (i * 0x0800));
+ u32 stat = nvkm_rd32(device, 0x128128 + (i * 0x0800));
+ nvkm_debug(ibus, "GPC%d: %06x %08x (%08x)\n", i, addr, data, stat);
+- nvkm_mask(device, 0x128128 + (i * 0x0800), 0x00000200, 0x00000000);
+ }
+
+ void
+@@ -90,6 +88,12 @@ gk104_ibus_intr(struct nvkm_subdev *ibus)
+ intr1 &= ~stat;
+ }
+ }
++
++ nvkm_mask(device, 0x12004c, 0x0000003f, 0x00000002);
++ nvkm_msec(device, 2000,
++ if (!(nvkm_rd32(device, 0x12004c) & 0x0000003f))
++ break;
++ );
+ }
+
+ static int
+--
+2.27.0
+
--- /dev/null
+From 92f161208dd97394d556c76c3cc8d123241b0b12 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 28 Dec 2020 04:04:36 -0800
+Subject: scsi: ufs: Correct the LUN used in eh_device_reset_handler() callback
+
+From: Can Guo <cang@codeaurora.org>
+
+[ Upstream commit 35fc4cd34426c242ab015ef280853b7bff101f48 ]
+
+Users can initiate resets to specific SCSI device/target/host through
+IOCTL. When this happens, the SCSI cmd passed to eh_device/target/host
+_reset_handler() callbacks is initialized with a request whose tag is -1.
+In this case it is not right for eh_device_reset_handler() callback to
+count on the LUN get from hba->lrb[-1]. Fix it by getting LUN from the SCSI
+device associated with the SCSI cmd.
+
+Link: https://lore.kernel.org/r/1609157080-26283-1-git-send-email-cang@codeaurora.org
+Reviewed-by: Avri Altman <avri.altman@wdc.com>
+Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
+Signed-off-by: Can Guo <cang@codeaurora.org>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/scsi/ufs/ufshcd.c | 11 ++++-------
+ 1 file changed, 4 insertions(+), 7 deletions(-)
+
+diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
+index 342e086e41991..f46fa8a2f6585 100644
+--- a/drivers/scsi/ufs/ufshcd.c
++++ b/drivers/scsi/ufs/ufshcd.c
+@@ -5536,19 +5536,16 @@ static int ufshcd_eh_device_reset_handler(struct scsi_cmnd *cmd)
+ {
+ struct Scsi_Host *host;
+ struct ufs_hba *hba;
+- unsigned int tag;
+ u32 pos;
+ int err;
+- u8 resp = 0xF;
+- struct ufshcd_lrb *lrbp;
++ u8 resp = 0xF, lun;
+ unsigned long flags;
+
+ host = cmd->device->host;
+ hba = shost_priv(host);
+- tag = cmd->request->tag;
+
+- lrbp = &hba->lrb[tag];
+- err = ufshcd_issue_tm_cmd(hba, lrbp->lun, 0, UFS_LOGICAL_RESET, &resp);
++ lun = ufshcd_scsi_to_upiu_lun(cmd->device->lun);
++ err = ufshcd_issue_tm_cmd(hba, lun, 0, UFS_LOGICAL_RESET, &resp);
+ if (err || resp != UPIU_TASK_MANAGEMENT_FUNC_COMPL) {
+ if (!err)
+ err = resp;
+@@ -5557,7 +5554,7 @@ static int ufshcd_eh_device_reset_handler(struct scsi_cmnd *cmd)
+
+ /* clear the commands that were pending for corresponding LUN */
+ for_each_set_bit(pos, &hba->outstanding_reqs, hba->nutrs) {
+- if (hba->lrb[pos].lun == lrbp->lun) {
++ if (hba->lrb[pos].lun == lun) {
+ err = ufshcd_clear_cmd(hba, pos);
+ if (err)
+ break;
+--
+2.27.0
+
mmc-sdhci-xenon-fix-1.8v-regulator-stabilization.patch
dm-avoid-filesystem-lookup-in-dm_get_dev_t.patch
drm-atomic-put-state-on-error-path.patch
+asoc-intel-haswell-add-missing-pm_ops.patch
+dm-integrity-select-crypto_skcipher.patch
+scsi-ufs-correct-the-lun-used-in-eh_device_reset_han.patch
+xen-fix-event-channel-callback-via-intx-gsi.patch
+drm-nouveau-bios-fix-issue-shadowing-expansion-roms.patch
+drm-nouveau-privring-ack-interrupts-the-same-way-as-.patch
+drm-nouveau-i2c-gm200-increase-width-of-aux-semaphor.patch
--- /dev/null
+From f8669206af27e46f74a4f4b0f0e0f39c2c0c871a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 13 Jan 2021 13:26:02 +0000
+Subject: xen: Fix event channel callback via INTX/GSI
+
+From: David Woodhouse <dwmw@amazon.co.uk>
+
+[ Upstream commit 3499ba8198cad47b731792e5e56b9ec2a78a83a2 ]
+
+For a while, event channel notification via the PCI platform device
+has been broken, because we attempt to communicate with xenstore before
+we even have notifications working, with the xs_reset_watches() call
+in xs_init().
+
+We tend to get away with this on Xen versions below 4.0 because we avoid
+calling xs_reset_watches() anyway, because xenstore might not cope with
+reading a non-existent key. And newer Xen *does* have the vector
+callback support, so we rarely fall back to INTX/GSI delivery.
+
+To fix it, clean up a bit of the mess of xs_init() and xenbus_probe()
+startup. Call xs_init() directly from xenbus_init() only in the !XS_HVM
+case, deferring it to be called from xenbus_probe() in the XS_HVM case
+instead.
+
+Then fix up the invocation of xenbus_probe() to happen either from its
+device_initcall if the callback is available early enough, or when the
+callback is finally set up. This means that the hack of calling
+xenbus_probe() from a workqueue after the first interrupt, or directly
+from the PCI platform device setup, is no longer needed.
+
+Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
+Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
+Link: https://lore.kernel.org/r/20210113132606.422794-2-dwmw2@infradead.org
+Signed-off-by: Juergen Gross <jgross@suse.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm/xen/enlighten.c | 2 +-
+ drivers/xen/events/events_base.c | 10 ----
+ drivers/xen/platform-pci.c | 1 -
+ drivers/xen/xenbus/xenbus.h | 1 +
+ drivers/xen/xenbus/xenbus_comms.c | 8 ---
+ drivers/xen/xenbus/xenbus_probe.c | 81 +++++++++++++++++++++++++------
+ include/xen/xenbus.h | 2 +-
+ 7 files changed, 70 insertions(+), 35 deletions(-)
+
+diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
+index ba7f4c8f5c3e4..e8e637c4f354d 100644
+--- a/arch/arm/xen/enlighten.c
++++ b/arch/arm/xen/enlighten.c
+@@ -393,7 +393,7 @@ static int __init xen_guest_init(void)
+ }
+ gnttab_init();
+ if (!xen_initial_domain())
+- xenbus_probe(NULL);
++ xenbus_probe();
+
+ /*
+ * Making sure board specific code will not set up ops for
+diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c
+index aca8456752797..8c08c7d46d3d0 100644
+--- a/drivers/xen/events/events_base.c
++++ b/drivers/xen/events/events_base.c
+@@ -1987,16 +1987,6 @@ static struct irq_chip xen_percpu_chip __read_mostly = {
+ .irq_ack = ack_dynirq,
+ };
+
+-int xen_set_callback_via(uint64_t via)
+-{
+- struct xen_hvm_param a;
+- a.domid = DOMID_SELF;
+- a.index = HVM_PARAM_CALLBACK_IRQ;
+- a.value = via;
+- return HYPERVISOR_hvm_op(HVMOP_set_param, &a);
+-}
+-EXPORT_SYMBOL_GPL(xen_set_callback_via);
+-
+ #ifdef CONFIG_XEN_PVHVM
+ /* Vector callbacks are better than PCI interrupts to receive event
+ * channel notifications because we can receive vector callbacks on any
+diff --git a/drivers/xen/platform-pci.c b/drivers/xen/platform-pci.c
+index 5d7dcad0b0a0d..4cec8146609ad 100644
+--- a/drivers/xen/platform-pci.c
++++ b/drivers/xen/platform-pci.c
+@@ -162,7 +162,6 @@ static int platform_pci_probe(struct pci_dev *pdev,
+ ret = gnttab_init();
+ if (ret)
+ goto grant_out;
+- xenbus_probe(NULL);
+ return 0;
+ grant_out:
+ gnttab_free_auto_xlat_frames();
+diff --git a/drivers/xen/xenbus/xenbus.h b/drivers/xen/xenbus/xenbus.h
+index 139539b0ab20d..e6a8d02d35254 100644
+--- a/drivers/xen/xenbus/xenbus.h
++++ b/drivers/xen/xenbus/xenbus.h
+@@ -114,6 +114,7 @@ int xenbus_probe_node(struct xen_bus_type *bus,
+ const char *type,
+ const char *nodename);
+ int xenbus_probe_devices(struct xen_bus_type *bus);
++void xenbus_probe(void);
+
+ void xenbus_dev_changed(const char *node, struct xen_bus_type *bus);
+
+diff --git a/drivers/xen/xenbus/xenbus_comms.c b/drivers/xen/xenbus/xenbus_comms.c
+index eb5151fc8efab..e5fda0256feb3 100644
+--- a/drivers/xen/xenbus/xenbus_comms.c
++++ b/drivers/xen/xenbus/xenbus_comms.c
+@@ -57,16 +57,8 @@ DEFINE_MUTEX(xs_response_mutex);
+ static int xenbus_irq;
+ static struct task_struct *xenbus_task;
+
+-static DECLARE_WORK(probe_work, xenbus_probe);
+-
+-
+ static irqreturn_t wake_waiting(int irq, void *unused)
+ {
+- if (unlikely(xenstored_ready == 0)) {
+- xenstored_ready = 1;
+- schedule_work(&probe_work);
+- }
+-
+ wake_up(&xb_waitq);
+ return IRQ_HANDLED;
+ }
+diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c
+index 217bcc092a968..fe24e8dcb2b8e 100644
+--- a/drivers/xen/xenbus/xenbus_probe.c
++++ b/drivers/xen/xenbus/xenbus_probe.c
+@@ -674,29 +674,76 @@ void unregister_xenstore_notifier(struct notifier_block *nb)
+ }
+ EXPORT_SYMBOL_GPL(unregister_xenstore_notifier);
+
+-void xenbus_probe(struct work_struct *unused)
++void xenbus_probe(void)
+ {
+ xenstored_ready = 1;
+
++ /*
++ * In the HVM case, xenbus_init() deferred its call to
++ * xs_init() in case callbacks were not operational yet.
++ * So do it now.
++ */
++ if (xen_store_domain_type == XS_HVM)
++ xs_init();
++
+ /* Notify others that xenstore is up */
+ blocking_notifier_call_chain(&xenstore_chain, 0, NULL);
+ }
+-EXPORT_SYMBOL_GPL(xenbus_probe);
+
+-static int __init xenbus_probe_initcall(void)
++/*
++ * Returns true when XenStore init must be deferred in order to
++ * allow the PCI platform device to be initialised, before we
++ * can actually have event channel interrupts working.
++ */
++static bool xs_hvm_defer_init_for_callback(void)
+ {
+- if (!xen_domain())
+- return -ENODEV;
++#ifdef CONFIG_XEN_PVHVM
++ return xen_store_domain_type == XS_HVM &&
++ !xen_have_vector_callback;
++#else
++ return false;
++#endif
++}
+
+- if (xen_initial_domain() || xen_hvm_domain())
+- return 0;
++static int __init xenbus_probe_initcall(void)
++{
++ /*
++ * Probe XenBus here in the XS_PV case, and also XS_HVM unless we
++ * need to wait for the platform PCI device to come up.
++ */
++ if (xen_store_domain_type == XS_PV ||
++ (xen_store_domain_type == XS_HVM &&
++ !xs_hvm_defer_init_for_callback()))
++ xenbus_probe();
+
+- xenbus_probe(NULL);
+ return 0;
+ }
+-
+ device_initcall(xenbus_probe_initcall);
+
++int xen_set_callback_via(uint64_t via)
++{
++ struct xen_hvm_param a;
++ int ret;
++
++ a.domid = DOMID_SELF;
++ a.index = HVM_PARAM_CALLBACK_IRQ;
++ a.value = via;
++
++ ret = HYPERVISOR_hvm_op(HVMOP_set_param, &a);
++ if (ret)
++ return ret;
++
++ /*
++ * If xenbus_probe_initcall() deferred the xenbus_probe()
++ * due to the callback not functioning yet, we can do it now.
++ */
++ if (!xenstored_ready && xs_hvm_defer_init_for_callback())
++ xenbus_probe();
++
++ return ret;
++}
++EXPORT_SYMBOL_GPL(xen_set_callback_via);
++
+ /* Set up event channel for xenstored which is run as a local process
+ * (this is normally used only in dom0)
+ */
+@@ -810,11 +857,17 @@ static int __init xenbus_init(void)
+ break;
+ }
+
+- /* Initialize the interface to xenstore. */
+- err = xs_init();
+- if (err) {
+- pr_warn("Error initializing xenstore comms: %i\n", err);
+- goto out_error;
++ /*
++ * HVM domains may not have a functional callback yet. In that
++ * case let xs_init() be called from xenbus_probe(), which will
++ * get invoked at an appropriate time.
++ */
++ if (xen_store_domain_type != XS_HVM) {
++ err = xs_init();
++ if (err) {
++ pr_warn("Error initializing xenstore comms: %i\n", err);
++ goto out_error;
++ }
+ }
+
+ if ((xen_store_domain_type != XS_LOCAL) &&
+diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h
+index eba01ab5a55e0..fe9a9fa2ebc45 100644
+--- a/include/xen/xenbus.h
++++ b/include/xen/xenbus.h
+@@ -187,7 +187,7 @@ void xs_suspend_cancel(void);
+
+ struct work_struct;
+
+-void xenbus_probe(struct work_struct *);
++void xenbus_probe(void);
+
+ #define XENBUS_IS_ERR_READ(str) ({ \
+ if (!IS_ERR(str) && strlen(str) == 0) { \
+--
+2.27.0
+