From: Greg Kroah-Hartman Date: Sat, 13 Aug 2022 12:56:56 +0000 (+0200) Subject: 5.4-stable patches X-Git-Tag: v5.15.61~183 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=306599a1f016b7b2d5a2a970d2c038f24c5d8cbc;p=thirdparty%2Fkernel%2Fstable-queue.git 5.4-stable patches added patches: drm-amdgpu-check-bo-s-requested-pinning-domains-against-its-preferred_domains.patch drm-gem-properly-annotate-ww-context-on-drm_gem_lock_reservations-error.patch drm-nouveau-fix-another-off-by-one-in-nvbios_addr.patch parisc-fix-device-names-in-proc-iomem.patch parisc-io_pgetevents_time64-needs-compat-syscall-in-32-bit-compat-mode.patch --- diff --git a/queue-5.4/drm-amdgpu-check-bo-s-requested-pinning-domains-against-its-preferred_domains.patch b/queue-5.4/drm-amdgpu-check-bo-s-requested-pinning-domains-against-its-preferred_domains.patch new file mode 100644 index 00000000000..8dcb6fba4a4 --- /dev/null +++ b/queue-5.4/drm-amdgpu-check-bo-s-requested-pinning-domains-against-its-preferred_domains.patch @@ -0,0 +1,49 @@ +From f5ba14043621f4afdf3ad5f92ee2d8dbebbe4340 Mon Sep 17 00:00:00 2001 +From: Leo Li +Date: Tue, 12 Jul 2022 12:30:29 -0400 +Subject: drm/amdgpu: Check BO's requested pinning domains against its preferred_domains +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Leo Li + +commit f5ba14043621f4afdf3ad5f92ee2d8dbebbe4340 upstream. + +When pinning a buffer, we should check to see if there are any +additional restrictions imposed by bo->preferred_domains. This will +prevent the BO from being moved to an invalid domain when pinning. + +For example, this can happen if the user requests to create a BO in GTT +domain for display scanout. amdgpu_dm will allow pinning to either VRAM +or GTT domains, since DCN can scanout from either or. However, in +amdgpu_bo_pin_restricted(), pinning to VRAM is preferred if there is +adequate carveout. This can lead to pinning to VRAM despite the user +requesting GTT placement for the BO. + +v2: Allow the kernel to override the domain, which can happen when + exporting a BO to a V4L camera (for example). + +Signed-off-by: Leo Li +Reviewed-by: Alex Deucher +Reviewed-by: Christian König +Signed-off-by: Alex Deucher +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +@@ -892,6 +892,10 @@ int amdgpu_bo_pin_restricted(struct amdg + if (WARN_ON_ONCE(min_offset > max_offset)) + return -EINVAL; + ++ /* Check domain to be pinned to against preferred domains */ ++ if (bo->preferred_domains & domain) ++ domain = bo->preferred_domains & domain; ++ + /* A shared bo cannot be migrated to VRAM */ + if (bo->prime_shared_count) { + if (domain & AMDGPU_GEM_DOMAIN_GTT) diff --git a/queue-5.4/drm-gem-properly-annotate-ww-context-on-drm_gem_lock_reservations-error.patch b/queue-5.4/drm-gem-properly-annotate-ww-context-on-drm_gem_lock_reservations-error.patch new file mode 100644 index 00000000000..ea717a035fb --- /dev/null +++ b/queue-5.4/drm-gem-properly-annotate-ww-context-on-drm_gem_lock_reservations-error.patch @@ -0,0 +1,50 @@ +From 2939deac1fa220bc82b89235f146df1d9b52e876 Mon Sep 17 00:00:00 2001 +From: Dmitry Osipenko +Date: Thu, 30 Jun 2022 23:04:04 +0300 +Subject: drm/gem: Properly annotate WW context on drm_gem_lock_reservations() error +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Dmitry Osipenko + +commit 2939deac1fa220bc82b89235f146df1d9b52e876 upstream. + +Use ww_acquire_fini() in the error code paths. Otherwise lockdep +thinks that lock is held when lock's memory is freed after the +drm_gem_lock_reservations() error. The ww_acquire_context needs to be +annotated as "released", which fixes the noisy "WARNING: held lock freed!" +splat of VirtIO-GPU driver with CONFIG_DEBUG_MUTEXES=y and enabled lockdep. + +Cc: stable@vger.kernel.org +Fixes: 7edc3e3b975b5 ("drm: Add helpers for locking an array of BO reservations.") +Reviewed-by: Thomas Hellström +Reviewed-by: Christian König +Signed-off-by: Dmitry Osipenko +Signed-off-by: Daniel Vetter +Link: https://patchwork.freedesktop.org/patch/msgid/20220630200405.1883897-2-dmitry.osipenko@collabora.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/drm_gem.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/gpu/drm/drm_gem.c ++++ b/drivers/gpu/drm/drm_gem.c +@@ -1292,7 +1292,7 @@ retry: + ret = dma_resv_lock_slow_interruptible(obj->resv, + acquire_ctx); + if (ret) { +- ww_acquire_done(acquire_ctx); ++ ww_acquire_fini(acquire_ctx); + return ret; + } + } +@@ -1317,7 +1317,7 @@ retry: + goto retry; + } + +- ww_acquire_done(acquire_ctx); ++ ww_acquire_fini(acquire_ctx); + return ret; + } + } diff --git a/queue-5.4/drm-nouveau-fix-another-off-by-one-in-nvbios_addr.patch b/queue-5.4/drm-nouveau-fix-another-off-by-one-in-nvbios_addr.patch new file mode 100644 index 00000000000..a3edec84b86 --- /dev/null +++ b/queue-5.4/drm-nouveau-fix-another-off-by-one-in-nvbios_addr.patch @@ -0,0 +1,35 @@ +From c441d28945fb113220d48d6c86ebc0b090a2b677 Mon Sep 17 00:00:00 2001 +From: Timur Tabi +Date: Wed, 11 May 2022 11:37:16 -0500 +Subject: drm/nouveau: fix another off-by-one in nvbios_addr + +From: Timur Tabi + +commit c441d28945fb113220d48d6c86ebc0b090a2b677 upstream. + +This check determines whether a given address is part of +image 0 or image 1. Image 1 starts at offset image0_size, +so that address should be included. + +Fixes: 4d4e9907ff572 ("drm/nouveau/bios: guard against out-of-bounds accesses to image") +Cc: # v4.8+ +Signed-off-by: Timur Tabi +Reviewed-by: Karol Herbst +Signed-off-by: Lyude Paul +Link: https://patchwork.freedesktop.org/patch/msgid/20220511163716.3520591-1-ttabi@nvidia.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c ++++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c +@@ -33,7 +33,7 @@ nvbios_addr(struct nvkm_bios *bios, u32 + { + u32 p = *addr; + +- if (*addr > bios->image0_size && bios->imaged_addr) { ++ if (*addr >= bios->image0_size && bios->imaged_addr) { + *addr -= bios->image0_size; + *addr += bios->imaged_addr; + } diff --git a/queue-5.4/parisc-fix-device-names-in-proc-iomem.patch b/queue-5.4/parisc-fix-device-names-in-proc-iomem.patch new file mode 100644 index 00000000000..66197efc351 --- /dev/null +++ b/queue-5.4/parisc-fix-device-names-in-proc-iomem.patch @@ -0,0 +1,45 @@ +From cab56b51ec0e69128909cef4650e1907248d821b Mon Sep 17 00:00:00 2001 +From: Helge Deller +Date: Mon, 18 Jul 2022 17:06:47 +0200 +Subject: parisc: Fix device names in /proc/iomem + +From: Helge Deller + +commit cab56b51ec0e69128909cef4650e1907248d821b upstream. + +Fix the output of /proc/iomem to show the real hardware device name +including the pa_pathname, e.g. "Merlin 160 Core Centronics [8:16:0]". +Up to now only the pa_pathname ("[8:16.0]") was shown. + +Signed-off-by: Helge Deller +Cc: # v4.9+ +Signed-off-by: Greg Kroah-Hartman +--- + arch/parisc/kernel/drivers.c | 9 ++++----- + 1 file changed, 4 insertions(+), 5 deletions(-) + +--- a/arch/parisc/kernel/drivers.c ++++ b/arch/parisc/kernel/drivers.c +@@ -520,7 +520,6 @@ alloc_pa_dev(unsigned long hpa, struct h + dev->id.hversion_rev = iodc_data[1] & 0x0f; + dev->id.sversion = ((iodc_data[4] & 0x0f) << 16) | + (iodc_data[5] << 8) | iodc_data[6]; +- dev->hpa.name = parisc_pathname(dev); + dev->hpa.start = hpa; + /* This is awkward. The STI spec says that gfx devices may occupy + * 32MB or 64MB. Unfortunately, we don't know how to tell whether +@@ -534,10 +533,10 @@ alloc_pa_dev(unsigned long hpa, struct h + dev->hpa.end = hpa + 0xfff; + } + dev->hpa.flags = IORESOURCE_MEM; +- name = parisc_hardware_description(&dev->id); +- if (name) { +- strlcpy(dev->name, name, sizeof(dev->name)); +- } ++ dev->hpa.name = dev->name; ++ name = parisc_hardware_description(&dev->id) ? : "unknown"; ++ snprintf(dev->name, sizeof(dev->name), "%s [%s]", ++ name, parisc_pathname(dev)); + + /* Silently fail things like mouse ports which are subsumed within + * the keyboard controller diff --git a/queue-5.4/parisc-io_pgetevents_time64-needs-compat-syscall-in-32-bit-compat-mode.patch b/queue-5.4/parisc-io_pgetevents_time64-needs-compat-syscall-in-32-bit-compat-mode.patch new file mode 100644 index 00000000000..81785bec4cd --- /dev/null +++ b/queue-5.4/parisc-io_pgetevents_time64-needs-compat-syscall-in-32-bit-compat-mode.patch @@ -0,0 +1,36 @@ +From 6431e92fc827bdd2d28f79150d90415ba9ce0d21 Mon Sep 17 00:00:00 2001 +From: Helge Deller +Date: Mon, 1 Aug 2022 17:36:15 +0200 +Subject: parisc: io_pgetevents_time64() needs compat syscall in 32-bit compat mode + +From: Helge Deller + +commit 6431e92fc827bdd2d28f79150d90415ba9ce0d21 upstream. + +For all syscalls in 32-bit compat mode on 64-bit kernels the upper +32-bits of the 64-bit registers are zeroed out, so a negative 32-bit +signed value will show up as positive 64-bit signed value. + +This behaviour breaks the io_pgetevents_time64() syscall which expects +signed 64-bit values for the "min_nr" and "nr" parameters. +Fix this by switching to the compat_sys_io_pgetevents_time64() syscall, +which uses "compat_long_t" types for those parameters. + +Cc: # v5.1+ +Signed-off-by: Helge Deller +Signed-off-by: Greg Kroah-Hartman +--- + arch/parisc/kernel/syscalls/syscall.tbl | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/parisc/kernel/syscalls/syscall.tbl ++++ b/arch/parisc/kernel/syscalls/syscall.tbl +@@ -413,7 +413,7 @@ + 412 32 utimensat_time64 sys_utimensat sys_utimensat + 413 32 pselect6_time64 sys_pselect6 compat_sys_pselect6_time64 + 414 32 ppoll_time64 sys_ppoll compat_sys_ppoll_time64 +-416 32 io_pgetevents_time64 sys_io_pgetevents sys_io_pgetevents ++416 32 io_pgetevents_time64 sys_io_pgetevents compat_sys_io_pgetevents_time64 + 417 32 recvmmsg_time64 sys_recvmmsg compat_sys_recvmmsg_time64 + 418 32 mq_timedsend_time64 sys_mq_timedsend sys_mq_timedsend + 419 32 mq_timedreceive_time64 sys_mq_timedreceive sys_mq_timedreceive diff --git a/queue-5.4/series b/queue-5.4/series index 25655045e20..ae2608ac922 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -26,3 +26,8 @@ thermal-sysfs-fix-cooling_device_stats_setup-error-code-path.patch fbcon-fix-boundary-checks-for-fbcon-vc-n1-n2-parameters.patch usbnet-fix-linkwatch-use-after-free-on-disconnect.patch ovl-drop-warn_on-dentry-is-null-in-ovl_encode_fh.patch +parisc-fix-device-names-in-proc-iomem.patch +parisc-io_pgetevents_time64-needs-compat-syscall-in-32-bit-compat-mode.patch +drm-gem-properly-annotate-ww-context-on-drm_gem_lock_reservations-error.patch +drm-nouveau-fix-another-off-by-one-in-nvbios_addr.patch +drm-amdgpu-check-bo-s-requested-pinning-domains-against-its-preferred_domains.patch