From 4924eaf3999969fe17df6044a2e607e4615371d3 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 27 Oct 2022 12:33:12 +0200 Subject: [PATCH] 4.19-stable patches added patches: acpi-video-force-backlight-native-for-more-tongfang-devices.patch makefile.debug-re-enable-debug-info-for-.s-files.patch media-v4l2-mem2mem-apply-dst_queue_off_base-on-mmap-buffers-across-ioctls.patch --- ...ght-native-for-more-tongfang-devices.patch | 118 +++++++++++++++ ...-up-si_domain-in-the-init_dmars-erro.patch | 9 +- ...ug-re-enable-debug-info-for-.s-files.patch | 41 +++++ ...f_base-on-mmap-buffers-across-ioctls.patch | 141 ++++++++++++++++++ queue-4.19/series | 3 + 5 files changed, 305 insertions(+), 7 deletions(-) create mode 100644 queue-4.19/acpi-video-force-backlight-native-for-more-tongfang-devices.patch create mode 100644 queue-4.19/makefile.debug-re-enable-debug-info-for-.s-files.patch create mode 100644 queue-4.19/media-v4l2-mem2mem-apply-dst_queue_off_base-on-mmap-buffers-across-ioctls.patch diff --git a/queue-4.19/acpi-video-force-backlight-native-for-more-tongfang-devices.patch b/queue-4.19/acpi-video-force-backlight-native-for-more-tongfang-devices.patch new file mode 100644 index 00000000000..96be72a361f --- /dev/null +++ b/queue-4.19/acpi-video-force-backlight-native-for-more-tongfang-devices.patch @@ -0,0 +1,118 @@ +From wse@tuxedocomputers.com Thu Oct 27 12:25:48 2022 +From: Werner Sembach +Date: Wed, 26 Oct 2022 17:22:46 +0200 +Subject: [PATCH v3] ACPI: video: Force backlight native for more TongFang devices +To: stable@vger.kernel.org +Cc: hdegoede@redhat.com, daniel@ffwll.ch, airlied@redhat.com, lenb@kernel.org, rafael.j.wysocki@intel.com +Message-ID: <20221026152246.24990-1-wse@tuxedocomputers.com> + +From: Werner Sembach + +commit 3dbc80a3e4c55c4a5b89ef207bed7b7de36157b4 upstream. + +This commit is very different from the upstream commit! It fixes the same +issue by adding more quirks, rather then the general fix from the 6.1 +kernel, because the general fix from the 6.1 kernel is part of a larger +refactoring of the backlight code which is not suitable for the stable +series. + +As described in "ACPI: video: Drop NL5x?U, PF4NU1F and PF5?U?? +acpi_backlight=native quirks" (10212754a0d2) the upstream commit "ACPI: +video: Make backlight class device registration a separate step (v2)" +(3dbc80a3e4c5) makes these quirks unnecessary. However as mentioned in this +bugtracker ticket https://bugzilla.kernel.org/show_bug.cgi?id=215683#c17 +the upstream fix is part of a larger patchset that is overall too complex +for stable. + +The TongFang GKxNRxx, GMxNGxx, GMxZGxx, and GMxRGxx / TUXEDO +Stellaris/Polaris Gen 1-4, have the same problem as the Clevo NL5xRU and +NL5xNU / TUXEDO Aura 15 Gen1 and Gen2: +They have a working native and video interface for screen backlight. +However the default detection mechanism first registers the video interface +before unregistering it again and switching to the native interface during +boot. This results in a dangling SBIOS request for backlight change for +some reason, causing the backlight to switch to ~2% once per boot on the +first power cord connect or disconnect event. Setting the native interface +explicitly circumvents this buggy behaviour by avoiding the unregistering +process. + +Reviewed-by: Hans de Goede +Signed-off-by: Werner Sembach +Signed-off-by: Greg Kroah-Hartman +--- + drivers/acpi/video_detect.c | 64 ++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 64 insertions(+) + +--- a/drivers/acpi/video_detect.c ++++ b/drivers/acpi/video_detect.c +@@ -448,6 +448,70 @@ static const struct dmi_system_id video_ + }, + }, + /* ++ * More Tongfang devices with the same issue as the Clevo NL5xRU and ++ * NL5xNU/TUXEDO Aura 15 Gen1 and Gen2. See the description above. ++ */ ++ { ++ .callback = video_detect_force_native, ++ .ident = "TongFang GKxNRxx", ++ .matches = { ++ DMI_MATCH(DMI_BOARD_NAME, "GKxNRxx"), ++ }, ++ }, ++ { ++ .callback = video_detect_force_native, ++ .ident = "TongFang GKxNRxx", ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "TUXEDO"), ++ DMI_MATCH(DMI_BOARD_NAME, "POLARIS1501A1650TI"), ++ }, ++ }, ++ { ++ .callback = video_detect_force_native, ++ .ident = "TongFang GKxNRxx", ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "TUXEDO"), ++ DMI_MATCH(DMI_BOARD_NAME, "POLARIS1501A2060"), ++ }, ++ }, ++ { ++ .callback = video_detect_force_native, ++ .ident = "TongFang GKxNRxx", ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "TUXEDO"), ++ DMI_MATCH(DMI_BOARD_NAME, "POLARIS1701A1650TI"), ++ }, ++ }, ++ { ++ .callback = video_detect_force_native, ++ .ident = "TongFang GKxNRxx", ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "TUXEDO"), ++ DMI_MATCH(DMI_BOARD_NAME, "POLARIS1701A2060"), ++ }, ++ }, ++ { ++ .callback = video_detect_force_native, ++ .ident = "TongFang GMxNGxx", ++ .matches = { ++ DMI_MATCH(DMI_BOARD_NAME, "GMxNGxx"), ++ }, ++ }, ++ { ++ .callback = video_detect_force_native, ++ .ident = "TongFang GMxZGxx", ++ .matches = { ++ DMI_MATCH(DMI_BOARD_NAME, "GMxZGxx"), ++ }, ++ }, ++ { ++ .callback = video_detect_force_native, ++ .ident = "TongFang GMxRGxx", ++ .matches = { ++ DMI_MATCH(DMI_BOARD_NAME, "GMxRGxx"), ++ }, ++ }, ++ /* + * Desktops which falsely report a backlight and which our heuristics + * for this do not catch. + */ diff --git a/queue-4.19/iommu-vt-d-clean-up-si_domain-in-the-init_dmars-erro.patch b/queue-4.19/iommu-vt-d-clean-up-si_domain-in-the-init_dmars-erro.patch index 87d8fb84cbe..2e81db48cc4 100644 --- a/queue-4.19/iommu-vt-d-clean-up-si_domain-in-the-init_dmars-erro.patch +++ b/queue-4.19/iommu-vt-d-clean-up-si_domain-in-the-init_dmars-erro.patch @@ -25,11 +25,9 @@ Signed-off-by: Lu Baolu Signed-off-by: Joerg Roedel Signed-off-by: Sasha Levin --- - drivers/iommu/intel-iommu.c | 5 +++++ + drivers/iommu/intel-iommu.c | 5 +++++ 1 file changed, 5 insertions(+) -diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c -index dcb865d19309..1b25f5c0dfad 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c @@ -2800,6 +2800,7 @@ static int __init si_domain_init(int hw) @@ -40,7 +38,7 @@ index dcb865d19309..1b25f5c0dfad 100644 return -EFAULT; } -@@ -3502,6 +3503,10 @@ static int __init init_dmars(void) +@@ -3502,6 +3503,10 @@ free_iommu: disable_dmar_iommu(iommu); free_dmar_iommu(iommu); } @@ -51,6 +49,3 @@ index dcb865d19309..1b25f5c0dfad 100644 kfree(g_iommus); --- -2.35.1 - diff --git a/queue-4.19/makefile.debug-re-enable-debug-info-for-.s-files.patch b/queue-4.19/makefile.debug-re-enable-debug-info-for-.s-files.patch new file mode 100644 index 00000000000..3e33d162242 --- /dev/null +++ b/queue-4.19/makefile.debug-re-enable-debug-info-for-.s-files.patch @@ -0,0 +1,41 @@ +From foo@baz Thu Oct 27 12:32:24 PM CEST 2022 +From: Nick Desaulniers +Date: Mon, 24 Oct 2022 13:34:14 -0700 +Subject: Makefile.debug: re-enable debug info for .S files + +From: Nick Desaulniers + +This is _not_ an upstream commit and just for 4.19.y only. It is based +on commit 32ef9e5054ec0321b9336058c58ec749e9c6b0fe upstream. + +Alexey reported that the fraction of unknown filename instances in +kallsyms grew from ~0.3% to ~10% recently; Bill and Greg tracked it down +to assembler defined symbols, which regressed as a result of: + +commit b8a9092330da ("Kbuild: do not emit debug info for assembly with LLVM_IAS=1") + +In that commit, I allude to restoring debug info for assembler defined +symbols in a follow up patch, but it seems I forgot to do so in + +commit a66049e2cf0e ("Kbuild: make DWARF version a choice") + +Fixes: b8a9092330da ("Kbuild: do not emit debug info for assembly with LLVM_IAS=1") +Signed-off-by: Nick Desaulniers +Signed-off-by: Greg Kroah-Hartman +--- + Makefile | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/Makefile ++++ b/Makefile +@@ -744,7 +744,9 @@ KBUILD_CFLAGS += $(call cc-option, -gs + else + KBUILD_CFLAGS += -g + endif +-ifneq ($(LLVM_IAS),1) ++ifeq ($(LLVM_IAS),1) ++KBUILD_AFLAGS += -g ++else + KBUILD_AFLAGS += -Wa,-gdwarf-2 + endif + endif diff --git a/queue-4.19/media-v4l2-mem2mem-apply-dst_queue_off_base-on-mmap-buffers-across-ioctls.patch b/queue-4.19/media-v4l2-mem2mem-apply-dst_queue_off_base-on-mmap-buffers-across-ioctls.patch new file mode 100644 index 00000000000..e01fbcbbbd3 --- /dev/null +++ b/queue-4.19/media-v4l2-mem2mem-apply-dst_queue_off_base-on-mmap-buffers-across-ioctls.patch @@ -0,0 +1,141 @@ +From 8310ca94075e784bbb06593cd6c068ee6b6e4ca6 Mon Sep 17 00:00:00 2001 +From: Chen-Yu Tsai +Date: Thu, 9 Dec 2021 17:38:03 +0100 +Subject: media: v4l2-mem2mem: Apply DST_QUEUE_OFF_BASE on MMAP buffers across ioctls + +From: Chen-Yu Tsai + +commit 8310ca94075e784bbb06593cd6c068ee6b6e4ca6 upstream. + +DST_QUEUE_OFF_BASE is applied to offset/mem_offset on MMAP capture buffers +only for the VIDIOC_QUERYBUF ioctl, while the userspace fields (including +offset/mem_offset) are filled in for VIDIOC_{QUERY,PREPARE,Q,DQ}BUF +ioctls. This leads to differences in the values presented to userspace. +If userspace attempts to mmap the capture buffer directly using values +from DQBUF, it will fail. + +Move the code that applies the magic offset into a helper, and call +that helper from all four ioctl entry points. + +[hverkuil: drop unnecessary '= 0' in v4l2_m2m_querybuf() for ret] + +Fixes: 7f98639def42 ("V4L/DVB: add memory-to-memory device helper framework for videobuf") +Fixes: 908a0d7c588e ("[media] v4l: mem2mem: port to videobuf2") +Signed-off-by: Chen-Yu Tsai +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab +[OP: adjusted return logic for 4.19] +Signed-off-by: Ovidiu Panait +Signed-off-by: Greg Kroah-Hartman +--- + drivers/media/v4l2-core/v4l2-mem2mem.c | 62 +++++++++++++++++++++++---------- + 1 file changed, 45 insertions(+), 17 deletions(-) + +--- a/drivers/media/v4l2-core/v4l2-mem2mem.c ++++ b/drivers/media/v4l2-core/v4l2-mem2mem.c +@@ -445,19 +445,14 @@ int v4l2_m2m_reqbufs(struct file *file, + } + EXPORT_SYMBOL_GPL(v4l2_m2m_reqbufs); + +-int v4l2_m2m_querybuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, +- struct v4l2_buffer *buf) ++static void v4l2_m2m_adjust_mem_offset(struct vb2_queue *vq, ++ struct v4l2_buffer *buf) + { +- struct vb2_queue *vq; +- int ret = 0; +- unsigned int i; +- +- vq = v4l2_m2m_get_vq(m2m_ctx, buf->type); +- ret = vb2_querybuf(vq, buf); +- + /* Adjust MMAP memory offsets for the CAPTURE queue */ + if (buf->memory == V4L2_MEMORY_MMAP && !V4L2_TYPE_IS_OUTPUT(vq->type)) { + if (V4L2_TYPE_IS_MULTIPLANAR(vq->type)) { ++ unsigned int i; ++ + for (i = 0; i < buf->length; ++i) + buf->m.planes[i].m.mem_offset + += DST_QUEUE_OFF_BASE; +@@ -465,8 +460,23 @@ int v4l2_m2m_querybuf(struct file *file, + buf->m.offset += DST_QUEUE_OFF_BASE; + } + } ++} ++ ++int v4l2_m2m_querybuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, ++ struct v4l2_buffer *buf) ++{ ++ struct vb2_queue *vq; ++ int ret; + +- return ret; ++ vq = v4l2_m2m_get_vq(m2m_ctx, buf->type); ++ ret = vb2_querybuf(vq, buf); ++ if (ret) ++ return ret; ++ ++ /* Adjust MMAP memory offsets for the CAPTURE queue */ ++ v4l2_m2m_adjust_mem_offset(vq, buf); ++ ++ return 0; + } + EXPORT_SYMBOL_GPL(v4l2_m2m_querybuf); + +@@ -478,10 +488,15 @@ int v4l2_m2m_qbuf(struct file *file, str + + vq = v4l2_m2m_get_vq(m2m_ctx, buf->type); + ret = vb2_qbuf(vq, buf); +- if (!ret) +- v4l2_m2m_try_schedule(m2m_ctx); ++ if (ret) ++ return ret; ++ ++ /* Adjust MMAP memory offsets for the CAPTURE queue */ ++ v4l2_m2m_adjust_mem_offset(vq, buf); ++ ++ v4l2_m2m_try_schedule(m2m_ctx); + +- return ret; ++ return 0; + } + EXPORT_SYMBOL_GPL(v4l2_m2m_qbuf); + +@@ -489,9 +504,17 @@ int v4l2_m2m_dqbuf(struct file *file, st + struct v4l2_buffer *buf) + { + struct vb2_queue *vq; ++ int ret; + + vq = v4l2_m2m_get_vq(m2m_ctx, buf->type); +- return vb2_dqbuf(vq, buf, file->f_flags & O_NONBLOCK); ++ ret = vb2_dqbuf(vq, buf, file->f_flags & O_NONBLOCK); ++ if (ret) ++ return ret; ++ ++ /* Adjust MMAP memory offsets for the CAPTURE queue */ ++ v4l2_m2m_adjust_mem_offset(vq, buf); ++ ++ return 0; + } + EXPORT_SYMBOL_GPL(v4l2_m2m_dqbuf); + +@@ -503,10 +526,15 @@ int v4l2_m2m_prepare_buf(struct file *fi + + vq = v4l2_m2m_get_vq(m2m_ctx, buf->type); + ret = vb2_prepare_buf(vq, buf); +- if (!ret) +- v4l2_m2m_try_schedule(m2m_ctx); ++ if (ret) ++ return ret; ++ ++ /* Adjust MMAP memory offsets for the CAPTURE queue */ ++ v4l2_m2m_adjust_mem_offset(vq, buf); ++ ++ v4l2_m2m_try_schedule(m2m_ctx); + +- return ret; ++ return 0; + } + EXPORT_SYMBOL_GPL(v4l2_m2m_prepare_buf); + diff --git a/queue-4.19/series b/queue-4.19/series index ec62266a5c9..4f2ac3c80ed 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -18,3 +18,6 @@ net-atm-fix-proc_mpc_write-incorrect-return-value.patch net-sched-cake-fix-null-pointer-access-issue-when-ca.patch net-hns-fix-possible-memory-leak-in-hnae_ae_register.patch iommu-vt-d-clean-up-si_domain-in-the-init_dmars-erro.patch +media-v4l2-mem2mem-apply-dst_queue_off_base-on-mmap-buffers-across-ioctls.patch +acpi-video-force-backlight-native-for-more-tongfang-devices.patch +makefile.debug-re-enable-debug-info-for-.s-files.patch -- 2.47.3