From: Sasha Levin Date: Fri, 10 Jan 2025 00:09:18 +0000 (-0500) Subject: Fixes for 5.10 X-Git-Tag: v6.6.71~3^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6fee1d14373cb87a82bd903e275be05e378b0832;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 5.10 Signed-off-by: Sasha Levin --- diff --git a/queue-5.10/asoc-mediatek-disable-buffer-pre-allocation.patch b/queue-5.10/asoc-mediatek-disable-buffer-pre-allocation.patch new file mode 100644 index 00000000000..184acea02e1 --- /dev/null +++ b/queue-5.10/asoc-mediatek-disable-buffer-pre-allocation.patch @@ -0,0 +1,57 @@ +From 1d5db51a9da31e69f248c15d84352e8d649384dc Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 19 Dec 2024 18:53:02 +0800 +Subject: ASoC: mediatek: disable buffer pre-allocation + +From: Chen-Yu Tsai + +[ Upstream commit 32c9c06adb5b157ef259233775a063a43746d699 ] + +On Chromebooks based on Mediatek MT8195 or MT8188, the audio frontend +(AFE) is limited to accessing a very small window (1 MiB) of memory, +which is described as a reserved memory region in the device tree. + +On these two platforms, the maximum buffer size is given as 512 KiB. +The MediaTek common code uses the same value for preallocations. This +means that only the first two PCM substreams get preallocations, and +then the whole space is exhausted, barring any other substreams from +working. Since the substreams used are not always the first two, this +means audio won't work correctly. + +This is observed on the MT8188 Geralt Chromebooks, on which the +"mediatek,dai-link" property was dropped when it was upstreamed. That +property causes the driver to only register the PCM substreams listed +in the property, and in the order given. + +Instead of trying to compute an optimal value and figuring out which +streams are used, simply disable preallocation. The PCM buffers are +managed by the core and are allocated and released on the fly. There +should be no impact to any of the other MediaTek platforms. + +Signed-off-by: Chen-Yu Tsai +Reviewed-by: AngeloGioacchino Del Regno +Link: https://patch.msgid.link/20241219105303.548437-1-wenst@chromium.org +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/mediatek/common/mtk-afe-platform-driver.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/sound/soc/mediatek/common/mtk-afe-platform-driver.c b/sound/soc/mediatek/common/mtk-afe-platform-driver.c +index 01501d5747a7..52495c930ca3 100644 +--- a/sound/soc/mediatek/common/mtk-afe-platform-driver.c ++++ b/sound/soc/mediatek/common/mtk-afe-platform-driver.c +@@ -120,8 +120,8 @@ int mtk_afe_pcm_new(struct snd_soc_component *component, + struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); + + size = afe->mtk_afe_hardware->buffer_bytes_max; +- snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, +- afe->dev, size, size); ++ snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, afe->dev, 0, size); ++ + return 0; + } + EXPORT_SYMBOL_GPL(mtk_afe_pcm_new); +-- +2.39.5 + diff --git a/queue-5.10/netfilter-nft_dynset-honor-stateful-expressions-in-s.patch b/queue-5.10/netfilter-nft_dynset-honor-stateful-expressions-in-s.patch new file mode 100644 index 00000000000..4f911a82d06 --- /dev/null +++ b/queue-5.10/netfilter-nft_dynset-honor-stateful-expressions-in-s.patch @@ -0,0 +1,102 @@ +From 077913c1e84f2d0c49ba0563e7fafd8262d523ac Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 9 Jan 2025 16:45:38 +0100 +Subject: netfilter: nft_dynset: honor stateful expressions in set definition + +From: Pablo Neira Ayuso + +commit fca05d4d61e65fa573a3768f9019a42143c03349 upstream. + +If the set definition contains stateful expressions, allocate them for +the newly added entries from the packet path. + +[ This backport includes nft_set_elem_expr_clone() which has been + taken from 8cfd9b0f8515 ("netfilter: nftables: generalize set + expressions support") and skip redundant expressions when set + already provides it per ce5379963b28 ("netfilter: nft_dynset: dump + expressions when set definition contains no expressions") ] + +Fixes: 65038428b2c6 ("netfilter: nf_tables: allow to specify stateful expression in set definition") +Signed-off-by: Pablo Neira Ayuso +Signed-off-by: Sasha Levin +--- + include/net/netfilter/nf_tables.h | 2 ++ + net/netfilter/nf_tables_api.c | 23 +++++++++++++++++++++++ + net/netfilter/nft_dynset.c | 7 ++++++- + 3 files changed, 31 insertions(+), 1 deletion(-) + +diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h +index 31edeafeda77..cb13e604dc34 100644 +--- a/include/net/netfilter/nf_tables.h ++++ b/include/net/netfilter/nf_tables.h +@@ -734,6 +734,8 @@ void *nft_set_elem_init(const struct nft_set *set, + const struct nft_set_ext_tmpl *tmpl, + const u32 *key, const u32 *key_end, const u32 *data, + u64 timeout, u64 expiration, gfp_t gfp); ++int nft_set_elem_expr_clone(const struct nft_ctx *ctx, struct nft_set *set, ++ struct nft_expr **pexpr); + void nft_set_elem_destroy(const struct nft_set *set, void *elem, + bool destroy_expr); + void nf_tables_set_elem_destroy(const struct nft_ctx *ctx, +diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c +index 2bd1c7e7edc3..28ea2ed3f337 100644 +--- a/net/netfilter/nf_tables_api.c ++++ b/net/netfilter/nf_tables_api.c +@@ -5548,6 +5548,29 @@ static int nft_set_elem_expr_setup(struct nft_ctx *ctx, + return 0; + } + ++int nft_set_elem_expr_clone(const struct nft_ctx *ctx, struct nft_set *set, ++ struct nft_expr **pexpr) ++{ ++ struct nft_expr *expr; ++ int err; ++ ++ expr = kzalloc(set->expr->ops->size, GFP_KERNEL); ++ if (!expr) ++ goto err_expr; ++ ++ err = nft_expr_clone(expr, set->expr, GFP_KERNEL); ++ if (err < 0) { ++ kfree(expr); ++ goto err_expr; ++ } ++ *pexpr = expr; ++ ++ return 0; ++ ++err_expr: ++ return -ENOMEM; ++} ++ + static int nft_add_set_elem(struct nft_ctx *ctx, struct nft_set *set, + const struct nlattr *attr, u32 nlmsg_flags) + { +diff --git a/net/netfilter/nft_dynset.c b/net/netfilter/nft_dynset.c +index 9461293182e8..fc81bda6cc6b 100644 +--- a/net/netfilter/nft_dynset.c ++++ b/net/netfilter/nft_dynset.c +@@ -192,6 +192,10 @@ static int nft_dynset_init(const struct nft_ctx *ctx, + err = -EOPNOTSUPP; + goto err_expr_free; + } ++ } else if (set->expr) { ++ err = nft_set_elem_expr_clone(ctx, set, &priv->expr); ++ if (err < 0) ++ return err; + } + + nft_set_ext_prepare(&priv->tmpl); +@@ -272,7 +276,8 @@ static int nft_dynset_dump(struct sk_buff *skb, const struct nft_expr *expr) + nf_jiffies64_to_msecs(priv->timeout), + NFTA_DYNSET_PAD)) + goto nla_put_failure; +- if (priv->expr && nft_expr_dump(skb, NFTA_DYNSET_EXPR, priv->expr)) ++ if (!priv->set->expr && priv->expr && ++ nft_expr_dump(skb, NFTA_DYNSET_EXPR, priv->expr)) + goto nla_put_failure; + if (nla_put_be32(skb, NFTA_DYNSET_FLAGS, htonl(flags))) + goto nla_put_failure; +-- +2.39.5 + diff --git a/queue-5.10/series b/queue-5.10/series index 106728d7b72..ee381655b82 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -4,3 +4,5 @@ dm-array-fix-releasing-a-faulty-array-block-twice-in.patch dm-array-fix-unreleased-btree-blocks-on-closing-a-fa.patch dm-array-fix-cursor-index-when-skipping-across-block.patch exfat-fix-the-infinite-loop-in-exfat_readdir.patch +asoc-mediatek-disable-buffer-pre-allocation.patch +netfilter-nft_dynset-honor-stateful-expressions-in-s.patch