From 6ed3f46eab3db805ac500f173b3c3aad5b435b59 Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Mon, 24 Jun 2024 23:25:05 -0400 Subject: [PATCH] Fixes for 5.4 Signed-off-by: Sasha Levin --- ...roduce-acpi_dev_hid_uid_match-helper.patch | 96 ++++++++ ...exynos4412-origen-fix-keypad-no-auto.patch | 43 ++++ ...ng-smdk4412-fix-keypad-no-autorepeat.patch | 43 ++++ ...ng-smdkv310-fix-keypad-no-autorepeat.patch | 43 ++++ ...-qcs404-fix-bluetooth-device-address.patch | 42 ++++ ...tly-define-file-modes-for-archived-h.patch | 42 ++++ ...isable-write-protect-detection-on-ac.patch | 74 +++++++ ...isable-write-protect-detection-on-to.patch | 53 +++++ ...-write-protect-detection-on-to.patch-21681 | 50 +++++ ...-acpi-sort-dmi-quirks-alphabetically.patch | 69 ++++++ ...witch-signal-voltage-back-to-3.3v-on.patch | 208 ++++++++++++++++++ ...switch-to-use-acpi_dev_hid_uid_match.patch | 183 +++++++++++++++ ...ror_response-and-related-definitions.patch | 56 +++++ ...ssing-wakeup-when-waiting-for-contex.patch | 111 ++++++++++ ...substituting-sort-in-archive-creatio.patch | 48 ++++ ...use-of-invalid-opcode-produce-a-link.patch | 65 ++++++ queue-5.4/series | 18 ++ ...le_description-to-preemptirq_delay_t.patch | 39 ++++ ...6-amd_nb-check-for-invalid-smn-reads.patch | 64 ++++++ 19 files changed, 1347 insertions(+) create mode 100644 queue-5.4/acpi-utils-introduce-acpi_dev_hid_uid_match-helper.patch create mode 100644 queue-5.4/arm-dts-samsung-exynos4412-origen-fix-keypad-no-auto.patch create mode 100644 queue-5.4/arm-dts-samsung-smdk4412-fix-keypad-no-autorepeat.patch create mode 100644 queue-5.4/arm-dts-samsung-smdkv310-fix-keypad-no-autorepeat.patch create mode 100644 queue-5.4/arm64-dts-qcom-qcs404-fix-bluetooth-device-address.patch create mode 100644 queue-5.4/kheaders-explicitly-define-file-modes-for-archived-h.patch create mode 100644 queue-5.4/mmc-sdhci-acpi-disable-write-protect-detection-on-ac.patch create mode 100644 queue-5.4/mmc-sdhci-acpi-disable-write-protect-detection-on-to.patch create mode 100644 queue-5.4/mmc-sdhci-acpi-disable-write-protect-detection-on-to.patch-21681 create mode 100644 queue-5.4/mmc-sdhci-acpi-sort-dmi-quirks-alphabetically.patch create mode 100644 queue-5.4/mmc-sdhci-acpi-switch-signal-voltage-back-to-3.3v-on.patch create mode 100644 queue-5.4/mmc-sdhci-acpi-switch-to-use-acpi_dev_hid_uid_match.patch create mode 100644 queue-5.4/pci-add-pci_error_response-and-related-definitions.patch create mode 100644 queue-5.4/perf-core-fix-missing-wakeup-when-waiting-for-contex.patch create mode 100644 queue-5.4/revert-kheaders-substituting-sort-in-archive-creatio.patch create mode 100644 queue-5.4/s390-cpacf-make-use-of-invalid-opcode-produce-a-link.patch create mode 100644 queue-5.4/tracing-add-module_description-to-preemptirq_delay_t.patch create mode 100644 queue-5.4/x86-amd_nb-check-for-invalid-smn-reads.patch diff --git a/queue-5.4/acpi-utils-introduce-acpi_dev_hid_uid_match-helper.patch b/queue-5.4/acpi-utils-introduce-acpi_dev_hid_uid_match-helper.patch new file mode 100644 index 00000000000..b90ddbe4baa --- /dev/null +++ b/queue-5.4/acpi-utils-introduce-acpi_dev_hid_uid_match-helper.patch @@ -0,0 +1,96 @@ +From 5625673f5fe2588680f82b34216d5156e7180de5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 1 Oct 2019 17:27:22 +0300 +Subject: ACPI / utils: Introduce acpi_dev_hid_uid_match() helper + +From: Andy Shevchenko + +[ Upstream commit 35009c807488ccd5a01cbf102033695e52794b68 ] + +There are users outside of ACPI realm which reimplementing the comparator +function to check if the given device matches to given HID and UID. + +For better utilization, introduce a helper for everyone to use. + +Signed-off-by: Andy Shevchenko +Reviewed-by: Mika Westerberg +Signed-off-by: Rafael J. Wysocki +Stable-dep-of: a92a73b1d924 ("mmc: sdhci-acpi: Sort DMI quirks alphabetically") +Signed-off-by: Sasha Levin +--- + drivers/acpi/utils.c | 25 +++++++++++++++++++++++++ + include/acpi/acpi_bus.h | 2 ++ + include/linux/acpi.h | 8 ++++++++ + 3 files changed, 35 insertions(+) + +diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c +index e3974a8f8fd41..2deba6c2cd99f 100644 +--- a/drivers/acpi/utils.c ++++ b/drivers/acpi/utils.c +@@ -694,6 +694,31 @@ bool acpi_check_dsm(acpi_handle handle, const guid_t *guid, u64 rev, u64 funcs) + } + EXPORT_SYMBOL(acpi_check_dsm); + ++/** ++ * acpi_dev_hid_uid_match - Match device by supplied HID and UID ++ * @adev: ACPI device to match. ++ * @hid2: Hardware ID of the device. ++ * @uid2: Unique ID of the device, pass NULL to not check _UID. ++ * ++ * Matches HID and UID in @adev with given @hid2 and @uid2. ++ * Returns true if matches. ++ */ ++bool acpi_dev_hid_uid_match(struct acpi_device *adev, ++ const char *hid2, const char *uid2) ++{ ++ const char *hid1 = acpi_device_hid(adev); ++ const char *uid1 = acpi_device_uid(adev); ++ ++ if (strcmp(hid1, hid2)) ++ return false; ++ ++ if (!uid2) ++ return true; ++ ++ return uid1 && !strcmp(uid1, uid2); ++} ++EXPORT_SYMBOL(acpi_dev_hid_uid_match); ++ + /** + * acpi_dev_found - Detect presence of a given ACPI device in the namespace. + * @hid: Hardware ID of the device. +diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h +index 1e5ae3b01eb2b..5de47e7a5d37b 100644 +--- a/include/acpi/acpi_bus.h ++++ b/include/acpi/acpi_bus.h +@@ -676,6 +676,8 @@ static inline bool acpi_device_can_poweroff(struct acpi_device *adev) + adev->power.states[ACPI_STATE_D3_HOT].flags.explicit_set); + } + ++bool acpi_dev_hid_uid_match(struct acpi_device *adev, const char *hid2, const char *uid2); ++ + struct acpi_device * + acpi_dev_get_first_match_dev(const char *hid, const char *uid, s64 hrv); + +diff --git a/include/linux/acpi.h b/include/linux/acpi.h +index c708fd8315652..65a6b75b55c32 100644 +--- a/include/linux/acpi.h ++++ b/include/linux/acpi.h +@@ -687,6 +687,14 @@ static inline bool acpi_dev_present(const char *hid, const char *uid, s64 hrv) + return false; + } + ++struct acpi_device; ++ ++static inline bool ++acpi_dev_hid_uid_match(struct acpi_device *adev, const char *hid2, const char *uid2) ++{ ++ return false; ++} ++ + static inline struct acpi_device * + acpi_dev_get_first_match_dev(const char *hid, const char *uid, s64 hrv) + { +-- +2.43.0 + diff --git a/queue-5.4/arm-dts-samsung-exynos4412-origen-fix-keypad-no-auto.patch b/queue-5.4/arm-dts-samsung-exynos4412-origen-fix-keypad-no-auto.patch new file mode 100644 index 00000000000..de1773390c4 --- /dev/null +++ b/queue-5.4/arm-dts-samsung-exynos4412-origen-fix-keypad-no-auto.patch @@ -0,0 +1,43 @@ +From 2ff201df866754eb6c5f3724e95d04c664283a18 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 12 Mar 2024 19:31:03 +0100 +Subject: ARM: dts: samsung: exynos4412-origen: fix keypad no-autorepeat + +From: Krzysztof Kozlowski + +[ Upstream commit 88208d3cd79821117fd3fb80d9bcab618467d37b ] + +Although the Samsung SoC keypad binding defined +linux,keypad-no-autorepeat property, Linux driver never implemented it +and always used linux,input-no-autorepeat. Correct the DTS to use +property actually implemented. + +This also fixes dtbs_check errors like: + + exynos4412-origen.dtb: keypad@100a0000: 'linux,keypad-no-autorepeat' does not match any of the regexes: '^key-[0-9a-z]+$', 'pinctrl-[0-9]+' + +Cc: +Fixes: bd08f6277e44 ("ARM: dts: Add keypad entries to Exynos4412 based Origen") +Link: https://lore.kernel.org/r/20240312183105.715735-2-krzysztof.kozlowski@linaro.org +Signed-off-by: Krzysztof Kozlowski +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/exynos4412-origen.dts | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/exynos4412-origen.dts b/arch/arm/boot/dts/exynos4412-origen.dts +index c6678c120cbd1..7b2dceb47c44c 100644 +--- a/arch/arm/boot/dts/exynos4412-origen.dts ++++ b/arch/arm/boot/dts/exynos4412-origen.dts +@@ -431,7 +431,7 @@ buck9_reg: BUCK9 { + &keypad { + samsung,keypad-num-rows = <3>; + samsung,keypad-num-columns = <2>; +- linux,keypad-no-autorepeat; ++ linux,input-no-autorepeat; + wakeup-source; + pinctrl-0 = <&keypad_rows &keypad_cols>; + pinctrl-names = "default"; +-- +2.43.0 + diff --git a/queue-5.4/arm-dts-samsung-smdk4412-fix-keypad-no-autorepeat.patch b/queue-5.4/arm-dts-samsung-smdk4412-fix-keypad-no-autorepeat.patch new file mode 100644 index 00000000000..de0006e3a34 --- /dev/null +++ b/queue-5.4/arm-dts-samsung-smdk4412-fix-keypad-no-autorepeat.patch @@ -0,0 +1,43 @@ +From 893bf49b8ec85f1d721ec0ac8fc5b93634464e37 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 12 Mar 2024 19:31:04 +0100 +Subject: ARM: dts: samsung: smdk4412: fix keypad no-autorepeat + +From: Krzysztof Kozlowski + +[ Upstream commit 4ac4c1d794e7ff454d191bbdab7585ed8dbf3758 ] + +Although the Samsung SoC keypad binding defined +linux,keypad-no-autorepeat property, Linux driver never implemented it +and always used linux,input-no-autorepeat. Correct the DTS to use +property actually implemented. + +This also fixes dtbs_check errors like: + + exynos4412-smdk4412.dtb: keypad@100a0000: 'key-A', 'key-B', 'key-C', 'key-D', 'key-E', 'linux,keypad-no-autorepeat' do not match any of the regexes: '^key-[0-9a-z]+$', 'pinctrl-[0-9]+' + +Cc: +Fixes: c9b92dd70107 ("ARM: dts: Add keypad entries to SMDK4412") +Link: https://lore.kernel.org/r/20240312183105.715735-3-krzysztof.kozlowski@linaro.org +Signed-off-by: Krzysztof Kozlowski +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/exynos4412-smdk4412.dts | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/exynos4412-smdk4412.dts b/arch/arm/boot/dts/exynos4412-smdk4412.dts +index e70fb6e601f0e..087e1f99ba32f 100644 +--- a/arch/arm/boot/dts/exynos4412-smdk4412.dts ++++ b/arch/arm/boot/dts/exynos4412-smdk4412.dts +@@ -43,7 +43,7 @@ xusbxti { + &keypad { + samsung,keypad-num-rows = <3>; + samsung,keypad-num-columns = <8>; +- linux,keypad-no-autorepeat; ++ linux,input-no-autorepeat; + wakeup-source; + pinctrl-0 = <&keypad_rows &keypad_cols>; + pinctrl-names = "default"; +-- +2.43.0 + diff --git a/queue-5.4/arm-dts-samsung-smdkv310-fix-keypad-no-autorepeat.patch b/queue-5.4/arm-dts-samsung-smdkv310-fix-keypad-no-autorepeat.patch new file mode 100644 index 00000000000..da333c95124 --- /dev/null +++ b/queue-5.4/arm-dts-samsung-smdkv310-fix-keypad-no-autorepeat.patch @@ -0,0 +1,43 @@ +From 883c192d6ec78ba72e76566849c0a47879ae51c0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 12 Mar 2024 19:31:02 +0100 +Subject: ARM: dts: samsung: smdkv310: fix keypad no-autorepeat + +From: Krzysztof Kozlowski + +[ Upstream commit 87d8e522d6f5a004f0aa06c0def302df65aff296 ] + +Although the Samsung SoC keypad binding defined +linux,keypad-no-autorepeat property, Linux driver never implemented it +and always used linux,input-no-autorepeat. Correct the DTS to use +property actually implemented. + +This also fixes dtbs_check errors like: + + exynos4210-smdkv310.dtb: keypad@100a0000: 'linux,keypad-no-autorepeat' does not match any of the regexes: '^key-[0-9a-z]+$', 'pinctrl-[0-9]+' + +Cc: +Fixes: 0561ceabd0f1 ("ARM: dts: Add intial dts file for EXYNOS4210 SoC, SMDKV310 and ORIGEN") +Link: https://lore.kernel.org/r/20240312183105.715735-1-krzysztof.kozlowski@linaro.org +Signed-off-by: Krzysztof Kozlowski +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/exynos4210-smdkv310.dts | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/exynos4210-smdkv310.dts b/arch/arm/boot/dts/exynos4210-smdkv310.dts +index 77fc11e593ad3..9297788c0c43f 100644 +--- a/arch/arm/boot/dts/exynos4210-smdkv310.dts ++++ b/arch/arm/boot/dts/exynos4210-smdkv310.dts +@@ -64,7 +64,7 @@ eeprom@52 { + &keypad { + samsung,keypad-num-rows = <2>; + samsung,keypad-num-columns = <8>; +- linux,keypad-no-autorepeat; ++ linux,input-no-autorepeat; + wakeup-source; + pinctrl-names = "default"; + pinctrl-0 = <&keypad_rows &keypad_cols>; +-- +2.43.0 + diff --git a/queue-5.4/arm64-dts-qcom-qcs404-fix-bluetooth-device-address.patch b/queue-5.4/arm64-dts-qcom-qcs404-fix-bluetooth-device-address.patch new file mode 100644 index 00000000000..34535ebf867 --- /dev/null +++ b/queue-5.4/arm64-dts-qcom-qcs404-fix-bluetooth-device-address.patch @@ -0,0 +1,42 @@ +From a48b0e85558565dc3a10c8021b1514099cada102 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 1 May 2024 09:52:01 +0200 +Subject: arm64: dts: qcom: qcs404: fix bluetooth device address + +From: Johan Hovold + +[ Upstream commit f5f390a77f18eaeb2c93211a1b7c5e66b5acd423 ] + +The 'local-bd-address' property is used to pass a unique Bluetooth +device address from the boot firmware to the kernel and should otherwise +be left unset so that the OS can prevent the controller from being used +until a valid address has been provided through some other means (e.g. +using btmgmt). + +Fixes: 60f77ae7d1c1 ("arm64: dts: qcom: qcs404-evb: Enable uart3 and add Bluetooth") +Cc: stable@vger.kernel.org # 5.10 +Signed-off-by: Johan Hovold +Reviewed-by: Bryan O'Donoghue +Link: https://lore.kernel.org/r/20240501075201.4732-1-johan+linaro@kernel.org +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/qcs404-evb.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/qcom/qcs404-evb.dtsi b/arch/arm64/boot/dts/qcom/qcs404-evb.dtsi +index 522d3ef72df5e..03244871474e2 100644 +--- a/arch/arm64/boot/dts/qcom/qcs404-evb.dtsi ++++ b/arch/arm64/boot/dts/qcom/qcs404-evb.dtsi +@@ -43,7 +43,7 @@ bluetooth { + vddrf-supply = <&vreg_l1_1p3>; + vddch0-supply = <&vdd_ch0_3p3>; + +- local-bd-address = [ 02 00 00 00 5a ad ]; ++ local-bd-address = [ 00 00 00 00 00 00 ]; + + max-speed = <3200000>; + }; +-- +2.43.0 + diff --git a/queue-5.4/kheaders-explicitly-define-file-modes-for-archived-h.patch b/queue-5.4/kheaders-explicitly-define-file-modes-for-archived-h.patch new file mode 100644 index 00000000000..d91bede751a --- /dev/null +++ b/queue-5.4/kheaders-explicitly-define-file-modes-for-archived-h.patch @@ -0,0 +1,42 @@ +From 52fc3013e83fdf3bbf68c868cf7d7c11e17a0a8b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 28 May 2024 11:32:43 +0000 +Subject: kheaders: explicitly define file modes for archived headers + +From: Matthias Maennich + +[ Upstream commit 3bd27a847a3a4827a948387cc8f0dbc9fa5931d5 ] + +Build environments might be running with different umask settings +resulting in indeterministic file modes for the files contained in +kheaders.tar.xz. The file itself is served with 444, i.e. world +readable. Archive the files explicitly with 744,a+X to improve +reproducibility across build environments. + +--mode=0444 is not suitable as directories need to be executable. Also, +444 makes it hard to delete all the readonly files after extraction. + +Cc: stable@vger.kernel.org +Signed-off-by: Matthias Maennich +Signed-off-by: Masahiro Yamada +Signed-off-by: Sasha Levin +--- + kernel/gen_kheaders.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/kernel/gen_kheaders.sh b/kernel/gen_kheaders.sh +index d7e827c6cd2d2..206ab3d41ee76 100755 +--- a/kernel/gen_kheaders.sh ++++ b/kernel/gen_kheaders.sh +@@ -84,7 +84,7 @@ find $cpio_dir -type f -print0 | + + # Create archive and try to normalize metadata for reproducibility. + tar "${KBUILD_BUILD_TIMESTAMP:+--mtime=$KBUILD_BUILD_TIMESTAMP}" \ +- --owner=0 --group=0 --sort=name --numeric-owner \ ++ --owner=0 --group=0 --sort=name --numeric-owner --mode=u=rw,go=r,a+X \ + -I $XZ -cf $tarfile -C $cpio_dir/ . > /dev/null + + echo $headers_md5 > kernel/kheaders.md5 +-- +2.43.0 + diff --git a/queue-5.4/mmc-sdhci-acpi-disable-write-protect-detection-on-ac.patch b/queue-5.4/mmc-sdhci-acpi-disable-write-protect-detection-on-ac.patch new file mode 100644 index 00000000000..af61efa3e8c --- /dev/null +++ b/queue-5.4/mmc-sdhci-acpi-disable-write-protect-detection-on-ac.patch @@ -0,0 +1,74 @@ +From 3fbee38b67a3931a32bfc02e73cfb0e3258e2d27 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 16 Mar 2020 19:47:53 +0100 +Subject: mmc: sdhci-acpi: Disable write protect detection on Acer Aspire + Switch 10 (SW5-012) + +From: Hans de Goede + +[ Upstream commit 3397b251ea02003f47f0b1667f3fe30bb4f9ce90 ] + +On the Acer Aspire Switch 10 (SW5-012) microSD slot always reports the card +being write-protected even though microSD cards do not have a write-protect +switch at all. + +Add a new DMI_QUIRK_SD_NO_WRITE_PROTECT quirk which when set sets +the MMC_CAP2_NO_WRITE_PROTECT flag on the controller for the external SD +slot; and add a DMI quirk table entry which selects this quirk for the +Acer SW5-012. + +Signed-off-by: Hans de Goede +Acked-by: Adrian Hunter +Cc: stable@vger.kernel.org +Link: https://lore.kernel.org/r/20200316184753.393458-2-hdegoede@redhat.com +Signed-off-by: Ulf Hansson +Stable-dep-of: a92a73b1d924 ("mmc: sdhci-acpi: Sort DMI quirks alphabetically") +Signed-off-by: Sasha Levin +--- + drivers/mmc/host/sdhci-acpi.c | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c +index 6a402367b1499..31049a9b1d582 100644 +--- a/drivers/mmc/host/sdhci-acpi.c ++++ b/drivers/mmc/host/sdhci-acpi.c +@@ -80,6 +80,7 @@ struct sdhci_acpi_host { + + enum { + DMI_QUIRK_RESET_SD_SIGNAL_VOLT_ON_SUSP = BIT(0), ++ DMI_QUIRK_SD_NO_WRITE_PROTECT = BIT(1), + }; + + static inline void *sdhci_acpi_priv(struct sdhci_acpi_host *c) +@@ -774,6 +775,18 @@ static const struct dmi_system_id sdhci_acpi_quirks[] = { + }, + .driver_data = (void *)DMI_QUIRK_RESET_SD_SIGNAL_VOLT_ON_SUSP, + }, ++ { ++ /* ++ * The Acer Aspire Switch 10 (SW5-012) microSD slot always ++ * reports the card being write-protected even though microSD ++ * cards do not have a write-protect switch at all. ++ */ ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "Acer"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "Aspire SW5-012"), ++ }, ++ .driver_data = (void *)DMI_QUIRK_SD_NO_WRITE_PROTECT, ++ }, + {} /* Terminating entry */ + }; + +@@ -898,6 +911,9 @@ static int sdhci_acpi_probe(struct platform_device *pdev) + + if (quirks & DMI_QUIRK_RESET_SD_SIGNAL_VOLT_ON_SUSP) + c->reset_signal_volt_on_suspend = true; ++ ++ if (quirks & DMI_QUIRK_SD_NO_WRITE_PROTECT) ++ host->mmc->caps2 |= MMC_CAP2_NO_WRITE_PROTECT; + } + + err = sdhci_setup_host(host); +-- +2.43.0 + diff --git a/queue-5.4/mmc-sdhci-acpi-disable-write-protect-detection-on-to.patch b/queue-5.4/mmc-sdhci-acpi-disable-write-protect-detection-on-to.patch new file mode 100644 index 00000000000..4a5d5639c54 --- /dev/null +++ b/queue-5.4/mmc-sdhci-acpi-disable-write-protect-detection-on-to.patch @@ -0,0 +1,53 @@ +From e084998de943b8af59f83c158e8935390d2bcdfa Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 3 May 2021 11:21:57 +0200 +Subject: mmc: sdhci-acpi: Disable write protect detection on Toshiba Encore 2 + WT8-B + +From: Hans de Goede + +[ Upstream commit 94ee6782e045645abd9180ab9369b01293d862bd ] + +On the Toshiba Encore 2 WT8-B the microSD slot always reports the card +being write-protected even though microSD cards do not have a write-protect +switch at all. + +Add a new DMI_QUIRK_SD_NO_WRITE_PROTECT quirk entry to sdhci-acpi.c's +DMI quirk table for this. + +Signed-off-by: Hans de Goede +Acked-by: Adrian Hunter +Link: https://lore.kernel.org/r/20210503092157.5689-1-hdegoede@redhat.com +Signed-off-by: Ulf Hansson +Cc: stable@vger.kernel.org +Stable-dep-of: a92a73b1d924 ("mmc: sdhci-acpi: Sort DMI quirks alphabetically") +Signed-off-by: Sasha Levin +--- + drivers/mmc/host/sdhci-acpi.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c +index 31049a9b1d582..ba4c00fc62600 100644 +--- a/drivers/mmc/host/sdhci-acpi.c ++++ b/drivers/mmc/host/sdhci-acpi.c +@@ -787,6 +787,17 @@ static const struct dmi_system_id sdhci_acpi_quirks[] = { + }, + .driver_data = (void *)DMI_QUIRK_SD_NO_WRITE_PROTECT, + }, ++ { ++ /* ++ * The Toshiba WT8-B's microSD slot always reports the card being ++ * write-protected. ++ */ ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "TOSHIBA ENCORE 2 WT8-B"), ++ }, ++ .driver_data = (void *)DMI_QUIRK_SD_NO_WRITE_PROTECT, ++ }, + {} /* Terminating entry */ + }; + +-- +2.43.0 + diff --git a/queue-5.4/mmc-sdhci-acpi-disable-write-protect-detection-on-to.patch-21681 b/queue-5.4/mmc-sdhci-acpi-disable-write-protect-detection-on-to.patch-21681 new file mode 100644 index 00000000000..afb9abcd3fa --- /dev/null +++ b/queue-5.4/mmc-sdhci-acpi-disable-write-protect-detection-on-to.patch-21681 @@ -0,0 +1,50 @@ +From 3cb15cba5c525cb9740b25ce3481390c386ae9f2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 10 Apr 2024 21:16:38 +0200 +Subject: mmc: sdhci-acpi: Disable write protect detection on Toshiba WT10-A + +From: Hans de Goede + +[ Upstream commit ef3eab75e17191e5665f52e64e85bc29d5705a7b ] + +On the Toshiba WT10-A the microSD slot always reports the card being +write-protected, just like on the Toshiba WT8-B. + +Add a DMI quirk to work around this. + +Reviewed-by: Andy Shevchenko +Signed-off-by: Hans de Goede +Acked-by: Adrian Hunter +Cc: stable@vger.kernel.org +Link: https://lore.kernel.org/r/20240410191639.526324-6-hdegoede@redhat.com +Signed-off-by: Ulf Hansson +Signed-off-by: Sasha Levin +--- + drivers/mmc/host/sdhci-acpi.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c +index b4192e00c333e..d3a7d38eb2a96 100644 +--- a/drivers/mmc/host/sdhci-acpi.c ++++ b/drivers/mmc/host/sdhci-acpi.c +@@ -799,6 +799,17 @@ static const struct dmi_system_id sdhci_acpi_quirks[] = { + }, + .driver_data = (void *)DMI_QUIRK_SD_NO_WRITE_PROTECT, + }, ++ { ++ /* ++ * The Toshiba WT10-A's microSD slot always reports the card being ++ * write-protected. ++ */ ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "TOSHIBA WT10-A"), ++ }, ++ .driver_data = (void *)DMI_QUIRK_SD_NO_WRITE_PROTECT, ++ }, + {} /* Terminating entry */ + }; + +-- +2.43.0 + diff --git a/queue-5.4/mmc-sdhci-acpi-sort-dmi-quirks-alphabetically.patch b/queue-5.4/mmc-sdhci-acpi-sort-dmi-quirks-alphabetically.patch new file mode 100644 index 00000000000..8b9688e1d2a --- /dev/null +++ b/queue-5.4/mmc-sdhci-acpi-sort-dmi-quirks-alphabetically.patch @@ -0,0 +1,69 @@ +From 4f5b54d40d617b8297eea7e3ab6e0b5b5824b766 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 10 Apr 2024 21:16:36 +0200 +Subject: mmc: sdhci-acpi: Sort DMI quirks alphabetically + +From: Hans de Goede + +[ Upstream commit a92a73b1d9249d155412d8ac237142fa716803ea ] + +Sort the DMI quirks alphabetically. + +Reviewed-by: Andy Shevchenko +Signed-off-by: Hans de Goede +Acked-by: Adrian Hunter +Cc: stable@vger.kernel.org +Link: https://lore.kernel.org/r/20240410191639.526324-4-hdegoede@redhat.com +Signed-off-by: Ulf Hansson +Signed-off-by: Sasha Levin +--- + drivers/mmc/host/sdhci-acpi.c | 25 +++++++++++++------------ + 1 file changed, 13 insertions(+), 12 deletions(-) + +diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c +index ba4c00fc62600..b4192e00c333e 100644 +--- a/drivers/mmc/host/sdhci-acpi.c ++++ b/drivers/mmc/host/sdhci-acpi.c +@@ -760,7 +760,20 @@ static const struct acpi_device_id sdhci_acpi_ids[] = { + }; + MODULE_DEVICE_TABLE(acpi, sdhci_acpi_ids); + ++/* Please keep this list sorted alphabetically */ + static const struct dmi_system_id sdhci_acpi_quirks[] = { ++ { ++ /* ++ * The Acer Aspire Switch 10 (SW5-012) microSD slot always ++ * reports the card being write-protected even though microSD ++ * cards do not have a write-protect switch at all. ++ */ ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "Acer"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "Aspire SW5-012"), ++ }, ++ .driver_data = (void *)DMI_QUIRK_SD_NO_WRITE_PROTECT, ++ }, + { + /* + * The Lenovo Miix 320-10ICR has a bug in the _PS0 method of +@@ -775,18 +788,6 @@ static const struct dmi_system_id sdhci_acpi_quirks[] = { + }, + .driver_data = (void *)DMI_QUIRK_RESET_SD_SIGNAL_VOLT_ON_SUSP, + }, +- { +- /* +- * The Acer Aspire Switch 10 (SW5-012) microSD slot always +- * reports the card being write-protected even though microSD +- * cards do not have a write-protect switch at all. +- */ +- .matches = { +- DMI_MATCH(DMI_SYS_VENDOR, "Acer"), +- DMI_MATCH(DMI_PRODUCT_NAME, "Aspire SW5-012"), +- }, +- .driver_data = (void *)DMI_QUIRK_SD_NO_WRITE_PROTECT, +- }, + { + /* + * The Toshiba WT8-B's microSD slot always reports the card being +-- +2.43.0 + diff --git a/queue-5.4/mmc-sdhci-acpi-switch-signal-voltage-back-to-3.3v-on.patch b/queue-5.4/mmc-sdhci-acpi-switch-signal-voltage-back-to-3.3v-on.patch new file mode 100644 index 00000000000..a00064c440b --- /dev/null +++ b/queue-5.4/mmc-sdhci-acpi-switch-signal-voltage-back-to-3.3v-on.patch @@ -0,0 +1,208 @@ +From f42b28c2b0945d814bb4cb62eebf807d0c32f976 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 16 Mar 2020 19:47:52 +0100 +Subject: mmc: sdhci-acpi: Switch signal voltage back to 3.3V on suspend on + external microSD on Lenovo Miix 320 + +From: Hans de Goede + +[ Upstream commit 84d49b3d08a1d33690cc159036f381c31c27c17b ] + +Based on a sample of 7 DSDTs from Cherry Trail devices using an AXP288 +PMIC depending on the design one of 2 possible LDOs on the PMIC is used +for the MMC signalling voltage, either DLDO3 or GPIO1LDO (GPIO1 pin in +low noise LDO mode). + +The Lenovo Miix 320-10ICR uses GPIO1LDO in the SHC1 ACPI device's DSM +methods to set 3.3 or 1.8 signalling voltage and this appears to work +as advertised, so presumably the device is actually using GPIO1LDO for +the external microSD signalling voltage. + +But this device has a bug in the _PS0 method of the SHC1 ACPI device, +the DSM remembers the last set signalling voltage and the _PS0 restores +this after a (runtime) suspend-resume cycle, but it "restores" the voltage +on DLDO3 instead of setting it on GPIO1LDO as the DSM method does. DLDO3 +is used for the LCD and setting it to 1.8V causes the LCD to go black. + +This commit works around this issue by calling the Intel DSM to reset the +signal voltage to 3.3V after the host has been runtime suspended. +This will make the _PS0 method reprogram the DLDO3 voltage to 3.3V, which +leaves it at its original setting fixing the LCD going black. + +This commit adds and uses a DMI quirk mechanism to only trigger this +workaround on the Lenovo Miix 320 while leaving the behavior of the +driver unchanged on other devices. + +BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=111294 +BugLink: https://gitlab.freedesktop.org/drm/intel/issues/355 +Reported-by: russianneuromancer +Signed-off-by: Hans de Goede +Acked-by: Adrian Hunter +Cc: stable@vger.kernel.org +Link: https://lore.kernel.org/r/20200316184753.393458-1-hdegoede@redhat.com +Signed-off-by: Ulf Hansson +Stable-dep-of: a92a73b1d924 ("mmc: sdhci-acpi: Sort DMI quirks alphabetically") +Signed-off-by: Sasha Levin +--- + drivers/mmc/host/sdhci-acpi.c | 68 +++++++++++++++++++++++++++++++++-- + 1 file changed, 66 insertions(+), 2 deletions(-) + +diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c +index a8d9a6037fe56..6a402367b1499 100644 +--- a/drivers/mmc/host/sdhci-acpi.c ++++ b/drivers/mmc/host/sdhci-acpi.c +@@ -23,6 +23,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -72,9 +73,15 @@ struct sdhci_acpi_host { + const struct sdhci_acpi_slot *slot; + struct platform_device *pdev; + bool use_runtime_pm; ++ bool is_intel; ++ bool reset_signal_volt_on_suspend; + unsigned long private[0] ____cacheline_aligned; + }; + ++enum { ++ DMI_QUIRK_RESET_SD_SIGNAL_VOLT_ON_SUSP = BIT(0), ++}; ++ + static inline void *sdhci_acpi_priv(struct sdhci_acpi_host *c) + { + return (void *)c->private; +@@ -391,6 +398,8 @@ static int intel_probe_slot(struct platform_device *pdev, struct acpi_device *ad + host->mmc_host_ops.start_signal_voltage_switch = + intel_start_signal_voltage_switch; + ++ c->is_intel = true; ++ + return 0; + } + +@@ -750,6 +759,24 @@ static const struct acpi_device_id sdhci_acpi_ids[] = { + }; + MODULE_DEVICE_TABLE(acpi, sdhci_acpi_ids); + ++static const struct dmi_system_id sdhci_acpi_quirks[] = { ++ { ++ /* ++ * The Lenovo Miix 320-10ICR has a bug in the _PS0 method of ++ * the SHC1 ACPI device, this bug causes it to reprogram the ++ * wrong LDO (DLDO3) to 1.8V if 1.8V modes are used and the ++ * card is (runtime) suspended + resumed. DLDO3 is used for ++ * the LCD and setting it to 1.8V causes the LCD to go black. ++ */ ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), ++ DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo MIIX 320-10ICR"), ++ }, ++ .driver_data = (void *)DMI_QUIRK_RESET_SD_SIGNAL_VOLT_ON_SUSP, ++ }, ++ {} /* Terminating entry */ ++}; ++ + static const struct sdhci_acpi_slot *sdhci_acpi_get_slot(struct acpi_device *adev) + { + const struct sdhci_acpi_uid_slot *u; +@@ -766,17 +793,23 @@ static int sdhci_acpi_probe(struct platform_device *pdev) + struct device *dev = &pdev->dev; + const struct sdhci_acpi_slot *slot; + struct acpi_device *device, *child; ++ const struct dmi_system_id *id; + struct sdhci_acpi_host *c; + struct sdhci_host *host; + struct resource *iomem; + resource_size_t len; + size_t priv_size; ++ int quirks = 0; + int err; + + device = ACPI_COMPANION(dev); + if (!device) + return -ENODEV; + ++ id = dmi_first_match(sdhci_acpi_quirks); ++ if (id) ++ quirks = (long)id->driver_data; ++ + slot = sdhci_acpi_get_slot(device); + + /* Power on the SDHCI controller and its children */ +@@ -862,6 +895,9 @@ static int sdhci_acpi_probe(struct platform_device *pdev) + dev_warn(dev, "failed to setup card detect gpio\n"); + c->use_runtime_pm = false; + } ++ ++ if (quirks & DMI_QUIRK_RESET_SD_SIGNAL_VOLT_ON_SUSP) ++ c->reset_signal_volt_on_suspend = true; + } + + err = sdhci_setup_host(host); +@@ -926,17 +962,39 @@ static int sdhci_acpi_remove(struct platform_device *pdev) + return 0; + } + ++static void __maybe_unused sdhci_acpi_reset_signal_voltage_if_needed( ++ struct device *dev) ++{ ++ struct sdhci_acpi_host *c = dev_get_drvdata(dev); ++ struct sdhci_host *host = c->host; ++ ++ if (c->is_intel && c->reset_signal_volt_on_suspend && ++ host->mmc->ios.signal_voltage != MMC_SIGNAL_VOLTAGE_330) { ++ struct intel_host *intel_host = sdhci_acpi_priv(c); ++ unsigned int fn = INTEL_DSM_V33_SWITCH; ++ u32 result = 0; ++ ++ intel_dsm(intel_host, dev, fn, &result); ++ } ++} ++ + #ifdef CONFIG_PM_SLEEP + + static int sdhci_acpi_suspend(struct device *dev) + { + struct sdhci_acpi_host *c = dev_get_drvdata(dev); + struct sdhci_host *host = c->host; ++ int ret; + + if (host->tuning_mode != SDHCI_TUNING_MODE_3) + mmc_retune_needed(host->mmc); + +- return sdhci_suspend_host(host); ++ ret = sdhci_suspend_host(host); ++ if (ret) ++ return ret; ++ ++ sdhci_acpi_reset_signal_voltage_if_needed(dev); ++ return 0; + } + + static int sdhci_acpi_resume(struct device *dev) +@@ -956,11 +1014,17 @@ static int sdhci_acpi_runtime_suspend(struct device *dev) + { + struct sdhci_acpi_host *c = dev_get_drvdata(dev); + struct sdhci_host *host = c->host; ++ int ret; + + if (host->tuning_mode != SDHCI_TUNING_MODE_3) + mmc_retune_needed(host->mmc); + +- return sdhci_runtime_suspend_host(host); ++ ret = sdhci_runtime_suspend_host(host); ++ if (ret) ++ return ret; ++ ++ sdhci_acpi_reset_signal_voltage_if_needed(dev); ++ return 0; + } + + static int sdhci_acpi_runtime_resume(struct device *dev) +-- +2.43.0 + diff --git a/queue-5.4/mmc-sdhci-acpi-switch-to-use-acpi_dev_hid_uid_match.patch b/queue-5.4/mmc-sdhci-acpi-switch-to-use-acpi_dev_hid_uid_match.patch new file mode 100644 index 00000000000..4a2cf41dc02 --- /dev/null +++ b/queue-5.4/mmc-sdhci-acpi-switch-to-use-acpi_dev_hid_uid_match.patch @@ -0,0 +1,183 @@ +From 30ab76be9799a03b0943addb5db5775905b33235 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 1 Oct 2019 17:27:24 +0300 +Subject: mmc: sdhci-acpi: Switch to use acpi_dev_hid_uid_match() + +From: Andy Shevchenko + +[ Upstream commit 4f3cde3a24ce874973ee21269da16024c77a159c ] + +Since we have a generic helper, drop custom implementation in the driver. + +Signed-off-by: Andy Shevchenko +Reviewed-by: Mika Westerberg +Acked-by: Adrian Hunter +Signed-off-by: Rafael J. Wysocki +Stable-dep-of: a92a73b1d924 ("mmc: sdhci-acpi: Sort DMI quirks alphabetically") +Signed-off-by: Sasha Levin +--- + drivers/mmc/host/sdhci-acpi.c | 49 ++++++++++++----------------------- + 1 file changed, 16 insertions(+), 33 deletions(-) + +diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c +index a02f3538d5611..a8d9a6037fe56 100644 +--- a/drivers/mmc/host/sdhci-acpi.c ++++ b/drivers/mmc/host/sdhci-acpi.c +@@ -61,7 +61,7 @@ struct sdhci_acpi_slot { + mmc_pm_flag_t pm_caps; + unsigned int flags; + size_t priv_size; +- int (*probe_slot)(struct platform_device *, const char *, const char *); ++ int (*probe_slot)(struct platform_device *, struct acpi_device *); + int (*remove_slot)(struct platform_device *); + int (*free_slot)(struct platform_device *pdev); + int (*setup_host)(struct platform_device *pdev); +@@ -325,12 +325,10 @@ static bool sdhci_acpi_cht_pci_wifi(unsigned int vendor, unsigned int device, + * wifi card in the expected slot with an ACPI companion node, is used to + * indicate that acpi_device_fix_up_power() should be avoided. + */ +-static inline bool sdhci_acpi_no_fixup_child_power(const char *hid, +- const char *uid) ++static inline bool sdhci_acpi_no_fixup_child_power(struct acpi_device *adev) + { + return sdhci_acpi_cht() && +- !strcmp(hid, "80860F14") && +- !strcmp(uid, "2") && ++ acpi_dev_hid_uid_match(adev, "80860F14", "2") && + sdhci_acpi_cht_pci_wifi(0x14e4, 0x43ec, 0, 28); + } + +@@ -345,8 +343,7 @@ static inline bool sdhci_acpi_byt_defer(struct device *dev) + return false; + } + +-static inline bool sdhci_acpi_no_fixup_child_power(const char *hid, +- const char *uid) ++static inline bool sdhci_acpi_no_fixup_child_power(struct acpi_device *adev) + { + return false; + } +@@ -375,19 +372,18 @@ static int bxt_get_cd(struct mmc_host *mmc) + return ret; + } + +-static int intel_probe_slot(struct platform_device *pdev, const char *hid, +- const char *uid) ++static int intel_probe_slot(struct platform_device *pdev, struct acpi_device *adev) + { + struct sdhci_acpi_host *c = platform_get_drvdata(pdev); + struct intel_host *intel_host = sdhci_acpi_priv(c); + struct sdhci_host *host = c->host; + +- if (hid && uid && !strcmp(hid, "80860F14") && !strcmp(uid, "1") && ++ if (acpi_dev_hid_uid_match(adev, "80860F14", "1") && + sdhci_readl(host, SDHCI_CAPABILITIES) == 0x446cc8b2 && + sdhci_readl(host, SDHCI_CAPABILITIES_1) == 0x00000807) + host->timeout_clk = 1000; /* 1000 kHz i.e. 1 MHz */ + +- if (hid && !strcmp(hid, "80865ACA")) ++ if (acpi_dev_hid_uid_match(adev, "80865ACA", NULL)) + host->mmc_host_ops.get_cd = bxt_get_cd; + + intel_dsm_init(intel_host, &pdev->dev, host->mmc); +@@ -473,8 +469,7 @@ static irqreturn_t sdhci_acpi_qcom_handler(int irq, void *ptr) + return IRQ_HANDLED; + } + +-static int qcom_probe_slot(struct platform_device *pdev, const char *hid, +- const char *uid) ++static int qcom_probe_slot(struct platform_device *pdev, struct acpi_device *adev) + { + struct sdhci_acpi_host *c = platform_get_drvdata(pdev); + struct sdhci_host *host = c->host; +@@ -482,7 +477,7 @@ static int qcom_probe_slot(struct platform_device *pdev, const char *hid, + + *irq = -EINVAL; + +- if (strcmp(hid, "QCOM8051")) ++ if (!acpi_dev_hid_uid_match(adev, "QCOM8051", NULL)) + return 0; + + *irq = platform_get_irq(pdev, 1); +@@ -501,14 +496,12 @@ static int qcom_free_slot(struct platform_device *pdev) + struct sdhci_host *host = c->host; + struct acpi_device *adev; + int *irq = sdhci_acpi_priv(c); +- const char *hid; + + adev = ACPI_COMPANION(dev); + if (!adev) + return -ENODEV; + +- hid = acpi_device_hid(adev); +- if (strcmp(hid, "QCOM8051")) ++ if (!acpi_dev_hid_uid_match(adev, "QCOM8051", NULL)) + return 0; + + if (*irq < 0) +@@ -645,7 +638,7 @@ static const struct sdhci_acpi_chip sdhci_acpi_chip_amd = { + }; + + static int sdhci_acpi_emmc_amd_probe_slot(struct platform_device *pdev, +- const char *hid, const char *uid) ++ struct acpi_device *adev) + { + struct sdhci_acpi_host *c = platform_get_drvdata(pdev); + struct sdhci_host *host = c->host; +@@ -757,17 +750,12 @@ static const struct acpi_device_id sdhci_acpi_ids[] = { + }; + MODULE_DEVICE_TABLE(acpi, sdhci_acpi_ids); + +-static const struct sdhci_acpi_slot *sdhci_acpi_get_slot(const char *hid, +- const char *uid) ++static const struct sdhci_acpi_slot *sdhci_acpi_get_slot(struct acpi_device *adev) + { + const struct sdhci_acpi_uid_slot *u; + + for (u = sdhci_acpi_uids; u->hid; u++) { +- if (strcmp(u->hid, hid)) +- continue; +- if (!u->uid) +- return u->slot; +- if (uid && !strcmp(u->uid, uid)) ++ if (acpi_dev_hid_uid_match(adev, u->hid, u->uid)) + return u->slot; + } + return NULL; +@@ -783,22 +771,17 @@ static int sdhci_acpi_probe(struct platform_device *pdev) + struct resource *iomem; + resource_size_t len; + size_t priv_size; +- const char *hid; +- const char *uid; + int err; + + device = ACPI_COMPANION(dev); + if (!device) + return -ENODEV; + +- hid = acpi_device_hid(device); +- uid = acpi_device_uid(device); +- +- slot = sdhci_acpi_get_slot(hid, uid); ++ slot = sdhci_acpi_get_slot(device); + + /* Power on the SDHCI controller and its children */ + acpi_device_fix_up_power(device); +- if (!sdhci_acpi_no_fixup_child_power(hid, uid)) { ++ if (!sdhci_acpi_no_fixup_child_power(device)) { + list_for_each_entry(child, &device->children, node) + if (child->status.present && child->status.enabled) + acpi_device_fix_up_power(child); +@@ -848,7 +831,7 @@ static int sdhci_acpi_probe(struct platform_device *pdev) + + if (c->slot) { + if (c->slot->probe_slot) { +- err = c->slot->probe_slot(pdev, hid, uid); ++ err = c->slot->probe_slot(pdev, device); + if (err) + goto err_free; + } +-- +2.43.0 + diff --git a/queue-5.4/pci-add-pci_error_response-and-related-definitions.patch b/queue-5.4/pci-add-pci_error_response-and-related-definitions.patch new file mode 100644 index 00000000000..b35de23ec53 --- /dev/null +++ b/queue-5.4/pci-add-pci_error_response-and-related-definitions.patch @@ -0,0 +1,56 @@ +From f23bee71411244d539230f541d2dbb609cfea5c3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 18 Nov 2021 19:33:11 +0530 +Subject: PCI: Add PCI_ERROR_RESPONSE and related definitions +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Naveen Naidu + +[ Upstream commit 57bdeef4716689d9b0e3571034d65cf420f6efcd ] + +A config or MMIO read from a PCI device that doesn't exist or doesn't +respond causes a PCI error. There's no real data to return to satisfy the +CPU read, so most hardware fabricates ~0 data. + +Add a PCI_ERROR_RESPONSE definition for that and use it where appropriate +to make these checks consistent and easier to find. + +Also add helper definitions PCI_SET_ERROR_RESPONSE() and +PCI_POSSIBLE_ERROR() to make the code more readable. + +Suggested-by: Bjorn Helgaas +Link: https://lore.kernel.org/r/55563bf4dfc5d3fdc96695373c659d099bf175b1.1637243717.git.naveennaidu479@gmail.com +Signed-off-by: Naveen Naidu +Signed-off-by: Bjorn Helgaas +Reviewed-by: Pali Rohár +Stable-dep-of: c625dabbf1c4 ("x86/amd_nb: Check for invalid SMN reads") +Signed-off-by: Sasha Levin +--- + include/linux/pci.h | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/include/linux/pci.h b/include/linux/pci.h +index 1cd5caa567cf5..7edc6de9e88c2 100644 +--- a/include/linux/pci.h ++++ b/include/linux/pci.h +@@ -129,6 +129,15 @@ enum pci_interrupt_pin { + /* The number of legacy PCI INTx interrupts */ + #define PCI_NUM_INTX 4 + ++/* ++ * Reading from a device that doesn't respond typically returns ~0. A ++ * successful read from a device may also return ~0, so you need additional ++ * information to reliably identify errors. ++ */ ++#define PCI_ERROR_RESPONSE (~0ULL) ++#define PCI_SET_ERROR_RESPONSE(val) (*(val) = ((typeof(*(val))) PCI_ERROR_RESPONSE)) ++#define PCI_POSSIBLE_ERROR(val) ((val) == ((typeof(val)) PCI_ERROR_RESPONSE)) ++ + /* + * pci_power_t values must match the bits in the Capabilities PME_Support + * and Control/Status PowerState fields in the Power Management capability. +-- +2.43.0 + diff --git a/queue-5.4/perf-core-fix-missing-wakeup-when-waiting-for-contex.patch b/queue-5.4/perf-core-fix-missing-wakeup-when-waiting-for-contex.patch new file mode 100644 index 00000000000..b61a6e7d806 --- /dev/null +++ b/queue-5.4/perf-core-fix-missing-wakeup-when-waiting-for-contex.patch @@ -0,0 +1,111 @@ +From 507076dab12d724b6461575546074466b410473b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 13 May 2024 10:39:48 +0000 +Subject: perf/core: Fix missing wakeup when waiting for context reference + +From: Haifeng Xu + +[ Upstream commit 74751ef5c1912ebd3e65c3b65f45587e05ce5d36 ] + +In our production environment, we found many hung tasks which are +blocked for more than 18 hours. Their call traces are like this: + +[346278.191038] __schedule+0x2d8/0x890 +[346278.191046] schedule+0x4e/0xb0 +[346278.191049] perf_event_free_task+0x220/0x270 +[346278.191056] ? init_wait_var_entry+0x50/0x50 +[346278.191060] copy_process+0x663/0x18d0 +[346278.191068] kernel_clone+0x9d/0x3d0 +[346278.191072] __do_sys_clone+0x5d/0x80 +[346278.191076] __x64_sys_clone+0x25/0x30 +[346278.191079] do_syscall_64+0x5c/0xc0 +[346278.191083] ? syscall_exit_to_user_mode+0x27/0x50 +[346278.191086] ? do_syscall_64+0x69/0xc0 +[346278.191088] ? irqentry_exit_to_user_mode+0x9/0x20 +[346278.191092] ? irqentry_exit+0x19/0x30 +[346278.191095] ? exc_page_fault+0x89/0x160 +[346278.191097] ? asm_exc_page_fault+0x8/0x30 +[346278.191102] entry_SYSCALL_64_after_hwframe+0x44/0xae + +The task was waiting for the refcount become to 1, but from the vmcore, +we found the refcount has already been 1. It seems that the task didn't +get woken up by perf_event_release_kernel() and got stuck forever. The +below scenario may cause the problem. + +Thread A Thread B +... ... +perf_event_free_task perf_event_release_kernel + ... + acquire event->child_mutex + ... + get_ctx + ... release event->child_mutex + acquire ctx->mutex + ... + perf_free_event (acquire/release event->child_mutex) + ... + release ctx->mutex + wait_var_event + acquire ctx->mutex + acquire event->child_mutex + # move existing events to free_list + release event->child_mutex + release ctx->mutex + put_ctx +... ... + +In this case, all events of the ctx have been freed, so we couldn't +find the ctx in free_list and Thread A will miss the wakeup. It's thus +necessary to add a wakeup after dropping the reference. + +Fixes: 1cf8dfe8a661 ("perf/core: Fix race between close() and fork()") +Signed-off-by: Haifeng Xu +Signed-off-by: Peter Zijlstra (Intel) +Reviewed-by: Frederic Weisbecker +Acked-by: Mark Rutland +Cc: stable@vger.kernel.org +Link: https://lkml.kernel.org/r/20240513103948.33570-1-haifeng.xu@shopee.com +Signed-off-by: Sasha Levin +--- + kernel/events/core.c | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/kernel/events/core.c b/kernel/events/core.c +index 576af248a539a..2347dda682abd 100644 +--- a/kernel/events/core.c ++++ b/kernel/events/core.c +@@ -4760,6 +4760,7 @@ int perf_event_release_kernel(struct perf_event *event) + again: + mutex_lock(&event->child_mutex); + list_for_each_entry(child, &event->child_list, child_list) { ++ void *var = NULL; + + /* + * Cannot change, child events are not migrated, see the +@@ -4800,11 +4801,23 @@ int perf_event_release_kernel(struct perf_event *event) + * this can't be the last reference. + */ + put_event(event); ++ } else { ++ var = &ctx->refcount; + } + + mutex_unlock(&event->child_mutex); + mutex_unlock(&ctx->mutex); + put_ctx(ctx); ++ ++ if (var) { ++ /* ++ * If perf_event_free_task() has deleted all events from the ++ * ctx while the child_mutex got released above, make sure to ++ * notify about the preceding put_ctx(). ++ */ ++ smp_mb(); /* pairs with wait_var_event() */ ++ wake_up_var(var); ++ } + goto again; + } + mutex_unlock(&event->child_mutex); +-- +2.43.0 + diff --git a/queue-5.4/revert-kheaders-substituting-sort-in-archive-creatio.patch b/queue-5.4/revert-kheaders-substituting-sort-in-archive-creatio.patch new file mode 100644 index 00000000000..bba544a9859 --- /dev/null +++ b/queue-5.4/revert-kheaders-substituting-sort-in-archive-creatio.patch @@ -0,0 +1,48 @@ +From 6f43d1454d33c746de667a0d94cf03364e8aba88 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 21 May 2023 22:23:35 +0900 +Subject: Revert "kheaders: substituting --sort in archive creation" + +From: Masahiro Yamada + +[ Upstream commit 49c386ebbb43394ff4773ce24f726f6afc4c30c8 ] + +This reverts commit 700dea5a0bea9f64eba89fae7cb2540326fdfdc1. + +The reason for that commit was --sort=ORDER introduced in +tar 1.28 (2014). More than 3 years have passed since then. + +Requiring GNU tar 1.28 should be fine now because we require +GCC 5.1 (2015). + +Signed-off-by: Masahiro Yamada +Reviewed-by: Nicolas Schier +Stable-dep-of: 3bd27a847a3a ("kheaders: explicitly define file modes for archived headers") +Signed-off-by: Sasha Levin +--- + kernel/gen_kheaders.sh | 9 +++------ + 1 file changed, 3 insertions(+), 6 deletions(-) + +diff --git a/kernel/gen_kheaders.sh b/kernel/gen_kheaders.sh +index c1510f0ab3ea5..d7e827c6cd2d2 100755 +--- a/kernel/gen_kheaders.sh ++++ b/kernel/gen_kheaders.sh +@@ -83,12 +83,9 @@ find $cpio_dir -type f -print0 | + xargs -0 -P8 -n1 perl -pi -e 'BEGIN {undef $/;}; s/\/\*((?!SPDX).)*?\*\///smg;' + + # Create archive and try to normalize metadata for reproducibility. +-# For compatibility with older versions of tar, files are fed to tar +-# pre-sorted, as --sort=name might not be available. +-find $cpio_dir -printf "./%P\n" | LC_ALL=C sort | \ +- tar "${KBUILD_BUILD_TIMESTAMP:+--mtime=$KBUILD_BUILD_TIMESTAMP}" \ +- --owner=0 --group=0 --numeric-owner --no-recursion \ +- -I $XZ -cf $tarfile -C $cpio_dir/ -T - > /dev/null ++tar "${KBUILD_BUILD_TIMESTAMP:+--mtime=$KBUILD_BUILD_TIMESTAMP}" \ ++ --owner=0 --group=0 --sort=name --numeric-owner \ ++ -I $XZ -cf $tarfile -C $cpio_dir/ . > /dev/null + + echo $headers_md5 > kernel/kheaders.md5 + echo "$this_file_md5" >> kernel/kheaders.md5 +-- +2.43.0 + diff --git a/queue-5.4/s390-cpacf-make-use-of-invalid-opcode-produce-a-link.patch b/queue-5.4/s390-cpacf-make-use-of-invalid-opcode-produce-a-link.patch new file mode 100644 index 00000000000..37729977bb8 --- /dev/null +++ b/queue-5.4/s390-cpacf-make-use-of-invalid-opcode-produce-a-link.patch @@ -0,0 +1,65 @@ +From 2ad575173fd2dea39bc933a54f2a5a883e102a41 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 14 May 2024 10:09:32 +0200 +Subject: s390/cpacf: Make use of invalid opcode produce a link error + +From: Harald Freudenberger + +[ Upstream commit 32e8bd6423fc127d2b37bdcf804fd76af3bbec79 ] + +Instead of calling BUG() at runtime introduce and use a prototype for a +non-existing function to produce a link error during compile when a not +supported opcode is used with the __cpacf_query() or __cpacf_check_opcode() +inline functions. + +Suggested-by: Heiko Carstens +Signed-off-by: Harald Freudenberger +Reviewed-by: Holger Dengler +Reviewed-by: Juergen Christ +Cc: stable@vger.kernel.org +Signed-off-by: Heiko Carstens +Signed-off-by: Sasha Levin +--- + arch/s390/include/asm/cpacf.h | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/arch/s390/include/asm/cpacf.h b/arch/s390/include/asm/cpacf.h +index fa31f71cf5746..0f6ff2008a159 100644 +--- a/arch/s390/include/asm/cpacf.h ++++ b/arch/s390/include/asm/cpacf.h +@@ -161,6 +161,13 @@ + + typedef struct { unsigned char bytes[16]; } cpacf_mask_t; + ++/* ++ * Prototype for a not existing function to produce a link ++ * error if __cpacf_query() or __cpacf_check_opcode() is used ++ * with an invalid compile time const opcode. ++ */ ++void __cpacf_bad_opcode(void); ++ + static __always_inline void __cpacf_query_rre(u32 opc, u8 r1, u8 r2, + cpacf_mask_t *mask) + { +@@ -232,7 +239,7 @@ static __always_inline void __cpacf_query(unsigned int opcode, + __cpacf_query_rre(CPACF_PRNO, 2, 4, mask); + break; + default: +- BUG(); ++ __cpacf_bad_opcode(); + } + } + +@@ -257,7 +264,8 @@ static __always_inline int __cpacf_check_opcode(unsigned int opcode) + case CPACF_KMA: + return test_facility(146); /* check for MSA8 */ + default: +- BUG(); ++ __cpacf_bad_opcode(); ++ return 0; + } + } + +-- +2.43.0 + diff --git a/queue-5.4/series b/queue-5.4/series index cac13825627..9649a628490 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -146,3 +146,21 @@ mm-fix-race-between-__split_huge_pmd_locked-and-gup-fast.patch drm-radeon-fix-ubsan-warning-in-kv_dpm.c.patch gcov-add-support-for-gcc-14.patch i2c-ocores-set-iack-bit-after-core-is-enabled.patch +arm-dts-samsung-smdkv310-fix-keypad-no-autorepeat.patch +arm-dts-samsung-exynos4412-origen-fix-keypad-no-auto.patch +arm-dts-samsung-smdk4412-fix-keypad-no-autorepeat.patch +acpi-utils-introduce-acpi_dev_hid_uid_match-helper.patch +mmc-sdhci-acpi-switch-to-use-acpi_dev_hid_uid_match.patch +mmc-sdhci-acpi-switch-signal-voltage-back-to-3.3v-on.patch +mmc-sdhci-acpi-disable-write-protect-detection-on-ac.patch +mmc-sdhci-acpi-disable-write-protect-detection-on-to.patch +mmc-sdhci-acpi-sort-dmi-quirks-alphabetically.patch +mmc-sdhci-acpi-disable-write-protect-detection-on-to.patch-21681 +arm64-dts-qcom-qcs404-fix-bluetooth-device-address.patch +s390-cpacf-make-use-of-invalid-opcode-produce-a-link.patch +tracing-add-module_description-to-preemptirq_delay_t.patch +revert-kheaders-substituting-sort-in-archive-creatio.patch +kheaders-explicitly-define-file-modes-for-archived-h.patch +perf-core-fix-missing-wakeup-when-waiting-for-contex.patch +pci-add-pci_error_response-and-related-definitions.patch +x86-amd_nb-check-for-invalid-smn-reads.patch diff --git a/queue-5.4/tracing-add-module_description-to-preemptirq_delay_t.patch b/queue-5.4/tracing-add-module_description-to-preemptirq_delay_t.patch new file mode 100644 index 00000000000..72c9b832c96 --- /dev/null +++ b/queue-5.4/tracing-add-module_description-to-preemptirq_delay_t.patch @@ -0,0 +1,39 @@ +From 32ae588ef22033d641ad85c0ba4cf9424a5faa22 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 18 May 2024 15:54:49 -0700 +Subject: tracing: Add MODULE_DESCRIPTION() to preemptirq_delay_test + +From: Jeff Johnson + +[ Upstream commit 23748e3e0fbfe471eff5ce439921629f6a427828 ] + +Fix the 'make W=1' warning: + +WARNING: modpost: missing MODULE_DESCRIPTION() in kernel/trace/preemptirq_delay_test.o + +Link: https://lore.kernel.org/linux-trace-kernel/20240518-md-preemptirq_delay_test-v1-1-387d11b30d85@quicinc.com + +Cc: stable@vger.kernel.org +Cc: Mathieu Desnoyers +Fixes: f96e8577da10 ("lib: Add module for testing preemptoff/irqsoff latency tracers") +Acked-by: Masami Hiramatsu (Google) +Signed-off-by: Jeff Johnson +Signed-off-by: Steven Rostedt (Google) +Signed-off-by: Sasha Levin +--- + kernel/trace/preemptirq_delay_test.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/kernel/trace/preemptirq_delay_test.c b/kernel/trace/preemptirq_delay_test.c +index d8765c952fab3..4692c87d4b69c 100644 +--- a/kernel/trace/preemptirq_delay_test.c ++++ b/kernel/trace/preemptirq_delay_test.c +@@ -69,4 +69,5 @@ static void __exit preemptirq_delay_exit(void) + + module_init(preemptirq_delay_init) + module_exit(preemptirq_delay_exit) ++MODULE_DESCRIPTION("Preempt / IRQ disable delay thread to test latency tracers"); + MODULE_LICENSE("GPL v2"); +-- +2.43.0 + diff --git a/queue-5.4/x86-amd_nb-check-for-invalid-smn-reads.patch b/queue-5.4/x86-amd_nb-check-for-invalid-smn-reads.patch new file mode 100644 index 00000000000..ec3a0c2693c --- /dev/null +++ b/queue-5.4/x86-amd_nb-check-for-invalid-smn-reads.patch @@ -0,0 +1,64 @@ +From e105b2f8b8a59bfd4bccb0ce4d22e1d97925325c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 3 Apr 2023 16:42:44 +0000 +Subject: x86/amd_nb: Check for invalid SMN reads + +From: Yazen Ghannam + +[ Upstream commit c625dabbf1c4a8e77e4734014f2fde7aa9071a1f ] + +AMD Zen-based systems use a System Management Network (SMN) that +provides access to implementation-specific registers. + +SMN accesses are done indirectly through an index/data pair in PCI +config space. The PCI config access may fail and return an error code. +This would prevent the "read" value from being updated. + +However, the PCI config access may succeed, but the return value may be +invalid. This is in similar fashion to PCI bad reads, i.e. return all +bits set. + +Most systems will return 0 for SMN addresses that are not accessible. +This is in line with AMD convention that unavailable registers are +Read-as-Zero/Writes-Ignored. + +However, some systems will return a "PCI Error Response" instead. This +value, along with an error code of 0 from the PCI config access, will +confuse callers of the amd_smn_read() function. + +Check for this condition, clear the return value, and set a proper error +code. + +Fixes: ddfe43cdc0da ("x86/amd_nb: Add SMN and Indirect Data Fabric access for AMD Fam17h") +Signed-off-by: Yazen Ghannam +Signed-off-by: Borislav Petkov (AMD) +Cc: stable@vger.kernel.org +Link: https://lore.kernel.org/r/20230403164244.471141-1-yazen.ghannam@amd.com +Signed-off-by: Sasha Levin +--- + arch/x86/kernel/amd_nb.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/arch/x86/kernel/amd_nb.c b/arch/x86/kernel/amd_nb.c +index c4bc01da820ef..e3b5de7b95988 100644 +--- a/arch/x86/kernel/amd_nb.c ++++ b/arch/x86/kernel/amd_nb.c +@@ -166,7 +166,14 @@ static int __amd_smn_rw(u16 node, u32 address, u32 *value, bool write) + + int amd_smn_read(u16 node, u32 address, u32 *value) + { +- return __amd_smn_rw(node, address, value, false); ++ int err = __amd_smn_rw(node, address, value, false); ++ ++ if (PCI_POSSIBLE_ERROR(*value)) { ++ err = -ENODEV; ++ *value = 0; ++ } ++ ++ return err; + } + EXPORT_SYMBOL_GPL(amd_smn_read); + +-- +2.43.0 + -- 2.47.3