From: Sasha Levin Date: Sun, 2 Oct 2022 17:51:58 +0000 (-0400) Subject: Fixes for 4.9 X-Git-Tag: v5.19.13~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3a6f7057c852ba81f3407c378490cbb189712155;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 4.9 Signed-off-by: Sasha Levin --- diff --git a/queue-4.9/clk-iproc-do-not-rely-on-node-name-for-correct-pll-s.patch b/queue-4.9/clk-iproc-do-not-rely-on-node-name-for-correct-pll-s.patch new file mode 100644 index 00000000000..f91b962d816 --- /dev/null +++ b/queue-4.9/clk-iproc-do-not-rely-on-node-name-for-correct-pll-s.patch @@ -0,0 +1,82 @@ +From 9ec6212e0f222482fd0c56852ef4cde5a5028b87 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 5 Sep 2022 09:15:03 -0700 +Subject: clk: iproc: Do not rely on node name for correct PLL setup +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Florian Fainelli + +[ Upstream commit 1b24a132eba7a1c19475ba2510ec1c00af3ff914 ] + +After commit 31fd9b79dc58 ("ARM: dts: BCM5301X: update CRU block +description") a warning from clk-iproc-pll.c was generated due to a +duplicate PLL name as well as the console stopped working. Upon closer +inspection it became clear that iproc_pll_clk_setup() used the Device +Tree node unit name as an unique identifier as well as a parent name to +parent all clocks under the PLL. + +BCM5301X was the first platform on which that got noticed because of the +DT node unit name renaming but the same assumptions hold true for any +user of the iproc_pll_clk_setup() function. + +The first 'clock-output-names' property is always guaranteed to be +unique as well as providing the actual desired PLL clock name, so we +utilize that to register the PLL and as a parent name of all children +clock. + +Fixes: 5fe225c105fd ("clk: iproc: add initial common clock support") +Signed-off-by: Florian Fainelli +Acked-by: Rafał Miłecki +Link: https://lore.kernel.org/r/20220905161504.1526-1-f.fainelli@gmail.com +Signed-off-by: Stephen Boyd +Signed-off-by: Sasha Levin +--- + drivers/clk/bcm/clk-iproc-pll.c | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +diff --git a/drivers/clk/bcm/clk-iproc-pll.c b/drivers/clk/bcm/clk-iproc-pll.c +index 53006f4305f8..d52f2b810a4b 100644 +--- a/drivers/clk/bcm/clk-iproc-pll.c ++++ b/drivers/clk/bcm/clk-iproc-pll.c +@@ -621,6 +621,7 @@ void __init iproc_pll_clk_setup(struct device_node *node, + const char *parent_name; + struct iproc_clk *iclk_array; + struct clk_hw_onecell_data *clk_data; ++ const char *clk_name; + + if (WARN_ON(!pll_ctrl) || WARN_ON(!clk_ctrl)) + return; +@@ -669,7 +670,12 @@ void __init iproc_pll_clk_setup(struct device_node *node, + iclk = &iclk_array[0]; + iclk->pll = pll; + +- init.name = node->name; ++ ret = of_property_read_string_index(node, "clock-output-names", ++ 0, &clk_name); ++ if (WARN_ON(ret)) ++ goto err_pll_register; ++ ++ init.name = clk_name; + init.ops = &iproc_pll_ops; + init.flags = 0; + parent_name = of_clk_get_parent_name(node, 0); +@@ -689,13 +695,11 @@ void __init iproc_pll_clk_setup(struct device_node *node, + goto err_pll_register; + + clk_data->hws[0] = &iclk->hw; ++ parent_name = clk_name; + + /* now initialize and register all leaf clocks */ + for (i = 1; i < num_clks; i++) { +- const char *clk_name; +- + memset(&init, 0, sizeof(init)); +- parent_name = node->name; + + ret = of_property_read_string_index(node, "clock-output-names", + i, &clk_name); +-- +2.35.1 + diff --git a/queue-4.9/clk-iproc-minor-tidy-up-of-iproc-pll-data-structures.patch b/queue-4.9/clk-iproc-minor-tidy-up-of-iproc-pll-data-structures.patch new file mode 100644 index 00000000000..76a64130142 --- /dev/null +++ b/queue-4.9/clk-iproc-minor-tidy-up-of-iproc-pll-data-structures.patch @@ -0,0 +1,269 @@ +From 7eba9ac89b7e2756e9c63c491381d439f19642c1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 14 Aug 2017 12:00:41 -0700 +Subject: clk: iproc: Minor tidy up of iproc pll data structures + +From: Lori Hikichi + +[ Upstream commit b33db49783763e1b2a63b12fbe0e91fb7147a987 ] + +There were a few fields in the iproc pll data structures that were +holding information that was not true state information. +Using stack variables is sufficient and simplifies the structure. +There are not any functional changes in this commit. + +Signed-off-by: Lori Hikichi +Signed-off-by: Stephen Boyd +Stable-dep-of: 1b24a132eba7 ("clk: iproc: Do not rely on node name for correct PLL setup") +Signed-off-by: Sasha Levin +--- + drivers/clk/bcm/clk-iproc-pll.c | 83 ++++++++++++++------------------- + 1 file changed, 36 insertions(+), 47 deletions(-) + +diff --git a/drivers/clk/bcm/clk-iproc-pll.c b/drivers/clk/bcm/clk-iproc-pll.c +index e04634c46395..53006f4305f8 100644 +--- a/drivers/clk/bcm/clk-iproc-pll.c ++++ b/drivers/clk/bcm/clk-iproc-pll.c +@@ -69,16 +69,6 @@ enum vco_freq_range { + VCO_MAX = 4000000000U, + }; + +-struct iproc_pll; +- +-struct iproc_clk { +- struct clk_hw hw; +- const char *name; +- struct iproc_pll *pll; +- unsigned long rate; +- const struct iproc_clk_ctrl *ctrl; +-}; +- + struct iproc_pll { + void __iomem *status_base; + void __iomem *control_base; +@@ -88,9 +78,12 @@ struct iproc_pll { + const struct iproc_pll_ctrl *ctrl; + const struct iproc_pll_vco_param *vco_param; + unsigned int num_vco_entries; ++}; + +- struct clk_hw_onecell_data *clk_data; +- struct iproc_clk *clks; ++struct iproc_clk { ++ struct clk_hw hw; ++ struct iproc_pll *pll; ++ const struct iproc_clk_ctrl *ctrl; + }; + + #define to_iproc_clk(hw) container_of(hw, struct iproc_clk, hw) +@@ -263,6 +256,7 @@ static int pll_set_rate(struct iproc_clk *clk, unsigned int rate_index, + u32 val; + enum kp_band kp_index; + unsigned long ref_freq; ++ const char *clk_name = clk_hw_get_name(&clk->hw); + + /* + * reference frequency = parent frequency / PDIV +@@ -285,19 +279,19 @@ static int pll_set_rate(struct iproc_clk *clk, unsigned int rate_index, + kp_index = KP_BAND_HIGH_HIGH; + } else { + pr_err("%s: pll: %s has invalid rate: %lu\n", __func__, +- clk->name, rate); ++ clk_name, rate); + return -EINVAL; + } + + kp = get_kp(ref_freq, kp_index); + if (kp < 0) { +- pr_err("%s: pll: %s has invalid kp\n", __func__, clk->name); ++ pr_err("%s: pll: %s has invalid kp\n", __func__, clk_name); + return kp; + } + + ret = __pll_enable(pll); + if (ret) { +- pr_err("%s: pll: %s fails to enable\n", __func__, clk->name); ++ pr_err("%s: pll: %s fails to enable\n", __func__, clk_name); + return ret; + } + +@@ -354,7 +348,7 @@ static int pll_set_rate(struct iproc_clk *clk, unsigned int rate_index, + + ret = pll_wait_for_lock(pll); + if (ret < 0) { +- pr_err("%s: pll: %s failed to lock\n", __func__, clk->name); ++ pr_err("%s: pll: %s failed to lock\n", __func__, clk_name); + return ret; + } + +@@ -390,16 +384,15 @@ static unsigned long iproc_pll_recalc_rate(struct clk_hw *hw, + u32 val; + u64 ndiv, ndiv_int, ndiv_frac; + unsigned int pdiv; ++ unsigned long rate; + + if (parent_rate == 0) + return 0; + + /* PLL needs to be locked */ + val = readl(pll->status_base + ctrl->status.offset); +- if ((val & (1 << ctrl->status.shift)) == 0) { +- clk->rate = 0; ++ if ((val & (1 << ctrl->status.shift)) == 0) + return 0; +- } + + /* + * PLL output frequency = +@@ -421,14 +414,14 @@ static unsigned long iproc_pll_recalc_rate(struct clk_hw *hw, + val = readl(pll->control_base + ctrl->pdiv.offset); + pdiv = (val >> ctrl->pdiv.shift) & bit_mask(ctrl->pdiv.width); + +- clk->rate = (ndiv * parent_rate) >> 20; ++ rate = (ndiv * parent_rate) >> 20; + + if (pdiv == 0) +- clk->rate *= 2; ++ rate *= 2; + else +- clk->rate /= pdiv; ++ rate /= pdiv; + +- return clk->rate; ++ return rate; + } + + static long iproc_pll_round_rate(struct clk_hw *hw, unsigned long rate, +@@ -518,6 +511,7 @@ static unsigned long iproc_clk_recalc_rate(struct clk_hw *hw, + struct iproc_pll *pll = clk->pll; + u32 val; + unsigned int mdiv; ++ unsigned long rate; + + if (parent_rate == 0) + return 0; +@@ -528,11 +522,11 @@ static unsigned long iproc_clk_recalc_rate(struct clk_hw *hw, + mdiv = 256; + + if (ctrl->flags & IPROC_CLK_MCLK_DIV_BY_2) +- clk->rate = parent_rate / (mdiv * 2); ++ rate = parent_rate / (mdiv * 2); + else +- clk->rate = parent_rate / mdiv; ++ rate = parent_rate / mdiv; + +- return clk->rate; ++ return rate; + } + + static long iproc_clk_round_rate(struct clk_hw *hw, unsigned long rate, +@@ -583,10 +577,6 @@ static int iproc_clk_set_rate(struct clk_hw *hw, unsigned long rate, + val |= div << ctrl->mdiv.shift; + } + iproc_pll_write(pll, pll->control_base, ctrl->mdiv.offset, val); +- if (ctrl->flags & IPROC_CLK_MCLK_DIV_BY_2) +- clk->rate = parent_rate / (div * 2); +- else +- clk->rate = parent_rate / div; + + return 0; + } +@@ -629,6 +619,8 @@ void __init iproc_pll_clk_setup(struct device_node *node, + struct iproc_clk *iclk; + struct clk_init_data init; + const char *parent_name; ++ struct iproc_clk *iclk_array; ++ struct clk_hw_onecell_data *clk_data; + + if (WARN_ON(!pll_ctrl) || WARN_ON(!clk_ctrl)) + return; +@@ -637,14 +629,14 @@ void __init iproc_pll_clk_setup(struct device_node *node, + if (WARN_ON(!pll)) + return; + +- pll->clk_data = kzalloc(sizeof(*pll->clk_data->hws) * num_clks + +- sizeof(*pll->clk_data), GFP_KERNEL); +- if (WARN_ON(!pll->clk_data)) ++ clk_data = kzalloc(sizeof(*clk_data->hws) * num_clks + ++ sizeof(*clk_data), GFP_KERNEL); ++ if (WARN_ON(!clk_data)) + goto err_clk_data; +- pll->clk_data->num = num_clks; ++ clk_data->num = num_clks; + +- pll->clks = kcalloc(num_clks, sizeof(*pll->clks), GFP_KERNEL); +- if (WARN_ON(!pll->clks)) ++ iclk_array = kcalloc(num_clks, sizeof(struct iproc_clk), GFP_KERNEL); ++ if (WARN_ON(!iclk_array)) + goto err_clks; + + pll->control_base = of_iomap(node, 0); +@@ -674,9 +666,8 @@ void __init iproc_pll_clk_setup(struct device_node *node, + /* initialize and register the PLL itself */ + pll->ctrl = pll_ctrl; + +- iclk = &pll->clks[0]; ++ iclk = &iclk_array[0]; + iclk->pll = pll; +- iclk->name = node->name; + + init.name = node->name; + init.ops = &iproc_pll_ops; +@@ -697,7 +688,7 @@ void __init iproc_pll_clk_setup(struct device_node *node, + if (WARN_ON(ret)) + goto err_pll_register; + +- pll->clk_data->hws[0] = &iclk->hw; ++ clk_data->hws[0] = &iclk->hw; + + /* now initialize and register all leaf clocks */ + for (i = 1; i < num_clks; i++) { +@@ -711,8 +702,7 @@ void __init iproc_pll_clk_setup(struct device_node *node, + if (WARN_ON(ret)) + goto err_clk_register; + +- iclk = &pll->clks[i]; +- iclk->name = clk_name; ++ iclk = &iclk_array[i]; + iclk->pll = pll; + iclk->ctrl = &clk_ctrl[i]; + +@@ -727,11 +717,10 @@ void __init iproc_pll_clk_setup(struct device_node *node, + if (WARN_ON(ret)) + goto err_clk_register; + +- pll->clk_data->hws[i] = &iclk->hw; ++ clk_data->hws[i] = &iclk->hw; + } + +- ret = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, +- pll->clk_data); ++ ret = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data); + if (WARN_ON(ret)) + goto err_clk_register; + +@@ -739,7 +728,7 @@ void __init iproc_pll_clk_setup(struct device_node *node, + + err_clk_register: + while (--i >= 0) +- clk_hw_unregister(pll->clk_data->hws[i]); ++ clk_hw_unregister(clk_data->hws[i]); + + err_pll_register: + if (pll->status_base != pll->control_base) +@@ -756,10 +745,10 @@ void __init iproc_pll_clk_setup(struct device_node *node, + iounmap(pll->control_base); + + err_pll_iomap: +- kfree(pll->clks); ++ kfree(iclk_array); + + err_clks: +- kfree(pll->clk_data); ++ kfree(clk_data); + + err_clk_data: + kfree(pll); +-- +2.35.1 + diff --git a/queue-4.9/drivers-soc-sunxi-add-support-for-a64-and-its-sram-c.patch b/queue-4.9/drivers-soc-sunxi-add-support-for-a64-and-its-sram-c.patch new file mode 100644 index 00000000000..1d065fcf41b --- /dev/null +++ b/queue-4.9/drivers-soc-sunxi-add-support-for-a64-and-its-sram-c.patch @@ -0,0 +1,60 @@ +From 489fd2a71c96a81da489abf3f099b1e9417496ca Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 9 Aug 2017 16:56:27 +0800 +Subject: drivers: soc: sunxi: add support for A64 and its SRAM C + +From: Icenowy Zheng + +[ Upstream commit 5e4fb6429761ebe8f5acb5a761fa57d02a91ac6f ] + +Allwinner A64's display engine claims the SRAM C section to work. + +Add support for the A64 SRAM controller and the SRAM C section of it. + +Signed-off-by: Icenowy Zheng +Signed-off-by: Chen-Yu Tsai +Stable-dep-of: 49fad91a7b89 ("soc: sunxi: sram: Fix probe function ordering issues") +Signed-off-by: Sasha Levin +--- + drivers/soc/sunxi/sunxi_sram.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/drivers/soc/sunxi/sunxi_sram.c b/drivers/soc/sunxi/sunxi_sram.c +index 706ed0cb568b..45bafaae15fc 100644 +--- a/drivers/soc/sunxi/sunxi_sram.c ++++ b/drivers/soc/sunxi/sunxi_sram.c +@@ -67,6 +67,12 @@ static struct sunxi_sram_desc sun4i_a10_sram_d = { + SUNXI_SRAM_MAP(1, "usb-otg")), + }; + ++static struct sunxi_sram_desc sun50i_a64_sram_c = { ++ .data = SUNXI_SRAM_DATA("C", 0x4, 24, 1, ++ SUNXI_SRAM_MAP(0, 1, "cpu"), ++ SUNXI_SRAM_MAP(1, 0, "de2")), ++}; ++ + static const struct of_device_id sunxi_sram_dt_ids[] = { + { + .compatible = "allwinner,sun4i-a10-sram-a3-a4", +@@ -76,6 +82,10 @@ static const struct of_device_id sunxi_sram_dt_ids[] = { + .compatible = "allwinner,sun4i-a10-sram-d", + .data = &sun4i_a10_sram_d.data, + }, ++ { ++ .compatible = "allwinner,sun50i-a64-sram-c", ++ .data = &sun50i_a64_sram_c.data, ++ }, + {} + }; + +@@ -268,6 +278,7 @@ static int sunxi_sram_probe(struct platform_device *pdev) + + static const struct of_device_id sunxi_sram_dt_match[] = { + { .compatible = "allwinner,sun4i-a10-sram-controller" }, ++ { .compatible = "allwinner,sun50i-a64-sram-controller" }, + { }, + }; + MODULE_DEVICE_TABLE(of, sunxi_sram_dt_match); +-- +2.35.1 + diff --git a/queue-4.9/input-melfas_mip4-fix-return-value-check-in-mip4_pro.patch b/queue-4.9/input-melfas_mip4-fix-return-value-check-in-mip4_pro.patch new file mode 100644 index 00000000000..125823a4418 --- /dev/null +++ b/queue-4.9/input-melfas_mip4-fix-return-value-check-in-mip4_pro.patch @@ -0,0 +1,37 @@ +From 659f5a55f5dd27d62b51f15bdc5df7d5c59395ce Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 24 Sep 2022 11:07:15 +0800 +Subject: Input: melfas_mip4 - fix return value check in mip4_probe() + +From: Yang Yingliang + +[ Upstream commit a54dc27bd25f20ee3ea2009584b3166d25178243 ] + +devm_gpiod_get_optional() may return ERR_PTR(-EPROBE_DEFER), +add a minus sign to fix it. + +Fixes: 6ccb1d8f78bd ("Input: add MELFAS MIP4 Touchscreen driver") +Signed-off-by: Yang Yingliang +Link: https://lore.kernel.org/r/20220924030715.1653538-1-yangyingliang@huawei.com +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/touchscreen/melfas_mip4.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/input/touchscreen/melfas_mip4.c b/drivers/input/touchscreen/melfas_mip4.c +index 552a3773f79d..cec2df449f89 100644 +--- a/drivers/input/touchscreen/melfas_mip4.c ++++ b/drivers/input/touchscreen/melfas_mip4.c +@@ -1416,7 +1416,7 @@ static int mip4_probe(struct i2c_client *client, const struct i2c_device_id *id) + "ce", GPIOD_OUT_LOW); + if (IS_ERR(ts->gpio_ce)) { + error = PTR_ERR(ts->gpio_ce); +- if (error != EPROBE_DEFER) ++ if (error != -EPROBE_DEFER) + dev_err(&client->dev, + "Failed to get gpio: %d\n", error); + return error; +-- +2.35.1 + diff --git a/queue-4.9/nvme-add-new-line-after-variable-declatation.patch b/queue-4.9/nvme-add-new-line-after-variable-declatation.patch new file mode 100644 index 00000000000..cf7c26ba640 --- /dev/null +++ b/queue-4.9/nvme-add-new-line-after-variable-declatation.patch @@ -0,0 +1,52 @@ +From 92456268acea40c5a377879dfe36eacca5e746e2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 28 Feb 2021 18:06:11 -0800 +Subject: nvme: add new line after variable declatation + +From: Chaitanya Kulkarni + +[ Upstream commit f1c772d581843e3a14bbd62ef7e40b56fc307f27 ] + +Add a new line in functions nvme_pr_preempt(), nvme_pr_clear(), and +nvme_pr_release() after variable declaration which follows the rest of +the code in the nvme/host/core.c. + +No functional change(s) in this patch. + +Signed-off-by: Chaitanya Kulkarni +Signed-off-by: Christoph Hellwig +Stable-dep-of: c292a337d0e4 ("nvme: Fix IOC_PR_CLEAR and IOC_PR_RELEASE ioctls for nvme devices") +Signed-off-by: Sasha Levin +--- + drivers/nvme/host/core.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c +index 9561a247d0dc..051bc7430af2 100644 +--- a/drivers/nvme/host/core.c ++++ b/drivers/nvme/host/core.c +@@ -1044,18 +1044,21 @@ static int nvme_pr_preempt(struct block_device *bdev, u64 old, u64 new, + enum pr_type type, bool abort) + { + u32 cdw10 = nvme_pr_type(type) << 8 | (abort ? 2 : 1); ++ + return nvme_pr_command(bdev, cdw10, old, new, nvme_cmd_resv_acquire); + } + + static int nvme_pr_clear(struct block_device *bdev, u64 key) + { + u32 cdw10 = 1 | (key ? 1 << 3 : 0); ++ + return nvme_pr_command(bdev, cdw10, key, 0, nvme_cmd_resv_register); + } + + static int nvme_pr_release(struct block_device *bdev, u64 key, enum pr_type type) + { + u32 cdw10 = nvme_pr_type(type) << 8 | (key ? 1 << 3 : 0); ++ + return nvme_pr_command(bdev, cdw10, key, 0, nvme_cmd_resv_release); + } + +-- +2.35.1 + diff --git a/queue-4.9/nvme-fix-ioc_pr_clear-and-ioc_pr_release-ioctls-for-.patch b/queue-4.9/nvme-fix-ioc_pr_clear-and-ioc_pr_release-ioctls-for-.patch new file mode 100644 index 00000000000..5c85a1665a3 --- /dev/null +++ b/queue-4.9/nvme-fix-ioc_pr_clear-and-ioc_pr_release-ioctls-for-.patch @@ -0,0 +1,63 @@ +From b9d1c63da236499fb87524c4c476674d255ae1fa Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 22 Sep 2022 21:49:09 -0700 +Subject: nvme: Fix IOC_PR_CLEAR and IOC_PR_RELEASE ioctls for nvme devices + +From: Michael Kelley + +[ Upstream commit c292a337d0e45a292c301e3cd51c35aa0ae91e95 ] + +The IOC_PR_CLEAR and IOC_PR_RELEASE ioctls are +non-functional on NVMe devices because the nvme_pr_clear() +and nvme_pr_release() functions set the IEKEY field incorrectly. +The IEKEY field should be set only when the key is zero (i.e, +not specified). The current code does it backwards. + +Furthermore, the NVMe spec describes the persistent +reservation "clear" function as an option on the reservation +release command. The current implementation of nvme_pr_clear() +erroneously uses the reservation register command. + +Fix these errors. Note that NVMe version 1.3 and later specify +that setting the IEKEY field will return an error of Invalid +Field in Command. The fix will set IEKEY when the key is zero, +which is appropriate as these ioctls consider a zero key to +be "unspecified", and the intention of the spec change is +to require a valid key. + +Tested on a version 1.4 PCI NVMe device in an Azure VM. + +Fixes: 1673f1f08c88 ("nvme: move block_device_operations and ns/ctrl freeing to common code") +Fixes: 1d277a637a71 ("NVMe: Add persistent reservation ops") +Signed-off-by: Michael Kelley +Signed-off-by: Christoph Hellwig +Signed-off-by: Sasha Levin +--- + drivers/nvme/host/core.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c +index 051bc7430af2..f260ef59dda2 100644 +--- a/drivers/nvme/host/core.c ++++ b/drivers/nvme/host/core.c +@@ -1050,14 +1050,14 @@ static int nvme_pr_preempt(struct block_device *bdev, u64 old, u64 new, + + static int nvme_pr_clear(struct block_device *bdev, u64 key) + { +- u32 cdw10 = 1 | (key ? 1 << 3 : 0); ++ u32 cdw10 = 1 | (key ? 0 : 1 << 3); + +- return nvme_pr_command(bdev, cdw10, key, 0, nvme_cmd_resv_register); ++ return nvme_pr_command(bdev, cdw10, key, 0, nvme_cmd_resv_release); + } + + static int nvme_pr_release(struct block_device *bdev, u64 key, enum pr_type type) + { +- u32 cdw10 = nvme_pr_type(type) << 8 | (key ? 1 << 3 : 0); ++ u32 cdw10 = nvme_pr_type(type) << 8 | (key ? 0 : 1 << 3); + + return nvme_pr_command(bdev, cdw10, key, 0, nvme_cmd_resv_release); + } +-- +2.35.1 + diff --git a/queue-4.9/revert-drm-bridge-analogix-dp-add-panel-prepare-unpr.patch b/queue-4.9/revert-drm-bridge-analogix-dp-add-panel-prepare-unpr.patch new file mode 100644 index 00000000000..7486a9ba415 --- /dev/null +++ b/queue-4.9/revert-drm-bridge-analogix-dp-add-panel-prepare-unpr.patch @@ -0,0 +1,88 @@ +From e627993cbc540a054de513c5c2bd97269b08ab6e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 22 Aug 2022 18:08:04 -0700 +Subject: Revert "drm: bridge: analogix/dp: add panel prepare/unprepare in + suspend/resume time" + +From: Brian Norris + +[ Upstream commit cc62d98bd56d45de4531844ca23913a15136c05b ] + +This reverts commit 211f276ed3d96e964d2d1106a198c7f4a4b3f4c0. + +For quite some time, core DRM helpers already ensure that any relevant +connectors/CRTCs/etc. are disabled, as well as their associated +components (e.g., bridges) when suspending the system. Thus, +analogix_dp_bridge_{enable,disable}() already get called, which in turn +call drm_panel_{prepare,unprepare}(). This makes these drm_panel_*() +calls redundant. + +Besides redundancy, there are a few problems with this handling: + +(1) drm_panel_{prepare,unprepare}() are *not* reference-counted APIs and +are not in general designed to be handled by multiple callers -- +although some panel drivers have a coarse 'prepared' flag that mitigates +some damage, at least. So at a minimum this is redundant and confusing, +but in some cases, this could be actively harmful. + +(2) The error-handling is a bit non-standard. We ignored errors in +suspend(), but handled errors in resume(). And recently, people noticed +that the clk handling is unbalanced in error paths, and getting *that* +right is not actually trivial, given the current way errors are mostly +ignored. + +(3) In the particular way analogix_dp_{suspend,resume}() get used (e.g., +in rockchip_dp_*(), as a late/early callback), we don't necessarily have +a proper PM relationship between the DP/bridge device and the panel +device. So while the DP bridge gets resumed, the panel's parent device +(e.g., platform_device) may still be suspended, and so any prepare() +calls may fail. + +So remove the superfluous, possibly-harmful suspend()/resume() handling +of panel state. + +Fixes: 211f276ed3d9 ("drm: bridge: analogix/dp: add panel prepare/unprepare in suspend/resume time") +Link: https://lore.kernel.org/all/Yv2CPBD3Picg%2FgVe@google.com/ +Signed-off-by: Brian Norris +Reviewed-by: Douglas Anderson +Signed-off-by: Douglas Anderson +Link: https://patchwork.freedesktop.org/patch/msgid/20220822180729.1.I8ac5abe3a4c1c6fd5c061686c6e883c22f69022c@changeid +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 13 ------------- + 1 file changed, 13 deletions(-) + +diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +index d1077a342f38..7c683245bdc0 100644 +--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c ++++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +@@ -1463,12 +1463,6 @@ int analogix_dp_suspend(struct device *dev) + struct analogix_dp_device *dp = dev_get_drvdata(dev); + + clk_disable_unprepare(dp->clock); +- +- if (dp->plat_data->panel) { +- if (drm_panel_unprepare(dp->plat_data->panel)) +- DRM_ERROR("failed to turnoff the panel\n"); +- } +- + return 0; + } + EXPORT_SYMBOL_GPL(analogix_dp_suspend); +@@ -1484,13 +1478,6 @@ int analogix_dp_resume(struct device *dev) + return ret; + } + +- if (dp->plat_data->panel) { +- if (drm_panel_prepare(dp->plat_data->panel)) { +- DRM_ERROR("failed to setup the panel\n"); +- return -EBUSY; +- } +- } +- + return 0; + } + EXPORT_SYMBOL_GPL(analogix_dp_resume); +-- +2.35.1 + diff --git a/queue-4.9/selftests-fix-the-if-conditions-of-in-test_extra_fil.patch b/queue-4.9/selftests-fix-the-if-conditions-of-in-test_extra_fil.patch new file mode 100644 index 00000000000..e1933bedfe7 --- /dev/null +++ b/queue-4.9/selftests-fix-the-if-conditions-of-in-test_extra_fil.patch @@ -0,0 +1,37 @@ +From ece0c6a08e30c58f58d6798116080936adbaaa17 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 23 Sep 2022 15:02:37 +0800 +Subject: selftests: Fix the if conditions of in test_extra_filter() + +From: Wang Yufen + +[ Upstream commit bc7a319844891746135dc1f34ab9df78d636a3ac ] + +The socket 2 bind the addr in use, bind should fail with EADDRINUSE. So +if bind success or errno != EADDRINUSE, testcase should be failed. + +Fixes: 3ca8e4029969 ("soreuseport: BPF selection functional test") +Signed-off-by: Wang Yufen +Link: https://lore.kernel.org/r/1663916557-10730-1-git-send-email-wangyufen@huawei.com +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/net/reuseport_bpf.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/testing/selftests/net/reuseport_bpf.c b/tools/testing/selftests/net/reuseport_bpf.c +index b5277106df1f..b0cc082fbb84 100644 +--- a/tools/testing/selftests/net/reuseport_bpf.c ++++ b/tools/testing/selftests/net/reuseport_bpf.c +@@ -330,7 +330,7 @@ static void test_extra_filter(const struct test_params p) + if (bind(fd1, addr, sockaddr_size())) + error(1, errno, "failed to bind recv socket 1"); + +- if (!bind(fd2, addr, sockaddr_size()) && errno != EADDRINUSE) ++ if (!bind(fd2, addr, sockaddr_size()) || errno != EADDRINUSE) + error(1, errno, "bind socket 2 should fail with EADDRINUSE"); + + free(addr); +-- +2.35.1 + diff --git a/queue-4.9/series b/queue-4.9/series index a37d5063da0..195c86c860c 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -5,3 +5,14 @@ net-usb-qmi_wwan-add-new-usb-id-for-dell-branded-em7455.patch ntfs-fix-bug_on-in-ntfs_lookup_inode_by_name.patch mmc-moxart-fix-4-bit-bus-width-and-remove-8-bit-bus-width.patch mm-prevent-page_frag_alloc-from-corrupting-the-memory.patch +soc-sunxi-sram-actually-claim-sram-regions.patch +drivers-soc-sunxi-add-support-for-a64-and-its-sram-c.patch +soc-sunxi-sram-fix-debugfs-info-for-a64-sram-c.patch +revert-drm-bridge-analogix-dp-add-panel-prepare-unpr.patch +input-melfas_mip4-fix-return-value-check-in-mip4_pro.patch +usbnet-fix-memory-leak-in-usbnet_disconnect.patch +nvme-add-new-line-after-variable-declatation.patch +nvme-fix-ioc_pr_clear-and-ioc_pr_release-ioctls-for-.patch +selftests-fix-the-if-conditions-of-in-test_extra_fil.patch +clk-iproc-minor-tidy-up-of-iproc-pll-data-structures.patch +clk-iproc-do-not-rely-on-node-name-for-correct-pll-s.patch diff --git a/queue-4.9/soc-sunxi-sram-actually-claim-sram-regions.patch b/queue-4.9/soc-sunxi-sram-actually-claim-sram-regions.patch new file mode 100644 index 00000000000..c38aee10317 --- /dev/null +++ b/queue-4.9/soc-sunxi-sram-actually-claim-sram-regions.patch @@ -0,0 +1,40 @@ +From 8bcafdc1f9e0ba37333b6571a169315e6ea28fd0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 14 Aug 2022 23:12:40 -0500 +Subject: soc: sunxi: sram: Actually claim SRAM regions + +From: Samuel Holland + +[ Upstream commit fd362baad2e659ef0fb5652f023a606b248f1781 ] + +sunxi_sram_claim() checks the sram_desc->claimed flag before updating +the register, with the intent that only one device can claim a region. +However, this was ineffective because the flag was never set. + +Fixes: 4af34b572a85 ("drivers: soc: sunxi: Introduce SoC driver to map SRAMs") +Reviewed-by: Jernej Skrabec +Signed-off-by: Samuel Holland +Reviewed-by: Heiko Stuebner +Tested-by: Heiko Stuebner +Signed-off-by: Jernej Skrabec +Link: https://lore.kernel.org/r/20220815041248.53268-4-samuel@sholland.org +Signed-off-by: Sasha Levin +--- + drivers/soc/sunxi/sunxi_sram.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/soc/sunxi/sunxi_sram.c b/drivers/soc/sunxi/sunxi_sram.c +index 99e354c8f53f..706ed0cb568b 100644 +--- a/drivers/soc/sunxi/sunxi_sram.c ++++ b/drivers/soc/sunxi/sunxi_sram.c +@@ -215,6 +215,7 @@ int sunxi_sram_claim(struct device *dev) + writel(val | ((device << sram_data->offset) & mask), + base + sram_data->reg); + ++ sram_desc->claimed = true; + spin_unlock(&sram_lock); + + return 0; +-- +2.35.1 + diff --git a/queue-4.9/soc-sunxi-sram-fix-debugfs-info-for-a64-sram-c.patch b/queue-4.9/soc-sunxi-sram-fix-debugfs-info-for-a64-sram-c.patch new file mode 100644 index 00000000000..de4612ec343 --- /dev/null +++ b/queue-4.9/soc-sunxi-sram-fix-debugfs-info-for-a64-sram-c.patch @@ -0,0 +1,40 @@ +From fcbae40b289ac3930411ddf895e1bee91842c7cc Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 14 Aug 2022 23:12:43 -0500 +Subject: soc: sunxi: sram: Fix debugfs info for A64 SRAM C + +From: Samuel Holland + +[ Upstream commit e3c95edb1bd8b9c2cb0caa6ae382fc8080f6a0ed ] + +The labels were backward with respect to the register values. The SRAM +is mapped to the CPU when the register value is 1. + +Fixes: 5e4fb6429761 ("drivers: soc: sunxi: add support for A64 and its SRAM C") +Acked-by: Jernej Skrabec +Signed-off-by: Samuel Holland +Signed-off-by: Jernej Skrabec +Link: https://lore.kernel.org/r/20220815041248.53268-7-samuel@sholland.org +Signed-off-by: Sasha Levin +--- + drivers/soc/sunxi/sunxi_sram.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/soc/sunxi/sunxi_sram.c b/drivers/soc/sunxi/sunxi_sram.c +index 45bafaae15fc..49c028653842 100644 +--- a/drivers/soc/sunxi/sunxi_sram.c ++++ b/drivers/soc/sunxi/sunxi_sram.c +@@ -69,8 +69,8 @@ static struct sunxi_sram_desc sun4i_a10_sram_d = { + + static struct sunxi_sram_desc sun50i_a64_sram_c = { + .data = SUNXI_SRAM_DATA("C", 0x4, 24, 1, +- SUNXI_SRAM_MAP(0, 1, "cpu"), +- SUNXI_SRAM_MAP(1, 0, "de2")), ++ SUNXI_SRAM_MAP(1, 0, "cpu"), ++ SUNXI_SRAM_MAP(0, 1, "de2")), + }; + + static const struct of_device_id sunxi_sram_dt_ids[] = { +-- +2.35.1 + diff --git a/queue-4.9/usbnet-fix-memory-leak-in-usbnet_disconnect.patch b/queue-4.9/usbnet-fix-memory-leak-in-usbnet_disconnect.patch new file mode 100644 index 00000000000..390be68f6e6 --- /dev/null +++ b/queue-4.9/usbnet-fix-memory-leak-in-usbnet_disconnect.patch @@ -0,0 +1,56 @@ +From 24c78d427047aff59368c61ae58493c0cc0286f1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 22 Sep 2022 21:25:51 -0700 +Subject: usbnet: Fix memory leak in usbnet_disconnect() + +From: Peilin Ye + +[ Upstream commit a43206156263fbaf1f2b7f96257441f331e91bb7 ] + +Currently usbnet_disconnect() unanchors and frees all deferred URBs +using usb_scuttle_anchored_urbs(), which does not free urb->context, +causing a memory leak as reported by syzbot. + +Use a usb_get_from_anchor() while loop instead, similar to what we did +in commit 19cfe912c37b ("Bluetooth: btusb: Fix memory leak in +play_deferred"). Also free urb->sg. + +Reported-and-tested-by: syzbot+dcd3e13cf4472f2e0ba1@syzkaller.appspotmail.com +Fixes: 69ee472f2706 ("usbnet & cdc-ether: Autosuspend for online devices") +Fixes: 638c5115a794 ("USBNET: support DMA SG") +Signed-off-by: Peilin Ye +Link: https://lore.kernel.org/r/20220923042551.2745-1-yepeilin.cs@gmail.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + drivers/net/usb/usbnet.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c +index f1cb512c55ac..810e4e65e2a3 100644 +--- a/drivers/net/usb/usbnet.c ++++ b/drivers/net/usb/usbnet.c +@@ -1559,6 +1559,7 @@ void usbnet_disconnect (struct usb_interface *intf) + struct usbnet *dev; + struct usb_device *xdev; + struct net_device *net; ++ struct urb *urb; + + dev = usb_get_intfdata(intf); + usb_set_intfdata(intf, NULL); +@@ -1575,7 +1576,11 @@ void usbnet_disconnect (struct usb_interface *intf) + net = dev->net; + unregister_netdev (net); + +- usb_scuttle_anchored_urbs(&dev->deferred); ++ while ((urb = usb_get_from_anchor(&dev->deferred))) { ++ dev_kfree_skb(urb->context); ++ kfree(urb->sg); ++ usb_free_urb(urb); ++ } + + if (dev->driver_info->unbind) + dev->driver_info->unbind (dev, intf); +-- +2.35.1 +