From: Sasha Levin Date: Wed, 30 Nov 2022 12:55:53 +0000 (-0500) Subject: Fixes for 5.10 X-Git-Tag: v5.10.157~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1a8a3c7030b222cc46f982cb178da26e26e6ac7f;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 5.10 Signed-off-by: Sasha Levin --- diff --git a/queue-5.10/asoc-intel-bytcht_es8316-add-quirk-for-the-nanote-um.patch b/queue-5.10/asoc-intel-bytcht_es8316-add-quirk-for-the-nanote-um.patch new file mode 100644 index 00000000000..5395feac999 --- /dev/null +++ b/queue-5.10/asoc-intel-bytcht_es8316-add-quirk-for-the-nanote-um.patch @@ -0,0 +1,42 @@ +From 7bf348428db51fb8781918d00ec0d830eff7dfef Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 25 Oct 2022 16:09:42 +0200 +Subject: ASoC: Intel: bytcht_es8316: Add quirk for the Nanote UMPC-01 + +From: Hans de Goede + +[ Upstream commit 8bb0ac0e6f64ebdf15d963c26b028de391c9bcf9 ] + +The Nanote UMPC-01 mini laptop has stereo speakers, while the default +bytcht_es8316 settings assume a mono speaker setup. Add a quirk for this. + +Signed-off-by: Hans de Goede +Acked-by: Pierre-Louis Bossart +Link: https://lore.kernel.org/r/20221025140942.509066-1-hdegoede@redhat.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/intel/boards/bytcht_es8316.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/sound/soc/intel/boards/bytcht_es8316.c b/sound/soc/intel/boards/bytcht_es8316.c +index 7ed869bf1a92..81269ed5a2aa 100644 +--- a/sound/soc/intel/boards/bytcht_es8316.c ++++ b/sound/soc/intel/boards/bytcht_es8316.c +@@ -450,6 +450,13 @@ static const struct dmi_system_id byt_cht_es8316_quirk_table[] = { + | BYT_CHT_ES8316_INTMIC_IN2_MAP + | BYT_CHT_ES8316_JD_INVERTED), + }, ++ { /* Nanote UMPC-01 */ ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "RWC CO.,LTD"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "UMPC-01"), ++ }, ++ .driver_data = (void *)BYT_CHT_ES8316_INTMIC_IN1_MAP, ++ }, + { /* Teclast X98 Plus II */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "TECLAST"), +-- +2.35.1 + diff --git a/queue-5.10/dm-integrity-clear-the-journal-on-suspend.patch b/queue-5.10/dm-integrity-clear-the-journal-on-suspend.patch new file mode 100644 index 00000000000..66d9ede712d --- /dev/null +++ b/queue-5.10/dm-integrity-clear-the-journal-on-suspend.patch @@ -0,0 +1,72 @@ +From 7d0a7aa39df2788004feedf3cbe96f3e415d9282 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 15 Nov 2022 12:51:50 -0500 +Subject: dm integrity: clear the journal on suspend + +From: Mikulas Patocka + +[ Upstream commit 984bf2cc531e778e49298fdf6730e0396166aa21 ] + +There was a problem that a user burned a dm-integrity image on CDROM +and could not activate it because it had a non-empty journal. + +Fix this problem by flushing the journal (done by the previous commit) +and clearing the journal (done by this commit). Once the journal is +cleared, dm-integrity won't attempt to replay it on the next +activation. + +Signed-off-by: Mikulas Patocka +Signed-off-by: Mike Snitzer +Signed-off-by: Sasha Levin +--- + drivers/md/dm-integrity.c | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c +index 847dfd682e20..2156a2d5ac70 100644 +--- a/drivers/md/dm-integrity.c ++++ b/drivers/md/dm-integrity.c +@@ -254,6 +254,7 @@ struct dm_integrity_c { + + struct completion crypto_backoff; + ++ bool wrote_to_journal; + bool journal_uptodate; + bool just_formatted; + bool recalculate_flag; +@@ -2256,6 +2257,8 @@ static void integrity_commit(struct work_struct *w) + if (!commit_sections) + goto release_flush_bios; + ++ ic->wrote_to_journal = true; ++ + i = commit_start; + for (n = 0; n < commit_sections; n++) { + for (j = 0; j < ic->journal_section_entries; j++) { +@@ -2979,6 +2982,14 @@ static void dm_integrity_postsuspend(struct dm_target *ti) + queue_work(ic->writer_wq, &ic->writer_work); + drain_workqueue(ic->writer_wq); + dm_integrity_flush_buffers(ic, true); ++ if (ic->wrote_to_journal) { ++ init_journal(ic, ic->free_section, ++ ic->journal_sections - ic->free_section, ic->commit_seq); ++ if (ic->free_section) { ++ init_journal(ic, 0, ic->free_section, ++ next_commit_seq(ic->commit_seq)); ++ } ++ } + } + + if (ic->mode == 'B') { +@@ -3006,6 +3017,8 @@ static void dm_integrity_resume(struct dm_target *ti) + + DEBUG_print("resume\n"); + ++ ic->wrote_to_journal = false; ++ + if (ic->provided_data_sectors != old_provided_data_sectors) { + if (ic->provided_data_sectors > old_provided_data_sectors && + ic->mode == 'B' && +-- +2.35.1 + diff --git a/queue-5.10/dm-integrity-flush-the-journal-on-suspend.patch b/queue-5.10/dm-integrity-flush-the-journal-on-suspend.patch new file mode 100644 index 00000000000..1f335f5525d --- /dev/null +++ b/queue-5.10/dm-integrity-flush-the-journal-on-suspend.patch @@ -0,0 +1,52 @@ +From fcce5fa19f76925556a116051511e57930b6ffa1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 15 Nov 2022 12:48:26 -0500 +Subject: dm integrity: flush the journal on suspend + +From: Mikulas Patocka + +[ Upstream commit 5e5dab5ec763d600fe0a67837dd9155bdc42f961 ] + +This commit flushes the journal on suspend. It is prerequisite for the +next commit that enables activating dm integrity devices in read-only mode. + +Note that we deliberately didn't flush the journal on suspend, so that the +journal replay code would be tested. However, the dm-integrity code is 5 +years old now, so that journal replay is well-tested, and we can make this +change now. + +Signed-off-by: Mikulas Patocka +Signed-off-by: Mike Snitzer +Signed-off-by: Sasha Levin +--- + drivers/md/dm-integrity.c | 7 +------ + 1 file changed, 1 insertion(+), 6 deletions(-) + +diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c +index 835b1f3464d0..847dfd682e20 100644 +--- a/drivers/md/dm-integrity.c ++++ b/drivers/md/dm-integrity.c +@@ -2470,10 +2470,6 @@ static void integrity_writer(struct work_struct *w) + + unsigned prev_free_sectors; + +- /* the following test is not needed, but it tests the replay code */ +- if (unlikely(dm_post_suspending(ic->ti)) && !ic->meta_dev) +- return; +- + spin_lock_irq(&ic->endio_wait.lock); + write_start = ic->committed_section; + write_sections = ic->n_committed_sections; +@@ -2980,8 +2976,7 @@ static void dm_integrity_postsuspend(struct dm_target *ti) + drain_workqueue(ic->commit_wq); + + if (ic->mode == 'J') { +- if (ic->meta_dev) +- queue_work(ic->writer_wq, &ic->writer_work); ++ queue_work(ic->writer_wq, &ic->writer_work); + drain_workqueue(ic->writer_wq); + dm_integrity_flush_buffers(ic, true); + } +-- +2.35.1 + diff --git a/queue-5.10/gpu-host1x-avoid-trying-to-use-gart-on-tegra20.patch b/queue-5.10/gpu-host1x-avoid-trying-to-use-gart-on-tegra20.patch new file mode 100644 index 00000000000..21c770b9dcf --- /dev/null +++ b/queue-5.10/gpu-host1x-avoid-trying-to-use-gart-on-tegra20.patch @@ -0,0 +1,61 @@ +From b43543c1ea9be28e52f6de414e7cd4abedb6887c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 20 Oct 2022 15:23:40 +0100 +Subject: gpu: host1x: Avoid trying to use GART on Tegra20 + +From: Robin Murphy + +[ Upstream commit c2418f911a31a266af4fbaca998dc73d3676475a ] + +Since commit c7e3ca515e78 ("iommu/tegra: gart: Do not register with +bus") quite some time ago, the GART driver has effectively disabled +itself to avoid issues with the GPU driver expecting it to work in ways +that it doesn't. As of commit 57365a04c921 ("iommu: Move bus setup to +IOMMU device registration") that bodge no longer works, but really the +GPU driver should be responsible for its own behaviour anyway. Make the +workaround explicit. + +Reported-by: Jon Hunter +Suggested-by: Dmitry Osipenko +Signed-off-by: Robin Murphy +Tested-by: Jon Hunter +Signed-off-by: Thierry Reding +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/tegra/drm.c | 4 ++++ + drivers/gpu/host1x/dev.c | 4 ++++ + 2 files changed, 8 insertions(+) + +diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c +index 2c6ebc328b24..318692ad9680 100644 +--- a/drivers/gpu/drm/tegra/drm.c ++++ b/drivers/gpu/drm/tegra/drm.c +@@ -1042,6 +1042,10 @@ static bool host1x_drm_wants_iommu(struct host1x_device *dev) + struct host1x *host1x = dev_get_drvdata(dev->dev.parent); + struct iommu_domain *domain; + ++ /* Our IOMMU usage policy doesn't currently play well with GART */ ++ if (of_machine_is_compatible("nvidia,tegra20")) ++ return false; ++ + /* + * If the Tegra DRM clients are backed by an IOMMU, push buffers are + * likely to be allocated beyond the 32-bit boundary if sufficient +diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c +index 8659558b518d..9f674a8d5009 100644 +--- a/drivers/gpu/host1x/dev.c ++++ b/drivers/gpu/host1x/dev.c +@@ -198,6 +198,10 @@ static void host1x_setup_sid_table(struct host1x *host) + + static bool host1x_wants_iommu(struct host1x *host1x) + { ++ /* Our IOMMU usage policy doesn't currently play well with GART */ ++ if (of_machine_is_compatible("nvidia,tegra20")) ++ return false; ++ + /* + * If we support addressing a maximum of 32 bits of physical memory + * and if the host1x firewall is enabled, there's no need to enable +-- +2.35.1 + diff --git a/queue-5.10/input-goodix-try-resetting-the-controller-when-no-co.patch b/queue-5.10/input-goodix-try-resetting-the-controller-when-no-co.patch new file mode 100644 index 00000000000..95e02af4508 --- /dev/null +++ b/queue-5.10/input-goodix-try-resetting-the-controller-when-no-co.patch @@ -0,0 +1,68 @@ +From f6946f084a0879e6a5efb748c707aa7908e125ce Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 3 Nov 2022 11:31:43 -0700 +Subject: Input: goodix - try resetting the controller when no config is set + +From: Hans de Goede + +[ Upstream commit c7e37cc6240767f794678d11704935d49cc81d59 ] + +On ACPI systems (irq_pin_access_method == IRQ_PIN_ACCESS_ACPI_*) the driver +does not reset the controller at probe time, because sometimes the system +firmware loads a config and resetting might loose this config. + +On the Nanote UMPC-01 device OTOH the config is in flash of the controller, +the controller needs a reset to load this; and the system firmware does not +reset the controller on a cold boot. + +To fix the Nanote UMPC-01 touchscreen not working on a cold boot, try +resetting the controller and then re-reading the config when encountering +a config with 0 width/height/max_touch_num value and the controller has +not already been reset by goodix_ts_probe(). + +This should be safe to do in general because normally we should never +encounter a config with 0 width/height/max_touch_num. Doing this in +general not only avoids the need for a DMI quirk, but also might help +other systems. + +Signed-off-by: Hans de Goede +Reviewed-by: Bastien Nocera +Link: https://lore.kernel.org/r/20221025122930.421377-2-hdegoede@redhat.com +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/touchscreen/goodix.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c +index b23abde5d7db..b7f87ad4b9a9 100644 +--- a/drivers/input/touchscreen/goodix.c ++++ b/drivers/input/touchscreen/goodix.c +@@ -1059,6 +1059,7 @@ static int goodix_configure_dev(struct goodix_ts_data *ts) + input_set_abs_params(ts->input_dev, ABS_MT_WIDTH_MAJOR, 0, 255, 0, 0); + input_set_abs_params(ts->input_dev, ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0); + ++retry_read_config: + /* Read configuration and apply touchscreen parameters */ + goodix_read_config(ts); + +@@ -1066,6 +1067,16 @@ static int goodix_configure_dev(struct goodix_ts_data *ts) + touchscreen_parse_properties(ts->input_dev, true, &ts->prop); + + if (!ts->prop.max_x || !ts->prop.max_y || !ts->max_touch_num) { ++ if (!ts->reset_controller_at_probe && ++ ts->irq_pin_access_method != IRQ_PIN_ACCESS_NONE) { ++ dev_info(&ts->client->dev, "Config not set, resetting controller\n"); ++ /* Retry after a controller reset */ ++ ts->reset_controller_at_probe = true; ++ error = goodix_reset(ts); ++ if (error) ++ return error; ++ goto retry_read_config; ++ } + dev_err(&ts->client->dev, + "Invalid config (%d, %d, %d), using defaults\n", + ts->prop.max_x, ts->prop.max_y, ts->max_touch_num); +-- +2.35.1 + diff --git a/queue-5.10/input-soc_button_array-add-acer-switch-v-10-to-dmi_u.patch b/queue-5.10/input-soc_button_array-add-acer-switch-v-10-to-dmi_u.patch new file mode 100644 index 00000000000..683138bbfec --- /dev/null +++ b/queue-5.10/input-soc_button_array-add-acer-switch-v-10-to-dmi_u.patch @@ -0,0 +1,46 @@ +From 051fe6e2c46677a5bd13f3b7e2594e84d5850cb3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 7 Nov 2022 10:30:41 -0800 +Subject: Input: soc_button_array - add Acer Switch V 10 to + dmi_use_low_level_irq[] + +From: Hans de Goede + +[ Upstream commit e13757f52496444b994a7ac67b6e517a15d89bbc ] + +Like on the Acer Switch 10 SW5-012, the Acer Switch V 10 SW5-017's _LID +method messes with home- and power-button GPIO IRQ settings, causing an +IRQ storm. + +Add a quirk entry for the Acer Switch V 10 to the dmi_use_low_level_irq[] +DMI quirk list, to use low-level IRQs on this model, fixing the IRQ storm. + +Signed-off-by: Hans de Goede +Link: https://lore.kernel.org/r/20221106215320.67109-2-hdegoede@redhat.com +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/misc/soc_button_array.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/drivers/input/misc/soc_button_array.c b/drivers/input/misc/soc_button_array.c +index 46ba8218de99..31c02c2019c1 100644 +--- a/drivers/input/misc/soc_button_array.c ++++ b/drivers/input/misc/soc_button_array.c +@@ -77,6 +77,13 @@ static const struct dmi_system_id dmi_use_low_level_irq[] = { + DMI_MATCH(DMI_PRODUCT_NAME, "Aspire SW5-012"), + }, + }, ++ { ++ /* Acer Switch V 10 SW5-017, same issue as Acer Switch 10 SW5-012. */ ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "Acer"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "SW5-017"), ++ }, ++ }, + { + /* + * Acer One S1003. _LID method messes with power-button GPIO +-- +2.35.1 + diff --git a/queue-5.10/input-soc_button_array-add-use_low_level_irq-module-.patch b/queue-5.10/input-soc_button_array-add-use_low_level_irq-module-.patch new file mode 100644 index 00000000000..13b6049ceed --- /dev/null +++ b/queue-5.10/input-soc_button_array-add-use_low_level_irq-module-.patch @@ -0,0 +1,64 @@ +From 2b4e9dd7347b74d8f5b6aa063457c57c86e17a1f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 7 Nov 2022 10:30:25 -0800 +Subject: Input: soc_button_array - add use_low_level_irq module parameter + +From: Hans de Goede + +[ Upstream commit 8e9ada1d0e72b4737df400fe1bba48dc42a68df7 ] + +It seems that the Windows drivers for the ACPI0011 soc_button_array +device use low level triggered IRQs rather then using edge triggering. + +Some ACPI tables depend on this, directly poking the GPIO controller's +registers to clear the trigger type when closing a laptop's/2-in-1's lid +and re-instating the trigger when opening the lid again. + +Linux sets the edge/level on which to trigger to both low+high since +it is using edge type IRQs, the ACPI tables then ends up also setting +the bit for level IRQs and since both low and high level have been +selected by Linux we get an IRQ storm leading to soft lockups. + +As a workaround for this the soc_button_array already contains +a DMI quirk table with device models known to have this issue. + +Add a module parameter for this so that users can easily test if their +device is affected too and so that they can use the module parameter +as a workaround. + +Signed-off-by: Hans de Goede +Link: https://lore.kernel.org/r/20221106215320.67109-1-hdegoede@redhat.com +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/misc/soc_button_array.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/drivers/input/misc/soc_button_array.c b/drivers/input/misc/soc_button_array.c +index efffcf0ebd3b..46ba8218de99 100644 +--- a/drivers/input/misc/soc_button_array.c ++++ b/drivers/input/misc/soc_button_array.c +@@ -18,6 +18,10 @@ + #include + #include + ++static bool use_low_level_irq; ++module_param(use_low_level_irq, bool, 0444); ++MODULE_PARM_DESC(use_low_level_irq, "Use low-level triggered IRQ instead of edge triggered"); ++ + struct soc_button_info { + const char *name; + int acpi_index; +@@ -164,7 +168,8 @@ soc_button_device_create(struct platform_device *pdev, + } + + /* See dmi_use_low_level_irq[] comment */ +- if (!autorepeat && dmi_check_system(dmi_use_low_level_irq)) { ++ if (!autorepeat && (use_low_level_irq || ++ dmi_check_system(dmi_use_low_level_irq))) { + irq_set_irq_type(irq, IRQ_TYPE_LEVEL_LOW); + gpio_keys[n_buttons].irq = irq; + gpio_keys[n_buttons].gpio = -ENOENT; +-- +2.35.1 + diff --git a/queue-5.10/input-synaptics-switch-touchpad-on-hp-laptop-15-da30.patch b/queue-5.10/input-synaptics-switch-touchpad-on-hp-laptop-15-da30.patch new file mode 100644 index 00000000000..a6c43a93bea --- /dev/null +++ b/queue-5.10/input-synaptics-switch-touchpad-on-hp-laptop-15-da30.patch @@ -0,0 +1,35 @@ +From 6aeeea4bf46c0633c75a37692a2de2cdc0c1666c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 15 Oct 2022 20:41:17 -0700 +Subject: Input: synaptics - switch touchpad on HP Laptop 15-da3001TU to RMI + mode + +From: Aman Dhoot + +[ Upstream commit ac5408991ea6b06e29129b4d4861097c4c3e0d59 ] + +The device works fine in native RMI mode, there is no reason to use legacy +PS/2 mode with it. + +Signed-off-by: Aman Dhoot +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/mouse/synaptics.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c +index 82577095e175..f1013b950d57 100644 +--- a/drivers/input/mouse/synaptics.c ++++ b/drivers/input/mouse/synaptics.c +@@ -191,6 +191,7 @@ static const char * const smbus_pnp_ids[] = { + "SYN3221", /* HP 15-ay000 */ + "SYN323d", /* HP Spectre X360 13-w013dx */ + "SYN3257", /* HP Envy 13-ad105ng */ ++ "SYN3286", /* HP Laptop 15-da3001TU */ + NULL + }; + +-- +2.35.1 + diff --git a/queue-5.10/net-usb-qmi_wwan-add-telit-0x103a-composition.patch b/queue-5.10/net-usb-qmi_wwan-add-telit-0x103a-composition.patch new file mode 100644 index 00000000000..aa04814827a --- /dev/null +++ b/queue-5.10/net-usb-qmi_wwan-add-telit-0x103a-composition.patch @@ -0,0 +1,40 @@ +From d8232575d859cc879da4e288d29af18be4dff8f5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 15 Nov 2022 11:58:59 +0100 +Subject: net: usb: qmi_wwan: add Telit 0x103a composition +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Enrico Sau + +[ Upstream commit e103ba33998d0f25653cc8ebe745b68d1ee10cda ] + +Add the following Telit LE910C4-WWX composition: + +0x103a: rmnet + +Signed-off-by: Enrico Sau +Acked-by: Bjørn Mork +Link: https://lore.kernel.org/r/20221115105859.14324-1-enrico.sau@gmail.com +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + drivers/net/usb/qmi_wwan.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c +index a1c9233e264d..7313e6e03c12 100644 +--- a/drivers/net/usb/qmi_wwan.c ++++ b/drivers/net/usb/qmi_wwan.c +@@ -1292,6 +1292,7 @@ static const struct usb_device_id products[] = { + {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */ + {QMI_FIXED_INTF(0x2357, 0x9000, 4)}, /* TP-LINK MA260 */ + {QMI_QUIRK_SET_DTR(0x1bc7, 0x1031, 3)}, /* Telit LE910C1-EUX */ ++ {QMI_QUIRK_SET_DTR(0x1bc7, 0x103a, 0)}, /* Telit LE910C4-WWX */ + {QMI_QUIRK_SET_DTR(0x1bc7, 0x1040, 2)}, /* Telit LE922A */ + {QMI_QUIRK_SET_DTR(0x1bc7, 0x1050, 2)}, /* Telit FN980 */ + {QMI_QUIRK_SET_DTR(0x1bc7, 0x1060, 2)}, /* Telit LN920 */ +-- +2.35.1 + diff --git a/queue-5.10/platform-x86-acer-wmi-enable-sw_tablet_mode-on-switc.patch b/queue-5.10/platform-x86-acer-wmi-enable-sw_tablet_mode-on-switc.patch new file mode 100644 index 00000000000..fb11000dac7 --- /dev/null +++ b/queue-5.10/platform-x86-acer-wmi-enable-sw_tablet_mode-on-switc.patch @@ -0,0 +1,48 @@ +From 32520035c824608e251b06d481c80248333bc068 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 11 Nov 2022 12:16:39 +0100 +Subject: platform/x86: acer-wmi: Enable SW_TABLET_MODE on Switch V 10 + (SW5-017) + +From: Hans de Goede + +[ Upstream commit 1e817b889c7d8c14e7005258e15fec62edafe03c ] + +Like the Acer Switch 10 (SW5-012) and Acer Switch 10 (S1003) models +the Acer Switch V 10 (SW5-017) supports reporting SW_TABLET_MODE +through acer-wmi. + +Add a DMI quirk for the SW5-017 setting force_caps to ACER_CAP_KBD_DOCK +(these devices have no other acer-wmi based functionality). + +Cc: Rudolf Polzer +Signed-off-by: Hans de Goede +Link: https://lore.kernel.org/r/20221111111639.35730-1-hdegoede@redhat.com +Signed-off-by: Sasha Levin +--- + drivers/platform/x86/acer-wmi.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c +index 8e696262215f..ebec49957ed0 100644 +--- a/drivers/platform/x86/acer-wmi.c ++++ b/drivers/platform/x86/acer-wmi.c +@@ -536,6 +536,15 @@ static const struct dmi_system_id acer_quirks[] __initconst = { + }, + .driver_data = (void *)ACER_CAP_KBD_DOCK, + }, ++ { ++ .callback = set_force_caps, ++ .ident = "Acer Aspire Switch V 10 SW5-017", ++ .matches = { ++ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Acer"), ++ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "SW5-017"), ++ }, ++ .driver_data = (void *)ACER_CAP_KBD_DOCK, ++ }, + { + .callback = set_force_caps, + .ident = "Acer One 10 (S1003)", +-- +2.35.1 + diff --git a/queue-5.10/platform-x86-asus-wmi-add-missing-pci_dev_put-in-asu.patch b/queue-5.10/platform-x86-asus-wmi-add-missing-pci_dev_put-in-asu.patch new file mode 100644 index 00000000000..1d336ba0c08 --- /dev/null +++ b/queue-5.10/platform-x86-asus-wmi-add-missing-pci_dev_put-in-asu.patch @@ -0,0 +1,39 @@ +From fc09c1b12949a23b1067492e8f937ef736c874d4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 11 Nov 2022 18:07:52 +0800 +Subject: platform/x86: asus-wmi: add missing pci_dev_put() in + asus_wmi_set_xusb2pr() + +From: Xiongfeng Wang + +[ Upstream commit d0cdd85046b15089df71a50548617ac1025300d0 ] + +pci_get_device() will increase the reference count for the returned +pci_dev. We need to use pci_dev_put() to decrease the reference count +before asus_wmi_set_xusb2pr() returns. + +Signed-off-by: Xiongfeng Wang +Link: https://lore.kernel.org/r/20221111100752.134311-1-wangxiongfeng2@huawei.com +Reviewed-by: Hans de Goede +Signed-off-by: Hans de Goede +Signed-off-by: Sasha Levin +--- + drivers/platform/x86/asus-wmi.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c +index 39e1a6396e08..db369cf26111 100644 +--- a/drivers/platform/x86/asus-wmi.c ++++ b/drivers/platform/x86/asus-wmi.c +@@ -1212,6 +1212,8 @@ static void asus_wmi_set_xusb2pr(struct asus_wmi *asus) + pci_write_config_dword(xhci_pdev, USB_INTEL_XUSB2PR, + cpu_to_le32(ports_available)); + ++ pci_dev_put(xhci_pdev); ++ + pr_info("set USB_INTEL_XUSB2PR old: 0x%04x, new: 0x%04x\n", + orig_ports_available, ports_available); + } +-- +2.35.1 + diff --git a/queue-5.10/platform-x86-hp-wmi-ignore-smart-experience-app-even.patch b/queue-5.10/platform-x86-hp-wmi-ignore-smart-experience-app-even.patch new file mode 100644 index 00000000000..7c763ff1b96 --- /dev/null +++ b/queue-5.10/platform-x86-hp-wmi-ignore-smart-experience-app-even.patch @@ -0,0 +1,48 @@ +From 21081fae676285b989df99b29fd6666f7039e0e7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 14 Nov 2022 15:38:41 +0800 +Subject: platform/x86: hp-wmi: Ignore Smart Experience App event + +From: Kai-Heng Feng + +[ Upstream commit 8b9b6a044b408283b086702b1d9e3cf4ba45b426 ] + +Sometimes hp-wmi driver complains on system resume: +[ 483.116451] hp_wmi: Unknown event_id - 33 - 0x0 + +According to HP it's a feature called "HP Smart Experience App" and it's +safe to be ignored. + +Signed-off-by: Kai-Heng Feng +Link: https://lore.kernel.org/r/20221114073842.205392-1-kai.heng.feng@canonical.com +Reviewed-by: Hans de Goede +Signed-off-by: Hans de Goede +Signed-off-by: Sasha Levin +--- + drivers/platform/x86/hp-wmi.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c +index 519b2ab84a63..6642d09b17b5 100644 +--- a/drivers/platform/x86/hp-wmi.c ++++ b/drivers/platform/x86/hp-wmi.c +@@ -63,6 +63,7 @@ enum hp_wmi_event_ids { + HPWMI_PEAKSHIFT_PERIOD = 0x0F, + HPWMI_BATTERY_CHARGE_PERIOD = 0x10, + HPWMI_SANITIZATION_MODE = 0x17, ++ HPWMI_SMART_EXPERIENCE_APP = 0x21, + }; + + struct bios_args { +@@ -632,6 +633,8 @@ static void hp_wmi_notify(u32 value, void *context) + break; + case HPWMI_SANITIZATION_MODE: + break; ++ case HPWMI_SMART_EXPERIENCE_APP: ++ break; + default: + pr_info("Unknown event_id - %d - 0x%x\n", event_id, event_data); + break; +-- +2.35.1 + diff --git a/queue-5.10/serial-8250-8250_omap-avoid-rs485-rts-glitch-on-set_.patch b/queue-5.10/serial-8250-8250_omap-avoid-rs485-rts-glitch-on-set_.patch new file mode 100644 index 00000000000..d14962d3e06 --- /dev/null +++ b/queue-5.10/serial-8250-8250_omap-avoid-rs485-rts-glitch-on-set_.patch @@ -0,0 +1,94 @@ +From 9ec4f3db461d982881a81d19f6ec587afe2526a3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 27 Sep 2022 13:52:34 +0200 +Subject: serial: 8250: 8250_omap: Avoid RS485 RTS glitch on ->set_termios() + +From: Lukas Wunner + +[ Upstream commit 038ee49fef18710bedd38b531d173ccd746b2d8d ] + +RS485-enabled UART ports on TI Sitara SoCs with active-low polarity +exhibit a Transmit Enable glitch on ->set_termios(): + +omap8250_restore_regs(), which is called from omap_8250_set_termios(), +sets the TCRTLR bit in the MCR register and clears all other bits, +including RTS. If RTS uses active-low polarity, it is now asserted +for no reason. + +The TCRTLR bit is subsequently cleared by writing up->mcr to the MCR +register. That variable is always zero, so the RTS bit is still cleared +(incorrectly so if RTS is active-high). + +(up->mcr is not, as one might think, a cache of the MCR register's +current value. Rather, it only caches a single bit of that register, +the AFE bit. And it only does so if the UART supports the AFE bit, +which OMAP does not. For details see serial8250_do_set_termios() and +serial8250_do_set_mctrl().) + +Finally at the end of omap8250_restore_regs(), the MCR register is +restored (and RTS deasserted) by a call to up->port.ops->set_mctrl() +(which equals serial8250_set_mctrl()) and serial8250_em485_stop_tx(). + +So there's an RTS glitch between setting TCRTLR and calling +serial8250_em485_stop_tx(). Avoid by using a read-modify-write +when setting TCRTLR. + +While at it, drop a redundant initialization of up->mcr. As explained +above, the variable isn't used by the driver and it is already +initialized to zero because it is part of the static struct +serial8250_ports[] declared in 8250_core.c. (Static structs are +initialized to zero per section 6.7.8 nr. 10 of the C99 standard.) + +Cc: Jan Kiszka +Cc: Su Bao Cheng +Tested-by: Matthias Schiffer +Signed-off-by: Lukas Wunner +Link: https://lore.kernel.org/r/6554b0241a2c7fd50f32576fdbafed96709e11e8.1664278942.git.lukas@wunner.de +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/tty/serial/8250/8250_omap.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c +index 3f7379f16a36..483fff3a95c9 100644 +--- a/drivers/tty/serial/8250/8250_omap.c ++++ b/drivers/tty/serial/8250/8250_omap.c +@@ -293,6 +293,7 @@ static void omap8250_restore_regs(struct uart_8250_port *up) + { + struct omap8250_priv *priv = up->port.private_data; + struct uart_8250_dma *dma = up->dma; ++ u8 mcr = serial8250_in_MCR(up); + + if (dma && dma->tx_running) { + /* +@@ -309,7 +310,7 @@ static void omap8250_restore_regs(struct uart_8250_port *up) + serial_out(up, UART_EFR, UART_EFR_ECB); + + serial_out(up, UART_LCR, UART_LCR_CONF_MODE_A); +- serial8250_out_MCR(up, UART_MCR_TCRTLR); ++ serial8250_out_MCR(up, mcr | UART_MCR_TCRTLR); + serial_out(up, UART_FCR, up->fcr); + + omap8250_update_scr(up, priv); +@@ -325,7 +326,8 @@ static void omap8250_restore_regs(struct uart_8250_port *up) + serial_out(up, UART_LCR, 0); + + /* drop TCR + TLR access, we setup XON/XOFF later */ +- serial8250_out_MCR(up, up->mcr); ++ serial8250_out_MCR(up, mcr); ++ + serial_out(up, UART_IER, up->ier); + + serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B); +@@ -684,7 +686,6 @@ static int omap_8250_startup(struct uart_port *port) + + pm_runtime_get_sync(port->dev); + +- up->mcr = 0; + serial_out(up, UART_FCR, UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT); + + serial_out(up, UART_LCR, UART_LCR_WLEN8); +-- +2.35.1 + diff --git a/queue-5.10/series b/queue-5.10/series index 8764c0eeb4e..e213a8a9d77 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -128,3 +128,20 @@ binder-defer-copies-of-pre-patched-txn-data.patch binder-fix-pointer-cast-warning.patch binder-address-corner-cases-in-deferred-copy-and-fixup.patch binder-gracefully-handle-binder_type_fda-objects-with-num_fds-0.patch +input-synaptics-switch-touchpad-on-hp-laptop-15-da30.patch +asoc-intel-bytcht_es8316-add-quirk-for-the-nanote-um.patch +serial-8250-8250_omap-avoid-rs485-rts-glitch-on-set_.patch +input-goodix-try-resetting-the-controller-when-no-co.patch +input-soc_button_array-add-use_low_level_irq-module-.patch +input-soc_button_array-add-acer-switch-v-10-to-dmi_u.patch +xen-pciback-allow-setting-pci_msix_flags_maskall-too.patch +xen-platform-pci-add-missing-free_irq-in-error-path.patch +platform-x86-asus-wmi-add-missing-pci_dev_put-in-asu.patch +platform-x86-acer-wmi-enable-sw_tablet_mode-on-switc.patch +zonefs-fix-zone-report-size-in-__zonefs_io_error.patch +platform-x86-hp-wmi-ignore-smart-experience-app-even.patch +tcp-configurable-source-port-perturb-table-size.patch +net-usb-qmi_wwan-add-telit-0x103a-composition.patch +gpu-host1x-avoid-trying-to-use-gart-on-tegra20.patch +dm-integrity-flush-the-journal-on-suspend.patch +dm-integrity-clear-the-journal-on-suspend.patch diff --git a/queue-5.10/tcp-configurable-source-port-perturb-table-size.patch b/queue-5.10/tcp-configurable-source-port-perturb-table-size.patch new file mode 100644 index 00000000000..906b4ddba63 --- /dev/null +++ b/queue-5.10/tcp-configurable-source-port-perturb-table-size.patch @@ -0,0 +1,78 @@ +From 56897df0d9ed5f92557f0db6ba3b556fbdb29ca5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 14 Nov 2022 22:56:16 +0000 +Subject: tcp: configurable source port perturb table size + +From: Gleb Mazovetskiy + +[ Upstream commit aeac4ec8f46d610a10adbaeff5e2edf6a88ffc62 ] + +On embedded systems with little memory and no relevant +security concerns, it is beneficial to reduce the size +of the table. + +Reducing the size from 2^16 to 2^8 saves 255 KiB +of kernel RAM. + +Makes the table size configurable as an expert option. + +The size was previously increased from 2^8 to 2^16 +in commit 4c2c8f03a5ab ("tcp: increase source port perturb table to +2^16"). + +Signed-off-by: Gleb Mazovetskiy +Reviewed-by: Kuniyuki Iwashima +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + net/ipv4/Kconfig | 10 ++++++++++ + net/ipv4/inet_hashtables.c | 10 +++++----- + 2 files changed, 15 insertions(+), 5 deletions(-) + +diff --git a/net/ipv4/Kconfig b/net/ipv4/Kconfig +index 87983e70f03f..23b06063e1a5 100644 +--- a/net/ipv4/Kconfig ++++ b/net/ipv4/Kconfig +@@ -403,6 +403,16 @@ config INET_IPCOMP + + If unsure, say Y. + ++config INET_TABLE_PERTURB_ORDER ++ int "INET: Source port perturbation table size (as power of 2)" if EXPERT ++ default 16 ++ help ++ Source port perturbation table size (as power of 2) for ++ RFC 6056 3.3.4. Algorithm 4: Double-Hash Port Selection Algorithm. ++ ++ The default is almost always what you want. ++ Only change this if you know what you are doing. ++ + config INET_XFRM_TUNNEL + tristate + select INET_TUNNEL +diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c +index c0de655fffd7..c68a1dae25ca 100644 +--- a/net/ipv4/inet_hashtables.c ++++ b/net/ipv4/inet_hashtables.c +@@ -721,13 +721,13 @@ EXPORT_SYMBOL_GPL(inet_unhash); + * Note that we use 32bit integers (vs RFC 'short integers') + * because 2^16 is not a multiple of num_ephemeral and this + * property might be used by clever attacker. ++ * + * RFC claims using TABLE_LENGTH=10 buckets gives an improvement, though +- * attacks were since demonstrated, thus we use 65536 instead to really +- * give more isolation and privacy, at the expense of 256kB of kernel +- * memory. ++ * attacks were since demonstrated, thus we use 65536 by default instead ++ * to really give more isolation and privacy, at the expense of 256kB ++ * of kernel memory. + */ +-#define INET_TABLE_PERTURB_SHIFT 16 +-#define INET_TABLE_PERTURB_SIZE (1 << INET_TABLE_PERTURB_SHIFT) ++#define INET_TABLE_PERTURB_SIZE (1 << CONFIG_INET_TABLE_PERTURB_ORDER) + static u32 *table_perturb; + + int __inet_hash_connect(struct inet_timewait_death_row *death_row, +-- +2.35.1 + diff --git a/queue-5.10/xen-pciback-allow-setting-pci_msix_flags_maskall-too.patch b/queue-5.10/xen-pciback-allow-setting-pci_msix_flags_maskall-too.patch new file mode 100644 index 00000000000..fb53b83572b --- /dev/null +++ b/queue-5.10/xen-pciback-allow-setting-pci_msix_flags_maskall-too.patch @@ -0,0 +1,69 @@ +From 61269e49d86e74f17545b1357bd2bdbf6f4cd9f2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 14 Nov 2022 11:31:08 +0100 +Subject: xen-pciback: Allow setting PCI_MSIX_FLAGS_MASKALL too +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Marek Marczykowski-Górecki + +[ Upstream commit 5e29500eba2aa19e1323df46f64dafcd4a327092 ] + +When Xen domain configures MSI-X, the usual approach is to enable MSI-X +together with masking all of them via the config space, then fill the +table and only then clear PCI_MSIX_FLAGS_MASKALL. Allow doing this via +QEMU running in a stub domain. + +Previously, when changing PCI_MSIX_FLAGS_MASKALL was not allowed, the +whole write was aborted, preventing change to the PCI_MSIX_FLAGS_ENABLE +bit too. + +Note the Xen hypervisor intercepts this write anyway, and may keep the +PCI_MSIX_FLAGS_MASKALL bit set if it wishes to. It will store the +guest-requested state and will apply it eventually. + +Signed-off-by: Marek Marczykowski-Górecki +Reviewed-by: Jan Beulich +Link: https://lore.kernel.org/r/20221114103110.1519413-1-marmarek@invisiblethingslab.com +Signed-off-by: Juergen Gross +Signed-off-by: Sasha Levin +--- + drivers/xen/xen-pciback/conf_space_capability.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/drivers/xen/xen-pciback/conf_space_capability.c b/drivers/xen/xen-pciback/conf_space_capability.c +index 5e53b4817f16..097316a74126 100644 +--- a/drivers/xen/xen-pciback/conf_space_capability.c ++++ b/drivers/xen/xen-pciback/conf_space_capability.c +@@ -190,13 +190,16 @@ static const struct config_field caplist_pm[] = { + }; + + static struct msi_msix_field_config { +- u16 enable_bit; /* bit for enabling MSI/MSI-X */ +- unsigned int int_type; /* interrupt type for exclusiveness check */ ++ u16 enable_bit; /* bit for enabling MSI/MSI-X */ ++ u16 allowed_bits; /* bits allowed to be changed */ ++ unsigned int int_type; /* interrupt type for exclusiveness check */ + } msi_field_config = { + .enable_bit = PCI_MSI_FLAGS_ENABLE, ++ .allowed_bits = PCI_MSI_FLAGS_ENABLE, + .int_type = INTERRUPT_TYPE_MSI, + }, msix_field_config = { + .enable_bit = PCI_MSIX_FLAGS_ENABLE, ++ .allowed_bits = PCI_MSIX_FLAGS_ENABLE | PCI_MSIX_FLAGS_MASKALL, + .int_type = INTERRUPT_TYPE_MSIX, + }; + +@@ -229,7 +232,7 @@ static int msi_msix_flags_write(struct pci_dev *dev, int offset, u16 new_value, + return 0; + + if (!dev_data->allow_interrupt_control || +- (new_value ^ old_value) & ~field_config->enable_bit) ++ (new_value ^ old_value) & ~field_config->allowed_bits) + return PCIBIOS_SET_FAILED; + + if (new_value & field_config->enable_bit) { +-- +2.35.1 + diff --git a/queue-5.10/xen-platform-pci-add-missing-free_irq-in-error-path.patch b/queue-5.10/xen-platform-pci-add-missing-free_irq-in-error-path.patch new file mode 100644 index 00000000000..10a127fd31b --- /dev/null +++ b/queue-5.10/xen-platform-pci-add-missing-free_irq-in-error-path.patch @@ -0,0 +1,54 @@ +From 0e33b8aa3da1b859133bb7804eac9e1108fbb73a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 14 Nov 2022 19:21:24 +0800 +Subject: xen/platform-pci: add missing free_irq() in error path + +From: ruanjinjie + +[ Upstream commit c53717e1e3f0d0f9129b2e0dbc6dcc5e0a8132e9 ] + +free_irq() is missing in case of error in platform_pci_probe(), fix that. + +Signed-off-by: ruanjinjie +Reviewed-by: Oleksandr Tyshchenko +Link: https://lore.kernel.org/r/20221114112124.1965611-1-ruanjinjie@huawei.com +Signed-off-by: Juergen Gross +Signed-off-by: Sasha Levin +--- + drivers/xen/platform-pci.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/drivers/xen/platform-pci.c b/drivers/xen/platform-pci.c +index 9db557b76511..804d8f4d0e73 100644 +--- a/drivers/xen/platform-pci.c ++++ b/drivers/xen/platform-pci.c +@@ -137,7 +137,7 @@ static int platform_pci_probe(struct pci_dev *pdev, + if (ret) { + dev_warn(&pdev->dev, "Unable to set the evtchn callback " + "err=%d\n", ret); +- goto out; ++ goto irq_out; + } + } + +@@ -145,13 +145,16 @@ static int platform_pci_probe(struct pci_dev *pdev, + grant_frames = alloc_xen_mmio(PAGE_SIZE * max_nr_gframes); + ret = gnttab_setup_auto_xlat_frames(grant_frames); + if (ret) +- goto out; ++ goto irq_out; + ret = gnttab_init(); + if (ret) + goto grant_out; + return 0; + grant_out: + gnttab_free_auto_xlat_frames(); ++irq_out: ++ if (!xen_have_vector_callback) ++ free_irq(pdev->irq, pdev); + out: + pci_release_region(pdev, 0); + mem_out: +-- +2.35.1 + diff --git a/queue-5.10/zonefs-fix-zone-report-size-in-__zonefs_io_error.patch b/queue-5.10/zonefs-fix-zone-report-size-in-__zonefs_io_error.patch new file mode 100644 index 00000000000..6305a9b2f93 --- /dev/null +++ b/queue-5.10/zonefs-fix-zone-report-size-in-__zonefs_io_error.patch @@ -0,0 +1,142 @@ +From 09b66fbb4730113affad6ebc3e8fa27022b2bf5f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 25 Oct 2022 13:39:31 +0900 +Subject: zonefs: fix zone report size in __zonefs_io_error() + +From: Damien Le Moal + +[ Upstream commit 7dd12d65ac646046a3fe0bbf9a4e86f4514207b3 ] + +When an IO error occurs, the function __zonefs_io_error() is used to +issue a zone report to obtain the latest zone information from the +device. This function gets a zone report for all zones used as storage +for a file, which is always 1 zone except for files representing +aggregated conventional zones. + +The number of zones of a zone report for a file is calculated in +__zonefs_io_error() by doing a bit-shift of the inode i_zone_size field, +which is equal to or larger than the device zone size. However, this +calculation does not take into account that the last zone of a zoned +device may be smaller than the zone size reported by bdev_zone_sectors() +(which is used to set the bit shift size). As a result, if an error +occurs for an IO targetting such last smaller zone, the zone report will +ask for 0 zones, leading to an invalid zone report. + +Fix this by using the fact that all files require a 1 zone report, +except if the inode i_zone_size field indicates a zone size larger than +the device zone size. This exception case corresponds to a mount with +aggregated conventional zones. + +A check for this exception is added to the file inode initialization +during mount. If an invalid setup is detected, emit an error and fail +the mount (check contributed by Johannes Thumshirn). + +Signed-off-by: Johannes Thumshirn +Signed-off-by: Damien Le Moal +Signed-off-by: Sasha Levin +--- + fs/zonefs/super.c | 37 +++++++++++++++++++++++++++---------- + 1 file changed, 27 insertions(+), 10 deletions(-) + +diff --git a/fs/zonefs/super.c b/fs/zonefs/super.c +index bf5cb6efb8c0..475d23a4f8da 100644 +--- a/fs/zonefs/super.c ++++ b/fs/zonefs/super.c +@@ -440,14 +440,22 @@ static void __zonefs_io_error(struct inode *inode, bool write) + struct super_block *sb = inode->i_sb; + struct zonefs_sb_info *sbi = ZONEFS_SB(sb); + unsigned int noio_flag; +- unsigned int nr_zones = +- zi->i_zone_size >> (sbi->s_zone_sectors_shift + SECTOR_SHIFT); ++ unsigned int nr_zones = 1; + struct zonefs_ioerr_data err = { + .inode = inode, + .write = write, + }; + int ret; + ++ /* ++ * The only files that have more than one zone are conventional zone ++ * files with aggregated conventional zones, for which the inode zone ++ * size is always larger than the device zone size. ++ */ ++ if (zi->i_zone_size > bdev_zone_sectors(sb->s_bdev)) ++ nr_zones = zi->i_zone_size >> ++ (sbi->s_zone_sectors_shift + SECTOR_SHIFT); ++ + /* + * Memory allocations in blkdev_report_zones() can trigger a memory + * reclaim which may in turn cause a recursion into zonefs as well as +@@ -1364,6 +1372,14 @@ static int zonefs_init_file_inode(struct inode *inode, struct blk_zone *zone, + zi->i_ztype = type; + zi->i_zsector = zone->start; + zi->i_zone_size = zone->len << SECTOR_SHIFT; ++ if (zi->i_zone_size > bdev_zone_sectors(sb->s_bdev) << SECTOR_SHIFT && ++ !(sbi->s_features & ZONEFS_F_AGGRCNV)) { ++ zonefs_err(sb, ++ "zone size %llu doesn't match device's zone sectors %llu\n", ++ zi->i_zone_size, ++ bdev_zone_sectors(sb->s_bdev) << SECTOR_SHIFT); ++ return -EINVAL; ++ } + + zi->i_max_size = min_t(loff_t, MAX_LFS_FILESIZE, + zone->capacity << SECTOR_SHIFT); +@@ -1406,11 +1422,11 @@ static struct dentry *zonefs_create_inode(struct dentry *parent, + struct inode *dir = d_inode(parent); + struct dentry *dentry; + struct inode *inode; +- int ret; ++ int ret = -ENOMEM; + + dentry = d_alloc_name(parent, name); + if (!dentry) +- return NULL; ++ return ERR_PTR(ret); + + inode = new_inode(parent->d_sb); + if (!inode) +@@ -1435,7 +1451,7 @@ static struct dentry *zonefs_create_inode(struct dentry *parent, + dput: + dput(dentry); + +- return NULL; ++ return ERR_PTR(ret); + } + + struct zonefs_zone_data { +@@ -1455,7 +1471,7 @@ static int zonefs_create_zgroup(struct zonefs_zone_data *zd, + struct blk_zone *zone, *next, *end; + const char *zgroup_name; + char *file_name; +- struct dentry *dir; ++ struct dentry *dir, *dent; + unsigned int n = 0; + int ret; + +@@ -1473,8 +1489,8 @@ static int zonefs_create_zgroup(struct zonefs_zone_data *zd, + zgroup_name = "seq"; + + dir = zonefs_create_inode(sb->s_root, zgroup_name, NULL, type); +- if (!dir) { +- ret = -ENOMEM; ++ if (IS_ERR(dir)) { ++ ret = PTR_ERR(dir); + goto free; + } + +@@ -1520,8 +1536,9 @@ static int zonefs_create_zgroup(struct zonefs_zone_data *zd, + * Use the file number within its group as file name. + */ + snprintf(file_name, ZONEFS_NAME_MAX - 1, "%u", n); +- if (!zonefs_create_inode(dir, file_name, zone, type)) { +- ret = -ENOMEM; ++ dent = zonefs_create_inode(dir, file_name, zone, type); ++ if (IS_ERR(dent)) { ++ ret = PTR_ERR(dent); + goto free; + } + +-- +2.35.1 +