]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.17-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 15 Apr 2022 10:46:33 +0000 (12:46 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 15 Apr 2022 10:46:33 +0000 (12:46 +0200)
added patches:
alsa-core-add-snd_card_free_on_error-helper.patch
alsa-sis7019-fix-the-missing-error-handling.patch
btrfs-fix-btrfs_submit_compressed_write-cgroup-attribution.patch
btrfs-release-correct-delalloc-amount-in-direct-io-write-path.patch
btrfs-return-allocated-block-group-from-do_chunk_alloc.patch
drm-amdgpu-ensure-hda-function-is-suspended-before-asic-reset.patch
media-si2157-unknown-chip-version-si2147-a30-rom-0x50.patch
risc-v-kvm-don-t-clear-hgatp-csr-in-kvm_arch_vcpu_put.patch
uapi-linux-stddef.h-add-include-guards.patch

queue-5.17/alsa-core-add-snd_card_free_on_error-helper.patch [new file with mode: 0644]
queue-5.17/alsa-sis7019-fix-the-missing-error-handling.patch [new file with mode: 0644]
queue-5.17/btrfs-fix-btrfs_submit_compressed_write-cgroup-attribution.patch [new file with mode: 0644]
queue-5.17/btrfs-release-correct-delalloc-amount-in-direct-io-write-path.patch [new file with mode: 0644]
queue-5.17/btrfs-return-allocated-block-group-from-do_chunk_alloc.patch [new file with mode: 0644]
queue-5.17/drm-amdgpu-ensure-hda-function-is-suspended-before-asic-reset.patch [new file with mode: 0644]
queue-5.17/media-si2157-unknown-chip-version-si2147-a30-rom-0x50.patch [new file with mode: 0644]
queue-5.17/risc-v-kvm-don-t-clear-hgatp-csr-in-kvm_arch_vcpu_put.patch [new file with mode: 0644]
queue-5.17/series
queue-5.17/uapi-linux-stddef.h-add-include-guards.patch [new file with mode: 0644]

diff --git a/queue-5.17/alsa-core-add-snd_card_free_on_error-helper.patch b/queue-5.17/alsa-core-add-snd_card_free_on_error-helper.patch
new file mode 100644 (file)
index 0000000..e847ab0
--- /dev/null
@@ -0,0 +1,96 @@
+From fee2b871d8d6389c9b4bdf9346a99ccc1c98c9b8 Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Tue, 12 Apr 2022 11:31:40 +0200
+Subject: ALSA: core: Add snd_card_free_on_error() helper
+
+From: Takashi Iwai <tiwai@suse.de>
+
+commit fee2b871d8d6389c9b4bdf9346a99ccc1c98c9b8 upstream.
+
+This is a small helper function to handle the error path more easily
+when an error happens during the probe for the device with the
+device-managed card.  Since devres releases in the reverser order of
+the creations, usually snd_card_free() gets called at the last in the
+probe error path unless it already reached snd_card_register() calls.
+Due to this nature, when a driver expects the resource releases in
+card->private_free, this might be called too lately.
+
+As a workaround, one should call the probe like:
+
+ static int __some_probe(...) { // do real probe.... }
+
+ static int some_probe(...)
+ {
+       return snd_card_free_on_error(dev, __some_probe(dev, ...));
+ }
+
+so that the snd_card_free() is called explicitly at the beginning of
+the error path from the probe.
+
+This function will be used in the upcoming fixes to address the
+regressions by devres usages.
+
+Fixes: e8ad415b7a55 ("ALSA: core: Add managed card creation")
+Cc: <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/20220412093141.8008-2-tiwai@suse.de
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ include/sound/core.h |    1 +
+ sound/core/init.c    |   28 ++++++++++++++++++++++++++++
+ 2 files changed, 29 insertions(+)
+
+--- a/include/sound/core.h
++++ b/include/sound/core.h
+@@ -284,6 +284,7 @@ int snd_card_disconnect(struct snd_card
+ void snd_card_disconnect_sync(struct snd_card *card);
+ int snd_card_free(struct snd_card *card);
+ int snd_card_free_when_closed(struct snd_card *card);
++int snd_card_free_on_error(struct device *dev, int ret);
+ void snd_card_set_id(struct snd_card *card, const char *id);
+ int snd_card_register(struct snd_card *card);
+ int snd_card_info_init(void);
+--- a/sound/core/init.c
++++ b/sound/core/init.c
+@@ -209,6 +209,12 @@ static void __snd_card_release(struct de
+  * snd_card_register(), the very first devres action to call snd_card_free()
+  * is added automatically.  In that way, the resource disconnection is assured
+  * at first, then released in the expected order.
++ *
++ * If an error happens at the probe before snd_card_register() is called and
++ * there have been other devres resources, you'd need to free the card manually
++ * via snd_card_free() call in the error; otherwise it may lead to UAF due to
++ * devres call orders.  You can use snd_card_free_on_error() helper for
++ * handling it more easily.
+  */
+ int snd_devm_card_new(struct device *parent, int idx, const char *xid,
+                     struct module *module, size_t extra_size,
+@@ -235,6 +241,28 @@ int snd_devm_card_new(struct device *par
+ }
+ EXPORT_SYMBOL_GPL(snd_devm_card_new);
++/**
++ * snd_card_free_on_error - a small helper for handling devm probe errors
++ * @dev: the managed device object
++ * @ret: the return code from the probe callback
++ *
++ * This function handles the explicit snd_card_free() call at the error from
++ * the probe callback.  It's just a small helper for simplifying the error
++ * handling with the managed devices.
++ */
++int snd_card_free_on_error(struct device *dev, int ret)
++{
++      struct snd_card *card;
++
++      if (!ret)
++              return 0;
++      card = devres_find(dev, __snd_card_release, NULL, NULL);
++      if (card)
++              snd_card_free(card);
++      return ret;
++}
++EXPORT_SYMBOL_GPL(snd_card_free_on_error);
++
+ static int snd_card_init(struct snd_card *card, struct device *parent,
+                        int idx, const char *xid, struct module *module,
+                        size_t extra_size)
diff --git a/queue-5.17/alsa-sis7019-fix-the-missing-error-handling.patch b/queue-5.17/alsa-sis7019-fix-the-missing-error-handling.patch
new file mode 100644 (file)
index 0000000..22bce0d
--- /dev/null
@@ -0,0 +1,60 @@
+From 2236a3243ff8291e97c70097dd11a0fdb8904380 Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Tue, 12 Apr 2022 12:26:24 +0200
+Subject: ALSA: sis7019: Fix the missing error handling
+
+From: Takashi Iwai <tiwai@suse.de>
+
+commit 2236a3243ff8291e97c70097dd11a0fdb8904380 upstream.
+
+The previous cleanup with devres forgot to replace the snd_card_free()
+call with the devm version.  Moreover, it still needs the manual call
+of snd_card_free() at the probe error path, otherwise the reverse
+order of the releases may happen.  This patch addresses those issues.
+
+Fixes: 499ddc16394c ("ALSA: sis7019: Allocate resources with device-managed APIs")
+Cc: <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/20220412102636.16000-28-tiwai@suse.de
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ sound/pci/sis7019.c |   14 ++++++++++----
+ 1 file changed, 10 insertions(+), 4 deletions(-)
+
+--- a/sound/pci/sis7019.c
++++ b/sound/pci/sis7019.c
+@@ -1331,8 +1331,8 @@ static int sis_chip_create(struct snd_ca
+       return 0;
+ }
+-static int snd_sis7019_probe(struct pci_dev *pci,
+-                           const struct pci_device_id *pci_id)
++static int __snd_sis7019_probe(struct pci_dev *pci,
++                             const struct pci_device_id *pci_id)
+ {
+       struct snd_card *card;
+       struct sis7019 *sis;
+@@ -1352,8 +1352,8 @@ static int snd_sis7019_probe(struct pci_
+       if (!codecs)
+               codecs = SIS_PRIMARY_CODEC_PRESENT;
+-      rc = snd_card_new(&pci->dev, index, id, THIS_MODULE,
+-                        sizeof(*sis), &card);
++      rc = snd_devm_card_new(&pci->dev, index, id, THIS_MODULE,
++                             sizeof(*sis), &card);
+       if (rc < 0)
+               return rc;
+@@ -1386,6 +1386,12 @@ static int snd_sis7019_probe(struct pci_
+       return 0;
+ }
++static int snd_sis7019_probe(struct pci_dev *pci,
++                           const struct pci_device_id *pci_id)
++{
++      return snd_card_free_on_error(&pci->dev, __snd_sis7019_probe(pci, pci_id));
++}
++
+ static struct pci_driver sis7019_driver = {
+       .name = KBUILD_MODNAME,
+       .id_table = snd_sis7019_ids,
diff --git a/queue-5.17/btrfs-fix-btrfs_submit_compressed_write-cgroup-attribution.patch b/queue-5.17/btrfs-fix-btrfs_submit_compressed_write-cgroup-attribution.patch
new file mode 100644 (file)
index 0000000..289fa98
--- /dev/null
@@ -0,0 +1,53 @@
+From acee08aaf6d158d03668dc82b0a0eef41100531b Mon Sep 17 00:00:00 2001
+From: Dennis Zhou <dennis@kernel.org>
+Date: Thu, 31 Mar 2022 14:58:28 -0700
+Subject: btrfs: fix btrfs_submit_compressed_write cgroup attribution
+
+From: Dennis Zhou <dennis@kernel.org>
+
+commit acee08aaf6d158d03668dc82b0a0eef41100531b upstream.
+
+This restores the logic from commit 46bcff2bfc5e ("btrfs: fix compressed
+write bio blkcg attribution") which added cgroup attribution to btrfs
+writeback. It also adds back the REQ_CGROUP_PUNT flag for these ios.
+
+Fixes: 91507240482e ("btrfs: determine stripe boundary at bio allocation time in btrfs_submit_compressed_write")
+CC: stable@vger.kernel.org # 5.16+
+Signed-off-by: Dennis Zhou <dennis@kernel.org>
+Signed-off-by: David Sterba <dsterba@suse.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/btrfs/compression.c |    8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+--- a/fs/btrfs/compression.c
++++ b/fs/btrfs/compression.c
+@@ -534,6 +534,9 @@ blk_status_t btrfs_submit_compressed_wri
+       cb->orig_bio = NULL;
+       cb->nr_pages = nr_pages;
++      if (blkcg_css)
++              kthread_associate_blkcg(blkcg_css);
++
+       while (cur_disk_bytenr < disk_start + compressed_len) {
+               u64 offset = cur_disk_bytenr - disk_start;
+               unsigned int index = offset >> PAGE_SHIFT;
+@@ -552,6 +555,8 @@ blk_status_t btrfs_submit_compressed_wri
+                               bio = NULL;
+                               goto finish_cb;
+                       }
++                      if (blkcg_css)
++                              bio->bi_opf |= REQ_CGROUP_PUNT;
+               }
+               /*
+                * We should never reach next_stripe_start start as we will
+@@ -609,6 +614,9 @@ blk_status_t btrfs_submit_compressed_wri
+       return 0;
+ finish_cb:
++      if (blkcg_css)
++              kthread_associate_blkcg(NULL);
++
+       if (bio) {
+               bio->bi_status = ret;
+               bio_endio(bio);
diff --git a/queue-5.17/btrfs-release-correct-delalloc-amount-in-direct-io-write-path.patch b/queue-5.17/btrfs-release-correct-delalloc-amount-in-direct-io-write-path.patch
new file mode 100644 (file)
index 0000000..8175304
--- /dev/null
@@ -0,0 +1,107 @@
+From 6d82ad13c4110e73c7b0392f00534a1502a1b520 Mon Sep 17 00:00:00 2001
+From: Naohiro Aota <naohiro.aota@wdc.com>
+Date: Mon, 28 Mar 2022 21:32:05 +0900
+Subject: btrfs: release correct delalloc amount in direct IO write path
+
+From: Naohiro Aota <naohiro.aota@wdc.com>
+
+commit 6d82ad13c4110e73c7b0392f00534a1502a1b520 upstream.
+
+Running generic/406 causes the following WARNING in btrfs_destroy_inode()
+which tells there are outstanding extents left.
+
+In btrfs_get_blocks_direct_write(), we reserve a temporary outstanding
+extents with btrfs_delalloc_reserve_metadata() (or indirectly from
+btrfs_delalloc_reserve_space(()). We then release the outstanding extents
+with btrfs_delalloc_release_extents(). However, the "len" can be modified
+in the COW case, which releases fewer outstanding extents than expected.
+
+Fix it by calling btrfs_delalloc_release_extents() for the original length.
+
+To reproduce the warning, the filesystem should be 1 GiB.  It's
+triggering a short-write, due to not being able to allocate a large
+extent and instead allocating a smaller one.
+
+  WARNING: CPU: 0 PID: 757 at fs/btrfs/inode.c:8848 btrfs_destroy_inode+0x1e6/0x210 [btrfs]
+  Modules linked in: btrfs blake2b_generic xor lzo_compress
+  lzo_decompress raid6_pq zstd zstd_decompress zstd_compress xxhash zram
+  zsmalloc
+  CPU: 0 PID: 757 Comm: umount Not tainted 5.17.0-rc8+ #101
+  Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS d55cb5a 04/01/2014
+  RIP: 0010:btrfs_destroy_inode+0x1e6/0x210 [btrfs]
+  RSP: 0018:ffffc9000327bda8 EFLAGS: 00010206
+  RAX: 0000000000000000 RBX: ffff888100548b78 RCX: 0000000000000000
+  RDX: 0000000000026900 RSI: 0000000000000000 RDI: ffff888100548b78
+  RBP: ffff888100548940 R08: 0000000000000000 R09: ffff88810b48aba8
+  R10: 0000000000000001 R11: ffff8881004eb240 R12: ffff88810b48a800
+  R13: ffff88810b48ec08 R14: ffff88810b48ed00 R15: ffff888100490c68
+  FS:  00007f8549ea0b80(0000) GS:ffff888237c00000(0000) knlGS:0000000000000000
+  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
+  CR2: 00007f854a09e733 CR3: 000000010a2e9003 CR4: 0000000000370eb0
+  DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
+  DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
+  Call Trace:
+   <TASK>
+   destroy_inode+0x33/0x70
+   dispose_list+0x43/0x60
+   evict_inodes+0x161/0x1b0
+   generic_shutdown_super+0x2d/0x110
+   kill_anon_super+0xf/0x20
+   btrfs_kill_super+0xd/0x20 [btrfs]
+   deactivate_locked_super+0x27/0x90
+   cleanup_mnt+0x12c/0x180
+   task_work_run+0x54/0x80
+   exit_to_user_mode_prepare+0x152/0x160
+   syscall_exit_to_user_mode+0x12/0x30
+   do_syscall_64+0x42/0x80
+   entry_SYSCALL_64_after_hwframe+0x44/0xae
+   RIP: 0033:0x7f854a000fb7
+
+Fixes: f0bfa76a11e9 ("btrfs: fix ENOSPC failure when attempting direct IO write into NOCOW range")
+CC: stable@vger.kernel.org # 5.17
+Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
+Tested-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
+Reviewed-by: Filipe Manana <fdmanana@suse.com>
+Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
+Signed-off-by: David Sterba <dsterba@suse.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/btrfs/inode.c |    6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+--- a/fs/btrfs/inode.c
++++ b/fs/btrfs/inode.c
+@@ -7423,6 +7423,7 @@ static int btrfs_get_blocks_direct_write
+       u64 block_start, orig_start, orig_block_len, ram_bytes;
+       bool can_nocow = false;
+       bool space_reserved = false;
++      u64 prev_len;
+       int ret = 0;
+       /*
+@@ -7450,6 +7451,7 @@ static int btrfs_get_blocks_direct_write
+                       can_nocow = true;
+       }
++      prev_len = len;
+       if (can_nocow) {
+               struct extent_map *em2;
+@@ -7479,8 +7481,6 @@ static int btrfs_get_blocks_direct_write
+                       goto out;
+               }
+       } else {
+-              const u64 prev_len = len;
+-
+               /* Our caller expects us to free the input extent map. */
+               free_extent_map(em);
+               *map = NULL;
+@@ -7511,7 +7511,7 @@ static int btrfs_get_blocks_direct_write
+        * We have created our ordered extent, so we can now release our reservation
+        * for an outstanding extent.
+        */
+-      btrfs_delalloc_release_extents(BTRFS_I(inode), len);
++      btrfs_delalloc_release_extents(BTRFS_I(inode), prev_len);
+       /*
+        * Need to update the i_size under the extent lock so buffered
diff --git a/queue-5.17/btrfs-return-allocated-block-group-from-do_chunk_alloc.patch b/queue-5.17/btrfs-return-allocated-block-group-from-do_chunk_alloc.patch
new file mode 100644 (file)
index 0000000..dddb7ec
--- /dev/null
@@ -0,0 +1,70 @@
+From 820c363bd526ec8e133e4b84e6ad1fda12023b4b Mon Sep 17 00:00:00 2001
+From: Naohiro Aota <naohiro.aota@wdc.com>
+Date: Tue, 22 Mar 2022 18:11:33 +0900
+Subject: btrfs: return allocated block group from do_chunk_alloc()
+
+From: Naohiro Aota <naohiro.aota@wdc.com>
+
+commit 820c363bd526ec8e133e4b84e6ad1fda12023b4b upstream.
+
+Return the allocated block group from do_chunk_alloc(). This is a
+preparation patch for the next patch.
+
+CC: stable@vger.kernel.org # 5.16+
+Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
+Tested-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
+Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
+Signed-off-by: David Sterba <dsterba@suse.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/btrfs/block-group.c |   16 +++++++++++++---
+ 1 file changed, 13 insertions(+), 3 deletions(-)
+
+--- a/fs/btrfs/block-group.c
++++ b/fs/btrfs/block-group.c
+@@ -3427,7 +3427,7 @@ int btrfs_force_chunk_alloc(struct btrfs
+       return btrfs_chunk_alloc(trans, alloc_flags, CHUNK_ALLOC_FORCE);
+ }
+-static int do_chunk_alloc(struct btrfs_trans_handle *trans, u64 flags)
++static struct btrfs_block_group *do_chunk_alloc(struct btrfs_trans_handle *trans, u64 flags)
+ {
+       struct btrfs_block_group *bg;
+       int ret;
+@@ -3514,7 +3514,11 @@ static int do_chunk_alloc(struct btrfs_t
+ out:
+       btrfs_trans_release_chunk_metadata(trans);
+-      return ret;
++      if (ret)
++              return ERR_PTR(ret);
++
++      btrfs_get_block_group(bg);
++      return bg;
+ }
+ /*
+@@ -3629,6 +3633,7 @@ int btrfs_chunk_alloc(struct btrfs_trans
+ {
+       struct btrfs_fs_info *fs_info = trans->fs_info;
+       struct btrfs_space_info *space_info;
++      struct btrfs_block_group *ret_bg;
+       bool wait_for_alloc = false;
+       bool should_alloc = false;
+       int ret = 0;
+@@ -3722,9 +3727,14 @@ int btrfs_chunk_alloc(struct btrfs_trans
+                       force_metadata_allocation(fs_info);
+       }
+-      ret = do_chunk_alloc(trans, flags);
++      ret_bg = do_chunk_alloc(trans, flags);
+       trans->allocating_chunk = false;
++      if (IS_ERR(ret_bg))
++              ret = PTR_ERR(ret_bg);
++      else
++              btrfs_put_block_group(ret_bg);
++
+       spin_lock(&space_info->lock);
+       if (ret < 0) {
+               if (ret == -ENOSPC)
diff --git a/queue-5.17/drm-amdgpu-ensure-hda-function-is-suspended-before-asic-reset.patch b/queue-5.17/drm-amdgpu-ensure-hda-function-is-suspended-before-asic-reset.patch
new file mode 100644 (file)
index 0000000..ce1b0c8
--- /dev/null
@@ -0,0 +1,76 @@
+From 887f75cfd0da44c19dda93b2ff9e70ca8792cdc1 Mon Sep 17 00:00:00 2001
+From: Kai-Heng Feng <kai.heng.feng@canonical.com>
+Date: Thu, 7 Apr 2022 20:12:28 +0800
+Subject: drm/amdgpu: Ensure HDA function is suspended before ASIC reset
+
+From: Kai-Heng Feng <kai.heng.feng@canonical.com>
+
+commit 887f75cfd0da44c19dda93b2ff9e70ca8792cdc1 upstream.
+
+DP/HDMI audio on AMD PRO VII stops working after S3:
+[  149.450391] amdgpu 0000:63:00.0: amdgpu: MODE1 reset
+[  149.450395] amdgpu 0000:63:00.0: amdgpu: GPU mode1 reset
+[  149.450494] amdgpu 0000:63:00.0: amdgpu: GPU psp mode1 reset
+[  149.983693] snd_hda_intel 0000:63:00.1: refused to change power state from D0 to D3hot
+[  150.003439] amdgpu 0000:63:00.0: refused to change power state from D0 to D3hot
+...
+[  155.432975] snd_hda_intel 0000:63:00.1: CORB reset timeout#2, CORBRP = 65535
+
+The offending commit is daf8de0874ab5b ("drm/amdgpu: always reset the asic in
+suspend (v2)"). Commit 34452ac3038a7 ("drm/amdgpu: don't use BACO for
+reset in S3 ") doesn't help, so the issue is something different.
+
+Assuming that to make HDA resume to D0 fully realized, it needs to be
+successfully put to D3 first. And this guesswork proves working, by
+moving amdgpu_asic_reset() to noirq callback, so it's called after HDA
+function is in D3.
+
+Fixes: daf8de0874ab5b ("drm/amdgpu: always reset the asic in suspend (v2)")
+Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c |   18 ++++++++++++------
+ 1 file changed, 12 insertions(+), 6 deletions(-)
+
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+@@ -2276,18 +2276,23 @@ static int amdgpu_pmops_suspend(struct d
+ {
+       struct drm_device *drm_dev = dev_get_drvdata(dev);
+       struct amdgpu_device *adev = drm_to_adev(drm_dev);
+-      int r;
+       if (amdgpu_acpi_is_s0ix_active(adev))
+               adev->in_s0ix = true;
+       else
+               adev->in_s3 = true;
+-      r = amdgpu_device_suspend(drm_dev, true);
+-      if (r)
+-              return r;
++      return amdgpu_device_suspend(drm_dev, true);
++}
++
++static int amdgpu_pmops_suspend_noirq(struct device *dev)
++{
++      struct drm_device *drm_dev = dev_get_drvdata(dev);
++      struct amdgpu_device *adev = drm_to_adev(drm_dev);
++
+       if (!adev->in_s0ix)
+-              r = amdgpu_asic_reset(adev);
+-      return r;
++              return amdgpu_asic_reset(adev);
++
++      return 0;
+ }
+ static int amdgpu_pmops_resume(struct device *dev)
+@@ -2528,6 +2533,7 @@ static const struct dev_pm_ops amdgpu_pm
+       .prepare = amdgpu_pmops_prepare,
+       .complete = amdgpu_pmops_complete,
+       .suspend = amdgpu_pmops_suspend,
++      .suspend_noirq = amdgpu_pmops_suspend_noirq,
+       .resume = amdgpu_pmops_resume,
+       .freeze = amdgpu_pmops_freeze,
+       .thaw = amdgpu_pmops_thaw,
diff --git a/queue-5.17/media-si2157-unknown-chip-version-si2147-a30-rom-0x50.patch b/queue-5.17/media-si2157-unknown-chip-version-si2147-a30-rom-0x50.patch
new file mode 100644 (file)
index 0000000..ef9a4ff
--- /dev/null
@@ -0,0 +1,76 @@
+From 3ae87d2f25c0e998da2721ce332e2b80d3d53c39 Mon Sep 17 00:00:00 2001
+From: Piotr Chmura <chmooreck@gmail.com>
+Date: Thu, 31 Mar 2022 17:55:50 +0200
+Subject: media: si2157: unknown chip version Si2147-A30 ROM 0x50
+
+From: Piotr Chmura <chmooreck@gmail.com>
+
+commit 3ae87d2f25c0e998da2721ce332e2b80d3d53c39 upstream.
+
+Fix firmware file names assignment in si2157 tuner, allow for running
+devices without firmware files needed.
+
+modprobe gives error: unknown chip version Si2147-A30 ROM 0x50
+Device initialization is interrupted.
+
+Caused by:
+1. table si2157_tuners has swapped fields rom_id and required vs struct
+   si2157_tuner_info.
+2. both firmware file names can be null for devices with
+   required == false - device uses build-in firmware in this case
+
+Tested on this device:
+       m07ca:1871 AVerMedia Technologies, Inc. TD310 DVB-T/T2/C dongle
+
+[mchehab: fix mangled patch]
+Link: https://bugzilla.kernel.org/show_bug.cgi?id=215726
+Link: https://lore.kernel.org/lkml/5f660108-8812-383c-83e4-29ee0558d623@leemhuis.info/
+Link: https://lore.kernel.org/linux-media/c4bcaff8-fbad-969e-ad47-e2c487ac02a1@gmail.com
+Fixes: 1c35ba3bf972 ("media: si2157: use a different namespace for firmware")
+Cc: stable@vger.kernel.org # 5.17.x
+Signed-off-by: Piotr Chmura <chmooreck@gmail.com>
+Tested-by: Robert Schlabbach <robert_s@gmx.net>
+Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/media/tuners/si2157.c |   22 +++++++++++-----------
+ 1 file changed, 11 insertions(+), 11 deletions(-)
+
+--- a/drivers/media/tuners/si2157.c
++++ b/drivers/media/tuners/si2157.c
+@@ -77,16 +77,16 @@ err_mutex_unlock:
+ }
+ static const struct si2157_tuner_info si2157_tuners[] = {
+-      { SI2141, false, 0x60, SI2141_60_FIRMWARE, SI2141_A10_FIRMWARE },
+-      { SI2141, false, 0x61, SI2141_61_FIRMWARE, SI2141_A10_FIRMWARE },
+-      { SI2146, false, 0x11, SI2146_11_FIRMWARE, NULL },
+-      { SI2147, false, 0x50, SI2147_50_FIRMWARE, NULL },
+-      { SI2148, true,  0x32, SI2148_32_FIRMWARE, SI2158_A20_FIRMWARE },
+-      { SI2148, true,  0x33, SI2148_33_FIRMWARE, SI2158_A20_FIRMWARE },
+-      { SI2157, false, 0x50, SI2157_50_FIRMWARE, SI2157_A30_FIRMWARE },
+-      { SI2158, false, 0x50, SI2158_50_FIRMWARE, SI2158_A20_FIRMWARE },
+-      { SI2158, false, 0x51, SI2158_51_FIRMWARE, SI2158_A20_FIRMWARE },
+-      { SI2177, false, 0x50, SI2177_50_FIRMWARE, SI2157_A30_FIRMWARE },
++      { SI2141, 0x60, false, SI2141_60_FIRMWARE, SI2141_A10_FIRMWARE },
++      { SI2141, 0x61, false, SI2141_61_FIRMWARE, SI2141_A10_FIRMWARE },
++      { SI2146, 0x11, false, SI2146_11_FIRMWARE, NULL },
++      { SI2147, 0x50, false, SI2147_50_FIRMWARE, NULL },
++      { SI2148, 0x32, true,  SI2148_32_FIRMWARE, SI2158_A20_FIRMWARE },
++      { SI2148, 0x33, true,  SI2148_33_FIRMWARE, SI2158_A20_FIRMWARE },
++      { SI2157, 0x50, false, SI2157_50_FIRMWARE, SI2157_A30_FIRMWARE },
++      { SI2158, 0x50, false, SI2158_50_FIRMWARE, SI2158_A20_FIRMWARE },
++      { SI2158, 0x51, false, SI2158_51_FIRMWARE, SI2158_A20_FIRMWARE },
++      { SI2177, 0x50, false, SI2177_50_FIRMWARE, SI2157_A30_FIRMWARE },
+ };
+ static int si2157_load_firmware(struct dvb_frontend *fe,
+@@ -178,7 +178,7 @@ static int si2157_find_and_load_firmware
+               }
+       }
+-      if (!fw_name && !fw_alt_name) {
++      if (required && !fw_name && !fw_alt_name) {
+               dev_err(&client->dev,
+                       "unknown chip version Si21%d-%c%c%c ROM 0x%02x\n",
+                       part_id, cmd.args[1], cmd.args[3], cmd.args[4], rom_id);
diff --git a/queue-5.17/risc-v-kvm-don-t-clear-hgatp-csr-in-kvm_arch_vcpu_put.patch b/queue-5.17/risc-v-kvm-don-t-clear-hgatp-csr-in-kvm_arch_vcpu_put.patch
new file mode 100644 (file)
index 0000000..0707989
--- /dev/null
@@ -0,0 +1,41 @@
+From 8c3ce496bd612bd21679e445f75fcabb6be997b2 Mon Sep 17 00:00:00 2001
+From: Anup Patel <apatel@ventanamicro.com>
+Date: Sat, 9 Apr 2022 09:15:33 +0530
+Subject: RISC-V: KVM: Don't clear hgatp CSR in kvm_arch_vcpu_put()
+
+From: Anup Patel <apatel@ventanamicro.com>
+
+commit 8c3ce496bd612bd21679e445f75fcabb6be997b2 upstream.
+
+We might have RISC-V systems (such as QEMU) where VMID is not part
+of the TLB entry tag so these systems will have to flush all TLB
+entries upon any change in hgatp.VMID.
+
+Currently, we zero-out hgatp CSR in kvm_arch_vcpu_put() and we
+re-program hgatp CSR in kvm_arch_vcpu_load(). For above described
+systems, this will flush all TLB entries whenever VCPU exits to
+user-space hence reducing performance.
+
+This patch fixes above described performance issue by not clearing
+hgatp CSR in kvm_arch_vcpu_put().
+
+Fixes: 34bde9d8b9e6 ("RISC-V: KVM: Implement VCPU world-switch")
+Cc: stable@vger.kernel.org
+Signed-off-by: Anup Patel <apatel@ventanamicro.com>
+Signed-off-by: Anup Patel <anup@brainfault.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/riscv/kvm/vcpu.c |    2 --
+ 1 file changed, 2 deletions(-)
+
+--- a/arch/riscv/kvm/vcpu.c
++++ b/arch/riscv/kvm/vcpu.c
+@@ -653,8 +653,6 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *
+                                    vcpu->arch.isa);
+       kvm_riscv_vcpu_host_fp_restore(&vcpu->arch.host_context);
+-      csr_write(CSR_HGATP, 0);
+-
+       csr->vsstatus = csr_read(CSR_VSSTATUS);
+       csr->vsie = csr_read(CSR_VSIE);
+       csr->vstvec = csr_read(CSR_VSTVEC);
index 4ed161f5ac2e6361b4f187d025ce938e0485c726..4887c5374aca26c5a534fe996dbe93b7471b49e0 100644 (file)
@@ -7,3 +7,12 @@ net-dsa-realtek-rtl8365mb-serialize-indirect-phy-register-access.patch
 net-dsa-realtek-make-interface-drivers-depend-on-of.patch
 btrfs-remove-no-longer-used-counter-when-reading-data-page.patch
 btrfs-remove-unused-variable-in-btrfs_-start-write-_dirty_block_groups.patch
+risc-v-kvm-don-t-clear-hgatp-csr-in-kvm_arch_vcpu_put.patch
+media-si2157-unknown-chip-version-si2147-a30-rom-0x50.patch
+uapi-linux-stddef.h-add-include-guards.patch
+drm-amdgpu-ensure-hda-function-is-suspended-before-asic-reset.patch
+btrfs-release-correct-delalloc-amount-in-direct-io-write-path.patch
+btrfs-fix-btrfs_submit_compressed_write-cgroup-attribution.patch
+btrfs-return-allocated-block-group-from-do_chunk_alloc.patch
+alsa-core-add-snd_card_free_on_error-helper.patch
+alsa-sis7019-fix-the-missing-error-handling.patch
diff --git a/queue-5.17/uapi-linux-stddef.h-add-include-guards.patch b/queue-5.17/uapi-linux-stddef.h-add-include-guards.patch
new file mode 100644 (file)
index 0000000..cba0b68
--- /dev/null
@@ -0,0 +1,43 @@
+From 55037ed7bdc62151a726f5685f88afa6a82959b1 Mon Sep 17 00:00:00 2001
+From: Tadeusz Struk <tadeusz.struk@linaro.org>
+Date: Tue, 29 Mar 2022 10:12:52 -0700
+Subject: uapi/linux/stddef.h: Add include guards
+
+From: Tadeusz Struk <tadeusz.struk@linaro.org>
+
+commit 55037ed7bdc62151a726f5685f88afa6a82959b1 upstream.
+
+Add include guard wrapper define to uapi/linux/stddef.h to prevent macro
+redefinition errors when stddef.h is included more than once. This was not
+needed before since the only contents already used a redefinition test.
+
+Signed-off-by: Tadeusz Struk <tadeusz.struk@linaro.org>
+Link: https://lore.kernel.org/r/20220329171252.57279-1-tadeusz.struk@linaro.org
+Fixes: 50d7bd38c3aa ("stddef: Introduce struct_group() helper macro")
+Cc: stable@vger.kernel.org
+Signed-off-by: Kees Cook <keescook@chromium.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ include/uapi/linux/stddef.h | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/include/uapi/linux/stddef.h b/include/uapi/linux/stddef.h
+index 3021ea25a284..7837ba4fe728 100644
+--- a/include/uapi/linux/stddef.h
++++ b/include/uapi/linux/stddef.h
+@@ -1,4 +1,7 @@
+ /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
++#ifndef _UAPI_LINUX_STDDEF_H
++#define _UAPI_LINUX_STDDEF_H
++
+ #include <linux/compiler_types.h>
+ #ifndef __always_inline
+@@ -41,3 +44,4 @@
+               struct { } __empty_ ## NAME; \
+               TYPE NAME[]; \
+       }
++#endif
+-- 
+2.35.2
+