From: Greg Kroah-Hartman Date: Sat, 22 Apr 2023 15:36:20 +0000 (+0200) Subject: 6.1-stable patches X-Git-Tag: v4.14.314~74 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e1aba391ab29c9ee2418218cf08e46c229f079e5;p=thirdparty%2Fkernel%2Fstable-queue.git 6.1-stable patches added patches: drm-amdgpu-vcn-disable-indirect-sram-on-vangogh-broken-bioses.patch revert-userfaultfd-don-t-fail-on-unrecognized-features.patch --- diff --git a/queue-6.1/drm-amdgpu-vcn-disable-indirect-sram-on-vangogh-broken-bioses.patch b/queue-6.1/drm-amdgpu-vcn-disable-indirect-sram-on-vangogh-broken-bioses.patch new file mode 100644 index 00000000000..4afc72cfece --- /dev/null +++ b/queue-6.1/drm-amdgpu-vcn-disable-indirect-sram-on-vangogh-broken-bioses.patch @@ -0,0 +1,81 @@ +From 542a56e8eb4467ae654eefab31ff194569db39cd Mon Sep 17 00:00:00 2001 +From: "Guilherme G. Piccoli" +Date: Sun, 12 Mar 2023 13:51:00 -0300 +Subject: drm/amdgpu/vcn: Disable indirect SRAM on Vangogh broken BIOSes + +From: Guilherme G. Piccoli + +commit 542a56e8eb4467ae654eefab31ff194569db39cd upstream. + +The VCN firmware loading path enables the indirect SRAM mode if it's +advertised as supported. We might have some cases of FW issues that +prevents this mode to working properly though, ending-up in a failed +probe. An example below, observed in the Steam Deck: + +[...] +[drm] failed to load ucode VCN0_RAM(0x3A) +[drm] psp gfx command LOAD_IP_FW(0x6) failed and response status is (0xFFFF0000) +amdgpu 0000:04:00.0: [drm:amdgpu_ring_test_helper [amdgpu]] *ERROR* ring vcn_dec_0 test failed (-110) +[drm:amdgpu_device_init.cold [amdgpu]] *ERROR* hw_init of IP block failed -110 +amdgpu 0000:04:00.0: amdgpu: amdgpu_device_ip_init failed +amdgpu 0000:04:00.0: amdgpu: Fatal error during GPU init +[...] + +Disabling the VCN block circumvents this, but it's a very invasive +workaround that turns off the entire feature. So, let's add a quirk +on VCN loading that checks for known problematic BIOSes on Vangogh, +so we can proactively disable the indirect SRAM mode and allow the +HW proper probe and VCN IP block to work fine. + +Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/2385 +Fixes: 82132ecc5432 ("drm/amdgpu: enable Vangogh VCN indirect sram mode") +Cc: stable@vger.kernel.org +Cc: James Zhu +Cc: Leo Liu +Signed-off-by: Guilherme G. Piccoli +Signed-off-by: Alex Deucher +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +@@ -26,6 +26,7 @@ + + #include + #include ++#include + #include + #include + #include +@@ -84,6 +85,7 @@ int amdgpu_vcn_sw_init(struct amdgpu_dev + { + unsigned long bo_size; + const char *fw_name; ++ const char *bios_ver; + const struct common_firmware_header *hdr; + unsigned char fw_check; + unsigned int fw_shared_size, log_offset; +@@ -159,6 +161,21 @@ int amdgpu_vcn_sw_init(struct amdgpu_dev + if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) && + (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)) + adev->vcn.indirect_sram = true; ++ /* ++ * Some Steam Deck's BIOS versions are incompatible with the ++ * indirect SRAM mode, leading to amdgpu being unable to get ++ * properly probed (and even potentially crashing the kernel). ++ * Hence, check for these versions here - notice this is ++ * restricted to Vangogh (Deck's APU). ++ */ ++ bios_ver = dmi_get_system_info(DMI_BIOS_VERSION); ++ ++ if (bios_ver && (!strncmp("F7A0113", bios_ver, 7) || ++ !strncmp("F7A0114", bios_ver, 7))) { ++ adev->vcn.indirect_sram = false; ++ dev_info(adev->dev, ++ "Steam Deck quirk: indirect SRAM disabled on BIOS %s\n", bios_ver); ++ } + break; + case IP_VERSION(3, 0, 16): + fw_name = FIRMWARE_DIMGREY_CAVEFISH; diff --git a/queue-6.1/revert-userfaultfd-don-t-fail-on-unrecognized-features.patch b/queue-6.1/revert-userfaultfd-don-t-fail-on-unrecognized-features.patch new file mode 100644 index 00000000000..e074ff987bb --- /dev/null +++ b/queue-6.1/revert-userfaultfd-don-t-fail-on-unrecognized-features.patch @@ -0,0 +1,56 @@ +From 2ff559f31a5d50c31a3f9d849f8af90dc36c7105 Mon Sep 17 00:00:00 2001 +From: Peter Xu +Date: Wed, 12 Apr 2023 12:38:52 -0400 +Subject: Revert "userfaultfd: don't fail on unrecognized features" + +From: Peter Xu + +commit 2ff559f31a5d50c31a3f9d849f8af90dc36c7105 upstream. + +This is a proposal to revert commit 914eedcb9ba0ff53c33808. + +I found this when writing a simple UFFDIO_API test to be the first unit +test in this set. Two things breaks with the commit: + + - UFFDIO_API check was lost and missing. According to man page, the + kernel should reject ioctl(UFFDIO_API) if uffdio_api.api != 0xaa. This + check is needed if the api version will be extended in the future, or + user app won't be able to identify which is a new kernel. + + - Feature flags checks were removed, which means UFFDIO_API with a + feature that does not exist will also succeed. According to the man + page, we should (and it makes sense) to reject ioctl(UFFDIO_API) if + unknown features passed in. + +Link: https://lore.kernel.org/r/20220722201513.1624158-1-axelrasmussen@google.com +Link: https://lkml.kernel.org/r/20230412163922.327282-2-peterx@redhat.com +Fixes: 914eedcb9ba0 ("userfaultfd: don't fail on unrecognized features") +Signed-off-by: Peter Xu +Acked-by: David Hildenbrand +Cc: Axel Rasmussen +Cc: Dmitry Safonov <0x7f454c46@gmail.com> +Cc: Mike Kravetz +Cc: Mike Rapoport (IBM) +Cc: Zach O'Keefe +Cc: +Signed-off-by: Andrew Morton +Signed-off-by: Greg Kroah-Hartman +--- + fs/userfaultfd.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/fs/userfaultfd.c ++++ b/fs/userfaultfd.c +@@ -1966,8 +1966,10 @@ static int userfaultfd_api(struct userfa + ret = -EFAULT; + if (copy_from_user(&uffdio_api, buf, sizeof(uffdio_api))) + goto out; +- /* Ignore unsupported features (userspace built against newer kernel) */ +- features = uffdio_api.features & UFFD_API_FEATURES; ++ features = uffdio_api.features; ++ ret = -EINVAL; ++ if (uffdio_api.api != UFFD_API || (features & ~UFFD_API_FEATURES)) ++ goto err_out; + ret = -EPERM; + if ((features & UFFD_FEATURE_EVENT_FORK) && !capable(CAP_SYS_PTRACE)) + goto err_out; diff --git a/queue-6.1/series b/queue-6.1/series index 9f0a4e1afd2..7ae3fec7b4f 100644 --- a/queue-6.1/series +++ b/queue-6.1/series @@ -46,3 +46,5 @@ xen-netback-use-same-error-messages-for-same-errors.patch platform-x86-gigabyte-wmi-add-support-for-x570s-aoru.patch platform-x86-asus-nb-wmi-add-quirk_asus_tablet_mode-.patch mtd-spi-nor-fix-memory-leak-when-using-debugfs_looku.patch +revert-userfaultfd-don-t-fail-on-unrecognized-features.patch +drm-amdgpu-vcn-disable-indirect-sram-on-vangogh-broken-bioses.patch