From e423352ec0c5194452e39cc5e02dbb9157c15c18 Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Sun, 17 Jul 2022 21:29:44 -0400 Subject: [PATCH] Fixes for 5.18 Signed-off-by: Sasha Levin --- ...-add-quirk-for-fiero-sc-01-fw-v1.0.0.patch | 187 +++++++++++ ...-usb-audio-add-quirk-for-fiero-sc-01.patch | 142 ++++++++ ...dd-quirks-for-macrosilicon-ms2100-ms.patch | 105 ++++++ ...arm-9211-1-domain-drop-modify_domain.patch | 49 +++ ...12-1-domain-modify-kconfig-help-text.patch | 41 +++ ...e-the-correct-clock-source-for-cec-o.patch | 34 ++ ...0-rt711-rt711-sdca-initialize-workqu.patch | 121 +++++++ ...d-asp-tx3-4-source-to-register-patch.patch | 69 ++++ ...c-cs35l41-correct-some-control-names.patch | 57 ++++ ...-event-generation-for-low-power-mux-.patch | 48 +++ ...lise-kcontrol-data-for-mux-demux-con.patch | 59 ++++ ...bindings-fix-description-for-msm8916.patch | 59 ++++ ..._wm5102-fix-gpio-related-probe-order.patch | 55 ++++ ...dw-handle-errors-on-card-registratio.patch | 107 ++++++ ...-fix-event-generation-for-out1-demux.patch | 46 +++ ...x-event-generation-for-rate-controls.patch | 51 +++ ...f-by-one-in-range-control-validation.patch | 45 +++ ...im-soundwire-codecs-disable-pm_runti.patch | 304 ++++++++++++++++++ ...soc-rockchip-i2s-switch-bclk-to-gpio.patch | 303 +++++++++++++++++ ...c-rt7-sdw-harden-jack_detect_handler.patch | 70 ++++ ...1-fix-calibrate-mutex-initialization.patch | 60 ++++ ...fix-kernel-null-pointer-dereference-.patch | 47 +++ ...sdw-fix-calibrate-mutex-initializati.patch | 70 ++++ ...hda-dsp-expose-hda_dsp_core_power_up.patch | 70 ++++ ...da-loader-clarify-the-cl_dsp_init-fl.patch | 54 ++++ ...da-loader-make-sure-that-the-fw-load.patch | 44 +++ ...cd9335-fix-spurious-event-generation.patch | 38 +++ ...ove-rx-channel-from-old-list-before-.patch | 47 +++ ...x-event-generation-for-some-controls.patch | 70 ++++ queue-5.18/asoc-wm5110-fix-dre-control.patch | 56 ++++ ...asoc-wm_adsp-fix-event-for-preloader.patch | 36 +++ ...pmac32-cpufreq-fix-refcount-leak-bug.patch | 38 +++ ...sfb-device-registration-when-removin.patch | 67 ++++ ...fb-add-sysfb_disable-helper-function.patch | 159 +++++++++ ...ake-sysfb_create_simplefb-return-a-p.patch | 130 ++++++++ ...-undefine-mask_ack-for-level-trigger.patch | 41 +++ ...sock_nonblock-type-for-kernel_accept.patch | 47 +++ ...net-sfp-fix-memory-leak-in-sfp_probe.patch | 39 +++ ...sible-refcount-leak-in-tipc_sk_creat.patch | 34 ++ ...filter-do-not-skip-all-hooks-with-0-.patch | 104 ++++++ ...tables-avoid-skb-access-on-nf_stolen.patch | 250 ++++++++++++++ ...t-print-header-length-mismatch-on-i2.patch | 50 +++ ...me-fix-block-device-naming-collision.patch | 64 ++++ ...ion-when-disconnect-a-recovering-ctr.patch | 143 ++++++++ ...i-phison-e16-has-bogus-namespace-ids.patch | 38 +++ ...fail-a-request-when-sending-it-faile.patch | 45 +++ ...uct-group-for-generic-command-dwords.patch | 57 ++++ ...ix-potential-null-dereference-in-asp.patch | 42 +++ ...imx-add-the-zero-base-flag-for-imx93.patch | 36 +++ ...p-wmi-ignore-sanitization-mode-event.patch | 49 +++ ...el-pmc-add-alder-lake-n-support-to-p.patch | 40 +++ ...nkpad-acpi-profile-capabilities-as-i.patch | 171 ++++++++++ ...nkpad_acpi-do-not-use-psc-mode-on-in.patch | 45 +++ ...spapr-correct-bitmap-allocation-size.patch | 112 +++++++ ...-can-xilinx_can-limit-canfd-brp-to-2.patch | 48 +++ ...d-expoline.o-for-modules_prepare-tar.patch | 93 ++++++ ...i_sas-limit-max-hw-sectors-for-v3-hw.patch | 53 +++ ...aid-clear-read-queue-map-s-nr_queues.patch | 48 +++ ...-drop-loglevel-of-writeboost-message.patch | 43 +++ queue-5.18/series | 72 +++++ ...dling-don-t-use-bug_on-for-debugging.patch | 54 ++++ ...-ixp4xx-npe-fix-unused-match-warning.patch | 45 +++ ...data-fix-description-of-return-value.patch | 38 +++ ...flip_buffer_commit-from-tty_flip_buf.patch | 61 ++++ ...insert_flip_string_and_push_buffer-i.patch | 128 ++++++++ ...mlx5-initialize-cvq-vringh-only-once.patch | 96 ++++++ ...use-tie-vduse-mgmtdev-and-its-device.patch | 134 ++++++++ ...d-missing-pm-calls-to-freeze-restore.patch | 81 +++++ ...io-restore-guest-page-size-on-resume.patch | 44 +++ ...elftests-always-call-kernel-makefile.patch | 47 +++ ...selftests-set-fake-real-time-in-init.patch | 154 +++++++++ ...d-selftests-use-virt-machine-on-m68k.patch | 58 ++++ .../x86-clear-.brk-area-at-early-boot.patch | 43 +++ 73 files changed, 5685 insertions(+) create mode 100644 queue-5.18/alsa-usb-audio-add-quirk-for-fiero-sc-01-fw-v1.0.0.patch create mode 100644 queue-5.18/alsa-usb-audio-add-quirk-for-fiero-sc-01.patch create mode 100644 queue-5.18/alsa-usb-audio-add-quirks-for-macrosilicon-ms2100-ms.patch create mode 100644 queue-5.18/arm-9211-1-domain-drop-modify_domain.patch create mode 100644 queue-5.18/arm-9212-1-domain-modify-kconfig-help-text.patch create mode 100644 queue-5.18/arm-dts-stm32-use-the-correct-clock-source-for-cec-o.patch create mode 100644 queue-5.18/asoc-codecs-rt700-rt711-rt711-sdca-initialize-workqu.patch create mode 100644 queue-5.18/asoc-cs35l41-add-asp-tx3-4-source-to-register-patch.patch create mode 100644 queue-5.18/asoc-cs35l41-correct-some-control-names.patch create mode 100644 queue-5.18/asoc-cs47l15-fix-event-generation-for-low-power-mux-.patch create mode 100644 queue-5.18/asoc-dapm-initialise-kcontrol-data-for-mux-demux-con.patch create mode 100644 queue-5.18/asoc-dt-bindings-fix-description-for-msm8916.patch create mode 100644 queue-5.18/asoc-intel-bytcr_wm5102-fix-gpio-related-probe-order.patch create mode 100644 queue-5.18/asoc-intel-sof_sdw-handle-errors-on-card-registratio.patch create mode 100644 queue-5.18/asoc-madera-fix-event-generation-for-out1-demux.patch create mode 100644 queue-5.18/asoc-madera-fix-event-generation-for-rate-controls.patch create mode 100644 queue-5.18/asoc-ops-fix-off-by-one-in-range-control-validation.patch create mode 100644 queue-5.18/asoc-realtek-maxim-soundwire-codecs-disable-pm_runti.patch create mode 100644 queue-5.18/asoc-rockchip-i2s-switch-bclk-to-gpio.patch create mode 100644 queue-5.18/asoc-rt7-sdw-harden-jack_detect_handler.patch create mode 100644 queue-5.18/asoc-rt711-fix-calibrate-mutex-initialization.patch create mode 100644 queue-5.18/asoc-rt711-sdca-fix-kernel-null-pointer-dereference-.patch create mode 100644 queue-5.18/asoc-rt711-sdca-sdw-fix-calibrate-mutex-initializati.patch create mode 100644 queue-5.18/asoc-sof-intel-hda-dsp-expose-hda_dsp_core_power_up.patch create mode 100644 queue-5.18/asoc-sof-intel-hda-loader-clarify-the-cl_dsp_init-fl.patch create mode 100644 queue-5.18/asoc-sof-intel-hda-loader-make-sure-that-the-fw-load.patch create mode 100644 queue-5.18/asoc-wcd9335-fix-spurious-event-generation.patch create mode 100644 queue-5.18/asoc-wcd9335-remove-rx-channel-from-old-list-before-.patch create mode 100644 queue-5.18/asoc-wcd938x-fix-event-generation-for-some-controls.patch create mode 100644 queue-5.18/asoc-wm5110-fix-dre-control.patch create mode 100644 queue-5.18/asoc-wm_adsp-fix-event-for-preloader.patch create mode 100644 queue-5.18/cpufreq-pmac32-cpufreq-fix-refcount-leak-bug.patch create mode 100644 queue-5.18/fbdev-disable-sysfb-device-registration-when-removin.patch create mode 100644 queue-5.18/firmware-sysfb-add-sysfb_disable-helper-function.patch create mode 100644 queue-5.18/firmware-sysfb-make-sysfb_create_simplefb-return-a-p.patch create mode 100644 queue-5.18/irqchip-or1k-pic-undefine-mask_ack-for-level-trigger.patch create mode 100644 queue-5.18/ksmbd-use-sock_nonblock-type-for-kernel_accept.patch create mode 100644 queue-5.18/net-sfp-fix-memory-leak-in-sfp_probe.patch create mode 100644 queue-5.18/net-tipc-fix-possible-refcount-leak-in-tipc_sk_creat.patch create mode 100644 queue-5.18/netfilter-br_netfilter-do-not-skip-all-hooks-with-0-.patch create mode 100644 queue-5.18/netfilter-nf_tables-avoid-skb-access-on-nf_stolen.patch create mode 100644 queue-5.18/nfc-nxp-nci-don-t-print-header-length-mismatch-on-i2.patch create mode 100644 queue-5.18/nvme-fix-block-device-naming-collision.patch create mode 100644 queue-5.18/nvme-fix-regression-when-disconnect-a-recovering-ctr.patch create mode 100644 queue-5.18/nvme-pci-phison-e16-has-bogus-namespace-ids.patch create mode 100644 queue-5.18/nvme-tcp-always-fail-a-request-when-sending-it-faile.patch create mode 100644 queue-5.18/nvme-use-struct-group-for-generic-command-dwords.patch create mode 100644 queue-5.18/pinctrl-aspeed-fix-potential-null-dereference-in-asp.patch create mode 100644 queue-5.18/pinctrl-imx-add-the-zero-base-flag-for-imx93.patch create mode 100644 queue-5.18/platform-x86-hp-wmi-ignore-sanitization-mode-event.patch create mode 100644 queue-5.18/platform-x86-intel-pmc-add-alder-lake-n-support-to-p.patch create mode 100644 queue-5.18/platform-x86-thinkpad-acpi-profile-capabilities-as-i.patch create mode 100644 queue-5.18/platform-x86-thinkpad_acpi-do-not-use-psc-mode-on-in.patch create mode 100644 queue-5.18/powerpc-xive-spapr-correct-bitmap-allocation-size.patch create mode 100644 queue-5.18/revert-can-xilinx_can-limit-canfd-brp-to-2.patch create mode 100644 queue-5.18/s390-nospec-build-expoline.o-for-modules_prepare-tar.patch create mode 100644 queue-5.18/scsi-hisi_sas-limit-max-hw-sectors-for-v3-hw.patch create mode 100644 queue-5.18/scsi-megaraid-clear-read-queue-map-s-nr_queues.patch create mode 100644 queue-5.18/scsi-ufs-core-drop-loglevel-of-writeboost-message.patch create mode 100644 queue-5.18/signal-handling-don-t-use-bug_on-for-debugging.patch create mode 100644 queue-5.18/soc-ixp4xx-npe-fix-unused-match-warning.patch create mode 100644 queue-5.18/tee-tee_get_drvdata-fix-description-of-return-value.patch create mode 100644 queue-5.18/tty-extract-tty_flip_buffer_commit-from-tty_flip_buf.patch create mode 100644 queue-5.18/tty-use-new-tty_insert_flip_string_and_push_buffer-i.patch create mode 100644 queue-5.18/vdpa-mlx5-initialize-cvq-vringh-only-once.patch create mode 100644 queue-5.18/vduse-tie-vduse-mgmtdev-and-its-device.patch create mode 100644 queue-5.18/virtio_mmio-add-missing-pm-calls-to-freeze-restore.patch create mode 100644 queue-5.18/virtio_mmio-restore-guest-page-size-on-resume.patch create mode 100644 queue-5.18/wireguard-selftests-always-call-kernel-makefile.patch create mode 100644 queue-5.18/wireguard-selftests-set-fake-real-time-in-init.patch create mode 100644 queue-5.18/wireguard-selftests-use-virt-machine-on-m68k.patch create mode 100644 queue-5.18/x86-clear-.brk-area-at-early-boot.patch diff --git a/queue-5.18/alsa-usb-audio-add-quirk-for-fiero-sc-01-fw-v1.0.0.patch b/queue-5.18/alsa-usb-audio-add-quirk-for-fiero-sc-01-fw-v1.0.0.patch new file mode 100644 index 00000000000..42e0ec44065 --- /dev/null +++ b/queue-5.18/alsa-usb-audio-add-quirk-for-fiero-sc-01-fw-v1.0.0.patch @@ -0,0 +1,187 @@ +From 912e31263931e4bfc1f6d795669918252fef1eb6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 27 Jun 2022 13:00:35 +0300 +Subject: ALSA: usb-audio: Add quirk for Fiero SC-01 (fw v1.0.0) + +From: Egor Vorontsov + +[ Upstream commit 2307a0e1ca0b5c1337b37ac6302f96e017ebac3c ] + +The patch applies the same quirks used for SC-01 at firmware v1.1.0 to +the ones running v1.0.0, with respect to hard-coded sample rates. + +I got two more units and successfully tested the patch series with both +firmwares. + +The support is now complete (not accounting ASIO). + +Signed-off-by: Egor Vorontsov +Link: https://lore.kernel.org/r/20220627100041.2861494-2-sdoregor@sdore.me +Signed-off-by: Takashi Iwai +Signed-off-by: Sasha Levin +--- + sound/usb/quirks-table.h | 132 +++++++++++++++++++++++++++++++++++++++ + sound/usb/quirks.c | 4 ++ + 2 files changed, 136 insertions(+) + +diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h +index 7067d314fecd..f93201a830b5 100644 +--- a/sound/usb/quirks-table.h ++++ b/sound/usb/quirks-table.h +@@ -4167,6 +4167,138 @@ YAMAHA_DEVICE(0x7010, "UB99"), + } + } + }, ++{ ++ /* ++ * Fiero SC-01 (firmware v1.0.0 @ 48 kHz) ++ */ ++ USB_DEVICE(0x2b53, 0x0023), ++ .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { ++ .vendor_name = "Fiero", ++ .product_name = "SC-01", ++ .ifnum = QUIRK_ANY_INTERFACE, ++ .type = QUIRK_COMPOSITE, ++ .data = &(const struct snd_usb_audio_quirk[]) { ++ { ++ .ifnum = 0, ++ .type = QUIRK_AUDIO_STANDARD_INTERFACE ++ }, ++ /* Playback */ ++ { ++ .ifnum = 1, ++ .type = QUIRK_AUDIO_FIXED_ENDPOINT, ++ .data = &(const struct audioformat) { ++ .formats = SNDRV_PCM_FMTBIT_S32_LE, ++ .channels = 2, ++ .fmt_bits = 24, ++ .iface = 1, ++ .altsetting = 1, ++ .altset_idx = 1, ++ .endpoint = 0x01, ++ .ep_attr = USB_ENDPOINT_XFER_ISOC | ++ USB_ENDPOINT_SYNC_ASYNC, ++ .rates = SNDRV_PCM_RATE_48000, ++ .rate_min = 48000, ++ .rate_max = 48000, ++ .nr_rates = 1, ++ .rate_table = (unsigned int[]) { 48000 }, ++ .clock = 0x29 ++ } ++ }, ++ /* Capture */ ++ { ++ .ifnum = 2, ++ .type = QUIRK_AUDIO_FIXED_ENDPOINT, ++ .data = &(const struct audioformat) { ++ .formats = SNDRV_PCM_FMTBIT_S32_LE, ++ .channels = 2, ++ .fmt_bits = 24, ++ .iface = 2, ++ .altsetting = 1, ++ .altset_idx = 1, ++ .endpoint = 0x82, ++ .ep_attr = USB_ENDPOINT_XFER_ISOC | ++ USB_ENDPOINT_SYNC_ASYNC | ++ USB_ENDPOINT_USAGE_IMPLICIT_FB, ++ .rates = SNDRV_PCM_RATE_48000, ++ .rate_min = 48000, ++ .rate_max = 48000, ++ .nr_rates = 1, ++ .rate_table = (unsigned int[]) { 48000 }, ++ .clock = 0x29 ++ } ++ }, ++ { ++ .ifnum = -1 ++ } ++ } ++ } ++}, ++{ ++ /* ++ * Fiero SC-01 (firmware v1.0.0 @ 96 kHz) ++ */ ++ USB_DEVICE(0x2b53, 0x0024), ++ .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { ++ .vendor_name = "Fiero", ++ .product_name = "SC-01", ++ .ifnum = QUIRK_ANY_INTERFACE, ++ .type = QUIRK_COMPOSITE, ++ .data = &(const struct snd_usb_audio_quirk[]) { ++ { ++ .ifnum = 0, ++ .type = QUIRK_AUDIO_STANDARD_INTERFACE ++ }, ++ /* Playback */ ++ { ++ .ifnum = 1, ++ .type = QUIRK_AUDIO_FIXED_ENDPOINT, ++ .data = &(const struct audioformat) { ++ .formats = SNDRV_PCM_FMTBIT_S32_LE, ++ .channels = 2, ++ .fmt_bits = 24, ++ .iface = 1, ++ .altsetting = 1, ++ .altset_idx = 1, ++ .endpoint = 0x01, ++ .ep_attr = USB_ENDPOINT_XFER_ISOC | ++ USB_ENDPOINT_SYNC_ASYNC, ++ .rates = SNDRV_PCM_RATE_96000, ++ .rate_min = 96000, ++ .rate_max = 96000, ++ .nr_rates = 1, ++ .rate_table = (unsigned int[]) { 96000 }, ++ .clock = 0x29 ++ } ++ }, ++ /* Capture */ ++ { ++ .ifnum = 2, ++ .type = QUIRK_AUDIO_FIXED_ENDPOINT, ++ .data = &(const struct audioformat) { ++ .formats = SNDRV_PCM_FMTBIT_S32_LE, ++ .channels = 2, ++ .fmt_bits = 24, ++ .iface = 2, ++ .altsetting = 1, ++ .altset_idx = 1, ++ .endpoint = 0x82, ++ .ep_attr = USB_ENDPOINT_XFER_ISOC | ++ USB_ENDPOINT_SYNC_ASYNC | ++ USB_ENDPOINT_USAGE_IMPLICIT_FB, ++ .rates = SNDRV_PCM_RATE_96000, ++ .rate_min = 96000, ++ .rate_max = 96000, ++ .nr_rates = 1, ++ .rate_table = (unsigned int[]) { 96000 }, ++ .clock = 0x29 ++ } ++ }, ++ { ++ .ifnum = -1 ++ } ++ } ++ } ++}, + { + /* + * Fiero SC-01 (firmware v1.1.0) +diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c +index 51138350f03c..968d90caeefa 100644 +--- a/sound/usb/quirks.c ++++ b/sound/usb/quirks.c +@@ -1915,6 +1915,10 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = { + QUIRK_FLAG_ALIGN_TRANSFER), + DEVICE_FLG(0x1224, 0x2a25, /* Jieli Technology USB PHY 2.0 */ + QUIRK_FLAG_GET_SAMPLE_RATE), ++ DEVICE_FLG(0x2b53, 0x0023, /* Fiero SC-01 (firmware v1.0.0 @ 48 kHz) */ ++ QUIRK_FLAG_GENERIC_IMPLICIT_FB), ++ DEVICE_FLG(0x2b53, 0x0024, /* Fiero SC-01 (firmware v1.0.0 @ 96 kHz) */ ++ QUIRK_FLAG_GENERIC_IMPLICIT_FB), + DEVICE_FLG(0x2b53, 0x0031, /* Fiero SC-01 (firmware v1.1.0) */ + QUIRK_FLAG_GENERIC_IMPLICIT_FB), + +-- +2.35.1 + diff --git a/queue-5.18/alsa-usb-audio-add-quirk-for-fiero-sc-01.patch b/queue-5.18/alsa-usb-audio-add-quirk-for-fiero-sc-01.patch new file mode 100644 index 00000000000..3b0306ae48e --- /dev/null +++ b/queue-5.18/alsa-usb-audio-add-quirk-for-fiero-sc-01.patch @@ -0,0 +1,142 @@ +From 9931e97e2b0ac5fa85b544b712776038bf91e9a0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 27 Jun 2022 13:00:34 +0300 +Subject: ALSA: usb-audio: Add quirk for Fiero SC-01 + +From: Egor Vorontsov + +[ Upstream commit 4fb7c24f69c48fdc02ea7858dbd5a60ff08bf7e5 ] + +Fiero SC-01 is a USB sound card with two mono inputs and a single +stereo output. The inputs are composed into a single stereo stream. + +The device uses a vendor-provided driver on Windows and does not work +at all without it. The driver mostly provides ASIO functionality, but +also alters the way the sound card is queried for sample rates and +clocks. + +ALSA queries those failing with an EPIPE (same as Windows 10 does). +Presumably, the vendor-provided driver does not query it at all, simply +matching by VID:PID. Thus, I consider this a buggy firmware and adhere +to a set of fixed endpoint quirks instead. + +The soundcard has an internal clock. Implicit feedback mode is required +for the playback. + +I have updated my device to v1.1.0 from a Windows 10 VM using a vendor- +provided binary prior to the development, hoping for it to just begin +working. The device provides no obvious way to downgrade the firmware, +and regardless, there's no binary available for v1.0.0 anyway. + +Thus, I will be getting another unit to extend the patch with support +for that. Expected to be a simple copy-paste of the existing one, +though. + +There were no previous reports of that device in context of Linux +anywhere. Other issues have been reported though, but that's out of the +scope. + +Signed-off-by: Egor Vorontsov +Link: https://lore.kernel.org/r/20220627100041.2861494-1-sdoregor@sdore.me +Signed-off-by: Takashi Iwai +Signed-off-by: Sasha Levin +--- + sound/usb/quirks-table.h | 68 ++++++++++++++++++++++++++++++++++++++++ + sound/usb/quirks.c | 2 ++ + 2 files changed, 70 insertions(+) + +diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h +index 853da162fd18..7067d314fecd 100644 +--- a/sound/usb/quirks-table.h ++++ b/sound/usb/quirks-table.h +@@ -4167,6 +4167,74 @@ YAMAHA_DEVICE(0x7010, "UB99"), + } + } + }, ++{ ++ /* ++ * Fiero SC-01 (firmware v1.1.0) ++ */ ++ USB_DEVICE(0x2b53, 0x0031), ++ .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { ++ .vendor_name = "Fiero", ++ .product_name = "SC-01", ++ .ifnum = QUIRK_ANY_INTERFACE, ++ .type = QUIRK_COMPOSITE, ++ .data = &(const struct snd_usb_audio_quirk[]) { ++ { ++ .ifnum = 0, ++ .type = QUIRK_AUDIO_STANDARD_INTERFACE ++ }, ++ /* Playback */ ++ { ++ .ifnum = 1, ++ .type = QUIRK_AUDIO_FIXED_ENDPOINT, ++ .data = &(const struct audioformat) { ++ .formats = SNDRV_PCM_FMTBIT_S32_LE, ++ .channels = 2, ++ .fmt_bits = 24, ++ .iface = 1, ++ .altsetting = 1, ++ .altset_idx = 1, ++ .endpoint = 0x01, ++ .ep_attr = USB_ENDPOINT_XFER_ISOC | ++ USB_ENDPOINT_SYNC_ASYNC, ++ .rates = SNDRV_PCM_RATE_48000 | ++ SNDRV_PCM_RATE_96000, ++ .rate_min = 48000, ++ .rate_max = 96000, ++ .nr_rates = 2, ++ .rate_table = (unsigned int[]) { 48000, 96000 }, ++ .clock = 0x29 ++ } ++ }, ++ /* Capture */ ++ { ++ .ifnum = 2, ++ .type = QUIRK_AUDIO_FIXED_ENDPOINT, ++ .data = &(const struct audioformat) { ++ .formats = SNDRV_PCM_FMTBIT_S32_LE, ++ .channels = 2, ++ .fmt_bits = 24, ++ .iface = 2, ++ .altsetting = 1, ++ .altset_idx = 1, ++ .endpoint = 0x82, ++ .ep_attr = USB_ENDPOINT_XFER_ISOC | ++ USB_ENDPOINT_SYNC_ASYNC | ++ USB_ENDPOINT_USAGE_IMPLICIT_FB, ++ .rates = SNDRV_PCM_RATE_48000 | ++ SNDRV_PCM_RATE_96000, ++ .rate_min = 48000, ++ .rate_max = 96000, ++ .nr_rates = 2, ++ .rate_table = (unsigned int[]) { 48000, 96000 }, ++ .clock = 0x29 ++ } ++ }, ++ { ++ .ifnum = -1 ++ } ++ } ++ } ++}, + + #undef USB_DEVICE_VENDOR_SPEC + #undef USB_AUDIO_DEVICE +diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c +index a7bcae0a2c75..51138350f03c 100644 +--- a/sound/usb/quirks.c ++++ b/sound/usb/quirks.c +@@ -1915,6 +1915,8 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = { + QUIRK_FLAG_ALIGN_TRANSFER), + DEVICE_FLG(0x1224, 0x2a25, /* Jieli Technology USB PHY 2.0 */ + QUIRK_FLAG_GET_SAMPLE_RATE), ++ DEVICE_FLG(0x2b53, 0x0031, /* Fiero SC-01 (firmware v1.1.0) */ ++ QUIRK_FLAG_GENERIC_IMPLICIT_FB), + + /* Vendor matches */ + VENDOR_FLG(0x045e, /* MS Lifecam */ +-- +2.35.1 + diff --git a/queue-5.18/alsa-usb-audio-add-quirks-for-macrosilicon-ms2100-ms.patch b/queue-5.18/alsa-usb-audio-add-quirks-for-macrosilicon-ms2100-ms.patch new file mode 100644 index 00000000000..58a4c0a63b7 --- /dev/null +++ b/queue-5.18/alsa-usb-audio-add-quirks-for-macrosilicon-ms2100-ms.patch @@ -0,0 +1,105 @@ +From bfa74adbe1a7992f8a43ab40afbedb09eb95c45c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 24 Jun 2022 15:07:57 +0100 +Subject: ALSA: usb-audio: Add quirks for MacroSilicon MS2100/MS2106 devices + +From: John Veness + +[ Upstream commit 6e2c9105e0b743c92a157389d40f00b81bdd09fe ] + +Treat the claimed 96kHz 1ch in the descriptors as 48kHz 2ch, so that +the audio stream doesn't sound mono. Also fix initial stream +alignment, so that left and right channels are in the correct order. + +Signed-off-by: John Veness +Link: https://lore.kernel.org/r/20220624140757.28758-1-john-linux@pelago.org.uk +Signed-off-by: Takashi Iwai +Signed-off-by: Sasha Levin +--- + sound/usb/quirks-table.h | 48 ++++++++++++++++++++++++++++++++++++++++ + sound/usb/quirks.c | 3 +++ + 2 files changed, 51 insertions(+) + +diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h +index 4f56e1784932..853da162fd18 100644 +--- a/sound/usb/quirks-table.h ++++ b/sound/usb/quirks-table.h +@@ -3802,6 +3802,54 @@ YAMAHA_DEVICE(0x7010, "UB99"), + } + }, + ++/* ++ * MacroSilicon MS2100/MS2106 based AV capture cards ++ * ++ * These claim 96kHz 1ch in the descriptors, but are actually 48kHz 2ch. ++ * They also need QUIRK_FLAG_ALIGN_TRANSFER, which makes one wonder if ++ * they pretend to be 96kHz mono as a workaround for stereo being broken ++ * by that... ++ * ++ * They also have an issue with initial stream alignment that causes the ++ * channels to be swapped and out of phase, which is dealt with in quirks.c. ++ */ ++{ ++ USB_AUDIO_DEVICE(0x534d, 0x0021), ++ .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { ++ .vendor_name = "MacroSilicon", ++ .product_name = "MS210x", ++ .ifnum = QUIRK_ANY_INTERFACE, ++ .type = QUIRK_COMPOSITE, ++ .data = &(const struct snd_usb_audio_quirk[]) { ++ { ++ .ifnum = 2, ++ .type = QUIRK_AUDIO_STANDARD_MIXER, ++ }, ++ { ++ .ifnum = 3, ++ .type = QUIRK_AUDIO_FIXED_ENDPOINT, ++ .data = &(const struct audioformat) { ++ .formats = SNDRV_PCM_FMTBIT_S16_LE, ++ .channels = 2, ++ .iface = 3, ++ .altsetting = 1, ++ .altset_idx = 1, ++ .attributes = 0, ++ .endpoint = 0x82, ++ .ep_attr = USB_ENDPOINT_XFER_ISOC | ++ USB_ENDPOINT_SYNC_ASYNC, ++ .rates = SNDRV_PCM_RATE_CONTINUOUS, ++ .rate_min = 48000, ++ .rate_max = 48000, ++ } ++ }, ++ { ++ .ifnum = -1 ++ } ++ } ++ } ++}, ++ + /* + * MacroSilicon MS2109 based HDMI capture cards + * +diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c +index 12ce69b04f63..a7bcae0a2c75 100644 +--- a/sound/usb/quirks.c ++++ b/sound/usb/quirks.c +@@ -1478,6 +1478,7 @@ void snd_usb_set_format_quirk(struct snd_usb_substream *subs, + case USB_ID(0x041e, 0x3f19): /* E-Mu 0204 USB */ + set_format_emu_quirk(subs, fmt); + break; ++ case USB_ID(0x534d, 0x0021): /* MacroSilicon MS2100/MS2106 */ + case USB_ID(0x534d, 0x2109): /* MacroSilicon MS2109 */ + subs->stream_offset_adj = 2; + break; +@@ -1908,6 +1909,8 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = { + QUIRK_FLAG_IGNORE_CTL_ERROR), + DEVICE_FLG(0x413c, 0xa506, /* Dell AE515 sound bar */ + QUIRK_FLAG_GET_SAMPLE_RATE), ++ DEVICE_FLG(0x534d, 0x0021, /* MacroSilicon MS2100/MS2106 */ ++ QUIRK_FLAG_ALIGN_TRANSFER), + DEVICE_FLG(0x534d, 0x2109, /* MacroSilicon MS2109 */ + QUIRK_FLAG_ALIGN_TRANSFER), + DEVICE_FLG(0x1224, 0x2a25, /* Jieli Technology USB PHY 2.0 */ +-- +2.35.1 + diff --git a/queue-5.18/arm-9211-1-domain-drop-modify_domain.patch b/queue-5.18/arm-9211-1-domain-drop-modify_domain.patch new file mode 100644 index 00000000000..1cc6106c081 --- /dev/null +++ b/queue-5.18/arm-9211-1-domain-drop-modify_domain.patch @@ -0,0 +1,49 @@ +From 5cb7e0de71466827ecd4ed621e72e8f5ac712cbb Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 19 Jun 2022 20:39:29 +0100 +Subject: ARM: 9211/1: domain: drop modify_domain() + +From: Linus Walleij + +[ Upstream commit cc45b836388f0ccc6831288a08f77a33845f10b0 ] + +This function/macro isn't used anywhere in the kernel. +The only user was set_fs() and was deleted in the set_fs() +removal patch set. + +Fixes: 8ac6f5d7f84b ("ARM: 9113/1: uaccess: remove set_fs() implementation") +Acked-by: Arnd Bergmann +Signed-off-by: Linus Walleij +Signed-off-by: Russell King (Oracle) +Signed-off-by: Sasha Levin +--- + arch/arm/include/asm/domain.h | 13 ------------- + 1 file changed, 13 deletions(-) + +diff --git a/arch/arm/include/asm/domain.h b/arch/arm/include/asm/domain.h +index f1d0a7807cd0..41536feb4392 100644 +--- a/arch/arm/include/asm/domain.h ++++ b/arch/arm/include/asm/domain.h +@@ -112,19 +112,6 @@ static __always_inline void set_domain(unsigned int val) + } + #endif + +-#ifdef CONFIG_CPU_USE_DOMAINS +-#define modify_domain(dom,type) \ +- do { \ +- unsigned int domain = get_domain(); \ +- domain &= ~domain_mask(dom); \ +- domain = domain | domain_val(dom, type); \ +- set_domain(domain); \ +- } while (0) +- +-#else +-static inline void modify_domain(unsigned dom, unsigned type) { } +-#endif +- + /* + * Generate the T (user) versions of the LDR/STR and related + * instructions (inline assembly) +-- +2.35.1 + diff --git a/queue-5.18/arm-9212-1-domain-modify-kconfig-help-text.patch b/queue-5.18/arm-9212-1-domain-modify-kconfig-help-text.patch new file mode 100644 index 00000000000..0d54fd99dd9 --- /dev/null +++ b/queue-5.18/arm-9212-1-domain-modify-kconfig-help-text.patch @@ -0,0 +1,41 @@ +From 701a831db23879b776b4c123f480f1775db4b842 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 19 Jun 2022 20:40:16 +0100 +Subject: ARM: 9212/1: domain: Modify Kconfig help text + +From: Linus Walleij + +[ Upstream commit 2bf6204240fddb22cc4940b9e3f40c538390212e ] + +After the removal of set_fs() the reference to set_fs() is stale. +Alter the helptext to reflect what the config option really does. + +Fixes: 8ac6f5d7f84b ("ARM: 9113/1: uaccess: remove set_fs() implementation") +Acked-by: Arnd Bergmann +Signed-off-by: Linus Walleij +Signed-off-by: Russell King (Oracle) +Signed-off-by: Sasha Levin +--- + arch/arm/mm/Kconfig | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig +index d30ee26ccc87..6284914f4361 100644 +--- a/arch/arm/mm/Kconfig ++++ b/arch/arm/mm/Kconfig +@@ -631,7 +631,11 @@ config CPU_USE_DOMAINS + bool + help + This option enables or disables the use of domain switching +- via the set_fs() function. ++ using the DACR (domain access control register) to protect memory ++ domains from each other. In Linux we use three domains: kernel, user ++ and IO. The domains are used to protect userspace from kernelspace ++ and to handle IO-space as a special type of memory by assigning ++ manager or client roles to running code (such as a process). + + config CPU_V7M_NUM_IRQ + int "Number of external interrupts connected to the NVIC" +-- +2.35.1 + diff --git a/queue-5.18/arm-dts-stm32-use-the-correct-clock-source-for-cec-o.patch b/queue-5.18/arm-dts-stm32-use-the-correct-clock-source-for-cec-o.patch new file mode 100644 index 00000000000..13f46008602 --- /dev/null +++ b/queue-5.18/arm-dts-stm32-use-the-correct-clock-source-for-cec-o.patch @@ -0,0 +1,34 @@ +From e6be2e9c2eafae56b72274186128760a6380bd38 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 24 Jun 2022 11:27:13 +0200 +Subject: ARM: dts: stm32: use the correct clock source for CEC on stm32mp151 + +From: Gabriel Fernandez + +[ Upstream commit 78ece8cce1ba0c3f3e5a7c6c1b914b3794f04c44 ] + +The peripheral clock of CEC is not LSE but CEC. + +Signed-off-by: Gabriel Fernandez +Signed-off-by: Alexandre Torgue +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/stm32mp151.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/stm32mp151.dtsi b/arch/arm/boot/dts/stm32mp151.dtsi +index 9c2bbf115f4c..de4d651f9575 100644 +--- a/arch/arm/boot/dts/stm32mp151.dtsi ++++ b/arch/arm/boot/dts/stm32mp151.dtsi +@@ -565,7 +565,7 @@ + compatible = "st,stm32-cec"; + reg = <0x40016000 0x400>; + interrupts = ; +- clocks = <&rcc CEC_K>, <&clk_lse>; ++ clocks = <&rcc CEC_K>, <&rcc CEC>; + clock-names = "cec", "hdmi-cec"; + status = "disabled"; + }; +-- +2.35.1 + diff --git a/queue-5.18/asoc-codecs-rt700-rt711-rt711-sdca-initialize-workqu.patch b/queue-5.18/asoc-codecs-rt700-rt711-rt711-sdca-initialize-workqu.patch new file mode 100644 index 00000000000..c61ddf965f3 --- /dev/null +++ b/queue-5.18/asoc-codecs-rt700-rt711-rt711-sdca-initialize-workqu.patch @@ -0,0 +1,121 @@ +From fcf8f7cf1c9ae35bfed320c982c07a02289fafa7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 6 Jun 2022 15:37:51 -0500 +Subject: ASoC: codecs: rt700/rt711/rt711-sdca: initialize workqueues in probe + +From: Pierre-Louis Bossart + +[ Upstream commit ba98d7d8b60ba410aa03834f6aa48fd3b2e68478 ] + +The workqueues are initialized in the io_init functions, which isn't +quite right. In some tests, this leads to warnings throw from +__queue_delayed_work() + +WARN_ON_FUNCTION_MISMATCH(timer->function, delayed_work_timer_fn); + +Move all the initializations to the probe functions. + +Signed-off-by: Pierre-Louis Bossart +Reviewed-by: Rander Wang +Reviewed-by: Bard Liao +Link: https://lore.kernel.org/r/20220606203752.144159-7-pierre-louis.bossart@linux.intel.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/codecs/rt700.c | 12 +++++------- + sound/soc/codecs/rt711-sdca.c | 10 +++------- + sound/soc/codecs/rt711.c | 12 +++++------- + 3 files changed, 13 insertions(+), 21 deletions(-) + +diff --git a/sound/soc/codecs/rt700.c b/sound/soc/codecs/rt700.c +index b16fbde02986..3de3406d653e 100644 +--- a/sound/soc/codecs/rt700.c ++++ b/sound/soc/codecs/rt700.c +@@ -1124,6 +1124,11 @@ int rt700_init(struct device *dev, struct regmap *sdw_regmap, + + mutex_init(&rt700->disable_irq_lock); + ++ INIT_DELAYED_WORK(&rt700->jack_detect_work, ++ rt700_jack_detect_handler); ++ INIT_DELAYED_WORK(&rt700->jack_btn_check_work, ++ rt700_btn_check_handler); ++ + /* + * Mark hw_init to false + * HW init will be performed when device reports present +@@ -1218,13 +1223,6 @@ int rt700_io_init(struct device *dev, struct sdw_slave *slave) + /* Finish Initial Settings, set power to D3 */ + regmap_write(rt700->regmap, RT700_SET_AUDIO_POWER_STATE, AC_PWRST_D3); + +- if (!rt700->first_hw_init) { +- INIT_DELAYED_WORK(&rt700->jack_detect_work, +- rt700_jack_detect_handler); +- INIT_DELAYED_WORK(&rt700->jack_btn_check_work, +- rt700_btn_check_handler); +- } +- + /* + * if set_jack callback occurred early than io_init, + * we set up the jack detection function now +diff --git a/sound/soc/codecs/rt711-sdca.c b/sound/soc/codecs/rt711-sdca.c +index 83e4c4e4d1e2..dfe3c9299ebd 100644 +--- a/sound/soc/codecs/rt711-sdca.c ++++ b/sound/soc/codecs/rt711-sdca.c +@@ -1417,6 +1417,9 @@ int rt711_sdca_init(struct device *dev, struct regmap *regmap, + mutex_init(&rt711->calibrate_mutex); + mutex_init(&rt711->disable_irq_lock); + ++ INIT_DELAYED_WORK(&rt711->jack_detect_work, rt711_sdca_jack_detect_handler); ++ INIT_DELAYED_WORK(&rt711->jack_btn_check_work, rt711_sdca_btn_check_handler); ++ + /* + * Mark hw_init to false + * HW init will be performed when device reports present +@@ -1548,13 +1551,6 @@ int rt711_sdca_io_init(struct device *dev, struct sdw_slave *slave) + rt711_sdca_index_update_bits(rt711, RT711_VENDOR_HDA_CTL, + RT711_PUSH_BTN_INT_CTL0, 0x20, 0x00); + +- if (!rt711->first_hw_init) { +- INIT_DELAYED_WORK(&rt711->jack_detect_work, +- rt711_sdca_jack_detect_handler); +- INIT_DELAYED_WORK(&rt711->jack_btn_check_work, +- rt711_sdca_btn_check_handler); +- } +- + /* calibration */ + ret = rt711_sdca_calibration(rt711); + if (ret < 0) +diff --git a/sound/soc/codecs/rt711.c b/sound/soc/codecs/rt711.c +index 18a0de77c477..9df800abfc2d 100644 +--- a/sound/soc/codecs/rt711.c ++++ b/sound/soc/codecs/rt711.c +@@ -1209,6 +1209,10 @@ int rt711_init(struct device *dev, struct regmap *sdw_regmap, + mutex_init(&rt711->calibrate_mutex); + mutex_init(&rt711->disable_irq_lock); + ++ INIT_DELAYED_WORK(&rt711->jack_detect_work, rt711_jack_detect_handler); ++ INIT_DELAYED_WORK(&rt711->jack_btn_check_work, rt711_btn_check_handler); ++ INIT_WORK(&rt711->calibration_work, rt711_calibration_work); ++ + /* + * Mark hw_init to false + * HW init will be performed when device reports present +@@ -1316,14 +1320,8 @@ int rt711_io_init(struct device *dev, struct sdw_slave *slave) + + if (rt711->first_hw_init) + rt711_calibration(rt711); +- else { +- INIT_DELAYED_WORK(&rt711->jack_detect_work, +- rt711_jack_detect_handler); +- INIT_DELAYED_WORK(&rt711->jack_btn_check_work, +- rt711_btn_check_handler); +- INIT_WORK(&rt711->calibration_work, rt711_calibration_work); ++ else + schedule_work(&rt711->calibration_work); +- } + + /* + * if set_jack callback occurred early than io_init, +-- +2.35.1 + diff --git a/queue-5.18/asoc-cs35l41-add-asp-tx3-4-source-to-register-patch.patch b/queue-5.18/asoc-cs35l41-add-asp-tx3-4-source-to-register-patch.patch new file mode 100644 index 00000000000..aeb70530965 --- /dev/null +++ b/queue-5.18/asoc-cs35l41-add-asp-tx3-4-source-to-register-patch.patch @@ -0,0 +1,69 @@ +From 083b400219ae923659863db7a11df625b8d616fa Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 23 Jun 2022 11:51:16 +0100 +Subject: ASoC: cs35l41: Add ASP TX3/4 source to register patch + +From: Charles Keepax + +[ Upstream commit 46b0d050c8c7df6dfb2c376aaa149bf2cfc5ca3e ] + +The mixer controls for ASP TX3/4 are set to values that are not included +in their enumeration control. This will cause spurious event +notifications when the controls are first changed, as the register value +changes whilst the actual visible enumeration value does not. Use the +register patch to set them to a known value, zero, which equates to zero +fill, thereby avoiding the spurious notifications. + +Signed-off-by: Charles Keepax +Link: https://lore.kernel.org/r/20220623105120.1981154-2-ckeepax@opensource.cirrus.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/codecs/cs35l41-lib.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/sound/soc/codecs/cs35l41-lib.c b/sound/soc/codecs/cs35l41-lib.c +index 17cf782f39af..538b5c4d3abf 100644 +--- a/sound/soc/codecs/cs35l41-lib.c ++++ b/sound/soc/codecs/cs35l41-lib.c +@@ -36,8 +36,8 @@ static const struct reg_default cs35l41_reg[] = { + { CS35L41_DAC_PCM1_SRC, 0x00000008 }, + { CS35L41_ASP_TX1_SRC, 0x00000018 }, + { CS35L41_ASP_TX2_SRC, 0x00000019 }, +- { CS35L41_ASP_TX3_SRC, 0x00000020 }, +- { CS35L41_ASP_TX4_SRC, 0x00000021 }, ++ { CS35L41_ASP_TX3_SRC, 0x00000000 }, ++ { CS35L41_ASP_TX4_SRC, 0x00000000 }, + { CS35L41_DSP1_RX1_SRC, 0x00000008 }, + { CS35L41_DSP1_RX2_SRC, 0x00000009 }, + { CS35L41_DSP1_RX3_SRC, 0x00000018 }, +@@ -643,6 +643,8 @@ static const struct reg_sequence cs35l41_reva0_errata_patch[] = { + { CS35L41_DSP1_XM_ACCEL_PL0_PRI, 0x00000000 }, + { CS35L41_PWR_CTRL2, 0x00000000 }, + { CS35L41_AMP_GAIN_CTRL, 0x00000000 }, ++ { CS35L41_ASP_TX3_SRC, 0x00000000 }, ++ { CS35L41_ASP_TX4_SRC, 0x00000000 }, + }; + + static const struct reg_sequence cs35l41_revb0_errata_patch[] = { +@@ -654,6 +656,8 @@ static const struct reg_sequence cs35l41_revb0_errata_patch[] = { + { CS35L41_DSP1_XM_ACCEL_PL0_PRI, 0x00000000 }, + { CS35L41_PWR_CTRL2, 0x00000000 }, + { CS35L41_AMP_GAIN_CTRL, 0x00000000 }, ++ { CS35L41_ASP_TX3_SRC, 0x00000000 }, ++ { CS35L41_ASP_TX4_SRC, 0x00000000 }, + }; + + static const struct reg_sequence cs35l41_revb2_errata_patch[] = { +@@ -665,6 +669,8 @@ static const struct reg_sequence cs35l41_revb2_errata_patch[] = { + { CS35L41_DSP1_XM_ACCEL_PL0_PRI, 0x00000000 }, + { CS35L41_PWR_CTRL2, 0x00000000 }, + { CS35L41_AMP_GAIN_CTRL, 0x00000000 }, ++ { CS35L41_ASP_TX3_SRC, 0x00000000 }, ++ { CS35L41_ASP_TX4_SRC, 0x00000000 }, + }; + + static const struct cs35l41_otp_map_element_t cs35l41_otp_map_map[] = { +-- +2.35.1 + diff --git a/queue-5.18/asoc-cs35l41-correct-some-control-names.patch b/queue-5.18/asoc-cs35l41-correct-some-control-names.patch new file mode 100644 index 00000000000..6e6250681aa --- /dev/null +++ b/queue-5.18/asoc-cs35l41-correct-some-control-names.patch @@ -0,0 +1,57 @@ +From c5ea750bfb7ddc542c7ecbb71d5b374a9e7073c6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 21 Jun 2022 11:20:40 +0100 +Subject: ASoC: cs35l41: Correct some control names + +From: Charles Keepax + +[ Upstream commit c6a5f22f9b4fd5f21414be690ce34046d9712f05 ] + +Various boolean controls on cs35l41 are missing the required "Switch" in +the name, add these. + +Signed-off-by: Charles Keepax +Link: https://lore.kernel.org/r/20220621102041.1713504-3-ckeepax@opensource.cirrus.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/codecs/cs35l41.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/sound/soc/codecs/cs35l41.c b/sound/soc/codecs/cs35l41.c +index 6b784a62df0c..20c76a53a508 100644 +--- a/sound/soc/codecs/cs35l41.c ++++ b/sound/soc/codecs/cs35l41.c +@@ -392,7 +392,7 @@ static const struct snd_kcontrol_new cs35l41_aud_controls[] = { + SOC_SINGLE("HW Noise Gate Enable", CS35L41_NG_CFG, 8, 63, 0), + SOC_SINGLE("HW Noise Gate Delay", CS35L41_NG_CFG, 4, 7, 0), + SOC_SINGLE("HW Noise Gate Threshold", CS35L41_NG_CFG, 0, 7, 0), +- SOC_SINGLE("Aux Noise Gate CH1 Enable", ++ SOC_SINGLE("Aux Noise Gate CH1 Switch", + CS35L41_MIXER_NGATE_CH1_CFG, 16, 1, 0), + SOC_SINGLE("Aux Noise Gate CH1 Entry Delay", + CS35L41_MIXER_NGATE_CH1_CFG, 8, 15, 0), +@@ -400,15 +400,15 @@ static const struct snd_kcontrol_new cs35l41_aud_controls[] = { + CS35L41_MIXER_NGATE_CH1_CFG, 0, 7, 0), + SOC_SINGLE("Aux Noise Gate CH2 Entry Delay", + CS35L41_MIXER_NGATE_CH2_CFG, 8, 15, 0), +- SOC_SINGLE("Aux Noise Gate CH2 Enable", ++ SOC_SINGLE("Aux Noise Gate CH2 Switch", + CS35L41_MIXER_NGATE_CH2_CFG, 16, 1, 0), + SOC_SINGLE("Aux Noise Gate CH2 Threshold", + CS35L41_MIXER_NGATE_CH2_CFG, 0, 7, 0), +- SOC_SINGLE("SCLK Force", CS35L41_SP_FORMAT, CS35L41_SCLK_FRC_SHIFT, 1, 0), +- SOC_SINGLE("LRCLK Force", CS35L41_SP_FORMAT, CS35L41_LRCLK_FRC_SHIFT, 1, 0), +- SOC_SINGLE("Invert Class D", CS35L41_AMP_DIG_VOL_CTRL, ++ SOC_SINGLE("SCLK Force Switch", CS35L41_SP_FORMAT, CS35L41_SCLK_FRC_SHIFT, 1, 0), ++ SOC_SINGLE("LRCLK Force Switch", CS35L41_SP_FORMAT, CS35L41_LRCLK_FRC_SHIFT, 1, 0), ++ SOC_SINGLE("Invert Class D Switch", CS35L41_AMP_DIG_VOL_CTRL, + CS35L41_AMP_INV_PCM_SHIFT, 1, 0), +- SOC_SINGLE("Amp Gain ZC", CS35L41_AMP_GAIN_CTRL, ++ SOC_SINGLE("Amp Gain ZC Switch", CS35L41_AMP_GAIN_CTRL, + CS35L41_AMP_GAIN_ZC_SHIFT, 1, 0), + WM_ADSP2_PRELOAD_SWITCH("DSP1", 1), + WM_ADSP_FW_CONTROL("DSP1", 0), +-- +2.35.1 + diff --git a/queue-5.18/asoc-cs47l15-fix-event-generation-for-low-power-mux-.patch b/queue-5.18/asoc-cs47l15-fix-event-generation-for-low-power-mux-.patch new file mode 100644 index 00000000000..5521b9c702f --- /dev/null +++ b/queue-5.18/asoc-cs47l15-fix-event-generation-for-low-power-mux-.patch @@ -0,0 +1,48 @@ +From c1cf8a3ebb2fa6e98450a64589eccc6f70f99134 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 23 Jun 2022 11:51:17 +0100 +Subject: ASoC: cs47l15: Fix event generation for low power mux control + +From: Charles Keepax + +[ Upstream commit 7f103af4a10f375b9b346b4d0b730f6a66b8c451 ] + +cs47l15_in1_adc_put always returns zero regardless of if the control +value was updated. This results in missing notifications to user-space +of the control change. Update the handling to return 1 when the value is +changed. + +Signed-off-by: Charles Keepax +Link: https://lore.kernel.org/r/20220623105120.1981154-3-ckeepax@opensource.cirrus.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/codecs/cs47l15.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/sound/soc/codecs/cs47l15.c b/sound/soc/codecs/cs47l15.c +index 391fd7da331f..1c7d52bef893 100644 +--- a/sound/soc/codecs/cs47l15.c ++++ b/sound/soc/codecs/cs47l15.c +@@ -122,6 +122,9 @@ static int cs47l15_in1_adc_put(struct snd_kcontrol *kcontrol, + snd_soc_kcontrol_component(kcontrol); + struct cs47l15 *cs47l15 = snd_soc_component_get_drvdata(component); + ++ if (!!ucontrol->value.integer.value[0] == cs47l15->in1_lp_mode) ++ return 0; ++ + switch (ucontrol->value.integer.value[0]) { + case 0: + /* Set IN1 to normal mode */ +@@ -150,7 +153,7 @@ static int cs47l15_in1_adc_put(struct snd_kcontrol *kcontrol, + break; + } + +- return 0; ++ return 1; + } + + static const struct snd_kcontrol_new cs47l15_snd_controls[] = { +-- +2.35.1 + diff --git a/queue-5.18/asoc-dapm-initialise-kcontrol-data-for-mux-demux-con.patch b/queue-5.18/asoc-dapm-initialise-kcontrol-data-for-mux-demux-con.patch new file mode 100644 index 00000000000..6c4ae5c3dff --- /dev/null +++ b/queue-5.18/asoc-dapm-initialise-kcontrol-data-for-mux-demux-con.patch @@ -0,0 +1,59 @@ +From 2ca0fea7a7bc56221f945264b37608995f90b846 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 23 Jun 2022 11:51:15 +0100 +Subject: ASoC: dapm: Initialise kcontrol data for mux/demux controls + +From: Charles Keepax + +[ Upstream commit 11d7a12f7f50baa5af9090b131c9b03af59503e7 ] + +DAPM keeps a copy of the current value of mux/demux controls, +however this value is only initialised in the case of autodisable +controls. This leads to false notification events when first +modifying a DAPM kcontrol that has a non-zero default. + +Autodisable controls are left as they are, since they already +initialise the value, and there would be more work required to +support autodisable muxes where the first option isn't disabled +and/or that isn't the default. + +Technically this issue could affect mixer/switch elements as well, +although not on any of the devices I am currently running. There +is also a little more work to do to address the issue there due to +that side supporting stereo controls, so that has not been tackled +in this patch. + +Signed-off-by: Charles Keepax +Link: https://lore.kernel.org/r/20220623105120.1981154-1-ckeepax@opensource.cirrus.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/soc-dapm.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c +index 869c76506b66..a8e842e02cdc 100644 +--- a/sound/soc/soc-dapm.c ++++ b/sound/soc/soc-dapm.c +@@ -62,6 +62,8 @@ struct snd_soc_dapm_widget * + snd_soc_dapm_new_control_unlocked(struct snd_soc_dapm_context *dapm, + const struct snd_soc_dapm_widget *widget); + ++static unsigned int soc_dapm_read(struct snd_soc_dapm_context *dapm, int reg); ++ + /* dapm power sequences - make this per codec in the future */ + static int dapm_up_seq[] = { + [snd_soc_dapm_pre] = 1, +@@ -442,6 +444,9 @@ static int dapm_kcontrol_data_alloc(struct snd_soc_dapm_widget *widget, + + snd_soc_dapm_add_path(widget->dapm, data->widget, + widget, NULL, NULL); ++ } else if (e->reg != SND_SOC_NOPM) { ++ data->value = soc_dapm_read(widget->dapm, e->reg) & ++ (e->mask << e->shift_l); + } + break; + default: +-- +2.35.1 + diff --git a/queue-5.18/asoc-dt-bindings-fix-description-for-msm8916.patch b/queue-5.18/asoc-dt-bindings-fix-description-for-msm8916.patch new file mode 100644 index 00000000000..049de969718 --- /dev/null +++ b/queue-5.18/asoc-dt-bindings-fix-description-for-msm8916.patch @@ -0,0 +1,59 @@ +From 1eef40209707e2fc960a8eebfc178629330a7b65 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 29 Jun 2022 12:40:12 +0100 +Subject: ASoC: dt-bindings: Fix description for msm8916 + +From: Bryan O'Donoghue + +[ Upstream commit 94c65dffd4c4af052b3ea8934fbcb2fa8da276a8 ] + +For the existing msm8916 bindings the minimum reg/reg-names is 1 not 2. +Similarly the minimum interrupt/interrupt-names is 1 not 2. + +Fixes: f3fc4fbfa2d2 ("ASoC: dt-bindings: Add SC7280 lpass cpu bindings") +Signed-off-by: Bryan O'Donoghue +Reviewed-by: Krzysztof Kozlowski +Link: https://lore.kernel.org/r/20220629114012.3282945-1-bryan.odonoghue@linaro.org +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + .../devicetree/bindings/sound/qcom,lpass-cpu.yaml | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/Documentation/devicetree/bindings/sound/qcom,lpass-cpu.yaml b/Documentation/devicetree/bindings/sound/qcom,lpass-cpu.yaml +index 2c81efb5fa37..47bb67d43ac2 100644 +--- a/Documentation/devicetree/bindings/sound/qcom,lpass-cpu.yaml ++++ b/Documentation/devicetree/bindings/sound/qcom,lpass-cpu.yaml +@@ -25,12 +25,12 @@ properties: + - qcom,sc7280-lpass-cpu + + reg: +- minItems: 2 ++ minItems: 1 + maxItems: 6 + description: LPAIF core registers + + reg-names: +- minItems: 2 ++ minItems: 1 + maxItems: 6 + + clocks: +@@ -42,12 +42,12 @@ properties: + maxItems: 7 + + interrupts: +- minItems: 2 ++ minItems: 1 + maxItems: 4 + description: LPAIF DMA buffer interrupt + + interrupt-names: +- minItems: 2 ++ minItems: 1 + maxItems: 4 + + qcom,adsp: +-- +2.35.1 + diff --git a/queue-5.18/asoc-intel-bytcr_wm5102-fix-gpio-related-probe-order.patch b/queue-5.18/asoc-intel-bytcr_wm5102-fix-gpio-related-probe-order.patch new file mode 100644 index 00000000000..bb75213a580 --- /dev/null +++ b/queue-5.18/asoc-intel-bytcr_wm5102-fix-gpio-related-probe-order.patch @@ -0,0 +1,55 @@ +From 5c197ca507a50f5fcd804777bf050ecd5337f370 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 12 Jun 2022 17:56:52 +0200 +Subject: ASoC: Intel: bytcr_wm5102: Fix GPIO related probe-ordering problem + +From: Hans de Goede + +[ Upstream commit 4e07479eab8a044cc9542414ccb4aeb8eb033bde ] + +The "wlf,spkvdd-ena" GPIO needed by the bytcr_wm5102 driver +is made available through a gpio-lookup table. + +This gpio-lookup table is registered by drivers/mfd/arizona-spi.c, which +may get probed after the bytcr_wm5102 driver. + +If the gpio-lookup table has not registered yet then the gpiod_get() +will return -ENOENT. Treat -ENOENT as -EPROBE_DEFER to still keep +things working in this case. + +Signed-off-by: Hans de Goede +Acked-by: Pierre-Louis Bossart +Link: https://lore.kernel.org/r/20220612155652.107310-1-hdegoede@redhat.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/intel/boards/bytcr_wm5102.c | 13 +++++++++++-- + 1 file changed, 11 insertions(+), 2 deletions(-) + +diff --git a/sound/soc/intel/boards/bytcr_wm5102.c b/sound/soc/intel/boards/bytcr_wm5102.c +index 8d8e96e3cd2d..f6d0cef1b28c 100644 +--- a/sound/soc/intel/boards/bytcr_wm5102.c ++++ b/sound/soc/intel/boards/bytcr_wm5102.c +@@ -421,8 +421,17 @@ static int snd_byt_wm5102_mc_probe(struct platform_device *pdev) + priv->spkvdd_en_gpio = gpiod_get(codec_dev, "wlf,spkvdd-ena", GPIOD_OUT_LOW); + put_device(codec_dev); + +- if (IS_ERR(priv->spkvdd_en_gpio)) +- return dev_err_probe(dev, PTR_ERR(priv->spkvdd_en_gpio), "getting spkvdd-GPIO\n"); ++ if (IS_ERR(priv->spkvdd_en_gpio)) { ++ ret = PTR_ERR(priv->spkvdd_en_gpio); ++ /* ++ * The spkvdd gpio-lookup is registered by: drivers/mfd/arizona-spi.c, ++ * so -ENOENT means that arizona-spi hasn't probed yet. ++ */ ++ if (ret == -ENOENT) ++ ret = -EPROBE_DEFER; ++ ++ return dev_err_probe(dev, ret, "getting spkvdd-GPIO\n"); ++ } + + /* override platform name, if required */ + byt_wm5102_card.dev = dev; +-- +2.35.1 + diff --git a/queue-5.18/asoc-intel-sof_sdw-handle-errors-on-card-registratio.patch b/queue-5.18/asoc-intel-sof_sdw-handle-errors-on-card-registratio.patch new file mode 100644 index 00000000000..c6debf5f63f --- /dev/null +++ b/queue-5.18/asoc-intel-sof_sdw-handle-errors-on-card-registratio.patch @@ -0,0 +1,107 @@ +From f28cd3660123edef37712af4f3e3e746e8f90a07 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 6 Jun 2022 15:37:48 -0500 +Subject: ASoC: Intel: sof_sdw: handle errors on card registration + +From: Pierre-Louis Bossart + +[ Upstream commit fe154c4ff376bc31041c6441958a08243df09c99 ] + +If the card registration fails, typically because of deferred probes, +the device properties added for headset codecs are not removed, which +leads to kernel oopses in driver bind/unbind tests. + +We already clean-up the device properties when the card is removed, +this code can be moved as a helper and called upon card registration +errors. + +Signed-off-by: Pierre-Louis Bossart +Reviewed-by: Rander Wang +Reviewed-by: Bard Liao +Link: https://lore.kernel.org/r/20220606203752.144159-4-pierre-louis.bossart@linux.intel.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/intel/boards/sof_sdw.c | 51 ++++++++++++++++++-------------- + 1 file changed, 29 insertions(+), 22 deletions(-) + +diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c +index 1f00679b4240..ad826ad82d51 100644 +--- a/sound/soc/intel/boards/sof_sdw.c ++++ b/sound/soc/intel/boards/sof_sdw.c +@@ -1398,6 +1398,33 @@ static struct snd_soc_card card_sof_sdw = { + .late_probe = sof_sdw_card_late_probe, + }; + ++static void mc_dailink_exit_loop(struct snd_soc_card *card) ++{ ++ struct snd_soc_dai_link *link; ++ int ret; ++ int i, j; ++ ++ for (i = 0; i < ARRAY_SIZE(codec_info_list); i++) { ++ if (!codec_info_list[i].exit) ++ continue; ++ /* ++ * We don't need to call .exit function if there is no matched ++ * dai link found. ++ */ ++ for_each_card_prelinks(card, j, link) { ++ if (!strcmp(link->codecs[0].dai_name, ++ codec_info_list[i].dai_name)) { ++ ret = codec_info_list[i].exit(card, link); ++ if (ret) ++ dev_warn(card->dev, ++ "codec exit failed %d\n", ++ ret); ++ break; ++ } ++ } ++ } ++} ++ + static int mc_probe(struct platform_device *pdev) + { + struct snd_soc_card *card = &card_sof_sdw; +@@ -1462,6 +1489,7 @@ static int mc_probe(struct platform_device *pdev) + ret = devm_snd_soc_register_card(&pdev->dev, card); + if (ret) { + dev_err(card->dev, "snd_soc_register_card failed %d\n", ret); ++ mc_dailink_exit_loop(card); + return ret; + } + +@@ -1473,29 +1501,8 @@ static int mc_probe(struct platform_device *pdev) + static int mc_remove(struct platform_device *pdev) + { + struct snd_soc_card *card = platform_get_drvdata(pdev); +- struct snd_soc_dai_link *link; +- int ret; +- int i, j; + +- for (i = 0; i < ARRAY_SIZE(codec_info_list); i++) { +- if (!codec_info_list[i].exit) +- continue; +- /* +- * We don't need to call .exit function if there is no matched +- * dai link found. +- */ +- for_each_card_prelinks(card, j, link) { +- if (!strcmp(link->codecs[0].dai_name, +- codec_info_list[i].dai_name)) { +- ret = codec_info_list[i].exit(card, link); +- if (ret) +- dev_warn(&pdev->dev, +- "codec exit failed %d\n", +- ret); +- break; +- } +- } +- } ++ mc_dailink_exit_loop(card); + + return 0; + } +-- +2.35.1 + diff --git a/queue-5.18/asoc-madera-fix-event-generation-for-out1-demux.patch b/queue-5.18/asoc-madera-fix-event-generation-for-out1-demux.patch new file mode 100644 index 00000000000..80554248ea3 --- /dev/null +++ b/queue-5.18/asoc-madera-fix-event-generation-for-out1-demux.patch @@ -0,0 +1,46 @@ +From 3ff83e6db22db2b30ba01305a214a1d8d3639b65 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 23 Jun 2022 11:51:18 +0100 +Subject: ASoC: madera: Fix event generation for OUT1 demux + +From: Charles Keepax + +[ Upstream commit e3cabbef3db8269207a6b8808f510137669f8deb ] + +madera_out1_demux_put returns the value of +snd_soc_dapm_mux_update_power, which returns a 1 if a path was found for +the kcontrol. This is obviously different to the expected return a 1 if +the control was updated value. This results in spurious notifications to +user-space. Update the handling to only return a 1 when the value is +changed. + +Signed-off-by: Charles Keepax +Link: https://lore.kernel.org/r/20220623105120.1981154-4-ckeepax@opensource.cirrus.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/codecs/madera.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/sound/soc/codecs/madera.c b/sound/soc/codecs/madera.c +index 272041c6236a..8095a87117cf 100644 +--- a/sound/soc/codecs/madera.c ++++ b/sound/soc/codecs/madera.c +@@ -618,7 +618,13 @@ int madera_out1_demux_put(struct snd_kcontrol *kcontrol, + end: + snd_soc_dapm_mutex_unlock(dapm); + +- return snd_soc_dapm_mux_update_power(dapm, kcontrol, mux, e, NULL); ++ ret = snd_soc_dapm_mux_update_power(dapm, kcontrol, mux, e, NULL); ++ if (ret < 0) { ++ dev_err(madera->dev, "Failed to update demux power state: %d\n", ret); ++ return ret; ++ } ++ ++ return change; + } + EXPORT_SYMBOL_GPL(madera_out1_demux_put); + +-- +2.35.1 + diff --git a/queue-5.18/asoc-madera-fix-event-generation-for-rate-controls.patch b/queue-5.18/asoc-madera-fix-event-generation-for-rate-controls.patch new file mode 100644 index 00000000000..7fb91535d3a --- /dev/null +++ b/queue-5.18/asoc-madera-fix-event-generation-for-rate-controls.patch @@ -0,0 +1,51 @@ +From 89c8dc6b8397955c42dcb72f77cab127a135c8a2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 23 Jun 2022 11:51:19 +0100 +Subject: ASoC: madera: Fix event generation for rate controls + +From: Charles Keepax + +[ Upstream commit 980555e95f7cabdc9c80a07107622b097ba23703 ] + +madera_adsp_rate_put always returns zero regardless of if the control +value was updated. This results in missing notifications to user-space +of the control change. Update the handling to return 1 when the +value is changed. + +Signed-off-by: Charles Keepax +Link: https://lore.kernel.org/r/20220623105120.1981154-5-ckeepax@opensource.cirrus.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/codecs/madera.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/sound/soc/codecs/madera.c b/sound/soc/codecs/madera.c +index 8095a87117cf..b9f19fbd2911 100644 +--- a/sound/soc/codecs/madera.c ++++ b/sound/soc/codecs/madera.c +@@ -899,7 +899,7 @@ static int madera_adsp_rate_put(struct snd_kcontrol *kcontrol, + struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; + const int adsp_num = e->shift_l; + const unsigned int item = ucontrol->value.enumerated.item[0]; +- int ret; ++ int ret = 0; + + if (item >= e->items) + return -EINVAL; +@@ -916,10 +916,10 @@ static int madera_adsp_rate_put(struct snd_kcontrol *kcontrol, + "Cannot change '%s' while in use by active audio paths\n", + kcontrol->id.name); + ret = -EBUSY; +- } else { ++ } else if (priv->adsp_rate_cache[adsp_num] != e->values[item]) { + /* Volatile register so defer until the codec is powered up */ + priv->adsp_rate_cache[adsp_num] = e->values[item]; +- ret = 0; ++ ret = 1; + } + + mutex_unlock(&priv->rate_lock); +-- +2.35.1 + diff --git a/queue-5.18/asoc-ops-fix-off-by-one-in-range-control-validation.patch b/queue-5.18/asoc-ops-fix-off-by-one-in-range-control-validation.patch new file mode 100644 index 00000000000..2641a5ef535 --- /dev/null +++ b/queue-5.18/asoc-ops-fix-off-by-one-in-range-control-validation.patch @@ -0,0 +1,45 @@ +From 33de65a0ea3407dd0ae4b6b4d1704039dd32484a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 4 Jun 2022 11:52:46 +0100 +Subject: ASoC: ops: Fix off by one in range control validation + +From: Mark Brown + +[ Upstream commit 5871321fb4558c55bf9567052b618ff0be6b975e ] + +We currently report that range controls accept a range of 0..(max-min) but +accept writes in the range 0..(max-min+1). Remove that extra +1. + +Signed-off-by: Mark Brown +Link: https://lore.kernel.org/r/20220604105246.4055214-1-broonie@kernel.org +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/soc-ops.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c +index e693070f51fe..d867f449d82d 100644 +--- a/sound/soc/soc-ops.c ++++ b/sound/soc/soc-ops.c +@@ -526,7 +526,7 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol, + return -EINVAL; + if (mc->platform_max && tmp > mc->platform_max) + return -EINVAL; +- if (tmp > mc->max - mc->min + 1) ++ if (tmp > mc->max - mc->min) + return -EINVAL; + + if (invert) +@@ -547,7 +547,7 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol, + return -EINVAL; + if (mc->platform_max && tmp > mc->platform_max) + return -EINVAL; +- if (tmp > mc->max - mc->min + 1) ++ if (tmp > mc->max - mc->min) + return -EINVAL; + + if (invert) +-- +2.35.1 + diff --git a/queue-5.18/asoc-realtek-maxim-soundwire-codecs-disable-pm_runti.patch b/queue-5.18/asoc-realtek-maxim-soundwire-codecs-disable-pm_runti.patch new file mode 100644 index 00000000000..17e6607fef3 --- /dev/null +++ b/queue-5.18/asoc-realtek-maxim-soundwire-codecs-disable-pm_runti.patch @@ -0,0 +1,304 @@ +From 42061674239f511237d6fb422d7c512c521018a4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 6 Jun 2022 15:37:46 -0500 +Subject: ASoC: Realtek/Maxim SoundWire codecs: disable pm_runtime on remove + +From: Pierre-Louis Bossart + +[ Upstream commit ac63716da3070f8cb6baaba3a058a0c7f22aeb5b ] + +When binding/unbinding codec drivers, the following warnings are +thrown: + +[ 107.266879] rt715-sdca sdw:3:025d:0714:01: Unbalanced pm_runtime_enable! +[ 306.879700] rt711-sdca sdw:0:025d:0711:01: Unbalanced pm_runtime_enable! + +Add a remove callback for all Realtek/Maxim SoundWire codecs and remove this +warning. + +Signed-off-by: Pierre-Louis Bossart +Reviewed-by: Rander Wang +Reviewed-by: Bard Liao +Link: https://lore.kernel.org/r/20220606203752.144159-2-pierre-louis.bossart@linux.intel.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/codecs/max98373-sdw.c | 12 +++++++++++- + sound/soc/codecs/rt1308-sdw.c | 11 +++++++++++ + sound/soc/codecs/rt1316-sdw.c | 11 +++++++++++ + sound/soc/codecs/rt5682-sdw.c | 5 ++++- + sound/soc/codecs/rt700-sdw.c | 6 +++++- + sound/soc/codecs/rt711-sdca-sdw.c | 6 +++++- + sound/soc/codecs/rt711-sdw.c | 6 +++++- + sound/soc/codecs/rt715-sdca-sdw.c | 12 ++++++++++++ + sound/soc/codecs/rt715-sdw.c | 12 ++++++++++++ + 9 files changed, 76 insertions(+), 5 deletions(-) + +diff --git a/sound/soc/codecs/max98373-sdw.c b/sound/soc/codecs/max98373-sdw.c +index f47e956d4f55..97b64477dde6 100644 +--- a/sound/soc/codecs/max98373-sdw.c ++++ b/sound/soc/codecs/max98373-sdw.c +@@ -862,6 +862,16 @@ static int max98373_sdw_probe(struct sdw_slave *slave, + return max98373_init(slave, regmap); + } + ++static int max98373_sdw_remove(struct sdw_slave *slave) ++{ ++ struct max98373_priv *max98373 = dev_get_drvdata(&slave->dev); ++ ++ if (max98373->first_hw_init) ++ pm_runtime_disable(&slave->dev); ++ ++ return 0; ++} ++ + #if defined(CONFIG_OF) + static const struct of_device_id max98373_of_match[] = { + { .compatible = "maxim,max98373", }, +@@ -893,7 +903,7 @@ static struct sdw_driver max98373_sdw_driver = { + .pm = &max98373_pm, + }, + .probe = max98373_sdw_probe, +- .remove = NULL, ++ .remove = max98373_sdw_remove, + .ops = &max98373_slave_ops, + .id_table = max98373_id, + }; +diff --git a/sound/soc/codecs/rt1308-sdw.c b/sound/soc/codecs/rt1308-sdw.c +index 1ef836a68a56..e42a63ee07f4 100644 +--- a/sound/soc/codecs/rt1308-sdw.c ++++ b/sound/soc/codecs/rt1308-sdw.c +@@ -690,6 +690,16 @@ static int rt1308_sdw_probe(struct sdw_slave *slave, + return 0; + } + ++static int rt1308_sdw_remove(struct sdw_slave *slave) ++{ ++ struct rt1308_sdw_priv *rt1308 = dev_get_drvdata(&slave->dev); ++ ++ if (rt1308->first_hw_init) ++ pm_runtime_disable(&slave->dev); ++ ++ return 0; ++} ++ + static const struct sdw_device_id rt1308_id[] = { + SDW_SLAVE_ENTRY_EXT(0x025d, 0x1308, 0x2, 0, 0), + {}, +@@ -749,6 +759,7 @@ static struct sdw_driver rt1308_sdw_driver = { + .pm = &rt1308_pm, + }, + .probe = rt1308_sdw_probe, ++ .remove = rt1308_sdw_remove, + .ops = &rt1308_slave_ops, + .id_table = rt1308_id, + }; +diff --git a/sound/soc/codecs/rt1316-sdw.c b/sound/soc/codecs/rt1316-sdw.c +index c66d7b20cb4d..1e04aa8ab166 100644 +--- a/sound/soc/codecs/rt1316-sdw.c ++++ b/sound/soc/codecs/rt1316-sdw.c +@@ -675,6 +675,16 @@ static int rt1316_sdw_probe(struct sdw_slave *slave, + return rt1316_sdw_init(&slave->dev, regmap, slave); + } + ++static int rt1316_sdw_remove(struct sdw_slave *slave) ++{ ++ struct rt1316_sdw_priv *rt1316 = dev_get_drvdata(&slave->dev); ++ ++ if (rt1316->first_hw_init) ++ pm_runtime_disable(&slave->dev); ++ ++ return 0; ++} ++ + static const struct sdw_device_id rt1316_id[] = { + SDW_SLAVE_ENTRY_EXT(0x025d, 0x1316, 0x3, 0x1, 0), + {}, +@@ -734,6 +744,7 @@ static struct sdw_driver rt1316_sdw_driver = { + .pm = &rt1316_pm, + }, + .probe = rt1316_sdw_probe, ++ .remove = rt1316_sdw_remove, + .ops = &rt1316_slave_ops, + .id_table = rt1316_id, + }; +diff --git a/sound/soc/codecs/rt5682-sdw.c b/sound/soc/codecs/rt5682-sdw.c +index 248257a2e4e0..f04e18c32489 100644 +--- a/sound/soc/codecs/rt5682-sdw.c ++++ b/sound/soc/codecs/rt5682-sdw.c +@@ -719,9 +719,12 @@ static int rt5682_sdw_remove(struct sdw_slave *slave) + { + struct rt5682_priv *rt5682 = dev_get_drvdata(&slave->dev); + +- if (rt5682 && rt5682->hw_init) ++ if (rt5682->hw_init) + cancel_delayed_work_sync(&rt5682->jack_detect_work); + ++ if (rt5682->first_hw_init) ++ pm_runtime_disable(&slave->dev); ++ + return 0; + } + +diff --git a/sound/soc/codecs/rt700-sdw.c b/sound/soc/codecs/rt700-sdw.c +index bda594899664..f7439e40ca8b 100644 +--- a/sound/soc/codecs/rt700-sdw.c ++++ b/sound/soc/codecs/rt700-sdw.c +@@ -13,6 +13,7 @@ + #include + #include + #include ++#include + #include + #include + #include "rt700.h" +@@ -463,11 +464,14 @@ static int rt700_sdw_remove(struct sdw_slave *slave) + { + struct rt700_priv *rt700 = dev_get_drvdata(&slave->dev); + +- if (rt700 && rt700->hw_init) { ++ if (rt700->hw_init) { + cancel_delayed_work_sync(&rt700->jack_detect_work); + cancel_delayed_work_sync(&rt700->jack_btn_check_work); + } + ++ if (rt700->first_hw_init) ++ pm_runtime_disable(&slave->dev); ++ + return 0; + } + +diff --git a/sound/soc/codecs/rt711-sdca-sdw.c b/sound/soc/codecs/rt711-sdca-sdw.c +index aaf5af153d3f..c722a2b0041f 100644 +--- a/sound/soc/codecs/rt711-sdca-sdw.c ++++ b/sound/soc/codecs/rt711-sdca-sdw.c +@@ -11,6 +11,7 @@ + #include + #include + #include ++#include + + #include "rt711-sdca.h" + #include "rt711-sdca-sdw.h" +@@ -364,11 +365,14 @@ static int rt711_sdca_sdw_remove(struct sdw_slave *slave) + { + struct rt711_sdca_priv *rt711 = dev_get_drvdata(&slave->dev); + +- if (rt711 && rt711->hw_init) { ++ if (rt711->hw_init) { + cancel_delayed_work_sync(&rt711->jack_detect_work); + cancel_delayed_work_sync(&rt711->jack_btn_check_work); + } + ++ if (rt711->first_hw_init) ++ pm_runtime_disable(&slave->dev); ++ + return 0; + } + +diff --git a/sound/soc/codecs/rt711-sdw.c b/sound/soc/codecs/rt711-sdw.c +index bda2cc9439c9..f49c94baa37c 100644 +--- a/sound/soc/codecs/rt711-sdw.c ++++ b/sound/soc/codecs/rt711-sdw.c +@@ -13,6 +13,7 @@ + #include + #include + #include ++#include + #include + #include + #include "rt711.h" +@@ -464,12 +465,15 @@ static int rt711_sdw_remove(struct sdw_slave *slave) + { + struct rt711_priv *rt711 = dev_get_drvdata(&slave->dev); + +- if (rt711 && rt711->hw_init) { ++ if (rt711->hw_init) { + cancel_delayed_work_sync(&rt711->jack_detect_work); + cancel_delayed_work_sync(&rt711->jack_btn_check_work); + cancel_work_sync(&rt711->calibration_work); + } + ++ if (rt711->first_hw_init) ++ pm_runtime_disable(&slave->dev); ++ + return 0; + } + +diff --git a/sound/soc/codecs/rt715-sdca-sdw.c b/sound/soc/codecs/rt715-sdca-sdw.c +index a5c673f43d82..0f4354eafef2 100644 +--- a/sound/soc/codecs/rt715-sdca-sdw.c ++++ b/sound/soc/codecs/rt715-sdca-sdw.c +@@ -13,6 +13,7 @@ + #include + #include + #include ++#include + #include + #include + #include "rt715-sdca.h" +@@ -195,6 +196,16 @@ static int rt715_sdca_sdw_probe(struct sdw_slave *slave, + return rt715_sdca_init(&slave->dev, mbq_regmap, regmap, slave); + } + ++static int rt715_sdca_sdw_remove(struct sdw_slave *slave) ++{ ++ struct rt715_sdca_priv *rt715 = dev_get_drvdata(&slave->dev); ++ ++ if (rt715->first_hw_init) ++ pm_runtime_disable(&slave->dev); ++ ++ return 0; ++} ++ + static const struct sdw_device_id rt715_sdca_id[] = { + SDW_SLAVE_ENTRY_EXT(0x025d, 0x715, 0x3, 0x1, 0), + SDW_SLAVE_ENTRY_EXT(0x025d, 0x714, 0x3, 0x1, 0), +@@ -269,6 +280,7 @@ static struct sdw_driver rt715_sdw_driver = { + .pm = &rt715_pm, + }, + .probe = rt715_sdca_sdw_probe, ++ .remove = rt715_sdca_sdw_remove, + .ops = &rt715_sdca_slave_ops, + .id_table = rt715_sdca_id, + }; +diff --git a/sound/soc/codecs/rt715-sdw.c b/sound/soc/codecs/rt715-sdw.c +index a7b21b03c08b..b047bf87a100 100644 +--- a/sound/soc/codecs/rt715-sdw.c ++++ b/sound/soc/codecs/rt715-sdw.c +@@ -14,6 +14,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -514,6 +515,16 @@ static int rt715_sdw_probe(struct sdw_slave *slave, + return 0; + } + ++static int rt715_sdw_remove(struct sdw_slave *slave) ++{ ++ struct rt715_priv *rt715 = dev_get_drvdata(&slave->dev); ++ ++ if (rt715->first_hw_init) ++ pm_runtime_disable(&slave->dev); ++ ++ return 0; ++} ++ + static const struct sdw_device_id rt715_id[] = { + SDW_SLAVE_ENTRY_EXT(0x025d, 0x714, 0x2, 0, 0), + SDW_SLAVE_ENTRY_EXT(0x025d, 0x715, 0x2, 0, 0), +@@ -575,6 +586,7 @@ static struct sdw_driver rt715_sdw_driver = { + .pm = &rt715_pm, + }, + .probe = rt715_sdw_probe, ++ .remove = rt715_sdw_remove, + .ops = &rt715_slave_ops, + .id_table = rt715_id, + }; +-- +2.35.1 + diff --git a/queue-5.18/asoc-rockchip-i2s-switch-bclk-to-gpio.patch b/queue-5.18/asoc-rockchip-i2s-switch-bclk-to-gpio.patch new file mode 100644 index 00000000000..6ccd48ac575 --- /dev/null +++ b/queue-5.18/asoc-rockchip-i2s-switch-bclk-to-gpio.patch @@ -0,0 +1,303 @@ +From 93e91684faaeb12f5a8d52d4352af28fd596a99e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 15 Jun 2022 04:56:43 +0000 +Subject: ASoC: rockchip: i2s: switch BCLK to GPIO + +From: Judy Hsiao + +[ Upstream commit a5450aba737dae3ee1a64b282e609d8375d6700c ] + +We discoverd that the state of BCLK on, LRCLK off and SD_MODE on +may cause the speaker melting issue. Removing LRCLK while BCLK +is present can cause unexpected output behavior including a large +DC output voltage as described in the Max98357a datasheet. + +In order to: + 1. prevent BCLK from turning on by other component. + 2. keep BCLK and LRCLK being present at the same time + +This patch switches BCLK to GPIO func before LRCLK output, and +configures BCLK func back during LRCLK is output. + +Without this fix, BCLK is turned on 11 ms earlier than LRCK by the +da7219. +With this fix, BCLK is turned on only 0.4 ms earlier than LRCK by +the rockchip codec. + +Signed-off-by: Judy Hsiao +Link: https://lore.kernel.org/r/20220615045643.3137287-1-judyhsiao@chromium.org +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/rockchip/rockchip_i2s.c | 160 ++++++++++++++++++++++++------ + 1 file changed, 129 insertions(+), 31 deletions(-) + +diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c +index 4ce5d2579387..99a128a666fb 100644 +--- a/sound/soc/rockchip/rockchip_i2s.c ++++ b/sound/soc/rockchip/rockchip_i2s.c +@@ -13,6 +13,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -54,8 +55,40 @@ struct rk_i2s_dev { + const struct rk_i2s_pins *pins; + unsigned int bclk_ratio; + spinlock_t lock; /* tx/rx lock */ ++ struct pinctrl *pinctrl; ++ struct pinctrl_state *bclk_on; ++ struct pinctrl_state *bclk_off; + }; + ++static int i2s_pinctrl_select_bclk_on(struct rk_i2s_dev *i2s) ++{ ++ int ret = 0; ++ ++ if (!IS_ERR(i2s->pinctrl) && !IS_ERR_OR_NULL(i2s->bclk_on)) ++ ret = pinctrl_select_state(i2s->pinctrl, ++ i2s->bclk_on); ++ ++ if (ret) ++ dev_err(i2s->dev, "bclk enable failed %d\n", ret); ++ ++ return ret; ++} ++ ++static int i2s_pinctrl_select_bclk_off(struct rk_i2s_dev *i2s) ++{ ++ ++ int ret = 0; ++ ++ if (!IS_ERR(i2s->pinctrl) && !IS_ERR_OR_NULL(i2s->bclk_off)) ++ ret = pinctrl_select_state(i2s->pinctrl, ++ i2s->bclk_off); ++ ++ if (ret) ++ dev_err(i2s->dev, "bclk disable failed %d\n", ret); ++ ++ return ret; ++} ++ + static int i2s_runtime_suspend(struct device *dev) + { + struct rk_i2s_dev *i2s = dev_get_drvdata(dev); +@@ -92,38 +125,49 @@ static inline struct rk_i2s_dev *to_info(struct snd_soc_dai *dai) + return snd_soc_dai_get_drvdata(dai); + } + +-static void rockchip_snd_txctrl(struct rk_i2s_dev *i2s, int on) ++static int rockchip_snd_txctrl(struct rk_i2s_dev *i2s, int on) + { + unsigned int val = 0; + int retry = 10; ++ int ret = 0; + + spin_lock(&i2s->lock); + if (on) { +- regmap_update_bits(i2s->regmap, I2S_DMACR, +- I2S_DMACR_TDE_ENABLE, I2S_DMACR_TDE_ENABLE); ++ ret = regmap_update_bits(i2s->regmap, I2S_DMACR, ++ I2S_DMACR_TDE_ENABLE, I2S_DMACR_TDE_ENABLE); ++ if (ret < 0) ++ goto end; + +- regmap_update_bits(i2s->regmap, I2S_XFER, +- I2S_XFER_TXS_START | I2S_XFER_RXS_START, +- I2S_XFER_TXS_START | I2S_XFER_RXS_START); ++ ret = regmap_update_bits(i2s->regmap, I2S_XFER, ++ I2S_XFER_TXS_START | I2S_XFER_RXS_START, ++ I2S_XFER_TXS_START | I2S_XFER_RXS_START); ++ if (ret < 0) ++ goto end; + + i2s->tx_start = true; + } else { + i2s->tx_start = false; + +- regmap_update_bits(i2s->regmap, I2S_DMACR, +- I2S_DMACR_TDE_ENABLE, I2S_DMACR_TDE_DISABLE); ++ ret = regmap_update_bits(i2s->regmap, I2S_DMACR, ++ I2S_DMACR_TDE_ENABLE, I2S_DMACR_TDE_DISABLE); ++ if (ret < 0) ++ goto end; + + if (!i2s->rx_start) { +- regmap_update_bits(i2s->regmap, I2S_XFER, +- I2S_XFER_TXS_START | +- I2S_XFER_RXS_START, +- I2S_XFER_TXS_STOP | +- I2S_XFER_RXS_STOP); ++ ret = regmap_update_bits(i2s->regmap, I2S_XFER, ++ I2S_XFER_TXS_START | ++ I2S_XFER_RXS_START, ++ I2S_XFER_TXS_STOP | ++ I2S_XFER_RXS_STOP); ++ if (ret < 0) ++ goto end; + + udelay(150); +- regmap_update_bits(i2s->regmap, I2S_CLR, +- I2S_CLR_TXC | I2S_CLR_RXC, +- I2S_CLR_TXC | I2S_CLR_RXC); ++ ret = regmap_update_bits(i2s->regmap, I2S_CLR, ++ I2S_CLR_TXC | I2S_CLR_RXC, ++ I2S_CLR_TXC | I2S_CLR_RXC); ++ if (ret < 0) ++ goto end; + + regmap_read(i2s->regmap, I2S_CLR, &val); + +@@ -138,44 +182,57 @@ static void rockchip_snd_txctrl(struct rk_i2s_dev *i2s, int on) + } + } + } ++end: + spin_unlock(&i2s->lock); ++ if (ret < 0) ++ dev_err(i2s->dev, "lrclk update failed\n"); ++ ++ return ret; + } + +-static void rockchip_snd_rxctrl(struct rk_i2s_dev *i2s, int on) ++static int rockchip_snd_rxctrl(struct rk_i2s_dev *i2s, int on) + { + unsigned int val = 0; + int retry = 10; ++ int ret = 0; + + spin_lock(&i2s->lock); + if (on) { +- regmap_update_bits(i2s->regmap, I2S_DMACR, ++ ret = regmap_update_bits(i2s->regmap, I2S_DMACR, + I2S_DMACR_RDE_ENABLE, I2S_DMACR_RDE_ENABLE); ++ if (ret < 0) ++ goto end; + +- regmap_update_bits(i2s->regmap, I2S_XFER, ++ ret = regmap_update_bits(i2s->regmap, I2S_XFER, + I2S_XFER_TXS_START | I2S_XFER_RXS_START, + I2S_XFER_TXS_START | I2S_XFER_RXS_START); ++ if (ret < 0) ++ goto end; + + i2s->rx_start = true; + } else { + i2s->rx_start = false; + +- regmap_update_bits(i2s->regmap, I2S_DMACR, ++ ret = regmap_update_bits(i2s->regmap, I2S_DMACR, + I2S_DMACR_RDE_ENABLE, I2S_DMACR_RDE_DISABLE); ++ if (ret < 0) ++ goto end; + + if (!i2s->tx_start) { +- regmap_update_bits(i2s->regmap, I2S_XFER, ++ ret = regmap_update_bits(i2s->regmap, I2S_XFER, + I2S_XFER_TXS_START | + I2S_XFER_RXS_START, + I2S_XFER_TXS_STOP | + I2S_XFER_RXS_STOP); +- ++ if (ret < 0) ++ goto end; + udelay(150); +- regmap_update_bits(i2s->regmap, I2S_CLR, ++ ret = regmap_update_bits(i2s->regmap, I2S_CLR, + I2S_CLR_TXC | I2S_CLR_RXC, + I2S_CLR_TXC | I2S_CLR_RXC); +- ++ if (ret < 0) ++ goto end; + regmap_read(i2s->regmap, I2S_CLR, &val); +- + /* Should wait for clear operation to finish */ + while (val) { + regmap_read(i2s->regmap, I2S_CLR, &val); +@@ -187,7 +244,12 @@ static void rockchip_snd_rxctrl(struct rk_i2s_dev *i2s, int on) + } + } + } ++end: + spin_unlock(&i2s->lock); ++ if (ret < 0) ++ dev_err(i2s->dev, "lrclk update failed\n"); ++ ++ return ret; + } + + static int rockchip_i2s_set_fmt(struct snd_soc_dai *cpu_dai, +@@ -425,17 +487,26 @@ static int rockchip_i2s_trigger(struct snd_pcm_substream *substream, + case SNDRV_PCM_TRIGGER_RESUME: + case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: + if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) +- rockchip_snd_rxctrl(i2s, 1); ++ ret = rockchip_snd_rxctrl(i2s, 1); + else +- rockchip_snd_txctrl(i2s, 1); ++ ret = rockchip_snd_txctrl(i2s, 1); ++ /* Do not turn on bclk if lrclk open fails. */ ++ if (ret < 0) ++ return ret; ++ i2s_pinctrl_select_bclk_on(i2s); + break; + case SNDRV_PCM_TRIGGER_SUSPEND: + case SNDRV_PCM_TRIGGER_STOP: + case SNDRV_PCM_TRIGGER_PAUSE_PUSH: +- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) +- rockchip_snd_rxctrl(i2s, 0); +- else +- rockchip_snd_txctrl(i2s, 0); ++ if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { ++ if (!i2s->tx_start) ++ i2s_pinctrl_select_bclk_off(i2s); ++ ret = rockchip_snd_rxctrl(i2s, 0); ++ } else { ++ if (!i2s->rx_start) ++ i2s_pinctrl_select_bclk_off(i2s); ++ ret = rockchip_snd_txctrl(i2s, 0); ++ } + break; + default: + ret = -EINVAL; +@@ -736,6 +807,33 @@ static int rockchip_i2s_probe(struct platform_device *pdev) + } + + i2s->bclk_ratio = 64; ++ i2s->pinctrl = devm_pinctrl_get(&pdev->dev); ++ if (IS_ERR(i2s->pinctrl)) ++ dev_err(&pdev->dev, "failed to find i2s pinctrl\n"); ++ ++ i2s->bclk_on = pinctrl_lookup_state(i2s->pinctrl, ++ "bclk_on"); ++ if (IS_ERR_OR_NULL(i2s->bclk_on)) ++ dev_err(&pdev->dev, "failed to find i2s default state\n"); ++ else ++ dev_dbg(&pdev->dev, "find i2s bclk state\n"); ++ ++ i2s->bclk_off = pinctrl_lookup_state(i2s->pinctrl, ++ "bclk_off"); ++ if (IS_ERR_OR_NULL(i2s->bclk_off)) ++ dev_err(&pdev->dev, "failed to find i2s gpio state\n"); ++ else ++ dev_dbg(&pdev->dev, "find i2s bclk_off state\n"); ++ ++ i2s_pinctrl_select_bclk_off(i2s); ++ ++ i2s->playback_dma_data.addr = res->start + I2S_TXDR; ++ i2s->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; ++ i2s->playback_dma_data.maxburst = 4; ++ ++ i2s->capture_dma_data.addr = res->start + I2S_RXDR; ++ i2s->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; ++ i2s->capture_dma_data.maxburst = 4; + + dev_set_drvdata(&pdev->dev, i2s); + +-- +2.35.1 + diff --git a/queue-5.18/asoc-rt7-sdw-harden-jack_detect_handler.patch b/queue-5.18/asoc-rt7-sdw-harden-jack_detect_handler.patch new file mode 100644 index 00000000000..c1d65ca176d --- /dev/null +++ b/queue-5.18/asoc-rt7-sdw-harden-jack_detect_handler.patch @@ -0,0 +1,70 @@ +From 5e7b647c8e2404967f5c28c450c14377e2f44f5c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 6 Jun 2022 15:37:50 -0500 +Subject: ASoC: rt7*-sdw: harden jack_detect_handler + +From: Pierre-Louis Bossart + +[ Upstream commit 0484271ab0ce50649329fa9dc23c50853c5b26a4 ] + +Realtek headset codec drivers typically check if the card is +instantiated before proceeding with the jack detection. + +The rt700, rt711 and rt711-sdca are however missing a check on the +card pointer, which can lead to NULL dereferences encountered in +driver bind/unbind tests. + +Signed-off-by: Pierre-Louis Bossart +Reviewed-by: Rander Wang +Reviewed-by: Bard Liao +Link: https://lore.kernel.org/r/20220606203752.144159-6-pierre-louis.bossart@linux.intel.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/codecs/rt700.c | 2 +- + sound/soc/codecs/rt711-sdca.c | 2 +- + sound/soc/codecs/rt711.c | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/sound/soc/codecs/rt700.c b/sound/soc/codecs/rt700.c +index 360d61a36c35..b16fbde02986 100644 +--- a/sound/soc/codecs/rt700.c ++++ b/sound/soc/codecs/rt700.c +@@ -162,7 +162,7 @@ static void rt700_jack_detect_handler(struct work_struct *work) + if (!rt700->hs_jack) + return; + +- if (!rt700->component->card->instantiated) ++ if (!rt700->component->card || !rt700->component->card->instantiated) + return; + + reg = RT700_VERB_GET_PIN_SENSE | RT700_HP_OUT; +diff --git a/sound/soc/codecs/rt711-sdca.c b/sound/soc/codecs/rt711-sdca.c +index 8a0b74d3fa9e..83e4c4e4d1e2 100644 +--- a/sound/soc/codecs/rt711-sdca.c ++++ b/sound/soc/codecs/rt711-sdca.c +@@ -294,7 +294,7 @@ static void rt711_sdca_jack_detect_handler(struct work_struct *work) + if (!rt711->hs_jack) + return; + +- if (!rt711->component->card->instantiated) ++ if (!rt711->component->card || !rt711->component->card->instantiated) + return; + + /* SDW_SCP_SDCA_INT_SDCA_0 is used for jack detection */ +diff --git a/sound/soc/codecs/rt711.c b/sound/soc/codecs/rt711.c +index db70d8073c0b..18a0de77c477 100644 +--- a/sound/soc/codecs/rt711.c ++++ b/sound/soc/codecs/rt711.c +@@ -242,7 +242,7 @@ static void rt711_jack_detect_handler(struct work_struct *work) + if (!rt711->hs_jack) + return; + +- if (!rt711->component->card->instantiated) ++ if (!rt711->component->card || !rt711->component->card->instantiated) + return; + + if (pm_runtime_status_suspended(rt711->slave->dev.parent)) { +-- +2.35.1 + diff --git a/queue-5.18/asoc-rt711-fix-calibrate-mutex-initialization.patch b/queue-5.18/asoc-rt711-fix-calibrate-mutex-initialization.patch new file mode 100644 index 00000000000..00e6d7f518b --- /dev/null +++ b/queue-5.18/asoc-rt711-fix-calibrate-mutex-initialization.patch @@ -0,0 +1,60 @@ +From 45e987c1f82746dfcae9fe644fb7f02ddc4001e8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 6 Jun 2022 15:37:49 -0500 +Subject: ASoC: rt711: fix calibrate mutex initialization + +From: Pierre-Louis Bossart + +[ Upstream commit 08bb5dc6ce02374169213cea772b1c297eaf32d5 ] + +Follow the same flow as rt711-sdca and initialize all mutexes at probe +time. + +Signed-off-by: Pierre-Louis Bossart +Reviewed-by: Rander Wang +Reviewed-by: Bard Liao +Link: https://lore.kernel.org/r/20220606203752.144159-5-pierre-louis.bossart@linux.intel.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/codecs/rt711-sdw.c | 3 +++ + sound/soc/codecs/rt711.c | 2 +- + 2 files changed, 4 insertions(+), 1 deletion(-) + +diff --git a/sound/soc/codecs/rt711-sdw.c b/sound/soc/codecs/rt711-sdw.c +index f49c94baa37c..4fe68bcf2a7c 100644 +--- a/sound/soc/codecs/rt711-sdw.c ++++ b/sound/soc/codecs/rt711-sdw.c +@@ -474,6 +474,9 @@ static int rt711_sdw_remove(struct sdw_slave *slave) + if (rt711->first_hw_init) + pm_runtime_disable(&slave->dev); + ++ mutex_destroy(&rt711->calibrate_mutex); ++ mutex_destroy(&rt711->disable_irq_lock); ++ + return 0; + } + +diff --git a/sound/soc/codecs/rt711.c b/sound/soc/codecs/rt711.c +index 9958067e80f1..db70d8073c0b 100644 +--- a/sound/soc/codecs/rt711.c ++++ b/sound/soc/codecs/rt711.c +@@ -1206,6 +1206,7 @@ int rt711_init(struct device *dev, struct regmap *sdw_regmap, + rt711->sdw_regmap = sdw_regmap; + rt711->regmap = regmap; + ++ mutex_init(&rt711->calibrate_mutex); + mutex_init(&rt711->disable_irq_lock); + + /* +@@ -1320,7 +1321,6 @@ int rt711_io_init(struct device *dev, struct sdw_slave *slave) + rt711_jack_detect_handler); + INIT_DELAYED_WORK(&rt711->jack_btn_check_work, + rt711_btn_check_handler); +- mutex_init(&rt711->calibrate_mutex); + INIT_WORK(&rt711->calibration_work, rt711_calibration_work); + schedule_work(&rt711->calibration_work); + } +-- +2.35.1 + diff --git a/queue-5.18/asoc-rt711-sdca-fix-kernel-null-pointer-dereference-.patch b/queue-5.18/asoc-rt711-sdca-fix-kernel-null-pointer-dereference-.patch new file mode 100644 index 00000000000..31d91b95514 --- /dev/null +++ b/queue-5.18/asoc-rt711-sdca-fix-kernel-null-pointer-dereference-.patch @@ -0,0 +1,47 @@ +From b92d4928eefd127fb0bb042b40f878e759f371e6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 21 Jun 2022 17:07:19 +0800 +Subject: ASoC: rt711-sdca: fix kernel NULL pointer dereference when IO error + +From: Shuming Fan + +[ Upstream commit 1df793d479bef546569fc2e409ff8bb3f0fb8e99 ] + +The initial settings will be written before the codec probe function. +But, the rt711->component doesn't be assigned yet. +If IO error happened during initial settings operations, it will cause the kernel panic. +This patch changed component->dev to slave->dev to fix this issue. + +Signed-off-by: Shuming Fan +Link: https://lore.kernel.org/r/20220621090719.30558-1-shumingf@realtek.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/codecs/rt711-sdca.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/sound/soc/codecs/rt711-sdca.c b/sound/soc/codecs/rt711-sdca.c +index dfe3c9299ebd..5ad53bbc8528 100644 +--- a/sound/soc/codecs/rt711-sdca.c ++++ b/sound/soc/codecs/rt711-sdca.c +@@ -34,7 +34,7 @@ static int rt711_sdca_index_write(struct rt711_sdca_priv *rt711, + + ret = regmap_write(regmap, addr, value); + if (ret < 0) +- dev_err(rt711->component->dev, ++ dev_err(&rt711->slave->dev, + "Failed to set private value: %06x <= %04x ret=%d\n", + addr, value, ret); + +@@ -50,7 +50,7 @@ static int rt711_sdca_index_read(struct rt711_sdca_priv *rt711, + + ret = regmap_read(regmap, addr, value); + if (ret < 0) +- dev_err(rt711->component->dev, ++ dev_err(&rt711->slave->dev, + "Failed to get private value: %06x => %04x ret=%d\n", + addr, *value, ret); + +-- +2.35.1 + diff --git a/queue-5.18/asoc-rt711-sdca-sdw-fix-calibrate-mutex-initializati.patch b/queue-5.18/asoc-rt711-sdca-sdw-fix-calibrate-mutex-initializati.patch new file mode 100644 index 00000000000..ac3ab87e4cc --- /dev/null +++ b/queue-5.18/asoc-rt711-sdca-sdw-fix-calibrate-mutex-initializati.patch @@ -0,0 +1,70 @@ +From 27bbd358eabd6d79358597551a0d282a2cd5088c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 6 Jun 2022 15:37:47 -0500 +Subject: ASoC: rt711-sdca-sdw: fix calibrate mutex initialization + +From: Pierre-Louis Bossart + +[ Upstream commit ed0a7fb29c9fd4f53eeb37d1fe2354df7a038047 ] + +In codec driver bind/unbind test, the following warning is thrown: + +DEBUG_LOCKS_WARN_ON(lock->magic != lock) +... +[ 699.182495] rt711_sdca_jack_init+0x1b/0x1d0 [snd_soc_rt711_sdca] +[ 699.182498] rt711_sdca_set_jack_detect+0x3b/0x90 [snd_soc_rt711_sdca] +[ 699.182500] snd_soc_component_set_jack+0x24/0x50 [snd_soc_core] + +A quick check in the code shows that the 'calibrate_mutex' used by +this driver are not initialized at probe time. Moving the +initialization to the probe removes the issue. + +BugLink: https://github.com/thesofproject/linux/issues/3644 +Signed-off-by: Pierre-Louis Bossart +Reviewed-by: Rander Wang +Reviewed-by: Bard Liao +Link: https://lore.kernel.org/r/20220606203752.144159-3-pierre-louis.bossart@linux.intel.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/codecs/rt711-sdca-sdw.c | 3 +++ + sound/soc/codecs/rt711-sdca.c | 2 +- + 2 files changed, 4 insertions(+), 1 deletion(-) + +diff --git a/sound/soc/codecs/rt711-sdca-sdw.c b/sound/soc/codecs/rt711-sdca-sdw.c +index c722a2b0041f..a085b2f530aa 100644 +--- a/sound/soc/codecs/rt711-sdca-sdw.c ++++ b/sound/soc/codecs/rt711-sdca-sdw.c +@@ -373,6 +373,9 @@ static int rt711_sdca_sdw_remove(struct sdw_slave *slave) + if (rt711->first_hw_init) + pm_runtime_disable(&slave->dev); + ++ mutex_destroy(&rt711->calibrate_mutex); ++ mutex_destroy(&rt711->disable_irq_lock); ++ + return 0; + } + +diff --git a/sound/soc/codecs/rt711-sdca.c b/sound/soc/codecs/rt711-sdca.c +index 9d59e653b941..8a0b74d3fa9e 100644 +--- a/sound/soc/codecs/rt711-sdca.c ++++ b/sound/soc/codecs/rt711-sdca.c +@@ -1414,6 +1414,7 @@ int rt711_sdca_init(struct device *dev, struct regmap *regmap, + rt711->regmap = regmap; + rt711->mbq_regmap = mbq_regmap; + ++ mutex_init(&rt711->calibrate_mutex); + mutex_init(&rt711->disable_irq_lock); + + /* +@@ -1552,7 +1553,6 @@ int rt711_sdca_io_init(struct device *dev, struct sdw_slave *slave) + rt711_sdca_jack_detect_handler); + INIT_DELAYED_WORK(&rt711->jack_btn_check_work, + rt711_sdca_btn_check_handler); +- mutex_init(&rt711->calibrate_mutex); + } + + /* calibration */ +-- +2.35.1 + diff --git a/queue-5.18/asoc-sof-intel-hda-dsp-expose-hda_dsp_core_power_up.patch b/queue-5.18/asoc-sof-intel-hda-dsp-expose-hda_dsp_core_power_up.patch new file mode 100644 index 00000000000..f073472acd1 --- /dev/null +++ b/queue-5.18/asoc-sof-intel-hda-dsp-expose-hda_dsp_core_power_up.patch @@ -0,0 +1,70 @@ +From 8f9ecd99ddea191041c84b43207acaff4baeb9f4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 9 Jun 2022 11:59:47 +0300 +Subject: ASoC: SOF: Intel: hda-dsp: Expose hda_dsp_core_power_up() + +From: Peter Ujfalusi + +[ Upstream commit 08f8a93198e300dff9649bbae424cd805d313326 ] + +The hda_dsp_core_power_up() needs to be exposed so that it can be used in +hda-loader.c to correct the boot flow. +The first step must not unstall the core, it should only power up the +core(s). + +Add sanity check for the core_mask while exposing it to be safe. + +Complements: 2a68ff846164 ("ASoC: SOF: Intel: hda: Revisit IMR boot sequence") +Signed-off-by: Peter Ujfalusi +Reviewed-by: Pierre-Louis Bossart +Reviewed-by: Bard Liao +Reviewed-by: Ranjani Sridharan +Link: https://lore.kernel.org/r/20220609085949.29062-2-peter.ujfalusi@linux.intel.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/sof/intel/hda-dsp.c | 10 +++++++++- + sound/soc/sof/intel/hda.h | 1 + + 2 files changed, 10 insertions(+), 1 deletion(-) + +diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c +index 8ddde60c56b3..68a8074c956a 100644 +--- a/sound/soc/sof/intel/hda-dsp.c ++++ b/sound/soc/sof/intel/hda-dsp.c +@@ -181,12 +181,20 @@ int hda_dsp_core_run(struct snd_sof_dev *sdev, unsigned int core_mask) + * Power Management. + */ + +-static int hda_dsp_core_power_up(struct snd_sof_dev *sdev, unsigned int core_mask) ++int hda_dsp_core_power_up(struct snd_sof_dev *sdev, unsigned int core_mask) + { ++ struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; ++ const struct sof_intel_dsp_desc *chip = hda->desc; + unsigned int cpa; + u32 adspcs; + int ret; + ++ /* restrict core_mask to host managed cores mask */ ++ core_mask &= chip->host_managed_cores_mask; ++ /* return if core_mask is not valid */ ++ if (!core_mask) ++ return 0; ++ + /* update bits */ + snd_sof_dsp_update_bits(sdev, HDA_DSP_BAR, HDA_DSP_REG_ADSPCS, + HDA_DSP_ADSPCS_SPA_MASK(core_mask), +diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h +index 196494ba1245..db066d094afa 100644 +--- a/sound/soc/sof/intel/hda.h ++++ b/sound/soc/sof/intel/hda.h +@@ -490,6 +490,7 @@ struct sof_intel_hda_stream { + */ + int hda_dsp_probe(struct snd_sof_dev *sdev); + int hda_dsp_remove(struct snd_sof_dev *sdev); ++int hda_dsp_core_power_up(struct snd_sof_dev *sdev, unsigned int core_mask); + int hda_dsp_core_run(struct snd_sof_dev *sdev, unsigned int core_mask); + int hda_dsp_enable_core(struct snd_sof_dev *sdev, unsigned int core_mask); + int hda_dsp_core_reset_power_down(struct snd_sof_dev *sdev, +-- +2.35.1 + diff --git a/queue-5.18/asoc-sof-intel-hda-loader-clarify-the-cl_dsp_init-fl.patch b/queue-5.18/asoc-sof-intel-hda-loader-clarify-the-cl_dsp_init-fl.patch new file mode 100644 index 00000000000..b936e883e0b --- /dev/null +++ b/queue-5.18/asoc-sof-intel-hda-loader-clarify-the-cl_dsp_init-fl.patch @@ -0,0 +1,54 @@ +From 893be051d24333aec51c4f5af99e85bf6ad86f52 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 9 Jun 2022 11:59:49 +0300 +Subject: ASoC: SOF: Intel: hda-loader: Clarify the cl_dsp_init() flow + +From: Peter Ujfalusi + +[ Upstream commit bbfef046c6613404c01aeb9e9928bebb78dd327a ] + +Update the comment for the cl_dsp_init() to clarify what is done by the +function and use the chip->init_core_mask instead of BIT(0) when +unstalling/running the init core. + +Complements: 2a68ff846164 ("ASoC: SOF: Intel: hda: Revisit IMR boot sequence") +Signed-off-by: Peter Ujfalusi +Reviewed-by: Pierre-Louis Bossart +Reviewed-by: Bard Liao +Reviewed-by: Ranjani Sridharan +Link: https://lore.kernel.org/r/20220609085949.29062-4-peter.ujfalusi@linux.intel.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/sof/intel/hda-loader.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/sound/soc/sof/intel/hda-loader.c b/sound/soc/sof/intel/hda-loader.c +index 9f624a84182b..88d23924e1bf 100644 +--- a/sound/soc/sof/intel/hda-loader.c ++++ b/sound/soc/sof/intel/hda-loader.c +@@ -97,9 +97,9 @@ static struct hdac_ext_stream *cl_stream_prepare(struct snd_sof_dev *sdev, unsig + } + + /* +- * first boot sequence has some extra steps. core 0 waits for power +- * status on core 1, so power up core 1 also momentarily, keep it in +- * reset/stall and then turn it off ++ * first boot sequence has some extra steps. ++ * power on all host managed cores and only unstall/run the boot core to boot the ++ * DSP then turn off all non boot cores (if any) is powered on. + */ + static int cl_dsp_init(struct snd_sof_dev *sdev, int stream_tag) + { +@@ -127,7 +127,7 @@ static int cl_dsp_init(struct snd_sof_dev *sdev, int stream_tag) + ((stream_tag - 1) << 9))); + + /* step 3: unset core 0 reset state & unstall/run core 0 */ +- ret = hda_dsp_core_run(sdev, BIT(0)); ++ ret = hda_dsp_core_run(sdev, chip->init_core_mask); + if (ret < 0) { + if (hda->boot_iteration == HDA_FW_BOOT_ATTEMPTS) + dev_err(sdev->dev, +-- +2.35.1 + diff --git a/queue-5.18/asoc-sof-intel-hda-loader-make-sure-that-the-fw-load.patch b/queue-5.18/asoc-sof-intel-hda-loader-make-sure-that-the-fw-load.patch new file mode 100644 index 00000000000..51519a1562f --- /dev/null +++ b/queue-5.18/asoc-sof-intel-hda-loader-make-sure-that-the-fw-load.patch @@ -0,0 +1,44 @@ +From 7c519137d1bfb00e4171c1d489ef31fe1693fc5c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 9 Jun 2022 11:59:48 +0300 +Subject: ASoC: SOF: Intel: hda-loader: Make sure that the fw load sequence is + followed + +From: Peter Ujfalusi + +[ Upstream commit c31691e0d126ec5d60d2b6b03f699c11b613b219 ] + +The hda_dsp_enable_core() is powering up _and_ unstall the core in one +call while the first step of the firmware loading must not unstall the +core. +The core can be unstalled only after the set cpb_cfp and the configuration +of the IPC register for the ROM_CONTROL message. + +Complements: 2a68ff846164 ("ASoC: SOF: Intel: hda: Revisit IMR boot sequence") +Signed-off-by: Peter Ujfalusi +Reviewed-by: Pierre-Louis Bossart +Reviewed-by: Bard Liao +Reviewed-by: Ranjani Sridharan +Link: https://lore.kernel.org/r/20220609085949.29062-3-peter.ujfalusi@linux.intel.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/sof/intel/hda-loader.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sound/soc/sof/intel/hda-loader.c b/sound/soc/sof/intel/hda-loader.c +index 2ac5d9d0719b..9f624a84182b 100644 +--- a/sound/soc/sof/intel/hda-loader.c ++++ b/sound/soc/sof/intel/hda-loader.c +@@ -112,7 +112,7 @@ static int cl_dsp_init(struct snd_sof_dev *sdev, int stream_tag) + int ret; + + /* step 1: power up corex */ +- ret = hda_dsp_enable_core(sdev, chip->host_managed_cores_mask); ++ ret = hda_dsp_core_power_up(sdev, chip->host_managed_cores_mask); + if (ret < 0) { + if (hda->boot_iteration == HDA_FW_BOOT_ATTEMPTS) + dev_err(sdev->dev, "error: dsp core 0/1 power up failed\n"); +-- +2.35.1 + diff --git a/queue-5.18/asoc-wcd9335-fix-spurious-event-generation.patch b/queue-5.18/asoc-wcd9335-fix-spurious-event-generation.patch new file mode 100644 index 00000000000..c2a720e3196 --- /dev/null +++ b/queue-5.18/asoc-wcd9335-fix-spurious-event-generation.patch @@ -0,0 +1,38 @@ +From d8d3b8fbbaf492d3c8dfe4f9fab2e5bedcbf75a7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 3 Jun 2022 14:46:09 +0200 +Subject: ASoC: wcd9335: Fix spurious event generation + +From: Mark Brown + +[ Upstream commit a7786cbae4b2732815da98efa39df96746b5bd0d ] + +The slimbus mux put operation unconditionally reports a change in value +which means that spurious events are generated. Fix this by exiting early +in that case. + +Signed-off-by: Mark Brown +Link: https://lore.kernel.org/r/20220603124609.4024666-1-broonie@kernel.org +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/codecs/wcd9335.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/sound/soc/codecs/wcd9335.c b/sound/soc/codecs/wcd9335.c +index 12be043ee9a3..aa685980a97b 100644 +--- a/sound/soc/codecs/wcd9335.c ++++ b/sound/soc/codecs/wcd9335.c +@@ -1287,6 +1287,9 @@ static int slim_rx_mux_put(struct snd_kcontrol *kc, + struct snd_soc_dapm_update *update = NULL; + u32 port_id = w->shift; + ++ if (wcd->rx_port_value[port_id] == ucontrol->value.enumerated.item[0]) ++ return 0; ++ + wcd->rx_port_value[port_id] = ucontrol->value.enumerated.item[0]; + + /* Remove channel from any list it's in before adding it to a new one */ +-- +2.35.1 + diff --git a/queue-5.18/asoc-wcd9335-remove-rx-channel-from-old-list-before-.patch b/queue-5.18/asoc-wcd9335-remove-rx-channel-from-old-list-before-.patch new file mode 100644 index 00000000000..6e7631c273f --- /dev/null +++ b/queue-5.18/asoc-wcd9335-remove-rx-channel-from-old-list-before-.patch @@ -0,0 +1,47 @@ +From 35696088702150e5ee4e9fef16a8efabbf5d7223 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 6 Jun 2022 19:22:26 +0400 +Subject: ASoC: wcd9335: Remove RX channel from old list before adding it to a + new one + +From: Yassine Oudjana + +[ Upstream commit be6dd72edb216f20fc80e426ece9fe9b8aabf033 ] + +Currently in slim_rx_mux_put, an RX channel gets added to a new list +even if it is already in one. This can mess up links and make either +it, the new list head, or both, get linked to the wrong entries. +This can cause an entry to link to itself which in turn ends up +making list_for_each_entry in other functions loop infinitely. +To avoid issues, always remove the RX channel from any list it's in +before adding it to a new list. + +Signed-off-by: Yassine Oudjana +Link: https://lore.kernel.org/r/20220606152226.149164-1-y.oudjana@protonmail.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/codecs/wcd9335.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/sound/soc/codecs/wcd9335.c b/sound/soc/codecs/wcd9335.c +index 1e60db4056ad..12be043ee9a3 100644 +--- a/sound/soc/codecs/wcd9335.c ++++ b/sound/soc/codecs/wcd9335.c +@@ -1289,9 +1289,12 @@ static int slim_rx_mux_put(struct snd_kcontrol *kc, + + wcd->rx_port_value[port_id] = ucontrol->value.enumerated.item[0]; + ++ /* Remove channel from any list it's in before adding it to a new one */ ++ list_del_init(&wcd->rx_chs[port_id].list); ++ + switch (wcd->rx_port_value[port_id]) { + case 0: +- list_del_init(&wcd->rx_chs[port_id].list); ++ /* Channel already removed from lists. Nothing to do here */ + break; + case 1: + list_add_tail(&wcd->rx_chs[port_id].list, +-- +2.35.1 + diff --git a/queue-5.18/asoc-wcd938x-fix-event-generation-for-some-controls.patch b/queue-5.18/asoc-wcd938x-fix-event-generation-for-some-controls.patch new file mode 100644 index 00000000000..f7fd4817898 --- /dev/null +++ b/queue-5.18/asoc-wcd938x-fix-event-generation-for-some-controls.patch @@ -0,0 +1,70 @@ +From 8a4a3118a3ab5c3663996413ac8596af91fd1840 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 3 Jun 2022 14:25:26 +0200 +Subject: ASoC: wcd938x: Fix event generation for some controls + +From: Mark Brown + +[ Upstream commit 10e7ff0047921e32b919ecee7be706dd33c107f8 ] + +Currently wcd938x_*_put() unconditionally report that the value of the +control changed, resulting in spurious events being generated. Return 0 in +that case instead as we should. There is still an issue in the compander +control which is a bit more complex. + +Signed-off-by: Mark Brown +Reported-by: kernel test robot +Link: https://lore.kernel.org/r/20220603122526.3914942-1-broonie@kernel.org +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/codecs/wcd938x.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/sound/soc/codecs/wcd938x.c b/sound/soc/codecs/wcd938x.c +index 898b2887fa63..088cfda767cc 100644 +--- a/sound/soc/codecs/wcd938x.c ++++ b/sound/soc/codecs/wcd938x.c +@@ -2519,6 +2519,9 @@ static int wcd938x_tx_mode_put(struct snd_kcontrol *kcontrol, + struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; + int path = e->shift_l; + ++ if (wcd938x->tx_mode[path] == ucontrol->value.enumerated.item[0]) ++ return 0; ++ + wcd938x->tx_mode[path] = ucontrol->value.enumerated.item[0]; + + return 1; +@@ -2541,6 +2544,9 @@ static int wcd938x_rx_hph_mode_put(struct snd_kcontrol *kcontrol, + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); + struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); + ++ if (wcd938x->hph_mode == ucontrol->value.enumerated.item[0]) ++ return 0; ++ + wcd938x->hph_mode = ucontrol->value.enumerated.item[0]; + + return 1; +@@ -2632,6 +2638,9 @@ static int wcd938x_ldoh_put(struct snd_kcontrol *kcontrol, + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); + struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); + ++ if (wcd938x->ldoh == ucontrol->value.integer.value[0]) ++ return 0; ++ + wcd938x->ldoh = ucontrol->value.integer.value[0]; + + return 1; +@@ -2654,6 +2663,9 @@ static int wcd938x_bcs_put(struct snd_kcontrol *kcontrol, + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); + struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); + ++ if (wcd938x->bcs_dis == ucontrol->value.integer.value[0]) ++ return 0; ++ + wcd938x->bcs_dis = ucontrol->value.integer.value[0]; + + return 1; +-- +2.35.1 + diff --git a/queue-5.18/asoc-wm5110-fix-dre-control.patch b/queue-5.18/asoc-wm5110-fix-dre-control.patch new file mode 100644 index 00000000000..13a95d19de6 --- /dev/null +++ b/queue-5.18/asoc-wm5110-fix-dre-control.patch @@ -0,0 +1,56 @@ +From 33e6782b47f64a7c0742af2555f97d6f197e4a80 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 21 Jun 2022 11:20:39 +0100 +Subject: ASoC: wm5110: Fix DRE control + +From: Charles Keepax + +[ Upstream commit 0bc0ae9a5938d512fd5d44f11c9c04892dcf4961 ] + +The DRE controls on wm5110 should return a value of 1 if the DRE state +is actually changed, update to fix this. + +Signed-off-by: Charles Keepax +Link: https://lore.kernel.org/r/20220621102041.1713504-2-ckeepax@opensource.cirrus.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/codecs/wm5110.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/sound/soc/codecs/wm5110.c b/sound/soc/codecs/wm5110.c +index 4973ba1ed779..4ab7a672f8de 100644 +--- a/sound/soc/codecs/wm5110.c ++++ b/sound/soc/codecs/wm5110.c +@@ -413,6 +413,7 @@ static int wm5110_put_dre(struct snd_kcontrol *kcontrol, + unsigned int rnew = (!!ucontrol->value.integer.value[1]) << mc->rshift; + unsigned int lold, rold; + unsigned int lena, rena; ++ bool change = false; + int ret; + + snd_soc_dapm_mutex_lock(dapm); +@@ -440,8 +441,8 @@ static int wm5110_put_dre(struct snd_kcontrol *kcontrol, + goto err; + } + +- ret = regmap_update_bits(arizona->regmap, ARIZONA_DRE_ENABLE, +- mask, lnew | rnew); ++ ret = regmap_update_bits_check(arizona->regmap, ARIZONA_DRE_ENABLE, ++ mask, lnew | rnew, &change); + if (ret) { + dev_err(arizona->dev, "Failed to set DRE: %d\n", ret); + goto err; +@@ -454,6 +455,9 @@ static int wm5110_put_dre(struct snd_kcontrol *kcontrol, + if (!rnew && rold) + wm5110_clear_pga_volume(arizona, mc->rshift); + ++ if (change) ++ ret = 1; ++ + err: + snd_soc_dapm_mutex_unlock(dapm); + +-- +2.35.1 + diff --git a/queue-5.18/asoc-wm_adsp-fix-event-for-preloader.patch b/queue-5.18/asoc-wm_adsp-fix-event-for-preloader.patch new file mode 100644 index 00000000000..22a8e3401ef --- /dev/null +++ b/queue-5.18/asoc-wm_adsp-fix-event-for-preloader.patch @@ -0,0 +1,36 @@ +From e625e78cce7881c32171b0081fee9a693dc6c4c6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 21 Jun 2022 11:20:38 +0100 +Subject: ASoC: wm_adsp: Fix event for preloader + +From: Charles Keepax + +[ Upstream commit 9896c029f0df628c6cb108253d09b1d61f1d4a88 ] + +The preloader controls on ADSP should return a value of 1 if the +preloader value was changed, update to correct this. + +Signed-off-by: Charles Keepax +Link: https://lore.kernel.org/r/20220621102041.1713504-1-ckeepax@opensource.cirrus.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/codecs/wm_adsp.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c +index 9cfd4f18493f..d3ecff3bdef2 100644 +--- a/sound/soc/codecs/wm_adsp.c ++++ b/sound/soc/codecs/wm_adsp.c +@@ -997,7 +997,7 @@ int wm_adsp2_preloader_put(struct snd_kcontrol *kcontrol, + snd_soc_dapm_sync(dapm); + } + +- return 0; ++ return 1; + } + EXPORT_SYMBOL_GPL(wm_adsp2_preloader_put); + +-- +2.35.1 + diff --git a/queue-5.18/cpufreq-pmac32-cpufreq-fix-refcount-leak-bug.patch b/queue-5.18/cpufreq-pmac32-cpufreq-fix-refcount-leak-bug.patch new file mode 100644 index 00000000000..eaec2ec7f21 --- /dev/null +++ b/queue-5.18/cpufreq-pmac32-cpufreq-fix-refcount-leak-bug.patch @@ -0,0 +1,38 @@ +From 191acc33e890c8349997ba8062615feae8dd1b44 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 18 Jun 2022 10:25:45 +0800 +Subject: cpufreq: pmac32-cpufreq: Fix refcount leak bug + +From: Liang He + +[ Upstream commit ccd7567d4b6cf187fdfa55f003a9e461ee629e36 ] + +In pmac_cpufreq_init_MacRISC3(), we need to add corresponding +of_node_put() for the three node pointers whose refcount have +been incremented by of_find_node_by_name(). + +Signed-off-by: Liang He +Signed-off-by: Viresh Kumar +Signed-off-by: Sasha Levin +--- + drivers/cpufreq/pmac32-cpufreq.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/drivers/cpufreq/pmac32-cpufreq.c b/drivers/cpufreq/pmac32-cpufreq.c +index 4f20c6a9108d..8e41fe9ee870 100644 +--- a/drivers/cpufreq/pmac32-cpufreq.c ++++ b/drivers/cpufreq/pmac32-cpufreq.c +@@ -470,6 +470,10 @@ static int pmac_cpufreq_init_MacRISC3(struct device_node *cpunode) + if (slew_done_gpio_np) + slew_done_gpio = read_gpio(slew_done_gpio_np); + ++ of_node_put(volt_gpio_np); ++ of_node_put(freq_gpio_np); ++ of_node_put(slew_done_gpio_np); ++ + /* If we use the frequency GPIOs, calculate the min/max speeds based + * on the bus frequencies + */ +-- +2.35.1 + diff --git a/queue-5.18/fbdev-disable-sysfb-device-registration-when-removin.patch b/queue-5.18/fbdev-disable-sysfb-device-registration-when-removin.patch new file mode 100644 index 00000000000..8e20a34e38b --- /dev/null +++ b/queue-5.18/fbdev-disable-sysfb-device-registration-when-removin.patch @@ -0,0 +1,67 @@ +From f694eb7931abafaac5db7684ff864b1c3fdbbe08 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 7 Jun 2022 20:23:36 +0200 +Subject: fbdev: Disable sysfb device registration when removing conflicting + FBs + +From: Javier Martinez Canillas + +[ Upstream commit ee7a69aa38d87a3bbced7b8245c732c05ed0c6ec ] + +The platform devices registered by sysfb match with firmware-based DRM or +fbdev drivers, that are used to have early graphics using a framebuffer +provided by the system firmware. + +DRM or fbdev drivers later are probed and remove conflicting framebuffers, +leading to these platform devices for generic drivers to be unregistered. + +But the current solution has a race, since the sysfb_init() function could +be called after a DRM or fbdev driver is probed and request to unregister +the devices for drivers with conflicting framebuffes. + +To prevent this, disable any future sysfb platform device registration by +calling sysfb_disable(), if a driver requests to remove the conflicting +framebuffers. + +Suggested-by: Daniel Vetter +Signed-off-by: Javier Martinez Canillas +Reviewed-by: Daniel Vetter +Link: https://patchwork.freedesktop.org/patch/msgid/20220607182338.344270-4-javierm@redhat.com +Signed-off-by: Sasha Levin +--- + drivers/video/fbdev/core/fbmem.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c +index 85de02d0d3aa..643383d74edc 100644 +--- a/drivers/video/fbdev/core/fbmem.c ++++ b/drivers/video/fbdev/core/fbmem.c +@@ -19,6 +19,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -1787,6 +1788,17 @@ int remove_conflicting_framebuffers(struct apertures_struct *a, + do_free = true; + } + ++ /* ++ * If a driver asked to unregister a platform device registered by ++ * sysfb, then can be assumed that this is a driver for a display ++ * that is set up by the system firmware and has a generic driver. ++ * ++ * Drivers for devices that don't have a generic driver will never ++ * ask for this, so let's assume that a real driver for the display ++ * was already probed and prevent sysfb to register devices later. ++ */ ++ sysfb_disable(); ++ + mutex_lock(®istration_lock); + do_remove_conflicting_framebuffers(a, name, primary); + mutex_unlock(®istration_lock); +-- +2.35.1 + diff --git a/queue-5.18/firmware-sysfb-add-sysfb_disable-helper-function.patch b/queue-5.18/firmware-sysfb-add-sysfb_disable-helper-function.patch new file mode 100644 index 00000000000..043e174f609 --- /dev/null +++ b/queue-5.18/firmware-sysfb-add-sysfb_disable-helper-function.patch @@ -0,0 +1,159 @@ +From cdb86f51e92d9e90b0cb021a75a40314290b0872 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 7 Jun 2022 20:23:35 +0200 +Subject: firmware: sysfb: Add sysfb_disable() helper function + +From: Javier Martinez Canillas + +[ Upstream commit bde376e9de3c0bc55eedc8956b0f114c05531595 ] + +This can be used by subsystems to unregister a platform device registered +by sysfb and also to disable future platform device registration in sysfb. + +Suggested-by: Daniel Vetter +Signed-off-by: Javier Martinez Canillas +Reviewed-by: Daniel Vetter +Link: https://patchwork.freedesktop.org/patch/msgid/20220607182338.344270-3-javierm@redhat.com +Signed-off-by: Sasha Levin +--- + .../driver-api/firmware/other_interfaces.rst | 6 +++ + drivers/firmware/sysfb.c | 54 ++++++++++++++++--- + include/linux/sysfb.h | 12 +++++ + 3 files changed, 66 insertions(+), 6 deletions(-) + +diff --git a/Documentation/driver-api/firmware/other_interfaces.rst b/Documentation/driver-api/firmware/other_interfaces.rst +index b81794e0cfbb..06ac89adaafb 100644 +--- a/Documentation/driver-api/firmware/other_interfaces.rst ++++ b/Documentation/driver-api/firmware/other_interfaces.rst +@@ -13,6 +13,12 @@ EDD Interfaces + .. kernel-doc:: drivers/firmware/edd.c + :internal: + ++Generic System Framebuffers Interface ++------------------------------------- ++ ++.. kernel-doc:: drivers/firmware/sysfb.c ++ :export: ++ + Intel Stratix10 SoC Service Layer + --------------------------------- + Some features of the Intel Stratix10 SoC require a level of privilege +diff --git a/drivers/firmware/sysfb.c b/drivers/firmware/sysfb.c +index b032f40a92de..1f276f108cc9 100644 +--- a/drivers/firmware/sysfb.c ++++ b/drivers/firmware/sysfb.c +@@ -34,21 +34,59 @@ + #include + #include + ++static struct platform_device *pd; ++static DEFINE_MUTEX(disable_lock); ++static bool disabled; ++ ++static bool sysfb_unregister(void) ++{ ++ if (IS_ERR_OR_NULL(pd)) ++ return false; ++ ++ platform_device_unregister(pd); ++ pd = NULL; ++ ++ return true; ++} ++ ++/** ++ * sysfb_disable() - disable the Generic System Framebuffers support ++ * ++ * This disables the registration of system framebuffer devices that match the ++ * generic drivers that make use of the system framebuffer set up by firmware. ++ * ++ * It also unregisters a device if this was already registered by sysfb_init(). ++ * ++ * Context: The function can sleep. A @disable_lock mutex is acquired to serialize ++ * against sysfb_init(), that registers a system framebuffer device. ++ */ ++void sysfb_disable(void) ++{ ++ mutex_lock(&disable_lock); ++ sysfb_unregister(); ++ disabled = true; ++ mutex_unlock(&disable_lock); ++} ++EXPORT_SYMBOL_GPL(sysfb_disable); ++ + static __init int sysfb_init(void) + { + struct screen_info *si = &screen_info; + struct simplefb_platform_data mode; +- struct platform_device *pd; + const char *name; + bool compatible; +- int ret; ++ int ret = 0; ++ ++ mutex_lock(&disable_lock); ++ if (disabled) ++ goto unlock_mutex; + + /* try to create a simple-framebuffer device */ + compatible = sysfb_parse_mode(si, &mode); + if (compatible) { + pd = sysfb_create_simplefb(si, &mode); + if (!IS_ERR(pd)) +- return 0; ++ goto unlock_mutex; + } + + /* if the FB is incompatible, create a legacy framebuffer device */ +@@ -60,8 +98,10 @@ static __init int sysfb_init(void) + name = "platform-framebuffer"; + + pd = platform_device_alloc(name, 0); +- if (!pd) +- return -ENOMEM; ++ if (!pd) { ++ ret = -ENOMEM; ++ goto unlock_mutex; ++ } + + sysfb_apply_efi_quirks(pd); + +@@ -73,9 +113,11 @@ static __init int sysfb_init(void) + if (ret) + goto err; + +- return 0; ++ goto unlock_mutex; + err: + platform_device_put(pd); ++unlock_mutex: ++ mutex_unlock(&disable_lock); + return ret; + } + +diff --git a/include/linux/sysfb.h b/include/linux/sysfb.h +index 708152e9037b..8ba8b5be5567 100644 +--- a/include/linux/sysfb.h ++++ b/include/linux/sysfb.h +@@ -55,6 +55,18 @@ struct efifb_dmi_info { + int flags; + }; + ++#ifdef CONFIG_SYSFB ++ ++void sysfb_disable(void); ++ ++#else /* CONFIG_SYSFB */ ++ ++static inline void sysfb_disable(void) ++{ ++} ++ ++#endif /* CONFIG_SYSFB */ ++ + #ifdef CONFIG_EFI + + extern struct efifb_dmi_info efifb_dmi_list[]; +-- +2.35.1 + diff --git a/queue-5.18/firmware-sysfb-make-sysfb_create_simplefb-return-a-p.patch b/queue-5.18/firmware-sysfb-make-sysfb_create_simplefb-return-a-p.patch new file mode 100644 index 00000000000..1ac9ba4028b --- /dev/null +++ b/queue-5.18/firmware-sysfb-make-sysfb_create_simplefb-return-a-p.patch @@ -0,0 +1,130 @@ +From ae8558f1b1f7815d22a9c0b2b4dd7f734473959e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 7 Jun 2022 20:23:34 +0200 +Subject: firmware: sysfb: Make sysfb_create_simplefb() return a pdev pointer + +From: Javier Martinez Canillas + +[ Upstream commit 9e121040e54abef9ed5542e5fdfa87911cd96204 ] + +This function just returned 0 on success or an errno code on error, but it +could be useful for sysfb_init() callers to have a pointer to the device. + +Signed-off-by: Javier Martinez Canillas +Reviewed-by: Daniel Vetter +Reviewed-by: Thomas Zimmermann +Link: https://patchwork.freedesktop.org/patch/msgid/20220607182338.344270-2-javierm@redhat.com +Signed-off-by: Sasha Levin +--- + drivers/firmware/sysfb.c | 4 ++-- + drivers/firmware/sysfb_simplefb.c | 16 ++++++++-------- + include/linux/sysfb.h | 10 +++++----- + 3 files changed, 15 insertions(+), 15 deletions(-) + +diff --git a/drivers/firmware/sysfb.c b/drivers/firmware/sysfb.c +index 2bfbb05f7d89..b032f40a92de 100644 +--- a/drivers/firmware/sysfb.c ++++ b/drivers/firmware/sysfb.c +@@ -46,8 +46,8 @@ static __init int sysfb_init(void) + /* try to create a simple-framebuffer device */ + compatible = sysfb_parse_mode(si, &mode); + if (compatible) { +- ret = sysfb_create_simplefb(si, &mode); +- if (!ret) ++ pd = sysfb_create_simplefb(si, &mode); ++ if (!IS_ERR(pd)) + return 0; + } + +diff --git a/drivers/firmware/sysfb_simplefb.c b/drivers/firmware/sysfb_simplefb.c +index bda8712bfd8c..a353e27f83f5 100644 +--- a/drivers/firmware/sysfb_simplefb.c ++++ b/drivers/firmware/sysfb_simplefb.c +@@ -57,8 +57,8 @@ __init bool sysfb_parse_mode(const struct screen_info *si, + return false; + } + +-__init int sysfb_create_simplefb(const struct screen_info *si, +- const struct simplefb_platform_data *mode) ++__init struct platform_device *sysfb_create_simplefb(const struct screen_info *si, ++ const struct simplefb_platform_data *mode) + { + struct platform_device *pd; + struct resource res; +@@ -76,7 +76,7 @@ __init int sysfb_create_simplefb(const struct screen_info *si, + base |= (u64)si->ext_lfb_base << 32; + if (!base || (u64)(resource_size_t)base != base) { + printk(KERN_DEBUG "sysfb: inaccessible VRAM base\n"); +- return -EINVAL; ++ return ERR_PTR(-EINVAL); + } + + /* +@@ -93,7 +93,7 @@ __init int sysfb_create_simplefb(const struct screen_info *si, + length = mode->height * mode->stride; + if (length > size) { + printk(KERN_WARNING "sysfb: VRAM smaller than advertised\n"); +- return -EINVAL; ++ return ERR_PTR(-EINVAL); + } + length = PAGE_ALIGN(length); + +@@ -104,11 +104,11 @@ __init int sysfb_create_simplefb(const struct screen_info *si, + res.start = base; + res.end = res.start + length - 1; + if (res.end <= res.start) +- return -EINVAL; ++ return ERR_PTR(-EINVAL); + + pd = platform_device_alloc("simple-framebuffer", 0); + if (!pd) +- return -ENOMEM; ++ return ERR_PTR(-ENOMEM); + + sysfb_apply_efi_quirks(pd); + +@@ -124,10 +124,10 @@ __init int sysfb_create_simplefb(const struct screen_info *si, + if (ret) + goto err_put_device; + +- return 0; ++ return pd; + + err_put_device: + platform_device_put(pd); + +- return ret; ++ return ERR_PTR(ret); + } +diff --git a/include/linux/sysfb.h b/include/linux/sysfb.h +index b0dcfa26d07b..708152e9037b 100644 +--- a/include/linux/sysfb.h ++++ b/include/linux/sysfb.h +@@ -72,8 +72,8 @@ static inline void sysfb_apply_efi_quirks(struct platform_device *pd) + + bool sysfb_parse_mode(const struct screen_info *si, + struct simplefb_platform_data *mode); +-int sysfb_create_simplefb(const struct screen_info *si, +- const struct simplefb_platform_data *mode); ++struct platform_device *sysfb_create_simplefb(const struct screen_info *si, ++ const struct simplefb_platform_data *mode); + + #else /* CONFIG_SYSFB_SIMPLE */ + +@@ -83,10 +83,10 @@ static inline bool sysfb_parse_mode(const struct screen_info *si, + return false; + } + +-static inline int sysfb_create_simplefb(const struct screen_info *si, +- const struct simplefb_platform_data *mode) ++static inline struct platform_device *sysfb_create_simplefb(const struct screen_info *si, ++ const struct simplefb_platform_data *mode) + { +- return -EINVAL; ++ return ERR_PTR(-EINVAL); + } + + #endif /* CONFIG_SYSFB_SIMPLE */ +-- +2.35.1 + diff --git a/queue-5.18/irqchip-or1k-pic-undefine-mask_ack-for-level-trigger.patch b/queue-5.18/irqchip-or1k-pic-undefine-mask_ack-for-level-trigger.patch new file mode 100644 index 00000000000..f318b3311be --- /dev/null +++ b/queue-5.18/irqchip-or1k-pic-undefine-mask_ack-for-level-trigger.patch @@ -0,0 +1,41 @@ +From 625bb0ef73d31f3ae39cc6fc0e87adfabc371fea Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 15 Jun 2022 08:54:26 +0900 +Subject: irqchip: or1k-pic: Undefine mask_ack for level triggered hardware + +From: Stafford Horne + +[ Upstream commit 8520501346ed8d1c4a6dfa751cb57328a9c843f1 ] + +The mask_ack operation clears the interrupt by writing to the PICSR +register. This we don't want for level triggered interrupt because +it does not actually clear the interrupt on the source hardware. + +This was causing issues in qemu with multi core setups where +interrupts would continue to fire even though they had been cleared in +PICSR. + +Just remove the mask_ack operation. + +Acked-by: Marc Zyngier +Signed-off-by: Stafford Horne +Signed-off-by: Sasha Levin +--- + drivers/irqchip/irq-or1k-pic.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/drivers/irqchip/irq-or1k-pic.c b/drivers/irqchip/irq-or1k-pic.c +index 49b47e787644..f289ccd95291 100644 +--- a/drivers/irqchip/irq-or1k-pic.c ++++ b/drivers/irqchip/irq-or1k-pic.c +@@ -66,7 +66,6 @@ static struct or1k_pic_dev or1k_pic_level = { + .name = "or1k-PIC-level", + .irq_unmask = or1k_pic_unmask, + .irq_mask = or1k_pic_mask, +- .irq_mask_ack = or1k_pic_mask_ack, + }, + .handle = handle_level_irq, + .flags = IRQ_LEVEL | IRQ_NOPROBE, +-- +2.35.1 + diff --git a/queue-5.18/ksmbd-use-sock_nonblock-type-for-kernel_accept.patch b/queue-5.18/ksmbd-use-sock_nonblock-type-for-kernel_accept.patch new file mode 100644 index 00000000000..762d061d0fa --- /dev/null +++ b/queue-5.18/ksmbd-use-sock_nonblock-type-for-kernel_accept.patch @@ -0,0 +1,47 @@ +From 6c838d0244253ea10f4e599d5792c813706f6111 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 2 Jun 2022 10:07:38 +0900 +Subject: ksmbd: use SOCK_NONBLOCK type for kernel_accept() + +From: Namjae Jeon + +[ Upstream commit fe0fde09e1cb83effcf8fafa372533f438d93a1a ] + +I found that normally it is O_NONBLOCK but there are different value +for some arch. + +/include/linux/net.h: +#ifndef SOCK_NONBLOCK +#define SOCK_NONBLOCK O_NONBLOCK +#endif + +/arch/alpha/include/asm/socket.h: +#define SOCK_NONBLOCK 0x40000000 + +Use SOCK_NONBLOCK instead of O_NONBLOCK for kernel_accept(). + +Suggested-by: David Howells +Signed-off-by: Namjae Jeon +Reviewed-by: Hyunchul Lee +Signed-off-by: Steve French +Signed-off-by: Sasha Levin +--- + fs/ksmbd/transport_tcp.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/fs/ksmbd/transport_tcp.c b/fs/ksmbd/transport_tcp.c +index 8fef9de787d3..143bba4e4db8 100644 +--- a/fs/ksmbd/transport_tcp.c ++++ b/fs/ksmbd/transport_tcp.c +@@ -230,7 +230,7 @@ static int ksmbd_kthread_fn(void *p) + break; + } + ret = kernel_accept(iface->ksmbd_socket, &client_sk, +- O_NONBLOCK); ++ SOCK_NONBLOCK); + mutex_unlock(&iface->sock_release_lock); + if (ret) { + if (ret == -EAGAIN) +-- +2.35.1 + diff --git a/queue-5.18/net-sfp-fix-memory-leak-in-sfp_probe.patch b/queue-5.18/net-sfp-fix-memory-leak-in-sfp_probe.patch new file mode 100644 index 00000000000..5f43f98a831 --- /dev/null +++ b/queue-5.18/net-sfp-fix-memory-leak-in-sfp_probe.patch @@ -0,0 +1,39 @@ +From b931ec06938d9a18f7e131d8ee9aee41087b7322 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 29 Jun 2022 15:55:50 +0800 +Subject: net: sfp: fix memory leak in sfp_probe() + +From: Jianglei Nie + +[ Upstream commit 0a18d802d65cf662644fd1d369c86d84a5630652 ] + +sfp_probe() allocates a memory chunk from sfp with sfp_alloc(). When +devm_add_action() fails, sfp is not freed, which leads to a memory leak. + +We should use devm_add_action_or_reset() instead of devm_add_action(). + +Signed-off-by: Jianglei Nie +Reviewed-by: Russell King (Oracle) +Link: https://lore.kernel.org/r/20220629075550.2152003-1-niejianglei2021@163.com +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + drivers/net/phy/sfp.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c +index 9a5d5a10560f..e7b0e12cc75b 100644 +--- a/drivers/net/phy/sfp.c ++++ b/drivers/net/phy/sfp.c +@@ -2516,7 +2516,7 @@ static int sfp_probe(struct platform_device *pdev) + + platform_set_drvdata(pdev, sfp); + +- err = devm_add_action(sfp->dev, sfp_cleanup, sfp); ++ err = devm_add_action_or_reset(sfp->dev, sfp_cleanup, sfp); + if (err < 0) + return err; + +-- +2.35.1 + diff --git a/queue-5.18/net-tipc-fix-possible-refcount-leak-in-tipc_sk_creat.patch b/queue-5.18/net-tipc-fix-possible-refcount-leak-in-tipc_sk_creat.patch new file mode 100644 index 00000000000..c4eff6e6570 --- /dev/null +++ b/queue-5.18/net-tipc-fix-possible-refcount-leak-in-tipc_sk_creat.patch @@ -0,0 +1,34 @@ +From 867722275246716378e1576c45f3b89dfdbec561 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 29 Jun 2022 14:34:18 +0800 +Subject: net: tipc: fix possible refcount leak in tipc_sk_create() + +From: Hangyu Hua + +[ Upstream commit 00aff3590fc0a73bddd3b743863c14e76fd35c0c ] + +Free sk in case tipc_sk_insert() fails. + +Signed-off-by: Hangyu Hua +Reviewed-by: Tung Nguyen +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + net/tipc/socket.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/net/tipc/socket.c b/net/tipc/socket.c +index 17f8c523e33b..43509c7e90fc 100644 +--- a/net/tipc/socket.c ++++ b/net/tipc/socket.c +@@ -502,6 +502,7 @@ static int tipc_sk_create(struct net *net, struct socket *sock, + sock_init_data(sock, sk); + tipc_set_sk_state(sk, TIPC_OPEN); + if (tipc_sk_insert(tsk)) { ++ sk_free(sk); + pr_warn("Socket create failed; port number exhausted\n"); + return -EINVAL; + } +-- +2.35.1 + diff --git a/queue-5.18/netfilter-br_netfilter-do-not-skip-all-hooks-with-0-.patch b/queue-5.18/netfilter-br_netfilter-do-not-skip-all-hooks-with-0-.patch new file mode 100644 index 00000000000..918e39a653b --- /dev/null +++ b/queue-5.18/netfilter-br_netfilter-do-not-skip-all-hooks-with-0-.patch @@ -0,0 +1,104 @@ +From 54680b3c89043fd7118aa45af09a964eca79e76d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 21 Jun 2022 18:26:03 +0200 +Subject: netfilter: br_netfilter: do not skip all hooks with 0 priority + +From: Florian Westphal + +[ Upstream commit c2577862eeb0be94f151f2f1fff662b028061b00 ] + +When br_netfilter module is loaded, skbs may be diverted to the +ipv4/ipv6 hooks, just like as if we were routing. + +Unfortunately, bridge filter hooks with priority 0 may be skipped +in this case. + +Example: +1. an nftables bridge ruleset is loaded, with a prerouting + hook that has priority 0. +2. interface is added to the bridge. +3. no tcp packet is ever seen by the bridge prerouting hook. +4. flush the ruleset +5. load the bridge ruleset again. +6. tcp packets are processed as expected. + +After 1) the only registered hook is the bridge prerouting hook, but its +not called yet because the bridge hasn't been brought up yet. + +After 2), hook order is: + 0 br_nf_pre_routing // br_netfilter internal hook + 0 chain bridge f prerouting // nftables bridge ruleset + +The packet is diverted to br_nf_pre_routing. +If call-iptables is off, the nftables bridge ruleset is called as expected. + +But if its enabled, br_nf_hook_thresh() will skip it because it assumes +that all 0-priority hooks had been called previously in bridge context. + +To avoid this, check for the br_nf_pre_routing hook itself, we need to +resume directly after it, even if this hook has a priority of 0. + +Unfortunately, this still results in different packet flow. +With this fix, the eval order after in 3) is: +1. br_nf_pre_routing +2. ip(6)tables (if enabled) +3. nftables bridge + +but after 5 its the much saner: +1. nftables bridge +2. br_nf_pre_routing +3. ip(6)tables (if enabled) + +Unfortunately I don't see a solution here: +It would be possible to move br_nf_pre_routing to a higher priority +so that it will be called later in the pipeline, but this also impacts +ebtables evaluation order, and would still result in this very ordering +problem for all nftables-bridge hooks with the same priority as the +br_nf_pre_routing one. + +Searching back through the git history I don't think this has +ever behaved in any other way, hence, no fixes-tag. + +Reported-by: Radim Hrazdil +Signed-off-by: Florian Westphal +Signed-off-by: Pablo Neira Ayuso +Signed-off-by: Sasha Levin +--- + net/bridge/br_netfilter_hooks.c | 21 ++++++++++++++++++--- + 1 file changed, 18 insertions(+), 3 deletions(-) + +diff --git a/net/bridge/br_netfilter_hooks.c b/net/bridge/br_netfilter_hooks.c +index 4fd882686b04..ff4779036649 100644 +--- a/net/bridge/br_netfilter_hooks.c ++++ b/net/bridge/br_netfilter_hooks.c +@@ -1012,9 +1012,24 @@ int br_nf_hook_thresh(unsigned int hook, struct net *net, + return okfn(net, sk, skb); + + ops = nf_hook_entries_get_hook_ops(e); +- for (i = 0; i < e->num_hook_entries && +- ops[i]->priority <= NF_BR_PRI_BRNF; i++) +- ; ++ for (i = 0; i < e->num_hook_entries; i++) { ++ /* These hooks have already been called */ ++ if (ops[i]->priority < NF_BR_PRI_BRNF) ++ continue; ++ ++ /* These hooks have not been called yet, run them. */ ++ if (ops[i]->priority > NF_BR_PRI_BRNF) ++ break; ++ ++ /* take a closer look at NF_BR_PRI_BRNF. */ ++ if (ops[i]->hook == br_nf_pre_routing) { ++ /* This hook diverted the skb to this function, ++ * hooks after this have not been run yet. ++ */ ++ i++; ++ break; ++ } ++ } + + nf_hook_state_init(&state, hook, NFPROTO_BRIDGE, indev, outdev, + sk, net, okfn); +-- +2.35.1 + diff --git a/queue-5.18/netfilter-nf_tables-avoid-skb-access-on-nf_stolen.patch b/queue-5.18/netfilter-nf_tables-avoid-skb-access-on-nf_stolen.patch new file mode 100644 index 00000000000..7d1050a989b --- /dev/null +++ b/queue-5.18/netfilter-nf_tables-avoid-skb-access-on-nf_stolen.patch @@ -0,0 +1,250 @@ +From 0394dc27fc3081562848b5aa5d866df3656457b7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 22 Jun 2022 16:43:57 +0200 +Subject: netfilter: nf_tables: avoid skb access on nf_stolen + +From: Florian Westphal + +[ Upstream commit e34b9ed96ce3b06c79bf884009b16961ca478f87 ] + +When verdict is NF_STOLEN, the skb might have been freed. + +When tracing is enabled, this can result in a use-after-free: +1. access to skb->nf_trace +2. access to skb->mark +3. computation of trace id +4. dump of packet payload + +To avoid 1, keep a cached copy of skb->nf_trace in the +trace state struct. +Refresh this copy whenever verdict is != STOLEN. + +Avoid 2 by skipping skb->mark access if verdict is STOLEN. + +3 is avoided by precomputing the trace id. + +Only dump the packet when verdict is not "STOLEN". + +Reported-by: Pablo Neira Ayuso +Signed-off-by: Florian Westphal +Signed-off-by: Pablo Neira Ayuso +Signed-off-by: Sasha Levin +--- + include/net/netfilter/nf_tables.h | 16 ++++++----- + net/netfilter/nf_tables_core.c | 24 ++++++++++++++--- + net/netfilter/nf_tables_trace.c | 44 +++++++++++++++++-------------- + 3 files changed, 55 insertions(+), 29 deletions(-) + +diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h +index f0c3a1ee197c..64cf655c818c 100644 +--- a/include/net/netfilter/nf_tables.h ++++ b/include/net/netfilter/nf_tables.h +@@ -1342,24 +1342,28 @@ void nft_unregister_flowtable_type(struct nf_flowtable_type *type); + /** + * struct nft_traceinfo - nft tracing information and state + * ++ * @trace: other struct members are initialised ++ * @nf_trace: copy of skb->nf_trace before rule evaluation ++ * @type: event type (enum nft_trace_types) ++ * @skbid: hash of skb to be used as trace id ++ * @packet_dumped: packet headers sent in a previous traceinfo message + * @pkt: pktinfo currently processed + * @basechain: base chain currently processed + * @chain: chain currently processed + * @rule: rule that was evaluated + * @verdict: verdict given by rule +- * @type: event type (enum nft_trace_types) +- * @packet_dumped: packet headers sent in a previous traceinfo message +- * @trace: other struct members are initialised + */ + struct nft_traceinfo { ++ bool trace; ++ bool nf_trace; ++ bool packet_dumped; ++ enum nft_trace_types type:8; ++ u32 skbid; + const struct nft_pktinfo *pkt; + const struct nft_base_chain *basechain; + const struct nft_chain *chain; + const struct nft_rule_dp *rule; + const struct nft_verdict *verdict; +- enum nft_trace_types type; +- bool packet_dumped; +- bool trace; + }; + + void nft_trace_init(struct nft_traceinfo *info, const struct nft_pktinfo *pkt, +diff --git a/net/netfilter/nf_tables_core.c b/net/netfilter/nf_tables_core.c +index 53f40e473855..3ddce24ac76d 100644 +--- a/net/netfilter/nf_tables_core.c ++++ b/net/netfilter/nf_tables_core.c +@@ -25,9 +25,7 @@ static noinline void __nft_trace_packet(struct nft_traceinfo *info, + const struct nft_chain *chain, + enum nft_trace_types type) + { +- const struct nft_pktinfo *pkt = info->pkt; +- +- if (!info->trace || !pkt->skb->nf_trace) ++ if (!info->trace || !info->nf_trace) + return; + + info->chain = chain; +@@ -42,11 +40,24 @@ static inline void nft_trace_packet(struct nft_traceinfo *info, + enum nft_trace_types type) + { + if (static_branch_unlikely(&nft_trace_enabled)) { ++ const struct nft_pktinfo *pkt = info->pkt; ++ ++ info->nf_trace = pkt->skb->nf_trace; + info->rule = rule; + __nft_trace_packet(info, chain, type); + } + } + ++static inline void nft_trace_copy_nftrace(struct nft_traceinfo *info) ++{ ++ if (static_branch_unlikely(&nft_trace_enabled)) { ++ const struct nft_pktinfo *pkt = info->pkt; ++ ++ if (info->trace) ++ info->nf_trace = pkt->skb->nf_trace; ++ } ++} ++ + static void nft_bitwise_fast_eval(const struct nft_expr *expr, + struct nft_regs *regs) + { +@@ -85,6 +96,7 @@ static noinline void __nft_trace_verdict(struct nft_traceinfo *info, + const struct nft_chain *chain, + const struct nft_regs *regs) + { ++ const struct nft_pktinfo *pkt = info->pkt; + enum nft_trace_types type; + + switch (regs->verdict.code) { +@@ -92,8 +104,13 @@ static noinline void __nft_trace_verdict(struct nft_traceinfo *info, + case NFT_RETURN: + type = NFT_TRACETYPE_RETURN; + break; ++ case NF_STOLEN: ++ type = NFT_TRACETYPE_RULE; ++ /* can't access skb->nf_trace; use copy */ ++ break; + default: + type = NFT_TRACETYPE_RULE; ++ info->nf_trace = pkt->skb->nf_trace; + break; + } + +@@ -254,6 +271,7 @@ nft_do_chain(struct nft_pktinfo *pkt, void *priv) + switch (regs.verdict.code) { + case NFT_BREAK: + regs.verdict.code = NFT_CONTINUE; ++ nft_trace_copy_nftrace(&info); + continue; + case NFT_CONTINUE: + nft_trace_packet(&info, chain, rule, +diff --git a/net/netfilter/nf_tables_trace.c b/net/netfilter/nf_tables_trace.c +index 5041725423c2..1163ba9c1401 100644 +--- a/net/netfilter/nf_tables_trace.c ++++ b/net/netfilter/nf_tables_trace.c +@@ -7,7 +7,7 @@ + #include + #include + #include +-#include ++#include + #include + #include + #include +@@ -25,22 +25,6 @@ + DEFINE_STATIC_KEY_FALSE(nft_trace_enabled); + EXPORT_SYMBOL_GPL(nft_trace_enabled); + +-static int trace_fill_id(struct sk_buff *nlskb, struct sk_buff *skb) +-{ +- __be32 id; +- +- /* using skb address as ID results in a limited number of +- * values (and quick reuse). +- * +- * So we attempt to use as many skb members that will not +- * change while skb is with netfilter. +- */ +- id = (__be32)jhash_2words(hash32_ptr(skb), skb_get_hash(skb), +- skb->skb_iif); +- +- return nla_put_be32(nlskb, NFTA_TRACE_ID, id); +-} +- + static int trace_fill_header(struct sk_buff *nlskb, u16 type, + const struct sk_buff *skb, + int off, unsigned int len) +@@ -186,6 +170,7 @@ void nft_trace_notify(struct nft_traceinfo *info) + struct nlmsghdr *nlh; + struct sk_buff *skb; + unsigned int size; ++ u32 mark = 0; + u16 event; + + if (!nfnetlink_has_listeners(nft_net(pkt), NFNLGRP_NFTRACE)) +@@ -229,7 +214,7 @@ void nft_trace_notify(struct nft_traceinfo *info) + if (nla_put_be32(skb, NFTA_TRACE_TYPE, htonl(info->type))) + goto nla_put_failure; + +- if (trace_fill_id(skb, pkt->skb)) ++ if (nla_put_u32(skb, NFTA_TRACE_ID, info->skbid)) + goto nla_put_failure; + + if (nla_put_string(skb, NFTA_TRACE_CHAIN, info->chain->name)) +@@ -249,16 +234,24 @@ void nft_trace_notify(struct nft_traceinfo *info) + case NFT_TRACETYPE_RULE: + if (nft_verdict_dump(skb, NFTA_TRACE_VERDICT, info->verdict)) + goto nla_put_failure; ++ ++ /* pkt->skb undefined iff NF_STOLEN, disable dump */ ++ if (info->verdict->code == NF_STOLEN) ++ info->packet_dumped = true; ++ else ++ mark = pkt->skb->mark; ++ + break; + case NFT_TRACETYPE_POLICY: ++ mark = pkt->skb->mark; ++ + if (nla_put_be32(skb, NFTA_TRACE_POLICY, + htonl(info->basechain->policy))) + goto nla_put_failure; + break; + } + +- if (pkt->skb->mark && +- nla_put_be32(skb, NFTA_TRACE_MARK, htonl(pkt->skb->mark))) ++ if (mark && nla_put_be32(skb, NFTA_TRACE_MARK, htonl(mark))) + goto nla_put_failure; + + if (!info->packet_dumped) { +@@ -283,9 +276,20 @@ void nft_trace_init(struct nft_traceinfo *info, const struct nft_pktinfo *pkt, + const struct nft_verdict *verdict, + const struct nft_chain *chain) + { ++ static siphash_key_t trace_key __read_mostly; ++ struct sk_buff *skb = pkt->skb; ++ + info->basechain = nft_base_chain(chain); + info->trace = true; ++ info->nf_trace = pkt->skb->nf_trace; + info->packet_dumped = false; + info->pkt = pkt; + info->verdict = verdict; ++ ++ net_get_random_once(&trace_key, sizeof(trace_key)); ++ ++ info->skbid = (u32)siphash_3u32(hash32_ptr(skb), ++ skb_get_hash(skb), ++ skb->skb_iif, ++ &trace_key); + } +-- +2.35.1 + diff --git a/queue-5.18/nfc-nxp-nci-don-t-print-header-length-mismatch-on-i2.patch b/queue-5.18/nfc-nxp-nci-don-t-print-header-length-mismatch-on-i2.patch new file mode 100644 index 00000000000..aa9acdc4319 --- /dev/null +++ b/queue-5.18/nfc-nxp-nci-don-t-print-header-length-mismatch-on-i2.patch @@ -0,0 +1,50 @@ +From db3a61cffaab506dce470b1ae936896c39ea5535 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 27 Jun 2022 19:06:43 +0200 +Subject: NFC: nxp-nci: don't print header length mismatch on i2c error + +From: Michael Walle + +[ Upstream commit 9577fc5fdc8b07b891709af6453545db405e24ad ] + +Don't print a misleading header length mismatch error if the i2c call +returns an error. Instead just return the error code without any error +message. + +Signed-off-by: Michael Walle +Reviewed-by: Krzysztof Kozlowski +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/nfc/nxp-nci/i2c.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c +index e8f3b35afbee..ae2ba08d8ac3 100644 +--- a/drivers/nfc/nxp-nci/i2c.c ++++ b/drivers/nfc/nxp-nci/i2c.c +@@ -122,7 +122,9 @@ static int nxp_nci_i2c_fw_read(struct nxp_nci_i2c_phy *phy, + skb_put_data(*skb, &header, NXP_NCI_FW_HDR_LEN); + + r = i2c_master_recv(client, skb_put(*skb, frame_len), frame_len); +- if (r != frame_len) { ++ if (r < 0) { ++ goto fw_read_exit_free_skb; ++ } else if (r != frame_len) { + nfc_err(&client->dev, + "Invalid frame length: %u (expected %zu)\n", + r, frame_len); +@@ -166,7 +168,9 @@ static int nxp_nci_i2c_nci_read(struct nxp_nci_i2c_phy *phy, + return 0; + + r = i2c_master_recv(client, skb_put(*skb, header.plen), header.plen); +- if (r != header.plen) { ++ if (r < 0) { ++ goto nci_read_exit_free_skb; ++ } else if (r != header.plen) { + nfc_err(&client->dev, + "Invalid frame payload length: %u (expected %u)\n", + r, header.plen); +-- +2.35.1 + diff --git a/queue-5.18/nvme-fix-block-device-naming-collision.patch b/queue-5.18/nvme-fix-block-device-naming-collision.patch new file mode 100644 index 00000000000..fbe62c49b21 --- /dev/null +++ b/queue-5.18/nvme-fix-block-device-naming-collision.patch @@ -0,0 +1,64 @@ +From a976717ff2f5b9088e0e5d167f279e267e1095a7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 14 Jul 2022 12:42:10 +0000 +Subject: nvme: fix block device naming collision + +From: Israel Rukshin + +[ Upstream commit 6961b5e02876b3b47f030a1f1ee8fd3e631ac270 ] + +The issue exists when multipath is enabled and the namespace is +shared, but all the other controller checks at nvme_is_unique_nsid() +are false. The reason for this issue is that nvme_is_unique_nsid() +returns false when is called from nvme_mpath_alloc_disk() due to an +uninitialized value of head->shared. The patch fixes it by setting +head->shared before nvme_mpath_alloc_disk() is called. + +Fixes: 5974ea7ce0f9 ("nvme: allow duplicate NSIDs for private namespaces") +Signed-off-by: Israel Rukshin +Reviewed-by: Keith Busch +Reviewed-by: Max Gurtovoy +Signed-off-by: Christoph Hellwig +Signed-off-by: Sasha Levin +--- + drivers/nvme/host/core.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c +index a2862a56fadc..0fef31c935de 100644 +--- a/drivers/nvme/host/core.c ++++ b/drivers/nvme/host/core.c +@@ -3726,7 +3726,7 @@ static int nvme_add_ns_cdev(struct nvme_ns *ns) + } + + static struct nvme_ns_head *nvme_alloc_ns_head(struct nvme_ctrl *ctrl, +- unsigned nsid, struct nvme_ns_ids *ids) ++ unsigned nsid, struct nvme_ns_ids *ids, bool is_shared) + { + struct nvme_ns_head *head; + size_t size = sizeof(*head); +@@ -3750,6 +3750,7 @@ static struct nvme_ns_head *nvme_alloc_ns_head(struct nvme_ctrl *ctrl, + head->subsys = ctrl->subsys; + head->ns_id = nsid; + head->ids = *ids; ++ head->shared = is_shared; + kref_init(&head->ref); + + if (head->ids.csi) { +@@ -3830,12 +3831,11 @@ static int nvme_init_ns_head(struct nvme_ns *ns, unsigned nsid, + nsid); + goto out_unlock; + } +- head = nvme_alloc_ns_head(ctrl, nsid, ids); ++ head = nvme_alloc_ns_head(ctrl, nsid, ids, is_shared); + if (IS_ERR(head)) { + ret = PTR_ERR(head); + goto out_unlock; + } +- head->shared = is_shared; + } else { + ret = -EINVAL; + if (!is_shared || !head->shared) { +-- +2.35.1 + diff --git a/queue-5.18/nvme-fix-regression-when-disconnect-a-recovering-ctr.patch b/queue-5.18/nvme-fix-regression-when-disconnect-a-recovering-ctr.patch new file mode 100644 index 00000000000..6966ff93ecd --- /dev/null +++ b/queue-5.18/nvme-fix-regression-when-disconnect-a-recovering-ctr.patch @@ -0,0 +1,143 @@ +From 70983807f9621175e1bc3d150bdddff989e90b91 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 23 Jun 2022 14:45:39 +0800 +Subject: nvme: fix regression when disconnect a recovering ctrl + +From: Ruozhu Li + +[ Upstream commit f7f70f4aa09dc43d7455c060143e86a017c30548 ] + +We encountered a problem that the disconnect command hangs. +After analyzing the log and stack, we found that the triggering +process is as follows: +CPU0 CPU1 + nvme_rdma_error_recovery_work + nvme_rdma_teardown_io_queues +nvme_do_delete_ctrl nvme_stop_queues + nvme_remove_namespaces + --clear ctrl->namespaces + nvme_start_queues + --no ns in ctrl->namespaces + nvme_ns_remove return(because ctrl is deleting) + blk_freeze_queue + blk_mq_freeze_queue_wait + --wait for ns to unquiesce to clean infligt IO, hang forever + +This problem was not found in older kernels because we will flush +err work in nvme_stop_ctrl before nvme_remove_namespaces.It does not +seem to be modified for functional reasons, the patch can be revert +to solve the problem. + +Revert commit 794a4cb3d2f7 ("nvme: remove the .stop_ctrl callout") + +Signed-off-by: Ruozhu Li +Reviewed-by: Sagi Grimberg +Signed-off-by: Christoph Hellwig +Signed-off-by: Sasha Levin +--- + drivers/nvme/host/core.c | 2 ++ + drivers/nvme/host/nvme.h | 1 + + drivers/nvme/host/rdma.c | 12 +++++++++--- + drivers/nvme/host/tcp.c | 10 +++++++--- + 4 files changed, 19 insertions(+), 6 deletions(-) + +diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c +index 0fef31c935de..c9831daafbc6 100644 +--- a/drivers/nvme/host/core.c ++++ b/drivers/nvme/host/core.c +@@ -4519,6 +4519,8 @@ void nvme_stop_ctrl(struct nvme_ctrl *ctrl) + nvme_stop_failfast_work(ctrl); + flush_work(&ctrl->async_event_work); + cancel_work_sync(&ctrl->fw_act_work); ++ if (ctrl->ops->stop_ctrl) ++ ctrl->ops->stop_ctrl(ctrl); + } + EXPORT_SYMBOL_GPL(nvme_stop_ctrl); + +diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h +index a2b53ca63335..337ae1e3ad25 100644 +--- a/drivers/nvme/host/nvme.h ++++ b/drivers/nvme/host/nvme.h +@@ -501,6 +501,7 @@ struct nvme_ctrl_ops { + void (*free_ctrl)(struct nvme_ctrl *ctrl); + void (*submit_async_event)(struct nvme_ctrl *ctrl); + void (*delete_ctrl)(struct nvme_ctrl *ctrl); ++ void (*stop_ctrl)(struct nvme_ctrl *ctrl); + int (*get_address)(struct nvme_ctrl *ctrl, char *buf, int size); + }; + +diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c +index d9f19d901313..5aef2b81dbec 100644 +--- a/drivers/nvme/host/rdma.c ++++ b/drivers/nvme/host/rdma.c +@@ -1048,6 +1048,14 @@ static void nvme_rdma_teardown_io_queues(struct nvme_rdma_ctrl *ctrl, + } + } + ++static void nvme_rdma_stop_ctrl(struct nvme_ctrl *nctrl) ++{ ++ struct nvme_rdma_ctrl *ctrl = to_rdma_ctrl(nctrl); ++ ++ cancel_work_sync(&ctrl->err_work); ++ cancel_delayed_work_sync(&ctrl->reconnect_work); ++} ++ + static void nvme_rdma_free_ctrl(struct nvme_ctrl *nctrl) + { + struct nvme_rdma_ctrl *ctrl = to_rdma_ctrl(nctrl); +@@ -2255,9 +2263,6 @@ static const struct blk_mq_ops nvme_rdma_admin_mq_ops = { + + static void nvme_rdma_shutdown_ctrl(struct nvme_rdma_ctrl *ctrl, bool shutdown) + { +- cancel_work_sync(&ctrl->err_work); +- cancel_delayed_work_sync(&ctrl->reconnect_work); +- + nvme_rdma_teardown_io_queues(ctrl, shutdown); + nvme_stop_admin_queue(&ctrl->ctrl); + if (shutdown) +@@ -2307,6 +2312,7 @@ static const struct nvme_ctrl_ops nvme_rdma_ctrl_ops = { + .submit_async_event = nvme_rdma_submit_async_event, + .delete_ctrl = nvme_rdma_delete_ctrl, + .get_address = nvmf_get_address, ++ .stop_ctrl = nvme_rdma_stop_ctrl, + }; + + /* +diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c +index e44d0570e694..1fb4f9b1621e 100644 +--- a/drivers/nvme/host/tcp.c ++++ b/drivers/nvme/host/tcp.c +@@ -2193,9 +2193,6 @@ static void nvme_tcp_error_recovery_work(struct work_struct *work) + + static void nvme_tcp_teardown_ctrl(struct nvme_ctrl *ctrl, bool shutdown) + { +- cancel_work_sync(&to_tcp_ctrl(ctrl)->err_work); +- cancel_delayed_work_sync(&to_tcp_ctrl(ctrl)->connect_work); +- + nvme_tcp_teardown_io_queues(ctrl, shutdown); + nvme_stop_admin_queue(ctrl); + if (shutdown) +@@ -2235,6 +2232,12 @@ static void nvme_reset_ctrl_work(struct work_struct *work) + nvme_tcp_reconnect_or_remove(ctrl); + } + ++static void nvme_tcp_stop_ctrl(struct nvme_ctrl *ctrl) ++{ ++ cancel_work_sync(&to_tcp_ctrl(ctrl)->err_work); ++ cancel_delayed_work_sync(&to_tcp_ctrl(ctrl)->connect_work); ++} ++ + static void nvme_tcp_free_ctrl(struct nvme_ctrl *nctrl) + { + struct nvme_tcp_ctrl *ctrl = to_tcp_ctrl(nctrl); +@@ -2559,6 +2562,7 @@ static const struct nvme_ctrl_ops nvme_tcp_ctrl_ops = { + .submit_async_event = nvme_tcp_submit_async_event, + .delete_ctrl = nvme_tcp_delete_ctrl, + .get_address = nvmf_get_address, ++ .stop_ctrl = nvme_tcp_stop_ctrl, + }; + + static bool +-- +2.35.1 + diff --git a/queue-5.18/nvme-pci-phison-e16-has-bogus-namespace-ids.patch b/queue-5.18/nvme-pci-phison-e16-has-bogus-namespace-ids.patch new file mode 100644 index 00000000000..63f809865be --- /dev/null +++ b/queue-5.18/nvme-pci-phison-e16-has-bogus-namespace-ids.patch @@ -0,0 +1,38 @@ +From a066ded84443d10b8d864f84ac81f17f63c9b322 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 5 Jul 2022 10:21:02 -0700 +Subject: nvme-pci: phison e16 has bogus namespace ids + +From: Keith Busch + +[ Upstream commit 73029c9b23cf1213e5f54c2b59efce08665199e7 ] + +Add the quirk. + +Link: https://bugzilla.kernel.org/show_bug.cgi?id=216049 +Reported-by: Chris Egolf +Signed-off-by: Keith Busch +Reviewed-by: Chaitanya Kulkarni +Signed-off-by: Christoph Hellwig +Signed-off-by: Sasha Levin +--- + drivers/nvme/host/pci.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c +index fe829377c7c2..ab575fdd8015 100644 +--- a/drivers/nvme/host/pci.c ++++ b/drivers/nvme/host/pci.c +@@ -3432,7 +3432,8 @@ static const struct pci_device_id nvme_id_table[] = { + NVME_QUIRK_DISABLE_WRITE_ZEROES| + NVME_QUIRK_IGNORE_DEV_SUBNQN, }, + { PCI_DEVICE(0x1987, 0x5016), /* Phison E16 */ +- .driver_data = NVME_QUIRK_IGNORE_DEV_SUBNQN, }, ++ .driver_data = NVME_QUIRK_IGNORE_DEV_SUBNQN | ++ NVME_QUIRK_BOGUS_NID, }, + { PCI_DEVICE(0x1b4b, 0x1092), /* Lexar 256 GB SSD */ + .driver_data = NVME_QUIRK_NO_NS_DESC_LIST | + NVME_QUIRK_IGNORE_DEV_SUBNQN, }, +-- +2.35.1 + diff --git a/queue-5.18/nvme-tcp-always-fail-a-request-when-sending-it-faile.patch b/queue-5.18/nvme-tcp-always-fail-a-request-when-sending-it-faile.patch new file mode 100644 index 00000000000..d0c0491e8ef --- /dev/null +++ b/queue-5.18/nvme-tcp-always-fail-a-request-when-sending-it-faile.patch @@ -0,0 +1,45 @@ +From 2d3458448b3e88a6188c9735db2831fa2f3aaad7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 26 Jun 2022 12:24:51 +0300 +Subject: nvme-tcp: always fail a request when sending it failed + +From: Sagi Grimberg + +[ Upstream commit 41d07df7de841bfbc32725ce21d933ad358f2844 ] + +queue stoppage and inflight requests cancellation is fully fenced from +io_work and thus failing a request from this context. Hence we don't +need to try to guess from the socket retcode if this failure is because +the queue is about to be torn down or not. + +We are perfectly safe to just fail it, the request will not be cancelled +later on. + +This solves possible very long shutdown delays when the users issues a +'nvme disconnect-all' + +Reported-by: Daniel Wagner +Signed-off-by: Sagi Grimberg +Signed-off-by: Christoph Hellwig +Signed-off-by: Sasha Levin +--- + drivers/nvme/host/tcp.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c +index ad3a2bf2f1e9..e44d0570e694 100644 +--- a/drivers/nvme/host/tcp.c ++++ b/drivers/nvme/host/tcp.c +@@ -1180,8 +1180,7 @@ static int nvme_tcp_try_send(struct nvme_tcp_queue *queue) + } else if (ret < 0) { + dev_err(queue->ctrl->ctrl.device, + "failed to send request %d\n", ret); +- if (ret != -EPIPE && ret != -ECONNRESET) +- nvme_tcp_fail_request(queue->request); ++ nvme_tcp_fail_request(queue->request); + nvme_tcp_done_send_req(queue); + } + return ret; +-- +2.35.1 + diff --git a/queue-5.18/nvme-use-struct-group-for-generic-command-dwords.patch b/queue-5.18/nvme-use-struct-group-for-generic-command-dwords.patch new file mode 100644 index 00000000000..fa20d758bf1 --- /dev/null +++ b/queue-5.18/nvme-use-struct-group-for-generic-command-dwords.patch @@ -0,0 +1,57 @@ +From 4abaefe5f68b3b568f81ff448c6d2bc8e299bb69 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 6 Jul 2022 10:05:05 -0700 +Subject: nvme: use struct group for generic command dwords + +From: Keith Busch + +[ Upstream commit 5c629dc9609dc43492a7bc8060cc6120875bf096 ] + +This will allow the trace event to know the full size of the data +intended to be copied and silence read overflow checks. + +Reported-by: John Garry +Suggested-by: Christoph Hellwig +Signed-off-by: Keith Busch +Signed-off-by: Christoph Hellwig +Signed-off-by: Sasha Levin +--- + drivers/nvme/host/trace.h | 2 +- + include/linux/nvme.h | 2 ++ + 2 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/nvme/host/trace.h b/drivers/nvme/host/trace.h +index b5f85259461a..37c7f4c89f92 100644 +--- a/drivers/nvme/host/trace.h ++++ b/drivers/nvme/host/trace.h +@@ -69,7 +69,7 @@ TRACE_EVENT(nvme_setup_cmd, + __entry->metadata = !!blk_integrity_rq(req); + __entry->fctype = cmd->fabrics.fctype; + __assign_disk_name(__entry->disk, req->q->disk); +- memcpy(__entry->cdw10, &cmd->common.cdw10, ++ memcpy(__entry->cdw10, &cmd->common.cdws, + sizeof(__entry->cdw10)); + ), + TP_printk("nvme%d: %sqid=%d, cmdid=%u, nsid=%u, flags=0x%x, meta=0x%x, cmd=(%s %s)", +diff --git a/include/linux/nvme.h b/include/linux/nvme.h +index f626a445d1a8..99b1b56f0cd3 100644 +--- a/include/linux/nvme.h ++++ b/include/linux/nvme.h +@@ -867,12 +867,14 @@ struct nvme_common_command { + __le32 cdw2[2]; + __le64 metadata; + union nvme_data_ptr dptr; ++ struct_group(cdws, + __le32 cdw10; + __le32 cdw11; + __le32 cdw12; + __le32 cdw13; + __le32 cdw14; + __le32 cdw15; ++ ); + }; + + struct nvme_rw_command { +-- +2.35.1 + diff --git a/queue-5.18/pinctrl-aspeed-fix-potential-null-dereference-in-asp.patch b/queue-5.18/pinctrl-aspeed-fix-potential-null-dereference-in-asp.patch new file mode 100644 index 00000000000..5577cb362e4 --- /dev/null +++ b/queue-5.18/pinctrl-aspeed-fix-potential-null-dereference-in-asp.patch @@ -0,0 +1,42 @@ +From 6ccd4fd0911d0c833c98d7ca92f12c351d7ded0b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 21 Apr 2022 10:26:59 +0800 +Subject: pinctrl: aspeed: Fix potential NULL dereference in + aspeed_pinmux_set_mux() + +From: Haowen Bai + +[ Upstream commit 84a85d3fef2e75b1fe9fc2af6f5267122555a1ed ] + +pdesc could be null but still dereference pdesc->name and it will lead to +a null pointer access. So we move a null check before dereference. + +Signed-off-by: Haowen Bai +Link: https://lore.kernel.org/r/1650508019-22554-1-git-send-email-baihaowen@meizu.com +Signed-off-by: Linus Walleij +Signed-off-by: Sasha Levin +--- + drivers/pinctrl/aspeed/pinctrl-aspeed.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/pinctrl/aspeed/pinctrl-aspeed.c b/drivers/pinctrl/aspeed/pinctrl-aspeed.c +index c94e24aadf92..83d47ff1cea8 100644 +--- a/drivers/pinctrl/aspeed/pinctrl-aspeed.c ++++ b/drivers/pinctrl/aspeed/pinctrl-aspeed.c +@@ -236,11 +236,11 @@ int aspeed_pinmux_set_mux(struct pinctrl_dev *pctldev, unsigned int function, + const struct aspeed_sig_expr **funcs; + const struct aspeed_sig_expr ***prios; + +- pr_debug("Muxing pin %s for %s\n", pdesc->name, pfunc->name); +- + if (!pdesc) + return -EINVAL; + ++ pr_debug("Muxing pin %s for %s\n", pdesc->name, pfunc->name); ++ + prios = pdesc->prios; + + if (!prios) +-- +2.35.1 + diff --git a/queue-5.18/pinctrl-imx-add-the-zero-base-flag-for-imx93.patch b/queue-5.18/pinctrl-imx-add-the-zero-base-flag-for-imx93.patch new file mode 100644 index 00000000000..f0760f3139d --- /dev/null +++ b/queue-5.18/pinctrl-imx-add-the-zero-base-flag-for-imx93.patch @@ -0,0 +1,36 @@ +From 4086899344c5c1da7e5fba7695d8d0c35aa39bee Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 13 Jun 2022 11:18:54 +0800 +Subject: pinctrl: imx: Add the zero base flag for imx93 + +From: Jacky Bai + +[ Upstream commit fbc24ebc65507feb9728dc38197f90486148dda0 ] + +On i.MX93, the pin mux reg offset is from 0x0, +so need to add the 'ZERO_OFFSET_VALID' flag to make +sure the pin at mux offset 0 can be found. + +Signed-off-by: Jacky Bai +Link: https://lore.kernel.org/r/20220613031854.1571357-1-ping.bai@nxp.com +Signed-off-by: Linus Walleij +Signed-off-by: Sasha Levin +--- + drivers/pinctrl/freescale/pinctrl-imx93.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/pinctrl/freescale/pinctrl-imx93.c b/drivers/pinctrl/freescale/pinctrl-imx93.c +index c0630f69e995..417e41b37a6f 100644 +--- a/drivers/pinctrl/freescale/pinctrl-imx93.c ++++ b/drivers/pinctrl/freescale/pinctrl-imx93.c +@@ -239,6 +239,7 @@ static const struct pinctrl_pin_desc imx93_pinctrl_pads[] = { + static const struct imx_pinctrl_soc_info imx93_pinctrl_info = { + .pins = imx93_pinctrl_pads, + .npins = ARRAY_SIZE(imx93_pinctrl_pads), ++ .flags = ZERO_OFFSET_VALID, + .gpr_compatible = "fsl,imx93-iomuxc-gpr", + }; + +-- +2.35.1 + diff --git a/queue-5.18/platform-x86-hp-wmi-ignore-sanitization-mode-event.patch b/queue-5.18/platform-x86-hp-wmi-ignore-sanitization-mode-event.patch new file mode 100644 index 00000000000..834228ffb82 --- /dev/null +++ b/queue-5.18/platform-x86-hp-wmi-ignore-sanitization-mode-event.patch @@ -0,0 +1,49 @@ +From 0fb5031db0fccf8cdcb111cf764ba12fed63f963 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 28 Jun 2022 20:37:26 +0800 +Subject: platform/x86: hp-wmi: Ignore Sanitization Mode event + +From: Kai-Heng Feng + +[ Upstream commit 9ab762a84b8094540c18a170e5ddd6488632c456 ] + +After system resume the hp-wmi driver may complain: +[ 702.620180] hp_wmi: Unknown event_id - 23 - 0x0 + +According to HP it means 'Sanitization Mode' and it's harmless to just +ignore the event. + +Cc: Jorge Lopez +Signed-off-by: Kai-Heng Feng +Link: https://lore.kernel.org/r/20220628123726.250062-1-kai.heng.feng@canonical.com +Reviewed-by: Hans de Goede +Signed-off-by: Hans de Goede +Signed-off-by: Sasha Levin +--- + drivers/platform/x86/hp-wmi.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c +index 0e6ed75c70f3..c63ec1471b84 100644 +--- a/drivers/platform/x86/hp-wmi.c ++++ b/drivers/platform/x86/hp-wmi.c +@@ -89,6 +89,7 @@ enum hp_wmi_event_ids { + HPWMI_BACKLIT_KB_BRIGHTNESS = 0x0D, + HPWMI_PEAKSHIFT_PERIOD = 0x0F, + HPWMI_BATTERY_CHARGE_PERIOD = 0x10, ++ HPWMI_SANITIZATION_MODE = 0x17, + }; + + /* +@@ -846,6 +847,8 @@ static void hp_wmi_notify(u32 value, void *context) + break; + case HPWMI_BATTERY_CHARGE_PERIOD: + break; ++ case HPWMI_SANITIZATION_MODE: ++ break; + default: + pr_info("Unknown event_id - %d - 0x%x\n", event_id, event_data); + break; +-- +2.35.1 + diff --git a/queue-5.18/platform-x86-intel-pmc-add-alder-lake-n-support-to-p.patch b/queue-5.18/platform-x86-intel-pmc-add-alder-lake-n-support-to-p.patch new file mode 100644 index 00000000000..57ac2238047 --- /dev/null +++ b/queue-5.18/platform-x86-intel-pmc-add-alder-lake-n-support-to-p.patch @@ -0,0 +1,40 @@ +From f8a5af0010906d7304a36940d203c0526f81d83f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 14 Jun 2022 17:27:51 -0700 +Subject: platform/x86: intel/pmc: Add Alder Lake N support to PMC core driver + +From: Gayatri Kammela + +[ Upstream commit d63eae6747eb8b3192e89712f6553c6aa162f872 ] + +Add Alder Lake N (ADL-N) to the list of the platforms that Intel's +PMC core driver supports. Alder Lake N reuses all the TigerLake PCH IPs. + +Cc: Srinivas Pandruvada +Cc: Andy Shevchenko +Cc: David E. Box +Signed-off-by: Gayatri Kammela +Reviewed-by: Rajneesh Bhardwaj +Link: https://lore.kernel.org/r/20220615002751.3371730-1-gayatri.kammela@linux.intel.com +Reviewed-by: Hans de Goede +Signed-off-by: Hans de Goede +Signed-off-by: Sasha Levin +--- + drivers/platform/x86/intel/pmc/core.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/platform/x86/intel/pmc/core.c b/drivers/platform/x86/intel/pmc/core.c +index 8ee15a7252c7..c3ec5dc88bbf 100644 +--- a/drivers/platform/x86/intel/pmc/core.c ++++ b/drivers/platform/x86/intel/pmc/core.c +@@ -1911,6 +1911,7 @@ static const struct x86_cpu_id intel_pmc_core_ids[] = { + X86_MATCH_INTEL_FAM6_MODEL(ATOM_TREMONT_L, &icl_reg_map), + X86_MATCH_INTEL_FAM6_MODEL(ROCKETLAKE, &tgl_reg_map), + X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE_L, &tgl_reg_map), ++ X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE_N, &tgl_reg_map), + X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE, &adl_reg_map), + X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE_P, &tgl_reg_map), + {} +-- +2.35.1 + diff --git a/queue-5.18/platform-x86-thinkpad-acpi-profile-capabilities-as-i.patch b/queue-5.18/platform-x86-thinkpad-acpi-profile-capabilities-as-i.patch new file mode 100644 index 00000000000..74279ca887b --- /dev/null +++ b/queue-5.18/platform-x86-thinkpad-acpi-profile-capabilities-as-i.patch @@ -0,0 +1,171 @@ +From 19e3c8e55c1d20710b37e75832591974a3ebdc39 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 3 Jun 2022 13:02:09 -0400 +Subject: platform/x86: thinkpad-acpi: profile capabilities as integer + +From: Mark Pearson + +[ Upstream commit 42504af775361ca2330a2bfde496a5ebc5655c86 ] + +Currently the active mode (PSC/MMC) is stored in an enum and queried +throughout the driver. + +Other driver changes will enumerate additional submodes that are relevant +to be tracked, so instead track PSC/MMC in a single integer variable. + +Co-developed-by: Mario Limonciello +Signed-off-by: Mario Limonciello +Signed-off-by: Mark Pearson +Link: https://lore.kernel.org/r/20220603170212.164963-1-markpearson@lenovo.com +Reviewed-by: Hans de Goede +Signed-off-by: Hans de Goede +Signed-off-by: Sasha Levin +--- + drivers/platform/x86/thinkpad_acpi.c | 45 +++++++++++----------------- + 1 file changed, 18 insertions(+), 27 deletions(-) + +diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c +index aa6ffeaa3932..b4d6a356b746 100644 +--- a/drivers/platform/x86/thinkpad_acpi.c ++++ b/drivers/platform/x86/thinkpad_acpi.c +@@ -10300,21 +10300,15 @@ static struct ibm_struct proxsensor_driver_data = { + #define DYTC_DISABLE_CQL DYTC_SET_COMMAND(DYTC_FUNCTION_CQL, DYTC_MODE_MMC_BALANCE, 0) + #define DYTC_ENABLE_CQL DYTC_SET_COMMAND(DYTC_FUNCTION_CQL, DYTC_MODE_MMC_BALANCE, 1) + +-enum dytc_profile_funcmode { +- DYTC_FUNCMODE_NONE = 0, +- DYTC_FUNCMODE_MMC, +- DYTC_FUNCMODE_PSC, +-}; +- +-static enum dytc_profile_funcmode dytc_profile_available; + static enum platform_profile_option dytc_current_profile; + static atomic_t dytc_ignore_event = ATOMIC_INIT(0); + static DEFINE_MUTEX(dytc_mutex); ++static int dytc_capabilities; + static bool dytc_mmc_get_available; + + static int convert_dytc_to_profile(int dytcmode, enum platform_profile_option *profile) + { +- if (dytc_profile_available == DYTC_FUNCMODE_MMC) { ++ if (dytc_capabilities & BIT(DYTC_FC_MMC)) { + switch (dytcmode) { + case DYTC_MODE_MMC_LOWPOWER: + *profile = PLATFORM_PROFILE_LOW_POWER; +@@ -10331,7 +10325,7 @@ static int convert_dytc_to_profile(int dytcmode, enum platform_profile_option *p + } + return 0; + } +- if (dytc_profile_available == DYTC_FUNCMODE_PSC) { ++ if (dytc_capabilities & BIT(DYTC_FC_PSC)) { + switch (dytcmode) { + case DYTC_MODE_PSC_LOWPOWER: + *profile = PLATFORM_PROFILE_LOW_POWER; +@@ -10353,21 +10347,21 @@ static int convert_profile_to_dytc(enum platform_profile_option profile, int *pe + { + switch (profile) { + case PLATFORM_PROFILE_LOW_POWER: +- if (dytc_profile_available == DYTC_FUNCMODE_MMC) ++ if (dytc_capabilities & BIT(DYTC_FC_MMC)) + *perfmode = DYTC_MODE_MMC_LOWPOWER; +- else if (dytc_profile_available == DYTC_FUNCMODE_PSC) ++ else if (dytc_capabilities & BIT(DYTC_FC_PSC)) + *perfmode = DYTC_MODE_PSC_LOWPOWER; + break; + case PLATFORM_PROFILE_BALANCED: +- if (dytc_profile_available == DYTC_FUNCMODE_MMC) ++ if (dytc_capabilities & BIT(DYTC_FC_MMC)) + *perfmode = DYTC_MODE_MMC_BALANCE; +- else if (dytc_profile_available == DYTC_FUNCMODE_PSC) ++ else if (dytc_capabilities & BIT(DYTC_FC_PSC)) + *perfmode = DYTC_MODE_PSC_BALANCE; + break; + case PLATFORM_PROFILE_PERFORMANCE: +- if (dytc_profile_available == DYTC_FUNCMODE_MMC) ++ if (dytc_capabilities & BIT(DYTC_FC_MMC)) + *perfmode = DYTC_MODE_MMC_PERFORM; +- else if (dytc_profile_available == DYTC_FUNCMODE_PSC) ++ else if (dytc_capabilities & BIT(DYTC_FC_PSC)) + *perfmode = DYTC_MODE_PSC_PERFORM; + break; + default: /* Unknown profile */ +@@ -10446,7 +10440,7 @@ static int dytc_profile_set(struct platform_profile_handler *pprof, + if (err) + goto unlock; + +- if (dytc_profile_available == DYTC_FUNCMODE_MMC) { ++ if (dytc_capabilities & BIT(DYTC_FC_MMC)) { + if (profile == PLATFORM_PROFILE_BALANCED) { + /* + * To get back to balanced mode we need to issue a reset command. +@@ -10465,7 +10459,7 @@ static int dytc_profile_set(struct platform_profile_handler *pprof, + goto unlock; + } + } +- if (dytc_profile_available == DYTC_FUNCMODE_PSC) { ++ if (dytc_capabilities & BIT(DYTC_FC_PSC)) { + err = dytc_command(DYTC_SET_COMMAND(DYTC_FUNCTION_PSC, perfmode, 1), &output); + if (err) + goto unlock; +@@ -10484,12 +10478,12 @@ static void dytc_profile_refresh(void) + int perfmode; + + mutex_lock(&dytc_mutex); +- if (dytc_profile_available == DYTC_FUNCMODE_MMC) { ++ if (dytc_capabilities & BIT(DYTC_FC_MMC)) { + if (dytc_mmc_get_available) + err = dytc_command(DYTC_CMD_MMC_GET, &output); + else + err = dytc_cql_command(DYTC_CMD_GET, &output); +- } else if (dytc_profile_available == DYTC_FUNCMODE_PSC) ++ } else if (dytc_capabilities & BIT(DYTC_FC_PSC)) + err = dytc_command(DYTC_CMD_GET, &output); + + mutex_unlock(&dytc_mutex); +@@ -10518,7 +10512,6 @@ static int tpacpi_dytc_profile_init(struct ibm_init_struct *iibm) + set_bit(PLATFORM_PROFILE_BALANCED, dytc_profile.choices); + set_bit(PLATFORM_PROFILE_PERFORMANCE, dytc_profile.choices); + +- dytc_profile_available = DYTC_FUNCMODE_NONE; + err = dytc_command(DYTC_CMD_QUERY, &output); + if (err) + return err; +@@ -10531,13 +10524,12 @@ static int tpacpi_dytc_profile_init(struct ibm_init_struct *iibm) + return -ENODEV; + + /* Check what capabilities are supported */ +- err = dytc_command(DYTC_CMD_FUNC_CAP, &output); ++ err = dytc_command(DYTC_CMD_FUNC_CAP, &dytc_capabilities); + if (err) + return err; + +- if (output & BIT(DYTC_FC_MMC)) { /* MMC MODE */ +- dytc_profile_available = DYTC_FUNCMODE_MMC; +- ++ if (dytc_capabilities & BIT(DYTC_FC_MMC)) { /* MMC MODE */ ++ pr_debug("MMC is supported\n"); + /* + * Check if MMC_GET functionality available + * Version > 6 and return success from MMC_GET command +@@ -10548,8 +10540,8 @@ static int tpacpi_dytc_profile_init(struct ibm_init_struct *iibm) + if (!err && ((output & DYTC_ERR_MASK) == DYTC_ERR_SUCCESS)) + dytc_mmc_get_available = true; + } +- } else if (output & BIT(DYTC_FC_PSC)) { /* PSC MODE */ +- dytc_profile_available = DYTC_FUNCMODE_PSC; ++ } else if (dytc_capabilities & BIT(DYTC_FC_PSC)) { /* PSC MODE */ ++ pr_debug("PSC is supported\n"); + } else { + dbg_printk(TPACPI_DBG_INIT, "No DYTC support available\n"); + return -ENODEV; +@@ -10575,7 +10567,6 @@ static int tpacpi_dytc_profile_init(struct ibm_init_struct *iibm) + + static void dytc_profile_exit(void) + { +- dytc_profile_available = DYTC_FUNCMODE_NONE; + platform_profile_remove(); + } + +-- +2.35.1 + diff --git a/queue-5.18/platform-x86-thinkpad_acpi-do-not-use-psc-mode-on-in.patch b/queue-5.18/platform-x86-thinkpad_acpi-do-not-use-psc-mode-on-in.patch new file mode 100644 index 00000000000..93f165af5fb --- /dev/null +++ b/queue-5.18/platform-x86-thinkpad_acpi-do-not-use-psc-mode-on-in.patch @@ -0,0 +1,45 @@ +From bb9e5d9b6f4a4a57c69b5f03e07ca5066c3aa102 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 27 Jun 2022 14:14:49 -0400 +Subject: platform/x86: thinkpad_acpi: do not use PSC mode on Intel platforms + +From: Mark Pearson + +[ Upstream commit bce6243f767f7da88aa4674d5d678f9f156eaba9 ] + +PSC platform profile mode is only supported on Linux for AMD platforms. + +Some older Intel platforms (e.g T490) are advertising it's capability +as Windows uses it - but on Linux we should only be using MMC profile +for Intel systems. + +Add a check to prevent it being enabled incorrectly. + +Signed-off-by: Mark Pearson +Link: https://lore.kernel.org/r/20220627181449.3537-1-markpearson@lenovo.com +Reviewed-by: Hans de Goede +Signed-off-by: Hans de Goede +Signed-off-by: Sasha Levin +--- + drivers/platform/x86/thinkpad_acpi.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c +index b4d6a356b746..a8b383051528 100644 +--- a/drivers/platform/x86/thinkpad_acpi.c ++++ b/drivers/platform/x86/thinkpad_acpi.c +@@ -10541,6 +10541,11 @@ static int tpacpi_dytc_profile_init(struct ibm_init_struct *iibm) + dytc_mmc_get_available = true; + } + } else if (dytc_capabilities & BIT(DYTC_FC_PSC)) { /* PSC MODE */ ++ /* Support for this only works on AMD platforms */ ++ if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD) { ++ dbg_printk(TPACPI_DBG_INIT, "PSC not support on Intel platforms\n"); ++ return -ENODEV; ++ } + pr_debug("PSC is supported\n"); + } else { + dbg_printk(TPACPI_DBG_INIT, "No DYTC support available\n"); +-- +2.35.1 + diff --git a/queue-5.18/powerpc-xive-spapr-correct-bitmap-allocation-size.patch b/queue-5.18/powerpc-xive-spapr-correct-bitmap-allocation-size.patch new file mode 100644 index 00000000000..f35ca9cb07b --- /dev/null +++ b/queue-5.18/powerpc-xive-spapr-correct-bitmap-allocation-size.patch @@ -0,0 +1,112 @@ +From da5888be73db1503204f824c282d7aef7cfbe455 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 23 Jun 2022 13:25:09 -0500 +Subject: powerpc/xive/spapr: correct bitmap allocation size +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Nathan Lynch + +[ Upstream commit 19fc5bb93c6bbdce8292b4d7eed04e2fa118d2fe ] + +kasan detects access beyond the end of the xibm->bitmap allocation: + +BUG: KASAN: slab-out-of-bounds in _find_first_zero_bit+0x40/0x140 +Read of size 8 at addr c00000001d1d0118 by task swapper/0/1 + +CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.19.0-rc2-00001-g90df023b36dd #28 +Call Trace: +[c00000001d98f770] [c0000000012baab8] dump_stack_lvl+0xac/0x108 (unreliable) +[c00000001d98f7b0] [c00000000068faac] print_report+0x37c/0x710 +[c00000001d98f880] [c0000000006902c0] kasan_report+0x110/0x354 +[c00000001d98f950] [c000000000692324] __asan_load8+0xa4/0xe0 +[c00000001d98f970] [c0000000011c6ed0] _find_first_zero_bit+0x40/0x140 +[c00000001d98f9b0] [c0000000000dbfbc] xive_spapr_get_ipi+0xcc/0x260 +[c00000001d98fa70] [c0000000000d6d28] xive_setup_cpu_ipi+0x1e8/0x450 +[c00000001d98fb30] [c000000004032a20] pSeries_smp_probe+0x5c/0x118 +[c00000001d98fb60] [c000000004018b44] smp_prepare_cpus+0x944/0x9ac +[c00000001d98fc90] [c000000004009f9c] kernel_init_freeable+0x2d4/0x640 +[c00000001d98fd90] [c0000000000131e8] kernel_init+0x28/0x1d0 +[c00000001d98fe10] [c00000000000cd54] ret_from_kernel_thread+0x5c/0x64 + +Allocated by task 0: + kasan_save_stack+0x34/0x70 + __kasan_kmalloc+0xb4/0xf0 + __kmalloc+0x268/0x540 + xive_spapr_init+0x4d0/0x77c + pseries_init_irq+0x40/0x27c + init_IRQ+0x44/0x84 + start_kernel+0x2a4/0x538 + start_here_common+0x1c/0x20 + +The buggy address belongs to the object at c00000001d1d0118 + which belongs to the cache kmalloc-8 of size 8 +The buggy address is located 0 bytes inside of + 8-byte region [c00000001d1d0118, c00000001d1d0120) + +The buggy address belongs to the physical page: +page:c00c000000074740 refcount:1 mapcount:0 mapping:0000000000000000 index:0xc00000001d1d0558 pfn:0x1d1d +flags: 0x7ffff000000200(slab|node=0|zone=0|lastcpupid=0x7ffff) +raw: 007ffff000000200 c00000001d0003c8 c00000001d0003c8 c00000001d010480 +raw: c00000001d1d0558 0000000001e1000a 00000001ffffffff 0000000000000000 +page dumped because: kasan: bad access detected + +Memory state around the buggy address: + c00000001d1d0000: fc 00 fc fc fc fc fc fc fc fc fc fc fc fc fc fc + c00000001d1d0080: fc fc 00 fc fc fc fc fc fc fc fc fc fc fc fc fc +>c00000001d1d0100: fc fc fc 02 fc fc fc fc fc fc fc fc fc fc fc fc + ^ + c00000001d1d0180: fc fc fc fc 04 fc fc fc fc fc fc fc fc fc fc fc + c00000001d1d0200: fc fc fc fc fc 04 fc fc fc fc fc fc fc fc fc fc + +This happens because the allocation uses the wrong unit (bits) when it +should pass (BITS_TO_LONGS(count) * sizeof(long)) or equivalent. With small +numbers of bits, the allocated object can be smaller than sizeof(long), +which results in invalid accesses. + +Use bitmap_zalloc() to allocate and initialize the irq bitmap, paired with +bitmap_free() for consistency. + +Signed-off-by: Nathan Lynch +Reviewed-by: Cédric Le Goater +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/20220623182509.3985625-1-nathanl@linux.ibm.com +Signed-off-by: Sasha Levin +--- + arch/powerpc/sysdev/xive/spapr.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/arch/powerpc/sysdev/xive/spapr.c b/arch/powerpc/sysdev/xive/spapr.c +index 503f544d28e2..b0d36e430dbc 100644 +--- a/arch/powerpc/sysdev/xive/spapr.c ++++ b/arch/powerpc/sysdev/xive/spapr.c +@@ -13,6 +13,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -55,7 +56,7 @@ static int __init xive_irq_bitmap_add(int base, int count) + spin_lock_init(&xibm->lock); + xibm->base = base; + xibm->count = count; +- xibm->bitmap = kzalloc(xibm->count, GFP_KERNEL); ++ xibm->bitmap = bitmap_zalloc(xibm->count, GFP_KERNEL); + if (!xibm->bitmap) { + kfree(xibm); + return -ENOMEM; +@@ -73,7 +74,7 @@ static void xive_irq_bitmap_remove_all(void) + + list_for_each_entry_safe(xibm, tmp, &xive_irq_bitmaps, list) { + list_del(&xibm->list); +- kfree(xibm->bitmap); ++ bitmap_free(xibm->bitmap); + kfree(xibm); + } + } +-- +2.35.1 + diff --git a/queue-5.18/revert-can-xilinx_can-limit-canfd-brp-to-2.patch b/queue-5.18/revert-can-xilinx_can-limit-canfd-brp-to-2.patch new file mode 100644 index 00000000000..050f1b7ce90 --- /dev/null +++ b/queue-5.18/revert-can-xilinx_can-limit-canfd-brp-to-2.patch @@ -0,0 +1,48 @@ +From 50900696566a421a0339d04e1a9a506a659cbe0b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 9 Jun 2022 13:54:32 +0530 +Subject: Revert "can: xilinx_can: Limit CANFD brp to 2" + +From: Srinivas Neeli + +[ Upstream commit c6da4590fe819dfe28a4f8037a8dc1e056542fb4 ] + +This reverts commit 05ca14fdb6fe65614e0652d03e44b02748d25af7. + +On early silicon engineering samples observed bit shrinking issue when +we use brp as 1. Hence updated brp_min as 2. As in production silicon +this issue is fixed, so reverting the patch. + +Link: https://lore.kernel.org/all/20220609082433.1191060-2-srinivas.neeli@xilinx.com +Signed-off-by: Srinivas Neeli +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Sasha Levin +--- + drivers/net/can/xilinx_can.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c +index 43f0c6a064ba..75b4db4d050b 100644 +--- a/drivers/net/can/xilinx_can.c ++++ b/drivers/net/can/xilinx_can.c +@@ -259,7 +259,7 @@ static const struct can_bittiming_const xcan_bittiming_const_canfd2 = { + .tseg2_min = 1, + .tseg2_max = 128, + .sjw_max = 128, +- .brp_min = 2, ++ .brp_min = 1, + .brp_max = 256, + .brp_inc = 1, + }; +@@ -272,7 +272,7 @@ static const struct can_bittiming_const xcan_data_bittiming_const_canfd2 = { + .tseg2_min = 1, + .tseg2_max = 16, + .sjw_max = 16, +- .brp_min = 2, ++ .brp_min = 1, + .brp_max = 256, + .brp_inc = 1, + }; +-- +2.35.1 + diff --git a/queue-5.18/s390-nospec-build-expoline.o-for-modules_prepare-tar.patch b/queue-5.18/s390-nospec-build-expoline.o-for-modules_prepare-tar.patch new file mode 100644 index 00000000000..2ff4a7f008a --- /dev/null +++ b/queue-5.18/s390-nospec-build-expoline.o-for-modules_prepare-tar.patch @@ -0,0 +1,93 @@ +From af166715262f9afca76b03b47f7df2d3ae06a24e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 27 Jun 2022 14:50:53 +0200 +Subject: s390/nospec: build expoline.o for modules_prepare target + +From: Vasily Gorbik + +[ Upstream commit c4e789572557aa147b13bf7fe09cc99663ed0cf5 ] + +When CONFIG_EXPOLINE_EXTERN is used expoline thunks are generated +from arch/s390/lib/expoline.S and postlinked into every module. +This is also true for external modules. Add expoline.o build to +the modules_prepare target. + +Fixes: 1d2ad084800e ("s390/nospec: add an option to use thunk-extern") +Reported-by: Joe Lawrence +Tested-by: Sumanth Korikkar +Acked-by: Sumanth Korikkar +Tested-by: C. Erastus Toe +Tested-by: Joe Lawrence +Link: https://lore.kernel.org/r/patch-1.thread-d13b6c.git-a2387a74dc49.your-ad-here.call-01656331067-ext-4899@work.hours +Signed-off-by: Vasily Gorbik +Signed-off-by: Alexander Gordeev +Signed-off-by: Sasha Levin +--- + arch/s390/Makefile | 8 +++++++- + arch/s390/lib/Makefile | 3 ++- + arch/s390/lib/expoline/Makefile | 3 +++ + arch/s390/lib/{ => expoline}/expoline.S | 0 + 4 files changed, 12 insertions(+), 2 deletions(-) + create mode 100644 arch/s390/lib/expoline/Makefile + rename arch/s390/lib/{ => expoline}/expoline.S (100%) + +diff --git a/arch/s390/Makefile b/arch/s390/Makefile +index eba70d585cb2..5b7e761b2d50 100644 +--- a/arch/s390/Makefile ++++ b/arch/s390/Makefile +@@ -80,7 +80,7 @@ endif + + ifdef CONFIG_EXPOLINE + ifdef CONFIG_EXPOLINE_EXTERN +- KBUILD_LDFLAGS_MODULE += arch/s390/lib/expoline.o ++ KBUILD_LDFLAGS_MODULE += arch/s390/lib/expoline/expoline.o + CC_FLAGS_EXPOLINE := -mindirect-branch=thunk-extern + CC_FLAGS_EXPOLINE += -mfunction-return=thunk-extern + else +@@ -162,6 +162,12 @@ vdso_prepare: prepare0 + $(Q)$(MAKE) $(build)=arch/s390/kernel/vdso64 include/generated/vdso64-offsets.h + $(if $(CONFIG_COMPAT),$(Q)$(MAKE) \ + $(build)=arch/s390/kernel/vdso32 include/generated/vdso32-offsets.h) ++ ++ifdef CONFIG_EXPOLINE_EXTERN ++modules_prepare: expoline_prepare ++expoline_prepare: prepare0 ++ $(Q)$(MAKE) $(build)=arch/s390/lib/expoline arch/s390/lib/expoline/expoline.o ++endif + endif + + # Don't use tabs in echo arguments +diff --git a/arch/s390/lib/Makefile b/arch/s390/lib/Makefile +index 5d415b3db6d1..580d2e3265cb 100644 +--- a/arch/s390/lib/Makefile ++++ b/arch/s390/lib/Makefile +@@ -7,7 +7,6 @@ lib-y += delay.o string.o uaccess.o find.o spinlock.o + obj-y += mem.o xor.o + lib-$(CONFIG_KPROBES) += probes.o + lib-$(CONFIG_UPROBES) += probes.o +-obj-$(CONFIG_EXPOLINE_EXTERN) += expoline.o + obj-$(CONFIG_S390_KPROBES_SANITY_TEST) += test_kprobes_s390.o + test_kprobes_s390-objs += test_kprobes_asm.o test_kprobes.o + +@@ -22,3 +21,5 @@ obj-$(CONFIG_S390_MODULES_SANITY_TEST) += test_modules.o + obj-$(CONFIG_S390_MODULES_SANITY_TEST_HELPERS) += test_modules_helpers.o + + lib-$(CONFIG_FUNCTION_ERROR_INJECTION) += error-inject.o ++ ++obj-$(CONFIG_EXPOLINE_EXTERN) += expoline/ +diff --git a/arch/s390/lib/expoline/Makefile b/arch/s390/lib/expoline/Makefile +new file mode 100644 +index 000000000000..854631d9cb03 +--- /dev/null ++++ b/arch/s390/lib/expoline/Makefile +@@ -0,0 +1,3 @@ ++# SPDX-License-Identifier: GPL-2.0 ++ ++obj-y += expoline.o +diff --git a/arch/s390/lib/expoline.S b/arch/s390/lib/expoline/expoline.S +similarity index 100% +rename from arch/s390/lib/expoline.S +rename to arch/s390/lib/expoline/expoline.S +-- +2.35.1 + diff --git a/queue-5.18/scsi-hisi_sas-limit-max-hw-sectors-for-v3-hw.patch b/queue-5.18/scsi-hisi_sas-limit-max-hw-sectors-for-v3-hw.patch new file mode 100644 index 00000000000..ab2e3e96384 --- /dev/null +++ b/queue-5.18/scsi-hisi_sas-limit-max-hw-sectors-for-v3-hw.patch @@ -0,0 +1,53 @@ +From 3d431e101da439002dd86ab2dda5450e1f25d4b9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 23 Jun 2022 20:41:59 +0800 +Subject: scsi: hisi_sas: Limit max hw sectors for v3 HW + +From: John Garry + +[ Upstream commit fce54ed027577517df1e74b7d54dc2b1bd536887 ] + +If the controller is behind an IOMMU then the IOMMU IOVA caching range can +affect performance, as discussed in [0]. + +Limit the max HW sectors to not exceed this limit. We need to hardcode the +value until a proper DMA mapping API is available. + +[0] https://lore.kernel.org/linux-iommu/20210129092120.1482-1-thunder.leizhen@huawei.com/ + +Link: https://lore.kernel.org/r/1655988119-223714-1-git-send-email-john.garry@huawei.com +Signed-off-by: John Garry +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +index 7d819fc0395e..eb86afb21aab 100644 +--- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c ++++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +@@ -2782,6 +2782,7 @@ static int slave_configure_v3_hw(struct scsi_device *sdev) + struct hisi_hba *hisi_hba = shost_priv(shost); + struct device *dev = hisi_hba->dev; + int ret = sas_slave_configure(sdev); ++ unsigned int max_sectors; + + if (ret) + return ret; +@@ -2799,6 +2800,12 @@ static int slave_configure_v3_hw(struct scsi_device *sdev) + } + } + ++ /* Set according to IOMMU IOVA caching limit */ ++ max_sectors = min_t(size_t, queue_max_hw_sectors(sdev->request_queue), ++ (PAGE_SIZE * 32) >> SECTOR_SHIFT); ++ ++ blk_queue_max_hw_sectors(sdev->request_queue, max_sectors); ++ + return 0; + } + +-- +2.35.1 + diff --git a/queue-5.18/scsi-megaraid-clear-read-queue-map-s-nr_queues.patch b/queue-5.18/scsi-megaraid-clear-read-queue-map-s-nr_queues.patch new file mode 100644 index 00000000000..368639e3331 --- /dev/null +++ b/queue-5.18/scsi-megaraid-clear-read-queue-map-s-nr_queues.patch @@ -0,0 +1,48 @@ +From adadc6ba7a3f3c4de5cc487cc86ad37a41de8ffe Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 6 Jul 2022 20:59:42 +0800 +Subject: scsi: megaraid: Clear READ queue map's nr_queues + +From: Ming Lei + +[ Upstream commit 8312cd3a7b835ae3033a679e5f0014a40e7891c5 ] + +The megaraid SCSI driver sets set->nr_maps as 3 if poll_queues is > 0, and +blk-mq actually initializes each map's nr_queues as nr_hw_queues. +Consequently the driver has to clear READ queue map's nr_queues, otherwise +the queue map becomes broken if poll_queues is set as non-zero. + +Link: https://lore.kernel.org/r/20220706125942.528533-1-ming.lei@redhat.com +Fixes: 9e4bec5b2a23 ("scsi: megaraid_sas: mq_poll support") +Cc: Kashyap Desai +Cc: sumit.saxena@broadcom.com +Cc: chandrakanth.patil@broadcom.com +Cc: linux-block@vger.kernel.org +Cc: Hannes Reinecke +Reported-by: Guangwu Zhang +Tested-by: Guangwu Zhang +Reviewed-by: Bart Van Assche +Signed-off-by: Ming Lei +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/megaraid/megaraid_sas_base.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c +index db6793608447..f5deb0e561a9 100644 +--- a/drivers/scsi/megaraid/megaraid_sas_base.c ++++ b/drivers/scsi/megaraid/megaraid_sas_base.c +@@ -3195,6 +3195,9 @@ static int megasas_map_queues(struct Scsi_Host *shost) + qoff += map->nr_queues; + offset += map->nr_queues; + ++ /* we never use READ queue, so can't cheat blk-mq */ ++ shost->tag_set.map[HCTX_TYPE_READ].nr_queues = 0; ++ + /* Setup Poll hctx */ + map = &shost->tag_set.map[HCTX_TYPE_POLL]; + map->nr_queues = instance->iopoll_q_count; +-- +2.35.1 + diff --git a/queue-5.18/scsi-ufs-core-drop-loglevel-of-writeboost-message.patch b/queue-5.18/scsi-ufs-core-drop-loglevel-of-writeboost-message.patch new file mode 100644 index 00000000000..49d892e2e5f --- /dev/null +++ b/queue-5.18/scsi-ufs-core-drop-loglevel-of-writeboost-message.patch @@ -0,0 +1,43 @@ +From 6145f4cf880f969fa700f583a2c8e74a9c0a3870 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 8 Jul 2022 17:00:27 -0700 +Subject: scsi: ufs: core: Drop loglevel of WriteBoost message + +From: Bjorn Andersson + +[ Upstream commit 2ae57c995003a7840cb6b5ec5f0c06193695321b ] + +Commit '3b5f3c0d0548 ("scsi: ufs: core: Tidy up WB configuration code")' +changed the log level of the write boost enable/disable notification from +debug to info. This results in a lot of noise in the kernel log during +normal operation. + +Drop it back to debug level to avoid this. + +Link: https://lore.kernel.org/r/20220709000027.3929970-1-bjorn.andersson@linaro.org +Fixes: 3b5f3c0d0548 ("scsi: ufs: core: Tidy up WB configuration code") +Reviewed-by: Alim Akhtar +Acked-by: Bean Huo +Signed-off-by: Bjorn Andersson +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/ufs/ufshcd.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c +index 4c9eb4be449c..452ad0612067 100644 +--- a/drivers/scsi/ufs/ufshcd.c ++++ b/drivers/scsi/ufs/ufshcd.c +@@ -5722,7 +5722,7 @@ int ufshcd_wb_toggle(struct ufs_hba *hba, bool enable) + } + + hba->dev_info.wb_enabled = enable; +- dev_info(hba->dev, "%s Write Booster %s\n", ++ dev_dbg(hba->dev, "%s Write Booster %s\n", + __func__, enable ? "enabled" : "disabled"); + + return ret; +-- +2.35.1 + diff --git a/queue-5.18/series b/queue-5.18/series index 57057ba2559..23c28045f67 100644 --- a/queue-5.18/series +++ b/queue-5.18/series @@ -144,3 +144,75 @@ x86-bugs-report-amd-retbleed-vulnerability.patch objtool-update-retpoline-validation.patch x86-xen-rename-sys-entry-points.patch x86-cpu-amd-add-spectral-chicken.patch +arm-9211-1-domain-drop-modify_domain.patch +arm-9212-1-domain-modify-kconfig-help-text.patch +asoc-dt-bindings-fix-description-for-msm8916.patch +tee-tee_get_drvdata-fix-description-of-return-value.patch +tty-extract-tty_flip_buffer_commit-from-tty_flip_buf.patch +tty-use-new-tty_insert_flip_string_and_push_buffer-i.patch +s390-nospec-build-expoline.o-for-modules_prepare-tar.patch +scsi-megaraid-clear-read-queue-map-s-nr_queues.patch +scsi-ufs-core-drop-loglevel-of-writeboost-message.patch +nvme-fix-block-device-naming-collision.patch +ksmbd-use-sock_nonblock-type-for-kernel_accept.patch +powerpc-xive-spapr-correct-bitmap-allocation-size.patch +vdpa-mlx5-initialize-cvq-vringh-only-once.patch +vduse-tie-vduse-mgmtdev-and-its-device.patch +platform-x86-intel-pmc-add-alder-lake-n-support-to-p.patch +virtio_mmio-add-missing-pm-calls-to-freeze-restore.patch +virtio_mmio-restore-guest-page-size-on-resume.patch +netfilter-nf_tables-avoid-skb-access-on-nf_stolen.patch +netfilter-br_netfilter-do-not-skip-all-hooks-with-0-.patch +scsi-hisi_sas-limit-max-hw-sectors-for-v3-hw.patch +cpufreq-pmac32-cpufreq-fix-refcount-leak-bug.patch +platform-x86-thinkpad-acpi-profile-capabilities-as-i.patch +platform-x86-thinkpad_acpi-do-not-use-psc-mode-on-in.patch +platform-x86-hp-wmi-ignore-sanitization-mode-event.patch +firmware-sysfb-make-sysfb_create_simplefb-return-a-p.patch +firmware-sysfb-add-sysfb_disable-helper-function.patch +fbdev-disable-sysfb-device-registration-when-removin.patch +net-tipc-fix-possible-refcount-leak-in-tipc_sk_creat.patch +nfc-nxp-nci-don-t-print-header-length-mismatch-on-i2.patch +nvme-tcp-always-fail-a-request-when-sending-it-faile.patch +nvme-fix-regression-when-disconnect-a-recovering-ctr.patch +net-sfp-fix-memory-leak-in-sfp_probe.patch +asoc-ops-fix-off-by-one-in-range-control-validation.patch +pinctrl-aspeed-fix-potential-null-dereference-in-asp.patch +asoc-realtek-maxim-soundwire-codecs-disable-pm_runti.patch +asoc-rt711-sdca-sdw-fix-calibrate-mutex-initializati.patch +asoc-intel-sof_sdw-handle-errors-on-card-registratio.patch +asoc-rt711-fix-calibrate-mutex-initialization.patch +asoc-rt7-sdw-harden-jack_detect_handler.patch +asoc-codecs-rt700-rt711-rt711-sdca-initialize-workqu.patch +asoc-sof-intel-hda-dsp-expose-hda_dsp_core_power_up.patch +asoc-sof-intel-hda-loader-make-sure-that-the-fw-load.patch +asoc-sof-intel-hda-loader-clarify-the-cl_dsp_init-fl.patch +asoc-wcd9335-remove-rx-channel-from-old-list-before-.patch +asoc-wcd9335-fix-spurious-event-generation.patch +asoc-wcd938x-fix-event-generation-for-some-controls.patch +asoc-intel-bytcr_wm5102-fix-gpio-related-probe-order.patch +asoc-rockchip-i2s-switch-bclk-to-gpio.patch +asoc-wm_adsp-fix-event-for-preloader.patch +asoc-wm5110-fix-dre-control.patch +asoc-cs35l41-correct-some-control-names.patch +asoc-rt711-sdca-fix-kernel-null-pointer-dereference-.patch +asoc-dapm-initialise-kcontrol-data-for-mux-demux-con.patch +asoc-cs35l41-add-asp-tx3-4-source-to-register-patch.patch +asoc-cs47l15-fix-event-generation-for-low-power-mux-.patch +asoc-madera-fix-event-generation-for-out1-demux.patch +asoc-madera-fix-event-generation-for-rate-controls.patch +irqchip-or1k-pic-undefine-mask_ack-for-level-trigger.patch +pinctrl-imx-add-the-zero-base-flag-for-imx93.patch +x86-clear-.brk-area-at-early-boot.patch +soc-ixp4xx-npe-fix-unused-match-warning.patch +arm-dts-stm32-use-the-correct-clock-source-for-cec-o.patch +revert-can-xilinx_can-limit-canfd-brp-to-2.patch +alsa-usb-audio-add-quirks-for-macrosilicon-ms2100-ms.patch +alsa-usb-audio-add-quirk-for-fiero-sc-01.patch +alsa-usb-audio-add-quirk-for-fiero-sc-01-fw-v1.0.0.patch +nvme-pci-phison-e16-has-bogus-namespace-ids.patch +nvme-use-struct-group-for-generic-command-dwords.patch +wireguard-selftests-set-fake-real-time-in-init.patch +wireguard-selftests-use-virt-machine-on-m68k.patch +wireguard-selftests-always-call-kernel-makefile.patch +signal-handling-don-t-use-bug_on-for-debugging.patch diff --git a/queue-5.18/signal-handling-don-t-use-bug_on-for-debugging.patch b/queue-5.18/signal-handling-don-t-use-bug_on-for-debugging.patch new file mode 100644 index 00000000000..47c36d81a82 --- /dev/null +++ b/queue-5.18/signal-handling-don-t-use-bug_on-for-debugging.patch @@ -0,0 +1,54 @@ +From 6f16d5765c877d39f1f87a59d36c36b19b2d7e32 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 6 Jul 2022 12:20:59 -0700 +Subject: signal handling: don't use BUG_ON() for debugging + +From: Linus Torvalds + +[ Upstream commit a382f8fee42ca10c9bfce0d2352d4153f931f5dc ] + +These are indeed "should not happen" situations, but it turns out recent +changes made the 'task_is_stopped_or_trace()' case trigger (fix for that +exists, is pending more testing), and the BUG_ON() makes it +unnecessarily hard to actually debug for no good reason. + +It's been that way for a long time, but let's make it clear: BUG_ON() is +not good for debugging, and should never be used in situations where you +could just say "this shouldn't happen, but we can continue". + +Use WARN_ON_ONCE() instead to make sure it gets logged, and then just +continue running. Instead of making the system basically unusuable +because you crashed the machine while potentially holding some very core +locks (eg this function is commonly called while holding 'tasklist_lock' +for writing). + +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +--- + kernel/signal.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/kernel/signal.c b/kernel/signal.c +index e43bc2a692f5..75cc2339d83e 100644 +--- a/kernel/signal.c ++++ b/kernel/signal.c +@@ -2031,12 +2031,12 @@ bool do_notify_parent(struct task_struct *tsk, int sig) + bool autoreap = false; + u64 utime, stime; + +- BUG_ON(sig == -1); ++ WARN_ON_ONCE(sig == -1); + +- /* do_notify_parent_cldstop should have been called instead. */ +- BUG_ON(task_is_stopped_or_traced(tsk)); ++ /* do_notify_parent_cldstop should have been called instead. */ ++ WARN_ON_ONCE(task_is_stopped_or_traced(tsk)); + +- BUG_ON(!tsk->ptrace && ++ WARN_ON_ONCE(!tsk->ptrace && + (tsk->group_leader != tsk || !thread_group_empty(tsk))); + + /* Wake up all pidfd waiters */ +-- +2.35.1 + diff --git a/queue-5.18/soc-ixp4xx-npe-fix-unused-match-warning.patch b/queue-5.18/soc-ixp4xx-npe-fix-unused-match-warning.patch new file mode 100644 index 00000000000..ddbd6888bb3 --- /dev/null +++ b/queue-5.18/soc-ixp4xx-npe-fix-unused-match-warning.patch @@ -0,0 +1,45 @@ +From 54c49cf9e9fc8052aad65597882c5bf03290578d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 26 Jun 2022 09:43:15 +0200 +Subject: soc: ixp4xx/npe: Fix unused match warning + +From: Linus Walleij + +[ Upstream commit 620f83b8326ce9706b1118334f0257ae028ce045 ] + +The kernel test robot found this inconsistency: + + drivers/soc/ixp4xx/ixp4xx-npe.c:737:34: warning: + 'ixp4xx_npe_of_match' defined but not used [-Wunused-const-variable=] + 737 | static const struct of_device_id ixp4xx_npe_of_match[] = { + +This is because the match is enclosed in the of_match_ptr() +which compiles into NULL when OF is disabled and this +is unnecessary. + +Fix it by dropping of_match_ptr() around the match. + +Signed-off-by: Linus Walleij +Link: https://lore.kernel.org/r/20220626074315.61209-1-linus.walleij@linaro.org' +Signed-off-by: Arnd Bergmann +Signed-off-by: Sasha Levin +--- + drivers/soc/ixp4xx/ixp4xx-npe.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/soc/ixp4xx/ixp4xx-npe.c b/drivers/soc/ixp4xx/ixp4xx-npe.c +index 613935cb6a48..58240e320c13 100644 +--- a/drivers/soc/ixp4xx/ixp4xx-npe.c ++++ b/drivers/soc/ixp4xx/ixp4xx-npe.c +@@ -758,7 +758,7 @@ static const struct of_device_id ixp4xx_npe_of_match[] = { + static struct platform_driver ixp4xx_npe_driver = { + .driver = { + .name = "ixp4xx-npe", +- .of_match_table = of_match_ptr(ixp4xx_npe_of_match), ++ .of_match_table = ixp4xx_npe_of_match, + }, + .probe = ixp4xx_npe_probe, + .remove = ixp4xx_npe_remove, +-- +2.35.1 + diff --git a/queue-5.18/tee-tee_get_drvdata-fix-description-of-return-value.patch b/queue-5.18/tee-tee_get_drvdata-fix-description-of-return-value.patch new file mode 100644 index 00000000000..9de43b7d16f --- /dev/null +++ b/queue-5.18/tee-tee_get_drvdata-fix-description-of-return-value.patch @@ -0,0 +1,38 @@ +From 1b8f7bc0d8e8877da6bd28e9826eb186519db2cb Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 6 Jun 2022 13:43:53 +0200 +Subject: tee: tee_get_drvdata(): fix description of return value + +From: Marc Kleine-Budde + +[ Upstream commit e5ce073c8a1e01b215a5eb32ba48f8d17ded3bd5 ] + +This patch fixes the description of tee_get_drvdata()'s return value. +It actually returns the driver_data pointer supplied to +tee_device_alloc() since the TEE subsystem was added to the kernel. + +Fixes: 967c9cca2cc5 ("tee: generic TEE subsystem") +Cc: Jens Wiklander +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Jens Wiklander +Signed-off-by: Sasha Levin +--- + drivers/tee/tee_core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/tee/tee_core.c b/drivers/tee/tee_core.c +index 8aa1a4836b92..cebe4963ad87 100644 +--- a/drivers/tee/tee_core.c ++++ b/drivers/tee/tee_core.c +@@ -1075,7 +1075,7 @@ EXPORT_SYMBOL_GPL(tee_device_unregister); + /** + * tee_get_drvdata() - Return driver_data pointer + * @teedev: Device containing the driver_data pointer +- * @returns the driver_data pointer supplied to tee_register(). ++ * @returns the driver_data pointer supplied to tee_device_alloc(). + */ + void *tee_get_drvdata(struct tee_device *teedev) + { +-- +2.35.1 + diff --git a/queue-5.18/tty-extract-tty_flip_buffer_commit-from-tty_flip_buf.patch b/queue-5.18/tty-extract-tty_flip_buffer_commit-from-tty_flip_buf.patch new file mode 100644 index 00000000000..4d7c94ce29a --- /dev/null +++ b/queue-5.18/tty-extract-tty_flip_buffer_commit-from-tty_flip_buf.patch @@ -0,0 +1,61 @@ +From 16e3d271c871ada7e72ad682f0f451b72fba02b0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 7 Jul 2022 10:25:57 +0200 +Subject: tty: extract tty_flip_buffer_commit() from tty_flip_buffer_push() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Jiri Slaby + +[ Upstream commit 716b10580283fda66f2b88140e3964f8a7f9da89 ] + +We will need this new helper in the next patch. + +Cc: Hillf Danton +Cc: 一只狗 +Cc: Dan Carpenter +Signed-off-by: Jiri Slaby +Link: https://lore.kernel.org/r/20220707082558.9250-1-jslaby@suse.cz +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/tty/tty_buffer.c | 15 ++++++++++----- + 1 file changed, 10 insertions(+), 5 deletions(-) + +diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c +index bfa431a8e690..303a26c1b821 100644 +--- a/drivers/tty/tty_buffer.c ++++ b/drivers/tty/tty_buffer.c +@@ -532,6 +532,15 @@ static void flush_to_ldisc(struct work_struct *work) + + } + ++static inline void tty_flip_buffer_commit(struct tty_buffer *tail) ++{ ++ /* ++ * Paired w/ acquire in flush_to_ldisc(); ensures flush_to_ldisc() sees ++ * buffer data. ++ */ ++ smp_store_release(&tail->commit, tail->used); ++} ++ + /** + * tty_flip_buffer_push - push terminal buffers + * @port: tty port to push +@@ -546,11 +555,7 @@ void tty_flip_buffer_push(struct tty_port *port) + { + struct tty_bufhead *buf = &port->buf; + +- /* +- * Paired w/ acquire in flush_to_ldisc(); ensures flush_to_ldisc() sees +- * buffer data. +- */ +- smp_store_release(&buf->tail->commit, buf->tail->used); ++ tty_flip_buffer_commit(buf->tail); + queue_work(system_unbound_wq, &buf->work); + } + EXPORT_SYMBOL(tty_flip_buffer_push); +-- +2.35.1 + diff --git a/queue-5.18/tty-use-new-tty_insert_flip_string_and_push_buffer-i.patch b/queue-5.18/tty-use-new-tty_insert_flip_string_and_push_buffer-i.patch new file mode 100644 index 00000000000..865e6247ae8 --- /dev/null +++ b/queue-5.18/tty-use-new-tty_insert_flip_string_and_push_buffer-i.patch @@ -0,0 +1,128 @@ +From 278bae1107dfab24c68b82f2aa7a2fdcca0dbf96 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 7 Jul 2022 10:25:58 +0200 +Subject: tty: use new tty_insert_flip_string_and_push_buffer() in pty_write() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Jiri Slaby + +[ Upstream commit a501ab75e7624d133a5a3c7ec010687c8b961d23 ] + +There is a race in pty_write(). pty_write() can be called in parallel +with e.g. ioctl(TIOCSTI) or ioctl(TCXONC) which also inserts chars to +the buffer. Provided, tty_flip_buffer_push() in pty_write() is called +outside the lock, it can commit inconsistent tail. This can lead to out +of bounds writes and other issues. See the Link below. + +To fix this, we have to introduce a new helper called +tty_insert_flip_string_and_push_buffer(). It does both +tty_insert_flip_string() and tty_flip_buffer_commit() under the port +lock. It also calls queue_work(), but outside the lock. See +71a174b39f10 (pty: do tty_flip_buffer_push without port->lock in +pty_write) for the reasons. + +Keep the helper internal-only (in drivers' tty.h). It is not intended to +be used widely. + +Link: https://seclists.org/oss-sec/2022/q2/155 +Fixes: 71a174b39f10 (pty: do tty_flip_buffer_push without port->lock in pty_write) +Cc: 一只狗 +Cc: Dan Carpenter +Suggested-by: Hillf Danton +Signed-off-by: Jiri Slaby +Link: https://lore.kernel.org/r/20220707082558.9250-2-jslaby@suse.cz +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/tty/pty.c | 14 ++------------ + drivers/tty/tty.h | 3 +++ + drivers/tty/tty_buffer.c | 31 +++++++++++++++++++++++++++++++ + 3 files changed, 36 insertions(+), 12 deletions(-) + +diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c +index 74bfabe5b453..752dab3356d7 100644 +--- a/drivers/tty/pty.c ++++ b/drivers/tty/pty.c +@@ -111,21 +111,11 @@ static void pty_unthrottle(struct tty_struct *tty) + static int pty_write(struct tty_struct *tty, const unsigned char *buf, int c) + { + struct tty_struct *to = tty->link; +- unsigned long flags; + +- if (tty->flow.stopped) ++ if (tty->flow.stopped || !c) + return 0; + +- if (c > 0) { +- spin_lock_irqsave(&to->port->lock, flags); +- /* Stuff the data into the input queue of the other end */ +- c = tty_insert_flip_string(to->port, buf, c); +- spin_unlock_irqrestore(&to->port->lock, flags); +- /* And shovel */ +- if (c) +- tty_flip_buffer_push(to->port); +- } +- return c; ++ return tty_insert_flip_string_and_push_buffer(to->port, buf, c); + } + + /** +diff --git a/drivers/tty/tty.h b/drivers/tty/tty.h +index b710c5ef89ab..f310a8274df1 100644 +--- a/drivers/tty/tty.h ++++ b/drivers/tty/tty.h +@@ -111,4 +111,7 @@ static inline void tty_audit_tiocsti(struct tty_struct *tty, char ch) + + ssize_t redirected_tty_write(struct kiocb *, struct iov_iter *); + ++int tty_insert_flip_string_and_push_buffer(struct tty_port *port, ++ const unsigned char *chars, size_t cnt); ++ + #endif +diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c +index 303a26c1b821..595d8b49c745 100644 +--- a/drivers/tty/tty_buffer.c ++++ b/drivers/tty/tty_buffer.c +@@ -560,6 +560,37 @@ void tty_flip_buffer_push(struct tty_port *port) + } + EXPORT_SYMBOL(tty_flip_buffer_push); + ++/** ++ * tty_insert_flip_string_and_push_buffer - add characters to the tty buffer and ++ * push ++ * @port: tty port ++ * @chars: characters ++ * @size: size ++ * ++ * The function combines tty_insert_flip_string() and tty_flip_buffer_push() ++ * with the exception of properly holding the @port->lock. ++ * ++ * To be used only internally (by pty currently). ++ * ++ * Returns: the number added. ++ */ ++int tty_insert_flip_string_and_push_buffer(struct tty_port *port, ++ const unsigned char *chars, size_t size) ++{ ++ struct tty_bufhead *buf = &port->buf; ++ unsigned long flags; ++ ++ spin_lock_irqsave(&port->lock, flags); ++ size = tty_insert_flip_string(port, chars, size); ++ if (size) ++ tty_flip_buffer_commit(buf->tail); ++ spin_unlock_irqrestore(&port->lock, flags); ++ ++ queue_work(system_unbound_wq, &buf->work); ++ ++ return size; ++} ++ + /** + * tty_buffer_init - prepare a tty buffer structure + * @port: tty port to initialise +-- +2.35.1 + diff --git a/queue-5.18/vdpa-mlx5-initialize-cvq-vringh-only-once.patch b/queue-5.18/vdpa-mlx5-initialize-cvq-vringh-only-once.patch new file mode 100644 index 00000000000..8c7645de888 --- /dev/null +++ b/queue-5.18/vdpa-mlx5-initialize-cvq-vringh-only-once.patch @@ -0,0 +1,96 @@ +From 444c85723f1080c59763fa97564881ff4847a18f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 13 Jun 2022 10:59:58 +0300 +Subject: vdpa/mlx5: Initialize CVQ vringh only once +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Eli Cohen + +[ Upstream commit ace9252446ec615cd79a5f77d90edb25c0b9d024 ] + +Currently, CVQ vringh is initialized inside setup_virtqueues() which is +called every time a memory update is done. This is undesirable since it +resets all the context of the vring, including the available and used +indices. + +Move the initialization to mlx5_vdpa_set_status() when +VIRTIO_CONFIG_S_DRIVER_OK is set. + +Signed-off-by: Eli Cohen +Message-Id: <20220613075958.511064-2-elic@nvidia.com> +Signed-off-by: Michael S. Tsirkin +Acked-by: Jason Wang +Acked-by: Eugenio Pérez +Signed-off-by: Sasha Levin +--- + drivers/vdpa/mlx5/net/mlx5_vnet.c | 31 ++++++++++++++++++++----------- + 1 file changed, 20 insertions(+), 11 deletions(-) + +diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c +index c290386aa2f3..ae4cfbd927fd 100644 +--- a/drivers/vdpa/mlx5/net/mlx5_vnet.c ++++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c +@@ -1965,7 +1965,6 @@ static int verify_driver_features(struct mlx5_vdpa_dev *mvdev, u64 features) + static int setup_virtqueues(struct mlx5_vdpa_dev *mvdev) + { + struct mlx5_vdpa_net *ndev = to_mlx5_vdpa_ndev(mvdev); +- struct mlx5_control_vq *cvq = &mvdev->cvq; + int err; + int i; + +@@ -1975,16 +1974,6 @@ static int setup_virtqueues(struct mlx5_vdpa_dev *mvdev) + goto err_vq; + } + +- if (mvdev->actual_features & BIT_ULL(VIRTIO_NET_F_CTRL_VQ)) { +- err = vringh_init_iotlb(&cvq->vring, mvdev->actual_features, +- MLX5_CVQ_MAX_ENT, false, +- (struct vring_desc *)(uintptr_t)cvq->desc_addr, +- (struct vring_avail *)(uintptr_t)cvq->driver_addr, +- (struct vring_used *)(uintptr_t)cvq->device_addr); +- if (err) +- goto err_vq; +- } +- + return 0; + + err_vq: +@@ -2257,6 +2246,21 @@ static void clear_vqs_ready(struct mlx5_vdpa_net *ndev) + ndev->mvdev.cvq.ready = false; + } + ++static int setup_cvq_vring(struct mlx5_vdpa_dev *mvdev) ++{ ++ struct mlx5_control_vq *cvq = &mvdev->cvq; ++ int err = 0; ++ ++ if (mvdev->actual_features & BIT_ULL(VIRTIO_NET_F_CTRL_VQ)) ++ err = vringh_init_iotlb(&cvq->vring, mvdev->actual_features, ++ MLX5_CVQ_MAX_ENT, false, ++ (struct vring_desc *)(uintptr_t)cvq->desc_addr, ++ (struct vring_avail *)(uintptr_t)cvq->driver_addr, ++ (struct vring_used *)(uintptr_t)cvq->device_addr); ++ ++ return err; ++} ++ + static void mlx5_vdpa_set_status(struct vdpa_device *vdev, u8 status) + { + struct mlx5_vdpa_dev *mvdev = to_mvdev(vdev); +@@ -2269,6 +2273,11 @@ static void mlx5_vdpa_set_status(struct vdpa_device *vdev, u8 status) + + if ((status ^ ndev->mvdev.status) & VIRTIO_CONFIG_S_DRIVER_OK) { + if (status & VIRTIO_CONFIG_S_DRIVER_OK) { ++ err = setup_cvq_vring(mvdev); ++ if (err) { ++ mlx5_vdpa_warn(mvdev, "failed to setup control VQ vring\n"); ++ goto err_setup; ++ } + err = setup_driver(mvdev); + if (err) { + mlx5_vdpa_warn(mvdev, "failed to setup driver\n"); +-- +2.35.1 + diff --git a/queue-5.18/vduse-tie-vduse-mgmtdev-and-its-device.patch b/queue-5.18/vduse-tie-vduse-mgmtdev-and-its-device.patch new file mode 100644 index 00000000000..be1388d0cc5 --- /dev/null +++ b/queue-5.18/vduse-tie-vduse-mgmtdev-and-its-device.patch @@ -0,0 +1,134 @@ +From 2dd7968bace1bd604966047dae5145559a3b82f8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 13 Jun 2022 22:52:23 +0300 +Subject: vduse: Tie vduse mgmtdev and its device + +From: Parav Pandit + +[ Upstream commit 0e0348ac3f0a6e6606f1aa5acb1803ada913aa3d ] + +vduse devices are not backed by any real devices such as PCI. Hence it +doesn't have any parent device linked to it. + +Kernel driver model in [1] suggests to avoid an empty device +release callback. + +Hence tie the mgmtdevice object's life cycle to an allocate dummy struct +device instead of static one. + +[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/core-api/kobject.rst?h=v5.18-rc7#n284 + +Signed-off-by: Parav Pandit +Message-Id: <20220613195223.473966-1-parav@nvidia.com> +Signed-off-by: Michael S. Tsirkin +Reviewed-by: Xie Yongji +Acked-by: Jason Wang +Signed-off-by: Sasha Levin +--- + drivers/vdpa/vdpa_user/vduse_dev.c | 60 ++++++++++++++++++------------ + 1 file changed, 37 insertions(+), 23 deletions(-) + +diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c +index 160e40d03084..02709f8a78bd 100644 +--- a/drivers/vdpa/vdpa_user/vduse_dev.c ++++ b/drivers/vdpa/vdpa_user/vduse_dev.c +@@ -1475,16 +1475,12 @@ static char *vduse_devnode(struct device *dev, umode_t *mode) + return kasprintf(GFP_KERNEL, "vduse/%s", dev_name(dev)); + } + +-static void vduse_mgmtdev_release(struct device *dev) +-{ +-} +- +-static struct device vduse_mgmtdev = { +- .init_name = "vduse", +- .release = vduse_mgmtdev_release, ++struct vduse_mgmt_dev { ++ struct vdpa_mgmt_dev mgmt_dev; ++ struct device dev; + }; + +-static struct vdpa_mgmt_dev mgmt_dev; ++static struct vduse_mgmt_dev *vduse_mgmt; + + static int vduse_dev_init_vdpa(struct vduse_dev *dev, const char *name) + { +@@ -1509,7 +1505,7 @@ static int vduse_dev_init_vdpa(struct vduse_dev *dev, const char *name) + } + set_dma_ops(&vdev->vdpa.dev, &vduse_dev_dma_ops); + vdev->vdpa.dma_dev = &vdev->vdpa.dev; +- vdev->vdpa.mdev = &mgmt_dev; ++ vdev->vdpa.mdev = &vduse_mgmt->mgmt_dev; + + return 0; + } +@@ -1555,34 +1551,52 @@ static struct virtio_device_id id_table[] = { + { 0 }, + }; + +-static struct vdpa_mgmt_dev mgmt_dev = { +- .device = &vduse_mgmtdev, +- .id_table = id_table, +- .ops = &vdpa_dev_mgmtdev_ops, +-}; ++static void vduse_mgmtdev_release(struct device *dev) ++{ ++ struct vduse_mgmt_dev *mgmt_dev; ++ ++ mgmt_dev = container_of(dev, struct vduse_mgmt_dev, dev); ++ kfree(mgmt_dev); ++} + + static int vduse_mgmtdev_init(void) + { + int ret; + +- ret = device_register(&vduse_mgmtdev); +- if (ret) ++ vduse_mgmt = kzalloc(sizeof(*vduse_mgmt), GFP_KERNEL); ++ if (!vduse_mgmt) ++ return -ENOMEM; ++ ++ ret = dev_set_name(&vduse_mgmt->dev, "vduse"); ++ if (ret) { ++ kfree(vduse_mgmt); + return ret; ++ } + +- ret = vdpa_mgmtdev_register(&mgmt_dev); ++ vduse_mgmt->dev.release = vduse_mgmtdev_release; ++ ++ ret = device_register(&vduse_mgmt->dev); + if (ret) +- goto err; ++ goto dev_reg_err; + +- return 0; +-err: +- device_unregister(&vduse_mgmtdev); ++ vduse_mgmt->mgmt_dev.id_table = id_table; ++ vduse_mgmt->mgmt_dev.ops = &vdpa_dev_mgmtdev_ops; ++ vduse_mgmt->mgmt_dev.device = &vduse_mgmt->dev; ++ ret = vdpa_mgmtdev_register(&vduse_mgmt->mgmt_dev); ++ if (ret) ++ device_unregister(&vduse_mgmt->dev); ++ ++ return ret; ++ ++dev_reg_err: ++ put_device(&vduse_mgmt->dev); + return ret; + } + + static void vduse_mgmtdev_exit(void) + { +- vdpa_mgmtdev_unregister(&mgmt_dev); +- device_unregister(&vduse_mgmtdev); ++ vdpa_mgmtdev_unregister(&vduse_mgmt->mgmt_dev); ++ device_unregister(&vduse_mgmt->dev); + } + + static int vduse_init(void) +-- +2.35.1 + diff --git a/queue-5.18/virtio_mmio-add-missing-pm-calls-to-freeze-restore.patch b/queue-5.18/virtio_mmio-add-missing-pm-calls-to-freeze-restore.patch new file mode 100644 index 00000000000..d2c9235233b --- /dev/null +++ b/queue-5.18/virtio_mmio-add-missing-pm-calls-to-freeze-restore.patch @@ -0,0 +1,81 @@ +From 5dc649f7eba1b6efb29c3fefb1e45ffc254fa35b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 21 Jun 2022 13:06:20 +0200 +Subject: virtio_mmio: Add missing PM calls to freeze/restore + +From: Stephan Gerhold + +[ Upstream commit ed7ac37fde33ccd84e4bd2b9363c191f925364c7 ] + +Most virtio drivers provide freeze/restore callbacks to finish up +device usage before suspend and to reinitialize the virtio device after +resume. However, these callbacks are currently only called when using +virtio_pci. virtio_mmio does not have any PM ops defined. + +This causes problems for example after suspend to disk (hibernation), +since the virtio devices might lose their state after the VMM is +restarted. Calling virtio_device_freeze()/restore() ensures that +the virtio devices are re-initialized correctly. + +Fix this by implementing the dev_pm_ops for virtio_mmio, +similar to virtio_pci_common. + +Signed-off-by: Stephan Gerhold +Message-Id: <20220621110621.3638025-2-stephan.gerhold@kernkonzept.com> +Signed-off-by: Michael S. Tsirkin +Signed-off-by: Sasha Levin +--- + drivers/virtio/virtio_mmio.c | 23 +++++++++++++++++++++++ + 1 file changed, 23 insertions(+) + +diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c +index 1dd396d4bebb..7522832529dd 100644 +--- a/drivers/virtio/virtio_mmio.c ++++ b/drivers/virtio/virtio_mmio.c +@@ -62,6 +62,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -543,6 +544,25 @@ static const struct virtio_config_ops virtio_mmio_config_ops = { + .get_shm_region = vm_get_shm_region, + }; + ++#ifdef CONFIG_PM_SLEEP ++static int virtio_mmio_freeze(struct device *dev) ++{ ++ struct virtio_mmio_device *vm_dev = dev_get_drvdata(dev); ++ ++ return virtio_device_freeze(&vm_dev->vdev); ++} ++ ++static int virtio_mmio_restore(struct device *dev) ++{ ++ struct virtio_mmio_device *vm_dev = dev_get_drvdata(dev); ++ ++ return virtio_device_restore(&vm_dev->vdev); ++} ++ ++static const struct dev_pm_ops virtio_mmio_pm_ops = { ++ SET_SYSTEM_SLEEP_PM_OPS(virtio_mmio_freeze, virtio_mmio_restore) ++}; ++#endif + + static void virtio_mmio_release_dev(struct device *_d) + { +@@ -786,6 +806,9 @@ static struct platform_driver virtio_mmio_driver = { + .name = "virtio-mmio", + .of_match_table = virtio_mmio_match, + .acpi_match_table = ACPI_PTR(virtio_mmio_acpi_match), ++#ifdef CONFIG_PM_SLEEP ++ .pm = &virtio_mmio_pm_ops, ++#endif + }, + }; + +-- +2.35.1 + diff --git a/queue-5.18/virtio_mmio-restore-guest-page-size-on-resume.patch b/queue-5.18/virtio_mmio-restore-guest-page-size-on-resume.patch new file mode 100644 index 00000000000..c53674ef5e7 --- /dev/null +++ b/queue-5.18/virtio_mmio-restore-guest-page-size-on-resume.patch @@ -0,0 +1,44 @@ +From 6448913c55ca92ba4a9d1db295de2c69fca0f86f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 21 Jun 2022 13:06:21 +0200 +Subject: virtio_mmio: Restore guest page size on resume + +From: Stephan Gerhold + +[ Upstream commit e0c2ce8217955537dd5434baeba061f209797119 ] + +Virtio devices might lose their state when the VMM is restarted +after a suspend to disk (hibernation) cycle. This means that the +guest page size register must be restored for the virtio_mmio legacy +interface, since otherwise the virtio queues are not functional. + +This is particularly problematic for QEMU that currently still defaults +to using the legacy interface for virtio_mmio. Write the guest page +size register again in virtio_mmio_restore() to make legacy virtio_mmio +devices work correctly after hibernation. + +Signed-off-by: Stephan Gerhold +Message-Id: <20220621110621.3638025-3-stephan.gerhold@kernkonzept.com> +Signed-off-by: Michael S. Tsirkin +Signed-off-by: Sasha Levin +--- + drivers/virtio/virtio_mmio.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c +index 7522832529dd..fe696aafaed8 100644 +--- a/drivers/virtio/virtio_mmio.c ++++ b/drivers/virtio/virtio_mmio.c +@@ -556,6 +556,9 @@ static int virtio_mmio_restore(struct device *dev) + { + struct virtio_mmio_device *vm_dev = dev_get_drvdata(dev); + ++ if (vm_dev->version == 1) ++ writel(PAGE_SIZE, vm_dev->base + VIRTIO_MMIO_GUEST_PAGE_SIZE); ++ + return virtio_device_restore(&vm_dev->vdev); + } + +-- +2.35.1 + diff --git a/queue-5.18/wireguard-selftests-always-call-kernel-makefile.patch b/queue-5.18/wireguard-selftests-always-call-kernel-makefile.patch new file mode 100644 index 00000000000..edb6b5ed186 --- /dev/null +++ b/queue-5.18/wireguard-selftests-always-call-kernel-makefile.patch @@ -0,0 +1,47 @@ +From 62f3329394e04ebad0316d8b121a64e8e558eb31 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 7 Jul 2022 02:31:54 +0200 +Subject: wireguard: selftests: always call kernel makefile + +From: Jason A. Donenfeld + +[ Upstream commit 1a087eec257154e26a81a7a0a15380d7a2431765 ] + +These selftests are used for much more extensive changes than just the +wireguard source files. So always call the kernel's build file, which +will do something or nothing after checking the whole tree, per usual. + +Signed-off-by: Jason A. Donenfeld +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/wireguard/qemu/Makefile | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/tools/testing/selftests/wireguard/qemu/Makefile b/tools/testing/selftests/wireguard/qemu/Makefile +index e8a82e495d2e..fcc3f668b807 100644 +--- a/tools/testing/selftests/wireguard/qemu/Makefile ++++ b/tools/testing/selftests/wireguard/qemu/Makefile +@@ -19,8 +19,6 @@ endif + MIRROR := https://download.wireguard.com/qemu-test/distfiles/ + + KERNEL_BUILD_PATH := $(BUILD_PATH)/kernel$(if $(findstring yes,$(DEBUG_KERNEL)),-debug) +-rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d)) +-WIREGUARD_SOURCES := $(call rwildcard,$(KERNEL_PATH)/drivers/net/wireguard/,*) + + default: qemu + +@@ -325,8 +323,9 @@ $(KERNEL_BUILD_PATH)/.config: $(TOOLCHAIN_PATH)/.installed kernel.config arch/$( + cd $(KERNEL_BUILD_PATH) && ARCH=$(KERNEL_ARCH) $(KERNEL_PATH)/scripts/kconfig/merge_config.sh -n $(KERNEL_BUILD_PATH)/.config $(KERNEL_BUILD_PATH)/minimal.config + $(if $(findstring yes,$(DEBUG_KERNEL)),cp debug.config $(KERNEL_BUILD_PATH) && cd $(KERNEL_BUILD_PATH) && ARCH=$(KERNEL_ARCH) $(KERNEL_PATH)/scripts/kconfig/merge_config.sh -n $(KERNEL_BUILD_PATH)/.config debug.config,) + +-$(KERNEL_BZIMAGE): $(TOOLCHAIN_PATH)/.installed $(KERNEL_BUILD_PATH)/.config $(BUILD_PATH)/init-cpio-spec.txt $(IPERF_PATH)/src/iperf3 $(IPUTILS_PATH)/ping $(BASH_PATH)/bash $(IPROUTE2_PATH)/misc/ss $(IPROUTE2_PATH)/ip/ip $(IPTABLES_PATH)/iptables/xtables-legacy-multi $(NMAP_PATH)/ncat/ncat $(WIREGUARD_TOOLS_PATH)/src/wg $(BUILD_PATH)/init ../netns.sh $(WIREGUARD_SOURCES) ++$(KERNEL_BZIMAGE): $(TOOLCHAIN_PATH)/.installed $(KERNEL_BUILD_PATH)/.config $(BUILD_PATH)/init-cpio-spec.txt $(IPERF_PATH)/src/iperf3 $(IPUTILS_PATH)/ping $(BASH_PATH)/bash $(IPROUTE2_PATH)/misc/ss $(IPROUTE2_PATH)/ip/ip $(IPTABLES_PATH)/iptables/xtables-legacy-multi $(NMAP_PATH)/ncat/ncat $(WIREGUARD_TOOLS_PATH)/src/wg $(BUILD_PATH)/init + $(MAKE) -C $(KERNEL_PATH) O=$(KERNEL_BUILD_PATH) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(CROSS_COMPILE) ++.PHONY: $(KERNEL_BZIMAGE) + + $(TOOLCHAIN_PATH)/$(CHOST)/include/linux/.installed: | $(KERNEL_BUILD_PATH)/.config $(TOOLCHAIN_PATH)/.installed + rm -rf $(TOOLCHAIN_PATH)/$(CHOST)/include/linux +-- +2.35.1 + diff --git a/queue-5.18/wireguard-selftests-set-fake-real-time-in-init.patch b/queue-5.18/wireguard-selftests-set-fake-real-time-in-init.patch new file mode 100644 index 00000000000..c75970cc906 --- /dev/null +++ b/queue-5.18/wireguard-selftests-set-fake-real-time-in-init.patch @@ -0,0 +1,154 @@ +From 919c4f9be4b2340d9e183ca68d4416e0506a3007 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 7 Jul 2022 02:31:52 +0200 +Subject: wireguard: selftests: set fake real time in init + +From: Jason A. Donenfeld + +[ Upstream commit 829be057dbc1e71383b8d7de8edb31dcf07b4aa0 ] + +Not all platforms have an RTC, and rather than trying to force one into +each, it's much easier to just set a fixed time. This is necessary +because WireGuard's latest handshakes parameter is returned in wallclock +time, and if the system time isn't set, and the system is really fast, +then this returns 0, which trips the test. + +Turning this on requires setting CONFIG_COMPAT_32BIT_TIME=y, as musl +doesn't support settimeofday without it. + +Signed-off-by: Jason A. Donenfeld +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + .../testing/selftests/wireguard/qemu/arch/arm.config | 1 + + .../selftests/wireguard/qemu/arch/armeb.config | 1 + + .../testing/selftests/wireguard/qemu/arch/i686.config | 1 + + .../testing/selftests/wireguard/qemu/arch/m68k.config | 1 + + .../testing/selftests/wireguard/qemu/arch/mips.config | 1 + + .../selftests/wireguard/qemu/arch/mipsel.config | 1 + + .../selftests/wireguard/qemu/arch/powerpc.config | 1 + + tools/testing/selftests/wireguard/qemu/init.c | 11 +++++++++++ + 8 files changed, 18 insertions(+) + +diff --git a/tools/testing/selftests/wireguard/qemu/arch/arm.config b/tools/testing/selftests/wireguard/qemu/arch/arm.config +index fc7959bef9c2..0579c66be83e 100644 +--- a/tools/testing/selftests/wireguard/qemu/arch/arm.config ++++ b/tools/testing/selftests/wireguard/qemu/arch/arm.config +@@ -7,6 +7,7 @@ CONFIG_SERIAL_AMBA_PL011_CONSOLE=y + CONFIG_VIRTIO_MENU=y + CONFIG_VIRTIO_MMIO=y + CONFIG_VIRTIO_CONSOLE=y ++CONFIG_COMPAT_32BIT_TIME=y + CONFIG_CMDLINE_BOOL=y + CONFIG_CMDLINE="console=ttyAMA0 wg.success=vport0p1 panic_on_warn=1" + CONFIG_FRAME_WARN=1024 +diff --git a/tools/testing/selftests/wireguard/qemu/arch/armeb.config b/tools/testing/selftests/wireguard/qemu/arch/armeb.config +index f3066be81c19..2a3307bbe534 100644 +--- a/tools/testing/selftests/wireguard/qemu/arch/armeb.config ++++ b/tools/testing/selftests/wireguard/qemu/arch/armeb.config +@@ -7,6 +7,7 @@ CONFIG_SERIAL_AMBA_PL011_CONSOLE=y + CONFIG_VIRTIO_MENU=y + CONFIG_VIRTIO_MMIO=y + CONFIG_VIRTIO_CONSOLE=y ++CONFIG_COMPAT_32BIT_TIME=y + CONFIG_CMDLINE_BOOL=y + CONFIG_CMDLINE="console=ttyAMA0 wg.success=vport0p1 panic_on_warn=1" + CONFIG_CPU_BIG_ENDIAN=y +diff --git a/tools/testing/selftests/wireguard/qemu/arch/i686.config b/tools/testing/selftests/wireguard/qemu/arch/i686.config +index 6d90892a85a2..cd864b9be6fb 100644 +--- a/tools/testing/selftests/wireguard/qemu/arch/i686.config ++++ b/tools/testing/selftests/wireguard/qemu/arch/i686.config +@@ -1,6 +1,7 @@ + CONFIG_ACPI=y + CONFIG_SERIAL_8250=y + CONFIG_SERIAL_8250_CONSOLE=y ++CONFIG_COMPAT_32BIT_TIME=y + CONFIG_CMDLINE_BOOL=y + CONFIG_CMDLINE="console=ttyS0 wg.success=ttyS1 panic_on_warn=1" + CONFIG_FRAME_WARN=1024 +diff --git a/tools/testing/selftests/wireguard/qemu/arch/m68k.config b/tools/testing/selftests/wireguard/qemu/arch/m68k.config +index 82c925e49beb..9639bfe06074 100644 +--- a/tools/testing/selftests/wireguard/qemu/arch/m68k.config ++++ b/tools/testing/selftests/wireguard/qemu/arch/m68k.config +@@ -5,5 +5,6 @@ CONFIG_MAC=y + CONFIG_SERIAL_PMACZILOG=y + CONFIG_SERIAL_PMACZILOG_TTYS=y + CONFIG_SERIAL_PMACZILOG_CONSOLE=y ++CONFIG_COMPAT_32BIT_TIME=y + CONFIG_CMDLINE="console=ttyS0 wg.success=ttyS1 panic_on_warn=1" + CONFIG_FRAME_WARN=1024 +diff --git a/tools/testing/selftests/wireguard/qemu/arch/mips.config b/tools/testing/selftests/wireguard/qemu/arch/mips.config +index d7ec63c17b30..2a84402353ab 100644 +--- a/tools/testing/selftests/wireguard/qemu/arch/mips.config ++++ b/tools/testing/selftests/wireguard/qemu/arch/mips.config +@@ -6,6 +6,7 @@ CONFIG_POWER_RESET=y + CONFIG_POWER_RESET_SYSCON=y + CONFIG_SERIAL_8250=y + CONFIG_SERIAL_8250_CONSOLE=y ++CONFIG_COMPAT_32BIT_TIME=y + CONFIG_CMDLINE_BOOL=y + CONFIG_CMDLINE="console=ttyS0 wg.success=ttyS1 panic_on_warn=1" + CONFIG_FRAME_WARN=1024 +diff --git a/tools/testing/selftests/wireguard/qemu/arch/mipsel.config b/tools/testing/selftests/wireguard/qemu/arch/mipsel.config +index 18a498293737..56146a101e7e 100644 +--- a/tools/testing/selftests/wireguard/qemu/arch/mipsel.config ++++ b/tools/testing/selftests/wireguard/qemu/arch/mipsel.config +@@ -7,6 +7,7 @@ CONFIG_POWER_RESET=y + CONFIG_POWER_RESET_SYSCON=y + CONFIG_SERIAL_8250=y + CONFIG_SERIAL_8250_CONSOLE=y ++CONFIG_COMPAT_32BIT_TIME=y + CONFIG_CMDLINE_BOOL=y + CONFIG_CMDLINE="console=ttyS0 wg.success=ttyS1 panic_on_warn=1" + CONFIG_FRAME_WARN=1024 +diff --git a/tools/testing/selftests/wireguard/qemu/arch/powerpc.config b/tools/testing/selftests/wireguard/qemu/arch/powerpc.config +index 5e04882e8e35..174a9ffe2a36 100644 +--- a/tools/testing/selftests/wireguard/qemu/arch/powerpc.config ++++ b/tools/testing/selftests/wireguard/qemu/arch/powerpc.config +@@ -4,6 +4,7 @@ CONFIG_PPC_85xx=y + CONFIG_PHYS_64BIT=y + CONFIG_SERIAL_8250=y + CONFIG_SERIAL_8250_CONSOLE=y ++CONFIG_COMPAT_32BIT_TIME=y + CONFIG_MATH_EMULATION=y + CONFIG_CMDLINE_BOOL=y + CONFIG_CMDLINE="console=ttyS0 wg.success=ttyS1 panic_on_warn=1" +diff --git a/tools/testing/selftests/wireguard/qemu/init.c b/tools/testing/selftests/wireguard/qemu/init.c +index 2a0f48fac925..542c34b00eb0 100644 +--- a/tools/testing/selftests/wireguard/qemu/init.c ++++ b/tools/testing/selftests/wireguard/qemu/init.c +@@ -11,6 +11,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -67,6 +68,15 @@ static void seed_rng(void) + close(fd); + } + ++static void set_time(void) ++{ ++ if (time(NULL)) ++ return; ++ pretty_message("[+] Setting fake time..."); ++ if (stime(&(time_t){1433512680}) < 0) ++ panic("settimeofday()"); ++} ++ + static void mount_filesystems(void) + { + pretty_message("[+] Mounting filesystems..."); +@@ -256,6 +266,7 @@ int main(int argc, char *argv[]) + print_banner(); + mount_filesystems(); + seed_rng(); ++ set_time(); + kmod_selftests(); + enable_logging(); + clear_leaks(); +-- +2.35.1 + diff --git a/queue-5.18/wireguard-selftests-use-virt-machine-on-m68k.patch b/queue-5.18/wireguard-selftests-use-virt-machine-on-m68k.patch new file mode 100644 index 00000000000..f12aa2da50f --- /dev/null +++ b/queue-5.18/wireguard-selftests-use-virt-machine-on-m68k.patch @@ -0,0 +1,58 @@ +From e91eead809767c82b8b3f54dd31f8d77490eb098 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 7 Jul 2022 02:31:53 +0200 +Subject: wireguard: selftests: use virt machine on m68k + +From: Jason A. Donenfeld + +[ Upstream commit 1f2f341a62639c7066ee4c76b7d9ebe867e0a1d5 ] + +This should be a bit more stable hopefully. + +Signed-off-by: Jason A. Donenfeld +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/wireguard/qemu/Makefile | 5 +++-- + tools/testing/selftests/wireguard/qemu/arch/m68k.config | 9 +++------ + 2 files changed, 6 insertions(+), 8 deletions(-) + +diff --git a/tools/testing/selftests/wireguard/qemu/Makefile b/tools/testing/selftests/wireguard/qemu/Makefile +index bca07b93eeb0..e8a82e495d2e 100644 +--- a/tools/testing/selftests/wireguard/qemu/Makefile ++++ b/tools/testing/selftests/wireguard/qemu/Makefile +@@ -210,10 +210,11 @@ QEMU_ARCH := m68k + KERNEL_ARCH := m68k + KERNEL_BZIMAGE := $(KERNEL_BUILD_PATH)/vmlinux + KERNEL_CMDLINE := $(shell sed -n 's/CONFIG_CMDLINE=\(.*\)/\1/p' arch/m68k.config) ++QEMU_VPORT_RESULT := virtio-serial-device + ifeq ($(HOST_ARCH),$(ARCH)) +-QEMU_MACHINE := -cpu host,accel=kvm -machine q800 -append $(KERNEL_CMDLINE) ++QEMU_MACHINE := -cpu host,accel=kvm -machine virt -append $(KERNEL_CMDLINE) + else +-QEMU_MACHINE := -machine q800 -smp 1 -append $(KERNEL_CMDLINE) ++QEMU_MACHINE := -machine virt -smp 1 -append $(KERNEL_CMDLINE) + endif + else ifeq ($(ARCH),riscv64) + CHOST := riscv64-linux-musl +diff --git a/tools/testing/selftests/wireguard/qemu/arch/m68k.config b/tools/testing/selftests/wireguard/qemu/arch/m68k.config +index 9639bfe06074..39c48cba56b7 100644 +--- a/tools/testing/selftests/wireguard/qemu/arch/m68k.config ++++ b/tools/testing/selftests/wireguard/qemu/arch/m68k.config +@@ -1,10 +1,7 @@ + CONFIG_MMU=y ++CONFIG_VIRT=y + CONFIG_M68KCLASSIC=y +-CONFIG_M68040=y +-CONFIG_MAC=y +-CONFIG_SERIAL_PMACZILOG=y +-CONFIG_SERIAL_PMACZILOG_TTYS=y +-CONFIG_SERIAL_PMACZILOG_CONSOLE=y ++CONFIG_VIRTIO_CONSOLE=y + CONFIG_COMPAT_32BIT_TIME=y +-CONFIG_CMDLINE="console=ttyS0 wg.success=ttyS1 panic_on_warn=1" ++CONFIG_CMDLINE="console=ttyGF0 wg.success=vport0p1 panic_on_warn=1" + CONFIG_FRAME_WARN=1024 +-- +2.35.1 + diff --git a/queue-5.18/x86-clear-.brk-area-at-early-boot.patch b/queue-5.18/x86-clear-.brk-area-at-early-boot.patch new file mode 100644 index 00000000000..912476ccd9d --- /dev/null +++ b/queue-5.18/x86-clear-.brk-area-at-early-boot.patch @@ -0,0 +1,43 @@ +From b7b9e4388c32c0b027b2ed5232ffd68ae478b75b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 30 Jun 2022 09:14:40 +0200 +Subject: x86: Clear .brk area at early boot + +From: Juergen Gross + +[ Upstream commit 38fa5479b41376dc9d7f57e71c83514285a25ca0 ] + +The .brk section has the same properties as .bss: it is an alloc-only +section and should be cleared before being used. + +Not doing so is especially a problem for Xen PV guests, as the +hypervisor will validate page tables (check for writable page tables +and hypervisor private bits) before accepting them to be used. + +Make sure .brk is initially zero by letting clear_bss() clear the brk +area, too. + +Signed-off-by: Juergen Gross +Signed-off-by: Borislav Petkov +Link: https://lore.kernel.org/r/20220630071441.28576-3-jgross@suse.com +Signed-off-by: Sasha Levin +--- + arch/x86/kernel/head64.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c +index 2e10a33778cf..92eae95f1a0b 100644 +--- a/arch/x86/kernel/head64.c ++++ b/arch/x86/kernel/head64.c +@@ -425,6 +425,8 @@ void __init clear_bss(void) + { + memset(__bss_start, 0, + (unsigned long) __bss_stop - (unsigned long) __bss_start); ++ memset(__brk_base, 0, ++ (unsigned long) __brk_limit - (unsigned long) __brk_base); + } + + static unsigned long get_cmd_line_ptr(void) +-- +2.35.1 + -- 2.47.3