From: Sasha Levin Date: Mon, 19 Jul 2021 13:16:45 +0000 (-0400) Subject: Fixes for 5.13 X-Git-Tag: v5.13.4~29^2~7 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4e37eafbefd0fe7a35f28fb97f2856a160dc5038;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 5.13 Signed-off-by: Sasha Levin --- diff --git a/queue-5.13/acpi-amba-fix-resource-name-in-proc-iomem.patch b/queue-5.13/acpi-amba-fix-resource-name-in-proc-iomem.patch new file mode 100644 index 00000000000..aea28e6a558 --- /dev/null +++ b/queue-5.13/acpi-amba-fix-resource-name-in-proc-iomem.patch @@ -0,0 +1,36 @@ +From 456ab734fcc7b46d0cb74e650cb1ba92bb56ac14 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 29 Jun 2021 19:27:48 +0800 +Subject: ACPI: AMBA: Fix resource name in /proc/iomem + +From: Liguang Zhang + +[ Upstream commit 7718629432676b5ebd9a32940782fe297a0abf8d ] + +In function amba_handler_attach(), dev->res.name is initialized by +amba_device_alloc. But when address_found is false, dev->res.name is +assigned to null value, which leads to wrong resource name display in +/proc/iomem, "" is seen for those resources. + +Signed-off-by: Liguang Zhang +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Sasha Levin +--- + drivers/acpi/acpi_amba.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/acpi/acpi_amba.c b/drivers/acpi/acpi_amba.c +index 49b781a9cd97..ab8a4e0191b1 100644 +--- a/drivers/acpi/acpi_amba.c ++++ b/drivers/acpi/acpi_amba.c +@@ -76,6 +76,7 @@ static int amba_handler_attach(struct acpi_device *adev, + case IORESOURCE_MEM: + if (!address_found) { + dev->res = *rentry->res; ++ dev->res.name = dev_name(&dev->dev); + address_found = true; + } + break; +-- +2.30.2 + diff --git a/queue-5.13/acpi-video-add-quirk-for-the-dell-vostro-3350.patch b/queue-5.13/acpi-video-add-quirk-for-the-dell-vostro-3350.patch new file mode 100644 index 00000000000..befada31b24 --- /dev/null +++ b/queue-5.13/acpi-video-add-quirk-for-the-dell-vostro-3350.patch @@ -0,0 +1,49 @@ +From f5d9ca03946d59d01958e971c819f1805f469cb9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 30 Jun 2021 17:23:16 +0200 +Subject: ACPI: video: Add quirk for the Dell Vostro 3350 + +From: Hans de Goede + +[ Upstream commit 9249c32ec9197e8d34fe5179c9e31668a205db04 ] + +The Dell Vostro 3350 ACPI video-bus device reports spurious +ACPI_VIDEO_NOTIFY_CYCLE events resulting in spurious KEY_SWITCHVIDEOMODE +events being reported to userspace (and causing trouble there). + +Add a quirk setting the report_key_events mask to +REPORT_BRIGHTNESS_KEY_EVENTS so that the ACPI_VIDEO_NOTIFY_CYCLE +events will be ignored, while still reporting brightness up/down +hotkey-presses to userspace normally. + +BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1911763 +Signed-off-by: Hans de Goede +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Sasha Levin +--- + drivers/acpi/acpi_video.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c +index 0c884020f74b..08a51dd285c4 100644 +--- a/drivers/acpi/acpi_video.c ++++ b/drivers/acpi/acpi_video.c +@@ -540,6 +540,15 @@ static const struct dmi_system_id video_dmi_table[] = { + DMI_MATCH(DMI_PRODUCT_NAME, "Vostro V131"), + }, + }, ++ { ++ .callback = video_set_report_key_events, ++ .driver_data = (void *)((uintptr_t)REPORT_BRIGHTNESS_KEY_EVENTS), ++ .ident = "Dell Vostro 3350", ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), ++ DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 3350"), ++ }, ++ }, + /* + * Some machines change the brightness themselves when a brightness + * hotkey gets pressed, despite us telling them not to. In this case +-- +2.30.2 + diff --git a/queue-5.13/alsa-ac97-fix-pm-reference-leak-in-ac97_bus_remove.patch b/queue-5.13/alsa-ac97-fix-pm-reference-leak-in-ac97_bus_remove.patch new file mode 100644 index 00000000000..c085d637a0a --- /dev/null +++ b/queue-5.13/alsa-ac97-fix-pm-reference-leak-in-ac97_bus_remove.patch @@ -0,0 +1,39 @@ +From d069c1d8777ac1dc956b1c18c0d7ff86dc1fc707 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 24 May 2021 05:38:11 -0400 +Subject: ALSA: ac97: fix PM reference leak in ac97_bus_remove() + +From: Yufen Yu + +[ Upstream commit a38e93302ee25b2ca6f4ee76c6c974cf3637985e ] + +pm_runtime_get_sync will increment pm usage counter even it failed. +Forgetting to putting operation will result in reference leak here. +Fix it by replacing it with pm_runtime_resume_and_get to keep usage +counter balanced. + +Reported-by: Hulk Robot +Signed-off-by: Yufen Yu +Link: https://lore.kernel.org/r/20210524093811.612302-1-yuyufen@huawei.com +Signed-off-by: Takashi Iwai +Signed-off-by: Sasha Levin +--- + sound/ac97/bus.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sound/ac97/bus.c b/sound/ac97/bus.c +index d9077e91382b..6ddf646cda65 100644 +--- a/sound/ac97/bus.c ++++ b/sound/ac97/bus.c +@@ -520,7 +520,7 @@ static int ac97_bus_remove(struct device *dev) + struct ac97_codec_driver *adrv = to_ac97_driver(dev->driver); + int ret; + +- ret = pm_runtime_get_sync(dev); ++ ret = pm_runtime_resume_and_get(dev); + if (ret < 0) + return ret; + +-- +2.30.2 + diff --git a/queue-5.13/alsa-bebob-add-support-for-toneweal-fw66.patch b/queue-5.13/alsa-bebob-add-support-for-toneweal-fw66.patch new file mode 100644 index 00000000000..86e76440d46 --- /dev/null +++ b/queue-5.13/alsa-bebob-add-support-for-toneweal-fw66.patch @@ -0,0 +1,105 @@ +From 0af1c98f1bd69aa366d7a67a1751f7456f2f071a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 19 Jun 2021 17:39:22 +0900 +Subject: ALSA: bebob: add support for ToneWeal FW66 + +From: Takashi Sakamoto + +[ Upstream commit 50ebe56222bfa0911a932930f9229ee5995508d9 ] + +A user of FFADO project reported the issue of ToneWeal FW66. As a result, +the device is identified as one of applications of BeBoB solution. + +I note that in the report the device returns contradictory result in plug +discovery process for audio subunit. Fortunately ALSA BeBoB driver doesn't +perform it thus it's likely to handle the device without issues. + +I receive no reaction to test request for this patch yet, however it would +be worth to add support for it. + +daniel@gibbonmoon:/sys/bus/firewire/devices/fw1$ grep -r . * +Binary file config_rom matches +dev:244:1 +guid:0x0023270002000000 +hardware_version:0x000002 +is_local:0 +model:0x020002 +model_name:FW66 +power/runtime_active_time:0 +power/runtime_active_kids:0 +power/runtime_usage:0 +power/runtime_status:unsupported +power/async:disabled +power/runtime_suspended_time:0 +power/runtime_enabled:disabled +power/control:auto +subsystem/drivers_autoprobe:1 +uevent:MAJOR=244 +uevent:MINOR=1 +uevent:DEVNAME=fw1 +units:0x00a02d:0x010001 +vendor:0x002327 +vendor_name:ToneWeal +fw1.0/uevent:MODALIAS=ieee1394:ven00002327mo00020002sp0000A02Dver00010001 +fw1.0/power/runtime_active_time:0 +fw1.0/power/runtime_active_kids:0 +fw1.0/power/runtime_usage:0 +fw1.0/power/runtime_status:unsupported +fw1.0/power/async:disabled +fw1.0/power/runtime_suspended_time:0 +fw1.0/power/runtime_enabled:disabled +fw1.0/power/control:auto +fw1.0/model:0x020002 +fw1.0/rom_index:15 +fw1.0/specifier_id:0x00a02d +fw1.0/model_name:FW66 +fw1.0/version:0x010001 +fw1.0/modalias:ieee1394:ven00002327mo00020002sp0000A02Dver00010001 + +Cc: Daniel Jozsef +Reference: https://lore.kernel.org/alsa-devel/20200119164335.GA11974@workstation/ +Signed-off-by: Takashi Sakamoto +Link: https://lore.kernel.org/r/20210619083922.16060-1-o-takashi@sakamocchi.jp +Signed-off-by: Takashi Iwai +Signed-off-by: Sasha Levin +--- + sound/firewire/Kconfig | 1 + + sound/firewire/bebob/bebob.c | 3 +++ + 2 files changed, 4 insertions(+) + +diff --git a/sound/firewire/Kconfig b/sound/firewire/Kconfig +index def1f3d5ecf5..12664c3a1414 100644 +--- a/sound/firewire/Kconfig ++++ b/sound/firewire/Kconfig +@@ -110,6 +110,7 @@ config SND_BEBOB + * M-Audio Ozonic/NRV10/ProfireLightBridge + * M-Audio FireWire 1814/ProjectMix IO + * Digidesign Mbox 2 Pro ++ * ToneWeal FW66 + + To compile this driver as a module, choose M here: the module + will be called snd-bebob. +diff --git a/sound/firewire/bebob/bebob.c b/sound/firewire/bebob/bebob.c +index 90e98a6d1546..67fa0f2178b0 100644 +--- a/sound/firewire/bebob/bebob.c ++++ b/sound/firewire/bebob/bebob.c +@@ -59,6 +59,7 @@ static DECLARE_BITMAP(devices_used, SNDRV_CARDS); + #define VEN_MAUDIO1 0x00000d6c + #define VEN_MAUDIO2 0x000007f5 + #define VEN_DIGIDESIGN 0x00a07e ++#define OUI_SHOUYO 0x002327 + + #define MODEL_FOCUSRITE_SAFFIRE_BOTH 0x00000000 + #define MODEL_MAUDIO_AUDIOPHILE_BOTH 0x00010060 +@@ -486,6 +487,8 @@ static const struct ieee1394_device_id bebob_id_table[] = { + &maudio_special_spec), + /* Digidesign Mbox 2 Pro */ + SND_BEBOB_DEV_ENTRY(VEN_DIGIDESIGN, 0x0000a9, &spec_normal), ++ // Toneweal FW66. ++ SND_BEBOB_DEV_ENTRY(OUI_SHOUYO, 0x020002, &spec_normal), + /* IDs are unknown but able to be supported */ + /* Apogee, Mini-ME Firewire */ + /* Apogee, Mini-DAC Firewire */ +-- +2.30.2 + diff --git a/queue-5.13/alsa-control_led-fix-initialization-in-the-mode-show.patch b/queue-5.13/alsa-control_led-fix-initialization-in-the-mode-show.patch new file mode 100644 index 00000000000..0c624095ad7 --- /dev/null +++ b/queue-5.13/alsa-control_led-fix-initialization-in-the-mode-show.patch @@ -0,0 +1,37 @@ +From a6cb387a98be6dc35d3e4d01b394dec14fd2d77c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 14 Jun 2021 09:17:10 +0200 +Subject: ALSA: control_led - fix initialization in the mode show callback + +From: Jaroslav Kysela + +[ Upstream commit e381a14c3e3a4e90e293d4eaa5a3ab8ae98b9973 ] + +The str variable should be always initialized before use even if +the switch covers all cases. This is a minimalistic fix: Assign NULL, +the sprintf() may print '(null)' if something is corrupted. + +Signed-off-by: Jaroslav Kysela +Link: https://lore.kernel.org/r/20210614071710.1786866-1-perex@perex.cz +Signed-off-by: Takashi Iwai +Signed-off-by: Sasha Levin +--- + sound/core/control_led.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sound/core/control_led.c b/sound/core/control_led.c +index a90e31dbde61..ff7fd5e29551 100644 +--- a/sound/core/control_led.c ++++ b/sound/core/control_led.c +@@ -397,7 +397,7 @@ static ssize_t show_mode(struct device *dev, + struct device_attribute *attr, char *buf) + { + struct snd_ctl_led *led = container_of(dev, struct snd_ctl_led, dev); +- const char *str; ++ const char *str = NULL; + + switch (led->mode) { + case MODE_FOLLOW_MUTE: str = "follow-mute"; break; +-- +2.30.2 + diff --git a/queue-5.13/alsa-firewire-motu-fix-detection-for-s-pdif-source-o.patch b/queue-5.13/alsa-firewire-motu-fix-detection-for-s-pdif-source-o.patch new file mode 100644 index 00000000000..b90794e4119 --- /dev/null +++ b/queue-5.13/alsa-firewire-motu-fix-detection-for-s-pdif-source-o.patch @@ -0,0 +1,65 @@ +From 6cbe4e224ad8c6f2b57624be9d2ccfd366cf42ad Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 23 Jun 2021 16:59:33 +0900 +Subject: ALSA: firewire-motu: fix detection for S/PDIF source on optical + interface in v2 protocol + +From: Takashi Sakamoto + +[ Upstream commit fa4db23233eb912234bdfb0b26a38be079c6b5ea ] + +The devices in protocol version 2 has a register with flag for IEC 60958 +signal detection as source of sampling clock without discrimination +between coaxial and optical interfaces. On the other hand, current +implementation of driver manage to interpret type of signal on optical +interface instead. + +This commit fixes the detection of optical/coaxial interface for S/PDIF +signal. + +Signed-off-by: Takashi Sakamoto +Link: https://lore.kernel.org/r/20210623075941.72562-2-o-takashi@sakamocchi.jp +Signed-off-by: Takashi Iwai +Signed-off-by: Sasha Levin +--- + sound/firewire/motu/motu-protocol-v2.c | 13 ++++++------- + 1 file changed, 6 insertions(+), 7 deletions(-) + +diff --git a/sound/firewire/motu/motu-protocol-v2.c b/sound/firewire/motu/motu-protocol-v2.c +index 784073aa1026..f0a0ecad4d74 100644 +--- a/sound/firewire/motu/motu-protocol-v2.c ++++ b/sound/firewire/motu/motu-protocol-v2.c +@@ -86,24 +86,23 @@ static int detect_clock_source_optical_model(struct snd_motu *motu, u32 data, + *src = SND_MOTU_CLOCK_SOURCE_INTERNAL; + break; + case 1: ++ *src = SND_MOTU_CLOCK_SOURCE_ADAT_ON_OPT; ++ break; ++ case 2: + { + __be32 reg; + + // To check the configuration of optical interface. +- int err = snd_motu_transaction_read(motu, V2_IN_OUT_CONF_OFFSET, +- ®, sizeof(reg)); ++ int err = snd_motu_transaction_read(motu, V2_IN_OUT_CONF_OFFSET, ®, sizeof(reg)); + if (err < 0) + return err; + +- if (be32_to_cpu(reg) & 0x00000200) ++ if (((data & V2_OPT_IN_IFACE_MASK) >> V2_OPT_IN_IFACE_SHIFT) == V2_OPT_IFACE_MODE_SPDIF) + *src = SND_MOTU_CLOCK_SOURCE_SPDIF_ON_OPT; + else +- *src = SND_MOTU_CLOCK_SOURCE_ADAT_ON_OPT; ++ *src = SND_MOTU_CLOCK_SOURCE_SPDIF_ON_COAX; + break; + } +- case 2: +- *src = SND_MOTU_CLOCK_SOURCE_SPDIF_ON_COAX; +- break; + case 3: + *src = SND_MOTU_CLOCK_SOURCE_SPH; + break; +-- +2.30.2 + diff --git a/queue-5.13/alsa-hda-add-irq-check-for-platform_get_irq.patch b/queue-5.13/alsa-hda-add-irq-check-for-platform_get_irq.patch new file mode 100644 index 00000000000..069c7deb9ca --- /dev/null +++ b/queue-5.13/alsa-hda-add-irq-check-for-platform_get_irq.patch @@ -0,0 +1,45 @@ +From 226fd28ee7dfd093d1bca4e0ebe188e52717b014 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 22 Jun 2021 21:19:42 +0800 +Subject: ALSA: hda: Add IRQ check for platform_get_irq() + +From: Jiajun Cao + +[ Upstream commit 8c13212443230d03ff25014514ec0d53498c0912 ] + +The function hda_tegra_first_init() neglects to check the return +value after executing platform_get_irq(). + +hda_tegra_first_init() should check the return value (if negative +error number) for errors so as to not pass a negative value to +the devm_request_irq(). + +Fix it by adding a check for the return value irq_id. + +Signed-off-by: Jiajun Cao +Signed-off-by: Xin Tan +Reviewed-by: Thierry Reding +Link: https://lore.kernel.org/r/20210622131947.94346-1-jjcao20@fudan.edu.cn +Signed-off-by: Takashi Iwai +Signed-off-by: Sasha Levin +--- + sound/pci/hda/hda_tegra.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/sound/pci/hda/hda_tegra.c b/sound/pci/hda/hda_tegra.c +index 6f2b743b9d75..6c6dc3fcde60 100644 +--- a/sound/pci/hda/hda_tegra.c ++++ b/sound/pci/hda/hda_tegra.c +@@ -262,6 +262,9 @@ static int hda_tegra_first_init(struct azx *chip, struct platform_device *pdev) + const char *sname, *drv_name = "tegra-hda"; + struct device_node *np = pdev->dev.of_node; + ++ if (irq_id < 0) ++ return irq_id; ++ + err = hda_tegra_init_chip(chip, pdev); + if (err) + return err; +-- +2.30.2 + diff --git a/queue-5.13/alsa-isa-fix-error-return-code-in-snd_cmi8330_probe.patch b/queue-5.13/alsa-isa-fix-error-return-code-in-snd_cmi8330_probe.patch new file mode 100644 index 00000000000..cf762499b35 --- /dev/null +++ b/queue-5.13/alsa-isa-fix-error-return-code-in-snd_cmi8330_probe.patch @@ -0,0 +1,39 @@ +From e37e4bc236b339a5534798c0a385c4dc3be3ddd2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 7 Jul 2021 15:40:51 +0800 +Subject: ALSA: isa: Fix error return code in snd_cmi8330_probe() + +From: Zhen Lei + +[ Upstream commit 31028cbed26a8afa25533a10425ffa2ab794c76c ] + +When 'SB_HW_16' check fails, the error code -ENODEV instead of 0 should be +returned, which is the same as that returned when 'WSS_HW_CMI8330' check +fails. + +Fixes: 43bcd973d6d0 ("[ALSA] Add snd_card_set_generic_dev() call to ISA drivers") +Reported-by: Hulk Robot +Signed-off-by: Zhen Lei +Link: https://lore.kernel.org/r/20210707074051.2663-1-thunder.leizhen@huawei.com +Signed-off-by: Takashi Iwai +Signed-off-by: Sasha Levin +--- + sound/isa/cmi8330.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c +index bc112df10fc5..d1ac9fc99491 100644 +--- a/sound/isa/cmi8330.c ++++ b/sound/isa/cmi8330.c +@@ -547,7 +547,7 @@ static int snd_cmi8330_probe(struct snd_card *card, int dev) + } + if (acard->sb->hardware != SB_HW_16) { + snd_printk(KERN_ERR PFX "SB16 not found during probe\n"); +- return err; ++ return -ENODEV; + } + + snd_wss_out(acard->wss, CS4231_MISC_INFO, 0x40); /* switch on MODE2 */ +-- +2.30.2 + diff --git a/queue-5.13/alsa-n64-check-return-value-after-calling-platform_g.patch b/queue-5.13/alsa-n64-check-return-value-after-calling-platform_g.patch new file mode 100644 index 00000000000..cd79008702e --- /dev/null +++ b/queue-5.13/alsa-n64-check-return-value-after-calling-platform_g.patch @@ -0,0 +1,38 @@ +From c0ae31039d997fdc5b645a6827d5f4bc98c35a15 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 10 Jun 2021 20:49:58 +0800 +Subject: ALSA: n64: check return value after calling platform_get_resource() + +From: Yang Yingliang + +[ Upstream commit be471fe332f7f14aa6828010b220d7e6902b91a0 ] + +It will cause null-ptr-deref if platform_get_resource() returns NULL, +we need check the return value. + +Signed-off-by: Yang Yingliang +Link: https://lore.kernel.org/r/20210610124958.116142-1-yangyingliang@huawei.com +Signed-off-by: Takashi Iwai +Signed-off-by: Sasha Levin +--- + sound/mips/snd-n64.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/sound/mips/snd-n64.c b/sound/mips/snd-n64.c +index e35e93157755..463a6fe589eb 100644 +--- a/sound/mips/snd-n64.c ++++ b/sound/mips/snd-n64.c +@@ -338,6 +338,10 @@ static int __init n64audio_probe(struct platform_device *pdev) + strcpy(card->longname, "N64 Audio"); + + res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); ++ if (!res) { ++ err = -EINVAL; ++ goto fail_dma_alloc; ++ } + if (devm_request_irq(&pdev->dev, res->start, n64audio_isr, + IRQF_SHARED, "N64 Audio", priv)) { + err = -EBUSY; +-- +2.30.2 + diff --git a/queue-5.13/alsa-ppc-fix-error-return-code-in-snd_pmac_probe.patch b/queue-5.13/alsa-ppc-fix-error-return-code-in-snd_pmac_probe.patch new file mode 100644 index 00000000000..33c17dcd3f3 --- /dev/null +++ b/queue-5.13/alsa-ppc-fix-error-return-code-in-snd_pmac_probe.patch @@ -0,0 +1,41 @@ +From 6a433213953fbb2cc5d132554934f461a73954a3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 16 Jun 2021 10:11:21 +0800 +Subject: ALSA: ppc: fix error return code in snd_pmac_probe() + +From: Yang Yingliang + +[ Upstream commit 80b9c1be567c3c6bbe0d4b290af578e630485b5d ] + +If snd_pmac_tumbler_init() or snd_pmac_tumbler_post_init() fails, +snd_pmac_probe() need return error code. + +Reported-by: Hulk Robot +Signed-off-by: Yang Yingliang +Link: https://lore.kernel.org/r/20210616021121.1991502-1-yangyingliang@huawei.com +Signed-off-by: Takashi Iwai +Signed-off-by: Sasha Levin +--- + sound/ppc/powermac.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/sound/ppc/powermac.c b/sound/ppc/powermac.c +index 9fb51ebafde1..8088f77d5a74 100644 +--- a/sound/ppc/powermac.c ++++ b/sound/ppc/powermac.c +@@ -76,7 +76,11 @@ static int snd_pmac_probe(struct platform_device *devptr) + sprintf(card->shortname, "PowerMac %s", name_ext); + sprintf(card->longname, "%s (Dev %d) Sub-frame %d", + card->shortname, chip->device_id, chip->subframe); +- if ( snd_pmac_tumbler_init(chip) < 0 || snd_pmac_tumbler_post_init() < 0) ++ err = snd_pmac_tumbler_init(chip); ++ if (err < 0) ++ goto __error; ++ err = snd_pmac_tumbler_post_init(); ++ if (err < 0) + goto __error; + break; + case PMAC_AWACS: +-- +2.30.2 + diff --git a/queue-5.13/alsa-sb-fix-potential-double-free-of-csp-mixer-eleme.patch b/queue-5.13/alsa-sb-fix-potential-double-free-of-csp-mixer-eleme.patch new file mode 100644 index 00000000000..304e3871baf --- /dev/null +++ b/queue-5.13/alsa-sb-fix-potential-double-free-of-csp-mixer-eleme.patch @@ -0,0 +1,47 @@ +From 8442be789a958e2ff9302af8561645deb4975bc1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 8 Jun 2021 16:04:37 +0200 +Subject: ALSA: sb: Fix potential double-free of CSP mixer elements + +From: Takashi Iwai + +[ Upstream commit c305366a37441c2ac90b08711cb6f032b43672f2 ] + +snd_sb_qsound_destroy() contains the calls of removing the previously +created mixer controls, but it doesn't clear the pointers. As +snd_sb_qsound_destroy() itself may be repeatedly called via ioctl, +this could lead to double-free potentially. + +Fix it by clearing the struct fields properly afterwards. + +Link: https://lore.kernel.org/r/20210608140540.17885-4-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Sasha Levin +--- + sound/isa/sb/sb16_csp.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/sound/isa/sb/sb16_csp.c b/sound/isa/sb/sb16_csp.c +index 4789345a8fdd..c98ccd421a2e 100644 +--- a/sound/isa/sb/sb16_csp.c ++++ b/sound/isa/sb/sb16_csp.c +@@ -1072,10 +1072,14 @@ static void snd_sb_qsound_destroy(struct snd_sb_csp * p) + card = p->chip->card; + + down_write(&card->controls_rwsem); +- if (p->qsound_switch) ++ if (p->qsound_switch) { + snd_ctl_remove(card, p->qsound_switch); +- if (p->qsound_space) ++ p->qsound_switch = NULL; ++ } ++ if (p->qsound_space) { + snd_ctl_remove(card, p->qsound_space); ++ p->qsound_space = NULL; ++ } + up_write(&card->controls_rwsem); + + /* cancel pending transfer of QSound parameters */ +-- +2.30.2 + diff --git a/queue-5.13/alsa-usb-audio-scarlett2-fix-18i8-gen-2-pcm-input-co.patch b/queue-5.13/alsa-usb-audio-scarlett2-fix-18i8-gen-2-pcm-input-co.patch new file mode 100644 index 00000000000..f7247c114d4 --- /dev/null +++ b/queue-5.13/alsa-usb-audio-scarlett2-fix-18i8-gen-2-pcm-input-co.patch @@ -0,0 +1,36 @@ +From 5713fc5e2e7e4eeb6e93c8b8aad1cf3e98348bdd Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 21 Jun 2021 02:16:25 +0930 +Subject: ALSA: usb-audio: scarlett2: Fix 18i8 Gen 2 PCM Input count + +From: Geoffrey D. Bennett + +[ Upstream commit c5210f213456383482b4a77c5310282a89a106b5 ] + +The 18i8 Gen 2 has 8 PCM Inputs, not 20. Fix the ports entry in +s18i8_gen2_info. + +Signed-off-by: Geoffrey D. Bennett +Link: https://lore.kernel.org/r/20210620164625.GA9165@m.b4.vu +Signed-off-by: Takashi Iwai +Signed-off-by: Sasha Levin +--- + sound/usb/mixer_scarlett_gen2.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sound/usb/mixer_scarlett_gen2.c b/sound/usb/mixer_scarlett_gen2.c +index bca3e7fe27df..1982e67a0f32 100644 +--- a/sound/usb/mixer_scarlett_gen2.c ++++ b/sound/usb/mixer_scarlett_gen2.c +@@ -356,7 +356,7 @@ static const struct scarlett2_device_info s18i8_gen2_info = { + }, + [SCARLETT2_PORT_TYPE_PCM] = { + .id = 0x600, +- .num = { 20, 18, 18, 14, 10 }, ++ .num = { 8, 18, 18, 14, 10 }, + .src_descr = "PCM %d", + .src_num_offset = 1, + .dst_descr = "PCM %02d Capture" +-- +2.30.2 + diff --git a/queue-5.13/alsa-usb-audio-scarlett2-fix-6i6-gen-2-line-out-desc.patch b/queue-5.13/alsa-usb-audio-scarlett2-fix-6i6-gen-2-line-out-desc.patch new file mode 100644 index 00000000000..b9a0267ae2f --- /dev/null +++ b/queue-5.13/alsa-usb-audio-scarlett2-fix-6i6-gen-2-line-out-desc.patch @@ -0,0 +1,42 @@ +From 55e55535d5b97b84514ecd8cc3bd3ce2cb4a5af2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 22 Jun 2021 03:39:18 +0930 +Subject: ALSA: usb-audio: scarlett2: Fix 6i6 Gen 2 line out descriptions + +From: Geoffrey D. Bennett + +[ Upstream commit c712c6c0ff2d60478582e337185bcdd520a7dc2e ] + +There are two headphone outputs, and they map to the four analogue +outputs. + +Signed-off-by: Geoffrey D. Bennett +Link: https://lore.kernel.org/r/205e5e5348f08ded0cc4da5446f604d4b91db5bf.1624294591.git.g@b4.vu +Signed-off-by: Takashi Iwai +Signed-off-by: Sasha Levin +--- + sound/usb/mixer_scarlett_gen2.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/sound/usb/mixer_scarlett_gen2.c b/sound/usb/mixer_scarlett_gen2.c +index b92319928ddd..38f4a2a37e0f 100644 +--- a/sound/usb/mixer_scarlett_gen2.c ++++ b/sound/usb/mixer_scarlett_gen2.c +@@ -254,10 +254,10 @@ static const struct scarlett2_device_info s6i6_gen2_info = { + .pad_input_count = 2, + + .line_out_descrs = { +- "Monitor L", +- "Monitor R", +- "Headphones L", +- "Headphones R", ++ "Headphones 1 L", ++ "Headphones 1 R", ++ "Headphones 2 L", ++ "Headphones 2 R", + }, + + .ports = { +-- +2.30.2 + diff --git a/queue-5.13/alsa-usb-audio-scarlett2-fix-data_mutex-lock.patch b/queue-5.13/alsa-usb-audio-scarlett2-fix-data_mutex-lock.patch new file mode 100644 index 00000000000..eaea61ab079 --- /dev/null +++ b/queue-5.13/alsa-usb-audio-scarlett2-fix-data_mutex-lock.patch @@ -0,0 +1,77 @@ +From d85e475b1a3ca97c82f5384da1e42533818577b8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 21 Jun 2021 02:16:43 +0930 +Subject: ALSA: usb-audio: scarlett2: Fix data_mutex lock + +From: Geoffrey D. Bennett + +[ Upstream commit 9b5ddea9ce5a68d7d2bedcb69901ac2a86c96c7b ] + +The private->vol_updated flag was being checked outside of the +mutex_lock/unlock() of private->data_mutex leading to the volume data +being fetched twice from the device unnecessarily or old volume data +being returned. + +Update scarlett2_*_ctl_get() and include the private->vol_updated flag +check inside the critical region. + +Signed-off-by: Geoffrey D. Bennett +Link: https://lore.kernel.org/r/20210620164643.GA9216@m.b4.vu +Signed-off-by: Takashi Iwai +Signed-off-by: Sasha Levin +--- + sound/usb/mixer_scarlett_gen2.c | 21 +++++++++------------ + 1 file changed, 9 insertions(+), 12 deletions(-) + +diff --git a/sound/usb/mixer_scarlett_gen2.c b/sound/usb/mixer_scarlett_gen2.c +index 1982e67a0f32..2ea41c8eafd1 100644 +--- a/sound/usb/mixer_scarlett_gen2.c ++++ b/sound/usb/mixer_scarlett_gen2.c +@@ -1033,11 +1033,10 @@ static int scarlett2_master_volume_ctl_get(struct snd_kcontrol *kctl, + struct usb_mixer_interface *mixer = elem->head.mixer; + struct scarlett2_mixer_data *private = mixer->private_data; + +- if (private->vol_updated) { +- mutex_lock(&private->data_mutex); ++ mutex_lock(&private->data_mutex); ++ if (private->vol_updated) + scarlett2_update_volumes(mixer); +- mutex_unlock(&private->data_mutex); +- } ++ mutex_unlock(&private->data_mutex); + + ucontrol->value.integer.value[0] = private->master_vol; + return 0; +@@ -1051,11 +1050,10 @@ static int scarlett2_volume_ctl_get(struct snd_kcontrol *kctl, + struct scarlett2_mixer_data *private = mixer->private_data; + int index = elem->control; + +- if (private->vol_updated) { +- mutex_lock(&private->data_mutex); ++ mutex_lock(&private->data_mutex); ++ if (private->vol_updated) + scarlett2_update_volumes(mixer); +- mutex_unlock(&private->data_mutex); +- } ++ mutex_unlock(&private->data_mutex); + + ucontrol->value.integer.value[0] = private->vol[index]; + return 0; +@@ -1319,11 +1317,10 @@ static int scarlett2_button_ctl_get(struct snd_kcontrol *kctl, + struct usb_mixer_interface *mixer = elem->head.mixer; + struct scarlett2_mixer_data *private = mixer->private_data; + +- if (private->vol_updated) { +- mutex_lock(&private->data_mutex); ++ mutex_lock(&private->data_mutex); ++ if (private->vol_updated) + scarlett2_update_volumes(mixer); +- mutex_unlock(&private->data_mutex); +- } ++ mutex_unlock(&private->data_mutex); + + ucontrol->value.enumerated.item[0] = private->buttons[elem->control]; + return 0; +-- +2.30.2 + diff --git a/queue-5.13/alsa-usb-audio-scarlett2-fix-scarlett2_-_ctl_put-ret.patch b/queue-5.13/alsa-usb-audio-scarlett2-fix-scarlett2_-_ctl_put-ret.patch new file mode 100644 index 00000000000..c4336bbf137 --- /dev/null +++ b/queue-5.13/alsa-usb-audio-scarlett2-fix-scarlett2_-_ctl_put-ret.patch @@ -0,0 +1,63 @@ +From cda8d8b96813a8b008a758b755edb1f766a56e39 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 21 Jun 2021 02:16:45 +0930 +Subject: ALSA: usb-audio: scarlett2: Fix scarlett2_*_ctl_put() return values + +From: Geoffrey D. Bennett + +[ Upstream commit c5d8e008032f3cd5f266d552732973a960b0bd4b ] + +Mixer control put callbacks should return 1 if the value is changed. +Fix the sw_hw, level, pad, and button controls accordingly. + +Signed-off-by: Geoffrey D. Bennett +Link: https://lore.kernel.org/r/20210620164645.GA9221@m.b4.vu +Signed-off-by: Takashi Iwai +Signed-off-by: Sasha Levin +--- + sound/usb/mixer_scarlett_gen2.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/sound/usb/mixer_scarlett_gen2.c b/sound/usb/mixer_scarlett_gen2.c +index 2ea41c8eafd1..b92319928ddd 100644 +--- a/sound/usb/mixer_scarlett_gen2.c ++++ b/sound/usb/mixer_scarlett_gen2.c +@@ -1184,6 +1184,8 @@ static int scarlett2_sw_hw_enum_ctl_put(struct snd_kcontrol *kctl, + /* Send SW/HW switch change to the device */ + err = scarlett2_usb_set_config(mixer, SCARLETT2_CONFIG_SW_HW_SWITCH, + index, val); ++ if (err == 0) ++ err = 1; + + unlock: + mutex_unlock(&private->data_mutex); +@@ -1244,6 +1246,8 @@ static int scarlett2_level_enum_ctl_put(struct snd_kcontrol *kctl, + /* Send switch change to the device */ + err = scarlett2_usb_set_config(mixer, SCARLETT2_CONFIG_LEVEL_SWITCH, + index, val); ++ if (err == 0) ++ err = 1; + + unlock: + mutex_unlock(&private->data_mutex); +@@ -1294,6 +1298,8 @@ static int scarlett2_pad_ctl_put(struct snd_kcontrol *kctl, + /* Send switch change to the device */ + err = scarlett2_usb_set_config(mixer, SCARLETT2_CONFIG_PAD_SWITCH, + index, val); ++ if (err == 0) ++ err = 1; + + unlock: + mutex_unlock(&private->data_mutex); +@@ -1349,6 +1355,8 @@ static int scarlett2_button_ctl_put(struct snd_kcontrol *kctl, + /* Send switch change to the device */ + err = scarlett2_usb_set_config(mixer, SCARLETT2_CONFIG_BUTTONS, + index, val); ++ if (err == 0) ++ err = 1; + + unlock: + mutex_unlock(&private->data_mutex); +-- +2.30.2 + diff --git a/queue-5.13/alsa-usx2y-avoid-camelcase.patch b/queue-5.13/alsa-usx2y-avoid-camelcase.patch new file mode 100644 index 00000000000..eff00452b85 --- /dev/null +++ b/queue-5.13/alsa-usx2y-avoid-camelcase.patch @@ -0,0 +1,2735 @@ +From f7fb84e989d808cb5b86f2e5300b8ea5384d46c0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 17 May 2021 15:15:35 +0200 +Subject: ALSA: usx2y: Avoid camelCase + +From: Takashi Iwai + +[ Upstream commit bae3ce4942980d5f7b2b9855f4a2db0c00f9dfbd ] + +For improving readability, convert camelCase fields, variables and +functions to the plain names with underscore. Also align the macros +to be capital letters. + +All done via sed, no functional changes. + +Note that you'll still see many coding style issues even after this +patch; the fixes will follow. + +Link: https://lore.kernel.org/r/20210517131545.27252-2-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Sasha Levin +--- + sound/usb/usx2y/usX2Yhwdep.c | 56 ++-- + sound/usb/usx2y/usX2Yhwdep.h | 2 +- + sound/usb/usx2y/usbus428ctldefs.h | 102 +++---- + sound/usb/usx2y/usbusx2y.c | 218 +++++++-------- + sound/usb/usx2y/usbusx2y.h | 58 ++-- + sound/usb/usx2y/usbusx2yaudio.c | 448 +++++++++++++++--------------- + sound/usb/usx2y/usx2yhwdeppcm.c | 410 +++++++++++++-------------- + sound/usb/usx2y/usx2yhwdeppcm.h | 4 +- + 8 files changed, 649 insertions(+), 649 deletions(-) + +diff --git a/sound/usb/usx2y/usX2Yhwdep.c b/sound/usb/usx2y/usX2Yhwdep.c +index 22412cd69e98..10868c3fb656 100644 +--- a/sound/usb/usx2y/usX2Yhwdep.c ++++ b/sound/usb/usx2y/usX2Yhwdep.c +@@ -29,7 +29,7 @@ static vm_fault_t snd_us428ctls_vm_fault(struct vm_fault *vmf) + vmf->pgoff); + + offset = vmf->pgoff << PAGE_SHIFT; +- vaddr = (char *)((struct usX2Ydev *)vmf->vma->vm_private_data)->us428ctls_sharedmem + offset; ++ vaddr = (char *)((struct usx2ydev *)vmf->vma->vm_private_data)->us428ctls_sharedmem + offset; + page = virt_to_page(vaddr); + get_page(page); + vmf->page = page; +@@ -47,7 +47,7 @@ static const struct vm_operations_struct us428ctls_vm_ops = { + static int snd_us428ctls_mmap(struct snd_hwdep * hw, struct file *filp, struct vm_area_struct *area) + { + unsigned long size = (unsigned long)(area->vm_end - area->vm_start); +- struct usX2Ydev *us428 = hw->private_data; ++ struct usx2ydev *us428 = hw->private_data; + + // FIXME this hwdep interface is used twice: fpga download and mmap for controlling Lights etc. Maybe better using 2 hwdep devs? + // so as long as the device isn't fully initialised yet we return -EBUSY here. +@@ -66,7 +66,7 @@ static int snd_us428ctls_mmap(struct snd_hwdep * hw, struct file *filp, struct v + if (!us428->us428ctls_sharedmem) + return -ENOMEM; + memset(us428->us428ctls_sharedmem, -1, sizeof(struct us428ctls_sharedmem)); +- us428->us428ctls_sharedmem->CtlSnapShotLast = -2; ++ us428->us428ctls_sharedmem->ctl_snapshot_last = -2; + } + area->vm_ops = &us428ctls_vm_ops; + area->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP; +@@ -77,21 +77,21 @@ static int snd_us428ctls_mmap(struct snd_hwdep * hw, struct file *filp, struct v + static __poll_t snd_us428ctls_poll(struct snd_hwdep *hw, struct file *file, poll_table *wait) + { + __poll_t mask = 0; +- struct usX2Ydev *us428 = hw->private_data; ++ struct usx2ydev *us428 = hw->private_data; + struct us428ctls_sharedmem *shm = us428->us428ctls_sharedmem; + if (us428->chip_status & USX2Y_STAT_CHIP_HUP) + return EPOLLHUP; + + poll_wait(file, &us428->us428ctls_wait_queue_head, wait); + +- if (shm != NULL && shm->CtlSnapShotLast != shm->CtlSnapShotRed) ++ if (shm != NULL && shm->ctl_snapshot_last != shm->ctl_snapshot_red) + mask |= EPOLLIN; + + return mask; + } + + +-static int snd_usX2Y_hwdep_dsp_status(struct snd_hwdep *hw, ++static int snd_usx2y_hwdep_dsp_status(struct snd_hwdep *hw, + struct snd_hwdep_dsp_status *info) + { + static const char * const type_ids[USX2Y_TYPE_NUMS] = { +@@ -99,7 +99,7 @@ static int snd_usX2Y_hwdep_dsp_status(struct snd_hwdep *hw, + [USX2Y_TYPE_224] = "us224", + [USX2Y_TYPE_428] = "us428", + }; +- struct usX2Ydev *us428 = hw->private_data; ++ struct usx2ydev *us428 = hw->private_data; + int id = -1; + + switch (le16_to_cpu(us428->dev->descriptor.idProduct)) { +@@ -124,7 +124,7 @@ static int snd_usX2Y_hwdep_dsp_status(struct snd_hwdep *hw, + } + + +-static int usX2Y_create_usbmidi(struct snd_card *card) ++static int usx2y_create_usbmidi(struct snd_card *card) + { + static const struct snd_usb_midi_endpoint_info quirk_data_1 = { + .out_ep = 0x06, +@@ -152,28 +152,28 @@ static int usX2Y_create_usbmidi(struct snd_card *card) + .type = QUIRK_MIDI_FIXED_ENDPOINT, + .data = &quirk_data_2 + }; +- struct usb_device *dev = usX2Y(card)->dev; ++ struct usb_device *dev = usx2y(card)->dev; + struct usb_interface *iface = usb_ifnum_to_if(dev, 0); + const struct snd_usb_audio_quirk *quirk = + le16_to_cpu(dev->descriptor.idProduct) == USB_ID_US428 ? + &quirk_2 : &quirk_1; + +- snd_printdd("usX2Y_create_usbmidi \n"); +- return snd_usbmidi_create(card, iface, &usX2Y(card)->midi_list, quirk); ++ snd_printdd("usx2y_create_usbmidi \n"); ++ return snd_usbmidi_create(card, iface, &usx2y(card)->midi_list, quirk); + } + +-static int usX2Y_create_alsa_devices(struct snd_card *card) ++static int usx2y_create_alsa_devices(struct snd_card *card) + { + int err; + + do { +- if ((err = usX2Y_create_usbmidi(card)) < 0) { +- snd_printk(KERN_ERR "usX2Y_create_alsa_devices: usX2Y_create_usbmidi error %i \n", err); ++ if ((err = usx2y_create_usbmidi(card)) < 0) { ++ snd_printk(KERN_ERR "usx2y_create_alsa_devices: usx2y_create_usbmidi error %i \n", err); + break; + } +- if ((err = usX2Y_audio_create(card)) < 0) ++ if ((err = usx2y_audio_create(card)) < 0) + break; +- if ((err = usX2Y_hwdep_pcm_new(card)) < 0) ++ if ((err = usx2y_hwdep_pcm_new(card)) < 0) + break; + if ((err = snd_card_register(card)) < 0) + break; +@@ -182,10 +182,10 @@ static int usX2Y_create_alsa_devices(struct snd_card *card) + return err; + } + +-static int snd_usX2Y_hwdep_dsp_load(struct snd_hwdep *hw, ++static int snd_usx2y_hwdep_dsp_load(struct snd_hwdep *hw, + struct snd_hwdep_dsp_image *dsp) + { +- struct usX2Ydev *priv = hw->private_data; ++ struct usx2ydev *priv = hw->private_data; + struct usb_device* dev = priv->dev; + int lret, err; + char *buf; +@@ -206,19 +206,19 @@ static int snd_usX2Y_hwdep_dsp_load(struct snd_hwdep *hw, + return err; + if (dsp->index == 1) { + msleep(250); // give the device some time +- err = usX2Y_AsyncSeq04_init(priv); ++ err = usx2y_async_seq04_init(priv); + if (err) { +- snd_printk(KERN_ERR "usX2Y_AsyncSeq04_init error \n"); ++ snd_printk(KERN_ERR "usx2y_async_seq04_init error \n"); + return err; + } +- err = usX2Y_In04_init(priv); ++ err = usx2y_in04_init(priv); + if (err) { +- snd_printk(KERN_ERR "usX2Y_In04_init error \n"); ++ snd_printk(KERN_ERR "usx2y_in04_init error \n"); + return err; + } +- err = usX2Y_create_alsa_devices(hw->card); ++ err = usx2y_create_alsa_devices(hw->card); + if (err) { +- snd_printk(KERN_ERR "usX2Y_create_alsa_devices error %i \n", err); ++ snd_printk(KERN_ERR "usx2y_create_alsa_devices error %i \n", err); + snd_card_free(hw->card); + return err; + } +@@ -229,7 +229,7 @@ static int snd_usX2Y_hwdep_dsp_load(struct snd_hwdep *hw, + } + + +-int usX2Y_hwdep_new(struct snd_card *card, struct usb_device* device) ++int usx2y_hwdep_new(struct snd_card *card, struct usb_device* device) + { + int err; + struct snd_hwdep *hw; +@@ -238,9 +238,9 @@ int usX2Y_hwdep_new(struct snd_card *card, struct usb_device* device) + return err; + + hw->iface = SNDRV_HWDEP_IFACE_USX2Y; +- hw->private_data = usX2Y(card); +- hw->ops.dsp_status = snd_usX2Y_hwdep_dsp_status; +- hw->ops.dsp_load = snd_usX2Y_hwdep_dsp_load; ++ hw->private_data = usx2y(card); ++ hw->ops.dsp_status = snd_usx2y_hwdep_dsp_status; ++ hw->ops.dsp_load = snd_usx2y_hwdep_dsp_load; + hw->ops.mmap = snd_us428ctls_mmap; + hw->ops.poll = snd_us428ctls_poll; + hw->exclusive = 1; +diff --git a/sound/usb/usx2y/usX2Yhwdep.h b/sound/usb/usx2y/usX2Yhwdep.h +index 457199b5ed03..34cef625712c 100644 +--- a/sound/usb/usx2y/usX2Yhwdep.h ++++ b/sound/usb/usx2y/usX2Yhwdep.h +@@ -2,6 +2,6 @@ + #ifndef USX2YHWDEP_H + #define USX2YHWDEP_H + +-int usX2Y_hwdep_new(struct snd_card *card, struct usb_device* device); ++int usx2y_hwdep_new(struct snd_card *card, struct usb_device* device); + + #endif +diff --git a/sound/usb/usx2y/usbus428ctldefs.h b/sound/usb/usx2y/usbus428ctldefs.h +index 5a7518ea3aeb..7366a940ffbb 100644 +--- a/sound/usb/usx2y/usbus428ctldefs.h ++++ b/sound/usb/usx2y/usbus428ctldefs.h +@@ -4,28 +4,28 @@ + * Copyright (c) 2003 by Karsten Wiese + */ + +-enum E_In84{ +- eFader0 = 0, +- eFader1, +- eFader2, +- eFader3, +- eFader4, +- eFader5, +- eFader6, +- eFader7, +- eFaderM, +- eTransport, +- eModifier = 10, +- eFilterSelect, +- eSelect, +- eMute, ++enum E_IN84 { ++ E_FADER_0 = 0, ++ E_FADER_1, ++ E_FADER_2, ++ E_FADER_3, ++ E_FADER_4, ++ E_FADER_5, ++ E_FADER_6, ++ E_FADER_7, ++ E_FADER_M, ++ E_TRANSPORT, ++ E_MODIFIER = 10, ++ E_FILTER_SELECT, ++ E_SELECT, ++ E_MUTE, + +- eSwitch = 15, +- eWheelGain, +- eWheelFreq, +- eWheelQ, +- eWheelPan, +- eWheel = 20 ++ E_SWITCH = 15, ++ E_WHEEL_GAIN, ++ E_WHEEL_FREQ, ++ E_WHEEL_Q, ++ E_WHEEL_PAN, ++ E_WHEEL = 20 + }; + + #define T_RECORD 1 +@@ -39,53 +39,53 @@ enum E_In84{ + + + struct us428_ctls { +- unsigned char Fader[9]; +- unsigned char Transport; +- unsigned char Modifier; +- unsigned char FilterSelect; +- unsigned char Select; +- unsigned char Mute; +- unsigned char UNKNOWN; +- unsigned char Switch; +- unsigned char Wheel[5]; ++ unsigned char fader[9]; ++ unsigned char transport; ++ unsigned char modifier; ++ unsigned char filters_elect; ++ unsigned char select; ++ unsigned char mute; ++ unsigned char unknown; ++ unsigned char wswitch; ++ unsigned char wheel[5]; + }; + +-struct us428_setByte { +- unsigned char Offset, +- Value; ++struct us428_set_byte { ++ unsigned char offset, ++ value; + }; + + enum { +- eLT_Volume = 0, +- eLT_Light ++ ELT_VOLUME = 0, ++ ELT_LIGHT + }; + +-struct usX2Y_volume { +- unsigned char Channel, +- LH, +- LL, +- RH, +- RL; ++struct usx2y_volume { ++ unsigned char channel, ++ lh, ++ ll, ++ rh, ++ rl; + }; + + struct us428_lights { +- struct us428_setByte Light[7]; ++ struct us428_set_byte light[7]; + }; + + struct us428_p4out { + char type; + union { +- struct usX2Y_volume vol; ++ struct usx2y_volume vol; + struct us428_lights lights; + } val; + }; + +-#define N_us428_ctl_BUFS 16 +-#define N_us428_p4out_BUFS 16 +-struct us428ctls_sharedmem{ +- struct us428_ctls CtlSnapShot[N_us428_ctl_BUFS]; +- int CtlSnapShotDiffersAt[N_us428_ctl_BUFS]; +- int CtlSnapShotLast, CtlSnapShotRed; +- struct us428_p4out p4out[N_us428_p4out_BUFS]; +- int p4outLast, p4outSent; ++#define N_US428_CTL_BUFS 16 ++#define N_US428_P4OUT_BUFS 16 ++struct us428ctls_sharedmem { ++ struct us428_ctls ctl_snapshot[N_US428_CTL_BUFS]; ++ int ctl_snapshot_differs_at[N_US428_CTL_BUFS]; ++ int ctl_snapshot_last, ctl_snapshot_red; ++ struct us428_p4out p4out[N_US428_P4OUT_BUFS]; ++ int p4out_last, p4out_sent; + }; +diff --git a/sound/usb/usx2y/usbusx2y.c b/sound/usb/usx2y/usbusx2y.c +index 3cd28d24f0a7..cdbb27a96e04 100644 +--- a/sound/usb/usx2y/usbusx2y.c ++++ b/sound/usb/usx2y/usbusx2y.c +@@ -17,7 +17,7 @@ + + 2004-10-26 Karsten Wiese + Version 0.8.6: +- wake_up() process waiting in usX2Y_urbs_start() on error. ++ wake_up() process waiting in usx2y_urbs_start() on error. + + 2004-10-21 Karsten Wiese + Version 0.8.5: +@@ -48,7 +48,7 @@ + 2004-06-12 Karsten Wiese + Version 0.6.3: + Made it thus the following rule is enforced: +- "All pcm substreams of one usX2Y have to operate at the same rate & format." ++ "All pcm substreams of one usx2y have to operate at the same rate & format." + + 2004-04-06 Karsten Wiese + Version 0.6.0: +@@ -150,161 +150,161 @@ module_param_array(enable, bool, NULL, 0444); + MODULE_PARM_DESC(enable, "Enable "NAME_ALLCAPS"."); + + +-static int snd_usX2Y_card_used[SNDRV_CARDS]; ++static int snd_usx2y_card_used[SNDRV_CARDS]; + +-static void usX2Y_usb_disconnect(struct usb_device* usb_device, void* ptr); +-static void snd_usX2Y_card_private_free(struct snd_card *card); ++static void usx2y_usb_disconnect(struct usb_device* usb_device, void* ptr); ++static void snd_usx2y_card_private_free(struct snd_card *card); + + /* + * pipe 4 is used for switching the lamps, setting samplerate, volumes .... + */ +-static void i_usX2Y_Out04Int(struct urb *urb) ++static void i_usx2y_out04_int(struct urb *urb) + { + #ifdef CONFIG_SND_DEBUG + if (urb->status) { + int i; +- struct usX2Ydev *usX2Y = urb->context; +- for (i = 0; i < 10 && usX2Y->AS04.urb[i] != urb; i++); +- snd_printdd("i_usX2Y_Out04Int() urb %i status=%i\n", i, urb->status); ++ struct usx2ydev *usx2y = urb->context; ++ for (i = 0; i < 10 && usx2y->as04.urb[i] != urb; i++); ++ snd_printdd("i_usx2y_out04_int() urb %i status=%i\n", i, urb->status); + } + #endif + } + +-static void i_usX2Y_In04Int(struct urb *urb) ++static void i_usx2y_in04_int(struct urb *urb) + { + int err = 0; +- struct usX2Ydev *usX2Y = urb->context; +- struct us428ctls_sharedmem *us428ctls = usX2Y->us428ctls_sharedmem; ++ struct usx2ydev *usx2y = urb->context; ++ struct us428ctls_sharedmem *us428ctls = usx2y->us428ctls_sharedmem; + +- usX2Y->In04IntCalls++; ++ usx2y->in04_int_calls++; + + if (urb->status) { + snd_printdd("Interrupt Pipe 4 came back with status=%i\n", urb->status); + return; + } + +- // printk("%i:0x%02X ", 8, (int)((unsigned char*)usX2Y->In04Buf)[8]); Master volume shows 0 here if fader is at max during boot ?!? ++ // printk("%i:0x%02X ", 8, (int)((unsigned char*)usx2y->in04_buf)[8]); Master volume shows 0 here if fader is at max during boot ?!? + if (us428ctls) { + int diff = -1; +- if (-2 == us428ctls->CtlSnapShotLast) { ++ if (-2 == us428ctls->ctl_snapshot_last) { + diff = 0; +- memcpy(usX2Y->In04Last, usX2Y->In04Buf, sizeof(usX2Y->In04Last)); +- us428ctls->CtlSnapShotLast = -1; ++ memcpy(usx2y->in04_last, usx2y->in04_buf, sizeof(usx2y->in04_last)); ++ us428ctls->ctl_snapshot_last = -1; + } else { + int i; + for (i = 0; i < 21; i++) { +- if (usX2Y->In04Last[i] != ((char*)usX2Y->In04Buf)[i]) { ++ if (usx2y->in04_last[i] != ((char*)usx2y->in04_buf)[i]) { + if (diff < 0) + diff = i; +- usX2Y->In04Last[i] = ((char*)usX2Y->In04Buf)[i]; ++ usx2y->in04_last[i] = ((char*)usx2y->in04_buf)[i]; + } + } + } + if (0 <= diff) { +- int n = us428ctls->CtlSnapShotLast + 1; +- if (n >= N_us428_ctl_BUFS || n < 0) ++ int n = us428ctls->ctl_snapshot_last + 1; ++ if (n >= N_US428_CTL_BUFS || n < 0) + n = 0; +- memcpy(us428ctls->CtlSnapShot + n, usX2Y->In04Buf, sizeof(us428ctls->CtlSnapShot[0])); +- us428ctls->CtlSnapShotDiffersAt[n] = diff; +- us428ctls->CtlSnapShotLast = n; +- wake_up(&usX2Y->us428ctls_wait_queue_head); ++ memcpy(us428ctls->ctl_snapshot + n, usx2y->in04_buf, sizeof(us428ctls->ctl_snapshot[0])); ++ us428ctls->ctl_snapshot_differs_at[n] = diff; ++ us428ctls->ctl_snapshot_last = n; ++ wake_up(&usx2y->us428ctls_wait_queue_head); + } + } + + +- if (usX2Y->US04) { +- if (0 == usX2Y->US04->submitted) ++ if (usx2y->us04) { ++ if (0 == usx2y->us04->submitted) + do { +- err = usb_submit_urb(usX2Y->US04->urb[usX2Y->US04->submitted++], GFP_ATOMIC); +- } while (!err && usX2Y->US04->submitted < usX2Y->US04->len); ++ err = usb_submit_urb(usx2y->us04->urb[usx2y->us04->submitted++], GFP_ATOMIC); ++ } while (!err && usx2y->us04->submitted < usx2y->us04->len); + } else +- if (us428ctls && us428ctls->p4outLast >= 0 && us428ctls->p4outLast < N_us428_p4out_BUFS) { +- if (us428ctls->p4outLast != us428ctls->p4outSent) { +- int j, send = us428ctls->p4outSent + 1; +- if (send >= N_us428_p4out_BUFS) ++ if (us428ctls && us428ctls->p4out_last >= 0 && us428ctls->p4out_last < N_US428_P4OUT_BUFS) { ++ if (us428ctls->p4out_last != us428ctls->p4out_sent) { ++ int j, send = us428ctls->p4out_sent + 1; ++ if (send >= N_US428_P4OUT_BUFS) + send = 0; +- for (j = 0; j < URBS_AsyncSeq && !err; ++j) +- if (0 == usX2Y->AS04.urb[j]->status) { ++ for (j = 0; j < URBS_ASYNC_SEQ && !err; ++j) ++ if (0 == usx2y->as04.urb[j]->status) { + struct us428_p4out *p4out = us428ctls->p4out + send; // FIXME if more than 1 p4out is new, 1 gets lost. +- usb_fill_bulk_urb(usX2Y->AS04.urb[j], usX2Y->dev, +- usb_sndbulkpipe(usX2Y->dev, 0x04), &p4out->val.vol, +- p4out->type == eLT_Light ? sizeof(struct us428_lights) : 5, +- i_usX2Y_Out04Int, usX2Y); +- err = usb_submit_urb(usX2Y->AS04.urb[j], GFP_ATOMIC); +- us428ctls->p4outSent = send; ++ usb_fill_bulk_urb(usx2y->as04.urb[j], usx2y->dev, ++ usb_sndbulkpipe(usx2y->dev, 0x04), &p4out->val.vol, ++ p4out->type == ELT_LIGHT ? sizeof(struct us428_lights) : 5, ++ i_usx2y_out04_int, usx2y); ++ err = usb_submit_urb(usx2y->as04.urb[j], GFP_ATOMIC); ++ us428ctls->p4out_sent = send; + break; + } + } + } + + if (err) +- snd_printk(KERN_ERR "In04Int() usb_submit_urb err=%i\n", err); ++ snd_printk(KERN_ERR "in04_int() usb_submit_urb err=%i\n", err); + +- urb->dev = usX2Y->dev; ++ urb->dev = usx2y->dev; + usb_submit_urb(urb, GFP_ATOMIC); + } + + /* + * Prepare some urbs + */ +-int usX2Y_AsyncSeq04_init(struct usX2Ydev *usX2Y) ++int usx2y_async_seq04_init(struct usx2ydev *usx2y) + { + int err = 0, + i; + +- usX2Y->AS04.buffer = kmalloc_array(URBS_AsyncSeq, +- URB_DataLen_AsyncSeq, GFP_KERNEL); +- if (NULL == usX2Y->AS04.buffer) { ++ usx2y->as04.buffer = kmalloc_array(URBS_ASYNC_SEQ, ++ URB_DATA_LEN_ASYNC_SEQ, GFP_KERNEL); ++ if (NULL == usx2y->as04.buffer) { + err = -ENOMEM; + } else +- for (i = 0; i < URBS_AsyncSeq; ++i) { +- if (NULL == (usX2Y->AS04.urb[i] = usb_alloc_urb(0, GFP_KERNEL))) { ++ for (i = 0; i < URBS_ASYNC_SEQ; ++i) { ++ if (NULL == (usx2y->as04.urb[i] = usb_alloc_urb(0, GFP_KERNEL))) { + err = -ENOMEM; + break; + } +- usb_fill_bulk_urb( usX2Y->AS04.urb[i], usX2Y->dev, +- usb_sndbulkpipe(usX2Y->dev, 0x04), +- usX2Y->AS04.buffer + URB_DataLen_AsyncSeq*i, 0, +- i_usX2Y_Out04Int, usX2Y ++ usb_fill_bulk_urb( usx2y->as04.urb[i], usx2y->dev, ++ usb_sndbulkpipe(usx2y->dev, 0x04), ++ usx2y->as04.buffer + URB_DATA_LEN_ASYNC_SEQ*i, 0, ++ i_usx2y_out04_int, usx2y + ); +- err = usb_urb_ep_type_check(usX2Y->AS04.urb[i]); ++ err = usb_urb_ep_type_check(usx2y->as04.urb[i]); + if (err < 0) + break; + } + return err; + } + +-int usX2Y_In04_init(struct usX2Ydev *usX2Y) ++int usx2y_in04_init(struct usx2ydev *usx2y) + { +- if (! (usX2Y->In04urb = usb_alloc_urb(0, GFP_KERNEL))) ++ if (! (usx2y->in04_urb = usb_alloc_urb(0, GFP_KERNEL))) + return -ENOMEM; + +- if (! (usX2Y->In04Buf = kmalloc(21, GFP_KERNEL))) ++ if (! (usx2y->in04_buf = kmalloc(21, GFP_KERNEL))) + return -ENOMEM; + +- init_waitqueue_head(&usX2Y->In04WaitQueue); +- usb_fill_int_urb(usX2Y->In04urb, usX2Y->dev, usb_rcvintpipe(usX2Y->dev, 0x4), +- usX2Y->In04Buf, 21, +- i_usX2Y_In04Int, usX2Y, ++ init_waitqueue_head(&usx2y->in04_wait_queue); ++ usb_fill_int_urb(usx2y->in04_urb, usx2y->dev, usb_rcvintpipe(usx2y->dev, 0x4), ++ usx2y->in04_buf, 21, ++ i_usx2y_in04_int, usx2y, + 10); +- if (usb_urb_ep_type_check(usX2Y->In04urb)) ++ if (usb_urb_ep_type_check(usx2y->in04_urb)) + return -EINVAL; +- return usb_submit_urb(usX2Y->In04urb, GFP_KERNEL); ++ return usb_submit_urb(usx2y->in04_urb, GFP_KERNEL); + } + +-static void usX2Y_unlinkSeq(struct snd_usX2Y_AsyncSeq *S) ++static void usx2y_unlinkseq(struct snd_usx2y_async_seq *s) + { + int i; +- for (i = 0; i < URBS_AsyncSeq; ++i) { +- usb_kill_urb(S->urb[i]); +- usb_free_urb(S->urb[i]); +- S->urb[i] = NULL; ++ for (i = 0; i < URBS_ASYNC_SEQ; ++i) { ++ usb_kill_urb(s->urb[i]); ++ usb_free_urb(s->urb[i]); ++ s->urb[i] = NULL; + } +- kfree(S->buffer); ++ kfree(s->buffer); + } + + +-static const struct usb_device_id snd_usX2Y_usb_id_table[] = { ++static const struct usb_device_id snd_usx2y_usb_id_table[] = { + { + .match_flags = USB_DEVICE_ID_MATCH_DEVICE, + .idVendor = 0x1604, +@@ -323,7 +323,7 @@ static const struct usb_device_id snd_usX2Y_usb_id_table[] = { + { /* terminator */ } + }; + +-static int usX2Y_create_card(struct usb_device *device, ++static int usx2y_create_card(struct usb_device *device, + struct usb_interface *intf, + struct snd_card **cardp) + { +@@ -332,20 +332,20 @@ static int usX2Y_create_card(struct usb_device *device, + int err; + + for (dev = 0; dev < SNDRV_CARDS; ++dev) +- if (enable[dev] && !snd_usX2Y_card_used[dev]) ++ if (enable[dev] && !snd_usx2y_card_used[dev]) + break; + if (dev >= SNDRV_CARDS) + return -ENODEV; + err = snd_card_new(&intf->dev, index[dev], id[dev], THIS_MODULE, +- sizeof(struct usX2Ydev), &card); ++ sizeof(struct usx2ydev), &card); + if (err < 0) + return err; +- snd_usX2Y_card_used[usX2Y(card)->card_index = dev] = 1; +- card->private_free = snd_usX2Y_card_private_free; +- usX2Y(card)->dev = device; +- init_waitqueue_head(&usX2Y(card)->prepare_wait_queue); +- mutex_init(&usX2Y(card)->pcm_mutex); +- INIT_LIST_HEAD(&usX2Y(card)->midi_list); ++ snd_usx2y_card_used[usx2y(card)->card_index = dev] = 1; ++ card->private_free = snd_usx2y_card_private_free; ++ usx2y(card)->dev = device; ++ init_waitqueue_head(&usx2y(card)->prepare_wait_queue); ++ mutex_init(&usx2y(card)->pcm_mutex); ++ INIT_LIST_HEAD(&usx2y(card)->midi_list); + strcpy(card->driver, "USB "NAME_ALLCAPS""); + sprintf(card->shortname, "TASCAM "NAME_ALLCAPS""); + sprintf(card->longname, "%s (%x:%x if %d at %03d/%03d)", +@@ -353,14 +353,14 @@ static int usX2Y_create_card(struct usb_device *device, + le16_to_cpu(device->descriptor.idVendor), + le16_to_cpu(device->descriptor.idProduct), + 0,//us428(card)->usbmidi.ifnum, +- usX2Y(card)->dev->bus->busnum, usX2Y(card)->dev->devnum ++ usx2y(card)->dev->bus->busnum, usx2y(card)->dev->devnum + ); + *cardp = card; + return 0; + } + + +-static int usX2Y_usb_probe(struct usb_device *device, ++static int usx2y_usb_probe(struct usb_device *device, + struct usb_interface *intf, + const struct usb_device_id *device_id, + struct snd_card **cardp) +@@ -375,10 +375,10 @@ static int usX2Y_usb_probe(struct usb_device *device, + le16_to_cpu(device->descriptor.idProduct) != USB_ID_US428)) + return -EINVAL; + +- err = usX2Y_create_card(device, intf, &card); ++ err = usx2y_create_card(device, intf, &card); + if (err < 0) + return err; +- if ((err = usX2Y_hwdep_new(card, device)) < 0 || ++ if ((err = usx2y_hwdep_new(card, device)) < 0 || + (err = snd_card_register(card)) < 0) { + snd_card_free(card); + return err; +@@ -390,64 +390,64 @@ static int usX2Y_usb_probe(struct usb_device *device, + /* + * new 2.5 USB kernel API + */ +-static int snd_usX2Y_probe(struct usb_interface *intf, const struct usb_device_id *id) ++static int snd_usx2y_probe(struct usb_interface *intf, const struct usb_device_id *id) + { + struct snd_card *card; + int err; + +- err = usX2Y_usb_probe(interface_to_usbdev(intf), intf, id, &card); ++ err = usx2y_usb_probe(interface_to_usbdev(intf), intf, id, &card); + if (err < 0) + return err; + dev_set_drvdata(&intf->dev, card); + return 0; + } + +-static void snd_usX2Y_disconnect(struct usb_interface *intf) ++static void snd_usx2y_disconnect(struct usb_interface *intf) + { +- usX2Y_usb_disconnect(interface_to_usbdev(intf), ++ usx2y_usb_disconnect(interface_to_usbdev(intf), + usb_get_intfdata(intf)); + } + +-MODULE_DEVICE_TABLE(usb, snd_usX2Y_usb_id_table); +-static struct usb_driver snd_usX2Y_usb_driver = { ++MODULE_DEVICE_TABLE(usb, snd_usx2y_usb_id_table); ++static struct usb_driver snd_usx2y_usb_driver = { + .name = "snd-usb-usx2y", +- .probe = snd_usX2Y_probe, +- .disconnect = snd_usX2Y_disconnect, +- .id_table = snd_usX2Y_usb_id_table, ++ .probe = snd_usx2y_probe, ++ .disconnect = snd_usx2y_disconnect, ++ .id_table = snd_usx2y_usb_id_table, + }; + +-static void snd_usX2Y_card_private_free(struct snd_card *card) ++static void snd_usx2y_card_private_free(struct snd_card *card) + { +- kfree(usX2Y(card)->In04Buf); +- usb_free_urb(usX2Y(card)->In04urb); +- if (usX2Y(card)->us428ctls_sharedmem) +- free_pages_exact(usX2Y(card)->us428ctls_sharedmem, +- sizeof(*usX2Y(card)->us428ctls_sharedmem)); +- if (usX2Y(card)->card_index >= 0 && usX2Y(card)->card_index < SNDRV_CARDS) +- snd_usX2Y_card_used[usX2Y(card)->card_index] = 0; ++ kfree(usx2y(card)->in04_buf); ++ usb_free_urb(usx2y(card)->in04_urb); ++ if (usx2y(card)->us428ctls_sharedmem) ++ free_pages_exact(usx2y(card)->us428ctls_sharedmem, ++ sizeof(*usx2y(card)->us428ctls_sharedmem)); ++ if (usx2y(card)->card_index >= 0 && usx2y(card)->card_index < SNDRV_CARDS) ++ snd_usx2y_card_used[usx2y(card)->card_index] = 0; + } + + /* + * Frees the device. + */ +-static void usX2Y_usb_disconnect(struct usb_device *device, void* ptr) ++static void usx2y_usb_disconnect(struct usb_device *device, void* ptr) + { + if (ptr) { + struct snd_card *card = ptr; +- struct usX2Ydev *usX2Y = usX2Y(card); ++ struct usx2ydev *usx2y = usx2y(card); + struct list_head *p; +- usX2Y->chip_status = USX2Y_STAT_CHIP_HUP; +- usX2Y_unlinkSeq(&usX2Y->AS04); +- usb_kill_urb(usX2Y->In04urb); ++ usx2y->chip_status = USX2Y_STAT_CHIP_HUP; ++ usx2y_unlinkseq(&usx2y->as04); ++ usb_kill_urb(usx2y->in04_urb); + snd_card_disconnect(card); + /* release the midi resources */ +- list_for_each(p, &usX2Y->midi_list) { ++ list_for_each(p, &usx2y->midi_list) { + snd_usbmidi_disconnect(p); + } +- if (usX2Y->us428ctls_sharedmem) +- wake_up(&usX2Y->us428ctls_wait_queue_head); ++ if (usx2y->us428ctls_sharedmem) ++ wake_up(&usx2y->us428ctls_wait_queue_head); + snd_card_free(card); + } + } + +-module_usb_driver(snd_usX2Y_usb_driver); ++module_usb_driver(snd_usx2y_usb_driver); +diff --git a/sound/usb/usx2y/usbusx2y.h b/sound/usb/usx2y/usbusx2y.h +index 144b85f57bd2..c330af628bcc 100644 +--- a/sound/usb/usx2y/usbusx2y.h ++++ b/sound/usb/usx2y/usbusx2y.h +@@ -8,14 +8,14 @@ + #define NRURBS 2 + + +-#define URBS_AsyncSeq 10 +-#define URB_DataLen_AsyncSeq 32 +-struct snd_usX2Y_AsyncSeq { +- struct urb *urb[URBS_AsyncSeq]; ++#define URBS_ASYNC_SEQ 10 ++#define URB_DATA_LEN_ASYNC_SEQ 32 ++struct snd_usx2y_async_seq { ++ struct urb *urb[URBS_ASYNC_SEQ]; + char *buffer; + }; + +-struct snd_usX2Y_urbSeq { ++struct snd_usx2y_urb_seq { + int submitted; + int len; + struct urb *urb[]; +@@ -23,17 +23,17 @@ struct snd_usX2Y_urbSeq { + + #include "usx2yhwdeppcm.h" + +-struct usX2Ydev { ++struct usx2ydev { + struct usb_device *dev; + int card_index; + int stride; +- struct urb *In04urb; +- void *In04Buf; +- char In04Last[24]; +- unsigned In04IntCalls; +- struct snd_usX2Y_urbSeq *US04; +- wait_queue_head_t In04WaitQueue; +- struct snd_usX2Y_AsyncSeq AS04; ++ struct urb *in04_urb; ++ void *in04_buf; ++ char in04_last[24]; ++ unsigned in04_int_calls; ++ struct snd_usx2y_urb_seq *us04; ++ wait_queue_head_t in04_wait_queue; ++ struct snd_usx2y_async_seq as04; + unsigned int rate, + format; + int chip_status; +@@ -41,9 +41,9 @@ struct usX2Ydev { + struct us428ctls_sharedmem *us428ctls_sharedmem; + int wait_iso_frame; + wait_queue_head_t us428ctls_wait_queue_head; +- struct snd_usX2Y_hwdep_pcm_shm *hwdep_pcm_shm; +- struct snd_usX2Y_substream *subs[4]; +- struct snd_usX2Y_substream * volatile prepare_subs; ++ struct snd_usx2y_hwdep_pcm_shm *hwdep_pcm_shm; ++ struct snd_usx2y_substream *subs[4]; ++ struct snd_usx2y_substream * volatile prepare_subs; + wait_queue_head_t prepare_wait_queue; + struct list_head midi_list; + struct list_head pcm_list; +@@ -51,21 +51,21 @@ struct usX2Ydev { + }; + + +-struct snd_usX2Y_substream { +- struct usX2Ydev *usX2Y; ++struct snd_usx2y_substream { ++ struct usx2ydev *usx2y; + struct snd_pcm_substream *pcm_substream; + + int endpoint; + unsigned int maxpacksize; /* max packet size in bytes */ + + atomic_t state; +-#define state_STOPPED 0 +-#define state_STARTING1 1 +-#define state_STARTING2 2 +-#define state_STARTING3 3 +-#define state_PREPARED 4 +-#define state_PRERUNNING 6 +-#define state_RUNNING 8 ++#define STATE_STOPPED 0 ++#define STATE_STARTING1 1 ++#define STATE_STARTING2 2 ++#define STATE_STARTING3 3 ++#define STATE_PREPARED 4 ++#define STATE_PRERUNNING 6 ++#define STATE_RUNNING 8 + + int hwptr; /* free frame position in the buffer (only for playback) */ + int hwptr_done; /* processed frame position in the buffer */ +@@ -77,12 +77,12 @@ struct snd_usX2Y_substream { + }; + + +-#define usX2Y(c) ((struct usX2Ydev *)(c)->private_data) ++#define usx2y(c) ((struct usx2ydev *)(c)->private_data) + +-int usX2Y_audio_create(struct snd_card *card); ++int usx2y_audio_create(struct snd_card *card); + +-int usX2Y_AsyncSeq04_init(struct usX2Ydev *usX2Y); +-int usX2Y_In04_init(struct usX2Ydev *usX2Y); ++int usx2y_async_seq04_init(struct usx2ydev *usx2y); ++int usx2y_in04_init(struct usx2ydev *usx2y); + + #define NAME_ALLCAPS "US-X2Y" + +diff --git a/sound/usb/usx2y/usbusx2yaudio.c b/sound/usb/usx2y/usbusx2yaudio.c +index ecaf41265dcd..8033bb7255d5 100644 +--- a/sound/usb/usx2y/usbusx2yaudio.c ++++ b/sound/usb/usx2y/usbusx2yaudio.c +@@ -54,13 +54,13 @@ + #endif + + +-static int usX2Y_urb_capt_retire(struct snd_usX2Y_substream *subs) ++static int usx2y_urb_capt_retire(struct snd_usx2y_substream *subs) + { + struct urb *urb = subs->completed_urb; + struct snd_pcm_runtime *runtime = subs->pcm_substream->runtime; + unsigned char *cp; + int i, len, lens = 0, hwptr_done = subs->hwptr_done; +- struct usX2Ydev *usX2Y = subs->usX2Y; ++ struct usx2ydev *usx2y = subs->usx2y; + + for (i = 0; i < nr_of_packs(); i++) { + cp = (unsigned char*)urb->transfer_buffer + urb->iso_frame_desc[i].offset; +@@ -70,7 +70,7 @@ static int usX2Y_urb_capt_retire(struct snd_usX2Y_substream *subs) + urb->iso_frame_desc[i].status); + return urb->iso_frame_desc[i].status; + } +- len = urb->iso_frame_desc[i].actual_length / usX2Y->stride; ++ len = urb->iso_frame_desc[i].actual_length / usx2y->stride; + if (! len) { + snd_printd("0 == len ERROR!\n"); + continue; +@@ -79,12 +79,12 @@ static int usX2Y_urb_capt_retire(struct snd_usX2Y_substream *subs) + /* copy a data chunk */ + if ((hwptr_done + len) > runtime->buffer_size) { + int cnt = runtime->buffer_size - hwptr_done; +- int blen = cnt * usX2Y->stride; +- memcpy(runtime->dma_area + hwptr_done * usX2Y->stride, cp, blen); +- memcpy(runtime->dma_area, cp + blen, len * usX2Y->stride - blen); ++ int blen = cnt * usx2y->stride; ++ memcpy(runtime->dma_area + hwptr_done * usx2y->stride, cp, blen); ++ memcpy(runtime->dma_area, cp + blen, len * usx2y->stride - blen); + } else { +- memcpy(runtime->dma_area + hwptr_done * usX2Y->stride, cp, +- len * usX2Y->stride); ++ memcpy(runtime->dma_area + hwptr_done * usx2y->stride, cp, ++ len * usx2y->stride); + } + lens += len; + if ((hwptr_done += len) >= runtime->buffer_size) +@@ -110,18 +110,18 @@ static int usX2Y_urb_capt_retire(struct snd_usX2Y_substream *subs) + * it directly from the buffer. thus the data is once copied to + * a temporary buffer and urb points to that. + */ +-static int usX2Y_urb_play_prepare(struct snd_usX2Y_substream *subs, ++static int usx2y_urb_play_prepare(struct snd_usx2y_substream *subs, + struct urb *cap_urb, + struct urb *urb) + { + int count, counts, pack; +- struct usX2Ydev *usX2Y = subs->usX2Y; ++ struct usx2ydev *usx2y = subs->usx2y; + struct snd_pcm_runtime *runtime = subs->pcm_substream->runtime; + + count = 0; + for (pack = 0; pack < nr_of_packs(); pack++) { + /* calculate the size of a packet */ +- counts = cap_urb->iso_frame_desc[pack].actual_length / usX2Y->stride; ++ counts = cap_urb->iso_frame_desc[pack].actual_length / usx2y->stride; + count += counts; + if (counts < 43 || counts > 50) { + snd_printk(KERN_ERR "should not be here with counts=%i\n", counts); +@@ -134,7 +134,7 @@ static int usX2Y_urb_play_prepare(struct snd_usX2Y_substream *subs, + 0; + urb->iso_frame_desc[pack].length = cap_urb->iso_frame_desc[pack].actual_length; + } +- if (atomic_read(&subs->state) >= state_PRERUNNING) ++ if (atomic_read(&subs->state) >= STATE_PRERUNNING) + if (subs->hwptr + count > runtime->buffer_size) { + /* err, the transferred area goes over buffer boundary. + * copy the data to the temp buffer. +@@ -143,20 +143,20 @@ static int usX2Y_urb_play_prepare(struct snd_usX2Y_substream *subs, + len = runtime->buffer_size - subs->hwptr; + urb->transfer_buffer = subs->tmpbuf; + memcpy(subs->tmpbuf, runtime->dma_area + +- subs->hwptr * usX2Y->stride, len * usX2Y->stride); +- memcpy(subs->tmpbuf + len * usX2Y->stride, +- runtime->dma_area, (count - len) * usX2Y->stride); ++ subs->hwptr * usx2y->stride, len * usx2y->stride); ++ memcpy(subs->tmpbuf + len * usx2y->stride, ++ runtime->dma_area, (count - len) * usx2y->stride); + subs->hwptr += count; + subs->hwptr -= runtime->buffer_size; + } else { + /* set the buffer pointer */ +- urb->transfer_buffer = runtime->dma_area + subs->hwptr * usX2Y->stride; ++ urb->transfer_buffer = runtime->dma_area + subs->hwptr * usx2y->stride; + if ((subs->hwptr += count) >= runtime->buffer_size) + subs->hwptr -= runtime->buffer_size; + } + else + urb->transfer_buffer = subs->tmpbuf; +- urb->transfer_buffer_length = count * usX2Y->stride; ++ urb->transfer_buffer_length = count * usx2y->stride; + return 0; + } + +@@ -165,10 +165,10 @@ static int usX2Y_urb_play_prepare(struct snd_usX2Y_substream *subs, + * + * update the current position and call callback if a period is processed. + */ +-static void usX2Y_urb_play_retire(struct snd_usX2Y_substream *subs, struct urb *urb) ++static void usx2y_urb_play_retire(struct snd_usx2y_substream *subs, struct urb *urb) + { + struct snd_pcm_runtime *runtime = subs->pcm_substream->runtime; +- int len = urb->actual_length / subs->usX2Y->stride; ++ int len = urb->actual_length / subs->usx2y->stride; + + subs->transfer_done += len; + subs->hwptr_done += len; +@@ -180,14 +180,14 @@ static void usX2Y_urb_play_retire(struct snd_usX2Y_substream *subs, struct urb * + } + } + +-static int usX2Y_urb_submit(struct snd_usX2Y_substream *subs, struct urb *urb, int frame) ++static int usx2y_urb_submit(struct snd_usx2y_substream *subs, struct urb *urb, int frame) + { + int err; + if (!urb) + return -ENODEV; + urb->start_frame = (frame + NRURBS * nr_of_packs()); // let hcd do rollover sanity checks + urb->hcpriv = NULL; +- urb->dev = subs->usX2Y->dev; /* we need to set this at each time */ ++ urb->dev = subs->usx2y->dev; /* we need to set this at each time */ + if ((err = usb_submit_urb(urb, GFP_ATOMIC)) < 0) { + snd_printk(KERN_ERR "usb_submit_urb() returned %i\n", err); + return err; +@@ -195,8 +195,8 @@ static int usX2Y_urb_submit(struct snd_usX2Y_substream *subs, struct urb *urb, i + return 0; + } + +-static inline int usX2Y_usbframe_complete(struct snd_usX2Y_substream *capsubs, +- struct snd_usX2Y_substream *playbacksubs, ++static inline int usx2y_usbframe_complete(struct snd_usx2y_substream *capsubs, ++ struct snd_usx2y_substream *playbacksubs, + int frame) + { + int err, state; +@@ -204,25 +204,25 @@ static inline int usX2Y_usbframe_complete(struct snd_usX2Y_substream *capsubs, + + state = atomic_read(&playbacksubs->state); + if (NULL != urb) { +- if (state == state_RUNNING) +- usX2Y_urb_play_retire(playbacksubs, urb); +- else if (state >= state_PRERUNNING) ++ if (state == STATE_RUNNING) ++ usx2y_urb_play_retire(playbacksubs, urb); ++ else if (state >= STATE_PRERUNNING) + atomic_inc(&playbacksubs->state); + } else { + switch (state) { +- case state_STARTING1: ++ case STATE_STARTING1: + urb = playbacksubs->urb[0]; + atomic_inc(&playbacksubs->state); + break; +- case state_STARTING2: ++ case STATE_STARTING2: + urb = playbacksubs->urb[1]; + atomic_inc(&playbacksubs->state); + break; + } + } + if (urb) { +- if ((err = usX2Y_urb_play_prepare(playbacksubs, capsubs->completed_urb, urb)) || +- (err = usX2Y_urb_submit(playbacksubs, urb, frame))) { ++ if ((err = usx2y_urb_play_prepare(playbacksubs, capsubs->completed_urb, urb)) || ++ (err = usx2y_urb_submit(playbacksubs, urb, frame))) { + return err; + } + } +@@ -230,13 +230,13 @@ static inline int usX2Y_usbframe_complete(struct snd_usX2Y_substream *capsubs, + playbacksubs->completed_urb = NULL; + + state = atomic_read(&capsubs->state); +- if (state >= state_PREPARED) { +- if (state == state_RUNNING) { +- if ((err = usX2Y_urb_capt_retire(capsubs))) ++ if (state >= STATE_PREPARED) { ++ if (state == STATE_RUNNING) { ++ if ((err = usx2y_urb_capt_retire(capsubs))) + return err; +- } else if (state >= state_PRERUNNING) ++ } else if (state >= STATE_PRERUNNING) + atomic_inc(&capsubs->state); +- if ((err = usX2Y_urb_submit(capsubs, capsubs->completed_urb, frame))) ++ if ((err = usx2y_urb_submit(capsubs, capsubs->completed_urb, frame))) + return err; + } + capsubs->completed_urb = NULL; +@@ -244,21 +244,21 @@ static inline int usX2Y_usbframe_complete(struct snd_usX2Y_substream *capsubs, + } + + +-static void usX2Y_clients_stop(struct usX2Ydev *usX2Y) ++static void usx2y_clients_stop(struct usx2ydev *usx2y) + { + int s, u; + + for (s = 0; s < 4; s++) { +- struct snd_usX2Y_substream *subs = usX2Y->subs[s]; ++ struct snd_usx2y_substream *subs = usx2y->subs[s]; + if (subs) { + snd_printdd("%i %p state=%i\n", s, subs, atomic_read(&subs->state)); +- atomic_set(&subs->state, state_STOPPED); ++ atomic_set(&subs->state, STATE_STOPPED); + } + } + for (s = 0; s < 4; s++) { +- struct snd_usX2Y_substream *subs = usX2Y->subs[s]; ++ struct snd_usx2y_substream *subs = usx2y->subs[s]; + if (subs) { +- if (atomic_read(&subs->state) >= state_PRERUNNING) ++ if (atomic_read(&subs->state) >= STATE_PRERUNNING) + snd_pcm_stop_xrun(subs->pcm_substream); + for (u = 0; u < NRURBS; u++) { + struct urb *urb = subs->urb[u]; +@@ -268,60 +268,60 @@ static void usX2Y_clients_stop(struct usX2Ydev *usX2Y) + } + } + } +- usX2Y->prepare_subs = NULL; +- wake_up(&usX2Y->prepare_wait_queue); ++ usx2y->prepare_subs = NULL; ++ wake_up(&usx2y->prepare_wait_queue); + } + +-static void usX2Y_error_urb_status(struct usX2Ydev *usX2Y, +- struct snd_usX2Y_substream *subs, struct urb *urb) ++static void usx2y_error_urb_status(struct usx2ydev *usx2y, ++ struct snd_usx2y_substream *subs, struct urb *urb) + { + snd_printk(KERN_ERR "ep=%i stalled with status=%i\n", subs->endpoint, urb->status); + urb->status = 0; +- usX2Y_clients_stop(usX2Y); ++ usx2y_clients_stop(usx2y); + } + +-static void i_usX2Y_urb_complete(struct urb *urb) ++static void i_usx2y_urb_complete(struct urb *urb) + { +- struct snd_usX2Y_substream *subs = urb->context; +- struct usX2Ydev *usX2Y = subs->usX2Y; ++ struct snd_usx2y_substream *subs = urb->context; ++ struct usx2ydev *usx2y = subs->usx2y; + +- if (unlikely(atomic_read(&subs->state) < state_PREPARED)) { ++ if (unlikely(atomic_read(&subs->state) < STATE_PREPARED)) { + snd_printdd("hcd_frame=%i ep=%i%s status=%i start_frame=%i\n", +- usb_get_current_frame_number(usX2Y->dev), ++ usb_get_current_frame_number(usx2y->dev), + subs->endpoint, usb_pipein(urb->pipe) ? "in" : "out", + urb->status, urb->start_frame); + return; + } + if (unlikely(urb->status)) { +- usX2Y_error_urb_status(usX2Y, subs, urb); ++ usx2y_error_urb_status(usx2y, subs, urb); + return; + } + + subs->completed_urb = urb; + + { +- struct snd_usX2Y_substream *capsubs = usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE], +- *playbacksubs = usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK]; ++ struct snd_usx2y_substream *capsubs = usx2y->subs[SNDRV_PCM_STREAM_CAPTURE], ++ *playbacksubs = usx2y->subs[SNDRV_PCM_STREAM_PLAYBACK]; + if (capsubs->completed_urb && +- atomic_read(&capsubs->state) >= state_PREPARED && ++ atomic_read(&capsubs->state) >= STATE_PREPARED && + (playbacksubs->completed_urb || +- atomic_read(&playbacksubs->state) < state_PREPARED)) { +- if (!usX2Y_usbframe_complete(capsubs, playbacksubs, urb->start_frame)) +- usX2Y->wait_iso_frame += nr_of_packs(); ++ atomic_read(&playbacksubs->state) < STATE_PREPARED)) { ++ if (!usx2y_usbframe_complete(capsubs, playbacksubs, urb->start_frame)) ++ usx2y->wait_iso_frame += nr_of_packs(); + else { + snd_printdd("\n"); +- usX2Y_clients_stop(usX2Y); ++ usx2y_clients_stop(usx2y); + } + } + } + } + +-static void usX2Y_urbs_set_complete(struct usX2Ydev * usX2Y, ++static void usx2y_urbs_set_complete(struct usx2ydev * usx2y, + void (*complete)(struct urb *)) + { + int s, u; + for (s = 0; s < 4; s++) { +- struct snd_usX2Y_substream *subs = usX2Y->subs[s]; ++ struct snd_usx2y_substream *subs = usx2y->subs[s]; + if (NULL != subs) + for (u = 0; u < NRURBS; u++) { + struct urb * urb = subs->urb[u]; +@@ -331,30 +331,30 @@ static void usX2Y_urbs_set_complete(struct usX2Ydev * usX2Y, + } + } + +-static void usX2Y_subs_startup_finish(struct usX2Ydev * usX2Y) ++static void usx2y_subs_startup_finish(struct usx2ydev * usx2y) + { +- usX2Y_urbs_set_complete(usX2Y, i_usX2Y_urb_complete); +- usX2Y->prepare_subs = NULL; ++ usx2y_urbs_set_complete(usx2y, i_usx2y_urb_complete); ++ usx2y->prepare_subs = NULL; + } + +-static void i_usX2Y_subs_startup(struct urb *urb) ++static void i_usx2y_subs_startup(struct urb *urb) + { +- struct snd_usX2Y_substream *subs = urb->context; +- struct usX2Ydev *usX2Y = subs->usX2Y; +- struct snd_usX2Y_substream *prepare_subs = usX2Y->prepare_subs; ++ struct snd_usx2y_substream *subs = urb->context; ++ struct usx2ydev *usx2y = subs->usx2y; ++ struct snd_usx2y_substream *prepare_subs = usx2y->prepare_subs; + if (NULL != prepare_subs) + if (urb->start_frame == prepare_subs->urb[0]->start_frame) { +- usX2Y_subs_startup_finish(usX2Y); ++ usx2y_subs_startup_finish(usx2y); + atomic_inc(&prepare_subs->state); +- wake_up(&usX2Y->prepare_wait_queue); ++ wake_up(&usx2y->prepare_wait_queue); + } + +- i_usX2Y_urb_complete(urb); ++ i_usx2y_urb_complete(urb); + } + +-static void usX2Y_subs_prepare(struct snd_usX2Y_substream *subs) ++static void usx2y_subs_prepare(struct snd_usx2y_substream *subs) + { +- snd_printdd("usX2Y_substream_prepare(%p) ep=%i urb0=%p urb1=%p\n", ++ snd_printdd("usx2y_substream_prepare(%p) ep=%i urb0=%p urb1=%p\n", + subs, subs->endpoint, subs->urb[0], subs->urb[1]); + /* reset the pointer */ + subs->hwptr = 0; +@@ -363,7 +363,7 @@ static void usX2Y_subs_prepare(struct snd_usX2Y_substream *subs) + } + + +-static void usX2Y_urb_release(struct urb **urb, int free_tb) ++static void usx2y_urb_release(struct urb **urb, int free_tb) + { + if (*urb) { + usb_kill_urb(*urb); +@@ -376,13 +376,13 @@ static void usX2Y_urb_release(struct urb **urb, int free_tb) + /* + * release a substreams urbs + */ +-static void usX2Y_urbs_release(struct snd_usX2Y_substream *subs) ++static void usx2y_urbs_release(struct snd_usx2y_substream *subs) + { + int i; +- snd_printdd("usX2Y_urbs_release() %i\n", subs->endpoint); ++ snd_printdd("usx2y_urbs_release() %i\n", subs->endpoint); + for (i = 0; i < NRURBS; i++) +- usX2Y_urb_release(subs->urb + i, +- subs != subs->usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK]); ++ usx2y_urb_release(subs->urb + i, ++ subs != subs->usx2y->subs[SNDRV_PCM_STREAM_PLAYBACK]); + + kfree(subs->tmpbuf); + subs->tmpbuf = NULL; +@@ -390,12 +390,12 @@ static void usX2Y_urbs_release(struct snd_usX2Y_substream *subs) + /* + * initialize a substream's urbs + */ +-static int usX2Y_urbs_allocate(struct snd_usX2Y_substream *subs) ++static int usx2y_urbs_allocate(struct snd_usx2y_substream *subs) + { + int i; + unsigned int pipe; +- int is_playback = subs == subs->usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK]; +- struct usb_device *dev = subs->usX2Y->dev; ++ int is_playback = subs == subs->usx2y->subs[SNDRV_PCM_STREAM_PLAYBACK]; ++ struct usb_device *dev = subs->usx2y->dev; + + pipe = is_playback ? usb_sndisocpipe(dev, subs->endpoint) : + usb_rcvisocpipe(dev, subs->endpoint); +@@ -417,7 +417,7 @@ static int usX2Y_urbs_allocate(struct snd_usX2Y_substream *subs) + } + *purb = usb_alloc_urb(nr_of_packs(), GFP_KERNEL); + if (NULL == *purb) { +- usX2Y_urbs_release(subs); ++ usx2y_urbs_release(subs); + return -ENOMEM; + } + if (!is_playback && !(*purb)->transfer_buffer) { +@@ -426,7 +426,7 @@ static int usX2Y_urbs_allocate(struct snd_usX2Y_substream *subs) + kmalloc_array(subs->maxpacksize, + nr_of_packs(), GFP_KERNEL); + if (NULL == (*purb)->transfer_buffer) { +- usX2Y_urbs_release(subs); ++ usx2y_urbs_release(subs); + return -ENOMEM; + } + } +@@ -435,43 +435,43 @@ static int usX2Y_urbs_allocate(struct snd_usX2Y_substream *subs) + (*purb)->number_of_packets = nr_of_packs(); + (*purb)->context = subs; + (*purb)->interval = 1; +- (*purb)->complete = i_usX2Y_subs_startup; ++ (*purb)->complete = i_usx2y_subs_startup; + } + return 0; + } + +-static void usX2Y_subs_startup(struct snd_usX2Y_substream *subs) ++static void usx2y_subs_startup(struct snd_usx2y_substream *subs) + { +- struct usX2Ydev *usX2Y = subs->usX2Y; +- usX2Y->prepare_subs = subs; ++ struct usx2ydev *usx2y = subs->usx2y; ++ usx2y->prepare_subs = subs; + subs->urb[0]->start_frame = -1; + wmb(); +- usX2Y_urbs_set_complete(usX2Y, i_usX2Y_subs_startup); ++ usx2y_urbs_set_complete(usx2y, i_usx2y_subs_startup); + } + +-static int usX2Y_urbs_start(struct snd_usX2Y_substream *subs) ++static int usx2y_urbs_start(struct snd_usx2y_substream *subs) + { + int i, err; +- struct usX2Ydev *usX2Y = subs->usX2Y; ++ struct usx2ydev *usx2y = subs->usx2y; + +- if ((err = usX2Y_urbs_allocate(subs)) < 0) ++ if ((err = usx2y_urbs_allocate(subs)) < 0) + return err; + subs->completed_urb = NULL; + for (i = 0; i < 4; i++) { +- struct snd_usX2Y_substream *subs = usX2Y->subs[i]; +- if (subs != NULL && atomic_read(&subs->state) >= state_PREPARED) ++ struct snd_usx2y_substream *subs = usx2y->subs[i]; ++ if (subs != NULL && atomic_read(&subs->state) >= STATE_PREPARED) + goto start; + } + + start: +- usX2Y_subs_startup(subs); ++ usx2y_subs_startup(subs); + for (i = 0; i < NRURBS; i++) { + struct urb *urb = subs->urb[i]; + if (usb_pipein(urb->pipe)) { + unsigned long pack; + if (0 == i) +- atomic_set(&subs->state, state_STARTING3); +- urb->dev = usX2Y->dev; ++ atomic_set(&subs->state, STATE_STARTING3); ++ urb->dev = usx2y->dev; + for (pack = 0; pack < nr_of_packs(); pack++) { + urb->iso_frame_desc[pack].offset = subs->maxpacksize * pack; + urb->iso_frame_desc[pack].length = subs->maxpacksize; +@@ -483,22 +483,22 @@ static int usX2Y_urbs_start(struct snd_usX2Y_substream *subs) + goto cleanup; + } else + if (i == 0) +- usX2Y->wait_iso_frame = urb->start_frame; ++ usx2y->wait_iso_frame = urb->start_frame; + urb->transfer_flags = 0; + } else { +- atomic_set(&subs->state, state_STARTING1); ++ atomic_set(&subs->state, STATE_STARTING1); + break; + } + } + err = 0; +- wait_event(usX2Y->prepare_wait_queue, NULL == usX2Y->prepare_subs); +- if (atomic_read(&subs->state) != state_PREPARED) ++ wait_event(usx2y->prepare_wait_queue, NULL == usx2y->prepare_subs); ++ if (atomic_read(&subs->state) != STATE_PREPARED) + err = -EPIPE; + + cleanup: + if (err) { +- usX2Y_subs_startup_finish(usX2Y); +- usX2Y_clients_stop(usX2Y); // something is completely wroong > stop evrything ++ usx2y_subs_startup_finish(usx2y); ++ usx2y_clients_stop(usx2y); // something is completely wroong > stop evrything + } + return err; + } +@@ -506,33 +506,33 @@ static int usX2Y_urbs_start(struct snd_usX2Y_substream *subs) + /* + * return the current pcm pointer. just return the hwptr_done value. + */ +-static snd_pcm_uframes_t snd_usX2Y_pcm_pointer(struct snd_pcm_substream *substream) ++static snd_pcm_uframes_t snd_usx2y_pcm_pointer(struct snd_pcm_substream *substream) + { +- struct snd_usX2Y_substream *subs = substream->runtime->private_data; ++ struct snd_usx2y_substream *subs = substream->runtime->private_data; + return subs->hwptr_done; + } + /* + * start/stop substream + */ +-static int snd_usX2Y_pcm_trigger(struct snd_pcm_substream *substream, int cmd) ++static int snd_usx2y_pcm_trigger(struct snd_pcm_substream *substream, int cmd) + { +- struct snd_usX2Y_substream *subs = substream->runtime->private_data; ++ struct snd_usx2y_substream *subs = substream->runtime->private_data; + + switch (cmd) { + case SNDRV_PCM_TRIGGER_START: +- snd_printdd("snd_usX2Y_pcm_trigger(START)\n"); +- if (atomic_read(&subs->state) == state_PREPARED && +- atomic_read(&subs->usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE]->state) >= state_PREPARED) { +- atomic_set(&subs->state, state_PRERUNNING); ++ snd_printdd("snd_usx2y_pcm_trigger(START)\n"); ++ if (atomic_read(&subs->state) == STATE_PREPARED && ++ atomic_read(&subs->usx2y->subs[SNDRV_PCM_STREAM_CAPTURE]->state) >= STATE_PREPARED) { ++ atomic_set(&subs->state, STATE_PRERUNNING); + } else { + snd_printdd("\n"); + return -EPIPE; + } + break; + case SNDRV_PCM_TRIGGER_STOP: +- snd_printdd("snd_usX2Y_pcm_trigger(STOP)\n"); +- if (atomic_read(&subs->state) >= state_PRERUNNING) +- atomic_set(&subs->state, state_PREPARED); ++ snd_printdd("snd_usx2y_pcm_trigger(STOP)\n"); ++ if (atomic_read(&subs->state) >= STATE_PRERUNNING) ++ atomic_set(&subs->state, STATE_PREPARED); + break; + default: + return -EINVAL; +@@ -553,7 +553,7 @@ static const struct s_c2 + { + char c1, c2; + } +- SetRate44100[] = ++ setrate_44100[] = + { + { 0x14, 0x08}, // this line sets 44100, well actually a little less + { 0x18, 0x40}, // only tascam / frontier design knows the further lines ....... +@@ -589,7 +589,7 @@ static const struct s_c2 + { 0x18, 0x7C}, + { 0x18, 0x7E} + }; +-static const struct s_c2 SetRate48000[] = ++static const struct s_c2 setrate_48000[] = + { + { 0x14, 0x09}, // this line sets 48000, well actually a little less + { 0x18, 0x40}, // only tascam / frontier design knows the further lines ....... +@@ -625,26 +625,26 @@ static const struct s_c2 SetRate48000[] = + { 0x18, 0x7C}, + { 0x18, 0x7E} + }; +-#define NOOF_SETRATE_URBS ARRAY_SIZE(SetRate48000) ++#define NOOF_SETRATE_URBS ARRAY_SIZE(setrate_48000) + +-static void i_usX2Y_04Int(struct urb *urb) ++static void i_usx2y_04int(struct urb *urb) + { +- struct usX2Ydev *usX2Y = urb->context; ++ struct usx2ydev *usx2y = urb->context; + + if (urb->status) +- snd_printk(KERN_ERR "snd_usX2Y_04Int() urb->status=%i\n", urb->status); +- if (0 == --usX2Y->US04->len) +- wake_up(&usX2Y->In04WaitQueue); ++ snd_printk(KERN_ERR "snd_usx2y_04int() urb->status=%i\n", urb->status); ++ if (0 == --usx2y->us04->len) ++ wake_up(&usx2y->in04_wait_queue); + } + +-static int usX2Y_rate_set(struct usX2Ydev *usX2Y, int rate) ++static int usx2y_rate_set(struct usx2ydev *usx2y, int rate) + { + int err = 0, i; +- struct snd_usX2Y_urbSeq *us = NULL; ++ struct snd_usx2y_urb_seq *us = NULL; + int *usbdata = NULL; +- const struct s_c2 *ra = rate == 48000 ? SetRate48000 : SetRate44100; ++ const struct s_c2 *ra = rate == 48000 ? setrate_48000 : setrate_44100; + +- if (usX2Y->rate != rate) { ++ if (usx2y->rate != rate) { + us = kzalloc(sizeof(*us) + sizeof(struct urb*) * NOOF_SETRATE_URBS, GFP_KERNEL); + if (NULL == us) { + err = -ENOMEM; +@@ -663,17 +663,17 @@ static int usX2Y_rate_set(struct usX2Ydev *usX2Y, int rate) + } + ((char*)(usbdata + i))[0] = ra[i].c1; + ((char*)(usbdata + i))[1] = ra[i].c2; +- usb_fill_bulk_urb(us->urb[i], usX2Y->dev, usb_sndbulkpipe(usX2Y->dev, 4), +- usbdata + i, 2, i_usX2Y_04Int, usX2Y); ++ usb_fill_bulk_urb(us->urb[i], usx2y->dev, usb_sndbulkpipe(usx2y->dev, 4), ++ usbdata + i, 2, i_usx2y_04int, usx2y); + } + err = usb_urb_ep_type_check(us->urb[0]); + if (err < 0) + goto cleanup; + us->submitted = 0; + us->len = NOOF_SETRATE_URBS; +- usX2Y->US04 = us; +- wait_event_timeout(usX2Y->In04WaitQueue, 0 == us->len, HZ); +- usX2Y->US04 = NULL; ++ usx2y->us04 = us; ++ wait_event_timeout(usx2y->in04_wait_queue, 0 == us->len, HZ); ++ usx2y->us04 = NULL; + if (us->len) + err = -ENODEV; + cleanup: +@@ -690,11 +690,11 @@ static int usX2Y_rate_set(struct usX2Ydev *usX2Y, int rate) + } + usb_free_urb(urb); + } +- usX2Y->US04 = NULL; ++ usx2y->us04 = NULL; + kfree(usbdata); + kfree(us); + if (!err) +- usX2Y->rate = rate; ++ usx2y->rate = rate; + } + } + +@@ -702,53 +702,53 @@ static int usX2Y_rate_set(struct usX2Ydev *usX2Y, int rate) + } + + +-static int usX2Y_format_set(struct usX2Ydev *usX2Y, snd_pcm_format_t format) ++static int usx2y_format_set(struct usx2ydev *usx2y, snd_pcm_format_t format) + { + int alternate, err; + struct list_head* p; + if (format == SNDRV_PCM_FORMAT_S24_3LE) { + alternate = 2; +- usX2Y->stride = 6; ++ usx2y->stride = 6; + } else { + alternate = 1; +- usX2Y->stride = 4; ++ usx2y->stride = 4; + } +- list_for_each(p, &usX2Y->midi_list) { ++ list_for_each(p, &usx2y->midi_list) { + snd_usbmidi_input_stop(p); + } +- usb_kill_urb(usX2Y->In04urb); +- if ((err = usb_set_interface(usX2Y->dev, 0, alternate))) { ++ usb_kill_urb(usx2y->in04_urb); ++ if ((err = usb_set_interface(usx2y->dev, 0, alternate))) { + snd_printk(KERN_ERR "usb_set_interface error \n"); + return err; + } +- usX2Y->In04urb->dev = usX2Y->dev; +- err = usb_submit_urb(usX2Y->In04urb, GFP_KERNEL); +- list_for_each(p, &usX2Y->midi_list) { ++ usx2y->in04_urb->dev = usx2y->dev; ++ err = usb_submit_urb(usx2y->in04_urb, GFP_KERNEL); ++ list_for_each(p, &usx2y->midi_list) { + snd_usbmidi_input_start(p); + } +- usX2Y->format = format; +- usX2Y->rate = 0; ++ usx2y->format = format; ++ usx2y->rate = 0; + return err; + } + + +-static int snd_usX2Y_pcm_hw_params(struct snd_pcm_substream *substream, ++static int snd_usx2y_pcm_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *hw_params) + { + int err = 0; + unsigned int rate = params_rate(hw_params); + snd_pcm_format_t format = params_format(hw_params); + struct snd_card *card = substream->pstr->pcm->card; +- struct usX2Ydev *dev = usX2Y(card); ++ struct usx2ydev *dev = usx2y(card); + int i; + +- mutex_lock(&usX2Y(card)->pcm_mutex); +- snd_printdd("snd_usX2Y_hw_params(%p, %p)\n", substream, hw_params); +- /* all pcm substreams off one usX2Y have to operate at the same ++ mutex_lock(&usx2y(card)->pcm_mutex); ++ snd_printdd("snd_usx2y_hw_params(%p, %p)\n", substream, hw_params); ++ /* all pcm substreams off one usx2y have to operate at the same + * rate & format + */ + for (i = 0; i < dev->pcm_devs * 2; i++) { +- struct snd_usX2Y_substream *subs = dev->subs[i]; ++ struct snd_usx2y_substream *subs = dev->subs[i]; + struct snd_pcm_substream *test_substream; + + if (!subs) +@@ -767,39 +767,39 @@ static int snd_usX2Y_pcm_hw_params(struct snd_pcm_substream *substream, + } + + error: +- mutex_unlock(&usX2Y(card)->pcm_mutex); ++ mutex_unlock(&usx2y(card)->pcm_mutex); + return err; + } + + /* + * free the buffer + */ +-static int snd_usX2Y_pcm_hw_free(struct snd_pcm_substream *substream) ++static int snd_usx2y_pcm_hw_free(struct snd_pcm_substream *substream) + { + struct snd_pcm_runtime *runtime = substream->runtime; +- struct snd_usX2Y_substream *subs = runtime->private_data; +- mutex_lock(&subs->usX2Y->pcm_mutex); +- snd_printdd("snd_usX2Y_hw_free(%p)\n", substream); ++ struct snd_usx2y_substream *subs = runtime->private_data; ++ mutex_lock(&subs->usx2y->pcm_mutex); ++ snd_printdd("snd_usx2y_hw_free(%p)\n", substream); + + if (SNDRV_PCM_STREAM_PLAYBACK == substream->stream) { +- struct snd_usX2Y_substream *cap_subs = subs->usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE]; +- atomic_set(&subs->state, state_STOPPED); +- usX2Y_urbs_release(subs); ++ struct snd_usx2y_substream *cap_subs = subs->usx2y->subs[SNDRV_PCM_STREAM_CAPTURE]; ++ atomic_set(&subs->state, STATE_STOPPED); ++ usx2y_urbs_release(subs); + if (!cap_subs->pcm_substream || + !cap_subs->pcm_substream->runtime || + !cap_subs->pcm_substream->runtime->status || + cap_subs->pcm_substream->runtime->status->state < SNDRV_PCM_STATE_PREPARED) { +- atomic_set(&cap_subs->state, state_STOPPED); +- usX2Y_urbs_release(cap_subs); ++ atomic_set(&cap_subs->state, STATE_STOPPED); ++ usx2y_urbs_release(cap_subs); + } + } else { +- struct snd_usX2Y_substream *playback_subs = subs->usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK]; +- if (atomic_read(&playback_subs->state) < state_PREPARED) { +- atomic_set(&subs->state, state_STOPPED); +- usX2Y_urbs_release(subs); ++ struct snd_usx2y_substream *playback_subs = subs->usx2y->subs[SNDRV_PCM_STREAM_PLAYBACK]; ++ if (atomic_read(&playback_subs->state) < STATE_PREPARED) { ++ atomic_set(&subs->state, STATE_STOPPED); ++ usx2y_urbs_release(subs); + } + } +- mutex_unlock(&subs->usX2Y->pcm_mutex); ++ mutex_unlock(&subs->usx2y->pcm_mutex); + return 0; + } + /* +@@ -807,40 +807,40 @@ static int snd_usX2Y_pcm_hw_free(struct snd_pcm_substream *substream) + * + * set format and initialize urbs + */ +-static int snd_usX2Y_pcm_prepare(struct snd_pcm_substream *substream) ++static int snd_usx2y_pcm_prepare(struct snd_pcm_substream *substream) + { + struct snd_pcm_runtime *runtime = substream->runtime; +- struct snd_usX2Y_substream *subs = runtime->private_data; +- struct usX2Ydev *usX2Y = subs->usX2Y; +- struct snd_usX2Y_substream *capsubs = subs->usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE]; ++ struct snd_usx2y_substream *subs = runtime->private_data; ++ struct usx2ydev *usx2y = subs->usx2y; ++ struct snd_usx2y_substream *capsubs = subs->usx2y->subs[SNDRV_PCM_STREAM_CAPTURE]; + int err = 0; +- snd_printdd("snd_usX2Y_pcm_prepare(%p)\n", substream); ++ snd_printdd("snd_usx2y_pcm_prepare(%p)\n", substream); + +- mutex_lock(&usX2Y->pcm_mutex); +- usX2Y_subs_prepare(subs); ++ mutex_lock(&usx2y->pcm_mutex); ++ usx2y_subs_prepare(subs); + // Start hardware streams + // SyncStream first.... +- if (atomic_read(&capsubs->state) < state_PREPARED) { +- if (usX2Y->format != runtime->format) +- if ((err = usX2Y_format_set(usX2Y, runtime->format)) < 0) ++ if (atomic_read(&capsubs->state) < STATE_PREPARED) { ++ if (usx2y->format != runtime->format) ++ if ((err = usx2y_format_set(usx2y, runtime->format)) < 0) + goto up_prepare_mutex; +- if (usX2Y->rate != runtime->rate) +- if ((err = usX2Y_rate_set(usX2Y, runtime->rate)) < 0) ++ if (usx2y->rate != runtime->rate) ++ if ((err = usx2y_rate_set(usx2y, runtime->rate)) < 0) + goto up_prepare_mutex; + snd_printdd("starting capture pipe for %s\n", subs == capsubs ? "self" : "playpipe"); +- if (0 > (err = usX2Y_urbs_start(capsubs))) ++ if (0 > (err = usx2y_urbs_start(capsubs))) + goto up_prepare_mutex; + } + +- if (subs != capsubs && atomic_read(&subs->state) < state_PREPARED) +- err = usX2Y_urbs_start(subs); ++ if (subs != capsubs && atomic_read(&subs->state) < STATE_PREPARED) ++ err = usx2y_urbs_start(subs); + + up_prepare_mutex: +- mutex_unlock(&usX2Y->pcm_mutex); ++ mutex_unlock(&usx2y->pcm_mutex); + return err; + } + +-static const struct snd_pcm_hardware snd_usX2Y_2c = ++static const struct snd_pcm_hardware snd_usx2y_2c = + { + .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | + SNDRV_PCM_INFO_BLOCK_TRANSFER | +@@ -862,16 +862,16 @@ static const struct snd_pcm_hardware snd_usX2Y_2c = + + + +-static int snd_usX2Y_pcm_open(struct snd_pcm_substream *substream) ++static int snd_usx2y_pcm_open(struct snd_pcm_substream *substream) + { +- struct snd_usX2Y_substream *subs = ((struct snd_usX2Y_substream **) ++ struct snd_usx2y_substream *subs = ((struct snd_usx2y_substream **) + snd_pcm_substream_chip(substream))[substream->stream]; + struct snd_pcm_runtime *runtime = substream->runtime; + +- if (subs->usX2Y->chip_status & USX2Y_STAT_CHIP_MMAP_PCM_URBS) ++ if (subs->usx2y->chip_status & USX2Y_STAT_CHIP_MMAP_PCM_URBS) + return -EBUSY; + +- runtime->hw = snd_usX2Y_2c; ++ runtime->hw = snd_usx2y_2c; + runtime->private_data = subs; + subs->pcm_substream = substream; + snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_TIME, 1000, 200000); +@@ -880,10 +880,10 @@ static int snd_usX2Y_pcm_open(struct snd_pcm_substream *substream) + + + +-static int snd_usX2Y_pcm_close(struct snd_pcm_substream *substream) ++static int snd_usx2y_pcm_close(struct snd_pcm_substream *substream) + { + struct snd_pcm_runtime *runtime = substream->runtime; +- struct snd_usX2Y_substream *subs = runtime->private_data; ++ struct snd_usx2y_substream *subs = runtime->private_data; + + subs->pcm_substream = NULL; + +@@ -891,75 +891,75 @@ static int snd_usX2Y_pcm_close(struct snd_pcm_substream *substream) + } + + +-static const struct snd_pcm_ops snd_usX2Y_pcm_ops = ++static const struct snd_pcm_ops snd_usx2y_pcm_ops = + { +- .open = snd_usX2Y_pcm_open, +- .close = snd_usX2Y_pcm_close, +- .hw_params = snd_usX2Y_pcm_hw_params, +- .hw_free = snd_usX2Y_pcm_hw_free, +- .prepare = snd_usX2Y_pcm_prepare, +- .trigger = snd_usX2Y_pcm_trigger, +- .pointer = snd_usX2Y_pcm_pointer, ++ .open = snd_usx2y_pcm_open, ++ .close = snd_usx2y_pcm_close, ++ .hw_params = snd_usx2y_pcm_hw_params, ++ .hw_free = snd_usx2y_pcm_hw_free, ++ .prepare = snd_usx2y_pcm_prepare, ++ .trigger = snd_usx2y_pcm_trigger, ++ .pointer = snd_usx2y_pcm_pointer, + }; + + + /* + * free a usb stream instance + */ +-static void usX2Y_audio_stream_free(struct snd_usX2Y_substream **usX2Y_substream) ++static void usx2y_audio_stream_free(struct snd_usx2y_substream **usx2y_substream) + { + int stream; + + for_each_pcm_streams(stream) { +- kfree(usX2Y_substream[stream]); +- usX2Y_substream[stream] = NULL; ++ kfree(usx2y_substream[stream]); ++ usx2y_substream[stream] = NULL; + } + } + +-static void snd_usX2Y_pcm_private_free(struct snd_pcm *pcm) ++static void snd_usx2y_pcm_private_free(struct snd_pcm *pcm) + { +- struct snd_usX2Y_substream **usX2Y_stream = pcm->private_data; +- if (usX2Y_stream) +- usX2Y_audio_stream_free(usX2Y_stream); ++ struct snd_usx2y_substream **usx2y_stream = pcm->private_data; ++ if (usx2y_stream) ++ usx2y_audio_stream_free(usx2y_stream); + } + +-static int usX2Y_audio_stream_new(struct snd_card *card, int playback_endpoint, int capture_endpoint) ++static int usx2y_audio_stream_new(struct snd_card *card, int playback_endpoint, int capture_endpoint) + { + struct snd_pcm *pcm; + int err, i; +- struct snd_usX2Y_substream **usX2Y_substream = +- usX2Y(card)->subs + 2 * usX2Y(card)->pcm_devs; ++ struct snd_usx2y_substream **usx2y_substream = ++ usx2y(card)->subs + 2 * usx2y(card)->pcm_devs; + + for (i = playback_endpoint ? SNDRV_PCM_STREAM_PLAYBACK : SNDRV_PCM_STREAM_CAPTURE; + i <= SNDRV_PCM_STREAM_CAPTURE; ++i) { +- usX2Y_substream[i] = kzalloc(sizeof(struct snd_usX2Y_substream), GFP_KERNEL); +- if (!usX2Y_substream[i]) ++ usx2y_substream[i] = kzalloc(sizeof(struct snd_usx2y_substream), GFP_KERNEL); ++ if (!usx2y_substream[i]) + return -ENOMEM; + +- usX2Y_substream[i]->usX2Y = usX2Y(card); ++ usx2y_substream[i]->usx2y = usx2y(card); + } + + if (playback_endpoint) +- usX2Y_substream[SNDRV_PCM_STREAM_PLAYBACK]->endpoint = playback_endpoint; +- usX2Y_substream[SNDRV_PCM_STREAM_CAPTURE]->endpoint = capture_endpoint; ++ usx2y_substream[SNDRV_PCM_STREAM_PLAYBACK]->endpoint = playback_endpoint; ++ usx2y_substream[SNDRV_PCM_STREAM_CAPTURE]->endpoint = capture_endpoint; + +- err = snd_pcm_new(card, NAME_ALLCAPS" Audio", usX2Y(card)->pcm_devs, ++ err = snd_pcm_new(card, NAME_ALLCAPS" Audio", usx2y(card)->pcm_devs, + playback_endpoint ? 1 : 0, 1, + &pcm); + if (err < 0) { +- usX2Y_audio_stream_free(usX2Y_substream); ++ usx2y_audio_stream_free(usx2y_substream); + return err; + } + + if (playback_endpoint) +- snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_usX2Y_pcm_ops); +- snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_usX2Y_pcm_ops); ++ snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_usx2y_pcm_ops); ++ snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_usx2y_pcm_ops); + +- pcm->private_data = usX2Y_substream; +- pcm->private_free = snd_usX2Y_pcm_private_free; ++ pcm->private_data = usx2y_substream; ++ pcm->private_free = snd_usx2y_pcm_private_free; + pcm->info_flags = 0; + +- sprintf(pcm->name, NAME_ALLCAPS" Audio #%d", usX2Y(card)->pcm_devs); ++ sprintf(pcm->name, NAME_ALLCAPS" Audio #%d", usx2y(card)->pcm_devs); + + if (playback_endpoint) { + snd_pcm_set_managed_buffer(pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream, +@@ -972,7 +972,7 @@ static int usX2Y_audio_stream_new(struct snd_card *card, int playback_endpoint, + SNDRV_DMA_TYPE_CONTINUOUS, + NULL, + 64*1024, 128*1024); +- usX2Y(card)->pcm_devs++; ++ usx2y(card)->pcm_devs++; + + return 0; + } +@@ -980,18 +980,18 @@ static int usX2Y_audio_stream_new(struct snd_card *card, int playback_endpoint, + /* + * create a chip instance and set its names. + */ +-int usX2Y_audio_create(struct snd_card *card) ++int usx2y_audio_create(struct snd_card *card) + { + int err = 0; + +- INIT_LIST_HEAD(&usX2Y(card)->pcm_list); ++ INIT_LIST_HEAD(&usx2y(card)->pcm_list); + +- if (0 > (err = usX2Y_audio_stream_new(card, 0xA, 0x8))) ++ if (0 > (err = usx2y_audio_stream_new(card, 0xA, 0x8))) + return err; +- if (le16_to_cpu(usX2Y(card)->dev->descriptor.idProduct) == USB_ID_US428) +- if (0 > (err = usX2Y_audio_stream_new(card, 0, 0xA))) ++ if (le16_to_cpu(usx2y(card)->dev->descriptor.idProduct) == USB_ID_US428) ++ if (0 > (err = usx2y_audio_stream_new(card, 0, 0xA))) + return err; +- if (le16_to_cpu(usX2Y(card)->dev->descriptor.idProduct) != USB_ID_US122) +- err = usX2Y_rate_set(usX2Y(card), 44100); // Lets us428 recognize output-volume settings, disturbs us122. ++ if (le16_to_cpu(usx2y(card)->dev->descriptor.idProduct) != USB_ID_US122) ++ err = usx2y_rate_set(usx2y(card), 44100); // Lets us428 recognize output-volume settings, disturbs us122. + return err; + } +diff --git a/sound/usb/usx2y/usx2yhwdeppcm.c b/sound/usb/usx2y/usx2yhwdeppcm.c +index 8253669c6a7d..399470e51c41 100644 +--- a/sound/usb/usx2y/usx2yhwdeppcm.c ++++ b/sound/usb/usx2y/usx2yhwdeppcm.c +@@ -47,17 +47,17 @@ + #include + + +-static int usX2Y_usbpcm_urb_capt_retire(struct snd_usX2Y_substream *subs) ++static int usx2y_usbpcm_urb_capt_retire(struct snd_usx2y_substream *subs) + { + struct urb *urb = subs->completed_urb; + struct snd_pcm_runtime *runtime = subs->pcm_substream->runtime; + int i, lens = 0, hwptr_done = subs->hwptr_done; +- struct usX2Ydev *usX2Y = subs->usX2Y; +- if (0 > usX2Y->hwdep_pcm_shm->capture_iso_start) { //FIXME +- int head = usX2Y->hwdep_pcm_shm->captured_iso_head + 1; +- if (head >= ARRAY_SIZE(usX2Y->hwdep_pcm_shm->captured_iso)) ++ struct usx2ydev *usx2y = subs->usx2y; ++ if (0 > usx2y->hwdep_pcm_shm->capture_iso_start) { //FIXME ++ int head = usx2y->hwdep_pcm_shm->captured_iso_head + 1; ++ if (head >= ARRAY_SIZE(usx2y->hwdep_pcm_shm->captured_iso)) + head = 0; +- usX2Y->hwdep_pcm_shm->capture_iso_start = head; ++ usx2y->hwdep_pcm_shm->capture_iso_start = head; + snd_printdd("cap start %i\n", head); + } + for (i = 0; i < nr_of_packs(); i++) { +@@ -65,7 +65,7 @@ static int usX2Y_usbpcm_urb_capt_retire(struct snd_usX2Y_substream *subs) + snd_printk(KERN_ERR "active frame status %i. Most probably some hardware problem.\n", urb->iso_frame_desc[i].status); + return urb->iso_frame_desc[i].status; + } +- lens += urb->iso_frame_desc[i].actual_length / usX2Y->stride; ++ lens += urb->iso_frame_desc[i].actual_length / usx2y->stride; + } + if ((hwptr_done += lens) >= runtime->buffer_size) + hwptr_done -= runtime->buffer_size; +@@ -79,10 +79,10 @@ static int usX2Y_usbpcm_urb_capt_retire(struct snd_usX2Y_substream *subs) + return 0; + } + +-static inline int usX2Y_iso_frames_per_buffer(struct snd_pcm_runtime *runtime, +- struct usX2Ydev * usX2Y) ++static inline int usx2y_iso_frames_per_buffer(struct snd_pcm_runtime *runtime, ++ struct usx2ydev * usx2y) + { +- return (runtime->buffer_size * 1000) / usX2Y->rate + 1; //FIXME: so far only correct period_size == 2^x ? ++ return (runtime->buffer_size * 1000) / usx2y->rate + 1; //FIXME: so far only correct period_size == 2^x ? + } + + /* +@@ -95,17 +95,17 @@ static inline int usX2Y_iso_frames_per_buffer(struct snd_pcm_runtime *runtime, + * it directly from the buffer. thus the data is once copied to + * a temporary buffer and urb points to that. + */ +-static int usX2Y_hwdep_urb_play_prepare(struct snd_usX2Y_substream *subs, ++static int usx2y_hwdep_urb_play_prepare(struct snd_usx2y_substream *subs, + struct urb *urb) + { + int count, counts, pack; +- struct usX2Ydev *usX2Y = subs->usX2Y; +- struct snd_usX2Y_hwdep_pcm_shm *shm = usX2Y->hwdep_pcm_shm; ++ struct usx2ydev *usx2y = subs->usx2y; ++ struct snd_usx2y_hwdep_pcm_shm *shm = usx2y->hwdep_pcm_shm; + struct snd_pcm_runtime *runtime = subs->pcm_substream->runtime; + + if (0 > shm->playback_iso_start) { + shm->playback_iso_start = shm->captured_iso_head - +- usX2Y_iso_frames_per_buffer(runtime, usX2Y); ++ usx2y_iso_frames_per_buffer(runtime, usx2y); + if (0 > shm->playback_iso_start) + shm->playback_iso_start += ARRAY_SIZE(shm->captured_iso); + shm->playback_iso_head = shm->playback_iso_start; +@@ -114,7 +114,7 @@ static int usX2Y_hwdep_urb_play_prepare(struct snd_usX2Y_substream *subs, + count = 0; + for (pack = 0; pack < nr_of_packs(); pack++) { + /* calculate the size of a packet */ +- counts = shm->captured_iso[shm->playback_iso_head].length / usX2Y->stride; ++ counts = shm->captured_iso[shm->playback_iso_head].length / usx2y->stride; + if (counts < 43 || counts > 50) { + snd_printk(KERN_ERR "should not be here with counts=%i\n", counts); + return -EPIPE; +@@ -122,26 +122,26 @@ static int usX2Y_hwdep_urb_play_prepare(struct snd_usX2Y_substream *subs, + /* set up descriptor */ + urb->iso_frame_desc[pack].offset = shm->captured_iso[shm->playback_iso_head].offset; + urb->iso_frame_desc[pack].length = shm->captured_iso[shm->playback_iso_head].length; +- if (atomic_read(&subs->state) != state_RUNNING) ++ if (atomic_read(&subs->state) != STATE_RUNNING) + memset((char *)urb->transfer_buffer + urb->iso_frame_desc[pack].offset, 0, + urb->iso_frame_desc[pack].length); + if (++shm->playback_iso_head >= ARRAY_SIZE(shm->captured_iso)) + shm->playback_iso_head = 0; + count += counts; + } +- urb->transfer_buffer_length = count * usX2Y->stride; ++ urb->transfer_buffer_length = count * usx2y->stride; + return 0; + } + + +-static inline void usX2Y_usbpcm_urb_capt_iso_advance(struct snd_usX2Y_substream *subs, ++static inline void usx2y_usbpcm_urb_capt_iso_advance(struct snd_usx2y_substream *subs, + struct urb *urb) + { + int pack; + for (pack = 0; pack < nr_of_packs(); ++pack) { + struct usb_iso_packet_descriptor *desc = urb->iso_frame_desc + pack; + if (NULL != subs) { +- struct snd_usX2Y_hwdep_pcm_shm *shm = subs->usX2Y->hwdep_pcm_shm; ++ struct snd_usx2y_hwdep_pcm_shm *shm = subs->usx2y->hwdep_pcm_shm; + int head = shm->captured_iso_head + 1; + if (head >= ARRAY_SIZE(shm->captured_iso)) + head = 0; +@@ -157,9 +157,9 @@ static inline void usX2Y_usbpcm_urb_capt_iso_advance(struct snd_usX2Y_substream + } + } + +-static inline int usX2Y_usbpcm_usbframe_complete(struct snd_usX2Y_substream *capsubs, +- struct snd_usX2Y_substream *capsubs2, +- struct snd_usX2Y_substream *playbacksubs, ++static inline int usx2y_usbpcm_usbframe_complete(struct snd_usx2y_substream *capsubs, ++ struct snd_usx2y_substream *capsubs2, ++ struct snd_usx2y_substream *playbacksubs, + int frame) + { + int err, state; +@@ -167,25 +167,25 @@ static inline int usX2Y_usbpcm_usbframe_complete(struct snd_usX2Y_substream *cap + + state = atomic_read(&playbacksubs->state); + if (NULL != urb) { +- if (state == state_RUNNING) +- usX2Y_urb_play_retire(playbacksubs, urb); +- else if (state >= state_PRERUNNING) ++ if (state == STATE_RUNNING) ++ usx2y_urb_play_retire(playbacksubs, urb); ++ else if (state >= STATE_PRERUNNING) + atomic_inc(&playbacksubs->state); + } else { + switch (state) { +- case state_STARTING1: ++ case STATE_STARTING1: + urb = playbacksubs->urb[0]; + atomic_inc(&playbacksubs->state); + break; +- case state_STARTING2: ++ case STATE_STARTING2: + urb = playbacksubs->urb[1]; + atomic_inc(&playbacksubs->state); + break; + } + } + if (urb) { +- if ((err = usX2Y_hwdep_urb_play_prepare(playbacksubs, urb)) || +- (err = usX2Y_urb_submit(playbacksubs, urb, frame))) { ++ if ((err = usx2y_hwdep_urb_play_prepare(playbacksubs, urb)) || ++ (err = usx2y_urb_submit(playbacksubs, urb, frame))) { + return err; + } + } +@@ -193,19 +193,19 @@ static inline int usX2Y_usbpcm_usbframe_complete(struct snd_usX2Y_substream *cap + playbacksubs->completed_urb = NULL; + + state = atomic_read(&capsubs->state); +- if (state >= state_PREPARED) { +- if (state == state_RUNNING) { +- if ((err = usX2Y_usbpcm_urb_capt_retire(capsubs))) ++ if (state >= STATE_PREPARED) { ++ if (state == STATE_RUNNING) { ++ if ((err = usx2y_usbpcm_urb_capt_retire(capsubs))) + return err; +- } else if (state >= state_PRERUNNING) ++ } else if (state >= STATE_PRERUNNING) + atomic_inc(&capsubs->state); +- usX2Y_usbpcm_urb_capt_iso_advance(capsubs, capsubs->completed_urb); ++ usx2y_usbpcm_urb_capt_iso_advance(capsubs, capsubs->completed_urb); + if (NULL != capsubs2) +- usX2Y_usbpcm_urb_capt_iso_advance(NULL, capsubs2->completed_urb); +- if ((err = usX2Y_urb_submit(capsubs, capsubs->completed_urb, frame))) ++ usx2y_usbpcm_urb_capt_iso_advance(NULL, capsubs2->completed_urb); ++ if ((err = usx2y_urb_submit(capsubs, capsubs->completed_urb, frame))) + return err; + if (NULL != capsubs2) +- if ((err = usX2Y_urb_submit(capsubs2, capsubs2->completed_urb, frame))) ++ if ((err = usx2y_urb_submit(capsubs2, capsubs2->completed_urb, frame))) + return err; + } + capsubs->completed_urb = NULL; +@@ -215,42 +215,42 @@ static inline int usX2Y_usbpcm_usbframe_complete(struct snd_usX2Y_substream *cap + } + + +-static void i_usX2Y_usbpcm_urb_complete(struct urb *urb) ++static void i_usx2y_usbpcm_urb_complete(struct urb *urb) + { +- struct snd_usX2Y_substream *subs = urb->context; +- struct usX2Ydev *usX2Y = subs->usX2Y; +- struct snd_usX2Y_substream *capsubs, *capsubs2, *playbacksubs; ++ struct snd_usx2y_substream *subs = urb->context; ++ struct usx2ydev *usx2y = subs->usx2y; ++ struct snd_usx2y_substream *capsubs, *capsubs2, *playbacksubs; + +- if (unlikely(atomic_read(&subs->state) < state_PREPARED)) { ++ if (unlikely(atomic_read(&subs->state) < STATE_PREPARED)) { + snd_printdd("hcd_frame=%i ep=%i%s status=%i start_frame=%i\n", +- usb_get_current_frame_number(usX2Y->dev), ++ usb_get_current_frame_number(usx2y->dev), + subs->endpoint, usb_pipein(urb->pipe) ? "in" : "out", + urb->status, urb->start_frame); + return; + } + if (unlikely(urb->status)) { +- usX2Y_error_urb_status(usX2Y, subs, urb); ++ usx2y_error_urb_status(usx2y, subs, urb); + return; + } + + subs->completed_urb = urb; +- capsubs = usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE]; +- capsubs2 = usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE + 2]; +- playbacksubs = usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK]; +- if (capsubs->completed_urb && atomic_read(&capsubs->state) >= state_PREPARED && ++ capsubs = usx2y->subs[SNDRV_PCM_STREAM_CAPTURE]; ++ capsubs2 = usx2y->subs[SNDRV_PCM_STREAM_CAPTURE + 2]; ++ playbacksubs = usx2y->subs[SNDRV_PCM_STREAM_PLAYBACK]; ++ if (capsubs->completed_urb && atomic_read(&capsubs->state) >= STATE_PREPARED && + (NULL == capsubs2 || capsubs2->completed_urb) && +- (playbacksubs->completed_urb || atomic_read(&playbacksubs->state) < state_PREPARED)) { +- if (!usX2Y_usbpcm_usbframe_complete(capsubs, capsubs2, playbacksubs, urb->start_frame)) +- usX2Y->wait_iso_frame += nr_of_packs(); ++ (playbacksubs->completed_urb || atomic_read(&playbacksubs->state) < STATE_PREPARED)) { ++ if (!usx2y_usbpcm_usbframe_complete(capsubs, capsubs2, playbacksubs, urb->start_frame)) ++ usx2y->wait_iso_frame += nr_of_packs(); + else { + snd_printdd("\n"); +- usX2Y_clients_stop(usX2Y); ++ usx2y_clients_stop(usx2y); + } + } + } + + +-static void usX2Y_hwdep_urb_release(struct urb **urb) ++static void usx2y_hwdep_urb_release(struct urb **urb) + { + usb_kill_urb(*urb); + usb_free_urb(*urb); +@@ -260,49 +260,49 @@ static void usX2Y_hwdep_urb_release(struct urb **urb) + /* + * release a substream + */ +-static void usX2Y_usbpcm_urbs_release(struct snd_usX2Y_substream *subs) ++static void usx2y_usbpcm_urbs_release(struct snd_usx2y_substream *subs) + { + int i; +- snd_printdd("snd_usX2Y_urbs_release() %i\n", subs->endpoint); ++ snd_printdd("snd_usx2y_urbs_release() %i\n", subs->endpoint); + for (i = 0; i < NRURBS; i++) +- usX2Y_hwdep_urb_release(subs->urb + i); ++ usx2y_hwdep_urb_release(subs->urb + i); + } + +-static void usX2Y_usbpcm_subs_startup_finish(struct usX2Ydev * usX2Y) ++static void usx2y_usbpcm_subs_startup_finish(struct usx2ydev * usx2y) + { +- usX2Y_urbs_set_complete(usX2Y, i_usX2Y_usbpcm_urb_complete); +- usX2Y->prepare_subs = NULL; ++ usx2y_urbs_set_complete(usx2y, i_usx2y_usbpcm_urb_complete); ++ usx2y->prepare_subs = NULL; + } + +-static void i_usX2Y_usbpcm_subs_startup(struct urb *urb) ++static void i_usx2y_usbpcm_subs_startup(struct urb *urb) + { +- struct snd_usX2Y_substream *subs = urb->context; +- struct usX2Ydev *usX2Y = subs->usX2Y; +- struct snd_usX2Y_substream *prepare_subs = usX2Y->prepare_subs; ++ struct snd_usx2y_substream *subs = urb->context; ++ struct usx2ydev *usx2y = subs->usx2y; ++ struct snd_usx2y_substream *prepare_subs = usx2y->prepare_subs; + if (NULL != prepare_subs && + urb->start_frame == prepare_subs->urb[0]->start_frame) { + atomic_inc(&prepare_subs->state); +- if (prepare_subs == usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE]) { +- struct snd_usX2Y_substream *cap_subs2 = usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE + 2]; ++ if (prepare_subs == usx2y->subs[SNDRV_PCM_STREAM_CAPTURE]) { ++ struct snd_usx2y_substream *cap_subs2 = usx2y->subs[SNDRV_PCM_STREAM_CAPTURE + 2]; + if (cap_subs2 != NULL) + atomic_inc(&cap_subs2->state); + } +- usX2Y_usbpcm_subs_startup_finish(usX2Y); +- wake_up(&usX2Y->prepare_wait_queue); ++ usx2y_usbpcm_subs_startup_finish(usx2y); ++ wake_up(&usx2y->prepare_wait_queue); + } + +- i_usX2Y_usbpcm_urb_complete(urb); ++ i_usx2y_usbpcm_urb_complete(urb); + } + + /* + * initialize a substream's urbs + */ +-static int usX2Y_usbpcm_urbs_allocate(struct snd_usX2Y_substream *subs) ++static int usx2y_usbpcm_urbs_allocate(struct snd_usx2y_substream *subs) + { + int i; + unsigned int pipe; +- int is_playback = subs == subs->usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK]; +- struct usb_device *dev = subs->usX2Y->dev; ++ int is_playback = subs == subs->usx2y->subs[SNDRV_PCM_STREAM_PLAYBACK]; ++ struct usb_device *dev = subs->usx2y->dev; + + pipe = is_playback ? usb_sndisocpipe(dev, subs->endpoint) : + usb_rcvisocpipe(dev, subs->endpoint); +@@ -319,21 +319,21 @@ static int usX2Y_usbpcm_urbs_allocate(struct snd_usX2Y_substream *subs) + } + *purb = usb_alloc_urb(nr_of_packs(), GFP_KERNEL); + if (NULL == *purb) { +- usX2Y_usbpcm_urbs_release(subs); ++ usx2y_usbpcm_urbs_release(subs); + return -ENOMEM; + } + (*purb)->transfer_buffer = is_playback ? +- subs->usX2Y->hwdep_pcm_shm->playback : ( ++ subs->usx2y->hwdep_pcm_shm->playback : ( + subs->endpoint == 0x8 ? +- subs->usX2Y->hwdep_pcm_shm->capture0x8 : +- subs->usX2Y->hwdep_pcm_shm->capture0xA); ++ subs->usx2y->hwdep_pcm_shm->capture0x8 : ++ subs->usx2y->hwdep_pcm_shm->capture0xA); + + (*purb)->dev = dev; + (*purb)->pipe = pipe; + (*purb)->number_of_packets = nr_of_packs(); + (*purb)->context = subs; + (*purb)->interval = 1; +- (*purb)->complete = i_usX2Y_usbpcm_subs_startup; ++ (*purb)->complete = i_usx2y_usbpcm_subs_startup; + } + return 0; + } +@@ -341,91 +341,91 @@ static int usX2Y_usbpcm_urbs_allocate(struct snd_usX2Y_substream *subs) + /* + * free the buffer + */ +-static int snd_usX2Y_usbpcm_hw_free(struct snd_pcm_substream *substream) ++static int snd_usx2y_usbpcm_hw_free(struct snd_pcm_substream *substream) + { + struct snd_pcm_runtime *runtime = substream->runtime; +- struct snd_usX2Y_substream *subs = runtime->private_data, +- *cap_subs2 = subs->usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE + 2]; +- mutex_lock(&subs->usX2Y->pcm_mutex); +- snd_printdd("snd_usX2Y_usbpcm_hw_free(%p)\n", substream); ++ struct snd_usx2y_substream *subs = runtime->private_data, ++ *cap_subs2 = subs->usx2y->subs[SNDRV_PCM_STREAM_CAPTURE + 2]; ++ mutex_lock(&subs->usx2y->pcm_mutex); ++ snd_printdd("snd_usx2y_usbpcm_hw_free(%p)\n", substream); + + if (SNDRV_PCM_STREAM_PLAYBACK == substream->stream) { +- struct snd_usX2Y_substream *cap_subs = subs->usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE]; +- atomic_set(&subs->state, state_STOPPED); +- usX2Y_usbpcm_urbs_release(subs); ++ struct snd_usx2y_substream *cap_subs = subs->usx2y->subs[SNDRV_PCM_STREAM_CAPTURE]; ++ atomic_set(&subs->state, STATE_STOPPED); ++ usx2y_usbpcm_urbs_release(subs); + if (!cap_subs->pcm_substream || + !cap_subs->pcm_substream->runtime || + !cap_subs->pcm_substream->runtime->status || + cap_subs->pcm_substream->runtime->status->state < SNDRV_PCM_STATE_PREPARED) { +- atomic_set(&cap_subs->state, state_STOPPED); ++ atomic_set(&cap_subs->state, STATE_STOPPED); + if (NULL != cap_subs2) +- atomic_set(&cap_subs2->state, state_STOPPED); +- usX2Y_usbpcm_urbs_release(cap_subs); ++ atomic_set(&cap_subs2->state, STATE_STOPPED); ++ usx2y_usbpcm_urbs_release(cap_subs); + if (NULL != cap_subs2) +- usX2Y_usbpcm_urbs_release(cap_subs2); ++ usx2y_usbpcm_urbs_release(cap_subs2); + } + } else { +- struct snd_usX2Y_substream *playback_subs = subs->usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK]; +- if (atomic_read(&playback_subs->state) < state_PREPARED) { +- atomic_set(&subs->state, state_STOPPED); ++ struct snd_usx2y_substream *playback_subs = subs->usx2y->subs[SNDRV_PCM_STREAM_PLAYBACK]; ++ if (atomic_read(&playback_subs->state) < STATE_PREPARED) { ++ atomic_set(&subs->state, STATE_STOPPED); + if (NULL != cap_subs2) +- atomic_set(&cap_subs2->state, state_STOPPED); +- usX2Y_usbpcm_urbs_release(subs); ++ atomic_set(&cap_subs2->state, STATE_STOPPED); ++ usx2y_usbpcm_urbs_release(subs); + if (NULL != cap_subs2) +- usX2Y_usbpcm_urbs_release(cap_subs2); ++ usx2y_usbpcm_urbs_release(cap_subs2); + } + } +- mutex_unlock(&subs->usX2Y->pcm_mutex); ++ mutex_unlock(&subs->usx2y->pcm_mutex); + return 0; + } + +-static void usX2Y_usbpcm_subs_startup(struct snd_usX2Y_substream *subs) ++static void usx2y_usbpcm_subs_startup(struct snd_usx2y_substream *subs) + { +- struct usX2Ydev * usX2Y = subs->usX2Y; +- usX2Y->prepare_subs = subs; ++ struct usx2ydev * usx2y = subs->usx2y; ++ usx2y->prepare_subs = subs; + subs->urb[0]->start_frame = -1; +- smp_wmb(); // Make sure above modifications are seen by i_usX2Y_subs_startup() +- usX2Y_urbs_set_complete(usX2Y, i_usX2Y_usbpcm_subs_startup); ++ smp_wmb(); // Make sure above modifications are seen by i_usx2y_subs_startup() ++ usx2y_urbs_set_complete(usx2y, i_usx2y_usbpcm_subs_startup); + } + +-static int usX2Y_usbpcm_urbs_start(struct snd_usX2Y_substream *subs) ++static int usx2y_usbpcm_urbs_start(struct snd_usx2y_substream *subs) + { + int p, u, err, + stream = subs->pcm_substream->stream; +- struct usX2Ydev *usX2Y = subs->usX2Y; ++ struct usx2ydev *usx2y = subs->usx2y; + + if (SNDRV_PCM_STREAM_CAPTURE == stream) { +- usX2Y->hwdep_pcm_shm->captured_iso_head = -1; +- usX2Y->hwdep_pcm_shm->captured_iso_frames = 0; ++ usx2y->hwdep_pcm_shm->captured_iso_head = -1; ++ usx2y->hwdep_pcm_shm->captured_iso_frames = 0; + } + + for (p = 0; 3 >= (stream + p); p += 2) { +- struct snd_usX2Y_substream *subs = usX2Y->subs[stream + p]; ++ struct snd_usx2y_substream *subs = usx2y->subs[stream + p]; + if (subs != NULL) { +- if ((err = usX2Y_usbpcm_urbs_allocate(subs)) < 0) ++ if ((err = usx2y_usbpcm_urbs_allocate(subs)) < 0) + return err; + subs->completed_urb = NULL; + } + } + + for (p = 0; p < 4; p++) { +- struct snd_usX2Y_substream *subs = usX2Y->subs[p]; +- if (subs != NULL && atomic_read(&subs->state) >= state_PREPARED) ++ struct snd_usx2y_substream *subs = usx2y->subs[p]; ++ if (subs != NULL && atomic_read(&subs->state) >= STATE_PREPARED) + goto start; + } + + start: +- usX2Y_usbpcm_subs_startup(subs); ++ usx2y_usbpcm_subs_startup(subs); + for (u = 0; u < NRURBS; u++) { + for (p = 0; 3 >= (stream + p); p += 2) { +- struct snd_usX2Y_substream *subs = usX2Y->subs[stream + p]; ++ struct snd_usx2y_substream *subs = usx2y->subs[stream + p]; + if (subs != NULL) { + struct urb *urb = subs->urb[u]; + if (usb_pipein(urb->pipe)) { + unsigned long pack; + if (0 == u) +- atomic_set(&subs->state, state_STARTING3); +- urb->dev = usX2Y->dev; ++ atomic_set(&subs->state, STATE_STARTING3); ++ urb->dev = usx2y->dev; + for (pack = 0; pack < nr_of_packs(); pack++) { + urb->iso_frame_desc[pack].offset = subs->maxpacksize * (pack + u * nr_of_packs()); + urb->iso_frame_desc[pack].length = subs->maxpacksize; +@@ -438,25 +438,25 @@ static int usX2Y_usbpcm_urbs_start(struct snd_usX2Y_substream *subs) + } else { + snd_printdd("%i\n", urb->start_frame); + if (u == 0) +- usX2Y->wait_iso_frame = urb->start_frame; ++ usx2y->wait_iso_frame = urb->start_frame; + } + urb->transfer_flags = 0; + } else { +- atomic_set(&subs->state, state_STARTING1); ++ atomic_set(&subs->state, STATE_STARTING1); + break; + } + } + } + } + err = 0; +- wait_event(usX2Y->prepare_wait_queue, NULL == usX2Y->prepare_subs); +- if (atomic_read(&subs->state) != state_PREPARED) ++ wait_event(usx2y->prepare_wait_queue, NULL == usx2y->prepare_subs); ++ if (atomic_read(&subs->state) != STATE_PREPARED) + err = -EPIPE; + + cleanup: + if (err) { +- usX2Y_subs_startup_finish(usX2Y); // Call it now +- usX2Y_clients_stop(usX2Y); // something is completely wroong > stop evrything ++ usx2y_subs_startup_finish(usx2y); // Call it now ++ usx2y_clients_stop(usx2y); // something is completely wroong > stop evrything + } + return err; + } +@@ -466,69 +466,69 @@ static int usX2Y_usbpcm_urbs_start(struct snd_usX2Y_substream *subs) + * + * set format and initialize urbs + */ +-static int snd_usX2Y_usbpcm_prepare(struct snd_pcm_substream *substream) ++static int snd_usx2y_usbpcm_prepare(struct snd_pcm_substream *substream) + { + struct snd_pcm_runtime *runtime = substream->runtime; +- struct snd_usX2Y_substream *subs = runtime->private_data; +- struct usX2Ydev *usX2Y = subs->usX2Y; +- struct snd_usX2Y_substream *capsubs = subs->usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE]; ++ struct snd_usx2y_substream *subs = runtime->private_data; ++ struct usx2ydev *usx2y = subs->usx2y; ++ struct snd_usx2y_substream *capsubs = subs->usx2y->subs[SNDRV_PCM_STREAM_CAPTURE]; + int err = 0; +- snd_printdd("snd_usX2Y_pcm_prepare(%p)\n", substream); ++ snd_printdd("snd_usx2y_pcm_prepare(%p)\n", substream); + +- if (NULL == usX2Y->hwdep_pcm_shm) { +- usX2Y->hwdep_pcm_shm = alloc_pages_exact(sizeof(struct snd_usX2Y_hwdep_pcm_shm), ++ if (NULL == usx2y->hwdep_pcm_shm) { ++ usx2y->hwdep_pcm_shm = alloc_pages_exact(sizeof(struct snd_usx2y_hwdep_pcm_shm), + GFP_KERNEL); +- if (!usX2Y->hwdep_pcm_shm) ++ if (!usx2y->hwdep_pcm_shm) + return -ENOMEM; +- memset(usX2Y->hwdep_pcm_shm, 0, sizeof(struct snd_usX2Y_hwdep_pcm_shm)); ++ memset(usx2y->hwdep_pcm_shm, 0, sizeof(struct snd_usx2y_hwdep_pcm_shm)); + } + +- mutex_lock(&usX2Y->pcm_mutex); +- usX2Y_subs_prepare(subs); ++ mutex_lock(&usx2y->pcm_mutex); ++ usx2y_subs_prepare(subs); + // Start hardware streams + // SyncStream first.... +- if (atomic_read(&capsubs->state) < state_PREPARED) { +- if (usX2Y->format != runtime->format) +- if ((err = usX2Y_format_set(usX2Y, runtime->format)) < 0) ++ if (atomic_read(&capsubs->state) < STATE_PREPARED) { ++ if (usx2y->format != runtime->format) ++ if ((err = usx2y_format_set(usx2y, runtime->format)) < 0) + goto up_prepare_mutex; +- if (usX2Y->rate != runtime->rate) +- if ((err = usX2Y_rate_set(usX2Y, runtime->rate)) < 0) ++ if (usx2y->rate != runtime->rate) ++ if ((err = usx2y_rate_set(usx2y, runtime->rate)) < 0) + goto up_prepare_mutex; + snd_printdd("starting capture pipe for %s\n", subs == capsubs ? + "self" : "playpipe"); +- if (0 > (err = usX2Y_usbpcm_urbs_start(capsubs))) ++ if (0 > (err = usx2y_usbpcm_urbs_start(capsubs))) + goto up_prepare_mutex; + } + + if (subs != capsubs) { +- usX2Y->hwdep_pcm_shm->playback_iso_start = -1; +- if (atomic_read(&subs->state) < state_PREPARED) { +- while (usX2Y_iso_frames_per_buffer(runtime, usX2Y) > +- usX2Y->hwdep_pcm_shm->captured_iso_frames) { ++ usx2y->hwdep_pcm_shm->playback_iso_start = -1; ++ if (atomic_read(&subs->state) < STATE_PREPARED) { ++ while (usx2y_iso_frames_per_buffer(runtime, usx2y) > ++ usx2y->hwdep_pcm_shm->captured_iso_frames) { + snd_printdd("Wait: iso_frames_per_buffer=%i," + "captured_iso_frames=%i\n", +- usX2Y_iso_frames_per_buffer(runtime, usX2Y), +- usX2Y->hwdep_pcm_shm->captured_iso_frames); ++ usx2y_iso_frames_per_buffer(runtime, usx2y), ++ usx2y->hwdep_pcm_shm->captured_iso_frames); + if (msleep_interruptible(10)) { + err = -ERESTARTSYS; + goto up_prepare_mutex; + } + } +- if (0 > (err = usX2Y_usbpcm_urbs_start(subs))) ++ if (0 > (err = usx2y_usbpcm_urbs_start(subs))) + goto up_prepare_mutex; + } + snd_printdd("Ready: iso_frames_per_buffer=%i,captured_iso_frames=%i\n", +- usX2Y_iso_frames_per_buffer(runtime, usX2Y), +- usX2Y->hwdep_pcm_shm->captured_iso_frames); ++ usx2y_iso_frames_per_buffer(runtime, usx2y), ++ usx2y->hwdep_pcm_shm->captured_iso_frames); + } else +- usX2Y->hwdep_pcm_shm->capture_iso_start = -1; ++ usx2y->hwdep_pcm_shm->capture_iso_start = -1; + + up_prepare_mutex: +- mutex_unlock(&usX2Y->pcm_mutex); ++ mutex_unlock(&usx2y->pcm_mutex); + return err; + } + +-static const struct snd_pcm_hardware snd_usX2Y_4c = ++static const struct snd_pcm_hardware snd_usx2y_4c = + { + .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | + SNDRV_PCM_INFO_BLOCK_TRANSFER | +@@ -549,17 +549,17 @@ static const struct snd_pcm_hardware snd_usX2Y_4c = + + + +-static int snd_usX2Y_usbpcm_open(struct snd_pcm_substream *substream) ++static int snd_usx2y_usbpcm_open(struct snd_pcm_substream *substream) + { +- struct snd_usX2Y_substream *subs = ((struct snd_usX2Y_substream **) ++ struct snd_usx2y_substream *subs = ((struct snd_usx2y_substream **) + snd_pcm_substream_chip(substream))[substream->stream]; + struct snd_pcm_runtime *runtime = substream->runtime; + +- if (!(subs->usX2Y->chip_status & USX2Y_STAT_CHIP_MMAP_PCM_URBS)) ++ if (!(subs->usx2y->chip_status & USX2Y_STAT_CHIP_MMAP_PCM_URBS)) + return -EBUSY; + +- runtime->hw = SNDRV_PCM_STREAM_PLAYBACK == substream->stream ? snd_usX2Y_2c : +- (subs->usX2Y->subs[3] ? snd_usX2Y_4c : snd_usX2Y_2c); ++ runtime->hw = SNDRV_PCM_STREAM_PLAYBACK == substream->stream ? snd_usx2y_2c : ++ (subs->usx2y->subs[3] ? snd_usx2y_4c : snd_usx2y_2c); + runtime->private_data = subs; + subs->pcm_substream = substream; + snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_TIME, 1000, 200000); +@@ -567,35 +567,35 @@ static int snd_usX2Y_usbpcm_open(struct snd_pcm_substream *substream) + } + + +-static int snd_usX2Y_usbpcm_close(struct snd_pcm_substream *substream) ++static int snd_usx2y_usbpcm_close(struct snd_pcm_substream *substream) + { + struct snd_pcm_runtime *runtime = substream->runtime; +- struct snd_usX2Y_substream *subs = runtime->private_data; ++ struct snd_usx2y_substream *subs = runtime->private_data; + + subs->pcm_substream = NULL; + return 0; + } + + +-static const struct snd_pcm_ops snd_usX2Y_usbpcm_ops = ++static const struct snd_pcm_ops snd_usx2y_usbpcm_ops = + { +- .open = snd_usX2Y_usbpcm_open, +- .close = snd_usX2Y_usbpcm_close, +- .hw_params = snd_usX2Y_pcm_hw_params, +- .hw_free = snd_usX2Y_usbpcm_hw_free, +- .prepare = snd_usX2Y_usbpcm_prepare, +- .trigger = snd_usX2Y_pcm_trigger, +- .pointer = snd_usX2Y_pcm_pointer, ++ .open = snd_usx2y_usbpcm_open, ++ .close = snd_usx2y_usbpcm_close, ++ .hw_params = snd_usx2y_pcm_hw_params, ++ .hw_free = snd_usx2y_usbpcm_hw_free, ++ .prepare = snd_usx2y_usbpcm_prepare, ++ .trigger = snd_usx2y_pcm_trigger, ++ .pointer = snd_usx2y_pcm_pointer, + }; + + +-static int usX2Y_pcms_busy_check(struct snd_card *card) ++static int usx2y_pcms_busy_check(struct snd_card *card) + { +- struct usX2Ydev *dev = usX2Y(card); ++ struct usx2ydev *dev = usx2y(card); + int i; + + for (i = 0; i < dev->pcm_devs * 2; i++) { +- struct snd_usX2Y_substream *subs = dev->subs[i]; ++ struct snd_usx2y_substream *subs = dev->subs[i]; + if (subs && subs->pcm_substream && + SUBSTREAM_BUSY(subs->pcm_substream)) + return -EBUSY; +@@ -603,102 +603,102 @@ static int usX2Y_pcms_busy_check(struct snd_card *card) + return 0; + } + +-static int snd_usX2Y_hwdep_pcm_open(struct snd_hwdep *hw, struct file *file) ++static int snd_usx2y_hwdep_pcm_open(struct snd_hwdep *hw, struct file *file) + { + struct snd_card *card = hw->card; + int err; + +- mutex_lock(&usX2Y(card)->pcm_mutex); +- err = usX2Y_pcms_busy_check(card); ++ mutex_lock(&usx2y(card)->pcm_mutex); ++ err = usx2y_pcms_busy_check(card); + if (!err) +- usX2Y(card)->chip_status |= USX2Y_STAT_CHIP_MMAP_PCM_URBS; +- mutex_unlock(&usX2Y(card)->pcm_mutex); ++ usx2y(card)->chip_status |= USX2Y_STAT_CHIP_MMAP_PCM_URBS; ++ mutex_unlock(&usx2y(card)->pcm_mutex); + return err; + } + + +-static int snd_usX2Y_hwdep_pcm_release(struct snd_hwdep *hw, struct file *file) ++static int snd_usx2y_hwdep_pcm_release(struct snd_hwdep *hw, struct file *file) + { + struct snd_card *card = hw->card; + int err; + +- mutex_lock(&usX2Y(card)->pcm_mutex); +- err = usX2Y_pcms_busy_check(card); ++ mutex_lock(&usx2y(card)->pcm_mutex); ++ err = usx2y_pcms_busy_check(card); + if (!err) +- usX2Y(hw->card)->chip_status &= ~USX2Y_STAT_CHIP_MMAP_PCM_URBS; +- mutex_unlock(&usX2Y(card)->pcm_mutex); ++ usx2y(hw->card)->chip_status &= ~USX2Y_STAT_CHIP_MMAP_PCM_URBS; ++ mutex_unlock(&usx2y(card)->pcm_mutex); + return err; + } + + +-static void snd_usX2Y_hwdep_pcm_vm_open(struct vm_area_struct *area) ++static void snd_usx2y_hwdep_pcm_vm_open(struct vm_area_struct *area) + { + } + + +-static void snd_usX2Y_hwdep_pcm_vm_close(struct vm_area_struct *area) ++static void snd_usx2y_hwdep_pcm_vm_close(struct vm_area_struct *area) + { + } + + +-static vm_fault_t snd_usX2Y_hwdep_pcm_vm_fault(struct vm_fault *vmf) ++static vm_fault_t snd_usx2y_hwdep_pcm_vm_fault(struct vm_fault *vmf) + { + unsigned long offset; + void *vaddr; + + offset = vmf->pgoff << PAGE_SHIFT; +- vaddr = (char *)((struct usX2Ydev *)vmf->vma->vm_private_data)->hwdep_pcm_shm + offset; ++ vaddr = (char *)((struct usx2ydev *)vmf->vma->vm_private_data)->hwdep_pcm_shm + offset; + vmf->page = virt_to_page(vaddr); + get_page(vmf->page); + return 0; + } + + +-static const struct vm_operations_struct snd_usX2Y_hwdep_pcm_vm_ops = { +- .open = snd_usX2Y_hwdep_pcm_vm_open, +- .close = snd_usX2Y_hwdep_pcm_vm_close, +- .fault = snd_usX2Y_hwdep_pcm_vm_fault, ++static const struct vm_operations_struct snd_usx2y_hwdep_pcm_vm_ops = { ++ .open = snd_usx2y_hwdep_pcm_vm_open, ++ .close = snd_usx2y_hwdep_pcm_vm_close, ++ .fault = snd_usx2y_hwdep_pcm_vm_fault, + }; + + +-static int snd_usX2Y_hwdep_pcm_mmap(struct snd_hwdep * hw, struct file *filp, struct vm_area_struct *area) ++static int snd_usx2y_hwdep_pcm_mmap(struct snd_hwdep * hw, struct file *filp, struct vm_area_struct *area) + { + unsigned long size = (unsigned long)(area->vm_end - area->vm_start); +- struct usX2Ydev *usX2Y = hw->private_data; ++ struct usx2ydev *usx2y = hw->private_data; + +- if (!(usX2Y->chip_status & USX2Y_STAT_CHIP_INIT)) ++ if (!(usx2y->chip_status & USX2Y_STAT_CHIP_INIT)) + return -EBUSY; + + /* if userspace tries to mmap beyond end of our buffer, fail */ +- if (size > PAGE_ALIGN(sizeof(struct snd_usX2Y_hwdep_pcm_shm))) { +- snd_printd("%lu > %lu\n", size, (unsigned long)sizeof(struct snd_usX2Y_hwdep_pcm_shm)); ++ if (size > PAGE_ALIGN(sizeof(struct snd_usx2y_hwdep_pcm_shm))) { ++ snd_printd("%lu > %lu\n", size, (unsigned long)sizeof(struct snd_usx2y_hwdep_pcm_shm)); + return -EINVAL; + } + +- if (!usX2Y->hwdep_pcm_shm) { ++ if (!usx2y->hwdep_pcm_shm) { + return -ENODEV; + } +- area->vm_ops = &snd_usX2Y_hwdep_pcm_vm_ops; ++ area->vm_ops = &snd_usx2y_hwdep_pcm_vm_ops; + area->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP; + area->vm_private_data = hw->private_data; + return 0; + } + + +-static void snd_usX2Y_hwdep_pcm_private_free(struct snd_hwdep *hwdep) ++static void snd_usx2y_hwdep_pcm_private_free(struct snd_hwdep *hwdep) + { +- struct usX2Ydev *usX2Y = hwdep->private_data; +- if (NULL != usX2Y->hwdep_pcm_shm) +- free_pages_exact(usX2Y->hwdep_pcm_shm, sizeof(struct snd_usX2Y_hwdep_pcm_shm)); ++ struct usx2ydev *usx2y = hwdep->private_data; ++ if (NULL != usx2y->hwdep_pcm_shm) ++ free_pages_exact(usx2y->hwdep_pcm_shm, sizeof(struct snd_usx2y_hwdep_pcm_shm)); + } + + +-int usX2Y_hwdep_pcm_new(struct snd_card *card) ++int usx2y_hwdep_pcm_new(struct snd_card *card) + { + int err; + struct snd_hwdep *hw; + struct snd_pcm *pcm; +- struct usb_device *dev = usX2Y(card)->dev; ++ struct usb_device *dev = usx2y(card)->dev; + if (1 != nr_of_packs()) + return 0; + +@@ -706,11 +706,11 @@ int usX2Y_hwdep_pcm_new(struct snd_card *card) + return err; + + hw->iface = SNDRV_HWDEP_IFACE_USX2Y_PCM; +- hw->private_data = usX2Y(card); +- hw->private_free = snd_usX2Y_hwdep_pcm_private_free; +- hw->ops.open = snd_usX2Y_hwdep_pcm_open; +- hw->ops.release = snd_usX2Y_hwdep_pcm_release; +- hw->ops.mmap = snd_usX2Y_hwdep_pcm_mmap; ++ hw->private_data = usx2y(card); ++ hw->private_free = snd_usx2y_hwdep_pcm_private_free; ++ hw->ops.open = snd_usx2y_hwdep_pcm_open; ++ hw->ops.release = snd_usx2y_hwdep_pcm_release; ++ hw->ops.mmap = snd_usx2y_hwdep_pcm_mmap; + hw->exclusive = 1; + sprintf(hw->name, "/dev/bus/usb/%03d/%03d/hwdeppcm", dev->bus->busnum, dev->devnum); + +@@ -718,10 +718,10 @@ int usX2Y_hwdep_pcm_new(struct snd_card *card) + if (err < 0) { + return err; + } +- snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_usX2Y_usbpcm_ops); +- snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_usX2Y_usbpcm_ops); ++ snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_usx2y_usbpcm_ops); ++ snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_usx2y_usbpcm_ops); + +- pcm->private_data = usX2Y(card)->subs; ++ pcm->private_data = usx2y(card)->subs; + pcm->info_flags = 0; + + sprintf(pcm->name, NAME_ALLCAPS" hwdep Audio"); +@@ -739,7 +739,7 @@ int usX2Y_hwdep_pcm_new(struct snd_card *card) + + #else + +-int usX2Y_hwdep_pcm_new(struct snd_card *card) ++int usx2y_hwdep_pcm_new(struct snd_card *card) + { + return 0; + } +diff --git a/sound/usb/usx2y/usx2yhwdeppcm.h b/sound/usb/usx2y/usx2yhwdeppcm.h +index eb5a46466f0e..731b1c5a3474 100644 +--- a/sound/usb/usx2y/usx2yhwdeppcm.h ++++ b/sound/usb/usx2y/usx2yhwdeppcm.h +@@ -4,7 +4,7 @@ + #define MAXSTRIDE 3 + + #define SSS (((MAXPACK*MAXBUFFERMS*MAXSTRIDE + 4096) / 4096) * 4096) +-struct snd_usX2Y_hwdep_pcm_shm { ++struct snd_usx2y_hwdep_pcm_shm { + char playback[SSS]; + char capture0x8[SSS]; + char capture0xA[SSS]; +@@ -20,4 +20,4 @@ struct snd_usX2Y_hwdep_pcm_shm { + int capture_iso_start; + }; + +-int usX2Y_hwdep_pcm_new(struct snd_card *card); ++int usx2y_hwdep_pcm_new(struct snd_card *card); +-- +2.30.2 + diff --git a/queue-5.13/alsa-usx2y-don-t-call-free_pages_exact-with-null-add.patch b/queue-5.13/alsa-usx2y-don-t-call-free_pages_exact-with-null-add.patch new file mode 100644 index 00000000000..feb65cecc7b --- /dev/null +++ b/queue-5.13/alsa-usx2y-don-t-call-free_pages_exact-with-null-add.patch @@ -0,0 +1,41 @@ +From bf62c8838e881d6fcf583a3546546026e3f6d313 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 17 May 2021 15:15:43 +0200 +Subject: ALSA: usx2y: Don't call free_pages_exact() with NULL address + +From: Takashi Iwai + +[ Upstream commit cae0cf651adccee2c3f376e78f30fbd788d0829f ] + +Unlike some other functions, we can't pass NULL pointer to +free_pages_exact(). Add a proper NULL check for avoiding possible +Oops. + +Link: https://lore.kernel.org/r/20210517131545.27252-10-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Sasha Levin +--- + sound/usb/usx2y/usb_stream.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/sound/usb/usx2y/usb_stream.c b/sound/usb/usx2y/usb_stream.c +index 091c071b270a..cff684942c4f 100644 +--- a/sound/usb/usx2y/usb_stream.c ++++ b/sound/usb/usx2y/usb_stream.c +@@ -142,8 +142,11 @@ void usb_stream_free(struct usb_stream_kernel *sk) + if (!s) + return; + +- free_pages_exact(sk->write_page, s->write_size); +- sk->write_page = NULL; ++ if (sk->write_page) { ++ free_pages_exact(sk->write_page, s->write_size); ++ sk->write_page = NULL; ++ } ++ + free_pages_exact(s, s->read_size); + sk->s = NULL; + } +-- +2.30.2 + diff --git a/queue-5.13/arch_topology-avoid-use-after-free-for-scale_freq_da.patch b/queue-5.13/arch_topology-avoid-use-after-free-for-scale_freq_da.patch new file mode 100644 index 00000000000..b72552471a2 --- /dev/null +++ b/queue-5.13/arch_topology-avoid-use-after-free-for-scale_freq_da.patch @@ -0,0 +1,117 @@ +From d083cd4cdeaccc6a4ce181ee8db39cecb501a54e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 15 Jun 2021 14:27:50 +0530 +Subject: arch_topology: Avoid use-after-free for scale_freq_data + +From: Viresh Kumar + +[ Upstream commit 83150f5d05f065fb5c12c612f119015cabdcc124 ] + +Currently topology_scale_freq_tick() (which gets called from +scheduler_tick()) may end up using a pointer to "struct +scale_freq_data", which was previously cleared by +topology_clear_scale_freq_source(), as there is no protection in place +here. The users of topology_clear_scale_freq_source() though needs a +guarantee that the previously cleared scale_freq_data isn't used +anymore, so they can free the related resources. + +Since topology_scale_freq_tick() is called from scheduler tick, we don't +want to add locking in there. Use the RCU update mechanism instead +(which is already used by the scheduler's utilization update path) to +guarantee race free updates here. + +synchronize_rcu() makes sure that all RCU critical sections that started +before it is called, will finish before it returns. And so the callers +of topology_clear_scale_freq_source() don't need to worry about their +callback getting called anymore. + +Cc: Paul E. McKenney +Fixes: 01e055c120a4 ("arch_topology: Allow multiple entities to provide sched_freq_tick() callback") +Tested-by: Vincent Guittot +Reviewed-by: Ionela Voinescu +Tested-by: Qian Cai +Signed-off-by: Viresh Kumar +Signed-off-by: Sasha Levin +--- + drivers/base/arch_topology.c | 27 +++++++++++++++++++++------ + 1 file changed, 21 insertions(+), 6 deletions(-) + +diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c +index c1179edc0f3b..921312a8d957 100644 +--- a/drivers/base/arch_topology.c ++++ b/drivers/base/arch_topology.c +@@ -18,10 +18,11 @@ + #include + #include + #include ++#include + #include + #include + +-static DEFINE_PER_CPU(struct scale_freq_data *, sft_data); ++static DEFINE_PER_CPU(struct scale_freq_data __rcu *, sft_data); + static struct cpumask scale_freq_counters_mask; + static bool scale_freq_invariant; + +@@ -66,16 +67,20 @@ void topology_set_scale_freq_source(struct scale_freq_data *data, + if (cpumask_empty(&scale_freq_counters_mask)) + scale_freq_invariant = topology_scale_freq_invariant(); + ++ rcu_read_lock(); ++ + for_each_cpu(cpu, cpus) { +- sfd = per_cpu(sft_data, cpu); ++ sfd = rcu_dereference(*per_cpu_ptr(&sft_data, cpu)); + + /* Use ARCH provided counters whenever possible */ + if (!sfd || sfd->source != SCALE_FREQ_SOURCE_ARCH) { +- per_cpu(sft_data, cpu) = data; ++ rcu_assign_pointer(per_cpu(sft_data, cpu), data); + cpumask_set_cpu(cpu, &scale_freq_counters_mask); + } + } + ++ rcu_read_unlock(); ++ + update_scale_freq_invariant(true); + } + EXPORT_SYMBOL_GPL(topology_set_scale_freq_source); +@@ -86,22 +91,32 @@ void topology_clear_scale_freq_source(enum scale_freq_source source, + struct scale_freq_data *sfd; + int cpu; + ++ rcu_read_lock(); ++ + for_each_cpu(cpu, cpus) { +- sfd = per_cpu(sft_data, cpu); ++ sfd = rcu_dereference(*per_cpu_ptr(&sft_data, cpu)); + + if (sfd && sfd->source == source) { +- per_cpu(sft_data, cpu) = NULL; ++ rcu_assign_pointer(per_cpu(sft_data, cpu), NULL); + cpumask_clear_cpu(cpu, &scale_freq_counters_mask); + } + } + ++ rcu_read_unlock(); ++ ++ /* ++ * Make sure all references to previous sft_data are dropped to avoid ++ * use-after-free races. ++ */ ++ synchronize_rcu(); ++ + update_scale_freq_invariant(false); + } + EXPORT_SYMBOL_GPL(topology_clear_scale_freq_source); + + void topology_scale_freq_tick(void) + { +- struct scale_freq_data *sfd = *this_cpu_ptr(&sft_data); ++ struct scale_freq_data *sfd = rcu_dereference_sched(*this_cpu_ptr(&sft_data)); + + if (sfd) + sfd->set_freq_scale(); +-- +2.30.2 + diff --git a/queue-5.13/arm-9087-1-kprobes-test-thumb-fix-for-llvm_ias-1.patch b/queue-5.13/arm-9087-1-kprobes-test-thumb-fix-for-llvm_ias-1.patch new file mode 100644 index 00000000000..4370b459aeb --- /dev/null +++ b/queue-5.13/arm-9087-1-kprobes-test-thumb-fix-for-llvm_ias-1.patch @@ -0,0 +1,71 @@ +From cf906c69be4db569b650bd60e97b2740eb927d2a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 1 Jun 2021 20:29:26 +0100 +Subject: ARM: 9087/1: kprobes: test-thumb: fix for LLVM_IAS=1 + +From: Nick Desaulniers + +[ Upstream commit 8b95a7d90ce8160ac5cffd5bace6e2eba01a871e ] + +There's a few instructions that GAS infers operands but Clang doesn't; +from what I can tell the Arm ARM doesn't say these are optional. + +F5.1.257 TBB, TBH T1 Halfword variant +F5.1.238 STREXD T1 variant +F5.1.84 LDREXD T1 variant + +Link: https://github.com/ClangBuiltLinux/linux/issues/1309 + +Signed-off-by: Nick Desaulniers +Reviewed-by: Jian Cai +Signed-off-by: Russell King +Signed-off-by: Sasha Levin +--- + arch/arm/probes/kprobes/test-thumb.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/arch/arm/probes/kprobes/test-thumb.c b/arch/arm/probes/kprobes/test-thumb.c +index 456c181a7bfe..4e11f0b760f8 100644 +--- a/arch/arm/probes/kprobes/test-thumb.c ++++ b/arch/arm/probes/kprobes/test-thumb.c +@@ -441,21 +441,21 @@ void kprobe_thumb32_test_cases(void) + "3: mvn r0, r0 \n\t" + "2: nop \n\t") + +- TEST_RX("tbh [pc, r",7, (9f-(1f+4))>>1,"]", ++ TEST_RX("tbh [pc, r",7, (9f-(1f+4))>>1,", lsl #1]", + "9: \n\t" + ".short (2f-1b-4)>>1 \n\t" + ".short (3f-1b-4)>>1 \n\t" + "3: mvn r0, r0 \n\t" + "2: nop \n\t") + +- TEST_RX("tbh [pc, r",12, ((9f-(1f+4))>>1)+1,"]", ++ TEST_RX("tbh [pc, r",12, ((9f-(1f+4))>>1)+1,", lsl #1]", + "9: \n\t" + ".short (2f-1b-4)>>1 \n\t" + ".short (3f-1b-4)>>1 \n\t" + "3: mvn r0, r0 \n\t" + "2: nop \n\t") + +- TEST_RRX("tbh [r",1,9f, ", r",14,1,"]", ++ TEST_RRX("tbh [r",1,9f, ", r",14,1,", lsl #1]", + "9: \n\t" + ".short (2f-1b-4)>>1 \n\t" + ".short (3f-1b-4)>>1 \n\t" +@@ -468,10 +468,10 @@ void kprobe_thumb32_test_cases(void) + + TEST_UNSUPPORTED("strexb r0, r1, [r2]") + TEST_UNSUPPORTED("strexh r0, r1, [r2]") +- TEST_UNSUPPORTED("strexd r0, r1, [r2]") ++ TEST_UNSUPPORTED("strexd r0, r1, r2, [r2]") + TEST_UNSUPPORTED("ldrexb r0, [r1]") + TEST_UNSUPPORTED("ldrexh r0, [r1]") +- TEST_UNSUPPORTED("ldrexd r0, [r1]") ++ TEST_UNSUPPORTED("ldrexd r0, r1, [r1]") + + TEST_GROUP("Data-processing (shifted register) and (modified immediate)") + +-- +2.30.2 + diff --git a/queue-5.13/arm-dts-am335x-align-ti-pindir-d0-out-d1-in-property.patch b/queue-5.13/arm-dts-am335x-align-ti-pindir-d0-out-d1-in-property.patch new file mode 100644 index 00000000000..6407a40853a --- /dev/null +++ b/queue-5.13/arm-dts-am335x-align-ti-pindir-d0-out-d1-in-property.patch @@ -0,0 +1,36 @@ +From 1a25aa0668b8d7d964e0c2da4c742cb81a781d61 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 8 Jun 2021 10:39:51 +0530 +Subject: ARM: dts: am335x: align ti,pindir-d0-out-d1-in property with dt-shema + +From: Aswath Govindraju + +[ Upstream commit 414bfe1d26b60ef20b58e36efd5363188a694bab ] + +ti,pindir-d0-out-d1-in property is expected to be of type boolean. +Therefore, fix the property accordingly. + +Fixes: 444d66fafab8 ("ARM: dts: add spi wifi support to cm-t335") +Signed-off-by: Aswath Govindraju +Signed-off-by: Tony Lindgren +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/am335x-cm-t335.dts | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/am335x-cm-t335.dts b/arch/arm/boot/dts/am335x-cm-t335.dts +index 36d963db4026..ec4730c82d39 100644 +--- a/arch/arm/boot/dts/am335x-cm-t335.dts ++++ b/arch/arm/boot/dts/am335x-cm-t335.dts +@@ -496,7 +496,7 @@ status = "okay"; + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&spi0_pins>; +- ti,pindir-d0-out-d1-in = <1>; ++ ti,pindir-d0-out-d1-in; + /* WLS1271 WiFi */ + wlcore: wlcore@1 { + compatible = "ti,wl1271"; +-- +2.30.2 + diff --git a/queue-5.13/arm-dts-am437x-align-ti-pindir-d0-out-d1-in-property.patch b/queue-5.13/arm-dts-am437x-align-ti-pindir-d0-out-d1-in-property.patch new file mode 100644 index 00000000000..f6d3528d5ea --- /dev/null +++ b/queue-5.13/arm-dts-am437x-align-ti-pindir-d0-out-d1-in-property.patch @@ -0,0 +1,45 @@ +From 8e66ad1d6adb71e3eaf24f87690af2632cf3ae27 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 8 Jun 2021 10:39:52 +0530 +Subject: ARM: dts: am437x: align ti,pindir-d0-out-d1-in property with dt-shema + +From: Aswath Govindraju + +[ Upstream commit 9b11fec7345f21995f4ea4bafb0e108b9a620238 ] + +ti,pindir-d0-out-d1-in property is expected to be of type boolean. +Therefore, fix the property accordingly. + +Fixes: b0b039515445 ("ARM: dts: am43x-epos-evm: set data pin directions for spi0 and spi1") +Signed-off-by: Aswath Govindraju +Signed-off-by: Tony Lindgren +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/am43x-epos-evm.dts | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/boot/dts/am43x-epos-evm.dts b/arch/arm/boot/dts/am43x-epos-evm.dts +index f517d1e843cf..8b696107eef8 100644 +--- a/arch/arm/boot/dts/am43x-epos-evm.dts ++++ b/arch/arm/boot/dts/am43x-epos-evm.dts +@@ -860,7 +860,7 @@ + pinctrl-names = "default", "sleep"; + pinctrl-0 = <&spi0_pins_default>; + pinctrl-1 = <&spi0_pins_sleep>; +- ti,pindir-d0-out-d1-in = <1>; ++ ti,pindir-d0-out-d1-in; + }; + + &spi1 { +@@ -868,7 +868,7 @@ + pinctrl-names = "default", "sleep"; + pinctrl-0 = <&spi1_pins_default>; + pinctrl-1 = <&spi1_pins_sleep>; +- ti,pindir-d0-out-d1-in = <1>; ++ ti,pindir-d0-out-d1-in; + }; + + &usb2_phy1 { +-- +2.30.2 + diff --git a/queue-5.13/arm-dts-bcm5301x-fixup-spi-binding.patch b/queue-5.13/arm-dts-bcm5301x-fixup-spi-binding.patch new file mode 100644 index 00000000000..ca7cb9656f0 --- /dev/null +++ b/queue-5.13/arm-dts-bcm5301x-fixup-spi-binding.patch @@ -0,0 +1,83 @@ +From a440747031e0e5c6f4a4d388dfc3fe49da69e8ab Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 12 May 2021 15:07:09 +0200 +Subject: ARM: dts: BCM5301X: Fixup SPI binding +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Rafał Miłecki + +[ Upstream commit d5aede3e6dd1b8ca574600a1ecafe1e580c53f2f ] + +1. Reorder interrupts +2. Fix typo: s/spi_lr_overhead/spi_lr_overread/ +3. Rename node: s/spi-nor@0/flash@0/ + +This fixes: +arch/arm/boot/dts/bcm4709-buffalo-wxr-1900dhp.dt.yaml: spi@18029200: interrupt-names: 'oneOf' conditional failed, one must be fixed: + ['spi_lr_fullness_reached', 'spi_lr_session_aborted', 'spi_lr_impatient', 'spi_lr_session_done', 'spi_lr_overhead', 'mspi_done', 'mspi_halted'] is too long + Additional items are not allowed ('spi_lr_session_aborted', 'spi_lr_impatient', 'spi_lr_session_done', 'spi_lr_overhead', 'mspi_done', 'mspi_halted' were unexpected) + 'mspi_done' was expected + 'spi_l1_intr' was expected + 'mspi_halted' was expected + 'spi_lr_fullness_reached' was expected + 'spi_lr_session_aborted' was expected + 'spi_lr_impatient' was expected + 'spi_lr_session_done' was expected + 'spi_lr_overread' was expected + From schema: Documentation/devicetree/bindings/spi/brcm,spi-bcm-qspi.yaml +arch/arm/boot/dts/bcm4709-buffalo-wxr-1900dhp.dt.yaml: spi-nor@0: $nodename:0: 'spi-nor@0' does not match '^flash(@.*)?$' + From schema: Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml + +Signed-off-by: Rafał Miłecki +Signed-off-by: Florian Fainelli +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/bcm5301x.dtsi | 18 +++++++++--------- + 1 file changed, 9 insertions(+), 9 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm5301x.dtsi b/arch/arm/boot/dts/bcm5301x.dtsi +index 7db72a2f1020..86872e12c355 100644 +--- a/arch/arm/boot/dts/bcm5301x.dtsi ++++ b/arch/arm/boot/dts/bcm5301x.dtsi +@@ -520,27 +520,27 @@ + <0x1811b408 0x004>, + <0x180293a0 0x01c>; + reg-names = "mspi", "bspi", "intr_regs", "intr_status_reg"; +- interrupts = , ++ interrupts = , ++ , ++ , + , + , + , +- , +- , +- ; +- interrupt-names = "spi_lr_fullness_reached", ++ ; ++ interrupt-names = "mspi_done", ++ "mspi_halted", ++ "spi_lr_fullness_reached", + "spi_lr_session_aborted", + "spi_lr_impatient", + "spi_lr_session_done", +- "spi_lr_overhead", +- "mspi_done", +- "mspi_halted"; ++ "spi_lr_overread"; + clocks = <&iprocmed>; + clock-names = "iprocmed"; + num-cs = <2>; + #address-cells = <1>; + #size-cells = <0>; + +- spi_nor: spi-nor@0 { ++ spi_nor: flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <20000000>; +-- +2.30.2 + diff --git a/queue-5.13/arm-dts-dra7-fix-duplicate-usb4-target-module-node.patch b/queue-5.13/arm-dts-dra7-fix-duplicate-usb4-target-module-node.patch new file mode 100644 index 00000000000..ffa9ab91d3b --- /dev/null +++ b/queue-5.13/arm-dts-dra7-fix-duplicate-usb4-target-module-node.patch @@ -0,0 +1,228 @@ +From c2c15a67ce4100909a9c25231914d11eb301c39c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 2 Jun 2021 17:04:58 -0500 +Subject: ARM: dts: dra7: Fix duplicate USB4 target module node + +From: Gowtham Tammana + +[ Upstream commit 78b4b165280d3d70e7a217599f0c06a4c0bb11f9 ] + +With [1] USB4 target-module node got defined in dra74x.dtsi file. +However, the earlier definition in [2] was not removed, and this +duplication of the target module is causing boot failure on dra74 +variant boards - dra7-evm, dra76-evm. + +USB4 is only present in DRA74x variants, so keeping the entry in +dra74x.dtsi and removing it from the top level interconnect hierarchy +dra7-l4.dtsi file. This change makes the USB4 target module no longer +visible to AM5718, DRA71x and DRA72x so removing references to it in +their respective dts files. + +[1]: commit c7b72abca61ec ("ARM: OMAP2+: Drop legacy platform data for +dra7 dwc3") +[2]: commit 549fce068a311 ("ARM: dts: dra7: Add l4 interconnect +hierarchy and ti-sysc data") + +Fixes: c7b72abca61ec ("ARM: OMAP2+: Drop legacy platform data for dra7 dwc3") +Signed-off-by: Gowtham Tammana +Reviewed-by: Grygorii Strashko +Signed-off-by: Tony Lindgren +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/am5718.dtsi | 6 +-- + arch/arm/boot/dts/dra7-l4.dtsi | 22 -------- + arch/arm/boot/dts/dra71x.dtsi | 4 -- + arch/arm/boot/dts/dra72x.dtsi | 4 -- + arch/arm/boot/dts/dra74x.dtsi | 92 ++++++++++++++++++---------------- + 5 files changed, 50 insertions(+), 78 deletions(-) + +diff --git a/arch/arm/boot/dts/am5718.dtsi b/arch/arm/boot/dts/am5718.dtsi +index ebf4d3cc1cfb..6d7530a48c73 100644 +--- a/arch/arm/boot/dts/am5718.dtsi ++++ b/arch/arm/boot/dts/am5718.dtsi +@@ -17,17 +17,13 @@ + * VCP1, VCP2 + * MLB + * ISS +- * USB3, USB4 ++ * USB3 + */ + + &usb3_tm { + status = "disabled"; + }; + +-&usb4_tm { +- status = "disabled"; +-}; +- + &atl_tm { + status = "disabled"; + }; +diff --git a/arch/arm/boot/dts/dra7-l4.dtsi b/arch/arm/boot/dts/dra7-l4.dtsi +index 149144cdff35..648d23f7f748 100644 +--- a/arch/arm/boot/dts/dra7-l4.dtsi ++++ b/arch/arm/boot/dts/dra7-l4.dtsi +@@ -4129,28 +4129,6 @@ + }; + }; + +- usb4_tm: target-module@140000 { /* 0x48940000, ap 75 3c.0 */ +- compatible = "ti,sysc-omap4", "ti,sysc"; +- reg = <0x140000 0x4>, +- <0x140010 0x4>; +- reg-names = "rev", "sysc"; +- ti,sysc-mask = ; +- ti,sysc-midle = , +- , +- , +- ; +- ti,sysc-sidle = , +- , +- , +- ; +- /* Domains (P, C): l3init_pwrdm, l3init_clkdm */ +- clocks = <&l3init_clkctrl DRA7_L3INIT_USB_OTG_SS4_CLKCTRL 0>; +- clock-names = "fck"; +- #address-cells = <1>; +- #size-cells = <1>; +- ranges = <0x0 0x140000 0x20000>; +- }; +- + target-module@170000 { /* 0x48970000, ap 21 0a.0 */ + compatible = "ti,sysc-omap4", "ti,sysc"; + reg = <0x170010 0x4>; +diff --git a/arch/arm/boot/dts/dra71x.dtsi b/arch/arm/boot/dts/dra71x.dtsi +index cad0e4a2bd8d..9c270d8f75d5 100644 +--- a/arch/arm/boot/dts/dra71x.dtsi ++++ b/arch/arm/boot/dts/dra71x.dtsi +@@ -11,7 +11,3 @@ + &rtctarget { + status = "disabled"; + }; +- +-&usb4_tm { +- status = "disabled"; +-}; +diff --git a/arch/arm/boot/dts/dra72x.dtsi b/arch/arm/boot/dts/dra72x.dtsi +index d403acc754b6..f3e934ef7d3e 100644 +--- a/arch/arm/boot/dts/dra72x.dtsi ++++ b/arch/arm/boot/dts/dra72x.dtsi +@@ -108,7 +108,3 @@ + &pcie2_rc { + compatible = "ti,dra726-pcie-rc", "ti,dra7-pcie"; + }; +- +-&usb4_tm { +- status = "disabled"; +-}; +diff --git a/arch/arm/boot/dts/dra74x.dtsi b/arch/arm/boot/dts/dra74x.dtsi +index e1850d6c841a..b4e07d99ffde 100644 +--- a/arch/arm/boot/dts/dra74x.dtsi ++++ b/arch/arm/boot/dts/dra74x.dtsi +@@ -49,49 +49,6 @@ + reg = <0x41500000 0x100>; + }; + +- target-module@48940000 { +- compatible = "ti,sysc-omap4", "ti,sysc"; +- reg = <0x48940000 0x4>, +- <0x48940010 0x4>; +- reg-names = "rev", "sysc"; +- ti,sysc-mask = ; +- ti,sysc-midle = , +- , +- , +- ; +- ti,sysc-sidle = , +- , +- , +- ; +- clocks = <&l3init_clkctrl DRA7_L3INIT_USB_OTG_SS4_CLKCTRL 0>; +- clock-names = "fck"; +- #address-cells = <1>; +- #size-cells = <1>; +- ranges = <0x0 0x48940000 0x20000>; +- +- omap_dwc3_4: omap_dwc3_4@0 { +- compatible = "ti,dwc3"; +- reg = <0 0x10000>; +- interrupts = ; +- #address-cells = <1>; +- #size-cells = <1>; +- utmi-mode = <2>; +- ranges; +- status = "disabled"; +- usb4: usb@10000 { +- compatible = "snps,dwc3"; +- reg = <0x10000 0x17000>; +- interrupts = , +- , +- ; +- interrupt-names = "peripheral", +- "host", +- "otg"; +- maximum-speed = "high-speed"; +- dr_mode = "otg"; +- }; +- }; +- }; + + target-module@41501000 { + compatible = "ti,sysc-omap2", "ti,sysc"; +@@ -224,3 +181,52 @@ + &pcie2_rc { + compatible = "ti,dra746-pcie-rc", "ti,dra7-pcie"; + }; ++ ++&l4_per3 { ++ segment@0 { ++ usb4_tm: target-module@140000 { /* 0x48940000, ap 75 3c.0 */ ++ compatible = "ti,sysc-omap4", "ti,sysc"; ++ reg = <0x140000 0x4>, ++ <0x140010 0x4>; ++ reg-names = "rev", "sysc"; ++ ti,sysc-mask = ; ++ ti,sysc-midle = , ++ , ++ , ++ ; ++ ti,sysc-sidle = , ++ , ++ , ++ ; ++ /* Domains (P, C): l3init_pwrdm, l3init_clkdm */ ++ clocks = <&l3init_clkctrl DRA7_L3INIT_USB_OTG_SS4_CLKCTRL 0>; ++ clock-names = "fck"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ranges = <0x0 0x140000 0x20000>; ++ ++ omap_dwc3_4: omap_dwc3_4@0 { ++ compatible = "ti,dwc3"; ++ reg = <0 0x10000>; ++ interrupts = ; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ utmi-mode = <2>; ++ ranges; ++ status = "disabled"; ++ usb4: usb@10000 { ++ compatible = "snps,dwc3"; ++ reg = <0x10000 0x17000>; ++ interrupts = , ++ , ++ ; ++ interrupt-names = "peripheral", ++ "host", ++ "otg"; ++ maximum-speed = "high-speed"; ++ dr_mode = "otg"; ++ }; ++ }; ++ }; ++ }; ++}; +-- +2.30.2 + diff --git a/queue-5.13/arm-dts-exynos-fix-pwm-led-max-brightness-on-odroid-.patch b/queue-5.13/arm-dts-exynos-fix-pwm-led-max-brightness-on-odroid-.patch new file mode 100644 index 00000000000..c84a360b339 --- /dev/null +++ b/queue-5.13/arm-dts-exynos-fix-pwm-led-max-brightness-on-odroid-.patch @@ -0,0 +1,47 @@ +From 7a731ead6a02f8d9905c0f61b6aba8ec9817bff6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 5 May 2021 09:59:39 -0400 +Subject: ARM: dts: exynos: fix PWM LED max brightness on Odroid XU/XU3 + +From: Krzysztof Kozlowski + +[ Upstream commit 75121e1dc9fe4def41e63d57f6a53749b88006ed ] + +There is no "max_brightness" property. This brings the intentional +brightness reduce of green LED and dtschema checks as well: + + arch/arm/boot/dts/exynos5410-odroidxu.dt.yaml: led-controller-1: led-1: 'max-brightness' is a required property + +Fixes: 719f39fec586 ("ARM: dts: exynos5422-odroidxu3: Hook up PWM and use it for LEDs") +Signed-off-by: Krzysztof Kozlowski +Link: https://lore.kernel.org/r/20210505135941.59898-3-krzysztof.kozlowski@canonical.com +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/exynos54xx-odroidxu-leds.dtsi | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/boot/dts/exynos54xx-odroidxu-leds.dtsi b/arch/arm/boot/dts/exynos54xx-odroidxu-leds.dtsi +index 2fc3e86dc5f7..982752e1df24 100644 +--- a/arch/arm/boot/dts/exynos54xx-odroidxu-leds.dtsi ++++ b/arch/arm/boot/dts/exynos54xx-odroidxu-leds.dtsi +@@ -22,7 +22,7 @@ + * Green LED is much brighter than the others + * so limit its max brightness + */ +- max_brightness = <127>; ++ max-brightness = <127>; + linux,default-trigger = "mmc0"; + }; + +@@ -30,7 +30,7 @@ + label = "blue:heartbeat"; + pwms = <&pwm 2 2000000 0>; + pwm-names = "pwm2"; +- max_brightness = <255>; ++ max-brightness = <255>; + linux,default-trigger = "heartbeat"; + }; + }; +-- +2.30.2 + diff --git a/queue-5.13/arm-dts-exynos-fix-pwm-led-max-brightness-on-odroid-.patch-1598 b/queue-5.13/arm-dts-exynos-fix-pwm-led-max-brightness-on-odroid-.patch-1598 new file mode 100644 index 00000000000..d9140c85bbd --- /dev/null +++ b/queue-5.13/arm-dts-exynos-fix-pwm-led-max-brightness-on-odroid-.patch-1598 @@ -0,0 +1,37 @@ +From ad6188f1c0dda62c0540e1d46f7e116c1a0d2035 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 5 May 2021 09:59:40 -0400 +Subject: ARM: dts: exynos: fix PWM LED max brightness on Odroid HC1 + +From: Krzysztof Kozlowski + +[ Upstream commit a7e59c84cf2055a1894f45855c8319191f2fa59e ] + +There is no "max_brightness" property as pointed out by dtschema: + + arch/arm/boot/dts/exynos5422-odroidhc1.dt.yaml: led-controller: led-1: 'max-brightness' is a required property + +Fixes: 1ac49427b566 ("ARM: dts: exynos: Add support for Hardkernel's Odroid HC1 board") +Signed-off-by: Krzysztof Kozlowski +Link: https://lore.kernel.org/r/20210505135941.59898-4-krzysztof.kozlowski@canonical.com +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/exynos5422-odroidhc1.dts | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/exynos5422-odroidhc1.dts b/arch/arm/boot/dts/exynos5422-odroidhc1.dts +index 20c222b33f98..d91f7fa2cf80 100644 +--- a/arch/arm/boot/dts/exynos5422-odroidhc1.dts ++++ b/arch/arm/boot/dts/exynos5422-odroidhc1.dts +@@ -22,7 +22,7 @@ + label = "blue:heartbeat"; + pwms = <&pwm 2 2000000 0>; + pwm-names = "pwm2"; +- max_brightness = <255>; ++ max-brightness = <255>; + linux,default-trigger = "heartbeat"; + }; + }; +-- +2.30.2 + diff --git a/queue-5.13/arm-dts-exynos-fix-pwm-led-max-brightness-on-odroid-.patch-24104 b/queue-5.13/arm-dts-exynos-fix-pwm-led-max-brightness-on-odroid-.patch-24104 new file mode 100644 index 00000000000..d25f3ec3f81 --- /dev/null +++ b/queue-5.13/arm-dts-exynos-fix-pwm-led-max-brightness-on-odroid-.patch-24104 @@ -0,0 +1,37 @@ +From 2fc164ea082bd32d180fb8a6cc4bba9d0c0c8dd1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 5 May 2021 09:59:41 -0400 +Subject: ARM: dts: exynos: fix PWM LED max brightness on Odroid XU4 + +From: Krzysztof Kozlowski + +[ Upstream commit fd2f1717966535b7d0b6fe45cf0d79e94330da5f ] + +There is no "max_brightness" property as pointed out by dtschema: + + arch/arm/boot/dts/exynos5422-odroidxu4.dt.yaml: led-controller: led-1: 'max-brightness' is a required property + +Fixes: 6658356014cb ("ARM: dts: Add support Odroid XU4 board for exynos5422-odroidxu4") +Signed-off-by: Krzysztof Kozlowski +Link: https://lore.kernel.org/r/20210505135941.59898-5-krzysztof.kozlowski@canonical.com +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/exynos5422-odroidxu4.dts | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/exynos5422-odroidxu4.dts b/arch/arm/boot/dts/exynos5422-odroidxu4.dts +index ede782257643..1c24f9b35973 100644 +--- a/arch/arm/boot/dts/exynos5422-odroidxu4.dts ++++ b/arch/arm/boot/dts/exynos5422-odroidxu4.dts +@@ -24,7 +24,7 @@ + label = "blue:heartbeat"; + pwms = <&pwm 2 2000000 0>; + pwm-names = "pwm2"; +- max_brightness = <255>; ++ max-brightness = <255>; + linux,default-trigger = "heartbeat"; + }; + }; +-- +2.30.2 + diff --git a/queue-5.13/arm-dts-gemini-rut1xx-remove-duplicate-ethernet-node.patch b/queue-5.13/arm-dts-gemini-rut1xx-remove-duplicate-ethernet-node.patch new file mode 100644 index 00000000000..acaacfd633e --- /dev/null +++ b/queue-5.13/arm-dts-gemini-rut1xx-remove-duplicate-ethernet-node.patch @@ -0,0 +1,49 @@ +From 34bdd82c7869b856a7ad377920e696505f2719e7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 28 Apr 2021 18:54:57 +0000 +Subject: ARM: dts: gemini-rut1xx: remove duplicate ethernet node + +From: Corentin Labbe + +[ Upstream commit 3d3bb3d27cd371d3edb43eeb1beb8ae4e92a356d ] + +Two ethernet node was added by +commit 95220046a62c ("ARM: dts: Add ethernet to a bunch of platforms") +and commit d6d0cef55e5b ("ARM: dts: Add the FOTG210 USB host to Gemini boards") + +This patch removes the duplicate one. + +Fixes: d6d0cef55e5b ("ARM: dts: Add the FOTG210 USB host to Gemini boards") +Signed-off-by: Corentin Labbe +Signed-off-by: Linus Walleij +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/gemini-rut1xx.dts | 12 ------------ + 1 file changed, 12 deletions(-) + +diff --git a/arch/arm/boot/dts/gemini-rut1xx.dts b/arch/arm/boot/dts/gemini-rut1xx.dts +index 9611ddf06792..08091d2a64e1 100644 +--- a/arch/arm/boot/dts/gemini-rut1xx.dts ++++ b/arch/arm/boot/dts/gemini-rut1xx.dts +@@ -125,18 +125,6 @@ + }; + }; + +- ethernet@60000000 { +- status = "okay"; +- +- ethernet-port@0 { +- phy-mode = "rgmii"; +- phy-handle = <&phy0>; +- }; +- ethernet-port@1 { +- /* Not used in this platform */ +- }; +- }; +- + usb@68000000 { + status = "okay"; + }; +-- +2.30.2 + diff --git a/queue-5.13/arm-dts-imx6q-dhcom-add-gpios-pinctrl-for-i2c-bus-re.patch b/queue-5.13/arm-dts-imx6q-dhcom-add-gpios-pinctrl-for-i2c-bus-re.patch new file mode 100644 index 00000000000..2acaaa83c09 --- /dev/null +++ b/queue-5.13/arm-dts-imx6q-dhcom-add-gpios-pinctrl-for-i2c-bus-re.patch @@ -0,0 +1,111 @@ +From 240f9486f841e6e52c0307fd5c46886549f7b478 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 26 May 2021 12:54:00 +0200 +Subject: ARM: dts: imx6q-dhcom: Add gpios pinctrl for i2c bus recovery + +From: Christoph Niedermaier + +[ Upstream commit ddc873cd3c0af4faad6a00bffda21c3f775126dd ] + +The i2c bus can freeze at the end of transaction so the bus can no longer work. +This scenario is improved by adding scl/sda gpios definitions to implement the +i2c bus recovery mechanism. + +Fixes: 52c7a088badd ("ARM: dts: imx6q: Add support for the DHCOM iMX6 SoM and PDK2") +Signed-off-by: Christoph Niedermaier +Cc: Shawn Guo +Cc: Fabio Estevam +Cc: Marek Vasut +Cc: NXP Linux Team +Cc: kernel@dh-electronics.com +To: linux-arm-kernel@lists.infradead.org +Signed-off-by: Shawn Guo +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/imx6q-dhcom-som.dtsi | 36 +++++++++++++++++++++++--- + 1 file changed, 33 insertions(+), 3 deletions(-) + +diff --git a/arch/arm/boot/dts/imx6q-dhcom-som.dtsi b/arch/arm/boot/dts/imx6q-dhcom-som.dtsi +index 6043be73a1a8..e3de2b487cf4 100644 +--- a/arch/arm/boot/dts/imx6q-dhcom-som.dtsi ++++ b/arch/arm/boot/dts/imx6q-dhcom-som.dtsi +@@ -105,22 +105,31 @@ + + &i2c1 { + clock-frequency = <100000>; +- pinctrl-names = "default"; ++ pinctrl-names = "default", "gpio"; + pinctrl-0 = <&pinctrl_i2c1>; ++ pinctrl-1 = <&pinctrl_i2c1_gpio>; ++ scl-gpios = <&gpio3 21 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; ++ sda-gpios = <&gpio3 28 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + status = "okay"; + }; + + &i2c2 { + clock-frequency = <100000>; +- pinctrl-names = "default"; ++ pinctrl-names = "default", "gpio"; + pinctrl-0 = <&pinctrl_i2c2>; ++ pinctrl-1 = <&pinctrl_i2c2_gpio>; ++ scl-gpios = <&gpio4 12 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; ++ sda-gpios = <&gpio4 13 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + status = "okay"; + }; + + &i2c3 { + clock-frequency = <100000>; +- pinctrl-names = "default"; ++ pinctrl-names = "default", "gpio"; + pinctrl-0 = <&pinctrl_i2c3>; ++ pinctrl-1 = <&pinctrl_i2c3_gpio>; ++ scl-gpios = <&gpio1 3 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; ++ sda-gpios = <&gpio1 6 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + status = "okay"; + + ltc3676: pmic@3c { +@@ -286,6 +295,13 @@ + >; + }; + ++ pinctrl_i2c1_gpio: i2c1-gpio-grp { ++ fsl,pins = < ++ MX6QDL_PAD_EIM_D21__GPIO3_IO21 0x4001b8b1 ++ MX6QDL_PAD_EIM_D28__GPIO3_IO28 0x4001b8b1 ++ >; ++ }; ++ + pinctrl_i2c2: i2c2-grp { + fsl,pins = < + MX6QDL_PAD_KEY_COL3__I2C2_SCL 0x4001b8b1 +@@ -293,6 +309,13 @@ + >; + }; + ++ pinctrl_i2c2_gpio: i2c2-gpio-grp { ++ fsl,pins = < ++ MX6QDL_PAD_KEY_COL3__GPIO4_IO12 0x4001b8b1 ++ MX6QDL_PAD_KEY_ROW3__GPIO4_IO13 0x4001b8b1 ++ >; ++ }; ++ + pinctrl_i2c3: i2c3-grp { + fsl,pins = < + MX6QDL_PAD_GPIO_3__I2C3_SCL 0x4001b8b1 +@@ -300,6 +323,13 @@ + >; + }; + ++ pinctrl_i2c3_gpio: i2c3-gpio-grp { ++ fsl,pins = < ++ MX6QDL_PAD_GPIO_3__GPIO1_IO03 0x4001b8b1 ++ MX6QDL_PAD_GPIO_6__GPIO1_IO06 0x4001b8b1 ++ >; ++ }; ++ + pinctrl_pmic_hw300: pmic-hw300-grp { + fsl,pins = < + MX6QDL_PAD_EIM_A25__GPIO5_IO02 0x1B0B0 +-- +2.30.2 + diff --git a/queue-5.13/arm-dts-imx6q-dhcom-fix-ethernet-plugin-detection-pr.patch b/queue-5.13/arm-dts-imx6q-dhcom-fix-ethernet-plugin-detection-pr.patch new file mode 100644 index 00000000000..1cdec062804 --- /dev/null +++ b/queue-5.13/arm-dts-imx6q-dhcom-fix-ethernet-plugin-detection-pr.patch @@ -0,0 +1,41 @@ +From 360abe5f5f87d4383c9d9d5a0e79aa6a8090b448 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 26 May 2021 12:53:59 +0200 +Subject: ARM: dts: imx6q-dhcom: Fix ethernet plugin detection problems + +From: Christoph Niedermaier + +[ Upstream commit e2bdd3484890441b9cc2560413a86e8f2aa04157 ] + +To make the ethernet cable plugin detection reliable the +power detection of the smsc phy has been disabled. + +Fixes: 52c7a088badd ("ARM: dts: imx6q: Add support for the DHCOM iMX6 SoM and PDK2") +Signed-off-by: Christoph Niedermaier +Cc: Shawn Guo +Cc: Fabio Estevam +Cc: Marek Vasut +Cc: NXP Linux Team +Cc: kernel@dh-electronics.com +To: linux-arm-kernel@lists.infradead.org +Signed-off-by: Shawn Guo +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/imx6q-dhcom-som.dtsi | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/arm/boot/dts/imx6q-dhcom-som.dtsi b/arch/arm/boot/dts/imx6q-dhcom-som.dtsi +index 921a277fc3b0..6043be73a1a8 100644 +--- a/arch/arm/boot/dts/imx6q-dhcom-som.dtsi ++++ b/arch/arm/boot/dts/imx6q-dhcom-som.dtsi +@@ -98,6 +98,7 @@ + reset-gpios = <&gpio5 0 GPIO_ACTIVE_LOW>; + reset-assert-us = <1000>; + reset-deassert-us = <1000>; ++ smsc,disable-energy-detect; /* Make plugin detection reliable */ + }; + }; + }; +-- +2.30.2 + diff --git a/queue-5.13/arm-dts-imx6q-dhcom-fix-ethernet-reset-time-properti.patch b/queue-5.13/arm-dts-imx6q-dhcom-fix-ethernet-reset-time-properti.patch new file mode 100644 index 00000000000..51ff4d9ea36 --- /dev/null +++ b/queue-5.13/arm-dts-imx6q-dhcom-fix-ethernet-reset-time-properti.patch @@ -0,0 +1,44 @@ +From 2152db7038dab7698ccde23f6c1bed4ce9e63f59 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 26 May 2021 12:53:58 +0200 +Subject: ARM: dts: imx6q-dhcom: Fix ethernet reset time properties + +From: Christoph Niedermaier + +[ Upstream commit c016c26c1631f539c652b5d82242a3ca402545c1 ] + +Fix ethernet reset time properties as described in +Documentation/devicetree/bindings/net/ethernet-phy.yaml + +Fixes: 52c7a088badd ("ARM: dts: imx6q: Add support for the DHCOM iMX6 SoM and PDK2") +Signed-off-by: Christoph Niedermaier +Cc: Shawn Guo +Cc: Fabio Estevam +Cc: Marek Vasut +Cc: NXP Linux Team +Cc: kernel@dh-electronics.com +To: linux-arm-kernel@lists.infradead.org +Signed-off-by: Shawn Guo +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/imx6q-dhcom-som.dtsi | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/boot/dts/imx6q-dhcom-som.dtsi b/arch/arm/boot/dts/imx6q-dhcom-som.dtsi +index d0768ae429fa..921a277fc3b0 100644 +--- a/arch/arm/boot/dts/imx6q-dhcom-som.dtsi ++++ b/arch/arm/boot/dts/imx6q-dhcom-som.dtsi +@@ -96,8 +96,8 @@ + reg = <0>; + max-speed = <100>; + reset-gpios = <&gpio5 0 GPIO_ACTIVE_LOW>; +- reset-delay-us = <1000>; +- reset-post-delay-us = <1000>; ++ reset-assert-us = <1000>; ++ reset-deassert-us = <1000>; + }; + }; + }; +-- +2.30.2 + diff --git a/queue-5.13/arm-dts-qcom-sdx55-t55-represent-secure-regions-as-6.patch b/queue-5.13/arm-dts-qcom-sdx55-t55-represent-secure-regions-as-6.patch new file mode 100644 index 00000000000..c287cecfa6a --- /dev/null +++ b/queue-5.13/arm-dts-qcom-sdx55-t55-represent-secure-regions-as-6.patch @@ -0,0 +1,39 @@ +From 6f274036db06183f950dfd59e66dbcf2b6c29550 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 12 May 2021 10:31:40 +0530 +Subject: ARM: dts: qcom: sdx55-t55: Represent secure-regions as 64-bit + elements + +From: Manivannan Sadhasivam + +[ Upstream commit 619d3c4bf8f346ac9192d3c266efc9e231ca5d17 ] + +The corresponding MTD code expects the regions to be of 64-bit elements. +Hence, prefix "/bits/ 64", otherwise the regions will not be parsed +correctly. + +Fixes: 3263d4be5788 ("ARM: dts: qcom: sdx55: Add basic devicetree support for Thundercomm T55") +Signed-off-by: Manivannan Sadhasivam +Link: https://lore.kernel.org/r/20210512050141.43338-1-manivannan.sadhasivam@linaro.org +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/qcom-sdx55-t55.dts | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/qcom-sdx55-t55.dts b/arch/arm/boot/dts/qcom-sdx55-t55.dts +index ddcd53aa533d..2ffcd085904d 100644 +--- a/arch/arm/boot/dts/qcom-sdx55-t55.dts ++++ b/arch/arm/boot/dts/qcom-sdx55-t55.dts +@@ -250,7 +250,7 @@ + nand-ecc-step-size = <512>; + nand-bus-width = <8>; + /* efs2 partition is secured */ +- secure-regions = <0x500000 0xb00000>; ++ secure-regions = /bits/ 64 <0x500000 0xb00000>; + }; + }; + +-- +2.30.2 + diff --git a/queue-5.13/arm-dts-qcom-sdx55-telit-represent-secure-regions-as.patch b/queue-5.13/arm-dts-qcom-sdx55-telit-represent-secure-regions-as.patch new file mode 100644 index 00000000000..dfcf82178b1 --- /dev/null +++ b/queue-5.13/arm-dts-qcom-sdx55-telit-represent-secure-regions-as.patch @@ -0,0 +1,41 @@ +From 88656e306cc81bde2193228c75b11063111f0bc1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 12 May 2021 10:31:41 +0530 +Subject: ARM: dts: qcom: sdx55-telit: Represent secure-regions as 64-bit + elements + +From: Manivannan Sadhasivam + +[ Upstream commit 0fa1baeedf06765ec6b441692ba2a2e83b7d17dc ] + +The corresponding MTD code expects the regions to be of 64-bit elements. +Hence, prefix "/bits/ 64", otherwise the regions will not be parsed +correctly. + +Fixes: 6a5d3c611930 ("ARM: dts: qcom: sdx55: Add basic devicetree support for Telit FN980 TLB") +Signed-off-by: Manivannan Sadhasivam +Link: https://lore.kernel.org/r/20210512050141.43338-2-manivannan.sadhasivam@linaro.org +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/qcom-sdx55-telit-fn980-tlb.dts | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/boot/dts/qcom-sdx55-telit-fn980-tlb.dts b/arch/arm/boot/dts/qcom-sdx55-telit-fn980-tlb.dts +index 3065f84634b8..80c40da79604 100644 +--- a/arch/arm/boot/dts/qcom-sdx55-telit-fn980-tlb.dts ++++ b/arch/arm/boot/dts/qcom-sdx55-telit-fn980-tlb.dts +@@ -250,8 +250,8 @@ + nand-ecc-step-size = <512>; + nand-bus-width = <8>; + /* ico and efs2 partitions are secured */ +- secure-regions = <0x500000 0x500000 +- 0xa00000 0xb00000>; ++ secure-regions = /bits/ 64 <0x500000 0x500000 ++ 0xa00000 0xb00000>; + }; + }; + +-- +2.30.2 + diff --git a/queue-5.13/arm-dts-r8a7779-marzen-fix-du-clock-names.patch b/queue-5.13/arm-dts-r8a7779-marzen-fix-du-clock-names.patch new file mode 100644 index 00000000000..f2bb7acecec --- /dev/null +++ b/queue-5.13/arm-dts-r8a7779-marzen-fix-du-clock-names.patch @@ -0,0 +1,56 @@ +From a5fd097b7897504ba51f1f25563a896ff53dcdf1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 29 Apr 2021 14:41:15 +0200 +Subject: ARM: dts: r8a7779, marzen: Fix DU clock names + +From: Geert Uytterhoeven + +[ Upstream commit 6ab8c23096a29b69044209a5925758a6f88bd450 ] + +"make dtbs_check" complains: + + arch/arm/boot/dts/r8a7779-marzen.dt.yaml: display@fff80000: clock-names:0: 'du.0' was expected + +Change the first clock name to match the DT bindings. +This has no effect on actual operation, as the Display Unit driver in +Linux does not use the first clock name on R-Car H1, but just grabs the +first clock. + +Fixes: 665d79aa47cb3983 ("ARM: shmobile: marzen: Add DU external pixel clock to DT") +Signed-off-by: Geert Uytterhoeven +Reviewed-by: Laurent Pinchart +Link: https://lore.kernel.org/r/9d5e1b371121883b3b3e10a3df43802a29c6a9da.1619699965.git.geert+renesas@glider.be +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/r8a7779-marzen.dts | 2 +- + arch/arm/boot/dts/r8a7779.dtsi | 1 + + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/r8a7779-marzen.dts b/arch/arm/boot/dts/r8a7779-marzen.dts +index d2240b89ee52..465845323495 100644 +--- a/arch/arm/boot/dts/r8a7779-marzen.dts ++++ b/arch/arm/boot/dts/r8a7779-marzen.dts +@@ -145,7 +145,7 @@ + status = "okay"; + + clocks = <&mstp1_clks R8A7779_CLK_DU>, <&x3_clk>; +- clock-names = "du", "dclkin.0"; ++ clock-names = "du.0", "dclkin.0"; + + ports { + port@0 { +diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi +index 74d7e9084eab..3c5fcdfe16b8 100644 +--- a/arch/arm/boot/dts/r8a7779.dtsi ++++ b/arch/arm/boot/dts/r8a7779.dtsi +@@ -463,6 +463,7 @@ + reg = <0xfff80000 0x40000>; + interrupts = ; + clocks = <&mstp1_clks R8A7779_CLK_DU>; ++ clock-names = "du.0"; + power-domains = <&sysc R8A7779_PD_ALWAYS_ON>; + status = "disabled"; + +-- +2.30.2 + diff --git a/queue-5.13/arm-dts-stm32-rework-lan8710ai-phy-reset-on-dhcom-so.patch b/queue-5.13/arm-dts-stm32-rework-lan8710ai-phy-reset-on-dhcom-so.patch new file mode 100644 index 00000000000..70f7956a491 --- /dev/null +++ b/queue-5.13/arm-dts-stm32-rework-lan8710ai-phy-reset-on-dhcom-so.patch @@ -0,0 +1,82 @@ +From 33b7f599f40ea49878b18bba2527b4b6b5777fab Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 9 Apr 2021 01:00:01 +0200 +Subject: ARM: dts: stm32: Rework LAN8710Ai PHY reset on DHCOM SoM + +From: Marek Vasut + +[ Upstream commit 1cebcf9932ab76102e8cfc555879574693ba8956 ] + +The Microchip LAN8710Ai PHY requires XTAL1/CLKIN external clock to be +enabled when the nRST is toggled according to datasheet Microchip +LAN8710A/LAN8710Ai DS00002164B page 35 section 3.8.5.1 Hardware Reset: + " + A Hardware reset is asserted by driving the nRST input pin low. When + driven, nRST should be held low for the minimum time detailed in + Section 5.5.3, "Power-On nRST & Configuration Strap Timing," on page + 59 to ensure a proper transceiver reset. During a Hardware reset, an + external clock must be supplied to the XTAL1/CLKIN signal. + " +This is accidentally fulfilled in the current setup, where ETHCK_K is used +to supply both PHY XTAL1/CLKIN and is also fed back through eth_clk_fb to +supply ETHRX clock of the DWMAC. Hence, the DWMAC enables ETHRX clock, +that has ETHCK_K as parent, so ETHCK_K clock are also enabled, and then +the PHY reset toggles. + +However, this is not always the case, e.g. in case the PHY XTAL1/CLKIN +clock are supplied by some other clock source than ETHCK_K or in case +ETHRX clock are not supplied by ETHCK_K. In the later case, ETHCK_K would +be kept disabled, while ETHRX clock would be enabled, so the PHY would +not be receiving XTAL1/CLKIN clock and the reset would fail. + +Improve the DT by adding the PHY clock phandle into the PHY node, which +then also requires moving the PHY reset GPIO specifier in the same place +and that then also requires correct PHY reset GPIO timing, so add that +too. + +A brief note regarding the timing, the datasheet says the reset should +stay asserted for at least 100uS and software should wait at least 200nS +after deassertion. Set both delays to 500uS which should be plenty. + +Fixes: 34e0c7847dcf ("ARM: dts: stm32: Add DH Electronics DHCOM STM32MP1 SoM and PDK2 board") +Signed-off-by: Marek Vasut +Cc: Alexandre Torgue +Cc: Patrice Chotard +Cc: Patrick Delaunay +Cc: linux-stm32@st-md-mailman.stormreply.com +To: linux-arm-kernel@lists.infradead.org +Signed-off-by: Alexandre Torgue +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi b/arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi +index 272a1a67a9ad..31d08423a32f 100644 +--- a/arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi ++++ b/arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi +@@ -123,7 +123,6 @@ + max-speed = <100>; + phy-handle = <&phy0>; + st,eth-ref-clk-sel; +- phy-reset-gpios = <&gpioh 3 GPIO_ACTIVE_LOW>; + + mdio0 { + #address-cells = <1>; +@@ -132,6 +131,13 @@ + + phy0: ethernet-phy@1 { + reg = <1>; ++ /* LAN8710Ai */ ++ compatible = "ethernet-phy-id0007.c0f0", ++ "ethernet-phy-ieee802.3-c22"; ++ clocks = <&rcc ETHCK_K>; ++ reset-gpios = <&gpioh 3 GPIO_ACTIVE_LOW>; ++ reset-assert-us = <500>; ++ reset-deassert-us = <500>; + interrupt-parent = <&gpioi>; + interrupts = <11 IRQ_TYPE_LEVEL_LOW>; + }; +-- +2.30.2 + diff --git a/queue-5.13/arm-dts-sun8i-h3-orangepi-plus-fix-ethernet-phy-mode.patch b/queue-5.13/arm-dts-sun8i-h3-orangepi-plus-fix-ethernet-phy-mode.patch new file mode 100644 index 00000000000..47ed100635d --- /dev/null +++ b/queue-5.13/arm-dts-sun8i-h3-orangepi-plus-fix-ethernet-phy-mode.patch @@ -0,0 +1,46 @@ +From 125dc51a8f5e8d6e34b754704f0350d86da6f599 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 24 May 2021 14:21:11 +0200 +Subject: ARM: dts: sun8i: h3: orangepi-plus: Fix ethernet phy-mode + +From: Salvatore Bonaccorso + +[ Upstream commit b19d3479f25e8a0ff24df0b46c82e50ef0f900dd ] + +Commit bbc4d71d6354 ("net: phy: realtek: fix rtl8211e rx/tx delay +config") sets the RX/TX delay according to the phy-mode property in the +device tree. For the Orange Pi Plus board this is "rgmii", which is the +wrong setting. + +Following the example of a900cac3750b ("ARM: dts: sun7i: a20: bananapro: +Fix ethernet phy-mode") the phy-mode is changed to "rgmii-id" which gets +the Ethernet working again on this board. + +Fixes: bbc4d71d6354 ("net: phy: realtek: fix rtl8211e rx/tx delay config") +Reported-by: "B.R. Oake" +Reported-by: Vagrant Cascadian +Link: https://bugs.debian.org/988574 +Signed-off-by: Salvatore Bonaccorso +Signed-off-by: Maxime Ripard +Link: https://lore.kernel.org/r/20210524122111.416885-1-carnil@debian.org +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts b/arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts +index 97f497854e05..d05fa679dcd3 100644 +--- a/arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts ++++ b/arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts +@@ -85,7 +85,7 @@ + pinctrl-0 = <&emac_rgmii_pins>; + phy-supply = <®_gmac_3v3>; + phy-handle = <&ext_rgmii_phy>; +- phy-mode = "rgmii"; ++ phy-mode = "rgmii-id"; + + status = "okay"; + }; +-- +2.30.2 + diff --git a/queue-5.13/arm-exynos-add-missing-of_node_put-for-loop-iteratio.patch b/queue-5.13/arm-exynos-add-missing-of_node_put-for-loop-iteratio.patch new file mode 100644 index 00000000000..153b5bc9563 --- /dev/null +++ b/queue-5.13/arm-exynos-add-missing-of_node_put-for-loop-iteratio.patch @@ -0,0 +1,47 @@ +From 2e31a710f530dd804d069f3892e6a97bbc38e32e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 25 Apr 2021 19:49:45 +0200 +Subject: ARM: exynos: add missing of_node_put for loop iteration + +From: Krzysztof Kozlowski + +[ Upstream commit 48d551bf20858240f38a0276be3016ff379918ac ] + +Early exits from for_each_compatible_node() should decrement the +node reference counter. Reported by Coccinelle: + + arch/arm/mach-exynos/exynos.c:52:1-25: WARNING: + Function "for_each_compatible_node" should have of_node_put() before break around line 58. + +Fixes: b3205dea8fbf ("ARM: EXYNOS: Map SYSRAM through generic DT bindings") +Signed-off-by: Krzysztof Kozlowski +Acked-by: Arnd Bergmann +Link: https://lore.kernel.org/r/20210425174945.164612-1-krzysztof.kozlowski@canonical.com +Signed-off-by: Sasha Levin +--- + arch/arm/mach-exynos/exynos.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c +index 25b01da4771b..8b48326be9fd 100644 +--- a/arch/arm/mach-exynos/exynos.c ++++ b/arch/arm/mach-exynos/exynos.c +@@ -55,6 +55,7 @@ void __init exynos_sysram_init(void) + sysram_base_addr = of_iomap(node, 0); + sysram_base_phys = of_translate_address(node, + of_get_address(node, 0, NULL, NULL)); ++ of_node_put(node); + break; + } + +@@ -62,6 +63,7 @@ void __init exynos_sysram_init(void) + if (!of_device_is_available(node)) + continue; + sysram_ns_base_addr = of_iomap(node, 0); ++ of_node_put(node); + break; + } + } +-- +2.30.2 + diff --git a/queue-5.13/arm64-defconfig-do-not-override-the-mtk_pmic_wrap-sy.patch b/queue-5.13/arm64-defconfig-do-not-override-the-mtk_pmic_wrap-sy.patch new file mode 100644 index 00000000000..3ce8a038a18 --- /dev/null +++ b/queue-5.13/arm64-defconfig-do-not-override-the-mtk_pmic_wrap-sy.patch @@ -0,0 +1,43 @@ +From 513e7eb8da74cf1f9b1f32e8d255ae0e37478e1b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 23 Apr 2021 09:52:01 +0200 +Subject: arm64: defconfig: Do not override the MTK_PMIC_WRAP symbol + +From: Enric Balletbo i Serra + +[ Upstream commit f0e70d4946332c681ceaba940652f30c7c33473d ] + +Commit 'fbbe38309d56 ("arm64: defconfig: Allow mt8173-based boards to boot +from usb")' added the MTK_PMIC_WRAP config built-in. It needs to be +built-in in order to be able to boot from USB or the MMC without needing +a ramdisk, but that symbol was already defined as a module so now we are +getting the following warning: + + arch/arm64/configs/defconfig:996:warning: override: reassigning to symbol MTK_PMIC_WRAP + +Remove the MTK_PMIC_WRAP=m from the defconfig to remove the error. + +Fixes: fbbe38309d56 ("arm64: defconfig: Allow mt8173-based boards to boot from usb") +Signed-off-by: Enric Balletbo i Serra +Link: https://lore.kernel.org/r/20210423075201.2616023-1-enric.balletbo@collabora.com +Signed-off-by: Matthias Brugger +Signed-off-by: Sasha Levin +--- + arch/arm64/configs/defconfig | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig +index 08c6f769df9a..9907a431db0d 100644 +--- a/arch/arm64/configs/defconfig ++++ b/arch/arm64/configs/defconfig +@@ -491,7 +491,6 @@ CONFIG_SPI_S3C64XX=y + CONFIG_SPI_SH_MSIOF=m + CONFIG_SPI_SUN6I=y + CONFIG_SPI_SPIDEV=m +-CONFIG_MTK_PMIC_WRAP=m + CONFIG_SPMI=y + CONFIG_PINCTRL_SINGLE=y + CONFIG_PINCTRL_MAX77620=y +-- +2.30.2 + diff --git a/queue-5.13/arm64-dts-allwinner-a64-sopine-baseboard-change-rgmi.patch b/queue-5.13/arm64-dts-allwinner-a64-sopine-baseboard-change-rgmi.patch new file mode 100644 index 00000000000..18af10c523b --- /dev/null +++ b/queue-5.13/arm64-dts-allwinner-a64-sopine-baseboard-change-rgmi.patch @@ -0,0 +1,48 @@ +From d0c1be4355341bcbc2791708d3798a4d1682887b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 9 Jun 2021 16:38:43 +0800 +Subject: arm64: dts: allwinner: a64-sopine-baseboard: change RGMII mode to + TXID + +From: Icenowy Zheng + +[ Upstream commit bd5431b2f9b30a70f6ed964dd5ee9a6d1c397c06 ] + +Although the schematics of Pine A64-LTS and SoPine Baseboard shows both +the RX and TX internal delay are enabled, they're using the same broken +RTL8211E chip batch with Pine A64+, so they should use TXID instead, not +ID. + +In addition, by checking the real components soldered on both a SoPine +Baseboard and a Pine A64-LTS, RX delay is not enabled (GR69 soldered and +GR70 NC) despite the schematics says it's enabled. It's a common +situation for Pine64 boards that the NC information on schematics is not +the same with the board. + +So the RGMII delay mode should be TXID on these boards. + +Fixes: c2b111e59a7b ("arm64: dts: allwinner: A64 Sopine: phy-mode rgmii-id") +Signed-off-by: Icenowy Zheng +Signed-off-by: Maxime Ripard +Link: https://lore.kernel.org/r/20210609083843.463750-1-icenowy@aosc.io +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts +index e22b94c83647..5e66ce1a334f 100644 +--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts ++++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts +@@ -79,7 +79,7 @@ + &emac { + pinctrl-names = "default"; + pinctrl-0 = <&rgmii_pins>; +- phy-mode = "rgmii-id"; ++ phy-mode = "rgmii-txid"; + phy-handle = <&ext_rgmii_phy>; + phy-supply = <®_dc1sw>; + status = "okay"; +-- +2.30.2 + diff --git a/queue-5.13/arm64-dts-qcom-c630-add-no-hpd-to-dsi-bridge-node.patch b/queue-5.13/arm64-dts-qcom-c630-add-no-hpd-to-dsi-bridge-node.patch new file mode 100644 index 00000000000..2c5625b3b5b --- /dev/null +++ b/queue-5.13/arm64-dts-qcom-c630-add-no-hpd-to-dsi-bridge-node.patch @@ -0,0 +1,44 @@ +From 0cd3f28bdccc95573526b5c0e86eff096d09b9f0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 24 Mar 2021 16:14:24 -0700 +Subject: arm64: dts: qcom: c630: Add no-hpd to DSI bridge node + +From: Stephen Boyd + +[ Upstream commit c0dcfe6a784fdf7fcc0fdc74bfbb06e9f77de964 ] + +We should indicate that we're not using the HPD pin on this device, per +the binding document. Otherwise if code in the future wants to enable +HPD in the bridge when this property is absent we'll be enabling HPD +when it isn't supposed to be used. Presumably this board isn't using hpd +on the bridge. + +Reviewed-by: Douglas Anderson +Cc: Laurent Pinchart +Cc: Douglas Anderson +Cc: Steev Klimaszewski +Fixes: 956e9c85f47b ("arm64: dts: qcom: c630: Define eDP bridge and panel") +Signed-off-by: Stephen Boyd +Link: https://lore.kernel.org/r/20210324231424.2890039-1-swboyd@chromium.org +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts b/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts +index 140db2d5ba31..c2a709a384e9 100644 +--- a/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts ++++ b/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts +@@ -376,6 +376,8 @@ + clocks = <&sn65dsi86_refclk>; + clock-names = "refclk"; + ++ no-hpd; ++ + ports { + #address-cells = <1>; + #size-cells = <0>; +-- +2.30.2 + diff --git a/queue-5.13/arm64-dts-qcom-msm8994-angler-fix-gpio-reserved-rang.patch b/queue-5.13/arm64-dts-qcom-msm8994-angler-fix-gpio-reserved-rang.patch new file mode 100644 index 00000000000..78582e6bd3a --- /dev/null +++ b/queue-5.13/arm64-dts-qcom-msm8994-angler-fix-gpio-reserved-rang.patch @@ -0,0 +1,40 @@ +From b5834079f324ef9ee572c7d134fce0b58add8805 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 15 Apr 2021 21:39:13 +0200 +Subject: arm64: dts: qcom: msm8994-angler: Fix gpio-reserved-ranges 85-88 + +From: Petr Vorel + +[ Upstream commit f890f89d9a80fffbfa7ca791b78927e5b8aba869 ] + +Reserve GPIO pins 85-88 as these aren't meant to be accessible from the +application CPUs (causes reboot). Yet another fix similar to +9134586715e3, 5f8d3ab136d0, which is needed to allow angler to boot after +3edfb7bd76bd ("gpiolib: Show correct direction from the beginning"). + +Fixes: feeaf56ac78d ("arm64: dts: msm8994 SoC and Huawei Angler (Nexus 6P) support") + +Signed-off-by: Petr Vorel +Reviewed-by: Konrad Dybcio +Link: https://lore.kernel.org/r/20210415193913.1836153-1-petr.vorel@gmail.com +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/msm8994-angler-rev-101.dts | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/arch/arm64/boot/dts/qcom/msm8994-angler-rev-101.dts b/arch/arm64/boot/dts/qcom/msm8994-angler-rev-101.dts +index baa55643b40f..ffe1a9bd8f70 100644 +--- a/arch/arm64/boot/dts/qcom/msm8994-angler-rev-101.dts ++++ b/arch/arm64/boot/dts/qcom/msm8994-angler-rev-101.dts +@@ -32,3 +32,7 @@ + }; + }; + }; ++ ++&tlmm { ++ gpio-reserved-ranges = <85 4>; ++}; +-- +2.30.2 + diff --git a/queue-5.13/arm64-dts-qcom-sc7180-fix-sc7180-qmp-usb3-dp-phy-reg.patch b/queue-5.13/arm64-dts-qcom-sc7180-fix-sc7180-qmp-usb3-dp-phy-reg.patch new file mode 100644 index 00000000000..c8d6511851f --- /dev/null +++ b/queue-5.13/arm64-dts-qcom-sc7180-fix-sc7180-qmp-usb3-dp-phy-reg.patch @@ -0,0 +1,56 @@ +From c42d0ebb39935147440632a094b23f995e512094 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 15 Mar 2021 10:38:54 -0700 +Subject: arm64: dts: qcom: sc7180: Fix sc7180-qmp-usb3-dp-phy reg sizes + +From: Douglas Anderson + +[ Upstream commit c1124180eb9883891ad2acef89c9d17d6190eab4 ] + +As per Dmitry Baryshkov [1]: +a) The 2nd "reg" should be 0x3c because "Offset 0x38 is + USB3_DP_COM_REVISION_ID3 (not used by the current driver though)." +b) The 3rd "reg" "is a serdes region and qmp_v3_dp_serdes_tbl contains + registers 0x148 and 0x154." + +I think because the 3rd "reg" is a serdes region we should just use +the same size as the 1st "reg"? + +[1] https://lore.kernel.org/r/ee5695bb-a603-0dd5-7a7f-695e919b1af1@linaro.org + +Reviewed-by: Dmitry Baryshkov +Reviewed-by: Stephen Boyd +Cc: Stephen Boyd +Cc: Jeykumar Sankaran +Cc: Chandan Uddaraju +Cc: Vara Reddy +Cc: Tanmay Shah +Cc: Rob Clark +Fixes: 58fd7ae621e7 ("arm64: dts: qcom: sc7180: Update dts for DP phy inside QMP phy") +Reported-by: Dmitry Baryshkov +Signed-off-by: Douglas Anderson +Link: https://lore.kernel.org/r/20210315103836.1.I9a97120319d43b42353aeac4d348624d60687df7@changeid +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/sc7180.dtsi | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/arm64/boot/dts/qcom/sc7180.dtsi b/arch/arm64/boot/dts/qcom/sc7180.dtsi +index 6228ba2d8513..b82014eac56b 100644 +--- a/arch/arm64/boot/dts/qcom/sc7180.dtsi ++++ b/arch/arm64/boot/dts/qcom/sc7180.dtsi +@@ -2754,8 +2754,8 @@ + usb_1_qmpphy: phy-wrapper@88e9000 { + compatible = "qcom,sc7180-qmp-usb3-dp-phy"; + reg = <0 0x088e9000 0 0x18c>, +- <0 0x088e8000 0 0x38>, +- <0 0x088ea000 0 0x40>; ++ <0 0x088e8000 0 0x3c>, ++ <0 0x088ea000 0 0x18c>; + status = "disabled"; + #address-cells = <2>; + #size-cells = <2>; +-- +2.30.2 + diff --git a/queue-5.13/arm64-dts-qcom-sdm845-oneplus-common-guard-rmtfs-mem.patch b/queue-5.13/arm64-dts-qcom-sdm845-oneplus-common-guard-rmtfs-mem.patch new file mode 100644 index 00000000000..a5fce564077 --- /dev/null +++ b/queue-5.13/arm64-dts-qcom-sdm845-oneplus-common-guard-rmtfs-mem.patch @@ -0,0 +1,77 @@ +From 4cace05e6b6567c4f7ac6a209b151cbddecee6ca Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 2 May 2021 01:42:57 +0000 +Subject: arm64: dts: qcom: sdm845-oneplus-common: guard rmtfs-mem + +From: Caleb Connolly + +[ Upstream commit e60fd5ac1f6851be5b2c042b39584bfcf8a66f57 ] + +The rmtfs_mem region is a weird one, downstream allocates it +dynamically, and supports a "qcom,guard-memory" property which when set +will reserve 4k above and below the rmtfs memory. + +A common from qcom 4.9 kernel msm_sharedmem driver: + +/* + * If guard_memory is set, then the shared memory region + * will be guarded by SZ_4K at the start and at the end. + * This is needed to overcome the XPU limitation on few + * MSM HW, so as to make this memory not contiguous with + * other allocations that may possibly happen from other + * clients in the system. +*/ + +When the kernel tries to touch memory that is too close the +rmtfs region it may cause an XPU violation. Such is the case on the +OnePlus 6 where random crashes would occur usually after boot. + +Reserve 4k above and below the rmtfs_mem to avoid hitting these XPU +Violations. + +This doesn't entirely solve the random crashes on the OnePlus 6/6T but +it does seem to prevent the ones which happen shortly after modem +bringup. + +Fixes: 288ef8a42612 ("arm64: dts: sdm845: add oneplus6/6t devices") +Signed-off-by: Caleb Connolly +Link: https://lore.kernel.org/r/20210502014146.85642-4-caleb@connolly.tech +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi b/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi +index 8f617f7b6d34..f712771df0c7 100644 +--- a/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi ++++ b/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi +@@ -46,6 +46,14 @@ + }; + + reserved-memory { ++ /* The rmtfs_mem needs to be guarded due to "XPU limitations" ++ * it is otherwise possible for an allocation adjacent to the ++ * rmtfs_mem region to trigger an XPU violation, causing a crash. ++ */ ++ rmtfs_lower_guard: memory@f5b00000 { ++ no-map; ++ reg = <0 0xf5b00000 0 0x1000>; ++ }; + /* + * The rmtfs memory region in downstream is 'dynamically allocated' + * but given the same address every time. Hard code it as this address is +@@ -59,6 +67,10 @@ + qcom,client-id = <1>; + qcom,vmid = <15>; + }; ++ rmtfs_upper_guard: memory@f5d01000 { ++ no-map; ++ reg = <0 0xf5d01000 0 0x2000>; ++ }; + + /* + * It seems like reserving the old rmtfs_mem region is also needed to prevent +-- +2.30.2 + diff --git a/queue-5.13/arm64-dts-qcom-trogdor-add-no-hpd-to-dsi-bridge-node.patch b/queue-5.13/arm64-dts-qcom-trogdor-add-no-hpd-to-dsi-bridge-node.patch new file mode 100644 index 00000000000..e6cd719a9d1 --- /dev/null +++ b/queue-5.13/arm64-dts-qcom-trogdor-add-no-hpd-to-dsi-bridge-node.patch @@ -0,0 +1,45 @@ +From be1dcbf08d904315717454f4f664760b6b31c430 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 23 Mar 2021 19:55:34 -0700 +Subject: arm64: dts: qcom: trogdor: Add no-hpd to DSI bridge node + +From: Stephen Boyd + +[ Upstream commit 5f551b5ce55575b14c26933fe9b49365ea246b3d ] + +We should indicate that we're not using the HPD pin on this device, per +the binding document. Otherwise if code in the future wants to enable +HPD in the bridge when this property is absent we'll be wasting power +powering hpd when we don't use it on trogdor boards. We didn't notice +this before because the kernel driver blindly disables hpd, but that +won't be true for much longer. + +Reviewed-by: Laurent Pinchart +Reviewed-by: Douglas Anderson +Cc: Laurent Pinchart +Cc: Douglas Anderson +Fixes: 7ec3e67307f8 ("arm64: dts: qcom: sc7180-trogdor: add initial trogdor and lazor dt") +Signed-off-by: Stephen Boyd +Link: https://lore.kernel.org/r/20210324025534.1837405-1-swboyd@chromium.org +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi +index 24d293ef56d7..74d15789ce9a 100644 +--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi ++++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi +@@ -655,6 +655,8 @@ edp_brij_i2c: &i2c2 { + clocks = <&rpmhcc RPMH_LN_BB_CLK3>; + clock-names = "refclk"; + ++ no-hpd; ++ + ports { + #address-cells = <1>; + #size-cells = <0>; +-- +2.30.2 + diff --git a/queue-5.13/arm64-dts-renesas-add-missing-opp-suspend-properties.patch b/queue-5.13/arm64-dts-renesas-add-missing-opp-suspend-properties.patch new file mode 100644 index 00000000000..d6da4de8448 --- /dev/null +++ b/queue-5.13/arm64-dts-renesas-add-missing-opp-suspend-properties.patch @@ -0,0 +1,73 @@ +From b2593b76e57647b0a7db1225a3132e85a9e5dbf9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 27 May 2021 15:42:42 +0200 +Subject: arm64: dts: renesas: Add missing opp-suspend properties +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Geert Uytterhoeven + +[ Upstream commit 44b615ac9fab16d1552cd8360454077d411e3c35 ] + +Tag the highest "Power Optimized" (1.5 GHz) Cortex-A57 operating point +table entries for the RZ/G2M, R-Car M3-W and M3-W+ SoCs with the +"opp-suspend" property. This makes sure the system will enter suspend +in the same performance state as it will be resumed by the firmware +later, avoiding state inconsistencies after resume. + +Based on a patch for R-Car M3-W in the BSP by Takeshi Kihara +. + +Fixes: 800037e815b91d8c ("arm64: dts: renesas: r8a774a1: Add operating points") +Fixes: da7e3113344fda50 ("arm64: dts: renesas: r8a7796: Add OPPs table for cpu devices") +Fixes: f51746ad7d1ff6b4 ("arm64: dts: renesas: Add Renesas R8A77961 SoC support") +Signed-off-by: Geert Uytterhoeven +Reviewed-by: Niklas Söderlund +Link: https://lore.kernel.org/r/45a061c3b0463aac7d10664f47c4afdd999da50d.1619699721.git.geert+renesas@glider.be +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/renesas/r8a774a1.dtsi | 1 + + arch/arm64/boot/dts/renesas/r8a77960.dtsi | 1 + + arch/arm64/boot/dts/renesas/r8a77961.dtsi | 1 + + 3 files changed, 3 insertions(+) + +diff --git a/arch/arm64/boot/dts/renesas/r8a774a1.dtsi b/arch/arm64/boot/dts/renesas/r8a774a1.dtsi +index 46f8dbf68904..95d9262d4f8a 100644 +--- a/arch/arm64/boot/dts/renesas/r8a774a1.dtsi ++++ b/arch/arm64/boot/dts/renesas/r8a774a1.dtsi +@@ -76,6 +76,7 @@ + opp-hz = /bits/ 64 <1500000000>; + opp-microvolt = <820000>; + clock-latency-ns = <300000>; ++ opp-suspend; + }; + }; + +diff --git a/arch/arm64/boot/dts/renesas/r8a77960.dtsi b/arch/arm64/boot/dts/renesas/r8a77960.dtsi +index 12476e354d74..cc09c5c652fa 100644 +--- a/arch/arm64/boot/dts/renesas/r8a77960.dtsi ++++ b/arch/arm64/boot/dts/renesas/r8a77960.dtsi +@@ -75,6 +75,7 @@ + opp-hz = /bits/ 64 <1500000000>; + opp-microvolt = <820000>; + clock-latency-ns = <300000>; ++ opp-suspend; + }; + opp-1600000000 { + opp-hz = /bits/ 64 <1600000000>; +diff --git a/arch/arm64/boot/dts/renesas/r8a77961.dtsi b/arch/arm64/boot/dts/renesas/r8a77961.dtsi +index d9804768425a..7d1333b9b92b 100644 +--- a/arch/arm64/boot/dts/renesas/r8a77961.dtsi ++++ b/arch/arm64/boot/dts/renesas/r8a77961.dtsi +@@ -64,6 +64,7 @@ + opp-hz = /bits/ 64 <1500000000>; + opp-microvolt = <820000>; + clock-latency-ns = <300000>; ++ opp-suspend; + }; + opp-1600000000 { + opp-hz = /bits/ 64 <1600000000>; +-- +2.30.2 + diff --git a/queue-5.13/arm64-dts-renesas-r8a7796-01-fix-opp-table-entry-vol.patch b/queue-5.13/arm64-dts-renesas-r8a7796-01-fix-opp-table-entry-vol.patch new file mode 100644 index 00000000000..7bf5979c7dd --- /dev/null +++ b/queue-5.13/arm64-dts-renesas-r8a7796-01-fix-opp-table-entry-vol.patch @@ -0,0 +1,80 @@ +From 1939ab212ad86ed4012207d0af8e6ea80f47f3ae Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 29 Apr 2021 14:39:12 +0200 +Subject: arm64: dts: renesas: r8a7796[01]: Fix OPP table entry voltages + +From: Geert Uytterhoeven + +[ Upstream commit 659b38203f04f5c3d1dc60f1a3e54b582ad3841c ] + +Correct the voltages in the "Power Optimized" (<= 1.5 GHz) Cortex-A57 +operating point table entries for the R-Car M3-W and M3-W+ SoCs from +0.82V to 0.83V, as per the R-Car Gen3 EC Manual Errata for Revision +0.53. + +Based on a patch for R-Car M3-W in the BSP by Takeshi Kihara +. + +Fixes: da7e3113344fda50 ("arm64: dts: renesas: r8a7796: Add OPPs table for cpu devices") +Fixes: f51746ad7d1ff6b4 ("arm64: dts: renesas: Add Renesas R8A77961 SoC support") +Signed-off-by: Geert Uytterhoeven +Link: https://lore.kernel.org/r/b9e9db907514790574429b83d070c823b36085ef.1619699909.git.geert+renesas@glider.be +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/renesas/r8a77960.dtsi | 6 +++--- + arch/arm64/boot/dts/renesas/r8a77961.dtsi | 6 +++--- + 2 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/arch/arm64/boot/dts/renesas/r8a77960.dtsi b/arch/arm64/boot/dts/renesas/r8a77960.dtsi +index cc09c5c652fa..a91a42c57484 100644 +--- a/arch/arm64/boot/dts/renesas/r8a77960.dtsi ++++ b/arch/arm64/boot/dts/renesas/r8a77960.dtsi +@@ -63,17 +63,17 @@ + + opp-500000000 { + opp-hz = /bits/ 64 <500000000>; +- opp-microvolt = <820000>; ++ opp-microvolt = <830000>; + clock-latency-ns = <300000>; + }; + opp-1000000000 { + opp-hz = /bits/ 64 <1000000000>; +- opp-microvolt = <820000>; ++ opp-microvolt = <830000>; + clock-latency-ns = <300000>; + }; + opp-1500000000 { + opp-hz = /bits/ 64 <1500000000>; +- opp-microvolt = <820000>; ++ opp-microvolt = <830000>; + clock-latency-ns = <300000>; + opp-suspend; + }; +diff --git a/arch/arm64/boot/dts/renesas/r8a77961.dtsi b/arch/arm64/boot/dts/renesas/r8a77961.dtsi +index 7d1333b9b92b..7f9d5c360522 100644 +--- a/arch/arm64/boot/dts/renesas/r8a77961.dtsi ++++ b/arch/arm64/boot/dts/renesas/r8a77961.dtsi +@@ -52,17 +52,17 @@ + + opp-500000000 { + opp-hz = /bits/ 64 <500000000>; +- opp-microvolt = <820000>; ++ opp-microvolt = <830000>; + clock-latency-ns = <300000>; + }; + opp-1000000000 { + opp-hz = /bits/ 64 <1000000000>; +- opp-microvolt = <820000>; ++ opp-microvolt = <830000>; + clock-latency-ns = <300000>; + }; + opp-1500000000 { + opp-hz = /bits/ 64 <1500000000>; +- opp-microvolt = <820000>; ++ opp-microvolt = <830000>; + clock-latency-ns = <300000>; + opp-suspend; + }; +-- +2.30.2 + diff --git a/queue-5.13/arm64-dts-renesas-r8a779a0-drop-power-domains-proper.patch b/queue-5.13/arm64-dts-renesas-r8a779a0-drop-power-domains-proper.patch new file mode 100644 index 00000000000..3d5a057ee03 --- /dev/null +++ b/queue-5.13/arm64-dts-renesas-r8a779a0-drop-power-domains-proper.patch @@ -0,0 +1,42 @@ +From aaf77bb8563d6a87e2ac8fb83b3b981d636bfdbb Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 1 Jun 2021 17:12:50 +0200 +Subject: arm64: dts: renesas: r8a779a0: Drop power-domains property from GIC + node + +From: Geert Uytterhoeven + +[ Upstream commit 1771a33b34421050c7b830f0a8af703178ba9d36 ] + +"make dtbs_check": + + arm64/boot/dts/renesas/r8a779a0-falcon.dt.yaml: interrupt-controller@f1000000: 'power-domains' does not match any of the regexes: '^(msi-controller|gic-its|interrupt-controller)@[0-9a-f]+$', '^gic-its@', '^interrupt-controller@[0-9a-f]+$', 'pinctrl-[0-9]+' + From schema: Documentation/devicetree/bindings/interrupt-controller/arm,gic-v3.yaml + +Remove the "power-domains" property, as the GIC on R-Car V3U is +always-on, and not part of a clock domain. + +Fixes: 834c310f541839b6 ("arm64: dts: renesas: Add Renesas R8A779A0 SoC support") +Signed-off-by: Geert Uytterhoeven +Reviewed-by: Yoshihiro Shimoda +Link: https://lore.kernel.org/r/a9ae5cbc7c586bf2c6b18ddc665ad7051bd1d206.1622560236.git.geert+renesas@glider.be +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/renesas/r8a779a0.dtsi | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/renesas/r8a779a0.dtsi b/arch/arm64/boot/dts/renesas/r8a779a0.dtsi +index 70b3604e56cd..9a7d1aca4998 100644 +--- a/arch/arm64/boot/dts/renesas/r8a779a0.dtsi ++++ b/arch/arm64/boot/dts/renesas/r8a779a0.dtsi +@@ -1096,7 +1096,6 @@ + <0x0 0xf1060000 0 0x110000>; + interrupts = ; +- power-domains = <&sysc R8A779A0_PD_ALWAYS_ON>; + }; + + fcpvd0: fcp@fea10000 { +-- +2.30.2 + diff --git a/queue-5.13/arm64-dts-renesas-v3msk-fix-memory-size.patch b/queue-5.13/arm64-dts-renesas-v3msk-fix-memory-size.patch new file mode 100644 index 00000000000..c619430cb76 --- /dev/null +++ b/queue-5.13/arm64-dts-renesas-v3msk-fix-memory-size.patch @@ -0,0 +1,37 @@ +From 6ed60fce96064d5d319d9e347d0e597fb83aeaee Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 26 Mar 2021 13:10:50 +0100 +Subject: arm64: dts: renesas: v3msk: Fix memory size + +From: Valentine Barshak + +[ Upstream commit a422ec20caef6a50cf3c1efa93538888ebd576a6 ] + +The V3MSK board has 2 GiB RAM according to the datasheet and schematics. + +Signed-off-by: Valentine Barshak +[geert: Verified schematics] +Fixes: cc3e267e9bb0ce7f ("arm64: dts: renesas: initial V3MSK board device tree") +Signed-off-by: Geert Uytterhoeven +Link: https://lore.kernel.org/r/20210326121050.1578460-1-geert+renesas@glider.be +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/renesas/r8a77970-v3msk.dts | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/renesas/r8a77970-v3msk.dts b/arch/arm64/boot/dts/renesas/r8a77970-v3msk.dts +index 7417cf5fea0f..2426e533128c 100644 +--- a/arch/arm64/boot/dts/renesas/r8a77970-v3msk.dts ++++ b/arch/arm64/boot/dts/renesas/r8a77970-v3msk.dts +@@ -59,7 +59,7 @@ + memory@48000000 { + device_type = "memory"; + /* first 128MB is reserved for secure area. */ +- reg = <0x0 0x48000000 0x0 0x38000000>; ++ reg = <0x0 0x48000000 0x0 0x78000000>; + }; + + osc5_clk: osc5-clock { +-- +2.30.2 + diff --git a/queue-5.13/arm64-dts-rockchip-drop-fephy-pinctrl-from-gmac2phy-.patch b/queue-5.13/arm64-dts-rockchip-drop-fephy-pinctrl-from-gmac2phy-.patch new file mode 100644 index 00000000000..fc31ca266a5 --- /dev/null +++ b/queue-5.13/arm64-dts-rockchip-drop-fephy-pinctrl-from-gmac2phy-.patch @@ -0,0 +1,40 @@ +From 09e0aa1769a1980220e5ab23b67d5280c644ea34 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 26 Apr 2021 17:59:16 +0800 +Subject: arm64: dts: rockchip: Drop fephy pinctrl from gmac2phy on rk3328 + rock-pi-e + +From: Chen-Yu Tsai + +[ Upstream commit e6526f90696e6a7d722d04b958f15b97d6fd9ce6 ] + +Turns out the fephy pins are already claimed in the phy node, which is +rightfully where they should be claimed. + +Drop the pinctrl properties from the gmac2phy node for the ROCK Pi E. + +Fixes: b918e81f2145 ("arm64: dts: rockchip: rk3328: Add Radxa ROCK Pi E") +Signed-off-by: Chen-Yu Tsai +Link: https://lore.kernel.org/r/20210426095916.14574-1-wens@kernel.org +Signed-off-by: Heiko Stuebner +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/rockchip/rk3328-rock-pi-e.dts | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3328-rock-pi-e.dts b/arch/arm64/boot/dts/rockchip/rk3328-rock-pi-e.dts +index c7e31efdd2e1..c02059c0a954 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3328-rock-pi-e.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3328-rock-pi-e.dts +@@ -177,8 +177,6 @@ + }; + + &gmac2phy { +- pinctrl-names = "default"; +- pinctrl-0 = <&fephyled_linkm1>, <&fephyled_rxm1>; + status = "okay"; + }; + +-- +2.30.2 + diff --git a/queue-5.13/arm64-dts-rockchip-re-add-regulator-always-on-for-vc.patch b/queue-5.13/arm64-dts-rockchip-re-add-regulator-always-on-for-vc.patch new file mode 100644 index 00000000000..265ee6d27af --- /dev/null +++ b/queue-5.13/arm64-dts-rockchip-re-add-regulator-always-on-for-vc.patch @@ -0,0 +1,39 @@ +From a32127e9ce0b93c4693db251f5d5d9f9f4289b2d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 19 Jun 2021 14:13:06 +0200 +Subject: arm64: dts: rockchip: Re-add regulator-always-on for vcc_sdio for + rk3399-roc-pc + +From: Alex Bee + +[ Upstream commit eb607cd4957fb0ef97beb2a8293478be6a54240a ] + +Re-add the regulator-always-on property for vcc_sdio which supplies sdmmc, +since it gets disabled during reboot now and the bootrom expects it to be +enabled when booting from SD card. This makes rebooting impossible in that +case and requires a hard reset to boot again. + +Fixes: 04a0077fdb19 ("arm64: dts: rockchip: Remove always-on properties from regulator nodes on rk3399-roc-pc.") +Signed-off-by: Alex Bee +Link: https://lore.kernel.org/r/20210619121306.7740-1-knaerzche@gmail.com +Signed-off-by: Heiko Stuebner +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi +index 3d5eb0b235b4..8b27ee4be755 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi +@@ -389,6 +389,7 @@ + + vcc_sdio: LDO_REG4 { + regulator-name = "vcc_sdio"; ++ regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; +-- +2.30.2 + diff --git a/queue-5.13/arm64-dts-rockchip-re-add-regulator-boot-on-regulato.patch b/queue-5.13/arm64-dts-rockchip-re-add-regulator-boot-on-regulato.patch new file mode 100644 index 00000000000..1e1813c3788 --- /dev/null +++ b/queue-5.13/arm64-dts-rockchip-re-add-regulator-boot-on-regulato.patch @@ -0,0 +1,40 @@ +From c92d91cef37de7e661efb32c669887fee98b67ce Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 19 Jun 2021 14:14:46 +0200 +Subject: arm64: dts: rockchip: Re-add regulator-boot-on, regulator-always-on + for vdd_gpu on rk3399-roc-pc + +From: Alex Bee + +[ Upstream commit 06b2818678d9b35102c9816ffaf6893caf306ed0 ] + +This might be a limitation of either the current panfrost driver +devfreq implementation or how the gpu is implemented in RK3399 SoC. +The gpu regulator must never get disabled or the registers get +(randomly?) inaccessable by the driver. (see all other RK3399 boards) + +Fixes: ec7d731d81e7 ("arm64: dts: rockchip: Add node for gpu on rk3399-roc-pc") +Signed-off-by: Alex Bee +Link: https://lore.kernel.org/r/20210619121446.7802-1-knaerzche@gmail.com +Signed-off-by: Heiko Stuebner +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi +index c172f5a803e7..3d5eb0b235b4 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi +@@ -493,6 +493,8 @@ + regulator-min-microvolt = <712500>; + regulator-max-microvolt = <1500000>; + regulator-ramp-delay = <1000>; ++ regulator-always-on; ++ regulator-boot-on; + vin-supply = <&vcc3v3_sys>; + + regulator-state-mem { +-- +2.30.2 + diff --git a/queue-5.13/arm64-dts-rockchip-rename-led-label-for-nanopi-r4s.patch b/queue-5.13/arm64-dts-rockchip-rename-led-label-for-nanopi-r4s.patch new file mode 100644 index 00000000000..b95fbab250b --- /dev/null +++ b/queue-5.13/arm64-dts-rockchip-rename-led-label-for-nanopi-r4s.patch @@ -0,0 +1,40 @@ +From e2d8fa9b4db8ed5bc80cd3e3eb817581fbb65d5a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 26 Apr 2021 19:46:52 +0800 +Subject: arm64: dts: rockchip: rename LED label for NanoPi R4S + +From: Tianling Shen + +[ Upstream commit 6a11ffc2cc54d89719d5b2f3ca44244cebd7ed2e ] + +However "sys" is not a valid function, and it is always on. +Let's keep existing functions. + +Fixes: db792e9adbf85f ("rockchip: rk3399: Add support for FriendlyARM NanoPi R4S") + +Suggested-by: Pavel Machek +Signed-off-by: Tianling Shen +Acked-by: Pavel Machek +Link: https://lore.kernel.org/r/20210426114652.29542-1-cnsztl@gmail.com +Signed-off-by: Heiko Stuebner +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts b/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts +index fa5809887643..cef4d18b599d 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts +@@ -33,7 +33,7 @@ + + sys_led: led-sys { + gpios = <&gpio0 RK_PB5 GPIO_ACTIVE_HIGH>; +- label = "red:sys"; ++ label = "red:power"; + default-state = "on"; + }; + +-- +2.30.2 + diff --git a/queue-5.13/arm64-dts-ti-am65-align-ti-pindir-d0-out-d1-in-prope.patch b/queue-5.13/arm64-dts-ti-am65-align-ti-pindir-d0-out-d1-in-prope.patch new file mode 100644 index 00000000000..80a61de265b --- /dev/null +++ b/queue-5.13/arm64-dts-ti-am65-align-ti-pindir-d0-out-d1-in-prope.patch @@ -0,0 +1,55 @@ +From c9710cd9b78c6e49afbb1de42e31d4637954873e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 8 Jun 2021 10:44:13 +0530 +Subject: arm64: dts: ti: am65: align ti,pindir-d0-out-d1-in property with + dt-shema + +From: Aswath Govindraju + +[ Upstream commit 4f76ea7b4da1cce9a9bda1fa678ef8036584c66b ] + +ti,pindir-d0-out-d1-in property is expected to be of type boolean. +Therefore, fix the property accordingly. + +Fixes: e180f76d0641 ("arm64: dts: ti: Add support for Siemens IOT2050 boards") +Fixes: 5da94b50475a ("arm64: dts: ti: k3-am654: Enable main domain McSPI0") +Signed-off-by: Aswath Govindraju +Acked-by: Jan Kiszka +Reviewed-by: Vignesh Raghavendra +Signed-off-by: Nishanth Menon +Link: https://lore.kernel.org/r/20210608051414.14873-2-a-govindraju@ti.com +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/ti/k3-am65-iot2050-common.dtsi | 2 +- + arch/arm64/boot/dts/ti/k3-am654-base-board.dts | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/arm64/boot/dts/ti/k3-am65-iot2050-common.dtsi b/arch/arm64/boot/dts/ti/k3-am65-iot2050-common.dtsi +index de763ca9251c..d9a7e2689b93 100644 +--- a/arch/arm64/boot/dts/ti/k3-am65-iot2050-common.dtsi ++++ b/arch/arm64/boot/dts/ti/k3-am65-iot2050-common.dtsi +@@ -575,7 +575,7 @@ + + #address-cells = <1>; + #size-cells= <0>; +- ti,pindir-d0-out-d1-in = <1>; ++ ti,pindir-d0-out-d1-in; + }; + + &tscadc0 { +diff --git a/arch/arm64/boot/dts/ti/k3-am654-base-board.dts b/arch/arm64/boot/dts/ti/k3-am654-base-board.dts +index eddb2ffb93ca..1b947e2c2e74 100644 +--- a/arch/arm64/boot/dts/ti/k3-am654-base-board.dts ++++ b/arch/arm64/boot/dts/ti/k3-am654-base-board.dts +@@ -299,7 +299,7 @@ + pinctrl-0 = <&main_spi0_pins_default>; + #address-cells = <1>; + #size-cells= <0>; +- ti,pindir-d0-out-d1-in = <1>; ++ ti,pindir-d0-out-d1-in; + + flash@0{ + compatible = "jedec,spi-nor"; +-- +2.30.2 + diff --git a/queue-5.13/arm64-dts-ti-j7200-main-enable-usb2-phy-rx-sensitivi.patch b/queue-5.13/arm64-dts-ti-j7200-main-enable-usb2-phy-rx-sensitivi.patch new file mode 100644 index 00000000000..d6ce0a168ed --- /dev/null +++ b/queue-5.13/arm64-dts-ti-j7200-main-enable-usb2-phy-rx-sensitivi.patch @@ -0,0 +1,38 @@ +From 1cf615ad34ef830802675d0678823789d233f8d1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 12 May 2021 21:03:08 +0530 +Subject: arm64: dts: ti: j7200-main: Enable USB2 PHY RX sensitivity workaround + +From: Roger Quadros + +[ Upstream commit a2894d85f44ba3f2bdf5806c8dc62e2ec40c1c09 ] + +Enable work around feature built into the controller to address issue with +RX Sensitivity for USB2 PHY. + +Fixes: 6197d7139d12 ("arm64: dts: ti: k3-j7200-main: Add USB controller") +Signed-off-by: Roger Quadros +Signed-off-by: Aswath Govindraju +Reviewed-by: Vignesh Raghavendra +Signed-off-by: Nishanth Menon +Link: https://lore.kernel.org/r/20210512153308.5840-1-a-govindraju@ti.com +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/ti/k3-j7200-main.dtsi | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/arm64/boot/dts/ti/k3-j7200-main.dtsi b/arch/arm64/boot/dts/ti/k3-j7200-main.dtsi +index 7e7169195902..a4b4b17a6ad7 100644 +--- a/arch/arm64/boot/dts/ti/k3-j7200-main.dtsi ++++ b/arch/arm64/boot/dts/ti/k3-j7200-main.dtsi +@@ -683,6 +683,7 @@ + "otg"; + maximum-speed = "super-speed"; + dr_mode = "otg"; ++ cdns,phyrst-a-enable; + }; + }; + +-- +2.30.2 + diff --git a/queue-5.13/arm64-dts-ti-k3-am64-mcu-fix-the-compatible-string-i.patch b/queue-5.13/arm64-dts-ti-k3-am64-mcu-fix-the-compatible-string-i.patch new file mode 100644 index 00000000000..95077950e6c --- /dev/null +++ b/queue-5.13/arm64-dts-ti-k3-am64-mcu-fix-the-compatible-string-i.patch @@ -0,0 +1,38 @@ +From ee19b4ba9d3ace1a62377b981d749a065ff41c0d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 23 Apr 2021 11:31:33 +0530 +Subject: arm64: dts: ti: k3-am64-mcu: Fix the compatible string in GPIO DT + node + +From: Aswath Govindraju + +[ Upstream commit ec2fb989d03e7f79f7cd901cf9abf40aebba7acf ] + +Fix the compatible string in mcu domain GPIO device tree node. + +Fixes: 01a91e01b8fd ("arm64: dts: ti: k3-am64: Add GPIO DT nodes") +Signed-off-by: Aswath Govindraju +Reviewed-by: Lokesh Vutla +Signed-off-by: Nishanth Menon +Link: https://lore.kernel.org/r/20210423060133.16473-1-a-govindraju@ti.com +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/ti/k3-am64-mcu.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/ti/k3-am64-mcu.dtsi b/arch/arm64/boot/dts/ti/k3-am64-mcu.dtsi +index deb19ae5e168..eaf7edb2ef4d 100644 +--- a/arch/arm64/boot/dts/ti/k3-am64-mcu.dtsi ++++ b/arch/arm64/boot/dts/ti/k3-am64-mcu.dtsi +@@ -87,7 +87,7 @@ + }; + + mcu_gpio0: gpio@4201000 { +- compatible = "ti,am64-gpio", "keystone-gpio"; ++ compatible = "ti,am64-gpio", "ti,keystone-gpio"; + reg = <0x0 0x4201000 0x0 0x100>; + gpio-controller; + #gpio-cells = <2>; +-- +2.30.2 + diff --git a/queue-5.13/arm64-dts-ti-k3-am642-evm-align-ti-pindir-d0-out-d1-.patch b/queue-5.13/arm64-dts-ti-k3-am642-evm-align-ti-pindir-d0-out-d1-.patch new file mode 100644 index 00000000000..c17d5653cc3 --- /dev/null +++ b/queue-5.13/arm64-dts-ti-k3-am642-evm-align-ti-pindir-d0-out-d1-.patch @@ -0,0 +1,39 @@ +From bc50ec06810d1551af331db8afe3f69803f9e739 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 8 Jun 2021 10:44:14 +0530 +Subject: arm64: dts: ti: k3-am642-evm: align ti,pindir-d0-out-d1-in property + with dt-shema + +From: Aswath Govindraju + +[ Upstream commit d3f1b155c04d949c843e6028034766aba1e0f8bf ] + +ti,pindir-d0-out-d1-in property is expected to be of type boolean. +Therefore, fix the property accordingly. + +Fixes: 4fb6c04683aa ("arm64: dts: ti: k3-am642-evm: Add support for SPI EEPROM") +Signed-off-by: Aswath Govindraju +Reviewed-by: Vignesh Raghavendra +Signed-off-by: Nishanth Menon +Link: https://lore.kernel.org/r/20210608051414.14873-3-a-govindraju@ti.com +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/ti/k3-am642-evm.dts | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/ti/k3-am642-evm.dts b/arch/arm64/boot/dts/ti/k3-am642-evm.dts +index dad0efa961ed..2fd0de905e61 100644 +--- a/arch/arm64/boot/dts/ti/k3-am642-evm.dts ++++ b/arch/arm64/boot/dts/ti/k3-am642-evm.dts +@@ -334,7 +334,7 @@ + &main_spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&main_spi0_pins_default>; +- ti,pindir-d0-out-d1-in = <1>; ++ ti,pindir-d0-out-d1-in; + eeprom@0 { + compatible = "microchip,93lc46b"; + reg = <0>; +-- +2.30.2 + diff --git a/queue-5.13/arm64-dts-ti-k3-am642-main-fix-ports-mac-properties.patch b/queue-5.13/arm64-dts-ti-k3-am642-main-fix-ports-mac-properties.patch new file mode 100644 index 00000000000..71b330017c2 --- /dev/null +++ b/queue-5.13/arm64-dts-ti-k3-am642-main-fix-ports-mac-properties.patch @@ -0,0 +1,60 @@ +From 152c74105ca7898129759fb9180923d0e9a000c7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 8 Jun 2021 21:49:40 +0300 +Subject: arm64: dts: ti: k3-am642-main: fix ports mac properties + +From: Grygorii Strashko + +[ Upstream commit 50c9bfca1bfe9ffd56d8c5deecf9204d14e20bfd ] + +The current device tree CPSW3g node adds non-zero "mac-address" property to +the ports, which prevents random MAC address assignment to network devices +if bootloader failed to update DT. This may cause more then one host to +have the same MAC in the network. + + mac-address = [00 00 de ad be ef]; + mac-address = [00 01 de ad be ef]; + +In addition, there is one MAC address available in eFuse registers which +can be used for default port 1. + +Hence, fix ports MAC properties by: +- resetting "mac-address" property to 0 +- adding ti,syscon-efuse = <&main_conf 0x200> to Port 1 + +Fixes: 3753b12877b6 ("arm64: dts: ti: k3-am64-main: Add CPSW DT node") +Signed-off-by: Grygorii Strashko +Reviewed-by: Vignesh Raghavendra +Signed-off-by: Nishanth Menon +Link: https://lore.kernel.org/r/20210608184940.25934-1-grygorii.strashko@ti.com +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/ti/k3-am64-main.dtsi | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/arch/arm64/boot/dts/ti/k3-am64-main.dtsi b/arch/arm64/boot/dts/ti/k3-am64-main.dtsi +index ca59d1f711f8..bcbf436a96b5 100644 +--- a/arch/arm64/boot/dts/ti/k3-am64-main.dtsi ++++ b/arch/arm64/boot/dts/ti/k3-am64-main.dtsi +@@ -489,7 +489,8 @@ + ti,mac-only; + label = "port1"; + phys = <&phy_gmii_sel 1>; +- mac-address = [00 00 de ad be ef]; ++ mac-address = [00 00 00 00 00 00]; ++ ti,syscon-efuse = <&main_conf 0x200>; + }; + + cpsw_port2: port@2 { +@@ -497,7 +498,7 @@ + ti,mac-only; + label = "port2"; + phys = <&phy_gmii_sel 2>; +- mac-address = [00 01 de ad be ef]; ++ mac-address = [00 00 00 00 00 00]; + }; + }; + +-- +2.30.2 + diff --git a/queue-5.13/arm64-dts-ti-k3-j7200-remove-address-cells-property-.patch b/queue-5.13/arm64-dts-ti-k3-j7200-remove-address-cells-property-.patch new file mode 100644 index 00000000000..887377af5d2 --- /dev/null +++ b/queue-5.13/arm64-dts-ti-k3-j7200-remove-address-cells-property-.patch @@ -0,0 +1,83 @@ +From da2d3383ed1152bdcdf35b565b965c1ea76867a9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 23 Apr 2021 12:17:57 +0530 +Subject: arm64: dts: ti: k3-j7200: Remove "#address-cells" property from GPIO + DT nodes + +From: Aswath Govindraju + +[ Upstream commit 6ec8ba764165f6ecb6f6f7efbfd2ec7ad76dedcb ] + +GPIO device tree nodes do not have child nodes. Therefore, "#address-cells" +property should not be added. + +Fixes: e0b2e6af39ea ("arm64: dts: ti: k3-j7200: Add gpio nodes") +Signed-off-by: Aswath Govindraju +Reviewed-by: Lokesh Vutla +Signed-off-by: Nishanth Menon +Link: https://lore.kernel.org/r/20210423064758.25520-1-a-govindraju@ti.com +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/ti/k3-j7200-main.dtsi | 4 ---- + arch/arm64/boot/dts/ti/k3-j7200-mcu-wakeup.dtsi | 2 -- + 2 files changed, 6 deletions(-) + +diff --git a/arch/arm64/boot/dts/ti/k3-j7200-main.dtsi b/arch/arm64/boot/dts/ti/k3-j7200-main.dtsi +index 19fea8adbcff..7e7169195902 100644 +--- a/arch/arm64/boot/dts/ti/k3-j7200-main.dtsi ++++ b/arch/arm64/boot/dts/ti/k3-j7200-main.dtsi +@@ -696,7 +696,6 @@ + <149>; + interrupt-controller; + #interrupt-cells = <2>; +- #address-cells = <0>; + ti,ngpio = <69>; + ti,davinci-gpio-unbanked = <0>; + power-domains = <&k3_pds 105 TI_SCI_PD_EXCLUSIVE>; +@@ -714,7 +713,6 @@ + <158>; + interrupt-controller; + #interrupt-cells = <2>; +- #address-cells = <0>; + ti,ngpio = <69>; + ti,davinci-gpio-unbanked = <0>; + power-domains = <&k3_pds 107 TI_SCI_PD_EXCLUSIVE>; +@@ -732,7 +730,6 @@ + <167>; + interrupt-controller; + #interrupt-cells = <2>; +- #address-cells = <0>; + ti,ngpio = <69>; + ti,davinci-gpio-unbanked = <0>; + power-domains = <&k3_pds 109 TI_SCI_PD_EXCLUSIVE>; +@@ -750,7 +747,6 @@ + <176>; + interrupt-controller; + #interrupt-cells = <2>; +- #address-cells = <0>; + ti,ngpio = <69>; + ti,davinci-gpio-unbanked = <0>; + power-domains = <&k3_pds 111 TI_SCI_PD_EXCLUSIVE>; +diff --git a/arch/arm64/boot/dts/ti/k3-j7200-mcu-wakeup.dtsi b/arch/arm64/boot/dts/ti/k3-j7200-mcu-wakeup.dtsi +index 5663fe3ea466..343449af53fb 100644 +--- a/arch/arm64/boot/dts/ti/k3-j7200-mcu-wakeup.dtsi ++++ b/arch/arm64/boot/dts/ti/k3-j7200-mcu-wakeup.dtsi +@@ -117,7 +117,6 @@ + interrupts = <103>, <104>, <105>, <106>, <107>, <108>; + interrupt-controller; + #interrupt-cells = <2>; +- #address-cells = <0>; + ti,ngpio = <85>; + ti,davinci-gpio-unbanked = <0>; + power-domains = <&k3_pds 113 TI_SCI_PD_EXCLUSIVE>; +@@ -134,7 +133,6 @@ + interrupts = <112>, <113>, <114>, <115>, <116>, <117>; + interrupt-controller; + #interrupt-cells = <2>; +- #address-cells = <0>; + ti,ngpio = <85>; + ti,davinci-gpio-unbanked = <0>; + power-domains = <&k3_pds 114 TI_SCI_PD_EXCLUSIVE>; +-- +2.30.2 + diff --git a/queue-5.13/arm64-dts-ti-k3-j721e-common-proc-board-re-name-link.patch b/queue-5.13/arm64-dts-ti-k3-j721e-common-proc-board-re-name-link.patch new file mode 100644 index 00000000000..e67d663a83d --- /dev/null +++ b/queue-5.13/arm64-dts-ti-k3-j721e-common-proc-board-re-name-link.patch @@ -0,0 +1,73 @@ +From 901d7191dd364188f901f663cc43256a2b8eb502 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 3 Jun 2021 20:04:27 +0530 +Subject: arm64: dts: ti: k3-j721e-common-proc-board: Re-name "link" name as + "phy" + +From: Kishon Vijay Abraham I + +[ Upstream commit 02b4d9186121d842a53e347f53a86ec7f2c6b0c7 ] + +Commit 66db854b1f62d ("arm64: dts: ti: k3-j721e-common-proc-board: +Configure the PCIe instances") and +commit 02c35dca2b488 ("arm64: dts: ti: k3-j721e: Enable Super-Speed +support for USB0") added PHY DT nodes with node name as "link" +However nodes with #phy-cells should be named 'phy' as discussed in [1]. +Re-name subnodes of serdes in J721E to 'phy'. + +[1] -> http://lore.kernel.org/r/20200909203631.GA3026331@bogus + +Fixes: 66db854b1f62d ("arm64: dts: ti: k3-j721e-common-proc-board: Configure the PCIe instances") +Fixes: 02c35dca2b488 ("arm64: dts: ti: k3-j721e: Enable Super-Speed support for USB0") +Signed-off-by: Kishon Vijay Abraham I +Reviewed-by: Aswath Govindraju +Signed-off-by: Nishanth Menon +Link: https://lore.kernel.org/r/20210603143427.28735-5-kishon@ti.com +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts b/arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts +index 1b25a5ae9635..ffccbc53f1e7 100644 +--- a/arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts ++++ b/arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts +@@ -359,7 +359,7 @@ + }; + + &serdes3 { +- serdes3_usb_link: link@0 { ++ serdes3_usb_link: phy@0 { + reg = <0>; + cdns,num-lanes = <2>; + #phy-cells = <0>; +@@ -674,7 +674,7 @@ + assigned-clocks = <&serdes0 CDNS_SIERRA_PLL_CMNLC>; + assigned-clock-parents = <&wiz0_pll1_refclk>; + +- serdes0_pcie_link: link@0 { ++ serdes0_pcie_link: phy@0 { + reg = <0>; + cdns,num-lanes = <1>; + #phy-cells = <0>; +@@ -687,7 +687,7 @@ + assigned-clocks = <&serdes1 CDNS_SIERRA_PLL_CMNLC>; + assigned-clock-parents = <&wiz1_pll1_refclk>; + +- serdes1_pcie_link: link@0 { ++ serdes1_pcie_link: phy@0 { + reg = <0>; + cdns,num-lanes = <2>; + #phy-cells = <0>; +@@ -700,7 +700,7 @@ + assigned-clocks = <&serdes2 CDNS_SIERRA_PLL_CMNLC>; + assigned-clock-parents = <&wiz2_pll1_refclk>; + +- serdes2_pcie_link: link@0 { ++ serdes2_pcie_link: phy@0 { + reg = <0>; + cdns,num-lanes = <2>; + #phy-cells = <0>; +-- +2.30.2 + diff --git a/queue-5.13/arm64-dts-ti-k3-j721e-common-proc-board-use-external.patch b/queue-5.13/arm64-dts-ti-k3-j721e-common-proc-board-use-external.patch new file mode 100644 index 00000000000..0705d771417 --- /dev/null +++ b/queue-5.13/arm64-dts-ti-k3-j721e-common-proc-board-use-external.patch @@ -0,0 +1,99 @@ +From 470e3b60854c1db89ab84cec705cbb29ba840c1e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 3 Jun 2021 20:04:26 +0530 +Subject: arm64: dts: ti: k3-j721e-common-proc-board: Use external clock for + SERDES + +From: Kishon Vijay Abraham I + +[ Upstream commit f2a7657ad7a821de9cc77d071a5587b243144cd5 ] + +Use external clock for all the SERDES used by PCIe controller. This will +make the same clock used by the local SERDES as well as the clock +provided to the PCIe connector. + +Signed-off-by: Kishon Vijay Abraham I +Reviewed-by: Aswath Govindraju +Signed-off-by: Nishanth Menon +Link: https://lore.kernel.org/r/20210603143427.28735-4-kishon@ti.com +Signed-off-by: Sasha Levin +--- + .../dts/ti/k3-j721e-common-proc-board.dts | 40 +++++++++++++++++++ + 1 file changed, 40 insertions(+) + +diff --git a/arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts b/arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts +index 86f7ab511ee8..1b25a5ae9635 100644 +--- a/arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts ++++ b/arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts +@@ -9,6 +9,7 @@ + #include + #include + #include ++#include + + / { + chosen { +@@ -639,7 +640,40 @@ + clock-frequency = <100000000>; + }; + ++&wiz0_pll1_refclk { ++ assigned-clocks = <&wiz0_pll1_refclk>; ++ assigned-clock-parents = <&cmn_refclk1>; ++}; ++ ++&wiz0_refclk_dig { ++ assigned-clocks = <&wiz0_refclk_dig>; ++ assigned-clock-parents = <&cmn_refclk1>; ++}; ++ ++&wiz1_pll1_refclk { ++ assigned-clocks = <&wiz1_pll1_refclk>; ++ assigned-clock-parents = <&cmn_refclk1>; ++}; ++ ++&wiz1_refclk_dig { ++ assigned-clocks = <&wiz1_refclk_dig>; ++ assigned-clock-parents = <&cmn_refclk1>; ++}; ++ ++&wiz2_pll1_refclk { ++ assigned-clocks = <&wiz2_pll1_refclk>; ++ assigned-clock-parents = <&cmn_refclk1>; ++}; ++ ++&wiz2_refclk_dig { ++ assigned-clocks = <&wiz2_refclk_dig>; ++ assigned-clock-parents = <&cmn_refclk1>; ++}; ++ + &serdes0 { ++ assigned-clocks = <&serdes0 CDNS_SIERRA_PLL_CMNLC>; ++ assigned-clock-parents = <&wiz0_pll1_refclk>; ++ + serdes0_pcie_link: link@0 { + reg = <0>; + cdns,num-lanes = <1>; +@@ -650,6 +684,9 @@ + }; + + &serdes1 { ++ assigned-clocks = <&serdes1 CDNS_SIERRA_PLL_CMNLC>; ++ assigned-clock-parents = <&wiz1_pll1_refclk>; ++ + serdes1_pcie_link: link@0 { + reg = <0>; + cdns,num-lanes = <2>; +@@ -660,6 +697,9 @@ + }; + + &serdes2 { ++ assigned-clocks = <&serdes2 CDNS_SIERRA_PLL_CMNLC>; ++ assigned-clock-parents = <&wiz2_pll1_refclk>; ++ + serdes2_pcie_link: link@0 { + reg = <0>; + cdns,num-lanes = <2>; +-- +2.30.2 + diff --git a/queue-5.13/arm64-dts-ti-k3-j721e-main-fix-external-refclk-input.patch b/queue-5.13/arm64-dts-ti-k3-j721e-main-fix-external-refclk-input.patch new file mode 100644 index 00000000000..a908078716e --- /dev/null +++ b/queue-5.13/arm64-dts-ti-k3-j721e-main-fix-external-refclk-input.patch @@ -0,0 +1,222 @@ +From c9527bf45c1f969892810585293d14612f804cb0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 3 Jun 2021 20:04:24 +0530 +Subject: arm64: dts: ti: k3-j721e-main: Fix external refclk input to SERDES + +From: Kishon Vijay Abraham I + +[ Upstream commit 5c6d0b55b46aeb91355e6a9616decf50a3778c91 ] + +Rename the external refclk inputs to the SERDES from +dummy_cmn_refclk/dummy_cmn_refclk1 to cmn_refclk/cmn_refclk1 +respectively. Also move the external refclk DT nodes outside the +cbass_main DT node. Since in j721e common processor board, only the +cmn_refclk1 is connected to 100MHz clock, fix the clock frequency. + +Fixes: afd094ebe69f ("arm64: dts: ti: k3-j721e-main: Add WIZ and SERDES PHY nodes") +Signed-off-by: Kishon Vijay Abraham I +Reviewed-by: Aswath Govindraju +Signed-off-by: Nishanth Menon +Link: https://lore.kernel.org/r/20210603143427.28735-2-kishon@ti.com +Signed-off-by: Sasha Levin +--- + .../dts/ti/k3-j721e-common-proc-board.dts | 4 ++ + arch/arm64/boot/dts/ti/k3-j721e-main.dtsi | 58 ++++++++++--------- + 2 files changed, 34 insertions(+), 28 deletions(-) + +diff --git a/arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts b/arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts +index 60764366e22b..86f7ab511ee8 100644 +--- a/arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts ++++ b/arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts +@@ -635,6 +635,10 @@ + status = "disabled"; + }; + ++&cmn_refclk1 { ++ clock-frequency = <100000000>; ++}; ++ + &serdes0 { + serdes0_pcie_link: link@0 { + reg = <0>; +diff --git a/arch/arm64/boot/dts/ti/k3-j721e-main.dtsi b/arch/arm64/boot/dts/ti/k3-j721e-main.dtsi +index 3bcafe4c1742..9ce4afd6da62 100644 +--- a/arch/arm64/boot/dts/ti/k3-j721e-main.dtsi ++++ b/arch/arm64/boot/dts/ti/k3-j721e-main.dtsi +@@ -8,6 +8,20 @@ + #include + #include + ++/ { ++ cmn_refclk: clock-cmnrefclk { ++ #clock-cells = <0>; ++ compatible = "fixed-clock"; ++ clock-frequency = <0>; ++ }; ++ ++ cmn_refclk1: clock-cmnrefclk1 { ++ #clock-cells = <0>; ++ compatible = "fixed-clock"; ++ clock-frequency = <0>; ++ }; ++}; ++ + &cbass_main { + msmc_ram: sram@70000000 { + compatible = "mmio-sram"; +@@ -338,24 +352,12 @@ + pinctrl-single,function-mask = <0xffffffff>; + }; + +- dummy_cmn_refclk: dummy-cmn-refclk { +- #clock-cells = <0>; +- compatible = "fixed-clock"; +- clock-frequency = <100000000>; +- }; +- +- dummy_cmn_refclk1: dummy-cmn-refclk1 { +- #clock-cells = <0>; +- compatible = "fixed-clock"; +- clock-frequency = <100000000>; +- }; +- + serdes_wiz0: wiz@5000000 { + compatible = "ti,j721e-wiz-16g"; + #address-cells = <1>; + #size-cells = <1>; + power-domains = <&k3_pds 292 TI_SCI_PD_EXCLUSIVE>; +- clocks = <&k3_clks 292 5>, <&k3_clks 292 11>, <&dummy_cmn_refclk>; ++ clocks = <&k3_clks 292 5>, <&k3_clks 292 11>, <&cmn_refclk>; + clock-names = "fck", "core_ref_clk", "ext_ref_clk"; + assigned-clocks = <&k3_clks 292 11>, <&k3_clks 292 0>; + assigned-clock-parents = <&k3_clks 292 15>, <&k3_clks 292 4>; +@@ -364,21 +366,21 @@ + ranges = <0x5000000 0x0 0x5000000 0x10000>; + + wiz0_pll0_refclk: pll0-refclk { +- clocks = <&k3_clks 292 11>, <&dummy_cmn_refclk>; ++ clocks = <&k3_clks 292 11>, <&cmn_refclk>; + #clock-cells = <0>; + assigned-clocks = <&wiz0_pll0_refclk>; + assigned-clock-parents = <&k3_clks 292 11>; + }; + + wiz0_pll1_refclk: pll1-refclk { +- clocks = <&k3_clks 292 0>, <&dummy_cmn_refclk1>; ++ clocks = <&k3_clks 292 0>, <&cmn_refclk1>; + #clock-cells = <0>; + assigned-clocks = <&wiz0_pll1_refclk>; + assigned-clock-parents = <&k3_clks 292 0>; + }; + + wiz0_refclk_dig: refclk-dig { +- clocks = <&k3_clks 292 11>, <&k3_clks 292 0>, <&dummy_cmn_refclk>, <&dummy_cmn_refclk1>; ++ clocks = <&k3_clks 292 11>, <&k3_clks 292 0>, <&cmn_refclk>, <&cmn_refclk1>; + #clock-cells = <0>; + assigned-clocks = <&wiz0_refclk_dig>; + assigned-clock-parents = <&k3_clks 292 11>; +@@ -412,7 +414,7 @@ + #address-cells = <1>; + #size-cells = <1>; + power-domains = <&k3_pds 293 TI_SCI_PD_EXCLUSIVE>; +- clocks = <&k3_clks 293 5>, <&k3_clks 293 13>, <&dummy_cmn_refclk>; ++ clocks = <&k3_clks 293 5>, <&k3_clks 293 13>, <&cmn_refclk>; + clock-names = "fck", "core_ref_clk", "ext_ref_clk"; + assigned-clocks = <&k3_clks 293 13>, <&k3_clks 293 0>; + assigned-clock-parents = <&k3_clks 293 17>, <&k3_clks 293 4>; +@@ -421,21 +423,21 @@ + ranges = <0x5010000 0x0 0x5010000 0x10000>; + + wiz1_pll0_refclk: pll0-refclk { +- clocks = <&k3_clks 293 13>, <&dummy_cmn_refclk>; ++ clocks = <&k3_clks 293 13>, <&cmn_refclk>; + #clock-cells = <0>; + assigned-clocks = <&wiz1_pll0_refclk>; + assigned-clock-parents = <&k3_clks 293 13>; + }; + + wiz1_pll1_refclk: pll1-refclk { +- clocks = <&k3_clks 293 0>, <&dummy_cmn_refclk1>; ++ clocks = <&k3_clks 293 0>, <&cmn_refclk1>; + #clock-cells = <0>; + assigned-clocks = <&wiz1_pll1_refclk>; + assigned-clock-parents = <&k3_clks 293 0>; + }; + + wiz1_refclk_dig: refclk-dig { +- clocks = <&k3_clks 293 13>, <&k3_clks 293 0>, <&dummy_cmn_refclk>, <&dummy_cmn_refclk1>; ++ clocks = <&k3_clks 293 13>, <&k3_clks 293 0>, <&cmn_refclk>, <&cmn_refclk1>; + #clock-cells = <0>; + assigned-clocks = <&wiz1_refclk_dig>; + assigned-clock-parents = <&k3_clks 293 13>; +@@ -469,7 +471,7 @@ + #address-cells = <1>; + #size-cells = <1>; + power-domains = <&k3_pds 294 TI_SCI_PD_EXCLUSIVE>; +- clocks = <&k3_clks 294 5>, <&k3_clks 294 11>, <&dummy_cmn_refclk>; ++ clocks = <&k3_clks 294 5>, <&k3_clks 294 11>, <&cmn_refclk>; + clock-names = "fck", "core_ref_clk", "ext_ref_clk"; + assigned-clocks = <&k3_clks 294 11>, <&k3_clks 294 0>; + assigned-clock-parents = <&k3_clks 294 15>, <&k3_clks 294 4>; +@@ -478,21 +480,21 @@ + ranges = <0x5020000 0x0 0x5020000 0x10000>; + + wiz2_pll0_refclk: pll0-refclk { +- clocks = <&k3_clks 294 11>, <&dummy_cmn_refclk>; ++ clocks = <&k3_clks 294 11>, <&cmn_refclk>; + #clock-cells = <0>; + assigned-clocks = <&wiz2_pll0_refclk>; + assigned-clock-parents = <&k3_clks 294 11>; + }; + + wiz2_pll1_refclk: pll1-refclk { +- clocks = <&k3_clks 294 0>, <&dummy_cmn_refclk1>; ++ clocks = <&k3_clks 294 0>, <&cmn_refclk1>; + #clock-cells = <0>; + assigned-clocks = <&wiz2_pll1_refclk>; + assigned-clock-parents = <&k3_clks 294 0>; + }; + + wiz2_refclk_dig: refclk-dig { +- clocks = <&k3_clks 294 11>, <&k3_clks 294 0>, <&dummy_cmn_refclk>, <&dummy_cmn_refclk1>; ++ clocks = <&k3_clks 294 11>, <&k3_clks 294 0>, <&cmn_refclk>, <&cmn_refclk1>; + #clock-cells = <0>; + assigned-clocks = <&wiz2_refclk_dig>; + assigned-clock-parents = <&k3_clks 294 11>; +@@ -526,7 +528,7 @@ + #address-cells = <1>; + #size-cells = <1>; + power-domains = <&k3_pds 295 TI_SCI_PD_EXCLUSIVE>; +- clocks = <&k3_clks 295 5>, <&k3_clks 295 9>, <&dummy_cmn_refclk>; ++ clocks = <&k3_clks 295 5>, <&k3_clks 295 9>, <&cmn_refclk>; + clock-names = "fck", "core_ref_clk", "ext_ref_clk"; + assigned-clocks = <&k3_clks 295 9>, <&k3_clks 295 0>; + assigned-clock-parents = <&k3_clks 295 13>, <&k3_clks 295 4>; +@@ -535,21 +537,21 @@ + ranges = <0x5030000 0x0 0x5030000 0x10000>; + + wiz3_pll0_refclk: pll0-refclk { +- clocks = <&k3_clks 295 9>, <&dummy_cmn_refclk>; ++ clocks = <&k3_clks 295 9>, <&cmn_refclk>; + #clock-cells = <0>; + assigned-clocks = <&wiz3_pll0_refclk>; + assigned-clock-parents = <&k3_clks 295 9>; + }; + + wiz3_pll1_refclk: pll1-refclk { +- clocks = <&k3_clks 295 0>, <&dummy_cmn_refclk1>; ++ clocks = <&k3_clks 295 0>, <&cmn_refclk1>; + #clock-cells = <0>; + assigned-clocks = <&wiz3_pll1_refclk>; + assigned-clock-parents = <&k3_clks 295 0>; + }; + + wiz3_refclk_dig: refclk-dig { +- clocks = <&k3_clks 295 9>, <&k3_clks 295 0>, <&dummy_cmn_refclk>, <&dummy_cmn_refclk1>; ++ clocks = <&k3_clks 295 9>, <&k3_clks 295 0>, <&cmn_refclk>, <&cmn_refclk1>; + #clock-cells = <0>; + assigned-clocks = <&wiz3_refclk_dig>; + assigned-clock-parents = <&k3_clks 295 9>; +-- +2.30.2 + diff --git a/queue-5.13/asoc-cs42l42-fix-1536000-bit-clock-instability.patch b/queue-5.13/asoc-cs42l42-fix-1536000-bit-clock-instability.patch new file mode 100644 index 00000000000..e680271caae --- /dev/null +++ b/queue-5.13/asoc-cs42l42-fix-1536000-bit-clock-instability.patch @@ -0,0 +1,127 @@ +From 2448c5228e24c5cdd95aab1c616d7b15d0567680 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 25 May 2021 10:08:19 +0100 +Subject: ASoC: cs42l42: Fix 1536000 Bit Clock instability + +From: Lucas Tanure + +[ Upstream commit 1c52825c38fc4e44c61ed75a8ae32f5fa580383b ] + +The 16 Bits, 2 channels, 48K sample rate use case needs +to configure a safer pll_divout during the start of PLL +After 800us from the start of PLL the correct pll_divout +can be set + +Signed-off-by: Lucas Tanure +Reviewed-by: Richard Fitzgerald +Message-Id: <20210525090822.64577-1-tanureal@opensource.cirrus.com> +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/codecs/cs42l42.c | 47 +++++++++++++++++++++++++------------- + sound/soc/codecs/cs42l42.h | 2 ++ + 2 files changed, 33 insertions(+), 16 deletions(-) + +diff --git a/sound/soc/codecs/cs42l42.c b/sound/soc/codecs/cs42l42.c +index 77473c226f9e..8434c48354f1 100644 +--- a/sound/soc/codecs/cs42l42.c ++++ b/sound/soc/codecs/cs42l42.c +@@ -581,6 +581,7 @@ struct cs42l42_pll_params { + u8 pll_divout; + u32 mclk_int; + u8 pll_cal_ratio; ++ u8 n; + }; + + /* +@@ -588,21 +589,21 @@ struct cs42l42_pll_params { + * Table 4-5 from the Datasheet + */ + static const struct cs42l42_pll_params pll_ratio_table[] = { +- { 1536000, 0, 1, 0x00, 0x7D, 0x000000, 0x03, 0x10, 12000000, 125 }, +- { 2822400, 0, 1, 0x00, 0x40, 0x000000, 0x03, 0x10, 11289600, 128 }, +- { 3000000, 0, 1, 0x00, 0x40, 0x000000, 0x03, 0x10, 12000000, 128 }, +- { 3072000, 0, 1, 0x00, 0x3E, 0x800000, 0x03, 0x10, 12000000, 125 }, +- { 4000000, 0, 1, 0x00, 0x30, 0x800000, 0x03, 0x10, 12000000, 96 }, +- { 4096000, 0, 1, 0x00, 0x2E, 0xE00000, 0x03, 0x10, 12000000, 94 }, +- { 5644800, 0, 1, 0x01, 0x40, 0x000000, 0x03, 0x10, 11289600, 128 }, +- { 6000000, 0, 1, 0x01, 0x40, 0x000000, 0x03, 0x10, 12000000, 128 }, +- { 6144000, 0, 1, 0x01, 0x3E, 0x800000, 0x03, 0x10, 12000000, 125 }, +- { 11289600, 0, 0, 0, 0, 0, 0, 0, 11289600, 0 }, +- { 12000000, 0, 0, 0, 0, 0, 0, 0, 12000000, 0 }, +- { 12288000, 0, 0, 0, 0, 0, 0, 0, 12288000, 0 }, +- { 22579200, 1, 0, 0, 0, 0, 0, 0, 22579200, 0 }, +- { 24000000, 1, 0, 0, 0, 0, 0, 0, 24000000, 0 }, +- { 24576000, 1, 0, 0, 0, 0, 0, 0, 24576000, 0 } ++ { 1536000, 0, 1, 0x00, 0x7D, 0x000000, 0x03, 0x10, 12000000, 125, 2}, ++ { 2822400, 0, 1, 0x00, 0x40, 0x000000, 0x03, 0x10, 11289600, 128, 1}, ++ { 3000000, 0, 1, 0x00, 0x40, 0x000000, 0x03, 0x10, 12000000, 128, 1}, ++ { 3072000, 0, 1, 0x00, 0x3E, 0x800000, 0x03, 0x10, 12000000, 125, 1}, ++ { 4000000, 0, 1, 0x00, 0x30, 0x800000, 0x03, 0x10, 12000000, 96, 1}, ++ { 4096000, 0, 1, 0x00, 0x2E, 0xE00000, 0x03, 0x10, 12000000, 94, 1}, ++ { 5644800, 0, 1, 0x01, 0x40, 0x000000, 0x03, 0x10, 11289600, 128, 1}, ++ { 6000000, 0, 1, 0x01, 0x40, 0x000000, 0x03, 0x10, 12000000, 128, 1}, ++ { 6144000, 0, 1, 0x01, 0x3E, 0x800000, 0x03, 0x10, 12000000, 125, 1}, ++ { 11289600, 0, 0, 0, 0, 0, 0, 0, 11289600, 0, 1}, ++ { 12000000, 0, 0, 0, 0, 0, 0, 0, 12000000, 0, 1}, ++ { 12288000, 0, 0, 0, 0, 0, 0, 0, 12288000, 0, 1}, ++ { 22579200, 1, 0, 0, 0, 0, 0, 0, 22579200, 0, 1}, ++ { 24000000, 1, 0, 0, 0, 0, 0, 0, 24000000, 0, 1}, ++ { 24576000, 1, 0, 0, 0, 0, 0, 0, 24576000, 0, 1} + }; + + static int cs42l42_pll_config(struct snd_soc_component *component) +@@ -738,8 +739,12 @@ static int cs42l42_pll_config(struct snd_soc_component *component) + snd_soc_component_update_bits(component, + CS42L42_PLL_CTL3, + CS42L42_PLL_DIVOUT_MASK, +- pll_ratio_table[i].pll_divout ++ (pll_ratio_table[i].pll_divout * pll_ratio_table[i].n) + << CS42L42_PLL_DIVOUT_SHIFT); ++ if (pll_ratio_table[i].n != 1) ++ cs42l42->pll_divout = pll_ratio_table[i].pll_divout; ++ else ++ cs42l42->pll_divout = 0; + snd_soc_component_update_bits(component, + CS42L42_PLL_CAL_RATIO, + CS42L42_PLL_CAL_RATIO_MASK, +@@ -894,6 +899,16 @@ static int cs42l42_mute_stream(struct snd_soc_dai *dai, int mute, int stream) + if ((cs42l42->bclk < 11289600) && (cs42l42->sclk < 11289600)) { + snd_soc_component_update_bits(component, CS42L42_PLL_CTL1, + CS42L42_PLL_START_MASK, 1); ++ ++ if (cs42l42->pll_divout) { ++ usleep_range(CS42L42_PLL_DIVOUT_TIME_US, ++ CS42L42_PLL_DIVOUT_TIME_US * 2); ++ snd_soc_component_update_bits(component, CS42L42_PLL_CTL3, ++ CS42L42_PLL_DIVOUT_MASK, ++ cs42l42->pll_divout << ++ CS42L42_PLL_DIVOUT_SHIFT); ++ } ++ + ret = regmap_read_poll_timeout(cs42l42->regmap, + CS42L42_PLL_LOCK_STATUS, + regval, +diff --git a/sound/soc/codecs/cs42l42.h b/sound/soc/codecs/cs42l42.h +index 386c40f9ed31..5384105afe50 100644 +--- a/sound/soc/codecs/cs42l42.h ++++ b/sound/soc/codecs/cs42l42.h +@@ -755,6 +755,7 @@ + + #define CS42L42_NUM_SUPPLIES 5 + #define CS42L42_BOOT_TIME_US 3000 ++#define CS42L42_PLL_DIVOUT_TIME_US 800 + #define CS42L42_CLOCK_SWITCH_DELAY_US 150 + #define CS42L42_PLL_LOCK_POLL_US 250 + #define CS42L42_PLL_LOCK_TIMEOUT_US 1250 +@@ -777,6 +778,7 @@ struct cs42l42_private { + int bclk; + u32 sclk; + u32 srate; ++ u8 pll_divout; + u8 plug_state; + u8 hs_type; + u8 ts_inv; +-- +2.30.2 + diff --git a/queue-5.13/asoc-fsl_xcvr-check-return-value-after-calling-platf.patch b/queue-5.13/asoc-fsl_xcvr-check-return-value-after-calling-platf.patch new file mode 100644 index 00000000000..4b6fcaa7c22 --- /dev/null +++ b/queue-5.13/asoc-fsl_xcvr-check-return-value-after-calling-platf.patch @@ -0,0 +1,39 @@ +From b222bc078b4b665fcf06d81fdf122a5b4940506a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 15 Jun 2021 09:39:22 +0800 +Subject: ASoC: fsl_xcvr: check return value after calling + platform_get_resource_byname() + +From: Yang Yingliang + +[ Upstream commit a2f6ed4a44721d3a9fdf4da7e0743cb13866bf61 ] + +It will cause null-ptr-deref if platform_get_resource_byname() returns NULL, +we need check the return value. + +Signed-off-by: Yang Yingliang +Link: https://lore.kernel.org/r/20210615013922.784296-10-yangyingliang@huawei.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/fsl/fsl_xcvr.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/sound/soc/fsl/fsl_xcvr.c b/sound/soc/fsl/fsl_xcvr.c +index 46f3f2c68756..535e17251a35 100644 +--- a/sound/soc/fsl/fsl_xcvr.c ++++ b/sound/soc/fsl/fsl_xcvr.c +@@ -1202,6 +1202,10 @@ static int fsl_xcvr_probe(struct platform_device *pdev) + + rx_res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "rxfifo"); + tx_res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "txfifo"); ++ if (!rx_res || !tx_res) { ++ dev_err(dev, "could not find rxfifo or txfifo resource\n"); ++ return -EINVAL; ++ } + xcvr->dma_prms_rx.chan_name = "rx"; + xcvr->dma_prms_tx.chan_name = "tx"; + xcvr->dma_prms_rx.addr = rx_res->start; +-- +2.30.2 + diff --git a/queue-5.13/asoc-img-fix-pm-reference-leak-in-img_i2s_in_probe.patch b/queue-5.13/asoc-img-fix-pm-reference-leak-in-img_i2s_in_probe.patch new file mode 100644 index 00000000000..29a575b42e6 --- /dev/null +++ b/queue-5.13/asoc-img-fix-pm-reference-leak-in-img_i2s_in_probe.patch @@ -0,0 +1,39 @@ +From 6fb7989b45794b549e699415293305c89cde347a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 24 May 2021 05:35:21 -0400 +Subject: ASoC: img: Fix PM reference leak in img_i2s_in_probe() + +From: Yufen Yu + +[ Upstream commit 81aad47278539f02de808bcc8251fed0ad3d6f55 ] + +pm_runtime_get_sync will increment pm usage counter even it failed. +Forgetting to putting operation will result in reference leak here. +Fix it by replacing it with pm_runtime_resume_and_get to keep usage +counter balanced. + +Reported-by: Hulk Robot +Signed-off-by: Yufen Yu +Link: https://lore.kernel.org/r/20210524093521.612176-1-yuyufen@huawei.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/img/img-i2s-in.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sound/soc/img/img-i2s-in.c b/sound/soc/img/img-i2s-in.c +index 0843235d73c9..fd3432a1d6ab 100644 +--- a/sound/soc/img/img-i2s-in.c ++++ b/sound/soc/img/img-i2s-in.c +@@ -464,7 +464,7 @@ static int img_i2s_in_probe(struct platform_device *pdev) + if (ret) + goto err_pm_disable; + } +- ret = pm_runtime_get_sync(&pdev->dev); ++ ret = pm_runtime_resume_and_get(&pdev->dev); + if (ret < 0) + goto err_suspend; + +-- +2.30.2 + diff --git a/queue-5.13/asoc-intel-boards-add-missing-module_device_table.patch b/queue-5.13/asoc-intel-boards-add-missing-module_device_table.patch new file mode 100644 index 00000000000..ee6b8bad49c --- /dev/null +++ b/queue-5.13/asoc-intel-boards-add-missing-module_device_table.patch @@ -0,0 +1,50 @@ +From 2f3ce4d2586440e238c049e8fcd84ca80f014e16 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 12 May 2021 11:54:07 +0800 +Subject: ASoC: intel/boards: add missing MODULE_DEVICE_TABLE + +From: Zou Wei + +[ Upstream commit a75e5cdf4dd1307bb1541edbb0c008f40896644c ] + +This patch adds missing MODULE_DEVICE_TABLE definition which generates +correct modalias for automatic loading of this driver when it is built +as an external module. + +Reported-by: Hulk Robot +Signed-off-by: Zou Wei +Link: https://lore.kernel.org/r/1620791647-16024-1-git-send-email-zou_wei@huawei.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/intel/boards/sof_da7219_max98373.c | 1 + + sound/soc/intel/boards/sof_rt5682.c | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/sound/soc/intel/boards/sof_da7219_max98373.c b/sound/soc/intel/boards/sof_da7219_max98373.c +index f3cb0773e70e..8d1ad892e86b 100644 +--- a/sound/soc/intel/boards/sof_da7219_max98373.c ++++ b/sound/soc/intel/boards/sof_da7219_max98373.c +@@ -440,6 +440,7 @@ static const struct platform_device_id board_ids[] = { + }, + { } + }; ++MODULE_DEVICE_TABLE(platform, board_ids); + + static struct platform_driver audio = { + .probe = audio_probe, +diff --git a/sound/soc/intel/boards/sof_rt5682.c b/sound/soc/intel/boards/sof_rt5682.c +index 58548ea0d915..cf1d053733e2 100644 +--- a/sound/soc/intel/boards/sof_rt5682.c ++++ b/sound/soc/intel/boards/sof_rt5682.c +@@ -968,6 +968,7 @@ static const struct platform_device_id board_ids[] = { + }, + { } + }; ++MODULE_DEVICE_TABLE(platform, board_ids); + + static struct platform_driver sof_audio = { + .probe = sof_audio_probe, +-- +2.30.2 + diff --git a/queue-5.13/asoc-intel-kbl_da7219_max98357a-shrink-platform_id-b.patch b/queue-5.13/asoc-intel-kbl_da7219_max98357a-shrink-platform_id-b.patch new file mode 100644 index 00000000000..3b34d255c4c --- /dev/null +++ b/queue-5.13/asoc-intel-kbl_da7219_max98357a-shrink-platform_id-b.patch @@ -0,0 +1,64 @@ +From 84346d1e12262dc851ea92e364f11938f6812198 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 21 Jun 2021 14:40:52 -0500 +Subject: ASoC: Intel: kbl_da7219_max98357a: shrink platform_id below 20 + characters + +From: Pierre-Louis Bossart + +[ Upstream commit 94efd726b947f265bd313605c9f73edec5469d65 ] + +Sparse throws the following warnings: + +sound/soc/intel/boards/kbl_da7219_max98357a.c:647:25: error: too long +initializer-string for array of char(no space for nul char) + +Fix by using the 'mx' acronym for Maxim. + +Signed-off-by: Pierre-Louis Bossart +Reviewed-by: Paul Olaru +Reviewed-by: Guennadi Liakhovetski +Reviewed-by: Rander Wang +Link: https://lore.kernel.org/r/20210621194057.21711-6-pierre-louis.bossart@linux.intel.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/intel/boards/kbl_da7219_max98357a.c | 4 ++-- + sound/soc/intel/common/soc-acpi-intel-kbl-match.c | 2 +- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/sound/soc/intel/boards/kbl_da7219_max98357a.c b/sound/soc/intel/boards/kbl_da7219_max98357a.c +index c0d8a73c6d21..7ca3347dbd2e 100644 +--- a/sound/soc/intel/boards/kbl_da7219_max98357a.c ++++ b/sound/soc/intel/boards/kbl_da7219_max98357a.c +@@ -644,7 +644,7 @@ static int kabylake_audio_probe(struct platform_device *pdev) + + static const struct platform_device_id kbl_board_ids[] = { + { +- .name = "kbl_da7219_max98357a", ++ .name = "kbl_da7219_mx98357a", + .driver_data = + (kernel_ulong_t)&kabylake_audio_card_da7219_m98357a, + }, +@@ -666,4 +666,4 @@ module_platform_driver(kabylake_audio) + MODULE_DESCRIPTION("Audio Machine driver-DA7219 & MAX98357A in I2S mode"); + MODULE_AUTHOR("Naveen Manohar "); + MODULE_LICENSE("GPL v2"); +-MODULE_ALIAS("platform:kbl_da7219_max98357a"); ++MODULE_ALIAS("platform:kbl_da7219_mx98357a"); +diff --git a/sound/soc/intel/common/soc-acpi-intel-kbl-match.c b/sound/soc/intel/common/soc-acpi-intel-kbl-match.c +index 47dadc9d5d2a..ba5ff468c265 100644 +--- a/sound/soc/intel/common/soc-acpi-intel-kbl-match.c ++++ b/sound/soc/intel/common/soc-acpi-intel-kbl-match.c +@@ -113,7 +113,7 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_kbl_machines[] = { + }, + { + .id = "DLGS7219", +- .drv_name = "kbl_da7219_max98373", ++ .drv_name = "kbl_da7219_mx98373", + .fw_filename = "intel/dsp_fw_kbl.bin", + .machine_quirk = snd_soc_acpi_codec_list, + .quirk_data = &kbl_7219_98373_codecs, +-- +2.30.2 + diff --git a/queue-5.13/asoc-intel-sof_sdw-add-mutual-exclusion-between-pch-.patch b/queue-5.13/asoc-intel-sof_sdw-add-mutual-exclusion-between-pch-.patch new file mode 100644 index 00000000000..47adbe7bb51 --- /dev/null +++ b/queue-5.13/asoc-intel-sof_sdw-add-mutual-exclusion-between-pch-.patch @@ -0,0 +1,134 @@ +From c92a4c38ebf74f9cfe56171be6c2db8fb7f8866e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 5 May 2021 11:36:56 -0500 +Subject: ASoC: Intel: sof_sdw: add mutual exclusion between PCH DMIC and RT715 + +From: Pierre-Louis Bossart + +[ Upstream commit 35564e2bf94611c3eb51d35362addb3cb394ad54 ] + +When external RT714/715 devices are used for capture, we don't want +the PCH DMICs to be used. + +Any information provided by the SOF platform driver or DMI quirks will +be overridden. + +Signed-off-by: Pierre-Louis Bossart +Reviewed-by: Kai Vehmanen +Reviewed-by: Libin Yang +Link: https://lore.kernel.org/r/20210505163705.305616-5-pierre-louis.bossart@linux.intel.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/intel/boards/sof_sdw.c | 19 +++++++++++++++++-- + sound/soc/intel/boards/sof_sdw_common.h | 1 + + 2 files changed, 18 insertions(+), 2 deletions(-) + +diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c +index dfad2ad129ab..5827a16773c9 100644 +--- a/sound/soc/intel/boards/sof_sdw.c ++++ b/sound/soc/intel/boards/sof_sdw.c +@@ -354,6 +354,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { + .part_id = 0x714, + .version_id = 3, + .direction = {false, true}, ++ .ignore_pch_dmic = true, + .dai_name = "rt715-aif2", + .init = sof_sdw_rt715_sdca_init, + }, +@@ -361,6 +362,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { + .part_id = 0x715, + .version_id = 3, + .direction = {false, true}, ++ .ignore_pch_dmic = true, + .dai_name = "rt715-aif2", + .init = sof_sdw_rt715_sdca_init, + }, +@@ -368,6 +370,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { + .part_id = 0x714, + .version_id = 2, + .direction = {false, true}, ++ .ignore_pch_dmic = true, + .dai_name = "rt715-aif2", + .init = sof_sdw_rt715_init, + }, +@@ -375,6 +378,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { + .part_id = 0x715, + .version_id = 2, + .direction = {false, true}, ++ .ignore_pch_dmic = true, + .dai_name = "rt715-aif2", + .init = sof_sdw_rt715_init, + }, +@@ -730,7 +734,8 @@ static int create_sdw_dailink(struct device *dev, int *be_index, + int *cpu_id, bool *group_generated, + struct snd_soc_codec_conf *codec_conf, + int codec_count, +- int *codec_conf_index) ++ int *codec_conf_index, ++ bool *ignore_pch_dmic) + { + const struct snd_soc_acpi_link_adr *link_next; + struct snd_soc_dai_link_component *codecs; +@@ -783,6 +788,9 @@ static int create_sdw_dailink(struct device *dev, int *be_index, + if (codec_index < 0) + return codec_index; + ++ if (codec_info_list[codec_index].ignore_pch_dmic) ++ *ignore_pch_dmic = true; ++ + cpu_dai_index = *cpu_id; + for_each_pcm_streams(stream) { + char *name, *cpu_name; +@@ -914,6 +922,7 @@ static int sof_card_dai_links_create(struct device *dev, + const struct snd_soc_acpi_link_adr *adr_link; + struct snd_soc_dai_link_component *cpus; + struct snd_soc_codec_conf *codec_conf; ++ bool ignore_pch_dmic = false; + int codec_conf_count; + int codec_conf_index = 0; + bool group_generated[SDW_MAX_GROUPS]; +@@ -1020,7 +1029,8 @@ static int sof_card_dai_links_create(struct device *dev, + sdw_cpu_dai_num, cpus, adr_link, + &cpu_id, group_generated, + codec_conf, codec_conf_count, +- &codec_conf_index); ++ &codec_conf_index, ++ &ignore_pch_dmic); + if (ret < 0) { + dev_err(dev, "failed to create dai link %d", be_id); + return -ENOMEM; +@@ -1088,6 +1098,10 @@ SSP: + DMIC: + /* dmic */ + if (dmic_num > 0) { ++ if (ignore_pch_dmic) { ++ dev_warn(dev, "Ignoring PCH DMIC\n"); ++ goto HDMI; ++ } + cpus[cpu_id].dai_name = "DMIC01 Pin"; + init_dai_link(dev, links + link_id, be_id, "dmic01", + 0, 1, // DMIC only supports capture +@@ -1106,6 +1120,7 @@ DMIC: + INC_ID(be_id, cpu_id, link_id); + } + ++HDMI: + /* HDMI */ + if (hdmi_num > 0) { + idisp_components = devm_kcalloc(dev, hdmi_num, +diff --git a/sound/soc/intel/boards/sof_sdw_common.h b/sound/soc/intel/boards/sof_sdw_common.h +index f3cb6796363e..ea60e8ed215c 100644 +--- a/sound/soc/intel/boards/sof_sdw_common.h ++++ b/sound/soc/intel/boards/sof_sdw_common.h +@@ -56,6 +56,7 @@ struct sof_sdw_codec_info { + int amp_num; + const u8 acpi_id[ACPI_ID_LEN]; + const bool direction[2]; // playback & capture support ++ const bool ignore_pch_dmic; + const char *dai_name; + const struct snd_soc_ops *ops; + +-- +2.30.2 + diff --git a/queue-5.13/asoc-intel-sof_sdw-add-quirk-support-for-brya-and-bt.patch b/queue-5.13/asoc-intel-sof_sdw-add-quirk-support-for-brya-and-bt.patch new file mode 100644 index 00000000000..0612d7c299b --- /dev/null +++ b/queue-5.13/asoc-intel-sof_sdw-add-quirk-support-for-brya-and-bt.patch @@ -0,0 +1,56 @@ +From 6c0a79a5cce70a4a7ef3a52f606031b561b2ace3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 21 May 2021 18:56:32 +0300 +Subject: ASoC: Intel: sof_sdw: add quirk support for Brya and BT-offload + +From: Vamshi Krishna Gopal + +[ Upstream commit 03effde3a2ea1d82c4dd6b634fc6174545d2c34f ] + +Brya is another ADL-P product. + +AlderLake has support for Bluetooth audio offload capability. +Enable the BT-offload quirk for ADL-P Brya and the Intel RVP. + +Signed-off-by: Vamshi Krishna Gopal +Signed-off-by: Yong Zhi +Reviewed-by: Bard Liao +Reviewed-by: Ranjani Sridharan +Signed-off-by: Kai Vehmanen +Link: https://lore.kernel.org/r/20210521155632.3736393-2-kai.vehmanen@linux.intel.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/intel/boards/sof_sdw.c | 16 +++++++++++++++- + 1 file changed, 15 insertions(+), 1 deletion(-) + +diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c +index 5827a16773c9..2ba3eefb9c8d 100644 +--- a/sound/soc/intel/boards/sof_sdw.c ++++ b/sound/soc/intel/boards/sof_sdw.c +@@ -197,7 +197,21 @@ static const struct dmi_system_id sof_sdw_quirk_table[] = { + .driver_data = (void *)(SOF_RT711_JD_SRC_JD1 | + SOF_SDW_TGL_HDMI | + SOF_RT715_DAI_ID_FIX | +- SOF_SDW_PCH_DMIC), ++ SOF_SDW_PCH_DMIC | ++ SOF_BT_OFFLOAD_SSP(2) | ++ SOF_SSP_BT_OFFLOAD_PRESENT), ++ }, ++ { ++ .callback = sof_sdw_quirk_cb, ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "Google"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "Brya"), ++ }, ++ .driver_data = (void *)(SOF_SDW_TGL_HDMI | ++ SOF_SDW_PCH_DMIC | ++ SOF_SDW_FOUR_SPK | ++ SOF_BT_OFFLOAD_SSP(2) | ++ SOF_SSP_BT_OFFLOAD_PRESENT), + }, + {} + }; +-- +2.30.2 + diff --git a/queue-5.13/asoc-soc-core-fix-the-error-return-code-in-snd_soc_o.patch b/queue-5.13/asoc-soc-core-fix-the-error-return-code-in-snd_soc_o.patch new file mode 100644 index 00000000000..343e0494e59 --- /dev/null +++ b/queue-5.13/asoc-soc-core-fix-the-error-return-code-in-snd_soc_o.patch @@ -0,0 +1,37 @@ +From 176ed3d1ca482dfe732bb9ca600cd663029c5900 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 17 Jun 2021 18:37:29 +0800 +Subject: ASoC: soc-core: Fix the error return code in + snd_soc_of_parse_audio_routing() + +From: Zhen Lei + +[ Upstream commit 7d3865a10b9ff2669c531d5ddd60bf46b3d48f1e ] + +When devm_kcalloc() fails, the error code -ENOMEM should be returned +instead of -EINVAL. + +Signed-off-by: Zhen Lei +Link: https://lore.kernel.org/r/20210617103729.1918-1-thunder.leizhen@huawei.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/soc-core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c +index a76974ccfce1..af0129cf90a2 100644 +--- a/sound/soc/soc-core.c ++++ b/sound/soc/soc-core.c +@@ -2793,7 +2793,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, + if (!routes) { + dev_err(card->dev, + "ASoC: Could not allocate DAPM route table\n"); +- return -EINVAL; ++ return -ENOMEM; + } + + for (i = 0; i < num_routes; i++) { +-- +2.30.2 + diff --git a/queue-5.13/asoc-soc-pcm-fix-the-return-value-in-dpcm_apply_symm.patch b/queue-5.13/asoc-soc-pcm-fix-the-return-value-in-dpcm_apply_symm.patch new file mode 100644 index 00000000000..4ced9708776 --- /dev/null +++ b/queue-5.13/asoc-soc-pcm-fix-the-return-value-in-dpcm_apply_symm.patch @@ -0,0 +1,39 @@ +From 7a4cff3afc20a4ed76d33e7aff1fc990ea88a8e4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 14 Jun 2021 09:17:46 +0200 +Subject: ASoC: soc-pcm: fix the return value in dpcm_apply_symmetry() + +From: Jaroslav Kysela + +[ Upstream commit 12ffd726824a2f52486f72338b6fd3244b512959 ] + +In case, where the loops are not executed for a reason, the uninitialized +variable 'err' is returned to the caller. Make code fully predictible +and assign zero in the declaration. + +Signed-off-by: Jaroslav Kysela +Cc: Mark Brown +Cc: Kuninori Morimoto +Link: https://lore.kernel.org/r/20210614071746.1787072-1-perex@perex.cz +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/soc-pcm.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c +index 8659089a87a0..46513bb97904 100644 +--- a/sound/soc/soc-pcm.c ++++ b/sound/soc/soc-pcm.c +@@ -1700,7 +1700,7 @@ static int dpcm_apply_symmetry(struct snd_pcm_substream *fe_substream, + struct snd_soc_dpcm *dpcm; + struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(fe_substream); + struct snd_soc_dai *fe_cpu_dai; +- int err; ++ int err = 0; + int i; + + /* apply symmetry for FE */ +-- +2.30.2 + diff --git a/queue-5.13/asoc-sof-topology-fix-assignment-to-use-le32_to_cpu.patch b/queue-5.13/asoc-sof-topology-fix-assignment-to-use-le32_to_cpu.patch new file mode 100644 index 00000000000..fe3a7485694 --- /dev/null +++ b/queue-5.13/asoc-sof-topology-fix-assignment-to-use-le32_to_cpu.patch @@ -0,0 +1,38 @@ +From 3752af9c1f3715720f3530fef443633a1bf4fc5f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 21 May 2021 12:28:02 +0300 +Subject: ASoC: SOF: topology: fix assignment to use le32_to_cpu + +From: Jaska Uimonen + +[ Upstream commit ccaea61a8d1b8180cc3c470e383381884e4bc1f2 ] + +Fix sparse warning by using le32_to_cpu. + +Signed-off-by: Jaska Uimonen +Reviewed-by: Pierre-Louis Bossart +Reviewed-by: Ranjani Sridharan +Signed-off-by: Kai Vehmanen +Link: https://lore.kernel.org/r/20210521092804.3721324-6-kai.vehmanen@linux.intel.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/sof/topology.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c +index 59abcfc9bd55..cb16b2bd8c21 100644 +--- a/sound/soc/sof/topology.c ++++ b/sound/soc/sof/topology.c +@@ -3335,7 +3335,7 @@ static int sof_link_load(struct snd_soc_component *scomp, int index, + /* Copy common data to all config ipc structs */ + for (i = 0; i < num_conf; i++) { + config[i].hdr.cmd = SOF_IPC_GLB_DAI_MSG | SOF_IPC_DAI_CONFIG; +- config[i].format = hw_config[i].fmt; ++ config[i].format = le32_to_cpu(hw_config[i].fmt); + config[i].type = common_config.type; + config[i].dai_index = common_config.dai_index; + } +-- +2.30.2 + diff --git a/queue-5.13/backlight-lm3630a-fix-return-code-of-.update_status-.patch b/queue-5.13/backlight-lm3630a-fix-return-code-of-.update_status-.patch new file mode 100644 index 00000000000..9124cb51f4f --- /dev/null +++ b/queue-5.13/backlight-lm3630a-fix-return-code-of-.update_status-.patch @@ -0,0 +1,74 @@ +From f921431a3fd741ddbcf2e990c7cc7a60a734632d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 21 Jun 2021 14:21:47 +0200 +Subject: backlight: lm3630a: Fix return code of .update_status() callback +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Uwe Kleine-König + +[ Upstream commit b9481a667a90ec739995e85f91f3672ca44d6ffa ] + +According to .update_status() is supposed to +return 0 on success and a negative error code otherwise. Adapt +lm3630a_bank_a_update_status() and lm3630a_bank_b_update_status() to +actually do it. + +While touching that also add the error code to the failure message. + +Signed-off-by: Uwe Kleine-König +Reviewed-by: Daniel Thompson +Signed-off-by: Lee Jones +Signed-off-by: Sasha Levin +--- + drivers/video/backlight/lm3630a_bl.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/drivers/video/backlight/lm3630a_bl.c b/drivers/video/backlight/lm3630a_bl.c +index 662029d6a3dc..419b0334cf08 100644 +--- a/drivers/video/backlight/lm3630a_bl.c ++++ b/drivers/video/backlight/lm3630a_bl.c +@@ -190,7 +190,7 @@ static int lm3630a_bank_a_update_status(struct backlight_device *bl) + if ((pwm_ctrl & LM3630A_PWM_BANK_A) != 0) { + lm3630a_pwm_ctrl(pchip, bl->props.brightness, + bl->props.max_brightness); +- return bl->props.brightness; ++ return 0; + } + + /* disable sleep */ +@@ -210,8 +210,8 @@ static int lm3630a_bank_a_update_status(struct backlight_device *bl) + return 0; + + out_i2c_err: +- dev_err(pchip->dev, "i2c failed to access\n"); +- return bl->props.brightness; ++ dev_err(pchip->dev, "i2c failed to access (%pe)\n", ERR_PTR(ret)); ++ return ret; + } + + static int lm3630a_bank_a_get_brightness(struct backlight_device *bl) +@@ -267,7 +267,7 @@ static int lm3630a_bank_b_update_status(struct backlight_device *bl) + if ((pwm_ctrl & LM3630A_PWM_BANK_B) != 0) { + lm3630a_pwm_ctrl(pchip, bl->props.brightness, + bl->props.max_brightness); +- return bl->props.brightness; ++ return 0; + } + + /* disable sleep */ +@@ -287,8 +287,8 @@ static int lm3630a_bank_b_update_status(struct backlight_device *bl) + return 0; + + out_i2c_err: +- dev_err(pchip->dev, "i2c failed to access REG_CTRL\n"); +- return bl->props.brightness; ++ dev_err(pchip->dev, "i2c failed to access (%pe)\n", ERR_PTR(ret)); ++ return ret; + } + + static int lm3630a_bank_b_get_brightness(struct backlight_device *bl) +-- +2.30.2 + diff --git a/queue-5.13/block-fix-the-problem-of-io_ticks-becoming-smaller.patch b/queue-5.13/block-fix-the-problem-of-io_ticks-becoming-smaller.patch new file mode 100644 index 00000000000..c83ff2147e7 --- /dev/null +++ b/queue-5.13/block-fix-the-problem-of-io_ticks-becoming-smaller.patch @@ -0,0 +1,42 @@ +From 88f6eb4b6b9281a039a0bf8da1f9e739a3838efe Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 6 Jul 2021 05:47:26 +0800 +Subject: block: fix the problem of io_ticks becoming smaller + +From: Chunguang Xu + +[ Upstream commit d80c228d44640f0b47b57a2ca4afa26ef87e16b0 ] + +On the IO submission path, blk_account_io_start() may interrupt +the system interruption. When the interruption returns, the value +of part->stamp may have been updated by other cores, so the time +value collected before the interruption may be less than part-> +stamp. So when this happens, we should do nothing to make io_ticks +more accurate? For kernels less than 5.0, this may cause io_ticks +to become smaller, which in turn may cause abnormal ioutil values. + +Signed-off-by: Chunguang Xu +Reviewed-by: Christoph Hellwig +Link: https://lore.kernel.org/r/1625521646-1069-1-git-send-email-brookxu.cn@gmail.com +Signed-off-by: Jens Axboe +Signed-off-by: Sasha Levin +--- + block/blk-core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/block/blk-core.c b/block/blk-core.c +index 9bcdae93f6d4..ce0125efbaa7 100644 +--- a/block/blk-core.c ++++ b/block/blk-core.c +@@ -1253,7 +1253,7 @@ static void update_io_ticks(struct block_device *part, unsigned long now, + unsigned long stamp; + again: + stamp = READ_ONCE(part->bd_stamp); +- if (unlikely(stamp != now)) { ++ if (unlikely(time_after(now, stamp))) { + if (likely(cmpxchg(&part->bd_stamp, stamp, now) == stamp)) + __part_stat_add(part, io_ticks, end ? now - stamp : 1); + } +-- +2.30.2 + diff --git a/queue-5.13/block-grab-a-device-refcount-in-disk_uevent.patch b/queue-5.13/block-grab-a-device-refcount-in-disk_uevent.patch new file mode 100644 index 00000000000..3f91adc657f --- /dev/null +++ b/queue-5.13/block-grab-a-device-refcount-in-disk_uevent.patch @@ -0,0 +1,44 @@ +From 84104052d93977ed1de374998c4cddf8bcfc67c5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 1 Jul 2021 10:16:37 +0200 +Subject: block: grab a device refcount in disk_uevent + +From: Christoph Hellwig + +[ Upstream commit 498dcc13fd6463de29b94e160f40ed04d5477cd8 ] + +Sending uevents requires the struct device to be alive. To +ensure that grab the device refcount instead of just an inode +reference. + +Fixes: bc359d03c7ec ("block: add a disk_uevent helper") +Signed-off-by: Christoph Hellwig +Link: https://lore.kernel.org/r/20210701081638.246552-2-hch@lst.de +Signed-off-by: Jens Axboe +Signed-off-by: Sasha Levin +--- + block/genhd.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/block/genhd.c b/block/genhd.c +index 9f8cb7beaad1..ad7436bd60c1 100644 +--- a/block/genhd.c ++++ b/block/genhd.c +@@ -402,12 +402,12 @@ void disk_uevent(struct gendisk *disk, enum kobject_action action) + xa_for_each(&disk->part_tbl, idx, part) { + if (bdev_is_partition(part) && !bdev_nr_sectors(part)) + continue; +- if (!bdgrab(part)) ++ if (!kobject_get_unless_zero(&part->bd_device.kobj)) + continue; + + rcu_read_unlock(); + kobject_uevent(bdev_kobj(part), action); +- bdput(part); ++ put_device(&part->bd_device); + rcu_read_lock(); + } + rcu_read_unlock(); +-- +2.30.2 + diff --git a/queue-5.13/ceph-remove-bogus-checks-and-warn_ons-from-ceph_set_.patch b/queue-5.13/ceph-remove-bogus-checks-and-warn_ons-from-ceph_set_.patch new file mode 100644 index 00000000000..bd4f1ed7a4d --- /dev/null +++ b/queue-5.13/ceph-remove-bogus-checks-and-warn_ons-from-ceph_set_.patch @@ -0,0 +1,56 @@ +From 531348c6fa7c3fd75b26402396320161d0758fd5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 4 May 2021 10:08:30 -0400 +Subject: ceph: remove bogus checks and WARN_ONs from ceph_set_page_dirty + +From: Jeff Layton + +[ Upstream commit 22d41cdcd3cfd467a4af074165357fcbea1c37f5 ] + +The checks for page->mapping are odd, as set_page_dirty is an +address_space operation, and I don't see where it would be called on a +non-pagecache page. + +The warning about the page lock also seems bogus. The comment over +set_page_dirty() says that it can be called without the page lock in +some rare cases. I don't think we want to warn if that's the case. + +Reported-by: Matthew Wilcox +Signed-off-by: Jeff Layton +Signed-off-by: Ilya Dryomov +Signed-off-by: Sasha Levin +--- + fs/ceph/addr.c | 10 +--------- + 1 file changed, 1 insertion(+), 9 deletions(-) + +diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c +index c1570fada3d8..998dc4dfdc6b 100644 +--- a/fs/ceph/addr.c ++++ b/fs/ceph/addr.c +@@ -82,10 +82,6 @@ static int ceph_set_page_dirty(struct page *page) + struct inode *inode; + struct ceph_inode_info *ci; + struct ceph_snap_context *snapc; +- int ret; +- +- if (unlikely(!mapping)) +- return !TestSetPageDirty(page); + + if (PageDirty(page)) { + dout("%p set_page_dirty %p idx %lu -- already dirty\n", +@@ -130,11 +126,7 @@ static int ceph_set_page_dirty(struct page *page) + BUG_ON(PagePrivate(page)); + attach_page_private(page, snapc); + +- ret = __set_page_dirty_nobuffers(page); +- WARN_ON(!PageLocked(page)); +- WARN_ON(!page->mapping); +- +- return ret; ++ return __set_page_dirty_nobuffers(page); + } + + /* +-- +2.30.2 + diff --git a/queue-5.13/cpufreq-cppc-fix-potential-memleak-in-cppc_cpufreq_c.patch b/queue-5.13/cpufreq-cppc-fix-potential-memleak-in-cppc_cpufreq_c.patch new file mode 100644 index 00000000000..5a8dbb45f6a --- /dev/null +++ b/queue-5.13/cpufreq-cppc-fix-potential-memleak-in-cppc_cpufreq_c.patch @@ -0,0 +1,89 @@ +From 1ec0bfd1682cf17002f5706c1f980d17d384916d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 18 Jun 2021 13:31:27 +0530 +Subject: cpufreq: CPPC: Fix potential memleak in cppc_cpufreq_cpu_init + +From: Viresh Kumar + +[ Upstream commit fe2535a44904a77615a3af8e8fd7dafb98fb0e1b ] + +It's a classic example of memleak, we allocate something, we fail and +never free the resources. + +Make sure we free all resources on policy ->init() failures. + +Fixes: a28b2bfc099c ("cppc_cpufreq: replace per-cpu data array with a list") +Tested-by: Vincent Guittot +Reviewed-by: Ionela Voinescu +Tested-by: Qian Cai +Signed-off-by: Viresh Kumar +Signed-off-by: Sasha Levin +--- + drivers/cpufreq/cppc_cpufreq.c | 27 ++++++++++++++++++++------- + 1 file changed, 20 insertions(+), 7 deletions(-) + +diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c +index 2f769b1630c5..a27445f40d2c 100644 +--- a/drivers/cpufreq/cppc_cpufreq.c ++++ b/drivers/cpufreq/cppc_cpufreq.c +@@ -182,6 +182,16 @@ static int cppc_verify_policy(struct cpufreq_policy_data *policy) + return 0; + } + ++static void cppc_cpufreq_put_cpu_data(struct cpufreq_policy *policy) ++{ ++ struct cppc_cpudata *cpu_data = policy->driver_data; ++ ++ list_del(&cpu_data->node); ++ free_cpumask_var(cpu_data->shared_cpu_map); ++ kfree(cpu_data); ++ policy->driver_data = NULL; ++} ++ + static void cppc_cpufreq_stop_cpu(struct cpufreq_policy *policy) + { + struct cppc_cpudata *cpu_data = policy->driver_data; +@@ -196,11 +206,7 @@ static void cppc_cpufreq_stop_cpu(struct cpufreq_policy *policy) + pr_debug("Err setting perf value:%d on CPU:%d. ret:%d\n", + caps->lowest_perf, cpu, ret); + +- /* Remove CPU node from list and free driver data for policy */ +- free_cpumask_var(cpu_data->shared_cpu_map); +- list_del(&cpu_data->node); +- kfree(policy->driver_data); +- policy->driver_data = NULL; ++ cppc_cpufreq_put_cpu_data(policy); + } + + /* +@@ -330,7 +336,8 @@ static int cppc_cpufreq_cpu_init(struct cpufreq_policy *policy) + default: + pr_debug("Unsupported CPU co-ord type: %d\n", + policy->shared_type); +- return -EFAULT; ++ ret = -EFAULT; ++ goto out; + } + + /* +@@ -345,10 +352,16 @@ static int cppc_cpufreq_cpu_init(struct cpufreq_policy *policy) + cpu_data->perf_ctrls.desired_perf = caps->highest_perf; + + ret = cppc_set_perf(cpu, &cpu_data->perf_ctrls); +- if (ret) ++ if (ret) { + pr_debug("Err setting perf value:%d on CPU:%d. ret:%d\n", + caps->highest_perf, cpu, ret); ++ goto out; ++ } + ++ return 0; ++ ++out: ++ cppc_cpufreq_put_cpu_data(policy); + return ret; + } + +-- +2.30.2 + diff --git a/queue-5.13/cpufreq-scmi-fix-an-error-message.patch b/queue-5.13/cpufreq-scmi-fix-an-error-message.patch new file mode 100644 index 00000000000..b50571a0422 --- /dev/null +++ b/queue-5.13/cpufreq-scmi-fix-an-error-message.patch @@ -0,0 +1,37 @@ +From 8ec9ab96727f4f934a7da76107ae0bbd9cdf228a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 6 May 2021 21:09:48 +0200 +Subject: cpufreq: scmi: Fix an error message + +From: Christophe JAILLET + +[ Upstream commit b791c7f94680ba9b60b0c0786b1d0eb4393053d6 ] + +'ret' is known to be 0 here. +The last error code is stored in 'nr_opp', so use it in the error message. + +Fixes: 71a37cd6a59d ("scmi-cpufreq: Remove deferred probe") +Signed-off-by: Christophe JAILLET +Reviewed-by: Sudeep Holla +Signed-off-by: Viresh Kumar +Signed-off-by: Sasha Levin +--- + drivers/cpufreq/scmi-cpufreq.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c +index c8a4364ad3c2..ec9a87ca2dbb 100644 +--- a/drivers/cpufreq/scmi-cpufreq.c ++++ b/drivers/cpufreq/scmi-cpufreq.c +@@ -174,7 +174,7 @@ static int scmi_cpufreq_init(struct cpufreq_policy *policy) + nr_opp = dev_pm_opp_get_opp_count(cpu_dev); + if (nr_opp <= 0) { + dev_err(cpu_dev, "%s: No OPPs for this device: %d\n", +- __func__, ret); ++ __func__, nr_opp); + + ret = -ENODEV; + goto out_free_opp; +-- +2.30.2 + diff --git a/queue-5.13/dmaengine-fsl-qdma-check-dma_set_mask-return-value.patch b/queue-5.13/dmaengine-fsl-qdma-check-dma_set_mask-return-value.patch new file mode 100644 index 00000000000..bd0a5a555ab --- /dev/null +++ b/queue-5.13/dmaengine-fsl-qdma-check-dma_set_mask-return-value.patch @@ -0,0 +1,41 @@ +From dbd762ee65ebf29d7dcf6b65854a356c8f4067e0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 26 Apr 2021 16:59:09 +0800 +Subject: dmaengine: fsl-qdma: check dma_set_mask return value + +From: Robin Gong + +[ Upstream commit f0c07993af0acf5545d5c1445798846565f4f147 ] + +For fix below warning reported by static code analysis tool like Coverity +from Synopsys: + +Signed-off-by: Robin Gong +Addresses-Coverity-ID: 12285639 ("Unchecked return value") +Link: https://lore.kernel.org/r/1619427549-20498-1-git-send-email-yibin.gong@nxp.com +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/dma/fsl-qdma.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/drivers/dma/fsl-qdma.c b/drivers/dma/fsl-qdma.c +index ed2ab46b15e7..045ead46ec8f 100644 +--- a/drivers/dma/fsl-qdma.c ++++ b/drivers/dma/fsl-qdma.c +@@ -1235,7 +1235,11 @@ static int fsl_qdma_probe(struct platform_device *pdev) + fsl_qdma->dma_dev.device_synchronize = fsl_qdma_synchronize; + fsl_qdma->dma_dev.device_terminate_all = fsl_qdma_terminate_all; + +- dma_set_mask(&pdev->dev, DMA_BIT_MASK(40)); ++ ret = dma_set_mask(&pdev->dev, DMA_BIT_MASK(40)); ++ if (ret) { ++ dev_err(&pdev->dev, "dma_set_mask failure.\n"); ++ return ret; ++ } + + platform_set_drvdata(pdev, fsl_qdma); + +-- +2.30.2 + diff --git a/queue-5.13/drm-amdgpu-fix-navi1x-tcp-power-gating-hang-when-iss.patch b/queue-5.13/drm-amdgpu-fix-navi1x-tcp-power-gating-hang-when-iss.patch new file mode 100644 index 00000000000..515e07e9a75 --- /dev/null +++ b/queue-5.13/drm-amdgpu-fix-navi1x-tcp-power-gating-hang-when-iss.patch @@ -0,0 +1,136 @@ +From a11c5df1010131639ff0ec399959cb50068438e5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 25 May 2021 11:43:38 +0800 +Subject: drm/amdgpu: fix Navi1x tcp power gating hang when issuing lightweight + invalidaiton + +From: Evan Quan + +[ Upstream commit 9c26ddb1c5b6e30c6bca48b8ad9205d96efe93d0 ] + +Fix TCP hang when a lightweight invalidation happens on Navi1x. + +Signed-off-by: Evan Quan +Reviewed-by: Lijo Lazar +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 95 ++++++++++++++++++++++++++ + 1 file changed, 95 insertions(+) + +diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +index 0597aeb5f0e8..9ea5b4d2fe8b 100644 +--- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c ++++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +@@ -7846,6 +7846,97 @@ static void gfx_v10_0_update_fine_grain_clock_gating(struct amdgpu_device *adev, + } + } + ++static void gfx_v10_0_apply_medium_grain_clock_gating_workaround(struct amdgpu_device *adev) ++{ ++ uint32_t reg_data = 0; ++ uint32_t reg_idx = 0; ++ uint32_t i; ++ ++ const uint32_t tcp_ctrl_regs[] = { ++ mmCGTS_SA0_WGP00_CU0_TCP_CTRL_REG, ++ mmCGTS_SA0_WGP00_CU1_TCP_CTRL_REG, ++ mmCGTS_SA0_WGP01_CU0_TCP_CTRL_REG, ++ mmCGTS_SA0_WGP01_CU1_TCP_CTRL_REG, ++ mmCGTS_SA0_WGP02_CU0_TCP_CTRL_REG, ++ mmCGTS_SA0_WGP02_CU1_TCP_CTRL_REG, ++ mmCGTS_SA0_WGP10_CU0_TCP_CTRL_REG, ++ mmCGTS_SA0_WGP10_CU1_TCP_CTRL_REG, ++ mmCGTS_SA0_WGP11_CU0_TCP_CTRL_REG, ++ mmCGTS_SA0_WGP11_CU1_TCP_CTRL_REG, ++ mmCGTS_SA0_WGP12_CU0_TCP_CTRL_REG, ++ mmCGTS_SA0_WGP12_CU1_TCP_CTRL_REG, ++ mmCGTS_SA1_WGP00_CU0_TCP_CTRL_REG, ++ mmCGTS_SA1_WGP00_CU1_TCP_CTRL_REG, ++ mmCGTS_SA1_WGP01_CU0_TCP_CTRL_REG, ++ mmCGTS_SA1_WGP01_CU1_TCP_CTRL_REG, ++ mmCGTS_SA1_WGP02_CU0_TCP_CTRL_REG, ++ mmCGTS_SA1_WGP02_CU1_TCP_CTRL_REG, ++ mmCGTS_SA1_WGP10_CU0_TCP_CTRL_REG, ++ mmCGTS_SA1_WGP10_CU1_TCP_CTRL_REG, ++ mmCGTS_SA1_WGP11_CU0_TCP_CTRL_REG, ++ mmCGTS_SA1_WGP11_CU1_TCP_CTRL_REG, ++ mmCGTS_SA1_WGP12_CU0_TCP_CTRL_REG, ++ mmCGTS_SA1_WGP12_CU1_TCP_CTRL_REG ++ }; ++ ++ const uint32_t tcp_ctrl_regs_nv12[] = { ++ mmCGTS_SA0_WGP00_CU0_TCP_CTRL_REG, ++ mmCGTS_SA0_WGP00_CU1_TCP_CTRL_REG, ++ mmCGTS_SA0_WGP01_CU0_TCP_CTRL_REG, ++ mmCGTS_SA0_WGP01_CU1_TCP_CTRL_REG, ++ mmCGTS_SA0_WGP02_CU0_TCP_CTRL_REG, ++ mmCGTS_SA0_WGP02_CU1_TCP_CTRL_REG, ++ mmCGTS_SA0_WGP10_CU0_TCP_CTRL_REG, ++ mmCGTS_SA0_WGP10_CU1_TCP_CTRL_REG, ++ mmCGTS_SA0_WGP11_CU0_TCP_CTRL_REG, ++ mmCGTS_SA0_WGP11_CU1_TCP_CTRL_REG, ++ mmCGTS_SA1_WGP00_CU0_TCP_CTRL_REG, ++ mmCGTS_SA1_WGP00_CU1_TCP_CTRL_REG, ++ mmCGTS_SA1_WGP01_CU0_TCP_CTRL_REG, ++ mmCGTS_SA1_WGP01_CU1_TCP_CTRL_REG, ++ mmCGTS_SA1_WGP02_CU0_TCP_CTRL_REG, ++ mmCGTS_SA1_WGP02_CU1_TCP_CTRL_REG, ++ mmCGTS_SA1_WGP10_CU0_TCP_CTRL_REG, ++ mmCGTS_SA1_WGP10_CU1_TCP_CTRL_REG, ++ mmCGTS_SA1_WGP11_CU0_TCP_CTRL_REG, ++ mmCGTS_SA1_WGP11_CU1_TCP_CTRL_REG, ++ }; ++ ++ const uint32_t sm_ctlr_regs[] = { ++ mmCGTS_SA0_QUAD0_SM_CTRL_REG, ++ mmCGTS_SA0_QUAD1_SM_CTRL_REG, ++ mmCGTS_SA1_QUAD0_SM_CTRL_REG, ++ mmCGTS_SA1_QUAD1_SM_CTRL_REG ++ }; ++ ++ if (adev->asic_type == CHIP_NAVI12) { ++ for (i = 0; i < ARRAY_SIZE(tcp_ctrl_regs_nv12); i++) { ++ reg_idx = adev->reg_offset[GC_HWIP][0][mmCGTS_SA0_WGP00_CU0_TCP_CTRL_REG_BASE_IDX] + ++ tcp_ctrl_regs_nv12[i]; ++ reg_data = RREG32(reg_idx); ++ reg_data |= CGTS_SA0_WGP00_CU0_TCP_CTRL_REG__TCPI_LS_OVERRIDE_MASK; ++ WREG32(reg_idx, reg_data); ++ } ++ } else { ++ for (i = 0; i < ARRAY_SIZE(tcp_ctrl_regs); i++) { ++ reg_idx = adev->reg_offset[GC_HWIP][0][mmCGTS_SA0_WGP00_CU0_TCP_CTRL_REG_BASE_IDX] + ++ tcp_ctrl_regs[i]; ++ reg_data = RREG32(reg_idx); ++ reg_data |= CGTS_SA0_WGP00_CU0_TCP_CTRL_REG__TCPI_LS_OVERRIDE_MASK; ++ WREG32(reg_idx, reg_data); ++ } ++ } ++ ++ for (i = 0; i < ARRAY_SIZE(sm_ctlr_regs); i++) { ++ reg_idx = adev->reg_offset[GC_HWIP][0][mmCGTS_SA0_QUAD0_SM_CTRL_REG_BASE_IDX] + ++ sm_ctlr_regs[i]; ++ reg_data = RREG32(reg_idx); ++ reg_data &= ~CGTS_SA0_QUAD0_SM_CTRL_REG__SM_MODE_MASK; ++ reg_data |= 2 << CGTS_SA0_QUAD0_SM_CTRL_REG__SM_MODE__SHIFT; ++ WREG32(reg_idx, reg_data); ++ } ++} ++ + static int gfx_v10_0_update_gfx_clock_gating(struct amdgpu_device *adev, + bool enable) + { +@@ -7862,6 +7953,10 @@ static int gfx_v10_0_update_gfx_clock_gating(struct amdgpu_device *adev, + gfx_v10_0_update_3d_clock_gating(adev, enable); + /* === CGCG + CGLS === */ + gfx_v10_0_update_coarse_grain_clock_gating(adev, enable); ++ ++ if ((adev->asic_type >= CHIP_NAVI10) && ++ (adev->asic_type <= CHIP_NAVI12)) ++ gfx_v10_0_apply_medium_grain_clock_gating_workaround(adev); + } else { + /* CGCG/CGLS should be disabled before MGCG/MGLS + * === CGCG + CGLS === +-- +2.30.2 + diff --git a/queue-5.13/drm-amdkfd-fix-sysfs-kobj-leak.patch b/queue-5.13/drm-amdkfd-fix-sysfs-kobj-leak.patch new file mode 100644 index 00000000000..7ce9bc03252 --- /dev/null +++ b/queue-5.13/drm-amdkfd-fix-sysfs-kobj-leak.patch @@ -0,0 +1,78 @@ +From 8c59ac0ab282f8e443e0c7652409ad69bee7e91d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 21 Jun 2021 18:51:26 -0400 +Subject: drm/amdkfd: fix sysfs kobj leak + +From: Philip Yang + +[ Upstream commit dcdb4d904b4bd3078fe8d4d24b1658560d6078ef ] + +3 cases of kobj leak, which causes memory leak: + +kobj_type must have release() method to free memory from release +callback. Don't need NULL default_attrs to init kobj. + +sysfs files created under kobj_status should be removed with kobj_status +as parent kobject. + +Remove queue sysfs files when releasing queue from process MMU notifier +release callback. + +Signed-off-by: Philip Yang +Reviewed-by: Felix Kuehling +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/amdkfd/kfd_process.c | 14 ++++++-------- + .../gpu/drm/amd/amdkfd/kfd_process_queue_manager.c | 1 + + 2 files changed, 7 insertions(+), 8 deletions(-) + +diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c +index d97e330a5022..7fe746c5a2b8 100644 +--- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c ++++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c +@@ -452,13 +452,9 @@ static const struct sysfs_ops procfs_stats_ops = { + .show = kfd_procfs_stats_show, + }; + +-static struct attribute *procfs_stats_attrs[] = { +- NULL +-}; +- + static struct kobj_type procfs_stats_type = { + .sysfs_ops = &procfs_stats_ops, +- .default_attrs = procfs_stats_attrs, ++ .release = kfd_procfs_kobj_release, + }; + + int kfd_procfs_add_queue(struct queue *q) +@@ -984,9 +980,11 @@ static void kfd_process_wq_release(struct work_struct *work) + + sysfs_remove_file(p->kobj, &pdd->attr_vram); + sysfs_remove_file(p->kobj, &pdd->attr_sdma); +- sysfs_remove_file(p->kobj, &pdd->attr_evict); +- if (pdd->dev->kfd2kgd->get_cu_occupancy != NULL) +- sysfs_remove_file(p->kobj, &pdd->attr_cu_occupancy); ++ ++ sysfs_remove_file(pdd->kobj_stats, &pdd->attr_evict); ++ if (pdd->dev->kfd2kgd->get_cu_occupancy) ++ sysfs_remove_file(pdd->kobj_stats, ++ &pdd->attr_cu_occupancy); + kobject_del(pdd->kobj_stats); + kobject_put(pdd->kobj_stats); + pdd->kobj_stats = NULL; +diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c +index 95a6c36cea4c..243dd1efcdbf 100644 +--- a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c ++++ b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c +@@ -153,6 +153,7 @@ void pqm_uninit(struct process_queue_manager *pqm) + if (pqn->q && pqn->q->gws) + amdgpu_amdkfd_remove_gws_from_process(pqm->process->kgd_process_info, + pqn->q->gws); ++ kfd_procfs_del_queue(pqn->q); + uninit_queue(pqn->q); + list_del(&pqn->process_queue_list); + kfree(pqn); +-- +2.30.2 + diff --git a/queue-5.13/drm-gma500-add-the-missed-drm_gem_object_put-in-psb_.patch b/queue-5.13/drm-gma500-add-the-missed-drm_gem_object_put-in-psb_.patch new file mode 100644 index 00000000000..6931d7867a6 --- /dev/null +++ b/queue-5.13/drm-gma500-add-the-missed-drm_gem_object_put-in-psb_.patch @@ -0,0 +1,49 @@ +From a7bc920827503a2fd635102939160bcdab5a2c3d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 29 Jun 2021 19:59:56 +0800 +Subject: drm/gma500: Add the missed drm_gem_object_put() in + psb_user_framebuffer_create() + +From: Jing Xiangfeng + +[ Upstream commit cd8f318fbd266b127ffc93cc4c1eaf9a5196fafb ] + +psb_user_framebuffer_create() misses to call drm_gem_object_put() in an +error path. Add the missed function call to fix it. + +Signed-off-by: Jing Xiangfeng +Signed-off-by: Daniel Vetter +Link: https://patchwork.freedesktop.org/patch/msgid/20210629115956.15160-1-jingxiangfeng@huawei.com +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/gma500/framebuffer.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/gma500/framebuffer.c b/drivers/gpu/drm/gma500/framebuffer.c +index ebe9dccf2d83..0b8648396fb2 100644 +--- a/drivers/gpu/drm/gma500/framebuffer.c ++++ b/drivers/gpu/drm/gma500/framebuffer.c +@@ -352,6 +352,7 @@ static struct drm_framebuffer *psb_user_framebuffer_create + const struct drm_mode_fb_cmd2 *cmd) + { + struct drm_gem_object *obj; ++ struct drm_framebuffer *fb; + + /* + * Find the GEM object and thus the gtt range object that is +@@ -362,7 +363,11 @@ static struct drm_framebuffer *psb_user_framebuffer_create + return ERR_PTR(-ENOENT); + + /* Let the core code do all the work */ +- return psb_framebuffer_create(dev, cmd, obj); ++ fb = psb_framebuffer_create(dev, cmd, obj); ++ if (IS_ERR(fb)) ++ drm_gem_object_put(obj); ++ ++ return fb; + } + + static int psbfb_probe(struct drm_fb_helper *fb_helper, +-- +2.30.2 + diff --git a/queue-5.13/dt-bindings-i2c-at91-fix-example-for-scl-gpios.patch b/queue-5.13/dt-bindings-i2c-at91-fix-example-for-scl-gpios.patch new file mode 100644 index 00000000000..26a576cafff --- /dev/null +++ b/queue-5.13/dt-bindings-i2c-at91-fix-example-for-scl-gpios.patch @@ -0,0 +1,37 @@ +From 385d56cb517cf7ce4dcabe6c2a5d68d1aec5bf35 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 4 Jun 2021 15:19:25 +0200 +Subject: dt-bindings: i2c: at91: fix example for scl-gpios + +From: Nicolas Ferre + +[ Upstream commit 92e669017ff1616ba7d8ba3c65f5193bc2a7acbe ] + +The SCL gpio pin used by I2C bus for recovery needs to be configured as +open drain, so fix the binding example accordingly. +In relation with fix c5a283802573 ("ARM: dts: at91: Configure I2C SCL +gpio as open drain"). + +Signed-off-by: Nicolas Ferre +Fixes: 19e5cef058a0 ("dt-bindings: i2c: at91: document optional bus recovery properties") +Signed-off-by: Sasha Levin +--- + Documentation/devicetree/bindings/i2c/i2c-at91.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Documentation/devicetree/bindings/i2c/i2c-at91.txt b/Documentation/devicetree/bindings/i2c/i2c-at91.txt +index 96c914e048f5..2015f50aed0f 100644 +--- a/Documentation/devicetree/bindings/i2c/i2c-at91.txt ++++ b/Documentation/devicetree/bindings/i2c/i2c-at91.txt +@@ -73,7 +73,7 @@ i2c0: i2c@f8034600 { + pinctrl-0 = <&pinctrl_i2c0>; + pinctrl-1 = <&pinctrl_i2c0_gpio>; + sda-gpios = <&pioA 30 GPIO_ACTIVE_HIGH>; +- scl-gpios = <&pioA 31 GPIO_ACTIVE_HIGH>; ++ scl-gpios = <&pioA 31 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + + wm8731: wm8731@1a { + compatible = "wm8731"; +-- +2.30.2 + diff --git a/queue-5.13/ext4-fix-warn_on_once-buffer_uptodate-after-an-error.patch b/queue-5.13/ext4-fix-warn_on_once-buffer_uptodate-after-an-error.patch new file mode 100644 index 00000000000..6b8cd3d063f --- /dev/null +++ b/queue-5.13/ext4-fix-warn_on_once-buffer_uptodate-after-an-error.patch @@ -0,0 +1,113 @@ +From d1c98d6bbd3f3cf77cb81a4ea80bfed762f00ac2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 15 Jun 2021 17:05:37 +0800 +Subject: ext4: fix WARN_ON_ONCE(!buffer_uptodate) after an error writing the + superblock + +From: Ye Bin + +[ Upstream commit 558d6450c7755aa005d89021204b6cdcae5e848f ] + +If a writeback of the superblock fails with an I/O error, the buffer +is marked not uptodate. However, this can cause a WARN_ON to trigger +when we attempt to write superblock a second time. (Which might +succeed this time, for cerrtain types of block devices such as iSCSI +devices over a flaky network.) + +Try to detect this case in flush_stashed_error_work(), and also change +__ext4_handle_dirty_metadata() so we always set the uptodate flag, not +just in the nojournal case. + +Before this commit, this problem can be repliciated via: + +1. dmsetup create dust1 --table '0 2097152 dust /dev/sdc 0 4096' +2. mount /dev/mapper/dust1 /home/test +3. dmsetup message dust1 0 addbadblock 0 10 +4. cd /home/test +5. echo "XXXXXXX" > t + +After a few seconds, we got following warning: + +[ 80.654487] end_buffer_async_write: bh=0xffff88842f18bdd0 +[ 80.656134] Buffer I/O error on dev dm-0, logical block 0, lost async page write +[ 85.774450] EXT4-fs error (device dm-0): ext4_check_bdev_write_error:193: comm kworker/u16:8: Error while async write back metadata +[ 91.415513] mark_buffer_dirty: bh=0xffff88842f18bdd0 +[ 91.417038] ------------[ cut here ]------------ +[ 91.418450] WARNING: CPU: 1 PID: 1944 at fs/buffer.c:1092 mark_buffer_dirty.cold+0x1c/0x5e +[ 91.440322] Call Trace: +[ 91.440652] __jbd2_journal_temp_unlink_buffer+0x135/0x220 +[ 91.441354] __jbd2_journal_unfile_buffer+0x24/0x90 +[ 91.441981] __jbd2_journal_refile_buffer+0x134/0x1d0 +[ 91.442628] jbd2_journal_commit_transaction+0x249a/0x3240 +[ 91.443336] ? put_prev_entity+0x2a/0x200 +[ 91.443856] ? kjournald2+0x12e/0x510 +[ 91.444324] kjournald2+0x12e/0x510 +[ 91.444773] ? woken_wake_function+0x30/0x30 +[ 91.445326] kthread+0x150/0x1b0 +[ 91.445739] ? commit_timeout+0x20/0x20 +[ 91.446258] ? kthread_flush_worker+0xb0/0xb0 +[ 91.446818] ret_from_fork+0x1f/0x30 +[ 91.447293] ---[ end trace 66f0b6bf3d1abade ]--- + +Signed-off-by: Ye Bin +Link: https://lore.kernel.org/r/20210615090537.3423231-1-yebin10@huawei.com +Signed-off-by: Theodore Ts'o +Signed-off-by: Sasha Levin +--- + fs/ext4/ext4_jbd2.c | 2 +- + fs/ext4/super.c | 12 ++++++++++-- + 2 files changed, 11 insertions(+), 3 deletions(-) + +diff --git a/fs/ext4/ext4_jbd2.c b/fs/ext4/ext4_jbd2.c +index be799040a415..b96ecba91899 100644 +--- a/fs/ext4/ext4_jbd2.c ++++ b/fs/ext4/ext4_jbd2.c +@@ -327,6 +327,7 @@ int __ext4_handle_dirty_metadata(const char *where, unsigned int line, + + set_buffer_meta(bh); + set_buffer_prio(bh); ++ set_buffer_uptodate(bh); + if (ext4_handle_valid(handle)) { + err = jbd2_journal_dirty_metadata(handle, bh); + /* Errors can only happen due to aborted journal or a nasty bug */ +@@ -355,7 +356,6 @@ int __ext4_handle_dirty_metadata(const char *where, unsigned int line, + err); + } + } else { +- set_buffer_uptodate(bh); + if (inode) + mark_buffer_dirty_inode(bh, inode); + else +diff --git a/fs/ext4/super.c b/fs/ext4/super.c +index 09f1f02e1d6d..6a4e040ea9b3 100644 +--- a/fs/ext4/super.c ++++ b/fs/ext4/super.c +@@ -705,15 +705,23 @@ static void flush_stashed_error_work(struct work_struct *work) + * ext4 error handling code during handling of previous errors. + */ + if (!sb_rdonly(sbi->s_sb) && journal) { ++ struct buffer_head *sbh = sbi->s_sbh; + handle = jbd2_journal_start(journal, 1); + if (IS_ERR(handle)) + goto write_directly; +- if (jbd2_journal_get_write_access(handle, sbi->s_sbh)) { ++ if (jbd2_journal_get_write_access(handle, sbh)) { + jbd2_journal_stop(handle); + goto write_directly; + } + ext4_update_super(sbi->s_sb); +- if (jbd2_journal_dirty_metadata(handle, sbi->s_sbh)) { ++ if (buffer_write_io_error(sbh) || !buffer_uptodate(sbh)) { ++ ext4_msg(sbi->s_sb, KERN_ERR, "previous I/O error to " ++ "superblock detected"); ++ clear_buffer_write_io_error(sbh); ++ set_buffer_uptodate(sbh); ++ } ++ ++ if (jbd2_journal_dirty_metadata(handle, sbh)) { + jbd2_journal_stop(handle); + goto write_directly; + } +-- +2.30.2 + diff --git a/queue-5.13/f2fs-add-module_softdep-to-ensure-crc32-is-included-.patch b/queue-5.13/f2fs-add-module_softdep-to-ensure-crc32-is-included-.patch new file mode 100644 index 00000000000..97795881261 --- /dev/null +++ b/queue-5.13/f2fs-add-module_softdep-to-ensure-crc32-is-included-.patch @@ -0,0 +1,43 @@ +From 5a5054e54884e4205e6bb70d9f33cb02a5768f95 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 18 May 2021 09:57:54 +0800 +Subject: f2fs: add MODULE_SOFTDEP to ensure crc32 is included in the initramfs + +From: Chao Yu + +[ Upstream commit 0dd571785d61528d62cdd8aa49d76bc6085152fe ] + +As marcosfrm reported in bugzilla: + +https://bugzilla.kernel.org/show_bug.cgi?id=213089 + +Initramfs generators rely on "pre" softdeps (and "depends") to include +additional required modules. + +F2FS does not declare "pre: crc32" softdep. Then every generator (dracut, +mkinitcpio...) has to maintain a hardcoded list for this purpose. + +Hence let's use MODULE_SOFTDEP("pre: crc32") in f2fs code. + +Fixes: 43b6573bac95 ("f2fs: use cryptoapi crc32 functions") +Reported-by: marcosfrm +Signed-off-by: Chao Yu +Signed-off-by: Jaegeuk Kim +Signed-off-by: Sasha Levin +--- + fs/f2fs/super.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c +index 096492caaa6b..b29de80ab60e 100644 +--- a/fs/f2fs/super.c ++++ b/fs/f2fs/super.c +@@ -4321,4 +4321,5 @@ module_exit(exit_f2fs_fs) + MODULE_AUTHOR("Samsung Electronics's Praesto Team"); + MODULE_DESCRIPTION("Flash Friendly File System"); + MODULE_LICENSE("GPL"); ++MODULE_SOFTDEP("pre: crc32"); + +-- +2.30.2 + diff --git a/queue-5.13/f2fs-atgc-fix-to-set-default-age-threshold.patch b/queue-5.13/f2fs-atgc-fix-to-set-default-age-threshold.patch new file mode 100644 index 00000000000..7ddc474b874 --- /dev/null +++ b/queue-5.13/f2fs-atgc-fix-to-set-default-age-threshold.patch @@ -0,0 +1,35 @@ +From d9406e6d8894deaa3e06f5e79efec0f7ab09fd6c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 11 May 2021 18:17:34 +0800 +Subject: f2fs: atgc: fix to set default age threshold + +From: Chao Yu + +[ Upstream commit 89e53ff1651a61cf2abef9356e2f60d0086215be ] + +Default age threshold value is missed to set, fix it. + +Fixes: 093749e296e2 ("f2fs: support age threshold based garbage collection") +Reported-by: Sahitya Tummala +Signed-off-by: Chao Yu +Signed-off-by: Jaegeuk Kim +Signed-off-by: Sasha Levin +--- + fs/f2fs/gc.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c +index 8d1f17ab94d8..b40a2da90147 100644 +--- a/fs/f2fs/gc.c ++++ b/fs/f2fs/gc.c +@@ -1822,6 +1822,7 @@ static void init_atgc_management(struct f2fs_sb_info *sbi) + am->candidate_ratio = DEF_GC_THREAD_CANDIDATE_RATIO; + am->max_candidate_count = DEF_GC_THREAD_MAX_CANDIDATE_COUNT; + am->age_weight = DEF_GC_THREAD_AGE_WEIGHT; ++ am->age_threshold = DEF_GC_THREAD_AGE_THRESHOLD; + } + + void f2fs_build_gc_manager(struct f2fs_sb_info *sbi) +-- +2.30.2 + diff --git a/queue-5.13/f2fs-compress-fix-to-disallow-temp-extension.patch b/queue-5.13/f2fs-compress-fix-to-disallow-temp-extension.patch new file mode 100644 index 00000000000..6acc048d381 --- /dev/null +++ b/queue-5.13/f2fs-compress-fix-to-disallow-temp-extension.patch @@ -0,0 +1,89 @@ +From d1eb1a81c3641bcbd0cbe2a9f741dd5bb68c600e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 18 May 2021 17:54:58 +0800 +Subject: f2fs: compress: fix to disallow temp extension + +From: Chao Yu + +[ Upstream commit 4a67d9b07ac8dce7f1034e0d887f2f4ee00fe118 ] + +This patch restricts to configure compress extension as format of: + + [filename + '.' + extension] + +rather than: + + [filename + '.' + extension + (optional: '.' + temp extension)] + +in order to avoid to enable compression incorrectly: + +1. compress_extension=so +2. touch file.soa +3. touch file.so.tmp + +Fixes: 4c8ff7095bef ("f2fs: support data compression") +Signed-off-by: Chao Yu +Signed-off-by: Jaegeuk Kim +Signed-off-by: Sasha Levin +--- + fs/f2fs/namei.c | 16 ++++++++++++---- + 1 file changed, 12 insertions(+), 4 deletions(-) + +diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c +index a9cd9cf97229..d4139e166b95 100644 +--- a/fs/f2fs/namei.c ++++ b/fs/f2fs/namei.c +@@ -153,7 +153,8 @@ fail_drop: + return ERR_PTR(err); + } + +-static inline int is_extension_exist(const unsigned char *s, const char *sub) ++static inline int is_extension_exist(const unsigned char *s, const char *sub, ++ bool tmp_ext) + { + size_t slen = strlen(s); + size_t sublen = strlen(sub); +@@ -169,6 +170,13 @@ static inline int is_extension_exist(const unsigned char *s, const char *sub) + if (slen < sublen + 2) + return 0; + ++ if (!tmp_ext) { ++ /* file has no temp extension */ ++ if (s[slen - sublen - 1] != '.') ++ return 0; ++ return !strncasecmp(s + slen - sublen, sub, sublen); ++ } ++ + for (i = 1; i < slen - sublen; i++) { + if (s[i] != '.') + continue; +@@ -194,7 +202,7 @@ static inline void set_file_temperature(struct f2fs_sb_info *sbi, struct inode * + hot_count = sbi->raw_super->hot_ext_count; + + for (i = 0; i < cold_count + hot_count; i++) { +- if (is_extension_exist(name, extlist[i])) ++ if (is_extension_exist(name, extlist[i], true)) + break; + } + +@@ -295,7 +303,7 @@ static void set_compress_inode(struct f2fs_sb_info *sbi, struct inode *inode, + hot_count = sbi->raw_super->hot_ext_count; + + for (i = cold_count; i < cold_count + hot_count; i++) { +- if (is_extension_exist(name, extlist[i])) { ++ if (is_extension_exist(name, extlist[i], false)) { + up_read(&sbi->sb_lock); + return; + } +@@ -306,7 +314,7 @@ static void set_compress_inode(struct f2fs_sb_info *sbi, struct inode *inode, + ext = F2FS_OPTION(sbi).extensions; + + for (i = 0; i < ext_cnt; i++) { +- if (!is_extension_exist(name, ext[i])) ++ if (!is_extension_exist(name, ext[i], false)) + continue; + + set_compress_context(inode); +-- +2.30.2 + diff --git a/queue-5.13/f2fs-fix-to-avoid-adding-tab-before-doc-section.patch b/queue-5.13/f2fs-fix-to-avoid-adding-tab-before-doc-section.patch new file mode 100644 index 00000000000..58b7c9d98d7 --- /dev/null +++ b/queue-5.13/f2fs-fix-to-avoid-adding-tab-before-doc-section.patch @@ -0,0 +1,58 @@ +From 6ec2cd81bf30808cdeb85011a74e6dfe2a1f6f0f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 8 Jun 2021 07:31:22 +0800 +Subject: f2fs: fix to avoid adding tab before doc section + +From: Chao Yu + +[ Upstream commit 3c16dc40aab84bab9cf54c2b61a458bb86b180c3 ] + +Otherwise whole section after tab will be invisible in compiled +html format document. + +Cc: Mauro Carvalho Chehab +Fixes: 89272ca1102e ("docs: filesystems: convert f2fs.txt to ReST") +Signed-off-by: Chao Yu +Signed-off-by: Jaegeuk Kim +Signed-off-by: Sasha Levin +--- + Documentation/filesystems/f2fs.rst | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +diff --git a/Documentation/filesystems/f2fs.rst b/Documentation/filesystems/f2fs.rst +index 992bf91eeec8..53d396650afb 100644 +--- a/Documentation/filesystems/f2fs.rst ++++ b/Documentation/filesystems/f2fs.rst +@@ -717,10 +717,10 @@ users. + ===================== ======================== =================== + User F2FS Block + ===================== ======================== =================== +- META WRITE_LIFE_NOT_SET +- HOT_NODE " +- WARM_NODE " +- COLD_NODE " ++N/A META WRITE_LIFE_NOT_SET ++N/A HOT_NODE " ++N/A WARM_NODE " ++N/A COLD_NODE " + ioctl(COLD) COLD_DATA WRITE_LIFE_EXTREME + extension list " " + +@@ -746,10 +746,10 @@ WRITE_LIFE_LONG " WRITE_LIFE_LONG + ===================== ======================== =================== + User F2FS Block + ===================== ======================== =================== +- META WRITE_LIFE_MEDIUM; +- HOT_NODE WRITE_LIFE_NOT_SET +- WARM_NODE " +- COLD_NODE WRITE_LIFE_NONE ++N/A META WRITE_LIFE_MEDIUM; ++N/A HOT_NODE WRITE_LIFE_NOT_SET ++N/A WARM_NODE " ++N/A COLD_NODE WRITE_LIFE_NONE + ioctl(COLD) COLD_DATA WRITE_LIFE_EXTREME + extension list " " + +-- +2.30.2 + diff --git a/queue-5.13/f2fs-remove-false-alarm-on-iget-failure-during-gc.patch b/queue-5.13/f2fs-remove-false-alarm-on-iget-failure-during-gc.patch new file mode 100644 index 00000000000..c6585636ea1 --- /dev/null +++ b/queue-5.13/f2fs-remove-false-alarm-on-iget-failure-during-gc.patch @@ -0,0 +1,48 @@ +From 6da26d60cf8e7e51c1e2bdb390b9e0e689e50e03 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 22 Jun 2021 12:56:44 -0700 +Subject: f2fs: remove false alarm on iget failure during GC + +From: Jaegeuk Kim + +[ Upstream commit 132e3209789c647e37dc398ef36af4de13f104b4 ] + +This patch removes setting SBI_NEED_FSCK when GC gets an error on f2fs_iget, +since f2fs_iget can give ENOMEM and others by race condition. +If we set this critical fsck flag, we'll get EIO during fsync via the below +code path. + +In f2fs_inplace_write_data(), + + if (is_sbi_flag_set(sbi, SBI_NEED_FSCK) || f2fs_cp_error(sbi)) { + err = -EIO; + goto drop_bio; + } + +Fixes: 9557727876674 ("f2fs: drop inplace IO if fs status is abnormal") +Reviewed-by: Chao Yu +Signed-off-by: Jaegeuk Kim +Signed-off-by: Sasha Levin +--- + fs/f2fs/gc.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c +index b40a2da90147..ab63951c08cb 100644 +--- a/fs/f2fs/gc.c ++++ b/fs/f2fs/gc.c +@@ -1450,10 +1450,8 @@ next_step: + + if (phase == 3) { + inode = f2fs_iget(sb, dni.ino); +- if (IS_ERR(inode) || is_bad_inode(inode)) { +- set_sbi_flag(sbi, SBI_NEED_FSCK); ++ if (IS_ERR(inode) || is_bad_inode(inode)) + continue; +- } + + if (!down_write_trylock( + &F2FS_I(inode)->i_gc_rwsem[WRITE])) { +-- +2.30.2 + diff --git a/queue-5.13/firmware-arm_scmi-add-delayed-response-status-check.patch b/queue-5.13/firmware-arm_scmi-add-delayed-response-status-check.patch new file mode 100644 index 00000000000..2587e00a290 --- /dev/null +++ b/queue-5.13/firmware-arm_scmi-add-delayed-response-status-check.patch @@ -0,0 +1,45 @@ +From 1babd101559aaa4841f746748421ac0e77954cea Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 8 Jun 2021 11:30:56 +0100 +Subject: firmware: arm_scmi: Add delayed response status check + +From: Cristian Marussi + +[ Upstream commit f1748b1ee1fa0fd1a074504045b530b62f949188 ] + +A successfully received delayed response could anyway report a failure at +the protocol layer in the message status field. + +Add a check also for this error condition. + +Link: https://lore.kernel.org/r/20210608103056.3388-1-cristian.marussi@arm.com +Fixes: 58ecdf03dbb9 ("firmware: arm_scmi: Add support for asynchronous commands and delayed response") +Signed-off-by: Cristian Marussi +Signed-off-by: Sudeep Holla +Signed-off-by: Sasha Levin +--- + drivers/firmware/arm_scmi/driver.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c +index 5e8e9337adc7..c2983ed53494 100644 +--- a/drivers/firmware/arm_scmi/driver.c ++++ b/drivers/firmware/arm_scmi/driver.c +@@ -517,8 +517,12 @@ static int do_xfer_with_response(const struct scmi_protocol_handle *ph, + xfer->async_done = &async_response; + + ret = do_xfer(ph, xfer); +- if (!ret && !wait_for_completion_timeout(xfer->async_done, timeout)) +- ret = -ETIMEDOUT; ++ if (!ret) { ++ if (!wait_for_completion_timeout(xfer->async_done, timeout)) ++ ret = -ETIMEDOUT; ++ else if (xfer->hdr.status) ++ ret = scmi_to_linux_errno(xfer->hdr.status); ++ } + + xfer->async_done = NULL; + return ret; +-- +2.30.2 + diff --git a/queue-5.13/firmware-arm_scmi-reset-rx-buffer-to-max-size-during.patch b/queue-5.13/firmware-arm_scmi-reset-rx-buffer-to-max-size-during.patch new file mode 100644 index 00000000000..095e1896676 --- /dev/null +++ b/queue-5.13/firmware-arm_scmi-reset-rx-buffer-to-max-size-during.patch @@ -0,0 +1,50 @@ +From e36fb53daabdadc2af14ecc9ceb7ed1c383b3e16 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 1 Jun 2021 11:24:17 +0100 +Subject: firmware: arm_scmi: Reset Rx buffer to max size during async commands + +From: Cristian Marussi + +[ Upstream commit 0cb7af474e0dbb2f500c67aa62b6db9fafa74de2 ] + +During an async commands execution the Rx buffer length is at first set +to max_msg_sz when the synchronous part of the command is first sent. +However once the synchronous part completes the transport layer waits +for the delayed response which will be processed using the same xfer +descriptor initially allocated. Since synchronous response received at +the end of the xfer will shrink the Rx buffer length to the effective +payload response length, it needs to be reset again. + +Raise the Rx buffer length again to max_msg_sz before fetching the +delayed response to ensure full response is read correctly from the +shared memory. + +Link: https://lore.kernel.org/r/20210601102421.26581-2-cristian.marussi@arm.com +Fixes: 58ecdf03dbb9 ("firmware: arm_scmi: Add support for asynchronous commands and delayed response") +Signed-off-by: Cristian Marussi +[sudeep.holla: moved reset to scmi_handle_response as it could race with + do_xfer_with_response] +Signed-off-by: Sudeep Holla +Signed-off-by: Sasha Levin +--- + drivers/firmware/arm_scmi/driver.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c +index 66eb3f0e5daf..5e8e9337adc7 100644 +--- a/drivers/firmware/arm_scmi/driver.c ++++ b/drivers/firmware/arm_scmi/driver.c +@@ -335,6 +335,10 @@ static void scmi_handle_response(struct scmi_chan_info *cinfo, + return; + } + ++ /* rx.len could be shrunk in the sync do_xfer, so reset to maxsz */ ++ if (msg_type == MSG_TYPE_DELAYED_RESP) ++ xfer->rx.len = info->desc->max_msg_size; ++ + scmi_dump_header_dbg(dev, &xfer->hdr); + + info->desc->ops->fetch_response(cinfo, xfer); +-- +2.30.2 + diff --git a/queue-5.13/firmware-tegra-fix-error-return-code-in-tegra210_bpm.patch b/queue-5.13/firmware-tegra-fix-error-return-code-in-tegra210_bpm.patch new file mode 100644 index 00000000000..f9e977ab58a --- /dev/null +++ b/queue-5.13/firmware-tegra-fix-error-return-code-in-tegra210_bpm.patch @@ -0,0 +1,38 @@ +From 65d12e1aca6feab414c6395ec6d64769fd8c405f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 13 May 2021 21:26:46 +0800 +Subject: firmware: tegra: Fix error return code in tegra210_bpmp_init() + +From: Zhen Lei + +[ Upstream commit 7fea67710e9f6a111a2c9440576f2396ccd92d57 ] + +When call irq_get_irq_data() to get the IRQ's irq_data failed, an +appropriate error code -ENOENT should be returned. However, we directly +return 'err', which records the IRQ number instead of the error code. + +Fixes: 139251fc2208 ("firmware: tegra: add bpmp driver for Tegra210") +Reported-by: Hulk Robot +Signed-off-by: Zhen Lei +Signed-off-by: Thierry Reding +Signed-off-by: Sasha Levin +--- + drivers/firmware/tegra/bpmp-tegra210.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/firmware/tegra/bpmp-tegra210.c b/drivers/firmware/tegra/bpmp-tegra210.c +index ae15940a078e..c32754055c60 100644 +--- a/drivers/firmware/tegra/bpmp-tegra210.c ++++ b/drivers/firmware/tegra/bpmp-tegra210.c +@@ -210,7 +210,7 @@ static int tegra210_bpmp_init(struct tegra_bpmp *bpmp) + priv->tx_irq_data = irq_get_irq_data(err); + if (!priv->tx_irq_data) { + dev_err(&pdev->dev, "failed to get IRQ data for TX IRQ\n"); +- return err; ++ return -ENOENT; + } + + err = platform_get_irq_byname(pdev, "rx"); +-- +2.30.2 + diff --git a/queue-5.13/firmware-turris-mox-rwtm-fail-probing-when-firmware-.patch b/queue-5.13/firmware-turris-mox-rwtm-fail-probing-when-firmware-.patch new file mode 100644 index 00000000000..aaefe987a87 --- /dev/null +++ b/queue-5.13/firmware-turris-mox-rwtm-fail-probing-when-firmware-.patch @@ -0,0 +1,80 @@ +From 9faa43699756403f72e556a68ef0f801c4887631 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 20 May 2021 13:35:19 +0200 +Subject: firmware: turris-mox-rwtm: fail probing when firmware does not + support hwrng +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Pali Rohár + +[ Upstream commit 2eab59cf0d2036a5a9e264f719b71c21ccf679c2 ] + +When Marvell's rWTM firmware, which does not support the GET_RANDOM +command, is used, kernel prints an error message + hwrng: no data available +every 10 seconds. + +Fail probing of this driver if the rWTM firmware does not support the +GET_RANDOM command. + +Fixes: 389711b37493 ("firmware: Add Turris Mox rWTM firmware driver") +Signed-off-by: Pali Rohár +Signed-off-by: Marek Behún +Reviewed-by: Andrew Lunn +Signed-off-by: Gregory CLEMENT +Signed-off-by: Sasha Levin +--- + drivers/firmware/turris-mox-rwtm.c | 28 ++++++++++++++++++++++++++++ + 1 file changed, 28 insertions(+) + +diff --git a/drivers/firmware/turris-mox-rwtm.c b/drivers/firmware/turris-mox-rwtm.c +index d7e3489e4bf2..3ef9687dddca 100644 +--- a/drivers/firmware/turris-mox-rwtm.c ++++ b/drivers/firmware/turris-mox-rwtm.c +@@ -260,6 +260,27 @@ static int mox_get_board_info(struct mox_rwtm *rwtm) + return 0; + } + ++static int check_get_random_support(struct mox_rwtm *rwtm) ++{ ++ struct armada_37xx_rwtm_tx_msg msg; ++ int ret; ++ ++ msg.command = MBOX_CMD_GET_RANDOM; ++ msg.args[0] = 1; ++ msg.args[1] = rwtm->buf_phys; ++ msg.args[2] = 4; ++ ++ ret = mbox_send_message(rwtm->mbox, &msg); ++ if (ret < 0) ++ return ret; ++ ++ ret = wait_for_completion_timeout(&rwtm->cmd_done, HZ / 2); ++ if (ret < 0) ++ return ret; ++ ++ return mox_get_status(MBOX_CMD_GET_RANDOM, rwtm->reply.retval); ++} ++ + static int mox_hwrng_read(struct hwrng *rng, void *data, size_t max, bool wait) + { + struct mox_rwtm *rwtm = (struct mox_rwtm *) rng->priv; +@@ -497,6 +518,13 @@ static int turris_mox_rwtm_probe(struct platform_device *pdev) + if (ret < 0) + dev_warn(dev, "Cannot read board information: %i\n", ret); + ++ ret = check_get_random_support(rwtm); ++ if (ret < 0) { ++ dev_notice(dev, ++ "Firmware does not support the GET_RANDOM command\n"); ++ goto free_channel; ++ } ++ + rwtm->hwrng.name = DRIVER_NAME "_hwrng"; + rwtm->hwrng.read = mox_hwrng_read; + rwtm->hwrng.priv = (unsigned long) rwtm; +-- +2.30.2 + diff --git a/queue-5.13/firmware-turris-mox-rwtm-fix-reply-status-decoding-f.patch b/queue-5.13/firmware-turris-mox-rwtm-fix-reply-status-decoding-f.patch new file mode 100644 index 00000000000..12e4cb215c9 --- /dev/null +++ b/queue-5.13/firmware-turris-mox-rwtm-fix-reply-status-decoding-f.patch @@ -0,0 +1,53 @@ +From dd28656f139171e26fbb9862556c22c11164a21d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 20 May 2021 13:35:17 +0200 +Subject: firmware: turris-mox-rwtm: fix reply status decoding function +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Marek Behún + +[ Upstream commit e34e60253d9272311831daed8a2d967cf80ca3dc ] + +The status decoding function mox_get_status() currently contains an +incorrect check: if the error status is not MBOX_STS_SUCCESS, it always +returns -EIO, so the comparison to MBOX_STS_FAIL is never executed and +we don't get the actual error code sent by the firmware. + +Fix this. + +Signed-off-by: Marek Behún +Reviewed-by: Pali Rohár +Reviewed-by: Andrew Lunn +Fixes: 389711b37493 ("firmware: Add Turris Mox rWTM firmware driver") +Signed-off-by: Gregory CLEMENT +Signed-off-by: Sasha Levin +--- + drivers/firmware/turris-mox-rwtm.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/drivers/firmware/turris-mox-rwtm.c b/drivers/firmware/turris-mox-rwtm.c +index 62f0d1a5dd32..f85acdb3130c 100644 +--- a/drivers/firmware/turris-mox-rwtm.c ++++ b/drivers/firmware/turris-mox-rwtm.c +@@ -147,11 +147,14 @@ MOX_ATTR_RO(pubkey, "%s\n", pubkey); + + static int mox_get_status(enum mbox_cmd cmd, u32 retval) + { +- if (MBOX_STS_CMD(retval) != cmd || +- MBOX_STS_ERROR(retval) != MBOX_STS_SUCCESS) ++ if (MBOX_STS_CMD(retval) != cmd) + return -EIO; + else if (MBOX_STS_ERROR(retval) == MBOX_STS_FAIL) + return -(int)MBOX_STS_VALUE(retval); ++ else if (MBOX_STS_ERROR(retval) == MBOX_STS_BADCMD) ++ return -ENOSYS; ++ else if (MBOX_STS_ERROR(retval) != MBOX_STS_SUCCESS) ++ return -EIO; + else + return MBOX_STS_VALUE(retval); + } +-- +2.30.2 + diff --git a/queue-5.13/firmware-turris-mox-rwtm-report-failures-better.patch b/queue-5.13/firmware-turris-mox-rwtm-report-failures-better.patch new file mode 100644 index 00000000000..642f8b4adcf --- /dev/null +++ b/queue-5.13/firmware-turris-mox-rwtm-report-failures-better.patch @@ -0,0 +1,70 @@ +From 65b33cf5034447166875982aa275dfddd68e5801 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 20 May 2021 13:35:18 +0200 +Subject: firmware: turris-mox-rwtm: report failures better +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Marek Behún + +[ Upstream commit 72f99888944c44de1c899bbe44db1e53bdc9d994 ] + +Report a notice level message if a command is not supported by the rWTM +firmware. + +This should not be an error, merely a notice, because the firmware can +be used on boards that do not have manufacturing information burned. + +Fixes: 389711b37493 ("firmware: Add Turris Mox rWTM firmware driver") +Signed-off-by: Marek Behún +Reviewed-by: Pali Rohár +Reviewed-by: Andrew Lunn +Signed-off-by: Gregory CLEMENT +Signed-off-by: Sasha Levin +--- + drivers/firmware/turris-mox-rwtm.c | 18 ++++++++++++------ + 1 file changed, 12 insertions(+), 6 deletions(-) + +diff --git a/drivers/firmware/turris-mox-rwtm.c b/drivers/firmware/turris-mox-rwtm.c +index f85acdb3130c..d7e3489e4bf2 100644 +--- a/drivers/firmware/turris-mox-rwtm.c ++++ b/drivers/firmware/turris-mox-rwtm.c +@@ -204,11 +204,14 @@ static int mox_get_board_info(struct mox_rwtm *rwtm) + return ret; + + ret = mox_get_status(MBOX_CMD_BOARD_INFO, reply->retval); +- if (ret < 0 && ret != -ENODATA) { +- return ret; +- } else if (ret == -ENODATA) { ++ if (ret == -ENODATA) { + dev_warn(rwtm->dev, + "Board does not have manufacturing information burned!\n"); ++ } else if (ret == -ENOSYS) { ++ dev_notice(rwtm->dev, ++ "Firmware does not support the BOARD_INFO command\n"); ++ } else if (ret < 0) { ++ return ret; + } else { + rwtm->serial_number = reply->status[1]; + rwtm->serial_number <<= 32; +@@ -237,10 +240,13 @@ static int mox_get_board_info(struct mox_rwtm *rwtm) + return ret; + + ret = mox_get_status(MBOX_CMD_ECDSA_PUB_KEY, reply->retval); +- if (ret < 0 && ret != -ENODATA) { +- return ret; +- } else if (ret == -ENODATA) { ++ if (ret == -ENODATA) { + dev_warn(rwtm->dev, "Board has no public key burned!\n"); ++ } else if (ret == -ENOSYS) { ++ dev_notice(rwtm->dev, ++ "Firmware does not support the ECDSA_PUB_KEY command\n"); ++ } else if (ret < 0) { ++ return ret; + } else { + u32 *s = reply->status; + +-- +2.30.2 + diff --git a/queue-5.13/firmware-turris-mox-rwtm-show-message-about-hwrng-re.patch b/queue-5.13/firmware-turris-mox-rwtm-show-message-about-hwrng-re.patch new file mode 100644 index 00000000000..a2acb54a1de --- /dev/null +++ b/queue-5.13/firmware-turris-mox-rwtm-show-message-about-hwrng-re.patch @@ -0,0 +1,41 @@ +From 11b4e5d165bef094ac876f676b6aaa457de81aea Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 20 May 2021 13:35:20 +0200 +Subject: firmware: turris-mox-rwtm: show message about HWRNG registration +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Pali Rohár + +[ Upstream commit fae20160992269431507708fb74c1fd9f3c309c1 ] + +Currently it is hard to determinate if on Armada 3720 device is HWRNG +by running kernel accessible or not. So print information message into +dmesg when HWRNG is available and registration was successful. + +Fixes: 389711b37493 ("firmware: Add Turris Mox rWTM firmware driver") +Signed-off-by: Pali Rohár +Reviewed-by: Andrew Lunn +Signed-off-by: Gregory CLEMENT +Signed-off-by: Sasha Levin +--- + drivers/firmware/turris-mox-rwtm.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/firmware/turris-mox-rwtm.c b/drivers/firmware/turris-mox-rwtm.c +index 3ef9687dddca..1cf4f1087492 100644 +--- a/drivers/firmware/turris-mox-rwtm.c ++++ b/drivers/firmware/turris-mox-rwtm.c +@@ -542,6 +542,8 @@ static int turris_mox_rwtm_probe(struct platform_device *pdev) + goto free_channel; + } + ++ dev_info(dev, "HWRNG successfully registered\n"); ++ + return 0; + + free_channel: +-- +2.30.2 + diff --git a/queue-5.13/fs-jfs-fix-missing-error-code-in-lmloginit.patch b/queue-5.13/fs-jfs-fix-missing-error-code-in-lmloginit.patch new file mode 100644 index 00000000000..be3fdace82c --- /dev/null +++ b/queue-5.13/fs-jfs-fix-missing-error-code-in-lmloginit.patch @@ -0,0 +1,39 @@ +From 35d6b884677a5d7f4257297dca265260f18e8f89 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 1 Jun 2021 19:07:10 +0800 +Subject: fs/jfs: Fix missing error code in lmLogInit() + +From: Jiapeng Chong + +[ Upstream commit 492109333c29e1bb16d8732e1d597b02e8e0bf2e ] + +The error code is missing in this code scenario, add the error code +'-EINVAL' to the return value 'rc. + +Eliminate the follow smatch warning: + +fs/jfs/jfs_logmgr.c:1327 lmLogInit() warn: missing error code 'rc'. + +Reported-by: Abaci Robot +Signed-off-by: Jiapeng Chong +Signed-off-by: Dave Kleikamp +Signed-off-by: Sasha Levin +--- + fs/jfs/jfs_logmgr.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c +index 9330eff210e0..78fd136ac13b 100644 +--- a/fs/jfs/jfs_logmgr.c ++++ b/fs/jfs/jfs_logmgr.c +@@ -1324,6 +1324,7 @@ int lmLogInit(struct jfs_log * log) + } else { + if (!uuid_equal(&logsuper->uuid, &log->uuid)) { + jfs_warn("wrong uuid on JFS log device"); ++ rc = -EINVAL; + goto errout20; + } + log->size = le32_to_cpu(logsuper->size); +-- +2.30.2 + diff --git a/queue-5.13/fsi-add-missing-module_device_table.patch b/queue-5.13/fsi-add-missing-module_device_table.patch new file mode 100644 index 00000000000..bbb6dd5af37 --- /dev/null +++ b/queue-5.13/fsi-add-missing-module_device_table.patch @@ -0,0 +1,76 @@ +From 6b810ea636531e299d901d82a7f604fe004be84f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 13 May 2021 16:57:29 +0800 +Subject: fsi: Add missing MODULE_DEVICE_TABLE + +From: Zou Wei + +[ Upstream commit 19a52178125c1e8b84444d85f2ce34c0964b4a91 ] + +This patch adds missing MODULE_DEVICE_TABLE definition which generates +correct modalias for automatic loading of this driver when it is built +as an external module. + +Reported-by: Hulk Robot +Signed-off-by: Zou Wei +Link: https://lore.kernel.org/r/1620896249-52769-1-git-send-email-zou_wei@huawei.com +Signed-off-by: Joel Stanley +Signed-off-by: Sasha Levin +--- + drivers/fsi/fsi-master-aspeed.c | 1 + + drivers/fsi/fsi-master-ast-cf.c | 1 + + drivers/fsi/fsi-master-gpio.c | 1 + + drivers/fsi/fsi-occ.c | 1 + + 4 files changed, 4 insertions(+) + +diff --git a/drivers/fsi/fsi-master-aspeed.c b/drivers/fsi/fsi-master-aspeed.c +index 90dbe58ca1ed..dbad73162c83 100644 +--- a/drivers/fsi/fsi-master-aspeed.c ++++ b/drivers/fsi/fsi-master-aspeed.c +@@ -645,6 +645,7 @@ static const struct of_device_id fsi_master_aspeed_match[] = { + { .compatible = "aspeed,ast2600-fsi-master" }, + { }, + }; ++MODULE_DEVICE_TABLE(of, fsi_master_aspeed_match); + + static struct platform_driver fsi_master_aspeed_driver = { + .driver = { +diff --git a/drivers/fsi/fsi-master-ast-cf.c b/drivers/fsi/fsi-master-ast-cf.c +index 57a779a89b07..70c03e304d6c 100644 +--- a/drivers/fsi/fsi-master-ast-cf.c ++++ b/drivers/fsi/fsi-master-ast-cf.c +@@ -1427,6 +1427,7 @@ static const struct of_device_id fsi_master_acf_match[] = { + { .compatible = "aspeed,ast2500-cf-fsi-master" }, + { }, + }; ++MODULE_DEVICE_TABLE(of, fsi_master_acf_match); + + static struct platform_driver fsi_master_acf = { + .driver = { +diff --git a/drivers/fsi/fsi-master-gpio.c b/drivers/fsi/fsi-master-gpio.c +index aa97c4a250cb..7d5f29b4b595 100644 +--- a/drivers/fsi/fsi-master-gpio.c ++++ b/drivers/fsi/fsi-master-gpio.c +@@ -882,6 +882,7 @@ static const struct of_device_id fsi_master_gpio_match[] = { + { .compatible = "fsi-master-gpio" }, + { }, + }; ++MODULE_DEVICE_TABLE(of, fsi_master_gpio_match); + + static struct platform_driver fsi_master_gpio_driver = { + .driver = { +diff --git a/drivers/fsi/fsi-occ.c b/drivers/fsi/fsi-occ.c +index cb05b6dacc9d..dc74bffedd72 100644 +--- a/drivers/fsi/fsi-occ.c ++++ b/drivers/fsi/fsi-occ.c +@@ -636,6 +636,7 @@ static const struct of_device_id occ_match[] = { + }, + { }, + }; ++MODULE_DEVICE_TABLE(of, occ_match); + + static struct platform_driver occ_driver = { + .driver = { +-- +2.30.2 + diff --git a/queue-5.13/fuse-fix-illegal-access-to-inode-with-reused-nodeid.patch b/queue-5.13/fuse-fix-illegal-access-to-inode-with-reused-nodeid.patch new file mode 100644 index 00000000000..ebd9b172124 --- /dev/null +++ b/queue-5.13/fuse-fix-illegal-access-to-inode-with-reused-nodeid.patch @@ -0,0 +1,109 @@ +From f4c1ef156356699ed79954db61d94f8ee072170b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 21 Jun 2021 14:03:53 +0300 +Subject: fuse: fix illegal access to inode with reused nodeid + +From: Amir Goldstein + +[ Upstream commit 15db16837a35d8007cb8563358787412213db25e ] + +Server responds to LOOKUP and other ops (READDIRPLUS/CREATE/MKNOD/...) +with ourarg containing nodeid and generation. + +If a fuse inode is found in inode cache with the same nodeid but different +generation, the existing fuse inode should be unhashed and marked "bad" and +a new inode with the new generation should be hashed instead. + +This can happen, for example, with passhrough fuse filesystem that returns +the real filesystem ino/generation on lookup and where real inode numbers +can get recycled due to real files being unlinked not via the fuse +passthrough filesystem. + +With current code, this situation will not be detected and an old fuse +dentry that used to point to an older generation real inode, can be used to +access a completely new inode, which should be accessed only via the new +dentry. + +Note that because the FORGET message carries the nodeid w/o generation, the +server should wait to get FORGET counts for the nlookup counts of the old +and reused inodes combined, before it can free the resources associated to +that nodeid. + +Signed-off-by: Amir Goldstein +Signed-off-by: Miklos Szeredi +Signed-off-by: Sasha Levin +--- + fs/fuse/dir.c | 2 +- + fs/fuse/fuse_i.h | 7 +++++++ + fs/fuse/inode.c | 4 ++-- + fs/fuse/readdir.c | 7 +++++-- + 4 files changed, 15 insertions(+), 5 deletions(-) + +diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c +index 3fa8604c21d5..d296b0d19c27 100644 +--- a/fs/fuse/dir.c ++++ b/fs/fuse/dir.c +@@ -252,7 +252,7 @@ static int fuse_dentry_revalidate(struct dentry *entry, unsigned int flags) + if (ret == -ENOMEM) + goto out; + if (ret || fuse_invalid_attr(&outarg.attr) || +- inode_wrong_type(inode, outarg.attr.mode)) ++ fuse_stale_inode(inode, outarg.generation, &outarg.attr)) + goto invalid; + + forget_all_cached_acls(inode); +diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h +index f48dd7ff32af..120f9c5908d1 100644 +--- a/fs/fuse/fuse_i.h ++++ b/fs/fuse/fuse_i.h +@@ -870,6 +870,13 @@ static inline u64 fuse_get_attr_version(struct fuse_conn *fc) + return atomic64_read(&fc->attr_version); + } + ++static inline bool fuse_stale_inode(const struct inode *inode, int generation, ++ struct fuse_attr *attr) ++{ ++ return inode->i_generation != generation || ++ inode_wrong_type(inode, attr->mode); ++} ++ + static inline void fuse_make_bad(struct inode *inode) + { + remove_inode_hash(inode); +diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c +index 93d28dc1f572..cf16d6d3a603 100644 +--- a/fs/fuse/inode.c ++++ b/fs/fuse/inode.c +@@ -350,8 +350,8 @@ retry: + inode->i_generation = generation; + fuse_init_inode(inode, attr); + unlock_new_inode(inode); +- } else if (inode_wrong_type(inode, attr->mode)) { +- /* Inode has changed type, any I/O on the old should fail */ ++ } else if (fuse_stale_inode(inode, generation, attr)) { ++ /* nodeid was reused, any I/O on the old inode should fail */ + fuse_make_bad(inode); + iput(inode); + goto retry; +diff --git a/fs/fuse/readdir.c b/fs/fuse/readdir.c +index 277f7041d55a..bc267832310c 100644 +--- a/fs/fuse/readdir.c ++++ b/fs/fuse/readdir.c +@@ -200,9 +200,12 @@ retry: + if (!d_in_lookup(dentry)) { + struct fuse_inode *fi; + inode = d_inode(dentry); ++ if (inode && get_node_id(inode) != o->nodeid) ++ inode = NULL; + if (!inode || +- get_node_id(inode) != o->nodeid || +- inode_wrong_type(inode, o->attr.mode)) { ++ fuse_stale_inode(inode, o->generation, &o->attr)) { ++ if (inode) ++ fuse_make_bad(inode); + d_invalidate(dentry); + dput(dentry); + goto retry; +-- +2.30.2 + diff --git a/queue-5.13/gpio-pca953x-add-support-for-the-on-semi-pca9655.patch b/queue-5.13/gpio-pca953x-add-support-for-the-on-semi-pca9655.patch new file mode 100644 index 00000000000..80b3ef36d2c --- /dev/null +++ b/queue-5.13/gpio-pca953x-add-support-for-the-on-semi-pca9655.patch @@ -0,0 +1,35 @@ +From 479e424afd6d9690e6d881ac2197ca127df3182c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 13 Jun 2021 23:03:26 +0100 +Subject: gpio: pca953x: Add support for the On Semi pca9655 + +From: Peter Robinson + +[ Upstream commit 6d49b3a0f351925b5ea5047166c112b7590b918a ] + +The On Semi pca9655 is a 16 bit variant of the On Semi pca9654 GPIO +expander, with 16 GPIOs and interrupt functionality. + +Signed-off-by: Peter Robinson +[Bartosz: fixed indentation as noted by Andy] +Signed-off-by: Bartosz Golaszewski +Signed-off-by: Sasha Levin +--- + drivers/gpio/gpio-pca953x.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c +index c91d05651596..f5cfc0698799 100644 +--- a/drivers/gpio/gpio-pca953x.c ++++ b/drivers/gpio/gpio-pca953x.c +@@ -1241,6 +1241,7 @@ static const struct of_device_id pca953x_dt_ids[] = { + + { .compatible = "onnn,cat9554", .data = OF_953X( 8, PCA_INT), }, + { .compatible = "onnn,pca9654", .data = OF_953X( 8, PCA_INT), }, ++ { .compatible = "onnn,pca9655", .data = OF_953X(16, PCA_INT), }, + + { .compatible = "exar,xra1202", .data = OF_953X( 8, 0), }, + { } +-- +2.30.2 + diff --git a/queue-5.13/gpio-zynq-check-return-value-of-irq_get_irq_data.patch b/queue-5.13/gpio-zynq-check-return-value-of-irq_get_irq_data.patch new file mode 100644 index 00000000000..25767a718a9 --- /dev/null +++ b/queue-5.13/gpio-zynq-check-return-value-of-irq_get_irq_data.patch @@ -0,0 +1,52 @@ +From bbeb659854119f92d9c9500d315fbec59887e495 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 9 Apr 2021 19:38:06 +0530 +Subject: gpio: zynq: Check return value of irq_get_irq_data + +From: Srinivas Neeli + +[ Upstream commit 35d7b72a632bc7afb15356f44005554af8697904 ] + +In two different instances the return value of "irq_get_irq_data" +API was neither captured nor checked. +Fixed it by capturing the return value and then checking for any error. + +Addresses-Coverity: "returned_null" +Signed-off-by: Srinivas Neeli +Signed-off-by: Bartosz Golaszewski +Signed-off-by: Sasha Levin +--- + drivers/gpio/gpio-zynq.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/drivers/gpio/gpio-zynq.c b/drivers/gpio/gpio-zynq.c +index fb8684d70fe3..c288a7502de2 100644 +--- a/drivers/gpio/gpio-zynq.c ++++ b/drivers/gpio/gpio-zynq.c +@@ -736,6 +736,11 @@ static int __maybe_unused zynq_gpio_suspend(struct device *dev) + struct zynq_gpio *gpio = dev_get_drvdata(dev); + struct irq_data *data = irq_get_irq_data(gpio->irq); + ++ if (!data) { ++ dev_err(dev, "irq_get_irq_data() failed\n"); ++ return -EINVAL; ++ } ++ + if (!device_may_wakeup(dev)) + disable_irq(gpio->irq); + +@@ -753,6 +758,11 @@ static int __maybe_unused zynq_gpio_resume(struct device *dev) + struct irq_data *data = irq_get_irq_data(gpio->irq); + int ret; + ++ if (!data) { ++ dev_err(dev, "irq_get_irq_data() failed\n"); ++ return -EINVAL; ++ } ++ + if (!device_may_wakeup(dev)) + enable_irq(gpio->irq); + +-- +2.30.2 + diff --git a/queue-5.13/gpio-zynq-check-return-value-of-pm_runtime_get_sync.patch b/queue-5.13/gpio-zynq-check-return-value-of-pm_runtime_get_sync.patch new file mode 100644 index 00000000000..cb439001766 --- /dev/null +++ b/queue-5.13/gpio-zynq-check-return-value-of-pm_runtime_get_sync.patch @@ -0,0 +1,40 @@ +From 9f420a5918bf7ca68a13ef398182acefe9004cf3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 9 Apr 2021 19:38:05 +0530 +Subject: gpio: zynq: Check return value of pm_runtime_get_sync + +From: Srinivas Neeli + +[ Upstream commit a51b2fb94b04ab71e53a71b9fad03fa826941254 ] + +Return value of "pm_runtime_get_sync" API was neither captured nor checked. +Fixed it by capturing the return value and then checking for any warning. + +Addresses-Coverity: "check_return" +Signed-off-by: Srinivas Neeli +Signed-off-by: Bartosz Golaszewski +Signed-off-by: Sasha Levin +--- + drivers/gpio/gpio-zynq.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpio/gpio-zynq.c b/drivers/gpio/gpio-zynq.c +index 3521c1dc3ac0..fb8684d70fe3 100644 +--- a/drivers/gpio/gpio-zynq.c ++++ b/drivers/gpio/gpio-zynq.c +@@ -1001,8 +1001,11 @@ err_pm_dis: + static int zynq_gpio_remove(struct platform_device *pdev) + { + struct zynq_gpio *gpio = platform_get_drvdata(pdev); ++ int ret; + +- pm_runtime_get_sync(&pdev->dev); ++ ret = pm_runtime_get_sync(&pdev->dev); ++ if (ret < 0) ++ dev_warn(&pdev->dev, "pm_runtime_get_sync() Failed\n"); + gpiochip_remove(&gpio->chip); + clk_disable_unprepare(gpio->clk); + device_set_wakeup_capable(&pdev->dev, 0); +-- +2.30.2 + diff --git a/queue-5.13/habanalabs-check-if-asic-secured-with-asic-type.patch b/queue-5.13/habanalabs-check-if-asic-secured-with-asic-type.patch new file mode 100644 index 00000000000..429e745e139 --- /dev/null +++ b/queue-5.13/habanalabs-check-if-asic-secured-with-asic-type.patch @@ -0,0 +1,36 @@ +From 37082ab48a50f31ac03aba87e0d39b922c8ef346 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 11 May 2021 16:02:41 +0300 +Subject: habanalabs: check if asic secured with asic type + +From: Ohad Sharabi + +[ Upstream commit 190ec49710a9fe0d5e9e36fe1a2fa864c048484f ] + +Fix issue in which the input to the function is_asic_secured was device +PCI_IDS number instead of the asic_type enumeration. + +Signed-off-by: Ohad Sharabi +Reviewed-by: Oded Gabbay +Signed-off-by: Oded Gabbay +Signed-off-by: Sasha Levin +--- + drivers/misc/habanalabs/common/habanalabs_drv.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/misc/habanalabs/common/habanalabs_drv.c b/drivers/misc/habanalabs/common/habanalabs_drv.c +index d15b912a347b..91bcaaed5cd6 100644 +--- a/drivers/misc/habanalabs/common/habanalabs_drv.c ++++ b/drivers/misc/habanalabs/common/habanalabs_drv.c +@@ -309,7 +309,7 @@ int create_hdev(struct hl_device **dev, struct pci_dev *pdev, + + if (pdev) + hdev->asic_prop.fw_security_disabled = +- !is_asic_secured(pdev->device); ++ !is_asic_secured(hdev->asic_type); + else + hdev->asic_prop.fw_security_disabled = true; + +-- +2.30.2 + diff --git a/queue-5.13/habanalabs-fix-mask-to-obtain-page-offset.patch b/queue-5.13/habanalabs-fix-mask-to-obtain-page-offset.patch new file mode 100644 index 00000000000..d6737ae783c --- /dev/null +++ b/queue-5.13/habanalabs-fix-mask-to-obtain-page-offset.patch @@ -0,0 +1,53 @@ +From 008d9259758e5d35d11761f4746a89d720d067d6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 3 Jun 2021 00:24:32 +0300 +Subject: habanalabs: fix mask to obtain page offset + +From: Ohad Sharabi + +[ Upstream commit 0f37510ca34848718db1003479bb4671e8f3c112 ] + +When converting virtual address to physical we need to add correct +offset to the physical page. + +For this we need to use mask that include ALL bits of page offset. + +Signed-off-by: Ohad Sharabi +Reviewed-by: Oded Gabbay +Signed-off-by: Oded Gabbay +Signed-off-by: Sasha Levin +--- + drivers/misc/habanalabs/common/mmu/mmu.c | 14 +++++++++++--- + 1 file changed, 11 insertions(+), 3 deletions(-) + +diff --git a/drivers/misc/habanalabs/common/mmu/mmu.c b/drivers/misc/habanalabs/common/mmu/mmu.c +index b37189956b14..792d25b79ea6 100644 +--- a/drivers/misc/habanalabs/common/mmu/mmu.c ++++ b/drivers/misc/habanalabs/common/mmu/mmu.c +@@ -501,12 +501,20 @@ static void hl_mmu_pa_page_with_offset(struct hl_ctx *ctx, u64 virt_addr, + + if ((hops->range_type == HL_VA_RANGE_TYPE_DRAM) && + !is_power_of_2(prop->dram_page_size)) { +- u32 bit; ++ unsigned long dram_page_size = prop->dram_page_size; + u64 page_offset_mask; + u64 phys_addr_mask; ++ u32 bit; + +- bit = __ffs64((u64)prop->dram_page_size); +- page_offset_mask = ((1ull << bit) - 1); ++ /* ++ * find last set bit in page_size to cover all bits of page ++ * offset. note that 1 has to be added to bit index. ++ * note that the internal ulong variable is used to avoid ++ * alignment issue. ++ */ ++ bit = find_last_bit(&dram_page_size, ++ sizeof(dram_page_size) * BITS_PER_BYTE) + 1; ++ page_offset_mask = (BIT_ULL(bit) - 1); + phys_addr_mask = ~page_offset_mask; + *phys_addr = (tmp_phys_addr & phys_addr_mask) | + (virt_addr & page_offset_mask); +-- +2.30.2 + diff --git a/queue-5.13/habanalabs-gaudi-set-the-correct-cpu_id-on-mme2_qm-f.patch b/queue-5.13/habanalabs-gaudi-set-the-correct-cpu_id-on-mme2_qm-f.patch new file mode 100644 index 00000000000..c69ae1c44b1 --- /dev/null +++ b/queue-5.13/habanalabs-gaudi-set-the-correct-cpu_id-on-mme2_qm-f.patch @@ -0,0 +1,36 @@ +From a328ed7a9c882035c306b3ec1a225bfb22f60887 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 19 May 2021 15:16:52 +0300 +Subject: habanalabs/gaudi: set the correct cpu_id on MME2_QM failure + +From: Koby Elbaz + +[ Upstream commit b92c637c5f5ef7e3e21dbc7bfa7f1999450f3902 ] + +This fix was applied since there was an incorrect reported CPU ID to GIC +such that an error in MME2 QMAN aliased to be an arriving from DMA0_QM. + +Signed-off-by: Koby Elbaz +Reviewed-by: Oded Gabbay +Signed-off-by: Oded Gabbay +Signed-off-by: Sasha Levin +--- + drivers/misc/habanalabs/gaudi/gaudi.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/misc/habanalabs/gaudi/gaudi.c b/drivers/misc/habanalabs/gaudi/gaudi.c +index 9e4a6bb3acd1..f6a56d5f2ae7 100644 +--- a/drivers/misc/habanalabs/gaudi/gaudi.c ++++ b/drivers/misc/habanalabs/gaudi/gaudi.c +@@ -2834,7 +2834,7 @@ static void gaudi_init_mme_qman(struct hl_device *hdev, u32 mme_offset, + + /* Configure RAZWI IRQ */ + mme_id = mme_offset / +- (mmMME1_QM_GLBL_CFG0 - mmMME0_QM_GLBL_CFG0); ++ (mmMME1_QM_GLBL_CFG0 - mmMME0_QM_GLBL_CFG0) / 2; + + mme_qm_err_cfg = MME_QMAN_GLBL_ERR_CFG_MSG_EN_MASK; + if (hdev->stop_on_err) { +-- +2.30.2 + diff --git a/queue-5.13/habanalabs-gaudi-set-the-correct-rc-in-case-of-err.patch b/queue-5.13/habanalabs-gaudi-set-the-correct-rc-in-case-of-err.patch new file mode 100644 index 00000000000..ece36431467 --- /dev/null +++ b/queue-5.13/habanalabs-gaudi-set-the-correct-rc-in-case-of-err.patch @@ -0,0 +1,39 @@ +From 6209be35915ca3b38fd78f9dcb8e8994f9ea4d10 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 10 Jun 2021 09:14:43 +0300 +Subject: habanalabs/gaudi: set the correct rc in case of err + +From: Koby Elbaz + +[ Upstream commit 1f7ef4bf41c7c2abad3d21b8c69db11fc3ebc4f5 ] + +fix the following smatch warnings: +gaudi_internal_cb_pool_init() warn: missing error code 'rc' + +Signed-off-by: Koby Elbaz +Reviewed-by: Oded Gabbay +Signed-off-by: Oded Gabbay +Signed-off-by: Sasha Levin +--- + drivers/misc/habanalabs/gaudi/gaudi.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/misc/habanalabs/gaudi/gaudi.c b/drivers/misc/habanalabs/gaudi/gaudi.c +index d4f764da013c..b7b281ae8d5a 100644 +--- a/drivers/misc/habanalabs/gaudi/gaudi.c ++++ b/drivers/misc/habanalabs/gaudi/gaudi.c +@@ -8307,8 +8307,10 @@ static int gaudi_internal_cb_pool_init(struct hl_device *hdev, + HL_VA_RANGE_TYPE_HOST, HOST_SPACE_INTERNAL_CB_SZ, + HL_MMU_VA_ALIGNMENT_NOT_NEEDED); + +- if (!hdev->internal_cb_va_base) ++ if (!hdev->internal_cb_va_base) { ++ rc = -ENOMEM; + goto destroy_internal_cb_pool; ++ } + + mutex_lock(&ctx->mmu_lock); + rc = hl_mmu_map_contiguous(ctx, hdev->internal_cb_va_base, +-- +2.30.2 + diff --git a/queue-5.13/habanalabs-remove-node-from-list-before-freeing-the-.patch b/queue-5.13/habanalabs-remove-node-from-list-before-freeing-the-.patch new file mode 100644 index 00000000000..1b0473222ad --- /dev/null +++ b/queue-5.13/habanalabs-remove-node-from-list-before-freeing-the-.patch @@ -0,0 +1,53 @@ +From 8da8bb37154663203d0a386893bfe169d225b116 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 9 Jun 2021 21:43:52 +0300 +Subject: habanalabs: remove node from list before freeing the node + +From: Koby Elbaz + +[ Upstream commit f5eb7bf0c487a212ebda3c1b048fc3ccabacc147 ] + +fix the following smatch warnings: + +goya_pin_memory_before_cs() +warn: '&userptr->job_node' not removed from list + +gaudi_pin_memory_before_cs() +warn: '&userptr->job_node' not removed from list + +Signed-off-by: Koby Elbaz +Reviewed-by: Oded Gabbay +Signed-off-by: Oded Gabbay +Signed-off-by: Sasha Levin +--- + drivers/misc/habanalabs/gaudi/gaudi.c | 1 + + drivers/misc/habanalabs/goya/goya.c | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/drivers/misc/habanalabs/gaudi/gaudi.c b/drivers/misc/habanalabs/gaudi/gaudi.c +index f6a56d5f2ae7..d4f764da013c 100644 +--- a/drivers/misc/habanalabs/gaudi/gaudi.c ++++ b/drivers/misc/habanalabs/gaudi/gaudi.c +@@ -4934,6 +4934,7 @@ already_pinned: + return 0; + + unpin_memory: ++ list_del(&userptr->job_node); + hl_unpin_host_memory(hdev, userptr); + free_userptr: + kfree(userptr); +diff --git a/drivers/misc/habanalabs/goya/goya.c b/drivers/misc/habanalabs/goya/goya.c +index e0ad2a269779..d4ac10b9f25e 100644 +--- a/drivers/misc/habanalabs/goya/goya.c ++++ b/drivers/misc/habanalabs/goya/goya.c +@@ -3270,6 +3270,7 @@ already_pinned: + return 0; + + unpin_memory: ++ list_del(&userptr->job_node); + hl_unpin_host_memory(hdev, userptr); + free_userptr: + kfree(userptr); +-- +2.30.2 + diff --git a/queue-5.13/habanalabs-set-rc-as-valid-in-case-of-intentional-fu.patch b/queue-5.13/habanalabs-set-rc-as-valid-in-case-of-intentional-fu.patch new file mode 100644 index 00000000000..e6eaebf194d --- /dev/null +++ b/queue-5.13/habanalabs-set-rc-as-valid-in-case-of-intentional-fu.patch @@ -0,0 +1,60 @@ +From 3e8624a56f51f24a44694668d83d900d4b0b4fbb Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 10 Jun 2021 09:01:57 +0300 +Subject: habanalabs: set rc as 'valid' in case of intentional func exit + +From: Koby Elbaz + +[ Upstream commit 11d5cb8b95456e2432dfee2ffcebf0623998493a ] + +fix the following smatch warnings: +hl_fw_static_init_cpu() warn: missing error code 'rc' + +Signed-off-by: Koby Elbaz +Reviewed-by: Oded Gabbay +Signed-off-by: Oded Gabbay +Signed-off-by: Sasha Levin +--- + drivers/misc/habanalabs/common/device.c | 5 +++-- + drivers/misc/habanalabs/common/firmware_if.c | 5 ++++- + 2 files changed, 7 insertions(+), 3 deletions(-) + +diff --git a/drivers/misc/habanalabs/common/device.c b/drivers/misc/habanalabs/common/device.c +index 00e92b678828..eea0d3e35b88 100644 +--- a/drivers/misc/habanalabs/common/device.c ++++ b/drivers/misc/habanalabs/common/device.c +@@ -1334,8 +1334,9 @@ int hl_device_init(struct hl_device *hdev, struct class *hclass) + } + + /* +- * From this point, in case of an error, add char devices and create +- * sysfs nodes as part of the error flow, to allow debugging. ++ * From this point, override rc (=0) in case of an error to allow ++ * debugging (by adding char devices and create sysfs nodes as part of ++ * the error flow). + */ + add_cdev_sysfs_on_err = true; + +diff --git a/drivers/misc/habanalabs/common/firmware_if.c b/drivers/misc/habanalabs/common/firmware_if.c +index 0713b2c12d54..86efb9fa701c 100644 +--- a/drivers/misc/habanalabs/common/firmware_if.c ++++ b/drivers/misc/habanalabs/common/firmware_if.c +@@ -1006,11 +1006,14 @@ int hl_fw_init_cpu(struct hl_device *hdev, u32 cpu_boot_status_reg, + + if (!(hdev->fw_components & FW_TYPE_LINUX)) { + dev_info(hdev->dev, "Skip loading Linux F/W\n"); ++ rc = 0; + goto out; + } + +- if (status == CPU_BOOT_STATUS_SRAM_AVAIL) ++ if (status == CPU_BOOT_STATUS_SRAM_AVAIL) { ++ rc = 0; + goto out; ++ } + + dev_info(hdev->dev, + "Loading firmware to device, may take some time...\n"); +-- +2.30.2 + diff --git a/queue-5.13/hexagon-handle-soft-irqentry_text-in-linker-script.patch b/queue-5.13/hexagon-handle-soft-irqentry_text-in-linker-script.patch new file mode 100644 index 00000000000..57b7d22e725 --- /dev/null +++ b/queue-5.13/hexagon-handle-soft-irqentry_text-in-linker-script.patch @@ -0,0 +1,102 @@ +From f1daa575e3311edb7c4abc2c585bea256ca2d528 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 7 Jul 2021 18:07:38 -0700 +Subject: hexagon: handle {,SOFT}IRQENTRY_TEXT in linker script + +From: Nathan Chancellor + +[ Upstream commit 6fef087d0d37ba7dba8f3d75566eb4c256cd6742 ] + +Patch series "hexagon: Fix build error with CONFIG_STACKDEPOT and select CONFIG_ARCH_WANT_LD_ORPHAN_WARN". + +This series fixes an error with ARCH=hexagon that was pointed out by the +patch "mm/slub: use stackdepot to save stack trace in objects". + +The first patch fixes that error by handling the '.irqentry.text' and +'.softirqentry.text' sections. + +The second patch switches Hexagon over to the common DISCARDS macro, which +should have been done when Hexagon was merged into the tree to match +commit 023bf6f1b8bf ("linker script: unify usage of discard definition"). + +The third patch selects CONFIG_ARCH_WANT_LD_ORPHAN_WARN so that something +like this does not happen again. + +This patch (of 3): + +Patch "mm/slub: use stackdepot to save stack trace in objects" in -mm +selects CONFIG_STACKDEPOT when CONFIG_STACKTRACE_SUPPORT is selected and +CONFIG_STACKDEPOT requires IRQENTRY_TEXT and SOFTIRQENTRY_TEXT to be +handled after commit 505a0ef15f96 ("kasan: stackdepot: move +filter_irq_stacks() to stackdepot.c") due to the use of the +__{,soft}irqentry_text_{start,end} section symbols. If those sections are +not handled, the build is broken. + +$ make ARCH=hexagon CROSS_COMPILE=hexagon-linux- LLVM=1 LLVM_IAS=1 defconfig all +... +ld.lld: error: undefined symbol: __irqentry_text_start +>>> referenced by stackdepot.c +>>> stackdepot.o:(filter_irq_stacks) in archive lib/built-in.a +>>> referenced by stackdepot.c +>>> stackdepot.o:(filter_irq_stacks) in archive lib/built-in.a + +ld.lld: error: undefined symbol: __irqentry_text_end +>>> referenced by stackdepot.c +>>> stackdepot.o:(filter_irq_stacks) in archive lib/built-in.a +>>> referenced by stackdepot.c +>>> stackdepot.o:(filter_irq_stacks) in archive lib/built-in.a + +ld.lld: error: undefined symbol: __softirqentry_text_start +>>> referenced by stackdepot.c +>>> stackdepot.o:(filter_irq_stacks) in archive lib/built-in.a +>>> referenced by stackdepot.c +>>> stackdepot.o:(filter_irq_stacks) in archive lib/built-in.a + +ld.lld: error: undefined symbol: __softirqentry_text_end +>>> referenced by stackdepot.c +>>> stackdepot.o:(filter_irq_stacks) in archive lib/built-in.a +>>> referenced by stackdepot.c +>>> stackdepot.o:(filter_irq_stacks) in archive lib/built-in.a +... + +Add these sections to the Hexagon linker script so the build continues to +work. ld.lld's orphan section warning would have caught this prior to the +-mm commit mentioned above: + +ld.lld: warning: kernel/built-in.a(softirq.o):(.softirqentry.text) is being placed in '.softirqentry.text' +ld.lld: warning: kernel/built-in.a(softirq.o):(.softirqentry.text) is being placed in '.softirqentry.text' +ld.lld: warning: kernel/built-in.a(softirq.o):(.softirqentry.text) is being placed in '.softirqentry.text' + +Link: https://lkml.kernel.org/r/20210521011239.1332345-1-nathan@kernel.org +Link: https://lkml.kernel.org/r/20210521011239.1332345-2-nathan@kernel.org +Link: https://github.com/ClangBuiltLinux/linux/issues/1381 +Fixes: 505a0ef15f96 ("kasan: stackdepot: move filter_irq_stacks() to stackdepot.c") +Signed-off-by: Nathan Chancellor +Reviewed-by: Nick Desaulniers +Acked-by: Brian Cain +Cc: Oliver Glitta +Cc: Vlastimil Babka +Cc: David Rientjes +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +--- + arch/hexagon/kernel/vmlinux.lds.S | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/arch/hexagon/kernel/vmlinux.lds.S b/arch/hexagon/kernel/vmlinux.lds.S +index 35b18e55eae8..20f19539c5fc 100644 +--- a/arch/hexagon/kernel/vmlinux.lds.S ++++ b/arch/hexagon/kernel/vmlinux.lds.S +@@ -38,6 +38,8 @@ SECTIONS + .text : AT(ADDR(.text)) { + _text = .; + TEXT_TEXT ++ IRQENTRY_TEXT ++ SOFTIRQENTRY_TEXT + SCHED_TEXT + CPUIDLE_TEXT + LOCK_TEXT +-- +2.30.2 + diff --git a/queue-5.13/hexagon-use-common-discards-macro.patch b/queue-5.13/hexagon-use-common-discards-macro.patch new file mode 100644 index 00000000000..cc18f93f618 --- /dev/null +++ b/queue-5.13/hexagon-use-common-discards-macro.patch @@ -0,0 +1,63 @@ +From 4750d79563ca9c2bd283214321085e862d676a41 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 7 Jul 2021 18:07:41 -0700 +Subject: hexagon: use common DISCARDS macro + +From: Nathan Chancellor + +[ Upstream commit 681ba73c72302214686401e707e2087ed11a6556 ] + +ld.lld warns that the '.modinfo' section is not currently handled: + +ld.lld: warning: kernel/built-in.a(workqueue.o):(.modinfo) is being placed in '.modinfo' +ld.lld: warning: kernel/built-in.a(printk/printk.o):(.modinfo) is being placed in '.modinfo' +ld.lld: warning: kernel/built-in.a(irq/spurious.o):(.modinfo) is being placed in '.modinfo' +ld.lld: warning: kernel/built-in.a(rcu/update.o):(.modinfo) is being placed in '.modinfo' + +The '.modinfo' section was added in commit 898490c010b5 ("moduleparam: +Save information about built-in modules in separate file") to the DISCARDS +macro but Hexagon has never used that macro. The unification of DISCARDS +happened in commit 023bf6f1b8bf ("linker script: unify usage of discard +definition") in 2009, prior to Hexagon being added in 2011. + +Switch Hexagon over to the DISCARDS macro so that anything that is +expected to be discarded gets discarded. + +Link: https://lkml.kernel.org/r/20210521011239.1332345-3-nathan@kernel.org +Fixes: e95bf452a9e2 ("Hexagon: Add configuration and makefiles for the Hexagon architecture.") +Signed-off-by: Nathan Chancellor +Reviewed-by: Nick Desaulniers +Acked-by: Brian Cain +Cc: David Rientjes +Cc: Oliver Glitta +Cc: Vlastimil Babka +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +--- + arch/hexagon/kernel/vmlinux.lds.S | 7 +------ + 1 file changed, 1 insertion(+), 6 deletions(-) + +diff --git a/arch/hexagon/kernel/vmlinux.lds.S b/arch/hexagon/kernel/vmlinux.lds.S +index 20f19539c5fc..57465bff1fe4 100644 +--- a/arch/hexagon/kernel/vmlinux.lds.S ++++ b/arch/hexagon/kernel/vmlinux.lds.S +@@ -61,14 +61,9 @@ SECTIONS + + _end = .; + +- /DISCARD/ : { +- EXIT_TEXT +- EXIT_DATA +- EXIT_CALL +- } +- + STABS_DEBUG + DWARF_DEBUG + ELF_DETAILS + ++ DISCARDS + } +-- +2.30.2 + diff --git a/queue-5.13/i2c-core-disable-client-irq-on-reboot-shutdown.patch b/queue-5.13/i2c-core-disable-client-irq-on-reboot-shutdown.patch new file mode 100644 index 00000000000..f98b499da6c --- /dev/null +++ b/queue-5.13/i2c-core-disable-client-irq-on-reboot-shutdown.patch @@ -0,0 +1,59 @@ +From 2c0678dadded3924116c13f0f4a4312449134648 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 4 Jun 2021 16:27:44 -0700 +Subject: i2c: core: Disable client irq on reboot/shutdown + +From: Dmitry Torokhov + +[ Upstream commit b64210f2f7c11c757432ba3701d88241b2b98fb1 ] + +If an i2c client receives an interrupt during reboot or shutdown it may +be too late to service it by making an i2c transaction on the bus +because the i2c controller has already been shutdown. This can lead to +system hangs if the i2c controller tries to make a transfer that is +doomed to fail because the access to the i2c pins is already shut down, +or an iommu translation has been torn down so i2c controller register +access doesn't work. + +Let's simply disable the irq if there isn't a shutdown callback for an +i2c client when there is an irq associated with the device. This will +make sure that irqs don't come in later than the time that we can handle +it. We don't do this if the i2c client device already has a shutdown +callback because presumably they're doing the right thing and quieting +the device so irqs don't come in after the shutdown callback returns. + +Reported-by: kernel test robot +[swboyd@chromium.org: Dropped newline, added commit text, added +interrupt.h for robot build error] +Signed-off-by: Stephen Boyd +Signed-off-by: Dmitry Torokhov +Signed-off-by: Wolfram Sang +Signed-off-by: Sasha Levin +--- + drivers/i2c/i2c-core-base.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c +index 5a97e4a02fa2..e314ccaf114a 100644 +--- a/drivers/i2c/i2c-core-base.c ++++ b/drivers/i2c/i2c-core-base.c +@@ -24,6 +24,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -627,6 +628,8 @@ static void i2c_device_shutdown(struct device *dev) + driver = to_i2c_driver(dev->driver); + if (driver->shutdown) + driver->shutdown(client); ++ else if (client->irq > 0) ++ disable_irq(client->irq); + } + + static void i2c_client_dev_release(struct device *dev) +-- +2.30.2 + diff --git a/queue-5.13/iio-gyro-fxa21002c-balance-runtime-pm-use-pm_runtime.patch b/queue-5.13/iio-gyro-fxa21002c-balance-runtime-pm-use-pm_runtime.patch new file mode 100644 index 00000000000..d87b082d6fe --- /dev/null +++ b/queue-5.13/iio-gyro-fxa21002c-balance-runtime-pm-use-pm_runtime.patch @@ -0,0 +1,71 @@ +From d19e7117c184995a6357ee48a1166a00a4bf6fab Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 9 May 2021 12:33:27 +0100 +Subject: iio: gyro: fxa21002c: Balance runtime pm + use + pm_runtime_resume_and_get(). + +From: Jonathan Cameron + +[ Upstream commit 41120ebbb1eb5e9dec93320e259d5b2c93226073 ] + +In both the probe() error path and remove() pm_runtime_put_noidle() +is called which will decrement the runtime pm reference count. +However, there is no matching function to have raised the reference count. +Not this isn't a fix as the runtime pm core will stop the reference count +going negative anyway. + +An alternative would have been to raise the count in these paths, but +it is not clear why that would be necessary. + +Whilst we are here replace some boilerplate with pm_runtime_resume_and_get() +Found using coccicheck script under review at: +https://lore.kernel.org/lkml/20210427141946.2478411-1-Julia.Lawall@inria.fr/ + +Signed-off-by: Jonathan Cameron +Reviewed-by: Rui Miguel Silva +Reviewed-by: Mauro Carvalho Chehab +Link: https://lore.kernel.org/r/20210509113354.660190-2-jic23@kernel.org +Signed-off-by: Sasha Levin +--- + drivers/iio/gyro/fxas21002c_core.c | 11 +---------- + 1 file changed, 1 insertion(+), 10 deletions(-) + +diff --git a/drivers/iio/gyro/fxas21002c_core.c b/drivers/iio/gyro/fxas21002c_core.c +index 645461c70454..6a85f231fd57 100644 +--- a/drivers/iio/gyro/fxas21002c_core.c ++++ b/drivers/iio/gyro/fxas21002c_core.c +@@ -366,14 +366,7 @@ out_unlock: + + static int fxas21002c_pm_get(struct fxas21002c_data *data) + { +- struct device *dev = regmap_get_device(data->regmap); +- int ret; +- +- ret = pm_runtime_get_sync(dev); +- if (ret < 0) +- pm_runtime_put_noidle(dev); +- +- return ret; ++ return pm_runtime_resume_and_get(regmap_get_device(data->regmap)); + } + + static int fxas21002c_pm_put(struct fxas21002c_data *data) +@@ -1004,7 +997,6 @@ int fxas21002c_core_probe(struct device *dev, struct regmap *regmap, int irq, + pm_disable: + pm_runtime_disable(dev); + pm_runtime_set_suspended(dev); +- pm_runtime_put_noidle(dev); + + return ret; + } +@@ -1018,7 +1010,6 @@ void fxas21002c_core_remove(struct device *dev) + + pm_runtime_disable(dev); + pm_runtime_set_suspended(dev); +- pm_runtime_put_noidle(dev); + } + EXPORT_SYMBOL_GPL(fxas21002c_core_remove); + +-- +2.30.2 + diff --git a/queue-5.13/iio-imu-st_lsm6dsx-correct-odr-in-header.patch b/queue-5.13/iio-imu-st_lsm6dsx-correct-odr-in-header.patch new file mode 100644 index 00000000000..6bb16d1ed9e --- /dev/null +++ b/queue-5.13/iio-imu-st_lsm6dsx-correct-odr-in-header.patch @@ -0,0 +1,49 @@ +From 60f310f9b9443bdca7114533799f84554d557931 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 7 May 2021 12:31:49 +0200 +Subject: iio: imu: st_lsm6dsx: correct ODR in header + +From: Sean Nyekjaer + +[ Upstream commit f7d5c18a8c371c306d73757547c2e0d6cfc764b3 ] + +Fix wrongly stated 13 Hz ODR for accelerometers, the correct ODR is 12.5 Hz + +Signed-off-by: Sean Nyekjaer +Acked-by: Lorenzo Bianconi +Signed-off-by: Jonathan Cameron +Signed-off-by: Sasha Levin +--- + drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c +index 7cedaab096a7..e8d242ee6743 100644 +--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c ++++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c +@@ -15,19 +15,19 @@ + * + * Supported sensors: + * - LSM6DS3: +- * - Accelerometer/Gyroscope supported ODR [Hz]: 13, 26, 52, 104, 208, 416 ++ * - Accelerometer/Gyroscope supported ODR [Hz]: 12.5, 26, 52, 104, 208, 416 + * - Accelerometer supported full-scale [g]: +-2/+-4/+-8/+-16 + * - Gyroscope supported full-scale [dps]: +-125/+-245/+-500/+-1000/+-2000 + * - FIFO size: 8KB + * + * - LSM6DS3H/LSM6DSL/LSM6DSM/ISM330DLC/LSM6DS3TR-C: +- * - Accelerometer/Gyroscope supported ODR [Hz]: 13, 26, 52, 104, 208, 416 ++ * - Accelerometer/Gyroscope supported ODR [Hz]: 12.5, 26, 52, 104, 208, 416 + * - Accelerometer supported full-scale [g]: +-2/+-4/+-8/+-16 + * - Gyroscope supported full-scale [dps]: +-125/+-245/+-500/+-1000/+-2000 + * - FIFO size: 4KB + * + * - LSM6DSO/LSM6DSOX/ASM330LHH/LSM6DSR/ISM330DHCX/LSM6DST/LSM6DSOP: +- * - Accelerometer/Gyroscope supported ODR [Hz]: 13, 26, 52, 104, 208, 416, ++ * - Accelerometer/Gyroscope supported ODR [Hz]: 12.5, 26, 52, 104, 208, 416, + * 833 + * - Accelerometer supported full-scale [g]: +-2/+-4/+-8/+-16 + * - Gyroscope supported full-scale [dps]: +-125/+-245/+-500/+-1000/+-2000 +-- +2.30.2 + diff --git a/queue-5.13/iio-magn-bmc150-balance-runtime-pm-use-pm_runtime_re.patch b/queue-5.13/iio-magn-bmc150-balance-runtime-pm-use-pm_runtime_re.patch new file mode 100644 index 00000000000..6947e64fea8 --- /dev/null +++ b/queue-5.13/iio-magn-bmc150-balance-runtime-pm-use-pm_runtime_re.patch @@ -0,0 +1,78 @@ +From 5593e9e67a73f4821032cd5e5d29228a254d1197 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 9 May 2021 12:33:37 +0100 +Subject: iio: magn: bmc150: Balance runtime pm + use + pm_runtime_resume_and_get() + +From: Jonathan Cameron + +[ Upstream commit 264da512431495e542fcaf56ffe75e7df0e7db74 ] + +probe() error paths after runtime pm is enabled, should disable it. +remove() should not call pm_runtime_put_noidle() as there is no +matching get() to have raised the reference count. This case +has no affect a the runtime pm core protects against going negative. + +Whilst here use pm_runtime_resume_and_get() to tidy things up a little. +coccicheck script didn't get this one due to complex code structure so +found by inspection. + +Signed-off-by: Jonathan Cameron +Cc: Linus Walleij +Reviewed-by: Mauro Carvalho Chehab +Link: https://lore.kernel.org/r/20210509113354.660190-12-jic23@kernel.org +Signed-off-by: Sasha Levin +--- + drivers/iio/magnetometer/bmc150_magn.c | 10 ++++------ + 1 file changed, 4 insertions(+), 6 deletions(-) + +diff --git a/drivers/iio/magnetometer/bmc150_magn.c b/drivers/iio/magnetometer/bmc150_magn.c +index d534f4f3909e..6cf3eceaf2d9 100644 +--- a/drivers/iio/magnetometer/bmc150_magn.c ++++ b/drivers/iio/magnetometer/bmc150_magn.c +@@ -265,7 +265,7 @@ static int bmc150_magn_set_power_state(struct bmc150_magn_data *data, bool on) + int ret; + + if (on) { +- ret = pm_runtime_get_sync(data->dev); ++ ret = pm_runtime_resume_and_get(data->dev); + } else { + pm_runtime_mark_last_busy(data->dev); + ret = pm_runtime_put_autosuspend(data->dev); +@@ -274,9 +274,6 @@ static int bmc150_magn_set_power_state(struct bmc150_magn_data *data, bool on) + if (ret < 0) { + dev_err(data->dev, + "failed to change power state to %d\n", on); +- if (on) +- pm_runtime_put_noidle(data->dev); +- + return ret; + } + #endif +@@ -966,12 +963,14 @@ int bmc150_magn_probe(struct device *dev, struct regmap *regmap, + ret = iio_device_register(indio_dev); + if (ret < 0) { + dev_err(dev, "unable to register iio device\n"); +- goto err_buffer_cleanup; ++ goto err_disable_runtime_pm; + } + + dev_dbg(dev, "Registered device %s\n", name); + return 0; + ++err_disable_runtime_pm: ++ pm_runtime_disable(dev); + err_buffer_cleanup: + iio_triggered_buffer_cleanup(indio_dev); + err_free_irq: +@@ -995,7 +994,6 @@ int bmc150_magn_remove(struct device *dev) + + pm_runtime_disable(dev); + pm_runtime_set_suspended(dev); +- pm_runtime_put_noidle(dev); + + iio_triggered_buffer_cleanup(indio_dev); + +-- +2.30.2 + diff --git a/queue-5.13/input-hideep-fix-the-uninitialized-use-in-hideep_nvm.patch b/queue-5.13/input-hideep-fix-the-uninitialized-use-in-hideep_nvm.patch new file mode 100644 index 00000000000..4b3000a8298 --- /dev/null +++ b/queue-5.13/input-hideep-fix-the-uninitialized-use-in-hideep_nvm.patch @@ -0,0 +1,67 @@ +From 5b2638067aa41d42ff5a915050e6adfabe9d6184 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 19 Jun 2021 22:26:50 -0700 +Subject: Input: hideep - fix the uninitialized use in hideep_nvm_unlock() + +From: Yizhuo Zhai + +[ Upstream commit cac7100d4c51c04979dacdfe6c9a5e400d3f0a27 ] + +Inside function hideep_nvm_unlock(), variable "unmask_code" could +be uninitialized if hideep_pgm_r_reg() returns error, however, it +is used in the later if statement after an "and" operation, which +is potentially unsafe. + +Signed-off-by: Yizhuo +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/touchscreen/hideep.c | 13 ++++++++++--- + 1 file changed, 10 insertions(+), 3 deletions(-) + +diff --git a/drivers/input/touchscreen/hideep.c b/drivers/input/touchscreen/hideep.c +index ddad4a82a5e5..e9547ee29756 100644 +--- a/drivers/input/touchscreen/hideep.c ++++ b/drivers/input/touchscreen/hideep.c +@@ -361,13 +361,16 @@ static int hideep_enter_pgm(struct hideep_ts *ts) + return -EIO; + } + +-static void hideep_nvm_unlock(struct hideep_ts *ts) ++static int hideep_nvm_unlock(struct hideep_ts *ts) + { + u32 unmask_code; ++ int error; + + hideep_pgm_w_reg(ts, HIDEEP_FLASH_CFG, HIDEEP_NVM_SFR_RPAGE); +- hideep_pgm_r_reg(ts, 0x0000000C, &unmask_code); ++ error = hideep_pgm_r_reg(ts, 0x0000000C, &unmask_code); + hideep_pgm_w_reg(ts, HIDEEP_FLASH_CFG, HIDEEP_NVM_DEFAULT_PAGE); ++ if (error) ++ return error; + + /* make it unprotected code */ + unmask_code &= ~HIDEEP_PROT_MODE; +@@ -384,6 +387,8 @@ static void hideep_nvm_unlock(struct hideep_ts *ts) + NVM_W_SFR(HIDEEP_NVM_MASK_OFS, ts->nvm_mask); + SET_FLASH_HWCONTROL(); + hideep_pgm_w_reg(ts, HIDEEP_FLASH_CFG, HIDEEP_NVM_DEFAULT_PAGE); ++ ++ return 0; + } + + static int hideep_check_status(struct hideep_ts *ts) +@@ -462,7 +467,9 @@ static int hideep_program_nvm(struct hideep_ts *ts, + u32 addr = 0; + int error; + +- hideep_nvm_unlock(ts); ++ error = hideep_nvm_unlock(ts); ++ if (error) ++ return error; + + while (ucode_len > 0) { + xfer_len = min_t(size_t, ucode_len, HIDEEP_NVM_PAGE_SIZE); +-- +2.30.2 + diff --git a/queue-5.13/intel_th-wait-until-port-is-in-reset-before-programm.patch b/queue-5.13/intel_th-wait-until-port-is-in-reset-before-programm.patch new file mode 100644 index 00000000000..a6708bc4062 --- /dev/null +++ b/queue-5.13/intel_th-wait-until-port-is-in-reset-before-programm.patch @@ -0,0 +1,119 @@ +From 8619d0809c00123be25c86f11e2667f5e31875bb Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 21 Jun 2021 18:12:46 +0300 +Subject: intel_th: Wait until port is in reset before programming it + +From: Alexander Shishkin + +[ Upstream commit ab1afed701d2db7eb35c1a2526a29067a38e93d1 ] + +Some devices don't drain their pipelines if we don't make sure that +the corresponding output port is in reset before programming it for +a new trace capture, resulting in bits of old trace appearing in the +new trace capture. Fix that by explicitly making sure the reset is +asserted before programming new trace capture. + +Reviewed-by: Andy Shevchenko +Signed-off-by: Alexander Shishkin +Link: https://lore.kernel.org/r/20210621151246.31891-5-alexander.shishkin@linux.intel.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/hwtracing/intel_th/core.c | 17 +++++++++++++++++ + drivers/hwtracing/intel_th/gth.c | 16 ++++++++++++++++ + drivers/hwtracing/intel_th/intel_th.h | 3 +++ + 3 files changed, 36 insertions(+) + +diff --git a/drivers/hwtracing/intel_th/core.c b/drivers/hwtracing/intel_th/core.c +index 24d0c974bfd5..1b44d86af9c2 100644 +--- a/drivers/hwtracing/intel_th/core.c ++++ b/drivers/hwtracing/intel_th/core.c +@@ -215,6 +215,22 @@ static ssize_t port_show(struct device *dev, struct device_attribute *attr, + + static DEVICE_ATTR_RO(port); + ++static void intel_th_trace_prepare(struct intel_th_device *thdev) ++{ ++ struct intel_th_device *hub = to_intel_th_hub(thdev); ++ struct intel_th_driver *hubdrv = to_intel_th_driver(hub->dev.driver); ++ ++ if (hub->type != INTEL_TH_SWITCH) ++ return; ++ ++ if (thdev->type != INTEL_TH_OUTPUT) ++ return; ++ ++ pm_runtime_get_sync(&thdev->dev); ++ hubdrv->prepare(hub, &thdev->output); ++ pm_runtime_put(&thdev->dev); ++} ++ + static int intel_th_output_activate(struct intel_th_device *thdev) + { + struct intel_th_driver *thdrv = +@@ -235,6 +251,7 @@ static int intel_th_output_activate(struct intel_th_device *thdev) + if (ret) + goto fail_put; + ++ intel_th_trace_prepare(thdev); + if (thdrv->activate) + ret = thdrv->activate(thdev); + else +diff --git a/drivers/hwtracing/intel_th/gth.c b/drivers/hwtracing/intel_th/gth.c +index 28509b02a0b5..b3308934a687 100644 +--- a/drivers/hwtracing/intel_th/gth.c ++++ b/drivers/hwtracing/intel_th/gth.c +@@ -564,6 +564,21 @@ static void gth_tscu_resync(struct gth_device *gth) + iowrite32(reg, gth->base + REG_TSCU_TSUCTRL); + } + ++static void intel_th_gth_prepare(struct intel_th_device *thdev, ++ struct intel_th_output *output) ++{ ++ struct gth_device *gth = dev_get_drvdata(&thdev->dev); ++ int count; ++ ++ /* ++ * Wait until the output port is in reset before we start ++ * programming it. ++ */ ++ for (count = GTH_PLE_WAITLOOP_DEPTH; ++ count && !(gth_output_get(gth, output->port) & BIT(5)); count--) ++ cpu_relax(); ++} ++ + /** + * intel_th_gth_enable() - enable tracing to an output device + * @thdev: GTH device +@@ -815,6 +830,7 @@ static struct intel_th_driver intel_th_gth_driver = { + .assign = intel_th_gth_assign, + .unassign = intel_th_gth_unassign, + .set_output = intel_th_gth_set_output, ++ .prepare = intel_th_gth_prepare, + .enable = intel_th_gth_enable, + .trig_switch = intel_th_gth_switch, + .disable = intel_th_gth_disable, +diff --git a/drivers/hwtracing/intel_th/intel_th.h b/drivers/hwtracing/intel_th/intel_th.h +index 89c67e0e1d34..0ffb42990175 100644 +--- a/drivers/hwtracing/intel_th/intel_th.h ++++ b/drivers/hwtracing/intel_th/intel_th.h +@@ -143,6 +143,7 @@ intel_th_output_assigned(struct intel_th_device *thdev) + * @remove: remove method + * @assign: match a given output type device against available outputs + * @unassign: deassociate an output type device from an output port ++ * @prepare: prepare output port for tracing + * @enable: enable tracing for a given output device + * @disable: disable tracing for a given output device + * @irq: interrupt callback +@@ -164,6 +165,8 @@ struct intel_th_driver { + struct intel_th_device *othdev); + void (*unassign)(struct intel_th_device *thdev, + struct intel_th_device *othdev); ++ void (*prepare)(struct intel_th_device *thdev, ++ struct intel_th_output *output); + void (*enable)(struct intel_th_device *thdev, + struct intel_th_output *output); + void (*trig_switch)(struct intel_th_device *thdev, +-- +2.30.2 + diff --git a/queue-5.13/io_uring-don-t-bounce-submit_state-cachelines.patch b/queue-5.13/io_uring-don-t-bounce-submit_state-cachelines.patch new file mode 100644 index 00000000000..309beaa55a9 --- /dev/null +++ b/queue-5.13/io_uring-don-t-bounce-submit_state-cachelines.patch @@ -0,0 +1,100 @@ +From b5f70d7202a1101a87e10a97d8c1c610825b3f66 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 16 May 2021 22:58:12 +0100 +Subject: io_uring: don't bounce submit_state cachelines + +From: Pavel Begunkov + +[ Upstream commit d0acdee296d42e700c16271d9f95085a9c897a53 ] + +struct io_submit_state contains struct io_comp_state and so +locked_free_*, that renders cachelines around ->locked_free* being +invalidated on most non-inline completions, that may terrorise caches if +submissions and completions are done by different tasks. + +Signed-off-by: Pavel Begunkov +Link: https://lore.kernel.org/r/290cb5412b76892e8631978ee8ab9db0c6290dd5.1621201931.git.asml.silence@gmail.com +Signed-off-by: Jens Axboe +Signed-off-by: Sasha Levin +--- + fs/io_uring.c | 20 +++++++++----------- + 1 file changed, 9 insertions(+), 11 deletions(-) + +diff --git a/fs/io_uring.c b/fs/io_uring.c +index 5d685c92b8fd..bf3566ff9516 100644 +--- a/fs/io_uring.c ++++ b/fs/io_uring.c +@@ -299,11 +299,8 @@ struct io_sq_data { + struct io_comp_state { + struct io_kiocb *reqs[IO_COMPL_BATCH]; + unsigned int nr; +- unsigned int locked_free_nr; + /* inline/task_work completion list, under ->uring_lock */ + struct list_head free_list; +- /* IRQ completion list, under ->completion_lock */ +- struct list_head locked_free_list; + }; + + struct io_submit_link { +@@ -382,6 +379,9 @@ struct io_ring_ctx { + } ____cacheline_aligned_in_smp; + + struct io_submit_state submit_state; ++ /* IRQ completion list, under ->completion_lock */ ++ struct list_head locked_free_list; ++ unsigned int locked_free_nr; + + struct io_rings *rings; + +@@ -1193,7 +1193,7 @@ static struct io_ring_ctx *io_ring_ctx_alloc(struct io_uring_params *p) + init_llist_head(&ctx->rsrc_put_llist); + INIT_LIST_HEAD(&ctx->tctx_list); + INIT_LIST_HEAD(&ctx->submit_state.comp.free_list); +- INIT_LIST_HEAD(&ctx->submit_state.comp.locked_free_list); ++ INIT_LIST_HEAD(&ctx->locked_free_list); + return ctx; + err: + kfree(ctx->dummy_ubuf); +@@ -1590,8 +1590,6 @@ static void io_req_complete_post(struct io_kiocb *req, long res, + * free_list cache. + */ + if (req_ref_put_and_test(req)) { +- struct io_comp_state *cs = &ctx->submit_state.comp; +- + if (req->flags & (REQ_F_LINK | REQ_F_HARDLINK)) { + if (req->flags & (REQ_F_LINK_TIMEOUT | REQ_F_FAIL_LINK)) + io_disarm_next(req); +@@ -1602,8 +1600,8 @@ static void io_req_complete_post(struct io_kiocb *req, long res, + } + io_dismantle_req(req); + io_put_task(req->task, 1); +- list_add(&req->compl.list, &cs->locked_free_list); +- cs->locked_free_nr++; ++ list_add(&req->compl.list, &ctx->locked_free_list); ++ ctx->locked_free_nr++; + } else { + if (!percpu_ref_tryget(&ctx->refs)) + req = NULL; +@@ -1658,8 +1656,8 @@ static void io_flush_cached_locked_reqs(struct io_ring_ctx *ctx, + struct io_comp_state *cs) + { + spin_lock_irq(&ctx->completion_lock); +- list_splice_init(&cs->locked_free_list, &cs->free_list); +- cs->locked_free_nr = 0; ++ list_splice_init(&ctx->locked_free_list, &cs->free_list); ++ ctx->locked_free_nr = 0; + spin_unlock_irq(&ctx->completion_lock); + } + +@@ -1675,7 +1673,7 @@ static bool io_flush_cached_reqs(struct io_ring_ctx *ctx) + * locked cache, grab the lock and move them over to our submission + * side cache. + */ +- if (READ_ONCE(cs->locked_free_nr) > IO_COMPL_BATCH) ++ if (READ_ONCE(ctx->locked_free_nr) > IO_COMPL_BATCH) + io_flush_cached_locked_reqs(ctx, cs); + + nr = state->free_reqs; +-- +2.30.2 + diff --git a/queue-5.13/io_uring-get-rid-of-files-in-exit-cancel.patch b/queue-5.13/io_uring-get-rid-of-files-in-exit-cancel.patch new file mode 100644 index 00000000000..6c7f9086529 --- /dev/null +++ b/queue-5.13/io_uring-get-rid-of-files-in-exit-cancel.patch @@ -0,0 +1,255 @@ +From a42aa3dcf6e0cd9f42694796ccc34d260963677e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 16 May 2021 22:58:04 +0100 +Subject: io_uring: get rid of files in exit cancel + +From: Pavel Begunkov + +[ Upstream commit 3dd0c97a9e011b11ce6bd245bacf58c57f6f7875 ] + +We don't match against files on cancellation anymore, so no need to drag +around files_struct anymore, just pass a flag telling whether only +inflight or all requests should be killed. + +Signed-off-by: Pavel Begunkov +Link: https://lore.kernel.org/r/7bfc5409a78f8e2d6b27dec3293ec2d248677348.1621201931.git.asml.silence@gmail.com +Signed-off-by: Jens Axboe +Signed-off-by: Sasha Levin +--- + fs/io_uring.c | 63 +++++++++++++++++++++++++-------------------------- + 1 file changed, 31 insertions(+), 32 deletions(-) + +diff --git a/fs/io_uring.c b/fs/io_uring.c +index a949b2bdb718..2bf2aacb4c81 100644 +--- a/fs/io_uring.c ++++ b/fs/io_uring.c +@@ -1037,7 +1037,7 @@ static bool io_disarm_next(struct io_kiocb *req); + static void io_uring_del_task_file(unsigned long index); + static void io_uring_try_cancel_requests(struct io_ring_ctx *ctx, + struct task_struct *task, +- struct files_struct *files); ++ bool cancel_all); + static void io_uring_cancel_sqpoll(struct io_sq_data *sqd); + static struct io_rsrc_node *io_rsrc_node_alloc(struct io_ring_ctx *ctx); + +@@ -1106,15 +1106,14 @@ static void io_refs_resurrect(struct percpu_ref *ref, struct completion *compl) + percpu_ref_put(ref); + } + +-static bool io_match_task(struct io_kiocb *head, +- struct task_struct *task, +- struct files_struct *files) ++static bool io_match_task(struct io_kiocb *head, struct task_struct *task, ++ bool cancel_all) + { + struct io_kiocb *req; + + if (task && head->task != task) + return false; +- if (!files) ++ if (cancel_all) + return true; + + io_for_each_link(req, head) { +@@ -5265,7 +5264,7 @@ static bool io_poll_remove_one(struct io_kiocb *req) + * Returns true if we found and killed one or more poll requests + */ + static bool io_poll_remove_all(struct io_ring_ctx *ctx, struct task_struct *tsk, +- struct files_struct *files) ++ bool cancel_all) + { + struct hlist_node *tmp; + struct io_kiocb *req; +@@ -5277,7 +5276,7 @@ static bool io_poll_remove_all(struct io_ring_ctx *ctx, struct task_struct *tsk, + + list = &ctx->cancel_hash[i]; + hlist_for_each_entry_safe(req, tmp, list, hash_node) { +- if (io_match_task(req, tsk, files)) ++ if (io_match_task(req, tsk, cancel_all)) + posted += io_poll_remove_one(req); + } + } +@@ -8747,7 +8746,7 @@ static void io_ring_exit_work(struct work_struct *work) + * as nobody else will be looking for them. + */ + do { +- io_uring_try_cancel_requests(ctx, NULL, NULL); ++ io_uring_try_cancel_requests(ctx, NULL, true); + if (ctx->sq_data) { + struct io_sq_data *sqd = ctx->sq_data; + struct task_struct *tsk; +@@ -8798,14 +8797,14 @@ static void io_ring_exit_work(struct work_struct *work) + + /* Returns true if we found and killed one or more timeouts */ + static bool io_kill_timeouts(struct io_ring_ctx *ctx, struct task_struct *tsk, +- struct files_struct *files) ++ bool cancel_all) + { + struct io_kiocb *req, *tmp; + int canceled = 0; + + spin_lock_irq(&ctx->completion_lock); + list_for_each_entry_safe(req, tmp, &ctx->timeout_list, timeout.list) { +- if (io_match_task(req, tsk, files)) { ++ if (io_match_task(req, tsk, cancel_all)) { + io_kill_timeout(req, -ECANCELED); + canceled++; + } +@@ -8831,8 +8830,8 @@ static void io_ring_ctx_wait_and_kill(struct io_ring_ctx *ctx) + io_unregister_personality(ctx, index); + mutex_unlock(&ctx->uring_lock); + +- io_kill_timeouts(ctx, NULL, NULL); +- io_poll_remove_all(ctx, NULL, NULL); ++ io_kill_timeouts(ctx, NULL, true); ++ io_poll_remove_all(ctx, NULL, true); + + /* if we failed setting up the ctx, we might not have any rings */ + io_iopoll_try_reap_events(ctx); +@@ -8858,7 +8857,7 @@ static int io_uring_release(struct inode *inode, struct file *file) + + struct io_task_cancel { + struct task_struct *task; +- struct files_struct *files; ++ bool all; + }; + + static bool io_cancel_task_cb(struct io_wq_work *work, void *data) +@@ -8867,30 +8866,29 @@ static bool io_cancel_task_cb(struct io_wq_work *work, void *data) + struct io_task_cancel *cancel = data; + bool ret; + +- if (cancel->files && (req->flags & REQ_F_LINK_TIMEOUT)) { ++ if (!cancel->all && (req->flags & REQ_F_LINK_TIMEOUT)) { + unsigned long flags; + struct io_ring_ctx *ctx = req->ctx; + + /* protect against races with linked timeouts */ + spin_lock_irqsave(&ctx->completion_lock, flags); +- ret = io_match_task(req, cancel->task, cancel->files); ++ ret = io_match_task(req, cancel->task, cancel->all); + spin_unlock_irqrestore(&ctx->completion_lock, flags); + } else { +- ret = io_match_task(req, cancel->task, cancel->files); ++ ret = io_match_task(req, cancel->task, cancel->all); + } + return ret; + } + + static bool io_cancel_defer_files(struct io_ring_ctx *ctx, +- struct task_struct *task, +- struct files_struct *files) ++ struct task_struct *task, bool cancel_all) + { + struct io_defer_entry *de; + LIST_HEAD(list); + + spin_lock_irq(&ctx->completion_lock); + list_for_each_entry_reverse(de, &ctx->defer_list, list) { +- if (io_match_task(de->req, task, files)) { ++ if (io_match_task(de->req, task, cancel_all)) { + list_cut_position(&list, &ctx->defer_list, &de->list); + break; + } +@@ -8934,9 +8932,9 @@ static bool io_uring_try_cancel_iowq(struct io_ring_ctx *ctx) + + static void io_uring_try_cancel_requests(struct io_ring_ctx *ctx, + struct task_struct *task, +- struct files_struct *files) ++ bool cancel_all) + { +- struct io_task_cancel cancel = { .task = task, .files = files, }; ++ struct io_task_cancel cancel = { .task = task, .all = cancel_all, }; + struct io_uring_task *tctx = task ? task->io_uring : NULL; + + while (1) { +@@ -8956,7 +8954,7 @@ static void io_uring_try_cancel_requests(struct io_ring_ctx *ctx, + } + + /* SQPOLL thread does its own polling */ +- if ((!(ctx->flags & IORING_SETUP_SQPOLL) && !files) || ++ if ((!(ctx->flags & IORING_SETUP_SQPOLL) && cancel_all) || + (ctx->sq_data && ctx->sq_data->thread == current)) { + while (!list_empty_careful(&ctx->iopoll_list)) { + io_iopoll_try_reap_events(ctx); +@@ -8964,9 +8962,9 @@ static void io_uring_try_cancel_requests(struct io_ring_ctx *ctx, + } + } + +- ret |= io_cancel_defer_files(ctx, task, files); +- ret |= io_poll_remove_all(ctx, task, files); +- ret |= io_kill_timeouts(ctx, task, files); ++ ret |= io_cancel_defer_files(ctx, task, cancel_all); ++ ret |= io_poll_remove_all(ctx, task, cancel_all); ++ ret |= io_kill_timeouts(ctx, task, cancel_all); + ret |= io_run_task_work(); + ret |= io_run_ctx_fallback(ctx); + if (!ret) +@@ -9072,7 +9070,7 @@ static s64 tctx_inflight(struct io_uring_task *tctx, bool tracked) + return percpu_counter_sum(&tctx->inflight); + } + +-static void io_uring_try_cancel(struct files_struct *files) ++static void io_uring_try_cancel(bool cancel_all) + { + struct io_uring_task *tctx = current->io_uring; + struct io_tctx_node *node; +@@ -9083,7 +9081,7 @@ static void io_uring_try_cancel(struct files_struct *files) + + /* sqpoll task will cancel all its requests */ + if (!ctx->sq_data) +- io_uring_try_cancel_requests(ctx, current, files); ++ io_uring_try_cancel_requests(ctx, current, cancel_all); + } + } + +@@ -9109,7 +9107,7 @@ static void io_uring_cancel_sqpoll(struct io_sq_data *sqd) + if (!inflight) + break; + list_for_each_entry(ctx, &sqd->ctx_list, sqd_list) +- io_uring_try_cancel_requests(ctx, current, NULL); ++ io_uring_try_cancel_requests(ctx, current, true); + + prepare_to_wait(&tctx->wait, &wait, TASK_UNINTERRUPTIBLE); + /* +@@ -9133,6 +9131,7 @@ void __io_uring_cancel(struct files_struct *files) + struct io_uring_task *tctx = current->io_uring; + DEFINE_WAIT(wait); + s64 inflight; ++ bool cancel_all = !files; + + if (tctx->io_wq) + io_wq_exit_start(tctx->io_wq); +@@ -9141,10 +9140,10 @@ void __io_uring_cancel(struct files_struct *files) + atomic_inc(&tctx->in_idle); + do { + /* read completions before cancelations */ +- inflight = tctx_inflight(tctx, !!files); ++ inflight = tctx_inflight(tctx, !cancel_all); + if (!inflight) + break; +- io_uring_try_cancel(files); ++ io_uring_try_cancel(cancel_all); + prepare_to_wait(&tctx->wait, &wait, TASK_UNINTERRUPTIBLE); + + /* +@@ -9152,14 +9151,14 @@ void __io_uring_cancel(struct files_struct *files) + * avoids a race where a completion comes in before we did + * prepare_to_wait(). + */ +- if (inflight == tctx_inflight(tctx, !!files)) ++ if (inflight == tctx_inflight(tctx, !cancel_all)) + schedule(); + finish_wait(&tctx->wait, &wait); + } while (1); + atomic_dec(&tctx->in_idle); + + io_uring_clean_tctx(tctx); +- if (!files) { ++ if (cancel_all) { + /* for exec all current's requests should be gone, kill tctx */ + __io_uring_free(current); + } +-- +2.30.2 + diff --git a/queue-5.13/io_uring-inline-__tctx_task_work.patch b/queue-5.13/io_uring-inline-__tctx_task_work.patch new file mode 100644 index 00000000000..68dbf33141a --- /dev/null +++ b/queue-5.13/io_uring-inline-__tctx_task_work.patch @@ -0,0 +1,107 @@ +From ca96ea446b2705be7be4afeffd65171e04e2a473 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 17 Jun 2021 18:14:06 +0100 +Subject: io_uring: inline __tctx_task_work() + +From: Pavel Begunkov + +[ Upstream commit 3f18407dc6f2db0968daaa36c39a772c2c9f8ea7 ] + +Inline __tctx_task_work() into tctx_task_work() in preparation for +further optimisations. + +Signed-off-by: Pavel Begunkov +Link: https://lore.kernel.org/r/f9c05c4bc9763af7bd8e25ebc3c5f7b6f69148f8.1623949695.git.asml.silence@gmail.com +Signed-off-by: Jens Axboe +Signed-off-by: Sasha Levin +--- + fs/io_uring.c | 67 ++++++++++++++++++++++++--------------------------- + 1 file changed, 31 insertions(+), 36 deletions(-) + +diff --git a/fs/io_uring.c b/fs/io_uring.c +index ab1dcf69217f..262e6748c88a 100644 +--- a/fs/io_uring.c ++++ b/fs/io_uring.c +@@ -1883,48 +1883,43 @@ static void ctx_flush_and_put(struct io_ring_ctx *ctx) + percpu_ref_put(&ctx->refs); + } + +-static bool __tctx_task_work(struct io_uring_task *tctx) +-{ +- struct io_ring_ctx *ctx = NULL; +- struct io_wq_work_list list; +- struct io_wq_work_node *node; +- +- if (wq_list_empty(&tctx->task_list)) +- return false; +- +- spin_lock_irq(&tctx->task_lock); +- list = tctx->task_list; +- INIT_WQ_LIST(&tctx->task_list); +- spin_unlock_irq(&tctx->task_lock); +- +- node = list.first; +- while (node) { +- struct io_wq_work_node *next = node->next; +- struct io_kiocb *req; +- +- req = container_of(node, struct io_kiocb, io_task_work.node); +- if (req->ctx != ctx) { +- ctx_flush_and_put(ctx); +- ctx = req->ctx; +- percpu_ref_get(&ctx->refs); +- } +- +- req->task_work.func(&req->task_work); +- node = next; +- } +- +- ctx_flush_and_put(ctx); +- return list.first != NULL; +-} +- + static void tctx_task_work(struct callback_head *cb) + { +- struct io_uring_task *tctx = container_of(cb, struct io_uring_task, task_work); ++ struct io_uring_task *tctx = container_of(cb, struct io_uring_task, ++ task_work); + + clear_bit(0, &tctx->task_state); + +- while (__tctx_task_work(tctx)) ++ while (!wq_list_empty(&tctx->task_list)) { ++ struct io_ring_ctx *ctx = NULL; ++ struct io_wq_work_list list; ++ struct io_wq_work_node *node; ++ ++ spin_lock_irq(&tctx->task_lock); ++ list = tctx->task_list; ++ INIT_WQ_LIST(&tctx->task_list); ++ spin_unlock_irq(&tctx->task_lock); ++ ++ node = list.first; ++ while (node) { ++ struct io_wq_work_node *next = node->next; ++ struct io_kiocb *req = container_of(node, struct io_kiocb, ++ io_task_work.node); ++ ++ if (req->ctx != ctx) { ++ ctx_flush_and_put(ctx); ++ ctx = req->ctx; ++ percpu_ref_get(&ctx->refs); ++ } ++ req->task_work.func(&req->task_work); ++ node = next; ++ } ++ ++ ctx_flush_and_put(ctx); ++ if (!list.first) ++ break; + cond_resched(); ++ } + } + + static int io_req_task_work_add(struct io_kiocb *req) +-- +2.30.2 + diff --git a/queue-5.13/io_uring-move-creds-from-io-wq-work-to-io_kiocb.patch b/queue-5.13/io_uring-move-creds-from-io-wq-work-to-io_kiocb.patch new file mode 100644 index 00000000000..a70a407b8de --- /dev/null +++ b/queue-5.13/io_uring-move-creds-from-io-wq-work-to-io_kiocb.patch @@ -0,0 +1,107 @@ +From c685ed073e5195d643491f90d5e6bd8d253197f6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 17 Jun 2021 18:14:01 +0100 +Subject: io_uring: move creds from io-wq work to io_kiocb + +From: Pavel Begunkov + +[ Upstream commit c10d1f986b4e2a906862148c77a97f186cc08b9e ] + +io-wq now doesn't have anything to do with creds now, so move ->creds +from struct io_wq_work into request (aka struct io_kiocb). + +Signed-off-by: Pavel Begunkov +Link: https://lore.kernel.org/r/8520c72ab8b8f4b96db12a228a2ab4c094ae64e1.1623949695.git.asml.silence@gmail.com +Signed-off-by: Jens Axboe +Signed-off-by: Sasha Levin +--- + fs/io-wq.h | 1 - + fs/io_uring.c | 24 +++++++++++++----------- + 2 files changed, 13 insertions(+), 12 deletions(-) + +diff --git a/fs/io-wq.h b/fs/io-wq.h +index af2df0680ee2..32c7b4e82484 100644 +--- a/fs/io-wq.h ++++ b/fs/io-wq.h +@@ -87,7 +87,6 @@ static inline void wq_list_del(struct io_wq_work_list *list, + + struct io_wq_work { + struct io_wq_work_node list; +- const struct cred *creds; + unsigned flags; + }; + +diff --git a/fs/io_uring.c b/fs/io_uring.c +index bf3566ff9516..ab1dcf69217f 100644 +--- a/fs/io_uring.c ++++ b/fs/io_uring.c +@@ -849,6 +849,8 @@ struct io_kiocb { + struct hlist_node hash_node; + struct async_poll *apoll; + struct io_wq_work work; ++ const struct cred *creds; ++ + /* store used ubuf, so we can prevent reloading */ + struct io_mapped_ubuf *imu; + }; +@@ -1227,8 +1229,8 @@ static void io_prep_async_work(struct io_kiocb *req) + const struct io_op_def *def = &io_op_defs[req->opcode]; + struct io_ring_ctx *ctx = req->ctx; + +- if (!req->work.creds) +- req->work.creds = get_current_cred(); ++ if (!req->creds) ++ req->creds = get_current_cred(); + + req->work.list.next = NULL; + req->work.flags = 0; +@@ -1742,9 +1744,9 @@ static void io_dismantle_req(struct io_kiocb *req) + percpu_ref_put(req->fixed_rsrc_refs); + if (req->async_data) + kfree(req->async_data); +- if (req->work.creds) { +- put_cred(req->work.creds); +- req->work.creds = NULL; ++ if (req->creds) { ++ put_cred(req->creds); ++ req->creds = NULL; + } + } + +@@ -6110,8 +6112,8 @@ static int io_issue_sqe(struct io_kiocb *req, unsigned int issue_flags) + const struct cred *creds = NULL; + int ret; + +- if (req->work.creds && req->work.creds != current_cred()) +- creds = override_creds(req->work.creds); ++ if (req->creds && req->creds != current_cred()) ++ creds = override_creds(req->creds); + + switch (req->opcode) { + case IORING_OP_NOP: +@@ -6518,7 +6520,7 @@ static int io_init_req(struct io_ring_ctx *ctx, struct io_kiocb *req, + atomic_set(&req->refs, 2); + req->task = current; + req->result = 0; +- req->work.creds = NULL; ++ req->creds = NULL; + + /* enforce forwards compatibility on users */ + if (unlikely(sqe_flags & ~SQE_VALID_FLAGS)) +@@ -6534,10 +6536,10 @@ static int io_init_req(struct io_ring_ctx *ctx, struct io_kiocb *req, + + personality = READ_ONCE(sqe->personality); + if (personality) { +- req->work.creds = xa_load(&ctx->personalities, personality); +- if (!req->work.creds) ++ req->creds = xa_load(&ctx->personalities, personality); ++ if (!req->creds) + return -EINVAL; +- get_cred(req->work.creds); ++ get_cred(req->creds); + } + state = &ctx->submit_state; + +-- +2.30.2 + diff --git a/queue-5.13/io_uring-remove-not-needed-pf_exiting-check.patch b/queue-5.13/io_uring-remove-not-needed-pf_exiting-check.patch new file mode 100644 index 00000000000..c34d7f031f0 --- /dev/null +++ b/queue-5.13/io_uring-remove-not-needed-pf_exiting-check.patch @@ -0,0 +1,51 @@ +From c3fbeb9cb29c453909878f9f3340695cd88be49c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 26 Jun 2021 21:40:46 +0100 +Subject: io_uring: remove not needed PF_EXITING check + +From: Pavel Begunkov + +[ Upstream commit e5dc480d4ed9884274e95c757fa2d2e9cc1047ee ] + +Since cancellation got moved before exit_signals(), there is no one left +who can call io_run_task_work() with PF_EXIING set, so remove the check. +Note that __io_req_task_submit() still needs a similar check. + +Signed-off-by: Pavel Begunkov +Link: https://lore.kernel.org/r/f7f305ececb1e6044ea649fb983ca754805bb884.1624739600.git.asml.silence@gmail.com +Signed-off-by: Jens Axboe +Signed-off-by: Sasha Levin +--- + fs/io_uring.c | 9 ++------- + 1 file changed, 2 insertions(+), 7 deletions(-) + +diff --git a/fs/io_uring.c b/fs/io_uring.c +index 262e6748c88a..eeea6b8c8bee 100644 +--- a/fs/io_uring.c ++++ b/fs/io_uring.c +@@ -2227,12 +2227,6 @@ static inline unsigned int io_put_rw_kbuf(struct io_kiocb *req) + + static inline bool io_run_task_work(void) + { +- /* +- * Not safe to run on exiting task, and the task_work handling will +- * not add work to such a task. +- */ +- if (unlikely(current->flags & PF_EXITING)) +- return false; + if (current->task_works) { + __set_current_state(TASK_RUNNING); + task_work_run(); +@@ -8958,7 +8952,8 @@ static void io_uring_try_cancel_requests(struct io_ring_ctx *ctx, + ret |= io_cancel_defer_files(ctx, task, cancel_all); + ret |= io_poll_remove_all(ctx, task, cancel_all); + ret |= io_kill_timeouts(ctx, task, cancel_all); +- ret |= io_run_task_work(); ++ if (task) ++ ret |= io_run_task_work(); + ret |= io_run_ctx_fallback(ctx); + if (!ret) + break; +-- +2.30.2 + diff --git a/queue-5.13/io_uring-shuffle-rarely-used-ctx-fields.patch b/queue-5.13/io_uring-shuffle-rarely-used-ctx-fields.patch new file mode 100644 index 00000000000..abcb36b6eff --- /dev/null +++ b/queue-5.13/io_uring-shuffle-rarely-used-ctx-fields.patch @@ -0,0 +1,93 @@ +From 1cd72416a890a217bffe5aea9b719f6812f26256 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 16 May 2021 22:58:06 +0100 +Subject: io_uring: shuffle rarely used ctx fields + +From: Pavel Begunkov + +[ Upstream commit b986af7e2df4f0871367c397ba61a542f37c0ab3 ] + +There is a bunch of scattered around ctx fields that are almost never +used, e.g. only on ring exit, plunge them to the end, better locality, +better aesthetically. + +Signed-off-by: Pavel Begunkov +Link: https://lore.kernel.org/r/782ff94b00355923eae757d58b1a47821b5b46d4.1621201931.git.asml.silence@gmail.com +Signed-off-by: Jens Axboe +Signed-off-by: Sasha Levin +--- + fs/io_uring.c | 36 +++++++++++++++++------------------- + 1 file changed, 17 insertions(+), 19 deletions(-) + +diff --git a/fs/io_uring.c b/fs/io_uring.c +index 2bf2aacb4c81..5d685c92b8fd 100644 +--- a/fs/io_uring.c ++++ b/fs/io_uring.c +@@ -369,9 +369,6 @@ struct io_ring_ctx { + unsigned cached_cq_overflow; + unsigned long sq_check_overflow; + +- /* hashed buffered write serialization */ +- struct io_wq_hash *hash_map; +- + struct list_head defer_list; + struct list_head timeout_list; + struct list_head cq_overflow_list; +@@ -388,9 +385,6 @@ struct io_ring_ctx { + + struct io_rings *rings; + +- /* Only used for accounting purposes */ +- struct mm_struct *mm_account; +- + const struct cred *sq_creds; /* cred used for __io_sq_thread() */ + struct io_sq_data *sq_data; /* if using sq thread polling */ + +@@ -411,14 +405,6 @@ struct io_ring_ctx { + unsigned nr_user_bufs; + struct io_mapped_ubuf **user_bufs; + +- struct user_struct *user; +- +- struct completion ref_comp; +- +-#if defined(CONFIG_UNIX) +- struct socket *ring_sock; +-#endif +- + struct xarray io_buffers; + + struct xarray personalities; +@@ -462,12 +448,24 @@ struct io_ring_ctx { + + struct io_restriction restrictions; + +- /* exit task_work */ +- struct callback_head *exit_task_work; +- + /* Keep this last, we don't need it for the fast path */ +- struct work_struct exit_work; +- struct list_head tctx_list; ++ struct { ++ #if defined(CONFIG_UNIX) ++ struct socket *ring_sock; ++ #endif ++ /* hashed buffered write serialization */ ++ struct io_wq_hash *hash_map; ++ ++ /* Only used for accounting purposes */ ++ struct user_struct *user; ++ struct mm_struct *mm_account; ++ ++ /* ctx exit and cancelation */ ++ struct callback_head *exit_task_work; ++ struct work_struct exit_work; ++ struct list_head tctx_list; ++ struct completion ref_comp; ++ }; + }; + + struct io_uring_task { +-- +2.30.2 + diff --git a/queue-5.13/iommu-arm-smmu-fix-arm_smmu_device-refcount-leak-in-.patch b/queue-5.13/iommu-arm-smmu-fix-arm_smmu_device-refcount-leak-in-.patch new file mode 100644 index 00000000000..8e072e9a557 --- /dev/null +++ b/queue-5.13/iommu-arm-smmu-fix-arm_smmu_device-refcount-leak-in-.patch @@ -0,0 +1,68 @@ +From 57f80c7576760c73fd275f95894c5e75588ad3ae Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 10 Jun 2021 10:49:20 +0800 +Subject: iommu/arm-smmu: Fix arm_smmu_device refcount leak in address + translation + +From: Xiyu Yang + +[ Upstream commit 7c8f176d6a3fa18aa0f8875da6f7c672ed2a8554 ] + +The reference counting issue happens in several exception handling paths +of arm_smmu_iova_to_phys_hard(). When those error scenarios occur, the +function forgets to decrease the refcount of "smmu" increased by +arm_smmu_rpm_get(), causing a refcount leak. + +Fix this issue by jumping to "out" label when those error scenarios +occur. + +Signed-off-by: Xiyu Yang +Signed-off-by: Xin Tan +Reviewed-by: Rob Clark +Link: https://lore.kernel.org/r/1623293391-17261-1-git-send-email-xiyuyang19@fudan.edu.cn +Signed-off-by: Will Deacon +Signed-off-by: Sasha Levin +--- + drivers/iommu/arm/arm-smmu/arm-smmu.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c +index ee6cac9e7c02..1a647e0ea3eb 100644 +--- a/drivers/iommu/arm/arm-smmu/arm-smmu.c ++++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c +@@ -1271,6 +1271,7 @@ static phys_addr_t arm_smmu_iova_to_phys_hard(struct iommu_domain *domain, + u64 phys; + unsigned long va, flags; + int ret, idx = cfg->cbndx; ++ phys_addr_t addr = 0; + + ret = arm_smmu_rpm_get(smmu); + if (ret < 0) +@@ -1290,6 +1291,7 @@ static phys_addr_t arm_smmu_iova_to_phys_hard(struct iommu_domain *domain, + dev_err(dev, + "iova to phys timed out on %pad. Falling back to software table walk.\n", + &iova); ++ arm_smmu_rpm_put(smmu); + return ops->iova_to_phys(ops, iova); + } + +@@ -1298,12 +1300,14 @@ static phys_addr_t arm_smmu_iova_to_phys_hard(struct iommu_domain *domain, + if (phys & ARM_SMMU_CB_PAR_F) { + dev_err(dev, "translation fault!\n"); + dev_err(dev, "PAR = 0x%llx\n", phys); +- return 0; ++ goto out; + } + ++ addr = (phys & GENMASK_ULL(39, 12)) | (iova & 0xfff); ++out: + arm_smmu_rpm_put(smmu); + +- return (phys & GENMASK_ULL(39, 12)) | (iova & 0xfff); ++ return addr; + } + + static phys_addr_t arm_smmu_iova_to_phys(struct iommu_domain *domain, +-- +2.30.2 + diff --git a/queue-5.13/iommu-arm-smmu-fix-arm_smmu_device-refcount-leak-whe.patch b/queue-5.13/iommu-arm-smmu-fix-arm_smmu_device-refcount-leak-whe.patch new file mode 100644 index 00000000000..b83db60e5e6 --- /dev/null +++ b/queue-5.13/iommu-arm-smmu-fix-arm_smmu_device-refcount-leak-whe.patch @@ -0,0 +1,47 @@ +From 934ff21f5b4415e4d162435a20b4fa6908181315 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 10 Jun 2021 10:54:29 +0800 +Subject: iommu/arm-smmu: Fix arm_smmu_device refcount leak when + arm_smmu_rpm_get fails + +From: Xiyu Yang + +[ Upstream commit 1adf30f198c26539a62d761e45af72cde570413d ] + +arm_smmu_rpm_get() invokes pm_runtime_get_sync(), which increases the +refcount of the "smmu" even though the return value is less than 0. + +The reference counting issue happens in some error handling paths of +arm_smmu_rpm_get() in its caller functions. When arm_smmu_rpm_get() +fails, the caller functions forget to decrease the refcount of "smmu" +increased by arm_smmu_rpm_get(), causing a refcount leak. + +Fix this issue by calling pm_runtime_resume_and_get() instead of +pm_runtime_get_sync() in arm_smmu_rpm_get(), which can keep the refcount +balanced in case of failure. + +Signed-off-by: Xiyu Yang +Signed-off-by: Xin Tan +Link: https://lore.kernel.org/r/1623293672-17954-1-git-send-email-xiyuyang19@fudan.edu.cn +Signed-off-by: Will Deacon +Signed-off-by: Sasha Levin +--- + drivers/iommu/arm/arm-smmu/arm-smmu.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c +index 6f72c4d208ca..ee6cac9e7c02 100644 +--- a/drivers/iommu/arm/arm-smmu/arm-smmu.c ++++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c +@@ -74,7 +74,7 @@ static bool using_legacy_binding, using_generic_binding; + static inline int arm_smmu_rpm_get(struct arm_smmu_device *smmu) + { + if (pm_runtime_enabled(smmu->dev)) +- return pm_runtime_get_sync(smmu->dev); ++ return pm_runtime_resume_and_get(smmu->dev); + + return 0; + } +-- +2.30.2 + diff --git a/queue-5.13/iommu-arm-smmu-qcom-skip-the-ttbr1-quirk-for-db820c.patch b/queue-5.13/iommu-arm-smmu-qcom-skip-the-ttbr1-quirk-for-db820c.patch new file mode 100644 index 00000000000..dfe0851a24c --- /dev/null +++ b/queue-5.13/iommu-arm-smmu-qcom-skip-the-ttbr1-quirk-for-db820c.patch @@ -0,0 +1,57 @@ +From d85b52a322708c43f78f33a3f2a3f0d6b6c41ff2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 26 Mar 2021 16:13:02 -0700 +Subject: iommu/arm-smmu-qcom: Skip the TTBR1 quirk for db820c. + +From: Eric Anholt + +[ Upstream commit a242f4297cfe3f4589a7620dcd42cc503607fc6b ] + +db820c wants to use the qcom smmu path to get HUPCF set (which keeps +the GPU from wedging and then sometimes wedging the kernel after a +page fault), but it doesn't have separate pagetables support yet in +drm/msm so we can't go all the way to the TTBR1 path. + +Signed-off-by: Eric Anholt +Reviewed-by: Bjorn Andersson +Link: https://lore.kernel.org/r/20210326231303.3071950-1-eric@anholt.net +Signed-off-by: Will Deacon +Signed-off-by: Sasha Levin +--- + drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 13 ++++++++++++- + 1 file changed, 12 insertions(+), 1 deletion(-) + +diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c +index 98b3a1c2a181..44a427833385 100644 +--- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c ++++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c +@@ -130,6 +130,16 @@ static int qcom_adreno_smmu_alloc_context_bank(struct arm_smmu_domain *smmu_doma + return __arm_smmu_alloc_bitmap(smmu->context_map, start, count); + } + ++static bool qcom_adreno_can_do_ttbr1(struct arm_smmu_device *smmu) ++{ ++ const struct device_node *np = smmu->dev->of_node; ++ ++ if (of_device_is_compatible(np, "qcom,msm8996-smmu-v2")) ++ return false; ++ ++ return true; ++} ++ + static int qcom_adreno_smmu_init_context(struct arm_smmu_domain *smmu_domain, + struct io_pgtable_cfg *pgtbl_cfg, struct device *dev) + { +@@ -144,7 +154,8 @@ static int qcom_adreno_smmu_init_context(struct arm_smmu_domain *smmu_domain, + * be AARCH64 stage 1 but double check because the arm-smmu code assumes + * that is the case when the TTBR1 quirk is enabled + */ +- if ((smmu_domain->stage == ARM_SMMU_DOMAIN_S1) && ++ if (qcom_adreno_can_do_ttbr1(smmu_domain->smmu) && ++ (smmu_domain->stage == ARM_SMMU_DOMAIN_S1) && + (smmu_domain->cfg.fmt == ARM_SMMU_CTX_FMT_AARCH64)) + pgtbl_cfg->quirks |= IO_PGTABLE_QUIRK_ARM_TTBR1; + +-- +2.30.2 + diff --git a/queue-5.13/iov_iter_advance-use-consistent-semantics-for-move-p.patch b/queue-5.13/iov_iter_advance-use-consistent-semantics-for-move-p.patch new file mode 100644 index 00000000000..a3cb85021ad --- /dev/null +++ b/queue-5.13/iov_iter_advance-use-consistent-semantics-for-move-p.patch @@ -0,0 +1,52 @@ +From 1f09ac2f6cb9652d2c7d249939a416b71277e317 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 23 Apr 2021 22:24:08 -0400 +Subject: iov_iter_advance(): use consistent semantics for move past the end + +From: Al Viro + +[ Upstream commit 3b3fc051cd2cba42bf736fa62780857d251a1236 ] + +asking to advance by more than we have left in the iov_iter should +move to the very end; it should *not* leave negative i->count and +it should not spew into syslog, etc. - it's a legitimate operation. + +Signed-off-by: Al Viro +Signed-off-by: Sasha Levin +--- + lib/iov_iter.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/lib/iov_iter.c b/lib/iov_iter.c +index 9eb7c31688cc..459c33c26bea 100644 +--- a/lib/iov_iter.c ++++ b/lib/iov_iter.c +@@ -1117,8 +1117,6 @@ static inline void pipe_truncate(struct iov_iter *i) + static void pipe_advance(struct iov_iter *i, size_t size) + { + struct pipe_inode_info *pipe = i->pipe; +- if (unlikely(i->count < size)) +- size = i->count; + if (size) { + struct pipe_buffer *buf; + unsigned int p_mask = pipe->ring_size - 1; +@@ -1159,6 +1157,8 @@ static void iov_iter_bvec_advance(struct iov_iter *i, size_t size) + + void iov_iter_advance(struct iov_iter *i, size_t size) + { ++ if (unlikely(i->count < size)) ++ size = i->count; + if (unlikely(iov_iter_is_pipe(i))) { + pipe_advance(i, size); + return; +@@ -1168,7 +1168,6 @@ void iov_iter_advance(struct iov_iter *i, size_t size) + return; + } + if (unlikely(iov_iter_is_xarray(i))) { +- size = min(size, i->count); + i->iov_offset += size; + i->count -= size; + return; +-- +2.30.2 + diff --git a/queue-5.13/jump_label-fix-jump_label_text_reserved-vs-__init.patch b/queue-5.13/jump_label-fix-jump_label_text_reserved-vs-__init.patch new file mode 100644 index 00000000000..663cf3b2f10 --- /dev/null +++ b/queue-5.13/jump_label-fix-jump_label_text_reserved-vs-__init.patch @@ -0,0 +1,77 @@ +From ee53f29244e95991da639de4fdc124a2a48ea0dc Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 28 Jun 2021 13:24:10 +0200 +Subject: jump_label: Fix jump_label_text_reserved() vs __init + +From: Peter Zijlstra + +[ Upstream commit 9e667624c291753b8a5128f620f493d0b5226063 ] + +It turns out that jump_label_text_reserved() was reporting __init text +as being reserved past the time when the __init text was freed and +re-used. + +For a long time, this resulted in, at worst, not being able to kprobe +text that happened to land at the re-used address. However a recent +commit e7bf1ba97afd ("jump_label, x86: Emit short JMP") made it a +fatal mistake because it now needs to read the instruction in order to +determine the conflict -- an instruction that's no longer there. + +Fixes: 4c3ef6d79328 ("jump label: Add jump_label_text_reserved() to reserve jump points") +Reported-by: kernel test robot +Signed-off-by: Peter Zijlstra (Intel) +Signed-off-by: Ingo Molnar +Reviewed-by: Masami Hiramatsu +Link: https://lore.kernel.org/r/20210628113045.045141693@infradead.org +Signed-off-by: Sasha Levin +--- + kernel/jump_label.c | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +diff --git a/kernel/jump_label.c b/kernel/jump_label.c +index ba39fbb1f8e7..af520ca26360 100644 +--- a/kernel/jump_label.c ++++ b/kernel/jump_label.c +@@ -316,14 +316,16 @@ static int addr_conflict(struct jump_entry *entry, void *start, void *end) + } + + static int __jump_label_text_reserved(struct jump_entry *iter_start, +- struct jump_entry *iter_stop, void *start, void *end) ++ struct jump_entry *iter_stop, void *start, void *end, bool init) + { + struct jump_entry *iter; + + iter = iter_start; + while (iter < iter_stop) { +- if (addr_conflict(iter, start, end)) +- return 1; ++ if (init || !jump_entry_is_init(iter)) { ++ if (addr_conflict(iter, start, end)) ++ return 1; ++ } + iter++; + } + +@@ -561,7 +563,7 @@ static int __jump_label_mod_text_reserved(void *start, void *end) + + ret = __jump_label_text_reserved(mod->jump_entries, + mod->jump_entries + mod->num_jump_entries, +- start, end); ++ start, end, mod->state == MODULE_STATE_COMING); + + module_put(mod); + +@@ -786,8 +788,9 @@ early_initcall(jump_label_init_module); + */ + int jump_label_text_reserved(void *start, void *end) + { ++ bool init = system_state < SYSTEM_RUNNING; + int ret = __jump_label_text_reserved(__start___jump_table, +- __stop___jump_table, start, end); ++ __stop___jump_table, start, end, init); + + if (ret) + return ret; +-- +2.30.2 + diff --git a/queue-5.13/kbuild-remove-trailing-slashes-from-kbuild_extmod.patch b/queue-5.13/kbuild-remove-trailing-slashes-from-kbuild_extmod.patch new file mode 100644 index 00000000000..9241319db93 --- /dev/null +++ b/queue-5.13/kbuild-remove-trailing-slashes-from-kbuild_extmod.patch @@ -0,0 +1,64 @@ +From cbb4600303d10e74b981dfd478aee3f30068bc38 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 2 Jun 2021 23:02:13 +0900 +Subject: kbuild: remove trailing slashes from $(KBUILD_EXTMOD) + +From: Masahiro Yamada + +[ Upstream commit 74ee585b7eecd98be3650e677625a0ee588d08e0 ] + +M= (or KBUILD_EXTMOD) generally expects a directory path without any +trailing slashes, like M=a/b/c. + +If you add a trailing slash, like M=a/b/c/, you will get ugly build +logs (two slashes in a series), but it still works fine as long as it +is consistent between 'make modules' and 'make modules_install'. + +The following commands correctly build and install the modules. + + $ make M=a/b/c/ modules + $ sudo make M=a/b/c/ modules_install + +Since commit ccae4cfa7bfb ("kbuild: refactor scripts/Makefile.modinst"), +a problem happens if you add a trailing slash only for modules_install. + + $ make M=a/b/c modules + $ sudo make M=a/b/c/ modules_install + +No module is installed in this case, Johannes Berg reported. [1] + +Trim any trailing slashes from $(KBUILD_EXTMOD). + +I used the 'dirname' command to remove all the trailing slashes in +case someone adds more slashes like M=a/b/c/////. The Make's built-in +function, $(dir ...) cannot take care of such a case. + +[1]: https://lore.kernel.org/lkml/10cc8522b27a051e6a9c3e158a4c4b6414fd04a0.camel@sipsolutions.net/ + +Fixes: ccae4cfa7bfb ("kbuild: refactor scripts/Makefile.modinst") +Reported-by: Johannes Berg +Signed-off-by: Masahiro Yamada +Signed-off-by: Sasha Levin +--- + Makefile | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/Makefile b/Makefile +index 83f4212e004f..4258a60f6119 100644 +--- a/Makefile ++++ b/Makefile +@@ -129,6 +129,11 @@ endif + $(if $(word 2, $(KBUILD_EXTMOD)), \ + $(error building multiple external modules is not supported)) + ++# Remove trailing slashes ++ifneq ($(filter %/, $(KBUILD_EXTMOD)),) ++KBUILD_EXTMOD := $(shell dirname $(KBUILD_EXTMOD).) ++endif ++ + export KBUILD_EXTMOD + + # Kbuild will save output files in the current working directory. +-- +2.30.2 + diff --git a/queue-5.13/kcov-add-__no_sanitize_coverage-to-fix-noinstr-for-a.patch b/queue-5.13/kcov-add-__no_sanitize_coverage-to-fix-noinstr-for-a.patch new file mode 100644 index 00000000000..5a1b63ec65b --- /dev/null +++ b/queue-5.13/kcov-add-__no_sanitize_coverage-to-fix-noinstr-for-a.patch @@ -0,0 +1,131 @@ +From a6ab72f3a57d165c2315b3049158d9ded06a3eca Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 30 Jun 2021 18:56:49 -0700 +Subject: kcov: add __no_sanitize_coverage to fix noinstr for all architectures + +From: Marco Elver + +[ Upstream commit 540540d06e9d9b3769b46d88def90f7e7c002322 ] + +Until now no compiler supported an attribute to disable coverage +instrumentation as used by KCOV. + +To work around this limitation on x86, noinstr functions have their +coverage instrumentation turned into nops by objtool. However, this +solution doesn't scale automatically to other architectures, such as +arm64, which are migrating to use the generic entry code. + +Clang [1] and GCC [2] have added support for the attribute recently. +[1] https://github.com/llvm/llvm-project/commit/280333021e9550d80f5c1152a34e33e81df1e178 +[2] https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=cec4d4a6782c9bd8d071839c50a239c49caca689 +The changes will appear in Clang 13 and GCC 12. + +Add __no_sanitize_coverage for both compilers, and add it to noinstr. + +Note: In the Clang case, __has_feature(coverage_sanitizer) is only true if +the feature is enabled, and therefore we do not require an additional +defined(CONFIG_KCOV) (like in the GCC case where __has_attribute(..) is +always true) to avoid adding redundant attributes to functions if KCOV is +off. That being said, compilers that support the attribute will not +generate errors/warnings if the attribute is redundantly used; however, +where possible let's avoid it as it reduces preprocessed code size and +associated compile-time overheads. + +[elver@google.com: Implement __has_feature(coverage_sanitizer) in Clang] + Link: https://lkml.kernel.org/r/20210527162655.3246381-1-elver@google.com +[elver@google.com: add comment explaining __has_feature() in Clang] + Link: https://lkml.kernel.org/r/20210527194448.3470080-1-elver@google.com + +Link: https://lkml.kernel.org/r/20210525175819.699786-1-elver@google.com +Signed-off-by: Marco Elver +Acked-by: Peter Zijlstra (Intel) +Reviewed-by: Miguel Ojeda +Reviewed-by: Nathan Chancellor +Cc: Nick Desaulniers +Cc: Kees Cook +Cc: Will Deacon +Cc: Ard Biesheuvel +Cc: Luc Van Oostenryck +Cc: Arvind Sankar +Cc: Masahiro Yamada +Cc: Sami Tolvanen +Cc: Arnd Bergmann +Cc: Dmitry Vyukov +Cc: Mark Rutland +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +--- + include/linux/compiler-clang.h | 17 +++++++++++++++++ + include/linux/compiler-gcc.h | 6 ++++++ + include/linux/compiler_types.h | 2 +- + 3 files changed, 24 insertions(+), 1 deletion(-) + +diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h +index adbe76b203e2..49b0ac8b6fd3 100644 +--- a/include/linux/compiler-clang.h ++++ b/include/linux/compiler-clang.h +@@ -13,6 +13,12 @@ + /* all clang versions usable with the kernel support KASAN ABI version 5 */ + #define KASAN_ABI_VERSION 5 + ++/* ++ * Note: Checking __has_feature(*_sanitizer) is only true if the feature is ++ * enabled. Therefore it is not required to additionally check defined(CONFIG_*) ++ * to avoid adding redundant attributes in other configurations. ++ */ ++ + #if __has_feature(address_sanitizer) || __has_feature(hwaddress_sanitizer) + /* Emulate GCC's __SANITIZE_ADDRESS__ flag */ + #define __SANITIZE_ADDRESS__ +@@ -45,6 +51,17 @@ + #define __no_sanitize_undefined + #endif + ++/* ++ * Support for __has_feature(coverage_sanitizer) was added in Clang 13 together ++ * with no_sanitize("coverage"). Prior versions of Clang support coverage ++ * instrumentation, but cannot be queried for support by the preprocessor. ++ */ ++#if __has_feature(coverage_sanitizer) ++#define __no_sanitize_coverage __attribute__((no_sanitize("coverage"))) ++#else ++#define __no_sanitize_coverage ++#endif ++ + /* + * Not all versions of clang implement the type-generic versions + * of the builtin overflow checkers. Fortunately, clang implements +diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h +index 5d97ef738a57..cb9217fc60af 100644 +--- a/include/linux/compiler-gcc.h ++++ b/include/linux/compiler-gcc.h +@@ -122,6 +122,12 @@ + #define __no_sanitize_undefined + #endif + ++#if defined(CONFIG_KCOV) && __has_attribute(__no_sanitize_coverage__) ++#define __no_sanitize_coverage __attribute__((no_sanitize_coverage)) ++#else ++#define __no_sanitize_coverage ++#endif ++ + #if GCC_VERSION >= 50100 + #define COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW 1 + #endif +diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h +index d29bda7f6ebd..cc2bee7f0977 100644 +--- a/include/linux/compiler_types.h ++++ b/include/linux/compiler_types.h +@@ -210,7 +210,7 @@ struct ftrace_likely_data { + /* Section for code which can't be instrumented at all */ + #define noinstr \ + noinline notrace __attribute((__section__(".noinstr.text"))) \ +- __no_kcsan __no_sanitize_address ++ __no_kcsan __no_sanitize_address __no_sanitize_coverage + + #endif /* __KERNEL__ */ + +-- +2.30.2 + diff --git a/queue-5.13/kprobe-static_call-restore-missing-static_call_text_.patch b/queue-5.13/kprobe-static_call-restore-missing-static_call_text_.patch new file mode 100644 index 00000000000..f6f880c0128 --- /dev/null +++ b/queue-5.13/kprobe-static_call-restore-missing-static_call_text_.patch @@ -0,0 +1,48 @@ +From e9f0e7454b3511f775029b33ecec1cd2deb6fe18 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 28 Jun 2021 13:24:12 +0200 +Subject: kprobe/static_call: Restore missing static_call_text_reserved() + +From: Peter Zijlstra + +[ Upstream commit fa68bd09fc62240a383c0c601d3349c47db10c34 ] + +Restore two hunks from commit: + + 6333e8f73b83 ("static_call: Avoid kprobes on inline static_call()s") + +that went walkabout in a Git merge commit. + +Fixes: 76d4acf22b48 ("Merge tag 'perf-kprobes-2020-12-14' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip") +Signed-off-by: Peter Zijlstra (Intel) +Acked-by: Masami Hiramatsu +Link: https://lore.kernel.org/r/20210628113045.167127609@infradead.org +Signed-off-by: Ingo Molnar +Signed-off-by: Sasha Levin +--- + kernel/kprobes.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/kernel/kprobes.c b/kernel/kprobes.c +index 745f08fdd7a6..c6b4c66b8fa2 100644 +--- a/kernel/kprobes.c ++++ b/kernel/kprobes.c +@@ -35,6 +35,7 @@ + #include + #include + #include ++#include + #include + + #include +@@ -1569,6 +1570,7 @@ static int check_kprobe_address_safe(struct kprobe *p, + if (!kernel_text_address((unsigned long) p->addr) || + within_kprobe_blacklist((unsigned long) p->addr) || + jump_label_text_reserved(p->addr, p->addr) || ++ static_call_text_reserved(p->addr, p->addr) || + find_bug((unsigned long)p->addr)) { + ret = -EINVAL; + goto out; +-- +2.30.2 + diff --git a/queue-5.13/leds-tlc591xx-fix-return-value-check-in-tlc591xx_pro.patch b/queue-5.13/leds-tlc591xx-fix-return-value-check-in-tlc591xx_pro.patch new file mode 100644 index 00000000000..274b6b5ac43 --- /dev/null +++ b/queue-5.13/leds-tlc591xx-fix-return-value-check-in-tlc591xx_pro.patch @@ -0,0 +1,50 @@ +From 59c141025e6eed0088eee061d1f8608e0d6c9d58 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 6 Apr 2021 21:11:59 +0800 +Subject: leds: tlc591xx: fix return value check in tlc591xx_probe() + +From: Yang Yingliang + +[ Upstream commit ee522bcf026ec82ada793979c3a906274430595a ] + +After device_get_match_data(), tlc591xx is not checked, add +check for it and also check np after dev_of_node. + +Reported-by: Hulk Robot +Signed-off-by: Yang Yingliang +Signed-off-by: Pavel Machek +Signed-off-by: Sasha Levin +--- + drivers/leds/leds-tlc591xx.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/drivers/leds/leds-tlc591xx.c b/drivers/leds/leds-tlc591xx.c +index 5b9dfdf743ec..cb7bd1353f9f 100644 +--- a/drivers/leds/leds-tlc591xx.c ++++ b/drivers/leds/leds-tlc591xx.c +@@ -148,16 +148,20 @@ static int + tlc591xx_probe(struct i2c_client *client, + const struct i2c_device_id *id) + { +- struct device_node *np = dev_of_node(&client->dev), *child; ++ struct device_node *np, *child; + struct device *dev = &client->dev; + const struct tlc591xx *tlc591xx; + struct tlc591xx_priv *priv; + int err, count, reg; + +- tlc591xx = device_get_match_data(dev); ++ np = dev_of_node(dev); + if (!np) + return -ENODEV; + ++ tlc591xx = device_get_match_data(dev); ++ if (!tlc591xx) ++ return -ENODEV; ++ + count = of_get_available_child_count(np); + if (!count || count > tlc591xx->max_leds) + return -EINVAL; +-- +2.30.2 + diff --git a/queue-5.13/leds-turris-omnia-add-missing-module_device_table.patch b/queue-5.13/leds-turris-omnia-add-missing-module_device_table.patch new file mode 100644 index 00000000000..7b2760e5e55 --- /dev/null +++ b/queue-5.13/leds-turris-omnia-add-missing-module_device_table.patch @@ -0,0 +1,36 @@ +From ba56579e121832cb46302561e40a7d6ae70095b5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 12 May 2021 14:49:18 +0800 +Subject: leds: turris-omnia: add missing MODULE_DEVICE_TABLE + +From: Zou Wei + +[ Upstream commit 9d0150db97583cfbb6b44cbe02241a1a48f90210 ] + +This patch adds missing MODULE_DEVICE_TABLE definition which generates +correct modalias for automatic loading of this driver when it is built +as an external module. + +Reported-by: Hulk Robot +Signed-off-by: Zou Wei +Signed-off-by: Pavel Machek +Signed-off-by: Sasha Levin +--- + drivers/leds/leds-turris-omnia.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/leds/leds-turris-omnia.c b/drivers/leds/leds-turris-omnia.c +index 2f9a289ab245..1adfed1c0619 100644 +--- a/drivers/leds/leds-turris-omnia.c ++++ b/drivers/leds/leds-turris-omnia.c +@@ -274,6 +274,7 @@ static const struct i2c_device_id omnia_id[] = { + { "omnia", 0 }, + { } + }; ++MODULE_DEVICE_TABLE(i2c, omnia_id); + + static struct i2c_driver omnia_leds_driver = { + .probe = omnia_leds_probe, +-- +2.30.2 + diff --git a/queue-5.13/lib-decompress_unlz4.c-correctly-handle-zero-padding.patch b/queue-5.13/lib-decompress_unlz4.c-correctly-handle-zero-padding.patch new file mode 100644 index 00000000000..32d31d2a7c4 --- /dev/null +++ b/queue-5.13/lib-decompress_unlz4.c-correctly-handle-zero-padding.patch @@ -0,0 +1,99 @@ +From 87c040e1a93e2d15199468cbc50125fe7edd4534 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 30 Jun 2021 18:56:16 -0700 +Subject: lib/decompress_unlz4.c: correctly handle zero-padding around initrds. + +From: Dimitri John Ledkov + +[ Upstream commit 2c484419efc09e7234c667aa72698cb79ba8d8ed ] + +lz4 compatible decompressor is simple. The format is underspecified and +relies on EOF notification to determine when to stop. Initramfs buffer +format[1] explicitly states that it can have arbitrary number of zero +padding. Thus when operating without a fill function, be extra careful to +ensure that sizes less than 4, or apperantly empty chunksizes are treated +as EOF. + +To test this I have created two cpio initrds, first a normal one, +main.cpio. And second one with just a single /test-file with content +"second" second.cpio. Then i compressed both of them with gzip, and with +lz4 -l. Then I created a padding of 4 bytes (dd if=/dev/zero of=pad4 bs=1 +count=4). To create four testcase initrds: + + 1) main.cpio.gzip + extra.cpio.gzip = pad0.gzip + 2) main.cpio.lz4 + extra.cpio.lz4 = pad0.lz4 + 3) main.cpio.gzip + pad4 + extra.cpio.gzip = pad4.gzip + 4) main.cpio.lz4 + pad4 + extra.cpio.lz4 = pad4.lz4 + +The pad4 test-cases replicate the initrd load by grub, as it pads and +aligns every initrd it loads. + +All of the above boot, however /test-file was not accessible in the initrd +for the testcase #4, as decoding in lz4 decompressor failed. Also an +error message printed which usually is harmless. + +Whith a patched kernel, all of the above testcases now pass, and +/test-file is accessible. + +This fixes lz4 initrd decompress warning on every boot with grub. And +more importantly this fixes inability to load multiple lz4 compressed +initrds with grub. This patch has been shipping in Ubuntu kernels since +January 2021. + +[1] ./Documentation/driver-api/early-userspace/buffer-format.rst + +BugLink: https://bugs.launchpad.net/bugs/1835660 +Link: https://lore.kernel.org/lkml/20210114200256.196589-1-xnox@ubuntu.com/ # v0 +Link: https://lkml.kernel.org/r/20210513104831.432975-1-dimitri.ledkov@canonical.com +Signed-off-by: Dimitri John Ledkov +Cc: Kyungsik Lee +Cc: Yinghai Lu +Cc: Bongkyu Kim +Cc: Kees Cook +Cc: Sven Schmidt <4sschmid@informatik.uni-hamburg.de> +Cc: Rajat Asthana +Cc: Nick Terrell +Cc: Gao Xiang +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +--- + lib/decompress_unlz4.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/lib/decompress_unlz4.c b/lib/decompress_unlz4.c +index c0cfcfd486be..e6327391b6b6 100644 +--- a/lib/decompress_unlz4.c ++++ b/lib/decompress_unlz4.c +@@ -112,6 +112,9 @@ STATIC inline int INIT unlz4(u8 *input, long in_len, + error("data corrupted"); + goto exit_2; + } ++ } else if (size < 4) { ++ /* empty or end-of-file */ ++ goto exit_3; + } + + chunksize = get_unaligned_le32(inp); +@@ -125,6 +128,10 @@ STATIC inline int INIT unlz4(u8 *input, long in_len, + continue; + } + ++ if (!fill && chunksize == 0) { ++ /* empty or end-of-file */ ++ goto exit_3; ++ } + + if (posp) + *posp += 4; +@@ -184,6 +191,7 @@ STATIC inline int INIT unlz4(u8 *input, long in_len, + } + } + ++exit_3: + ret = 0; + exit_2: + if (!input) +-- +2.30.2 + diff --git a/queue-5.13/m68knommu-fix-missing-lcd-splash-screen-data-initial.patch b/queue-5.13/m68knommu-fix-missing-lcd-splash-screen-data-initial.patch new file mode 100644 index 00000000000..4abc4990b7f --- /dev/null +++ b/queue-5.13/m68knommu-fix-missing-lcd-splash-screen-data-initial.patch @@ -0,0 +1,861 @@ +From b669e757f8ac2e5abdd2b324be5e0a9438696442 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 27 Apr 2021 23:49:31 +1000 +Subject: m68knommu: fix missing LCD splash screen data initializer + +From: Greg Ungerer + +[ Upstream commit 3f605ee17f8e785ba6ff69bee8e584e377a3cf28 ] + +The kernel test robot reports that the "screen_bits" splash screen data +is missing for the dragen platform: + + arch/m68k/68000/dragen2.c:73:16: error: 'screen_bits' undeclared (first use in this function) + 73 | LSSA = (long) screen_bits; + | ^~~~~~~~~~~ + arch/m68k/68000/dragen2.c:73:16: note: each undeclared identifier is reported only once for each function it appears in + +Digging around a bit I found the screen_bits data structure was originally +in a screen.h file that was generated from a screen.xbm file. That was +removed in commit 0c0e6db80683 ("m68k: drop unused parts of 68VZ328 +Makefile"). + +Other splash screen initializers for 68000 targets are kept here as the +C data structures so lets do the same for this one. Add the missing +screen.h file and include it in the dragen specific startup code. + +Reported-by: kernel test robot +Signed-off-by: Greg Ungerer +Acked-by: Arnd Bergmann +Signed-off-by: Sasha Levin +--- + arch/m68k/68000/dragen2.c | 1 + + arch/m68k/68000/screen.h | 804 ++++++++++++++++++++++++++++++++++++++ + 2 files changed, 805 insertions(+) + create mode 100644 arch/m68k/68000/screen.h + +diff --git a/arch/m68k/68000/dragen2.c b/arch/m68k/68000/dragen2.c +index 584893c57c37..62f10a9e1ab7 100644 +--- a/arch/m68k/68000/dragen2.c ++++ b/arch/m68k/68000/dragen2.c +@@ -11,6 +11,7 @@ + #include + #include + #include ++#include "screen.h" + + /***************************************************************************/ + /* Init Drangon Engine hardware */ +diff --git a/arch/m68k/68000/screen.h b/arch/m68k/68000/screen.h +new file mode 100644 +index 000000000000..2089bdf02688 +--- /dev/null ++++ b/arch/m68k/68000/screen.h +@@ -0,0 +1,804 @@ ++/* Created with The GIMP */ ++#define screen_width 320 ++#define screen_height 240 ++static unsigned char screen_bits[] = { ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd3, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x56, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x0d, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29, 0x5a, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6b, 0x55, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x03, 0x95, 0x6a, 0x00, 0x00, 0x00, 0x03, 0xf8, 0x70, 0xe0, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, ++ 0x01, 0xf8, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x5b, 0x55, 0x00, 0x00, 0x00, 0x0f, ++ 0xfc, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x38, 0x03, 0xfc, 0x00, 0x7f, 0x80, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0xb5, 0x56, ++ 0x00, 0x00, 0x00, 0x1e, 0x0c, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x03, 0x0e, 0x00, 0x61, ++ 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0xd7, 0x55, 0x55, 0x00, 0x03, 0x8e, 0x1c, 0x00, 0x70, 0xe1, 0x9e, ++ 0x0e, 0x38, 0xe1, 0x80, 0x70, 0xc0, 0xf0, 0x73, 0x33, 0xc0, 0x78, 0x38, ++ 0x00, 0x0e, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x02, 0xa9, 0xaa, 0xad, 0x00, 0x03, 0x8e, 0x38, ++ 0x00, 0x70, 0xe1, 0xff, 0x0e, 0x38, 0xe3, 0x80, 0x71, 0xc3, 0xf8, 0x77, ++ 0x3f, 0xe1, 0xfc, 0x38, 0x00, 0x0e, 0x00, 0xef, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x2b, 0x55, 0x6a, ++ 0x00, 0x03, 0x8e, 0x38, 0x00, 0x70, 0xe1, 0xe7, 0x0e, 0x38, 0x73, 0x00, ++ 0x73, 0x83, 0x9c, 0x7f, 0x3c, 0xe1, 0xce, 0x38, 0x00, 0x1c, 0x00, 0xff, ++ 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x15, 0x56, 0xab, 0x55, 0x00, 0x03, 0x8e, 0x38, 0x00, 0x70, 0xe1, 0xc7, ++ 0x0e, 0x38, 0x76, 0x00, 0x77, 0x07, 0x1c, 0x78, 0x38, 0xe3, 0x8e, 0x38, ++ 0x00, 0x78, 0x00, 0xf3, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x69, 0x55, 0x5a, 0xb7, 0x00, 0x03, 0x8e, 0x38, ++ 0x00, 0x70, 0xe1, 0xc7, 0x0e, 0x38, 0x3c, 0x00, 0x7e, 0x07, 0xfc, 0x70, ++ 0x38, 0xe3, 0xfe, 0x38, 0x00, 0xf0, 0x00, 0xe1, 0xc0, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xa5, 0x9a, 0xab, 0x6d, ++ 0x00, 0x03, 0x8e, 0x3c, 0x00, 0x70, 0xe1, 0xc7, 0x0e, 0x38, 0x3e, 0x00, ++ 0x7f, 0x07, 0xfc, 0x70, 0x38, 0xe3, 0xfe, 0x38, 0x01, 0xc0, 0x00, 0xe1, ++ 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, ++ 0x4d, 0x75, 0xb6, 0xd5, 0x00, 0x03, 0x8e, 0x1c, 0x00, 0x70, 0xe1, 0xc7, ++ 0x0e, 0x38, 0x77, 0x00, 0x77, 0x87, 0x00, 0x70, 0x38, 0xe3, 0x80, 0x38, ++ 0x03, 0x80, 0x00, 0xe1, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x14, 0xaa, 0xca, 0xd5, 0x5b, 0x00, 0x03, 0x9e, 0x1f, ++ 0x0c, 0x70, 0xe1, 0xc7, 0x0e, 0x78, 0x67, 0x00, 0x73, 0xc7, 0x8c, 0x70, ++ 0x38, 0xe3, 0xc6, 0x38, 0x03, 0xfe, 0x38, 0x71, 0xc0, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0xb5, 0xbb, 0x5b, 0x6a, ++ 0x00, 0x03, 0xfe, 0x0f, 0xfc, 0x70, 0xe1, 0xc7, 0x0f, 0xf8, 0xe3, 0x80, ++ 0x71, 0xe3, 0xfc, 0x70, 0x38, 0xe1, 0xfe, 0x38, 0x03, 0xfe, 0x38, 0x7f, ++ 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa9, ++ 0x6b, 0x56, 0xd6, 0xad, 0x00, 0x01, 0xe6, 0x03, 0xf0, 0x70, 0xe1, 0xc7, ++ 0x07, 0x98, 0xc3, 0x80, 0x70, 0xe0, 0xf8, 0x70, 0x38, 0xe0, 0x7c, 0x38, ++ 0x03, 0xfe, 0x38, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x03, 0x55, 0x55, 0x6a, 0xba, 0xeb, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x56, 0xd5, 0xd5, 0xd5, 0xac, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x5a, ++ 0xb7, 0x3d, 0x57, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x75, 0x6d, 0xaa, 0xd3, 0xac, 0xaa, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x8b, 0x6a, 0xb6, 0xde, 0x6b, 0xb6, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xba, 0xad, ++ 0xeb, 0x32, 0xda, 0xad, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x1e, 0xaa, 0xb5, 0xad, 0x6e, 0x96, 0xaa, 0x00, 0x00, 0x00, 0x00, ++ 0x01, 0x86, 0x00, 0x00, 0x07, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0xfc, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0xc3, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x6b, 0x6f, 0x5a, 0xb5, 0x75, 0x69, ++ 0x00, 0x00, 0x00, 0x00, 0x01, 0x86, 0x00, 0x00, 0x06, 0x18, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf5, 0xda, 0xd9, ++ 0x53, 0xeb, 0x6b, 0x4b, 0x00, 0x00, 0xf0, 0xde, 0x03, 0xe6, 0xf0, 0x78, ++ 0x06, 0x0c, 0x6c, 0x7c, 0x1f, 0x87, 0x86, 0xf0, 0xc0, 0xde, 0x0f, 0xcc, ++ 0xde, 0x0f, 0x00, 0xc3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x03, 0xd6, 0xab, 0x57, 0x6e, 0x8a, 0xd6, 0xba, 0x00, 0x01, 0x98, 0xe7, ++ 0x01, 0x87, 0x38, 0xcc, 0x06, 0x0c, 0x6c, 0x06, 0x31, 0x8c, 0xc7, 0x38, ++ 0xc0, 0xe7, 0x18, 0xcc, 0xe7, 0x19, 0x80, 0xc3, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x0e, 0x2d, 0x5e, 0xda, 0x55, 0xbb, 0x59, 0x42, ++ 0x00, 0x03, 0x0c, 0xc3, 0x01, 0x86, 0x19, 0x8c, 0x06, 0x0c, 0x70, 0x06, ++ 0x61, 0x98, 0x66, 0x18, 0xf8, 0xc3, 0x30, 0xcc, 0xc3, 0x31, 0x80, 0xc3, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0xf7, 0x6b, 0x6a, ++ 0xab, 0x56, 0xd6, 0xbf, 0x00, 0x03, 0x0c, 0xc3, 0x01, 0x86, 0x19, 0xfc, ++ 0x06, 0x0c, 0x60, 0x7e, 0x61, 0x98, 0x66, 0x18, 0xc0, 0xc3, 0x30, 0xcc, ++ 0xc3, 0x3f, 0x80, 0xc3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x75, 0x94, 0xdb, 0x75, 0x6e, 0xda, 0xaa, 0xa2, 0x00, 0x03, 0x0c, 0xc3, ++ 0x01, 0x86, 0x19, 0x80, 0x06, 0x0c, 0x60, 0xc6, 0x61, 0x98, 0x66, 0x18, ++ 0xc0, 0xc3, 0x30, 0xcc, 0xc3, 0x30, 0x00, 0xc3, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x01, 0xdb, 0x6b, 0xad, 0x9b, 0x27, 0x55, 0x55, 0x55, ++ 0x00, 0x03, 0x0c, 0xc3, 0x01, 0x86, 0x19, 0x80, 0x06, 0x0c, 0x60, 0xc6, ++ 0x33, 0x98, 0x66, 0x18, 0xc0, 0xc3, 0x19, 0xcc, 0xc3, 0x30, 0x00, 0xc3, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x36, 0xde, 0xb5, 0x65, ++ 0x75, 0x5a, 0xd5, 0x56, 0x00, 0x01, 0x98, 0xc3, 0x01, 0x86, 0x18, 0xc4, ++ 0x06, 0x18, 0x60, 0xce, 0x1d, 0x8c, 0xc6, 0x18, 0xc0, 0xc3, 0x0e, 0xcc, ++ 0xc3, 0x18, 0x80, 0xc3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, ++ 0xed, 0xb5, 0x6d, 0x56, 0x55, 0x55, 0x55, 0xae, 0x00, 0x00, 0xf0, 0xc3, ++ 0x00, 0xe6, 0x18, 0x78, 0x07, 0xf0, 0x60, 0x77, 0x01, 0x87, 0x86, 0x18, ++ 0xfc, 0xc3, 0x00, 0xcc, 0xc3, 0x0f, 0x00, 0xc3, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x7a, 0xab, 0x6d, 0xda, 0xaa, 0xca, 0xd5, 0x6d, 0x58, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0x80, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0xda, 0xaa, 0xea, 0xae, ++ 0x9b, 0x5a, 0xa9, 0x4b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xd5, ++ 0xbb, 0xfd, 0xad, 0xad, 0x69, 0xea, 0xcb, 0x55, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x05, 0xaf, 0xb6, 0x8a, 0x6a, 0xb9, 0x5a, 0x2d, 0xba, 0xb6, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1d, 0x7a, 0x75, 0x6e, 0xcd, 0x52, ++ 0x9b, 0xdb, 0x55, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5b, 0xad, ++ 0xaf, 0x95, 0x55, 0xed, 0x55, 0x55, 0x6b, 0x55, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0xea, 0xb5, 0xec, 0xfd, 0x59, 0x5a, 0xb5, 0x56, 0xaa, 0xb6, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xb7, 0x6b, 0x36, 0x4a, 0xeb, 0xab, ++ 0x2d, 0x6a, 0x9b, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xad, 0x6f, ++ 0x6b, 0xeb, 0xdd, 0x7b, 0x6a, 0x55, 0xb5, 0x56, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x17, 0x76, 0xda, 0xd6, 0x5d, 0x62, 0xc6, 0xd5, 0x36, 0xaa, 0xb5, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xdb, 0x56, 0xbc, 0xf2, 0xa5, 0x5d, ++ 0x96, 0xaa, 0xb6, 0xd6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xab, 0xee, 0xfd, ++ 0xd5, 0x2c, 0x6d, 0x9a, 0x75, 0x5b, 0x6a, 0xb5, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x03, 0xee, 0xad, 0x55, 0x15, 0xef, 0x54, 0xf6, 0xc5, 0x6a, 0xa9, 0xa6, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x05, 0x5b, 0xd6, 0xad, 0xbe, 0xb0, 0xa6, 0x35, ++ 0x5b, 0xd5, 0x4a, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0xeb, 0x5d, 0xf5, ++ 0xaa, 0xd7, 0xf4, 0x75, 0xba, 0x55, 0xaf, 0x6e, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x37, 0x5e, 0xf7, 0x55, 0x61, 0xbc, 0x08, 0x5b, 0x55, 0x5a, 0xa9, 0xb5, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x01, 0xf6, 0xba, 0xaa, 0xaa, 0x9f, 0x69, 0xec, 0xd5, ++ 0x4b, 0xa9, 0xaa, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x2d, 0xd5, 0xed, 0x5a, ++ 0xf2, 0xd6, 0xae, 0xdb, 0x9e, 0x27, 0x5f, 0xb5, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, ++ 0x6d, 0x5b, 0xaa, 0xda, 0xae, 0x95, 0x58, 0xd5, 0x34, 0x6d, 0x68, 0xad, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x15, 0xdb, 0xd7, 0x56, 0xb5, 0xd5, 0x6d, 0x29, 0x5b, ++ 0x4b, 0xdb, 0x57, 0xb6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0xda, 0xac, 0xd5, 0x4b, ++ 0x57, 0x6a, 0x9b, 0x76, 0x5c, 0x95, 0x54, 0x2a, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfa, ++ 0xb7, 0xfb, 0xab, 0xb6, 0xea, 0xad, 0x62, 0x95, 0xa1, 0xf5, 0xa9, 0xad, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x03, 0x57, 0xaf, 0x6b, 0x72, 0x54, 0x99, 0xd5, 0x0e, 0xf3, ++ 0x5f, 0x15, 0x2a, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xea, 0xd4, 0xad, 0x5d, 0x35, ++ 0xb5, 0x34, 0xb2, 0xaa, 0x54, 0xba, 0xad, 0x55, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x5e, ++ 0xaf, 0xed, 0xab, 0xea, 0xb3, 0xaa, 0x6a, 0xad, 0xd5, 0xd5, 0xaa, 0xab, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x2a, 0xb9, 0xf5, 0xbb, 0xb5, 0x55, 0x64, 0x57, 0x55, 0x6b, ++ 0x5d, 0xd0, 0x52, 0xac, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xab, 0x5b, 0xb6, 0x6d, 0x37, ++ 0x6f, 0xaa, 0x5b, 0xa2, 0xb5, 0x1f, 0xed, 0x73, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x65, 0xaa, ++ 0x6e, 0xfb, 0xd3, 0x5a, 0xd4, 0x54, 0xaa, 0x5e, 0xc3, 0xb5, 0x15, 0x56, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x07, 0xaf, 0x7f, 0xea, 0xb6, 0xaa, 0xd6, 0xad, 0xf1, 0xd2, 0xd5, ++ 0x56, 0x55, 0x6a, 0xd5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0xbd, 0xda, 0xaf, 0x75, 0x6f, 0x5a, ++ 0x45, 0x26, 0xb7, 0x5b, 0x20, 0xdd, 0x55, 0x2a, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0xeb, 0x7f, ++ 0xf5, 0x4d, 0x95, 0x76, 0xd9, 0x56, 0xb5, 0x52, 0x6d, 0x12, 0xad, 0xaa, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x57, 0x3f, 0xa4, 0x8f, 0xb9, 0x6e, 0xa2, 0x6f, 0x1d, 0x6a, 0xef, ++ 0xb5, 0x6d, 0xaa, 0xb5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x03, 0xfd, 0x75, 0x2f, 0x7c, 0x57, 0x88, 0xf6, ++ 0x80, 0xb5, 0x57, 0x5c, 0xd7, 0x55, 0x54, 0xae, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x39, 0xff, 0xf6, ++ 0xab, 0x7a, 0x57, 0x94, 0xef, 0x0d, 0xe4, 0xea, 0xa8, 0xaa, 0xab, 0xff, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x0c, 0xf7, 0xff, 0x6d, 0xb7, 0x4b, 0x39, 0x17, 0x2a, 0xfa, 0xb7, 0x56, ++ 0xb7, 0xaa, 0xed, 0xd9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x18, 0xbe, 0xfd, 0xda, 0x9e, 0xec, 0xe6, 0xd5, ++ 0x52, 0x2a, 0x58, 0xa9, 0x54, 0x5a, 0x97, 0xe7, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x72, 0xe9, 0xf6, 0xbe, ++ 0xd4, 0x5b, 0xad, 0x63, 0x61, 0xf7, 0xb7, 0xaf, 0x55, 0x52, 0x9f, 0xee, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, ++ 0xc9, 0xbd, 0xfb, 0x6b, 0xeb, 0xf5, 0x6b, 0x2d, 0x57, 0x52, 0x94, 0xaa, ++ 0xb1, 0xab, 0x4a, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x02, 0xdb, 0xcb, 0xff, 0xf5, 0x3b, 0x55, 0xa0, 0x00, ++ 0x45, 0x6e, 0xb5, 0xb5, 0x65, 0x52, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x2e, 0x7d, 0xdb, 0xa5, ++ 0xca, 0xbe, 0x80, 0x00, 0x0a, 0x54, 0xaa, 0xa5, 0x45, 0x08, 0x09, 0x15, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, ++ 0xd8, 0xd3, 0x1b, 0xae, 0xb7, 0xea, 0x00, 0x00, 0x00, 0x95, 0xaa, 0x56, ++ 0xdc, 0xe1, 0x21, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x53, 0x41, 0xff, 0x77, 0xbd, 0xaa, 0x58, 0x00, 0x00, ++ 0x00, 0xdb, 0x75, 0xd4, 0xb2, 0xa4, 0x07, 0xea, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xef, 0x07, 0xbd, 0x65, 0xeb, ++ 0xa2, 0xd0, 0x00, 0x00, 0x00, 0x25, 0x4b, 0x35, 0x56, 0x80, 0x77, 0x6a, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x28, ++ 0x01, 0x28, 0x9a, 0xb6, 0xd7, 0x60, 0x00, 0x00, 0x00, 0x0c, 0xaa, 0xaa, ++ 0xaa, 0x02, 0x07, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x17, 0xe0, 0x17, 0xb1, 0xbf, 0xee, 0xb4, 0xc0, 0x00, 0x00, ++ 0x00, 0x08, 0xaa, 0xad, 0x68, 0x54, 0x04, 0x5a, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x74, 0x87, 0x77, 0x72, 0x5a, ++ 0xab, 0x80, 0x00, 0x00, 0x00, 0x02, 0xd4, 0xb5, 0x52, 0x08, 0x5b, 0xd4, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x00, ++ 0x1f, 0xd6, 0xef, 0xda, 0xd5, 0x00, 0x00, 0x00, 0x0c, 0x01, 0x52, 0xd5, ++ 0x40, 0xf1, 0x55, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x9b, 0x00, 0x17, 0x4b, 0x92, 0xb7, 0xaf, 0x00, 0x00, 0x00, ++ 0x0e, 0x01, 0x4e, 0xaa, 0xae, 0x95, 0x55, 0x6d, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xb8, 0x11, 0x2b, 0x13, 0x76, 0xef, ++ 0x54, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x54, 0xaa, 0xaa, 0xb5, 0xad, 0x55, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x40, 0x00, ++ 0x7e, 0x7c, 0x65, 0xf4, 0x78, 0x00, 0x00, 0x00, 0x1f, 0x00, 0xab, 0x56, ++ 0xd5, 0x55, 0x59, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x0a, 0x40, 0x42, 0x6d, 0xce, 0xe5, 0xae, 0x54, 0x00, 0x00, 0x00, ++ 0x18, 0x00, 0x6d, 0x75, 0x5d, 0x55, 0x4d, 0x52, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x82, 0x03, 0xdc, 0x54, 0xbf, 0x61, ++ 0xa8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0xad, 0xa2, 0xb5, 0x60, 0xad, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x16, ++ 0xd9, 0xb5, 0xa4, 0xc7, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5a, 0xea, ++ 0xae, 0xd5, 0x57, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x54, 0x04, 0x0d, 0x76, 0xbb, 0x4b, 0xbc, 0x58, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x36, 0x95, 0xa9, 0x55, 0x54, 0xaa, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x01, 0x50, 0x08, 0x5b, 0xc5, 0x3d, 0x97, 0x0a, ++ 0xd0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0xb6, 0xab, 0x2b, 0x55, 0xab, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x24, 0x20, 0x3d, ++ 0x59, 0x7b, 0x76, 0x37, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1d, 0x6d, ++ 0x75, 0xb5, 0x55, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x12, 0xf0, 0x01, 0xff, 0x21, 0xa8, 0xc3, 0x74, 0xa8, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x1b, 0xa9, 0x4b, 0x55, 0x55, 0x2a, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x25, 0xc0, 0x41, 0xca, 0x9c, 0x77, 0x58, 0x9d, ++ 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x56, 0xb4, 0xad, 0xb2, 0x55, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4b, 0x80, 0x0f, 0xbe, ++ 0xc0, 0xf6, 0xd5, 0xb3, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x54, ++ 0xa5, 0xaa, 0x55, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x17, 0x04, 0x87, 0xbc, 0x6a, 0x3b, 0xac, 0x9d, 0x58, 0x00, 0x00, 0x03, ++ 0xe0, 0x00, 0x16, 0xab, 0x55, 0x4a, 0xd6, 0xa5, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x01, 0x5c, 0x00, 0x1f, 0x54, 0xc9, 0x2a, 0xb7, 0xa6, ++ 0xd8, 0x0f, 0x00, 0x07, 0xf8, 0x00, 0x15, 0x6a, 0x55, 0x5a, 0xa4, 0xaa, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7a, 0x08, 0x74, 0xca, ++ 0x9c, 0x5a, 0xa8, 0xc5, 0x30, 0x1f, 0x80, 0x0f, 0xfc, 0x00, 0x0d, 0x55, ++ 0xaa, 0xa5, 0x55, 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, ++ 0xf0, 0x20, 0xea, 0x5a, 0xb0, 0xe7, 0x95, 0x7d, 0x10, 0x3f, 0xc0, 0x1f, ++ 0xfe, 0x00, 0x0a, 0xaa, 0xaa, 0xad, 0x4a, 0x95, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x03, 0xf4, 0x02, 0x7d, 0xb5, 0x8f, 0x9c, 0xaa, 0xe9, ++ 0xa0, 0x3f, 0xc0, 0x1f, 0xfe, 0x00, 0x06, 0xb5, 0x54, 0xa9, 0x2a, 0x54, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x40, 0x47, 0xeb, 0xab, ++ 0x75, 0x51, 0x55, 0x4d, 0xd8, 0x3f, 0xe0, 0x3f, 0x3f, 0x00, 0x0a, 0xaa, ++ 0xa9, 0x4a, 0xaa, 0xad, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, ++ 0xc0, 0x06, 0xff, 0xe5, 0xb6, 0xbb, 0xa9, 0x34, 0x48, 0x30, 0xe0, 0x3c, ++ 0x0f, 0x00, 0x0a, 0xaa, 0x8a, 0xaa, 0xaa, 0xa4, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0xaf, 0x80, 0x9f, 0xa1, 0x8d, 0xb5, 0xd6, 0x93, 0xcd, ++ 0x90, 0x62, 0x60, 0x3c, 0x27, 0x00, 0x06, 0xaa, 0xb5, 0xaa, 0xaa, 0xa9, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9f, 0x92, 0x3f, 0xb5, 0x36, ++ 0x56, 0xb5, 0x9d, 0x55, 0x90, 0x62, 0x60, 0x38, 0x17, 0x80, 0x0d, 0x54, ++ 0xaa, 0x54, 0xaa, 0x9a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x7a, ++ 0x00, 0xba, 0xab, 0x73, 0xe7, 0xa2, 0xb6, 0x55, 0x2c, 0x61, 0x60, 0x38, ++ 0x17, 0x80, 0x09, 0x6b, 0x4a, 0xd5, 0x4a, 0x92, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x0d, 0xfe, 0x03, 0x6d, 0xea, 0x08, 0x51, 0x1d, 0x2b, 0x35, ++ 0x08, 0x61, 0x60, 0x38, 0x07, 0x80, 0x06, 0xda, 0xaa, 0xa9, 0x55, 0x55, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x27, 0xf8, 0x4e, 0xfb, 0x89, 0xde, ++ 0x35, 0xea, 0x6b, 0x72, 0x28, 0x60, 0x70, 0x38, 0x07, 0x80, 0x05, 0x52, ++ 0xaa, 0xaa, 0x95, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xf8, ++ 0x0d, 0x63, 0xbd, 0xe3, 0x57, 0x55, 0xb6, 0x49, 0xcc, 0x20, 0x7f, 0xf8, ++ 0x07, 0x80, 0x0a, 0xaa, 0xaa, 0xaa, 0xaa, 0xad, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x5d, 0xe1, 0x34, 0xc6, 0xab, 0xa7, 0x91, 0x77, 0x37, 0xcc, ++ 0x48, 0x30, 0x9f, 0x3c, 0x07, 0x80, 0x0a, 0xaa, 0xaa, 0xaa, 0xaa, 0x69, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x3b, 0xc0, 0x34, 0xdb, 0x4e, 0xf9, ++ 0xae, 0xd5, 0x54, 0xe1, 0xb4, 0x19, 0x3f, 0xfe, 0x0f, 0x00, 0x05, 0x55, ++ 0x55, 0x55, 0x52, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x7f, 0x89, ++ 0xf1, 0xf7, 0xe5, 0x57, 0xea, 0x8d, 0x4c, 0xda, 0xac, 0x13, 0xff, 0xff, ++ 0x80, 0x00, 0x0a, 0xd5, 0xaa, 0xa4, 0x95, 0x54, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0xf7, 0x02, 0x53, 0x6c, 0x72, 0x10, 0xa3, 0x6a, 0x74, 0xea, ++ 0x34, 0x07, 0xff, 0xff, 0xe0, 0x00, 0x05, 0x4e, 0x54, 0x95, 0x55, 0x55, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0xfc, 0x97, 0xd6, 0x55, 0xb6, 0xab, ++ 0xb7, 0x45, 0x46, 0xad, 0xf4, 0x1f, 0xff, 0xff, 0xfe, 0x00, 0x05, 0x2a, ++ 0xd5, 0x54, 0x95, 0x51, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xcf, 0x0e, ++ 0xfb, 0x2d, 0x12, 0xd4, 0xb8, 0xb6, 0xeb, 0x6a, 0x10, 0x3f, 0xff, 0xff, ++ 0xff, 0x00, 0x02, 0xda, 0x8a, 0xab, 0x6a, 0xaa, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x57, 0xbc, 0x3a, 0xc6, 0x0d, 0x76, 0xb1, 0x77, 0x15, 0x2a, 0x56, ++ 0x34, 0x7f, 0xff, 0xff, 0xff, 0x80, 0x02, 0xa5, 0x75, 0x2a, 0x52, 0xaa, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x02, 0x0f, 0xfc, 0xdf, 0x75, 0x9d, 0x5a, 0x67, ++ 0x15, 0x59, 0xb3, 0x6c, 0x4c, 0x7f, 0xff, 0xff, 0xff, 0x80, 0x05, 0x55, ++ 0x8a, 0xaa, 0xaa, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xf9, 0xdb, ++ 0xed, 0x36, 0x5a, 0xeb, 0xad, 0x6b, 0x57, 0x5d, 0xa4, 0x7f, 0xff, 0xff, ++ 0xf3, 0x80, 0x05, 0x54, 0xb2, 0xaa, 0xaa, 0xa9, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x7f, 0xf4, 0x5a, 0xaa, 0xdb, 0x40, 0x20, 0xea, 0xaa, 0xa8, 0x19, ++ 0xe8, 0x1f, 0xff, 0xff, 0xe7, 0x00, 0x02, 0x55, 0x4b, 0xd5, 0x55, 0x4a, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x05, 0xff, 0xf2, 0xb5, 0x7d, 0x56, 0xaa, 0x76, ++ 0xa5, 0xce, 0xb4, 0xd1, 0x2c, 0x0f, 0xff, 0xff, 0x0f, 0x00, 0x02, 0xa5, ++ 0x5a, 0x2a, 0x55, 0x59, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0xc1, 0x31, ++ 0x9a, 0x8d, 0x61, 0x2e, 0xb2, 0xb5, 0x57, 0x59, 0x88, 0x07, 0xff, 0xf8, ++ 0x7e, 0x06, 0x00, 0xaa, 0x65, 0xd2, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x1f, 0x7e, 0x02, 0x55, 0x67, 0xb5, 0x5b, 0x05, 0xfa, 0xab, 0x0a, 0x8d, ++ 0xe4, 0x03, 0xff, 0xc3, 0xfe, 0x07, 0x01, 0xaa, 0xaa, 0x26, 0xaa, 0xa9, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x16, 0x7d, 0x10, 0x57, 0x9d, 0x4a, 0x8a, 0xd7, ++ 0x95, 0x5a, 0xd5, 0x4d, 0x58, 0x00, 0xfc, 0x1f, 0xe6, 0x03, 0xc1, 0x55, ++ 0x52, 0xd5, 0x55, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0xe1, 0x42, 0xa4, ++ 0x7d, 0xd7, 0xba, 0xb0, 0x24, 0xd5, 0x97, 0xc5, 0xd2, 0x00, 0x00, 0x7f, ++ 0x87, 0x03, 0xe0, 0x42, 0xaa, 0x95, 0x55, 0x4b, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x0d, 0x42, 0x17, 0xfb, 0x8c, 0xac, 0x46, 0xae, 0xdd, 0xb3, 0x68, 0x92, ++ 0x6c, 0x03, 0x03, 0xfe, 0x0f, 0x01, 0xe0, 0x5a, 0x55, 0x62, 0xaa, 0x54, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x01, 0x3d, 0x0a, 0x32, 0xd5, 0x7b, 0xc9, 0xde, 0xad, ++ 0x91, 0x4a, 0xaa, 0xc6, 0x68, 0x21, 0xff, 0xf8, 0x7f, 0x00, 0x60, 0x2a, ++ 0xa9, 0x2e, 0xa9, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x64, 0xb3, 0x18, ++ 0x8e, 0xae, 0xb4, 0x46, 0x9a, 0xbb, 0x54, 0xd5, 0xb4, 0x30, 0xff, 0xe0, ++ 0xff, 0x80, 0x00, 0x52, 0xa5, 0x51, 0x55, 0x4a, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, ++ 0x82, 0xc1, 0x52, 0xb3, 0xcb, 0xc5, 0xd4, 0xda, 0xd3, 0x4a, 0x68, 0x87, ++ 0x68, 0x30, 0x3f, 0x03, 0xff, 0x80, 0x00, 0x2a, 0xaa, 0x55, 0x45, 0x55, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x01, 0x5b, 0xc6, 0xa9, 0x19, 0x74, 0x3d, 0xa9, 0x92, ++ 0xab, 0x5b, 0x95, 0xb0, 0x28, 0x78, 0x00, 0x07, 0xff, 0xc0, 0x00, 0x15, ++ 0x2a, 0x95, 0x2a, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x10, 0x0f, 0x6b, 0xa2, ++ 0xb7, 0x22, 0x61, 0x2b, 0x52, 0xaa, 0x33, 0x1d, 0xa0, 0x7c, 0x00, 0x0f, ++ 0xff, 0xe0, 0x00, 0x14, 0xa4, 0xaa, 0xa9, 0x52, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, ++ 0x00, 0x23, 0x27, 0x64, 0x8d, 0xfb, 0x64, 0xa7, 0x5a, 0xaa, 0xd3, 0x5a, ++ 0xa0, 0x7c, 0x00, 0x3f, 0xff, 0xe0, 0x00, 0x05, 0x29, 0x52, 0x45, 0x55, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x02, 0x4a, 0x5f, 0x66, 0x6a, 0xab, 0x22, 0xaf, 0xec, ++ 0xa9, 0x55, 0x17, 0x17, 0xa0, 0xfe, 0x00, 0x7f, 0xff, 0xf0, 0x00, 0x02, ++ 0xaa, 0x4a, 0xaa, 0x94, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x8d, 0x83, 0x49, 0xad, ++ 0x9a, 0x57, 0x50, 0x6b, 0x6b, 0x5a, 0xd1, 0x1a, 0x80, 0xff, 0x00, 0xff, ++ 0xff, 0xf0, 0x00, 0x05, 0x52, 0x95, 0x29, 0x55, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8c, ++ 0x1b, 0x4b, 0xcb, 0x45, 0x7b, 0x4e, 0x4b, 0x5d, 0x2a, 0xd5, 0x16, 0x29, ++ 0x41, 0xff, 0x87, 0xff, 0xff, 0xf8, 0x00, 0x01, 0x2a, 0xa5, 0x4a, 0x52, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x20, 0x52, 0x98, 0x9d, 0x0e, 0x95, 0x65, 0x38, 0x95, ++ 0x55, 0x6a, 0xab, 0x35, 0x81, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x01, ++ 0xa9, 0x14, 0xa9, 0x4a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x80, 0xe3, 0x2b, 0x74, 0x4d, ++ 0xb5, 0x55, 0xd5, 0x95, 0x69, 0x4a, 0xac, 0x6e, 0x03, 0xff, 0xff, 0xff, ++ 0xff, 0xfc, 0x00, 0x01, 0x25, 0x65, 0x2a, 0x95, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, ++ 0x9a, 0xb7, 0x0b, 0xb0, 0x6f, 0xfc, 0xfd, 0x6a, 0x8b, 0xd5, 0x4e, 0xa8, ++ 0x03, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x01, 0x49, 0x14, 0xa5, 0x6a, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x08, 0x02, 0x94, 0xab, 0x3d, 0xc9, 0x6b, 0xb5, 0x43, 0xee, ++ 0xb6, 0x95, 0x54, 0x9a, 0x07, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x00, ++ 0xaa, 0x54, 0xaa, 0x4a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x13, 0x9f, 0x68, 0x5b, ++ 0xff, 0xfa, 0xd7, 0xfa, 0xa5, 0x6a, 0xac, 0xd4, 0x07, 0xff, 0xff, 0xff, ++ 0xff, 0xfe, 0x00, 0x00, 0x55, 0x53, 0x2a, 0xaa, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x04, ++ 0x65, 0x3c, 0x8b, 0x93, 0x87, 0x76, 0x75, 0xf5, 0x57, 0x55, 0x5c, 0xa8, ++ 0x0f, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x0b, 0x54, 0x95, 0x54, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x2a, 0x7b, 0xfd, 0x75, 0xba, 0xae, 0xfe, 0x44, 0x5a, ++ 0x8a, 0xca, 0x9c, 0xf0, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, ++ 0x14, 0x4a, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0xd8, 0xa2, 0xbd, 0x59, 0x52, ++ 0x8e, 0xec, 0x48, 0xf1, 0x2d, 0x52, 0x9c, 0xa0, 0x0f, 0xff, 0xff, 0xff, ++ 0xff, 0xfe, 0x02, 0x00, 0x02, 0x95, 0x54, 0x92, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x35, ++ 0x5f, 0xed, 0x6a, 0xf2, 0x95, 0x19, 0x09, 0xaa, 0x6a, 0x5d, 0x48, 0xc0, ++ 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x02, 0xaa, 0x52, 0xaa, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x04, 0x22, 0xa6, 0xc3, 0xdf, 0xd0, 0x66, 0x29, 0xf0, 0x01, 0x6a, ++ 0xca, 0xd5, 0x59, 0x80, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x80, ++ 0x05, 0x2a, 0xaa, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0xa4, 0x03, 0xf2, 0x61, 0xed, ++ 0x17, 0xe2, 0x02, 0xaa, 0x99, 0x2a, 0x98, 0x80, 0x07, 0xff, 0xff, 0xff, ++ 0xff, 0xff, 0x80, 0x40, 0x02, 0x55, 0x55, 0x2a, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x09, 0x05, ++ 0x88, 0xa7, 0x47, 0xdc, 0xc0, 0x00, 0x2a, 0x6b, 0x4a, 0x6a, 0xb0, 0x00, ++ 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x20, 0x01, 0x55, 0x55, 0x55, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x80, 0x2e, 0x89, 0x11, 0xfb, 0x87, 0x9c, 0x90, 0x64, 0xaa, 0x9a, ++ 0x4a, 0xa9, 0x1a, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x30, ++ 0x00, 0xa8, 0x42, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x2b, 0x16, 0x2b, 0x85, 0x09, 0xf8, ++ 0x83, 0x45, 0x5d, 0xad, 0x95, 0x49, 0x5c, 0x08, 0x1f, 0xff, 0xff, 0xff, ++ 0xff, 0xff, 0xe0, 0x10, 0x00, 0xae, 0xea, 0x4a, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x49, 0x28, ++ 0x3b, 0xf5, 0xbd, 0x30, 0x14, 0x96, 0x95, 0x6a, 0xd2, 0xb5, 0xaa, 0x10, ++ 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x18, 0x00, 0xa9, 0x15, 0x55, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x02, 0x19, 0x26, 0x58, 0x76, 0x4a, 0x1e, 0xe1, 0x7a, 0xba, 0xb1, 0x5b, ++ 0x4a, 0xab, 0x2c, 0x10, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x08, ++ 0x00, 0x2b, 0x6a, 0xa8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x11, 0x21, 0x4d, 0x78, 0x6d, 0x20, ++ 0x0a, 0x84, 0xda, 0xaf, 0x55, 0x56, 0x52, 0x20, 0x3f, 0xff, 0xff, 0xff, ++ 0xff, 0xff, 0xf0, 0x0c, 0x00, 0x54, 0xaa, 0xa5, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0xe8, 0x62, ++ 0xcd, 0x49, 0xd8, 0x42, 0xb4, 0xb8, 0x96, 0x3a, 0xa5, 0x54, 0xd4, 0x00, ++ 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x04, 0x00, 0x14, 0xaa, 0x4a, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x05, 0x2d, 0x18, 0x4e, 0x0e, 0x61, 0xb0, 0x0a, 0xab, 0x6b, 0xaa, 0x37, ++ 0x0d, 0x5a, 0xa8, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x06, ++ 0x00, 0x2b, 0x4a, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x10, 0x40, 0xb1, 0xd8, 0x5f, 0xc1, 0x90, 0x55, ++ 0x55, 0x4a, 0x32, 0xed, 0x79, 0x49, 0x50, 0x00, 0xff, 0xff, 0xff, 0xff, ++ 0xff, 0xff, 0xf8, 0x06, 0x00, 0x12, 0xaa, 0xa9, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x16, 0x00, 0xd1, ++ 0xac, 0x89, 0x91, 0x4a, 0xaa, 0xaa, 0xa9, 0xb2, 0xc5, 0x65, 0x68, 0x00, ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x03, 0x00, 0x15, 0x2a, 0x4a, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, ++ 0x64, 0x54, 0x81, 0xcf, 0x89, 0x00, 0x1f, 0xf2, 0xaa, 0xd5, 0x6b, 0x35, ++ 0x5a, 0xad, 0xa8, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x03, ++ 0x00, 0x05, 0x6a, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x89, 0x23, 0xf6, 0x52, 0x28, 0x19, 0xd5, ++ 0x45, 0x55, 0x49, 0x54, 0xa5, 0x6a, 0xa0, 0x01, 0xff, 0xff, 0xff, 0xff, ++ 0xff, 0xff, 0xfc, 0x03, 0x00, 0x15, 0x24, 0xaa, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x09, 0x18, 0x04, 0x6c, ++ 0x64, 0x61, 0x21, 0x95, 0xad, 0x56, 0xaa, 0xd7, 0xab, 0x55, 0x50, 0x03, ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x01, 0x80, 0x04, 0xaa, 0x94, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, ++ 0x12, 0x46, 0x20, 0xdc, 0xc4, 0x01, 0x01, 0xaa, 0xaa, 0xa9, 0x5b, 0x49, ++ 0x2a, 0xad, 0xa0, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x01, ++ 0x80, 0x02, 0xa4, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x10, 0x44, 0x08, 0x00, 0xd1, 0x84, 0x20, 0x05, 0xaa, ++ 0xaa, 0x95, 0x66, 0xaa, 0xaa, 0xaa, 0xa0, 0x03, 0xff, 0xff, 0xff, 0xff, ++ 0xff, 0xff, 0xfe, 0x01, 0x80, 0x05, 0x55, 0x29, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0c, 0xa8, 0x89, 0x99, ++ 0x00, 0x22, 0x03, 0xd5, 0x4a, 0xaa, 0xa7, 0x4d, 0x5a, 0xd5, 0x40, 0x07, ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x01, 0x80, 0x02, 0x49, 0x4a, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, ++ 0x18, 0x02, 0x03, 0x24, 0x10, 0xa8, 0x2f, 0x6a, 0xaa, 0xaa, 0x45, 0x51, ++ 0x4a, 0xb5, 0x40, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, ++ 0x80, 0x04, 0x95, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x02, 0x01, 0x05, 0x48, 0x07, 0xae, 0x83, 0x02, 0x8c, 0x2a, ++ 0x95, 0x52, 0xcd, 0x56, 0xad, 0x56, 0xc0, 0x07, 0xff, 0xff, 0xff, 0xff, ++ 0xff, 0xff, 0xfe, 0x00, 0xc0, 0x01, 0x52, 0x52, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x58, 0x98, 0x2f, 0x30, ++ 0x02, 0x82, 0x01, 0x6a, 0xaa, 0xaa, 0x8d, 0x29, 0x35, 0xb5, 0x04, 0x07, ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0xc0, 0x02, 0x94, 0x95, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, ++ 0x45, 0x30, 0x1f, 0xa0, 0x25, 0x1d, 0x15, 0x4a, 0xa5, 0x51, 0xad, 0x55, ++ 0x6d, 0x6a, 0x84, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, ++ 0xc0, 0x01, 0x29, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x08, 0xa1, 0x2d, 0x21, 0x7f, 0x40, 0x4d, 0xb0, 0x35, 0x55, ++ 0x15, 0x15, 0x79, 0x25, 0x4a, 0xca, 0x04, 0x0f, 0xff, 0xff, 0xff, 0xff, ++ 0xff, 0xff, 0xff, 0x00, 0xc0, 0x02, 0x52, 0x96, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x40, 0x7f, 0x24, ++ 0x8a, 0x58, 0xad, 0x55, 0x55, 0x52, 0x0a, 0x5a, 0xaa, 0xbb, 0x04, 0x0f, ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xc0, 0x00, 0xa5, 0x20, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x09, ++ 0x50, 0x42, 0xfd, 0xc0, 0x59, 0x53, 0x53, 0x4c, 0xaa, 0x54, 0x5a, 0xa2, ++ 0xad, 0xaa, 0x04, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, ++ 0xc0, 0x01, 0x4d, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x08, 0x02, 0x15, 0x90, 0x7d, 0x15, 0x76, 0xac, 0xad, 0x52, ++ 0x95, 0x55, 0xaa, 0x4c, 0xa5, 0x54, 0x04, 0x0f, 0xff, 0xff, 0xff, 0xff, ++ 0xff, 0xff, 0xff, 0x00, 0xc0, 0x00, 0xa5, 0x12, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x0c, 0x83, 0x01, 0xff, 0xf9, ++ 0x15, 0x29, 0x51, 0x55, 0x52, 0x2c, 0xa2, 0x54, 0xab, 0x6c, 0x04, 0x0f, ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x80, 0x01, 0x28, 0x54, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x98, ++ 0x06, 0x01, 0xff, 0xe9, 0x55, 0xd5, 0x56, 0xa5, 0x55, 0xaa, 0xad, 0x51, ++ 0x35, 0x54, 0x04, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, ++ 0x80, 0x00, 0x4a, 0xa9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x01, 0x08, 0x31, 0x1c, 0x12, 0xf4, 0xc5, 0x44, 0x5a, 0xaa, 0x49, ++ 0xaa, 0xa9, 0xa8, 0x95, 0x55, 0x50, 0x04, 0x0f, 0xff, 0xff, 0xff, 0xff, ++ 0xff, 0xff, 0xff, 0x01, 0x80, 0x01, 0x52, 0x82, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x40, 0x48, 0x1c, 0x41, 0x3e, 0x2e, ++ 0x8b, 0x54, 0xaa, 0xab, 0x52, 0xa5, 0x45, 0x24, 0x95, 0x50, 0x06, 0x0f, ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x01, 0x24, 0x5a, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc1, 0x00, ++ 0x38, 0x01, 0x1d, 0x64, 0x9a, 0xa9, 0x2a, 0x94, 0xaa, 0xab, 0x55, 0x55, ++ 0xaa, 0xd8, 0x02, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, ++ 0x00, 0x01, 0x4a, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x13, 0xc8, 0x00, 0xb0, 0x02, 0x3e, 0x96, 0x35, 0x6a, 0xaa, 0x55, ++ 0x4a, 0x95, 0x4a, 0x54, 0x55, 0x28, 0x03, 0x0f, 0xff, 0xff, 0xff, 0xff, ++ 0xff, 0xff, 0xff, 0x8f, 0xc0, 0x01, 0x29, 0x4a, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x83, 0x49, 0x20, 0x8c, 0x78, 0xb5, ++ 0x65, 0x4a, 0xaa, 0xa6, 0xaa, 0xa5, 0x29, 0x45, 0xaa, 0xa8, 0x03, 0x0f, ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x70, 0x01, 0x45, 0x28, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x25, 0x03, 0x20, ++ 0x00, 0x30, 0x75, 0x4c, 0x95, 0x55, 0x54, 0xa9, 0x52, 0x95, 0x52, 0x95, ++ 0x2a, 0xa8, 0x01, 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, ++ 0x18, 0x00, 0x94, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x0d, 0x0c, 0x0c, 0x44, 0x18, 0xe5, 0xb9, 0xb5, 0x54, 0x92, 0x96, ++ 0xaa, 0x55, 0x4a, 0x69, 0x55, 0x20, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, ++ 0xff, 0xff, 0xff, 0x00, 0x00, 0x01, 0x29, 0x29, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x01, 0x2e, 0x08, 0x1c, 0x01, 0x7b, 0xdc, 0x96, ++ 0x4a, 0xaa, 0xaa, 0xa9, 0x4a, 0xaa, 0x95, 0x0a, 0x73, 0x50, 0x00, 0xff, ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x01, 0x52, 0x52, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x20, 0x30, ++ 0x44, 0x79, 0x88, 0xd4, 0x95, 0x49, 0x54, 0xab, 0x52, 0x94, 0xa4, 0xaa, ++ 0xc6, 0x51, 0xe0, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, ++ 0x00, 0x00, 0x8a, 0x8a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x38, 0x2a, 0x21, 0x01, 0xfb, 0xa0, 0x7d, 0x54, 0xb5, 0x55, 0x54, ++ 0x95, 0x55, 0x29, 0x55, 0x29, 0x57, 0xf8, 0x3f, 0xff, 0xff, 0xff, 0xff, ++ 0xff, 0xff, 0xfe, 0x00, 0x00, 0x02, 0x50, 0x52, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x02, 0x78, 0x90, 0x00, 0x0d, 0xfb, 0xca, 0xd2, ++ 0xaa, 0x92, 0x49, 0x55, 0x55, 0x2a, 0x4a, 0x4a, 0xd3, 0x57, 0xfc, 0x1f, ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x02, 0x95, 0x54, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x39, 0x20, 0xa4, ++ 0x13, 0xfd, 0xab, 0x2a, 0x52, 0xa5, 0x52, 0x55, 0x52, 0xa9, 0x55, 0x55, ++ 0x2a, 0x57, 0xff, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc6, 0x00, ++ 0x00, 0x0d, 0x24, 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x08, 0x30, 0xc0, 0x00, 0x77, 0xb5, 0x55, 0x69, 0x4a, 0xaa, 0x96, 0xaa, ++ 0x94, 0xaa, 0x91, 0x45, 0x55, 0x4f, 0xff, 0x03, 0xff, 0xff, 0xff, 0xff, ++ 0xff, 0xff, 0xcf, 0x00, 0x00, 0x1e, 0x55, 0x2a, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x01, 0x30, 0x81, 0x00, 0x67, 0xb4, 0x74, 0x52, ++ 0x55, 0x55, 0x2a, 0xaa, 0xaa, 0x52, 0x55, 0x35, 0x52, 0xaf, 0xff, 0x81, ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcf, 0x00, 0x00, 0x1e, 0xa0, 0x48, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0xe3, 0x00, 0x08, ++ 0x86, 0x4a, 0xd4, 0xd5, 0x54, 0x91, 0x49, 0x55, 0x51, 0x54, 0x95, 0x49, ++ 0x56, 0x4f, 0xff, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0x80, ++ 0x00, 0x3e, 0x0b, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x05, 0xc4, 0x02, 0x00, 0x7f, 0xbd, 0x8a, 0x25, 0x49, 0x55, 0x2a, 0xb5, ++ 0x55, 0x52, 0xa4, 0x96, 0xac, 0x8f, 0xff, 0xe0, 0x7f, 0xff, 0xff, 0xff, ++ 0xff, 0xff, 0x9f, 0x80, 0x00, 0x7e, 0x54, 0xa4, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x43, 0x80, 0x20, 0x21, 0x4d, 0x3f, 0x52, 0xb4, ++ 0x55, 0x2a, 0x55, 0x55, 0x4a, 0xa4, 0x95, 0x32, 0xa5, 0x4f, 0xff, 0xe0, ++ 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x9f, 0xc0, 0x00, 0xfe, 0x49, 0x14, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xe8, 0x04, 0x08, ++ 0x1a, 0x46, 0xd4, 0x49, 0xaa, 0xa4, 0xaa, 0xaa, 0x54, 0x95, 0x2a, 0xc4, ++ 0x94, 0x8f, 0xff, 0xf0, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x9f, 0xe0, ++ 0x01, 0xfe, 0x92, 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x8e, 0x40, 0x80, 0x00, 0x74, 0x44, 0x51, 0x55, 0x64, 0xa9, 0x49, 0x55, ++ 0x49, 0x51, 0x52, 0x5a, 0x2a, 0x1f, 0xff, 0xf8, 0x07, 0xff, 0xff, 0xff, ++ 0xff, 0xff, 0x9f, 0xf0, 0x07, 0xfe, 0x24, 0x52, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x0d, 0x90, 0x00, 0x41, 0xeb, 0x12, 0xab, 0x52, ++ 0xa9, 0x4a, 0xaa, 0xa5, 0x52, 0x95, 0x2a, 0xa2, 0xa8, 0x1f, 0xff, 0xf8, ++ 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0x9f, 0xf8, 0x1f, 0xfe, 0x52, 0x8a, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x3b, 0x81, 0x08, 0x05, ++ 0xe3, 0x15, 0xa5, 0x36, 0x95, 0x4a, 0x4a, 0xaa, 0x45, 0x2a, 0xa2, 0xac, ++ 0x00, 0x3f, 0xff, 0xfc, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0x9f, 0xff, ++ 0xff, 0xfe, 0x04, 0xa8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0xb2, 0x00, 0x00, 0x80, 0xe8, 0x52, 0xac, 0xa8, 0xa4, 0x92, 0xa9, 0x4a, ++ 0x95, 0x51, 0x2d, 0x50, 0xe1, 0xff, 0xff, 0xfe, 0x00, 0x7f, 0xff, 0xff, ++ 0xff, 0xff, 0x9f, 0xff, 0xff, 0xfe, 0x29, 0x05, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x04, 0x00, 0x35, 0x10, 0x09, 0xa9, 0x4a, 0xaa, 0xaa, ++ 0xa9, 0x54, 0x95, 0x2a, 0xa4, 0x8a, 0xa9, 0x43, 0xff, 0xff, 0xff, 0xfe, ++ 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0x9f, 0xff, 0xff, 0xfe, 0x12, 0xa9, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2e, 0x01, 0x03, ++ 0x34, 0xa5, 0x19, 0x25, 0x55, 0x55, 0x55, 0x55, 0x15, 0x55, 0x45, 0x53, ++ 0xff, 0xff, 0xff, 0xff, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0x9f, 0xff, ++ 0xff, 0xfe, 0x04, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, ++ 0x49, 0x3c, 0x00, 0x34, 0x75, 0x4a, 0xa2, 0xaa, 0x92, 0x92, 0x92, 0x54, ++ 0x52, 0x54, 0x99, 0x53, 0xff, 0xff, 0xff, 0xff, 0x80, 0x0f, 0xff, 0xff, ++ 0xff, 0xff, 0x9f, 0xff, 0xff, 0xff, 0x14, 0x94, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x02, 0x00, 0x78, 0x12, 0xfc, 0xaa, 0x92, 0x2d, 0x54, ++ 0xa4, 0xa5, 0x2a, 0x92, 0x94, 0x92, 0xa2, 0xa3, 0xff, 0xff, 0xff, 0xff, ++ 0x80, 0x0f, 0xff, 0xff, 0xff, 0xff, 0x9f, 0xff, 0xff, 0xff, 0x01, 0x51, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x16, 0xf0, 0x80, 0x71, ++ 0xc5, 0x2a, 0x65, 0x25, 0x55, 0x4a, 0x52, 0xaa, 0x51, 0x52, 0x95, 0x21, ++ 0xff, 0xff, 0xff, 0xff, 0xc0, 0x07, 0xff, 0xff, 0xff, 0xff, 0x8f, 0xff, ++ 0xff, 0xff, 0x81, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, ++ 0x8e, 0xa0, 0x00, 0xb3, 0x94, 0xa4, 0xa9, 0x55, 0x45, 0x54, 0xa5, 0x25, ++ 0x25, 0x2a, 0x65, 0x41, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x07, 0xff, 0xff, ++ 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, 0x80, 0x4a, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0xa0, 0x0f, 0x42, 0x13, 0x46, 0x94, 0x94, 0xa5, 0x4a, ++ 0x54, 0x92, 0x88, 0xa8, 0x49, 0x55, 0x4a, 0x51, 0xff, 0xff, 0xff, 0xff, ++ 0xe0, 0x07, 0xff, 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xe0, 0x52, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4c, 0x2d, 0x00, 0x87, 0x56, ++ 0x4b, 0x2a, 0x99, 0x55, 0x4a, 0xaa, 0x55, 0x4a, 0x92, 0xa2, 0x54, 0xa8, ++ 0xff, 0xff, 0xff, 0xff, 0xf0, 0x07, 0xff, 0xff, 0xff, 0xfd, 0x8f, 0xff, ++ 0xff, 0xff, 0xfe, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x88, ++ 0x18, 0x04, 0x1f, 0x11, 0x51, 0x51, 0x0b, 0x54, 0x94, 0xa5, 0x52, 0x92, ++ 0x55, 0x54, 0x95, 0x20, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x0f, 0xff, 0xff, ++ 0xff, 0xf9, 0x8f, 0xff, 0xff, 0xff, 0xff, 0x89, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x11, 0xe0, 0x38, 0x01, 0x3e, 0x4d, 0x0a, 0x55, 0x5a, 0x55, ++ 0x55, 0x4a, 0x25, 0x24, 0x81, 0x25, 0x29, 0x48, 0xff, 0xff, 0xff, 0xff, ++ 0xf8, 0x1f, 0xff, 0xff, 0xff, 0xf0, 0x8f, 0xff, 0xff, 0xff, 0xff, 0xc2, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x80, 0xf0, 0x90, 0x7e, 0xd4, ++ 0x68, 0x92, 0xaa, 0x54, 0x92, 0x92, 0xa9, 0x55, 0x2e, 0xaa, 0xa2, 0x58, ++ 0x7f, 0xff, 0xff, 0xff, 0xfc, 0x3f, 0xff, 0xff, 0xff, 0xe0, 0x8f, 0xff, ++ 0xff, 0xff, 0xff, 0xe4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x04, ++ 0x40, 0x00, 0x49, 0xe2, 0x8a, 0xa9, 0x54, 0x95, 0x2a, 0x54, 0x4a, 0x48, ++ 0x91, 0x51, 0x2a, 0xc8, 0x7f, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, ++ 0xff, 0xc0, 0x8f, 0xff, 0xff, 0xff, 0xff, 0xe2, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x2e, 0x00, 0x00, 0x03, 0x79, 0x4a, 0xa9, 0x45, 0x49, 0x54, ++ 0xa4, 0x89, 0x49, 0x52, 0x8a, 0x85, 0x4a, 0x98, 0x7f, 0xff, 0xff, 0xff, ++ 0xfe, 0x7f, 0xff, 0xff, 0xff, 0x80, 0x8f, 0xff, 0xff, 0xff, 0xff, 0xc4, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x48, 0x44, 0x91, 0x65, 0x55, ++ 0x4a, 0x54, 0x96, 0x85, 0x55, 0x52, 0xaa, 0x8a, 0x1a, 0xaa, 0x59, 0x30, ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xfe, 0x01, 0x0f, 0xff, ++ 0xff, 0xff, 0xff, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x20, 0x00, ++ 0x00, 0x02, 0xc3, 0x50, 0x29, 0x49, 0x2d, 0x35, 0x24, 0x54, 0x89, 0x32, ++ 0x52, 0x91, 0x49, 0x40, 0xff, 0xff, 0xff, 0xff, 0xff, 0x30, 0xff, 0xff, ++ 0xfc, 0x01, 0x0f, 0xff, 0xff, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x20, 0x08, 0x80, 0x00, 0x87, 0x4b, 0x42, 0x95, 0x2a, 0x4a, ++ 0x4a, 0x89, 0x52, 0x44, 0x45, 0x25, 0x55, 0x10, 0xff, 0xff, 0xff, 0xff, ++ 0xff, 0x98, 0x7f, 0xff, 0xf0, 0x01, 0x0f, 0xff, 0xff, 0xff, 0xfc, 0x09, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x40, 0x40, 0x11, 0x15, 0x6a, 0x92, ++ 0x4d, 0x29, 0x4a, 0xaa, 0xa4, 0xaa, 0x55, 0x54, 0x9a, 0x74, 0x44, 0xb1, ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0x8c, 0x1f, 0xff, 0x00, 0x01, 0x0f, 0xff, ++ 0xff, 0xff, 0xf0, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, ++ 0x80, 0x01, 0x48, 0x54, 0x94, 0xa6, 0xa9, 0x52, 0x45, 0x24, 0x84, 0x92, ++ 0xa4, 0x85, 0x2a, 0x43, 0xff, 0xff, 0xff, 0xff, 0xff, 0x84, 0x00, 0x00, ++ 0x00, 0x01, 0x1f, 0xff, 0xff, 0xff, 0xc0, 0x92, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x11, 0x00, 0x09, 0x02, 0x03, 0x53, 0x15, 0x2a, 0x49, 0x4a, 0xa5, ++ 0x49, 0x29, 0x29, 0x24, 0x2a, 0xd5, 0x54, 0xa3, 0xff, 0xff, 0xff, 0xff, ++ 0xff, 0xc6, 0x00, 0x00, 0x00, 0x03, 0x1f, 0xff, 0xff, 0xfe, 0x01, 0x24, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x02, 0x20, 0x26, 0xd4, 0xa2, ++ 0x49, 0xb5, 0x15, 0x4a, 0x52, 0xa9, 0x4a, 0x92, 0xa5, 0x12, 0x52, 0xa3, ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xc6, 0x00, 0x00, 0x00, 0x03, 0x1f, 0xff, ++ 0xff, 0xf0, 0x14, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, 0x84, 0x00, 0x44, ++ 0x00, 0x0c, 0xc4, 0xa4, 0xa8, 0x25, 0x2a, 0xaa, 0x84, 0x45, 0x28, 0xa4, ++ 0xa8, 0xa5, 0x4a, 0x43, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc2, 0x00, 0x00, ++ 0x00, 0x06, 0x1f, 0xff, 0xff, 0xc0, 0x25, 0x24, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x10, 0x80, 0x12, 0x01, 0x11, 0x12, 0x8a, 0x95, 0x49, 0x55, 0x49, ++ 0x2a, 0xaa, 0x45, 0x0a, 0x4a, 0x94, 0xaa, 0x90, 0xff, 0xff, 0xff, 0xff, ++ 0xff, 0xc2, 0x00, 0x00, 0x00, 0x06, 0x1f, 0xff, 0xff, 0x02, 0x48, 0x92, ++ 0x00, 0x00, 0x00, 0x00, 0x02, 0x01, 0x08, 0x00, 0x22, 0x01, 0x24, 0x95, ++ 0x21, 0x55, 0x55, 0x2a, 0x54, 0x92, 0x94, 0xa8, 0xa9, 0x2a, 0x92, 0xa8, ++ 0x1f, 0xff, 0xff, 0xff, 0xff, 0x82, 0x00, 0x00, 0x00, 0x06, 0x0f, 0xff, ++ 0xfe, 0x02, 0x49, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x01, 0x40, ++ 0x00, 0xc4, 0x89, 0x11, 0x54, 0x95, 0x29, 0x49, 0x49, 0x24, 0x29, 0x12, ++ 0x92, 0xa5, 0x55, 0x28, 0x01, 0xff, 0xff, 0xff, 0xff, 0x82, 0x00, 0x00, ++ 0x00, 0x02, 0x0f, 0xff, 0xfc, 0x14, 0x92, 0x49, 0x00, 0x00, 0x00, 0x00, ++ 0x08, 0x42, 0x06, 0x44, 0x45, 0x08, 0x92, 0x24, 0x95, 0xaa, 0xa5, 0x52, ++ 0x92, 0x55, 0x42, 0x52, 0xaa, 0x4a, 0x49, 0x4a, 0x80, 0x0f, 0xff, 0xff, ++ 0xff, 0x84, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xf0, 0x04, 0x92, 0x49, ++ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x2a, 0x80, 0x01, 0x95, 0x2a, 0x8a, ++ 0xa0, 0x95, 0x2a, 0x95, 0x54, 0xa4, 0x54, 0x84, 0x44, 0x95, 0x55, 0x29, ++ 0x54, 0x00, 0x7f, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, ++ 0xe0, 0x29, 0x24, 0x92, 0x00, 0x00, 0x00, 0x00, 0x22, 0x04, 0x03, 0x03, ++ 0x42, 0x12, 0x52, 0x2a, 0x15, 0x55, 0x54, 0xa8, 0x92, 0xa9, 0x49, 0x29, ++ 0x54, 0xaa, 0x92, 0x52, 0xa5, 0x40, 0x07, 0xff, 0xff, 0x00, 0x15, 0x50, ++ 0x92, 0x44, 0x07, 0xff, 0xc0, 0x52, 0x54, 0xaa, 0x00, 0x00, 0x00, 0x00, ++ 0x84, 0x02, 0x86, 0x03, 0x08, 0x41, 0x48, 0x94, 0xa5, 0x52, 0xaa, 0x8a, ++ 0x49, 0x52, 0x92, 0x45, 0x49, 0x55, 0x2a, 0xaa, 0x94, 0x96, 0x00, 0x7f, ++ 0xfe, 0x01, 0x55, 0x2b, 0x25, 0x50, 0x03, 0xff, 0x00, 0xa4, 0x91, 0x08, ++ 0x00, 0x00, 0x00, 0x00, 0x88, 0x2c, 0x18, 0x14, 0x0a, 0xaa, 0x92, 0x55, ++ 0x49, 0x55, 0x4a, 0xa9, 0x52, 0x44, 0x92, 0x94, 0x92, 0x92, 0xca, 0x4a, ++ 0x55, 0x27, 0xa0, 0x0f, 0xf8, 0x05, 0x35, 0x49, 0x68, 0x91, 0x00, 0xf8, ++ 0x04, 0x95, 0x25, 0x29, 0x00, 0x00, 0x00, 0x01, 0x08, 0x04, 0x18, 0x00, ++ 0x08, 0x04, 0x49, 0x08, 0x55, 0x4a, 0xa9, 0x12, 0x95, 0x55, 0x49, 0x22, ++ 0x65, 0x2a, 0x5a, 0x92, 0xa9, 0x49, 0x54, 0x00, 0xe0, 0x24, 0xb2, 0x55, ++ 0x15, 0x4c, 0x00, 0x00, 0x02, 0x48, 0x52, 0x52, 0x00, 0x00, 0x00, 0x02, ++ 0x21, 0x09, 0x50, 0x81, 0x51, 0x69, 0x48, 0x52, 0x92, 0x94, 0xaa, 0x54, ++ 0x25, 0x54, 0x92, 0x4a, 0x89, 0x54, 0x82, 0xaa, 0x4a, 0x53, 0x55, 0x00, ++ 0x00, 0x49, 0x65, 0x52, 0x51, 0x12, 0x80, 0x00, 0x14, 0x92, 0x92, 0x42, ++ 0x00, 0x00, 0x00, 0x01, 0x00, 0x20, 0x50, 0x24, 0x2a, 0x95, 0x25, 0x29, ++ 0x4a, 0xb5, 0x48, 0xa5, 0x52, 0x49, 0x24, 0x94, 0xaa, 0xab, 0x15, 0x24, ++ 0x92, 0xa5, 0x54, 0x40, 0x00, 0xaa, 0xb5, 0x25, 0x4a, 0xa4, 0x80, 0x00, ++ 0x21, 0x24, 0xa8, 0x94, 0x00, 0x00, 0x00, 0x0a, 0x44, 0x02, 0xb1, 0x01, ++ 0x24, 0x80, 0x48, 0xa2, 0x55, 0x55, 0x52, 0x8a, 0x94, 0xaa, 0x49, 0x22, ++ 0x8a, 0x49, 0x49, 0x55, 0x4a, 0x51, 0x25, 0x48, 0x02, 0xa8, 0x6a, 0x69, ++ 0x12, 0x29, 0x50, 0x00, 0x55, 0x24, 0x81, 0x24, 0x00, 0x00, 0x00, 0x23, ++ 0x80, 0x90, 0x70, 0x14, 0x82, 0x55, 0x22, 0x8a, 0xa9, 0x14, 0xaa, 0xa9, ++ 0x25, 0x51, 0x2a, 0x55, 0x21, 0x55, 0x55, 0x12, 0x55, 0x32, 0xaa, 0x94, ++ 0xa5, 0x55, 0x5a, 0x92, 0x54, 0xa5, 0x52, 0x24, 0xa2, 0x49, 0x2a, 0x92, ++ 0x00, 0x00, 0x00, 0x0e, 0x08, 0x00, 0xe2, 0xa0, 0x04, 0x54, 0x84, 0x52, ++ 0x4a, 0xa4, 0xaa, 0x2a, 0xa9, 0x25, 0x45, 0x42, 0xae, 0x92, 0x44, 0xa4, ++ 0x91, 0x24, 0xaa, 0xaa, 0xaa, 0x91, 0x55, 0x55, 0x51, 0x55, 0x54, 0xa9, ++ 0x14, 0x92, 0x49, 0x24, 0x00, 0x00, 0x00, 0x24, 0x01, 0x82, 0x70, 0x09, ++ 0x2a, 0x41, 0x2a, 0x89, 0x14, 0x49, 0x29, 0x52, 0x4a, 0xaa, 0x2a, 0x15, ++ 0x12, 0xaa, 0xa9, 0x2a, 0xaa, 0xba, 0xa4, 0x94, 0x95, 0x55, 0x5a, 0x49, ++ 0x25, 0x20, 0x49, 0x22, 0xa5, 0x24, 0x92, 0x92, 0x00, 0x00, 0x01, 0x0c, ++ 0x93, 0x10, 0xe2, 0x11, 0x00, 0x94, 0x22, 0x52, 0x69, 0x53, 0x52, 0x45, ++ 0x49, 0x22, 0xa4, 0x4a, 0x55, 0x29, 0x2a, 0xa4, 0x52, 0x42, 0xaa, 0xa5, ++ 0x52, 0xa8, 0xaa, 0x55, 0x4a, 0xab, 0xa9, 0x4a, 0x54, 0x49, 0x32, 0x24 }; +-- +2.30.2 + diff --git a/queue-5.13/memory-atmel-ebi-add-missing-of_node_put-for-loop-it.patch b/queue-5.13/memory-atmel-ebi-add-missing-of_node_put-for-loop-it.patch new file mode 100644 index 00000000000..08323a25651 --- /dev/null +++ b/queue-5.13/memory-atmel-ebi-add-missing-of_node_put-for-loop-it.patch @@ -0,0 +1,42 @@ +From 6ffcd2a308365033dbfc02100c1be4d9fc4b7400 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 23 Apr 2021 12:18:15 +0200 +Subject: memory: atmel-ebi: add missing of_node_put for loop iteration + +From: Krzysztof Kozlowski + +[ Upstream commit 907c5bbb514a4676160e79764522fff56ce3448e ] + +Early exits from for_each_available_child_of_node() should decrement the +node reference counter. Reported by Coccinelle: + + drivers/memory/atmel-ebi.c:593:1-33: WARNING: + Function "for_each_available_child_of_node" should have of_node_put() before return around line 604. + +Fixes: 6a4ec4cd0888 ("memory: add Atmel EBI (External Bus Interface) driver") +Signed-off-by: Krzysztof Kozlowski +Link: https://lore.kernel.org/r/20210423101815.119341-2-krzysztof.kozlowski@canonical.com +Signed-off-by: Sasha Levin +--- + drivers/memory/atmel-ebi.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/memory/atmel-ebi.c b/drivers/memory/atmel-ebi.c +index 14386d0b5f57..c267283b01fd 100644 +--- a/drivers/memory/atmel-ebi.c ++++ b/drivers/memory/atmel-ebi.c +@@ -600,8 +600,10 @@ static int atmel_ebi_probe(struct platform_device *pdev) + child); + + ret = atmel_ebi_dev_disable(ebi, child); +- if (ret) ++ if (ret) { ++ of_node_put(child); + return ret; ++ } + } + } + +-- +2.30.2 + diff --git a/queue-5.13/memory-fsl_ifc-fix-leak-of-io-mapping-on-probe-failu.patch b/queue-5.13/memory-fsl_ifc-fix-leak-of-io-mapping-on-probe-failu.patch new file mode 100644 index 00000000000..ff198bc4563 --- /dev/null +++ b/queue-5.13/memory-fsl_ifc-fix-leak-of-io-mapping-on-probe-failu.patch @@ -0,0 +1,48 @@ +From cc97202d834631aeea8d9853259aeaa8623ff7f0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 27 May 2021 11:43:21 -0400 +Subject: memory: fsl_ifc: fix leak of IO mapping on probe failure + +From: Krzysztof Kozlowski + +[ Upstream commit 3b132ab67fc7a358fff35e808fa65d4bea452521 ] + +On probe error the driver should unmap the IO memory. Smatch reports: + + drivers/memory/fsl_ifc.c:298 fsl_ifc_ctrl_probe() warn: 'fsl_ifc_ctrl_dev->gregs' not released on lines: 298. + +Fixes: a20cbdeffce2 ("powerpc/fsl: Add support for Integrated Flash Controller") +Reported-by: kernel test robot +Reported-by: Dan Carpenter +Signed-off-by: Krzysztof Kozlowski +Link: https://lore.kernel.org/r/20210527154322.81253-1-krzysztof.kozlowski@canonical.com +Signed-off-by: Sasha Levin +--- + drivers/memory/fsl_ifc.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/memory/fsl_ifc.c b/drivers/memory/fsl_ifc.c +index 89f99b5b6450..a6324044a085 100644 +--- a/drivers/memory/fsl_ifc.c ++++ b/drivers/memory/fsl_ifc.c +@@ -219,8 +219,7 @@ static int fsl_ifc_ctrl_probe(struct platform_device *dev) + fsl_ifc_ctrl_dev->gregs = of_iomap(dev->dev.of_node, 0); + if (!fsl_ifc_ctrl_dev->gregs) { + dev_err(&dev->dev, "failed to get memory region\n"); +- ret = -ENODEV; +- goto err; ++ return -ENODEV; + } + + if (of_property_read_bool(dev->dev.of_node, "little-endian")) { +@@ -295,6 +294,7 @@ err_irq: + free_irq(fsl_ifc_ctrl_dev->irq, fsl_ifc_ctrl_dev); + irq_dispose_mapping(fsl_ifc_ctrl_dev->irq); + err: ++ iounmap(fsl_ifc_ctrl_dev->gregs); + return ret; + } + +-- +2.30.2 + diff --git a/queue-5.13/memory-fsl_ifc-fix-leak-of-private-memory-on-probe-f.patch b/queue-5.13/memory-fsl_ifc-fix-leak-of-private-memory-on-probe-f.patch new file mode 100644 index 00000000000..7883f6350e0 --- /dev/null +++ b/queue-5.13/memory-fsl_ifc-fix-leak-of-private-memory-on-probe-f.patch @@ -0,0 +1,45 @@ +From 3852515b162ee21d8bc894edda82827c8b8cb79c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 27 May 2021 11:43:22 -0400 +Subject: memory: fsl_ifc: fix leak of private memory on probe failure + +From: Krzysztof Kozlowski + +[ Upstream commit 8e0d09b1232d0538066c40ed4c13086faccbdff6 ] + +On probe error the driver should free the memory allocated for private +structure. Fix this by using resource-managed allocation. + +Fixes: a20cbdeffce2 ("powerpc/fsl: Add support for Integrated Flash Controller") +Signed-off-by: Krzysztof Kozlowski +Link: https://lore.kernel.org/r/20210527154322.81253-2-krzysztof.kozlowski@canonical.com +Signed-off-by: Sasha Levin +--- + drivers/memory/fsl_ifc.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/memory/fsl_ifc.c b/drivers/memory/fsl_ifc.c +index a6324044a085..d062c2f8250f 100644 +--- a/drivers/memory/fsl_ifc.c ++++ b/drivers/memory/fsl_ifc.c +@@ -97,7 +97,6 @@ static int fsl_ifc_ctrl_remove(struct platform_device *dev) + iounmap(ctrl->gregs); + + dev_set_drvdata(&dev->dev, NULL); +- kfree(ctrl); + + return 0; + } +@@ -209,7 +208,8 @@ static int fsl_ifc_ctrl_probe(struct platform_device *dev) + + dev_info(&dev->dev, "Freescale Integrated Flash Controller\n"); + +- fsl_ifc_ctrl_dev = kzalloc(sizeof(*fsl_ifc_ctrl_dev), GFP_KERNEL); ++ fsl_ifc_ctrl_dev = devm_kzalloc(&dev->dev, sizeof(*fsl_ifc_ctrl_dev), ++ GFP_KERNEL); + if (!fsl_ifc_ctrl_dev) + return -ENOMEM; + +-- +2.30.2 + diff --git a/queue-5.13/memory-pl353-fix-error-return-code-in-pl353_smc_prob.patch b/queue-5.13/memory-pl353-fix-error-return-code-in-pl353_smc_prob.patch new file mode 100644 index 00000000000..a7a28b21178 --- /dev/null +++ b/queue-5.13/memory-pl353-fix-error-return-code-in-pl353_smc_prob.patch @@ -0,0 +1,38 @@ +From 3c9bb3d5550f973674ed632ca63d9a1ec5bdaf4c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 15 May 2021 12:00:04 +0800 +Subject: memory: pl353: Fix error return code in pl353_smc_probe() + +From: Zhen Lei + +[ Upstream commit 76e5624f3f9343a621dd3f4006f4e4d9c3f91e33 ] + +When no child nodes are matched, an appropriate error code -ENODEV should +be returned. However, we currently do not explicitly assign this error +code to 'err'. As a result, 0 was incorrectly returned. + +Fixes: fee10bd22678 ("memory: pl353: Add driver for arm pl353 static memory controller") +Reported-by: Hulk Robot +Signed-off-by: Zhen Lei +Link: https://lore.kernel.org/r/20210515040004.6983-1-thunder.leizhen@huawei.com +Signed-off-by: Krzysztof Kozlowski +Signed-off-by: Sasha Levin +--- + drivers/memory/pl353-smc.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/memory/pl353-smc.c b/drivers/memory/pl353-smc.c +index 9c0a28416777..b0b251bb207f 100644 +--- a/drivers/memory/pl353-smc.c ++++ b/drivers/memory/pl353-smc.c +@@ -407,6 +407,7 @@ static int pl353_smc_probe(struct amba_device *adev, const struct amba_id *id) + break; + } + if (!match) { ++ err = -ENODEV; + dev_err(&adev->dev, "no matching children\n"); + goto out_clk_disable; + } +-- +2.30.2 + diff --git a/queue-5.13/memory-stm32-fmc2-ebi-add-missing-of_node_put-for-lo.patch b/queue-5.13/memory-stm32-fmc2-ebi-add-missing-of_node_put-for-lo.patch new file mode 100644 index 00000000000..fb1466d1f66 --- /dev/null +++ b/queue-5.13/memory-stm32-fmc2-ebi-add-missing-of_node_put-for-lo.patch @@ -0,0 +1,59 @@ +From a894e76de45493887f36ec639a8d587a9b293610 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 23 Apr 2021 12:18:14 +0200 +Subject: memory: stm32-fmc2-ebi: add missing of_node_put for loop iteration + +From: Krzysztof Kozlowski + +[ Upstream commit 2f9dc6a357ff3b82c1e54d29fb5d52b8d4a0c587 ] + +Early exits from for_each_available_child_of_node() should decrement the +node reference counter. Reported by Coccinelle: + + drivers/memory/stm32-fmc2-ebi.c:1046:1-33: WARNING: + Function "for_each_available_child_of_node" should have of_node_put() before return around line 1051. + +Fixes: 66b8173a197f ("memory: stm32-fmc2-ebi: add STM32 FMC2 EBI controller driver") +Signed-off-by: Krzysztof Kozlowski +Reviewed-by: Christophe Kerello +Link: https://lore.kernel.org/r/20210423101815.119341-1-krzysztof.kozlowski@canonical.com +Signed-off-by: Sasha Levin +--- + drivers/memory/stm32-fmc2-ebi.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/drivers/memory/stm32-fmc2-ebi.c b/drivers/memory/stm32-fmc2-ebi.c +index 4d5758c419c5..ffec26a99313 100644 +--- a/drivers/memory/stm32-fmc2-ebi.c ++++ b/drivers/memory/stm32-fmc2-ebi.c +@@ -1048,16 +1048,19 @@ static int stm32_fmc2_ebi_parse_dt(struct stm32_fmc2_ebi *ebi) + if (ret) { + dev_err(dev, "could not retrieve reg property: %d\n", + ret); ++ of_node_put(child); + return ret; + } + + if (bank >= FMC2_MAX_BANKS) { + dev_err(dev, "invalid reg value: %d\n", bank); ++ of_node_put(child); + return -EINVAL; + } + + if (ebi->bank_assigned & BIT(bank)) { + dev_err(dev, "bank already assigned: %d\n", bank); ++ of_node_put(child); + return -EINVAL; + } + +@@ -1066,6 +1069,7 @@ static int stm32_fmc2_ebi_parse_dt(struct stm32_fmc2_ebi *ebi) + if (ret) { + dev_err(dev, "setup chip select %d failed: %d\n", + bank, ret); ++ of_node_put(child); + return ret; + } + } +-- +2.30.2 + diff --git a/queue-5.13/mfd-cpcap-fix-cpcap-dmamask-not-set-warnings.patch b/queue-5.13/mfd-cpcap-fix-cpcap-dmamask-not-set-warnings.patch new file mode 100644 index 00000000000..bbcebf47766 --- /dev/null +++ b/queue-5.13/mfd-cpcap-fix-cpcap-dmamask-not-set-warnings.patch @@ -0,0 +1,62 @@ +From 1c19da6e14628d06ded6a874f6bebc00d4597fac Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 22 May 2021 08:10:01 +0300 +Subject: mfd: cpcap: Fix cpcap dmamask not set warnings + +From: Tony Lindgren + +[ Upstream commit 0b7cbe811ca524295ea43d9a4d73d3427e419c54 ] + +We have started to get a bunch of pointless dmamask not set warnings +that makes the output of dmesg -l err,warn hard to read with many +extra warnings: + +cpcap-regulator cpcap-regulator.0: DMA mask not set +cpcap_adc cpcap_adc.0: DMA mask not set +cpcap_battery cpcap_battery.0: DMA mask not set +cpcap-charger cpcap-charger.0: DMA mask not set +cpcap-pwrbutton cpcap-pwrbutton.0: DMA mask not set +cpcap-led cpcap-led.0: DMA mask not set +cpcap-led cpcap-led.1: DMA mask not set +cpcap-led cpcap-led.2: DMA mask not set +cpcap-led cpcap-led.3: DMA mask not set +cpcap-led cpcap-led.4: DMA mask not set +cpcap-rtc cpcap-rtc.0: DMA mask not set +cpcap-usb-phy cpcap-usb-phy.0: DMA mask not set + +This seems to have started with commit 4d8bde883bfb ("OF: Don't set +default coherent DMA mask"). We have the parent SPI controller use +DMA, while CPCAP driver and it's children do not. For audio, the +DMA is handled over I2S bus with the McBSP driver. + +Cc: Carl Philipp Klemm +Cc: Ivan Jelincic +Cc: Merlijn Wajer +Cc: Pavel Machek +Cc: Sebastian Reichel +Cc: Sicelo A. Mhlongo +Signed-off-by: Tony Lindgren +Signed-off-by: Lee Jones +Signed-off-by: Sasha Levin +--- + drivers/mfd/motorola-cpcap.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/drivers/mfd/motorola-cpcap.c b/drivers/mfd/motorola-cpcap.c +index 30d82bfe5b02..6fb206da2729 100644 +--- a/drivers/mfd/motorola-cpcap.c ++++ b/drivers/mfd/motorola-cpcap.c +@@ -327,6 +327,10 @@ static int cpcap_probe(struct spi_device *spi) + if (ret) + return ret; + ++ /* Parent SPI controller uses DMA, CPCAP and child devices do not */ ++ spi->dev.coherent_dma_mask = 0; ++ spi->dev.dma_mask = &spi->dev.coherent_dma_mask; ++ + return devm_mfd_add_devices(&spi->dev, 0, cpcap_mfd_devices, + ARRAY_SIZE(cpcap_mfd_devices), NULL, 0, NULL); + } +-- +2.30.2 + diff --git a/queue-5.13/mfd-da9052-stmpe-add-and-modify-module_device_table.patch b/queue-5.13/mfd-da9052-stmpe-add-and-modify-module_device_table.patch new file mode 100644 index 00000000000..4b3b443025e --- /dev/null +++ b/queue-5.13/mfd-da9052-stmpe-add-and-modify-module_device_table.patch @@ -0,0 +1,50 @@ +From 996cee2d8bca3cbc0dc49ebe3f58da3cd83bfa16 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 12 May 2021 14:33:46 +0800 +Subject: mfd: da9052/stmpe: Add and modify MODULE_DEVICE_TABLE + +From: Zou Wei + +[ Upstream commit 4700ef326556ed74aba188f12396740a8c1c21dd ] + +This patch adds/modifies MODULE_DEVICE_TABLE definition which generates +correct modalias for automatic loading of this driver when it is built +as an external module. + +Reported-by: Hulk Robot +Signed-off-by: Zou Wei +Signed-off-by: Lee Jones +Signed-off-by: Sasha Levin +--- + drivers/mfd/da9052-i2c.c | 1 + + drivers/mfd/stmpe-i2c.c | 2 +- + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/mfd/da9052-i2c.c b/drivers/mfd/da9052-i2c.c +index 47556d2d9abe..8ebfc7bbe4e0 100644 +--- a/drivers/mfd/da9052-i2c.c ++++ b/drivers/mfd/da9052-i2c.c +@@ -113,6 +113,7 @@ static const struct i2c_device_id da9052_i2c_id[] = { + {"da9053-bc", DA9053_BC}, + {} + }; ++MODULE_DEVICE_TABLE(i2c, da9052_i2c_id); + + #ifdef CONFIG_OF + static const struct of_device_id dialog_dt_ids[] = { +diff --git a/drivers/mfd/stmpe-i2c.c b/drivers/mfd/stmpe-i2c.c +index 61aa020199f5..cd2f45257dc1 100644 +--- a/drivers/mfd/stmpe-i2c.c ++++ b/drivers/mfd/stmpe-i2c.c +@@ -109,7 +109,7 @@ static const struct i2c_device_id stmpe_i2c_id[] = { + { "stmpe2403", STMPE2403 }, + { } + }; +-MODULE_DEVICE_TABLE(i2c, stmpe_id); ++MODULE_DEVICE_TABLE(i2c, stmpe_i2c_id); + + static struct i2c_driver stmpe_i2c_driver = { + .driver = { +-- +2.30.2 + diff --git a/queue-5.13/mips-always-link-byteswap-helpers-into-decompressor.patch b/queue-5.13/mips-always-link-byteswap-helpers-into-decompressor.patch new file mode 100644 index 00000000000..da7c2ea728d --- /dev/null +++ b/queue-5.13/mips-always-link-byteswap-helpers-into-decompressor.patch @@ -0,0 +1,65 @@ +From 48a11a1a82085814b7ffbfecf923693c42b8edbf Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 2 Jul 2021 16:28:37 +0200 +Subject: mips: always link byteswap helpers into decompressor + +From: Arnd Bergmann + +[ Upstream commit cddc40f5617e53f97ef019d5b29c1bd6cbb031ec ] + +My series to clean up the unaligned access implementation +across architectures caused some mips randconfig builds to +fail with: + + mips64-linux-ld: arch/mips/boot/compressed/decompress.o: in function `decompress_kernel': + decompress.c:(.text.decompress_kernel+0x54): undefined reference to `__bswapsi2' + +It turns out that this problem has already been fixed for the XZ +decompressor but now it also shows up in (at least) LZO and LZ4. From my +analysis I concluded that the compiler could always have emitted those +calls, but the different implementation allowed it to make otherwise +better decisions about not inlining the byteswap, which results in the +link error when the out-of-line code is missing. + +While it could be addressed by adding it to the two decompressor +implementations that are known to be affected, but as this only adds +112 bytes to the kernel, the safer choice is to always add them. + +Fixes: c50ec6787536 ("MIPS: zboot: Fix the build with XZ compression on older GCC versions") +Fixes: 0652035a5794 ("asm-generic: unaligned: remove byteshift helpers") +Link: https://lore.kernel.org/linux-mm/202106301304.gz2wVY9w-lkp@intel.com/ +Link: https://lore.kernel.org/linux-mm/202106260659.TyMe8mjr-lkp@intel.com/ +Link: https://lore.kernel.org/linux-mm/202106172016.onWT6Tza-lkp@intel.com/ +Link: https://lore.kernel.org/linux-mm/202105231743.JJcALnhS-lkp@intel.com/ +Signed-off-by: Arnd Bergmann +Signed-off-by: Thomas Bogendoerfer +Signed-off-by: Sasha Levin +--- + arch/mips/boot/compressed/Makefile | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile +index e4b7839293e1..3548b3b45269 100644 +--- a/arch/mips/boot/compressed/Makefile ++++ b/arch/mips/boot/compressed/Makefile +@@ -40,7 +40,7 @@ GCOV_PROFILE := n + UBSAN_SANITIZE := n + + # decompressor objects (linked with vmlinuz) +-vmlinuzobjs-y := $(obj)/head.o $(obj)/decompress.o $(obj)/string.o ++vmlinuzobjs-y := $(obj)/head.o $(obj)/decompress.o $(obj)/string.o $(obj)/bswapsi.o + + ifdef CONFIG_DEBUG_ZBOOT + vmlinuzobjs-$(CONFIG_DEBUG_ZBOOT) += $(obj)/dbg.o +@@ -54,7 +54,7 @@ extra-y += uart-ath79.c + $(obj)/uart-ath79.c: $(srctree)/arch/mips/ath79/early_printk.c + $(call cmd,shipped) + +-vmlinuzobjs-$(CONFIG_KERNEL_XZ) += $(obj)/ashldi3.o $(obj)/bswapsi.o ++vmlinuzobjs-$(CONFIG_KERNEL_XZ) += $(obj)/ashldi3.o + + extra-y += ashldi3.c + $(obj)/ashldi3.c: $(obj)/%.c: $(srctree)/lib/%.c FORCE +-- +2.30.2 + diff --git a/queue-5.13/mips-disable-branch-profiling-in-boot-decompress.o.patch b/queue-5.13/mips-disable-branch-profiling-in-boot-decompress.o.patch new file mode 100644 index 00000000000..8aff5ad3101 --- /dev/null +++ b/queue-5.13/mips-disable-branch-profiling-in-boot-decompress.o.patch @@ -0,0 +1,48 @@ +From e031d9a6e930459ac0d42b8e3d57ebb21691cae8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 4 Jul 2021 16:02:11 -0700 +Subject: mips: disable branch profiling in boot/decompress.o + +From: Randy Dunlap + +[ Upstream commit 97e488073cfca0eea84450169ca4cbfcc64e33e3 ] + +Use DISABLE_BRANCH_PROFILING for arch/mips/boot/compressed/decompress.o +to prevent linkage errors. + +mips64-linux-ld: arch/mips/boot/compressed/decompress.o: in function `LZ4_decompress_fast_extDict': +decompress.c:(.text+0x8c): undefined reference to `ftrace_likely_update' +mips64-linux-ld: decompress.c:(.text+0xf4): undefined reference to `ftrace_likely_update' +mips64-linux-ld: decompress.c:(.text+0x200): undefined reference to `ftrace_likely_update' +mips64-linux-ld: decompress.c:(.text+0x230): undefined reference to `ftrace_likely_update' +mips64-linux-ld: decompress.c:(.text+0x320): undefined reference to `ftrace_likely_update' +mips64-linux-ld: arch/mips/boot/compressed/decompress.o:decompress.c:(.text+0x3f4): more undefined references to `ftrace_likely_update' follow + +Fixes: e76e1fdfa8f8 ("lib: add support for LZ4-compressed kernel") +Reported-by: kernel test robot +Signed-off-by: Randy Dunlap +Cc: Thomas Bogendoerfer +Cc: linux-mips@vger.kernel.org +Cc: Kyungsik Lee +Signed-off-by: Thomas Bogendoerfer +Signed-off-by: Sasha Levin +--- + arch/mips/boot/compressed/decompress.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/arch/mips/boot/compressed/decompress.c b/arch/mips/boot/compressed/decompress.c +index 3d70d15ada28..aae1346a509a 100644 +--- a/arch/mips/boot/compressed/decompress.c ++++ b/arch/mips/boot/compressed/decompress.c +@@ -7,6 +7,8 @@ + * Author: Wu Zhangjin + */ + ++#define DISABLE_BRANCH_PROFILING ++ + #include + #include + #include +-- +2.30.2 + diff --git a/queue-5.13/mips-vdso-invalid-gic-access-through-vdso.patch b/queue-5.13/mips-vdso-invalid-gic-access-through-vdso.patch new file mode 100644 index 00000000000..1497d9c717b --- /dev/null +++ b/queue-5.13/mips-vdso-invalid-gic-access-through-vdso.patch @@ -0,0 +1,65 @@ +From a1e3733dab5300c82c22bb7e6b9b2d4887836c2b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 5 Jul 2021 02:03:54 +0200 +Subject: MIPS: vdso: Invalid GIC access through VDSO +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Martin Fäcknitz + +[ Upstream commit 47ce8527fbba145a7723685bc9a27d9855e06491 ] + +Accessing raw timers (currently only CLOCK_MONOTONIC_RAW) through VDSO +doesn't return the correct time when using the GIC as clock source. +The address of the GIC mapped page is in this case not calculated +correctly. The GIC mapped page is calculated from the VDSO data by +subtracting PAGE_SIZE: + + void *get_gic(const struct vdso_data *data) { + return (void __iomem *)data - PAGE_SIZE; + } + +However, the data pointer is not page aligned for raw clock sources. +This is because the VDSO data for raw clock sources (CS_RAW = 1) is +stored after the VDSO data for coarse clock sources (CS_HRES_COARSE = 0). +Therefore, only the VDSO data for CS_HRES_COARSE is page aligned: + + +--------------------+ + | | + | vd[CS_RAW] | ---+ + | vd[CS_HRES_COARSE] | | + +--------------------+ | -PAGE_SIZE + | | | + | GIC mapped page | <--+ + | | + +--------------------+ + +When __arch_get_hw_counter() is called with &vd[CS_RAW], get_gic returns +the wrong address (somewhere inside the GIC mapped page). The GIC counter +values are not returned which results in an invalid time. + +Fixes: a7f4df4e21dd ("MIPS: VDSO: Add implementations of gettimeofday() and clock_gettime()") +Signed-off-by: Martin Fäcknitz +Signed-off-by: Thomas Bogendoerfer +Signed-off-by: Sasha Levin +--- + arch/mips/include/asm/vdso/vdso.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/mips/include/asm/vdso/vdso.h b/arch/mips/include/asm/vdso/vdso.h +index 737ddfc3411c..a327ca21270e 100644 +--- a/arch/mips/include/asm/vdso/vdso.h ++++ b/arch/mips/include/asm/vdso/vdso.h +@@ -67,7 +67,7 @@ static inline const struct vdso_data *get_vdso_data(void) + + static inline void __iomem *get_gic(const struct vdso_data *data) + { +- return (void __iomem *)data - PAGE_SIZE; ++ return (void __iomem *)((unsigned long)data & PAGE_MASK) - PAGE_SIZE; + } + + #endif /* CONFIG_CLKSRC_MIPS_GIC */ +-- +2.30.2 + diff --git a/queue-5.13/misc-alcor_pci-fix-null-ptr-deref-when-there-is-no-p.patch b/queue-5.13/misc-alcor_pci-fix-null-ptr-deref-when-there-is-no-p.patch new file mode 100644 index 00000000000..1169796f2fc --- /dev/null +++ b/queue-5.13/misc-alcor_pci-fix-null-ptr-deref-when-there-is-no-p.patch @@ -0,0 +1,56 @@ +From cedf7c0d2d7aed66ad5ef4fcb271361441847443 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 13 May 2021 00:07:33 -0400 +Subject: misc: alcor_pci: fix null-ptr-deref when there is no PCI bridge + +From: Tong Zhang + +[ Upstream commit 3ce3e45cc333da707d4d6eb433574b990bcc26f5 ] + +There is an issue with the ASPM(optional) capability checking function. +A device might be attached to root complex directly, in this case, +bus->self(bridge) will be NULL, thus priv->parent_pdev is NULL. +Since alcor_pci_init_check_aspm(priv->parent_pdev) checks the PCI link's +ASPM capability and populate parent_cap_off, which will be used later by +alcor_pci_aspm_ctrl() to dynamically turn on/off device, what we can do +here is to avoid checking the capability if we are on the root complex. +This will make pdev_cap_off 0 and alcor_pci_aspm_ctrl() will simply +return when bring called, effectively disable ASPM for the device. + +[ 1.246492] BUG: kernel NULL pointer dereference, address: 00000000000000c0 +[ 1.248731] RIP: 0010:pci_read_config_byte+0x5/0x40 +[ 1.253998] Call Trace: +[ 1.254131] ? alcor_pci_find_cap_offset.isra.0+0x3a/0x100 [alcor_pci] +[ 1.254476] alcor_pci_probe+0x169/0x2d5 [alcor_pci] + +Co-developed-by: Greg Kroah-Hartman +Signed-off-by: Tong Zhang +Link: https://lore.kernel.org/r/20210513040732.1310159-1-ztong0001@gmail.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/misc/cardreader/alcor_pci.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/drivers/misc/cardreader/alcor_pci.c b/drivers/misc/cardreader/alcor_pci.c +index cd402c89189e..0a62307f7ffb 100644 +--- a/drivers/misc/cardreader/alcor_pci.c ++++ b/drivers/misc/cardreader/alcor_pci.c +@@ -139,7 +139,13 @@ static void alcor_pci_init_check_aspm(struct alcor_pci_priv *priv) + u32 val32; + + priv->pdev_cap_off = alcor_pci_find_cap_offset(priv, priv->pdev); +- priv->parent_cap_off = alcor_pci_find_cap_offset(priv, ++ /* ++ * A device might be attached to root complex directly and ++ * priv->parent_pdev will be NULL. In this case we don't check its ++ * capability and disable ASPM completely. ++ */ ++ if (!priv->parent_pdev) ++ priv->parent_cap_off = alcor_pci_find_cap_offset(priv, + priv->parent_pdev); + + if ((priv->pdev_cap_off == 0) || (priv->parent_cap_off == 0)) { +-- +2.30.2 + diff --git a/queue-5.13/misc-libmasm-module-fix-two-use-after-free-in-ibmasm.patch b/queue-5.13/misc-libmasm-module-fix-two-use-after-free-in-ibmasm.patch new file mode 100644 index 00000000000..faa91680885 --- /dev/null +++ b/queue-5.13/misc-libmasm-module-fix-two-use-after-free-in-ibmasm.patch @@ -0,0 +1,58 @@ +From 514343b929f6bb2e3bbc5be167d318c8db064329 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 26 Apr 2021 10:06:20 -0700 +Subject: misc/libmasm/module: Fix two use after free in ibmasm_init_one + +From: Lv Yunlong + +[ Upstream commit 7272b591c4cb9327c43443f67b8fbae7657dd9ae ] + +In ibmasm_init_one, it calls ibmasm_init_remote_input_dev(). +Inside ibmasm_init_remote_input_dev, mouse_dev and keybd_dev are +allocated by input_allocate_device(), and assigned to +sp->remote.mouse_dev and sp->remote.keybd_dev respectively. + +In the err_free_devices error branch of ibmasm_init_one, +mouse_dev and keybd_dev are freed by input_free_device(), and return +error. Then the execution runs into error_send_message error branch +of ibmasm_init_one, where ibmasm_free_remote_input_dev(sp) is called +to unregister the freed sp->remote.mouse_dev and sp->remote.keybd_dev. + +My patch add a "error_init_remote" label to handle the error of +ibmasm_init_remote_input_dev(), to avoid the uaf bugs. + +Signed-off-by: Lv Yunlong +Link: https://lore.kernel.org/r/20210426170620.10546-1-lyl2019@mail.ustc.edu.cn +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/misc/ibmasm/module.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/drivers/misc/ibmasm/module.c b/drivers/misc/ibmasm/module.c +index 4edad6c445d3..dc8a06c06c63 100644 +--- a/drivers/misc/ibmasm/module.c ++++ b/drivers/misc/ibmasm/module.c +@@ -111,7 +111,7 @@ static int ibmasm_init_one(struct pci_dev *pdev, const struct pci_device_id *id) + result = ibmasm_init_remote_input_dev(sp); + if (result) { + dev_err(sp->dev, "Failed to initialize remote queue\n"); +- goto error_send_message; ++ goto error_init_remote; + } + + result = ibmasm_send_driver_vpd(sp); +@@ -131,8 +131,9 @@ static int ibmasm_init_one(struct pci_dev *pdev, const struct pci_device_id *id) + return 0; + + error_send_message: +- disable_sp_interrupts(sp->base_address); + ibmasm_free_remote_input_dev(sp); ++error_init_remote: ++ disable_sp_interrupts(sp->base_address); + free_irq(sp->irq, (void *)sp); + error_request_irq: + iounmap(sp->base_address); +-- +2.30.2 + diff --git a/queue-5.13/module-correctly-exit-module_kallsyms_on_each_symbol.patch b/queue-5.13/module-correctly-exit-module_kallsyms_on_each_symbol.patch new file mode 100644 index 00000000000..b5dde4b5fce --- /dev/null +++ b/queue-5.13/module-correctly-exit-module_kallsyms_on_each_symbol.patch @@ -0,0 +1,44 @@ +From 9b92ca294c3d115efa015bf26036a2b5424e3733 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 20 May 2021 14:23:26 +0200 +Subject: module: correctly exit module_kallsyms_on_each_symbol when fn() != 0 + +From: Jon Mediero + +[ Upstream commit 2c0f0f3639562d6e38ee9705303c6457c4936eac ] + +Commit 013c1667cf78 ("kallsyms: refactor +{,module_}kallsyms_on_each_symbol") replaced the return inside the +nested loop with a break, changing the semantics of the function: the +break only exits the innermost loop, so the code continues iterating the +symbols of the next module instead of exiting. + +Fixes: 013c1667cf78 ("kallsyms: refactor {,module_}kallsyms_on_each_symbol") +Reviewed-by: Petr Mladek +Reviewed-by: Miroslav Benes +Signed-off-by: Jon Mediero +Signed-off-by: Jessica Yu +Signed-off-by: Sasha Levin +--- + kernel/module.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/kernel/module.c b/kernel/module.c +index 927d46cb8eb9..0b850188419a 100644 +--- a/kernel/module.c ++++ b/kernel/module.c +@@ -4425,9 +4425,10 @@ int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *, + ret = fn(data, kallsyms_symbol_name(kallsyms, i), + mod, kallsyms_symbol_value(sym)); + if (ret != 0) +- break; ++ goto out; + } + } ++out: + mutex_unlock(&module_mutex); + return ret; + } +-- +2.30.2 + diff --git a/queue-5.13/nfs-fix-acl-memory-leak-of-posix_acl_create.patch b/queue-5.13/nfs-fix-acl-memory-leak-of-posix_acl_create.patch new file mode 100644 index 00000000000..f1fa3d7c64a --- /dev/null +++ b/queue-5.13/nfs-fix-acl-memory-leak-of-posix_acl_create.patch @@ -0,0 +1,50 @@ +From f68f2ab69c497ca0304a4b0b883f9b35dd65e7a8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 18 Jun 2021 12:20:55 +0800 +Subject: nfs: fix acl memory leak of posix_acl_create() + +From: Gao Xiang + +[ Upstream commit 1fcb6fcd74a222d9ead54d405842fc763bb86262 ] + +When looking into another nfs xfstests report, I found acl and +default_acl in nfs3_proc_create() and nfs3_proc_mknod() error +paths are possibly leaked. Fix them in advance. + +Fixes: 013cdf1088d7 ("nfs: use generic posix ACL infrastructure for v3 Posix ACLs") +Cc: Trond Myklebust +Cc: Anna Schumaker +Cc: Christoph Hellwig +Cc: Joseph Qi +Signed-off-by: Gao Xiang +Signed-off-by: Trond Myklebust +Signed-off-by: Sasha Levin +--- + fs/nfs/nfs3proc.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c +index 5c4e23abc345..2299446b3b89 100644 +--- a/fs/nfs/nfs3proc.c ++++ b/fs/nfs/nfs3proc.c +@@ -385,7 +385,7 @@ nfs3_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr, + break; + + case NFS3_CREATE_UNCHECKED: +- goto out; ++ goto out_release_acls; + } + nfs_fattr_init(data->res.dir_attr); + nfs_fattr_init(data->res.fattr); +@@ -751,7 +751,7 @@ nfs3_proc_mknod(struct inode *dir, struct dentry *dentry, struct iattr *sattr, + break; + default: + status = -EINVAL; +- goto out; ++ goto out_release_acls; + } + + d_alias = nfs3_do_create(dir, dentry, data); +-- +2.30.2 + diff --git a/queue-5.13/nfs-fix-fscache-read-from-nfs-after-cache-error.patch b/queue-5.13/nfs-fix-fscache-read-from-nfs-after-cache-error.patch new file mode 100644 index 00000000000..df66eefa4f1 --- /dev/null +++ b/queue-5.13/nfs-fix-fscache-read-from-nfs-after-cache-error.patch @@ -0,0 +1,99 @@ +From f93376d8a79335b0771d68a9aa30dc8f8eee212f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 29 Jun 2021 13:13:57 -0400 +Subject: NFS: Fix fscache read from NFS after cache error + +From: Dave Wysochanski + +[ Upstream commit ba512c1bc3232124567a59a3995c773dc79716e8 ] + +Earlier commits refactored some NFS read code and removed +nfs_readpage_async(), but neglected to properly fixup +nfs_readpage_from_fscache_complete(). The code path is +only hit when something unusual occurs with the cachefiles +backing filesystem, such as an IO error or while a cookie +is being invalidated. + +Mark page with PG_checked if fscache IO completes in error, +unlock the page, and let the VM decide to re-issue based on +PG_uptodate. When the VM reissues the readpage, PG_checked +allows us to skip over fscache and read from the server. + +Link: https://marc.info/?l=linux-nfs&m=162498209518739 +Fixes: 1e83b173b266 ("NFS: Add nfs_pageio_complete_read() and remove nfs_readpage_async()") +Signed-off-by: Dave Wysochanski +Signed-off-by: Trond Myklebust +Signed-off-by: Sasha Levin +--- + fs/nfs/fscache.c | 18 +++++++++++++----- + fs/nfs/read.c | 5 +++-- + 2 files changed, 16 insertions(+), 7 deletions(-) + +diff --git a/fs/nfs/fscache.c b/fs/nfs/fscache.c +index c4c021c6ebbd..d743629e05e1 100644 +--- a/fs/nfs/fscache.c ++++ b/fs/nfs/fscache.c +@@ -385,12 +385,15 @@ static void nfs_readpage_from_fscache_complete(struct page *page, + "NFS: readpage_from_fscache_complete (0x%p/0x%p/%d)\n", + page, context, error); + +- /* if the read completes with an error, we just unlock the page and let +- * the VM reissue the readpage */ +- if (!error) { ++ /* ++ * If the read completes with an error, mark the page with PG_checked, ++ * unlock the page, and let the VM reissue the readpage. ++ */ ++ if (!error) + SetPageUptodate(page); +- unlock_page(page); +- } ++ else ++ SetPageChecked(page); ++ unlock_page(page); + } + + /* +@@ -405,6 +408,11 @@ int __nfs_readpage_from_fscache(struct nfs_open_context *ctx, + "NFS: readpage_from_fscache(fsc:%p/p:%p(i:%lx f:%lx)/0x%p)\n", + nfs_i_fscache(inode), page, page->index, page->flags, inode); + ++ if (PageChecked(page)) { ++ ClearPageChecked(page); ++ return 1; ++ } ++ + ret = fscache_read_or_alloc_page(nfs_i_fscache(inode), + page, + nfs_readpage_from_fscache_complete, +diff --git a/fs/nfs/read.c b/fs/nfs/read.c +index d2b6dce1f99f..4ca50b70a7b0 100644 +--- a/fs/nfs/read.c ++++ b/fs/nfs/read.c +@@ -363,13 +363,13 @@ int nfs_readpage(struct file *file, struct page *page) + } else + desc.ctx = get_nfs_open_context(nfs_file_open_context(file)); + ++ xchg(&desc.ctx->error, 0); + if (!IS_SYNC(inode)) { + ret = nfs_readpage_from_fscache(desc.ctx, inode, page); + if (ret == 0) +- goto out; ++ goto out_wait; + } + +- xchg(&desc.ctx->error, 0); + nfs_pageio_init_read(&desc.pgio, inode, false, + &nfs_async_read_completion_ops); + +@@ -379,6 +379,7 @@ int nfs_readpage(struct file *file, struct page *page) + nfs_pageio_complete_read(&desc.pgio, inode); + + ret = desc.pgio.pg_error < 0 ? desc.pgio.pg_error : 0; ++out_wait: + if (!ret) { + ret = wait_on_page_locked_killable(page); + if (!PageUptodate(page) && !ret) +-- +2.30.2 + diff --git a/queue-5.13/nfs-fix-up-inode-attribute-revalidation-timeouts.patch b/queue-5.13/nfs-fix-up-inode-attribute-revalidation-timeouts.patch new file mode 100644 index 00000000000..0534d542749 --- /dev/null +++ b/queue-5.13/nfs-fix-up-inode-attribute-revalidation-timeouts.patch @@ -0,0 +1,154 @@ +From 02cf9c0fe4bb605b1006dbb2865c5c8d795880e7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 26 Jun 2021 09:23:51 -0400 +Subject: NFS: Fix up inode attribute revalidation timeouts + +From: Trond Myklebust + +[ Upstream commit 213bb58475b57786e4336bc8bfd5029e16257c49 ] + +The inode is considered revalidated when we've checked the value of the +change attribute against our cached value since that suffices to +establish whether or not the other cached values are valid. + +Signed-off-by: Trond Myklebust +Signed-off-by: Sasha Levin +--- + fs/nfs/inode.c | 50 ++++++++++++++++---------------------------------- + 1 file changed, 16 insertions(+), 34 deletions(-) + +diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c +index 529c4099f482..327f9ae4dd3f 100644 +--- a/fs/nfs/inode.c ++++ b/fs/nfs/inode.c +@@ -2066,24 +2066,22 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) + } else { + nfsi->cache_validity |= + save_cache_validity & NFS_INO_INVALID_CHANGE; +- cache_revalidated = false; ++ if (!have_delegation || ++ (nfsi->cache_validity & NFS_INO_INVALID_CHANGE) != 0) ++ cache_revalidated = false; + } + +- if (fattr->valid & NFS_ATTR_FATTR_MTIME) { ++ if (fattr->valid & NFS_ATTR_FATTR_MTIME) + inode->i_mtime = fattr->mtime; +- } else if (fattr_supported & NFS_ATTR_FATTR_MTIME) { ++ else if (fattr_supported & NFS_ATTR_FATTR_MTIME) + nfsi->cache_validity |= + save_cache_validity & NFS_INO_INVALID_MTIME; +- cache_revalidated = false; +- } + +- if (fattr->valid & NFS_ATTR_FATTR_CTIME) { ++ if (fattr->valid & NFS_ATTR_FATTR_CTIME) + inode->i_ctime = fattr->ctime; +- } else if (fattr_supported & NFS_ATTR_FATTR_CTIME) { ++ else if (fattr_supported & NFS_ATTR_FATTR_CTIME) + nfsi->cache_validity |= + save_cache_validity & NFS_INO_INVALID_CTIME; +- cache_revalidated = false; +- } + + /* Check if our cached file size is stale */ + if (fattr->valid & NFS_ATTR_FATTR_SIZE) { +@@ -2111,19 +2109,15 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) + fattr->du.nfs3.used = 0; + fattr->valid |= NFS_ATTR_FATTR_SPACE_USED; + } +- } else { ++ } else + nfsi->cache_validity |= + save_cache_validity & NFS_INO_INVALID_SIZE; +- cache_revalidated = false; +- } + + if (fattr->valid & NFS_ATTR_FATTR_ATIME) + inode->i_atime = fattr->atime; +- else if (fattr_supported & NFS_ATTR_FATTR_ATIME) { ++ else if (fattr_supported & NFS_ATTR_FATTR_ATIME) + nfsi->cache_validity |= + save_cache_validity & NFS_INO_INVALID_ATIME; +- cache_revalidated = false; +- } + + if (fattr->valid & NFS_ATTR_FATTR_MODE) { + if ((inode->i_mode & S_IALLUGO) != (fattr->mode & S_IALLUGO)) { +@@ -2134,11 +2128,9 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) + | NFS_INO_INVALID_ACL; + attr_changed = true; + } +- } else if (fattr_supported & NFS_ATTR_FATTR_MODE) { ++ } else if (fattr_supported & NFS_ATTR_FATTR_MODE) + nfsi->cache_validity |= + save_cache_validity & NFS_INO_INVALID_MODE; +- cache_revalidated = false; +- } + + if (fattr->valid & NFS_ATTR_FATTR_OWNER) { + if (!uid_eq(inode->i_uid, fattr->uid)) { +@@ -2147,11 +2139,9 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) + inode->i_uid = fattr->uid; + attr_changed = true; + } +- } else if (fattr_supported & NFS_ATTR_FATTR_OWNER) { ++ } else if (fattr_supported & NFS_ATTR_FATTR_OWNER) + nfsi->cache_validity |= + save_cache_validity & NFS_INO_INVALID_OTHER; +- cache_revalidated = false; +- } + + if (fattr->valid & NFS_ATTR_FATTR_GROUP) { + if (!gid_eq(inode->i_gid, fattr->gid)) { +@@ -2160,11 +2150,9 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) + inode->i_gid = fattr->gid; + attr_changed = true; + } +- } else if (fattr_supported & NFS_ATTR_FATTR_GROUP) { ++ } else if (fattr_supported & NFS_ATTR_FATTR_GROUP) + nfsi->cache_validity |= + save_cache_validity & NFS_INO_INVALID_OTHER; +- cache_revalidated = false; +- } + + if (fattr->valid & NFS_ATTR_FATTR_NLINK) { + if (inode->i_nlink != fattr->nlink) { +@@ -2173,30 +2161,24 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) + set_nlink(inode, fattr->nlink); + attr_changed = true; + } +- } else if (fattr_supported & NFS_ATTR_FATTR_NLINK) { ++ } else if (fattr_supported & NFS_ATTR_FATTR_NLINK) + nfsi->cache_validity |= + save_cache_validity & NFS_INO_INVALID_NLINK; +- cache_revalidated = false; +- } + + if (fattr->valid & NFS_ATTR_FATTR_SPACE_USED) { + /* + * report the blocks in 512byte units + */ + inode->i_blocks = nfs_calc_block_size(fattr->du.nfs3.used); +- } else if (fattr_supported & NFS_ATTR_FATTR_SPACE_USED) { ++ } else if (fattr_supported & NFS_ATTR_FATTR_SPACE_USED) + nfsi->cache_validity |= + save_cache_validity & NFS_INO_INVALID_BLOCKS; +- cache_revalidated = false; +- } + +- if (fattr->valid & NFS_ATTR_FATTR_BLOCKS_USED) { ++ if (fattr->valid & NFS_ATTR_FATTR_BLOCKS_USED) + inode->i_blocks = fattr->du.nfs2.blocks; +- } else if (fattr_supported & NFS_ATTR_FATTR_BLOCKS_USED) { ++ else if (fattr_supported & NFS_ATTR_FATTR_BLOCKS_USED) + nfsi->cache_validity |= + save_cache_validity & NFS_INO_INVALID_BLOCKS; +- cache_revalidated = false; +- } + + /* Update attrtimeo value if we're out of the unstable period */ + if (attr_changed) { +-- +2.30.2 + diff --git a/queue-5.13/nfs-nfs_find_open_context-may-only-select-open-files.patch b/queue-5.13/nfs-nfs_find_open_context-may-only-select-open-files.patch new file mode 100644 index 00000000000..9d0f703a358 --- /dev/null +++ b/queue-5.13/nfs-nfs_find_open_context-may-only-select-open-files.patch @@ -0,0 +1,64 @@ +From cd7134ab0968b46a5bcd7fe621cfd5a4022957ad Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 11 May 2021 23:41:10 -0400 +Subject: NFS: nfs_find_open_context() may only select open files + +From: Trond Myklebust + +[ Upstream commit e97bc66377bca097e1f3349ca18ca17f202ff659 ] + +If a file has already been closed, then it should not be selected to +support further I/O. + +Signed-off-by: Trond Myklebust +[Trond: Fix an invalid pointer deref reported by Colin Ian King] +Signed-off-by: Sasha Levin +--- + fs/nfs/inode.c | 4 ++++ + include/linux/nfs_fs.h | 1 + + 2 files changed, 5 insertions(+) + +diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c +index 327f9ae4dd3f..1acae1716df1 100644 +--- a/fs/nfs/inode.c ++++ b/fs/nfs/inode.c +@@ -1101,6 +1101,7 @@ EXPORT_SYMBOL_GPL(nfs_inode_attach_open_context); + void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx) + { + filp->private_data = get_nfs_open_context(ctx); ++ set_bit(NFS_CONTEXT_FILE_OPEN, &ctx->flags); + if (list_empty(&ctx->list)) + nfs_inode_attach_open_context(ctx); + } +@@ -1120,6 +1121,8 @@ struct nfs_open_context *nfs_find_open_context(struct inode *inode, const struct + continue; + if ((pos->mode & (FMODE_READ|FMODE_WRITE)) != mode) + continue; ++ if (!test_bit(NFS_CONTEXT_FILE_OPEN, &pos->flags)) ++ continue; + ctx = get_nfs_open_context(pos); + if (ctx) + break; +@@ -1135,6 +1138,7 @@ void nfs_file_clear_open_context(struct file *filp) + if (ctx) { + struct inode *inode = d_inode(ctx->dentry); + ++ clear_bit(NFS_CONTEXT_FILE_OPEN, &ctx->flags); + /* + * We fatal error on write before. Try to writeback + * every page again. +diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h +index ffba254d2098..ce6474594872 100644 +--- a/include/linux/nfs_fs.h ++++ b/include/linux/nfs_fs.h +@@ -84,6 +84,7 @@ struct nfs_open_context { + #define NFS_CONTEXT_RESEND_WRITES (1) + #define NFS_CONTEXT_BAD (2) + #define NFS_CONTEXT_UNLOCK (3) ++#define NFS_CONTEXT_FILE_OPEN (4) + int error; + + struct list_head list; +-- +2.30.2 + diff --git a/queue-5.13/nfs-update-has_sec_mnt_opts-after-cloning-lsm-option.patch b/queue-5.13/nfs-update-has_sec_mnt_opts-after-cloning-lsm-option.patch new file mode 100644 index 00000000000..b04b4a9a138 --- /dev/null +++ b/queue-5.13/nfs-update-has_sec_mnt_opts-after-cloning-lsm-option.patch @@ -0,0 +1,86 @@ +From c0880cad64880019e9d11da9d86a7ae38b92e9c8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 22 Jun 2021 08:11:59 -0400 +Subject: nfs: update has_sec_mnt_opts after cloning lsm options from parent + +From: Scott Mayhew + +[ Upstream commit eae00c5d6e48ccb2d78ae5873743d7d1a572951b ] + +After calling security_sb_clone_mnt_opts() in nfs_get_root(), it's +necessary to copy the value of has_sec_mnt_opts from the cloned +super_block's nfs_server. Otherwise, calls to nfs_compare_super() +using this super_block may not return the correct result, leading to +mount failures. + +For example, mounting an nfs server with the following in /etc/exports: +/export *(rw,insecure,crossmnt,no_root_squash,security_label) +and having /export/scratch on a separate block device. + +mount -o v4.2,context=system_u:object_r:root_t:s0 server:/export/test /mnt/test +mount -o v4.2,context=system_u:object_r:swapfile_t:s0 server:/export/scratch /mnt/scratch + +The second mount would fail with "mount.nfs: /mnt/scratch is busy or +already mounted or sharecache fail" and "SELinux: mount invalid. Same +superblock, different security settings for..." would appear in the +syslog. + +Also while we're in there, replace several instances of "NFS_SB(s)" +with "server", which was already declared at the top of the +nfs_get_root(). + +Fixes: ec1ade6a0448 ("nfs: account for selinux security context when deciding to share superblock") +Signed-off-by: Scott Mayhew +Signed-off-by: Trond Myklebust +Signed-off-by: Sasha Levin +--- + fs/nfs/getroot.c | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +diff --git a/fs/nfs/getroot.c b/fs/nfs/getroot.c +index aaeeb4659bff..59355c106ece 100644 +--- a/fs/nfs/getroot.c ++++ b/fs/nfs/getroot.c +@@ -67,7 +67,7 @@ static int nfs_superblock_set_dummy_root(struct super_block *sb, struct inode *i + int nfs_get_root(struct super_block *s, struct fs_context *fc) + { + struct nfs_fs_context *ctx = nfs_fc2context(fc); +- struct nfs_server *server = NFS_SB(s); ++ struct nfs_server *server = NFS_SB(s), *clone_server; + struct nfs_fsinfo fsinfo; + struct dentry *root; + struct inode *inode; +@@ -127,7 +127,7 @@ int nfs_get_root(struct super_block *s, struct fs_context *fc) + } + spin_unlock(&root->d_lock); + fc->root = root; +- if (NFS_SB(s)->caps & NFS_CAP_SECURITY_LABEL) ++ if (server->caps & NFS_CAP_SECURITY_LABEL) + kflags |= SECURITY_LSM_NATIVE_LABELS; + if (ctx->clone_data.sb) { + if (d_inode(fc->root)->i_fop != &nfs_dir_operations) { +@@ -137,15 +137,19 @@ int nfs_get_root(struct super_block *s, struct fs_context *fc) + /* clone lsm security options from the parent to the new sb */ + error = security_sb_clone_mnt_opts(ctx->clone_data.sb, + s, kflags, &kflags_out); ++ if (error) ++ goto error_splat_root; ++ clone_server = NFS_SB(ctx->clone_data.sb); ++ server->has_sec_mnt_opts = clone_server->has_sec_mnt_opts; + } else { + error = security_sb_set_mnt_opts(s, fc->security, + kflags, &kflags_out); + } + if (error) + goto error_splat_root; +- if (NFS_SB(s)->caps & NFS_CAP_SECURITY_LABEL && ++ if (server->caps & NFS_CAP_SECURITY_LABEL && + !(kflags_out & SECURITY_LSM_NATIVE_LABELS)) +- NFS_SB(s)->caps &= ~NFS_CAP_SECURITY_LABEL; ++ server->caps &= ~NFS_CAP_SECURITY_LABEL; + + nfs_setsecurity(inode, fsinfo.fattr, fsinfo.fattr->label); + error = 0; +-- +2.30.2 + diff --git a/queue-5.13/nfsd-add-nfsd_clid_confirmed-tracepoint.patch b/queue-5.13/nfsd-add-nfsd_clid_confirmed-tracepoint.patch new file mode 100644 index 00000000000..2d23930ae19 --- /dev/null +++ b/queue-5.13/nfsd-add-nfsd_clid_confirmed-tracepoint.patch @@ -0,0 +1,67 @@ +From 2a64fca4d8fe001c7e2f4b23835b7f778f98750d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 14 May 2021 15:55:48 -0400 +Subject: NFSD: Add nfsd_clid_confirmed tracepoint + +From: Chuck Lever + +[ Upstream commit 7e3b32ace6094aadfa2e1e54ca4c6bbfd07646af ] + +This replaces a dprintk call site in order to get greater visibility +on when client IDs are confirmed or re-used. Simple example: + + nfsd-995 [000] 126.622975: nfsd_compound: xid=0x3a34e2b1 opcnt=1 + nfsd-995 [000] 126.623005: nfsd_cb_args: addr=192.168.2.51:45901 client 60958e3b:9213ef0e prog=1073741824 ident=1 + nfsd-995 [000] 126.623007: nfsd_compound_status: op=1/1 OP_SETCLIENTID status=0 + nfsd-996 [001] 126.623142: nfsd_compound: xid=0x3b34e2b1 opcnt=1 + >>>> nfsd-996 [001] 126.623146: nfsd_clid_confirmed: client 60958e3b:9213ef0e + nfsd-996 [001] 126.623148: nfsd_cb_probe: addr=192.168.2.51:45901 client 60958e3b:9213ef0e state=UNKNOWN + nfsd-996 [001] 126.623154: nfsd_compound_status: op=1/1 OP_SETCLIENTID_CONFIRM status=0 + +Signed-off-by: Chuck Lever +Signed-off-by: J. Bruce Fields +Signed-off-by: Sasha Levin +--- + fs/nfsd/nfs4state.c | 10 +++++----- + fs/nfsd/trace.h | 1 + + 2 files changed, 6 insertions(+), 5 deletions(-) + +diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c +index 6abe48dee6ed..67ebb040bc5f 100644 +--- a/fs/nfsd/nfs4state.c ++++ b/fs/nfsd/nfs4state.c +@@ -2816,14 +2816,14 @@ move_to_confirmed(struct nfs4_client *clp) + + lockdep_assert_held(&nn->client_lock); + +- dprintk("NFSD: move_to_confirm nfs4_client %p\n", clp); + list_move(&clp->cl_idhash, &nn->conf_id_hashtbl[idhashval]); + rb_erase(&clp->cl_namenode, &nn->unconf_name_tree); + add_clp_to_name_tree(clp, &nn->conf_name_tree); +- if (!test_and_set_bit(NFSD4_CLIENT_CONFIRMED, &clp->cl_flags) && +- clp->cl_nfsd_dentry && +- clp->cl_nfsd_info_dentry) +- fsnotify_dentry(clp->cl_nfsd_info_dentry, FS_MODIFY); ++ if (!test_and_set_bit(NFSD4_CLIENT_CONFIRMED, &clp->cl_flags)) { ++ trace_nfsd_clid_confirmed(&clp->cl_clientid); ++ if (clp->cl_nfsd_dentry && clp->cl_nfsd_info_dentry) ++ fsnotify_dentry(clp->cl_nfsd_info_dentry, FS_MODIFY); ++ } + renew_client_locked(clp); + } + +diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h +index 42ad2a02f953..e7a269291a73 100644 +--- a/fs/nfsd/trace.h ++++ b/fs/nfsd/trace.h +@@ -511,6 +511,7 @@ DEFINE_EVENT(nfsd_clientid_class, nfsd_clid_##name, \ + TP_PROTO(const clientid_t *clid), \ + TP_ARGS(clid)) + ++DEFINE_CLIENTID_EVENT(confirmed); + DEFINE_CLIENTID_EVENT(expired); + DEFINE_CLIENTID_EVENT(purged); + DEFINE_CLIENTID_EVENT(renew); +-- +2.30.2 + diff --git a/queue-5.13/nfsd-fix-null-dereference-in-nfs3svc_encode_getaclre.patch b/queue-5.13/nfsd-fix-null-dereference-in-nfs3svc_encode_getaclre.patch new file mode 100644 index 00000000000..e3694c4f19a --- /dev/null +++ b/queue-5.13/nfsd-fix-null-dereference-in-nfs3svc_encode_getaclre.patch @@ -0,0 +1,53 @@ +From 0ff43d4166dbfcd19a09b959aa323ecf179e88b8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 1 Jul 2021 20:06:56 -0400 +Subject: nfsd: fix NULL dereference in nfs3svc_encode_getaclres + +From: J. Bruce Fields + +[ Upstream commit ab1016d39cc052064e32f25ad18ef8767a0ee3b8 ] + +In error cases the dentry may be NULL. + +Before 20798dfe249a, the encoder also checked dentry and +d_really_is_positive(dentry), but that looks like overkill to me--zero +status should be enough to guarantee a positive dentry. + +This isn't the first time we've seen an error-case NULL dereference +hidden in the initialization of a local variable in an xdr encoder. But +I went back through the other recent rewrites and didn't spot any +similar bugs. + +Reported-by: JianHong Yin +Reviewed-by: Chuck Lever III +Fixes: 20798dfe249a ("NFSD: Update the NFSv3 GETACL result encoder...") +Signed-off-by: J. Bruce Fields +Signed-off-by: Sasha Levin +--- + fs/nfsd/nfs3acl.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/fs/nfsd/nfs3acl.c b/fs/nfsd/nfs3acl.c +index a1591feeea22..5dfe7644a517 100644 +--- a/fs/nfsd/nfs3acl.c ++++ b/fs/nfsd/nfs3acl.c +@@ -172,7 +172,7 @@ static int nfs3svc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p) + struct nfsd3_getaclres *resp = rqstp->rq_resp; + struct dentry *dentry = resp->fh.fh_dentry; + struct kvec *head = rqstp->rq_res.head; +- struct inode *inode = d_inode(dentry); ++ struct inode *inode; + unsigned int base; + int n; + int w; +@@ -181,6 +181,7 @@ static int nfs3svc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p) + return 0; + switch (resp->status) { + case nfs_ok: ++ inode = d_inode(dentry); + if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh)) + return 0; + if (xdr_stream_encode_u32(xdr, resp->mask) < 0) +-- +2.30.2 + diff --git a/queue-5.13/nfsd-fix-tp_printk-format-specifier-in-nfsd_clid_cla.patch b/queue-5.13/nfsd-fix-tp_printk-format-specifier-in-nfsd_clid_cla.patch new file mode 100644 index 00000000000..a22ce798896 --- /dev/null +++ b/queue-5.13/nfsd-fix-tp_printk-format-specifier-in-nfsd_clid_cla.patch @@ -0,0 +1,90 @@ +From 9b2c153394858f06cfe2d53809eba3a9abd76cf7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 14 May 2021 15:55:17 -0400 +Subject: NFSD: Fix TP_printk() format specifier in nfsd_clid_class + +From: Chuck Lever + +[ Upstream commit a948b1142cae66785521a389cab2cce74069b547 ] + +Since commit 9a6944fee68e ("tracing: Add a verifier to check string +pointers for trace events"), which was merged in v5.13-rc1, +TP_printk() no longer tacitly supports the "%.*s" format specifier. + +These are low value tracepoints, so just remove them. + +Reported-by: David Wysochanski +Fixes: dd5e3fbc1f47 ("NFSD: Add tracepoints to the NFSD state management code") +Signed-off-by: Chuck Lever +Cc: Steven Rostedt +Signed-off-by: J. Bruce Fields +Signed-off-by: Sasha Levin +--- + fs/nfsd/nfs4state.c | 3 --- + fs/nfsd/trace.h | 29 ----------------------------- + 2 files changed, 32 deletions(-) + +diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c +index b517a8794400..6abe48dee6ed 100644 +--- a/fs/nfsd/nfs4state.c ++++ b/fs/nfsd/nfs4state.c +@@ -7229,7 +7229,6 @@ nfs4_client_to_reclaim(struct xdr_netobj name, struct xdr_netobj princhash, + unsigned int strhashval; + struct nfs4_client_reclaim *crp; + +- trace_nfsd_clid_reclaim(nn, name.len, name.data); + crp = alloc_reclaim(); + if (crp) { + strhashval = clientstr_hashval(name); +@@ -7279,8 +7278,6 @@ nfsd4_find_reclaim_client(struct xdr_netobj name, struct nfsd_net *nn) + unsigned int strhashval; + struct nfs4_client_reclaim *crp = NULL; + +- trace_nfsd_clid_find(nn, name.len, name.data); +- + strhashval = clientstr_hashval(name); + list_for_each_entry(crp, &nn->reclaim_str_hashtbl[strhashval], cr_strhash) { + if (compare_blob(&crp->cr_name, &name) == 0) { +diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h +index 27a93ebd1d80..42ad2a02f953 100644 +--- a/fs/nfsd/trace.h ++++ b/fs/nfsd/trace.h +@@ -536,35 +536,6 @@ DEFINE_EVENT(nfsd_net_class, nfsd_##name, \ + DEFINE_NET_EVENT(grace_start); + DEFINE_NET_EVENT(grace_complete); + +-DECLARE_EVENT_CLASS(nfsd_clid_class, +- TP_PROTO(const struct nfsd_net *nn, +- unsigned int namelen, +- const unsigned char *namedata), +- TP_ARGS(nn, namelen, namedata), +- TP_STRUCT__entry( +- __field(unsigned long long, boot_time) +- __field(unsigned int, namelen) +- __dynamic_array(unsigned char, name, namelen) +- ), +- TP_fast_assign( +- __entry->boot_time = nn->boot_time; +- __entry->namelen = namelen; +- memcpy(__get_dynamic_array(name), namedata, namelen); +- ), +- TP_printk("boot_time=%16llx nfs4_clientid=%.*s", +- __entry->boot_time, __entry->namelen, __get_str(name)) +-) +- +-#define DEFINE_CLID_EVENT(name) \ +-DEFINE_EVENT(nfsd_clid_class, nfsd_clid_##name, \ +- TP_PROTO(const struct nfsd_net *nn, \ +- unsigned int namelen, \ +- const unsigned char *namedata), \ +- TP_ARGS(nn, namelen, namedata)) +- +-DEFINE_CLID_EVENT(find); +-DEFINE_CLID_EVENT(reclaim); +- + TRACE_EVENT(nfsd_clid_inuse_err, + TP_PROTO(const struct nfs4_client *clp), + TP_ARGS(clp), +-- +2.30.2 + diff --git a/queue-5.13/nfsd-move-fsnotify-on-client-creation-outside-spinlo.patch b/queue-5.13/nfsd-move-fsnotify-on-client-creation-outside-spinlo.patch new file mode 100644 index 00000000000..9861cfd6897 --- /dev/null +++ b/queue-5.13/nfsd-move-fsnotify-on-client-creation-outside-spinlo.patch @@ -0,0 +1,64 @@ +From ba14db48075963abfcd4fd1160d7b04561cb9898 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 25 May 2021 14:53:44 -0400 +Subject: nfsd: move fsnotify on client creation outside spinlock + +From: J. Bruce Fields + +[ Upstream commit 934bd07fae7e55232845f909f78873ab8678ca74 ] + +This was causing a "sleeping function called from invalid context" +warning. + +I don't think we need the set_and_test_bit() here; clients move from +unconfirmed to confirmed only once, under the client_lock. + +The (conf == unconf) is a way to check whether we're in that confirming +case, hopefully that's not too obscure. + +Fixes: 472d155a0631 "nfsd: report client confirmation status in "info" file" +Signed-off-by: J. Bruce Fields +Signed-off-by: Sasha Levin +--- + fs/nfsd/nfs4state.c | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c +index 67ebb040bc5f..90e81f6491ff 100644 +--- a/fs/nfsd/nfs4state.c ++++ b/fs/nfsd/nfs4state.c +@@ -2819,11 +2819,8 @@ move_to_confirmed(struct nfs4_client *clp) + list_move(&clp->cl_idhash, &nn->conf_id_hashtbl[idhashval]); + rb_erase(&clp->cl_namenode, &nn->unconf_name_tree); + add_clp_to_name_tree(clp, &nn->conf_name_tree); +- if (!test_and_set_bit(NFSD4_CLIENT_CONFIRMED, &clp->cl_flags)) { +- trace_nfsd_clid_confirmed(&clp->cl_clientid); +- if (clp->cl_nfsd_dentry && clp->cl_nfsd_info_dentry) +- fsnotify_dentry(clp->cl_nfsd_info_dentry, FS_MODIFY); +- } ++ set_bit(NFSD4_CLIENT_CONFIRMED, &clp->cl_flags); ++ trace_nfsd_clid_confirmed(&clp->cl_clientid); + renew_client_locked(clp); + } + +@@ -3471,6 +3468,8 @@ nfsd4_create_session(struct svc_rqst *rqstp, + /* cache solo and embedded create sessions under the client_lock */ + nfsd4_cache_create_session(cr_ses, cs_slot, status); + spin_unlock(&nn->client_lock); ++ if (conf == unconf) ++ fsnotify_dentry(conf->cl_nfsd_info_dentry, FS_MODIFY); + /* init connection and backchannel */ + nfsd4_init_conn(rqstp, conn, new); + nfsd4_put_session(new); +@@ -4071,6 +4070,8 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp, + } + get_client_locked(conf); + spin_unlock(&nn->client_lock); ++ if (conf == unconf) ++ fsnotify_dentry(conf->cl_nfsd_info_dentry, FS_MODIFY); + nfsd4_probe_callback(conf); + spin_lock(&nn->client_lock); + put_client_renew_locked(conf); +-- +2.30.2 + diff --git a/queue-5.13/nfsd-prevent-a-possible-oops-in-the-nfs_dirent-trace.patch b/queue-5.13/nfsd-prevent-a-possible-oops-in-the-nfs_dirent-trace.patch new file mode 100644 index 00000000000..7eeb9f74d25 --- /dev/null +++ b/queue-5.13/nfsd-prevent-a-possible-oops-in-the-nfs_dirent-trace.patch @@ -0,0 +1,36 @@ +From d537168c1187542bdaaf231e3ae8d37beae14c60 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 25 Jun 2021 11:12:49 -0400 +Subject: NFSD: Prevent a possible oops in the nfs_dirent() tracepoint + +From: Chuck Lever + +[ Upstream commit 7b08cf62b1239a4322427d677ea9363f0ab677c6 ] + +The double copy of the string is a mistake, plus __assign_str() +uses strlen(), which is wrong to do on a string that isn't +guaranteed to be NUL-terminated. + +Fixes: 6019ce0742ca ("NFSD: Add a tracepoint to record directory entry encoding") +Signed-off-by: Chuck Lever +Signed-off-by: J. Bruce Fields +Signed-off-by: Sasha Levin +--- + fs/nfsd/trace.h | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h +index e7a269291a73..f3961506fe16 100644 +--- a/fs/nfsd/trace.h ++++ b/fs/nfsd/trace.h +@@ -408,7 +408,6 @@ TRACE_EVENT(nfsd_dirent, + __entry->ino = ino; + __entry->len = namlen; + memcpy(__get_str(name), name, namlen); +- __assign_str(name, name); + ), + TP_printk("fh_hash=0x%08x ino=%llu name=%.*s", + __entry->fh_hash, __entry->ino, +-- +2.30.2 + diff --git a/queue-5.13/nfsd-reduce-contention-for-the-nfsd_file-nf_rwsem.patch b/queue-5.13/nfsd-reduce-contention-for-the-nfsd_file-nf_rwsem.patch new file mode 100644 index 00000000000..0f36ea3346c --- /dev/null +++ b/queue-5.13/nfsd-reduce-contention-for-the-nfsd_file-nf_rwsem.patch @@ -0,0 +1,66 @@ +From 4d4cc15f278160bf3e36b1efe901c61870c2bf24 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 17 Jun 2021 19:26:52 -0400 +Subject: nfsd: Reduce contention for the nfsd_file nf_rwsem + +From: Trond Myklebust + +[ Upstream commit 474bc334698df98ce07c890f1898c7e7f389b0c7 ] + +When flushing out the unstable file writes as part of a COMMIT call, try +to perform most of of the data writes and waits outside the semaphore. + +This means that if the client is sending the COMMIT as part of a memory +reclaim operation, then it can continue performing I/O, with contention +for the lock occurring only once the data sync is finished. + +Fixes: 5011af4c698a ("nfsd: Fix stable writes") +Signed-off-by: Trond Myklebust + Tested-by: Chuck Lever +Signed-off-by: J. Bruce Fields +Signed-off-by: Sasha Levin +--- + fs/nfsd/vfs.c | 18 ++++++++++++++++-- + 1 file changed, 16 insertions(+), 2 deletions(-) + +diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c +index 15adf1f6ab21..46485c04740d 100644 +--- a/fs/nfsd/vfs.c ++++ b/fs/nfsd/vfs.c +@@ -1123,6 +1123,19 @@ out: + } + + #ifdef CONFIG_NFSD_V3 ++static int ++nfsd_filemap_write_and_wait_range(struct nfsd_file *nf, loff_t offset, ++ loff_t end) ++{ ++ struct address_space *mapping = nf->nf_file->f_mapping; ++ int ret = filemap_fdatawrite_range(mapping, offset, end); ++ ++ if (ret) ++ return ret; ++ filemap_fdatawait_range_keep_errors(mapping, offset, end); ++ return 0; ++} ++ + /* + * Commit all pending writes to stable storage. + * +@@ -1153,10 +1166,11 @@ nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp, + if (err) + goto out; + if (EX_ISSYNC(fhp->fh_export)) { +- int err2; ++ int err2 = nfsd_filemap_write_and_wait_range(nf, offset, end); + + down_write(&nf->nf_rwsem); +- err2 = vfs_fsync_range(nf->nf_file, offset, end, 0); ++ if (!err2) ++ err2 = vfs_fsync_range(nf->nf_file, offset, end, 0); + switch (err2) { + case 0: + nfsd_copy_boot_verifier(verf, net_generic(nf->nf_net, +-- +2.30.2 + diff --git a/queue-5.13/nfsv4-fix-an-oops-in-pnfs_mark_request_commit-when-d.patch b/queue-5.13/nfsv4-fix-an-oops-in-pnfs_mark_request_commit-when-d.patch new file mode 100644 index 00000000000..e7ee37730f0 --- /dev/null +++ b/queue-5.13/nfsv4-fix-an-oops-in-pnfs_mark_request_commit-when-d.patch @@ -0,0 +1,72 @@ +From 2d366ed43600c011603dcc3bfaff243d6bebe3d9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 11 Jun 2021 13:40:55 -0400 +Subject: NFSv4: Fix an Oops in pnfs_mark_request_commit() when doing O_DIRECT + +From: Trond Myklebust + +[ Upstream commit 3731d44bba8e0116b052b1b374476c5f6dd9a456 ] + +Fix an Oopsable condition in pnfs_mark_request_commit() when we're +putting a set of writes on the commit list to reschedule them after a +failed pNFS attempt. + +Fixes: 9c455a8c1e14 ("NFS/pNFS: Clean up pNFS commit operations") +Signed-off-by: Trond Myklebust +Signed-off-by: Sasha Levin +--- + fs/nfs/direct.c | 17 +++++++---------- + 1 file changed, 7 insertions(+), 10 deletions(-) + +diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c +index 2d30a4da49fa..2e894fec036b 100644 +--- a/fs/nfs/direct.c ++++ b/fs/nfs/direct.c +@@ -700,8 +700,8 @@ static void nfs_direct_write_completion(struct nfs_pgio_header *hdr) + { + struct nfs_direct_req *dreq = hdr->dreq; + struct nfs_commit_info cinfo; +- bool request_commit = false; + struct nfs_page *req = nfs_list_entry(hdr->pages.next); ++ int flags = NFS_ODIRECT_DONE; + + nfs_init_cinfo_from_dreq(&cinfo, dreq); + +@@ -713,15 +713,9 @@ static void nfs_direct_write_completion(struct nfs_pgio_header *hdr) + + nfs_direct_count_bytes(dreq, hdr); + if (hdr->good_bytes != 0 && nfs_write_need_commit(hdr)) { +- switch (dreq->flags) { +- case 0: ++ if (!dreq->flags) + dreq->flags = NFS_ODIRECT_DO_COMMIT; +- request_commit = true; +- break; +- case NFS_ODIRECT_RESCHED_WRITES: +- case NFS_ODIRECT_DO_COMMIT: +- request_commit = true; +- } ++ flags = dreq->flags; + } + spin_unlock(&dreq->lock); + +@@ -729,12 +723,15 @@ static void nfs_direct_write_completion(struct nfs_pgio_header *hdr) + + req = nfs_list_entry(hdr->pages.next); + nfs_list_remove_request(req); +- if (request_commit) { ++ if (flags == NFS_ODIRECT_DO_COMMIT) { + kref_get(&req->wb_kref); + memcpy(&req->wb_verf, &hdr->verf.verifier, + sizeof(req->wb_verf)); + nfs_mark_request_commit(req, hdr->lseg, &cinfo, + hdr->ds_commit_idx); ++ } else if (flags == NFS_ODIRECT_RESCHED_WRITES) { ++ kref_get(&req->wb_kref); ++ nfs_mark_request_commit(req, NULL, &cinfo, 0); + } + nfs_unlock_and_release_request(req); + } +-- +2.30.2 + diff --git a/queue-5.13/nfsv4-fix-delegation-return-in-cases-where-we-have-t.patch b/queue-5.13/nfsv4-fix-delegation-return-in-cases-where-we-have-t.patch new file mode 100644 index 00000000000..fb9588eb53e --- /dev/null +++ b/queue-5.13/nfsv4-fix-delegation-return-in-cases-where-we-have-t.patch @@ -0,0 +1,185 @@ +From aa4a3d49dc07c2a29113064900eead88f1411805 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 8 May 2021 10:01:32 -0400 +Subject: NFSv4: Fix delegation return in cases where we have to retry + +From: Trond Myklebust + +[ Upstream commit be20037725d17935ec669044bd2b15bc40c3b5ab ] + +If we're unable to immediately recover all locks because the server is +unable to immediately service our reclaim calls, then we want to retry +after we've finished servicing all the other asynchronous delegation +returns on our queue. + +Signed-off-by: Trond Myklebust +Signed-off-by: Sasha Levin +--- + fs/nfs/delegation.c | 71 +++++++++++++++++++++++++++++++++++---------- + fs/nfs/delegation.h | 1 + + fs/nfs/nfs4_fs.h | 1 + + 3 files changed, 58 insertions(+), 15 deletions(-) + +diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c +index e6ec6f09ac6e..7c45ac3c3b0b 100644 +--- a/fs/nfs/delegation.c ++++ b/fs/nfs/delegation.c +@@ -75,6 +75,13 @@ void nfs_mark_delegation_referenced(struct nfs_delegation *delegation) + set_bit(NFS_DELEGATION_REFERENCED, &delegation->flags); + } + ++static void nfs_mark_return_delegation(struct nfs_server *server, ++ struct nfs_delegation *delegation) ++{ ++ set_bit(NFS_DELEGATION_RETURN, &delegation->flags); ++ set_bit(NFS4CLNT_DELEGRETURN, &server->nfs_client->cl_state); ++} ++ + static bool + nfs4_is_valid_delegation(const struct nfs_delegation *delegation, + fmode_t flags) +@@ -293,6 +300,7 @@ nfs_start_delegation_return_locked(struct nfs_inode *nfsi) + goto out; + spin_lock(&delegation->lock); + if (!test_and_set_bit(NFS_DELEGATION_RETURNING, &delegation->flags)) { ++ clear_bit(NFS_DELEGATION_RETURN_DELAYED, &delegation->flags); + /* Refcount matched in nfs_end_delegation_return() */ + ret = nfs_get_delegation(delegation); + } +@@ -314,16 +322,17 @@ nfs_start_delegation_return(struct nfs_inode *nfsi) + return delegation; + } + +-static void +-nfs_abort_delegation_return(struct nfs_delegation *delegation, +- struct nfs_client *clp) ++static void nfs_abort_delegation_return(struct nfs_delegation *delegation, ++ struct nfs_client *clp, int err) + { + + spin_lock(&delegation->lock); + clear_bit(NFS_DELEGATION_RETURNING, &delegation->flags); +- set_bit(NFS_DELEGATION_RETURN, &delegation->flags); ++ if (err == -EAGAIN) { ++ set_bit(NFS_DELEGATION_RETURN_DELAYED, &delegation->flags); ++ set_bit(NFS4CLNT_DELEGRETURN_DELAYED, &clp->cl_state); ++ } + spin_unlock(&delegation->lock); +- set_bit(NFS4CLNT_DELEGRETURN, &clp->cl_state); + } + + static struct nfs_delegation * +@@ -539,7 +548,7 @@ static int nfs_end_delegation_return(struct inode *inode, struct nfs_delegation + } while (err == 0); + + if (err) { +- nfs_abort_delegation_return(delegation, clp); ++ nfs_abort_delegation_return(delegation, clp, err); + goto out; + } + +@@ -568,6 +577,7 @@ static bool nfs_delegation_need_return(struct nfs_delegation *delegation) + if (ret) + clear_bit(NFS_DELEGATION_RETURN_IF_CLOSED, &delegation->flags); + if (test_bit(NFS_DELEGATION_RETURNING, &delegation->flags) || ++ test_bit(NFS_DELEGATION_RETURN_DELAYED, &delegation->flags) || + test_bit(NFS_DELEGATION_REVOKED, &delegation->flags)) + ret = false; + +@@ -647,6 +657,38 @@ out: + return err; + } + ++static bool nfs_server_clear_delayed_delegations(struct nfs_server *server) ++{ ++ struct nfs_delegation *d; ++ bool ret = false; ++ ++ list_for_each_entry_rcu (d, &server->delegations, super_list) { ++ if (!test_bit(NFS_DELEGATION_RETURN_DELAYED, &d->flags)) ++ continue; ++ nfs_mark_return_delegation(server, d); ++ clear_bit(NFS_DELEGATION_RETURN_DELAYED, &d->flags); ++ ret = true; ++ } ++ return ret; ++} ++ ++static bool nfs_client_clear_delayed_delegations(struct nfs_client *clp) ++{ ++ struct nfs_server *server; ++ bool ret = false; ++ ++ if (!test_and_clear_bit(NFS4CLNT_DELEGRETURN_DELAYED, &clp->cl_state)) ++ goto out; ++ rcu_read_lock(); ++ list_for_each_entry_rcu (server, &clp->cl_superblocks, client_link) { ++ if (nfs_server_clear_delayed_delegations(server)) ++ ret = true; ++ } ++ rcu_read_unlock(); ++out: ++ return ret; ++} ++ + /** + * nfs_client_return_marked_delegations - return previously marked delegations + * @clp: nfs_client to process +@@ -659,8 +701,14 @@ out: + */ + int nfs_client_return_marked_delegations(struct nfs_client *clp) + { +- return nfs_client_for_each_server(clp, +- nfs_server_return_marked_delegations, NULL); ++ int err = nfs_client_for_each_server( ++ clp, nfs_server_return_marked_delegations, NULL); ++ if (err) ++ return err; ++ /* If a return was delayed, sleep to prevent hard looping */ ++ if (nfs_client_clear_delayed_delegations(clp)) ++ ssleep(1); ++ return 0; + } + + /** +@@ -775,13 +823,6 @@ static void nfs_mark_return_if_closed_delegation(struct nfs_server *server, + set_bit(NFS4CLNT_DELEGRETURN, &server->nfs_client->cl_state); + } + +-static void nfs_mark_return_delegation(struct nfs_server *server, +- struct nfs_delegation *delegation) +-{ +- set_bit(NFS_DELEGATION_RETURN, &delegation->flags); +- set_bit(NFS4CLNT_DELEGRETURN, &server->nfs_client->cl_state); +-} +- + static bool nfs_server_mark_return_all_delegations(struct nfs_server *server) + { + struct nfs_delegation *delegation; +diff --git a/fs/nfs/delegation.h b/fs/nfs/delegation.h +index c19b4fd20781..1c378992b7c0 100644 +--- a/fs/nfs/delegation.h ++++ b/fs/nfs/delegation.h +@@ -36,6 +36,7 @@ enum { + NFS_DELEGATION_REVOKED, + NFS_DELEGATION_TEST_EXPIRED, + NFS_DELEGATION_INODE_FREEING, ++ NFS_DELEGATION_RETURN_DELAYED, + }; + + int nfs_inode_set_delegation(struct inode *inode, const struct cred *cred, +diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h +index 543d916f79ab..3e344bec3647 100644 +--- a/fs/nfs/nfs4_fs.h ++++ b/fs/nfs/nfs4_fs.h +@@ -45,6 +45,7 @@ enum nfs4_client_state { + NFS4CLNT_RECALL_RUNNING, + NFS4CLNT_RECALL_ANY_LAYOUT_READ, + NFS4CLNT_RECALL_ANY_LAYOUT_RW, ++ NFS4CLNT_DELEGRETURN_DELAYED, + }; + + #define NFS4_RENEW_TIMEOUT 0x01 +-- +2.30.2 + diff --git a/queue-5.13/nfsv4-fix-handling-of-non-atomic-change-attrbute-upd.patch b/queue-5.13/nfsv4-fix-handling-of-non-atomic-change-attrbute-upd.patch new file mode 100644 index 00000000000..3dc01d8c376 --- /dev/null +++ b/queue-5.13/nfsv4-fix-handling-of-non-atomic-change-attrbute-upd.patch @@ -0,0 +1,83 @@ +From fda197da71d3e13a524f5b854e934d9d3c48776e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 25 Jun 2021 15:49:31 -0400 +Subject: NFSv4: Fix handling of non-atomic change attrbute updates + +From: Trond Myklebust + +[ Upstream commit 20cf7d4ea4ad7d9830b01ff7444f6ac64a727a23 ] + +If the change attribute update is declared to be non-atomic by the +server, or our cached value does not match the server's value before the +operation was performed, then we should declare the inode cache invalid. + +On the other hand, if the change to the directory raced with a lookup or +getattr which already updated the change attribute, then optimise away +the revalidation. + +Signed-off-by: Trond Myklebust +Signed-off-by: Sasha Levin +--- + fs/nfs/nfs4proc.c | 33 +++++++++++++++------------------ + 1 file changed, 15 insertions(+), 18 deletions(-) + +diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c +index e653654c10bc..451d3d56d80c 100644 +--- a/fs/nfs/nfs4proc.c ++++ b/fs/nfs/nfs4proc.c +@@ -1205,12 +1205,12 @@ nfs4_update_changeattr_locked(struct inode *inode, + u64 change_attr = inode_peek_iversion_raw(inode); + + cache_validity |= NFS_INO_INVALID_CTIME | NFS_INO_INVALID_MTIME; ++ if (S_ISDIR(inode->i_mode)) ++ cache_validity |= NFS_INO_INVALID_DATA; + + switch (NFS_SERVER(inode)->change_attr_type) { + case NFS4_CHANGE_TYPE_IS_UNDEFINED: +- break; +- case NFS4_CHANGE_TYPE_IS_TIME_METADATA: +- if ((s64)(change_attr - cinfo->after) > 0) ++ if (cinfo->after == change_attr) + goto out; + break; + default: +@@ -1218,24 +1218,21 @@ nfs4_update_changeattr_locked(struct inode *inode, + goto out; + } + +- if (cinfo->atomic && cinfo->before == change_attr) { +- nfsi->attrtimeo_timestamp = jiffies; +- } else { +- if (S_ISDIR(inode->i_mode)) { +- cache_validity |= NFS_INO_INVALID_DATA; ++ inode_set_iversion_raw(inode, cinfo->after); ++ if (!cinfo->atomic || cinfo->before != change_attr) { ++ if (S_ISDIR(inode->i_mode)) + nfs_force_lookup_revalidate(inode); +- } else { +- if (!NFS_PROTO(inode)->have_delegation(inode, +- FMODE_READ)) +- cache_validity |= NFS_INO_REVAL_PAGECACHE; +- } + +- if (cinfo->before != change_attr) +- cache_validity |= NFS_INO_INVALID_ACCESS | +- NFS_INO_INVALID_ACL | +- NFS_INO_INVALID_XATTR; ++ if (!NFS_PROTO(inode)->have_delegation(inode, FMODE_READ)) ++ cache_validity |= ++ NFS_INO_INVALID_ACCESS | NFS_INO_INVALID_ACL | ++ NFS_INO_INVALID_SIZE | NFS_INO_INVALID_OTHER | ++ NFS_INO_INVALID_BLOCKS | NFS_INO_INVALID_NLINK | ++ NFS_INO_INVALID_MODE | NFS_INO_INVALID_XATTR | ++ NFS_INO_REVAL_PAGECACHE; ++ nfsi->attrtimeo = NFS_MINATTRTIMEO(inode); + } +- inode_set_iversion_raw(inode, cinfo->after); ++ nfsi->attrtimeo_timestamp = jiffies; + nfsi->read_cache_jiffies = timestamp; + nfsi->attr_gencount = nfs_inc_attr_generation_counter(); + nfsi->cache_validity &= ~NFS_INO_INVALID_CHANGE; +-- +2.30.2 + diff --git a/queue-5.13/nfsv4-initialise-connection-to-the-server-in-nfs4_al.patch b/queue-5.13/nfsv4-initialise-connection-to-the-server-in-nfs4_al.patch new file mode 100644 index 00000000000..09b155a5aff --- /dev/null +++ b/queue-5.13/nfsv4-initialise-connection-to-the-server-in-nfs4_al.patch @@ -0,0 +1,140 @@ +From 1141352ce0bd87d49a2ac221f57b1b7deeb87ba1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 9 Jun 2021 10:04:46 -0400 +Subject: NFSv4: Initialise connection to the server in nfs4_alloc_client() + +From: Trond Myklebust + +[ Upstream commit dd99e9f98fbf423ff6d365b37a98e8879170f17c ] + +Set up the connection to the NFSv4 server in nfs4_alloc_client(), before +we've added the struct nfs_client to the net-namespace's nfs_client_list +so that a downed server won't cause other mounts to hang in the trunking +detection code. + +Reported-by: Michael Wakabayashi +Fixes: 5c6e5b60aae4 ("NFS: Fix an Oops in the pNFS files and flexfiles connection setup to the DS") +Signed-off-by: Trond Myklebust +Signed-off-by: Sasha Levin +--- + fs/nfs/nfs4client.c | 82 +++++++++++++++++++++++---------------------- + 1 file changed, 42 insertions(+), 40 deletions(-) + +diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c +index 42719384e25f..28431acd1230 100644 +--- a/fs/nfs/nfs4client.c ++++ b/fs/nfs/nfs4client.c +@@ -197,8 +197,11 @@ void nfs40_shutdown_client(struct nfs_client *clp) + + struct nfs_client *nfs4_alloc_client(const struct nfs_client_initdata *cl_init) + { +- int err; ++ char buf[INET6_ADDRSTRLEN + 1]; ++ const char *ip_addr = cl_init->ip_addr; + struct nfs_client *clp = nfs_alloc_client(cl_init); ++ int err; ++ + if (IS_ERR(clp)) + return clp; + +@@ -222,6 +225,44 @@ struct nfs_client *nfs4_alloc_client(const struct nfs_client_initdata *cl_init) + init_waitqueue_head(&clp->cl_lock_waitq); + #endif + INIT_LIST_HEAD(&clp->pending_cb_stateids); ++ ++ if (cl_init->minorversion != 0) ++ __set_bit(NFS_CS_INFINITE_SLOTS, &clp->cl_flags); ++ __set_bit(NFS_CS_DISCRTRY, &clp->cl_flags); ++ __set_bit(NFS_CS_NO_RETRANS_TIMEOUT, &clp->cl_flags); ++ ++ /* ++ * Set up the connection to the server before we add add to the ++ * global list. ++ */ ++ err = nfs_create_rpc_client(clp, cl_init, RPC_AUTH_GSS_KRB5I); ++ if (err == -EINVAL) ++ err = nfs_create_rpc_client(clp, cl_init, RPC_AUTH_UNIX); ++ if (err < 0) ++ goto error; ++ ++ /* If no clientaddr= option was specified, find a usable cb address */ ++ if (ip_addr == NULL) { ++ struct sockaddr_storage cb_addr; ++ struct sockaddr *sap = (struct sockaddr *)&cb_addr; ++ ++ err = rpc_localaddr(clp->cl_rpcclient, sap, sizeof(cb_addr)); ++ if (err < 0) ++ goto error; ++ err = rpc_ntop(sap, buf, sizeof(buf)); ++ if (err < 0) ++ goto error; ++ ip_addr = (const char *)buf; ++ } ++ strlcpy(clp->cl_ipaddr, ip_addr, sizeof(clp->cl_ipaddr)); ++ ++ err = nfs_idmap_new(clp); ++ if (err < 0) { ++ dprintk("%s: failed to create idmapper. Error = %d\n", ++ __func__, err); ++ goto error; ++ } ++ __set_bit(NFS_CS_IDMAP, &clp->cl_res_state); + return clp; + + error: +@@ -372,8 +413,6 @@ static int nfs4_init_client_minor_version(struct nfs_client *clp) + struct nfs_client *nfs4_init_client(struct nfs_client *clp, + const struct nfs_client_initdata *cl_init) + { +- char buf[INET6_ADDRSTRLEN + 1]; +- const char *ip_addr = cl_init->ip_addr; + struct nfs_client *old; + int error; + +@@ -381,43 +420,6 @@ struct nfs_client *nfs4_init_client(struct nfs_client *clp, + /* the client is initialised already */ + return clp; + +- /* Check NFS protocol revision and initialize RPC op vector */ +- clp->rpc_ops = &nfs_v4_clientops; +- +- if (clp->cl_minorversion != 0) +- __set_bit(NFS_CS_INFINITE_SLOTS, &clp->cl_flags); +- __set_bit(NFS_CS_DISCRTRY, &clp->cl_flags); +- __set_bit(NFS_CS_NO_RETRANS_TIMEOUT, &clp->cl_flags); +- +- error = nfs_create_rpc_client(clp, cl_init, RPC_AUTH_GSS_KRB5I); +- if (error == -EINVAL) +- error = nfs_create_rpc_client(clp, cl_init, RPC_AUTH_UNIX); +- if (error < 0) +- goto error; +- +- /* If no clientaddr= option was specified, find a usable cb address */ +- if (ip_addr == NULL) { +- struct sockaddr_storage cb_addr; +- struct sockaddr *sap = (struct sockaddr *)&cb_addr; +- +- error = rpc_localaddr(clp->cl_rpcclient, sap, sizeof(cb_addr)); +- if (error < 0) +- goto error; +- error = rpc_ntop(sap, buf, sizeof(buf)); +- if (error < 0) +- goto error; +- ip_addr = (const char *)buf; +- } +- strlcpy(clp->cl_ipaddr, ip_addr, sizeof(clp->cl_ipaddr)); +- +- error = nfs_idmap_new(clp); +- if (error < 0) { +- dprintk("%s: failed to create idmapper. Error = %d\n", +- __func__, error); +- goto error; +- } +- __set_bit(NFS_CS_IDMAP, &clp->cl_res_state); +- + error = nfs4_init_client_minor_version(clp); + if (error < 0) + goto error; +-- +2.30.2 + diff --git a/queue-5.13/nfsv4-pnfs-don-t-call-_nfs4_pnfs_v3_ds_connect-multi.patch b/queue-5.13/nfsv4-pnfs-don-t-call-_nfs4_pnfs_v3_ds_connect-multi.patch new file mode 100644 index 00000000000..b3341a30da5 --- /dev/null +++ b/queue-5.13/nfsv4-pnfs-don-t-call-_nfs4_pnfs_v3_ds_connect-multi.patch @@ -0,0 +1,104 @@ +From 041c7ac65cdfa68b458cd8d293bb711f160a162b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 3 Jul 2021 14:34:20 -0400 +Subject: NFSv4/pNFS: Don't call _nfs4_pnfs_v3_ds_connect multiple times + +From: Trond Myklebust + +[ Upstream commit f46f84931a0aa344678efe412d4b071d84d8a805 ] + +After we grab the lock in nfs4_pnfs_ds_connect(), there is no check for +whether or not ds->ds_clp has already been initialised, so we can end up +adding the same transports multiple times. + +Fixes: fc821d59209d ("pnfs/NFSv4.1: Add multipath capabilities to pNFS flexfiles servers over NFSv3") +Signed-off-by: Trond Myklebust +Signed-off-by: Sasha Levin +--- + fs/nfs/pnfs_nfs.c | 52 +++++++++++++++++++++++------------------------ + 1 file changed, 26 insertions(+), 26 deletions(-) + +diff --git a/fs/nfs/pnfs_nfs.c b/fs/nfs/pnfs_nfs.c +index 49d3389bd813..1c2c0d08614e 100644 +--- a/fs/nfs/pnfs_nfs.c ++++ b/fs/nfs/pnfs_nfs.c +@@ -805,19 +805,16 @@ out: + } + EXPORT_SYMBOL_GPL(nfs4_pnfs_ds_add); + +-static void nfs4_wait_ds_connect(struct nfs4_pnfs_ds *ds) ++static int nfs4_wait_ds_connect(struct nfs4_pnfs_ds *ds) + { + might_sleep(); +- wait_on_bit(&ds->ds_state, NFS4DS_CONNECTING, +- TASK_KILLABLE); ++ return wait_on_bit(&ds->ds_state, NFS4DS_CONNECTING, TASK_KILLABLE); + } + + static void nfs4_clear_ds_conn_bit(struct nfs4_pnfs_ds *ds) + { + smp_mb__before_atomic(); +- clear_bit(NFS4DS_CONNECTING, &ds->ds_state); +- smp_mb__after_atomic(); +- wake_up_bit(&ds->ds_state, NFS4DS_CONNECTING); ++ clear_and_wake_up_bit(NFS4DS_CONNECTING, &ds->ds_state); + } + + static struct nfs_client *(*get_v3_ds_connect)( +@@ -993,30 +990,33 @@ int nfs4_pnfs_ds_connect(struct nfs_server *mds_srv, struct nfs4_pnfs_ds *ds, + { + int err; + +-again: +- err = 0; +- if (test_and_set_bit(NFS4DS_CONNECTING, &ds->ds_state) == 0) { +- if (version == 3) { +- err = _nfs4_pnfs_v3_ds_connect(mds_srv, ds, timeo, +- retrans); +- } else if (version == 4) { +- err = _nfs4_pnfs_v4_ds_connect(mds_srv, ds, timeo, +- retrans, minor_version); +- } else { +- dprintk("%s: unsupported DS version %d\n", __func__, +- version); +- err = -EPROTONOSUPPORT; +- } ++ do { ++ err = nfs4_wait_ds_connect(ds); ++ if (err || ds->ds_clp) ++ goto out; ++ if (nfs4_test_deviceid_unavailable(devid)) ++ return -ENODEV; ++ } while (test_and_set_bit(NFS4DS_CONNECTING, &ds->ds_state) != 0); + +- nfs4_clear_ds_conn_bit(ds); +- } else { +- nfs4_wait_ds_connect(ds); ++ if (ds->ds_clp) ++ goto connect_done; + +- /* what was waited on didn't connect AND didn't mark unavail */ +- if (!ds->ds_clp && !nfs4_test_deviceid_unavailable(devid)) +- goto again; ++ switch (version) { ++ case 3: ++ err = _nfs4_pnfs_v3_ds_connect(mds_srv, ds, timeo, retrans); ++ break; ++ case 4: ++ err = _nfs4_pnfs_v4_ds_connect(mds_srv, ds, timeo, retrans, ++ minor_version); ++ break; ++ default: ++ dprintk("%s: unsupported DS version %d\n", __func__, version); ++ err = -EPROTONOSUPPORT; + } + ++connect_done: ++ nfs4_clear_ds_conn_bit(ds); ++out: + /* + * At this point the ds->ds_clp should be ready, but it might have + * hit an error. +-- +2.30.2 + diff --git a/queue-5.13/nfsv4-pnfs-fix-layoutget-behaviour-after-invalidatio.patch b/queue-5.13/nfsv4-pnfs-fix-layoutget-behaviour-after-invalidatio.patch new file mode 100644 index 00000000000..0c1e6e9c1e0 --- /dev/null +++ b/queue-5.13/nfsv4-pnfs-fix-layoutget-behaviour-after-invalidatio.patch @@ -0,0 +1,61 @@ +From 9d0cd6fa01cd0f2e78ab9887c1db093b07e446a7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 2 Jul 2021 19:48:41 -0400 +Subject: NFSv4/pnfs: Fix layoutget behaviour after invalidation + +From: Trond Myklebust + +[ Upstream commit 0b77f97a7e42adc72bd566ff8cb733ea426f74f6 ] + +If the layout gets invalidated, we should wait for any outstanding +layoutget requests for that layout to complete, and we should resend +them only after re-establishing the layout stateid. + +Fixes: d29b468da4f9 ("pNFS/NFSv4: Improve rejection of out-of-order layouts") +Signed-off-by: Trond Myklebust +Signed-off-by: Sasha Levin +--- + fs/nfs/pnfs.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c +index ffe02e43f8c0..be960e47d7f6 100644 +--- a/fs/nfs/pnfs.c ++++ b/fs/nfs/pnfs.c +@@ -2014,7 +2014,7 @@ lookup_again: + * If the layout segment list is empty, but there are outstanding + * layoutget calls, then they might be subject to a layoutrecall. + */ +- if (list_empty(&lo->plh_segs) && ++ if ((list_empty(&lo->plh_segs) || !pnfs_layout_is_valid(lo)) && + atomic_read(&lo->plh_outstanding) != 0) { + spin_unlock(&ino->i_lock); + lseg = ERR_PTR(wait_var_event_killable(&lo->plh_outstanding, +@@ -2390,11 +2390,13 @@ pnfs_layout_process(struct nfs4_layoutget *lgp) + goto out_forget; + } + ++ if (!pnfs_layout_is_valid(lo) && !pnfs_is_first_layoutget(lo)) ++ goto out_forget; ++ + if (nfs4_stateid_match_other(&lo->plh_stateid, &res->stateid)) { + /* existing state ID, make sure the sequence number matches. */ + if (pnfs_layout_stateid_blocked(lo, &res->stateid)) { +- if (!pnfs_layout_is_valid(lo) && +- pnfs_is_first_layoutget(lo)) ++ if (!pnfs_layout_is_valid(lo)) + lo->plh_barrier = 0; + dprintk("%s forget reply due to sequence\n", __func__); + goto out_forget; +@@ -2413,8 +2415,6 @@ pnfs_layout_process(struct nfs4_layoutget *lgp) + goto out_forget; + } else { + /* We have a completely new layout */ +- if (!pnfs_is_first_layoutget(lo)) +- goto out_forget; + pnfs_set_layout_stateid(lo, &res->stateid, lgp->cred, true); + } + +-- +2.30.2 + diff --git a/queue-5.13/nfsv4-pnfs-fix-the-layout-barrier-update.patch b/queue-5.13/nfsv4-pnfs-fix-the-layout-barrier-update.patch new file mode 100644 index 00000000000..1c13067be7a --- /dev/null +++ b/queue-5.13/nfsv4-pnfs-fix-the-layout-barrier-update.patch @@ -0,0 +1,79 @@ +From 879d2e1e738951d3913fb19a260043090f99a6d4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 2 Jul 2021 16:37:15 -0400 +Subject: NFSv4/pnfs: Fix the layout barrier update + +From: Trond Myklebust + +[ Upstream commit aa95edf309ef31e2df4a37ebf0e5c2ca2a6772ab ] + +If we have multiple outstanding layoutget requests, the current code to +update the layout barrier assumes that the outstanding layout stateids +are updated in order. That's not necessarily the case. + +Instead of using the value of lo->plh_outstanding as a guesstimate for +the window of values we need to accept, just wait to update the window +until we're processing the last one. The intention here is just to +ensure that we don't process 2^31 seqid updates without also updating +the barrier. + +Fixes: 1bcf34fdac5f ("pNFS/NFSv4: Update the layout barrier when we schedule a layoutreturn") +Signed-off-by: Trond Myklebust +Signed-off-by: Sasha Levin +--- + fs/nfs/pnfs.c | 30 +++++++++++++++--------------- + 1 file changed, 15 insertions(+), 15 deletions(-) + +diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c +index 2c01ee805306..ffe02e43f8c0 100644 +--- a/fs/nfs/pnfs.c ++++ b/fs/nfs/pnfs.c +@@ -966,10 +966,8 @@ void + pnfs_set_layout_stateid(struct pnfs_layout_hdr *lo, const nfs4_stateid *new, + const struct cred *cred, bool update_barrier) + { +- u32 oldseq, newseq, new_barrier = 0; +- +- oldseq = be32_to_cpu(lo->plh_stateid.seqid); +- newseq = be32_to_cpu(new->seqid); ++ u32 oldseq = be32_to_cpu(lo->plh_stateid.seqid); ++ u32 newseq = be32_to_cpu(new->seqid); + + if (!pnfs_layout_is_valid(lo)) { + pnfs_set_layout_cred(lo, cred); +@@ -979,19 +977,21 @@ pnfs_set_layout_stateid(struct pnfs_layout_hdr *lo, const nfs4_stateid *new, + clear_bit(NFS_LAYOUT_INVALID_STID, &lo->plh_flags); + return; + } +- if (pnfs_seqid_is_newer(newseq, oldseq)) { ++ ++ if (pnfs_seqid_is_newer(newseq, oldseq)) + nfs4_stateid_copy(&lo->plh_stateid, new); +- /* +- * Because of wraparound, we want to keep the barrier +- * "close" to the current seqids. +- */ +- new_barrier = newseq - atomic_read(&lo->plh_outstanding); +- } +- if (update_barrier) +- new_barrier = be32_to_cpu(new->seqid); +- else if (new_barrier == 0) ++ ++ if (update_barrier) { ++ pnfs_barrier_update(lo, newseq); + return; +- pnfs_barrier_update(lo, new_barrier); ++ } ++ /* ++ * Because of wraparound, we want to keep the barrier ++ * "close" to the current seqids. We really only want to ++ * get here from a layoutget call. ++ */ ++ if (atomic_read(&lo->plh_outstanding) == 1) ++ pnfs_barrier_update(lo, be32_to_cpu(lo->plh_stateid.seqid)); + } + + static bool +-- +2.30.2 + diff --git a/queue-5.13/nvme-tcp-can-t-set-sk_user_data-without-write_lock.patch b/queue-5.13/nvme-tcp-can-t-set-sk_user_data-without-write_lock.patch new file mode 100644 index 00000000000..2f324272921 --- /dev/null +++ b/queue-5.13/nvme-tcp-can-t-set-sk_user_data-without-write_lock.patch @@ -0,0 +1,43 @@ +From 13c4ec40c8cf5c88b10b4d22954d3cc0ac147442 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 2 Jul 2021 10:11:21 +0200 +Subject: nvme-tcp: can't set sk_user_data without write_lock + +From: Maurizio Lombardi + +[ Upstream commit 0755d3be2d9bb6ea38598ccd30d6bbaa1a5c3a50 ] + +The sk_user_data pointer is supposed to be modified only while +holding the write_lock "sk_callback_lock", otherwise +we could race with other threads and crash the kernel. + +we can't take the write_lock in nvmet_tcp_state_change() +because it would cause a deadlock, but the release_work queue +will set the pointer to NULL later so we can simply remove +the assignment. + +Fixes: b5332a9f3f3d ("nvmet-tcp: fix incorrect locking in state_change sk callback") + +Signed-off-by: Maurizio Lombardi +Reviewed-by: Sagi Grimberg +Signed-off-by: Christoph Hellwig +Signed-off-by: Sasha Levin +--- + drivers/nvme/target/tcp.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c +index d8aceef83284..07ee347ea3f3 100644 +--- a/drivers/nvme/target/tcp.c ++++ b/drivers/nvme/target/tcp.c +@@ -1497,7 +1497,6 @@ static void nvmet_tcp_state_change(struct sock *sk) + case TCP_CLOSE_WAIT: + case TCP_CLOSE: + /* FALLTHRU */ +- sk->sk_user_data = NULL; + nvmet_tcp_schedule_release_queue(queue); + break; + default: +-- +2.30.2 + diff --git a/queue-5.13/orangefs-fix-orangefs-df-output.patch b/queue-5.13/orangefs-fix-orangefs-df-output.patch new file mode 100644 index 00000000000..239b547cbc0 --- /dev/null +++ b/queue-5.13/orangefs-fix-orangefs-df-output.patch @@ -0,0 +1,34 @@ +From 20940c29bdba6e880eed29ac905cb44fb24fb1c1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 18 May 2021 08:09:13 -0400 +Subject: orangefs: fix orangefs df output. + +From: Mike Marshall + +[ Upstream commit 0fdec1b3c9fbb5e856a40db5993c9eaf91c74a83 ] + +Orangefs df output is whacky. Walt Ligon suggested this might fix it. +It seems way more in line with reality now... + +Signed-off-by: Mike Marshall +Signed-off-by: Sasha Levin +--- + fs/orangefs/super.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/fs/orangefs/super.c b/fs/orangefs/super.c +index ee5efdc35cc1..2f2e430461b2 100644 +--- a/fs/orangefs/super.c ++++ b/fs/orangefs/super.c +@@ -209,7 +209,7 @@ static int orangefs_statfs(struct dentry *dentry, struct kstatfs *buf) + buf->f_bavail = (sector_t) new_op->downcall.resp.statfs.blocks_avail; + buf->f_files = (sector_t) new_op->downcall.resp.statfs.files_total; + buf->f_ffree = (sector_t) new_op->downcall.resp.statfs.files_avail; +- buf->f_frsize = sb->s_blocksize; ++ buf->f_frsize = 0; + + out_op_release: + op_release(new_op); +-- +2.30.2 + diff --git a/queue-5.13/partitions-msdos-fix-one-byte-get_unaligned.patch b/queue-5.13/partitions-msdos-fix-one-byte-get_unaligned.patch new file mode 100644 index 00000000000..95e9ce03e5b --- /dev/null +++ b/queue-5.13/partitions-msdos-fix-one-byte-get_unaligned.patch @@ -0,0 +1,142 @@ +From 13dab0f210bd5b4c606cac1714d15b7bb945d7cf Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 8 May 2021 00:07:53 +0200 +Subject: partitions: msdos: fix one-byte get_unaligned() + +From: Arnd Bergmann + +[ Upstream commit 1b1774998b2dec837a57d729d1a22e5eb2d6d206 ] + +A simplification of get_unaligned() clashes with callers that pass +in a character pointer, causing a harmless warning like: + +block/partitions/msdos.c: In function 'msdos_partition': +include/asm-generic/unaligned.h:13:22: warning: 'packed' attribute ignored for field of type 'u8' {aka 'unsigned char'} [-Wattributes] + +Remove the SYS_IND() macro with the get_unaligned() call +and just use the ->ind field directly. + +Signed-off-by: Arnd Bergmann +Signed-off-by: Sasha Levin +--- + block/partitions/ldm.c | 2 +- + block/partitions/ldm.h | 3 --- + block/partitions/msdos.c | 24 +++++++++++------------- + 3 files changed, 12 insertions(+), 17 deletions(-) + +diff --git a/block/partitions/ldm.c b/block/partitions/ldm.c +index d333786b5c7e..cc86534c80ad 100644 +--- a/block/partitions/ldm.c ++++ b/block/partitions/ldm.c +@@ -510,7 +510,7 @@ static bool ldm_validate_partition_table(struct parsed_partitions *state) + + p = (struct msdos_partition *)(data + 0x01BE); + for (i = 0; i < 4; i++, p++) +- if (SYS_IND (p) == LDM_PARTITION) { ++ if (p->sys_ind == LDM_PARTITION) { + result = true; + break; + } +diff --git a/block/partitions/ldm.h b/block/partitions/ldm.h +index d8d6beaa72c4..8693704dcf5e 100644 +--- a/block/partitions/ldm.h ++++ b/block/partitions/ldm.h +@@ -84,9 +84,6 @@ struct parsed_partitions; + #define TOC_BITMAP1 "config" /* Names of the two defined */ + #define TOC_BITMAP2 "log" /* bitmaps in the TOCBLOCK. */ + +-/* Borrowed from msdos.c */ +-#define SYS_IND(p) (get_unaligned(&(p)->sys_ind)) +- + struct frag { /* VBLK Fragment handling */ + struct list_head list; + u32 group; +diff --git a/block/partitions/msdos.c b/block/partitions/msdos.c +index 8f2fcc080264..c94de377c502 100644 +--- a/block/partitions/msdos.c ++++ b/block/partitions/msdos.c +@@ -38,8 +38,6 @@ + */ + #include + +-#define SYS_IND(p) get_unaligned(&p->sys_ind) +- + static inline sector_t nr_sects(struct msdos_partition *p) + { + return (sector_t)get_unaligned_le32(&p->nr_sects); +@@ -52,9 +50,9 @@ static inline sector_t start_sect(struct msdos_partition *p) + + static inline int is_extended_partition(struct msdos_partition *p) + { +- return (SYS_IND(p) == DOS_EXTENDED_PARTITION || +- SYS_IND(p) == WIN98_EXTENDED_PARTITION || +- SYS_IND(p) == LINUX_EXTENDED_PARTITION); ++ return (p->sys_ind == DOS_EXTENDED_PARTITION || ++ p->sys_ind == WIN98_EXTENDED_PARTITION || ++ p->sys_ind == LINUX_EXTENDED_PARTITION); + } + + #define MSDOS_LABEL_MAGIC1 0x55 +@@ -193,7 +191,7 @@ static void parse_extended(struct parsed_partitions *state, + + put_partition(state, state->next, next, size); + set_info(state, state->next, disksig); +- if (SYS_IND(p) == LINUX_RAID_PARTITION) ++ if (p->sys_ind == LINUX_RAID_PARTITION) + state->parts[state->next].flags = ADDPART_FLAG_RAID; + loopct = 0; + if (++state->next == state->limit) +@@ -546,7 +544,7 @@ static void parse_minix(struct parsed_partitions *state, + * a secondary MBR describing its subpartitions, or + * the normal boot sector. */ + if (msdos_magic_present(data + 510) && +- SYS_IND(p) == MINIX_PARTITION) { /* subpartition table present */ ++ p->sys_ind == MINIX_PARTITION) { /* subpartition table present */ + char tmp[1 + BDEVNAME_SIZE + 10 + 9 + 1]; + + snprintf(tmp, sizeof(tmp), " %s%d: name, origin); +@@ -555,7 +553,7 @@ static void parse_minix(struct parsed_partitions *state, + if (state->next == state->limit) + break; + /* add each partition in use */ +- if (SYS_IND(p) == MINIX_PARTITION) ++ if (p->sys_ind == MINIX_PARTITION) + put_partition(state, state->next++, + start_sect(p), nr_sects(p)); + } +@@ -643,7 +641,7 @@ int msdos_partition(struct parsed_partitions *state) + p = (struct msdos_partition *) (data + 0x1be); + for (slot = 1 ; slot <= 4 ; slot++, p++) { + /* If this is an EFI GPT disk, msdos should ignore it. */ +- if (SYS_IND(p) == EFI_PMBR_OSTYPE_EFI_GPT) { ++ if (p->sys_ind == EFI_PMBR_OSTYPE_EFI_GPT) { + put_dev_sector(sect); + return 0; + } +@@ -685,11 +683,11 @@ int msdos_partition(struct parsed_partitions *state) + } + put_partition(state, slot, start, size); + set_info(state, slot, disksig); +- if (SYS_IND(p) == LINUX_RAID_PARTITION) ++ if (p->sys_ind == LINUX_RAID_PARTITION) + state->parts[slot].flags = ADDPART_FLAG_RAID; +- if (SYS_IND(p) == DM6_PARTITION) ++ if (p->sys_ind == DM6_PARTITION) + strlcat(state->pp_buf, "[DM]", PAGE_SIZE); +- if (SYS_IND(p) == EZD_PARTITION) ++ if (p->sys_ind == EZD_PARTITION) + strlcat(state->pp_buf, "[EZD]", PAGE_SIZE); + } + +@@ -698,7 +696,7 @@ int msdos_partition(struct parsed_partitions *state) + /* second pass - output for each on a separate line */ + p = (struct msdos_partition *) (0x1be + data); + for (slot = 1 ; slot <= 4 ; slot++, p++) { +- unsigned char id = SYS_IND(p); ++ unsigned char id = p->sys_ind; + int n; + + if (!nr_sects(p)) +-- +2.30.2 + diff --git a/queue-5.13/pci-dynamically-map-ecam-regions.patch b/queue-5.13/pci-dynamically-map-ecam-regions.patch new file mode 100644 index 00000000000..473f36225cc --- /dev/null +++ b/queue-5.13/pci-dynamically-map-ecam-regions.patch @@ -0,0 +1,162 @@ +From fe883a64d345d9d340e5924fd7b5567302329f57 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 13 May 2021 15:18:27 +0100 +Subject: PCI: Dynamically map ECAM regions + +From: Russell King + +[ Upstream commit 8fe55ef23387ce3c7488375b1fd539420d7654bb ] + +Attempting to boot 32-bit ARM kernels under QEMU's 3.x virt models fails +when we have more than 512M of RAM in the model as we run out of vmalloc +space for the PCI ECAM regions. This failure will be silent when running +libvirt, as the console in that situation is a PCI device. + +In this configuration, the kernel maps the whole ECAM, which QEMU sets up +for 256 buses, even when maybe only seven buses are in use. Each bus uses +1M of ECAM space, and ioremap() adds an additional guard page between +allocations. The kernel vmap allocator will align these regions to 512K, +resulting in each mapping eating 1.5M of vmalloc space. This means we need +384M of vmalloc space just to map all of these, which is very wasteful of +resources. + +Fix this by only mapping the ECAM for buses we are going to be using. In +my setups, this is around seven buses in most guests, which is 10.5M of +vmalloc space - way smaller than the 384M that would otherwise be required. +This also means that the kernel can boot without forcing extra RAM into +highmem with the vmalloc= argument, or decreasing the virtual RAM available +to the guest. + +Suggested-by: Arnd Bergmann +Link: https://lore.kernel.org/r/E1lhCAV-0002yb-50@rmk-PC.armlinux.org.uk +Signed-off-by: Russell King +Signed-off-by: Bjorn Helgaas +Reviewed-by: Arnd Bergmann +Signed-off-by: Sasha Levin +--- + drivers/pci/ecam.c | 54 ++++++++++++++++++++++++++++++++++------ + include/linux/pci-ecam.h | 1 + + 2 files changed, 47 insertions(+), 8 deletions(-) + +diff --git a/drivers/pci/ecam.c b/drivers/pci/ecam.c +index d2a1920bb055..1c40d2506aef 100644 +--- a/drivers/pci/ecam.c ++++ b/drivers/pci/ecam.c +@@ -32,7 +32,7 @@ struct pci_config_window *pci_ecam_create(struct device *dev, + struct pci_config_window *cfg; + unsigned int bus_range, bus_range_max, bsz; + struct resource *conflict; +- int i, err; ++ int err; + + if (busr->start > busr->end) + return ERR_PTR(-EINVAL); +@@ -50,6 +50,7 @@ struct pci_config_window *pci_ecam_create(struct device *dev, + cfg->busr.start = busr->start; + cfg->busr.end = busr->end; + cfg->busr.flags = IORESOURCE_BUS; ++ cfg->bus_shift = bus_shift; + bus_range = resource_size(&cfg->busr); + bus_range_max = resource_size(cfgres) >> bus_shift; + if (bus_range > bus_range_max) { +@@ -77,13 +78,6 @@ struct pci_config_window *pci_ecam_create(struct device *dev, + cfg->winp = kcalloc(bus_range, sizeof(*cfg->winp), GFP_KERNEL); + if (!cfg->winp) + goto err_exit_malloc; +- for (i = 0; i < bus_range; i++) { +- cfg->winp[i] = +- pci_remap_cfgspace(cfgres->start + i * bsz, +- bsz); +- if (!cfg->winp[i]) +- goto err_exit_iomap; +- } + } else { + cfg->win = pci_remap_cfgspace(cfgres->start, bus_range * bsz); + if (!cfg->win) +@@ -129,6 +123,44 @@ void pci_ecam_free(struct pci_config_window *cfg) + } + EXPORT_SYMBOL_GPL(pci_ecam_free); + ++static int pci_ecam_add_bus(struct pci_bus *bus) ++{ ++ struct pci_config_window *cfg = bus->sysdata; ++ unsigned int bsz = 1 << cfg->bus_shift; ++ unsigned int busn = bus->number; ++ phys_addr_t start; ++ ++ if (!per_bus_mapping) ++ return 0; ++ ++ if (busn < cfg->busr.start || busn > cfg->busr.end) ++ return -EINVAL; ++ ++ busn -= cfg->busr.start; ++ start = cfg->res.start + busn * bsz; ++ ++ cfg->winp[busn] = pci_remap_cfgspace(start, bsz); ++ if (!cfg->winp[busn]) ++ return -ENOMEM; ++ ++ return 0; ++} ++ ++static void pci_ecam_remove_bus(struct pci_bus *bus) ++{ ++ struct pci_config_window *cfg = bus->sysdata; ++ unsigned int busn = bus->number; ++ ++ if (!per_bus_mapping || busn < cfg->busr.start || busn > cfg->busr.end) ++ return; ++ ++ busn -= cfg->busr.start; ++ if (cfg->winp[busn]) { ++ iounmap(cfg->winp[busn]); ++ cfg->winp[busn] = NULL; ++ } ++} ++ + /* + * Function to implement the pci_ops ->map_bus method + */ +@@ -167,6 +199,8 @@ EXPORT_SYMBOL_GPL(pci_ecam_map_bus); + /* ECAM ops */ + const struct pci_ecam_ops pci_generic_ecam_ops = { + .pci_ops = { ++ .add_bus = pci_ecam_add_bus, ++ .remove_bus = pci_ecam_remove_bus, + .map_bus = pci_ecam_map_bus, + .read = pci_generic_config_read, + .write = pci_generic_config_write, +@@ -178,6 +212,8 @@ EXPORT_SYMBOL_GPL(pci_generic_ecam_ops); + /* ECAM ops for 32-bit access only (non-compliant) */ + const struct pci_ecam_ops pci_32b_ops = { + .pci_ops = { ++ .add_bus = pci_ecam_add_bus, ++ .remove_bus = pci_ecam_remove_bus, + .map_bus = pci_ecam_map_bus, + .read = pci_generic_config_read32, + .write = pci_generic_config_write32, +@@ -187,6 +223,8 @@ const struct pci_ecam_ops pci_32b_ops = { + /* ECAM ops for 32-bit read only (non-compliant) */ + const struct pci_ecam_ops pci_32b_read_ops = { + .pci_ops = { ++ .add_bus = pci_ecam_add_bus, ++ .remove_bus = pci_ecam_remove_bus, + .map_bus = pci_ecam_map_bus, + .read = pci_generic_config_read32, + .write = pci_generic_config_write, +diff --git a/include/linux/pci-ecam.h b/include/linux/pci-ecam.h +index fbdadd4d8377..adea5a4771cf 100644 +--- a/include/linux/pci-ecam.h ++++ b/include/linux/pci-ecam.h +@@ -55,6 +55,7 @@ struct pci_ecam_ops { + struct pci_config_window { + struct resource res; + struct resource busr; ++ unsigned int bus_shift; + void *priv; + const struct pci_ecam_ops *ops; + union { +-- +2.30.2 + diff --git a/queue-5.13/pci-ftpci100-rename-macro-name-collision.patch b/queue-5.13/pci-ftpci100-rename-macro-name-collision.patch new file mode 100644 index 00000000000..3c834056c30 --- /dev/null +++ b/queue-5.13/pci-ftpci100-rename-macro-name-collision.patch @@ -0,0 +1,123 @@ +From 3b57742bb871855542315dfb680e4cc2e942739d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 17 May 2021 16:41:17 -0700 +Subject: PCI: ftpci100: Rename macro name collision +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Randy Dunlap + +[ Upstream commit 5be967d5016ac5ffb9c4d0df51b48441ee4d5ed1 ] + +PCI_IOSIZE is defined in mach-loongson64/spaces.h, so change the name +of the PCI_* macros in pci-ftpci100.c to use FTPCI_* so that they are +more localized and won't conflict with other drivers or arches. + +../drivers/pci/controller/pci-ftpci100.c:37: warning: "PCI_IOSIZE" redefined + 37 | #define PCI_IOSIZE 0x00 + | +In file included from ../arch/mips/include/asm/addrspace.h:13, +... from ../drivers/pci/controller/pci-ftpci100.c:15: +arch/mips/include/asm/mach-loongson64/spaces.h:11: note: this is the location of the previous definition + 11 | #define PCI_IOSIZE SZ_16M + +Suggested-by: Linus Walleij +Link: https://lore.kernel.org/r/20210517234117.3660-1-rdunlap@infradead.org +Reported-by: kernel test robot +Signed-off-by: Randy Dunlap +Signed-off-by: Lorenzo Pieralisi +Reviewed-by: Linus Walleij +Cc: Jiaxun Yang +Cc: Linus Walleij +Cc: Krzysztof Wilczyński +Cc: Thomas Bogendoerfer +Cc: linux-mips@vger.kernel.org +Signed-off-by: Sasha Levin +--- + drivers/pci/controller/pci-ftpci100.c | 30 +++++++++++++-------------- + 1 file changed, 15 insertions(+), 15 deletions(-) + +diff --git a/drivers/pci/controller/pci-ftpci100.c b/drivers/pci/controller/pci-ftpci100.c +index da3cd216da00..aefef1986201 100644 +--- a/drivers/pci/controller/pci-ftpci100.c ++++ b/drivers/pci/controller/pci-ftpci100.c +@@ -34,12 +34,12 @@ + * Special configuration registers directly in the first few words + * in I/O space. + */ +-#define PCI_IOSIZE 0x00 +-#define PCI_PROT 0x04 /* AHB protection */ +-#define PCI_CTRL 0x08 /* PCI control signal */ +-#define PCI_SOFTRST 0x10 /* Soft reset counter and response error enable */ +-#define PCI_CONFIG 0x28 /* PCI configuration command register */ +-#define PCI_DATA 0x2C ++#define FTPCI_IOSIZE 0x00 ++#define FTPCI_PROT 0x04 /* AHB protection */ ++#define FTPCI_CTRL 0x08 /* PCI control signal */ ++#define FTPCI_SOFTRST 0x10 /* Soft reset counter and response error enable */ ++#define FTPCI_CONFIG 0x28 /* PCI configuration command register */ ++#define FTPCI_DATA 0x2C + + #define FARADAY_PCI_STATUS_CMD 0x04 /* Status and command */ + #define FARADAY_PCI_PMC 0x40 /* Power management control */ +@@ -195,9 +195,9 @@ static int faraday_raw_pci_read_config(struct faraday_pci *p, int bus_number, + PCI_CONF_FUNCTION(PCI_FUNC(fn)) | + PCI_CONF_WHERE(config) | + PCI_CONF_ENABLE, +- p->base + PCI_CONFIG); ++ p->base + FTPCI_CONFIG); + +- *value = readl(p->base + PCI_DATA); ++ *value = readl(p->base + FTPCI_DATA); + + if (size == 1) + *value = (*value >> (8 * (config & 3))) & 0xFF; +@@ -230,17 +230,17 @@ static int faraday_raw_pci_write_config(struct faraday_pci *p, int bus_number, + PCI_CONF_FUNCTION(PCI_FUNC(fn)) | + PCI_CONF_WHERE(config) | + PCI_CONF_ENABLE, +- p->base + PCI_CONFIG); ++ p->base + FTPCI_CONFIG); + + switch (size) { + case 4: +- writel(value, p->base + PCI_DATA); ++ writel(value, p->base + FTPCI_DATA); + break; + case 2: +- writew(value, p->base + PCI_DATA + (config & 3)); ++ writew(value, p->base + FTPCI_DATA + (config & 3)); + break; + case 1: +- writeb(value, p->base + PCI_DATA + (config & 3)); ++ writeb(value, p->base + FTPCI_DATA + (config & 3)); + break; + default: + ret = PCIBIOS_BAD_REGISTER_NUMBER; +@@ -469,7 +469,7 @@ static int faraday_pci_probe(struct platform_device *pdev) + if (!faraday_res_to_memcfg(io->start - win->offset, + resource_size(io), &val)) { + /* setup I/O space size */ +- writel(val, p->base + PCI_IOSIZE); ++ writel(val, p->base + FTPCI_IOSIZE); + } else { + dev_err(dev, "illegal IO mem size\n"); + return -EINVAL; +@@ -477,11 +477,11 @@ static int faraday_pci_probe(struct platform_device *pdev) + } + + /* Setup hostbridge */ +- val = readl(p->base + PCI_CTRL); ++ val = readl(p->base + FTPCI_CTRL); + val |= PCI_COMMAND_IO; + val |= PCI_COMMAND_MEMORY; + val |= PCI_COMMAND_MASTER; +- writel(val, p->base + PCI_CTRL); ++ writel(val, p->base + FTPCI_CTRL); + /* Mask and clear all interrupts */ + faraday_raw_pci_write_config(p, 0, 0, FARADAY_PCI_CTRL2 + 2, 2, 0xF000); + if (variant->cascaded_irq) { +-- +2.30.2 + diff --git a/queue-5.13/pci-hv-fix-a-race-condition-when-removing-the-device.patch b/queue-5.13/pci-hv-fix-a-race-condition-when-removing-the-device.patch new file mode 100644 index 00000000000..b3474fa854f --- /dev/null +++ b/queue-5.13/pci-hv-fix-a-race-condition-when-removing-the-device.patch @@ -0,0 +1,106 @@ +From 7df83c5f8572cf901f0ff8025284e2ebd233e808 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 12 May 2021 01:06:40 -0700 +Subject: PCI: hv: Fix a race condition when removing the device + +From: Long Li + +[ Upstream commit 94d22763207ac6633612b8d8e0ca4fba0f7aa139 ] + +On removing the device, any work item (hv_pci_devices_present() or +hv_pci_eject_device()) scheduled on workqueue hbus->wq may still be running +and race with hv_pci_remove(). + +This can happen because the host may send PCI_EJECT or PCI_BUS_RELATIONS(2) +and decide to rescind the channel immediately after that. + +Fix this by flushing/destroying the workqueue of hbus before doing hbus remove. + +Link: https://lore.kernel.org/r/1620806800-30983-1-git-send-email-longli@linuxonhyperv.com +Signed-off-by: Long Li +Signed-off-by: Lorenzo Pieralisi +Reviewed-by: Michael Kelley +Signed-off-by: Sasha Levin +--- + drivers/pci/controller/pci-hyperv.c | 30 ++++++++++++++++++++++------- + 1 file changed, 23 insertions(+), 7 deletions(-) + +diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c +index bebe3eeebc4e..efbf8c80bd31 100644 +--- a/drivers/pci/controller/pci-hyperv.c ++++ b/drivers/pci/controller/pci-hyperv.c +@@ -444,7 +444,6 @@ enum hv_pcibus_state { + hv_pcibus_probed, + hv_pcibus_installed, + hv_pcibus_removing, +- hv_pcibus_removed, + hv_pcibus_maximum + }; + +@@ -3243,8 +3242,9 @@ static int hv_pci_bus_exit(struct hv_device *hdev, bool keep_devs) + struct pci_packet teardown_packet; + u8 buffer[sizeof(struct pci_message)]; + } pkt; +- struct hv_dr_state *dr; + struct hv_pci_compl comp_pkt; ++ struct hv_pci_dev *hpdev, *tmp; ++ unsigned long flags; + int ret; + + /* +@@ -3256,9 +3256,16 @@ static int hv_pci_bus_exit(struct hv_device *hdev, bool keep_devs) + + if (!keep_devs) { + /* Delete any children which might still exist. */ +- dr = kzalloc(sizeof(*dr), GFP_KERNEL); +- if (dr && hv_pci_start_relations_work(hbus, dr)) +- kfree(dr); ++ spin_lock_irqsave(&hbus->device_list_lock, flags); ++ list_for_each_entry_safe(hpdev, tmp, &hbus->children, list_entry) { ++ list_del(&hpdev->list_entry); ++ if (hpdev->pci_slot) ++ pci_destroy_slot(hpdev->pci_slot); ++ /* For the two refs got in new_pcichild_device() */ ++ put_pcichild(hpdev); ++ put_pcichild(hpdev); ++ } ++ spin_unlock_irqrestore(&hbus->device_list_lock, flags); + } + + ret = hv_send_resources_released(hdev); +@@ -3301,13 +3308,23 @@ static int hv_pci_remove(struct hv_device *hdev) + + hbus = hv_get_drvdata(hdev); + if (hbus->state == hv_pcibus_installed) { ++ tasklet_disable(&hdev->channel->callback_event); ++ hbus->state = hv_pcibus_removing; ++ tasklet_enable(&hdev->channel->callback_event); ++ destroy_workqueue(hbus->wq); ++ hbus->wq = NULL; ++ /* ++ * At this point, no work is running or can be scheduled ++ * on hbus-wq. We can't race with hv_pci_devices_present() ++ * or hv_pci_eject_device(), it's safe to proceed. ++ */ ++ + /* Remove the bus from PCI's point of view. */ + pci_lock_rescan_remove(); + pci_stop_root_bus(hbus->pci_bus); + hv_pci_remove_slots(hbus); + pci_remove_root_bus(hbus->pci_bus); + pci_unlock_rescan_remove(); +- hbus->state = hv_pcibus_removed; + } + + ret = hv_pci_bus_exit(hdev, false); +@@ -3322,7 +3339,6 @@ static int hv_pci_remove(struct hv_device *hdev) + irq_domain_free_fwnode(hbus->sysdata.fwnode); + put_hvpcibus(hbus); + wait_for_completion(&hbus->remove_event); +- destroy_workqueue(hbus->wq); + + hv_put_dom_num(hbus->sysdata.domain); + +-- +2.30.2 + diff --git a/queue-5.13/pci-intel-gw-fix-intx-enable.patch b/queue-5.13/pci-intel-gw-fix-intx-enable.patch new file mode 100644 index 00000000000..040939983ea --- /dev/null +++ b/queue-5.13/pci-intel-gw-fix-intx-enable.patch @@ -0,0 +1,57 @@ +From e1da6abf24a0576fcf1d17181f4b3be36d8f7bd3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 6 Jan 2021 14:55:40 +0100 +Subject: PCI: intel-gw: Fix INTx enable + +From: Martin Blumenstingl + +[ Upstream commit 655832d12f2251e04031294f547c86935a0a126d ] + +The legacy PCI interrupt lines need to be enabled using PCIE_APP_IRNEN bits +13 (INTA), 14 (INTB), 15 (INTC) and 16 (INTD). The old code however was +taking (for example) "13" as raw value instead of taking BIT(13). Define +the legacy PCI interrupt bits using the BIT() macro and then use these in +PCIE_APP_IRN_INT. + +Link: https://lore.kernel.org/r/20210106135540.48420-1-martin.blumenstingl@googlemail.com +Fixes: ed22aaaede44 ("PCI: dwc: intel: PCIe RC controller driver") +Signed-off-by: Martin Blumenstingl +Signed-off-by: Lorenzo Pieralisi +Signed-off-by: Bjorn Helgaas +Acked-by: Rahul Tanwar +Signed-off-by: Sasha Levin +--- + drivers/pci/controller/dwc/pcie-intel-gw.c | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +diff --git a/drivers/pci/controller/dwc/pcie-intel-gw.c b/drivers/pci/controller/dwc/pcie-intel-gw.c +index f89a7d24ba28..d15cf35fa7f2 100644 +--- a/drivers/pci/controller/dwc/pcie-intel-gw.c ++++ b/drivers/pci/controller/dwc/pcie-intel-gw.c +@@ -39,6 +39,10 @@ + #define PCIE_APP_IRN_PM_TO_ACK BIT(9) + #define PCIE_APP_IRN_LINK_AUTO_BW_STAT BIT(11) + #define PCIE_APP_IRN_BW_MGT BIT(12) ++#define PCIE_APP_IRN_INTA BIT(13) ++#define PCIE_APP_IRN_INTB BIT(14) ++#define PCIE_APP_IRN_INTC BIT(15) ++#define PCIE_APP_IRN_INTD BIT(16) + #define PCIE_APP_IRN_MSG_LTR BIT(18) + #define PCIE_APP_IRN_SYS_ERR_RC BIT(29) + #define PCIE_APP_INTX_OFST 12 +@@ -48,10 +52,8 @@ + PCIE_APP_IRN_RX_VDM_MSG | PCIE_APP_IRN_SYS_ERR_RC | \ + PCIE_APP_IRN_PM_TO_ACK | PCIE_APP_IRN_MSG_LTR | \ + PCIE_APP_IRN_BW_MGT | PCIE_APP_IRN_LINK_AUTO_BW_STAT | \ +- (PCIE_APP_INTX_OFST + PCI_INTERRUPT_INTA) | \ +- (PCIE_APP_INTX_OFST + PCI_INTERRUPT_INTB) | \ +- (PCIE_APP_INTX_OFST + PCI_INTERRUPT_INTC) | \ +- (PCIE_APP_INTX_OFST + PCI_INTERRUPT_INTD)) ++ PCIE_APP_IRN_INTA | PCIE_APP_IRN_INTB | \ ++ PCIE_APP_IRN_INTC | PCIE_APP_IRN_INTD) + + #define BUS_IATU_OFFSET SZ_256M + #define RESET_INTERVAL_MS 100 +-- +2.30.2 + diff --git a/queue-5.13/pci-iproc-fix-multi-msi-base-vector-number-allocatio.patch b/queue-5.13/pci-iproc-fix-multi-msi-base-vector-number-allocatio.patch new file mode 100644 index 00000000000..a96dac7e47f --- /dev/null +++ b/queue-5.13/pci-iproc-fix-multi-msi-base-vector-number-allocatio.patch @@ -0,0 +1,75 @@ +From 124fdcad7cbddcc7fe71786ecf0758b6c4ec96f6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 22 Jun 2021 17:26:29 +0200 +Subject: PCI: iproc: Fix multi-MSI base vector number allocation +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Sandor Bodo-Merle + +[ Upstream commit e673d697b9a234fc3544ac240e173cef8c82b349 ] + +Commit fc54bae28818 ("PCI: iproc: Allow allocation of multiple MSIs") +introduced multi-MSI support with a broken allocation mechanism (it failed +to reserve the proper number of bits from the inner domain). Natural +alignment of the base vector number was also not guaranteed. + +Link: https://lore.kernel.org/r/20210622152630.40842-1-sbodomerle@gmail.com +Fixes: fc54bae28818 ("PCI: iproc: Allow allocation of multiple MSIs") +Reported-by: Pali Rohár +Signed-off-by: Sandor Bodo-Merle +Signed-off-by: Lorenzo Pieralisi +Acked-by: Marc Zyngier +Acked-by: Pali Rohár +Acked-by: Ray Jui +Signed-off-by: Sasha Levin +--- + drivers/pci/controller/pcie-iproc-msi.c | 21 +++++++++++---------- + 1 file changed, 11 insertions(+), 10 deletions(-) + +diff --git a/drivers/pci/controller/pcie-iproc-msi.c b/drivers/pci/controller/pcie-iproc-msi.c +index eede4e8f3f75..557d93dcb3bc 100644 +--- a/drivers/pci/controller/pcie-iproc-msi.c ++++ b/drivers/pci/controller/pcie-iproc-msi.c +@@ -252,18 +252,18 @@ static int iproc_msi_irq_domain_alloc(struct irq_domain *domain, + + mutex_lock(&msi->bitmap_lock); + +- /* Allocate 'nr_cpus' number of MSI vectors each time */ +- hwirq = bitmap_find_next_zero_area(msi->bitmap, msi->nr_msi_vecs, 0, +- msi->nr_cpus, 0); +- if (hwirq < msi->nr_msi_vecs) { +- bitmap_set(msi->bitmap, hwirq, msi->nr_cpus); +- } else { +- mutex_unlock(&msi->bitmap_lock); +- return -ENOSPC; +- } ++ /* ++ * Allocate 'nr_irqs' multiplied by 'nr_cpus' number of MSI vectors ++ * each time ++ */ ++ hwirq = bitmap_find_free_region(msi->bitmap, msi->nr_msi_vecs, ++ order_base_2(msi->nr_cpus * nr_irqs)); + + mutex_unlock(&msi->bitmap_lock); + ++ if (hwirq < 0) ++ return -ENOSPC; ++ + for (i = 0; i < nr_irqs; i++) { + irq_domain_set_info(domain, virq + i, hwirq + i, + &iproc_msi_bottom_irq_chip, +@@ -284,7 +284,8 @@ static void iproc_msi_irq_domain_free(struct irq_domain *domain, + mutex_lock(&msi->bitmap_lock); + + hwirq = hwirq_to_canonical_hwirq(msi, data->hwirq); +- bitmap_clear(msi->bitmap, hwirq, msi->nr_cpus); ++ bitmap_release_region(msi->bitmap, hwirq, ++ order_base_2(msi->nr_cpus * nr_irqs)); + + mutex_unlock(&msi->bitmap_lock); + +-- +2.30.2 + diff --git a/queue-5.13/pci-iproc-support-multi-msi-only-on-uniprocessor-ker.patch b/queue-5.13/pci-iproc-support-multi-msi-only-on-uniprocessor-ker.patch new file mode 100644 index 00000000000..807ca73e488 --- /dev/null +++ b/queue-5.13/pci-iproc-support-multi-msi-only-on-uniprocessor-ker.patch @@ -0,0 +1,67 @@ +From 7077fe1335214497146a8d90509e7d6485376539 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 22 Jun 2021 17:26:30 +0200 +Subject: PCI: iproc: Support multi-MSI only on uniprocessor kernel +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Sandor Bodo-Merle + +[ Upstream commit 2dc0a201d0f59e6818ef443609f0850a32910844 ] + +The interrupt affinity scheme used by this driver is incompatible with +multi-MSI as it implies moving the doorbell address to that of another MSI +group. This isn't possible for multi-MSI, as all the MSIs must have the +same doorbell address. As such it is restricted to systems with a single +CPU. + +Link: https://lore.kernel.org/r/20210622152630.40842-2-sbodomerle@gmail.com +Fixes: fc54bae28818 ("PCI: iproc: Allow allocation of multiple MSIs") +Reported-by: Marc Zyngier +Signed-off-by: Sandor Bodo-Merle +Signed-off-by: Lorenzo Pieralisi +Acked-by: Marc Zyngier +Acked-by: Pali Rohár +Acked-by: Ray Jui +Signed-off-by: Sasha Levin +--- + drivers/pci/controller/pcie-iproc-msi.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/drivers/pci/controller/pcie-iproc-msi.c b/drivers/pci/controller/pcie-iproc-msi.c +index 557d93dcb3bc..81b4effeb130 100644 +--- a/drivers/pci/controller/pcie-iproc-msi.c ++++ b/drivers/pci/controller/pcie-iproc-msi.c +@@ -171,7 +171,7 @@ static struct irq_chip iproc_msi_irq_chip = { + + static struct msi_domain_info iproc_msi_domain_info = { + .flags = MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS | +- MSI_FLAG_MULTI_PCI_MSI | MSI_FLAG_PCI_MSIX, ++ MSI_FLAG_PCI_MSIX, + .chip = &iproc_msi_irq_chip, + }; + +@@ -250,6 +250,9 @@ static int iproc_msi_irq_domain_alloc(struct irq_domain *domain, + struct iproc_msi *msi = domain->host_data; + int hwirq, i; + ++ if (msi->nr_cpus > 1 && nr_irqs > 1) ++ return -EINVAL; ++ + mutex_lock(&msi->bitmap_lock); + + /* +@@ -540,6 +543,9 @@ int iproc_msi_init(struct iproc_pcie *pcie, struct device_node *node) + mutex_init(&msi->bitmap_lock); + msi->nr_cpus = num_possible_cpus(); + ++ if (msi->nr_cpus == 1) ++ iproc_msi_domain_info.flags |= MSI_FLAG_MULTI_PCI_MSI; ++ + msi->nr_irqs = of_irq_count(node); + if (!msi->nr_irqs) { + dev_err(pcie->dev, "found no MSI GIC interrupt\n"); +-- +2.30.2 + diff --git a/queue-5.13/pci-mediatek-gen3-add-missing-module_device_table.patch b/queue-5.13/pci-mediatek-gen3-add-missing-module_device_table.patch new file mode 100644 index 00000000000..9dbd226f841 --- /dev/null +++ b/queue-5.13/pci-mediatek-gen3-add-missing-module_device_table.patch @@ -0,0 +1,41 @@ +From 96da7284e6b7ef6a93d20d35844bb7f2d48a92be Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 11 May 2021 15:11:31 +0800 +Subject: PCI: mediatek-gen3: Add missing MODULE_DEVICE_TABLE +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Zou Wei + +[ Upstream commit 3a2e476dc5d02af3422143b07d8db1eced475314 ] + +This patch adds missing MODULE_DEVICE_TABLE definition which generates +correct modalias for automatic loading of this driver when it is built +as an external module. + +Link: https://lore.kernel.org/r/1620717091-108691-1-git-send-email-zou_wei@huawei.com +Reported-by: Hulk Robot +Signed-off-by: Zou Wei +Signed-off-by: Lorenzo Pieralisi +Reviewed-by: Krzysztof Wilczyński +Signed-off-by: Sasha Levin +--- + drivers/pci/controller/pcie-mediatek-gen3.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/pci/controller/pcie-mediatek-gen3.c b/drivers/pci/controller/pcie-mediatek-gen3.c +index 3c5b97716d40..f3aeb8d4eaca 100644 +--- a/drivers/pci/controller/pcie-mediatek-gen3.c ++++ b/drivers/pci/controller/pcie-mediatek-gen3.c +@@ -1012,6 +1012,7 @@ static const struct of_device_id mtk_pcie_of_match[] = { + { .compatible = "mediatek,mt8192-pcie" }, + {}, + }; ++MODULE_DEVICE_TABLE(of, mtk_pcie_of_match); + + static struct platform_driver mtk_pcie_driver = { + .probe = mtk_pcie_probe, +-- +2.30.2 + diff --git a/queue-5.13/pci-p2pdma-avoid-pci_get_slot-which-may-sleep.patch b/queue-5.13/pci-p2pdma-avoid-pci_get_slot-which-may-sleep.patch new file mode 100644 index 00000000000..cd01585a5d6 --- /dev/null +++ b/queue-5.13/pci-p2pdma-avoid-pci_get_slot-which-may-sleep.patch @@ -0,0 +1,87 @@ +From b00a82b105c730676cb5add3ae6a2cd1670d509e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 10 Jun 2021 10:06:09 -0600 +Subject: PCI/P2PDMA: Avoid pci_get_slot(), which may sleep + +From: Logan Gunthorpe + +[ Upstream commit 3ec0c3ec2d92c09465534a1ff9c6f9d9506ffef6 ] + +In order to use upstream_bridge_distance_warn() from a dma_map function, it +must not sleep. However, pci_get_slot() takes the pci_bus_sem so it might +sleep. + +In order to avoid this, try to get the host bridge's device from the first +element in the device list. It should be impossible for the host bridge's +device to go away while references are held on child devices, so the first +element should not be able to change and, thus, this should be safe. + +Introduce a static function called pci_host_bridge_dev() to obtain the host +bridge's root device. + +Link: https://lore.kernel.org/r/20210610160609.28447-7-logang@deltatee.com +Signed-off-by: Logan Gunthorpe +Signed-off-by: Bjorn Helgaas +Signed-off-by: Sasha Levin +--- + drivers/pci/p2pdma.c | 34 ++++++++++++++++++++++++++++++++-- + 1 file changed, 32 insertions(+), 2 deletions(-) + +diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c +index 196382630363..c49c13a5fedc 100644 +--- a/drivers/pci/p2pdma.c ++++ b/drivers/pci/p2pdma.c +@@ -308,10 +308,41 @@ static const struct pci_p2pdma_whitelist_entry { + {} + }; + ++/* ++ * This lookup function tries to find the PCI device corresponding to a given ++ * host bridge. ++ * ++ * It assumes the host bridge device is the first PCI device in the ++ * bus->devices list and that the devfn is 00.0. These assumptions should hold ++ * for all the devices in the whitelist above. ++ * ++ * This function is equivalent to pci_get_slot(host->bus, 0), however it does ++ * not take the pci_bus_sem lock seeing __host_bridge_whitelist() must not ++ * sleep. ++ * ++ * For this to be safe, the caller should hold a reference to a device on the ++ * bridge, which should ensure the host_bridge device will not be freed ++ * or removed from the head of the devices list. ++ */ ++static struct pci_dev *pci_host_bridge_dev(struct pci_host_bridge *host) ++{ ++ struct pci_dev *root; ++ ++ root = list_first_entry_or_null(&host->bus->devices, ++ struct pci_dev, bus_list); ++ ++ if (!root) ++ return NULL; ++ if (root->devfn != PCI_DEVFN(0, 0)) ++ return NULL; ++ ++ return root; ++} ++ + static bool __host_bridge_whitelist(struct pci_host_bridge *host, + bool same_host_bridge) + { +- struct pci_dev *root = pci_get_slot(host->bus, PCI_DEVFN(0, 0)); ++ struct pci_dev *root = pci_host_bridge_dev(host); + const struct pci_p2pdma_whitelist_entry *entry; + unsigned short vendor, device; + +@@ -320,7 +351,6 @@ static bool __host_bridge_whitelist(struct pci_host_bridge *host, + + vendor = root->vendor; + device = root->device; +- pci_dev_put(root); + + for (entry = pci_p2pdma_whitelist; entry->vendor; entry++) { + if (vendor != entry->vendor || device != entry->device) +-- +2.30.2 + diff --git a/queue-5.13/pci-pciehp-ignore-link-down-up-caused-by-dpc.patch b/queue-5.13/pci-pciehp-ignore-link-down-up-caused-by-dpc.patch new file mode 100644 index 00000000000..2d520cb21dd --- /dev/null +++ b/queue-5.13/pci-pciehp-ignore-link-down-up-caused-by-dpc.patch @@ -0,0 +1,280 @@ +From e804bfe338513ed4b325b452ab2a37d7fbbc680c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 1 May 2021 10:29:00 +0200 +Subject: PCI: pciehp: Ignore Link Down/Up caused by DPC + +From: Lukas Wunner + +[ Upstream commit a97396c6eb13f65bea894dbe7739b2e883d40a3e ] + +Downstream Port Containment (PCIe r5.0, sec. 6.2.10) disables the link upon +an error and attempts to re-enable it when instructed by the DPC driver. + +A slot which is both DPC- and hotplug-capable is currently powered off by +pciehp once DPC is triggered (due to the link change) and powered back up +on successful recovery. That's undesirable, the slot should remain powered +so the hotplugged device remains bound to its driver. DPC notifies the +driver of the error and of successful recovery in pcie_do_recovery() and +the driver may then restore the device to working state. + +Moreover, Sinan points out that turning off slot power by pciehp may foil +recovery by DPC: Power off/on is a cold reset concurrently to DPC's warm +reset. Sathyanarayanan reports extended delays or failure in link +retraining by DPC if pciehp brings down the slot. + +Fix by detecting whether a Link Down event is caused by DPC and awaiting +recovery if so. On successful recovery, ignore both the Link Down and the +subsequent Link Up event. + +Afterwards, check whether the link is down to detect surprise-removal or +another DPC event immediately after DPC recovery. Ensure that the +corresponding DLLSC event is not ignored by synthesizing it and invoking +irq_wake_thread() to trigger a re-run of pciehp_ist(). + +The IRQ threads of the hotplug and DPC drivers, pciehp_ist() and +dpc_handler(), race against each other. If pciehp is faster than DPC, it +will wait until DPC recovery completes. + +Recovery consists of two steps: The first step (waiting for link +disablement) is recognizable by pciehp through a set DPC Trigger Status +bit. The second step (waiting for link retraining) is recognizable through +a newly introduced PCI_DPC_RECOVERING flag. + +If DPC is faster than pciehp, neither of the two flags will be set and +pciehp may glean the recovery status from the new PCI_DPC_RECOVERED flag. +The flag is zero if DPC didn't occur at all, hence DLLSC events are not +ignored by default. + +pciehp waits up to 4 seconds before assuming that DPC recovery failed and +bringing down the slot. This timeout is not taken from the spec (it +doesn't mandate one) but based on a report from Yicong Yang that DPC may +take a bit more than 3 seconds on HiSilicon's Kunpeng platform. + +The timeout is necessary because the DPC Trigger Status bit may never +clear: On Root Ports which support RP Extensions for DPC, the DPC driver +polls the DPC RP Busy bit for up to 1 second before giving up on DPC +recovery. Without the timeout, pciehp would then wait indefinitely for DPC +to complete. + +This commit draws inspiration from previous attempts to synchronize DPC +with pciehp: + +By Sinan Kaya, August 2018: +https://lore.kernel.org/linux-pci/20180818065126.77912-1-okaya@kernel.org/ + +By Ethan Zhao, October 2020: +https://lore.kernel.org/linux-pci/20201007113158.48933-1-haifeng.zhao@intel.com/ + +By Kuppuswamy Sathyanarayanan, March 2021: +https://lore.kernel.org/linux-pci/59cb30f5e5ac6d65427ceaadf1012b2ba8dbf66c.1615606143.git.sathyanarayanan.kuppuswamy@linux.intel.com/ + +Link: https://lore.kernel.org/r/0be565d97438fe2a6d57354b3aa4e8626952a00b.1619857124.git.lukas@wunner.de +Reported-by: Sinan Kaya +Reported-by: Ethan Zhao +Reported-by: Kuppuswamy Sathyanarayanan +Tested-by: Kuppuswamy Sathyanarayanan +Tested-by: Yicong Yang +Signed-off-by: Lukas Wunner +Signed-off-by: Bjorn Helgaas +Reviewed-by: Kuppuswamy Sathyanarayanan +Cc: Dan Williams +Cc: Ashok Raj +Cc: Keith Busch +Signed-off-by: Sasha Levin +--- + drivers/pci/hotplug/pciehp_hpc.c | 36 ++++++++++++++++ + drivers/pci/pci.h | 4 ++ + drivers/pci/pcie/dpc.c | 74 +++++++++++++++++++++++++++++--- + 3 files changed, 109 insertions(+), 5 deletions(-) + +diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c +index fb3840e222ad..9d06939736c0 100644 +--- a/drivers/pci/hotplug/pciehp_hpc.c ++++ b/drivers/pci/hotplug/pciehp_hpc.c +@@ -563,6 +563,32 @@ void pciehp_power_off_slot(struct controller *ctrl) + PCI_EXP_SLTCTL_PWR_OFF); + } + ++static void pciehp_ignore_dpc_link_change(struct controller *ctrl, ++ struct pci_dev *pdev, int irq) ++{ ++ /* ++ * Ignore link changes which occurred while waiting for DPC recovery. ++ * Could be several if DPC triggered multiple times consecutively. ++ */ ++ synchronize_hardirq(irq); ++ atomic_and(~PCI_EXP_SLTSTA_DLLSC, &ctrl->pending_events); ++ if (pciehp_poll_mode) ++ pcie_capability_write_word(pdev, PCI_EXP_SLTSTA, ++ PCI_EXP_SLTSTA_DLLSC); ++ ctrl_info(ctrl, "Slot(%s): Link Down/Up ignored (recovered by DPC)\n", ++ slot_name(ctrl)); ++ ++ /* ++ * If the link is unexpectedly down after successful recovery, ++ * the corresponding link change may have been ignored above. ++ * Synthesize it to ensure that it is acted on. ++ */ ++ down_read(&ctrl->reset_lock); ++ if (!pciehp_check_link_active(ctrl)) ++ pciehp_request(ctrl, PCI_EXP_SLTSTA_DLLSC); ++ up_read(&ctrl->reset_lock); ++} ++ + static irqreturn_t pciehp_isr(int irq, void *dev_id) + { + struct controller *ctrl = (struct controller *)dev_id; +@@ -706,6 +732,16 @@ static irqreturn_t pciehp_ist(int irq, void *dev_id) + PCI_EXP_SLTCTL_ATTN_IND_ON); + } + ++ /* ++ * Ignore Link Down/Up events caused by Downstream Port Containment ++ * if recovery from the error succeeded. ++ */ ++ if ((events & PCI_EXP_SLTSTA_DLLSC) && pci_dpc_recovered(pdev) && ++ ctrl->state == ON_STATE) { ++ events &= ~PCI_EXP_SLTSTA_DLLSC; ++ pciehp_ignore_dpc_link_change(ctrl, pdev, irq); ++ } ++ + /* + * Disable requests have higher priority than Presence Detect Changed + * or Data Link Layer State Changed events. +diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h +index 37c913bbc6e1..dac6922553b4 100644 +--- a/drivers/pci/pci.h ++++ b/drivers/pci/pci.h +@@ -385,6 +385,8 @@ static inline bool pci_dev_is_disconnected(const struct pci_dev *dev) + + /* pci_dev priv_flags */ + #define PCI_DEV_ADDED 0 ++#define PCI_DPC_RECOVERED 1 ++#define PCI_DPC_RECOVERING 2 + + static inline void pci_dev_assign_added(struct pci_dev *dev, bool added) + { +@@ -439,10 +441,12 @@ void pci_restore_dpc_state(struct pci_dev *dev); + void pci_dpc_init(struct pci_dev *pdev); + void dpc_process_error(struct pci_dev *pdev); + pci_ers_result_t dpc_reset_link(struct pci_dev *pdev); ++bool pci_dpc_recovered(struct pci_dev *pdev); + #else + static inline void pci_save_dpc_state(struct pci_dev *dev) {} + static inline void pci_restore_dpc_state(struct pci_dev *dev) {} + static inline void pci_dpc_init(struct pci_dev *pdev) {} ++static inline bool pci_dpc_recovered(struct pci_dev *pdev) { return false; } + #endif + + #ifdef CONFIG_PCIEPORTBUS +diff --git a/drivers/pci/pcie/dpc.c b/drivers/pci/pcie/dpc.c +index e05aba86a317..c556e7beafe3 100644 +--- a/drivers/pci/pcie/dpc.c ++++ b/drivers/pci/pcie/dpc.c +@@ -71,6 +71,58 @@ void pci_restore_dpc_state(struct pci_dev *dev) + pci_write_config_word(dev, dev->dpc_cap + PCI_EXP_DPC_CTL, *cap); + } + ++static DECLARE_WAIT_QUEUE_HEAD(dpc_completed_waitqueue); ++ ++#ifdef CONFIG_HOTPLUG_PCI_PCIE ++static bool dpc_completed(struct pci_dev *pdev) ++{ ++ u16 status; ++ ++ pci_read_config_word(pdev, pdev->dpc_cap + PCI_EXP_DPC_STATUS, &status); ++ if ((status != 0xffff) && (status & PCI_EXP_DPC_STATUS_TRIGGER)) ++ return false; ++ ++ if (test_bit(PCI_DPC_RECOVERING, &pdev->priv_flags)) ++ return false; ++ ++ return true; ++} ++ ++/** ++ * pci_dpc_recovered - whether DPC triggered and has recovered successfully ++ * @pdev: PCI device ++ * ++ * Return true if DPC was triggered for @pdev and has recovered successfully. ++ * Wait for recovery if it hasn't completed yet. Called from the PCIe hotplug ++ * driver to recognize and ignore Link Down/Up events caused by DPC. ++ */ ++bool pci_dpc_recovered(struct pci_dev *pdev) ++{ ++ struct pci_host_bridge *host; ++ ++ if (!pdev->dpc_cap) ++ return false; ++ ++ /* ++ * Synchronization between hotplug and DPC is not supported ++ * if DPC is owned by firmware and EDR is not enabled. ++ */ ++ host = pci_find_host_bridge(pdev->bus); ++ if (!host->native_dpc && !IS_ENABLED(CONFIG_PCIE_EDR)) ++ return false; ++ ++ /* ++ * Need a timeout in case DPC never completes due to failure of ++ * dpc_wait_rp_inactive(). The spec doesn't mandate a time limit, ++ * but reports indicate that DPC completes within 4 seconds. ++ */ ++ wait_event_timeout(dpc_completed_waitqueue, dpc_completed(pdev), ++ msecs_to_jiffies(4000)); ++ ++ return test_and_clear_bit(PCI_DPC_RECOVERED, &pdev->priv_flags); ++} ++#endif /* CONFIG_HOTPLUG_PCI_PCIE */ ++ + static int dpc_wait_rp_inactive(struct pci_dev *pdev) + { + unsigned long timeout = jiffies + HZ; +@@ -91,8 +143,11 @@ static int dpc_wait_rp_inactive(struct pci_dev *pdev) + + pci_ers_result_t dpc_reset_link(struct pci_dev *pdev) + { ++ pci_ers_result_t ret; + u16 cap; + ++ set_bit(PCI_DPC_RECOVERING, &pdev->priv_flags); ++ + /* + * DPC disables the Link automatically in hardware, so it has + * already been reset by the time we get here. +@@ -106,18 +161,27 @@ pci_ers_result_t dpc_reset_link(struct pci_dev *pdev) + if (!pcie_wait_for_link(pdev, false)) + pci_info(pdev, "Data Link Layer Link Active not cleared in 1000 msec\n"); + +- if (pdev->dpc_rp_extensions && dpc_wait_rp_inactive(pdev)) +- return PCI_ERS_RESULT_DISCONNECT; ++ if (pdev->dpc_rp_extensions && dpc_wait_rp_inactive(pdev)) { ++ clear_bit(PCI_DPC_RECOVERED, &pdev->priv_flags); ++ ret = PCI_ERS_RESULT_DISCONNECT; ++ goto out; ++ } + + pci_write_config_word(pdev, cap + PCI_EXP_DPC_STATUS, + PCI_EXP_DPC_STATUS_TRIGGER); + + if (!pcie_wait_for_link(pdev, true)) { + pci_info(pdev, "Data Link Layer Link Active not set in 1000 msec\n"); +- return PCI_ERS_RESULT_DISCONNECT; ++ clear_bit(PCI_DPC_RECOVERED, &pdev->priv_flags); ++ ret = PCI_ERS_RESULT_DISCONNECT; ++ } else { ++ set_bit(PCI_DPC_RECOVERED, &pdev->priv_flags); ++ ret = PCI_ERS_RESULT_RECOVERED; + } +- +- return PCI_ERS_RESULT_RECOVERED; ++out: ++ clear_bit(PCI_DPC_RECOVERING, &pdev->priv_flags); ++ wake_up_all(&dpc_completed_waitqueue); ++ return ret; + } + + static void dpc_process_rp_pio_error(struct pci_dev *pdev) +-- +2.30.2 + diff --git a/queue-5.13/pci-rockchip-register-irq-handlers-after-device-and-.patch b/queue-5.13/pci-rockchip-register-irq-handlers-after-device-and-.patch new file mode 100644 index 00000000000..3df96cd42f0 --- /dev/null +++ b/queue-5.13/pci-rockchip-register-irq-handlers-after-device-and-.patch @@ -0,0 +1,81 @@ +From 4ab0480884717688a737c51123dba8e3febebeb8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 8 Jun 2021 10:04:09 +0200 +Subject: PCI: rockchip: Register IRQ handlers after device and data are ready + +From: Javier Martinez Canillas + +[ Upstream commit 3cf5f7ab230e2b886e493c7a8449ed50e29d2b98 ] + +An IRQ handler may be called at any time after it is registered, so +anything it relies on must be ready before registration. + +rockchip_pcie_subsys_irq_handler() and rockchip_pcie_client_irq_handler() +read registers in the PCIe controller, but we registered them before +turning on clocks to the controller. If either is called before the clocks +are turned on, the register reads fail and the machine hangs. + +Similarly, rockchip_pcie_legacy_int_handler() uses rockchip->irq_domain, +but we installed it before initializing irq_domain. + +Register IRQ handlers after their data structures are initialized and +clocks are enabled. + +Found by enabling CONFIG_DEBUG_SHIRQ, which calls the IRQ handler when it +is being unregistered. An error during the probe path might cause this +unregistration and IRQ handler execution before the device or data +structure init has finished. + +[bhelgaas: commit log] +Link: https://lore.kernel.org/r/20210608080409.1729276-1-javierm@redhat.com +Reported-by: Peter Robinson +Tested-by: Peter Robinson +Signed-off-by: Javier Martinez Canillas +Signed-off-by: Lorenzo Pieralisi +Signed-off-by: Bjorn Helgaas +Acked-by: Shawn Lin +Signed-off-by: Sasha Levin +--- + drivers/pci/controller/pcie-rockchip-host.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/drivers/pci/controller/pcie-rockchip-host.c b/drivers/pci/controller/pcie-rockchip-host.c +index f1d08a1b1591..78d04ac29cd5 100644 +--- a/drivers/pci/controller/pcie-rockchip-host.c ++++ b/drivers/pci/controller/pcie-rockchip-host.c +@@ -592,10 +592,6 @@ static int rockchip_pcie_parse_host_dt(struct rockchip_pcie *rockchip) + if (err) + return err; + +- err = rockchip_pcie_setup_irq(rockchip); +- if (err) +- return err; +- + rockchip->vpcie12v = devm_regulator_get_optional(dev, "vpcie12v"); + if (IS_ERR(rockchip->vpcie12v)) { + if (PTR_ERR(rockchip->vpcie12v) != -ENODEV) +@@ -973,8 +969,6 @@ static int rockchip_pcie_probe(struct platform_device *pdev) + if (err) + goto err_vpcie; + +- rockchip_pcie_enable_interrupts(rockchip); +- + err = rockchip_pcie_init_irq_domain(rockchip); + if (err < 0) + goto err_deinit_port; +@@ -992,6 +986,12 @@ static int rockchip_pcie_probe(struct platform_device *pdev) + bridge->sysdata = rockchip; + bridge->ops = &rockchip_pcie_ops; + ++ err = rockchip_pcie_setup_irq(rockchip); ++ if (err) ++ goto err_remove_irq_domain; ++ ++ rockchip_pcie_enable_interrupts(rockchip); ++ + err = pci_host_probe(bridge); + if (err < 0) + goto err_remove_irq_domain; +-- +2.30.2 + diff --git a/queue-5.13/pci-sysfs-fix-dsm_label_utf16s_to_utf8s-buffer-overr.patch b/queue-5.13/pci-sysfs-fix-dsm_label_utf16s_to_utf8s-buffer-overr.patch new file mode 100644 index 00000000000..84ba7b3a832 --- /dev/null +++ b/queue-5.13/pci-sysfs-fix-dsm_label_utf16s_to_utf8s-buffer-overr.patch @@ -0,0 +1,47 @@ +From cd8ce849b5bedf133353a5d3ec14a4f25f0ab60f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 3 Jun 2021 00:01:12 +0000 +Subject: PCI/sysfs: Fix dsm_label_utf16s_to_utf8s() buffer overrun +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Krzysztof Wilczyński + +[ Upstream commit bdcdaa13ad96f1a530711c29e6d4b8311eff767c ] + +"utf16s_to_utf8s(..., buf, PAGE_SIZE)" puts up to PAGE_SIZE bytes into +"buf" and returns the number of bytes it actually put there. If it wrote +PAGE_SIZE bytes, the newline added by dsm_label_utf16s_to_utf8s() would +overrun "buf". + +Reduce the size available for utf16s_to_utf8s() to use so there is always +space for the newline. + +[bhelgaas: reorder patch in series, commit log] +Fixes: 6058989bad05 ("PCI: Export ACPI _DSM provided firmware instance number and string name to sysfs") +Link: https://lore.kernel.org/r/20210603000112.703037-7-kw@linux.com +Reported-by: Joe Perches +Signed-off-by: Krzysztof Wilczyński +Signed-off-by: Bjorn Helgaas +Signed-off-by: Sasha Levin +--- + drivers/pci/pci-label.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/pci/pci-label.c b/drivers/pci/pci-label.c +index c32f3b7540e8..76b381cf70b2 100644 +--- a/drivers/pci/pci-label.c ++++ b/drivers/pci/pci-label.c +@@ -145,7 +145,7 @@ static void dsm_label_utf16s_to_utf8s(union acpi_object *obj, char *buf) + len = utf16s_to_utf8s((const wchar_t *)obj->buffer.pointer, + obj->buffer.length, + UTF16_LITTLE_ENDIAN, +- buf, PAGE_SIZE); ++ buf, PAGE_SIZE - 1); + buf[len] = '\n'; + } + +-- +2.30.2 + diff --git a/queue-5.13/pci-tegra-add-missing-module_device_table.patch b/queue-5.13/pci-tegra-add-missing-module_device_table.patch new file mode 100644 index 00000000000..3041e6405a0 --- /dev/null +++ b/queue-5.13/pci-tegra-add-missing-module_device_table.patch @@ -0,0 +1,39 @@ +From 2ad3855f4b3393138e04774832acea08421b9e89 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 12 May 2021 12:07:02 +0800 +Subject: PCI: tegra: Add missing MODULE_DEVICE_TABLE + +From: Zou Wei + +[ Upstream commit 7bf475a4614a9722b9b989e53184a02596cf16d1 ] + +Add missing MODULE_DEVICE_TABLE definition so we generate correct modalias +for automatic loading of this driver when it is built as a module. + +Link: https://lore.kernel.org/r/1620792422-16535-1-git-send-email-zou_wei@huawei.com +Reported-by: Hulk Robot +Signed-off-by: Zou Wei +Signed-off-by: Lorenzo Pieralisi +Signed-off-by: Bjorn Helgaas +Reviewed-by: Vidya Sagar +Acked-by: Thierry Reding +Signed-off-by: Sasha Levin +--- + drivers/pci/controller/pci-tegra.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/pci/controller/pci-tegra.c b/drivers/pci/controller/pci-tegra.c +index 8069bd9232d4..c979229a6d0d 100644 +--- a/drivers/pci/controller/pci-tegra.c ++++ b/drivers/pci/controller/pci-tegra.c +@@ -2539,6 +2539,7 @@ static const struct of_device_id tegra_pcie_of_match[] = { + { .compatible = "nvidia,tegra20-pcie", .data = &tegra20_pcie }, + { }, + }; ++MODULE_DEVICE_TABLE(of, tegra_pcie_of_match); + + static void *tegra_pcie_ports_seq_start(struct seq_file *s, loff_t *pos) + { +-- +2.30.2 + diff --git a/queue-5.13/pci-tegra194-fix-tegra_pcie_ep_raise_msi_irq-ill-def.patch b/queue-5.13/pci-tegra194-fix-tegra_pcie_ep_raise_msi_irq-ill-def.patch new file mode 100644 index 00000000000..7a1dca8b649 --- /dev/null +++ b/queue-5.13/pci-tegra194-fix-tegra_pcie_ep_raise_msi_irq-ill-def.patch @@ -0,0 +1,51 @@ +From 9bf66f3e7bfe0e9661d0c3faa10d54190d662df9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 18 Jun 2021 17:02:19 +0100 +Subject: PCI: tegra194: Fix tegra_pcie_ep_raise_msi_irq() ill-defined shift + +From: Jon Hunter + +[ Upstream commit f67092eff2bd40650aad54a1a1910160f41d864a ] + +tegra_pcie_ep_raise_msi_irq() shifted a signed 32-bit value left by 31 +bits. The behavior of this is implementation-defined. + +Replace the shift by BIT(), which is well-defined. + +Found by cppcheck: + + $ cppcheck --enable=all drivers/pci/controller/dwc/pcie-tegra194.c + Checking drivers/pci/controller/dwc/pcie-tegra194.c ... + + drivers/pci/controller/dwc/pcie-tegra194.c:1829:23: portability: Shifting signed 32-bit value by 31 bits is implementation-defined behaviour. See condition at line 1826. [shiftTooManyBitsSigned] + + appl_writel(pcie, (1 << irq), APPL_MSI_CTRL_1); + ^ + +[bhelgaas: commit log] +Link: https://lore.kernel.org/r/20210618160219.303092-1-jonathanh@nvidia.com +Fixes: c57247f940e8 ("PCI: tegra: Add support for PCIe endpoint mode in Tegra194") +Signed-off-by: Jon Hunter +Signed-off-by: Lorenzo Pieralisi +Signed-off-by: Bjorn Helgaas +Signed-off-by: Sasha Levin +--- + drivers/pci/controller/dwc/pcie-tegra194.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/pci/controller/dwc/pcie-tegra194.c b/drivers/pci/controller/dwc/pcie-tegra194.c +index fa6b12cfc043..3ec7b29d5dc7 100644 +--- a/drivers/pci/controller/dwc/pcie-tegra194.c ++++ b/drivers/pci/controller/dwc/pcie-tegra194.c +@@ -1826,7 +1826,7 @@ static int tegra_pcie_ep_raise_msi_irq(struct tegra_pcie_dw *pcie, u16 irq) + if (unlikely(irq > 31)) + return -EINVAL; + +- appl_writel(pcie, (1 << irq), APPL_MSI_CTRL_1); ++ appl_writel(pcie, BIT(irq), APPL_MSI_CTRL_1); + + return 0; + } +-- +2.30.2 + diff --git a/queue-5.13/perf-report-fix-task-and-stat-with-pipe-input.patch b/queue-5.13/perf-report-fix-task-and-stat-with-pipe-input.patch new file mode 100644 index 00000000000..10e9cbf8d6c --- /dev/null +++ b/queue-5.13/perf-report-fix-task-and-stat-with-pipe-input.patch @@ -0,0 +1,104 @@ +From 25f6a201c0155943aa3e1d097e55967a06f4d387 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 29 Jun 2021 21:30:58 -0700 +Subject: perf report: Fix --task and --stat with pipe input + +From: Namhyung Kim + +[ Upstream commit 892ba7f18621a02af4428c58d97451f64685dba4 ] + +Current 'perf report' fails to process a pipe input when --task or +--stat options are used. This is because they reset all the tool +callbacks and fails to find a matching event for a sample. + +When pipe input is used, the event info is passed via ATTR records so it +needs to handle that operation. Otherwise the following error occurs. +Note, -14 (= -EFAULT) comes from evlist__parse_sample(): + + # perf record -a -o- sleep 1 | perf report -i- --stat + Can't parse sample, err = -14 + 0x271044 [0x38]: failed to process type: 9 + Error: + failed to process sample + # + +Committer testing: + +Before: + + $ perf record -o- sleep 1 | perf report -i- --stat + Can't parse sample, err = -14 + [ perf record: Woken up 1 times to write data ] + 0x1350 [0x30]: failed to process type: 9 + Error: + failed to process sample + [ perf record: Captured and wrote 0.000 MB - ] + $ + +After: + + $ perf record -o- sleep 1 | perf report -i- --stat + [ perf record: Woken up 1 times to write data ] + [ perf record: Captured and wrote 0.000 MB - ] + + Aggregated stats: + TOTAL events: 41 + COMM events: 2 ( 4.9%) + EXIT events: 1 ( 2.4%) + SAMPLE events: 9 (22.0%) + MMAP2 events: 4 ( 9.8%) + ATTR events: 1 ( 2.4%) + FINISHED_ROUND events: 1 ( 2.4%) + THREAD_MAP events: 1 ( 2.4%) + CPU_MAP events: 1 ( 2.4%) + EVENT_UPDATE events: 1 ( 2.4%) + TIME_CONV events: 1 ( 2.4%) + FEATURE events: 19 (46.3%) + cycles:uhH stats: + SAMPLE events: 9 + $ + +Fixes: a4a4d0a7a2b20f78 ("perf report: Add --stats option to display quick data statistics") +Signed-off-by: Namhyung Kim +Acked-by: Jiri Olsa +Tested-by: Arnaldo Carvalho de Melo +Cc: Andi Kleen +Cc: Ian Rogers +Cc: Peter Zijlstra +Link: http://lore.kernel.org/lkml/20210630043058.1131295-1-namhyung@kernel.org +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/perf/builtin-report.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c +index 36f9ccfeb38a..2eb40cf5ef0c 100644 +--- a/tools/perf/builtin-report.c ++++ b/tools/perf/builtin-report.c +@@ -729,9 +729,14 @@ static int count_sample_event(struct perf_tool *tool __maybe_unused, + return 0; + } + ++static int process_attr(struct perf_tool *tool __maybe_unused, ++ union perf_event *event, ++ struct evlist **pevlist); ++ + static void stats_setup(struct report *rep) + { + memset(&rep->tool, 0, sizeof(rep->tool)); ++ rep->tool.attr = process_attr; + rep->tool.sample = count_sample_event; + rep->tool.no_warn = true; + } +@@ -753,6 +758,7 @@ static void tasks_setup(struct report *rep) + rep->tool.mmap = perf_event__process_mmap; + rep->tool.mmap2 = perf_event__process_mmap2; + } ++ rep->tool.attr = process_attr; + rep->tool.comm = perf_event__process_comm; + rep->tool.exit = perf_event__process_exit; + rep->tool.fork = perf_event__process_fork; +-- +2.30.2 + diff --git a/queue-5.13/perf-script-python-fix-buffer-size-to-report-iregs-i.patch b/queue-5.13/perf-script-python-fix-buffer-size-to-report-iregs-i.patch new file mode 100644 index 00000000000..7225c39f38a --- /dev/null +++ b/queue-5.13/perf-script-python-fix-buffer-size-to-report-iregs-i.patch @@ -0,0 +1,95 @@ +From 36d37bc61bc0af44dac02a4bbf9d106d7d3b7230 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 28 Jun 2021 11:53:41 +0530 +Subject: perf script python: Fix buffer size to report iregs in perf script + +From: Kajol Jain + +[ Upstream commit dea8cfcc33695f70f56023b416cf88ae44c8a45a ] + +Commit 48a1f565261d2ab1 ("perf script python: Add more PMU fields to +event handler dict") added functionality to report fields like weight, +iregs, uregs etc via perf report. That commit predefined buffer size to +512 bytes to print those fields. + +But in PowerPC, since we added extended regs support in: + + 068aeea3773a6f4c ("perf powerpc: Support exposing Performance Monitor Counter SPRs as part of extended regs") + d735599a069f6936 ("powerpc/perf: Add extended regs support for power10 platform") + +Now iregs can carry more bytes of data and this predefined buffer size +can result to data loss in perf script output. + +This patch resolves this issue by making the buffer size dynamic, based +on the number of registers needed to print. It also changes the +regs_map() return type from int to void, as it is not being used by the +set_regs_in_dict(), its only caller. + +Fixes: 068aeea3773a6f4c ("perf powerpc: Support exposing Performance Monitor Counter SPRs as part of extended regs") +Signed-off-by: Kajol Jain +Tested-by: Nageswara R Sastry +Cc: Athira Jajeev +Cc: Jiri Olsa +Cc: Madhavan Srinivasan +Cc: Paul Clarke +Cc: Ravi Bangoria +Cc: linuxppc-dev@lists.ozlabs.org +Link: http://lore.kernel.org/lkml/20210628062341.155839-1-kjain@linux.ibm.com +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + .../util/scripting-engines/trace-event-python.c | 17 ++++++++++++----- + 1 file changed, 12 insertions(+), 5 deletions(-) + +diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c +index 3dfc543327af..18dbd9cddda8 100644 +--- a/tools/perf/util/scripting-engines/trace-event-python.c ++++ b/tools/perf/util/scripting-engines/trace-event-python.c +@@ -687,7 +687,7 @@ static void set_sample_datasrc_in_dict(PyObject *dict, + _PyUnicode_FromString(decode)); + } + +-static int regs_map(struct regs_dump *regs, uint64_t mask, char *bf, int size) ++static void regs_map(struct regs_dump *regs, uint64_t mask, char *bf, int size) + { + unsigned int i = 0, r; + int printed = 0; +@@ -695,7 +695,7 @@ static int regs_map(struct regs_dump *regs, uint64_t mask, char *bf, int size) + bf[0] = 0; + + if (!regs || !regs->regs) +- return 0; ++ return; + + for_each_set_bit(r, (unsigned long *) &mask, sizeof(mask) * 8) { + u64 val = regs->regs[i++]; +@@ -704,8 +704,6 @@ static int regs_map(struct regs_dump *regs, uint64_t mask, char *bf, int size) + "%5s:0x%" PRIx64 " ", + perf_reg_name(r), val); + } +- +- return printed; + } + + static void set_regs_in_dict(PyObject *dict, +@@ -713,7 +711,16 @@ static void set_regs_in_dict(PyObject *dict, + struct evsel *evsel) + { + struct perf_event_attr *attr = &evsel->core.attr; +- char bf[512]; ++ ++ /* ++ * Here value 28 is a constant size which can be used to print ++ * one register value and its corresponds to: ++ * 16 chars is to specify 64 bit register in hexadecimal. ++ * 2 chars is for appending "0x" to the hexadecimal value and ++ * 10 chars is for register name. ++ */ ++ int size = __sw_hweight64(attr->sample_regs_intr) * 28; ++ char bf[size]; + + regs_map(&sample->intr_regs, attr->sample_regs_intr, bf, sizeof(bf)); + +-- +2.30.2 + diff --git a/queue-5.13/perf-tools-fix-pattern-matching-for-same-substring-i.patch b/queue-5.13/perf-tools-fix-pattern-matching-for-same-substring-i.patch new file mode 100644 index 00000000000..f4fbd3306e4 --- /dev/null +++ b/queue-5.13/perf-tools-fix-pattern-matching-for-same-substring-i.patch @@ -0,0 +1,157 @@ +From 4844ff99daed9d6d135ce39d82eb9a29c67b991b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 1 Jul 2021 14:42:53 +0800 +Subject: perf tools: Fix pattern matching for same substring in different PMU + type + +From: Jin Yao + +[ Upstream commit c47a5599eda324bacdacd125227a0925d6c50fbe ] + +Some different PMU types may have the same substring. For example, on +Icelake server we have PMU types "uncore_imc" and +"uncore_imc_free_running". Both PMU types have the substring +"uncore_imc". But the parser wrongly thinks they are the same PMU type. + +We enable an imc event, +perf stat -e uncore_imc/event=0xe3/ -a -- sleep 1 + +Perf actually expands the event to: + + uncore_imc_0/event=0xe3/ + uncore_imc_1/event=0xe3/ + uncore_imc_2/event=0xe3/ + uncore_imc_3/event=0xe3/ + uncore_imc_4/event=0xe3/ + uncore_imc_5/event=0xe3/ + uncore_imc_6/event=0xe3/ + uncore_imc_7/event=0xe3/ + uncore_imc_free_running_0/event=0xe3/ + uncore_imc_free_running_1/event=0xe3/ + uncore_imc_free_running_3/event=0xe3/ + uncore_imc_free_running_4/event=0xe3/ + +That's because the "uncore_imc_free_running" matches the +pattern "uncore_imc*". + +Now we check that the last characters of PMU name is '_'. + +For example, for pattern "uncore_imc*", "uncore_imc_0" is parsed ok, but +"uncore_imc_free_running_0" fails. + +Fixes: b2b9d3a3f0211c5d ("perf pmu: Support wildcards on pmu name in dynamic pmu events") +Signed-off-by: Jin Yao +Reviewed-by: Kan Liang +Acked-by: Jiri Olsa +Cc: Agustin Vega-Frias +Cc: Alexander Shishkin +Cc: Andi Kleen +Cc: Peter Zijlstra +Link: http://lore.kernel.org/lkml/20210701064253.1175-1-yao.jin@linux.intel.com +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/perf/util/parse-events.y | 2 +- + tools/perf/util/pmu.c | 36 +++++++++++++++++++++++++++++++++- + tools/perf/util/pmu.h | 1 + + 3 files changed, 37 insertions(+), 2 deletions(-) + +diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y +index aba12a4d488e..9321bd0e2f76 100644 +--- a/tools/perf/util/parse-events.y ++++ b/tools/perf/util/parse-events.y +@@ -316,7 +316,7 @@ event_pmu_name opt_pmu_config + if (!strncmp(name, "uncore_", 7) && + strncmp($1, "uncore_", 7)) + name += 7; +- if (!fnmatch(pattern, name, 0)) { ++ if (!perf_pmu__match(pattern, name, $1)) { + if (parse_events_copy_term_list(orig_terms, &terms)) + CLEANUP_YYABORT; + if (!parse_events_add_pmu(_parse_state, list, pmu->name, terms, true, false)) +diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c +index 88c8ecdc60b0..44b90d638ad5 100644 +--- a/tools/perf/util/pmu.c ++++ b/tools/perf/util/pmu.c +@@ -3,6 +3,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -17,6 +18,7 @@ + #include + #include + #include ++#include + #include "debug.h" + #include "evsel.h" + #include "pmu.h" +@@ -740,6 +742,27 @@ struct pmu_events_map *__weak pmu_events_map__find(void) + return perf_pmu__find_map(NULL); + } + ++static bool perf_pmu__valid_suffix(char *pmu_name, char *tok) ++{ ++ char *p; ++ ++ if (strncmp(pmu_name, tok, strlen(tok))) ++ return false; ++ ++ p = pmu_name + strlen(tok); ++ if (*p == 0) ++ return true; ++ ++ if (*p != '_') ++ return false; ++ ++ ++p; ++ if (*p == 0 || !isdigit(*p)) ++ return false; ++ ++ return true; ++} ++ + bool pmu_uncore_alias_match(const char *pmu_name, const char *name) + { + char *tmp = NULL, *tok, *str; +@@ -768,7 +791,7 @@ bool pmu_uncore_alias_match(const char *pmu_name, const char *name) + */ + for (; tok; name += strlen(tok), tok = strtok_r(NULL, ",", &tmp)) { + name = strstr(name, tok); +- if (!name) { ++ if (!name || !perf_pmu__valid_suffix((char *)name, tok)) { + res = false; + goto out; + } +@@ -1872,3 +1895,14 @@ bool perf_pmu__has_hybrid(void) + + return !list_empty(&perf_pmu__hybrid_pmus); + } ++ ++int perf_pmu__match(char *pattern, char *name, char *tok) ++{ ++ if (fnmatch(pattern, name, 0)) ++ return -1; ++ ++ if (tok && !perf_pmu__valid_suffix(name, tok)) ++ return -1; ++ ++ return 0; ++} +diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h +index a790ef758171..926da483a141 100644 +--- a/tools/perf/util/pmu.h ++++ b/tools/perf/util/pmu.h +@@ -133,5 +133,6 @@ void perf_pmu__warn_invalid_config(struct perf_pmu *pmu, __u64 config, + char *name); + + bool perf_pmu__has_hybrid(void); ++int perf_pmu__match(char *pattern, char *name, char *tok); + + #endif /* __PMU_H */ +-- +2.30.2 + diff --git a/queue-5.13/phy-intel-fix-for-warnings-due-to-emmc-clock-175mhz-.patch b/queue-5.13/phy-intel-fix-for-warnings-due-to-emmc-clock-175mhz-.patch new file mode 100644 index 00000000000..e2db3978f5f --- /dev/null +++ b/queue-5.13/phy-intel-fix-for-warnings-due-to-emmc-clock-175mhz-.patch @@ -0,0 +1,45 @@ +From b4ccd52f5dcaeb93be87349ea8111eb36a4608e7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 3 Jun 2021 23:52:42 +0530 +Subject: phy: intel: Fix for warnings due to EMMC clock 175Mhz change in FIP + +From: Rashmi A + +[ Upstream commit 2f2b73a29d2aabf5ad0150856c3e5cb6e04dcfc1 ] + +Since the EMMC clock was changed from 200Mhz to 175Mhz in FIP, +there were some warnings introduced, as the frequency values +being checked was still wrt 200Mhz in code. Hence, the frequency +checks are now updated based on the current 175Mhz EMMC clock changed +in FIP. + +Spamming kernel log msg: +"phy phy-20290000.mmc_phy.2: Unsupported rate: 43750000" + +Signed-off-by: Rashmi A +Reviewed-by: Adrian Hunter +Acked-By: Vinod Koul +Link: https://lore.kernel.org/r/20210603182242.25733-3-rashmi.a@intel.com +Signed-off-by: Ulf Hansson +Signed-off-by: Sasha Levin +--- + drivers/phy/intel/phy-intel-keembay-emmc.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/phy/intel/phy-intel-keembay-emmc.c b/drivers/phy/intel/phy-intel-keembay-emmc.c +index eb7c635ed89a..0eb11ac7c2e2 100644 +--- a/drivers/phy/intel/phy-intel-keembay-emmc.c ++++ b/drivers/phy/intel/phy-intel-keembay-emmc.c +@@ -95,7 +95,8 @@ static int keembay_emmc_phy_power(struct phy *phy, bool on_off) + else + freqsel = 0x0; + +- if (mhz < 50 || mhz > 200) ++ /* Check for EMMC clock rate*/ ++ if (mhz > 175) + dev_warn(&phy->dev, "Unsupported rate: %d MHz\n", mhz); + + /* +-- +2.30.2 + diff --git a/queue-5.13/power-reset-gpio-poweroff-add-missing-module_device_.patch b/queue-5.13/power-reset-gpio-poweroff-add-missing-module_device_.patch new file mode 100644 index 00000000000..823a32b08bb --- /dev/null +++ b/queue-5.13/power-reset-gpio-poweroff-add-missing-module_device_.patch @@ -0,0 +1,36 @@ +From 03fd9fc8142cc93e9ee2efdddc2cdab1760a1f00 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 8 May 2021 11:14:59 +0800 +Subject: power: reset: gpio-poweroff: add missing MODULE_DEVICE_TABLE + +From: Bixuan Cui + +[ Upstream commit ed3443fb4df4e140a22f65144546c8a8e1e27f4e ] + +This patch adds missing MODULE_DEVICE_TABLE definition which generates +correct modalias for automatic loading of this driver when it is built +as an external module. + +Reported-by: Hulk Robot +Signed-off-by: Bixuan Cui +Signed-off-by: Sebastian Reichel +Signed-off-by: Sasha Levin +--- + drivers/power/reset/gpio-poweroff.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/power/reset/gpio-poweroff.c b/drivers/power/reset/gpio-poweroff.c +index c5067eb75370..1c5af2fef142 100644 +--- a/drivers/power/reset/gpio-poweroff.c ++++ b/drivers/power/reset/gpio-poweroff.c +@@ -90,6 +90,7 @@ static const struct of_device_id of_gpio_poweroff_match[] = { + { .compatible = "gpio-poweroff", }, + {}, + }; ++MODULE_DEVICE_TABLE(of, of_gpio_poweroff_match); + + static struct platform_driver gpio_poweroff_driver = { + .probe = gpio_poweroff_probe, +-- +2.30.2 + diff --git a/queue-5.13/power-reset-regulator-poweroff-add-missing-module_de.patch b/queue-5.13/power-reset-regulator-poweroff-add-missing-module_de.patch new file mode 100644 index 00000000000..3a7676d4465 --- /dev/null +++ b/queue-5.13/power-reset-regulator-poweroff-add-missing-module_de.patch @@ -0,0 +1,36 @@ +From 997d6b20a90b31ca66f74fb5fc515b81494458ff Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 5 Jun 2021 09:21:23 +0800 +Subject: power: reset: regulator-poweroff: add missing MODULE_DEVICE_TABLE + +From: Zou Wei + +[ Upstream commit 4465b3a621e761d82d1a92e3fda88c5d33c804b8 ] + +This patch adds missing MODULE_DEVICE_TABLE definition which generates +correct modalias for automatic loading of this driver when it is built +as an external module. + +Reported-by: Hulk Robot +Signed-off-by: Zou Wei +Signed-off-by: Sebastian Reichel +Signed-off-by: Sasha Levin +--- + drivers/power/reset/regulator-poweroff.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/power/reset/regulator-poweroff.c b/drivers/power/reset/regulator-poweroff.c +index f697088e0ad1..20701203935f 100644 +--- a/drivers/power/reset/regulator-poweroff.c ++++ b/drivers/power/reset/regulator-poweroff.c +@@ -64,6 +64,7 @@ static const struct of_device_id of_regulator_poweroff_match[] = { + { .compatible = "regulator-poweroff", }, + {}, + }; ++MODULE_DEVICE_TABLE(of, of_regulator_poweroff_match); + + static struct platform_driver regulator_poweroff_driver = { + .probe = regulator_poweroff_probe, +-- +2.30.2 + diff --git a/queue-5.13/power-supply-ab8500-add-missing-module_device_table.patch b/queue-5.13/power-supply-ab8500-add-missing-module_device_table.patch new file mode 100644 index 00000000000..1726930a077 --- /dev/null +++ b/queue-5.13/power-supply-ab8500-add-missing-module_device_table.patch @@ -0,0 +1,62 @@ +From 72d38d2b96b013f1d9373628b99b9fe8c07bc832 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 5 Jun 2021 09:21:41 +0800 +Subject: power: supply: ab8500: add missing MODULE_DEVICE_TABLE + +From: Zou Wei + +[ Upstream commit dfe52db13ab8d24857a9840ec7ca75eef800c26c ] + +This patch adds missing MODULE_DEVICE_TABLE definition which generates +correct modalias for automatic loading of this driver when it is built +as an external module. + +Reported-by: Hulk Robot +Signed-off-by: Zou Wei +Signed-off-by: Sebastian Reichel +Signed-off-by: Sasha Levin +--- + drivers/power/supply/ab8500_btemp.c | 1 + + drivers/power/supply/ab8500_charger.c | 1 + + drivers/power/supply/ab8500_fg.c | 1 + + 3 files changed, 3 insertions(+) + +diff --git a/drivers/power/supply/ab8500_btemp.c b/drivers/power/supply/ab8500_btemp.c +index 3598b5a748e7..4df305c767c5 100644 +--- a/drivers/power/supply/ab8500_btemp.c ++++ b/drivers/power/supply/ab8500_btemp.c +@@ -1104,6 +1104,7 @@ static const struct of_device_id ab8500_btemp_match[] = { + { .compatible = "stericsson,ab8500-btemp", }, + { }, + }; ++MODULE_DEVICE_TABLE(of, ab8500_btemp_match); + + struct platform_driver ab8500_btemp_driver = { + .probe = ab8500_btemp_probe, +diff --git a/drivers/power/supply/ab8500_charger.c b/drivers/power/supply/ab8500_charger.c +index e6f23ae05f95..98127e3591f9 100644 +--- a/drivers/power/supply/ab8500_charger.c ++++ b/drivers/power/supply/ab8500_charger.c +@@ -3708,6 +3708,7 @@ static const struct of_device_id ab8500_charger_match[] = { + { .compatible = "stericsson,ab8500-charger", }, + { }, + }; ++MODULE_DEVICE_TABLE(of, ab8500_charger_match); + + static struct platform_driver ab8500_charger_driver = { + .probe = ab8500_charger_probe, +diff --git a/drivers/power/supply/ab8500_fg.c b/drivers/power/supply/ab8500_fg.c +index acf0f2471c0b..46c718e9ebb7 100644 +--- a/drivers/power/supply/ab8500_fg.c ++++ b/drivers/power/supply/ab8500_fg.c +@@ -3218,6 +3218,7 @@ static const struct of_device_id ab8500_fg_match[] = { + { .compatible = "stericsson,ab8500-fg", }, + { }, + }; ++MODULE_DEVICE_TABLE(of, ab8500_fg_match); + + struct platform_driver ab8500_fg_driver = { + .probe = ab8500_fg_probe, +-- +2.30.2 + diff --git a/queue-5.13/power-supply-ab8500-avoid-null-pointers.patch b/queue-5.13/power-supply-ab8500-avoid-null-pointers.patch new file mode 100644 index 00000000000..d97da3d2d84 --- /dev/null +++ b/queue-5.13/power-supply-ab8500-avoid-null-pointers.patch @@ -0,0 +1,60 @@ +From 70ca1f647496f93771b25819899786f0aa125e52 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 23 May 2021 00:50:41 +0200 +Subject: power: supply: ab8500: Avoid NULL pointers + +From: Linus Walleij + +[ Upstream commit 5bcb5087c9dd3dca1ff0ebd8002c5313c9332b56 ] + +Sometimes the code will crash because we haven't enabled +AC or USB charging and thus not created the corresponding +psy device. Fix it by checking that it is there before +notifying. + +Signed-off-by: Linus Walleij +Signed-off-by: Sebastian Reichel +Signed-off-by: Sasha Levin +--- + drivers/power/supply/ab8500_charger.c | 18 +++++++++++++++++- + 1 file changed, 17 insertions(+), 1 deletion(-) + +diff --git a/drivers/power/supply/ab8500_charger.c b/drivers/power/supply/ab8500_charger.c +index af32cfae9f19..57fbfe3d8c03 100644 +--- a/drivers/power/supply/ab8500_charger.c ++++ b/drivers/power/supply/ab8500_charger.c +@@ -415,6 +415,14 @@ disable_otp: + static void ab8500_power_supply_changed(struct ab8500_charger *di, + struct power_supply *psy) + { ++ /* ++ * This happens if we get notifications or interrupts and ++ * the platform has been configured not to support one or ++ * other type of charging. ++ */ ++ if (!psy) ++ return; ++ + if (di->autopower_cfg) { + if (!di->usb.charger_connected && + !di->ac.charger_connected && +@@ -441,7 +449,15 @@ static void ab8500_charger_set_usb_connected(struct ab8500_charger *di, + if (!connected) + di->flags.vbus_drop_end = false; + +- sysfs_notify(&di->usb_chg.psy->dev.kobj, NULL, "present"); ++ /* ++ * Sometimes the platform is configured not to support ++ * USB charging and no psy has been created, but we still ++ * will get these notifications. ++ */ ++ if (di->usb_chg.psy) { ++ sysfs_notify(&di->usb_chg.psy->dev.kobj, NULL, ++ "present"); ++ } + + if (connected) { + mutex_lock(&di->charger_attached_mutex); +-- +2.30.2 + diff --git a/queue-5.13/power-supply-ab8500-enable-usb-and-ac.patch b/queue-5.13/power-supply-ab8500-enable-usb-and-ac.patch new file mode 100644 index 00000000000..e451c074fa9 --- /dev/null +++ b/queue-5.13/power-supply-ab8500-enable-usb-and-ac.patch @@ -0,0 +1,91 @@ +From 11ebd89745523de6b1a67bb7ae00c2866abde0d9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 23 May 2021 00:50:42 +0200 +Subject: power: supply: ab8500: Enable USB and AC + +From: Linus Walleij + +[ Upstream commit f9184a228d7a60ad56b810d549a7debb355f1be6 ] + +The vendor code tree supplies platform data to enable he +USB charging for AB8500 and AB8500 and disable the AC +charging on the AB8505. This was missed when the driver +was submitted to the mainline kernel. + +Fix this by doing what the vendor kernel does: always +register the USB charger, do not register the AC charger +on the AB8505. + +Signed-off-by: Linus Walleij +Signed-off-by: Sebastian Reichel +Signed-off-by: Sasha Levin +--- + drivers/power/supply/ab8500-bm.h | 2 -- + drivers/power/supply/ab8500_charger.c | 24 ++++++++++++++---------- + 2 files changed, 14 insertions(+), 12 deletions(-) + +diff --git a/drivers/power/supply/ab8500-bm.h b/drivers/power/supply/ab8500-bm.h +index 012595a9d269..871bdc1f5cbd 100644 +--- a/drivers/power/supply/ab8500-bm.h ++++ b/drivers/power/supply/ab8500-bm.h +@@ -507,8 +507,6 @@ struct abx500_bm_data { + int bkup_bat_v; + int bkup_bat_i; + bool autopower_cfg; +- bool ac_enabled; +- bool usb_enabled; + bool no_maintenance; + bool capacity_scaling; + bool chg_unknown_bat; +diff --git a/drivers/power/supply/ab8500_charger.c b/drivers/power/supply/ab8500_charger.c +index 57fbfe3d8c03..e6f23ae05f95 100644 +--- a/drivers/power/supply/ab8500_charger.c ++++ b/drivers/power/supply/ab8500_charger.c +@@ -3511,7 +3511,14 @@ static int ab8500_charger_probe(struct platform_device *pdev) + di->ac_chg.max_out_curr = + di->bm->chg_output_curr[di->bm->n_chg_out_curr - 1]; + di->ac_chg.wdt_refresh = CHG_WD_INTERVAL; +- di->ac_chg.enabled = di->bm->ac_enabled; ++ /* ++ * The AB8505 only supports USB charging. If we are not the ++ * AB8505, register an AC charger. ++ * ++ * TODO: if this should be opt-in, add DT properties for this. ++ */ ++ if (!is_ab8505(di->parent)) ++ di->ac_chg.enabled = true; + di->ac_chg.external = false; + + /* USB supply */ +@@ -3525,7 +3532,6 @@ static int ab8500_charger_probe(struct platform_device *pdev) + di->usb_chg.max_out_curr = + di->bm->chg_output_curr[di->bm->n_chg_out_curr - 1]; + di->usb_chg.wdt_refresh = CHG_WD_INTERVAL; +- di->usb_chg.enabled = di->bm->usb_enabled; + di->usb_chg.external = false; + di->usb_state.usb_current = -1; + +@@ -3599,14 +3605,12 @@ static int ab8500_charger_probe(struct platform_device *pdev) + } + + /* Register USB charger class */ +- if (di->usb_chg.enabled) { +- di->usb_chg.psy = devm_power_supply_register(dev, +- &ab8500_usb_chg_desc, +- &usb_psy_cfg); +- if (IS_ERR(di->usb_chg.psy)) { +- dev_err(dev, "failed to register USB charger\n"); +- return PTR_ERR(di->usb_chg.psy); +- } ++ di->usb_chg.psy = devm_power_supply_register(dev, ++ &ab8500_usb_chg_desc, ++ &usb_psy_cfg); ++ if (IS_ERR(di->usb_chg.psy)) { ++ dev_err(dev, "failed to register USB charger\n"); ++ return PTR_ERR(di->usb_chg.psy); + } + + /* Identify the connected charger types during startup */ +-- +2.30.2 + diff --git a/queue-5.13/power-supply-ab8500-move-to-componentized-binding.patch b/queue-5.13/power-supply-ab8500-move-to-componentized-binding.patch new file mode 100644 index 00000000000..1ad3c758801 --- /dev/null +++ b/queue-5.13/power-supply-ab8500-move-to-componentized-binding.patch @@ -0,0 +1,1189 @@ +From 8c77d026da9ad99c205cebca50686a8d1730bdbf Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 23 May 2021 00:50:39 +0200 +Subject: power: supply: ab8500: Move to componentized binding + +From: Linus Walleij + +[ Upstream commit 1c1f13a006ed0d71bb5664c8b7e3e77a28da3beb ] + +The driver has problems with the different components of +the charging code racing with each other to probe(). + +This results in all four subdrivers populating battery +information to ascertain that it is populated for their +own needs for example. + +Fix this by using component probing and thus expressing +to the kernel that these are dependent components. +The probes can happen in any order and will only acquire +resources such as state container, regulators and +interrupts and initialize the data structures, but no +execution happens until the .bind() callback is called. + +The charging driver is the main component and binds +first, then bind in order the three subcomponents: +ab8500-fg, ab8500-btemp and ab8500-chargalg. + +Do some housekeeping while we are moving the code around. +Like use devm_* for IRQs so as to cut down on some +boilerplate. + +Signed-off-by: Linus Walleij +Signed-off-by: Sebastian Reichel +Signed-off-by: Sasha Levin +--- + drivers/power/supply/ab8500-bm.h | 4 + + drivers/power/supply/ab8500_btemp.c | 118 ++++----- + drivers/power/supply/ab8500_charger.c | 339 ++++++++++++++----------- + drivers/power/supply/ab8500_fg.c | 136 +++++----- + drivers/power/supply/abx500_chargalg.c | 116 +++++---- + 5 files changed, 379 insertions(+), 334 deletions(-) + +diff --git a/drivers/power/supply/ab8500-bm.h b/drivers/power/supply/ab8500-bm.h +index 41c69a4f2a1f..012595a9d269 100644 +--- a/drivers/power/supply/ab8500-bm.h ++++ b/drivers/power/supply/ab8500-bm.h +@@ -730,4 +730,8 @@ int ab8500_bm_of_probe(struct device *dev, + struct device_node *np, + struct abx500_bm_data *bm); + ++extern struct platform_driver ab8500_fg_driver; ++extern struct platform_driver ab8500_btemp_driver; ++extern struct platform_driver abx500_chargalg_driver; ++ + #endif /* _AB8500_CHARGER_H_ */ +diff --git a/drivers/power/supply/ab8500_btemp.c b/drivers/power/supply/ab8500_btemp.c +index fdfcd59fc43e..3598b5a748e7 100644 +--- a/drivers/power/supply/ab8500_btemp.c ++++ b/drivers/power/supply/ab8500_btemp.c +@@ -13,6 +13,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -932,26 +933,6 @@ static int __maybe_unused ab8500_btemp_suspend(struct device *dev) + return 0; + } + +-static int ab8500_btemp_remove(struct platform_device *pdev) +-{ +- struct ab8500_btemp *di = platform_get_drvdata(pdev); +- int i, irq; +- +- /* Disable interrupts */ +- for (i = 0; i < ARRAY_SIZE(ab8500_btemp_irq); i++) { +- irq = platform_get_irq_byname(pdev, ab8500_btemp_irq[i].name); +- free_irq(irq, di); +- } +- +- /* Delete the work queue */ +- destroy_workqueue(di->btemp_wq); +- +- flush_scheduled_work(); +- power_supply_unregister(di->btemp_psy); +- +- return 0; +-} +- + static char *supply_interface[] = { + "ab8500_chargalg", + "ab8500_fg", +@@ -966,6 +947,40 @@ static const struct power_supply_desc ab8500_btemp_desc = { + .external_power_changed = ab8500_btemp_external_power_changed, + }; + ++static int ab8500_btemp_bind(struct device *dev, struct device *master, ++ void *data) ++{ ++ struct ab8500_btemp *di = dev_get_drvdata(dev); ++ ++ /* Create a work queue for the btemp */ ++ di->btemp_wq = ++ alloc_workqueue("ab8500_btemp_wq", WQ_MEM_RECLAIM, 0); ++ if (di->btemp_wq == NULL) { ++ dev_err(dev, "failed to create work queue\n"); ++ return -ENOMEM; ++ } ++ ++ /* Kick off periodic temperature measurements */ ++ ab8500_btemp_periodic(di, true); ++ ++ return 0; ++} ++ ++static void ab8500_btemp_unbind(struct device *dev, struct device *master, ++ void *data) ++{ ++ struct ab8500_btemp *di = dev_get_drvdata(dev); ++ ++ /* Delete the work queue */ ++ destroy_workqueue(di->btemp_wq); ++ flush_scheduled_work(); ++} ++ ++static const struct component_ops ab8500_btemp_component_ops = { ++ .bind = ab8500_btemp_bind, ++ .unbind = ab8500_btemp_unbind, ++}; ++ + static int ab8500_btemp_probe(struct platform_device *pdev) + { + struct device_node *np = pdev->dev.of_node; +@@ -1011,14 +1026,6 @@ static int ab8500_btemp_probe(struct platform_device *pdev) + psy_cfg.num_supplicants = ARRAY_SIZE(supply_interface); + psy_cfg.drv_data = di; + +- /* Create a work queue for the btemp */ +- di->btemp_wq = +- alloc_workqueue("ab8500_btemp_wq", WQ_MEM_RECLAIM, 0); +- if (di->btemp_wq == NULL) { +- dev_err(dev, "failed to create work queue\n"); +- return -ENOMEM; +- } +- + /* Init work for measuring temperature periodically */ + INIT_DEFERRABLE_WORK(&di->btemp_periodic_work, + ab8500_btemp_periodic_work); +@@ -1031,7 +1038,7 @@ static int ab8500_btemp_probe(struct platform_device *pdev) + AB8500_BTEMP_HIGH_TH, &val); + if (ret < 0) { + dev_err(dev, "%s ab8500 read failed\n", __func__); +- goto free_btemp_wq; ++ return ret; + } + switch (val) { + case BTEMP_HIGH_TH_57_0: +@@ -1050,30 +1057,28 @@ static int ab8500_btemp_probe(struct platform_device *pdev) + } + + /* Register BTEMP power supply class */ +- di->btemp_psy = power_supply_register(dev, &ab8500_btemp_desc, +- &psy_cfg); ++ di->btemp_psy = devm_power_supply_register(dev, &ab8500_btemp_desc, ++ &psy_cfg); + if (IS_ERR(di->btemp_psy)) { + dev_err(dev, "failed to register BTEMP psy\n"); +- ret = PTR_ERR(di->btemp_psy); +- goto free_btemp_wq; ++ return PTR_ERR(di->btemp_psy); + } + + /* Register interrupts */ + for (i = 0; i < ARRAY_SIZE(ab8500_btemp_irq); i++) { + irq = platform_get_irq_byname(pdev, ab8500_btemp_irq[i].name); +- if (irq < 0) { +- ret = irq; +- goto free_irq; +- } ++ if (irq < 0) ++ return irq; + +- ret = request_threaded_irq(irq, NULL, ab8500_btemp_irq[i].isr, ++ ret = devm_request_threaded_irq(dev, irq, NULL, ++ ab8500_btemp_irq[i].isr, + IRQF_SHARED | IRQF_NO_SUSPEND | IRQF_ONESHOT, + ab8500_btemp_irq[i].name, di); + + if (ret) { + dev_err(dev, "failed to request %s IRQ %d: %d\n" + , ab8500_btemp_irq[i].name, irq, ret); +- goto free_irq; ++ return ret; + } + dev_dbg(dev, "Requested %s IRQ %d: %d\n", + ab8500_btemp_irq[i].name, irq, ret); +@@ -1081,23 +1086,16 @@ static int ab8500_btemp_probe(struct platform_device *pdev) + + platform_set_drvdata(pdev, di); + +- /* Kick off periodic temperature measurements */ +- ab8500_btemp_periodic(di, true); + list_add_tail(&di->node, &ab8500_btemp_list); + +- return ret; ++ return component_add(dev, &ab8500_btemp_component_ops); ++} + +-free_irq: +- /* We also have to free all successfully registered irqs */ +- for (i = i - 1; i >= 0; i--) { +- irq = platform_get_irq_byname(pdev, ab8500_btemp_irq[i].name); +- free_irq(irq, di); +- } ++static int ab8500_btemp_remove(struct platform_device *pdev) ++{ ++ component_del(&pdev->dev, &ab8500_btemp_component_ops); + +- power_supply_unregister(di->btemp_psy); +-free_btemp_wq: +- destroy_workqueue(di->btemp_wq); +- return ret; ++ return 0; + } + + static SIMPLE_DEV_PM_OPS(ab8500_btemp_pm_ops, ab8500_btemp_suspend, ab8500_btemp_resume); +@@ -1107,7 +1105,7 @@ static const struct of_device_id ab8500_btemp_match[] = { + { }, + }; + +-static struct platform_driver ab8500_btemp_driver = { ++struct platform_driver ab8500_btemp_driver = { + .probe = ab8500_btemp_probe, + .remove = ab8500_btemp_remove, + .driver = { +@@ -1116,20 +1114,6 @@ static struct platform_driver ab8500_btemp_driver = { + .pm = &ab8500_btemp_pm_ops, + }, + }; +- +-static int __init ab8500_btemp_init(void) +-{ +- return platform_driver_register(&ab8500_btemp_driver); +-} +- +-static void __exit ab8500_btemp_exit(void) +-{ +- platform_driver_unregister(&ab8500_btemp_driver); +-} +- +-device_initcall(ab8500_btemp_init); +-module_exit(ab8500_btemp_exit); +- + MODULE_LICENSE("GPL v2"); + MODULE_AUTHOR("Johan Palsson, Karl Komierowski, Arun R Murthy"); + MODULE_ALIAS("platform:ab8500-btemp"); +diff --git a/drivers/power/supply/ab8500_charger.c b/drivers/power/supply/ab8500_charger.c +index a9be10eb2c22..af32cfae9f19 100644 +--- a/drivers/power/supply/ab8500_charger.c ++++ b/drivers/power/supply/ab8500_charger.c +@@ -13,6 +13,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -3276,10 +3277,74 @@ static struct notifier_block charger_nb = { + .notifier_call = ab8500_external_charger_prepare, + }; + +-static int ab8500_charger_remove(struct platform_device *pdev) ++static char *supply_interface[] = { ++ "ab8500_chargalg", ++ "ab8500_fg", ++ "ab8500_btemp", ++}; ++ ++static const struct power_supply_desc ab8500_ac_chg_desc = { ++ .name = "ab8500_ac", ++ .type = POWER_SUPPLY_TYPE_MAINS, ++ .properties = ab8500_charger_ac_props, ++ .num_properties = ARRAY_SIZE(ab8500_charger_ac_props), ++ .get_property = ab8500_charger_ac_get_property, ++}; ++ ++static const struct power_supply_desc ab8500_usb_chg_desc = { ++ .name = "ab8500_usb", ++ .type = POWER_SUPPLY_TYPE_USB, ++ .properties = ab8500_charger_usb_props, ++ .num_properties = ARRAY_SIZE(ab8500_charger_usb_props), ++ .get_property = ab8500_charger_usb_get_property, ++}; ++ ++static int ab8500_charger_bind(struct device *dev) + { +- struct ab8500_charger *di = platform_get_drvdata(pdev); +- int i, irq, ret; ++ struct ab8500_charger *di = dev_get_drvdata(dev); ++ int ch_stat; ++ int ret; ++ ++ /* Create a work queue for the charger */ ++ di->charger_wq = alloc_ordered_workqueue("ab8500_charger_wq", ++ WQ_MEM_RECLAIM); ++ if (di->charger_wq == NULL) { ++ dev_err(dev, "failed to create work queue\n"); ++ return -ENOMEM; ++ } ++ ++ ch_stat = ab8500_charger_detect_chargers(di, false); ++ ++ if (ch_stat & AC_PW_CONN) { ++ if (is_ab8500(di->parent)) ++ queue_delayed_work(di->charger_wq, ++ &di->ac_charger_attached_work, ++ HZ); ++ } ++ if (ch_stat & USB_PW_CONN) { ++ if (is_ab8500(di->parent)) ++ queue_delayed_work(di->charger_wq, ++ &di->usb_charger_attached_work, ++ HZ); ++ di->vbus_detected = true; ++ di->vbus_detected_start = true; ++ queue_work(di->charger_wq, ++ &di->detect_usb_type_work); ++ } ++ ++ ret = component_bind_all(dev, di); ++ if (ret) { ++ dev_err(dev, "can't bind component devices\n"); ++ return ret; ++ } ++ ++ return 0; ++} ++ ++static void ab8500_charger_unbind(struct device *dev) ++{ ++ struct ab8500_charger *di = dev_get_drvdata(dev); ++ int ret; + + /* Disable AC charging */ + ab8500_charger_ac_en(&di->ac_chg, false, 0, 0); +@@ -3287,68 +3352,47 @@ static int ab8500_charger_remove(struct platform_device *pdev) + /* Disable USB charging */ + ab8500_charger_usb_en(&di->usb_chg, false, 0, 0); + +- /* Disable interrupts */ +- for (i = 0; i < ARRAY_SIZE(ab8500_charger_irq); i++) { +- irq = platform_get_irq_byname(pdev, ab8500_charger_irq[i].name); +- free_irq(irq, di); +- } +- + /* Backup battery voltage and current disable */ + ret = abx500_mask_and_set_register_interruptible(di->dev, + AB8500_RTC, AB8500_RTC_CTRL_REG, RTC_BUP_CH_ENA, 0); + if (ret < 0) + dev_err(di->dev, "%s mask and set failed\n", __func__); + +- usb_unregister_notifier(di->usb_phy, &di->nb); +- usb_put_phy(di->usb_phy); +- + /* Delete the work queue */ + destroy_workqueue(di->charger_wq); + +- /* Unregister external charger enable notifier */ +- if (!di->ac_chg.enabled) +- blocking_notifier_chain_unregister( +- &charger_notifier_list, &charger_nb); +- + flush_scheduled_work(); +- if (di->usb_chg.enabled) +- power_supply_unregister(di->usb_chg.psy); +- +- if (di->ac_chg.enabled && !di->ac_chg.external) +- power_supply_unregister(di->ac_chg.psy); + +- return 0; ++ /* Unbind fg, btemp, algorithm */ ++ component_unbind_all(dev, di); + } + +-static char *supply_interface[] = { +- "ab8500_chargalg", +- "ab8500_fg", +- "ab8500_btemp", ++static const struct component_master_ops ab8500_charger_comp_ops = { ++ .bind = ab8500_charger_bind, ++ .unbind = ab8500_charger_unbind, + }; + +-static const struct power_supply_desc ab8500_ac_chg_desc = { +- .name = "ab8500_ac", +- .type = POWER_SUPPLY_TYPE_MAINS, +- .properties = ab8500_charger_ac_props, +- .num_properties = ARRAY_SIZE(ab8500_charger_ac_props), +- .get_property = ab8500_charger_ac_get_property, ++static struct platform_driver *const ab8500_charger_component_drivers[] = { ++ &ab8500_fg_driver, ++ &ab8500_btemp_driver, ++ &abx500_chargalg_driver, + }; + +-static const struct power_supply_desc ab8500_usb_chg_desc = { +- .name = "ab8500_usb", +- .type = POWER_SUPPLY_TYPE_USB, +- .properties = ab8500_charger_usb_props, +- .num_properties = ARRAY_SIZE(ab8500_charger_usb_props), +- .get_property = ab8500_charger_usb_get_property, +-}; ++static int ab8500_charger_compare_dev(struct device *dev, void *data) ++{ ++ return dev == data; ++} + + static int ab8500_charger_probe(struct platform_device *pdev) + { +- struct device_node *np = pdev->dev.of_node; ++ struct device *dev = &pdev->dev; ++ struct device_node *np = dev->of_node; ++ struct component_match *match = NULL; + struct power_supply_config ac_psy_cfg = {}, usb_psy_cfg = {}; + struct ab8500_charger *di; +- int irq, i, charger_status, ret = 0, ch_stat; +- struct device *dev = &pdev->dev; ++ int charger_status; ++ int i, irq; ++ int ret; + + di = devm_kzalloc(dev, sizeof(*di), GFP_KERNEL); + if (!di) +@@ -3393,6 +3437,38 @@ static int ab8500_charger_probe(struct platform_device *pdev) + return ret; + } + ++ /* ++ * VDD ADC supply needs to be enabled from this driver when there ++ * is a charger connected to avoid erroneous BTEMP_HIGH/LOW ++ * interrupts during charging ++ */ ++ di->regu = devm_regulator_get(dev, "vddadc"); ++ if (IS_ERR(di->regu)) { ++ ret = PTR_ERR(di->regu); ++ dev_err(dev, "failed to get vddadc regulator\n"); ++ return ret; ++ } ++ ++ /* Request interrupts */ ++ for (i = 0; i < ARRAY_SIZE(ab8500_charger_irq); i++) { ++ irq = platform_get_irq_byname(pdev, ab8500_charger_irq[i].name); ++ if (irq < 0) ++ return irq; ++ ++ ret = devm_request_threaded_irq(dev, ++ irq, NULL, ab8500_charger_irq[i].isr, ++ IRQF_SHARED | IRQF_NO_SUSPEND | IRQF_ONESHOT, ++ ab8500_charger_irq[i].name, di); ++ ++ if (ret != 0) { ++ dev_err(dev, "failed to request %s IRQ %d: %d\n" ++ , ab8500_charger_irq[i].name, irq, ret); ++ return ret; ++ } ++ dev_dbg(dev, "Requested %s IRQ %d: %d\n", ++ ab8500_charger_irq[i].name, irq, ret); ++ } ++ + /* initialize lock */ + spin_lock_init(&di->usb_state.usb_lock); + mutex_init(&di->usb_ipt_crnt_lock); +@@ -3422,11 +3498,6 @@ static int ab8500_charger_probe(struct platform_device *pdev) + di->ac_chg.enabled = di->bm->ac_enabled; + di->ac_chg.external = false; + +- /*notifier for external charger enabling*/ +- if (!di->ac_chg.enabled) +- blocking_notifier_chain_register( +- &charger_notifier_list, &charger_nb); +- + /* USB supply */ + /* ux500_charger sub-class */ + di->usb_chg.ops.enable = &ab8500_charger_usb_en; +@@ -3442,14 +3513,6 @@ static int ab8500_charger_probe(struct platform_device *pdev) + di->usb_chg.external = false; + di->usb_state.usb_current = -1; + +- /* Create a work queue for the charger */ +- di->charger_wq = alloc_ordered_workqueue("ab8500_charger_wq", +- WQ_MEM_RECLAIM); +- if (di->charger_wq == NULL) { +- dev_err(dev, "failed to create work queue\n"); +- return -ENOMEM; +- } +- + mutex_init(&di->charger_attached_mutex); + + /* Init work for HW failure check */ +@@ -3500,63 +3563,36 @@ static int ab8500_charger_probe(struct platform_device *pdev) + INIT_WORK(&di->check_usb_thermal_prot_work, + ab8500_charger_check_usb_thermal_prot_work); + +- /* +- * VDD ADC supply needs to be enabled from this driver when there +- * is a charger connected to avoid erroneous BTEMP_HIGH/LOW +- * interrupts during charging +- */ +- di->regu = devm_regulator_get(dev, "vddadc"); +- if (IS_ERR(di->regu)) { +- ret = PTR_ERR(di->regu); +- dev_err(dev, "failed to get vddadc regulator\n"); +- goto free_charger_wq; +- } +- + + /* Initialize OVV, and other registers */ + ret = ab8500_charger_init_hw_registers(di); + if (ret) { + dev_err(dev, "failed to initialize ABB registers\n"); +- goto free_charger_wq; ++ return ret; + } + + /* Register AC charger class */ + if (di->ac_chg.enabled) { +- di->ac_chg.psy = power_supply_register(dev, ++ di->ac_chg.psy = devm_power_supply_register(dev, + &ab8500_ac_chg_desc, + &ac_psy_cfg); + if (IS_ERR(di->ac_chg.psy)) { + dev_err(dev, "failed to register AC charger\n"); +- ret = PTR_ERR(di->ac_chg.psy); +- goto free_charger_wq; ++ return PTR_ERR(di->ac_chg.psy); + } + } + + /* Register USB charger class */ + if (di->usb_chg.enabled) { +- di->usb_chg.psy = power_supply_register(dev, ++ di->usb_chg.psy = devm_power_supply_register(dev, + &ab8500_usb_chg_desc, + &usb_psy_cfg); + if (IS_ERR(di->usb_chg.psy)) { + dev_err(dev, "failed to register USB charger\n"); +- ret = PTR_ERR(di->usb_chg.psy); +- goto free_ac; ++ return PTR_ERR(di->usb_chg.psy); + } + } + +- di->usb_phy = usb_get_phy(USB_PHY_TYPE_USB2); +- if (IS_ERR_OR_NULL(di->usb_phy)) { +- dev_err(dev, "failed to get usb transceiver\n"); +- ret = -EINVAL; +- goto free_usb; +- } +- di->nb.notifier_call = ab8500_charger_usb_notifier_call; +- ret = usb_register_notifier(di->usb_phy, &di->nb); +- if (ret) { +- dev_err(dev, "failed to register usb notifier\n"); +- goto put_usb_phy; +- } +- + /* Identify the connected charger types during startup */ + charger_status = ab8500_charger_detect_chargers(di, true); + if (charger_status & AC_PW_CONN) { +@@ -3566,78 +3602,86 @@ static int ab8500_charger_probe(struct platform_device *pdev) + sysfs_notify(&di->ac_chg.psy->dev.kobj, NULL, "present"); + } + +- if (charger_status & USB_PW_CONN) { +- di->vbus_detected = true; +- di->vbus_detected_start = true; +- queue_work(di->charger_wq, +- &di->detect_usb_type_work); +- } +- +- /* Register interrupts */ +- for (i = 0; i < ARRAY_SIZE(ab8500_charger_irq); i++) { +- irq = platform_get_irq_byname(pdev, ab8500_charger_irq[i].name); +- if (irq < 0) { +- ret = irq; +- goto free_irq; +- } ++ platform_set_drvdata(pdev, di); + +- ret = request_threaded_irq(irq, NULL, ab8500_charger_irq[i].isr, +- IRQF_SHARED | IRQF_NO_SUSPEND | IRQF_ONESHOT, +- ab8500_charger_irq[i].name, di); ++ /* Create something that will match the subdrivers when we bind */ ++ for (i = 0; i < ARRAY_SIZE(ab8500_charger_component_drivers); i++) { ++ struct device_driver *drv = &ab8500_charger_component_drivers[i]->driver; ++ struct device *p = NULL, *d; + +- if (ret != 0) { +- dev_err(dev, "failed to request %s IRQ %d: %d\n" +- , ab8500_charger_irq[i].name, irq, ret); +- goto free_irq; ++ while ((d = platform_find_device_by_driver(p, drv))) { ++ put_device(p); ++ component_match_add(dev, &match, ++ ab8500_charger_compare_dev, d); ++ p = d; + } +- dev_dbg(dev, "Requested %s IRQ %d: %d\n", +- ab8500_charger_irq[i].name, irq, ret); ++ put_device(p); ++ } ++ if (!match) { ++ dev_err(dev, "no matching components\n"); ++ return -ENODEV; ++ } ++ if (IS_ERR(match)) { ++ dev_err(dev, "could not create component match\n"); ++ return PTR_ERR(match); + } + +- platform_set_drvdata(pdev, di); ++ /* Notifier for external charger enabling */ ++ if (!di->ac_chg.enabled) ++ blocking_notifier_chain_register( ++ &charger_notifier_list, &charger_nb); + +- mutex_lock(&di->charger_attached_mutex); + +- ch_stat = ab8500_charger_detect_chargers(di, false); +- +- if ((ch_stat & AC_PW_CONN) == AC_PW_CONN) { +- if (is_ab8500(di->parent)) +- queue_delayed_work(di->charger_wq, +- &di->ac_charger_attached_work, +- HZ); ++ di->usb_phy = usb_get_phy(USB_PHY_TYPE_USB2); ++ if (IS_ERR_OR_NULL(di->usb_phy)) { ++ dev_err(dev, "failed to get usb transceiver\n"); ++ ret = -EINVAL; ++ goto out_charger_notifier; + } +- if ((ch_stat & USB_PW_CONN) == USB_PW_CONN) { +- if (is_ab8500(di->parent)) +- queue_delayed_work(di->charger_wq, +- &di->usb_charger_attached_work, +- HZ); ++ di->nb.notifier_call = ab8500_charger_usb_notifier_call; ++ ret = usb_register_notifier(di->usb_phy, &di->nb); ++ if (ret) { ++ dev_err(dev, "failed to register usb notifier\n"); ++ goto put_usb_phy; + } + +- mutex_unlock(&di->charger_attached_mutex); + +- return ret; ++ ret = component_master_add_with_match(&pdev->dev, ++ &ab8500_charger_comp_ops, ++ match); ++ if (ret) { ++ dev_err(dev, "failed to add component master\n"); ++ goto free_notifier; ++ } + +-free_irq: +- usb_unregister_notifier(di->usb_phy, &di->nb); ++ return 0; + +- /* We also have to free all successfully registered irqs */ +- for (i = i - 1; i >= 0; i--) { +- irq = platform_get_irq_byname(pdev, ab8500_charger_irq[i].name); +- free_irq(irq, di); +- } ++free_notifier: ++ usb_unregister_notifier(di->usb_phy, &di->nb); + put_usb_phy: + usb_put_phy(di->usb_phy); +-free_usb: +- if (di->usb_chg.enabled) +- power_supply_unregister(di->usb_chg.psy); +-free_ac: +- if (di->ac_chg.enabled) +- power_supply_unregister(di->ac_chg.psy); +-free_charger_wq: +- destroy_workqueue(di->charger_wq); ++out_charger_notifier: ++ if (!di->ac_chg.enabled) ++ blocking_notifier_chain_unregister( ++ &charger_notifier_list, &charger_nb); + return ret; + } + ++static int ab8500_charger_remove(struct platform_device *pdev) ++{ ++ struct ab8500_charger *di = platform_get_drvdata(pdev); ++ ++ component_master_del(&pdev->dev, &ab8500_charger_comp_ops); ++ ++ usb_unregister_notifier(di->usb_phy, &di->nb); ++ usb_put_phy(di->usb_phy); ++ if (!di->ac_chg.enabled) ++ blocking_notifier_chain_unregister( ++ &charger_notifier_list, &charger_nb); ++ ++ return 0; ++} ++ + static SIMPLE_DEV_PM_OPS(ab8500_charger_pm_ops, ab8500_charger_suspend, ab8500_charger_resume); + + static const struct of_device_id ab8500_charger_match[] = { +@@ -3657,15 +3701,24 @@ static struct platform_driver ab8500_charger_driver = { + + static int __init ab8500_charger_init(void) + { ++ int ret; ++ ++ ret = platform_register_drivers(ab8500_charger_component_drivers, ++ ARRAY_SIZE(ab8500_charger_component_drivers)); ++ if (ret) ++ return ret; ++ + return platform_driver_register(&ab8500_charger_driver); + } + + static void __exit ab8500_charger_exit(void) + { ++ platform_unregister_drivers(ab8500_charger_component_drivers, ++ ARRAY_SIZE(ab8500_charger_component_drivers)); + platform_driver_unregister(&ab8500_charger_driver); + } + +-subsys_initcall_sync(ab8500_charger_init); ++module_init(ab8500_charger_init); + module_exit(ab8500_charger_exit); + + MODULE_LICENSE("GPL v2"); +diff --git a/drivers/power/supply/ab8500_fg.c b/drivers/power/supply/ab8500_fg.c +index 0c7c01a0d979..acf0f2471c0b 100644 +--- a/drivers/power/supply/ab8500_fg.c ++++ b/drivers/power/supply/ab8500_fg.c +@@ -17,6 +17,7 @@ + + #include + #include ++#include + #include + #include + #include +@@ -2980,27 +2981,6 @@ static int __maybe_unused ab8500_fg_suspend(struct device *dev) + return 0; + } + +-static int ab8500_fg_remove(struct platform_device *pdev) +-{ +- int ret = 0; +- struct ab8500_fg *di = platform_get_drvdata(pdev); +- +- list_del(&di->node); +- +- /* Disable coulomb counter */ +- ret = ab8500_fg_coulomb_counter(di, false); +- if (ret) +- dev_err(di->dev, "failed to disable coulomb counter\n"); +- +- destroy_workqueue(di->fg_wq); +- ab8500_fg_sysfs_exit(di); +- +- flush_scheduled_work(); +- ab8500_fg_sysfs_psy_remove_attrs(di); +- power_supply_unregister(di->fg_psy); +- return ret; +-} +- + /* ab8500 fg driver interrupts and their respective isr */ + static struct ab8500_fg_interrupts ab8500_fg_irq[] = { + {"NCONV_ACCU", ab8500_fg_cc_convend_handler}, +@@ -3024,11 +3004,50 @@ static const struct power_supply_desc ab8500_fg_desc = { + .external_power_changed = ab8500_fg_external_power_changed, + }; + ++static int ab8500_fg_bind(struct device *dev, struct device *master, ++ void *data) ++{ ++ struct ab8500_fg *di = dev_get_drvdata(dev); ++ ++ /* Create a work queue for running the FG algorithm */ ++ di->fg_wq = alloc_ordered_workqueue("ab8500_fg_wq", WQ_MEM_RECLAIM); ++ if (di->fg_wq == NULL) { ++ dev_err(dev, "failed to create work queue\n"); ++ return -ENOMEM; ++ } ++ ++ /* Start the coulomb counter */ ++ ab8500_fg_coulomb_counter(di, true); ++ /* Run the FG algorithm */ ++ queue_delayed_work(di->fg_wq, &di->fg_periodic_work, 0); ++ ++ return 0; ++} ++ ++static void ab8500_fg_unbind(struct device *dev, struct device *master, ++ void *data) ++{ ++ struct ab8500_fg *di = dev_get_drvdata(dev); ++ int ret; ++ ++ /* Disable coulomb counter */ ++ ret = ab8500_fg_coulomb_counter(di, false); ++ if (ret) ++ dev_err(dev, "failed to disable coulomb counter\n"); ++ ++ destroy_workqueue(di->fg_wq); ++ flush_scheduled_work(); ++} ++ ++static const struct component_ops ab8500_fg_component_ops = { ++ .bind = ab8500_fg_bind, ++ .unbind = ab8500_fg_unbind, ++}; ++ + static int ab8500_fg_probe(struct platform_device *pdev) + { +- struct device_node *np = pdev->dev.of_node; +- struct power_supply_config psy_cfg = {}; + struct device *dev = &pdev->dev; ++ struct power_supply_config psy_cfg = {}; + struct ab8500_fg *di; + int i, irq; + int ret = 0; +@@ -3074,13 +3093,6 @@ static int ab8500_fg_probe(struct platform_device *pdev) + ab8500_fg_charge_state_to(di, AB8500_FG_CHARGE_INIT); + ab8500_fg_discharge_state_to(di, AB8500_FG_DISCHARGE_INIT); + +- /* Create a work queue for running the FG algorithm */ +- di->fg_wq = alloc_ordered_workqueue("ab8500_fg_wq", WQ_MEM_RECLAIM); +- if (di->fg_wq == NULL) { +- dev_err(dev, "failed to create work queue\n"); +- return -ENOMEM; +- } +- + /* Init work for running the fg algorithm instantly */ + INIT_WORK(&di->fg_work, ab8500_fg_instant_work); + +@@ -3113,7 +3125,7 @@ static int ab8500_fg_probe(struct platform_device *pdev) + ret = ab8500_fg_init_hw_registers(di); + if (ret) { + dev_err(dev, "failed to initialize registers\n"); +- goto free_inst_curr_wq; ++ return ret; + } + + /* Consider battery unknown until we're informed otherwise */ +@@ -3121,15 +3133,13 @@ static int ab8500_fg_probe(struct platform_device *pdev) + di->flags.batt_id_received = false; + + /* Register FG power supply class */ +- di->fg_psy = power_supply_register(dev, &ab8500_fg_desc, &psy_cfg); ++ di->fg_psy = devm_power_supply_register(dev, &ab8500_fg_desc, &psy_cfg); + if (IS_ERR(di->fg_psy)) { + dev_err(dev, "failed to register FG psy\n"); +- ret = PTR_ERR(di->fg_psy); +- goto free_inst_curr_wq; ++ return PTR_ERR(di->fg_psy); + } + + di->fg_samples = SEC_TO_SAMPLE(di->bm->fg_params->init_timer); +- ab8500_fg_coulomb_counter(di, true); + + /* + * Initialize completion used to notify completion and start +@@ -3141,19 +3151,18 @@ static int ab8500_fg_probe(struct platform_device *pdev) + /* Register primary interrupt handlers */ + for (i = 0; i < ARRAY_SIZE(ab8500_fg_irq); i++) { + irq = platform_get_irq_byname(pdev, ab8500_fg_irq[i].name); +- if (irq < 0) { +- ret = irq; +- goto free_irq; +- } ++ if (irq < 0) ++ return irq; + +- ret = request_threaded_irq(irq, NULL, ab8500_fg_irq[i].isr, ++ ret = devm_request_threaded_irq(dev, irq, NULL, ++ ab8500_fg_irq[i].isr, + IRQF_SHARED | IRQF_NO_SUSPEND | IRQF_ONESHOT, + ab8500_fg_irq[i].name, di); + + if (ret != 0) { + dev_err(dev, "failed to request %s IRQ %d: %d\n", + ab8500_fg_irq[i].name, irq, ret); +- goto free_irq; ++ return ret; + } + dev_dbg(dev, "Requested %s IRQ %d: %d\n", + ab8500_fg_irq[i].name, irq, ret); +@@ -3168,14 +3177,14 @@ static int ab8500_fg_probe(struct platform_device *pdev) + ret = ab8500_fg_sysfs_init(di); + if (ret) { + dev_err(dev, "failed to create sysfs entry\n"); +- goto free_irq; ++ return ret; + } + + ret = ab8500_fg_sysfs_psy_create_attrs(di); + if (ret) { + dev_err(dev, "failed to create FG psy\n"); + ab8500_fg_sysfs_exit(di); +- goto free_irq; ++ return ret; + } + + /* Calibrate the fg first time */ +@@ -3185,24 +3194,21 @@ static int ab8500_fg_probe(struct platform_device *pdev) + /* Use room temp as default value until we get an update from driver. */ + di->bat_temp = 210; + +- /* Run the FG algorithm */ +- queue_delayed_work(di->fg_wq, &di->fg_periodic_work, 0); +- + list_add_tail(&di->node, &ab8500_fg_list); + +- return ret; ++ return component_add(dev, &ab8500_fg_component_ops); ++} + +-free_irq: +- /* We also have to free all registered irqs */ +- while (--i >= 0) { +- /* Last assignment of i from primary interrupt handlers */ +- irq = platform_get_irq_byname(pdev, ab8500_fg_irq[i].name); +- free_irq(irq, di); +- } ++static int ab8500_fg_remove(struct platform_device *pdev) ++{ ++ int ret = 0; ++ struct ab8500_fg *di = platform_get_drvdata(pdev); ++ ++ component_del(&pdev->dev, &ab8500_fg_component_ops); ++ list_del(&di->node); ++ ab8500_fg_sysfs_exit(di); ++ ab8500_fg_sysfs_psy_remove_attrs(di); + +- power_supply_unregister(di->fg_psy); +-free_inst_curr_wq: +- destroy_workqueue(di->fg_wq); + return ret; + } + +@@ -3213,7 +3219,7 @@ static const struct of_device_id ab8500_fg_match[] = { + { }, + }; + +-static struct platform_driver ab8500_fg_driver = { ++struct platform_driver ab8500_fg_driver = { + .probe = ab8500_fg_probe, + .remove = ab8500_fg_remove, + .driver = { +@@ -3222,20 +3228,6 @@ static struct platform_driver ab8500_fg_driver = { + .pm = &ab8500_fg_pm_ops, + }, + }; +- +-static int __init ab8500_fg_init(void) +-{ +- return platform_driver_register(&ab8500_fg_driver); +-} +- +-static void __exit ab8500_fg_exit(void) +-{ +- platform_driver_unregister(&ab8500_fg_driver); +-} +- +-subsys_initcall_sync(ab8500_fg_init); +-module_exit(ab8500_fg_exit); +- + MODULE_LICENSE("GPL v2"); + MODULE_AUTHOR("Johan Palsson, Karl Komierowski"); + MODULE_ALIAS("platform:ab8500-fg"); +diff --git a/drivers/power/supply/abx500_chargalg.c b/drivers/power/supply/abx500_chargalg.c +index f5b792243727..599684ce0e4b 100644 +--- a/drivers/power/supply/abx500_chargalg.c ++++ b/drivers/power/supply/abx500_chargalg.c +@@ -15,6 +15,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -1943,13 +1944,44 @@ static int __maybe_unused abx500_chargalg_suspend(struct device *dev) + return 0; + } + +-static int abx500_chargalg_remove(struct platform_device *pdev) ++static char *supply_interface[] = { ++ "ab8500_fg", ++}; ++ ++static const struct power_supply_desc abx500_chargalg_desc = { ++ .name = "abx500_chargalg", ++ .type = POWER_SUPPLY_TYPE_BATTERY, ++ .properties = abx500_chargalg_props, ++ .num_properties = ARRAY_SIZE(abx500_chargalg_props), ++ .get_property = abx500_chargalg_get_property, ++ .external_power_changed = abx500_chargalg_external_power_changed, ++}; ++ ++static int abx500_chargalg_bind(struct device *dev, struct device *master, ++ void *data) + { +- struct abx500_chargalg *di = platform_get_drvdata(pdev); ++ struct abx500_chargalg *di = dev_get_drvdata(dev); + +- /* sysfs interface to enable/disbale charging from user space */ +- abx500_chargalg_sysfs_exit(di); ++ /* Create a work queue for the chargalg */ ++ di->chargalg_wq = alloc_ordered_workqueue("abx500_chargalg_wq", ++ WQ_MEM_RECLAIM); ++ if (di->chargalg_wq == NULL) { ++ dev_err(di->dev, "failed to create work queue\n"); ++ return -ENOMEM; ++ } ++ ++ /* Run the charging algorithm */ ++ queue_delayed_work(di->chargalg_wq, &di->chargalg_periodic_work, 0); ++ ++ return 0; ++} + ++static void abx500_chargalg_unbind(struct device *dev, struct device *master, ++ void *data) ++{ ++ struct abx500_chargalg *di = dev_get_drvdata(dev); ++ ++ /* Stop all timers and work */ + hrtimer_cancel(&di->safety_timer); + hrtimer_cancel(&di->maintenance_timer); + +@@ -1959,48 +1991,36 @@ static int abx500_chargalg_remove(struct platform_device *pdev) + + /* Delete the work queue */ + destroy_workqueue(di->chargalg_wq); +- +- power_supply_unregister(di->chargalg_psy); +- +- return 0; ++ flush_scheduled_work(); + } + +-static char *supply_interface[] = { +- "ab8500_fg", +-}; +- +-static const struct power_supply_desc abx500_chargalg_desc = { +- .name = "abx500_chargalg", +- .type = POWER_SUPPLY_TYPE_BATTERY, +- .properties = abx500_chargalg_props, +- .num_properties = ARRAY_SIZE(abx500_chargalg_props), +- .get_property = abx500_chargalg_get_property, +- .external_power_changed = abx500_chargalg_external_power_changed, ++static const struct component_ops abx500_chargalg_component_ops = { ++ .bind = abx500_chargalg_bind, ++ .unbind = abx500_chargalg_unbind, + }; + + static int abx500_chargalg_probe(struct platform_device *pdev) + { +- struct device_node *np = pdev->dev.of_node; ++ struct device *dev = &pdev->dev; ++ struct device_node *np = dev->of_node; + struct power_supply_config psy_cfg = {}; + struct abx500_chargalg *di; + int ret = 0; + +- di = devm_kzalloc(&pdev->dev, sizeof(*di), GFP_KERNEL); +- if (!di) { +- dev_err(&pdev->dev, "%s no mem for ab8500_chargalg\n", __func__); ++ di = devm_kzalloc(dev, sizeof(*di), GFP_KERNEL); ++ if (!di) + return -ENOMEM; +- } + + di->bm = &ab8500_bm_data; + +- ret = ab8500_bm_of_probe(&pdev->dev, np, di->bm); ++ ret = ab8500_bm_of_probe(dev, np, di->bm); + if (ret) { +- dev_err(&pdev->dev, "failed to get battery information\n"); ++ dev_err(dev, "failed to get battery information\n"); + return ret; + } + + /* get device struct and parent */ +- di->dev = &pdev->dev; ++ di->dev = dev; + di->parent = dev_get_drvdata(pdev->dev.parent); + + psy_cfg.supplied_to = supply_interface; +@@ -2016,14 +2036,6 @@ static int abx500_chargalg_probe(struct platform_device *pdev) + di->maintenance_timer.function = + abx500_chargalg_maintenance_timer_expired; + +- /* Create a work queue for the chargalg */ +- di->chargalg_wq = alloc_ordered_workqueue("abx500_chargalg_wq", +- WQ_MEM_RECLAIM); +- if (di->chargalg_wq == NULL) { +- dev_err(di->dev, "failed to create work queue\n"); +- return -ENOMEM; +- } +- + /* Init work for chargalg */ + INIT_DEFERRABLE_WORK(&di->chargalg_periodic_work, + abx500_chargalg_periodic_work); +@@ -2037,12 +2049,12 @@ static int abx500_chargalg_probe(struct platform_device *pdev) + di->chg_info.prev_conn_chg = -1; + + /* Register chargalg power supply class */ +- di->chargalg_psy = power_supply_register(di->dev, &abx500_chargalg_desc, ++ di->chargalg_psy = devm_power_supply_register(di->dev, ++ &abx500_chargalg_desc, + &psy_cfg); + if (IS_ERR(di->chargalg_psy)) { + dev_err(di->dev, "failed to register chargalg psy\n"); +- ret = PTR_ERR(di->chargalg_psy); +- goto free_chargalg_wq; ++ return PTR_ERR(di->chargalg_psy); + } + + platform_set_drvdata(pdev, di); +@@ -2051,21 +2063,24 @@ static int abx500_chargalg_probe(struct platform_device *pdev) + ret = abx500_chargalg_sysfs_init(di); + if (ret) { + dev_err(di->dev, "failed to create sysfs entry\n"); +- goto free_psy; ++ return ret; + } + di->curr_status.curr_step = CHARGALG_CURR_STEP_HIGH; + +- /* Run the charging algorithm */ +- queue_delayed_work(di->chargalg_wq, &di->chargalg_periodic_work, 0); +- + dev_info(di->dev, "probe success\n"); +- return ret; ++ return component_add(dev, &abx500_chargalg_component_ops); ++} + +-free_psy: +- power_supply_unregister(di->chargalg_psy); +-free_chargalg_wq: +- destroy_workqueue(di->chargalg_wq); +- return ret; ++static int abx500_chargalg_remove(struct platform_device *pdev) ++{ ++ struct abx500_chargalg *di = platform_get_drvdata(pdev); ++ ++ component_del(&pdev->dev, &abx500_chargalg_component_ops); ++ ++ /* sysfs interface to enable/disable charging from user space */ ++ abx500_chargalg_sysfs_exit(di); ++ ++ return 0; + } + + static SIMPLE_DEV_PM_OPS(abx500_chargalg_pm_ops, abx500_chargalg_suspend, abx500_chargalg_resume); +@@ -2075,7 +2090,7 @@ static const struct of_device_id ab8500_chargalg_match[] = { + { }, + }; + +-static struct platform_driver abx500_chargalg_driver = { ++struct platform_driver abx500_chargalg_driver = { + .probe = abx500_chargalg_probe, + .remove = abx500_chargalg_remove, + .driver = { +@@ -2084,9 +2099,6 @@ static struct platform_driver abx500_chargalg_driver = { + .pm = &abx500_chargalg_pm_ops, + }, + }; +- +-module_platform_driver(abx500_chargalg_driver); +- + MODULE_LICENSE("GPL v2"); + MODULE_AUTHOR("Johan Palsson, Karl Komierowski"); + MODULE_ALIAS("platform:abx500-chargalg"); +-- +2.30.2 + diff --git a/queue-5.13/power-supply-axp288_fuel_gauge-make-t3-mrd-no_batter.patch b/queue-5.13/power-supply-axp288_fuel_gauge-make-t3-mrd-no_batter.patch new file mode 100644 index 00000000000..ebd33f3bb15 --- /dev/null +++ b/queue-5.13/power-supply-axp288_fuel_gauge-make-t3-mrd-no_batter.patch @@ -0,0 +1,73 @@ +From 0db8c8742f10176b487f2af2a7a4e9714e53d89d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 17 Jun 2021 21:27:02 +0200 +Subject: power: supply: axp288_fuel_gauge: Make "T3 MRD" no_battery_list DMI + entry more generic + +From: Hans de Goede + +[ Upstream commit 3a06b912a5ce494d7b7300b12719c562be7b566f ] + +It turns out that the "T3 MRD" DMI_BOARD_NAME value is used in a lot of +different Cherry Trail x5-z8300 / x5-z8350 based Mini-PC / HDMI-stick +models from Ace PC / Meegopad / MinisForum / Wintel (and likely also +other vendors). + +Most of the other DMI strings on these boxes unfortunately contain various +generic values like "Default string" or "$(DEFAULT_STRING)", so we cannot +match on them. These devices do have their chassis-type correctly set to a +value of "3" (desktop) which is a pleasant surprise, so also match on that. + +This should avoid the quirk accidentally also getting applied to laptops / +tablets (which do actually have a battery). Although in my quite large +database of Bay and Cherry Trail based devices DMIdecode dumps I don't +have any laptops / tables with a board-name of "T3 MRD", so this should +not be an issue. + +BugLink: https://askubuntu.com/questions/1206714/how-can-a-mini-pc-be-stopped-from-being-detected-as-a-laptop-with-a-battery/ +Signed-off-by: Hans de Goede +Signed-off-by: Sebastian Reichel +Signed-off-by: Sasha Levin +--- + drivers/power/supply/axp288_fuel_gauge.c | 18 +++++++++--------- + 1 file changed, 9 insertions(+), 9 deletions(-) + +diff --git a/drivers/power/supply/axp288_fuel_gauge.c b/drivers/power/supply/axp288_fuel_gauge.c +index 39e16ecb7638..37af0e216bc3 100644 +--- a/drivers/power/supply/axp288_fuel_gauge.c ++++ b/drivers/power/supply/axp288_fuel_gauge.c +@@ -723,15 +723,6 @@ static const struct dmi_system_id axp288_fuel_gauge_blacklist[] = { + DMI_MATCH(DMI_PRODUCT_NAME, "MEEGOPAD T02"), + }, + }, +- { +- /* Meegopad T08 */ +- .matches = { +- DMI_MATCH(DMI_SYS_VENDOR, "Default string"), +- DMI_MATCH(DMI_BOARD_VENDOR, "To be filled by OEM."), +- DMI_MATCH(DMI_BOARD_NAME, "T3 MRD"), +- DMI_MATCH(DMI_BOARD_VERSION, "V1.1"), +- }, +- }, + { /* Mele PCG03 Mini PC */ + .matches = { + DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Mini PC"), +@@ -745,6 +736,15 @@ static const struct dmi_system_id axp288_fuel_gauge_blacklist[] = { + DMI_MATCH(DMI_PRODUCT_NAME, "Z83-4"), + } + }, ++ { ++ /* Various Ace PC/Meegopad/MinisForum/Wintel Mini-PCs/HDMI-sticks */ ++ .matches = { ++ DMI_MATCH(DMI_BOARD_NAME, "T3 MRD"), ++ DMI_MATCH(DMI_CHASSIS_TYPE, "3"), ++ DMI_MATCH(DMI_BIOS_VENDOR, "American Megatrends Inc."), ++ DMI_MATCH(DMI_BIOS_VERSION, "5.11"), ++ }, ++ }, + {} + }; + +-- +2.30.2 + diff --git a/queue-5.13/power-supply-charger-manager-add-missing-module_devi.patch b/queue-5.13/power-supply-charger-manager-add-missing-module_devi.patch new file mode 100644 index 00000000000..12854c01ceb --- /dev/null +++ b/queue-5.13/power-supply-charger-manager-add-missing-module_devi.patch @@ -0,0 +1,36 @@ +From 4b6f0d11bc753f0bffdf2ce68fd9372ad1c9849e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 5 Jun 2021 09:21:54 +0800 +Subject: power: supply: charger-manager: add missing MODULE_DEVICE_TABLE + +From: Zou Wei + +[ Upstream commit 073b5d5b1f9cc94a3eea25279fbafee3f4f5f097 ] + +This patch adds missing MODULE_DEVICE_TABLE definition which generates +correct modalias for automatic loading of this driver when it is built +as an external module. + +Reported-by: Hulk Robot +Signed-off-by: Zou Wei +Signed-off-by: Sebastian Reichel +Signed-off-by: Sasha Levin +--- + drivers/power/supply/charger-manager.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/power/supply/charger-manager.c b/drivers/power/supply/charger-manager.c +index 45da870aecca..d67edb760c94 100644 +--- a/drivers/power/supply/charger-manager.c ++++ b/drivers/power/supply/charger-manager.c +@@ -1279,6 +1279,7 @@ static const struct of_device_id charger_manager_match[] = { + }, + {}, + }; ++MODULE_DEVICE_TABLE(of, charger_manager_match); + + static struct charger_desc *of_cm_parse_desc(struct device *dev) + { +-- +2.30.2 + diff --git a/queue-5.13/power-supply-max17040-do-not-enforce-incorrect-inter.patch b/queue-5.13/power-supply-max17040-do-not-enforce-incorrect-inter.patch new file mode 100644 index 00000000000..71ec705f509 --- /dev/null +++ b/queue-5.13/power-supply-max17040-do-not-enforce-incorrect-inter.patch @@ -0,0 +1,62 @@ +From aee43ffd5a3b1e73e2e59c21f0f7253f1e7511fe Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 26 May 2021 13:20:36 -0400 +Subject: power: supply: max17040: Do not enforce (incorrect) interrupt trigger + type + +From: Krzysztof Kozlowski + +[ Upstream commit 8bb2314fc22628333d89df83d695ff9a8d2a6eac ] + +Interrupt line can be configured on different hardware in different way, +even inverted. Therefore driver should not enforce specific trigger +type - edge falling - but instead rely on Devicetree to configure it. + +The Maxim 14577/77836 datasheets describe the interrupt line as active +low with a requirement of acknowledge from the CPU therefore the edge +falling is not correct. + +Signed-off-by: Krzysztof Kozlowski +Acked-by: Iskren Chernev +Acked-by: Rob Herring +Signed-off-by: Sebastian Reichel +Signed-off-by: Sasha Levin +--- + .../devicetree/bindings/power/supply/maxim,max17040.yaml | 2 +- + drivers/power/supply/max17040_battery.c | 4 +--- + 2 files changed, 2 insertions(+), 4 deletions(-) + +diff --git a/Documentation/devicetree/bindings/power/supply/maxim,max17040.yaml b/Documentation/devicetree/bindings/power/supply/maxim,max17040.yaml +index de91cf3f058c..f792d06db413 100644 +--- a/Documentation/devicetree/bindings/power/supply/maxim,max17040.yaml ++++ b/Documentation/devicetree/bindings/power/supply/maxim,max17040.yaml +@@ -89,7 +89,7 @@ examples: + reg = <0x36>; + maxim,alert-low-soc-level = <10>; + interrupt-parent = <&gpio7>; +- interrupts = <2 IRQ_TYPE_EDGE_FALLING>; ++ interrupts = <2 IRQ_TYPE_LEVEL_LOW>; + wakeup-source; + }; + }; +diff --git a/drivers/power/supply/max17040_battery.c b/drivers/power/supply/max17040_battery.c +index 1aab868adabf..e80dd9141ae7 100644 +--- a/drivers/power/supply/max17040_battery.c ++++ b/drivers/power/supply/max17040_battery.c +@@ -361,12 +361,10 @@ static irqreturn_t max17040_thread_handler(int id, void *dev) + static int max17040_enable_alert_irq(struct max17040_chip *chip) + { + struct i2c_client *client = chip->client; +- unsigned int flags; + int ret; + +- flags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT; + ret = devm_request_threaded_irq(&client->dev, client->irq, NULL, +- max17040_thread_handler, flags, ++ max17040_thread_handler, IRQF_ONESHOT, + chip->battery->desc->name, chip); + + return ret; +-- +2.30.2 + diff --git a/queue-5.13/power-supply-max17042-do-not-enforce-incorrect-inter.patch b/queue-5.13/power-supply-max17042-do-not-enforce-incorrect-inter.patch new file mode 100644 index 00000000000..5d3646894c8 --- /dev/null +++ b/queue-5.13/power-supply-max17042-do-not-enforce-incorrect-inter.patch @@ -0,0 +1,47 @@ +From 4b89973cef2cf5014378ede624313cce20d4b399 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 26 May 2021 13:20:35 -0400 +Subject: power: supply: max17042: Do not enforce (incorrect) interrupt trigger + type + +From: Krzysztof Kozlowski + +[ Upstream commit 7fbf6b731bca347700e460d94b130f9d734b33e9 ] + +Interrupt line can be configured on different hardware in different way, +even inverted. Therefore driver should not enforce specific trigger +type - edge falling - but instead rely on Devicetree to configure it. + +The Maxim 17047/77693 datasheets describe the interrupt line as active +low with a requirement of acknowledge from the CPU therefore the edge +falling is not correct. + +The interrupt line is shared between PMIC and RTC driver, so using level +sensitive interrupt is here especially important to avoid races. With +an edge configuration in case if first PMIC signals interrupt followed +shortly after by the RTC, the interrupt might not be yet cleared/acked +thus the second one would not be noticed. + +Signed-off-by: Krzysztof Kozlowski +Signed-off-by: Sebastian Reichel +Signed-off-by: Sasha Levin +--- + drivers/power/supply/max17042_battery.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/power/supply/max17042_battery.c b/drivers/power/supply/max17042_battery.c +index 1d7326cd8fc6..ce2041b30a06 100644 +--- a/drivers/power/supply/max17042_battery.c ++++ b/drivers/power/supply/max17042_battery.c +@@ -1104,7 +1104,7 @@ static int max17042_probe(struct i2c_client *client, + } + + if (client->irq) { +- unsigned int flags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT; ++ unsigned int flags = IRQF_ONESHOT; + + /* + * On ACPI systems the IRQ may be handled by ACPI-event code, +-- +2.30.2 + diff --git a/queue-5.13/power-supply-rt5033_battery-fix-device-tree-enumerat.patch b/queue-5.13/power-supply-rt5033_battery-fix-device-tree-enumerat.patch new file mode 100644 index 00000000000..41840f3db54 --- /dev/null +++ b/queue-5.13/power-supply-rt5033_battery-fix-device-tree-enumerat.patch @@ -0,0 +1,67 @@ +From 9acfbe16bad136a247328fabf076a5f13811fa11 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 17 May 2021 12:51:12 +0200 +Subject: power: supply: rt5033_battery: Fix device tree enumeration + +From: Stephan Gerhold + +[ Upstream commit f3076cd8d1d5fa64b5e1fa5affc045c2fc123baa ] + +The fuel gauge in the RT5033 PMIC has its own I2C bus and interrupt +line. Therefore, it is not actually part of the RT5033 MFD and needs +its own of_match_table to probe properly. + +Also, given that it's independent of the MFD, there is actually +no need to make the Kconfig depend on MFD_RT5033. Although the driver +uses the shared header, there is no compile +or runtime dependency on the RT5033 MFD driver. + +Cc: Beomho Seo +Cc: Chanwoo Choi +Fixes: b847dd96e659 ("power: rt5033_battery: Add RT5033 Fuel gauge device driver") +Signed-off-by: Stephan Gerhold +Signed-off-by: Sebastian Reichel +Signed-off-by: Sasha Levin +--- + drivers/power/supply/Kconfig | 3 ++- + drivers/power/supply/rt5033_battery.c | 7 +++++++ + 2 files changed, 9 insertions(+), 1 deletion(-) + +diff --git a/drivers/power/supply/Kconfig b/drivers/power/supply/Kconfig +index e696364126f1..20a2f93252f9 100644 +--- a/drivers/power/supply/Kconfig ++++ b/drivers/power/supply/Kconfig +@@ -712,7 +712,8 @@ config BATTERY_GOLDFISH + + config BATTERY_RT5033 + tristate "RT5033 fuel gauge support" +- depends on MFD_RT5033 ++ depends on I2C ++ select REGMAP_I2C + help + This adds support for battery fuel gauge in Richtek RT5033 PMIC. + The fuelgauge calculates and determines the battery state of charge +diff --git a/drivers/power/supply/rt5033_battery.c b/drivers/power/supply/rt5033_battery.c +index f330452341f0..9ad0afe83d1b 100644 +--- a/drivers/power/supply/rt5033_battery.c ++++ b/drivers/power/supply/rt5033_battery.c +@@ -164,9 +164,16 @@ static const struct i2c_device_id rt5033_battery_id[] = { + }; + MODULE_DEVICE_TABLE(i2c, rt5033_battery_id); + ++static const struct of_device_id rt5033_battery_of_match[] = { ++ { .compatible = "richtek,rt5033-battery", }, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, rt5033_battery_of_match); ++ + static struct i2c_driver rt5033_battery_driver = { + .driver = { + .name = "rt5033-battery", ++ .of_match_table = rt5033_battery_of_match, + }, + .probe = rt5033_battery_probe, + .remove = rt5033_battery_remove, +-- +2.30.2 + diff --git a/queue-5.13/power-supply-sc2731_charger-add-missing-module_devic.patch b/queue-5.13/power-supply-sc2731_charger-add-missing-module_devic.patch new file mode 100644 index 00000000000..5b849f529f6 --- /dev/null +++ b/queue-5.13/power-supply-sc2731_charger-add-missing-module_devic.patch @@ -0,0 +1,36 @@ +From 70ec37f9e376cd534523253baa6f26ead6e36bc1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 11 May 2021 14:17:12 +0800 +Subject: power: supply: sc2731_charger: Add missing MODULE_DEVICE_TABLE + +From: Zou Wei + +[ Upstream commit 2aac79d14d76879c8e307820b31876e315b1b242 ] + +This patch adds missing MODULE_DEVICE_TABLE definition which generates +correct modalias for automatic loading of this driver when it is built +as an external module. + +Reported-by: Hulk Robot +Signed-off-by: Zou Wei +Signed-off-by: Sebastian Reichel +Signed-off-by: Sasha Levin +--- + drivers/power/supply/sc2731_charger.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/power/supply/sc2731_charger.c b/drivers/power/supply/sc2731_charger.c +index 335cb857ef30..288b79836c13 100644 +--- a/drivers/power/supply/sc2731_charger.c ++++ b/drivers/power/supply/sc2731_charger.c +@@ -524,6 +524,7 @@ static const struct of_device_id sc2731_charger_of_match[] = { + { .compatible = "sprd,sc2731-charger", }, + { } + }; ++MODULE_DEVICE_TABLE(of, sc2731_charger_of_match); + + static struct platform_driver sc2731_charger_driver = { + .driver = { +-- +2.30.2 + diff --git a/queue-5.13/power-supply-sc27xx-add-missing-module_device_table.patch b/queue-5.13/power-supply-sc27xx-add-missing-module_device_table.patch new file mode 100644 index 00000000000..24f5e1d58d3 --- /dev/null +++ b/queue-5.13/power-supply-sc27xx-add-missing-module_device_table.patch @@ -0,0 +1,36 @@ +From aa4c88fc9af4ab3829fb8811d2e7cdab7125c47b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 11 May 2021 11:37:45 +0800 +Subject: power: supply: sc27xx: Add missing MODULE_DEVICE_TABLE + +From: Zou Wei + +[ Upstream commit 603fcfb9d4ec1cad8d66d3bb37f3613afa8a661a ] + +This patch adds missing MODULE_DEVICE_TABLE definition which generates +correct modalias for automatic loading of this driver when it is built +as an external module. + +Reported-by: Hulk Robot +Signed-off-by: Zou Wei +Signed-off-by: Sebastian Reichel +Signed-off-by: Sasha Levin +--- + drivers/power/supply/sc27xx_fuel_gauge.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/power/supply/sc27xx_fuel_gauge.c b/drivers/power/supply/sc27xx_fuel_gauge.c +index 9c627618c224..1ae8374e1ceb 100644 +--- a/drivers/power/supply/sc27xx_fuel_gauge.c ++++ b/drivers/power/supply/sc27xx_fuel_gauge.c +@@ -1342,6 +1342,7 @@ static const struct of_device_id sc27xx_fgu_of_match[] = { + { .compatible = "sprd,sc2731-fgu", }, + { } + }; ++MODULE_DEVICE_TABLE(of, sc27xx_fgu_of_match); + + static struct platform_driver sc27xx_fgu_driver = { + .probe = sc27xx_fgu_probe, +-- +2.30.2 + diff --git a/queue-5.13/power-supply-surface-charger-fix-type-of-integer-var.patch b/queue-5.13/power-supply-surface-charger-fix-type-of-integer-var.patch new file mode 100644 index 00000000000..7fe1e639164 --- /dev/null +++ b/queue-5.13/power-supply-surface-charger-fix-type-of-integer-var.patch @@ -0,0 +1,37 @@ +From cc3ddf6472bc275eed9b7c2e569b35863d2f47fa Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 11 May 2021 11:24:21 +0200 +Subject: power: supply: surface-charger: Fix type of integer variable + +From: Maximilian Luz + +[ Upstream commit 601423bc0c06467d019cf2a446962a5bf1b5e330 ] + +The ac->state field is __le32, not u32. So change the variable we're +temporarily storing it in to __le32 as well. + +Reported-by: kernel test robot +Fixes: e61ffb344591 ("power: supply: Add AC driver for Surface Aggregator Module") +Signed-off-by: Maximilian Luz +Signed-off-by: Sebastian Reichel +Signed-off-by: Sasha Levin +--- + drivers/power/supply/surface_charger.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/power/supply/surface_charger.c b/drivers/power/supply/surface_charger.c +index 81a5b79822c9..a060c36c7766 100644 +--- a/drivers/power/supply/surface_charger.c ++++ b/drivers/power/supply/surface_charger.c +@@ -66,7 +66,7 @@ struct spwr_ac_device { + + static int spwr_ac_update_unlocked(struct spwr_ac_device *ac) + { +- u32 old = ac->state; ++ __le32 old = ac->state; + int status; + + lockdep_assert_held(&ac->lock); +-- +2.30.2 + diff --git a/queue-5.13/power-supply-surface_battery-fix-battery-event-handl.patch b/queue-5.13/power-supply-surface_battery-fix-battery-event-handl.patch new file mode 100644 index 00000000000..fc0e18740ad --- /dev/null +++ b/queue-5.13/power-supply-surface_battery-fix-battery-event-handl.patch @@ -0,0 +1,62 @@ +From 7d68035b41291351618a8151e2377875717e1de5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 4 May 2021 20:48:13 +0200 +Subject: power: supply: surface_battery: Fix battery event handling + +From: Maximilian Luz + +[ Upstream commit e633f33d2669cb54db2846f9cde08662d254dbd3 ] + +The battery subsystem of the Surface Aggregator Module EC requires us to +register the battery notifier with instance ID 0. However, battery +events are actually sent with the instance ID corresponding to the +device, which is nonzero. Thus, the strict-matching approach doesn't +work here and will discard events that the driver is expected to handle. + +To fix this we have to fall back on notifier matching by target-category +only and have to manually check the instance ID in the notifier +callback. + +Fixes: 167f77f7d0b3 ("power: supply: Add battery driver for Surface Aggregator Module") +Signed-off-by: Maximilian Luz +Signed-off-by: Sebastian Reichel +Signed-off-by: Sasha Levin +--- + drivers/power/supply/surface_battery.c | 14 ++++++++++++-- + 1 file changed, 12 insertions(+), 2 deletions(-) + +diff --git a/drivers/power/supply/surface_battery.c b/drivers/power/supply/surface_battery.c +index 7efa431a62b2..5ec2e6bb2465 100644 +--- a/drivers/power/supply/surface_battery.c ++++ b/drivers/power/supply/surface_battery.c +@@ -345,6 +345,16 @@ static u32 spwr_notify_bat(struct ssam_event_notifier *nf, const struct ssam_eve + struct spwr_battery_device *bat = container_of(nf, struct spwr_battery_device, notif); + int status; + ++ /* ++ * We cannot use strict matching when registering the notifier as the ++ * EC expects us to register it against instance ID 0. Strict matching ++ * would thus drop events, as those may have non-zero instance IDs in ++ * this subsystem. So we need to check the instance ID of the event ++ * here manually. ++ */ ++ if (event->instance_id != bat->sdev->uid.instance) ++ return 0; ++ + dev_dbg(&bat->sdev->dev, "power event (cid = %#04x, iid = %#04x, tid = %#04x)\n", + event->command_id, event->instance_id, event->target_id); + +@@ -720,8 +730,8 @@ static void spwr_battery_init(struct spwr_battery_device *bat, struct ssam_devic + bat->notif.base.fn = spwr_notify_bat; + bat->notif.event.reg = registry; + bat->notif.event.id.target_category = sdev->uid.category; +- bat->notif.event.id.instance = 0; +- bat->notif.event.mask = SSAM_EVENT_MASK_STRICT; ++ bat->notif.event.id.instance = 0; /* need to register with instance 0 */ ++ bat->notif.event.mask = SSAM_EVENT_MASK_TARGET; + bat->notif.event.flags = SSAM_EVENT_SEQUENCED; + + bat->psy_desc.name = bat->name; +-- +2.30.2 + diff --git a/queue-5.13/powerpc-boot-fixup-device-tree-on-little-endian.patch b/queue-5.13/powerpc-boot-fixup-device-tree-on-little-endian.patch new file mode 100644 index 00000000000..2ef70355c1b --- /dev/null +++ b/queue-5.13/powerpc-boot-fixup-device-tree-on-little-endian.patch @@ -0,0 +1,243 @@ +From 07fc08178fd0a7bc6095e3e434ad3a359eaea7eb Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 18 Jun 2021 13:49:00 +1000 +Subject: powerpc/boot: Fixup device-tree on little endian + +From: Benjamin Herrenschmidt + +[ Upstream commit c93f80849bdd9b45d834053ae1336e28f0026c84 ] + +This fixes the core devtree.c functions and the ns16550 UART backend. + +Signed-off-by: Benjamin Herrenschmidt +Signed-off-by: Paul Mackerras +Reviewed-by: Segher Boessenkool +Acked-by: Nicholas Piggin +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/YMwXrPT8nc4YUdJ9@thinks.paulus.ozlabs.org +Signed-off-by: Sasha Levin +--- + arch/powerpc/boot/devtree.c | 59 +++++++++++++++++++++---------------- + arch/powerpc/boot/ns16550.c | 9 ++++-- + 2 files changed, 41 insertions(+), 27 deletions(-) + +diff --git a/arch/powerpc/boot/devtree.c b/arch/powerpc/boot/devtree.c +index 5d91036ad626..58fbcfcc98c9 100644 +--- a/arch/powerpc/boot/devtree.c ++++ b/arch/powerpc/boot/devtree.c +@@ -13,6 +13,7 @@ + #include "string.h" + #include "stdio.h" + #include "ops.h" ++#include "of.h" + + void dt_fixup_memory(u64 start, u64 size) + { +@@ -23,21 +24,25 @@ void dt_fixup_memory(u64 start, u64 size) + root = finddevice("/"); + if (getprop(root, "#address-cells", &naddr, sizeof(naddr)) < 0) + naddr = 2; ++ else ++ naddr = be32_to_cpu(naddr); + if (naddr < 1 || naddr > 2) + fatal("Can't cope with #address-cells == %d in /\n\r", naddr); + + if (getprop(root, "#size-cells", &nsize, sizeof(nsize)) < 0) + nsize = 1; ++ else ++ nsize = be32_to_cpu(nsize); + if (nsize < 1 || nsize > 2) + fatal("Can't cope with #size-cells == %d in /\n\r", nsize); + + i = 0; + if (naddr == 2) +- memreg[i++] = start >> 32; +- memreg[i++] = start & 0xffffffff; ++ memreg[i++] = cpu_to_be32(start >> 32); ++ memreg[i++] = cpu_to_be32(start & 0xffffffff); + if (nsize == 2) +- memreg[i++] = size >> 32; +- memreg[i++] = size & 0xffffffff; ++ memreg[i++] = cpu_to_be32(size >> 32); ++ memreg[i++] = cpu_to_be32(size & 0xffffffff); + + memory = finddevice("/memory"); + if (! memory) { +@@ -45,9 +50,9 @@ void dt_fixup_memory(u64 start, u64 size) + setprop_str(memory, "device_type", "memory"); + } + +- printf("Memory <- <0x%x", memreg[0]); ++ printf("Memory <- <0x%x", be32_to_cpu(memreg[0])); + for (i = 1; i < (naddr + nsize); i++) +- printf(" 0x%x", memreg[i]); ++ printf(" 0x%x", be32_to_cpu(memreg[i])); + printf("> (%ldMB)\n\r", (unsigned long)(size >> 20)); + + setprop(memory, "reg", memreg, (naddr + nsize)*sizeof(u32)); +@@ -65,10 +70,10 @@ void dt_fixup_cpu_clocks(u32 cpu, u32 tb, u32 bus) + printf("CPU bus-frequency <- 0x%x (%dMHz)\n\r", bus, MHZ(bus)); + + while ((devp = find_node_by_devtype(devp, "cpu"))) { +- setprop_val(devp, "clock-frequency", cpu); +- setprop_val(devp, "timebase-frequency", tb); ++ setprop_val(devp, "clock-frequency", cpu_to_be32(cpu)); ++ setprop_val(devp, "timebase-frequency", cpu_to_be32(tb)); + if (bus > 0) +- setprop_val(devp, "bus-frequency", bus); ++ setprop_val(devp, "bus-frequency", cpu_to_be32(bus)); + } + + timebase_period_ns = 1000000000 / tb; +@@ -80,7 +85,7 @@ void dt_fixup_clock(const char *path, u32 freq) + + if (devp) { + printf("%s: clock-frequency <- %x (%dMHz)\n\r", path, freq, MHZ(freq)); +- setprop_val(devp, "clock-frequency", freq); ++ setprop_val(devp, "clock-frequency", cpu_to_be32(freq)); + } + } + +@@ -133,8 +138,12 @@ void dt_get_reg_format(void *node, u32 *naddr, u32 *nsize) + { + if (getprop(node, "#address-cells", naddr, 4) != 4) + *naddr = 2; ++ else ++ *naddr = be32_to_cpu(*naddr); + if (getprop(node, "#size-cells", nsize, 4) != 4) + *nsize = 1; ++ else ++ *nsize = be32_to_cpu(*nsize); + } + + static void copy_val(u32 *dest, u32 *src, int naddr) +@@ -163,9 +172,9 @@ static int add_reg(u32 *reg, u32 *add, int naddr) + int i, carry = 0; + + for (i = MAX_ADDR_CELLS - 1; i >= MAX_ADDR_CELLS - naddr; i--) { +- u64 tmp = (u64)reg[i] + add[i] + carry; ++ u64 tmp = (u64)be32_to_cpu(reg[i]) + be32_to_cpu(add[i]) + carry; + carry = tmp >> 32; +- reg[i] = (u32)tmp; ++ reg[i] = cpu_to_be32((u32)tmp); + } + + return !carry; +@@ -180,18 +189,18 @@ static int compare_reg(u32 *reg, u32 *range, u32 *rangesize) + u32 end; + + for (i = 0; i < MAX_ADDR_CELLS; i++) { +- if (reg[i] < range[i]) ++ if (be32_to_cpu(reg[i]) < be32_to_cpu(range[i])) + return 0; +- if (reg[i] > range[i]) ++ if (be32_to_cpu(reg[i]) > be32_to_cpu(range[i])) + break; + } + + for (i = 0; i < MAX_ADDR_CELLS; i++) { +- end = range[i] + rangesize[i]; ++ end = be32_to_cpu(range[i]) + be32_to_cpu(rangesize[i]); + +- if (reg[i] < end) ++ if (be32_to_cpu(reg[i]) < end) + break; +- if (reg[i] > end) ++ if (be32_to_cpu(reg[i]) > end) + return 0; + } + +@@ -240,7 +249,6 @@ static int dt_xlate(void *node, int res, int reglen, unsigned long *addr, + return 0; + + dt_get_reg_format(parent, &naddr, &nsize); +- + if (nsize > 2) + return 0; + +@@ -252,10 +260,10 @@ static int dt_xlate(void *node, int res, int reglen, unsigned long *addr, + + copy_val(last_addr, prop_buf + offset, naddr); + +- ret_size = prop_buf[offset + naddr]; ++ ret_size = be32_to_cpu(prop_buf[offset + naddr]); + if (nsize == 2) { + ret_size <<= 32; +- ret_size |= prop_buf[offset + naddr + 1]; ++ ret_size |= be32_to_cpu(prop_buf[offset + naddr + 1]); + } + + for (;;) { +@@ -278,7 +286,6 @@ static int dt_xlate(void *node, int res, int reglen, unsigned long *addr, + + offset = find_range(last_addr, prop_buf, prev_naddr, + naddr, prev_nsize, buflen / 4); +- + if (offset < 0) + return 0; + +@@ -296,8 +303,7 @@ static int dt_xlate(void *node, int res, int reglen, unsigned long *addr, + if (naddr > 2) + return 0; + +- ret_addr = ((u64)last_addr[2] << 32) | last_addr[3]; +- ++ ret_addr = ((u64)be32_to_cpu(last_addr[2]) << 32) | be32_to_cpu(last_addr[3]); + if (sizeof(void *) == 4 && + (ret_addr >= 0x100000000ULL || ret_size > 0x100000000ULL || + ret_addr + ret_size > 0x100000000ULL)) +@@ -350,11 +356,14 @@ int dt_is_compatible(void *node, const char *compat) + int dt_get_virtual_reg(void *node, void **addr, int nres) + { + unsigned long xaddr; +- int n; ++ int n, i; + + n = getprop(node, "virtual-reg", addr, nres * 4); +- if (n > 0) ++ if (n > 0) { ++ for (i = 0; i < n/4; i ++) ++ ((u32 *)addr)[i] = be32_to_cpu(((u32 *)addr)[i]); + return n / 4; ++ } + + for (n = 0; n < nres; n++) { + if (!dt_xlate_reg(node, n, &xaddr, NULL)) +diff --git a/arch/powerpc/boot/ns16550.c b/arch/powerpc/boot/ns16550.c +index b0da4466d419..f16d2be1d0f3 100644 +--- a/arch/powerpc/boot/ns16550.c ++++ b/arch/powerpc/boot/ns16550.c +@@ -15,6 +15,7 @@ + #include "stdio.h" + #include "io.h" + #include "ops.h" ++#include "of.h" + + #define UART_DLL 0 /* Out: Divisor Latch Low */ + #define UART_DLM 1 /* Out: Divisor Latch High */ +@@ -58,16 +59,20 @@ int ns16550_console_init(void *devp, struct serial_console_data *scdp) + int n; + u32 reg_offset; + +- if (dt_get_virtual_reg(devp, (void **)®_base, 1) < 1) ++ if (dt_get_virtual_reg(devp, (void **)®_base, 1) < 1) { ++ printf("virt reg parse fail...\r\n"); + return -1; ++ } + + n = getprop(devp, "reg-offset", ®_offset, sizeof(reg_offset)); + if (n == sizeof(reg_offset)) +- reg_base += reg_offset; ++ reg_base += be32_to_cpu(reg_offset); + + n = getprop(devp, "reg-shift", ®_shift, sizeof(reg_shift)); + if (n != sizeof(reg_shift)) + reg_shift = 0; ++ else ++ reg_shift = be32_to_cpu(reg_shift); + + scdp->open = ns16550_open; + scdp->putc = ns16550_putc; +-- +2.30.2 + diff --git a/queue-5.13/powerpc-bpf-fix-detecting-bpf-atomic-instructions.patch b/queue-5.13/powerpc-bpf-fix-detecting-bpf-atomic-instructions.patch new file mode 100644 index 00000000000..89f62a729ad --- /dev/null +++ b/queue-5.13/powerpc-bpf-fix-detecting-bpf-atomic-instructions.patch @@ -0,0 +1,57 @@ +From 2f050a301c296a109005507197ecd6c8d66d7842 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 1 Jul 2021 20:38:58 +0530 +Subject: powerpc/bpf: Fix detecting BPF atomic instructions + +From: Naveen N. Rao + +[ Upstream commit 419ac821766cbdb9fd85872bb3f1a589df05c94c ] + +Commit 91c960b0056672 ("bpf: Rename BPF_XADD and prepare to encode other +atomics in .imm") converted BPF_XADD to BPF_ATOMIC and added a way to +distinguish instructions based on the immediate field. Existing JIT +implementations were updated to check for the immediate field and to +reject programs utilizing anything more than BPF_ADD (such as BPF_FETCH) +in the immediate field. + +However, the check added to powerpc64 JIT did not look at the correct +BPF instruction. Due to this, such programs would be accepted and +incorrectly JIT'ed resulting in soft lockups, as seen with the atomic +bounds test. Fix this by looking at the correct immediate value. + +Fixes: 91c960b0056672 ("bpf: Rename BPF_XADD and prepare to encode other atomics in .imm") +Reported-by: Jiri Olsa +Signed-off-by: Naveen N. Rao +Tested-by: Jiri Olsa +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/4117b430ffaa8cd7af042496f87fd7539e4f17fd.1625145429.git.naveen.n.rao@linux.vnet.ibm.com +Signed-off-by: Sasha Levin +--- + arch/powerpc/net/bpf_jit_comp64.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/powerpc/net/bpf_jit_comp64.c b/arch/powerpc/net/bpf_jit_comp64.c +index 57a8c1153851..94411af24013 100644 +--- a/arch/powerpc/net/bpf_jit_comp64.c ++++ b/arch/powerpc/net/bpf_jit_comp64.c +@@ -667,7 +667,7 @@ emit_clear: + * BPF_STX ATOMIC (atomic ops) + */ + case BPF_STX | BPF_ATOMIC | BPF_W: +- if (insn->imm != BPF_ADD) { ++ if (imm != BPF_ADD) { + pr_err_ratelimited( + "eBPF filter atomic op code %02x (@%d) unsupported\n", + code, i); +@@ -689,7 +689,7 @@ emit_clear: + PPC_BCC_SHORT(COND_NE, tmp_idx); + break; + case BPF_STX | BPF_ATOMIC | BPF_DW: +- if (insn->imm != BPF_ADD) { ++ if (imm != BPF_ADD) { + pr_err_ratelimited( + "eBPF filter atomic op code %02x (@%d) unsupported\n", + code, i); +-- +2.30.2 + diff --git a/queue-5.13/powerpc-inst-fix-sparse-detection-on-get_user_instr.patch b/queue-5.13/powerpc-inst-fix-sparse-detection-on-get_user_instr.patch new file mode 100644 index 00000000000..ca9bf363ba2 --- /dev/null +++ b/queue-5.13/powerpc-inst-fix-sparse-detection-on-get_user_instr.patch @@ -0,0 +1,51 @@ +From 1549ebf11842d838d7f23d8e95d01ebe65a987d4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 20 May 2021 13:50:38 +0000 +Subject: powerpc/inst: Fix sparse detection on get_user_instr() + +From: Christophe Leroy + +[ Upstream commit b3a9e523237013477bea914b7fbfbe420428b988 ] + +get_user_instr() lacks sparse detection for the __user tag. + +This is because __gui_ptr is assigned with a cast. + +Fix that by adding a __chk_user_ptr() + +Signed-off-by: Christophe Leroy +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/0320e5b41a794fd456ab8c5993bbfadcf9e1d8b4.1621516826.git.christophe.leroy@csgroup.eu +Signed-off-by: Sasha Levin +--- + arch/powerpc/include/asm/inst.h | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/arch/powerpc/include/asm/inst.h b/arch/powerpc/include/asm/inst.h +index 268d3bd073c8..887ef150fdda 100644 +--- a/arch/powerpc/include/asm/inst.h ++++ b/arch/powerpc/include/asm/inst.h +@@ -12,6 +12,8 @@ + unsigned long __gui_ptr = (unsigned long)ptr; \ + struct ppc_inst __gui_inst; \ + unsigned int __prefix, __suffix; \ ++ \ ++ __chk_user_ptr(ptr); \ + __gui_ret = gu_op(__prefix, (unsigned int __user *)__gui_ptr); \ + if (__gui_ret == 0) { \ + if ((__prefix >> 26) == OP_PREFIX) { \ +@@ -29,7 +31,10 @@ + }) + #else /* !CONFIG_PPC64 */ + #define ___get_user_instr(gu_op, dest, ptr) \ +- gu_op((dest).val, (u32 __user *)(ptr)) ++({ \ ++ __chk_user_ptr(ptr); \ ++ gu_op((dest).val, (u32 __user *)(ptr)); \ ++}) + #endif /* CONFIG_PPC64 */ + + #define get_user_instr(x, ptr) \ +-- +2.30.2 + diff --git a/queue-5.13/powerpc-mm-book3s64-fix-possible-build-error.patch b/queue-5.13/powerpc-mm-book3s64-fix-possible-build-error.patch new file mode 100644 index 00000000000..03b1c3f96d0 --- /dev/null +++ b/queue-5.13/powerpc-mm-book3s64-fix-possible-build-error.patch @@ -0,0 +1,91 @@ +From 36c95c74b50f3bd4ed6ca8703df6a627b290ab78 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 10 Jun 2021 14:06:39 +0530 +Subject: powerpc/mm/book3s64: Fix possible build error +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Aneesh Kumar K.V + +[ Upstream commit 07d8ad6fd8a3d47f50595ca4826f41dbf4f3a0c6 ] + +Update _tlbiel_pid() such that we can avoid build errors like below when +using this function in other places. + +arch/powerpc/mm/book3s64/radix_tlb.c: In function ‘__radix__flush_tlb_range_psize’: +arch/powerpc/mm/book3s64/radix_tlb.c:114:2: warning: ‘asm’ operand 3 probably does not match constraints + 114 | asm volatile(PPC_TLBIEL(%0, %4, %3, %2, %1) + | ^~~ +arch/powerpc/mm/book3s64/radix_tlb.c:114:2: error: impossible constraint in ‘asm’ +make[4]: *** [scripts/Makefile.build:271: arch/powerpc/mm/book3s64/radix_tlb.o] Error 1 +m + +With this fix, we can also drop the __always_inline in __radix_flush_tlb_range_psize +which was added by commit e12d6d7d46a6 ("powerpc/mm/radix: mark __radix__flush_tlb_range_psize() as __always_inline") + +Signed-off-by: Aneesh Kumar K.V +Reviewed-by: Christophe Leroy +Acked-by: Michael Ellerman +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/20210610083639.387365-1-aneesh.kumar@linux.ibm.com +Signed-off-by: Sasha Levin +--- + arch/powerpc/mm/book3s64/radix_tlb.c | 26 +++++++++++++++++--------- + 1 file changed, 17 insertions(+), 9 deletions(-) + +diff --git a/arch/powerpc/mm/book3s64/radix_tlb.c b/arch/powerpc/mm/book3s64/radix_tlb.c +index 409e61210789..817a02ef6032 100644 +--- a/arch/powerpc/mm/book3s64/radix_tlb.c ++++ b/arch/powerpc/mm/book3s64/radix_tlb.c +@@ -291,22 +291,30 @@ static inline void fixup_tlbie_lpid(unsigned long lpid) + /* + * We use 128 set in radix mode and 256 set in hpt mode. + */ +-static __always_inline void _tlbiel_pid(unsigned long pid, unsigned long ric) ++static inline void _tlbiel_pid(unsigned long pid, unsigned long ric) + { + int set; + + asm volatile("ptesync": : :"memory"); + +- /* +- * Flush the first set of the TLB, and if we're doing a RIC_FLUSH_ALL, +- * also flush the entire Page Walk Cache. +- */ +- __tlbiel_pid(pid, 0, ric); ++ switch (ric) { ++ case RIC_FLUSH_PWC: + +- /* For PWC, only one flush is needed */ +- if (ric == RIC_FLUSH_PWC) { ++ /* For PWC, only one flush is needed */ ++ __tlbiel_pid(pid, 0, RIC_FLUSH_PWC); + ppc_after_tlbiel_barrier(); + return; ++ case RIC_FLUSH_TLB: ++ __tlbiel_pid(pid, 0, RIC_FLUSH_TLB); ++ break; ++ case RIC_FLUSH_ALL: ++ default: ++ /* ++ * Flush the first set of the TLB, and if ++ * we're doing a RIC_FLUSH_ALL, also flush ++ * the entire Page Walk Cache. ++ */ ++ __tlbiel_pid(pid, 0, RIC_FLUSH_ALL); + } + + if (!cpu_has_feature(CPU_FTR_ARCH_31)) { +@@ -1176,7 +1184,7 @@ void radix__tlb_flush(struct mmu_gather *tlb) + } + } + +-static __always_inline void __radix__flush_tlb_range_psize(struct mm_struct *mm, ++static void __radix__flush_tlb_range_psize(struct mm_struct *mm, + unsigned long start, unsigned long end, + int psize, bool also_pwc) + { +-- +2.30.2 + diff --git a/queue-5.13/powerpc-ps3-add-dma_mask-to-ps3_dma_region.patch b/queue-5.13/powerpc-ps3-add-dma_mask-to-ps3_dma_region.patch new file mode 100644 index 00000000000..f1c8dd0dacc --- /dev/null +++ b/queue-5.13/powerpc-ps3-add-dma_mask-to-ps3_dma_region.patch @@ -0,0 +1,93 @@ +From ecb6745b1072759a4a7ff25eabf6f1c48bd22966 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 3 Jun 2021 19:17:02 +0000 +Subject: powerpc/ps3: Add dma_mask to ps3_dma_region + +From: Geoff Levand + +[ Upstream commit 9733862e50fdba55e7f1554e4286fcc5302ff28e ] + +Commit f959dcd6ddfd29235030e8026471ac1b022ad2b0 (dma-direct: Fix +potential NULL pointer dereference) added a null check on the +dma_mask pointer of the kernel's device structure. + +Add a dma_mask variable to the ps3_dma_region structure and set +the device structure's dma_mask pointer to point to this new variable. + +Fixes runtime errors like these: +# WARNING: Fixes tag on line 10 doesn't match correct format +# WARNING: Fixes tag on line 10 doesn't match correct format + + ps3_system_bus_match:349: dev=8.0(sb_01), drv=8.0(ps3flash): match + WARNING: CPU: 0 PID: 1 at kernel/dma/mapping.c:151 .dma_map_page_attrs+0x34/0x1e0 + ps3flash sb_01: ps3stor_setup:193: map DMA region failed + +Signed-off-by: Geoff Levand +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/562d0c9ea0100a30c3b186bcc7adb34b0bbd2cd7.1622746428.git.geoff@infradead.org +Signed-off-by: Sasha Levin +--- + arch/powerpc/include/asm/ps3.h | 2 ++ + arch/powerpc/platforms/ps3/mm.c | 12 ++++++++++++ + 2 files changed, 14 insertions(+) + +diff --git a/arch/powerpc/include/asm/ps3.h b/arch/powerpc/include/asm/ps3.h +index e646c7f218bc..12b6b76e8d0f 100644 +--- a/arch/powerpc/include/asm/ps3.h ++++ b/arch/powerpc/include/asm/ps3.h +@@ -71,6 +71,7 @@ struct ps3_dma_region_ops; + * @bus_addr: The 'translated' bus address of the region. + * @len: The length in bytes of the region. + * @offset: The offset from the start of memory of the region. ++ * @dma_mask: Device dma_mask. + * @ioid: The IOID of the device who owns this region + * @chunk_list: Opaque variable used by the ioc page manager. + * @region_ops: struct ps3_dma_region_ops - dma region operations +@@ -85,6 +86,7 @@ struct ps3_dma_region { + enum ps3_dma_region_type region_type; + unsigned long len; + unsigned long offset; ++ u64 dma_mask; + + /* driver variables (set by ps3_dma_region_create) */ + unsigned long bus_addr; +diff --git a/arch/powerpc/platforms/ps3/mm.c b/arch/powerpc/platforms/ps3/mm.c +index d094321964fb..a81eac35d900 100644 +--- a/arch/powerpc/platforms/ps3/mm.c ++++ b/arch/powerpc/platforms/ps3/mm.c +@@ -6,6 +6,7 @@ + * Copyright 2006 Sony Corp. + */ + ++#include + #include + #include + #include +@@ -1118,6 +1119,7 @@ int ps3_dma_region_init(struct ps3_system_bus_device *dev, + enum ps3_dma_region_type region_type, void *addr, unsigned long len) + { + unsigned long lpar_addr; ++ int result; + + lpar_addr = addr ? ps3_mm_phys_to_lpar(__pa(addr)) : 0; + +@@ -1129,6 +1131,16 @@ int ps3_dma_region_init(struct ps3_system_bus_device *dev, + r->offset -= map.r1.offset; + r->len = len ? len : ALIGN(map.total, 1 << r->page_size); + ++ dev->core.dma_mask = &r->dma_mask; ++ ++ result = dma_set_mask_and_coherent(&dev->core, DMA_BIT_MASK(32)); ++ ++ if (result < 0) { ++ dev_err(&dev->core, "%s:%d: dma_set_mask_and_coherent failed: %d\n", ++ __func__, __LINE__, result); ++ return result; ++ } ++ + switch (dev->dev_type) { + case PS3_DEVICE_TYPE_SB: + r->region_ops = (USE_DYNAMIC_DMA) +-- +2.30.2 + diff --git a/queue-5.13/pwm-img-fix-pm-reference-leak-in-img_pwm_enable.patch b/queue-5.13/pwm-img-fix-pm-reference-leak-in-img_pwm_enable.patch new file mode 100644 index 00000000000..2464ffdfd4e --- /dev/null +++ b/queue-5.13/pwm-img-fix-pm-reference-leak-in-img_pwm_enable.patch @@ -0,0 +1,38 @@ +From 2ece98071a33b1aae5a8c5ba9503a444ebdc21a1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 12 May 2021 11:57:17 +0800 +Subject: pwm: img: Fix PM reference leak in img_pwm_enable() + +From: Zou Wei + +[ Upstream commit fde25294dfd8e36e4e30b693c27a86232864002a ] + +pm_runtime_get_sync will increment pm usage counter even it failed. +Forgetting to putting operation will result in reference leak here. +Fix it by replacing it with pm_runtime_resume_and_get to keep usage +counter balanced. + +Reported-by: Hulk Robot +Signed-off-by: Zou Wei +Signed-off-by: Thierry Reding +Signed-off-by: Sasha Levin +--- + drivers/pwm/pwm-img.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/pwm/pwm-img.c b/drivers/pwm/pwm-img.c +index cc37054589cc..11b16ecc4f96 100644 +--- a/drivers/pwm/pwm-img.c ++++ b/drivers/pwm/pwm-img.c +@@ -156,7 +156,7 @@ static int img_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm) + struct img_pwm_chip *pwm_chip = to_img_pwm_chip(chip); + int ret; + +- ret = pm_runtime_get_sync(chip->dev); ++ ret = pm_runtime_resume_and_get(chip->dev); + if (ret < 0) + return ret; + +-- +2.30.2 + diff --git a/queue-5.13/pwm-imx1-don-t-disable-clocks-at-device-remove-time.patch b/queue-5.13/pwm-imx1-don-t-disable-clocks-at-device-remove-time.patch new file mode 100644 index 00000000000..e09fe3350a6 --- /dev/null +++ b/queue-5.13/pwm-imx1-don-t-disable-clocks-at-device-remove-time.patch @@ -0,0 +1,44 @@ +From 00ae820d9ec7b45ffb4eef169d48edcdc4235f93 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 25 May 2021 08:35:27 +0200 +Subject: pwm: imx1: Don't disable clocks at device remove time +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Uwe Kleine-König + +[ Upstream commit 1bc6ea31cb41d50302a3c9b401964cf0a88d41f9 ] + +The .remove() callback disables clocks that were not enabled in +.probe(). So just probing and then unbinding the driver results in a clk +enable imbalance. + +So just drop the call to disable the clocks. (Which BTW was also in the +wrong order because the call makes the PWM unfunctional and so should +have come only after pwmchip_remove()). + +Fixes: 9f4c8f9607c3 ("pwm: imx: Add ipg clock operation") +Signed-off-by: Uwe Kleine-König +Signed-off-by: Thierry Reding +Signed-off-by: Sasha Levin +--- + drivers/pwm/pwm-imx1.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/drivers/pwm/pwm-imx1.c b/drivers/pwm/pwm-imx1.c +index c957b365448e..e73858a8e464 100644 +--- a/drivers/pwm/pwm-imx1.c ++++ b/drivers/pwm/pwm-imx1.c +@@ -168,8 +168,6 @@ static int pwm_imx1_remove(struct platform_device *pdev) + { + struct pwm_imx1_chip *imx = platform_get_drvdata(pdev); + +- pwm_imx1_clk_disable_unprepare(&imx->chip); +- + return pwmchip_remove(&imx->chip); + } + +-- +2.30.2 + diff --git a/queue-5.13/pwm-pca9685-restrict-period-change-for-enabled-pwms.patch b/queue-5.13/pwm-pca9685-restrict-period-change-for-enabled-pwms.patch new file mode 100644 index 00000000000..2f3b112d9d9 --- /dev/null +++ b/queue-5.13/pwm-pca9685-restrict-period-change-for-enabled-pwms.patch @@ -0,0 +1,179 @@ +From 5fd5ea8e68e4dc8c9ceffe6821cdc89980e63ff5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 7 May 2021 15:18:44 +0200 +Subject: pwm: pca9685: Restrict period change for enabled PWMs + +From: Clemens Gruber + +[ Upstream commit 6d6e7050276d40b5de97aa950d5d71057f2e2a25 ] + +Previously, the last used PWM channel could change the global prescale +setting, even if other channels are already in use. + +Fix it by only allowing the first enabled PWM to change the global +chip-wide prescale setting. If there is more than one channel in use, +the prescale settings resulting from the chosen periods must match. + +GPIOs do not count as enabled PWMs as they are not using the prescaler +and can't change it. + +Signed-off-by: Clemens Gruber +Signed-off-by: Thierry Reding +Signed-off-by: Sasha Levin +--- + drivers/pwm/pwm-pca9685.c | 74 +++++++++++++++++++++++++++++++++------ + 1 file changed, 64 insertions(+), 10 deletions(-) + +diff --git a/drivers/pwm/pwm-pca9685.c b/drivers/pwm/pwm-pca9685.c +index 7c9f174de64e..ec9f93006654 100644 +--- a/drivers/pwm/pwm-pca9685.c ++++ b/drivers/pwm/pwm-pca9685.c +@@ -23,11 +23,11 @@ + #include + + /* +- * Because the PCA9685 has only one prescaler per chip, changing the period of +- * one channel affects the period of all 16 PWM outputs! +- * However, the ratio between each configured duty cycle and the chip-wide +- * period remains constant, because the OFF time is set in proportion to the +- * counter range. ++ * Because the PCA9685 has only one prescaler per chip, only the first channel ++ * that is enabled is allowed to change the prescale register. ++ * PWM channels requested afterwards must use a period that results in the same ++ * prescale setting as the one set by the first requested channel. ++ * GPIOs do not count as enabled PWMs as they are not using the prescaler. + */ + + #define PCA9685_MODE1 0x00 +@@ -78,8 +78,9 @@ + struct pca9685 { + struct pwm_chip chip; + struct regmap *regmap; +-#if IS_ENABLED(CONFIG_GPIOLIB) + struct mutex lock; ++ DECLARE_BITMAP(pwms_enabled, PCA9685_MAXCHAN + 1); ++#if IS_ENABLED(CONFIG_GPIOLIB) + struct gpio_chip gpio; + DECLARE_BITMAP(pwms_inuse, PCA9685_MAXCHAN + 1); + #endif +@@ -90,6 +91,22 @@ static inline struct pca9685 *to_pca(struct pwm_chip *chip) + return container_of(chip, struct pca9685, chip); + } + ++/* This function is supposed to be called with the lock mutex held */ ++static bool pca9685_prescaler_can_change(struct pca9685 *pca, int channel) ++{ ++ /* No PWM enabled: Change allowed */ ++ if (bitmap_empty(pca->pwms_enabled, PCA9685_MAXCHAN + 1)) ++ return true; ++ /* More than one PWM enabled: Change not allowed */ ++ if (bitmap_weight(pca->pwms_enabled, PCA9685_MAXCHAN + 1) > 1) ++ return false; ++ /* ++ * Only one PWM enabled: Change allowed if the PWM about to ++ * be changed is the one that is already enabled ++ */ ++ return test_bit(channel, pca->pwms_enabled); ++} ++ + /* Helper function to set the duty cycle ratio to duty/4096 (e.g. duty=2048 -> 50%) */ + static void pca9685_pwm_set_duty(struct pca9685 *pca, int channel, unsigned int duty) + { +@@ -240,8 +257,6 @@ static int pca9685_pwm_gpio_probe(struct pca9685 *pca) + { + struct device *dev = pca->chip.dev; + +- mutex_init(&pca->lock); +- + pca->gpio.label = dev_name(dev); + pca->gpio.parent = dev; + pca->gpio.request = pca9685_pwm_gpio_request; +@@ -285,8 +300,8 @@ static void pca9685_set_sleep_mode(struct pca9685 *pca, bool enable) + } + } + +-static int pca9685_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, +- const struct pwm_state *state) ++static int __pca9685_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, ++ const struct pwm_state *state) + { + struct pca9685 *pca = to_pca(chip); + unsigned long long duty, prescale; +@@ -309,6 +324,12 @@ static int pca9685_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, + + regmap_read(pca->regmap, PCA9685_PRESCALE, &val); + if (prescale != val) { ++ if (!pca9685_prescaler_can_change(pca, pwm->hwpwm)) { ++ dev_err(chip->dev, ++ "pwm not changed: periods of enabled pwms must match!\n"); ++ return -EBUSY; ++ } ++ + /* + * Putting the chip briefly into SLEEP mode + * at this point won't interfere with the +@@ -331,6 +352,25 @@ static int pca9685_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, + return 0; + } + ++static int pca9685_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, ++ const struct pwm_state *state) ++{ ++ struct pca9685 *pca = to_pca(chip); ++ int ret; ++ ++ mutex_lock(&pca->lock); ++ ret = __pca9685_pwm_apply(chip, pwm, state); ++ if (ret == 0) { ++ if (state->enabled) ++ set_bit(pwm->hwpwm, pca->pwms_enabled); ++ else ++ clear_bit(pwm->hwpwm, pca->pwms_enabled); ++ } ++ mutex_unlock(&pca->lock); ++ ++ return ret; ++} ++ + static void pca9685_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm, + struct pwm_state *state) + { +@@ -372,6 +412,14 @@ static int pca9685_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm) + + if (pca9685_pwm_test_and_set_inuse(pca, pwm->hwpwm)) + return -EBUSY; ++ ++ if (pwm->hwpwm < PCA9685_MAXCHAN) { ++ /* PWMs - except the "all LEDs" channel - default to enabled */ ++ mutex_lock(&pca->lock); ++ set_bit(pwm->hwpwm, pca->pwms_enabled); ++ mutex_unlock(&pca->lock); ++ } ++ + pm_runtime_get_sync(chip->dev); + + return 0; +@@ -381,7 +429,11 @@ static void pca9685_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm) + { + struct pca9685 *pca = to_pca(chip); + ++ mutex_lock(&pca->lock); + pca9685_pwm_set_duty(pca, pwm->hwpwm, 0); ++ clear_bit(pwm->hwpwm, pca->pwms_enabled); ++ mutex_unlock(&pca->lock); ++ + pm_runtime_put(chip->dev); + pca9685_pwm_clear_inuse(pca, pwm->hwpwm); + } +@@ -422,6 +474,8 @@ static int pca9685_pwm_probe(struct i2c_client *client, + + i2c_set_clientdata(client, pca); + ++ mutex_init(&pca->lock); ++ + regmap_read(pca->regmap, PCA9685_MODE2, ®); + + if (device_property_read_bool(&client->dev, "invert")) +-- +2.30.2 + diff --git a/queue-5.13/pwm-spear-don-t-modify-hw-state-in-.remove-callback.patch b/queue-5.13/pwm-spear-don-t-modify-hw-state-in-.remove-callback.patch new file mode 100644 index 00000000000..70372d4549f --- /dev/null +++ b/queue-5.13/pwm-spear-don-t-modify-hw-state-in-.remove-callback.patch @@ -0,0 +1,45 @@ +From b799b3bc6f3b544af48294b0e76e0f8439c9dc30 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 28 Apr 2021 11:05:24 +0200 +Subject: pwm: spear: Don't modify HW state in .remove callback +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Uwe Kleine-König + +[ Upstream commit b601a18f12383001e7a8da238de7ca1559ebc450 ] + +A consumer is expected to disable a PWM before calling pwm_put(). And if +they didn't there is hopefully a good reason (or the consumer needs +fixing). Also if disabling an enabled PWM was the right thing to do, +this should better be done in the framework instead of in each low level +driver. + +So drop the hardware modification from the .remove() callback. + +Signed-off-by: Uwe Kleine-König +Signed-off-by: Thierry Reding +Signed-off-by: Sasha Levin +--- + drivers/pwm/pwm-spear.c | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/drivers/pwm/pwm-spear.c b/drivers/pwm/pwm-spear.c +index 1a1cedfd11ce..6879b49581b3 100644 +--- a/drivers/pwm/pwm-spear.c ++++ b/drivers/pwm/pwm-spear.c +@@ -228,10 +228,6 @@ static int spear_pwm_probe(struct platform_device *pdev) + static int spear_pwm_remove(struct platform_device *pdev) + { + struct spear_pwm_chip *pc = platform_get_drvdata(pdev); +- int i; +- +- for (i = 0; i < NUM_PWM; i++) +- pwm_disable(&pc->chip.pwms[i]); + + /* clk was prepared in probe, hence unprepare it here */ + clk_unprepare(pc->clk); +-- +2.30.2 + diff --git a/queue-5.13/pwm-tegra-don-t-modify-hw-state-in-.remove-callback.patch b/queue-5.13/pwm-tegra-don-t-modify-hw-state-in-.remove-callback.patch new file mode 100644 index 00000000000..ac73fa3fd0c --- /dev/null +++ b/queue-5.13/pwm-tegra-don-t-modify-hw-state-in-.remove-callback.patch @@ -0,0 +1,61 @@ +From e27ed987368a94aa54acc94ba973a05902ebb0b9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 17 Jun 2021 11:51:41 +0200 +Subject: pwm: tegra: Don't modify HW state in .remove callback +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Uwe Kleine-König + +[ Upstream commit 86f7fa71cd830d18d7ebcaf719dffd5ddfe1acdd ] + +A consumer is expected to disable a PWM before calling pwm_put(). And if +they didn't there is hopefully a good reason (or the consumer needs +fixing). Also if disabling an enabled PWM was the right thing to do, +this should better be done in the framework instead of in each low level +driver. + +So drop the hardware modification from the .remove() callback. + +Signed-off-by: Uwe Kleine-König +Signed-off-by: Thierry Reding +Signed-off-by: Sasha Levin +--- + drivers/pwm/pwm-tegra.c | 13 ------------- + 1 file changed, 13 deletions(-) + +diff --git a/drivers/pwm/pwm-tegra.c b/drivers/pwm/pwm-tegra.c +index c529a170bcdd..5509ce0d5432 100644 +--- a/drivers/pwm/pwm-tegra.c ++++ b/drivers/pwm/pwm-tegra.c +@@ -300,7 +300,6 @@ static int tegra_pwm_probe(struct platform_device *pdev) + static int tegra_pwm_remove(struct platform_device *pdev) + { + struct tegra_pwm_chip *pc = platform_get_drvdata(pdev); +- unsigned int i; + int err; + + if (WARN_ON(!pc)) +@@ -310,18 +309,6 @@ static int tegra_pwm_remove(struct platform_device *pdev) + if (err < 0) + return err; + +- for (i = 0; i < pc->chip.npwm; i++) { +- struct pwm_device *pwm = &pc->chip.pwms[i]; +- +- if (!pwm_is_enabled(pwm)) +- if (clk_prepare_enable(pc->clk) < 0) +- continue; +- +- pwm_writel(pc, i, 0); +- +- clk_disable_unprepare(pc->clk); +- } +- + reset_control_assert(pc->rst); + clk_disable_unprepare(pc->clk); + +-- +2.30.2 + diff --git a/queue-5.13/pwm-visconti-fix-and-simplify-period-calculation.patch b/queue-5.13/pwm-visconti-fix-and-simplify-period-calculation.patch new file mode 100644 index 00000000000..e679f584de2 --- /dev/null +++ b/queue-5.13/pwm-visconti-fix-and-simplify-period-calculation.patch @@ -0,0 +1,59 @@ +From 5484c80351f256b7a2d9ba18be35d9bd98e2e442 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 26 Apr 2021 17:03:50 +0200 +Subject: pwm: visconti: Fix and simplify period calculation +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Uwe Kleine-König + +[ Upstream commit 937efa29e70f7f8424b74631375dcb35d82a4614 ] + +With the original code a request for period = 65536000 ns and period = +32768000 ns yields the same register settings (which results in 32768000 +ns) because the value for pwmc0 was miscalculated. + +Also simplify using that fls(0) is 0. + +Fixes: 721b595744f1 ("pwm: visconti: Add Toshiba Visconti SoC PWM support") +Signed-off-by: Uwe Kleine-König +Acked-by: Nobuhiro Iwamatsu +Signed-off-by: Thierry Reding +Signed-off-by: Sasha Levin +--- + drivers/pwm/pwm-visconti.c | 17 +++++++---------- + 1 file changed, 7 insertions(+), 10 deletions(-) + +diff --git a/drivers/pwm/pwm-visconti.c b/drivers/pwm/pwm-visconti.c +index 46d903786366..af4e37d3e3a6 100644 +--- a/drivers/pwm/pwm-visconti.c ++++ b/drivers/pwm/pwm-visconti.c +@@ -82,17 +82,14 @@ static int visconti_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, + return -ERANGE; + + /* +- * PWMC controls a divider that divides the input clk by a +- * power of two between 1 and 8. As a smaller divider yields +- * higher precision, pick the smallest possible one. ++ * PWMC controls a divider that divides the input clk by a power of two ++ * between 1 and 8. As a smaller divider yields higher precision, pick ++ * the smallest possible one. As period is at most 0xffff << 3, pwmc0 is ++ * in the intended range [0..3]. + */ +- if (period > 0xffff) { +- pwmc0 = ilog2(period >> 16); +- if (WARN_ON(pwmc0 > 3)) +- return -EINVAL; +- } else { +- pwmc0 = 0; +- } ++ pwmc0 = fls(period >> 16); ++ if (WARN_ON(pwmc0 > 3)) ++ return -EINVAL; + + period >>= pwmc0; + duty_cycle >>= pwmc0; +-- +2.30.2 + diff --git a/queue-5.13/rcu-reject-rcu_lockdep_warn-false-positives.patch b/queue-5.13/rcu-reject-rcu_lockdep_warn-false-positives.patch new file mode 100644 index 00000000000..71fcccf45e4 --- /dev/null +++ b/queue-5.13/rcu-reject-rcu_lockdep_warn-false-positives.patch @@ -0,0 +1,82 @@ +From e2869552887c624c0f9c1262c7c2a89208e9f5aa Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 5 Apr 2021 09:51:05 -0700 +Subject: rcu: Reject RCU_LOCKDEP_WARN() false positives + +From: Paul E. McKenney + +[ Upstream commit 3066820034b5dd4e89bd74a7739c51c2d6f5e554 ] + +If another lockdep report runs concurrently with an RCU lockdep report +from RCU_LOCKDEP_WARN(), the following sequence of events can occur: + +1. debug_lockdep_rcu_enabled() sees that lockdep is enabled + when called from (say) synchronize_rcu(). + +2. Lockdep is disabled by a concurrent lockdep report. + +3. debug_lockdep_rcu_enabled() evaluates its lockdep-expression + argument, for example, lock_is_held(&rcu_bh_lock_map). + +4. Because lockdep is now disabled, lock_is_held() plays it safe and + returns the constant 1. + +5. But in this case, the constant 1 is not safe, because invoking + synchronize_rcu() under rcu_read_lock_bh() is disallowed. + +6. debug_lockdep_rcu_enabled() wrongly invokes lockdep_rcu_suspicious(), + resulting in a false-positive splat. + +This commit therefore changes RCU_LOCKDEP_WARN() to check +debug_lockdep_rcu_enabled() after checking the lockdep expression, +so that any "safe" returns from lock_is_held() are rejected by +debug_lockdep_rcu_enabled(). This requires memory ordering, which is +supplied by READ_ONCE(debug_locks). The resulting volatile accesses +prevent the compiler from reordering and the fact that only one variable +is being accessed prevents the underlying hardware from reordering. +The combination works for IA64, which can reorder reads to the same +location, but this is defeated by the volatile accesses, which compile +to load instructions that provide ordering. + +Reported-by: syzbot+dde0cc33951735441301@syzkaller.appspotmail.com +Reported-by: Matthew Wilcox +Reported-by: syzbot+88e4f02896967fe1ab0d@syzkaller.appspotmail.com +Reported-by: Thomas Gleixner +Suggested-by: Boqun Feng +Reviewed-by: Boqun Feng +Signed-off-by: Paul E. McKenney +Signed-off-by: Sasha Levin +--- + include/linux/rcupdate.h | 2 +- + kernel/rcu/update.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h +index 9455476c5ba2..1199ffd305d1 100644 +--- a/include/linux/rcupdate.h ++++ b/include/linux/rcupdate.h +@@ -315,7 +315,7 @@ static inline int rcu_read_lock_any_held(void) + #define RCU_LOCKDEP_WARN(c, s) \ + do { \ + static bool __section(".data.unlikely") __warned; \ +- if (debug_lockdep_rcu_enabled() && !__warned && (c)) { \ ++ if ((c) && debug_lockdep_rcu_enabled() && !__warned) { \ + __warned = true; \ + lockdep_rcu_suspicious(__FILE__, __LINE__, s); \ + } \ +diff --git a/kernel/rcu/update.c b/kernel/rcu/update.c +index b95ae86c40a7..dd94a602a6d2 100644 +--- a/kernel/rcu/update.c ++++ b/kernel/rcu/update.c +@@ -277,7 +277,7 @@ EXPORT_SYMBOL_GPL(rcu_callback_map); + + noinstr int notrace debug_lockdep_rcu_enabled(void) + { +- return rcu_scheduler_active != RCU_SCHEDULER_INACTIVE && debug_locks && ++ return rcu_scheduler_active != RCU_SCHEDULER_INACTIVE && READ_ONCE(debug_locks) && + current->lockdep_recursion == 0; + } + EXPORT_SYMBOL_GPL(debug_lockdep_rcu_enabled); +-- +2.30.2 + diff --git a/queue-5.13/remoteproc-core-fix-cdev-remove-and-rproc-del.patch b/queue-5.13/remoteproc-core-fix-cdev-remove-and-rproc-del.patch new file mode 100644 index 00000000000..0627b1f973b --- /dev/null +++ b/queue-5.13/remoteproc-core-fix-cdev-remove-and-rproc-del.patch @@ -0,0 +1,60 @@ +From 23f3adb6d9d884b375e3aa0aa98748b655b25cbf Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 14 Jun 2021 19:21:10 -0700 +Subject: remoteproc: core: Fix cdev remove and rproc del + +From: Siddharth Gupta + +[ Upstream commit 930eec0be20c93a53160c74005a1485a230e6911 ] + +The rproc_char_device_remove() call currently unmaps the cdev +region instead of simply deleting the cdev that was added as a +part of the rproc_char_device_add() call. This change fixes that +behaviour, and also fixes the order in which device_del() and +cdev_del() need to be called. + +Signed-off-by: Siddharth Gupta +Link: https://lore.kernel.org/r/1623723671-5517-4-git-send-email-sidgup@codeaurora.org +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + drivers/remoteproc/remoteproc_cdev.c | 2 +- + drivers/remoteproc/remoteproc_core.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/remoteproc/remoteproc_cdev.c b/drivers/remoteproc/remoteproc_cdev.c +index 0b8a84c04f76..4ad98b0b8caa 100644 +--- a/drivers/remoteproc/remoteproc_cdev.c ++++ b/drivers/remoteproc/remoteproc_cdev.c +@@ -124,7 +124,7 @@ int rproc_char_device_add(struct rproc *rproc) + + void rproc_char_device_remove(struct rproc *rproc) + { +- __unregister_chrdev(MAJOR(rproc->dev.devt), rproc->index, 1, "remoteproc"); ++ cdev_del(&rproc->cdev); + } + + void __init rproc_init_cdev(void) +diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c +index 626a6b90fba2..203e2bd8ebb4 100644 +--- a/drivers/remoteproc/remoteproc_core.c ++++ b/drivers/remoteproc/remoteproc_core.c +@@ -2602,7 +2602,6 @@ int rproc_del(struct rproc *rproc) + mutex_unlock(&rproc->lock); + + rproc_delete_debug_dir(rproc); +- rproc_char_device_remove(rproc); + + /* the rproc is downref'ed as soon as it's removed from the klist */ + mutex_lock(&rproc_list_mutex); +@@ -2613,6 +2612,7 @@ int rproc_del(struct rproc *rproc) + synchronize_rcu(); + + device_del(&rproc->dev); ++ rproc_char_device_remove(rproc); + + return 0; + } +-- +2.30.2 + diff --git a/queue-5.13/remoteproc-k3-r5-fix-an-error-message.patch b/queue-5.13/remoteproc-k3-r5-fix-an-error-message.patch new file mode 100644 index 00000000000..e26131a09e7 --- /dev/null +++ b/queue-5.13/remoteproc-k3-r5-fix-an-error-message.patch @@ -0,0 +1,40 @@ +From b13d45083e16c446b380bd7677bff8e74ae2402b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 6 May 2021 22:46:01 +0200 +Subject: remoteproc: k3-r5: Fix an error message + +From: Christophe JAILLET + +[ Upstream commit 34c4da6d5dfba48f49f891ebd75bb55999f0c538 ] + +'ret' is known to be 0 here. +Reorder the code so that the expected error code is printed. + +Acked-by: Suman Anna +Fixes: 6dedbd1d5443 ("remoteproc: k3-r5: Add a remoteproc driver for R5F subsystem") +Signed-off-by: Christophe JAILLET +Link: https://lore.kernel.org/r/d6e29d903b48957bf59c67229d54b0fc215e31ae.1620333870.git.christophe.jaillet@wanadoo.fr +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + drivers/remoteproc/ti_k3_r5_remoteproc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/remoteproc/ti_k3_r5_remoteproc.c b/drivers/remoteproc/ti_k3_r5_remoteproc.c +index 5cf8d030a1f0..4104e4846dbf 100644 +--- a/drivers/remoteproc/ti_k3_r5_remoteproc.c ++++ b/drivers/remoteproc/ti_k3_r5_remoteproc.c +@@ -1272,9 +1272,9 @@ static int k3_r5_core_of_init(struct platform_device *pdev) + + core->tsp = k3_r5_core_of_get_tsp(dev, core->ti_sci); + if (IS_ERR(core->tsp)) { ++ ret = PTR_ERR(core->tsp); + dev_err(dev, "failed to construct ti-sci proc control, ret = %d\n", + ret); +- ret = PTR_ERR(core->tsp); + goto err; + } + +-- +2.30.2 + diff --git a/queue-5.13/remoteproc-stm32-fix-mbox_send_message-call.patch b/queue-5.13/remoteproc-stm32-fix-mbox_send_message-call.patch new file mode 100644 index 00000000000..2594cda3cb2 --- /dev/null +++ b/queue-5.13/remoteproc-stm32-fix-mbox_send_message-call.patch @@ -0,0 +1,79 @@ +From adb27fbc5bbeb726547bd392b3a32f40ba2223f3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 20 Apr 2021 11:19:22 +0200 +Subject: remoteproc: stm32: fix mbox_send_message call + +From: Arnaud Pouliquen + +[ Upstream commit 51c4b4e212269a8634dee2000182cfca7f11575b ] + +mbox_send_message is called by passing a local dummy message or +a function parameter. As the message is queued, it is dereferenced. +This works because the message field is not used by the stm32 ipcc +driver, but it is not clean. + +Fix by passing a constant string in all cases. + +The associated comments are removed because rproc should not have to +deal with the behavior of the mailbox frame. + +Reported-by: Bjorn Andersson +Signed-off-by: Arnaud Pouliquen +Link: https://lore.kernel.org/r/20210420091922.29429-1-arnaud.pouliquen@foss.st.com +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + drivers/remoteproc/stm32_rproc.c | 14 +++++--------- + 1 file changed, 5 insertions(+), 9 deletions(-) + +diff --git a/drivers/remoteproc/stm32_rproc.c b/drivers/remoteproc/stm32_rproc.c +index 7353f9e7e7af..0e8203a432ab 100644 +--- a/drivers/remoteproc/stm32_rproc.c ++++ b/drivers/remoteproc/stm32_rproc.c +@@ -474,14 +474,12 @@ static int stm32_rproc_attach(struct rproc *rproc) + static int stm32_rproc_detach(struct rproc *rproc) + { + struct stm32_rproc *ddata = rproc->priv; +- int err, dummy_data, idx; ++ int err, idx; + + /* Inform the remote processor of the detach */ + idx = stm32_rproc_mbox_idx(rproc, STM32_MBX_DETACH); + if (idx >= 0 && ddata->mb[idx].chan) { +- /* A dummy data is sent to allow to block on transmit */ +- err = mbox_send_message(ddata->mb[idx].chan, +- &dummy_data); ++ err = mbox_send_message(ddata->mb[idx].chan, "stop"); + if (err < 0) + dev_warn(&rproc->dev, "warning: remote FW detach without ack\n"); + } +@@ -493,15 +491,13 @@ static int stm32_rproc_detach(struct rproc *rproc) + static int stm32_rproc_stop(struct rproc *rproc) + { + struct stm32_rproc *ddata = rproc->priv; +- int err, dummy_data, idx; ++ int err, idx; + + /* request shutdown of the remote processor */ + if (rproc->state != RPROC_OFFLINE) { + idx = stm32_rproc_mbox_idx(rproc, STM32_MBX_SHUTDOWN); + if (idx >= 0 && ddata->mb[idx].chan) { +- /* a dummy data is sent to allow to block on transmit */ +- err = mbox_send_message(ddata->mb[idx].chan, +- &dummy_data); ++ err = mbox_send_message(ddata->mb[idx].chan, "detach"); + if (err < 0) + dev_warn(&rproc->dev, "warning: remote FW shutdown without ack\n"); + } +@@ -556,7 +552,7 @@ static void stm32_rproc_kick(struct rproc *rproc, int vqid) + continue; + if (!ddata->mb[i].chan) + return; +- err = mbox_send_message(ddata->mb[i].chan, (void *)(long)vqid); ++ err = mbox_send_message(ddata->mb[i].chan, "kick"); + if (err < 0) + dev_err(&rproc->dev, "%s: failed (%s, err:%d)\n", + __func__, ddata->mb[i].name, err); +-- +2.30.2 + diff --git a/queue-5.13/remoteproc-stm32-fix-phys_addr_t-format-string.patch b/queue-5.13/remoteproc-stm32-fix-phys_addr_t-format-string.patch new file mode 100644 index 00000000000..d59e077a1bc --- /dev/null +++ b/queue-5.13/remoteproc-stm32-fix-phys_addr_t-format-string.patch @@ -0,0 +1,43 @@ +From 03bea47150d9d7f1ec7b13bedbf56dbc70384f3c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 21 Apr 2021 16:00:40 +0200 +Subject: remoteproc: stm32: fix phys_addr_t format string + +From: Arnd Bergmann + +[ Upstream commit 3e25e407a1c93b53a87a7743ea0cd4703d3985b7 ] + +A phys_addr_t may be wider than an int or pointer: + +drivers/remoteproc/stm32_rproc.c: In function 'stm32_rproc_da_to_pa': +drivers/remoteproc/stm32_rproc.c:583:30: error: format '%x' expects argument of type 'unsigned int', but argument 5 has type 'phys_addr_t' {aka 'long long unsigned int'} [-Werror=format=] + 583 | dev_dbg(dev, "da %llx to pa %#x\n", da, *pa); + +Print it by reference using the special %pap format string. + +Reviewed-by: Arnaud Pouliquen +Fixes: 8a471396d21c ("remoteproc: stm32: Move resource table setup to rproc_ops") +Signed-off-by: Arnd Bergmann +Link: https://lore.kernel.org/r/20210421140053.3727528-1-arnd@kernel.org +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + drivers/remoteproc/stm32_rproc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/remoteproc/stm32_rproc.c b/drivers/remoteproc/stm32_rproc.c +index 0e8203a432ab..b643efcf995a 100644 +--- a/drivers/remoteproc/stm32_rproc.c ++++ b/drivers/remoteproc/stm32_rproc.c +@@ -576,7 +576,7 @@ static int stm32_rproc_da_to_pa(struct rproc *rproc, + continue; + + *pa = da - p_mem->dev_addr + p_mem->bus_addr; +- dev_dbg(dev, "da %llx to pa %#x\n", da, *pa); ++ dev_dbg(dev, "da %llx to pa %pap\n", da, pa); + + return 0; + } +-- +2.30.2 + diff --git a/queue-5.13/reset-a10sr-add-missing-of_match_table-reference.patch b/queue-5.13/reset-a10sr-add-missing-of_match_table-reference.patch new file mode 100644 index 00000000000..012e16cea7e --- /dev/null +++ b/queue-5.13/reset-a10sr-add-missing-of_match_table-reference.patch @@ -0,0 +1,44 @@ +From 00debc85266c2208242d7a9a64c47307dc57bc69 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 7 May 2021 07:28:03 -0400 +Subject: reset: a10sr: add missing of_match_table reference +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Krzysztof Kozlowski + +[ Upstream commit 466ba3c8ff4fae39e455ff8d080b3d5503302765 ] + +The driver defined of_device_id table but did not use it with +of_match_table. This prevents usual matching via devicetree and causes +a W=1 warning: + + drivers/reset/reset-a10sr.c:111:34: warning: + ‘a10sr_reset_of_match’ defined but not used [-Wunused-const-variable=] + +Reported-by: kernel test robot +Fixes: 627006820268 ("reset: Add Altera Arria10 SR Reset Controller") +Signed-off-by: Krzysztof Kozlowski +Link: https://lore.kernel.org/r/20210507112803.20012-1-krzysztof.kozlowski@canonical.com +Signed-off-by: Philipp Zabel +Signed-off-by: Sasha Levin +--- + drivers/reset/reset-a10sr.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/reset/reset-a10sr.c b/drivers/reset/reset-a10sr.c +index 7eacc89382f8..99b3bc8382f3 100644 +--- a/drivers/reset/reset-a10sr.c ++++ b/drivers/reset/reset-a10sr.c +@@ -118,6 +118,7 @@ static struct platform_driver a10sr_reset_driver = { + .probe = a10sr_reset_probe, + .driver = { + .name = "altr_a10sr_reset", ++ .of_match_table = a10sr_reset_of_match, + }, + }; + module_platform_driver(a10sr_reset_driver); +-- +2.30.2 + diff --git a/queue-5.13/reset-bail-if-try_module_get-fails.patch b/queue-5.13/reset-bail-if-try_module_get-fails.patch new file mode 100644 index 00000000000..2eba4db386c --- /dev/null +++ b/queue-5.13/reset-bail-if-try_module_get-fails.patch @@ -0,0 +1,44 @@ +From 90a753312c782c9845055ed651249c1b5dc77ac4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 7 Jun 2021 10:26:15 +0200 +Subject: reset: bail if try_module_get() fails +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Philipp Zabel + +[ Upstream commit 4fb26fb83f0def3d39c14e268bcd4003aae8fade ] + +Abort instead of returning a new reset control for a reset controller +device that is going to have its module unloaded. + +Reported-by: Uwe Kleine-König +Fixes: 61fc41317666 ("reset: Add reset controller API") +Acked-by: Uwe Kleine-König +Link: https://lore.kernel.org/r/20210607082615.15160-1-p.zabel@pengutronix.de +Signed-off-by: Philipp Zabel +Signed-off-by: Sasha Levin +--- + drivers/reset/core.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/drivers/reset/core.c b/drivers/reset/core.c +index 71c1c8264b2d..e2a6a927b84c 100644 +--- a/drivers/reset/core.c ++++ b/drivers/reset/core.c +@@ -774,7 +774,10 @@ static struct reset_control *__reset_control_get_internal( + if (!rstc) + return ERR_PTR(-ENOMEM); + +- try_module_get(rcdev->owner); ++ if (!try_module_get(rcdev->owner)) { ++ kfree(rstc); ++ return ERR_PTR(-ENODEV); ++ } + + rstc->rcdev = rcdev; + list_add(&rstc->list, &rcdev->reset_control_head); +-- +2.30.2 + diff --git a/queue-5.13/reset-brcmstb-add-missing-module_device_table.patch b/queue-5.13/reset-brcmstb-add-missing-module_device_table.patch new file mode 100644 index 00000000000..bb05d7af7bf --- /dev/null +++ b/queue-5.13/reset-brcmstb-add-missing-module_device_table.patch @@ -0,0 +1,38 @@ +From 419cf7ad7f21bd8fd2ca99ab6d6c626b2c994cf5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 12 May 2021 11:14:43 +0800 +Subject: reset: brcmstb: Add missing MODULE_DEVICE_TABLE + +From: Zou Wei + +[ Upstream commit e207457f9045343a24d936fbb67eb4b412f1c6ad ] + +This patch adds missing MODULE_DEVICE_TABLE definition which generates +correct modalias for automatic loading of this driver when it is built +as an external module. + +Reported-by: Hulk Robot +Fixes: 77750bc089e4 ("reset: Add Broadcom STB SW_INIT reset controller driver") +Signed-off-by: Zou Wei +Link: https://lore.kernel.org/r/1620789283-15048-1-git-send-email-zou_wei@huawei.com +Signed-off-by: Philipp Zabel +Signed-off-by: Sasha Levin +--- + drivers/reset/reset-brcmstb.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/reset/reset-brcmstb.c b/drivers/reset/reset-brcmstb.c +index f213264c8567..42c9d5241c53 100644 +--- a/drivers/reset/reset-brcmstb.c ++++ b/drivers/reset/reset-brcmstb.c +@@ -111,6 +111,7 @@ static const struct of_device_id brcmstb_reset_of_match[] = { + { .compatible = "brcm,brcmstb-reset" }, + { /* sentinel */ } + }; ++MODULE_DEVICE_TABLE(of, brcmstb_reset_of_match); + + static struct platform_driver brcmstb_reset_driver = { + .probe = brcmstb_reset_probe, +-- +2.30.2 + diff --git a/queue-5.13/reset-reset_brcmstb_rescal-should-depend-on-arch_brc.patch b/queue-5.13/reset-reset_brcmstb_rescal-should-depend-on-arch_brc.patch new file mode 100644 index 00000000000..72cdf380dd6 --- /dev/null +++ b/queue-5.13/reset-reset_brcmstb_rescal-should-depend-on-arch_brc.patch @@ -0,0 +1,43 @@ +From b8ab70bcde9daee45c6955a3981c165772e74d10 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 16 Mar 2021 14:37:33 +0100 +Subject: reset: RESET_BRCMSTB_RESCAL should depend on ARCH_BRCMSTB + +From: Geert Uytterhoeven + +[ Upstream commit 42f6a76fbe85e5243f83a3ed76809b1ebbb7087e ] + +The Broadcom STB RESCAL reset controller is only present on Broadcom +BCM7216 platforms. Hence add a dependency on ARCH_BRCMSTB, to prevent +asking the user about this driver when configuring a kernel without +BCM7216 support. + +Also, merely enabling CONFIG_COMPILE_TEST should not enable additional +code, and thus should not enable this driver by default. + +Fixes: 4cf176e52397853e ("reset: Add Broadcom STB RESCAL reset controller") +Signed-off-by: Geert Uytterhoeven +Acked-by: Florian Fainelli +Signed-off-by: Philipp Zabel +Signed-off-by: Sasha Levin +--- + drivers/reset/Kconfig | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig +index 3e7f55e44d84..312b7064cdb4 100644 +--- a/drivers/reset/Kconfig ++++ b/drivers/reset/Kconfig +@@ -59,7 +59,8 @@ config RESET_BRCMSTB + config RESET_BRCMSTB_RESCAL + bool "Broadcom STB RESCAL reset controller" + depends on HAS_IOMEM +- default ARCH_BRCMSTB || COMPILE_TEST ++ depends on ARCH_BRCMSTB || COMPILE_TEST ++ default ARCH_BRCMSTB + help + This enables the RESCAL reset controller for SATA, PCIe0, or PCIe1 on + BCM7216. +-- +2.30.2 + diff --git a/queue-5.13/reset-reset_intel_gw-should-depend-on-x86.patch b/queue-5.13/reset-reset_intel_gw-should-depend-on-x86.patch new file mode 100644 index 00000000000..dbc007ad836 --- /dev/null +++ b/queue-5.13/reset-reset_intel_gw-should-depend-on-x86.patch @@ -0,0 +1,37 @@ +From bdee7387790796600c0bf56244aede1a1f81ce51 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 31 Mar 2021 10:15:19 +0200 +Subject: reset: RESET_INTEL_GW should depend on X86 + +From: Geert Uytterhoeven + +[ Upstream commit 6ab9d6219f86f0db916105444813aafce626a2f4 ] + +The Intel Gateway reset controller is only present on Intel Gateway +platforms. Hence add a dependency on X86, to prevent asking the user +about this driver when configuring a kernel without Intel Gateway +support. + +Fixes: c9aef213e38cde27 ("reset: intel: Add system reset controller driver") +Signed-off-by: Geert Uytterhoeven +Signed-off-by: Philipp Zabel +Signed-off-by: Sasha Levin +--- + drivers/reset/Kconfig | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig +index 312b7064cdb4..bc8e90c8be52 100644 +--- a/drivers/reset/Kconfig ++++ b/drivers/reset/Kconfig +@@ -83,6 +83,7 @@ config RESET_IMX7 + + config RESET_INTEL_GW + bool "Intel Reset Controller Driver" ++ depends on X86 || COMPILE_TEST + depends on OF && HAS_IOMEM + select REGMAP_MMIO + help +-- +2.30.2 + diff --git a/queue-5.13/revert-alsa-bebob-oxfw-fix-kconfig-entry-for-mackie-.patch b/queue-5.13/revert-alsa-bebob-oxfw-fix-kconfig-entry-for-mackie-.patch new file mode 100644 index 00000000000..1918bd1cd70 --- /dev/null +++ b/queue-5.13/revert-alsa-bebob-oxfw-fix-kconfig-entry-for-mackie-.patch @@ -0,0 +1,80 @@ +From 5d01eb1d1d7a342827d805aacd3c6067321e93b5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 18 May 2021 17:45:47 +0900 +Subject: Revert "ALSA: bebob/oxfw: fix Kconfig entry for Mackie d.2 Pro" + +From: Takashi Sakamoto + +[ Upstream commit 5d6fb80a142b5994355ce675c517baba6089d199 ] + +This reverts commit 0edabdfe89581669609eaac5f6a8d0ae6fe95e7f. + +I've explained that optional FireWire card for d.2 is also built-in to +d.2 Pro, however it's wrong. The optional card uses DM1000 ASIC and has +'Mackie DJ Mixer' in its model name of configuration ROM. On the other +hand, built-in FireWire card for d.2 Pro and d.4 Pro uses OXFW971 ASIC +and has 'd.Pro' in its model name according to manuals and user +experiences. The former card is not the card for d.2 Pro. They are similar +in appearance but different internally. + +Signed-off-by: Takashi Sakamoto +Link: https://lore.kernel.org/r/20210518084557.102681-2-o-takashi@sakamocchi.jp +Signed-off-by: Takashi Iwai +Signed-off-by: Sasha Levin +--- + sound/firewire/Kconfig | 4 ++-- + sound/firewire/bebob/bebob.c | 2 +- + sound/firewire/oxfw/oxfw.c | 2 +- + 3 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/sound/firewire/Kconfig b/sound/firewire/Kconfig +index 9897bd26a438..def1f3d5ecf5 100644 +--- a/sound/firewire/Kconfig ++++ b/sound/firewire/Kconfig +@@ -38,7 +38,7 @@ config SND_OXFW + * Mackie(Loud) Onyx 1640i (former model) + * Mackie(Loud) Onyx Satellite + * Mackie(Loud) Tapco Link.Firewire +- * Mackie(Loud) d.4 pro ++ * Mackie(Loud) d.2 pro/d.4 pro (built-in FireWire card with OXFW971 ASIC) + * Mackie(Loud) U.420/U.420d + * TASCAM FireOne + * Stanton Controllers & Systems 1 Deck/Mixer +@@ -84,7 +84,7 @@ config SND_BEBOB + * PreSonus FIREBOX/FIREPOD/FP10/Inspire1394 + * BridgeCo RDAudio1/Audio5 + * Mackie Onyx 1220/1620/1640 (FireWire I/O Card) +- * Mackie d.2 (FireWire Option) and d.2 Pro ++ * Mackie d.2 (optional FireWire card with DM1000 ASIC) + * Stanton FinalScratch 2 (ScratchAmp) + * Tascam IF-FW/DM + * Behringer XENIX UFX 1204/1604 +diff --git a/sound/firewire/bebob/bebob.c b/sound/firewire/bebob/bebob.c +index daeecfa8b9aa..90e98a6d1546 100644 +--- a/sound/firewire/bebob/bebob.c ++++ b/sound/firewire/bebob/bebob.c +@@ -387,7 +387,7 @@ static const struct ieee1394_device_id bebob_id_table[] = { + SND_BEBOB_DEV_ENTRY(VEN_BRIDGECO, 0x00010049, &spec_normal), + /* Mackie, Onyx 1220/1620/1640 (Firewire I/O Card) */ + SND_BEBOB_DEV_ENTRY(VEN_MACKIE2, 0x00010065, &spec_normal), +- // Mackie, d.2 (Firewire option card) and d.2 Pro (the card is built-in). ++ // Mackie, d.2 (optional Firewire card with DM1000). + SND_BEBOB_DEV_ENTRY(VEN_MACKIE1, 0x00010067, &spec_normal), + /* Stanton, ScratchAmp */ + SND_BEBOB_DEV_ENTRY(VEN_STANTON, 0x00000001, &spec_normal), +diff --git a/sound/firewire/oxfw/oxfw.c b/sound/firewire/oxfw/oxfw.c +index 9eea25c46dc7..5490637d278a 100644 +--- a/sound/firewire/oxfw/oxfw.c ++++ b/sound/firewire/oxfw/oxfw.c +@@ -355,7 +355,7 @@ static const struct ieee1394_device_id oxfw_id_table[] = { + * Onyx-i series (former models): 0x081216 + * Mackie Onyx Satellite: 0x00200f + * Tapco LINK.firewire 4x6: 0x000460 +- * d.4 pro: Unknown ++ * d.2 pro/d.4 pro (built-in card): Unknown + * U.420: Unknown + * U.420d: Unknown + */ +-- +2.30.2 + diff --git a/queue-5.13/revert-arm-dts-bcm283x-increase-dwc2-s-rx-fifo-size.patch b/queue-5.13/revert-arm-dts-bcm283x-increase-dwc2-s-rx-fifo-size.patch new file mode 100644 index 00000000000..0fc6ce7fa20 --- /dev/null +++ b/queue-5.13/revert-arm-dts-bcm283x-increase-dwc2-s-rx-fifo-size.patch @@ -0,0 +1,55 @@ +From 87473d0d2326fcc9c00f8ab91258ba39c0826ca2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 29 May 2021 15:02:51 +0200 +Subject: Revert "ARM: dts: bcm283x: increase dwc2's RX FIFO size" + +From: Stefan Wahren + +[ Upstream commit 77daceabedb42482bb6200fa26047c5591716e45 ] + +This reverts commit 278407a53c3b33fb820332c4d39eb39316c3879a. + +The original change breaks USB config on Raspberry Pi Zero and Pi 4 B, +because it exceeds the total fifo size of 4080. A naive attempt to reduce +g-tx-fifo-size doesn't help on Raspberry Pi Zero. So better go back. + +Fixes: 278407a53c3b ("ARM: dts: bcm283x: increase dwc2's RX FIFO size") +Signed-off-by: Stefan Wahren +Cc: Pavel Hofman +Link: https://lore.kernel.org/r/1622293371-5997-1-git-send-email-stefan.wahren@i2se.com +Signed-off-by: Nicolas Saenz Julienne +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/bcm283x-rpi-usb-otg.dtsi | 2 +- + arch/arm/boot/dts/bcm283x-rpi-usb-peripheral.dtsi | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm283x-rpi-usb-otg.dtsi b/arch/arm/boot/dts/bcm283x-rpi-usb-otg.dtsi +index 20322de2f8bf..e2fd9610e125 100644 +--- a/arch/arm/boot/dts/bcm283x-rpi-usb-otg.dtsi ++++ b/arch/arm/boot/dts/bcm283x-rpi-usb-otg.dtsi +@@ -1,7 +1,7 @@ + // SPDX-License-Identifier: GPL-2.0 + &usb { + dr_mode = "otg"; +- g-rx-fifo-size = <558>; ++ g-rx-fifo-size = <256>; + g-np-tx-fifo-size = <32>; + /* + * According to dwc2 the sum of all device EP +diff --git a/arch/arm/boot/dts/bcm283x-rpi-usb-peripheral.dtsi b/arch/arm/boot/dts/bcm283x-rpi-usb-peripheral.dtsi +index 1409d1b559c1..0ff0e9e25327 100644 +--- a/arch/arm/boot/dts/bcm283x-rpi-usb-peripheral.dtsi ++++ b/arch/arm/boot/dts/bcm283x-rpi-usb-peripheral.dtsi +@@ -1,7 +1,7 @@ + // SPDX-License-Identifier: GPL-2.0 + &usb { + dr_mode = "peripheral"; +- g-rx-fifo-size = <558>; ++ g-rx-fifo-size = <256>; + g-np-tx-fifo-size = <32>; + g-tx-fifo-size = <256 256 512 512 512 768 768>; + }; +-- +2.30.2 + diff --git a/queue-5.13/rtc-bd70528-fix-bd71815-watchdog-dependency.patch b/queue-5.13/rtc-bd70528-fix-bd71815-watchdog-dependency.patch new file mode 100644 index 00000000000..8bab70741e4 --- /dev/null +++ b/queue-5.13/rtc-bd70528-fix-bd71815-watchdog-dependency.patch @@ -0,0 +1,57 @@ +From 2e248ff8ed357bdc838f6d3f5f24490f0d084dd8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 22 Apr 2021 17:15:21 +0200 +Subject: rtc: bd70528: fix BD71815 watchdog dependency + +From: Arnd Bergmann + +[ Upstream commit b0ddc5b170058a9ed3c9f031501d735a4eb8ee89 ] + +The added Kconfig dependency is slightly incorrect, which can +lead to a link failure when the watchdog is a loadable module: + +arm-linux-gnueabi-ld: drivers/rtc/rtc-bd70528.o: in function `bd70528_set_rtc_based_timers': +rtc-bd70528.c:(.text+0x6cc): undefined reference to `bd70528_wdt_set' +arm-linux-gnueabi-ld: drivers/rtc/rtc-bd70528.o: in function `bd70528_set_time': +rtc-bd70528.c:(.text+0xaa0): undefined reference to `bd70528_wdt_lock' +arm-linux-gnueabi-ld: rtc-bd70528.c:(.text+0xab8): undefined reference to `bd70528_wdt_unlock' +arm-linux-gnueabi-ld: drivers/rtc/rtc-bd70528.o: in function `bd70528_alm_enable': +rtc-bd70528.c:(.text+0xfc0): undefined reference to `bd70528_wdt_lock' +arm-linux-gnueabi-ld: rtc-bd70528.c:(.text+0x1030): undefined reference to `bd70528_wdt_unlock' + +The problem is that it allows to be built-in if MFD_ROHM_BD71828 +is built-in, even when the watchdog is a loadable module. + +Rework this so that having the watchdog as a loadable module always +forces the rtc to be a module as well instead of built-in, +regardless of bd71828. + +Fixes: c56dc069f268 ("rtc: bd70528: Support RTC on ROHM BD71815") +Signed-off-by: Arnd Bergmann +Reviewed-by: Guenter Roeck +Reviewed-by: Matti Vaittinen +Acked-by: Randy Dunlap # build-tested +Signed-off-by: Alexandre Belloni +Link: https://lore.kernel.org/r/20210422151545.2403356-1-arnd@kernel.org +Signed-off-by: Sasha Levin +--- + drivers/rtc/Kconfig | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig +index d8c13fded164..914497abeef9 100644 +--- a/drivers/rtc/Kconfig ++++ b/drivers/rtc/Kconfig +@@ -502,7 +502,8 @@ config RTC_DRV_M41T80_WDT + + config RTC_DRV_BD70528 + tristate "ROHM BD70528, BD71815 and BD71828 PMIC RTC" +- depends on MFD_ROHM_BD71828 || MFD_ROHM_BD70528 && (BD70528_WATCHDOG || !BD70528_WATCHDOG) ++ depends on MFD_ROHM_BD71828 || MFD_ROHM_BD70528 ++ depends on BD70528_WATCHDOG || !BD70528_WATCHDOG + help + If you say Y here you will get support for the RTC + block on ROHM BD70528, BD71815 and BD71828 Power Management IC. +-- +2.30.2 + diff --git a/queue-5.13/rtc-fix-snprintf-checking-in-is_rtc_hctosys.patch b/queue-5.13/rtc-fix-snprintf-checking-in-is_rtc_hctosys.patch new file mode 100644 index 00000000000..937dd28eced --- /dev/null +++ b/queue-5.13/rtc-fix-snprintf-checking-in-is_rtc_hctosys.patch @@ -0,0 +1,44 @@ +From 89621a2ad0d2c6e4b3a88bac406fa83ed0cd4b59 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 11 May 2021 10:19:26 +0300 +Subject: rtc: fix snprintf() checking in is_rtc_hctosys() + +From: Dan Carpenter + +[ Upstream commit 54b909436ede47e0ee07f1765da27ec2efa41e84 ] + +The scnprintf() function silently truncates the printf() and returns +the number bytes that it was able to copy (not counting the NUL +terminator). Thus, the highest value it can return here is +"NAME_SIZE - 1" and the overflow check is dead code. Fix this by +using the snprintf() function which returns the number of bytes that +would have been copied if there was enough space and changing the +condition from "> NAME_SIZE" to ">= NAME_SIZE". + +Fixes: 92589c986b33 ("rtc-proc: permit the /proc/driver/rtc device to use other devices") +Signed-off-by: Dan Carpenter +Signed-off-by: Alexandre Belloni +Link: https://lore.kernel.org/r/YJov/pcGmhLi2pEl@mwanda +Signed-off-by: Sasha Levin +--- + drivers/rtc/proc.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/rtc/proc.c b/drivers/rtc/proc.c +index 73344598fc1b..cbcdbb19d848 100644 +--- a/drivers/rtc/proc.c ++++ b/drivers/rtc/proc.c +@@ -23,8 +23,8 @@ static bool is_rtc_hctosys(struct rtc_device *rtc) + int size; + char name[NAME_SIZE]; + +- size = scnprintf(name, NAME_SIZE, "rtc%d", rtc->id); +- if (size > NAME_SIZE) ++ size = snprintf(name, NAME_SIZE, "rtc%d", rtc->id); ++ if (size >= NAME_SIZE) + return false; + + return !strncmp(name, CONFIG_RTC_HCTOSYS_DEVICE, NAME_SIZE); +-- +2.30.2 + diff --git a/queue-5.13/s390-disable-ssp-when-needed.patch b/queue-5.13/s390-disable-ssp-when-needed.patch new file mode 100644 index 00000000000..4c57459f8d2 --- /dev/null +++ b/queue-5.13/s390-disable-ssp-when-needed.patch @@ -0,0 +1,57 @@ +From 6c8b521d2f7f05bff2213a01b36ecc0e266f3026 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 10 May 2021 07:31:33 +0200 +Subject: s390: disable SSP when needed + +From: Fabrice Fontaine + +[ Upstream commit 42e8d652438f5ddf04e5dac299cb5e623d113dc0 ] + +Though -nostdlib is passed in PURGATORY_LDFLAGS and -ffreestanding in +KBUILD_CFLAGS_DECOMPRESSOR, -fno-stack-protector must also be passed to +avoid linking errors related to undefined references to +'__stack_chk_guard' and '__stack_chk_fail' if toolchain enforces +-fstack-protector. + +Fixes + - https://gitlab.com/kubu93/buildroot/-/jobs/1247043361 + +Signed-off-by: Fabrice Fontaine +Signed-off-by: Vasily Gorbik +Reviewed-by: Alexander Egorenkov +Tested-by: Alexander Egorenkov +Link: https://lore.kernel.org/r/20210510053133.1220167-1-fontaine.fabrice@gmail.com +Signed-off-by: Vasily Gorbik +Signed-off-by: Sasha Levin +--- + arch/s390/Makefile | 1 + + arch/s390/purgatory/Makefile | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/arch/s390/Makefile b/arch/s390/Makefile +index e443ed9947bd..098abe3a56f3 100644 +--- a/arch/s390/Makefile ++++ b/arch/s390/Makefile +@@ -28,6 +28,7 @@ KBUILD_CFLAGS_DECOMPRESSOR += -DDISABLE_BRANCH_PROFILING -D__NO_FORTIFY + KBUILD_CFLAGS_DECOMPRESSOR += -fno-delete-null-pointer-checks -msoft-float -mbackchain + KBUILD_CFLAGS_DECOMPRESSOR += -fno-asynchronous-unwind-tables + KBUILD_CFLAGS_DECOMPRESSOR += -ffreestanding ++KBUILD_CFLAGS_DECOMPRESSOR += -fno-stack-protector + KBUILD_CFLAGS_DECOMPRESSOR += $(call cc-disable-warning, address-of-packed-member) + KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),-g) + KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO_DWARF4), $(call cc-option, -gdwarf-4,)) +diff --git a/arch/s390/purgatory/Makefile b/arch/s390/purgatory/Makefile +index c57f8c40e992..21c4ebe29b9a 100644 +--- a/arch/s390/purgatory/Makefile ++++ b/arch/s390/purgatory/Makefile +@@ -24,6 +24,7 @@ KBUILD_CFLAGS := -fno-strict-aliasing -Wall -Wstrict-prototypes + KBUILD_CFLAGS += -Wno-pointer-sign -Wno-sign-compare + KBUILD_CFLAGS += -fno-zero-initialized-in-bss -fno-builtin -ffreestanding + KBUILD_CFLAGS += -c -MD -Os -m64 -msoft-float -fno-common ++KBUILD_CFLAGS += -fno-stack-protector + KBUILD_CFLAGS += $(CLANG_FLAGS) + KBUILD_CFLAGS += $(call cc-option,-fno-PIE) + KBUILD_AFLAGS := $(filter-out -DCC_USING_EXPOLINE,$(KBUILD_AFLAGS)) +-- +2.30.2 + diff --git a/queue-5.13/s390-ipl_parm-fix-program-check-new-psw-handling.patch b/queue-5.13/s390-ipl_parm-fix-program-check-new-psw-handling.patch new file mode 100644 index 00000000000..d6c59033e04 --- /dev/null +++ b/queue-5.13/s390-ipl_parm-fix-program-check-new-psw-handling.patch @@ -0,0 +1,71 @@ +From 92e7895fc3720f36109678bca0d115d271105a98 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 14 Jun 2021 14:49:31 +0200 +Subject: s390/ipl_parm: fix program check new psw handling + +From: Heiko Carstens + +[ Upstream commit 88c2510cecb7e2b518e3c4fdf3cf0e13ebe9377c ] + +The __diag308() inline asm temporarily changes the program check new +psw to redirect a potential program check on the diag instruction. +Restoring of the program check new psw is done in C code behind the +inline asm. + +This can be problematic, especially if the function is inlined, since +the compiler can reorder instructions in such a way that a different +instruction, which may result in a program check, might be executed +before the program check new psw has been restored. + +To avoid such a scenario move restoring into the inline asm. For +consistency reasons move also saving of the original program check new +psw into the inline asm. + +Signed-off-by: Heiko Carstens +Signed-off-by: Vasily Gorbik +Signed-off-by: Sasha Levin +--- + arch/s390/boot/ipl_parm.c | 19 +++++++++++-------- + 1 file changed, 11 insertions(+), 8 deletions(-) + +diff --git a/arch/s390/boot/ipl_parm.c b/arch/s390/boot/ipl_parm.c +index d372a45fe10e..dd92092e3eec 100644 +--- a/arch/s390/boot/ipl_parm.c ++++ b/arch/s390/boot/ipl_parm.c +@@ -28,22 +28,25 @@ static inline int __diag308(unsigned long subcode, void *addr) + register unsigned long _addr asm("0") = (unsigned long)addr; + register unsigned long _rc asm("1") = 0; + unsigned long reg1, reg2; +- psw_t old = S390_lowcore.program_new_psw; ++ psw_t old; + + asm volatile( ++ " mvc 0(16,%[psw_old]),0(%[psw_pgm])\n" + " epsw %0,%1\n" +- " st %0,%[psw_pgm]\n" +- " st %1,%[psw_pgm]+4\n" ++ " st %0,0(%[psw_pgm])\n" ++ " st %1,4(%[psw_pgm])\n" + " larl %0,1f\n" +- " stg %0,%[psw_pgm]+8\n" ++ " stg %0,8(%[psw_pgm])\n" + " diag %[addr],%[subcode],0x308\n" +- "1: nopr %%r7\n" ++ "1: mvc 0(16,%[psw_pgm]),0(%[psw_old])\n" + : "=&d" (reg1), "=&a" (reg2), +- [psw_pgm] "=Q" (S390_lowcore.program_new_psw), ++ "+Q" (S390_lowcore.program_new_psw), ++ "=Q" (old), + [addr] "+d" (_addr), "+d" (_rc) +- : [subcode] "d" (subcode) ++ : [subcode] "d" (subcode), ++ [psw_old] "a" (&old), ++ [psw_pgm] "a" (&S390_lowcore.program_new_psw) + : "cc", "memory"); +- S390_lowcore.program_new_psw = old; + return _rc; + } + +-- +2.30.2 + diff --git a/queue-5.13/s390-irq-remove-have_irq_exit_on_irq_stack.patch b/queue-5.13/s390-irq-remove-have_irq_exit_on_irq_stack.patch new file mode 100644 index 00000000000..39555a2eaf1 --- /dev/null +++ b/queue-5.13/s390-irq-remove-have_irq_exit_on_irq_stack.patch @@ -0,0 +1,37 @@ +From 758f08dcb414515b787c6e5dd897bae75ee82a3e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 6 Jul 2021 20:24:58 +0200 +Subject: s390/irq: remove HAVE_IRQ_EXIT_ON_IRQ_STACK + +From: Sven Schnelle + +[ Upstream commit 0aa4ff7688632a86bdb133fa106f2ccd514b91a7 ] + +This is no longer true since we switched to generic entry. The code +switches to the IRQ stack before calling do_IRQ, but switches back +to the kernel stack before calling irq_exit(). + +Fixes: 56e62a737028 ("s390: convert to generic entry") +Signed-off-by: Sven Schnelle +Reviewed-by: Heiko Carstens +Signed-off-by: Vasily Gorbik +Signed-off-by: Sasha Levin +--- + arch/s390/Kconfig | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig +index 93488bbf491b..90e1639697b4 100644 +--- a/arch/s390/Kconfig ++++ b/arch/s390/Kconfig +@@ -165,7 +165,6 @@ config S390 + select HAVE_GCC_PLUGINS + select HAVE_GENERIC_VDSO + select HAVE_IOREMAP_PROT if PCI +- select HAVE_IRQ_EXIT_ON_IRQ_STACK + select HAVE_KERNEL_BZIP2 + select HAVE_KERNEL_GZIP + select HAVE_KERNEL_LZ4 +-- +2.30.2 + diff --git a/queue-5.13/s390-mem_detect-fix-diag260-program-check-new-psw-ha.patch b/queue-5.13/s390-mem_detect-fix-diag260-program-check-new-psw-ha.patch new file mode 100644 index 00000000000..81361e42b17 --- /dev/null +++ b/queue-5.13/s390-mem_detect-fix-diag260-program-check-new-psw-ha.patch @@ -0,0 +1,73 @@ +From 9a1e3f6c0dd925ee74f877e9fe0c3bbfc5a8bc6f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 14 Jun 2021 21:40:43 +0200 +Subject: s390/mem_detect: fix diag260() program check new psw handling + +From: Heiko Carstens + +[ Upstream commit 86807f348f418a84970eebb8f9912a7eea16b497 ] + +The __diag260() inline asm temporarily changes the program check new +psw to redirect a potential program check on the diag instruction. +Restoring of the program check new psw is done in C code behind the +inline asm. + +This can be problematic, especially if the function is inlined, since +the compiler can reorder instructions in such a way that a different +instruction, which may result in a program check, might be executed +before the program check new psw has been restored. + +To avoid such a scenario move restoring into the inline asm. For +consistency reasons move also saving of the original program check new +psw into the inline asm. + +Signed-off-by: Heiko Carstens +Signed-off-by: Vasily Gorbik +Signed-off-by: Sasha Levin +--- + arch/s390/boot/mem_detect.c | 19 +++++++++++-------- + 1 file changed, 11 insertions(+), 8 deletions(-) + +diff --git a/arch/s390/boot/mem_detect.c b/arch/s390/boot/mem_detect.c +index 40168e59abd3..3f093556dc3b 100644 +--- a/arch/s390/boot/mem_detect.c ++++ b/arch/s390/boot/mem_detect.c +@@ -69,24 +69,27 @@ static int __diag260(unsigned long rx1, unsigned long rx2) + register unsigned long _ry asm("4") = 0x10; /* storage configuration */ + int rc = -1; /* fail */ + unsigned long reg1, reg2; +- psw_t old = S390_lowcore.program_new_psw; ++ psw_t old; + + asm volatile( ++ " mvc 0(16,%[psw_old]),0(%[psw_pgm])\n" + " epsw %0,%1\n" +- " st %0,%[psw_pgm]\n" +- " st %1,%[psw_pgm]+4\n" ++ " st %0,0(%[psw_pgm])\n" ++ " st %1,4(%[psw_pgm])\n" + " larl %0,1f\n" +- " stg %0,%[psw_pgm]+8\n" ++ " stg %0,8(%[psw_pgm])\n" + " diag %[rx],%[ry],0x260\n" + " ipm %[rc]\n" + " srl %[rc],28\n" +- "1:\n" ++ "1: mvc 0(16,%[psw_pgm]),0(%[psw_old])\n" + : "=&d" (reg1), "=&a" (reg2), +- [psw_pgm] "=Q" (S390_lowcore.program_new_psw), ++ "+Q" (S390_lowcore.program_new_psw), ++ "=Q" (old), + [rc] "+&d" (rc), [ry] "+d" (_ry) +- : [rx] "d" (_rx1), "d" (_rx2) ++ : [rx] "d" (_rx1), "d" (_rx2), ++ [psw_old] "a" (&old), ++ [psw_pgm] "a" (&S390_lowcore.program_new_psw) + : "cc", "memory"); +- S390_lowcore.program_new_psw = old; + return rc == 0 ? _ry : -1; + } + +-- +2.30.2 + diff --git a/queue-5.13/s390-mem_detect-fix-tprot-program-check-new-psw-hand.patch b/queue-5.13/s390-mem_detect-fix-tprot-program-check-new-psw-hand.patch new file mode 100644 index 00000000000..03cb13e5bf9 --- /dev/null +++ b/queue-5.13/s390-mem_detect-fix-tprot-program-check-new-psw-hand.patch @@ -0,0 +1,79 @@ +From e1f04389de6851cc77f70c43a35017e92e67ac21 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 14 Jun 2021 22:09:20 +0200 +Subject: s390/mem_detect: fix tprot() program check new psw handling + +From: Heiko Carstens + +[ Upstream commit da9057576785aaab52e706e76c0475c85b77ec14 ] + +The tprot() inline asm temporarily changes the program check new psw +to redirect a potential program check on the diag instruction. +Restoring of the program check new psw is done in C code behind the +inline asm. + +This can be problematic, especially if the function is inlined, since +the compiler can reorder instructions in such a way that a different +instruction, which may result in a program check, might be executed +before the program check new psw has been restored. + +To avoid such a scenario move restoring into the inline asm. For +consistency reasons move also saving of the original program check new +psw into the inline asm. + +Signed-off-by: Heiko Carstens +Signed-off-by: Vasily Gorbik +Signed-off-by: Sasha Levin +--- + arch/s390/boot/mem_detect.c | 28 +++++++++++++++++----------- + 1 file changed, 17 insertions(+), 11 deletions(-) + +diff --git a/arch/s390/boot/mem_detect.c b/arch/s390/boot/mem_detect.c +index 3f093556dc3b..a0e980f57c02 100644 +--- a/arch/s390/boot/mem_detect.c ++++ b/arch/s390/boot/mem_detect.c +@@ -114,24 +114,30 @@ static int diag260(void) + + static int tprot(unsigned long addr) + { +- unsigned long pgm_addr; ++ unsigned long reg1, reg2; + int rc = -EFAULT; +- psw_t old = S390_lowcore.program_new_psw; ++ psw_t old; + +- S390_lowcore.program_new_psw.mask = __extract_psw(); + asm volatile( +- " larl %[pgm_addr],1f\n" +- " stg %[pgm_addr],%[psw_pgm_addr]\n" ++ " mvc 0(16,%[psw_old]),0(%[psw_pgm])\n" ++ " epsw %[reg1],%[reg2]\n" ++ " st %[reg1],0(%[psw_pgm])\n" ++ " st %[reg2],4(%[psw_pgm])\n" ++ " larl %[reg1],1f\n" ++ " stg %[reg1],8(%[psw_pgm])\n" + " tprot 0(%[addr]),0\n" + " ipm %[rc]\n" + " srl %[rc],28\n" +- "1:\n" +- : [pgm_addr] "=&d"(pgm_addr), +- [psw_pgm_addr] "=Q"(S390_lowcore.program_new_psw.addr), +- [rc] "+&d"(rc) +- : [addr] "a"(addr) ++ "1: mvc 0(16,%[psw_pgm]),0(%[psw_old])\n" ++ : [reg1] "=&d" (reg1), ++ [reg2] "=&a" (reg2), ++ [rc] "+&d" (rc), ++ "=Q" (S390_lowcore.program_new_psw.addr), ++ "=Q" (old) ++ : [psw_old] "a" (&old), ++ [psw_pgm] "a" (&S390_lowcore.program_new_psw), ++ [addr] "a" (addr) + : "cc", "memory"); +- S390_lowcore.program_new_psw = old; + return rc; + } + +-- +2.30.2 + diff --git a/queue-5.13/s390-processor-always-inline-stap-and-__load_psw_mas.patch b/queue-5.13/s390-processor-always-inline-stap-and-__load_psw_mas.patch new file mode 100644 index 00000000000..784cfb38954 --- /dev/null +++ b/queue-5.13/s390-processor-always-inline-stap-and-__load_psw_mas.patch @@ -0,0 +1,48 @@ +From a0b712d4185f9e91738e0dcb5249e67f2bc321ac Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 10 Jun 2021 17:50:25 +0200 +Subject: s390/processor: always inline stap() and __load_psw_mask() + +From: Heiko Carstens + +[ Upstream commit 9c9a915afd90f7534c16a71d1cd44b58596fddf3 ] + +s390 is the only architecture which makes use of the __no_kasan_or_inline +attribute for two functions. Given that both stap() and __load_psw_mask() +are very small functions they can and should be always inlined anyway. + +Therefore get rid of __no_kasan_or_inline and always inline these +functions. + +Signed-off-by: Heiko Carstens +Signed-off-by: Vasily Gorbik +Signed-off-by: Sasha Levin +--- + arch/s390/include/asm/processor.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/s390/include/asm/processor.h b/arch/s390/include/asm/processor.h +index 023a15dc25a3..dbd380d81133 100644 +--- a/arch/s390/include/asm/processor.h ++++ b/arch/s390/include/asm/processor.h +@@ -207,7 +207,7 @@ static __always_inline unsigned long current_stack_pointer(void) + return sp; + } + +-static __no_kasan_or_inline unsigned short stap(void) ++static __always_inline unsigned short stap(void) + { + unsigned short cpu_address; + +@@ -246,7 +246,7 @@ static inline void __load_psw(psw_t psw) + * Set PSW mask to specified value, while leaving the + * PSW addr pointing to the next instruction. + */ +-static __no_kasan_or_inline void __load_psw_mask(unsigned long mask) ++static __always_inline void __load_psw_mask(unsigned long mask) + { + unsigned long addr; + psw_t psw; +-- +2.30.2 + diff --git a/queue-5.13/s390-sclp_vt220-fix-console-name-to-match-device.patch b/queue-5.13/s390-sclp_vt220-fix-console-name-to-match-device.patch new file mode 100644 index 00000000000..5c71bb19610 --- /dev/null +++ b/queue-5.13/s390-sclp_vt220-fix-console-name-to-match-device.patch @@ -0,0 +1,63 @@ +From 66116e13692c10065d8f6e79a1dde3d1e63d6871 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 27 Apr 2021 21:40:10 +0200 +Subject: s390/sclp_vt220: fix console name to match device + +From: Valentin Vidic + +[ Upstream commit b7d91d230a119fdcc334d10c9889ce9c5e15118b ] + +Console name reported in /proc/consoles: + + ttyS1 -W- (EC p ) 4:65 + +does not match the char device name: + + crw--w---- 1 root root 4, 65 May 17 12:18 /dev/ttysclp0 + +so debian-installer inside a QEMU s390x instance gets confused and fails +to start with the following error: + + steal-ctty: No such file or directory + +Signed-off-by: Valentin Vidic +Link: https://lore.kernel.org/r/20210427194010.9330-1-vvidic@valentin-vidic.from.hr +Signed-off-by: Christian Borntraeger +Signed-off-by: Vasily Gorbik +Signed-off-by: Sasha Levin +--- + arch/s390/kernel/setup.c | 2 +- + drivers/s390/char/sclp_vt220.c | 4 ++-- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c +index 382d73da134c..93538e63fa03 100644 +--- a/arch/s390/kernel/setup.c ++++ b/arch/s390/kernel/setup.c +@@ -165,7 +165,7 @@ static void __init set_preferred_console(void) + else if (CONSOLE_IS_3270) + add_preferred_console("tty3270", 0, NULL); + else if (CONSOLE_IS_VT220) +- add_preferred_console("ttyS", 1, NULL); ++ add_preferred_console("ttysclp", 0, NULL); + else if (CONSOLE_IS_HVC) + add_preferred_console("hvc", 0, NULL); + } +diff --git a/drivers/s390/char/sclp_vt220.c b/drivers/s390/char/sclp_vt220.c +index 7f4445b0f819..2f96c31e9b7b 100644 +--- a/drivers/s390/char/sclp_vt220.c ++++ b/drivers/s390/char/sclp_vt220.c +@@ -35,8 +35,8 @@ + #define SCLP_VT220_MINOR 65 + #define SCLP_VT220_DRIVER_NAME "sclp_vt220" + #define SCLP_VT220_DEVICE_NAME "ttysclp" +-#define SCLP_VT220_CONSOLE_NAME "ttyS" +-#define SCLP_VT220_CONSOLE_INDEX 1 /* console=ttyS1 */ ++#define SCLP_VT220_CONSOLE_NAME "ttysclp" ++#define SCLP_VT220_CONSOLE_INDEX 0 /* console=ttysclp0 */ + + /* Representation of a single write request */ + struct sclp_vt220_request { +-- +2.30.2 + diff --git a/queue-5.13/sched-uclamp-ignore-max-aggregation-if-rq-is-idle.patch b/queue-5.13/sched-uclamp-ignore-max-aggregation-if-rq-is-idle.patch new file mode 100644 index 00000000000..dc91a021571 --- /dev/null +++ b/queue-5.13/sched-uclamp-ignore-max-aggregation-if-rq-is-idle.patch @@ -0,0 +1,78 @@ +From 24373a4f10f3d3ad1c424dfebf5bfcc56b70362a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 30 Jun 2021 22:12:04 +0800 +Subject: sched/uclamp: Ignore max aggregation if rq is idle + +From: Xuewen Yan + +[ Upstream commit 3e1493f46390618ea78607cb30c58fc19e2a5035 ] + +When a task wakes up on an idle rq, uclamp_rq_util_with() would max +aggregate with rq value. But since there is no task enqueued yet, the +values are stale based on the last task that was running. When the new +task actually wakes up and enqueued, then the rq uclamp values should +reflect that of the newly woken up task effective uclamp values. + +This is a problem particularly for uclamp_max because it default to +1024. If a task p with uclamp_max = 512 wakes up, then max aggregation +would ignore the capping that should apply when this task is enqueued, +which is wrong. + +Fix that by ignoring max aggregation if the rq is idle since in that +case the effective uclamp value of the rq will be the ones of the task +that will wake up. + +Fixes: 9d20ad7dfc9a ("sched/uclamp: Add uclamp_util_with()") +Signed-off-by: Xuewen Yan +Signed-off-by: Peter Zijlstra (Intel) +Reviewed-by: Valentin Schneider +[qias: Changelog] +Reviewed-by: Qais Yousef +Link: https://lore.kernel.org/r/20210630141204.8197-1-xuewen.yan94@gmail.com +Signed-off-by: Sasha Levin +--- + kernel/sched/sched.h | 21 ++++++++++++++------- + 1 file changed, 14 insertions(+), 7 deletions(-) + +diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h +index a189bec13729..35f7efed75c4 100644 +--- a/kernel/sched/sched.h ++++ b/kernel/sched/sched.h +@@ -2539,20 +2539,27 @@ static __always_inline + unsigned long uclamp_rq_util_with(struct rq *rq, unsigned long util, + struct task_struct *p) + { +- unsigned long min_util; +- unsigned long max_util; ++ unsigned long min_util = 0; ++ unsigned long max_util = 0; + + if (!static_branch_likely(&sched_uclamp_used)) + return util; + +- min_util = READ_ONCE(rq->uclamp[UCLAMP_MIN].value); +- max_util = READ_ONCE(rq->uclamp[UCLAMP_MAX].value); +- + if (p) { +- min_util = max(min_util, uclamp_eff_value(p, UCLAMP_MIN)); +- max_util = max(max_util, uclamp_eff_value(p, UCLAMP_MAX)); ++ min_util = uclamp_eff_value(p, UCLAMP_MIN); ++ max_util = uclamp_eff_value(p, UCLAMP_MAX); ++ ++ /* ++ * Ignore last runnable task's max clamp, as this task will ++ * reset it. Similarly, no need to read the rq's min clamp. ++ */ ++ if (rq->uclamp_flags & UCLAMP_FLAG_IDLE) ++ goto out; + } + ++ min_util = max_t(unsigned long, min_util, READ_ONCE(rq->uclamp[UCLAMP_MIN].value)); ++ max_util = max_t(unsigned long, max_util, READ_ONCE(rq->uclamp[UCLAMP_MAX].value)); ++out: + /* + * Since CPU's {min,max}_util clamps are MAX aggregated considering + * RUNNABLE tasks with _different_ clamps, we can end up with an +-- +2.30.2 + diff --git a/queue-5.13/scsi-arcmsr-fix-doorbell-status-being-updated-late-o.patch b/queue-5.13/scsi-arcmsr-fix-doorbell-status-being-updated-late-o.patch new file mode 100644 index 00000000000..9518b27f967 --- /dev/null +++ b/queue-5.13/scsi-arcmsr-fix-doorbell-status-being-updated-late-o.patch @@ -0,0 +1,48 @@ +From 2aa51911480308e96a5681c1cf4a71badc11512d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 20 May 2021 14:55:15 +0800 +Subject: scsi: arcmsr: Fix doorbell status being updated late on ARC-1886 + +From: ching Huang + +[ Upstream commit d9a231226f28261a787535e08d0c78669e1ad010 ] + +It is possible for the IOP to be delayed in updating the doorbell +status. The doorbell status should not be 0 so loop until the value +changes. + +Link: https://lore.kernel.org/r/afdfdf7eabecf14632492c4987a6b9ac6312a7ad.camel@areca.com.tw +Signed-off-by: ching Huang +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/arcmsr/arcmsr_hba.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c +index 930972cda38c..42e494a7106c 100644 +--- a/drivers/scsi/arcmsr/arcmsr_hba.c ++++ b/drivers/scsi/arcmsr/arcmsr_hba.c +@@ -2419,10 +2419,17 @@ static void arcmsr_hbaD_doorbell_isr(struct AdapterControlBlock *pACB) + + static void arcmsr_hbaE_doorbell_isr(struct AdapterControlBlock *pACB) + { +- uint32_t outbound_doorbell, in_doorbell, tmp; ++ uint32_t outbound_doorbell, in_doorbell, tmp, i; + struct MessageUnit_E __iomem *reg = pACB->pmuE; + +- in_doorbell = readl(®->iobound_doorbell); ++ if (pACB->adapter_type == ACB_ADAPTER_TYPE_F) { ++ for (i = 0; i < 5; i++) { ++ in_doorbell = readl(®->iobound_doorbell); ++ if (in_doorbell != 0) ++ break; ++ } ++ } else ++ in_doorbell = readl(®->iobound_doorbell); + outbound_doorbell = in_doorbell ^ pACB->in_doorbell; + do { + writel(0, ®->host_int_status); /* clear interrupt */ +-- +2.30.2 + diff --git a/queue-5.13/scsi-arcmsr-fix-the-wrong-cdb-payload-report-to-iop.patch b/queue-5.13/scsi-arcmsr-fix-the-wrong-cdb-payload-report-to-iop.patch new file mode 100644 index 00000000000..b553562f22b --- /dev/null +++ b/queue-5.13/scsi-arcmsr-fix-the-wrong-cdb-payload-report-to-iop.patch @@ -0,0 +1,41 @@ +From 3e9e52bcf4c3aa66789be50a0ac931165502930f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 16 Apr 2021 11:44:57 +0800 +Subject: scsi: arcmsr: Fix the wrong CDB payload report to IOP + +From: ching Huang + +[ Upstream commit 5b8644968d2ca85abb785e83efec36934974b0c2 ] + +This patch fixes the wrong CDB payload report to IOP. + +Link: https://lore.kernel.org/r/d2c97df3c817595c6faf582839316209022f70da.camel@areca.com.tw +Signed-off-by: ching Huang +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/arcmsr/arcmsr_hba.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c +index 4b79661275c9..930972cda38c 100644 +--- a/drivers/scsi/arcmsr/arcmsr_hba.c ++++ b/drivers/scsi/arcmsr/arcmsr_hba.c +@@ -1923,8 +1923,12 @@ static void arcmsr_post_ccb(struct AdapterControlBlock *acb, struct CommandContr + + if (ccb->arc_cdb_size <= 0x300) + arc_cdb_size = (ccb->arc_cdb_size - 1) >> 6 | 1; +- else +- arc_cdb_size = (((ccb->arc_cdb_size + 0xff) >> 8) + 2) << 1 | 1; ++ else { ++ arc_cdb_size = ((ccb->arc_cdb_size + 0xff) >> 8) + 2; ++ if (arc_cdb_size > 0xF) ++ arc_cdb_size = 0xF; ++ arc_cdb_size = (arc_cdb_size << 1) | 1; ++ } + ccb_post_stamp = (ccb->smid | arc_cdb_size); + writel(0, &pmu->inbound_queueport_high); + writel(ccb_post_stamp, &pmu->inbound_queueport_low); +-- +2.30.2 + diff --git a/queue-5.13/scsi-be2iscsi-fix-an-error-handling-path-in-beiscsi_.patch b/queue-5.13/scsi-be2iscsi-fix-an-error-handling-path-in-beiscsi_.patch new file mode 100644 index 00000000000..26599b917e6 --- /dev/null +++ b/queue-5.13/scsi-be2iscsi-fix-an-error-handling-path-in-beiscsi_.patch @@ -0,0 +1,37 @@ +From a4af6d6313169968ce301842a6053681a8ca9b4e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 12 Jun 2021 09:18:34 +0200 +Subject: scsi: be2iscsi: Fix an error handling path in beiscsi_dev_probe() + +From: Christophe JAILLET + +[ Upstream commit 030e4138d11fced3b831c2761e4cecf347bae99c ] + +If an error occurs after a pci_enable_pcie_error_reporting() call, it must +be undone by a corresponding pci_disable_pcie_error_reporting() call, as +already done in the remove function. + +Link: https://lore.kernel.org/r/77adb02cfea7f1364e5603ecf3930d8597ae356e.1623482155.git.christophe.jaillet@wanadoo.fr +Fixes: 3567f36a09d1 ("[SCSI] be2iscsi: Fix AER handling in driver") +Signed-off-by: Christophe JAILLET +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/be2iscsi/be_main.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c +index d941e1561527..b98f2f1e782d 100644 +--- a/drivers/scsi/be2iscsi/be_main.c ++++ b/drivers/scsi/be2iscsi/be_main.c +@@ -5745,6 +5745,7 @@ free_hba: + pci_disable_msix(phba->pcidev); + pci_dev_put(phba->pcidev); + iscsi_host_free(phba->shost); ++ pci_disable_pcie_error_reporting(pcidev); + pci_set_drvdata(pcidev, NULL); + disable_pci: + pci_release_regions(pcidev); +-- +2.30.2 + diff --git a/queue-5.13/scsi-core-cap-scsi_host-cmd_per_lun-at-can_queue.patch b/queue-5.13/scsi-core-cap-scsi_host-cmd_per_lun-at-can_queue.patch new file mode 100644 index 00000000000..eec63f14c86 --- /dev/null +++ b/queue-5.13/scsi-core-cap-scsi_host-cmd_per_lun-at-can_queue.patch @@ -0,0 +1,51 @@ +From 999954bc56a1de02f3510207d99e0b39ca7eb527 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 19 May 2021 22:31:02 +0800 +Subject: scsi: core: Cap scsi_host cmd_per_lun at can_queue + +From: John Garry + +[ Upstream commit ea2f0f77538c50739b9fb4de4700cee5535e1f77 ] + +The sysfs handling function sdev_store_queue_depth() enforces that the sdev +queue depth cannot exceed shost can_queue. The initial sdev queue depth +comes from shost cmd_per_lun. However, the LLDD may manually set +cmd_per_lun to be larger than can_queue, which leads to an initial sdev +queue depth greater than can_queue. + +Such an issue was reported in [0], which caused a hang. That has since been +fixed in commit fc09acb7de31 ("scsi: scsi_debug: Fix cmd_per_lun, set to +max_queue"). + +Stop this possibly happening for other drivers by capping shost cmd_per_lun +at shost can_queue. + +[0] https://lore.kernel.org/linux-scsi/YHaez6iN2HHYxYOh@T590/ + +Link: https://lore.kernel.org/r/1621434662-173079-1-git-send-email-john.garry@huawei.com +Reviewed-by: Ming Lei +Reviewed-by: Bart Van Assche +Signed-off-by: John Garry +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/hosts.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c +index 00ec0b9e9dbb..b40bb6bd5f5d 100644 +--- a/drivers/scsi/hosts.c ++++ b/drivers/scsi/hosts.c +@@ -220,6 +220,9 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev, + goto fail; + } + ++ shost->cmd_per_lun = min_t(short, shost->cmd_per_lun, ++ shost->can_queue); ++ + error = scsi_init_sense_cache(shost); + if (error) + goto fail; +-- +2.30.2 + diff --git a/queue-5.13/scsi-core-fixup-calling-convention-for-scsi_mode_sen.patch b/queue-5.13/scsi-core-fixup-calling-convention-for-scsi_mode_sen.patch new file mode 100644 index 00000000000..78e8107effc --- /dev/null +++ b/queue-5.13/scsi-core-fixup-calling-convention-for-scsi_mode_sen.patch @@ -0,0 +1,163 @@ +From a4678590076a42c8171ef19eef41bc2883604016 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 27 Apr 2021 10:30:09 +0200 +Subject: scsi: core: Fixup calling convention for scsi_mode_sense() + +From: Hannes Reinecke + +[ Upstream commit 8793613de913e03e7c884f4cc56e350bc716431e ] + +The description for scsi_mode_sense() claims to return the number of valid +bytes on success, which is not what the code does. Additionally there is +no gain in returning the SCSI status, as everything the callers do is to +check against scsi_result_is_good(), which is what scsi_mode_sense() does +already. So change the calling convention to return a standard error code +on failure, and 0 on success, and adapt the description and all callers. + +Link: https://lore.kernel.org/r/20210427083046.31620-4-hare@suse.de +Reviewed-by: Bart Van Assche +Signed-off-by: Hannes Reinecke +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/scsi_lib.c | 10 ++++++---- + drivers/scsi/scsi_transport_sas.c | 9 ++++----- + drivers/scsi/sd.c | 12 ++++++------ + drivers/scsi/sr.c | 2 +- + 4 files changed, 17 insertions(+), 16 deletions(-) + +diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c +index 269bfb8f9165..89560562d9f6 100644 +--- a/drivers/scsi/scsi_lib.c ++++ b/drivers/scsi/scsi_lib.c +@@ -2094,9 +2094,7 @@ EXPORT_SYMBOL_GPL(scsi_mode_select); + * @sshdr: place to put sense data (or NULL if no sense to be collected). + * must be SCSI_SENSE_BUFFERSIZE big. + * +- * Returns zero if unsuccessful, or the header offset (either 4 +- * or 8 depending on whether a six or ten byte command was +- * issued) if successful. ++ * Returns zero if successful, or a negative error number on failure + */ + int + scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, +@@ -2143,6 +2141,8 @@ scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, + + result = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buffer, len, + sshdr, timeout, retries, NULL); ++ if (result < 0) ++ return result; + + /* This code looks awful: what it's doing is making sure an + * ILLEGAL REQUEST sense return identifies the actual command +@@ -2187,13 +2187,15 @@ scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, + data->block_descriptor_length = buffer[3]; + } + data->header_length = header_length; ++ result = 0; + } else if ((status_byte(result) == CHECK_CONDITION) && + scsi_sense_valid(sshdr) && + sshdr->sense_key == UNIT_ATTENTION && retry_count) { + retry_count--; + goto retry; + } +- ++ if (result > 0) ++ result = -EIO; + return result; + } + EXPORT_SYMBOL(scsi_mode_sense); +diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c +index c9abed8429c9..4a96fb05731d 100644 +--- a/drivers/scsi/scsi_transport_sas.c ++++ b/drivers/scsi/scsi_transport_sas.c +@@ -1229,16 +1229,15 @@ int sas_read_port_mode_page(struct scsi_device *sdev) + char *buffer = kzalloc(BUF_SIZE, GFP_KERNEL), *msdata; + struct sas_end_device *rdev = sas_sdev_to_rdev(sdev); + struct scsi_mode_data mode_data; +- int res, error; ++ int error; + + if (!buffer) + return -ENOMEM; + +- res = scsi_mode_sense(sdev, 1, 0x19, buffer, BUF_SIZE, 30*HZ, 3, +- &mode_data, NULL); ++ error = scsi_mode_sense(sdev, 1, 0x19, buffer, BUF_SIZE, 30*HZ, 3, ++ &mode_data, NULL); + +- error = -EINVAL; +- if (!scsi_status_is_good(res)) ++ if (error) + goto out; + + msdata = buffer + mode_data.header_length + +diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c +index a2c3d9ad9ee4..4df54d4b3c65 100644 +--- a/drivers/scsi/sd.c ++++ b/drivers/scsi/sd.c +@@ -2684,18 +2684,18 @@ sd_read_write_protect_flag(struct scsi_disk *sdkp, unsigned char *buffer) + * 5: Illegal Request, Sense Code 24: Invalid field in + * CDB. + */ +- if (!scsi_status_is_good(res)) ++ if (res < 0) + res = sd_do_mode_sense(sdkp, 0, 0, buffer, 4, &data, NULL); + + /* + * Third attempt: ask 255 bytes, as we did earlier. + */ +- if (!scsi_status_is_good(res)) ++ if (res < 0) + res = sd_do_mode_sense(sdkp, 0, 0x3F, buffer, 255, + &data, NULL); + } + +- if (!scsi_status_is_good(res)) { ++ if (res < 0) { + sd_first_printk(KERN_WARNING, sdkp, + "Test WP failed, assume Write Enabled\n"); + } else { +@@ -2756,7 +2756,7 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer) + res = sd_do_mode_sense(sdkp, dbd, modepage, buffer, first_len, + &data, &sshdr); + +- if (!scsi_status_is_good(res)) ++ if (res < 0) + goto bad_sense; + + if (!data.header_length) { +@@ -2788,7 +2788,7 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer) + res = sd_do_mode_sense(sdkp, dbd, modepage, buffer, len, + &data, &sshdr); + +- if (scsi_status_is_good(res)) { ++ if (!res) { + int offset = data.header_length + data.block_descriptor_length; + + while (offset < len) { +@@ -2906,7 +2906,7 @@ static void sd_read_app_tag_own(struct scsi_disk *sdkp, unsigned char *buffer) + res = scsi_mode_sense(sdp, 1, 0x0a, buffer, 36, SD_TIMEOUT, + sdkp->max_retries, &data, &sshdr); + +- if (!scsi_status_is_good(res) || !data.header_length || ++ if (res < 0 || !data.header_length || + data.length < 6) { + sd_first_printk(KERN_WARNING, sdkp, + "getting Control mode page failed, assume no ATO\n"); +diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c +index 7815ed642d43..1a94c7b1de2d 100644 +--- a/drivers/scsi/sr.c ++++ b/drivers/scsi/sr.c +@@ -913,7 +913,7 @@ static void get_capabilities(struct scsi_cd *cd) + rc = scsi_mode_sense(cd->device, 0, 0x2a, buffer, ms_len, + SR_TIMEOUT, 3, &data, NULL); + +- if (!scsi_status_is_good(rc) || data.length > ms_len || ++ if (rc < 0 || data.length > ms_len || + data.header_length + data.block_descriptor_length > data.length) { + /* failed, drive doesn't have capabilities mode page */ + cd->cdi.speed = 1; +-- +2.30.2 + diff --git a/queue-5.13/scsi-hisi_sas-propagate-errors-in-interrupt_init_v1_.patch b/queue-5.13/scsi-hisi_sas-propagate-errors-in-interrupt_init_v1_.patch new file mode 100644 index 00000000000..dc8c19fcd60 --- /dev/null +++ b/queue-5.13/scsi-hisi_sas-propagate-errors-in-interrupt_init_v1_.patch @@ -0,0 +1,85 @@ +From 0234d015ac52bc6c7e2c654b5832f0b91df3e2a1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 19 May 2021 22:20:15 +0300 +Subject: scsi: hisi_sas: Propagate errors in interrupt_init_v1_hw() + +From: Sergey Shtylyov + +[ Upstream commit ab17122e758ef68fb21033e25c041144067975f5 ] + +After commit 6c11dc060427 ("scsi: hisi_sas: Fix IRQ checks") we have the +error codes returned by platform_get_irq() ready for the propagation +upsream in interrupt_init_v1_hw() -- that will fix still broken deferred +probing. Let's propagate the error codes from devm_request_irq() as well +since I don't see the reason to override them with -ENOENT... + +Link: https://lore.kernel.org/r/49ba93a3-d427-7542-d85a-b74fe1a33a73@omp.ru +Acked-by: John Garry +Signed-off-by: Sergey Shtylyov +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/hisi_sas/hisi_sas_v1_hw.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c +index 3e359ac752fd..3cba7bfba296 100644 +--- a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c ++++ b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c +@@ -1649,7 +1649,7 @@ static int interrupt_init_v1_hw(struct hisi_hba *hisi_hba) + if (irq < 0) { + dev_err(dev, "irq init: fail map phy interrupt %d\n", + idx); +- return -ENOENT; ++ return irq; + } + + rc = devm_request_irq(dev, irq, phy_interrupts[j], 0, +@@ -1657,7 +1657,7 @@ static int interrupt_init_v1_hw(struct hisi_hba *hisi_hba) + if (rc) { + dev_err(dev, "irq init: could not request phy interrupt %d, rc=%d\n", + irq, rc); +- return -ENOENT; ++ return rc; + } + } + } +@@ -1668,7 +1668,7 @@ static int interrupt_init_v1_hw(struct hisi_hba *hisi_hba) + if (irq < 0) { + dev_err(dev, "irq init: could not map cq interrupt %d\n", + idx); +- return -ENOENT; ++ return irq; + } + + rc = devm_request_irq(dev, irq, cq_interrupt_v1_hw, 0, +@@ -1676,7 +1676,7 @@ static int interrupt_init_v1_hw(struct hisi_hba *hisi_hba) + if (rc) { + dev_err(dev, "irq init: could not request cq interrupt %d, rc=%d\n", + irq, rc); +- return -ENOENT; ++ return rc; + } + } + +@@ -1686,7 +1686,7 @@ static int interrupt_init_v1_hw(struct hisi_hba *hisi_hba) + if (irq < 0) { + dev_err(dev, "irq init: could not map fatal interrupt %d\n", + idx); +- return -ENOENT; ++ return irq; + } + + rc = devm_request_irq(dev, irq, fatal_interrupts[i], 0, +@@ -1694,7 +1694,7 @@ static int interrupt_init_v1_hw(struct hisi_hba *hisi_hba) + if (rc) { + dev_err(dev, "irq init: could not request fatal interrupt %d, rc=%d\n", + irq, rc); +- return -ENOENT; ++ return rc; + } + } + +-- +2.30.2 + diff --git a/queue-5.13/scsi-iscsi-add-iscsi_cls_conn-refcount-helpers.patch b/queue-5.13/scsi-iscsi-add-iscsi_cls_conn-refcount-helpers.patch new file mode 100644 index 00000000000..61f512dad4a --- /dev/null +++ b/queue-5.13/scsi-iscsi-add-iscsi_cls_conn-refcount-helpers.patch @@ -0,0 +1,97 @@ +From 8856e92c9ec724d4307640f9fd69873583e3c9b2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 25 May 2021 13:18:03 -0500 +Subject: scsi: iscsi: Add iscsi_cls_conn refcount helpers + +From: Mike Christie + +[ Upstream commit b1d19e8c92cfb0ded180ef3376c20e130414e067 ] + +There are a couple places where we could free the iscsi_cls_conn while it's +still in use. This adds some helpers to get/put a refcount on the struct +and converts an exiting user. Subsequent commits will then use the helpers +to fix 2 bugs in the eh code. + +Link: https://lore.kernel.org/r/20210525181821.7617-11-michael.christie@oracle.com +Reviewed-by: Lee Duncan +Signed-off-by: Mike Christie +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/libiscsi.c | 7 ++----- + drivers/scsi/scsi_transport_iscsi.c | 12 ++++++++++++ + include/scsi/scsi_transport_iscsi.h | 2 ++ + 3 files changed, 16 insertions(+), 5 deletions(-) + +diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c +index 2aaf83678654..ab39d7f65bbb 100644 +--- a/drivers/scsi/libiscsi.c ++++ b/drivers/scsi/libiscsi.c +@@ -1361,7 +1361,6 @@ void iscsi_session_failure(struct iscsi_session *session, + enum iscsi_err err) + { + struct iscsi_conn *conn; +- struct device *dev; + + spin_lock_bh(&session->frwd_lock); + conn = session->leadconn; +@@ -1370,10 +1369,8 @@ void iscsi_session_failure(struct iscsi_session *session, + return; + } + +- dev = get_device(&conn->cls_conn->dev); ++ iscsi_get_conn(conn->cls_conn); + spin_unlock_bh(&session->frwd_lock); +- if (!dev) +- return; + /* + * if the host is being removed bypass the connection + * recovery initialization because we are going to kill +@@ -1383,7 +1380,7 @@ void iscsi_session_failure(struct iscsi_session *session, + iscsi_conn_error_event(conn->cls_conn, err); + else + iscsi_conn_failure(conn, err); +- put_device(dev); ++ iscsi_put_conn(conn->cls_conn); + } + EXPORT_SYMBOL_GPL(iscsi_session_failure); + +diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c +index 6ce1cc992d1d..b07105ae7c91 100644 +--- a/drivers/scsi/scsi_transport_iscsi.c ++++ b/drivers/scsi/scsi_transport_iscsi.c +@@ -2459,6 +2459,18 @@ int iscsi_destroy_conn(struct iscsi_cls_conn *conn) + } + EXPORT_SYMBOL_GPL(iscsi_destroy_conn); + ++void iscsi_put_conn(struct iscsi_cls_conn *conn) ++{ ++ put_device(&conn->dev); ++} ++EXPORT_SYMBOL_GPL(iscsi_put_conn); ++ ++void iscsi_get_conn(struct iscsi_cls_conn *conn) ++{ ++ get_device(&conn->dev); ++} ++EXPORT_SYMBOL_GPL(iscsi_get_conn); ++ + /* + * iscsi interface functions + */ +diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h +index 3974329d4d02..c5d7810fd792 100644 +--- a/include/scsi/scsi_transport_iscsi.h ++++ b/include/scsi/scsi_transport_iscsi.h +@@ -443,6 +443,8 @@ extern void iscsi_remove_session(struct iscsi_cls_session *session); + extern void iscsi_free_session(struct iscsi_cls_session *session); + extern struct iscsi_cls_conn *iscsi_create_conn(struct iscsi_cls_session *sess, + int dd_size, uint32_t cid); ++extern void iscsi_put_conn(struct iscsi_cls_conn *conn); ++extern void iscsi_get_conn(struct iscsi_cls_conn *conn); + extern int iscsi_destroy_conn(struct iscsi_cls_conn *conn); + extern void iscsi_unblock_session(struct iscsi_cls_session *session); + extern void iscsi_block_session(struct iscsi_cls_session *session); +-- +2.30.2 + diff --git a/queue-5.13/scsi-iscsi-fix-conn-use-after-free-during-resets.patch b/queue-5.13/scsi-iscsi-fix-conn-use-after-free-during-resets.patch new file mode 100644 index 00000000000..36c28d9d255 --- /dev/null +++ b/queue-5.13/scsi-iscsi-fix-conn-use-after-free-during-resets.patch @@ -0,0 +1,412 @@ +From 94436bc9f5727561afdcd9bcd8acafbd51bd5bc0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 25 May 2021 13:18:06 -0500 +Subject: scsi: iscsi: Fix conn use after free during resets + +From: Mike Christie + +[ Upstream commit ec29d0ac29be366450a7faffbcf8cba3a6a3b506 ] + +If we haven't done a unbind target call we can race where +iscsi_conn_teardown wakes up the EH thread and then frees the conn while +those threads are still accessing the conn ehwait. + +We can only do one TMF per session so this just moves the TMF fields from +the conn to the session. We can then rely on the +iscsi_session_teardown->iscsi_remove_session->__iscsi_unbind_session call +to remove the target and it's devices, and know after that point there is +no device or scsi-ml callout trying to access the session. + +Link: https://lore.kernel.org/r/20210525181821.7617-14-michael.christie@oracle.com +Reviewed-by: Lee Duncan +Signed-off-by: Mike Christie +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/libiscsi.c | 115 +++++++++++++++++++--------------------- + include/scsi/libiscsi.h | 11 ++-- + 2 files changed, 60 insertions(+), 66 deletions(-) + +diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c +index ab39d7f65bbb..dfe906307e55 100644 +--- a/drivers/scsi/libiscsi.c ++++ b/drivers/scsi/libiscsi.c +@@ -230,11 +230,11 @@ static int iscsi_prep_ecdb_ahs(struct iscsi_task *task) + */ + static int iscsi_check_tmf_restrictions(struct iscsi_task *task, int opcode) + { +- struct iscsi_conn *conn = task->conn; +- struct iscsi_tm *tmf = &conn->tmhdr; ++ struct iscsi_session *session = task->conn->session; ++ struct iscsi_tm *tmf = &session->tmhdr; + u64 hdr_lun; + +- if (conn->tmf_state == TMF_INITIAL) ++ if (session->tmf_state == TMF_INITIAL) + return 0; + + if ((tmf->opcode & ISCSI_OPCODE_MASK) != ISCSI_OP_SCSI_TMFUNC) +@@ -254,24 +254,19 @@ static int iscsi_check_tmf_restrictions(struct iscsi_task *task, int opcode) + * Fail all SCSI cmd PDUs + */ + if (opcode != ISCSI_OP_SCSI_DATA_OUT) { +- iscsi_conn_printk(KERN_INFO, conn, +- "task [op %x itt " +- "0x%x/0x%x] " +- "rejected.\n", +- opcode, task->itt, +- task->hdr_itt); ++ iscsi_session_printk(KERN_INFO, session, ++ "task [op %x itt 0x%x/0x%x] rejected.\n", ++ opcode, task->itt, task->hdr_itt); + return -EACCES; + } + /* + * And also all data-out PDUs in response to R2T + * if fast_abort is set. + */ +- if (conn->session->fast_abort) { +- iscsi_conn_printk(KERN_INFO, conn, +- "task [op %x itt " +- "0x%x/0x%x] fast abort.\n", +- opcode, task->itt, +- task->hdr_itt); ++ if (session->fast_abort) { ++ iscsi_session_printk(KERN_INFO, session, ++ "task [op %x itt 0x%x/0x%x] fast abort.\n", ++ opcode, task->itt, task->hdr_itt); + return -EACCES; + } + break; +@@ -284,7 +279,7 @@ static int iscsi_check_tmf_restrictions(struct iscsi_task *task, int opcode) + */ + if (opcode == ISCSI_OP_SCSI_DATA_OUT && + task->hdr_itt == tmf->rtt) { +- ISCSI_DBG_SESSION(conn->session, ++ ISCSI_DBG_SESSION(session, + "Preventing task %x/%x from sending " + "data-out due to abort task in " + "progress\n", task->itt, +@@ -936,20 +931,21 @@ iscsi_data_in_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr, + static void iscsi_tmf_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr) + { + struct iscsi_tm_rsp *tmf = (struct iscsi_tm_rsp *)hdr; ++ struct iscsi_session *session = conn->session; + + conn->exp_statsn = be32_to_cpu(hdr->statsn) + 1; + conn->tmfrsp_pdus_cnt++; + +- if (conn->tmf_state != TMF_QUEUED) ++ if (session->tmf_state != TMF_QUEUED) + return; + + if (tmf->response == ISCSI_TMF_RSP_COMPLETE) +- conn->tmf_state = TMF_SUCCESS; ++ session->tmf_state = TMF_SUCCESS; + else if (tmf->response == ISCSI_TMF_RSP_NO_TASK) +- conn->tmf_state = TMF_NOT_FOUND; ++ session->tmf_state = TMF_NOT_FOUND; + else +- conn->tmf_state = TMF_FAILED; +- wake_up(&conn->ehwait); ++ session->tmf_state = TMF_FAILED; ++ wake_up(&session->ehwait); + } + + static int iscsi_send_nopout(struct iscsi_conn *conn, struct iscsi_nopin *rhdr) +@@ -1826,15 +1822,14 @@ EXPORT_SYMBOL_GPL(iscsi_target_alloc); + + static void iscsi_tmf_timedout(struct timer_list *t) + { +- struct iscsi_conn *conn = from_timer(conn, t, tmf_timer); +- struct iscsi_session *session = conn->session; ++ struct iscsi_session *session = from_timer(session, t, tmf_timer); + + spin_lock(&session->frwd_lock); +- if (conn->tmf_state == TMF_QUEUED) { +- conn->tmf_state = TMF_TIMEDOUT; ++ if (session->tmf_state == TMF_QUEUED) { ++ session->tmf_state = TMF_TIMEDOUT; + ISCSI_DBG_EH(session, "tmf timedout\n"); + /* unblock eh_abort() */ +- wake_up(&conn->ehwait); ++ wake_up(&session->ehwait); + } + spin_unlock(&session->frwd_lock); + } +@@ -1857,8 +1852,8 @@ static int iscsi_exec_task_mgmt_fn(struct iscsi_conn *conn, + return -EPERM; + } + conn->tmfcmd_pdus_cnt++; +- conn->tmf_timer.expires = timeout * HZ + jiffies; +- add_timer(&conn->tmf_timer); ++ session->tmf_timer.expires = timeout * HZ + jiffies; ++ add_timer(&session->tmf_timer); + ISCSI_DBG_EH(session, "tmf set timeout\n"); + + spin_unlock_bh(&session->frwd_lock); +@@ -1872,12 +1867,12 @@ static int iscsi_exec_task_mgmt_fn(struct iscsi_conn *conn, + * 3) session is terminated or restarted or userspace has + * given up on recovery + */ +- wait_event_interruptible(conn->ehwait, age != session->age || ++ wait_event_interruptible(session->ehwait, age != session->age || + session->state != ISCSI_STATE_LOGGED_IN || +- conn->tmf_state != TMF_QUEUED); ++ session->tmf_state != TMF_QUEUED); + if (signal_pending(current)) + flush_signals(current); +- del_timer_sync(&conn->tmf_timer); ++ del_timer_sync(&session->tmf_timer); + + mutex_lock(&session->eh_mutex); + spin_lock_bh(&session->frwd_lock); +@@ -2309,17 +2304,17 @@ int iscsi_eh_abort(struct scsi_cmnd *sc) + } + + /* only have one tmf outstanding at a time */ +- if (conn->tmf_state != TMF_INITIAL) ++ if (session->tmf_state != TMF_INITIAL) + goto failed; +- conn->tmf_state = TMF_QUEUED; ++ session->tmf_state = TMF_QUEUED; + +- hdr = &conn->tmhdr; ++ hdr = &session->tmhdr; + iscsi_prep_abort_task_pdu(task, hdr); + + if (iscsi_exec_task_mgmt_fn(conn, hdr, age, session->abort_timeout)) + goto failed; + +- switch (conn->tmf_state) { ++ switch (session->tmf_state) { + case TMF_SUCCESS: + spin_unlock_bh(&session->frwd_lock); + /* +@@ -2334,7 +2329,7 @@ int iscsi_eh_abort(struct scsi_cmnd *sc) + */ + spin_lock_bh(&session->frwd_lock); + fail_scsi_task(task, DID_ABORT); +- conn->tmf_state = TMF_INITIAL; ++ session->tmf_state = TMF_INITIAL; + memset(hdr, 0, sizeof(*hdr)); + spin_unlock_bh(&session->frwd_lock); + iscsi_start_tx(conn); +@@ -2345,7 +2340,7 @@ int iscsi_eh_abort(struct scsi_cmnd *sc) + goto failed_unlocked; + case TMF_NOT_FOUND: + if (!sc->SCp.ptr) { +- conn->tmf_state = TMF_INITIAL; ++ session->tmf_state = TMF_INITIAL; + memset(hdr, 0, sizeof(*hdr)); + /* task completed before tmf abort response */ + ISCSI_DBG_EH(session, "sc completed while abort in " +@@ -2354,7 +2349,7 @@ int iscsi_eh_abort(struct scsi_cmnd *sc) + } + fallthrough; + default: +- conn->tmf_state = TMF_INITIAL; ++ session->tmf_state = TMF_INITIAL; + goto failed; + } + +@@ -2413,11 +2408,11 @@ int iscsi_eh_device_reset(struct scsi_cmnd *sc) + conn = session->leadconn; + + /* only have one tmf outstanding at a time */ +- if (conn->tmf_state != TMF_INITIAL) ++ if (session->tmf_state != TMF_INITIAL) + goto unlock; +- conn->tmf_state = TMF_QUEUED; ++ session->tmf_state = TMF_QUEUED; + +- hdr = &conn->tmhdr; ++ hdr = &session->tmhdr; + iscsi_prep_lun_reset_pdu(sc, hdr); + + if (iscsi_exec_task_mgmt_fn(conn, hdr, session->age, +@@ -2426,7 +2421,7 @@ int iscsi_eh_device_reset(struct scsi_cmnd *sc) + goto unlock; + } + +- switch (conn->tmf_state) { ++ switch (session->tmf_state) { + case TMF_SUCCESS: + break; + case TMF_TIMEDOUT: +@@ -2434,7 +2429,7 @@ int iscsi_eh_device_reset(struct scsi_cmnd *sc) + iscsi_conn_failure(conn, ISCSI_ERR_SCSI_EH_SESSION_RST); + goto done; + default: +- conn->tmf_state = TMF_INITIAL; ++ session->tmf_state = TMF_INITIAL; + goto unlock; + } + +@@ -2446,7 +2441,7 @@ int iscsi_eh_device_reset(struct scsi_cmnd *sc) + spin_lock_bh(&session->frwd_lock); + memset(hdr, 0, sizeof(*hdr)); + fail_scsi_tasks(conn, sc->device->lun, DID_ERROR); +- conn->tmf_state = TMF_INITIAL; ++ session->tmf_state = TMF_INITIAL; + spin_unlock_bh(&session->frwd_lock); + + iscsi_start_tx(conn); +@@ -2469,8 +2464,7 @@ void iscsi_session_recovery_timedout(struct iscsi_cls_session *cls_session) + spin_lock_bh(&session->frwd_lock); + if (session->state != ISCSI_STATE_LOGGED_IN) { + session->state = ISCSI_STATE_RECOVERY_FAILED; +- if (session->leadconn) +- wake_up(&session->leadconn->ehwait); ++ wake_up(&session->ehwait); + } + spin_unlock_bh(&session->frwd_lock); + } +@@ -2515,7 +2509,7 @@ failed: + iscsi_conn_failure(conn, ISCSI_ERR_SCSI_EH_SESSION_RST); + + ISCSI_DBG_EH(session, "wait for relogin\n"); +- wait_event_interruptible(conn->ehwait, ++ wait_event_interruptible(session->ehwait, + session->state == ISCSI_STATE_TERMINATE || + session->state == ISCSI_STATE_LOGGED_IN || + session->state == ISCSI_STATE_RECOVERY_FAILED); +@@ -2576,11 +2570,11 @@ static int iscsi_eh_target_reset(struct scsi_cmnd *sc) + conn = session->leadconn; + + /* only have one tmf outstanding at a time */ +- if (conn->tmf_state != TMF_INITIAL) ++ if (session->tmf_state != TMF_INITIAL) + goto unlock; +- conn->tmf_state = TMF_QUEUED; ++ session->tmf_state = TMF_QUEUED; + +- hdr = &conn->tmhdr; ++ hdr = &session->tmhdr; + iscsi_prep_tgt_reset_pdu(sc, hdr); + + if (iscsi_exec_task_mgmt_fn(conn, hdr, session->age, +@@ -2589,7 +2583,7 @@ static int iscsi_eh_target_reset(struct scsi_cmnd *sc) + goto unlock; + } + +- switch (conn->tmf_state) { ++ switch (session->tmf_state) { + case TMF_SUCCESS: + break; + case TMF_TIMEDOUT: +@@ -2597,7 +2591,7 @@ static int iscsi_eh_target_reset(struct scsi_cmnd *sc) + iscsi_conn_failure(conn, ISCSI_ERR_SCSI_EH_SESSION_RST); + goto done; + default: +- conn->tmf_state = TMF_INITIAL; ++ session->tmf_state = TMF_INITIAL; + goto unlock; + } + +@@ -2609,7 +2603,7 @@ static int iscsi_eh_target_reset(struct scsi_cmnd *sc) + spin_lock_bh(&session->frwd_lock); + memset(hdr, 0, sizeof(*hdr)); + fail_scsi_tasks(conn, -1, DID_ERROR); +- conn->tmf_state = TMF_INITIAL; ++ session->tmf_state = TMF_INITIAL; + spin_unlock_bh(&session->frwd_lock); + + iscsi_start_tx(conn); +@@ -2939,7 +2933,10 @@ iscsi_session_setup(struct iscsi_transport *iscsit, struct Scsi_Host *shost, + session->tt = iscsit; + session->dd_data = cls_session->dd_data + sizeof(*session); + ++ session->tmf_state = TMF_INITIAL; ++ timer_setup(&session->tmf_timer, iscsi_tmf_timedout, 0); + mutex_init(&session->eh_mutex); ++ + spin_lock_init(&session->frwd_lock); + spin_lock_init(&session->back_lock); + +@@ -3043,7 +3040,6 @@ iscsi_conn_setup(struct iscsi_cls_session *cls_session, int dd_size, + conn->c_stage = ISCSI_CONN_INITIAL_STAGE; + conn->id = conn_idx; + conn->exp_statsn = 0; +- conn->tmf_state = TMF_INITIAL; + + timer_setup(&conn->transport_timer, iscsi_check_transport_timeouts, 0); + +@@ -3068,8 +3064,7 @@ iscsi_conn_setup(struct iscsi_cls_session *cls_session, int dd_size, + goto login_task_data_alloc_fail; + conn->login_task->data = conn->data = data; + +- timer_setup(&conn->tmf_timer, iscsi_tmf_timedout, 0); +- init_waitqueue_head(&conn->ehwait); ++ init_waitqueue_head(&session->ehwait); + + return cls_conn; + +@@ -3104,7 +3099,7 @@ void iscsi_conn_teardown(struct iscsi_cls_conn *cls_conn) + * leading connection? then give up on recovery. + */ + session->state = ISCSI_STATE_TERMINATE; +- wake_up(&conn->ehwait); ++ wake_up(&session->ehwait); + } + spin_unlock_bh(&session->frwd_lock); + +@@ -3179,7 +3174,7 @@ int iscsi_conn_start(struct iscsi_cls_conn *cls_conn) + * commands after successful recovery + */ + conn->stop_stage = 0; +- conn->tmf_state = TMF_INITIAL; ++ session->tmf_state = TMF_INITIAL; + session->age++; + if (session->age == 16) + session->age = 0; +@@ -3193,7 +3188,7 @@ int iscsi_conn_start(struct iscsi_cls_conn *cls_conn) + spin_unlock_bh(&session->frwd_lock); + + iscsi_unblock_session(session->cls_session); +- wake_up(&conn->ehwait); ++ wake_up(&session->ehwait); + return 0; + } + EXPORT_SYMBOL_GPL(iscsi_conn_start); +@@ -3287,7 +3282,7 @@ void iscsi_conn_stop(struct iscsi_cls_conn *cls_conn, int flag) + spin_lock_bh(&session->frwd_lock); + fail_scsi_tasks(conn, -1, DID_TRANSPORT_DISRUPTED); + fail_mgmt_tasks(session, conn); +- memset(&conn->tmhdr, 0, sizeof(conn->tmhdr)); ++ memset(&session->tmhdr, 0, sizeof(session->tmhdr)); + spin_unlock_bh(&session->frwd_lock); + mutex_unlock(&session->eh_mutex); + } +diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h +index 091f284bd6e9..2bb452a8f134 100644 +--- a/include/scsi/libiscsi.h ++++ b/include/scsi/libiscsi.h +@@ -195,12 +195,6 @@ struct iscsi_conn { + unsigned long suspend_tx; /* suspend Tx */ + unsigned long suspend_rx; /* suspend Rx */ + +- /* abort */ +- wait_queue_head_t ehwait; /* used in eh_abort() */ +- struct iscsi_tm tmhdr; +- struct timer_list tmf_timer; +- int tmf_state; /* see TMF_INITIAL, etc.*/ +- + /* negotiated params */ + unsigned max_recv_dlength; /* initiator_max_recv_dsl*/ + unsigned max_xmit_dlength; /* target_max_recv_dsl */ +@@ -270,6 +264,11 @@ struct iscsi_session { + * and recv lock. + */ + struct mutex eh_mutex; ++ /* abort */ ++ wait_queue_head_t ehwait; /* used in eh_abort() */ ++ struct iscsi_tm tmhdr; ++ struct timer_list tmf_timer; ++ int tmf_state; /* see TMF_INITIAL, etc.*/ + + /* iSCSI session-wide sequencing */ + uint32_t cmdsn; +-- +2.30.2 + diff --git a/queue-5.13/scsi-iscsi-fix-shost-max_id-use.patch b/queue-5.13/scsi-iscsi-fix-shost-max_id-use.patch new file mode 100644 index 00000000000..f545ff893e7 --- /dev/null +++ b/queue-5.13/scsi-iscsi-fix-shost-max_id-use.patch @@ -0,0 +1,100 @@ +From 413e41b3a1600834003f5d24cda8f58d310393d0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 25 May 2021 13:18:07 -0500 +Subject: scsi: iscsi: Fix shost->max_id use + +From: Mike Christie + +[ Upstream commit bdd4aad7ff92ae39c2e93c415bb6761cb8b584da ] + +The iscsi offload drivers are setting the shost->max_id to the max number +of sessions they support. The problem is that max_id is not the max number +of targets but the highest identifier the targets can have. To use it to +limit the number of targets we need to set it to max sessions - 1, or we +can end up with a session we might not have preallocated resources for. + +Link: https://lore.kernel.org/r/20210525181821.7617-15-michael.christie@oracle.com +Reviewed-by: Lee Duncan +Signed-off-by: Mike Christie +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/be2iscsi/be_main.c | 4 ++-- + drivers/scsi/bnx2i/bnx2i_iscsi.c | 2 +- + drivers/scsi/cxgbi/libcxgbi.c | 4 ++-- + drivers/scsi/qedi/qedi_main.c | 2 +- + 4 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c +index 27c4f1598f76..d941e1561527 100644 +--- a/drivers/scsi/be2iscsi/be_main.c ++++ b/drivers/scsi/be2iscsi/be_main.c +@@ -416,7 +416,7 @@ static struct beiscsi_hba *beiscsi_hba_alloc(struct pci_dev *pcidev) + "beiscsi_hba_alloc - iscsi_host_alloc failed\n"); + return NULL; + } +- shost->max_id = BE2_MAX_SESSIONS; ++ shost->max_id = BE2_MAX_SESSIONS - 1; + shost->max_channel = 0; + shost->max_cmd_len = BEISCSI_MAX_CMD_LEN; + shost->max_lun = BEISCSI_NUM_MAX_LUN; +@@ -5318,7 +5318,7 @@ static int beiscsi_enable_port(struct beiscsi_hba *phba) + /* Re-enable UER. If different TPE occurs then it is recoverable. */ + beiscsi_set_uer_feature(phba); + +- phba->shost->max_id = phba->params.cxns_per_ctrl; ++ phba->shost->max_id = phba->params.cxns_per_ctrl - 1; + phba->shost->can_queue = phba->params.ios_per_ctrl; + ret = beiscsi_init_port(phba); + if (ret < 0) { +diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c +index 2ad85c6b99fd..8cf2f9a7cfdc 100644 +--- a/drivers/scsi/bnx2i/bnx2i_iscsi.c ++++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c +@@ -791,7 +791,7 @@ struct bnx2i_hba *bnx2i_alloc_hba(struct cnic_dev *cnic) + return NULL; + shost->dma_boundary = cnic->pcidev->dma_mask; + shost->transportt = bnx2i_scsi_xport_template; +- shost->max_id = ISCSI_MAX_CONNS_PER_HBA; ++ shost->max_id = ISCSI_MAX_CONNS_PER_HBA - 1; + shost->max_channel = 0; + shost->max_lun = 512; + shost->max_cmd_len = 16; +diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c +index f6bcae829c29..506b561670af 100644 +--- a/drivers/scsi/cxgbi/libcxgbi.c ++++ b/drivers/scsi/cxgbi/libcxgbi.c +@@ -337,7 +337,7 @@ void cxgbi_hbas_remove(struct cxgbi_device *cdev) + EXPORT_SYMBOL_GPL(cxgbi_hbas_remove); + + int cxgbi_hbas_add(struct cxgbi_device *cdev, u64 max_lun, +- unsigned int max_id, struct scsi_host_template *sht, ++ unsigned int max_conns, struct scsi_host_template *sht, + struct scsi_transport_template *stt) + { + struct cxgbi_hba *chba; +@@ -357,7 +357,7 @@ int cxgbi_hbas_add(struct cxgbi_device *cdev, u64 max_lun, + + shost->transportt = stt; + shost->max_lun = max_lun; +- shost->max_id = max_id; ++ shost->max_id = max_conns - 1; + shost->max_channel = 0; + shost->max_cmd_len = SCSI_MAX_VARLEN_CDB_SIZE; + +diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c +index 2455d1448a7e..edf915432704 100644 +--- a/drivers/scsi/qedi/qedi_main.c ++++ b/drivers/scsi/qedi/qedi_main.c +@@ -640,7 +640,7 @@ static struct qedi_ctx *qedi_host_alloc(struct pci_dev *pdev) + goto exit_setup_shost; + } + +- shost->max_id = QEDI_MAX_ISCSI_CONNS_PER_HBA; ++ shost->max_id = QEDI_MAX_ISCSI_CONNS_PER_HBA - 1; + shost->max_channel = 0; + shost->max_lun = ~0; + shost->max_cmd_len = 16; +-- +2.30.2 + diff --git a/queue-5.13/scsi-lpfc-fix-crash-when-lpfc_sli4_hba_setup-fails-t.patch b/queue-5.13/scsi-lpfc-fix-crash-when-lpfc_sli4_hba_setup-fails-t.patch new file mode 100644 index 00000000000..d0b52bc68a0 --- /dev/null +++ b/queue-5.13/scsi-lpfc-fix-crash-when-lpfc_sli4_hba_setup-fails-t.patch @@ -0,0 +1,55 @@ +From 6145e7900a9776f2a03c848fd52c0c46f7f6d4d9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 14 May 2021 12:55:56 -0700 +Subject: scsi: lpfc: Fix crash when lpfc_sli4_hba_setup() fails to initialize + the SGLs + +From: James Smart + +[ Upstream commit 5aa615d195f1e142c662cb2253f057c9baec7531 ] + +The driver is encountering a crash in lpfc_free_iocb_list() while +performing initial attachment. + +Code review found this to be an errant failure path that was taken, jumping +to a tag that then referenced structures that were uninitialized. + +Fix the failure path. + +Link: https://lore.kernel.org/r/20210514195559.119853-9-jsmart2021@gmail.com +Co-developed-by: Justin Tee +Signed-off-by: Justin Tee +Signed-off-by: James Smart +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/lpfc/lpfc_sli.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c +index bc0bcb0dccc9..9ed826fd53e8 100644 +--- a/drivers/scsi/lpfc/lpfc_sli.c ++++ b/drivers/scsi/lpfc/lpfc_sli.c +@@ -7959,7 +7959,7 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba) + "0393 Error %d during rpi post operation\n", + rc); + rc = -ENODEV; +- goto out_destroy_queue; ++ goto out_free_iocblist; + } + lpfc_sli4_node_prep(phba); + +@@ -8125,8 +8125,9 @@ out_io_buff_free: + out_unset_queue: + /* Unset all the queues set up in this routine when error out */ + lpfc_sli4_queue_unset(phba); +-out_destroy_queue: ++out_free_iocblist: + lpfc_free_iocb_list(phba); ++out_destroy_queue: + lpfc_sli4_queue_destroy(phba); + out_stop_timers: + lpfc_stop_hba_timers(phba); +-- +2.30.2 + diff --git a/queue-5.13/scsi-lpfc-fix-unexpected-timeout-error-in-direct-att.patch b/queue-5.13/scsi-lpfc-fix-unexpected-timeout-error-in-direct-att.patch new file mode 100644 index 00000000000..f85cc01facc --- /dev/null +++ b/queue-5.13/scsi-lpfc-fix-unexpected-timeout-error-in-direct-att.patch @@ -0,0 +1,53 @@ +From 4c88cbdc1c67f01cd8bd292e4ac8e40549760dd7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 14 May 2021 12:55:51 -0700 +Subject: scsi: lpfc: Fix "Unexpected timeout" error in direct attach topology + +From: James Smart + +[ Upstream commit e30d55137edef47434c40d7570276a0846fe922c ] + +An 'unexpected timeout' message may be seen in a point-2-point topology. +The message occurs when a PLOGI is received before the driver is notified +of FLOGI completion. The FLOGI completion failure causes discovery to be +triggered for a second time. The discovery timer is restarted but no new +discovery activity is initiated, thus the timeout message eventually +appears. + +In point-2-point, when discovery has progressed before the FLOGI completion +is processed, it is not a failure. Add code to FLOGI completion to detect +that discovery has progressed and exit the FLOGI handling (noop'ing it). + +Link: https://lore.kernel.org/r/20210514195559.119853-4-jsmart2021@gmail.com +Co-developed-by: Justin Tee +Signed-off-by: Justin Tee +Signed-off-by: James Smart +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/lpfc/lpfc_els.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c +index c3ca2ccf9f82..933927f738c7 100644 +--- a/drivers/scsi/lpfc/lpfc_els.c ++++ b/drivers/scsi/lpfc/lpfc_els.c +@@ -1175,6 +1175,15 @@ stop_rr_fcf_flogi: + phba->fcf.fcf_redisc_attempted = 0; /* reset */ + goto out; + } ++ } else if (vport->port_state > LPFC_FLOGI && ++ vport->fc_flag & FC_PT2PT) { ++ /* ++ * In a p2p topology, it is possible that discovery has ++ * already progressed, and this completion can be ignored. ++ * Recheck the indicated topology. ++ */ ++ if (!sp->cmn.fPort) ++ goto out; + } + + flogifail: +-- +2.30.2 + diff --git a/queue-5.13/scsi-megaraid_sas-early-detection-of-vd-deletion-thr.patch b/queue-5.13/scsi-megaraid_sas-early-detection-of-vd-deletion-thr.patch new file mode 100644 index 00000000000..3764099d34f --- /dev/null +++ b/queue-5.13/scsi-megaraid_sas-early-detection-of-vd-deletion-thr.patch @@ -0,0 +1,270 @@ +From 771e81157a2a6dcd513846307674b107f6dc7a8f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 28 May 2021 18:43:05 +0530 +Subject: scsi: megaraid_sas: Early detection of VD deletion through RaidMap + update + +From: Kashyap Desai + +[ Upstream commit ae6874ba4b43c5a00065f48599811a09d33b873d ] + +Consider the case where a VD is deleted and the targetID of that VD is +assigned to a newly created VD. If the sequence of deletion/addition of VD +happens very quickly there is a possibility that second event (VD add) +occurs even before the driver processes the first event (VD delete). As +event processing is done in deferred context the device list remains the +same (but targetID is re-used) so driver will not learn the VD +deletion/additon. I/Os meant for the older VD will be directed to new VD +which may lead to data corruption. + +Make driver detect the deleted VD as soon as possible based on the RaidMap +update and block further I/O to that device. + +Link: https://lore.kernel.org/r/20210528131307.25683-4-chandrakanth.patil@broadcom.com +Reported-by: kernel test robot +Signed-off-by: Kashyap Desai +Signed-off-by: Chandrakanth Patil +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/megaraid/megaraid_sas.h | 12 ++++ + drivers/scsi/megaraid/megaraid_sas_base.c | 83 ++++++++++++++++++++--- + drivers/scsi/megaraid/megaraid_sas_fp.c | 6 +- + 3 files changed, 92 insertions(+), 9 deletions(-) + +diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h +index b5a765b73c76..a43b67299b08 100644 +--- a/drivers/scsi/megaraid/megaraid_sas.h ++++ b/drivers/scsi/megaraid/megaraid_sas.h +@@ -2262,6 +2262,15 @@ enum MR_PERF_MODE { + (mode) == MR_LATENCY_PERF_MODE ? "Latency" : \ + "Unknown") + ++enum MEGASAS_LD_TARGET_ID_STATUS { ++ LD_TARGET_ID_INITIAL, ++ LD_TARGET_ID_ACTIVE, ++ LD_TARGET_ID_DELETED, ++}; ++ ++#define MEGASAS_TARGET_ID(sdev) \ ++ (((sdev->channel % 2) * MEGASAS_MAX_DEV_PER_CHANNEL) + sdev->id) ++ + struct megasas_instance { + + unsigned int *reply_map; +@@ -2326,6 +2335,9 @@ struct megasas_instance { + struct megasas_pd_list pd_list[MEGASAS_MAX_PD]; + struct megasas_pd_list local_pd_list[MEGASAS_MAX_PD]; + u8 ld_ids[MEGASAS_MAX_LD_IDS]; ++ u8 ld_tgtid_status[MEGASAS_MAX_LD_IDS]; ++ u8 ld_ids_prev[MEGASAS_MAX_LD_IDS]; ++ u8 ld_ids_from_raidmap[MEGASAS_MAX_LD_IDS]; + s8 init_id; + + u16 max_num_sge; +diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c +index e4004d3353b8..3fecf4b2b0bd 100644 +--- a/drivers/scsi/megaraid/megaraid_sas_base.c ++++ b/drivers/scsi/megaraid/megaraid_sas_base.c +@@ -141,6 +141,8 @@ static int megasas_register_aen(struct megasas_instance *instance, + u32 seq_num, u32 class_locale_word); + static void megasas_get_pd_info(struct megasas_instance *instance, + struct scsi_device *sdev); ++static void ++megasas_set_ld_removed_by_fw(struct megasas_instance *instance); + + /* + * PCI ID table for all supported controllers +@@ -436,6 +438,12 @@ megasas_decode_evt(struct megasas_instance *instance) + (class_locale.members.locale), + format_class(class_locale.members.class), + evt_detail->description); ++ ++ if (megasas_dbg_lvl & LD_PD_DEBUG) ++ dev_info(&instance->pdev->dev, ++ "evt_detail.args.ld.target_id/index %d/%d\n", ++ evt_detail->args.ld.target_id, evt_detail->args.ld.ld_index); ++ + } + + /* +@@ -1779,6 +1787,7 @@ megasas_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scmd) + { + struct megasas_instance *instance; + struct MR_PRIV_DEVICE *mr_device_priv_data; ++ u32 ld_tgt_id; + + instance = (struct megasas_instance *) + scmd->device->host->hostdata; +@@ -1805,17 +1814,21 @@ megasas_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scmd) + } + } + +- if (atomic_read(&instance->adprecovery) == MEGASAS_HW_CRITICAL_ERROR) { ++ mr_device_priv_data = scmd->device->hostdata; ++ if (!mr_device_priv_data || ++ (atomic_read(&instance->adprecovery) == MEGASAS_HW_CRITICAL_ERROR)) { + scmd->result = DID_NO_CONNECT << 16; + scmd->scsi_done(scmd); + return 0; + } + +- mr_device_priv_data = scmd->device->hostdata; +- if (!mr_device_priv_data) { +- scmd->result = DID_NO_CONNECT << 16; +- scmd->scsi_done(scmd); +- return 0; ++ if (MEGASAS_IS_LOGICAL(scmd->device)) { ++ ld_tgt_id = MEGASAS_TARGET_ID(scmd->device); ++ if (instance->ld_tgtid_status[ld_tgt_id] == LD_TARGET_ID_DELETED) { ++ scmd->result = DID_NO_CONNECT << 16; ++ scmd->scsi_done(scmd); ++ return 0; ++ } + } + + if (atomic_read(&instance->adprecovery) != MEGASAS_HBA_OPERATIONAL) +@@ -2095,7 +2108,7 @@ static int megasas_slave_configure(struct scsi_device *sdev) + + static int megasas_slave_alloc(struct scsi_device *sdev) + { +- u16 pd_index = 0; ++ u16 pd_index = 0, ld_tgt_id; + struct megasas_instance *instance ; + struct MR_PRIV_DEVICE *mr_device_priv_data; + +@@ -2120,6 +2133,14 @@ scan_target: + GFP_KERNEL); + if (!mr_device_priv_data) + return -ENOMEM; ++ ++ if (MEGASAS_IS_LOGICAL(sdev)) { ++ ld_tgt_id = MEGASAS_TARGET_ID(sdev); ++ instance->ld_tgtid_status[ld_tgt_id] = LD_TARGET_ID_ACTIVE; ++ if (megasas_dbg_lvl & LD_PD_DEBUG) ++ sdev_printk(KERN_INFO, sdev, "LD target ID %d created.\n", ld_tgt_id); ++ } ++ + sdev->hostdata = mr_device_priv_data; + + atomic_set(&mr_device_priv_data->r1_ldio_hint, +@@ -2129,6 +2150,19 @@ scan_target: + + static void megasas_slave_destroy(struct scsi_device *sdev) + { ++ u16 ld_tgt_id; ++ struct megasas_instance *instance; ++ ++ instance = megasas_lookup_instance(sdev->host->host_no); ++ ++ if (MEGASAS_IS_LOGICAL(sdev)) { ++ ld_tgt_id = MEGASAS_TARGET_ID(sdev); ++ instance->ld_tgtid_status[ld_tgt_id] = LD_TARGET_ID_DELETED; ++ if (megasas_dbg_lvl & LD_PD_DEBUG) ++ sdev_printk(KERN_INFO, sdev, ++ "LD target ID %d removed from OS stack\n", ld_tgt_id); ++ } ++ + kfree(sdev->hostdata); + sdev->hostdata = NULL; + } +@@ -3525,6 +3559,22 @@ megasas_complete_abort(struct megasas_instance *instance, + } + } + ++static void ++megasas_set_ld_removed_by_fw(struct megasas_instance *instance) ++{ ++ uint i; ++ ++ for (i = 0; (i < MEGASAS_MAX_LD_IDS); i++) { ++ if (instance->ld_ids_prev[i] != 0xff && ++ instance->ld_ids_from_raidmap[i] == 0xff) { ++ if (megasas_dbg_lvl & LD_PD_DEBUG) ++ dev_info(&instance->pdev->dev, ++ "LD target ID %d removed from RAID map\n", i); ++ instance->ld_tgtid_status[i] = LD_TARGET_ID_DELETED; ++ } ++ } ++} ++ + /** + * megasas_complete_cmd - Completes a command + * @instance: Adapter soft state +@@ -3687,9 +3737,13 @@ megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd, + fusion->fast_path_io = 0; + } + ++ if (instance->adapter_type >= INVADER_SERIES) ++ megasas_set_ld_removed_by_fw(instance); ++ + megasas_sync_map_info(instance); + spin_unlock_irqrestore(instance->host->host_lock, + flags); ++ + break; + } + if (opcode == MR_DCMD_CTRL_EVENT_GET_INFO || +@@ -8831,8 +8885,10 @@ megasas_aen_polling(struct work_struct *work) + union megasas_evt_class_locale class_locale; + int event_type = 0; + u32 seq_num; ++ u16 ld_target_id; + int error; + u8 dcmd_ret = DCMD_SUCCESS; ++ struct scsi_device *sdev1; + + if (!instance) { + printk(KERN_ERR "invalid instance!\n"); +@@ -8855,12 +8911,23 @@ megasas_aen_polling(struct work_struct *work) + break; + + case MR_EVT_LD_OFFLINE: +- case MR_EVT_CFG_CLEARED: + case MR_EVT_LD_DELETED: ++ ld_target_id = instance->evt_detail->args.ld.target_id; ++ sdev1 = scsi_device_lookup(instance->host, ++ MEGASAS_MAX_PD_CHANNELS + ++ (ld_target_id / MEGASAS_MAX_DEV_PER_CHANNEL), ++ (ld_target_id - MEGASAS_MAX_DEV_PER_CHANNEL), ++ 0); ++ if (sdev1) ++ megasas_remove_scsi_device(sdev1); ++ ++ event_type = SCAN_VD_CHANNEL; ++ break; + case MR_EVT_LD_CREATED: + event_type = SCAN_VD_CHANNEL; + break; + ++ case MR_EVT_CFG_CLEARED: + case MR_EVT_CTRL_HOST_BUS_SCAN_REQUESTED: + case MR_EVT_FOREIGN_CFG_IMPORTED: + case MR_EVT_LD_STATE_CHANGE: +diff --git a/drivers/scsi/megaraid/megaraid_sas_fp.c b/drivers/scsi/megaraid/megaraid_sas_fp.c +index b6c08d620033..83f69c33b01a 100644 +--- a/drivers/scsi/megaraid/megaraid_sas_fp.c ++++ b/drivers/scsi/megaraid/megaraid_sas_fp.c +@@ -349,6 +349,10 @@ u8 MR_ValidateMapInfo(struct megasas_instance *instance, u64 map_id) + + num_lds = le16_to_cpu(drv_map->raidMap.ldCount); + ++ memcpy(instance->ld_ids_prev, ++ instance->ld_ids_from_raidmap, ++ sizeof(instance->ld_ids_from_raidmap)); ++ memset(instance->ld_ids_from_raidmap, 0xff, MEGASAS_MAX_LD_IDS); + /*Convert Raid capability values to CPU arch */ + for (i = 0; (num_lds > 0) && (i < MAX_LOGICAL_DRIVES_EXT); i++) { + ld = MR_TargetIdToLdGet(i, drv_map); +@@ -359,7 +363,7 @@ u8 MR_ValidateMapInfo(struct megasas_instance *instance, u64 map_id) + + raid = MR_LdRaidGet(ld, drv_map); + le32_to_cpus((u32 *)&raid->capability); +- ++ instance->ld_ids_from_raidmap[i] = i; + num_lds--; + } + +-- +2.30.2 + diff --git a/queue-5.13/scsi-megaraid_sas-fix-resource-leak-in-case-of-probe.patch b/queue-5.13/scsi-megaraid_sas-fix-resource-leak-in-case-of-probe.patch new file mode 100644 index 00000000000..3347eba003d --- /dev/null +++ b/queue-5.13/scsi-megaraid_sas-fix-resource-leak-in-case-of-probe.patch @@ -0,0 +1,78 @@ +From ed294bb8e92c1bb4d71eb48307b12f458f1297df Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 28 May 2021 18:43:04 +0530 +Subject: scsi: megaraid_sas: Fix resource leak in case of probe failure + +From: Chandrakanth Patil + +[ Upstream commit b5438f48fdd8e1c3f130d32637511efd32038152 ] + +The driver doesn't clean up all the allocated resources properly when +scsi_add_host(), megasas_start_aen() function fails during the PCI device +probe. + +Clean up all those resources. + +Link: https://lore.kernel.org/r/20210528131307.25683-3-chandrakanth.patil@broadcom.com +Signed-off-by: Chandrakanth Patil +Signed-off-by: Sumit Saxena +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/megaraid/megaraid_sas_base.c | 13 +++++++++++++ + drivers/scsi/megaraid/megaraid_sas_fusion.c | 1 + + 2 files changed, 14 insertions(+) + +diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c +index 4d4e9dbe5193..e4004d3353b8 100644 +--- a/drivers/scsi/megaraid/megaraid_sas_base.c ++++ b/drivers/scsi/megaraid/megaraid_sas_base.c +@@ -7545,11 +7545,16 @@ static int megasas_probe_one(struct pci_dev *pdev, + return 0; + + fail_start_aen: ++ instance->unload = 1; ++ scsi_remove_host(instance->host); + fail_io_attach: + megasas_mgmt_info.count--; + megasas_mgmt_info.max_index--; + megasas_mgmt_info.instance[megasas_mgmt_info.max_index] = NULL; + ++ if (instance->requestorId && !instance->skip_heartbeat_timer_del) ++ del_timer_sync(&instance->sriov_heartbeat_timer); ++ + instance->instancet->disable_intr(instance); + megasas_destroy_irqs(instance); + +@@ -7557,8 +7562,16 @@ fail_io_attach: + megasas_release_fusion(instance); + else + megasas_release_mfi(instance); ++ + if (instance->msix_vectors) + pci_free_irq_vectors(instance->pdev); ++ instance->msix_vectors = 0; ++ ++ if (instance->fw_crash_state != UNAVAILABLE) ++ megasas_free_host_crash_buffer(instance); ++ ++ if (instance->adapter_type != MFI_SERIES) ++ megasas_fusion_stop_watchdog(instance); + fail_init_mfi: + scsi_host_put(host); + fail_alloc_instance: +diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c +index cd94a0c81f83..f79c19010c92 100644 +--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c ++++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c +@@ -5272,6 +5272,7 @@ megasas_alloc_fusion_context(struct megasas_instance *instance) + if (!fusion->log_to_span) { + dev_err(&instance->pdev->dev, "Failed from %s %d\n", + __func__, __LINE__); ++ kfree(instance->ctrl_context); + return -ENOMEM; + } + } +-- +2.30.2 + diff --git a/queue-5.13/scsi-megaraid_sas-handle-missing-interrupts-while-re.patch b/queue-5.13/scsi-megaraid_sas-handle-missing-interrupts-while-re.patch new file mode 100644 index 00000000000..22ea13860e8 --- /dev/null +++ b/queue-5.13/scsi-megaraid_sas-handle-missing-interrupts-while-re.patch @@ -0,0 +1,76 @@ +From c1baa6ea63ef088fbb51c74ee082a05f49d024ef Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 28 May 2021 18:43:06 +0530 +Subject: scsi: megaraid_sas: Handle missing interrupts while re-enabling IRQs + +From: Chandrakanth Patil + +[ Upstream commit 9bedd36e9146b34dda4d6994e3aa1d72bc6442c1 ] + +While reenabling the IRQ after IRQ poll there may be a small window for the +firmware to post the replies with interrupts raised. In that case the +driver will not see the interrupts which leads to I/O timeout. + +This issue only happens when there are many I/O completions on a single +reply queue. This forces the driver to switch between the interrupt and IRQ +context. + +Make the driver process the reply queue one more time after enabling the +IRQ. + +Link: https://lore.kernel.org/linux-scsi/20201102072746.27410-1-sreekanth.reddy@broadcom.com/ +Link: https://lore.kernel.org/r/20210528131307.25683-5-chandrakanth.patil@broadcom.com +Cc: Tomas Henzl +Reported-by: kernel test robot +Signed-off-by: Chandrakanth Patil +Signed-off-by: Sumit Saxena +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/megaraid/megaraid_sas_fusion.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c +index f79c19010c92..142e60741094 100644 +--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c ++++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c +@@ -3745,6 +3745,7 @@ static void megasas_sync_irqs(unsigned long instance_addr) + if (irq_ctx->irq_poll_scheduled) { + irq_ctx->irq_poll_scheduled = false; + enable_irq(irq_ctx->os_irq); ++ complete_cmd_fusion(instance, irq_ctx->MSIxIndex, irq_ctx); + } + } + } +@@ -3776,6 +3777,7 @@ int megasas_irqpoll(struct irq_poll *irqpoll, int budget) + irq_poll_complete(irqpoll); + irq_ctx->irq_poll_scheduled = false; + enable_irq(irq_ctx->os_irq); ++ complete_cmd_fusion(instance, irq_ctx->MSIxIndex, irq_ctx); + } + + return num_entries; +@@ -3792,6 +3794,7 @@ megasas_complete_cmd_dpc_fusion(unsigned long instance_addr) + { + struct megasas_instance *instance = + (struct megasas_instance *)instance_addr; ++ struct megasas_irq_context *irq_ctx = NULL; + u32 count, MSIxIndex; + + count = instance->msix_vectors > 0 ? instance->msix_vectors : 1; +@@ -3800,8 +3803,10 @@ megasas_complete_cmd_dpc_fusion(unsigned long instance_addr) + if (atomic_read(&instance->adprecovery) == MEGASAS_HW_CRITICAL_ERROR) + return; + +- for (MSIxIndex = 0 ; MSIxIndex < count; MSIxIndex++) +- complete_cmd_fusion(instance, MSIxIndex, NULL); ++ for (MSIxIndex = 0 ; MSIxIndex < count; MSIxIndex++) { ++ irq_ctx = &instance->irq_context[MSIxIndex]; ++ complete_cmd_fusion(instance, MSIxIndex, irq_ctx); ++ } + } + + /** +-- +2.30.2 + diff --git a/queue-5.13/scsi-mpt3sas-fix-deadlock-while-cancelling-the-runni.patch b/queue-5.13/scsi-mpt3sas-fix-deadlock-while-cancelling-the-runni.patch new file mode 100644 index 00000000000..e766232b372 --- /dev/null +++ b/queue-5.13/scsi-mpt3sas-fix-deadlock-while-cancelling-the-runni.patch @@ -0,0 +1,59 @@ +From 87e13bed51473214dd34fe2632da5e62ba4f3f7b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 18 May 2021 10:46:23 +0530 +Subject: scsi: mpt3sas: Fix deadlock while cancelling the running firmware + event + +From: Suganath Prabu S + +[ Upstream commit e2fac6c44ae06e58ac02181b048af31195883c31 ] + +Do not cancel current running firmware event work if the event type is +different from MPT3SAS_REMOVE_UNRESPONDING_DEVICES. Otherwise a deadlock +can be observed while cancelling the current firmware event work if a hard +reset operation is called as part of processing the current event. + +Link: https://lore.kernel.org/r/20210518051625.1596742-2-suganath-prabu.subramani@broadcom.com +Signed-off-by: Suganath Prabu S +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/mpt3sas/mpt3sas_scsih.c | 22 ++++++++++++++++++++++ + 1 file changed, 22 insertions(+) + +diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c +index a5f70f0e0287..b48f10f7cf31 100644 +--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c ++++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c +@@ -3697,6 +3697,28 @@ _scsih_fw_event_cleanup_queue(struct MPT3SAS_ADAPTER *ioc) + ioc->fw_events_cleanup = 1; + while ((fw_event = dequeue_next_fw_event(ioc)) || + (fw_event = ioc->current_event)) { ++ ++ /* ++ * Don't call cancel_work_sync() for current_event ++ * other than MPT3SAS_REMOVE_UNRESPONDING_DEVICES; ++ * otherwise we may observe deadlock if current ++ * hard reset issued as part of processing the current_event. ++ * ++ * Orginal logic of cleaning the current_event is added ++ * for handling the back to back host reset issued by the user. ++ * i.e. during back to back host reset, driver use to process ++ * the two instances of MPT3SAS_REMOVE_UNRESPONDING_DEVICES ++ * event back to back and this made the drives to unregister ++ * the devices from SML. ++ */ ++ ++ if (fw_event == ioc->current_event && ++ ioc->current_event->event != ++ MPT3SAS_REMOVE_UNRESPONDING_DEVICES) { ++ ioc->current_event = NULL; ++ continue; ++ } ++ + /* + * Wait on the fw_event to complete. If this returns 1, then + * the event was never executed, and we need a put for the +-- +2.30.2 + diff --git a/queue-5.13/scsi-qedi-fix-cleanup-session-block-unblock-use.patch b/queue-5.13/scsi-qedi-fix-cleanup-session-block-unblock-use.patch new file mode 100644 index 00000000000..700e736efac --- /dev/null +++ b/queue-5.13/scsi-qedi-fix-cleanup-session-block-unblock-use.patch @@ -0,0 +1,78 @@ +From f8e2d7eb3021f37acce719f9a84e807883509d92 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 25 May 2021 13:18:18 -0500 +Subject: scsi: qedi: Fix cleanup session block/unblock use + +From: Mike Christie + +[ Upstream commit 0c72191da68638a479602dd515b587ada913184a ] + +Drivers shouldn't be calling block/unblock session for cmd cleanup because +the functions can change the session state from under libiscsi. This adds +a new a driver level bit so it can block all I/O the host while it drains +the card. + +Link: https://lore.kernel.org/r/20210525181821.7617-26-michael.christie@oracle.com +Reviewed-by: Manish Rangankar +Signed-off-by: Mike Christie +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/qedi/qedi.h | 1 + + drivers/scsi/qedi/qedi_iscsi.c | 17 +++++++++++++++-- + 2 files changed, 16 insertions(+), 2 deletions(-) + +diff --git a/drivers/scsi/qedi/qedi.h b/drivers/scsi/qedi/qedi.h +index c342defc3f52..ce199a7a16b8 100644 +--- a/drivers/scsi/qedi/qedi.h ++++ b/drivers/scsi/qedi/qedi.h +@@ -284,6 +284,7 @@ struct qedi_ctx { + #define QEDI_IN_RECOVERY 5 + #define QEDI_IN_OFFLINE 6 + #define QEDI_IN_SHUTDOWN 7 ++#define QEDI_BLOCK_IO 8 + + u8 mac[ETH_ALEN]; + u32 src_ip[4]; +diff --git a/drivers/scsi/qedi/qedi_iscsi.c b/drivers/scsi/qedi/qedi_iscsi.c +index 4acc12111330..5f7e62f19d83 100644 +--- a/drivers/scsi/qedi/qedi_iscsi.c ++++ b/drivers/scsi/qedi/qedi_iscsi.c +@@ -330,12 +330,22 @@ free_conn: + + void qedi_mark_device_missing(struct iscsi_cls_session *cls_session) + { +- iscsi_block_session(cls_session); ++ struct iscsi_session *session = cls_session->dd_data; ++ struct qedi_conn *qedi_conn = session->leadconn->dd_data; ++ ++ spin_lock_bh(&session->frwd_lock); ++ set_bit(QEDI_BLOCK_IO, &qedi_conn->qedi->flags); ++ spin_unlock_bh(&session->frwd_lock); + } + + void qedi_mark_device_available(struct iscsi_cls_session *cls_session) + { +- iscsi_unblock_session(cls_session); ++ struct iscsi_session *session = cls_session->dd_data; ++ struct qedi_conn *qedi_conn = session->leadconn->dd_data; ++ ++ spin_lock_bh(&session->frwd_lock); ++ clear_bit(QEDI_BLOCK_IO, &qedi_conn->qedi->flags); ++ spin_unlock_bh(&session->frwd_lock); + } + + static int qedi_bind_conn_to_iscsi_cid(struct qedi_ctx *qedi, +@@ -800,6 +810,9 @@ static int qedi_task_xmit(struct iscsi_task *task) + if (test_bit(QEDI_IN_SHUTDOWN, &qedi_conn->qedi->flags)) + return -ENODEV; + ++ if (test_bit(QEDI_BLOCK_IO, &qedi_conn->qedi->flags)) ++ return -EACCES; ++ + cmd->state = 0; + cmd->task = NULL; + cmd->use_slowpath = false; +-- +2.30.2 + diff --git a/queue-5.13/scsi-qedi-fix-null-ref-during-abort-handling.patch b/queue-5.13/scsi-qedi-fix-null-ref-during-abort-handling.patch new file mode 100644 index 00000000000..546b7ddfcad --- /dev/null +++ b/queue-5.13/scsi-qedi-fix-null-ref-during-abort-handling.patch @@ -0,0 +1,38 @@ +From 651d60f52b9c5d46cb42e8acb11942b4b5c547e1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 25 May 2021 13:18:12 -0500 +Subject: scsi: qedi: Fix null ref during abort handling + +From: Mike Christie + +[ Upstream commit 5777b7f0f03ce49372203b6521631f62f2810c8f ] + +If qedi_process_cmd_cleanup_resp finds the cmd it frees the work and sets +list_tmf_work to NULL, so qedi_tmf_work should check if list_tmf_work is +non-NULL when it wants to force cleanup. + +Link: https://lore.kernel.org/r/20210525181821.7617-20-michael.christie@oracle.com +Reviewed-by: Manish Rangankar +Signed-off-by: Mike Christie +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/qedi/qedi_fw.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/scsi/qedi/qedi_fw.c b/drivers/scsi/qedi/qedi_fw.c +index 440ddd2309f1..cf57b4e49700 100644 +--- a/drivers/scsi/qedi/qedi_fw.c ++++ b/drivers/scsi/qedi/qedi_fw.c +@@ -1453,7 +1453,7 @@ abort_ret: + + ldel_exit: + spin_lock_bh(&qedi_conn->tmf_work_lock); +- if (!qedi_cmd->list_tmf_work) { ++ if (qedi_cmd->list_tmf_work) { + list_del_init(&list_work->list); + qedi_cmd->list_tmf_work = NULL; + kfree(list_work); +-- +2.30.2 + diff --git a/queue-5.13/scsi-qedi-fix-race-during-abort-timeouts.patch b/queue-5.13/scsi-qedi-fix-race-during-abort-timeouts.patch new file mode 100644 index 00000000000..c810cd7ffca --- /dev/null +++ b/queue-5.13/scsi-qedi-fix-race-during-abort-timeouts.patch @@ -0,0 +1,193 @@ +From f986e2431bcc391c7e411c254e1a70ca83873b92 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 25 May 2021 13:18:13 -0500 +Subject: scsi: qedi: Fix race during abort timeouts + +From: Mike Christie + +[ Upstream commit 2ce002366a3fcc3f9616d4583194f65dde0ad253 ] + +If the SCSI cmd completes after qedi_tmf_work calls iscsi_itt_to_task then +the qedi qedi_cmd->task_id could be freed and used for another cmd. If we +then call qedi_iscsi_cleanup_task with that task_id we will be cleaning up +the wrong cmd. + +Wait to release the task_id until the last put has been done on the +iscsi_task. Because libiscsi grabs a ref to the task when sending the +abort, we know that for the non-abort timeout case that the task_id we are +referencing is for the cmd that was supposed to be aborted. + +A latter commit will fix the case where the abort times out while we are +running qedi_tmf_work. + +Link: https://lore.kernel.org/r/20210525181821.7617-21-michael.christie@oracle.com +Reviewed-by: Manish Rangankar +Signed-off-by: Mike Christie +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/qedi/qedi_fw.c | 15 --------------- + drivers/scsi/qedi/qedi_iscsi.c | 20 +++++++++++++++++--- + 2 files changed, 17 insertions(+), 18 deletions(-) + +diff --git a/drivers/scsi/qedi/qedi_fw.c b/drivers/scsi/qedi/qedi_fw.c +index cf57b4e49700..c12bb2dd5ff9 100644 +--- a/drivers/scsi/qedi/qedi_fw.c ++++ b/drivers/scsi/qedi/qedi_fw.c +@@ -73,7 +73,6 @@ static void qedi_process_logout_resp(struct qedi_ctx *qedi, + spin_unlock(&qedi_conn->list_lock); + + cmd->state = RESPONSE_RECEIVED; +- qedi_clear_task_idx(qedi, cmd->task_id); + __iscsi_complete_pdu(conn, (struct iscsi_hdr *)resp_hdr, NULL, 0); + + spin_unlock(&session->back_lock); +@@ -138,7 +137,6 @@ static void qedi_process_text_resp(struct qedi_ctx *qedi, + spin_unlock(&qedi_conn->list_lock); + + cmd->state = RESPONSE_RECEIVED; +- qedi_clear_task_idx(qedi, cmd->task_id); + + __iscsi_complete_pdu(conn, (struct iscsi_hdr *)resp_hdr_ptr, + qedi_conn->gen_pdu.resp_buf, +@@ -164,13 +162,11 @@ static void qedi_tmf_resp_work(struct work_struct *work) + iscsi_block_session(session->cls_session); + rval = qedi_cleanup_all_io(qedi, qedi_conn, qedi_cmd->task, true); + if (rval) { +- qedi_clear_task_idx(qedi, qedi_cmd->task_id); + iscsi_unblock_session(session->cls_session); + goto exit_tmf_resp; + } + + iscsi_unblock_session(session->cls_session); +- qedi_clear_task_idx(qedi, qedi_cmd->task_id); + + spin_lock(&session->back_lock); + __iscsi_complete_pdu(conn, (struct iscsi_hdr *)resp_hdr_ptr, NULL, 0); +@@ -245,8 +241,6 @@ static void qedi_process_tmf_resp(struct qedi_ctx *qedi, + goto unblock_sess; + } + +- qedi_clear_task_idx(qedi, qedi_cmd->task_id); +- + __iscsi_complete_pdu(conn, (struct iscsi_hdr *)resp_hdr_ptr, NULL, 0); + kfree(resp_hdr_ptr); + +@@ -314,7 +308,6 @@ static void qedi_process_login_resp(struct qedi_ctx *qedi, + "Freeing tid=0x%x for cid=0x%x\n", + cmd->task_id, qedi_conn->iscsi_conn_id); + cmd->state = RESPONSE_RECEIVED; +- qedi_clear_task_idx(qedi, cmd->task_id); + } + + static void qedi_get_rq_bdq_buf(struct qedi_ctx *qedi, +@@ -468,7 +461,6 @@ static int qedi_process_nopin_mesg(struct qedi_ctx *qedi, + } + + spin_unlock(&qedi_conn->list_lock); +- qedi_clear_task_idx(qedi, cmd->task_id); + } + + done: +@@ -673,7 +665,6 @@ static void qedi_scsi_completion(struct qedi_ctx *qedi, + if (qedi_io_tracing) + qedi_trace_io(qedi, task, cmd->task_id, QEDI_IO_TRACE_RSP); + +- qedi_clear_task_idx(qedi, cmd->task_id); + __iscsi_complete_pdu(conn, (struct iscsi_hdr *)hdr, + conn->data, datalen); + error: +@@ -730,7 +721,6 @@ static void qedi_process_nopin_local_cmpl(struct qedi_ctx *qedi, + cqe->itid, cmd->task_id); + + cmd->state = RESPONSE_RECEIVED; +- qedi_clear_task_idx(qedi, cmd->task_id); + + spin_lock_bh(&session->back_lock); + __iscsi_put_task(task); +@@ -748,7 +738,6 @@ static void qedi_process_cmd_cleanup_resp(struct qedi_ctx *qedi, + itt_t protoitt = 0; + int found = 0; + struct qedi_cmd *qedi_cmd = NULL; +- u32 rtid = 0; + u32 iscsi_cid; + struct qedi_conn *qedi_conn; + struct qedi_cmd *dbg_cmd; +@@ -779,7 +768,6 @@ static void qedi_process_cmd_cleanup_resp(struct qedi_ctx *qedi, + found = 1; + mtask = qedi_cmd->task; + tmf_hdr = (struct iscsi_tm *)mtask->hdr; +- rtid = work->rtid; + + list_del_init(&work->list); + kfree(work); +@@ -821,8 +809,6 @@ static void qedi_process_cmd_cleanup_resp(struct qedi_ctx *qedi, + if (qedi_cmd->state == CLEANUP_WAIT_FAILED) + qedi_cmd->state = CLEANUP_RECV; + +- qedi_clear_task_idx(qedi_conn->qedi, rtid); +- + spin_lock(&qedi_conn->list_lock); + if (likely(dbg_cmd->io_cmd_in_list)) { + dbg_cmd->io_cmd_in_list = false; +@@ -856,7 +842,6 @@ static void qedi_process_cmd_cleanup_resp(struct qedi_ctx *qedi, + QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_TID, + "Freeing tid=0x%x for cid=0x%x\n", + cqe->itid, qedi_conn->iscsi_conn_id); +- qedi_clear_task_idx(qedi_conn->qedi, cqe->itid); + + } else { + qedi_get_proto_itt(qedi, cqe->itid, &ptmp_itt); +diff --git a/drivers/scsi/qedi/qedi_iscsi.c b/drivers/scsi/qedi/qedi_iscsi.c +index 087c7ff28cd5..4acc12111330 100644 +--- a/drivers/scsi/qedi/qedi_iscsi.c ++++ b/drivers/scsi/qedi/qedi_iscsi.c +@@ -783,7 +783,6 @@ static int qedi_mtask_xmit(struct iscsi_conn *conn, struct iscsi_task *task) + } + + cmd->conn = conn->dd_data; +- cmd->scsi_cmd = NULL; + return qedi_iscsi_send_generic_request(task); + } + +@@ -794,6 +793,10 @@ static int qedi_task_xmit(struct iscsi_task *task) + struct qedi_cmd *cmd = task->dd_data; + struct scsi_cmnd *sc = task->sc; + ++ /* Clear now so in cleanup_task we know it didn't make it */ ++ cmd->scsi_cmd = NULL; ++ cmd->task_id = U16_MAX; ++ + if (test_bit(QEDI_IN_SHUTDOWN, &qedi_conn->qedi->flags)) + return -ENODEV; + +@@ -1394,13 +1397,24 @@ static umode_t qedi_attr_is_visible(int param_type, int param) + + static void qedi_cleanup_task(struct iscsi_task *task) + { +- if (!task->sc || task->state == ISCSI_TASK_PENDING) { ++ struct qedi_cmd *cmd; ++ ++ if (task->state == ISCSI_TASK_PENDING) { + QEDI_INFO(NULL, QEDI_LOG_IO, "Returning ref_cnt=%d\n", + refcount_read(&task->refcount)); + return; + } + +- qedi_iscsi_unmap_sg_list(task->dd_data); ++ if (task->sc) ++ qedi_iscsi_unmap_sg_list(task->dd_data); ++ ++ cmd = task->dd_data; ++ if (cmd->task_id != U16_MAX) ++ qedi_clear_task_idx(iscsi_host_priv(task->conn->session->host), ++ cmd->task_id); ++ ++ cmd->task_id = U16_MAX; ++ cmd->scsi_cmd = NULL; + } + + struct iscsi_transport qedi_iscsi_transport = { +-- +2.30.2 + diff --git a/queue-5.13/scsi-qedi-fix-tmf-session-block-unblock-use.patch b/queue-5.13/scsi-qedi-fix-tmf-session-block-unblock-use.patch new file mode 100644 index 00000000000..1595e0c1b2b --- /dev/null +++ b/queue-5.13/scsi-qedi-fix-tmf-session-block-unblock-use.patch @@ -0,0 +1,48 @@ +From cd2d2ca8f7a8eaff8cccee40f6dbe803cfe98bad Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 25 May 2021 13:18:17 -0500 +Subject: scsi: qedi: Fix TMF session block/unblock use + +From: Mike Christie + +[ Upstream commit 2819b4ae2873d50fd55292877b0231ec936c3b2e ] + +Drivers shouldn't be calling block/unblock session for tmf handling because +the functions can change the session state from under libiscsi. +iscsi_queuecommand's call to iscsi_prep_scsi_cmd_pdu-> +iscsi_check_tmf_restrictions will prevent new cmds from being sent to qedi +after we've started handling a TMF. So we don't need to try and block it in +the driver, and we can remove these block calls. + +Link: https://lore.kernel.org/r/20210525181821.7617-25-michael.christie@oracle.com +Reviewed-by: Manish Rangankar +Signed-off-by: Mike Christie +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/qedi/qedi_fw.c | 7 +------ + 1 file changed, 1 insertion(+), 6 deletions(-) + +diff --git a/drivers/scsi/qedi/qedi_fw.c b/drivers/scsi/qedi/qedi_fw.c +index c12bb2dd5ff9..4c87640e6a91 100644 +--- a/drivers/scsi/qedi/qedi_fw.c ++++ b/drivers/scsi/qedi/qedi_fw.c +@@ -159,14 +159,9 @@ static void qedi_tmf_resp_work(struct work_struct *work) + set_bit(QEDI_CONN_FW_CLEANUP, &qedi_conn->flags); + resp_hdr_ptr = (struct iscsi_tm_rsp *)qedi_cmd->tmf_resp_buf; + +- iscsi_block_session(session->cls_session); + rval = qedi_cleanup_all_io(qedi, qedi_conn, qedi_cmd->task, true); +- if (rval) { +- iscsi_unblock_session(session->cls_session); ++ if (rval) + goto exit_tmf_resp; +- } +- +- iscsi_unblock_session(session->cls_session); + + spin_lock(&session->back_lock); + __iscsi_complete_pdu(conn, (struct iscsi_hdr *)resp_hdr_ptr, NULL, 0); +-- +2.30.2 + diff --git a/queue-5.13/scsi-scsi_dh_alua-check-for-negative-result-value.patch b/queue-5.13/scsi-scsi_dh_alua-check-for-negative-result-value.patch new file mode 100644 index 00000000000..8e670dfc1ef --- /dev/null +++ b/queue-5.13/scsi-scsi_dh_alua-check-for-negative-result-value.patch @@ -0,0 +1,58 @@ +From 88c09fc422d021f6ae0aa06df11f15d36159dad4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 27 Apr 2021 10:30:11 +0200 +Subject: scsi: scsi_dh_alua: Check for negative result value + +From: Hannes Reinecke + +[ Upstream commit 7e26e3ea028740f934477ec01ba586ab033c35aa ] + +scsi_execute() will now return a negative error if there was an error prior +to command submission; evaluate that instead if checking for DRIVER_ERROR. + +[mkp: build fix] + +Link: https://lore.kernel.org/r/20210427083046.31620-6-hare@suse.de +Signed-off-by: Hannes Reinecke +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/device_handler/scsi_dh_alua.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c b/drivers/scsi/device_handler/scsi_dh_alua.c +index efa8c0381476..c8bfd87a8047 100644 +--- a/drivers/scsi/device_handler/scsi_dh_alua.c ++++ b/drivers/scsi/device_handler/scsi_dh_alua.c +@@ -562,12 +562,12 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg) + kfree(buff); + return SCSI_DH_OK; + } +- if (!scsi_sense_valid(&sense_hdr)) { ++ if (retval < 0 || !scsi_sense_valid(&sense_hdr)) { + sdev_printk(KERN_INFO, sdev, + "%s: rtpg failed, result %d\n", + ALUA_DH_NAME, retval); + kfree(buff); +- if (driver_byte(retval) == DRIVER_ERROR) ++ if (retval < 0) + return SCSI_DH_DEV_TEMP_BUSY; + return SCSI_DH_IO; + } +@@ -791,11 +791,11 @@ static unsigned alua_stpg(struct scsi_device *sdev, struct alua_port_group *pg) + retval = submit_stpg(sdev, pg->group_id, &sense_hdr); + + if (retval) { +- if (!scsi_sense_valid(&sense_hdr)) { ++ if (retval < 0 || !scsi_sense_valid(&sense_hdr)) { + sdev_printk(KERN_INFO, sdev, + "%s: stpg failed, result %d", + ALUA_DH_NAME, retval); +- if (driver_byte(retval) == DRIVER_ERROR) ++ if (retval < 0) + return SCSI_DH_DEV_TEMP_BUSY; + } else { + sdev_printk(KERN_INFO, sdev, "%s: stpg failed\n", +-- +2.30.2 + diff --git a/queue-5.13/scsi-storvsc-correctly-handle-multiple-flags-in-srb_.patch b/queue-5.13/scsi-storvsc-correctly-handle-multiple-flags-in-srb_.patch new file mode 100644 index 00000000000..eecd9822f87 --- /dev/null +++ b/queue-5.13/scsi-storvsc-correctly-handle-multiple-flags-in-srb_.patch @@ -0,0 +1,120 @@ +From 9cff8e10a0e32daf1dd803c4d97d3a2ded295ace Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 4 Jun 2021 10:21:03 -0700 +Subject: scsi: storvsc: Correctly handle multiple flags in srb_status + +From: Michael Kelley + +[ Upstream commit 52e1b3b3daa9d53f0204bf474ee1d4b1beb38234 ] + +Hyper-V is observed to sometimes set multiple flags in the srb_status, such +as ABORTED and ERROR. Current code in storvsc_handle_error() handles only a +single flag being set, and does nothing when multiple flags are set. Fix +this by changing the case statement into a series of "if" statements +testing individual flags. The functionality for handling each flag is +unchanged. + +Link: https://lore.kernel.org/r/1622827263-12516-3-git-send-email-mikelley@microsoft.com +Signed-off-by: Michael Kelley +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/storvsc_drv.c | 61 +++++++++++++++++++++----------------- + 1 file changed, 33 insertions(+), 28 deletions(-) + +diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c +index e6718a74e5da..b2e28197a086 100644 +--- a/drivers/scsi/storvsc_drv.c ++++ b/drivers/scsi/storvsc_drv.c +@@ -1009,17 +1009,40 @@ static void storvsc_handle_error(struct vmscsi_request *vm_srb, + struct storvsc_scan_work *wrk; + void (*process_err_fn)(struct work_struct *work); + struct hv_host_device *host_dev = shost_priv(host); +- bool do_work = false; + +- switch (SRB_STATUS(vm_srb->srb_status)) { +- case SRB_STATUS_ERROR: ++ /* ++ * In some situations, Hyper-V sets multiple bits in the ++ * srb_status, such as ABORTED and ERROR. So process them ++ * individually, with the most specific bits first. ++ */ ++ ++ if (vm_srb->srb_status & SRB_STATUS_INVALID_LUN) { ++ set_host_byte(scmnd, DID_NO_CONNECT); ++ process_err_fn = storvsc_remove_lun; ++ goto do_work; ++ } ++ ++ if (vm_srb->srb_status & SRB_STATUS_ABORTED) { ++ if (vm_srb->srb_status & SRB_STATUS_AUTOSENSE_VALID && ++ /* Capacity data has changed */ ++ (asc == 0x2a) && (ascq == 0x9)) { ++ process_err_fn = storvsc_device_scan; ++ /* ++ * Retry the I/O that triggered this. ++ */ ++ set_host_byte(scmnd, DID_REQUEUE); ++ goto do_work; ++ } ++ } ++ ++ if (vm_srb->srb_status & SRB_STATUS_ERROR) { + /* + * Let upper layer deal with error when + * sense message is present. + */ +- + if (vm_srb->srb_status & SRB_STATUS_AUTOSENSE_VALID) +- break; ++ return; ++ + /* + * If there is an error; offline the device since all + * error recovery strategies would have already been +@@ -1032,37 +1055,19 @@ static void storvsc_handle_error(struct vmscsi_request *vm_srb, + set_host_byte(scmnd, DID_PASSTHROUGH); + break; + /* +- * On Some Windows hosts TEST_UNIT_READY command can return +- * SRB_STATUS_ERROR, let the upper level code deal with it +- * based on the sense information. ++ * On some Hyper-V hosts TEST_UNIT_READY command can ++ * return SRB_STATUS_ERROR. Let the upper level code ++ * deal with it based on the sense information. + */ + case TEST_UNIT_READY: + break; + default: + set_host_byte(scmnd, DID_ERROR); + } +- break; +- case SRB_STATUS_INVALID_LUN: +- set_host_byte(scmnd, DID_NO_CONNECT); +- do_work = true; +- process_err_fn = storvsc_remove_lun; +- break; +- case SRB_STATUS_ABORTED: +- if (vm_srb->srb_status & SRB_STATUS_AUTOSENSE_VALID && +- (asc == 0x2a) && (ascq == 0x9)) { +- do_work = true; +- process_err_fn = storvsc_device_scan; +- /* +- * Retry the I/O that triggered this. +- */ +- set_host_byte(scmnd, DID_REQUEUE); +- } +- break; + } ++ return; + +- if (!do_work) +- return; +- ++do_work: + /* + * We need to schedule work to process this error; schedule it. + */ +-- +2.30.2 + diff --git a/queue-5.13/selftests-powerpc-fix-no_handler-ebb-selftest.patch b/queue-5.13/selftests-powerpc-fix-no_handler-ebb-selftest.patch new file mode 100644 index 00000000000..40fd429014f --- /dev/null +++ b/queue-5.13/selftests-powerpc-fix-no_handler-ebb-selftest.patch @@ -0,0 +1,45 @@ +From 2045be4b089282b47c58bc000c79818fab3331e7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 25 May 2021 09:51:42 -0400 +Subject: selftests/powerpc: Fix "no_handler" EBB selftest + +From: Athira Rajeev + +[ Upstream commit 45677c9aebe926192e59475b35a1ff35ff2d4217 ] + +The "no_handler_test" in ebb selftests attempts to read the PMU +registers twice via helper function "dump_ebb_state". First dump is +just before closing of event and the second invocation is done after +closing of the event. The original intention of second +dump_ebb_state was to dump the state of registers at the end of +the test when the counters are frozen. But this will be achieved +with the first call itself since sample period is set to low value +and PMU will be frozen by then. Hence patch removes the +dump which was done before closing of the event. + +Reported-by: Shirisha Ganta +Signed-off-by: Athira Rajeev +Tested-by: Nageswara R Sastry > +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/1621950703-1532-2-git-send-email-atrajeev@linux.vnet.ibm.com +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/powerpc/pmu/ebb/no_handler_test.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/tools/testing/selftests/powerpc/pmu/ebb/no_handler_test.c b/tools/testing/selftests/powerpc/pmu/ebb/no_handler_test.c +index fc5bf4870d8e..01e827c31169 100644 +--- a/tools/testing/selftests/powerpc/pmu/ebb/no_handler_test.c ++++ b/tools/testing/selftests/powerpc/pmu/ebb/no_handler_test.c +@@ -50,8 +50,6 @@ static int no_handler_test(void) + + event_close(&event); + +- dump_ebb_state(); +- + /* The real test is that we never took an EBB at 0x0 */ + + return 0; +-- +2.30.2 + diff --git a/queue-5.13/selftests-timers-rtcpie-skip-test-if-default-rtc-dev.patch b/queue-5.13/selftests-timers-rtcpie-skip-test-if-default-rtc-dev.patch new file mode 100644 index 00000000000..eb52a5bf5b2 --- /dev/null +++ b/queue-5.13/selftests-timers-rtcpie-skip-test-if-default-rtc-dev.patch @@ -0,0 +1,67 @@ +From d214db908cbf48fdfa6ce206fdfb6a478b08e72c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 25 May 2021 10:36:14 +0800 +Subject: selftests: timers: rtcpie: skip test if default RTC device does not + exist + +From: Po-Hsu Lin + +[ Upstream commit 0d3e5a057992bdc66e4dca2ca50b77fa4a7bd90e ] + +This test will require /dev/rtc0, the default RTC device, or one +specified by user to run. Since this default RTC is not guaranteed to +exist on all of the devices, so check its existence first, otherwise +skip this test with the kselftest skip code 4. + +Without this patch this test will fail like this on a s390x zVM: +$ selftests: timers: rtcpie +$ /dev/rtc0: No such file or directory +not ok 1 selftests: timers: rtcpie # exit=22 + +With this patch: +$ selftests: timers: rtcpie +$ Default RTC /dev/rtc0 does not exist. Test Skipped! +not ok 9 selftests: timers: rtcpie # SKIP + +Fixed up change log so "With this patch" text doesn't get dropped. +Shuah Khan + +Signed-off-by: Po-Hsu Lin +Signed-off-by: Shuah Khan +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/timers/rtcpie.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/tools/testing/selftests/timers/rtcpie.c b/tools/testing/selftests/timers/rtcpie.c +index 47b5bad1b393..4ef2184f1558 100644 +--- a/tools/testing/selftests/timers/rtcpie.c ++++ b/tools/testing/selftests/timers/rtcpie.c +@@ -18,6 +18,8 @@ + #include + #include + ++#include "../kselftest.h" ++ + /* + * This expects the new RTC class driver framework, working with + * clocks that will often not be clones of what the PC-AT had. +@@ -35,8 +37,14 @@ int main(int argc, char **argv) + switch (argc) { + case 2: + rtc = argv[1]; +- /* FALLTHROUGH */ ++ break; + case 1: ++ fd = open(default_rtc, O_RDONLY); ++ if (fd == -1) { ++ printf("Default RTC %s does not exist. Test Skipped!\n", default_rtc); ++ exit(KSFT_SKIP); ++ } ++ close(fd); + break; + default: + fprintf(stderr, "usage: rtctest [rtcdev] [d]\n"); +-- +2.30.2 + diff --git a/queue-5.13/serial-8250-of-check-for-config_serial_8250_bcm7271.patch b/queue-5.13/serial-8250-of-check-for-config_serial_8250_bcm7271.patch new file mode 100644 index 00000000000..c28defc08a4 --- /dev/null +++ b/queue-5.13/serial-8250-of-check-for-config_serial_8250_bcm7271.patch @@ -0,0 +1,68 @@ +From b8fe7fcbdd4041e17e31428298f9755b1baaf344 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 23 Apr 2021 11:32:04 -0700 +Subject: serial: 8250: of: Check for CONFIG_SERIAL_8250_BCM7271 + +From: Jim Quinlan + +[ Upstream commit f5b08386dee439c7a9e60ce0a4a4a705f3a60dff ] + +Our SoC's have always had a NS16650A UART core and older SoC's would +have a compatible string of: 'compatible = ""ns16550a"' and use the +8250_of driver. Our newer SoC's have added enhancements to the base +core to add support for DMA and accurate high speed baud rates and use +this newer 8250_bcm7271 driver. The Device Tree node for our enhanced +UARTs has a compatible string of: 'compatible = "brcm,bcm7271-uart", +"ns16550a"''. With both drivers running and the link order setup so +that the 8250_bcm7217 driver is initialized before the 8250_of driver, +we should bind the 8250_bcm7271 driver to the enhanced UART, or for +upstream kernels that don't have the 8250_bcm7271 driver, we bind to +the 8250_of driver. + +The problem is that when both the 8250_of and 8250_bcm7271 drivers +were running, occasionally the 8250_of driver would be bound to the +enhanced UART instead of the 8250_bcm7271 driver. This was happening +because we use SCMI based clocks which come up late in initialization +and cause probe DEFER's when the two drivers get their clocks. + +Occasionally the SCMI clock would become ready between the 8250_bcm7271 +probe and the 8250_of probe and the 8250_of driver would be bound. To +fix this we decided to config only our 8250_bcm7271 driver and added +"ns16665a0" to the compatible string so the driver would work on our +older system. + +This commit has of_platform_serial_probe() check specifically for the +"brcm,bcm7271-uart" and whether its companion driver is enabled. If it +is the case, and the clock provider is not ready, we want to make sure +that when the 8250_bcm7271.c driver returns EPROBE_DEFER, we are not +getting the UART registered via 8250_of.c. + +Reviewed-by: Andy Shevchenko +Signed-off-by: Jim Quinlan +Signed-off-by: Al Cooper +Signed-off-by: Florian Fainelli +Link: https://lore.kernel.org/r/20210423183206.3917725-1-f.fainelli@gmail.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/tty/serial/8250/8250_of.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/drivers/tty/serial/8250/8250_of.c b/drivers/tty/serial/8250/8250_of.c +index 0b077b45d6a9..bce28729dd7b 100644 +--- a/drivers/tty/serial/8250/8250_of.c ++++ b/drivers/tty/serial/8250/8250_of.c +@@ -192,6 +192,10 @@ static int of_platform_serial_probe(struct platform_device *ofdev) + u32 tx_threshold; + int ret; + ++ if (IS_ENABLED(CONFIG_SERIAL_8250_BCM7271) && ++ of_device_is_compatible(ofdev->dev.of_node, "brcm,bcm7271-uart")) ++ return -ENODEV; ++ + port_type = (unsigned long)of_device_get_match_data(&ofdev->dev); + if (port_type == PORT_UNKNOWN) + return -EINVAL; +-- +2.30.2 + diff --git a/queue-5.13/serial-fsl_lpuart-disable-dma-for-console-and-fix-sy.patch b/queue-5.13/serial-fsl_lpuart-disable-dma-for-console-and-fix-sy.patch new file mode 100644 index 00000000000..10484adad2f --- /dev/null +++ b/queue-5.13/serial-fsl_lpuart-disable-dma-for-console-and-fix-sy.patch @@ -0,0 +1,51 @@ +From 5d7b3c9c48b8447853b3d550b664eb1cc075fb17 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 12 May 2021 16:12:55 +0200 +Subject: serial: fsl_lpuart: disable DMA for console and fix sysrq + +From: Michael Walle + +[ Upstream commit 8cac2f6eb8548245e6f8fb893fc7f2a714952654 ] + +SYSRQ doesn't work with DMA. This is because there is no error +indication whether a symbol had a framing error or not. Actually, +this is not completely correct, there is a bit in the data register +which is set in this case, but we'd have to read change the DMA access +to 16 bit and we'd need to post process the data, thus make the DMA +pointless in the first place. + +Signed-off-by: Michael Walle +Link: https://lore.kernel.org/r/20210512141255.18277-10-michael@walle.cc +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/tty/serial/fsl_lpuart.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c +index 4cad2ac00e9f..0d7ea144a4a6 100644 +--- a/drivers/tty/serial/fsl_lpuart.c ++++ b/drivers/tty/serial/fsl_lpuart.c +@@ -1571,6 +1571,9 @@ static void lpuart_tx_dma_startup(struct lpuart_port *sport) + u32 uartbaud; + int ret; + ++ if (uart_console(&sport->port)) ++ goto err; ++ + if (!sport->dma_tx_chan) + goto err; + +@@ -1600,6 +1603,9 @@ static void lpuart_rx_dma_startup(struct lpuart_port *sport) + int ret; + unsigned char cr3; + ++ if (uart_console(&sport->port)) ++ goto err; ++ + if (!sport->dma_rx_chan) + goto err; + +-- +2.30.2 + diff --git a/queue-5.13/serial-tty-uartlite-fix-console-setup.patch b/queue-5.13/serial-tty-uartlite-fix-console-setup.patch new file mode 100644 index 00000000000..d2f2f2adeab --- /dev/null +++ b/queue-5.13/serial-tty-uartlite-fix-console-setup.patch @@ -0,0 +1,92 @@ +From c7544f4aeb12fdb20017947746cdc5a47ec7a4fd Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 28 May 2021 15:33:20 +0200 +Subject: serial: tty: uartlite: fix console setup + +From: Daniel Mack + +[ Upstream commit d157fca711ad42e75efef3444c83d2e1a17be27a ] + +Remove the hack to assign the global console_port variable at probe time. +This assumption that cons->index is -1 is wrong for systems that specify +'console=' in the cmdline (or 'stdout-path' in dts). Hence, on such system +the actual console assignment is ignored, and the first UART that happens +to be probed is used as console instead. + +Move the logic to console_setup() and map the console to the correct port +through the array of available ports instead. + +Signed-off-by: Daniel Mack +Link: https://lore.kernel.org/r/20210528133321.1859346-1-daniel@zonque.org +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/tty/serial/uartlite.c | 27 ++++++--------------------- + 1 file changed, 6 insertions(+), 21 deletions(-) + +diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c +index f42ccc40ffa6..a5f15f22d9ef 100644 +--- a/drivers/tty/serial/uartlite.c ++++ b/drivers/tty/serial/uartlite.c +@@ -505,21 +505,23 @@ static void ulite_console_write(struct console *co, const char *s, + + static int ulite_console_setup(struct console *co, char *options) + { +- struct uart_port *port; ++ struct uart_port *port = NULL; + int baud = 9600; + int bits = 8; + int parity = 'n'; + int flow = 'n'; + +- +- port = console_port; ++ if (co->index >= 0 && co->index < ULITE_NR_UARTS) ++ port = ulite_ports + co->index; + + /* Has the device been initialized yet? */ +- if (!port->mapbase) { ++ if (!port || !port->mapbase) { + pr_debug("console on ttyUL%i not present\n", co->index); + return -ENODEV; + } + ++ console_port = port; ++ + /* not initialized yet? */ + if (!port->membase) { + if (ulite_request_port(port)) +@@ -655,17 +657,6 @@ static int ulite_assign(struct device *dev, int id, u32 base, int irq, + + dev_set_drvdata(dev, port); + +-#ifdef CONFIG_SERIAL_UARTLITE_CONSOLE +- /* +- * If console hasn't been found yet try to assign this port +- * because it is required to be assigned for console setup function. +- * If register_console() don't assign value, then console_port pointer +- * is cleanup. +- */ +- if (ulite_uart_driver.cons->index == -1) +- console_port = port; +-#endif +- + /* Register the port */ + rc = uart_add_one_port(&ulite_uart_driver, port); + if (rc) { +@@ -675,12 +666,6 @@ static int ulite_assign(struct device *dev, int id, u32 base, int irq, + return rc; + } + +-#ifdef CONFIG_SERIAL_UARTLITE_CONSOLE +- /* This is not port which is used for console that's why clean it up */ +- if (ulite_uart_driver.cons->index == -1) +- console_port = NULL; +-#endif +- + return 0; + } + +-- +2.30.2 + diff --git a/queue-5.13/series b/queue-5.13/series index 10f8c8427a9..13976b71fe4 100644 --- a/queue-5.13/series +++ b/queue-5.13/series @@ -36,3 +36,314 @@ drm-dp_mst-avoid-to-mess-up-payload-table-by-ports-in-stale-topology.patch drm-dp_mst-add-missing-drm-parameters-to-recently-added-call-to-drm_dbg_kms.patch net-bridge-multicast-fix-pim-hello-router-port-marking-race.patch net-bridge-multicast-fix-mrd-advertisement-router-port-marking-race.patch +leds-tlc591xx-fix-return-value-check-in-tlc591xx_pro.patch +asoc-intel-sof_sdw-add-mutual-exclusion-between-pch-.patch +dmaengine-fsl-qdma-check-dma_set_mask-return-value.patch +scsi-arcmsr-fix-the-wrong-cdb-payload-report-to-iop.patch +srcu-fix-broken-node-geometry-after-early-ssp-init.patch +rcu-reject-rcu_lockdep_warn-false-positives.patch +soundwire-bus-only-use-clock_stop_mode0-and-fix-conf.patch +soundwire-bus-handle-enodata-errors-in-clock-stop-st.patch +usb-dwc3-pci-fix-define-for-intel-elkhart-lake.patch +tty-serial-fsl_lpuart-fix-the-potential-risk-of-divi.patch +serial-fsl_lpuart-disable-dma-for-console-and-fix-sy.patch +serial-8250-of-check-for-config_serial_8250_bcm7271.patch +misc-libmasm-module-fix-two-use-after-free-in-ibmasm.patch +misc-alcor_pci-fix-null-ptr-deref-when-there-is-no-p.patch +asoc-intel-boards-add-missing-module_device_table.patch +partitions-msdos-fix-one-byte-get_unaligned.patch +iio-imu-st_lsm6dsx-correct-odr-in-header.patch +iio-gyro-fxa21002c-balance-runtime-pm-use-pm_runtime.patch +iio-magn-bmc150-balance-runtime-pm-use-pm_runtime_re.patch +alsa-usx2y-avoid-camelcase.patch +alsa-usx2y-don-t-call-free_pages_exact-with-null-add.patch +revert-alsa-bebob-oxfw-fix-kconfig-entry-for-mackie-.patch +usb-common-usb-conn-gpio-fix-null-pointer-dereferenc.patch +asoc-sof-topology-fix-assignment-to-use-le32_to_cpu.patch +w1-ds2438-fixing-bug-that-would-always-get-page0.patch +asoc-intel-sof_sdw-add-quirk-support-for-brya-and-bt.patch +scsi-arcmsr-fix-doorbell-status-being-updated-late-o.patch +scsi-hisi_sas-propagate-errors-in-interrupt_init_v1_.patch +scsi-lpfc-fix-unexpected-timeout-error-in-direct-att.patch +scsi-lpfc-fix-crash-when-lpfc_sli4_hba_setup-fails-t.patch +scsi-core-cap-scsi_host-cmd_per_lun-at-can_queue.patch +alsa-ac97-fix-pm-reference-leak-in-ac97_bus_remove.patch +asoc-cs42l42-fix-1536000-bit-clock-instability.patch +tty-serial-8250-serial_cs-fix-a-memory-leak-in-error.patch +scsi-mpt3sas-fix-deadlock-while-cancelling-the-runni.patch +scsi-core-fixup-calling-convention-for-scsi_mode_sen.patch +scsi-scsi_dh_alua-check-for-negative-result-value.patch +fs-jfs-fix-missing-error-code-in-lmloginit.patch +scsi-megaraid_sas-fix-resource-leak-in-case-of-probe.patch +scsi-megaraid_sas-early-detection-of-vd-deletion-thr.patch +scsi-megaraid_sas-handle-missing-interrupts-while-re.patch +scsi-iscsi-add-iscsi_cls_conn-refcount-helpers.patch +scsi-iscsi-fix-conn-use-after-free-during-resets.patch +scsi-iscsi-fix-shost-max_id-use.patch +scsi-qedi-fix-null-ref-during-abort-handling.patch +scsi-qedi-fix-race-during-abort-timeouts.patch +scsi-qedi-fix-tmf-session-block-unblock-use.patch +scsi-qedi-fix-cleanup-session-block-unblock-use.patch +mfd-da9052-stmpe-add-and-modify-module_device_table.patch +mfd-cpcap-fix-cpcap-dmamask-not-set-warnings.patch +asoc-img-fix-pm-reference-leak-in-img_i2s_in_probe.patch +iov_iter_advance-use-consistent-semantics-for-move-p.patch +fsi-add-missing-module_device_table.patch +serial-tty-uartlite-fix-console-setup.patch +s390-sclp_vt220-fix-console-name-to-match-device.patch +s390-disable-ssp-when-needed.patch +selftests-timers-rtcpie-skip-test-if-default-rtc-dev.patch +iommu-arm-smmu-qcom-skip-the-ttbr1-quirk-for-db820c.patch +alsa-sb-fix-potential-double-free-of-csp-mixer-eleme.patch +powerpc-ps3-add-dma_mask-to-ps3_dma_region.patch +iommu-arm-smmu-fix-arm_smmu_device-refcount-leak-whe.patch +iommu-arm-smmu-fix-arm_smmu_device-refcount-leak-in-.patch +alsa-n64-check-return-value-after-calling-platform_g.patch +alsa-control_led-fix-initialization-in-the-mode-show.patch +asoc-soc-pcm-fix-the-return-value-in-dpcm_apply_symm.patch +gpio-zynq-check-return-value-of-pm_runtime_get_sync.patch +gpio-zynq-check-return-value-of-irq_get_irq_data.patch +thunderbolt-fix-drom-handling-for-usb4-drom.patch +powerpc-inst-fix-sparse-detection-on-get_user_instr.patch +scsi-storvsc-correctly-handle-multiple-flags-in-srb_.patch +alsa-ppc-fix-error-return-code-in-snd_pmac_probe.patch +selftests-powerpc-fix-no_handler-ebb-selftest.patch +gpio-pca953x-add-support-for-the-on-semi-pca9655.patch +powerpc-mm-book3s64-fix-possible-build-error.patch +asoc-soc-core-fix-the-error-return-code-in-snd_soc_o.patch +xhci-handle-failed-buffer-copy-to-urb-sg-list-and-fi.patch +habanalabs-check-if-asic-secured-with-asic-type.patch +habanalabs-gaudi-set-the-correct-cpu_id-on-mme2_qm-f.patch +habanalabs-fix-mask-to-obtain-page-offset.patch +habanalabs-set-rc-as-valid-in-case-of-intentional-fu.patch +habanalabs-remove-node-from-list-before-freeing-the-.patch +habanalabs-gaudi-set-the-correct-rc-in-case-of-err.patch +s390-processor-always-inline-stap-and-__load_psw_mas.patch +s390-ipl_parm-fix-program-check-new-psw-handling.patch +s390-mem_detect-fix-diag260-program-check-new-psw-ha.patch +s390-mem_detect-fix-tprot-program-check-new-psw-hand.patch +input-hideep-fix-the-uninitialized-use-in-hideep_nvm.patch +alsa-bebob-add-support-for-toneweal-fw66.patch +m68knommu-fix-missing-lcd-splash-screen-data-initial.patch +alsa-usb-audio-scarlett2-fix-18i8-gen-2-pcm-input-co.patch +alsa-usb-audio-scarlett2-fix-data_mutex-lock.patch +alsa-usb-audio-scarlett2-fix-scarlett2_-_ctl_put-ret.patch +usb-gadget-f_hid-fix-endianness-issue-with-descripto.patch +usb-gadget-hid-fix-error-return-code-in-hid_bind.patch +powerpc-boot-fixup-device-tree-on-little-endian.patch +asoc-fsl_xcvr-check-return-value-after-calling-platf.patch +asoc-intel-kbl_da7219_max98357a-shrink-platform_id-b.patch +backlight-lm3630a-fix-return-code-of-.update_status-.patch +alsa-hda-add-irq-check-for-platform_get_irq.patch +alsa-usb-audio-scarlett2-fix-6i6-gen-2-line-out-desc.patch +alsa-firewire-motu-fix-detection-for-s-pdif-source-o.patch +leds-turris-omnia-add-missing-module_device_table.patch +staging-rtl8723bs-fix-macro-value-for-2.4ghz-only-de.patch +staging-rtl8723bs-fix-check-allowing-5ghz-settings.patch +intel_th-wait-until-port-is-in-reset-before-programm.patch +i2c-core-disable-client-irq-on-reboot-shutdown.patch +phy-intel-fix-for-warnings-due-to-emmc-clock-175mhz-.patch +lib-decompress_unlz4.c-correctly-handle-zero-padding.patch +kcov-add-__no_sanitize_coverage-to-fix-noinstr-for-a.patch +power-supply-sc27xx-add-missing-module_device_table.patch +power-supply-sc2731_charger-add-missing-module_devic.patch +pwm-spear-don-t-modify-hw-state-in-.remove-callback.patch +pci-ftpci100-rename-macro-name-collision.patch +power-supply-ab8500-move-to-componentized-binding.patch +power-supply-ab8500-avoid-null-pointers.patch +power-supply-ab8500-enable-usb-and-ac.patch +pci-hv-fix-a-race-condition-when-removing-the-device.patch +pwm-pca9685-restrict-period-change-for-enabled-pwms.patch +power-supply-max17042-do-not-enforce-incorrect-inter.patch +power-supply-max17040-do-not-enforce-incorrect-inter.patch +power-reset-gpio-poweroff-add-missing-module_device_.patch +arm-9087-1-kprobes-test-thumb-fix-for-llvm_ias-1.patch +pci-p2pdma-avoid-pci_get_slot-which-may-sleep.patch +nfsv4-fix-delegation-return-in-cases-where-we-have-t.patch +pci-pciehp-ignore-link-down-up-caused-by-dpc.patch +pci-dynamically-map-ecam-regions.patch +watchdog-fix-possible-use-after-free-in-wdt_startup.patch +watchdog-sc520_wdt-fix-possible-use-after-free-in-wd.patch +watchdog-fix-possible-use-after-free-by-calling-del_.patch +watchdog-imx_sc_wdt-fix-pretimeout.patch +watchdog-itco_wdt-account-for-rebooting-on-second-ti.patch +virtiofs-propagate-sync-to-file-server.patch +fuse-fix-illegal-access-to-inode-with-reused-nodeid.patch +pci-mediatek-gen3-add-missing-module_device_table.patch +x86-fpu-return-proper-error-codes-from-user-access-f.patch +remoteproc-core-fix-cdev-remove-and-rproc-del.patch +remoteproc-stm32-fix-mbox_send_message-call.patch +pci-tegra-add-missing-module_device_table.patch +nfs-fix-up-inode-attribute-revalidation-timeouts.patch +nfsv4-fix-handling-of-non-atomic-change-attrbute-upd.patch +orangefs-fix-orangefs-df-output.patch +ceph-remove-bogus-checks-and-warn_ons-from-ceph_set_.patch +drm-gma500-add-the-missed-drm_gem_object_put-in-psb_.patch +nfs-nfs_find_open_context-may-only-select-open-files.patch +power-reset-regulator-poweroff-add-missing-module_de.patch +power-supply-charger-manager-add-missing-module_devi.patch +power-supply-ab8500-add-missing-module_device_table.patch +power-supply-axp288_fuel_gauge-make-t3-mrd-no_batter.patch +drm-amdgpu-fix-navi1x-tcp-power-gating-hang-when-iss.patch +drm-amdkfd-fix-sysfs-kobj-leak.patch +pwm-img-fix-pm-reference-leak-in-img_pwm_enable.patch +pwm-tegra-don-t-modify-hw-state-in-.remove-callback.patch +acpi-amba-fix-resource-name-in-proc-iomem.patch +acpi-video-add-quirk-for-the-dell-vostro-3350.patch +pci-rockchip-register-irq-handlers-after-device-and-.patch +ext4-fix-warn_on_once-buffer_uptodate-after-an-error.patch +virtio-blk-fix-memory-leak-among-suspend-resume-proc.patch +virtio_net-fix-error-handling-in-virtnet_restore.patch +virtio_console-assure-used-length-from-device-is-lim.patch +block-fix-the-problem-of-io_ticks-becoming-smaller.patch +power-supply-surface_battery-fix-battery-event-handl.patch +f2fs-atgc-fix-to-set-default-age-threshold.patch +nfsd-fix-tp_printk-format-specifier-in-nfsd_clid_cla.patch +x86-signal-detect-and-prevent-an-alternate-signal-st.patch +cpufreq-scmi-fix-an-error-message.patch +pwm-visconti-fix-and-simplify-period-calculation.patch +module-correctly-exit-module_kallsyms_on_each_symbol.patch +f2fs-add-module_softdep-to-ensure-crc32-is-included-.patch +f2fs-compress-fix-to-disallow-temp-extension.patch +remoteproc-stm32-fix-phys_addr_t-format-string.patch +remoteproc-k3-r5-fix-an-error-message.patch +power-supply-surface-charger-fix-type-of-integer-var.patch +pci-sysfs-fix-dsm_label_utf16s_to_utf8s-buffer-overr.patch +power-supply-rt5033_battery-fix-device-tree-enumerat.patch +nfsv4-initialise-connection-to-the-server-in-nfs4_al.patch +nfsv4-fix-an-oops-in-pnfs_mark_request_commit-when-d.patch +sunrpc-avoid-a-kasan-slab-out-of-bounds-bug-in-xdr_s.patch +um-fix-stack-pointer-alignment.patch +um-fix-error-return-code-in-slip_open.patch +um-fix-error-return-code-in-winch_tramp.patch +ubifs-journal-fix-error-return-code-in-ubifs_jnl_wri.patch +watchdog-keembay-update-wdt-pre-timeout-during-the-i.patch +watchdog-keembay-upadate-wdt-pretimeout-for-every-up.patch +watchdog-keembay-update-pretimeout-to-zero-in-the-th.patch +watchdog-keembay-clear-either-the-to-or-th-interrupt.patch +watchdog-keembay-remove-timeout-update-in-the-wdt-st.patch +watchdog-keembay-removed-timeout-update-in-the-to-is.patch +watchdog-aspeed-fix-hardware-timeout-calculation.patch +watchdog-jz4740-fix-return-value-check-in-jz4740_wdt.patch +sunrpc-prevent-port-reuse-on-transports-which-don-t-.patch +nfs-fix-acl-memory-leak-of-posix_acl_create.patch +ubifs-set-clear-i_linkable-under-i_lock-for-whiteout.patch +pci-iproc-fix-multi-msi-base-vector-number-allocatio.patch +pci-iproc-support-multi-msi-only-on-uniprocessor-ker.patch +f2fs-fix-to-avoid-adding-tab-before-doc-section.patch +x86-fpu-fix-copy_xstate_to_kernel-gap-handling.patch +x86-fpu-limit-xstate-copy-size-in-xstateregs_set.patch +pci-intel-gw-fix-intx-enable.patch +pwm-imx1-don-t-disable-clocks-at-device-remove-time.patch +nfs-update-has_sec_mnt_opts-after-cloning-lsm-option.patch +f2fs-remove-false-alarm-on-iget-failure-during-gc.patch +pci-tegra194-fix-tegra_pcie_ep_raise_msi_irq-ill-def.patch +arch_topology-avoid-use-after-free-for-scale_freq_da.patch +block-grab-a-device-refcount-in-disk_uevent.patch +io_uring-get-rid-of-files-in-exit-cancel.patch +io_uring-shuffle-rarely-used-ctx-fields.patch +io_uring-don-t-bounce-submit_state-cachelines.patch +io_uring-move-creds-from-io-wq-work-to-io_kiocb.patch +io_uring-inline-__tctx_task_work.patch +io_uring-remove-not-needed-pf_exiting-check.patch +vp_vdpa-correct-the-return-value-when-fail-to-map-no.patch +vdpa-mlx5-fix-umem-sizes-assignments-on-vq-create.patch +vdpa-mlx5-fix-possible-failure-in-umem-size-calculat.patch +vdp-mlx5-fix-setting-the-correct-dma_device.patch +virtio_net-move-tx-vq-operation-under-tx-queue-lock.patch +nvme-tcp-can-t-set-sk_user_data-without-write_lock.patch +powerpc-bpf-fix-detecting-bpf-atomic-instructions.patch +nfsd-add-nfsd_clid_confirmed-tracepoint.patch +nfsd-move-fsnotify-on-client-creation-outside-spinlo.patch +nfsd-reduce-contention-for-the-nfsd_file-nf_rwsem.patch +nfsd-prevent-a-possible-oops-in-the-nfs_dirent-trace.patch +nfsd-fix-null-dereference-in-nfs3svc_encode_getaclre.patch +alsa-isa-fix-error-return-code-in-snd_cmi8330_probe.patch +vdpa-mlx5-clear-vq-ready-indication-upon-device-rese.patch +virtio-mem-don-t-read-big-block-size-in-sub-block-mo.patch +nfs-fix-fscache-read-from-nfs-after-cache-error.patch +nfsv4-pnfs-fix-the-layout-barrier-update.patch +nfsv4-pnfs-fix-layoutget-behaviour-after-invalidatio.patch +nfsv4-pnfs-don-t-call-_nfs4_pnfs_v3_ds_connect-multi.patch +hexagon-handle-soft-irqentry_text-in-linker-script.patch +hexagon-use-common-discards-macro.patch +arm-dts-gemini-rut1xx-remove-duplicate-ethernet-node.patch +arm64-dts-rockchip-rename-led-label-for-nanopi-r4s.patch +arm64-dts-rockchip-drop-fephy-pinctrl-from-gmac2phy-.patch +reset-reset_brcmstb_rescal-should-depend-on-arch_brc.patch +reset-reset_intel_gw-should-depend-on-x86.patch +reset-a10sr-add-missing-of_match_table-reference.patch +arm-exynos-add-missing-of_node_put-for-loop-iteratio.patch +arm-dts-exynos-fix-pwm-led-max-brightness-on-odroid-.patch +arm-dts-exynos-fix-pwm-led-max-brightness-on-odroid-.patch-1598 +arm-dts-exynos-fix-pwm-led-max-brightness-on-odroid-.patch-24104 +memory-stm32-fmc2-ebi-add-missing-of_node_put-for-lo.patch +memory-atmel-ebi-add-missing-of_node_put-for-loop-it.patch +reset-brcmstb-add-missing-module_device_table.patch +arm64-defconfig-do-not-override-the-mtk_pmic_wrap-sy.patch +memory-pl353-fix-error-return-code-in-pl353_smc_prob.patch +arm-dts-sun8i-h3-orangepi-plus-fix-ethernet-phy-mode.patch +rtc-bd70528-fix-bd71815-watchdog-dependency.patch +rtc-fix-snprintf-checking-in-is_rtc_hctosys.patch +arm64-dts-renesas-v3msk-fix-memory-size.patch +arm-dts-r8a7779-marzen-fix-du-clock-names.patch +arm64-dts-qcom-sdm845-oneplus-common-guard-rmtfs-mem.patch +arm64-dts-ti-k3-am64-mcu-fix-the-compatible-string-i.patch +arm64-dts-ti-k3-j7200-remove-address-cells-property-.patch +arm64-dts-ti-j7200-main-enable-usb2-phy-rx-sensitivi.patch +arm-dts-qcom-sdx55-t55-represent-secure-regions-as-6.patch +arm-dts-qcom-sdx55-telit-represent-secure-regions-as.patch +arm64-dts-renesas-add-missing-opp-suspend-properties.patch +arm64-dts-renesas-r8a7796-01-fix-opp-table-entry-vol.patch +arm-dts-stm32-rework-lan8710ai-phy-reset-on-dhcom-so.patch +arm64-dts-qcom-msm8994-angler-fix-gpio-reserved-rang.patch +arm64-dts-qcom-trogdor-add-no-hpd-to-dsi-bridge-node.patch +arm64-dts-qcom-c630-add-no-hpd-to-dsi-bridge-node.patch +arm64-dts-qcom-sc7180-fix-sc7180-qmp-usb3-dp-phy-reg.patch +firmware-tegra-fix-error-return-code-in-tegra210_bpm.patch +soc-mtk-pm-domains-do-not-register-smi-node-as-sysco.patch +soc-mtk-pm-domains-fix-the-clock-prepared-issue.patch +firmware-arm_scmi-reset-rx-buffer-to-max-size-during.patch +dt-bindings-i2c-at91-fix-example-for-scl-gpios.patch +arm-dts-bcm5301x-fixup-spi-binding.patch +reset-bail-if-try_module_get-fails.patch +arm64-dts-renesas-r8a779a0-drop-power-domains-proper.patch +revert-arm-dts-bcm283x-increase-dwc2-s-rx-fifo-size.patch +firmware-arm_scmi-add-delayed-response-status-check.patch +arm64-dts-ti-k3-j721e-main-fix-external-refclk-input.patch +arm64-dts-ti-k3-j721e-common-proc-board-use-external.patch +arm64-dts-ti-k3-j721e-common-proc-board-re-name-link.patch +memory-fsl_ifc-fix-leak-of-io-mapping-on-probe-failu.patch +memory-fsl_ifc-fix-leak-of-private-memory-on-probe-f.patch +arm64-dts-allwinner-a64-sopine-baseboard-change-rgmi.patch +arm-dts-dra7-fix-duplicate-usb4-target-module-node.patch +arm-dts-am335x-align-ti-pindir-d0-out-d1-in-property.patch +arm-dts-am437x-align-ti-pindir-d0-out-d1-in-property.patch +thermal-drivers-sprd-add-missing-module_device_table.patch +arm-dts-imx6q-dhcom-fix-ethernet-reset-time-properti.patch +arm-dts-imx6q-dhcom-fix-ethernet-plugin-detection-pr.patch +arm-dts-imx6q-dhcom-add-gpios-pinctrl-for-i2c-bus-re.patch +arm64-dts-ti-k3-am642-main-fix-ports-mac-properties.patch +arm64-dts-ti-am65-align-ti-pindir-d0-out-d1-in-prope.patch +arm64-dts-ti-k3-am642-evm-align-ti-pindir-d0-out-d1-.patch +thermal-drivers-rcar_gen3_thermal-fix-coefficient-ca.patch +kbuild-remove-trailing-slashes-from-kbuild_extmod.patch +firmware-turris-mox-rwtm-fix-reply-status-decoding-f.patch +firmware-turris-mox-rwtm-report-failures-better.patch +firmware-turris-mox-rwtm-fail-probing-when-firmware-.patch +firmware-turris-mox-rwtm-show-message-about-hwrng-re.patch +arm64-dts-rockchip-re-add-regulator-boot-on-regulato.patch +arm64-dts-rockchip-re-add-regulator-always-on-for-vc.patch +scsi-be2iscsi-fix-an-error-handling-path-in-beiscsi_.patch +sched-uclamp-ignore-max-aggregation-if-rq-is-idle.patch +jump_label-fix-jump_label_text_reserved-vs-__init.patch +static_call-fix-static_call_text_reserved-vs-__init.patch +kprobe-static_call-restore-missing-static_call_text_.patch +mips-always-link-byteswap-helpers-into-decompressor.patch +mips-disable-branch-profiling-in-boot-decompress.o.patch +perf-report-fix-task-and-stat-with-pipe-input.patch +perf-script-python-fix-buffer-size-to-report-iregs-i.patch +s390-irq-remove-have_irq_exit_on_irq_stack.patch +mips-vdso-invalid-gic-access-through-vdso.patch +perf-tools-fix-pattern-matching-for-same-substring-i.patch +cpufreq-cppc-fix-potential-memleak-in-cppc_cpufreq_c.patch diff --git a/queue-5.13/soc-mtk-pm-domains-do-not-register-smi-node-as-sysco.patch b/queue-5.13/soc-mtk-pm-domains-do-not-register-smi-node-as-sysco.patch new file mode 100644 index 00000000000..09354e93bff --- /dev/null +++ b/queue-5.13/soc-mtk-pm-domains-do-not-register-smi-node-as-sysco.patch @@ -0,0 +1,63 @@ +From bcc7303b619118cc79c59cdf78345ab1696ca8dd Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 1 Jun 2021 11:59:04 +0800 +Subject: soc: mtk-pm-domains: do not register smi node as syscon + +From: Hsin-Yi Wang + +[ Upstream commit eed6ff1bb2da65067d928f4ab322c7d75f944fa4 ] + +Mediatek requires mmsys clocks to be unprepared during suspend, +otherwise system has chances to hang. + +syscon_regmap_lookup_by_phandle_optional() will attach and prepare the +first clock in smi node, leading to additional prepare to the clock +which is not balanced with the prepare/unprepare pair in resume/suspend +callbacks. + +If a power domain node requests an smi node and the smi node's first +clock is an mmsys clock, it will results in an unstable suspend resume. + +Fixes: f414854c8843 ("soc: mediatek: pm-domains: Add SMI block as bus protection block") +Signed-off-by: Hsin-Yi Wang +Reviewed-by: chun-jie.chen +Reviewed-by: Enric Balletbo i Serra +Link: https://lore.kernel.org/r/20210601035905.2970384-2-hsinyi@chromium.org +Signed-off-by: Matthias Brugger +Signed-off-by: Sasha Levin +--- + drivers/soc/mediatek/mtk-pm-domains.c | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +diff --git a/drivers/soc/mediatek/mtk-pm-domains.c b/drivers/soc/mediatek/mtk-pm-domains.c +index 0af00efa0ef8..22fa52f0e86e 100644 +--- a/drivers/soc/mediatek/mtk-pm-domains.c ++++ b/drivers/soc/mediatek/mtk-pm-domains.c +@@ -297,6 +297,7 @@ generic_pm_domain *scpsys_add_one_domain(struct scpsys *scpsys, struct device_no + const struct scpsys_domain_data *domain_data; + struct scpsys_domain *pd; + struct device_node *root_node = scpsys->dev->of_node; ++ struct device_node *smi_node; + struct property *prop; + const char *clk_name; + int i, ret, num_clks; +@@ -352,9 +353,13 @@ generic_pm_domain *scpsys_add_one_domain(struct scpsys *scpsys, struct device_no + if (IS_ERR(pd->infracfg)) + return ERR_CAST(pd->infracfg); + +- pd->smi = syscon_regmap_lookup_by_phandle_optional(node, "mediatek,smi"); +- if (IS_ERR(pd->smi)) +- return ERR_CAST(pd->smi); ++ smi_node = of_parse_phandle(node, "mediatek,smi", 0); ++ if (smi_node) { ++ pd->smi = device_node_to_regmap(smi_node); ++ of_node_put(smi_node); ++ if (IS_ERR(pd->smi)) ++ return ERR_CAST(pd->smi); ++ } + + num_clks = of_clk_get_parent_count(node); + if (num_clks > 0) { +-- +2.30.2 + diff --git a/queue-5.13/soc-mtk-pm-domains-fix-the-clock-prepared-issue.patch b/queue-5.13/soc-mtk-pm-domains-fix-the-clock-prepared-issue.patch new file mode 100644 index 00000000000..de238b3d58b --- /dev/null +++ b/queue-5.13/soc-mtk-pm-domains-fix-the-clock-prepared-issue.patch @@ -0,0 +1,155 @@ +From 328ebb4e99b986fce570530d62b4f2dc1f776a77 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 1 Jun 2021 11:59:03 +0800 +Subject: soc: mtk-pm-domains: Fix the clock prepared issue + +From: Weiyi Lu + +[ Upstream commit f0fce06e345dc4f75c1cdd21840780f5fe2df1f3 ] + +In this new power domain driver, when adding one power domain +it will prepare the dependent clocks at the same. +So we only do clk_bulk_enable/disable control during power ON/OFF. +When system suspend, the pm runtime framework will forcely power off +power domains. However, the dependent clocks are disabled but kept +prepared. + +In MediaTek clock drivers, PLL would be turned ON when we do +clk_bulk_prepare control. + +Clock hierarchy: +PLL --> + DIV_CK --> + CLK_MUX + (may be dependent clocks) + --> + SUBSYS_CG + (may be dependent clocks) + +It will lead some unexpected clock states during system suspend. +This patch will fix by doing prepare_enable/disable_unprepare on +dependent clocks at the same time while we are going to power on/off +any power domain. + +Fixes: 59b644b01cf4 ("soc: mediatek: Add MediaTek SCPSYS power domains") +Signed-off-by: Weiyi Lu +Signed-off-by: Hsin-Yi Wang +Reviewed-by: chun-jie.chen +Reviewed-by: Enric Balletbo i Serra +Link: https://lore.kernel.org/r/20210601035905.2970384-1-hsinyi@chromium.org +Signed-off-by: Matthias Brugger +Signed-off-by: Sasha Levin +--- + drivers/soc/mediatek/mtk-pm-domains.c | 31 +++++++-------------------- + 1 file changed, 8 insertions(+), 23 deletions(-) + +diff --git a/drivers/soc/mediatek/mtk-pm-domains.c b/drivers/soc/mediatek/mtk-pm-domains.c +index 22fa52f0e86e..b762bc40f56b 100644 +--- a/drivers/soc/mediatek/mtk-pm-domains.c ++++ b/drivers/soc/mediatek/mtk-pm-domains.c +@@ -211,7 +211,7 @@ static int scpsys_power_on(struct generic_pm_domain *genpd) + if (ret) + return ret; + +- ret = clk_bulk_enable(pd->num_clks, pd->clks); ++ ret = clk_bulk_prepare_enable(pd->num_clks, pd->clks); + if (ret) + goto err_reg; + +@@ -229,7 +229,7 @@ static int scpsys_power_on(struct generic_pm_domain *genpd) + regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_ISO_BIT); + regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_RST_B_BIT); + +- ret = clk_bulk_enable(pd->num_subsys_clks, pd->subsys_clks); ++ ret = clk_bulk_prepare_enable(pd->num_subsys_clks, pd->subsys_clks); + if (ret) + goto err_pwr_ack; + +@@ -246,9 +246,9 @@ static int scpsys_power_on(struct generic_pm_domain *genpd) + err_disable_sram: + scpsys_sram_disable(pd); + err_disable_subsys_clks: +- clk_bulk_disable(pd->num_subsys_clks, pd->subsys_clks); ++ clk_bulk_disable_unprepare(pd->num_subsys_clks, pd->subsys_clks); + err_pwr_ack: +- clk_bulk_disable(pd->num_clks, pd->clks); ++ clk_bulk_disable_unprepare(pd->num_clks, pd->clks); + err_reg: + scpsys_regulator_disable(pd->supply); + return ret; +@@ -269,7 +269,7 @@ static int scpsys_power_off(struct generic_pm_domain *genpd) + if (ret < 0) + return ret; + +- clk_bulk_disable(pd->num_subsys_clks, pd->subsys_clks); ++ clk_bulk_disable_unprepare(pd->num_subsys_clks, pd->subsys_clks); + + /* subsys power off */ + regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_RST_B_BIT); +@@ -284,7 +284,7 @@ static int scpsys_power_off(struct generic_pm_domain *genpd) + if (ret < 0) + return ret; + +- clk_bulk_disable(pd->num_clks, pd->clks); ++ clk_bulk_disable_unprepare(pd->num_clks, pd->clks); + + scpsys_regulator_disable(pd->supply); + +@@ -410,14 +410,6 @@ generic_pm_domain *scpsys_add_one_domain(struct scpsys *scpsys, struct device_no + pd->subsys_clks[i].clk = clk; + } + +- ret = clk_bulk_prepare(pd->num_clks, pd->clks); +- if (ret) +- goto err_put_subsys_clocks; +- +- ret = clk_bulk_prepare(pd->num_subsys_clks, pd->subsys_clks); +- if (ret) +- goto err_unprepare_clocks; +- + /* + * Initially turn on all domains to make the domains usable + * with !CONFIG_PM and to get the hardware in sync with the +@@ -432,7 +424,7 @@ generic_pm_domain *scpsys_add_one_domain(struct scpsys *scpsys, struct device_no + ret = scpsys_power_on(&pd->genpd); + if (ret < 0) { + dev_err(scpsys->dev, "%pOF: failed to power on domain: %d\n", node, ret); +- goto err_unprepare_clocks; ++ goto err_put_subsys_clocks; + } + } + +@@ -440,7 +432,7 @@ generic_pm_domain *scpsys_add_one_domain(struct scpsys *scpsys, struct device_no + ret = -EINVAL; + dev_err(scpsys->dev, + "power domain with id %d already exists, check your device-tree\n", id); +- goto err_unprepare_subsys_clocks; ++ goto err_put_subsys_clocks; + } + + if (!pd->data->name) +@@ -460,10 +452,6 @@ generic_pm_domain *scpsys_add_one_domain(struct scpsys *scpsys, struct device_no + + return scpsys->pd_data.domains[id]; + +-err_unprepare_subsys_clocks: +- clk_bulk_unprepare(pd->num_subsys_clks, pd->subsys_clks); +-err_unprepare_clocks: +- clk_bulk_unprepare(pd->num_clks, pd->clks); + err_put_subsys_clocks: + clk_bulk_put(pd->num_subsys_clks, pd->subsys_clks); + err_put_clocks: +@@ -542,10 +530,7 @@ static void scpsys_remove_one_domain(struct scpsys_domain *pd) + "failed to remove domain '%s' : %d - state may be inconsistent\n", + pd->genpd.name, ret); + +- clk_bulk_unprepare(pd->num_clks, pd->clks); + clk_bulk_put(pd->num_clks, pd->clks); +- +- clk_bulk_unprepare(pd->num_subsys_clks, pd->subsys_clks); + clk_bulk_put(pd->num_subsys_clks, pd->subsys_clks); + } + +-- +2.30.2 + diff --git a/queue-5.13/soundwire-bus-handle-enodata-errors-in-clock-stop-st.patch b/queue-5.13/soundwire-bus-handle-enodata-errors-in-clock-stop-st.patch new file mode 100644 index 00000000000..524e00b9bf2 --- /dev/null +++ b/queue-5.13/soundwire-bus-handle-enodata-errors-in-clock-stop-st.patch @@ -0,0 +1,219 @@ +From 4ed11f73771d269fbceb94d7a5d18a8be4fea90a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 11 May 2021 11:00:47 +0800 +Subject: soundwire: bus: handle -ENODATA errors in clock stop/start sequences + +From: Pierre-Louis Bossart + +[ Upstream commit b50bb8ba369cdc8814e82558117711c12ef3af3d ] + +If a device lost sync and can no longer ACK a command, it may not be +able to enter a lower-power state but it will still be able to resync +when the clock restarts. In those cases, we want to continue with the +clock stop sequence. + +This patch modifies the behavior during clock stop sequences to only +log errors unrelated to -ENODATA/Command_Ignored. The flow is also +modified so that loops continue to prepare/deprepare other devices +even when one seems to have lost sync. + +When resuming the clocks, all issues are logged with a dev_warn(), +previously only some of them were checked. This is the only part that +now differs between the clock stop entry and clock stop exit +sequences: while we don't want to stop the suspend flow, we do want +information on potential issues while resuming, as they may have +ripple effects. + +For consistency the log messages are also modified to be unique and +self-explanatory. Errors in sdw_slave_clk_stop_callback() were +removed, they are now handled in the caller. + +Signed-off-by: Pierre-Louis Bossart +Reviewed-by: Guennadi Liakhovetski +Reviewed-by: Rander Wang +Signed-off-by: Bard Liao +Link: https://lore.kernel.org/r/20210511030048.25622-4-yung-chuan.liao@linux.intel.com +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/soundwire/bus.c | 69 +++++++++++++++++++++-------------------- + 1 file changed, 36 insertions(+), 33 deletions(-) + +diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c +index dc4033b6f2e9..100d904bf700 100644 +--- a/drivers/soundwire/bus.c ++++ b/drivers/soundwire/bus.c +@@ -829,11 +829,8 @@ static int sdw_slave_clk_stop_callback(struct sdw_slave *slave, + + if (slave->ops && slave->ops->clk_stop) { + ret = slave->ops->clk_stop(slave, mode, type); +- if (ret < 0) { +- dev_err(&slave->dev, +- "Clk Stop type =%d failed: %d\n", type, ret); ++ if (ret < 0) + return ret; +- } + } + + return 0; +@@ -860,7 +857,8 @@ static int sdw_slave_clk_stop_prepare(struct sdw_slave *slave, + } else { + ret = sdw_read_no_pm(slave, SDW_SCP_SYSTEMCTRL); + if (ret < 0) { +- dev_err(&slave->dev, "SDW_SCP_SYSTEMCTRL read failed:%d\n", ret); ++ if (ret != -ENODATA) ++ dev_err(&slave->dev, "SDW_SCP_SYSTEMCTRL read failed:%d\n", ret); + return ret; + } + val = ret; +@@ -869,9 +867,8 @@ static int sdw_slave_clk_stop_prepare(struct sdw_slave *slave, + + ret = sdw_write_no_pm(slave, SDW_SCP_SYSTEMCTRL, val); + +- if (ret < 0) +- dev_err(&slave->dev, +- "Clock Stop prepare failed for slave: %d", ret); ++ if (ret < 0 && ret != -ENODATA) ++ dev_err(&slave->dev, "SDW_SCP_SYSTEMCTRL write failed:%d\n", ret); + + return ret; + } +@@ -922,6 +919,9 @@ int sdw_bus_prep_clk_stop(struct sdw_bus *bus) + * In order to save on transition time, prepare + * each Slave and then wait for all Slave(s) to be + * prepared for clock stop. ++ * If one of the Slave devices has lost sync and ++ * replies with Command Ignored/-ENODATA, we continue ++ * the loop + */ + list_for_each_entry(slave, &bus->slaves, node) { + if (!slave->dev_num) +@@ -937,9 +937,8 @@ int sdw_bus_prep_clk_stop(struct sdw_bus *bus) + ret = sdw_slave_clk_stop_callback(slave, + SDW_CLK_STOP_MODE0, + SDW_CLK_PRE_PREPARE); +- if (ret < 0) { +- dev_err(&slave->dev, +- "pre-prepare failed:%d", ret); ++ if (ret < 0 && ret != -ENODATA) { ++ dev_err(&slave->dev, "clock stop pre-prepare cb failed:%d\n", ret); + return ret; + } + +@@ -950,9 +949,8 @@ int sdw_bus_prep_clk_stop(struct sdw_bus *bus) + ret = sdw_slave_clk_stop_prepare(slave, + SDW_CLK_STOP_MODE0, + true); +- if (ret < 0) { +- dev_err(&slave->dev, +- "pre-prepare failed:%d", ret); ++ if (ret < 0 && ret != -ENODATA) { ++ dev_err(&slave->dev, "clock stop prepare failed:%d\n", ret); + return ret; + } + } +@@ -960,7 +958,7 @@ int sdw_bus_prep_clk_stop(struct sdw_bus *bus) + + /* Skip remaining clock stop preparation if no Slave is attached */ + if (!is_slave) +- return ret; ++ return 0; + + /* + * Don't wait for all Slaves to be ready if they follow the simple +@@ -969,6 +967,12 @@ int sdw_bus_prep_clk_stop(struct sdw_bus *bus) + if (!simple_clk_stop) { + ret = sdw_bus_wait_for_clk_prep_deprep(bus, + SDW_BROADCAST_DEV_NUM); ++ /* ++ * if there are no Slave devices present and the reply is ++ * Command_Ignored/-ENODATA, we don't need to continue with the ++ * flow and can just return here. The error code is not modified ++ * and its handling left as an exercise for the caller. ++ */ + if (ret < 0) + return ret; + } +@@ -986,13 +990,13 @@ int sdw_bus_prep_clk_stop(struct sdw_bus *bus) + SDW_CLK_STOP_MODE0, + SDW_CLK_POST_PREPARE); + +- if (ret < 0) { +- dev_err(&slave->dev, +- "post-prepare failed:%d", ret); ++ if (ret < 0 && ret != -ENODATA) { ++ dev_err(&slave->dev, "clock stop post-prepare cb failed:%d\n", ret); ++ return ret; + } + } + +- return ret; ++ return 0; + } + EXPORT_SYMBOL(sdw_bus_prep_clk_stop); + +@@ -1015,12 +1019,8 @@ int sdw_bus_clk_stop(struct sdw_bus *bus) + ret = sdw_bwrite_no_pm(bus, SDW_BROADCAST_DEV_NUM, + SDW_SCP_CTRL, SDW_SCP_CTRL_CLK_STP_NOW); + if (ret < 0) { +- if (ret == -ENODATA) +- dev_dbg(bus->dev, +- "ClockStopNow Broadcast msg ignored %d", ret); +- else +- dev_err(bus->dev, +- "ClockStopNow Broadcast msg failed %d", ret); ++ if (ret != -ENODATA) ++ dev_err(bus->dev, "ClockStopNow Broadcast msg failed %d\n", ret); + return ret; + } + +@@ -1063,8 +1063,7 @@ int sdw_bus_exit_clk_stop(struct sdw_bus *bus) + ret = sdw_slave_clk_stop_callback(slave, SDW_CLK_STOP_MODE0, + SDW_CLK_PRE_DEPREPARE); + if (ret < 0) +- dev_warn(&slave->dev, +- "clk stop deprep failed:%d", ret); ++ dev_warn(&slave->dev, "clock stop pre-deprepare cb failed:%d\n", ret); + + /* Only de-prepare a Slave device if needed */ + if (!slave->prop.simple_clk_stop_capable) { +@@ -1074,8 +1073,7 @@ int sdw_bus_exit_clk_stop(struct sdw_bus *bus) + false); + + if (ret < 0) +- dev_warn(&slave->dev, +- "clk stop deprep failed:%d", ret); ++ dev_warn(&slave->dev, "clock stop deprepare failed:%d\n", ret); + } + } + +@@ -1087,8 +1085,11 @@ int sdw_bus_exit_clk_stop(struct sdw_bus *bus) + * Don't wait for all Slaves to be ready if they follow the simple + * state machine + */ +- if (!simple_clk_stop) +- sdw_bus_wait_for_clk_prep_deprep(bus, SDW_BROADCAST_DEV_NUM); ++ if (!simple_clk_stop) { ++ ret = sdw_bus_wait_for_clk_prep_deprep(bus, SDW_BROADCAST_DEV_NUM); ++ if (ret < 0) ++ dev_warn(&slave->dev, "clock stop deprepare wait failed:%d\n", ret); ++ } + + list_for_each_entry(slave, &bus->slaves, node) { + if (!slave->dev_num) +@@ -1098,8 +1099,10 @@ int sdw_bus_exit_clk_stop(struct sdw_bus *bus) + slave->status != SDW_SLAVE_ALERT) + continue; + +- sdw_slave_clk_stop_callback(slave, SDW_CLK_STOP_MODE0, +- SDW_CLK_POST_DEPREPARE); ++ ret = sdw_slave_clk_stop_callback(slave, SDW_CLK_STOP_MODE0, ++ SDW_CLK_POST_DEPREPARE); ++ if (ret < 0) ++ dev_warn(&slave->dev, "clock stop post-deprepare cb failed:%d\n", ret); + } + + return 0; +-- +2.30.2 + diff --git a/queue-5.13/soundwire-bus-only-use-clock_stop_mode0-and-fix-conf.patch b/queue-5.13/soundwire-bus-only-use-clock_stop_mode0-and-fix-conf.patch new file mode 100644 index 00000000000..51a7099709e --- /dev/null +++ b/queue-5.13/soundwire-bus-only-use-clock_stop_mode0-and-fix-conf.patch @@ -0,0 +1,238 @@ +From a8e54de775bd282e4818c0205db52caf099e93a1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 11 May 2021 11:00:45 +0800 +Subject: soundwire: bus: only use CLOCK_STOP_MODE0 and fix confusions + +From: Pierre-Louis Bossart + +[ Upstream commit 345e9f5ca798600e44c0843646621f2804eb99f4 ] + +Existing devices and implementations only support the required +CLOCK_STOP_MODE0. All the code related to CLOCK_STOP_MODE1 has not +been tested and is highly questionable, with a clear confusion between +CLOCK_STOP_MODE1 and the simple clock stop state machine. + +This patch removes all usages of CLOCK_STOP_MODE1 - which has no +impact on any solution - and fixes the use of the simple clock stop +state machine. The resulting code should be a lot more symmetrical and +easier to maintain. + +Note that CLOCK_STOP_MODE1 is not supported in the SoundWire Device +Class specification so it's rather unlikely that we need to re-add +this mode later. + +Signed-off-by: Pierre-Louis Bossart +Reviewed-by: Guennadi Liakhovetski +Reviewed-by: Rander Wang +Signed-off-by: Bard Liao +Link: https://lore.kernel.org/r/20210511030048.25622-2-yung-chuan.liao@linux.intel.com +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/soundwire/bus.c | 100 ++++++++++++++-------------------- + include/linux/soundwire/sdw.h | 2 - + 2 files changed, 40 insertions(+), 62 deletions(-) + +diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c +index a9e0aa72654d..dc4033b6f2e9 100644 +--- a/drivers/soundwire/bus.c ++++ b/drivers/soundwire/bus.c +@@ -821,26 +821,6 @@ static void sdw_modify_slave_status(struct sdw_slave *slave, + mutex_unlock(&bus->bus_lock); + } + +-static enum sdw_clk_stop_mode sdw_get_clk_stop_mode(struct sdw_slave *slave) +-{ +- enum sdw_clk_stop_mode mode; +- +- /* +- * Query for clock stop mode if Slave implements +- * ops->get_clk_stop_mode, else read from property. +- */ +- if (slave->ops && slave->ops->get_clk_stop_mode) { +- mode = slave->ops->get_clk_stop_mode(slave); +- } else { +- if (slave->prop.clk_stop_mode1) +- mode = SDW_CLK_STOP_MODE1; +- else +- mode = SDW_CLK_STOP_MODE0; +- } +- +- return mode; +-} +- + static int sdw_slave_clk_stop_callback(struct sdw_slave *slave, + enum sdw_clk_stop_mode mode, + enum sdw_clk_stop_type type) +@@ -933,7 +913,6 @@ static int sdw_bus_wait_for_clk_prep_deprep(struct sdw_bus *bus, u16 dev_num) + */ + int sdw_bus_prep_clk_stop(struct sdw_bus *bus) + { +- enum sdw_clk_stop_mode slave_mode; + bool simple_clk_stop = true; + struct sdw_slave *slave; + bool is_slave = false; +@@ -955,10 +934,8 @@ int sdw_bus_prep_clk_stop(struct sdw_bus *bus) + /* Identify if Slave(s) are available on Bus */ + is_slave = true; + +- slave_mode = sdw_get_clk_stop_mode(slave); +- slave->curr_clk_stop_mode = slave_mode; +- +- ret = sdw_slave_clk_stop_callback(slave, slave_mode, ++ ret = sdw_slave_clk_stop_callback(slave, ++ SDW_CLK_STOP_MODE0, + SDW_CLK_PRE_PREPARE); + if (ret < 0) { + dev_err(&slave->dev, +@@ -966,22 +943,29 @@ int sdw_bus_prep_clk_stop(struct sdw_bus *bus) + return ret; + } + +- ret = sdw_slave_clk_stop_prepare(slave, +- slave_mode, true); +- if (ret < 0) { +- dev_err(&slave->dev, +- "pre-prepare failed:%d", ret); +- return ret; +- } +- +- if (slave_mode == SDW_CLK_STOP_MODE1) ++ /* Only prepare a Slave device if needed */ ++ if (!slave->prop.simple_clk_stop_capable) { + simple_clk_stop = false; ++ ++ ret = sdw_slave_clk_stop_prepare(slave, ++ SDW_CLK_STOP_MODE0, ++ true); ++ if (ret < 0) { ++ dev_err(&slave->dev, ++ "pre-prepare failed:%d", ret); ++ return ret; ++ } ++ } + } + + /* Skip remaining clock stop preparation if no Slave is attached */ + if (!is_slave) + return ret; + ++ /* ++ * Don't wait for all Slaves to be ready if they follow the simple ++ * state machine ++ */ + if (!simple_clk_stop) { + ret = sdw_bus_wait_for_clk_prep_deprep(bus, + SDW_BROADCAST_DEV_NUM); +@@ -998,17 +982,13 @@ int sdw_bus_prep_clk_stop(struct sdw_bus *bus) + slave->status != SDW_SLAVE_ALERT) + continue; + +- slave_mode = slave->curr_clk_stop_mode; +- +- if (slave_mode == SDW_CLK_STOP_MODE1) { +- ret = sdw_slave_clk_stop_callback(slave, +- slave_mode, +- SDW_CLK_POST_PREPARE); ++ ret = sdw_slave_clk_stop_callback(slave, ++ SDW_CLK_STOP_MODE0, ++ SDW_CLK_POST_PREPARE); + +- if (ret < 0) { +- dev_err(&slave->dev, +- "post-prepare failed:%d", ret); +- } ++ if (ret < 0) { ++ dev_err(&slave->dev, ++ "post-prepare failed:%d", ret); + } + } + +@@ -1059,7 +1039,6 @@ EXPORT_SYMBOL(sdw_bus_clk_stop); + */ + int sdw_bus_exit_clk_stop(struct sdw_bus *bus) + { +- enum sdw_clk_stop_mode mode; + bool simple_clk_stop = true; + struct sdw_slave *slave; + bool is_slave = false; +@@ -1081,31 +1060,33 @@ int sdw_bus_exit_clk_stop(struct sdw_bus *bus) + /* Identify if Slave(s) are available on Bus */ + is_slave = true; + +- mode = slave->curr_clk_stop_mode; +- +- if (mode == SDW_CLK_STOP_MODE1) { +- simple_clk_stop = false; +- continue; +- } +- +- ret = sdw_slave_clk_stop_callback(slave, mode, ++ ret = sdw_slave_clk_stop_callback(slave, SDW_CLK_STOP_MODE0, + SDW_CLK_PRE_DEPREPARE); + if (ret < 0) + dev_warn(&slave->dev, + "clk stop deprep failed:%d", ret); + +- ret = sdw_slave_clk_stop_prepare(slave, mode, +- false); ++ /* Only de-prepare a Slave device if needed */ ++ if (!slave->prop.simple_clk_stop_capable) { ++ simple_clk_stop = false; + +- if (ret < 0) +- dev_warn(&slave->dev, +- "clk stop deprep failed:%d", ret); ++ ret = sdw_slave_clk_stop_prepare(slave, SDW_CLK_STOP_MODE0, ++ false); ++ ++ if (ret < 0) ++ dev_warn(&slave->dev, ++ "clk stop deprep failed:%d", ret); ++ } + } + + /* Skip remaining clock stop de-preparation if no Slave is attached */ + if (!is_slave) + return 0; + ++ /* ++ * Don't wait for all Slaves to be ready if they follow the simple ++ * state machine ++ */ + if (!simple_clk_stop) + sdw_bus_wait_for_clk_prep_deprep(bus, SDW_BROADCAST_DEV_NUM); + +@@ -1117,8 +1098,7 @@ int sdw_bus_exit_clk_stop(struct sdw_bus *bus) + slave->status != SDW_SLAVE_ALERT) + continue; + +- mode = slave->curr_clk_stop_mode; +- sdw_slave_clk_stop_callback(slave, mode, ++ sdw_slave_clk_stop_callback(slave, SDW_CLK_STOP_MODE0, + SDW_CLK_POST_DEPREPARE); + } + +diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h +index ced07f8fde87..5d93d9949653 100644 +--- a/include/linux/soundwire/sdw.h ++++ b/include/linux/soundwire/sdw.h +@@ -624,7 +624,6 @@ struct sdw_slave_ops { + int (*port_prep)(struct sdw_slave *slave, + struct sdw_prepare_ch *prepare_ch, + enum sdw_port_prep_ops pre_ops); +- int (*get_clk_stop_mode)(struct sdw_slave *slave); + int (*clk_stop)(struct sdw_slave *slave, + enum sdw_clk_stop_mode mode, + enum sdw_clk_stop_type type); +@@ -675,7 +674,6 @@ struct sdw_slave { + struct list_head node; + struct completion port_ready[SDW_MAX_PORTS]; + unsigned int m_port_map[SDW_MAX_PORTS]; +- enum sdw_clk_stop_mode curr_clk_stop_mode; + u16 dev_num; + u16 dev_num_sticky; + bool probed; +-- +2.30.2 + diff --git a/queue-5.13/srcu-fix-broken-node-geometry-after-early-ssp-init.patch b/queue-5.13/srcu-fix-broken-node-geometry-after-early-ssp-init.patch new file mode 100644 index 00000000000..a451e75c6be --- /dev/null +++ b/queue-5.13/srcu-fix-broken-node-geometry-after-early-ssp-init.patch @@ -0,0 +1,151 @@ +From 6c145fafc7daeef640b4014e9041fcffddb9aa54 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 17 Apr 2021 15:16:49 +0200 +Subject: srcu: Fix broken node geometry after early ssp init + +From: Frederic Weisbecker + +[ Upstream commit b5befe842e6612cf894cf4a199924ee872d8b7d8 ] + +An srcu_struct structure that is initialized before rcu_init_geometry() +will have its srcu_node hierarchy based on CONFIG_NR_CPUS. Once +rcu_init_geometry() is called, this hierarchy is compressed as needed +for the actual maximum number of CPUs for this system. + +Later on, that srcu_struct structure is confused, sometimes referring +to its initial CONFIG_NR_CPUS-based hierarchy, and sometimes instead +to the new num_possible_cpus() hierarchy. For example, each of its +->mynode fields continues to reference the original leaf rcu_node +structures, some of which might no longer exist. On the other hand, +srcu_for_each_node_breadth_first() traverses to the new node hierarchy. + +There are at least two bad possible outcomes to this: + +1) a) A callback enqueued early on an srcu_data structure (call it + *sdp) is recorded pending on sdp->mynode->srcu_data_have_cbs in + srcu_funnel_gp_start() with sdp->mynode pointing to a deep leaf + (say 3 levels). + + b) The grace period ends after rcu_init_geometry() shrinks the + nodes level to a single one. srcu_gp_end() walks through the new + srcu_node hierarchy without ever reaching the old leaves so the + callback is never executed. + + This is easily reproduced on an 8 CPUs machine with CONFIG_NR_CPUS >= 32 + and "rcupdate.rcu_self_test=1". The srcu_barrier() after early tests + verification never completes and the boot hangs: + + [ 5413.141029] INFO: task swapper/0:1 blocked for more than 4915 seconds. + [ 5413.147564] Not tainted 5.12.0-rc4+ #28 + [ 5413.151927] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. + [ 5413.159753] task:swapper/0 state:D stack: 0 pid: 1 ppid: 0 flags:0x00004000 + [ 5413.168099] Call Trace: + [ 5413.170555] __schedule+0x36c/0x930 + [ 5413.174057] ? wait_for_completion+0x88/0x110 + [ 5413.178423] schedule+0x46/0xf0 + [ 5413.181575] schedule_timeout+0x284/0x380 + [ 5413.185591] ? wait_for_completion+0x88/0x110 + [ 5413.189957] ? mark_held_locks+0x61/0x80 + [ 5413.193882] ? mark_held_locks+0x61/0x80 + [ 5413.197809] ? _raw_spin_unlock_irq+0x24/0x50 + [ 5413.202173] ? wait_for_completion+0x88/0x110 + [ 5413.206535] wait_for_completion+0xb4/0x110 + [ 5413.210724] ? srcu_torture_stats_print+0x110/0x110 + [ 5413.215610] srcu_barrier+0x187/0x200 + [ 5413.219277] ? rcu_tasks_verify_self_tests+0x50/0x50 + [ 5413.224244] ? rdinit_setup+0x2b/0x2b + [ 5413.227907] rcu_verify_early_boot_tests+0x2d/0x40 + [ 5413.232700] do_one_initcall+0x63/0x310 + [ 5413.236541] ? rdinit_setup+0x2b/0x2b + [ 5413.240207] ? rcu_read_lock_sched_held+0x52/0x80 + [ 5413.244912] kernel_init_freeable+0x253/0x28f + [ 5413.249273] ? rest_init+0x250/0x250 + [ 5413.252846] kernel_init+0xa/0x110 + [ 5413.256257] ret_from_fork+0x22/0x30 + +2) An srcu_struct structure that is initialized before rcu_init_geometry() + and used afterward will always have stale rdp->mynode references, + resulting in callbacks to be missed in srcu_gp_end(), just like in + the previous scenario. + +This commit therefore causes init_srcu_struct_nodes to initialize the +geometry, if needed. This ensures that the srcu_node hierarchy is +properly built and distributed from the get-go. + +Suggested-by: Paul E. McKenney +Signed-off-by: Frederic Weisbecker +Cc: Boqun Feng +Cc: Lai Jiangshan +Cc: Neeraj Upadhyay +Cc: Josh Triplett +Cc: Joel Fernandes +Cc: Uladzislau Rezki +Signed-off-by: Paul E. McKenney +Signed-off-by: Sasha Levin +--- + kernel/rcu/rcu.h | 2 ++ + kernel/rcu/srcutree.c | 3 +++ + kernel/rcu/tree.c | 16 +++++++++++++++- + 3 files changed, 20 insertions(+), 1 deletion(-) + +diff --git a/kernel/rcu/rcu.h b/kernel/rcu/rcu.h +index bf0827d4b659..cfd06fb5ba6d 100644 +--- a/kernel/rcu/rcu.h ++++ b/kernel/rcu/rcu.h +@@ -308,6 +308,8 @@ static inline void rcu_init_levelspread(int *levelspread, const int *levelcnt) + } + } + ++extern void rcu_init_geometry(void); ++ + /* Returns a pointer to the first leaf rcu_node structure. */ + #define rcu_first_leaf_node() (rcu_state.level[rcu_num_lvls - 1]) + +diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c +index e26547b34ad3..072e47288f1f 100644 +--- a/kernel/rcu/srcutree.c ++++ b/kernel/rcu/srcutree.c +@@ -90,6 +90,9 @@ static void init_srcu_struct_nodes(struct srcu_struct *ssp, bool is_static) + struct srcu_node *snp; + struct srcu_node *snp_first; + ++ /* Initialize geometry if it has not already been initialized. */ ++ rcu_init_geometry(); ++ + /* Work out the overall tree geometry. */ + ssp->level[0] = &ssp->node[0]; + for (i = 1; i < rcu_num_lvls; i++) +diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c +index 9a1396a70c52..afbb0a337c32 100644 +--- a/kernel/rcu/tree.c ++++ b/kernel/rcu/tree.c +@@ -4582,11 +4582,25 @@ static void __init rcu_init_one(void) + * replace the definitions in tree.h because those are needed to size + * the ->node array in the rcu_state structure. + */ +-static void __init rcu_init_geometry(void) ++void rcu_init_geometry(void) + { + ulong d; + int i; ++ static unsigned long old_nr_cpu_ids; + int rcu_capacity[RCU_NUM_LVLS]; ++ static bool initialized; ++ ++ if (initialized) { ++ /* ++ * Warn if setup_nr_cpu_ids() had not yet been invoked, ++ * unless nr_cpus_ids == NR_CPUS, in which case who cares? ++ */ ++ WARN_ON_ONCE(old_nr_cpu_ids != nr_cpu_ids); ++ return; ++ } ++ ++ old_nr_cpu_ids = nr_cpu_ids; ++ initialized = true; + + /* + * Initialize any unspecified boot parameters. +-- +2.30.2 + diff --git a/queue-5.13/staging-rtl8723bs-fix-check-allowing-5ghz-settings.patch b/queue-5.13/staging-rtl8723bs-fix-check-allowing-5ghz-settings.patch new file mode 100644 index 00000000000..a001f60b171 --- /dev/null +++ b/queue-5.13/staging-rtl8723bs-fix-check-allowing-5ghz-settings.patch @@ -0,0 +1,43 @@ +From 25cefe658118ce6e3e8cb1ff85d0dcbf475756e3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 22 Jun 2021 15:10:00 +0200 +Subject: staging: rtl8723bs: fix check allowing 5Ghz settings + +From: Fabio Aiuto + +[ Upstream commit 990a1472930bf2bb7927ea2def4b434790780a8d ] + +fix check allowing 5Ghz settings, only disabled and +2.4Ghz enabled states are allowed. Fix comment +accordingly. + +Acked-by: Hans de Goede +Signed-off-by: Fabio Aiuto +Link: https://lore.kernel.org/r/df7d0ecc02ac7a27e568768523dd7b3f34acd551.1624367072.git.fabioaiuto83@gmail.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +index 6d0d0beed402..0cd5608e6496 100644 +--- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c ++++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +@@ -2602,10 +2602,9 @@ static int rtw_dbg_port(struct net_device *dev, + case 0x12: /* set rx_stbc */ + { + struct registry_priv *pregpriv = &padapter->registrypriv; +- /* 0: disable, bit(0):enable 2.4g, bit(1):enable 5g, 0x3: enable both 2.4g and 5g */ +- /* default is set to enable 2.4GHZ for IOT issue with bufflao's AP at 5GHZ */ +- if (extra_arg == 0 || extra_arg == 1 || +- extra_arg == 2 || extra_arg == 3) ++ /* 0: disable, bit(0):enable 2.4g */ ++ /* default is set to enable 2.4GHZ */ ++ if (extra_arg == 0 || extra_arg == 1) + pregpriv->rx_stbc = extra_arg; + } + break; +-- +2.30.2 + diff --git a/queue-5.13/staging-rtl8723bs-fix-macro-value-for-2.4ghz-only-de.patch b/queue-5.13/staging-rtl8723bs-fix-macro-value-for-2.4ghz-only-de.patch new file mode 100644 index 00000000000..92e0a2d82f1 --- /dev/null +++ b/queue-5.13/staging-rtl8723bs-fix-macro-value-for-2.4ghz-only-de.patch @@ -0,0 +1,40 @@ +From 145795b2568e93e37279ca874859fa8dc79c0f25 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 22 Jun 2021 15:09:58 +0200 +Subject: staging: rtl8723bs: fix macro value for 2.4Ghz only device + +From: Fabio Aiuto + +[ Upstream commit 6d490a27e23c5fb79b766530016ab8665169498e ] + +fix IQK_Matrix_Settings_NUM macro value to 14 which is +the max channel number value allowed in a 2.4Ghz device. + +Acked-by: Hans de Goede +Signed-off-by: Fabio Aiuto +Link: https://lore.kernel.org/r/0b4a876929949248aa18cb919da3583c65e4ee4e.1624367072.git.fabioaiuto83@gmail.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/staging/rtl8723bs/hal/odm.h | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +diff --git a/drivers/staging/rtl8723bs/hal/odm.h b/drivers/staging/rtl8723bs/hal/odm.h +index ff21343fbe0b..a428b0d7e37c 100644 +--- a/drivers/staging/rtl8723bs/hal/odm.h ++++ b/drivers/staging/rtl8723bs/hal/odm.h +@@ -197,10 +197,7 @@ struct odm_rate_adaptive { + + #define AVG_THERMAL_NUM 8 + #define IQK_Matrix_REG_NUM 8 +-#define IQK_Matrix_Settings_NUM (14 + 24 + 21) /* Channels_2_4G_NUM +- * + Channels_5G_20M_NUM +- * + Channels_5G +- */ ++#define IQK_Matrix_Settings_NUM 14 /* Channels_2_4G_NUM */ + + #define DM_Type_ByFW 0 + #define DM_Type_ByDriver 1 +-- +2.30.2 + diff --git a/queue-5.13/static_call-fix-static_call_text_reserved-vs-__init.patch b/queue-5.13/static_call-fix-static_call_text_reserved-vs-__init.patch new file mode 100644 index 00000000000..3a0097f3ca0 --- /dev/null +++ b/queue-5.13/static_call-fix-static_call_text_reserved-vs-__init.patch @@ -0,0 +1,71 @@ +From ace8bf6550bfb691db1d928e890286115c5facc6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 28 Jun 2021 13:24:11 +0200 +Subject: static_call: Fix static_call_text_reserved() vs __init + +From: Peter Zijlstra + +[ Upstream commit 2bee6d16e4379326b1eea454e68c98b17456769e ] + +It turns out that static_call_text_reserved() was reporting __init +text as being reserved past the time when the __init text was freed +and re-used. + +This is mostly harmless and will at worst result in refusing a kprobe. + +Fixes: 6333e8f73b83 ("static_call: Avoid kprobes on inline static_call()s") +Signed-off-by: Peter Zijlstra (Intel) +Signed-off-by: Ingo Molnar +Reviewed-by: Masami Hiramatsu +Link: https://lore.kernel.org/r/20210628113045.106211657@infradead.org +Signed-off-by: Sasha Levin +--- + kernel/static_call.c | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +diff --git a/kernel/static_call.c b/kernel/static_call.c +index 723fcc9d20db..43ba0b1e0edb 100644 +--- a/kernel/static_call.c ++++ b/kernel/static_call.c +@@ -292,13 +292,15 @@ static int addr_conflict(struct static_call_site *site, void *start, void *end) + + static int __static_call_text_reserved(struct static_call_site *iter_start, + struct static_call_site *iter_stop, +- void *start, void *end) ++ void *start, void *end, bool init) + { + struct static_call_site *iter = iter_start; + + while (iter < iter_stop) { +- if (addr_conflict(iter, start, end)) +- return 1; ++ if (init || !static_call_is_init(iter)) { ++ if (addr_conflict(iter, start, end)) ++ return 1; ++ } + iter++; + } + +@@ -324,7 +326,7 @@ static int __static_call_mod_text_reserved(void *start, void *end) + + ret = __static_call_text_reserved(mod->static_call_sites, + mod->static_call_sites + mod->num_static_call_sites, +- start, end); ++ start, end, mod->state == MODULE_STATE_COMING); + + module_put(mod); + +@@ -459,8 +461,9 @@ static inline int __static_call_mod_text_reserved(void *start, void *end) + + int static_call_text_reserved(void *start, void *end) + { ++ bool init = system_state < SYSTEM_RUNNING; + int ret = __static_call_text_reserved(__start_static_call_sites, +- __stop_static_call_sites, start, end); ++ __stop_static_call_sites, start, end, init); + + if (ret) + return ret; +-- +2.30.2 + diff --git a/queue-5.13/sunrpc-avoid-a-kasan-slab-out-of-bounds-bug-in-xdr_s.patch b/queue-5.13/sunrpc-avoid-a-kasan-slab-out-of-bounds-bug-in-xdr_s.patch new file mode 100644 index 00000000000..514b2251613 --- /dev/null +++ b/queue-5.13/sunrpc-avoid-a-kasan-slab-out-of-bounds-bug-in-xdr_s.patch @@ -0,0 +1,44 @@ +From 33bbb44ccab4c4f9fe3d4655ba2541be53457100 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 9 Jun 2021 17:07:29 -0400 +Subject: sunrpc: Avoid a KASAN slab-out-of-bounds bug in xdr_set_page_base() + +From: Anna Schumaker + +[ Upstream commit 6d1c0f3d28f98ea2736128ed3e46821496dc3a8c ] + +This seems to happen fairly easily during READ_PLUS testing on NFS v4.2. +I found that we could end up accessing xdr->buf->pages[pgnr] with a pgnr +greater than the number of pages in the array. So let's just return +early if we're setting base to a point at the end of the page data and +let xdr_set_tail_base() handle setting up the buffer pointers instead. + +Signed-off-by: Anna Schumaker +Fixes: 8d86e373b0ef ("SUNRPC: Clean up helpers xdr_set_iov() and xdr_set_page_base()") +Signed-off-by: Trond Myklebust +Signed-off-by: Sasha Levin +--- + net/sunrpc/xdr.c | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c +index 3964ff74ee51..ca10ba2626f2 100644 +--- a/net/sunrpc/xdr.c ++++ b/net/sunrpc/xdr.c +@@ -1230,10 +1230,9 @@ static unsigned int xdr_set_page_base(struct xdr_stream *xdr, + void *kaddr; + + maxlen = xdr->buf->page_len; +- if (base >= maxlen) { +- base = maxlen; +- maxlen = 0; +- } else ++ if (base >= maxlen) ++ return 0; ++ else + maxlen -= base; + if (len > maxlen) + len = maxlen; +-- +2.30.2 + diff --git a/queue-5.13/sunrpc-prevent-port-reuse-on-transports-which-don-t-.patch b/queue-5.13/sunrpc-prevent-port-reuse-on-transports-which-don-t-.patch new file mode 100644 index 00000000000..a210db6b5e8 --- /dev/null +++ b/queue-5.13/sunrpc-prevent-port-reuse-on-transports-which-don-t-.patch @@ -0,0 +1,49 @@ +From 268c34678c3341e425c59f7e00af57a28405d44f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 15 Jun 2021 11:18:38 +1000 +Subject: SUNRPC: prevent port reuse on transports which don't request it. + +From: NeilBrown + +[ Upstream commit bc1c56e9bbe92766d017efb5f0a0c71f80da5570 ] + +If an RPC client is created without RPC_CLNT_CREATE_REUSEPORT, it should +not reuse the source port when a TCP connection is re-established. +This is currently implemented by preventing the source port being +recorded after a successful connection (the call to xs_set_srcport()). + +However the source port is also recorded after a successful bind in xs_bind(). +This may not be needed at all and certainly is not wanted when +RPC_CLNT_CREATE_REUSEPORT wasn't requested. + +So avoid that assignment when xprt.reuseport is not set. + +With this change, NFSv4.1 and later mounts use a different port number on +each connection. This is helpful with some firewalls which don't cope +well with port reuse. + +Signed-off-by: NeilBrown +Fixes: e6237b6feb37 ("NFSv4.1: Don't rebind to the same source port when reconnecting to the server") +Signed-off-by: Trond Myklebust +Signed-off-by: Sasha Levin +--- + net/sunrpc/xprtsock.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c +index 316d04945587..3228b7a1836a 100644 +--- a/net/sunrpc/xprtsock.c ++++ b/net/sunrpc/xprtsock.c +@@ -1689,7 +1689,8 @@ static int xs_bind(struct sock_xprt *transport, struct socket *sock) + err = kernel_bind(sock, (struct sockaddr *)&myaddr, + transport->xprt.addrlen); + if (err == 0) { +- transport->srcport = port; ++ if (transport->xprt.reuseport) ++ transport->srcport = port; + break; + } + last = port; +-- +2.30.2 + diff --git a/queue-5.13/thermal-drivers-rcar_gen3_thermal-fix-coefficient-ca.patch b/queue-5.13/thermal-drivers-rcar_gen3_thermal-fix-coefficient-ca.patch new file mode 100644 index 00000000000..090a6d97679 --- /dev/null +++ b/queue-5.13/thermal-drivers-rcar_gen3_thermal-fix-coefficient-ca.patch @@ -0,0 +1,45 @@ +From 20e61ba708080a03c137b0603c8aa7072d865e6c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 5 Jun 2021 10:52:11 +0200 +Subject: thermal/drivers/rcar_gen3_thermal: Fix coefficient calculations +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Niklas Söderlund + +[ Upstream commit 8946187ab57ffd02088e50256c73dd31f49db06d ] + +The fixed value of 157 used in the calculations are only correct for +M3-W, on other Gen3 SoC it should be 167. The constant can be derived +correctly from the static TJ_3 constant and the SoC specific TJ_1 value. +Update the calculation be correct on all Gen3 SoCs. + +Fixes: 4eb39f79ef44 ("thermal: rcar_gen3_thermal: Update value of Tj_1") +Reported-by: Yoshihiro Shimoda +Signed-off-by: Niklas Söderlund +Reviewed-by: Yoshihiro Shimoda +Reviewed-by: Geert Uytterhoeven +Signed-off-by: Daniel Lezcano +Link: https://lore.kernel.org/r/20210605085211.564909-1-niklas.soderlund+renesas@ragnatech.se +Signed-off-by: Sasha Levin +--- + drivers/thermal/rcar_gen3_thermal.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen3_thermal.c +index e1e412348076..1a60adb1d30a 100644 +--- a/drivers/thermal/rcar_gen3_thermal.c ++++ b/drivers/thermal/rcar_gen3_thermal.c +@@ -143,7 +143,7 @@ static void rcar_gen3_thermal_calc_coefs(struct rcar_gen3_thermal_tsc *tsc, + * Division is not scaled in BSP and if scaled it might overflow + * the dividend (4095 * 4095 << 14 > INT_MAX) so keep it unscaled + */ +- tsc->tj_t = (FIXPT_INT((ptat[1] - ptat[2]) * 157) ++ tsc->tj_t = (FIXPT_INT((ptat[1] - ptat[2]) * (ths_tj_1 - TJ_3)) + / (ptat[0] - ptat[2])) + FIXPT_INT(TJ_3); + + tsc->coef.a1 = FIXPT_DIV(FIXPT_INT(thcode[1] - thcode[2]), +-- +2.30.2 + diff --git a/queue-5.13/thermal-drivers-sprd-add-missing-module_device_table.patch b/queue-5.13/thermal-drivers-sprd-add-missing-module_device_table.patch new file mode 100644 index 00000000000..bf865f8efff --- /dev/null +++ b/queue-5.13/thermal-drivers-sprd-add-missing-module_device_table.patch @@ -0,0 +1,38 @@ +From 7a0dd2f76a876e5e19a6adbf7b42d8dbf2c90d37 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 12 May 2021 17:37:52 +0800 +Subject: thermal/drivers/sprd: Add missing MODULE_DEVICE_TABLE + +From: Chunyan Zhang + +[ Upstream commit 4d57fd9aeaa013a245bf1fade81e2c30a5efd491 ] + +MODULE_DEVICE_TABLE is used to extract the device information out of the +driver and builds a table when being compiled. If using this macro, +kernel can find the driver if available when the device is plugged in, +and then loads that driver and initializes the device. + +Fixes: 554fdbaf19b18 ("thermal: sprd: Add Spreadtrum thermal driver support") +Signed-off-by: Chunyan Zhang +Signed-off-by: Daniel Lezcano +Link: https://lore.kernel.org/r/20210512093752.243168-1-zhang.lyra@gmail.com +Signed-off-by: Sasha Levin +--- + drivers/thermal/sprd_thermal.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/thermal/sprd_thermal.c b/drivers/thermal/sprd_thermal.c +index 3682edb2f466..fe06cccf14b3 100644 +--- a/drivers/thermal/sprd_thermal.c ++++ b/drivers/thermal/sprd_thermal.c +@@ -532,6 +532,7 @@ static const struct of_device_id sprd_thermal_of_match[] = { + { .compatible = "sprd,ums512-thermal", .data = &ums512_data }, + { }, + }; ++MODULE_DEVICE_TABLE(of, sprd_thermal_of_match); + + static const struct dev_pm_ops sprd_thermal_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(sprd_thm_suspend, sprd_thm_resume) +-- +2.30.2 + diff --git a/queue-5.13/thunderbolt-fix-drom-handling-for-usb4-drom.patch b/queue-5.13/thunderbolt-fix-drom-handling-for-usb4-drom.patch new file mode 100644 index 00000000000..a5c15cb041e --- /dev/null +++ b/queue-5.13/thunderbolt-fix-drom-handling-for-usb4-drom.patch @@ -0,0 +1,86 @@ +From c9067004403852eff7c8454981755d11fb8a14ef Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 14 Jun 2021 16:52:10 +0300 +Subject: thunderbolt: Fix DROM handling for USB4 DROM + +From: Gil Fine + +[ Upstream commit b18f901382fdb74a138a0bf30458c54a023a1d86 ] + +DROM for USB4 host/device has a shorter header than Thunderbolt DROM +header. This patch addresses host/device with USB4 DROM (According to spec: +Universal Serial Bus 4 (USB4) Device ROM Specification, Rev 1.0, Feb-2021). + +While there correct the data_len field to be 12 bits and rename +__unknown1 to reserved following the spec. + +Signed-off-by: Gil Fine +Signed-off-by: Mika Westerberg +Signed-off-by: Sasha Levin +--- + drivers/thunderbolt/eeprom.c | 19 +++++++++++-------- + 1 file changed, 11 insertions(+), 8 deletions(-) + +diff --git a/drivers/thunderbolt/eeprom.c b/drivers/thunderbolt/eeprom.c +index 46d0906a3070..470885e6f1c8 100644 +--- a/drivers/thunderbolt/eeprom.c ++++ b/drivers/thunderbolt/eeprom.c +@@ -214,7 +214,10 @@ static u32 tb_crc32(void *data, size_t len) + return ~__crc32c_le(~0, data, len); + } + +-#define TB_DROM_DATA_START 13 ++#define TB_DROM_DATA_START 13 ++#define TB_DROM_HEADER_SIZE 22 ++#define USB4_DROM_HEADER_SIZE 16 ++ + struct tb_drom_header { + /* BYTE 0 */ + u8 uid_crc8; /* checksum for uid */ +@@ -224,9 +227,9 @@ struct tb_drom_header { + u32 data_crc32; /* checksum for data_len bytes starting at byte 13 */ + /* BYTE 13 */ + u8 device_rom_revision; /* should be <= 1 */ +- u16 data_len:10; +- u8 __unknown1:6; +- /* BYTES 16-21 */ ++ u16 data_len:12; ++ u8 reserved:4; ++ /* BYTES 16-21 - Only for TBT DROM, nonexistent in USB4 DROM */ + u16 vendor_id; + u16 model_id; + u8 model_rev; +@@ -401,10 +404,10 @@ static int tb_drom_parse_entry_port(struct tb_switch *sw, + * + * Drom must have been copied to sw->drom. + */ +-static int tb_drom_parse_entries(struct tb_switch *sw) ++static int tb_drom_parse_entries(struct tb_switch *sw, size_t header_size) + { + struct tb_drom_header *header = (void *) sw->drom; +- u16 pos = sizeof(*header); ++ u16 pos = header_size; + u16 drom_size = header->data_len + TB_DROM_DATA_START; + int res; + +@@ -566,7 +569,7 @@ static int tb_drom_parse(struct tb_switch *sw) + header->data_crc32, crc); + } + +- return tb_drom_parse_entries(sw); ++ return tb_drom_parse_entries(sw, TB_DROM_HEADER_SIZE); + } + + static int usb4_drom_parse(struct tb_switch *sw) +@@ -583,7 +586,7 @@ static int usb4_drom_parse(struct tb_switch *sw) + return -EINVAL; + } + +- return tb_drom_parse_entries(sw); ++ return tb_drom_parse_entries(sw, USB4_DROM_HEADER_SIZE); + } + + /** +-- +2.30.2 + diff --git a/queue-5.13/tty-serial-8250-serial_cs-fix-a-memory-leak-in-error.patch b/queue-5.13/tty-serial-8250-serial_cs-fix-a-memory-leak-in-error.patch new file mode 100644 index 00000000000..58570cea3d6 --- /dev/null +++ b/queue-5.13/tty-serial-8250-serial_cs-fix-a-memory-leak-in-error.patch @@ -0,0 +1,55 @@ +From e5115ba7520ad35b87145dc99772ef480c5a2546 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 25 May 2021 21:44:04 +0200 +Subject: tty: serial: 8250: serial_cs: Fix a memory leak in error handling + path + +From: Christophe JAILLET + +[ Upstream commit fad92b11047a748c996ebd6cfb164a63814eeb2e ] + +In the probe function, if the final 'serial_config()' fails, 'info' is +leaking. + +Add a resource handling path to free this memory. + +Signed-off-by: Christophe JAILLET +Link: https://lore.kernel.org/r/dc25f96b7faebf42e60fe8d02963c941cf4d8124.1621971720.git.christophe.jaillet@wanadoo.fr +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/tty/serial/8250/serial_cs.c | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/drivers/tty/serial/8250/serial_cs.c b/drivers/tty/serial/8250/serial_cs.c +index 53f2697014a0..dc2ef05a10eb 100644 +--- a/drivers/tty/serial/8250/serial_cs.c ++++ b/drivers/tty/serial/8250/serial_cs.c +@@ -306,6 +306,7 @@ static int serial_resume(struct pcmcia_device *link) + static int serial_probe(struct pcmcia_device *link) + { + struct serial_info *info; ++ int ret; + + dev_dbg(&link->dev, "serial_attach()\n"); + +@@ -320,7 +321,15 @@ static int serial_probe(struct pcmcia_device *link) + if (do_sound) + link->config_flags |= CONF_ENABLE_SPKR; + +- return serial_config(link); ++ ret = serial_config(link); ++ if (ret) ++ goto free_info; ++ ++ return 0; ++ ++free_info: ++ kfree(info); ++ return ret; + } + + static void serial_detach(struct pcmcia_device *link) +-- +2.30.2 + diff --git a/queue-5.13/tty-serial-fsl_lpuart-fix-the-potential-risk-of-divi.patch b/queue-5.13/tty-serial-fsl_lpuart-fix-the-potential-risk-of-divi.patch new file mode 100644 index 00000000000..42a376b4810 --- /dev/null +++ b/queue-5.13/tty-serial-fsl_lpuart-fix-the-potential-risk-of-divi.patch @@ -0,0 +1,41 @@ +From 2c0d223fcd59e5b30a91b01d10886fc657a6a56b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 27 Apr 2021 10:12:26 +0800 +Subject: tty: serial: fsl_lpuart: fix the potential risk of division or modulo + by zero + +From: Sherry Sun + +[ Upstream commit fcb10ee27fb91b25b68d7745db9817ecea9f1038 ] + +We should be very careful about the register values that will be used +for division or modulo operations, althrough the possibility that the +UARTBAUD register value is zero is very low, but we had better to deal +with the "bad data" of hardware in advance to avoid division or modulo +by zero leading to undefined kernel behavior. + +Signed-off-by: Sherry Sun +Link: https://lore.kernel.org/r/20210427021226.27468-1-sherry.sun@nxp.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/tty/serial/fsl_lpuart.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c +index 9c78e43e669d..4cad2ac00e9f 100644 +--- a/drivers/tty/serial/fsl_lpuart.c ++++ b/drivers/tty/serial/fsl_lpuart.c +@@ -2404,6 +2404,9 @@ lpuart32_console_get_options(struct lpuart_port *sport, int *baud, + + bd = lpuart32_read(&sport->port, UARTBAUD); + bd &= UARTBAUD_SBR_MASK; ++ if (!bd) ++ return; ++ + sbr = bd; + uartclk = lpuart_get_baud_clk_rate(sport); + /* +-- +2.30.2 + diff --git a/queue-5.13/ubifs-journal-fix-error-return-code-in-ubifs_jnl_wri.patch b/queue-5.13/ubifs-journal-fix-error-return-code-in-ubifs_jnl_wri.patch new file mode 100644 index 00000000000..6b47f0fe23d --- /dev/null +++ b/queue-5.13/ubifs-journal-fix-error-return-code-in-ubifs_jnl_wri.patch @@ -0,0 +1,36 @@ +From 541a36bbd2b7c2632596e447d09b3f1a398704c7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 8 May 2021 11:33:13 +0800 +Subject: ubifs: journal: Fix error return code in ubifs_jnl_write_inode() + +From: Zhen Lei + +[ Upstream commit a2c2a622d41168f9fea2aa3f76b9fbaa88531aac ] + +Fix to return a negative error code from the error handling case instead +of 0, as done elsewhere in this function. + +Fixes: 9ca2d7326444 ("ubifs: Limit number of xattrs per inode") +Reported-by: Hulk Robot +Signed-off-by: Zhen Lei +Signed-off-by: Richard Weinberger +Signed-off-by: Sasha Levin +--- + fs/ubifs/journal.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/fs/ubifs/journal.c b/fs/ubifs/journal.c +index 2857e64d673d..230717384a38 100644 +--- a/fs/ubifs/journal.c ++++ b/fs/ubifs/journal.c +@@ -882,6 +882,7 @@ int ubifs_jnl_write_inode(struct ubifs_info *c, const struct inode *inode) + struct ubifs_dent_node *xent, *pxent = NULL; + + if (ui->xattr_cnt > ubifs_xattr_max_cnt(c)) { ++ err = -EPERM; + ubifs_err(c, "Cannot delete inode, it has too much xattrs!"); + goto out_release; + } +-- +2.30.2 + diff --git a/queue-5.13/ubifs-set-clear-i_linkable-under-i_lock-for-whiteout.patch b/queue-5.13/ubifs-set-clear-i_linkable-under-i_lock-for-whiteout.patch new file mode 100644 index 00000000000..a19ac76bb2b --- /dev/null +++ b/queue-5.13/ubifs-set-clear-i_linkable-under-i_lock-for-whiteout.patch @@ -0,0 +1,79 @@ +From cf981ac976841aadfb90c304596377b1e57b968f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 18 Jun 2021 16:11:03 +0800 +Subject: ubifs: Set/Clear I_LINKABLE under i_lock for whiteout inode + +From: Zhihao Cheng + +[ Upstream commit a801fcfeef96702fa3f9b22ad56c5eb1989d9221 ] + +xfstests-generic/476 reports a warning message as below: + +WARNING: CPU: 2 PID: 30347 at fs/inode.c:361 inc_nlink+0x52/0x70 +Call Trace: + do_rename+0x502/0xd40 [ubifs] + ubifs_rename+0x8b/0x180 [ubifs] + vfs_rename+0x476/0x1080 + do_renameat2+0x67c/0x7b0 + __x64_sys_renameat2+0x6e/0x90 + do_syscall_64+0x66/0xe0 + entry_SYSCALL_64_after_hwframe+0x44/0xae + +Following race case can cause this: + rename_whiteout(Thread 1) wb_workfn(Thread 2) +ubifs_rename + do_rename + __writeback_single_inode + spin_lock(&inode->i_lock) + whiteout->i_state |= I_LINKABLE + inode->i_state &= ~dirty; +---- How race happens on i_state: + (tmp = whiteout->i_state | I_LINKABLE) + (tmp = inode->i_state & ~dirty) + (whiteout->i_state = tmp) + (inode->i_state = tmp) +---- + spin_unlock(&inode->i_lock) + inc_nlink(whiteout) + WARN_ON(!(inode->i_state & I_LINKABLE)) !!! + +Fix to add i_lock to avoid i_state update race condition. + +Fixes: 9e0a1fff8db56ea ("ubifs: Implement RENAME_WHITEOUT") +Signed-off-by: Zhihao Cheng +Signed-off-by: Richard Weinberger +Signed-off-by: Sasha Levin +--- + fs/ubifs/dir.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c +index 5bd8482e660a..7c61d0ec0159 100644 +--- a/fs/ubifs/dir.c ++++ b/fs/ubifs/dir.c +@@ -1337,7 +1337,10 @@ static int do_rename(struct inode *old_dir, struct dentry *old_dentry, + goto out_release; + } + ++ spin_lock(&whiteout->i_lock); + whiteout->i_state |= I_LINKABLE; ++ spin_unlock(&whiteout->i_lock); ++ + whiteout_ui = ubifs_inode(whiteout); + whiteout_ui->data = dev; + whiteout_ui->data_len = ubifs_encode_dev(dev, MKDEV(0, 0)); +@@ -1430,7 +1433,11 @@ static int do_rename(struct inode *old_dir, struct dentry *old_dentry, + + inc_nlink(whiteout); + mark_inode_dirty(whiteout); ++ ++ spin_lock(&whiteout->i_lock); + whiteout->i_state &= ~I_LINKABLE; ++ spin_unlock(&whiteout->i_lock); ++ + iput(whiteout); + } + +-- +2.30.2 + diff --git a/queue-5.13/um-fix-error-return-code-in-slip_open.patch b/queue-5.13/um-fix-error-return-code-in-slip_open.patch new file mode 100644 index 00000000000..4ec156d15b0 --- /dev/null +++ b/queue-5.13/um-fix-error-return-code-in-slip_open.patch @@ -0,0 +1,39 @@ +From bc64a67833c18c2da1d20293be04d2dd9a560fbe Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 8 May 2021 11:13:54 +0800 +Subject: um: fix error return code in slip_open() + +From: Zhen Lei + +[ Upstream commit b77e81fbe5f5fb4ad9a61ec80f6d1e30b6da093a ] + +Fix to return a negative error code from the error handling case instead +of 0, as done elsewhere in this function. + +Fixes: a3c77c67a443 ("[PATCH] uml: slirp and slip driver cleanups and fixes") +Reported-by: Hulk Robot +Signed-off-by: Zhen Lei +Acked-By: anton.ivanov@cambridgegreys.com +Signed-off-by: Richard Weinberger +Signed-off-by: Sasha Levin +--- + arch/um/drivers/slip_user.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/arch/um/drivers/slip_user.c b/arch/um/drivers/slip_user.c +index 482a19c5105c..7334019c9e60 100644 +--- a/arch/um/drivers/slip_user.c ++++ b/arch/um/drivers/slip_user.c +@@ -145,7 +145,8 @@ static int slip_open(void *data) + } + sfd = err; + +- if (set_up_tty(sfd)) ++ err = set_up_tty(sfd); ++ if (err) + goto out_close2; + + pri->slave = sfd; +-- +2.30.2 + diff --git a/queue-5.13/um-fix-error-return-code-in-winch_tramp.patch b/queue-5.13/um-fix-error-return-code-in-winch_tramp.patch new file mode 100644 index 00000000000..86ccbe8f34b --- /dev/null +++ b/queue-5.13/um-fix-error-return-code-in-winch_tramp.patch @@ -0,0 +1,39 @@ +From 1057e3852f36833ce9690d23df2d8fa3bfe0806c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 8 May 2021 11:22:39 +0800 +Subject: um: fix error return code in winch_tramp() + +From: Zhen Lei + +[ Upstream commit ccf1236ecac476d9d2704866d9a476c86e387971 ] + +Fix to return a negative error code from the error handling case instead +of 0, as done elsewhere in this function. + +Fixes: 89df6bfc0405 ("uml: DEBUG_SHIRQ fixes") +Reported-by: Hulk Robot +Signed-off-by: Zhen Lei +Acked-By: anton.ivanov@cambridgegreys.com +Signed-off-by: Richard Weinberger +Signed-off-by: Sasha Levin +--- + arch/um/drivers/chan_user.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/arch/um/drivers/chan_user.c b/arch/um/drivers/chan_user.c +index d8845d4aac6a..6040817c036f 100644 +--- a/arch/um/drivers/chan_user.c ++++ b/arch/um/drivers/chan_user.c +@@ -256,7 +256,8 @@ static int winch_tramp(int fd, struct tty_port *port, int *fd_out, + goto out_close; + } + +- if (os_set_fd_block(*fd_out, 0)) { ++ err = os_set_fd_block(*fd_out, 0); ++ if (err) { + printk(UM_KERN_ERR "winch_tramp: failed to set thread_fd " + "non-blocking.\n"); + goto out_close; +-- +2.30.2 + diff --git a/queue-5.13/um-fix-stack-pointer-alignment.patch b/queue-5.13/um-fix-stack-pointer-alignment.patch new file mode 100644 index 00000000000..32f0cdbd0ca --- /dev/null +++ b/queue-5.13/um-fix-stack-pointer-alignment.patch @@ -0,0 +1,174 @@ +From bcfbe2a276f82028a226ff7fa8ae4261fe54d6cd Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 20 Apr 2021 00:56:10 -0500 +Subject: um: Fix stack pointer alignment + +From: YiFei Zhu + +[ Upstream commit 558f9b2f94dbd2d5c5c8292aa13e081cc11ea7d9 ] + +GCC assumes that stack is aligned to 16-byte on call sites [1]. +Since GCC 8, GCC began using 16-byte aligned SSE instructions to +implement assignments to structs on stack. When +CC_OPTIMIZE_FOR_PERFORMANCE is enabled, this affects +os-Linux/sigio.c, write_sigio_thread: + + struct pollfds *fds, tmp; + tmp = current_poll; + +Note that struct pollfds is exactly 16 bytes in size. +GCC 8+ generates assembly similar to: + + movdqa (%rdi),%xmm0 + movaps %xmm0,-0x50(%rbp) + +This is an issue, because movaps will #GP if -0x50(%rbp) is not +aligned to 16 bytes [2], and how rbp gets assigned to is via glibc +clone thread_start, then function prologue, going though execution +trace similar to (showing only relevant instructions): + + sub $0x10,%rsi + mov %rcx,0x8(%rsi) + mov %rdi,(%rsi) + syscall + pop %rax + pop %rdi + callq *%rax + push %rbp + mov %rsp,%rbp + +The stack pointer always points to the topmost element on stack, +rather then the space right above the topmost. On push, the +pointer decrements first before writing to the memory pointed to +by it. Therefore, there is no need to have the stack pointer +pointer always point to valid memory unless the stack is poped; +so the `- sizeof(void *)` in the code is unnecessary. + +On the other hand, glibc reserves the 16 bytes it needs on stack +and pops itself, so by the call instruction the stack pointer +is exactly the caller-supplied sp. It then push the 16 bytes of +the return address and the saved stack pointer, so the base +pointer will be 16-byte aligned if and only if the caller +supplied sp is 16-byte aligned. Therefore, the caller must supply +a 16-byte aligned pointer, which `stack + UM_KERN_PAGE_SIZE` +already satisfies. + +On a side note, musl is unaffected by this issue because it forces +16 byte alignment via `and $-16,%rsi` in its clone wrapper. +Similarly, glibc i386 is also unaffected because it has +`andl $0xfffffff0, %ecx`. + +To reproduce this bug, enable CONFIG_UML_RTC and +CC_OPTIMIZE_FOR_PERFORMANCE. uml_rtc will call +add_sigio_fd which will then cause write_sigio_thread to either go +into segfault loop or panic with "Segfault with no mm". + +Similarly, signal stacks will be aligned by the host kernel upon +signal delivery. `- sizeof(void *)` to sigaltstack is +unconventional and extraneous. + +On a related note, initialization of longjmp buffers do require +`- sizeof(void *)`. This is to account for the return address +that would have been pushed to the stack at the call site. + +The reason for uml to respect 16-byte alignment, rather than +telling GCC to assume 8-byte alignment like the host kernel since +commit d9b0cde91c60 ("x86-64, gcc: Use +-mpreferred-stack-boundary=3 if supported"), is because uml links +against libc. There is no reason to assume libc is also compiled +with that flag and assumes 8-byte alignment rather than 16-byte. + +[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=40838 +[2] https://c9x.me/x86/html/file_module_x86_id_180.html + +Signed-off-by: YiFei Zhu +Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") +Reviewed-by: Johannes Berg +Signed-off-by: Richard Weinberger +Signed-off-by: Sasha Levin +--- + arch/um/drivers/ubd_kern.c | 3 +-- + arch/um/kernel/skas/clone.c | 2 +- + arch/um/os-Linux/helper.c | 4 ++-- + arch/um/os-Linux/signal.c | 2 +- + arch/um/os-Linux/skas/process.c | 2 +- + 5 files changed, 6 insertions(+), 7 deletions(-) + +diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c +index 8e0b43cf089f..cbd4f00fe77e 100644 +--- a/arch/um/drivers/ubd_kern.c ++++ b/arch/um/drivers/ubd_kern.c +@@ -1242,8 +1242,7 @@ static int __init ubd_driver_init(void){ + * enough. So use anyway the io thread. */ + } + stack = alloc_stack(0, 0); +- io_pid = start_io_thread(stack + PAGE_SIZE - sizeof(void *), +- &thread_fd); ++ io_pid = start_io_thread(stack + PAGE_SIZE, &thread_fd); + if(io_pid < 0){ + printk(KERN_ERR + "ubd : Failed to start I/O thread (errno = %d) - " +diff --git a/arch/um/kernel/skas/clone.c b/arch/um/kernel/skas/clone.c +index 592cdb138441..5afac0fef24e 100644 +--- a/arch/um/kernel/skas/clone.c ++++ b/arch/um/kernel/skas/clone.c +@@ -29,7 +29,7 @@ stub_clone_handler(void) + long err; + + err = stub_syscall2(__NR_clone, CLONE_PARENT | CLONE_FILES | SIGCHLD, +- (unsigned long)data + UM_KERN_PAGE_SIZE / 2 - sizeof(void *)); ++ (unsigned long)data + UM_KERN_PAGE_SIZE / 2); + if (err) { + data->parent_err = err; + goto done; +diff --git a/arch/um/os-Linux/helper.c b/arch/um/os-Linux/helper.c +index 9fa6e4187d4f..32e88baf18dd 100644 +--- a/arch/um/os-Linux/helper.c ++++ b/arch/um/os-Linux/helper.c +@@ -64,7 +64,7 @@ int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv) + goto out_close; + } + +- sp = stack + UM_KERN_PAGE_SIZE - sizeof(void *); ++ sp = stack + UM_KERN_PAGE_SIZE; + data.pre_exec = pre_exec; + data.pre_data = pre_data; + data.argv = argv; +@@ -120,7 +120,7 @@ int run_helper_thread(int (*proc)(void *), void *arg, unsigned int flags, + if (stack == 0) + return -ENOMEM; + +- sp = stack + UM_KERN_PAGE_SIZE - sizeof(void *); ++ sp = stack + UM_KERN_PAGE_SIZE; + pid = clone(proc, (void *) sp, flags, arg); + if (pid < 0) { + err = -errno; +diff --git a/arch/um/os-Linux/signal.c b/arch/um/os-Linux/signal.c +index 96f511d1aabe..e283f130aadc 100644 +--- a/arch/um/os-Linux/signal.c ++++ b/arch/um/os-Linux/signal.c +@@ -129,7 +129,7 @@ void set_sigstack(void *sig_stack, int size) + stack_t stack = { + .ss_flags = 0, + .ss_sp = sig_stack, +- .ss_size = size - sizeof(void *) ++ .ss_size = size + }; + + if (sigaltstack(&stack, NULL) != 0) +diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c +index fba674fac8b7..87d3129e7362 100644 +--- a/arch/um/os-Linux/skas/process.c ++++ b/arch/um/os-Linux/skas/process.c +@@ -327,7 +327,7 @@ int start_userspace(unsigned long stub_stack) + } + + /* set stack pointer to the end of the stack page, so it can grow downwards */ +- sp = (unsigned long) stack + UM_KERN_PAGE_SIZE - sizeof(void *); ++ sp = (unsigned long)stack + UM_KERN_PAGE_SIZE; + + flags = CLONE_FILES | SIGCHLD; + +-- +2.30.2 + diff --git a/queue-5.13/usb-common-usb-conn-gpio-fix-null-pointer-dereferenc.patch b/queue-5.13/usb-common-usb-conn-gpio-fix-null-pointer-dereferenc.patch new file mode 100644 index 00000000000..78006372ccd --- /dev/null +++ b/queue-5.13/usb-common-usb-conn-gpio-fix-null-pointer-dereferenc.patch @@ -0,0 +1,98 @@ +From 40022385532beb10cbb105311b4252fe10e88938 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 19 May 2021 14:39:44 +0800 +Subject: usb: common: usb-conn-gpio: fix NULL pointer dereference of charger + +From: Chunfeng Yun + +[ Upstream commit 880287910b1892ed2cb38977893b947382a09d21 ] + +When power on system with OTG cable, IDDIG's interrupt arises before +the charger registration, it will cause a NULL pointer dereference, +fix the issue by registering the power supply before requesting +IDDIG/VBUS irq. + +Signed-off-by: Chunfeng Yun +Link: https://lore.kernel.org/r/1621406386-18838-1-git-send-email-chunfeng.yun@mediatek.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/usb/common/usb-conn-gpio.c | 44 ++++++++++++++++++------------ + 1 file changed, 26 insertions(+), 18 deletions(-) + +diff --git a/drivers/usb/common/usb-conn-gpio.c b/drivers/usb/common/usb-conn-gpio.c +index 6c4e3a19f42c..c9545a4eff66 100644 +--- a/drivers/usb/common/usb-conn-gpio.c ++++ b/drivers/usb/common/usb-conn-gpio.c +@@ -149,14 +149,32 @@ static int usb_charger_get_property(struct power_supply *psy, + return 0; + } + +-static int usb_conn_probe(struct platform_device *pdev) ++static int usb_conn_psy_register(struct usb_conn_info *info) + { +- struct device *dev = &pdev->dev; +- struct power_supply_desc *desc; +- struct usb_conn_info *info; ++ struct device *dev = info->dev; ++ struct power_supply_desc *desc = &info->desc; + struct power_supply_config cfg = { + .of_node = dev->of_node, + }; ++ ++ desc->name = "usb-charger"; ++ desc->properties = usb_charger_properties; ++ desc->num_properties = ARRAY_SIZE(usb_charger_properties); ++ desc->get_property = usb_charger_get_property; ++ desc->type = POWER_SUPPLY_TYPE_USB; ++ cfg.drv_data = info; ++ ++ info->charger = devm_power_supply_register(dev, desc, &cfg); ++ if (IS_ERR(info->charger)) ++ dev_err(dev, "Unable to register charger\n"); ++ ++ return PTR_ERR_OR_ZERO(info->charger); ++} ++ ++static int usb_conn_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct usb_conn_info *info; + bool need_vbus = true; + int ret = 0; + +@@ -218,6 +236,10 @@ static int usb_conn_probe(struct platform_device *pdev) + return PTR_ERR(info->role_sw); + } + ++ ret = usb_conn_psy_register(info); ++ if (ret) ++ goto put_role_sw; ++ + if (info->id_gpiod) { + info->id_irq = gpiod_to_irq(info->id_gpiod); + if (info->id_irq < 0) { +@@ -252,20 +274,6 @@ static int usb_conn_probe(struct platform_device *pdev) + } + } + +- desc = &info->desc; +- desc->name = "usb-charger"; +- desc->properties = usb_charger_properties; +- desc->num_properties = ARRAY_SIZE(usb_charger_properties); +- desc->get_property = usb_charger_get_property; +- desc->type = POWER_SUPPLY_TYPE_USB; +- cfg.drv_data = info; +- +- info->charger = devm_power_supply_register(dev, desc, &cfg); +- if (IS_ERR(info->charger)) { +- dev_err(dev, "Unable to register charger\n"); +- return PTR_ERR(info->charger); +- } +- + platform_set_drvdata(pdev, info); + + /* Perform initial detection */ +-- +2.30.2 + diff --git a/queue-5.13/usb-dwc3-pci-fix-define-for-intel-elkhart-lake.patch b/queue-5.13/usb-dwc3-pci-fix-define-for-intel-elkhart-lake.patch new file mode 100644 index 00000000000..789af8e9e5c --- /dev/null +++ b/queue-5.13/usb-dwc3-pci-fix-define-for-intel-elkhart-lake.patch @@ -0,0 +1,58 @@ +From 4e680607d3bafbe9597056f5f53f93c30b698ff0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 12 May 2021 16:59:01 +0300 +Subject: usb: dwc3: pci: Fix DEFINE for Intel Elkhart Lake + +From: Raymond Tan + +[ Upstream commit 457d22850b27de3aea336108272d08602c55fdf7 ] + +There's no separate low power (LP) version of Elkhart Lake, thus +this patch updates the PCI Device ID DEFINE to indicate this. + +Acked-by: Felipe Balbi +Signed-off-by: Raymond Tan +Signed-off-by: Heikki Krogerus +Link: https://lore.kernel.org/r/20210512135901.28495-1-heikki.krogerus@linux.intel.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/usb/dwc3/dwc3-pci.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c +index 1e51460938b8..2b37bdd39a74 100644 +--- a/drivers/usb/dwc3/dwc3-pci.c ++++ b/drivers/usb/dwc3/dwc3-pci.c +@@ -36,7 +36,7 @@ + #define PCI_DEVICE_ID_INTEL_CNPH 0xa36e + #define PCI_DEVICE_ID_INTEL_CNPV 0xa3b0 + #define PCI_DEVICE_ID_INTEL_ICLLP 0x34ee +-#define PCI_DEVICE_ID_INTEL_EHLLP 0x4b7e ++#define PCI_DEVICE_ID_INTEL_EHL 0x4b7e + #define PCI_DEVICE_ID_INTEL_TGPLP 0xa0ee + #define PCI_DEVICE_ID_INTEL_TGPH 0x43ee + #define PCI_DEVICE_ID_INTEL_JSP 0x4dee +@@ -167,7 +167,7 @@ static int dwc3_pci_quirks(struct dwc3_pci *dwc) + if (pdev->vendor == PCI_VENDOR_ID_INTEL) { + if (pdev->device == PCI_DEVICE_ID_INTEL_BXT || + pdev->device == PCI_DEVICE_ID_INTEL_BXT_M || +- pdev->device == PCI_DEVICE_ID_INTEL_EHLLP) { ++ pdev->device == PCI_DEVICE_ID_INTEL_EHL) { + guid_parse(PCI_INTEL_BXT_DSM_GUID, &dwc->guid); + dwc->has_dsm_for_pm = true; + } +@@ -375,8 +375,8 @@ static const struct pci_device_id dwc3_pci_id_table[] = { + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ICLLP), + (kernel_ulong_t) &dwc3_pci_intel_swnode, }, + +- { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_EHLLP), +- (kernel_ulong_t) &dwc3_pci_intel_swnode }, ++ { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_EHL), ++ (kernel_ulong_t) &dwc3_pci_intel_swnode, }, + + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_TGPLP), + (kernel_ulong_t) &dwc3_pci_intel_swnode, }, +-- +2.30.2 + diff --git a/queue-5.13/usb-gadget-f_hid-fix-endianness-issue-with-descripto.patch b/queue-5.13/usb-gadget-f_hid-fix-endianness-issue-with-descripto.patch new file mode 100644 index 00000000000..892d2178680 --- /dev/null +++ b/queue-5.13/usb-gadget-f_hid-fix-endianness-issue-with-descripto.patch @@ -0,0 +1,45 @@ +From 0a7b95b24e3be1f31fd3bd5beeaa87eb7054d3ec Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 17 Jun 2021 19:27:55 +0300 +Subject: usb: gadget: f_hid: fix endianness issue with descriptors + +From: Ruslan Bilovol + +[ Upstream commit 33cb46c4676d01956811b68a29157ea969a5df70 ] + +Running sparse checker it shows warning message about +incorrect endianness used for descriptor initialization: + +| f_hid.c:91:43: warning: incorrect type in initializer (different base types) +| f_hid.c:91:43: expected restricted __le16 [usertype] bcdHID +| f_hid.c:91:43: got int + +Fixing issue with cpu_to_le16() macro, however this is not a real issue +as the value is the same both endians. + +Cc: Fabien Chouteau +Cc: Segiy Stetsyuk +Signed-off-by: Ruslan Bilovol +Link: https://lore.kernel.org/r/20210617162755.29676-1-ruslan.bilovol@gmail.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/usb/gadget/function/f_hid.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c +index e55699308117..a82b3de1a54b 100644 +--- a/drivers/usb/gadget/function/f_hid.c ++++ b/drivers/usb/gadget/function/f_hid.c +@@ -88,7 +88,7 @@ static struct usb_interface_descriptor hidg_interface_desc = { + static struct hid_descriptor hidg_desc = { + .bLength = sizeof hidg_desc, + .bDescriptorType = HID_DT_HID, +- .bcdHID = 0x0101, ++ .bcdHID = cpu_to_le16(0x0101), + .bCountryCode = 0x00, + .bNumDescriptors = 0x1, + /*.desc[0].bDescriptorType = DYNAMIC */ +-- +2.30.2 + diff --git a/queue-5.13/usb-gadget-hid-fix-error-return-code-in-hid_bind.patch b/queue-5.13/usb-gadget-hid-fix-error-return-code-in-hid_bind.patch new file mode 100644 index 00000000000..49faf889e36 --- /dev/null +++ b/queue-5.13/usb-gadget-hid-fix-error-return-code-in-hid_bind.patch @@ -0,0 +1,40 @@ +From 55340a0d0ab2e7be3f228c7459fcd747d596b370 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 18 Jun 2021 12:38:35 +0800 +Subject: usb: gadget: hid: fix error return code in hid_bind() + +From: Yang Yingliang + +[ Upstream commit 88693f770bb09c196b1eb5f06a484a254ecb9924 ] + +Fix to return a negative error code from the error handling +case instead of 0. + +Reported-by: Hulk Robot +Signed-off-by: Yang Yingliang +Link: https://lore.kernel.org/r/20210618043835.2641360-1-yangyingliang@huawei.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/usb/gadget/legacy/hid.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/usb/gadget/legacy/hid.c b/drivers/usb/gadget/legacy/hid.c +index c4eda7fe7ab4..5b27d289443f 100644 +--- a/drivers/usb/gadget/legacy/hid.c ++++ b/drivers/usb/gadget/legacy/hid.c +@@ -171,8 +171,10 @@ static int hid_bind(struct usb_composite_dev *cdev) + struct usb_descriptor_header *usb_desc; + + usb_desc = usb_otg_descriptor_alloc(gadget); +- if (!usb_desc) ++ if (!usb_desc) { ++ status = -ENOMEM; + goto put; ++ } + usb_otg_descriptor_init(gadget, usb_desc); + otg_desc[0] = usb_desc; + otg_desc[1] = NULL; +-- +2.30.2 + diff --git a/queue-5.13/vdp-mlx5-fix-setting-the-correct-dma_device.patch b/queue-5.13/vdp-mlx5-fix-setting-the-correct-dma_device.patch new file mode 100644 index 00000000000..e558954e228 --- /dev/null +++ b/queue-5.13/vdp-mlx5-fix-setting-the-correct-dma_device.patch @@ -0,0 +1,81 @@ +From 92afa2afdb6168c8633b1a89052942ab3baf14c9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 6 Jun 2021 08:31:50 +0300 +Subject: vdp/mlx5: Fix setting the correct dma_device + +From: Eli Cohen + +[ Upstream commit 7d23dcdf213c2e5f097eb7eec3148c26eb01d59f ] + +Before SF support was introduced, the DMA device was equal to +mdev->device which was in essence equal to pdev->dev. + +With SF introduction this is no longer true. It has already been +handled for vhost_vdpa since the reference to the dma device can from +within mlx5_vdpa. With virtio_vdpa this broke. To fix this we set the +real dma device when initializing the device. + +In addition, for the sake of consistency, previous references in the +code to the dma device are changed to vdev->dma_dev. + +Fixes: d13a15d544ce5 ("vdpa/mlx5: Use the correct dma device when registering memory") +Signed-off-by: Eli Cohen +Link: https://lore.kernel.org/r/20210606053150.170489-1-elic@nvidia.com +Signed-off-by: Michael S. Tsirkin +Acked-by: Jason Wang +Signed-off-by: Sasha Levin +--- + drivers/vdpa/mlx5/core/mr.c | 9 ++------- + drivers/vdpa/mlx5/net/mlx5_vnet.c | 2 +- + 2 files changed, 3 insertions(+), 8 deletions(-) + +diff --git a/drivers/vdpa/mlx5/core/mr.c b/drivers/vdpa/mlx5/core/mr.c +index 800cfd1967ad..cfa56a58b271 100644 +--- a/drivers/vdpa/mlx5/core/mr.c ++++ b/drivers/vdpa/mlx5/core/mr.c +@@ -219,11 +219,6 @@ static void destroy_indirect_key(struct mlx5_vdpa_dev *mvdev, struct mlx5_vdpa_m + mlx5_vdpa_destroy_mkey(mvdev, &mkey->mkey); + } + +-static struct device *get_dma_device(struct mlx5_vdpa_dev *mvdev) +-{ +- return &mvdev->mdev->pdev->dev; +-} +- + static int map_direct_mr(struct mlx5_vdpa_dev *mvdev, struct mlx5_vdpa_direct_mr *mr, + struct vhost_iotlb *iotlb) + { +@@ -239,7 +234,7 @@ static int map_direct_mr(struct mlx5_vdpa_dev *mvdev, struct mlx5_vdpa_direct_mr + u64 pa; + u64 paend; + struct scatterlist *sg; +- struct device *dma = get_dma_device(mvdev); ++ struct device *dma = mvdev->vdev.dma_dev; + + for (map = vhost_iotlb_itree_first(iotlb, mr->start, mr->end - 1); + map; map = vhost_iotlb_itree_next(map, start, mr->end - 1)) { +@@ -298,7 +293,7 @@ err_map: + + static void unmap_direct_mr(struct mlx5_vdpa_dev *mvdev, struct mlx5_vdpa_direct_mr *mr) + { +- struct device *dma = get_dma_device(mvdev); ++ struct device *dma = mvdev->vdev.dma_dev; + + destroy_direct_mr(mvdev, mr); + dma_unmap_sg_attrs(dma, mr->sg_head.sgl, mr->nsg, DMA_BIDIRECTIONAL, 0); +diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c +index 01eb6c100d2d..2b74e34fbdec 100644 +--- a/drivers/vdpa/mlx5/net/mlx5_vnet.c ++++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c +@@ -2032,7 +2032,7 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name) + goto err_mtu; + } + +- mvdev->vdev.dma_dev = mdev->device; ++ mvdev->vdev.dma_dev = &mdev->pdev->dev; + err = mlx5_vdpa_alloc_resources(&ndev->mvdev); + if (err) + goto err_mpfs; +-- +2.30.2 + diff --git a/queue-5.13/vdpa-mlx5-clear-vq-ready-indication-upon-device-rese.patch b/queue-5.13/vdpa-mlx5-clear-vq-ready-indication-upon-device-rese.patch new file mode 100644 index 00000000000..21fc14329a2 --- /dev/null +++ b/queue-5.13/vdpa-mlx5-clear-vq-ready-indication-upon-device-rese.patch @@ -0,0 +1,56 @@ +From ac04d4bddcafb0054adcf093c5c190d66f386019 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 6 Jun 2021 08:31:28 +0300 +Subject: vdpa/mlx5: Clear vq ready indication upon device reset + +From: Eli Cohen + +[ Upstream commit e3aadf2e1614174dc81d52cbb9dabb77913b11c6 ] + +After device reset, the virtqueues are not ready so clear the ready +field. + +Failing to do so can result in virtio_vdpa failing to load if the device +was previously used by vhost_vdpa and the old values are ready. +virtio_vdpa expects to find VQs in "not ready" state. + +Fixes: 1a86b377aa21 ("vdpa/mlx5: Add VDPA driver for supported mlx5 devices") +Signed-off-by: Eli Cohen +Link: https://lore.kernel.org/r/20210606053128.170399-1-elic@nvidia.com +Signed-off-by: Michael S. Tsirkin +Acked-by: Jason Wang +Signed-off-by: Sasha Levin +--- + drivers/vdpa/mlx5/net/mlx5_vnet.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c +index 2b74e34fbdec..32dd5ed712cb 100644 +--- a/drivers/vdpa/mlx5/net/mlx5_vnet.c ++++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c +@@ -1767,6 +1767,14 @@ out: + mutex_unlock(&ndev->reslock); + } + ++static void clear_vqs_ready(struct mlx5_vdpa_net *ndev) ++{ ++ int i; ++ ++ for (i = 0; i < ndev->mvdev.max_vqs; i++) ++ ndev->vqs[i].ready = false; ++} ++ + static void mlx5_vdpa_set_status(struct vdpa_device *vdev, u8 status) + { + struct mlx5_vdpa_dev *mvdev = to_mvdev(vdev); +@@ -1777,6 +1785,7 @@ static void mlx5_vdpa_set_status(struct vdpa_device *vdev, u8 status) + if (!status) { + mlx5_vdpa_info(mvdev, "performing device reset\n"); + teardown_driver(ndev); ++ clear_vqs_ready(ndev); + mlx5_vdpa_destroy_mr(&ndev->mvdev); + ndev->mvdev.status = 0; + ndev->mvdev.mlx_features = 0; +-- +2.30.2 + diff --git a/queue-5.13/vdpa-mlx5-fix-possible-failure-in-umem-size-calculat.patch b/queue-5.13/vdpa-mlx5-fix-possible-failure-in-umem-size-calculat.patch new file mode 100644 index 00000000000..6b6afc0ffd4 --- /dev/null +++ b/queue-5.13/vdpa-mlx5-fix-possible-failure-in-umem-size-calculat.patch @@ -0,0 +1,71 @@ +From 7a548f17965386cb7be176033f4994b2e9011b8f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 30 May 2021 12:03:49 +0300 +Subject: vdpa/mlx5: Fix possible failure in umem size calculation + +From: Eli Cohen + +[ Upstream commit 71ab6a7cfbae27f86a3901daab10bfe13b3a1e3a ] + +umem size is a 32 bit unsigned value so assigning it to an int could +cause false failures. Set the calculated value inside the function and +modify function name to reflect the fact it updates the size. + +This bug was found during code review but never had real impact to this +date. + +Fixes: 1a86b377aa21 ("vdpa/mlx5: Add VDPA driver for supported mlx5 devices") +Signed-off-by: Eli Cohen +Link: https://lore.kernel.org/r/20210530090349.8360-1-elic@nvidia.com +Signed-off-by: Michael S. Tsirkin +Acked-by: Jason Wang +Signed-off-by: Sasha Levin +--- + drivers/vdpa/mlx5/net/mlx5_vnet.c | 15 +++++---------- + 1 file changed, 5 insertions(+), 10 deletions(-) + +diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c +index e8865e6adf37..01eb6c100d2d 100644 +--- a/drivers/vdpa/mlx5/net/mlx5_vnet.c ++++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c +@@ -611,8 +611,8 @@ static void cq_destroy(struct mlx5_vdpa_net *ndev, u16 idx) + mlx5_db_free(ndev->mvdev.mdev, &vcq->db); + } + +-static int umem_size(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *mvq, int num, +- struct mlx5_vdpa_umem **umemp) ++static void set_umem_size(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *mvq, int num, ++ struct mlx5_vdpa_umem **umemp) + { + struct mlx5_core_dev *mdev = ndev->mvdev.mdev; + int p_a; +@@ -635,7 +635,7 @@ static int umem_size(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *mvq + *umemp = &mvq->umem3; + break; + } +- return p_a * mvq->num_ent + p_b; ++ (*umemp)->size = p_a * mvq->num_ent + p_b; + } + + static void umem_frag_buf_free(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_umem *umem) +@@ -651,15 +651,10 @@ static int create_umem(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *m + void *in; + int err; + __be64 *pas; +- int size; + struct mlx5_vdpa_umem *umem; + +- size = umem_size(ndev, mvq, num, &umem); +- if (size < 0) +- return size; +- +- umem->size = size; +- err = umem_frag_buf_alloc(ndev, umem, size); ++ set_umem_size(ndev, mvq, num, &umem); ++ err = umem_frag_buf_alloc(ndev, umem, umem->size); + if (err) + return err; + +-- +2.30.2 + diff --git a/queue-5.13/vdpa-mlx5-fix-umem-sizes-assignments-on-vq-create.patch b/queue-5.13/vdpa-mlx5-fix-umem-sizes-assignments-on-vq-create.patch new file mode 100644 index 00000000000..e6aa3395d82 --- /dev/null +++ b/queue-5.13/vdpa-mlx5-fix-umem-sizes-assignments-on-vq-create.patch @@ -0,0 +1,43 @@ +From 3f605e6e79176b750e89deb53533fb79dfad5eac Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 30 May 2021 12:03:17 +0300 +Subject: vdpa/mlx5: Fix umem sizes assignments on VQ create + +From: Eli Cohen + +[ Upstream commit e3011776af16caf423f2c36d0047acd624c274fa ] + +Fix copy paste bug assigning umem1 size to umem2 and umem3. The issue +was discovered when trying to use a 1:1 MR that covers the entire +address space where firmware complained that provided sizes are not +large enough. 1:1 MRs are required to support virtio_vdpa. + +Fixes: 1a86b377aa21 ("vdpa/mlx5: Add VDPA driver for supported mlx5 devices") +Signed-off-by: Eli Cohen +Link: https://lore.kernel.org/r/20210530090317.8284-1-elic@nvidia.com +Signed-off-by: Michael S. Tsirkin +Acked-by: Jason Wang +Signed-off-by: Sasha Levin +--- + drivers/vdpa/mlx5/net/mlx5_vnet.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c +index dda5dc6f7737..e8865e6adf37 100644 +--- a/drivers/vdpa/mlx5/net/mlx5_vnet.c ++++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c +@@ -829,9 +829,9 @@ static int create_virtqueue(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtque + MLX5_SET(virtio_q, vq_ctx, umem_1_id, mvq->umem1.id); + MLX5_SET(virtio_q, vq_ctx, umem_1_size, mvq->umem1.size); + MLX5_SET(virtio_q, vq_ctx, umem_2_id, mvq->umem2.id); +- MLX5_SET(virtio_q, vq_ctx, umem_2_size, mvq->umem1.size); ++ MLX5_SET(virtio_q, vq_ctx, umem_2_size, mvq->umem2.size); + MLX5_SET(virtio_q, vq_ctx, umem_3_id, mvq->umem3.id); +- MLX5_SET(virtio_q, vq_ctx, umem_3_size, mvq->umem1.size); ++ MLX5_SET(virtio_q, vq_ctx, umem_3_size, mvq->umem3.size); + MLX5_SET(virtio_q, vq_ctx, pd, ndev->mvdev.res.pdn); + if (MLX5_CAP_DEV_VDPA_EMULATION(ndev->mvdev.mdev, eth_frame_offload_type)) + MLX5_SET(virtio_q, vq_ctx, virtio_version_1_0, 1); +-- +2.30.2 + diff --git a/queue-5.13/virtio-blk-fix-memory-leak-among-suspend-resume-proc.patch b/queue-5.13/virtio-blk-fix-memory-leak-among-suspend-resume-proc.patch new file mode 100644 index 00000000000..58784275e33 --- /dev/null +++ b/queue-5.13/virtio-blk-fix-memory-leak-among-suspend-resume-proc.patch @@ -0,0 +1,37 @@ +From dea643b33bff0a0774227e1864be862d8a4f3d1a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 17 May 2021 16:43:32 +0800 +Subject: virtio-blk: Fix memory leak among suspend/resume procedure + +From: Xie Yongji + +[ Upstream commit b71ba22e7c6c6b279c66f53ee7818709774efa1f ] + +The vblk->vqs should be freed before we call init_vqs() +in virtblk_restore(). + +Signed-off-by: Xie Yongji +Link: https://lore.kernel.org/r/20210517084332.280-1-xieyongji@bytedance.com +Acked-by: Jason Wang +Signed-off-by: Michael S. Tsirkin +Signed-off-by: Sasha Levin +--- + drivers/block/virtio_blk.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c +index b9fa3ef5b57c..425bae618131 100644 +--- a/drivers/block/virtio_blk.c ++++ b/drivers/block/virtio_blk.c +@@ -948,6 +948,8 @@ static int virtblk_freeze(struct virtio_device *vdev) + blk_mq_quiesce_queue(vblk->disk->queue); + + vdev->config->del_vqs(vdev); ++ kfree(vblk->vqs); ++ + return 0; + } + +-- +2.30.2 + diff --git a/queue-5.13/virtio-mem-don-t-read-big-block-size-in-sub-block-mo.patch b/queue-5.13/virtio-mem-don-t-read-big-block-size-in-sub-block-mo.patch new file mode 100644 index 00000000000..c5555bd66e6 --- /dev/null +++ b/queue-5.13/virtio-mem-don-t-read-big-block-size-in-sub-block-mo.patch @@ -0,0 +1,61 @@ +From 58e7c9660c3a6fa414983bea16a0582301f5bad5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 2 Jun 2021 20:57:14 +0200 +Subject: virtio-mem: don't read big block size in Sub Block Mode + +From: David Hildenbrand + +[ Upstream commit 500817bf5e110ad9b7138bc582971bb7ee77d6f7 ] + +We are reading a Big Block Mode value while in Sub Block Mode +when initializing. Fortunately, vm->bbm.bb_size maps to some counter +in the vm->sbm.mb_count array, which is 0 at that point in time. + +No harm done; still, this was unintended and is not future-proof. + +Fixes: 4ba50cd3355d ("virtio-mem: Big Block Mode (BBM) memory hotplug") +Signed-off-by: David Hildenbrand +Link: https://lore.kernel.org/r/20210602185720.31821-2-david@redhat.com +Signed-off-by: Michael S. Tsirkin +Signed-off-by: Sasha Levin +--- + drivers/virtio/virtio_mem.c | 15 ++++++++------- + 1 file changed, 8 insertions(+), 7 deletions(-) + +diff --git a/drivers/virtio/virtio_mem.c b/drivers/virtio/virtio_mem.c +index 10ec60d81e84..3bf08b5bb359 100644 +--- a/drivers/virtio/virtio_mem.c ++++ b/drivers/virtio/virtio_mem.c +@@ -2420,6 +2420,10 @@ static int virtio_mem_init(struct virtio_mem *vm) + dev_warn(&vm->vdev->dev, + "Some device memory is not addressable/pluggable. This can make some memory unusable.\n"); + ++ /* Prepare the offline threshold - make sure we can add two blocks. */ ++ vm->offline_threshold = max_t(uint64_t, 2 * memory_block_size_bytes(), ++ VIRTIO_MEM_DEFAULT_OFFLINE_THRESHOLD); ++ + /* + * We want subblocks to span at least MAX_ORDER_NR_PAGES and + * pageblock_nr_pages pages. This: +@@ -2466,14 +2470,11 @@ static int virtio_mem_init(struct virtio_mem *vm) + vm->bbm.bb_size - 1; + vm->bbm.first_bb_id = virtio_mem_phys_to_bb_id(vm, addr); + vm->bbm.next_bb_id = vm->bbm.first_bb_id; +- } + +- /* Prepare the offline threshold - make sure we can add two blocks. */ +- vm->offline_threshold = max_t(uint64_t, 2 * memory_block_size_bytes(), +- VIRTIO_MEM_DEFAULT_OFFLINE_THRESHOLD); +- /* In BBM, we also want at least two big blocks. */ +- vm->offline_threshold = max_t(uint64_t, 2 * vm->bbm.bb_size, +- vm->offline_threshold); ++ /* Make sure we can add two big blocks. */ ++ vm->offline_threshold = max_t(uint64_t, 2 * vm->bbm.bb_size, ++ vm->offline_threshold); ++ } + + dev_info(&vm->vdev->dev, "start address: 0x%llx", vm->addr); + dev_info(&vm->vdev->dev, "region size: 0x%llx", vm->region_size); +-- +2.30.2 + diff --git a/queue-5.13/virtio_console-assure-used-length-from-device-is-lim.patch b/queue-5.13/virtio_console-assure-used-length-from-device-is-lim.patch new file mode 100644 index 00000000000..3f11dbe6905 --- /dev/null +++ b/queue-5.13/virtio_console-assure-used-length-from-device-is-lim.patch @@ -0,0 +1,47 @@ +From f61033e501dedd5be3a10e7f2288ab9178c2d8ce Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 25 May 2021 20:56:22 +0800 +Subject: virtio_console: Assure used length from device is limited + +From: Xie Yongji + +[ Upstream commit d00d8da5869a2608e97cfede094dfc5e11462a46 ] + +The buf->len might come from an untrusted device. This +ensures the value would not exceed the size of the buffer +to avoid data corruption or loss. + +Signed-off-by: Xie Yongji +Acked-by: Jason Wang +Link: https://lore.kernel.org/r/20210525125622.1203-1-xieyongji@bytedance.com +Signed-off-by: Michael S. Tsirkin +Signed-off-by: Sasha Levin +--- + drivers/char/virtio_console.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c +index 59dfd9c421a1..7eaf303a7a86 100644 +--- a/drivers/char/virtio_console.c ++++ b/drivers/char/virtio_console.c +@@ -475,7 +475,7 @@ static struct port_buffer *get_inbuf(struct port *port) + + buf = virtqueue_get_buf(port->in_vq, &len); + if (buf) { +- buf->len = len; ++ buf->len = min_t(size_t, len, buf->size); + buf->offset = 0; + port->stats.bytes_received += len; + } +@@ -1709,7 +1709,7 @@ static void control_work_handler(struct work_struct *work) + while ((buf = virtqueue_get_buf(vq, &len))) { + spin_unlock(&portdev->c_ivq_lock); + +- buf->len = len; ++ buf->len = min_t(size_t, len, buf->size); + buf->offset = 0; + + handle_control_message(vq->vdev, portdev, buf); +-- +2.30.2 + diff --git a/queue-5.13/virtio_net-fix-error-handling-in-virtnet_restore.patch b/queue-5.13/virtio_net-fix-error-handling-in-virtnet_restore.patch new file mode 100644 index 00000000000..dee616e16ad --- /dev/null +++ b/queue-5.13/virtio_net-fix-error-handling-in-virtnet_restore.patch @@ -0,0 +1,40 @@ +From 4db77378229c89d7ba32adda72987a10b986c70e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 17 May 2021 16:45:16 +0800 +Subject: virtio_net: Fix error handling in virtnet_restore() + +From: Xie Yongji + +[ Upstream commit 3f2869cace829fb4b80fc53b3ddaa7f4ba9acbf1 ] + +Do some cleanups in virtnet_restore() when virtnet_cpu_notif_add() failed. + +Signed-off-by: Xie Yongji +Link: https://lore.kernel.org/r/20210517084516.332-1-xieyongji@bytedance.com +Acked-by: Jason Wang +Signed-off-by: Michael S. Tsirkin +Signed-off-by: Sasha Levin +--- + drivers/net/virtio_net.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c +index 2debb32a1813..af4e04beb03a 100644 +--- a/drivers/net/virtio_net.c ++++ b/drivers/net/virtio_net.c +@@ -3299,8 +3299,11 @@ static __maybe_unused int virtnet_restore(struct virtio_device *vdev) + virtnet_set_queues(vi, vi->curr_queue_pairs); + + err = virtnet_cpu_notif_add(vi); +- if (err) ++ if (err) { ++ virtnet_freeze_down(vdev); ++ remove_vq_common(vi); + return err; ++ } + + return 0; + } +-- +2.30.2 + diff --git a/queue-5.13/virtio_net-move-tx-vq-operation-under-tx-queue-lock.patch b/queue-5.13/virtio_net-move-tx-vq-operation-under-tx-queue-lock.patch new file mode 100644 index 00000000000..9f4ec85c3f8 --- /dev/null +++ b/queue-5.13/virtio_net-move-tx-vq-operation-under-tx-queue-lock.patch @@ -0,0 +1,71 @@ +From c3ff1bfd8bd9437deaa4a760ec019fc1fc1616b1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 13 Apr 2021 01:35:26 -0400 +Subject: virtio_net: move tx vq operation under tx queue lock + +From: Michael S. Tsirkin + +[ Upstream commit 5a2f966d0f3fa0ef6dada7ab9eda74cacee96b8a ] + +It's unsafe to operate a vq from multiple threads. +Unfortunately this is exactly what we do when invoking +clean tx poll from rx napi. +Same happens with napi-tx even without the +opportunistic cleaning from the receive interrupt: that races +with processing the vq in start_xmit. + +As a fix move everything that deals with the vq to under tx lock. + +Fixes: b92f1e6751a6 ("virtio-net: transmit napi") +Signed-off-by: Michael S. Tsirkin +Signed-off-by: Sasha Levin +--- + drivers/net/virtio_net.c | 22 +++++++++++++++++++++- + 1 file changed, 21 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c +index af4e04beb03a..6af227964413 100644 +--- a/drivers/net/virtio_net.c ++++ b/drivers/net/virtio_net.c +@@ -1581,6 +1581,8 @@ static int virtnet_poll_tx(struct napi_struct *napi, int budget) + struct virtnet_info *vi = sq->vq->vdev->priv; + unsigned int index = vq2txq(sq->vq); + struct netdev_queue *txq; ++ int opaque; ++ bool done; + + if (unlikely(is_xdp_raw_buffer_queue(vi, index))) { + /* We don't need to enable cb for XDP */ +@@ -1590,10 +1592,28 @@ static int virtnet_poll_tx(struct napi_struct *napi, int budget) + + txq = netdev_get_tx_queue(vi->dev, index); + __netif_tx_lock(txq, raw_smp_processor_id()); ++ virtqueue_disable_cb(sq->vq); + free_old_xmit_skbs(sq, true); ++ ++ opaque = virtqueue_enable_cb_prepare(sq->vq); ++ ++ done = napi_complete_done(napi, 0); ++ ++ if (!done) ++ virtqueue_disable_cb(sq->vq); ++ + __netif_tx_unlock(txq); + +- virtqueue_napi_complete(napi, sq->vq, 0); ++ if (done) { ++ if (unlikely(virtqueue_poll(sq->vq, opaque))) { ++ if (napi_schedule_prep(napi)) { ++ __netif_tx_lock(txq, raw_smp_processor_id()); ++ virtqueue_disable_cb(sq->vq); ++ __netif_tx_unlock(txq); ++ __napi_schedule(napi); ++ } ++ } ++ } + + if (sq->vq->num_free >= 2 + MAX_SKB_FRAGS) + netif_tx_wake_queue(txq); +-- +2.30.2 + diff --git a/queue-5.13/virtiofs-propagate-sync-to-file-server.patch b/queue-5.13/virtiofs-propagate-sync-to-file-server.patch new file mode 100644 index 00000000000..32f40274bfe --- /dev/null +++ b/queue-5.13/virtiofs-propagate-sync-to-file-server.patch @@ -0,0 +1,188 @@ +From dcda49548b1dd9461e4126c34c6f4810aadbaa7c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 20 May 2021 17:46:54 +0200 +Subject: virtiofs: propagate sync() to file server + +From: Greg Kurz + +[ Upstream commit 2d82ab251ef0f6e7716279b04e9b5a01a86ca530 ] + +Even if POSIX doesn't mandate it, linux users legitimately expect sync() to +flush all data and metadata to physical storage when it is located on the +same system. This isn't happening with virtiofs though: sync() inside the +guest returns right away even though data still needs to be flushed from +the host page cache. + +This is easily demonstrated by doing the following in the guest: + +$ dd if=/dev/zero of=/mnt/foo bs=1M count=5K ; strace -T -e sync sync +5120+0 records in +5120+0 records out +5368709120 bytes (5.4 GB, 5.0 GiB) copied, 5.22224 s, 1.0 GB/s +sync() = 0 <0.024068> + +and start the following in the host when the 'dd' command completes +in the guest: + +$ strace -T -e fsync /usr/bin/sync virtiofs/foo +fsync(3) = 0 <10.371640> + +There are no good reasons not to honor the expected behavior of sync() +actually: it gives an unrealistic impression that virtiofs is super fast +and that data has safely landed on HW, which isn't the case obviously. + +Implement a ->sync_fs() superblock operation that sends a new FUSE_SYNCFS +request type for this purpose. Provision a 64-bit placeholder for possible +future extensions. Since the file server cannot handle the wait == 0 case, +we skip it to avoid a gratuitous roundtrip. Note that this is +per-superblock: a FUSE_SYNCFS is send for the root mount and for each +submount. + +Like with FUSE_FSYNC and FUSE_FSYNCDIR, lack of support for FUSE_SYNCFS in +the file server is treated as permanent success. This ensures +compatibility with older file servers: the client will get the current +behavior of sync() not being propagated to the file server. + +Note that such an operation allows the file server to DoS sync(). Since a +typical FUSE file server is an untrusted piece of software running in +userspace, this is disabled by default. Only enable it with virtiofs for +now since virtiofsd is supposedly trusted by the guest kernel. + +Reported-by: Robert Krawitz +Signed-off-by: Greg Kurz +Signed-off-by: Miklos Szeredi +Signed-off-by: Sasha Levin +--- + fs/fuse/fuse_i.h | 3 +++ + fs/fuse/inode.c | 40 +++++++++++++++++++++++++++++++++++++++ + fs/fuse/virtio_fs.c | 1 + + include/uapi/linux/fuse.h | 10 +++++++++- + 4 files changed, 53 insertions(+), 1 deletion(-) + +diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h +index 7e463e220053..f48dd7ff32af 100644 +--- a/fs/fuse/fuse_i.h ++++ b/fs/fuse/fuse_i.h +@@ -761,6 +761,9 @@ struct fuse_conn { + /* Auto-mount submounts announced by the server */ + unsigned int auto_submounts:1; + ++ /* Propagate syncfs() to server */ ++ unsigned int sync_fs:1; ++ + /** The number of requests waiting for completion */ + atomic_t num_waiting; + +diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c +index 393e36b74dc4..93d28dc1f572 100644 +--- a/fs/fuse/inode.c ++++ b/fs/fuse/inode.c +@@ -506,6 +506,45 @@ static int fuse_statfs(struct dentry *dentry, struct kstatfs *buf) + return err; + } + ++static int fuse_sync_fs(struct super_block *sb, int wait) ++{ ++ struct fuse_mount *fm = get_fuse_mount_super(sb); ++ struct fuse_conn *fc = fm->fc; ++ struct fuse_syncfs_in inarg; ++ FUSE_ARGS(args); ++ int err; ++ ++ /* ++ * Userspace cannot handle the wait == 0 case. Avoid a ++ * gratuitous roundtrip. ++ */ ++ if (!wait) ++ return 0; ++ ++ /* The filesystem is being unmounted. Nothing to do. */ ++ if (!sb->s_root) ++ return 0; ++ ++ if (!fc->sync_fs) ++ return 0; ++ ++ memset(&inarg, 0, sizeof(inarg)); ++ args.in_numargs = 1; ++ args.in_args[0].size = sizeof(inarg); ++ args.in_args[0].value = &inarg; ++ args.opcode = FUSE_SYNCFS; ++ args.nodeid = get_node_id(sb->s_root->d_inode); ++ args.out_numargs = 0; ++ ++ err = fuse_simple_request(fm, &args); ++ if (err == -ENOSYS) { ++ fc->sync_fs = 0; ++ err = 0; ++ } ++ ++ return err; ++} ++ + enum { + OPT_SOURCE, + OPT_SUBTYPE, +@@ -909,6 +948,7 @@ static const struct super_operations fuse_super_operations = { + .put_super = fuse_put_super, + .umount_begin = fuse_umount_begin, + .statfs = fuse_statfs, ++ .sync_fs = fuse_sync_fs, + .show_options = fuse_show_options, + }; + +diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c +index bcb8a02e2d8b..f9809b1b82f0 100644 +--- a/fs/fuse/virtio_fs.c ++++ b/fs/fuse/virtio_fs.c +@@ -1447,6 +1447,7 @@ static int virtio_fs_get_tree(struct fs_context *fsc) + fc->release = fuse_free_conn; + fc->delete_stale = true; + fc->auto_submounts = true; ++ fc->sync_fs = true; + + /* Tell FUSE to split requests that exceed the virtqueue's size */ + fc->max_pages_limit = min_t(unsigned int, fc->max_pages_limit, +diff --git a/include/uapi/linux/fuse.h b/include/uapi/linux/fuse.h +index 271ae90a9bb7..36ed092227fa 100644 +--- a/include/uapi/linux/fuse.h ++++ b/include/uapi/linux/fuse.h +@@ -181,6 +181,9 @@ + * - add FUSE_OPEN_KILL_SUIDGID + * - extend fuse_setxattr_in, add FUSE_SETXATTR_EXT + * - add FUSE_SETXATTR_ACL_KILL_SGID ++ * ++ * 7.34 ++ * - add FUSE_SYNCFS + */ + + #ifndef _LINUX_FUSE_H +@@ -216,7 +219,7 @@ + #define FUSE_KERNEL_VERSION 7 + + /** Minor version number of this interface */ +-#define FUSE_KERNEL_MINOR_VERSION 33 ++#define FUSE_KERNEL_MINOR_VERSION 34 + + /** The node ID of the root inode */ + #define FUSE_ROOT_ID 1 +@@ -509,6 +512,7 @@ enum fuse_opcode { + FUSE_COPY_FILE_RANGE = 47, + FUSE_SETUPMAPPING = 48, + FUSE_REMOVEMAPPING = 49, ++ FUSE_SYNCFS = 50, + + /* CUSE specific operations */ + CUSE_INIT = 4096, +@@ -971,4 +975,8 @@ struct fuse_removemapping_one { + #define FUSE_REMOVEMAPPING_MAX_ENTRY \ + (PAGE_SIZE / sizeof(struct fuse_removemapping_one)) + ++struct fuse_syncfs_in { ++ uint64_t padding; ++}; ++ + #endif /* _LINUX_FUSE_H */ +-- +2.30.2 + diff --git a/queue-5.13/vp_vdpa-correct-the-return-value-when-fail-to-map-no.patch b/queue-5.13/vp_vdpa-correct-the-return-value-when-fail-to-map-no.patch new file mode 100644 index 00000000000..98c06b08520 --- /dev/null +++ b/queue-5.13/vp_vdpa-correct-the-return-value-when-fail-to-map-no.patch @@ -0,0 +1,39 @@ +From b648482c59c1a973a55ec70d430bf06083d5d905 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 24 Jun 2021 11:59:39 +0800 +Subject: vp_vdpa: correct the return value when fail to map notification + +From: Jason Wang + +[ Upstream commit 94e48d6aafef23143f92eadd010c505c49487576 ] + +We forget to assign a error value when we fail to map the notification +during prove. This patch fixes it. + +Reported-by: kernel test robot +Reported-by: Dan Carpenter +Fixes: 11d8ffed00b23 ("vp_vdpa: switch to use vp_modern_map_vq_notify()") +Signed-off-by: Jason Wang +Link: https://lore.kernel.org/r/20210624035939.26618-1-jasowang@redhat.com +Reviewed-by: Stefano Garzarella +Signed-off-by: Michael S. Tsirkin +Signed-off-by: Sasha Levin +--- + drivers/vdpa/virtio_pci/vp_vdpa.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/vdpa/virtio_pci/vp_vdpa.c b/drivers/vdpa/virtio_pci/vp_vdpa.c +index c76ebb531212..9145e0624565 100644 +--- a/drivers/vdpa/virtio_pci/vp_vdpa.c ++++ b/drivers/vdpa/virtio_pci/vp_vdpa.c +@@ -442,6 +442,7 @@ static int vp_vdpa_probe(struct pci_dev *pdev, const struct pci_device_id *id) + vp_modern_map_vq_notify(mdev, i, + &vp_vdpa->vring[i].notify_pa); + if (!vp_vdpa->vring[i].notify) { ++ ret = -EINVAL; + dev_warn(&pdev->dev, "Fail to map vq notify %d\n", i); + goto err; + } +-- +2.30.2 + diff --git a/queue-5.13/w1-ds2438-fixing-bug-that-would-always-get-page0.patch b/queue-5.13/w1-ds2438-fixing-bug-that-would-always-get-page0.patch new file mode 100644 index 00000000000..2272ea741ab --- /dev/null +++ b/queue-5.13/w1-ds2438-fixing-bug-that-would-always-get-page0.patch @@ -0,0 +1,45 @@ +From 760e62348ecb1e1b5d5b33c70b6a20e67845a4af Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 19 May 2021 19:30:44 -0300 +Subject: w1: ds2438: fixing bug that would always get page0 + +From: Luiz Sampaio + +[ Upstream commit 1f5e7518f063728aee0679c5086b92d8ea429e11 ] + +The purpose of the w1_ds2438_get_page function is to get the register +values at the page passed as the pageno parameter. However, the page0 was +hardcoded, such that the function always returned the page0 contents. Fixed +so that the function can retrieve any page. + +Signed-off-by: Luiz Sampaio +Link: https://lore.kernel.org/r/20210519223046.13798-5-sampaio.ime@gmail.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/w1/slaves/w1_ds2438.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/w1/slaves/w1_ds2438.c b/drivers/w1/slaves/w1_ds2438.c +index 5cfb0ae23e91..5698566b0ee0 100644 +--- a/drivers/w1/slaves/w1_ds2438.c ++++ b/drivers/w1/slaves/w1_ds2438.c +@@ -62,13 +62,13 @@ static int w1_ds2438_get_page(struct w1_slave *sl, int pageno, u8 *buf) + if (w1_reset_select_slave(sl)) + continue; + w1_buf[0] = W1_DS2438_RECALL_MEMORY; +- w1_buf[1] = 0x00; ++ w1_buf[1] = (u8)pageno; + w1_write_block(sl->master, w1_buf, 2); + + if (w1_reset_select_slave(sl)) + continue; + w1_buf[0] = W1_DS2438_READ_SCRATCH; +- w1_buf[1] = 0x00; ++ w1_buf[1] = (u8)pageno; + w1_write_block(sl->master, w1_buf, 2); + + count = w1_read_block(sl->master, buf, DS2438_PAGE_SIZE + 1); +-- +2.30.2 + diff --git a/queue-5.13/watchdog-aspeed-fix-hardware-timeout-calculation.patch b/queue-5.13/watchdog-aspeed-fix-hardware-timeout-calculation.patch new file mode 100644 index 00000000000..7b0409e4ce2 --- /dev/null +++ b/queue-5.13/watchdog-aspeed-fix-hardware-timeout-calculation.patch @@ -0,0 +1,40 @@ +From 0e9e6bde723664322e3e8e94ead64c19be415b18 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 16 Apr 2021 20:42:49 -0700 +Subject: watchdog: aspeed: fix hardware timeout calculation + +From: Tao Ren + +[ Upstream commit e7dc481c92060f9ce872878b0b7a08c24713a7e5 ] + +Fix hardware timeout calculation in aspeed_wdt_set_timeout function to +ensure the reload value does not exceed the hardware limit. + +Fixes: efa859f7d786 ("watchdog: Add Aspeed watchdog driver") +Reported-by: Amithash Prasad +Signed-off-by: Tao Ren +Reviewed-by: Guenter Roeck +Link: https://lore.kernel.org/r/20210417034249.5978-1-rentao.bupt@gmail.com +Signed-off-by: Guenter Roeck +Signed-off-by: Wim Van Sebroeck +Signed-off-by: Sasha Levin +--- + drivers/watchdog/aspeed_wdt.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/watchdog/aspeed_wdt.c b/drivers/watchdog/aspeed_wdt.c +index 7e00960651fa..507fd815d767 100644 +--- a/drivers/watchdog/aspeed_wdt.c ++++ b/drivers/watchdog/aspeed_wdt.c +@@ -147,7 +147,7 @@ static int aspeed_wdt_set_timeout(struct watchdog_device *wdd, + + wdd->timeout = timeout; + +- actual = min(timeout, wdd->max_hw_heartbeat_ms * 1000); ++ actual = min(timeout, wdd->max_hw_heartbeat_ms / 1000); + + writel(actual * WDT_RATE_1MHZ, wdt->base + WDT_RELOAD_VALUE); + writel(WDT_RESTART_MAGIC, wdt->base + WDT_RESTART); +-- +2.30.2 + diff --git a/queue-5.13/watchdog-fix-possible-use-after-free-by-calling-del_.patch b/queue-5.13/watchdog-fix-possible-use-after-free-by-calling-del_.patch new file mode 100644 index 00000000000..ef40990bf14 --- /dev/null +++ b/queue-5.13/watchdog-fix-possible-use-after-free-by-calling-del_.patch @@ -0,0 +1,59 @@ +From 3cc6e87e8d563370d2be308aac4fbe15188a9f34 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 12 May 2021 14:57:56 +0800 +Subject: watchdog: Fix possible use-after-free by calling del_timer_sync() + +From: Zou Wei + +[ Upstream commit d0212f095ab56672f6f36aabc605bda205e1e0bf ] + +This driver's remove path calls del_timer(). However, that function +does not wait until the timer handler finishes. This means that the +timer handler may still be running after the driver's remove function +has finished, which would result in a use-after-free. + +Fix by calling del_timer_sync(), which makes sure the timer handler +has finished, and unable to re-schedule itself. + +Reported-by: Hulk Robot +Signed-off-by: Zou Wei +Reviewed-by: Guenter Roeck +Acked-by: Vladimir Zapolskiy +Link: https://lore.kernel.org/r/1620802676-19701-1-git-send-email-zou_wei@huawei.com +Signed-off-by: Guenter Roeck +Signed-off-by: Wim Van Sebroeck +Signed-off-by: Sasha Levin +--- + drivers/watchdog/lpc18xx_wdt.c | 2 +- + drivers/watchdog/w83877f_wdt.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/watchdog/lpc18xx_wdt.c b/drivers/watchdog/lpc18xx_wdt.c +index 78cf11c94941..60b6d74f267d 100644 +--- a/drivers/watchdog/lpc18xx_wdt.c ++++ b/drivers/watchdog/lpc18xx_wdt.c +@@ -292,7 +292,7 @@ static int lpc18xx_wdt_remove(struct platform_device *pdev) + struct lpc18xx_wdt_dev *lpc18xx_wdt = platform_get_drvdata(pdev); + + dev_warn(&pdev->dev, "I quit now, hardware will probably reboot!\n"); +- del_timer(&lpc18xx_wdt->timer); ++ del_timer_sync(&lpc18xx_wdt->timer); + + return 0; + } +diff --git a/drivers/watchdog/w83877f_wdt.c b/drivers/watchdog/w83877f_wdt.c +index 5772cc5d3780..f2650863fd02 100644 +--- a/drivers/watchdog/w83877f_wdt.c ++++ b/drivers/watchdog/w83877f_wdt.c +@@ -166,7 +166,7 @@ static void wdt_startup(void) + static void wdt_turnoff(void) + { + /* Stop the timer */ +- del_timer(&timer); ++ del_timer_sync(&timer); + + wdt_change(WDT_DISABLE); + +-- +2.30.2 + diff --git a/queue-5.13/watchdog-fix-possible-use-after-free-in-wdt_startup.patch b/queue-5.13/watchdog-fix-possible-use-after-free-in-wdt_startup.patch new file mode 100644 index 00000000000..15ae83383c6 --- /dev/null +++ b/queue-5.13/watchdog-fix-possible-use-after-free-in-wdt_startup.patch @@ -0,0 +1,44 @@ +From c6272e801f637572742c9f049a8566fa5e05436b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 11 May 2021 15:01:35 +0800 +Subject: watchdog: Fix possible use-after-free in wdt_startup() + +From: Zou Wei + +[ Upstream commit c08a6b31e4917034f0ed0cb457c3bb209576f542 ] + +This module's remove path calls del_timer(). However, that function +does not wait until the timer handler finishes. This means that the +timer handler may still be running after the driver's remove function +has finished, which would result in a use-after-free. + +Fix by calling del_timer_sync(), which makes sure the timer handler +has finished, and unable to re-schedule itself. + +Reported-by: Hulk Robot +Signed-off-by: Zou Wei +Reviewed-by: Guenter Roeck +Link: https://lore.kernel.org/r/1620716495-108352-1-git-send-email-zou_wei@huawei.com +Signed-off-by: Guenter Roeck +Signed-off-by: Wim Van Sebroeck +Signed-off-by: Sasha Levin +--- + drivers/watchdog/sbc60xxwdt.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/watchdog/sbc60xxwdt.c b/drivers/watchdog/sbc60xxwdt.c +index a947a63fb44a..7b974802dfc7 100644 +--- a/drivers/watchdog/sbc60xxwdt.c ++++ b/drivers/watchdog/sbc60xxwdt.c +@@ -146,7 +146,7 @@ static void wdt_startup(void) + static void wdt_turnoff(void) + { + /* Stop the timer */ +- del_timer(&timer); ++ del_timer_sync(&timer); + inb_p(wdt_stop); + pr_info("Watchdog timer is now disabled...\n"); + } +-- +2.30.2 + diff --git a/queue-5.13/watchdog-imx_sc_wdt-fix-pretimeout.patch b/queue-5.13/watchdog-imx_sc_wdt-fix-pretimeout.patch new file mode 100644 index 00000000000..8d1ba2f7311 --- /dev/null +++ b/queue-5.13/watchdog-imx_sc_wdt-fix-pretimeout.patch @@ -0,0 +1,69 @@ +From 35a56ae8809520aa81167e49b11a9ad1bbb37451 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 6 Apr 2021 14:12:47 +0200 +Subject: watchdog: imx_sc_wdt: fix pretimeout + +From: Stefan Eichenberger + +[ Upstream commit 854478a381078ee86ae2a7908a934b1ded399130 ] + +If the WDIOF_PRETIMEOUT flag is not set when registering the device the +driver will not show the sysfs entries or register the default governor. +By moving the registering after the decision whether pretimeout is +supported this gets fixed. + +Signed-off-by: Stefan Eichenberger +Reviewed-by: Guenter Roeck +Reviewed-by: Dong Aisheng +Link: https://lore.kernel.org/r/20210519080311.142928-1-eichest@gmail.com +Signed-off-by: Guenter Roeck +Signed-off-by: Wim Van Sebroeck +Signed-off-by: Sasha Levin +--- + drivers/watchdog/imx_sc_wdt.c | 11 ++++------- + 1 file changed, 4 insertions(+), 7 deletions(-) + +diff --git a/drivers/watchdog/imx_sc_wdt.c b/drivers/watchdog/imx_sc_wdt.c +index e9ee22a7cb45..8ac021748d16 100644 +--- a/drivers/watchdog/imx_sc_wdt.c ++++ b/drivers/watchdog/imx_sc_wdt.c +@@ -183,16 +183,12 @@ static int imx_sc_wdt_probe(struct platform_device *pdev) + watchdog_stop_on_reboot(wdog); + watchdog_stop_on_unregister(wdog); + +- ret = devm_watchdog_register_device(dev, wdog); +- if (ret) +- return ret; +- + ret = imx_scu_irq_group_enable(SC_IRQ_GROUP_WDOG, + SC_IRQ_WDOG, + true); + if (ret) { + dev_warn(dev, "Enable irq failed, pretimeout NOT supported\n"); +- return 0; ++ goto register_device; + } + + imx_sc_wdd->wdt_notifier.notifier_call = imx_sc_wdt_notify; +@@ -203,7 +199,7 @@ static int imx_sc_wdt_probe(struct platform_device *pdev) + false); + dev_warn(dev, + "Register irq notifier failed, pretimeout NOT supported\n"); +- return 0; ++ goto register_device; + } + + ret = devm_add_action_or_reset(dev, imx_sc_wdt_action, +@@ -213,7 +209,8 @@ static int imx_sc_wdt_probe(struct platform_device *pdev) + else + dev_warn(dev, "Add action failed, pretimeout NOT supported\n"); + +- return 0; ++register_device: ++ return devm_watchdog_register_device(dev, wdog); + } + + static int __maybe_unused imx_sc_wdt_suspend(struct device *dev) +-- +2.30.2 + diff --git a/queue-5.13/watchdog-itco_wdt-account-for-rebooting-on-second-ti.patch b/queue-5.13/watchdog-itco_wdt-account-for-rebooting-on-second-ti.patch new file mode 100644 index 00000000000..060c0f4cf24 --- /dev/null +++ b/queue-5.13/watchdog-itco_wdt-account-for-rebooting-on-second-ti.patch @@ -0,0 +1,71 @@ +From dc8152fcd9ae4ac7ed69d399d4ca8893e1df4245 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 30 May 2021 13:24:23 +0200 +Subject: watchdog: iTCO_wdt: Account for rebooting on second timeout + +From: Jan Kiszka + +[ Upstream commit cb011044e34c293e139570ce5c01aed66a34345c ] + +This was already attempted to fix via 1fccb73011ea: If the BIOS did not +enable TCO SMIs, the timer definitely needs to trigger twice in order to +cause a reboot. If TCO SMIs are on, as well as SMIs in general, we can +continue to assume that the BIOS will perform a reboot on the first +timeout. + +QEMU with its ICH9 and related BIOS falls into the former category, +currently taking twice the configured timeout in order to reboot the +machine. For iTCO version that fall under turn_SMI_watchdog_clear_off, +this is also true and was currently only addressed for v1, irrespective +of the turn_SMI_watchdog_clear_off value. + +Signed-off-by: Jan Kiszka +Reviewed-by: Guenter Roeck +Link: https://lore.kernel.org/r/0b8bb307-d08b-41b5-696c-305cdac6789c@siemens.com +Signed-off-by: Guenter Roeck +Signed-off-by: Wim Van Sebroeck +Signed-off-by: Sasha Levin +--- + drivers/watchdog/iTCO_wdt.c | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +diff --git a/drivers/watchdog/iTCO_wdt.c b/drivers/watchdog/iTCO_wdt.c +index bf31d7b67a69..3f1324871cfd 100644 +--- a/drivers/watchdog/iTCO_wdt.c ++++ b/drivers/watchdog/iTCO_wdt.c +@@ -71,6 +71,8 @@ + #define TCOBASE(p) ((p)->tco_res->start) + /* SMI Control and Enable Register */ + #define SMI_EN(p) ((p)->smi_res->start) ++#define TCO_EN (1 << 13) ++#define GBL_SMI_EN (1 << 0) + + #define TCO_RLD(p) (TCOBASE(p) + 0x00) /* TCO Timer Reload/Curr. Value */ + #define TCOv1_TMR(p) (TCOBASE(p) + 0x01) /* TCOv1 Timer Initial Value*/ +@@ -355,8 +357,12 @@ static int iTCO_wdt_set_timeout(struct watchdog_device *wd_dev, unsigned int t) + + tmrval = seconds_to_ticks(p, t); + +- /* For TCO v1 the timer counts down twice before rebooting */ +- if (p->iTCO_version == 1) ++ /* ++ * If TCO SMIs are off, the timer counts down twice before rebooting. ++ * Otherwise, the BIOS generally reboots when the SMI triggers. ++ */ ++ if (p->smi_res && ++ (SMI_EN(p) & (TCO_EN | GBL_SMI_EN)) != (TCO_EN | GBL_SMI_EN)) + tmrval /= 2; + + /* from the specs: */ +@@ -521,7 +527,7 @@ static int iTCO_wdt_probe(struct platform_device *pdev) + * Disables TCO logic generating an SMI# + */ + val32 = inl(SMI_EN(p)); +- val32 &= 0xffffdfff; /* Turn off SMI clearing watchdog */ ++ val32 &= ~TCO_EN; /* Turn off SMI clearing watchdog */ + outl(val32, SMI_EN(p)); + } + +-- +2.30.2 + diff --git a/queue-5.13/watchdog-jz4740-fix-return-value-check-in-jz4740_wdt.patch b/queue-5.13/watchdog-jz4740-fix-return-value-check-in-jz4740_wdt.patch new file mode 100644 index 00000000000..2ce74658827 --- /dev/null +++ b/queue-5.13/watchdog-jz4740-fix-return-value-check-in-jz4740_wdt.patch @@ -0,0 +1,44 @@ +From 107ffcbe31e21f7449f63d8c4a2888244ec99255 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 4 Mar 2021 04:59:09 +0000 +Subject: watchdog: jz4740: Fix return value check in jz4740_wdt_probe() + +From: Wei Yongjun + +[ Upstream commit 29e85f53fb58b45b9e9276dcdf1f1cb762dd1c9f ] + +In case of error, the function device_node_to_regmap() returns +ERR_PTR() and never returns NULL. The NULL test in the return +value check should be replaced with IS_ERR(). + +Fixes: 6d532143c915 ("watchdog: jz4740: Use regmap provided by TCU driver") +Reported-by: Hulk Robot +Signed-off-by: Wei Yongjun +Acked-by: Paul Cercueil +Link: https://lore.kernel.org/r/20210304045909.945799-1-weiyongjun1@huawei.com +Signed-off-by: Guenter Roeck +Signed-off-by: Wim Van Sebroeck +Signed-off-by: Sasha Levin +--- + drivers/watchdog/jz4740_wdt.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/watchdog/jz4740_wdt.c b/drivers/watchdog/jz4740_wdt.c +index bdf9564efa29..395bde79e292 100644 +--- a/drivers/watchdog/jz4740_wdt.c ++++ b/drivers/watchdog/jz4740_wdt.c +@@ -176,9 +176,9 @@ static int jz4740_wdt_probe(struct platform_device *pdev) + watchdog_set_drvdata(jz4740_wdt, drvdata); + + drvdata->map = device_node_to_regmap(dev->parent->of_node); +- if (!drvdata->map) { ++ if (IS_ERR(drvdata->map)) { + dev_err(dev, "regmap not found\n"); +- return -EINVAL; ++ return PTR_ERR(drvdata->map); + } + + return devm_watchdog_register_device(dev, &drvdata->wdt); +-- +2.30.2 + diff --git a/queue-5.13/watchdog-keembay-clear-either-the-to-or-th-interrupt.patch b/queue-5.13/watchdog-keembay-clear-either-the-to-or-th-interrupt.patch new file mode 100644 index 00000000000..1223cf453b1 --- /dev/null +++ b/queue-5.13/watchdog-keembay-clear-either-the-to-or-th-interrupt.patch @@ -0,0 +1,61 @@ +From d8e93ce563e5724391b6fca3c38e2cf2ffbd0231 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 17 May 2021 23:19:48 +0530 +Subject: watchdog: keembay: Clear either the TO or TH interrupt bit + +From: Shruthi Sanil + +[ Upstream commit 0e36a09faea25f4564d41a0c28938199b605148e ] + +During the interrupt service routine of the TimeOut interrupt and +the ThresHold interrupt, the respective interrupt clear bit +have to be cleared and not both. + +Fixes: fa0f8d51e90d ("watchdog: Add watchdog driver for Intel Keembay Soc") +Reviewed-by: Guenter Roeck +Reviewed-by: Andy Shevchenko +Tested-by: Kris Pan +Signed-off-by: Shruthi Sanil +Link: https://lore.kernel.org/r/20210517174953.19404-5-shruthi.sanil@intel.com +Signed-off-by: Guenter Roeck +Signed-off-by: Wim Van Sebroeck +Signed-off-by: Sasha Levin +--- + drivers/watchdog/keembay_wdt.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/drivers/watchdog/keembay_wdt.c b/drivers/watchdog/keembay_wdt.c +index 6053416b8d3d..f2a16c9933c3 100644 +--- a/drivers/watchdog/keembay_wdt.c ++++ b/drivers/watchdog/keembay_wdt.c +@@ -23,7 +23,8 @@ + #define TIM_WDOG_EN 0x8 + #define TIM_SAFE 0xc + +-#define WDT_ISR_MASK GENMASK(9, 8) ++#define WDT_TH_INT_MASK BIT(8) ++#define WDT_TO_INT_MASK BIT(9) + #define WDT_ISR_CLEAR 0x8200ff18 + #define WDT_UNLOCK 0xf1d0dead + #define WDT_LOAD_MAX U32_MAX +@@ -142,7 +143,7 @@ static irqreturn_t keembay_wdt_to_isr(int irq, void *dev_id) + struct arm_smccc_res res; + + keembay_wdt_writel(wdt, TIM_WATCHDOG, 1); +- arm_smccc_smc(WDT_ISR_CLEAR, WDT_ISR_MASK, 0, 0, 0, 0, 0, 0, &res); ++ arm_smccc_smc(WDT_ISR_CLEAR, WDT_TO_INT_MASK, 0, 0, 0, 0, 0, 0, &res); + dev_crit(wdt->wdd.parent, "Intel Keem Bay non-sec wdt timeout.\n"); + emergency_restart(); + +@@ -156,7 +157,7 @@ static irqreturn_t keembay_wdt_th_isr(int irq, void *dev_id) + + keembay_wdt_set_pretimeout(&wdt->wdd, 0x0); + +- arm_smccc_smc(WDT_ISR_CLEAR, WDT_ISR_MASK, 0, 0, 0, 0, 0, 0, &res); ++ arm_smccc_smc(WDT_ISR_CLEAR, WDT_TH_INT_MASK, 0, 0, 0, 0, 0, 0, &res); + dev_crit(wdt->wdd.parent, "Intel Keem Bay non-sec wdt pre-timeout.\n"); + watchdog_notify_pretimeout(&wdt->wdd); + +-- +2.30.2 + diff --git a/queue-5.13/watchdog-keembay-remove-timeout-update-in-the-wdt-st.patch b/queue-5.13/watchdog-keembay-remove-timeout-update-in-the-wdt-st.patch new file mode 100644 index 00000000000..05c3bf7d58a --- /dev/null +++ b/queue-5.13/watchdog-keembay-remove-timeout-update-in-the-wdt-st.patch @@ -0,0 +1,42 @@ +From 4cbe2023881d3944d5f58d0f38a40b5d9904a9e7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 17 May 2021 23:19:49 +0530 +Subject: watchdog: keembay: Remove timeout update in the WDT start function + +From: Shruthi Sanil + +[ Upstream commit 9eb25269271c679e8cfcc7df5c0c5e9d0572fc27 ] + +Removed set timeout from the start WDT function. There is a function +defined to set the timeout. Hence no need to set the timeout again in +start function as the timeout would have been already updated +before calling the start/enable. + +Fixes: fa0f8d51e90d ("watchdog: Add watchdog driver for Intel Keembay Soc") +Reviewed-by: Guenter Roeck +Reviewed-by: Andy Shevchenko +Tested-by: Kris Pan +Signed-off-by: Shruthi Sanil +Link: https://lore.kernel.org/r/20210517174953.19404-6-shruthi.sanil@intel.com +Signed-off-by: Guenter Roeck +Signed-off-by: Wim Van Sebroeck +Signed-off-by: Sasha Levin +--- + drivers/watchdog/keembay_wdt.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/drivers/watchdog/keembay_wdt.c b/drivers/watchdog/keembay_wdt.c +index f2a16c9933c3..039753b9932b 100644 +--- a/drivers/watchdog/keembay_wdt.c ++++ b/drivers/watchdog/keembay_wdt.c +@@ -84,7 +84,6 @@ static int keembay_wdt_start(struct watchdog_device *wdog) + { + struct keembay_wdt *wdt = watchdog_get_drvdata(wdog); + +- keembay_wdt_set_timeout_reg(wdog); + keembay_wdt_writel(wdt, TIM_WDOG_EN, 1); + + return 0; +-- +2.30.2 + diff --git a/queue-5.13/watchdog-keembay-removed-timeout-update-in-the-to-is.patch b/queue-5.13/watchdog-keembay-removed-timeout-update-in-the-to-is.patch new file mode 100644 index 00000000000..25823506603 --- /dev/null +++ b/queue-5.13/watchdog-keembay-removed-timeout-update-in-the-to-is.patch @@ -0,0 +1,41 @@ +From 3391713cd30099ef719fd9d75797c7b856926c57 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 17 May 2021 23:19:50 +0530 +Subject: watchdog: keembay: Removed timeout update in the TO ISR + +From: Shruthi Sanil + +[ Upstream commit 3168be5d66ac6c3508a880022f79b5a887865d5d ] + +In the TO ISR removed updating the Timeout value because +its not serving any purpose as the timer would have already expired +and the system would be rebooting. + +Fixes: fa0f8d51e90d ("watchdog: Add watchdog driver for Intel Keembay Soc") +Reviewed-by: Guenter Roeck +Reviewed-by: Andy Shevchenko +Tested-by: Kris Pan +Signed-off-by: Shruthi Sanil +Link: https://lore.kernel.org/r/20210517174953.19404-7-shruthi.sanil@intel.com +Signed-off-by: Guenter Roeck +Signed-off-by: Wim Van Sebroeck +Signed-off-by: Sasha Levin +--- + drivers/watchdog/keembay_wdt.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/drivers/watchdog/keembay_wdt.c b/drivers/watchdog/keembay_wdt.c +index 039753b9932b..dd192b8dff55 100644 +--- a/drivers/watchdog/keembay_wdt.c ++++ b/drivers/watchdog/keembay_wdt.c +@@ -141,7 +141,6 @@ static irqreturn_t keembay_wdt_to_isr(int irq, void *dev_id) + struct keembay_wdt *wdt = dev_id; + struct arm_smccc_res res; + +- keembay_wdt_writel(wdt, TIM_WATCHDOG, 1); + arm_smccc_smc(WDT_ISR_CLEAR, WDT_TO_INT_MASK, 0, 0, 0, 0, 0, 0, &res); + dev_crit(wdt->wdd.parent, "Intel Keem Bay non-sec wdt timeout.\n"); + emergency_restart(); +-- +2.30.2 + diff --git a/queue-5.13/watchdog-keembay-upadate-wdt-pretimeout-for-every-up.patch b/queue-5.13/watchdog-keembay-upadate-wdt-pretimeout-for-every-up.patch new file mode 100644 index 00000000000..02cc0709cc2 --- /dev/null +++ b/queue-5.13/watchdog-keembay-upadate-wdt-pretimeout-for-every-up.patch @@ -0,0 +1,42 @@ +From 841093cc3e8f176b9e76b99ee3e73d94e1bf08f4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 17 May 2021 23:19:46 +0530 +Subject: watchdog: keembay: Upadate WDT pretimeout for every update in timeout + +From: Shruthi Sanil + +[ Upstream commit 0f7bfaf10c0abc979220442bae2af4f1f869c41e ] + +The pre-timeout value to be programmed to the register has to be +calculated and updated for every change in the timeout value. +Else the threshold time wouldn't be calculated to its +corresponding timeout. + +Fixes: fa0f8d51e90d ("watchdog: Add watchdog driver for Intel Keembay Soc") +Reviewed-by: Guenter Roeck +Reviewed-by: Andy Shevchenko +Tested-by: Kris Pan +Signed-off-by: Shruthi Sanil +Link: https://lore.kernel.org/r/20210517174953.19404-3-shruthi.sanil@intel.com +Signed-off-by: Guenter Roeck +Signed-off-by: Wim Van Sebroeck +Signed-off-by: Sasha Levin +--- + drivers/watchdog/keembay_wdt.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/watchdog/keembay_wdt.c b/drivers/watchdog/keembay_wdt.c +index f2f5c9fae29c..b2afeb4a60e3 100644 +--- a/drivers/watchdog/keembay_wdt.c ++++ b/drivers/watchdog/keembay_wdt.c +@@ -109,6 +109,7 @@ static int keembay_wdt_set_timeout(struct watchdog_device *wdog, u32 t) + { + wdog->timeout = t; + keembay_wdt_set_timeout_reg(wdog); ++ keembay_wdt_set_pretimeout_reg(wdog); + + return 0; + } +-- +2.30.2 + diff --git a/queue-5.13/watchdog-keembay-update-pretimeout-to-zero-in-the-th.patch b/queue-5.13/watchdog-keembay-update-pretimeout-to-zero-in-the-th.patch new file mode 100644 index 00000000000..7d1d04b544d --- /dev/null +++ b/queue-5.13/watchdog-keembay-update-pretimeout-to-zero-in-the-th.patch @@ -0,0 +1,42 @@ +From 3487dde844a0a1be702ed57a971499407015ac2a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 17 May 2021 23:19:47 +0530 +Subject: watchdog: keembay: Update pretimeout to zero in the TH ISR + +From: Shruthi Sanil + +[ Upstream commit 75f6c56dfeec92c53e09a72896547888ac9a27d7 ] + +The pretimeout has to be updated to zero during the ISR of the +ThresHold interrupt. Else the TH interrupt would be triggerred for +every tick until the timeout. + +Fixes: fa0f8d51e90d ("watchdog: Add watchdog driver for Intel Keembay Soc") +Reviewed-by: Guenter Roeck +Reviewed-by: Andy Shevchenko +Tested-by: Kris Pan +Signed-off-by: Shruthi Sanil +Link: https://lore.kernel.org/r/20210517174953.19404-4-shruthi.sanil@intel.com +Signed-off-by: Guenter Roeck +Signed-off-by: Wim Van Sebroeck +Signed-off-by: Sasha Levin +--- + drivers/watchdog/keembay_wdt.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/watchdog/keembay_wdt.c b/drivers/watchdog/keembay_wdt.c +index b2afeb4a60e3..6053416b8d3d 100644 +--- a/drivers/watchdog/keembay_wdt.c ++++ b/drivers/watchdog/keembay_wdt.c +@@ -154,6 +154,8 @@ static irqreturn_t keembay_wdt_th_isr(int irq, void *dev_id) + struct keembay_wdt *wdt = dev_id; + struct arm_smccc_res res; + ++ keembay_wdt_set_pretimeout(&wdt->wdd, 0x0); ++ + arm_smccc_smc(WDT_ISR_CLEAR, WDT_ISR_MASK, 0, 0, 0, 0, 0, 0, &res); + dev_crit(wdt->wdd.parent, "Intel Keem Bay non-sec wdt pre-timeout.\n"); + watchdog_notify_pretimeout(&wdt->wdd); +-- +2.30.2 + diff --git a/queue-5.13/watchdog-keembay-update-wdt-pre-timeout-during-the-i.patch b/queue-5.13/watchdog-keembay-update-wdt-pre-timeout-during-the-i.patch new file mode 100644 index 00000000000..71b49c45506 --- /dev/null +++ b/queue-5.13/watchdog-keembay-update-wdt-pre-timeout-during-the-i.patch @@ -0,0 +1,59 @@ +From ab0fc484cd2962a541d8002226898ba672b6642a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 17 May 2021 23:19:45 +0530 +Subject: watchdog: keembay: Update WDT pre-timeout during the initialization + +From: Shruthi Sanil + +[ Upstream commit 29353816300c79cb5157ed2719cc71285c7b77aa ] + +The pretimeout register has a default reset value. Hence +when a smaller WDT timeout is set which would be lesser than the +default pretimeout, the system behaves abnormally, starts +triggering the pretimeout interrupt even when the WDT is +not enabled, most of the times leading to system crash. +Hence an update in the pre-timeout is also required for the +default timeout that is being configured. + +Fixes: fa0f8d51e90d ("watchdog: Add watchdog driver for Intel Keembay Soc") +Reviewed-by: Guenter Roeck +Reviewed-by: Andy Shevchenko +Tested-by: Kris Pan +Signed-off-by: Shruthi Sanil +Link: https://lore.kernel.org/r/20210517174953.19404-2-shruthi.sanil@intel.com +Signed-off-by: Guenter Roeck +Signed-off-by: Wim Van Sebroeck +Signed-off-by: Sasha Levin +--- + drivers/watchdog/keembay_wdt.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/watchdog/keembay_wdt.c b/drivers/watchdog/keembay_wdt.c +index 547d3fea33ff..f2f5c9fae29c 100644 +--- a/drivers/watchdog/keembay_wdt.c ++++ b/drivers/watchdog/keembay_wdt.c +@@ -29,6 +29,7 @@ + #define WDT_LOAD_MAX U32_MAX + #define WDT_LOAD_MIN 1 + #define WDT_TIMEOUT 5 ++#define WDT_PRETIMEOUT 4 + + static unsigned int timeout = WDT_TIMEOUT; + module_param(timeout, int, 0); +@@ -224,11 +225,13 @@ static int keembay_wdt_probe(struct platform_device *pdev) + wdt->wdd.min_timeout = WDT_LOAD_MIN; + wdt->wdd.max_timeout = WDT_LOAD_MAX / wdt->rate; + wdt->wdd.timeout = WDT_TIMEOUT; ++ wdt->wdd.pretimeout = WDT_PRETIMEOUT; + + watchdog_set_drvdata(&wdt->wdd, wdt); + watchdog_set_nowayout(&wdt->wdd, nowayout); + watchdog_init_timeout(&wdt->wdd, timeout, dev); + keembay_wdt_set_timeout(&wdt->wdd, wdt->wdd.timeout); ++ keembay_wdt_set_pretimeout(&wdt->wdd, wdt->wdd.pretimeout); + + ret = devm_watchdog_register_device(dev, &wdt->wdd); + if (ret) +-- +2.30.2 + diff --git a/queue-5.13/watchdog-sc520_wdt-fix-possible-use-after-free-in-wd.patch b/queue-5.13/watchdog-sc520_wdt-fix-possible-use-after-free-in-wd.patch new file mode 100644 index 00000000000..e58285d0799 --- /dev/null +++ b/queue-5.13/watchdog-sc520_wdt-fix-possible-use-after-free-in-wd.patch @@ -0,0 +1,44 @@ +From d564b867d18d98b627cfedddb98a11a2a77a1125 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 11 May 2021 15:04:51 +0800 +Subject: watchdog: sc520_wdt: Fix possible use-after-free in wdt_turnoff() + +From: Zou Wei + +[ Upstream commit 90b7c141132244e8e49a34a4c1e445cce33e07f4 ] + +This module's remove path calls del_timer(). However, that function +does not wait until the timer handler finishes. This means that the +timer handler may still be running after the driver's remove function +has finished, which would result in a use-after-free. + +Fix by calling del_timer_sync(), which makes sure the timer handler +has finished, and unable to re-schedule itself. + +Reported-by: Hulk Robot +Signed-off-by: Zou Wei +Reviewed-by: Guenter Roeck +Link: https://lore.kernel.org/r/1620716691-108460-1-git-send-email-zou_wei@huawei.com +Signed-off-by: Guenter Roeck +Signed-off-by: Wim Van Sebroeck +Signed-off-by: Sasha Levin +--- + drivers/watchdog/sc520_wdt.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/watchdog/sc520_wdt.c b/drivers/watchdog/sc520_wdt.c +index e66e6b905964..ca65468f4b9c 100644 +--- a/drivers/watchdog/sc520_wdt.c ++++ b/drivers/watchdog/sc520_wdt.c +@@ -186,7 +186,7 @@ static int wdt_startup(void) + static int wdt_turnoff(void) + { + /* Stop the timer */ +- del_timer(&timer); ++ del_timer_sync(&timer); + + /* Stop the watchdog */ + wdt_config(0); +-- +2.30.2 + diff --git a/queue-5.13/x86-fpu-fix-copy_xstate_to_kernel-gap-handling.patch b/queue-5.13/x86-fpu-fix-copy_xstate_to_kernel-gap-handling.patch new file mode 100644 index 00000000000..ebbcfc13a1d --- /dev/null +++ b/queue-5.13/x86-fpu-fix-copy_xstate_to_kernel-gap-handling.patch @@ -0,0 +1,184 @@ +From 216216924a3c746a1ef259372961ab283944c00f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 23 Jun 2021 14:01:28 +0200 +Subject: x86/fpu: Fix copy_xstate_to_kernel() gap handling + +From: Thomas Gleixner + +[ Upstream commit 9625895011d130033d1bc7aac0d77a9bf68ff8a6 ] + +The gap handling in copy_xstate_to_kernel() is wrong when XSAVES is in +use. + +Using init_fpstate for copying the init state of features which are +not set in the xstate header is only correct for the legacy area, but +not for the extended features area because when XSAVES is in use then +init_fpstate is in compacted form which means the xstate offsets which +are used to copy from init_fpstate are not valid. + +Fortunately, this is not a real problem today because all extended +features in use have an all-zeros init state, but it is wrong +nevertheless and with a potentially dynamically sized init_fpstate this +would result in an access outside of the init_fpstate. + +Fix this by keeping track of the last copied state in the target buffer and +explicitly zero it when there is a feature or alignment gap. + +Use the compacted offset when accessing the extended feature space in +init_fpstate. + +As this is not a functional issue on older kernels this is intentionally +not tagged for stable. + +Fixes: b8be15d58806 ("x86/fpu/xstate: Re-enable XSAVES") +Signed-off-by: Thomas Gleixner +Signed-off-by: Borislav Petkov +Reviewed-by: Borislav Petkov +Link: https://lkml.kernel.org/r/20210623121451.294282032@linutronix.de +Signed-off-by: Sasha Levin +--- + arch/x86/kernel/fpu/xstate.c | 105 ++++++++++++++++++++--------------- + 1 file changed, 61 insertions(+), 44 deletions(-) + +diff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c +index 1cadb2faf740..4819251ffe7c 100644 +--- a/arch/x86/kernel/fpu/xstate.c ++++ b/arch/x86/kernel/fpu/xstate.c +@@ -1084,20 +1084,10 @@ static inline bool xfeatures_mxcsr_quirk(u64 xfeatures) + return true; + } + +-static void fill_gap(struct membuf *to, unsigned *last, unsigned offset) ++static void copy_feature(bool from_xstate, struct membuf *to, void *xstate, ++ void *init_xstate, unsigned int size) + { +- if (*last >= offset) +- return; +- membuf_write(to, (void *)&init_fpstate.xsave + *last, offset - *last); +- *last = offset; +-} +- +-static void copy_part(struct membuf *to, unsigned *last, unsigned offset, +- unsigned size, void *from) +-{ +- fill_gap(to, last, offset); +- membuf_write(to, from, size); +- *last = offset + size; ++ membuf_write(to, from_xstate ? xstate : init_xstate, size); + } + + /* +@@ -1109,10 +1099,10 @@ static void copy_part(struct membuf *to, unsigned *last, unsigned offset, + */ + void copy_xstate_to_kernel(struct membuf to, struct xregs_state *xsave) + { ++ const unsigned int off_mxcsr = offsetof(struct fxregs_state, mxcsr); ++ struct xregs_state *xinit = &init_fpstate.xsave; + struct xstate_header header; +- const unsigned off_mxcsr = offsetof(struct fxregs_state, mxcsr); +- unsigned size = to.left; +- unsigned last = 0; ++ unsigned int zerofrom; + int i; + + /* +@@ -1122,41 +1112,68 @@ void copy_xstate_to_kernel(struct membuf to, struct xregs_state *xsave) + header.xfeatures = xsave->header.xfeatures; + header.xfeatures &= xfeatures_mask_user(); + +- if (header.xfeatures & XFEATURE_MASK_FP) +- copy_part(&to, &last, 0, off_mxcsr, &xsave->i387); +- if (header.xfeatures & (XFEATURE_MASK_SSE | XFEATURE_MASK_YMM)) +- copy_part(&to, &last, off_mxcsr, +- MXCSR_AND_FLAGS_SIZE, &xsave->i387.mxcsr); +- if (header.xfeatures & XFEATURE_MASK_FP) +- copy_part(&to, &last, offsetof(struct fxregs_state, st_space), +- 128, &xsave->i387.st_space); +- if (header.xfeatures & XFEATURE_MASK_SSE) +- copy_part(&to, &last, xstate_offsets[XFEATURE_SSE], +- 256, &xsave->i387.xmm_space); +- /* +- * Fill xsave->i387.sw_reserved value for ptrace frame: +- */ +- copy_part(&to, &last, offsetof(struct fxregs_state, sw_reserved), +- 48, xstate_fx_sw_bytes); +- /* +- * Copy xregs_state->header: +- */ +- copy_part(&to, &last, offsetof(struct xregs_state, header), +- sizeof(header), &header); ++ /* Copy FP state up to MXCSR */ ++ copy_feature(header.xfeatures & XFEATURE_MASK_FP, &to, &xsave->i387, ++ &xinit->i387, off_mxcsr); ++ ++ /* Copy MXCSR when SSE or YMM are set in the feature mask */ ++ copy_feature(header.xfeatures & (XFEATURE_MASK_SSE | XFEATURE_MASK_YMM), ++ &to, &xsave->i387.mxcsr, &xinit->i387.mxcsr, ++ MXCSR_AND_FLAGS_SIZE); ++ ++ /* Copy the remaining FP state */ ++ copy_feature(header.xfeatures & XFEATURE_MASK_FP, ++ &to, &xsave->i387.st_space, &xinit->i387.st_space, ++ sizeof(xsave->i387.st_space)); ++ ++ /* Copy the SSE state - shared with YMM, but independently managed */ ++ copy_feature(header.xfeatures & XFEATURE_MASK_SSE, ++ &to, &xsave->i387.xmm_space, &xinit->i387.xmm_space, ++ sizeof(xsave->i387.xmm_space)); ++ ++ /* Zero the padding area */ ++ membuf_zero(&to, sizeof(xsave->i387.padding)); ++ ++ /* Copy xsave->i387.sw_reserved */ ++ membuf_write(&to, xstate_fx_sw_bytes, sizeof(xsave->i387.sw_reserved)); ++ ++ /* Copy the user space relevant state of @xsave->header */ ++ membuf_write(&to, &header, sizeof(header)); ++ ++ zerofrom = offsetof(struct xregs_state, extended_state_area); + + for (i = FIRST_EXTENDED_XFEATURE; i < XFEATURE_MAX; i++) { + /* +- * Copy only in-use xstates: ++ * The ptrace buffer is in non-compacted XSAVE format. ++ * In non-compacted format disabled features still occupy ++ * state space, but there is no state to copy from in the ++ * compacted init_fpstate. The gap tracking will zero this ++ * later. + */ +- if ((header.xfeatures >> i) & 1) { +- void *src = __raw_xsave_addr(xsave, i); ++ if (!(xfeatures_mask_user() & BIT_ULL(i))) ++ continue; + +- copy_part(&to, &last, xstate_offsets[i], +- xstate_sizes[i], src); +- } ++ /* ++ * If there was a feature or alignment gap, zero the space ++ * in the destination buffer. ++ */ ++ if (zerofrom < xstate_offsets[i]) ++ membuf_zero(&to, xstate_offsets[i] - zerofrom); ++ ++ copy_feature(header.xfeatures & BIT_ULL(i), &to, ++ __raw_xsave_addr(xsave, i), ++ __raw_xsave_addr(xinit, i), ++ xstate_sizes[i]); + ++ /* ++ * Keep track of the last copied state in the non-compacted ++ * target buffer for gap zeroing. ++ */ ++ zerofrom = xstate_offsets[i] + xstate_sizes[i]; + } +- fill_gap(&to, &last, size); ++ ++ if (to.left) ++ membuf_zero(&to, to.left); + } + + /* +-- +2.30.2 + diff --git a/queue-5.13/x86-fpu-limit-xstate-copy-size-in-xstateregs_set.patch b/queue-5.13/x86-fpu-limit-xstate-copy-size-in-xstateregs_set.patch new file mode 100644 index 00000000000..a82819c194e --- /dev/null +++ b/queue-5.13/x86-fpu-limit-xstate-copy-size-in-xstateregs_set.patch @@ -0,0 +1,39 @@ +From 9c8802328fe66d632f573ec91f270dfb9992ff3a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 23 Jun 2021 14:01:35 +0200 +Subject: x86/fpu: Limit xstate copy size in xstateregs_set() + +From: Thomas Gleixner + +[ Upstream commit 07d6688b22e09be465652cf2da0da6bf86154df6 ] + +If the count argument is larger than the xstate size, this will happily +copy beyond the end of xstate. + +Fixes: 91c3dba7dbc1 ("x86/fpu/xstate: Fix PTRACE frames for XSAVES") +Signed-off-by: Thomas Gleixner +Signed-off-by: Borislav Petkov +Reviewed-by: Andy Lutomirski +Reviewed-by: Borislav Petkov +Link: https://lkml.kernel.org/r/20210623121452.120741557@linutronix.de +Signed-off-by: Sasha Levin +--- + arch/x86/kernel/fpu/regset.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/x86/kernel/fpu/regset.c b/arch/x86/kernel/fpu/regset.c +index c413756ba89f..6bb874441de8 100644 +--- a/arch/x86/kernel/fpu/regset.c ++++ b/arch/x86/kernel/fpu/regset.c +@@ -117,7 +117,7 @@ int xstateregs_set(struct task_struct *target, const struct user_regset *regset, + /* + * A whole standard-format XSAVE buffer is needed: + */ +- if ((pos != 0) || (count < fpu_user_xstate_size)) ++ if (pos != 0 || count != fpu_user_xstate_size) + return -EFAULT; + + xsave = &fpu->state.xsave; +-- +2.30.2 + diff --git a/queue-5.13/x86-fpu-return-proper-error-codes-from-user-access-f.patch b/queue-5.13/x86-fpu-return-proper-error-codes-from-user-access-f.patch new file mode 100644 index 00000000000..34f583fae8c --- /dev/null +++ b/queue-5.13/x86-fpu-return-proper-error-codes-from-user-access-f.patch @@ -0,0 +1,86 @@ +From eb358fd430ac5228059e79434cf044571bbcb24d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 23 Jun 2021 14:02:30 +0200 +Subject: x86/fpu: Return proper error codes from user access functions + +From: Thomas Gleixner + +[ Upstream commit aee8c67a4faa40a8df4e79316dbfc92d123989c1 ] + +When *RSTOR from user memory raises an exception, there is no way to +differentiate them. That's bad because it forces the slow path even when +the failure was not a fault. If the operation raised eg. #GP then going +through the slow path is pointless. + +Use _ASM_EXTABLE_FAULT() which stores the trap number and let the exception +fixup return the negated trap number as error. + +This allows to separate the fast path and let it handle faults directly and +avoid the slow path for all other exceptions. + +Signed-off-by: Thomas Gleixner +Signed-off-by: Borislav Petkov +Link: https://lkml.kernel.org/r/20210623121457.601480369@linutronix.de +Signed-off-by: Sasha Levin +--- + arch/x86/include/asm/fpu/internal.h | 19 ++++++++++++------- + 1 file changed, 12 insertions(+), 7 deletions(-) + +diff --git a/arch/x86/include/asm/fpu/internal.h b/arch/x86/include/asm/fpu/internal.h +index 16bf4d4a8159..4e5af2b00d89 100644 +--- a/arch/x86/include/asm/fpu/internal.h ++++ b/arch/x86/include/asm/fpu/internal.h +@@ -103,6 +103,7 @@ static inline void fpstate_init_fxstate(struct fxregs_state *fx) + } + extern void fpstate_sanitize_xstate(struct fpu *fpu); + ++/* Returns 0 or the negated trap number, which results in -EFAULT for #PF */ + #define user_insn(insn, output, input...) \ + ({ \ + int err; \ +@@ -110,14 +111,14 @@ extern void fpstate_sanitize_xstate(struct fpu *fpu); + might_fault(); \ + \ + asm volatile(ASM_STAC "\n" \ +- "1:" #insn "\n\t" \ ++ "1: " #insn "\n" \ + "2: " ASM_CLAC "\n" \ + ".section .fixup,\"ax\"\n" \ +- "3: movl $-1,%[err]\n" \ ++ "3: negl %%eax\n" \ + " jmp 2b\n" \ + ".previous\n" \ +- _ASM_EXTABLE(1b, 3b) \ +- : [err] "=r" (err), output \ ++ _ASM_EXTABLE_FAULT(1b, 3b) \ ++ : [err] "=a" (err), output \ + : "0"(0), input); \ + err; \ + }) +@@ -219,16 +220,20 @@ static inline void fxsave(struct fxregs_state *fx) + #define XRSTOR ".byte " REX_PREFIX "0x0f,0xae,0x2f" + #define XRSTORS ".byte " REX_PREFIX "0x0f,0xc7,0x1f" + ++/* ++ * After this @err contains 0 on success or the negated trap number when ++ * the operation raises an exception. For faults this results in -EFAULT. ++ */ + #define XSTATE_OP(op, st, lmask, hmask, err) \ + asm volatile("1:" op "\n\t" \ + "xor %[err], %[err]\n" \ + "2:\n\t" \ + ".pushsection .fixup,\"ax\"\n\t" \ +- "3: movl $-2,%[err]\n\t" \ ++ "3: negl %%eax\n\t" \ + "jmp 2b\n\t" \ + ".popsection\n\t" \ +- _ASM_EXTABLE(1b, 3b) \ +- : [err] "=r" (err) \ ++ _ASM_EXTABLE_FAULT(1b, 3b) \ ++ : [err] "=a" (err) \ + : "D" (st), "m" (*st), "a" (lmask), "d" (hmask) \ + : "memory") + +-- +2.30.2 + diff --git a/queue-5.13/x86-signal-detect-and-prevent-an-alternate-signal-st.patch b/queue-5.13/x86-signal-detect-and-prevent-an-alternate-signal-st.patch new file mode 100644 index 00000000000..5a3d2cd96f5 --- /dev/null +++ b/queue-5.13/x86-signal-detect-and-prevent-an-alternate-signal-st.patch @@ -0,0 +1,142 @@ +From 9834b2d3da774f2fce382a469ab6483cb01ff590 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 18 May 2021 13:03:19 -0700 +Subject: x86/signal: Detect and prevent an alternate signal stack overflow + +From: Chang S. Bae + +[ Upstream commit 2beb4a53fc3f1081cedc1c1a198c7f56cc4fc60c ] + +The kernel pushes context on to the userspace stack to prepare for the +user's signal handler. When the user has supplied an alternate signal +stack, via sigaltstack(2), it is easy for the kernel to verify that the +stack size is sufficient for the current hardware context. + +Check if writing the hardware context to the alternate stack will exceed +it's size. If yes, then instead of corrupting user-data and proceeding with +the original signal handler, an immediate SIGSEGV signal is delivered. + +Refactor the stack pointer check code from on_sig_stack() and use the new +helper. + +While the kernel allows new source code to discover and use a sufficient +alternate signal stack size, this check is still necessary to protect +binaries with insufficient alternate signal stack size from data +corruption. + +Fixes: c2bc11f10a39 ("x86, AVX-512: Enable AVX-512 States Context Switch") +Reported-by: Florian Weimer +Suggested-by: Jann Horn +Suggested-by: Andy Lutomirski +Signed-off-by: Chang S. Bae +Signed-off-by: Borislav Petkov +Reviewed-by: Len Brown +Acked-by: Thomas Gleixner +Link: https://lkml.kernel.org/r/20210518200320.17239-6-chang.seok.bae@intel.com +Link: https://bugzilla.kernel.org/show_bug.cgi?id=153531 +Signed-off-by: Sasha Levin +--- + arch/x86/kernel/signal.c | 24 ++++++++++++++++++++---- + include/linux/sched/signal.h | 19 ++++++++++++------- + 2 files changed, 32 insertions(+), 11 deletions(-) + +diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c +index a06cb107c0e8..ca3ab89be5cc 100644 +--- a/arch/x86/kernel/signal.c ++++ b/arch/x86/kernel/signal.c +@@ -234,10 +234,11 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size, + void __user **fpstate) + { + /* Default to using normal stack */ ++ bool nested_altstack = on_sig_stack(regs->sp); ++ bool entering_altstack = false; + unsigned long math_size = 0; + unsigned long sp = regs->sp; + unsigned long buf_fx = 0; +- int onsigstack = on_sig_stack(sp); + int ret; + + /* redzone */ +@@ -246,15 +247,23 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size, + + /* This is the X/Open sanctioned signal stack switching. */ + if (ka->sa.sa_flags & SA_ONSTACK) { +- if (sas_ss_flags(sp) == 0) ++ /* ++ * This checks nested_altstack via sas_ss_flags(). Sensible ++ * programs use SS_AUTODISARM, which disables that check, and ++ * programs that don't use SS_AUTODISARM get compatible. ++ */ ++ if (sas_ss_flags(sp) == 0) { + sp = current->sas_ss_sp + current->sas_ss_size; ++ entering_altstack = true; ++ } + } else if (IS_ENABLED(CONFIG_X86_32) && +- !onsigstack && ++ !nested_altstack && + regs->ss != __USER_DS && + !(ka->sa.sa_flags & SA_RESTORER) && + ka->sa.sa_restorer) { + /* This is the legacy signal stack switching. */ + sp = (unsigned long) ka->sa.sa_restorer; ++ entering_altstack = true; + } + + sp = fpu__alloc_mathframe(sp, IS_ENABLED(CONFIG_X86_32), +@@ -267,8 +276,15 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size, + * If we are on the alternate signal stack and would overflow it, don't. + * Return an always-bogus address instead so we will die with SIGSEGV. + */ +- if (onsigstack && !likely(on_sig_stack(sp))) ++ if (unlikely((nested_altstack || entering_altstack) && ++ !__on_sig_stack(sp))) { ++ ++ if (show_unhandled_signals && printk_ratelimit()) ++ pr_info("%s[%d] overflowed sigaltstack\n", ++ current->comm, task_pid_nr(current)); ++ + return (void __user *)-1L; ++ } + + /* save i387 and extended state */ + ret = copy_fpstate_to_sigframe(*fpstate, (void __user *)buf_fx, math_size); +diff --git a/include/linux/sched/signal.h b/include/linux/sched/signal.h +index 7f4278fa21fe..0d7fec79d28f 100644 +--- a/include/linux/sched/signal.h ++++ b/include/linux/sched/signal.h +@@ -538,6 +538,17 @@ static inline int kill_cad_pid(int sig, int priv) + #define SEND_SIG_NOINFO ((struct kernel_siginfo *) 0) + #define SEND_SIG_PRIV ((struct kernel_siginfo *) 1) + ++static inline int __on_sig_stack(unsigned long sp) ++{ ++#ifdef CONFIG_STACK_GROWSUP ++ return sp >= current->sas_ss_sp && ++ sp - current->sas_ss_sp < current->sas_ss_size; ++#else ++ return sp > current->sas_ss_sp && ++ sp - current->sas_ss_sp <= current->sas_ss_size; ++#endif ++} ++ + /* + * True if we are on the alternate signal stack. + */ +@@ -555,13 +566,7 @@ static inline int on_sig_stack(unsigned long sp) + if (current->sas_ss_flags & SS_AUTODISARM) + return 0; + +-#ifdef CONFIG_STACK_GROWSUP +- return sp >= current->sas_ss_sp && +- sp - current->sas_ss_sp < current->sas_ss_size; +-#else +- return sp > current->sas_ss_sp && +- sp - current->sas_ss_sp <= current->sas_ss_size; +-#endif ++ return __on_sig_stack(sp); + } + + static inline int sas_ss_flags(unsigned long sp) +-- +2.30.2 + diff --git a/queue-5.13/xhci-handle-failed-buffer-copy-to-urb-sg-list-and-fi.patch b/queue-5.13/xhci-handle-failed-buffer-copy-to-urb-sg-list-and-fi.patch new file mode 100644 index 00000000000..ba44c017382 --- /dev/null +++ b/queue-5.13/xhci-handle-failed-buffer-copy-to-urb-sg-list-and-fi.patch @@ -0,0 +1,49 @@ +From cd58753dc2100e11b12846ffc52413f3484374ff Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 17 Jun 2021 18:03:53 +0300 +Subject: xhci: handle failed buffer copy to URB sg list and fix a W=1 copiler + warning + +From: Mathias Nyman + +[ Upstream commit 271a21d8b280b186f8cc9ca6f7151902efde9512 ] + +Set the urb->actual_length to bytes successfully copied in case all bytes +weren't copied from a temporary buffer to the URB sg list. +Also print a debug message + +Signed-off-by: Mathias Nyman +Link: https://lore.kernel.org/r/20210617150354.1512157-4-mathias.nyman@linux.intel.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/usb/host/xhci.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c +index 27283654ca08..9248ce8d09a4 100644 +--- a/drivers/usb/host/xhci.c ++++ b/drivers/usb/host/xhci.c +@@ -1361,12 +1361,17 @@ static void xhci_unmap_temp_buf(struct usb_hcd *hcd, struct urb *urb) + urb->transfer_buffer_length, + dir); + +- if (usb_urb_dir_in(urb)) ++ if (usb_urb_dir_in(urb)) { + len = sg_pcopy_from_buffer(urb->sg, urb->num_sgs, + urb->transfer_buffer, + buf_len, + 0); +- ++ if (len != buf_len) { ++ xhci_dbg(hcd_to_xhci(hcd), ++ "Copy from tmp buf to urb sg list failed\n"); ++ urb->actual_length = len; ++ } ++ } + urb->transfer_flags &= ~URB_DMA_MAP_SINGLE; + kfree(urb->transfer_buffer); + urb->transfer_buffer = NULL; +-- +2.30.2 +