+++ /dev/null
-From 19e384fab3542d0a4953c584f7ad91e6aeb9a515 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 18 Jun 2024 20:18:34 +0200
-Subject: media: hantro: Disable multicore support
-
-From: Sebastian Reichel <sebastian.reichel@collabora.com>
-
-[ Upstream commit ccdeb8d57f7fb3e5c05d72cb7dfb9bc78f09f542 ]
-
-Avoid exposing equal Hantro video codecs to userspace. Equal video
-codecs allow scheduling work between the cores. For that kernel support
-is required, which does not yet exist. Until that is implemented avoid
-exposing each core separately to userspace so that multicore can be
-added in the future without breaking userspace ABI.
-
-This was written with Rockchip RK3588 in mind (which has 4 Hantro H1
-cores), but applies to all SoCs.
-
-Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
-Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
-Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-Stable-dep-of: e0203ddf9af7 ("media: verisilicon: Avoid G2 bus error while decoding H.264 and HEVC")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- .../media/platform/verisilicon/hantro_drv.c | 47 +++++++++++++++++++
- 1 file changed, 47 insertions(+)
-
-diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
-index a35b6ae62d585..092ee1681c3ea 100644
---- a/drivers/media/platform/verisilicon/hantro_drv.c
-+++ b/drivers/media/platform/verisilicon/hantro_drv.c
-@@ -896,6 +896,49 @@ static const struct media_device_ops hantro_m2m_media_ops = {
- .req_queue = v4l2_m2m_request_queue,
- };
-
-+/*
-+ * Some SoCs, like RK3588 have multiple identical Hantro cores, but the
-+ * kernel is currently missing support for multi-core handling. Exposing
-+ * separate devices for each core to userspace is bad, since that does
-+ * not allow scheduling tasks properly (and creates ABI). With this workaround
-+ * the driver will only probe for the first core and early exit for the other
-+ * cores. Once the driver gains multi-core support, the same technique
-+ * for detecting the main core can be used to cluster all cores together.
-+ */
-+static int hantro_disable_multicore(struct hantro_dev *vpu)
-+{
-+ struct device_node *node = NULL;
-+ const char *compatible;
-+ bool is_main_core;
-+ int ret;
-+
-+ /* Intentionally ignores the fallback strings */
-+ ret = of_property_read_string(vpu->dev->of_node, "compatible", &compatible);
-+ if (ret)
-+ return ret;
-+
-+ /* The first compatible and available node found is considered the main core */
-+ do {
-+ node = of_find_compatible_node(node, NULL, compatible);
-+ if (of_device_is_available(node))
-+ break;
-+ } while (node);
-+
-+ if (!node)
-+ return -EINVAL;
-+
-+ is_main_core = (vpu->dev->of_node == node);
-+
-+ of_node_put(node);
-+
-+ if (!is_main_core) {
-+ dev_info(vpu->dev, "missing multi-core support, ignoring this instance\n");
-+ return -ENODEV;
-+ }
-+
-+ return 0;
-+}
-+
- static int hantro_probe(struct platform_device *pdev)
- {
- const struct of_device_id *match;
-@@ -916,6 +959,10 @@ static int hantro_probe(struct platform_device *pdev)
- match = of_match_node(of_hantro_match, pdev->dev.of_node);
- vpu->variant = match->data;
-
-+ ret = hantro_disable_multicore(vpu);
-+ if (ret)
-+ return ret;
-+
- /*
- * Support for nxp,imx8mq-vpu is kept for backwards compatibility
- * but it's deprecated. Please update your DTS file to use
---
-2.51.0
-
+++ /dev/null
-From 4a73dc3209e55c4c415b2e672332b8a745cddb65 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 5 Dec 2025 09:54:24 +0800
-Subject: media: v4l2-mem2mem: Add a kref to the v4l2_m2m_dev structure
-
-From: Nicolas Dufresne <nicolas.dufresne@collabora.com>
-
-[ Upstream commit db6b97a4f8041e479be9ef4b8b07022636c96f50 ]
-
-Adding a reference count to the v4l2_m2m_dev structure allow safely
-sharing it across multiple hardware nodes. This can be used to prevent
-running jobs concurrently on m2m cores that have some internal resource
-sharing.
-
-Signed-off-by: Ming Qian <ming.qian@oss.nxp.com>
-Reviewed-by: Frank Li <Frank.Li@nxp.com>
-Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
-Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
-[hverkuil: fix typos in v4l2_m2m_put documentation]
-Stable-dep-of: e0203ddf9af7 ("media: verisilicon: Avoid G2 bus error while decoding H.264 and HEVC")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/media/v4l2-core/v4l2-mem2mem.c | 23 +++++++++++++++++++++++
- include/media/v4l2-mem2mem.h | 21 +++++++++++++++++++++
- 2 files changed, 44 insertions(+)
-
-diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-core/v4l2-mem2mem.c
-index 97645d6509e1c..64a389aa7f81d 100644
---- a/drivers/media/v4l2-core/v4l2-mem2mem.c
-+++ b/drivers/media/v4l2-core/v4l2-mem2mem.c
-@@ -90,6 +90,7 @@ static const char * const m2m_entity_name[] = {
- * @job_work: worker to run queued jobs.
- * @job_queue_flags: flags of the queue status, %QUEUE_PAUSED.
- * @m2m_ops: driver callbacks
-+ * @kref: device reference count
- */
- struct v4l2_m2m_dev {
- struct v4l2_m2m_ctx *curr_ctx;
-@@ -109,6 +110,8 @@ struct v4l2_m2m_dev {
- unsigned long job_queue_flags;
-
- const struct v4l2_m2m_ops *m2m_ops;
-+
-+ struct kref kref;
- };
-
- static struct v4l2_m2m_queue_ctx *get_queue_ctx(struct v4l2_m2m_ctx *m2m_ctx,
-@@ -1207,6 +1210,7 @@ struct v4l2_m2m_dev *v4l2_m2m_init(const struct v4l2_m2m_ops *m2m_ops)
- INIT_LIST_HEAD(&m2m_dev->job_queue);
- spin_lock_init(&m2m_dev->job_spinlock);
- INIT_WORK(&m2m_dev->job_work, v4l2_m2m_device_run_work);
-+ kref_init(&m2m_dev->kref);
-
- return m2m_dev;
- }
-@@ -1218,6 +1222,25 @@ void v4l2_m2m_release(struct v4l2_m2m_dev *m2m_dev)
- }
- EXPORT_SYMBOL_GPL(v4l2_m2m_release);
-
-+void v4l2_m2m_get(struct v4l2_m2m_dev *m2m_dev)
-+{
-+ kref_get(&m2m_dev->kref);
-+}
-+EXPORT_SYMBOL_GPL(v4l2_m2m_get);
-+
-+static void v4l2_m2m_release_from_kref(struct kref *kref)
-+{
-+ struct v4l2_m2m_dev *m2m_dev = container_of(kref, struct v4l2_m2m_dev, kref);
-+
-+ v4l2_m2m_release(m2m_dev);
-+}
-+
-+void v4l2_m2m_put(struct v4l2_m2m_dev *m2m_dev)
-+{
-+ kref_put(&m2m_dev->kref, v4l2_m2m_release_from_kref);
-+}
-+EXPORT_SYMBOL_GPL(v4l2_m2m_put);
-+
- struct v4l2_m2m_ctx *v4l2_m2m_ctx_init(struct v4l2_m2m_dev *m2m_dev,
- void *drv_priv,
- int (*queue_init)(void *priv, struct vb2_queue *src_vq, struct vb2_queue *dst_vq))
-diff --git a/include/media/v4l2-mem2mem.h b/include/media/v4l2-mem2mem.h
-index 370c230ad3bea..4a2649a4562ae 100644
---- a/include/media/v4l2-mem2mem.h
-+++ b/include/media/v4l2-mem2mem.h
-@@ -537,6 +537,27 @@ v4l2_m2m_register_media_controller(struct v4l2_m2m_dev *m2m_dev,
- */
- void v4l2_m2m_release(struct v4l2_m2m_dev *m2m_dev);
-
-+/**
-+ * v4l2_m2m_get() - take a reference to the m2m_dev structure
-+ *
-+ * @m2m_dev: opaque pointer to the internal data to handle M2M context
-+ *
-+ * This is used to share the M2M device across multiple devices. This
-+ * can be used to avoid scheduling two hardware nodes concurrently.
-+ */
-+void v4l2_m2m_get(struct v4l2_m2m_dev *m2m_dev);
-+
-+/**
-+ * v4l2_m2m_put() - remove a reference to the m2m_dev structure
-+ *
-+ * @m2m_dev: opaque pointer to the internal data to handle M2M context
-+ *
-+ * Once the M2M device has no more references, v4l2_m2m_release() will be
-+ * called automatically. Users of this method should never call
-+ * v4l2_m2m_release() directly. See v4l2_m2m_get() for more details.
-+ */
-+void v4l2_m2m_put(struct v4l2_m2m_dev *m2m_dev);
-+
- /**
- * v4l2_m2m_ctx_init() - allocate and initialize a m2m context
- *
---
-2.51.0
-
+++ /dev/null
-From 63c8800c43df8752425d8761f8ae86949fbb021c Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 5 Dec 2025 09:54:26 +0800
-Subject: media: verisilicon: Avoid G2 bus error while decoding H.264 and HEVC
-
-From: Ming Qian <ming.qian@oss.nxp.com>
-
-[ Upstream commit e0203ddf9af7c8e170e1e99ce83b4dc07f0cd765 ]
-
-For the i.MX8MQ platform, there is a hardware limitation: the g1 VPU and
-g2 VPU cannot decode simultaneously; otherwise, it will cause below bus
-error and produce corrupted pictures, even potentially lead to system hang.
-
-[ 110.527986] hantro-vpu 38310000.video-codec: frame decode timed out.
-[ 110.583517] hantro-vpu 38310000.video-codec: bus error detected.
-
-Therefore, it is necessary to ensure that g1 and g2 operate alternately.
-This allows for successful multi-instance decoding of H.264 and HEVC.
-
-To achieve this, g1 and g2 share the same v4l2_m2m_dev, and then the
-v4l2_m2m_dev can handle the scheduling.
-
-Fixes: cb5dd5a0fa518 ("media: hantro: Introduce G2/HEVC decoder")
-Cc: stable@vger.kernel.org
-Signed-off-by: Ming Qian <ming.qian@oss.nxp.com>
-Reviewed-by: Frank Li <Frank.Li@nxp.com>
-Co-developed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
-Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
-Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/media/platform/verisilicon/hantro.h | 2 +
- .../media/platform/verisilicon/hantro_drv.c | 42 +++++++++++++++++--
- .../media/platform/verisilicon/imx8m_vpu_hw.c | 8 ++++
- 3 files changed, 49 insertions(+), 3 deletions(-)
-
-diff --git a/drivers/media/platform/verisilicon/hantro.h b/drivers/media/platform/verisilicon/hantro.h
-index 2989ebc631cc0..fca6ef4a11665 100644
---- a/drivers/media/platform/verisilicon/hantro.h
-+++ b/drivers/media/platform/verisilicon/hantro.h
-@@ -76,6 +76,7 @@ struct hantro_irq {
- * @double_buffer: core needs double buffering
- * @legacy_regs: core uses legacy register set
- * @late_postproc: postproc must be set up at the end of the job
-+ * @shared_devices: an array of device ids that cannot run concurrently
- */
- struct hantro_variant {
- unsigned int enc_offset;
-@@ -100,6 +101,7 @@ struct hantro_variant {
- unsigned int double_buffer : 1;
- unsigned int legacy_regs : 1;
- unsigned int late_postproc : 1;
-+ const struct of_device_id *shared_devices;
- };
-
- /**
-diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
-index 092ee1681c3ea..29baefc93628c 100644
---- a/drivers/media/platform/verisilicon/hantro_drv.c
-+++ b/drivers/media/platform/verisilicon/hantro_drv.c
-@@ -13,6 +13,7 @@
- #include <linux/clk.h>
- #include <linux/module.h>
- #include <linux/of.h>
-+#include <linux/of_platform.h>
- #include <linux/platform_device.h>
- #include <linux/pm.h>
- #include <linux/pm_runtime.h>
-@@ -939,6 +940,41 @@ static int hantro_disable_multicore(struct hantro_dev *vpu)
- return 0;
- }
-
-+static struct v4l2_m2m_dev *hantro_get_v4l2_m2m_dev(struct hantro_dev *vpu)
-+{
-+ struct device_node *node;
-+ struct hantro_dev *shared_vpu;
-+
-+ if (!vpu->variant || !vpu->variant->shared_devices)
-+ goto init_new_m2m_dev;
-+
-+ for_each_matching_node(node, vpu->variant->shared_devices) {
-+ struct platform_device *pdev;
-+ struct v4l2_m2m_dev *m2m_dev;
-+
-+ pdev = of_find_device_by_node(node);
-+ if (!pdev)
-+ continue;
-+
-+ shared_vpu = platform_get_drvdata(pdev);
-+ if (IS_ERR_OR_NULL(shared_vpu) || shared_vpu == vpu) {
-+ platform_device_put(pdev);
-+ continue;
-+ }
-+
-+ v4l2_m2m_get(shared_vpu->m2m_dev);
-+ m2m_dev = shared_vpu->m2m_dev;
-+ platform_device_put(pdev);
-+
-+ of_node_put(node);
-+
-+ return m2m_dev;
-+ }
-+
-+init_new_m2m_dev:
-+ return v4l2_m2m_init(&vpu_m2m_ops);
-+}
-+
- static int hantro_probe(struct platform_device *pdev)
- {
- const struct of_device_id *match;
-@@ -1093,7 +1129,7 @@ static int hantro_probe(struct platform_device *pdev)
- }
- platform_set_drvdata(pdev, vpu);
-
-- vpu->m2m_dev = v4l2_m2m_init(&vpu_m2m_ops);
-+ vpu->m2m_dev = hantro_get_v4l2_m2m_dev(vpu);
- if (IS_ERR(vpu->m2m_dev)) {
- v4l2_err(&vpu->v4l2_dev, "Failed to init mem2mem device\n");
- ret = PTR_ERR(vpu->m2m_dev);
-@@ -1134,7 +1170,7 @@ static int hantro_probe(struct platform_device *pdev)
- hantro_remove_enc_func(vpu);
- err_m2m_rel:
- media_device_cleanup(&vpu->mdev);
-- v4l2_m2m_release(vpu->m2m_dev);
-+ v4l2_m2m_put(vpu->m2m_dev);
- err_v4l2_unreg:
- v4l2_device_unregister(&vpu->v4l2_dev);
- err_clk_unprepare:
-@@ -1157,7 +1193,7 @@ static int hantro_remove(struct platform_device *pdev)
- hantro_remove_dec_func(vpu);
- hantro_remove_enc_func(vpu);
- media_device_cleanup(&vpu->mdev);
-- v4l2_m2m_release(vpu->m2m_dev);
-+ v4l2_m2m_put(vpu->m2m_dev);
- v4l2_device_unregister(&vpu->v4l2_dev);
- clk_bulk_unprepare(vpu->variant->num_clocks, vpu->clocks);
- reset_control_assert(vpu->resets);
-diff --git a/drivers/media/platform/verisilicon/imx8m_vpu_hw.c b/drivers/media/platform/verisilicon/imx8m_vpu_hw.c
-index d89c2c3501aa8..80539f7573c18 100644
---- a/drivers/media/platform/verisilicon/imx8m_vpu_hw.c
-+++ b/drivers/media/platform/verisilicon/imx8m_vpu_hw.c
-@@ -359,6 +359,12 @@ const struct hantro_variant imx8mq_vpu_variant = {
- .num_regs = ARRAY_SIZE(imx8mq_reg_names)
- };
-
-+static const struct of_device_id imx8mq_vpu_shared_resources[] __initconst = {
-+ { .compatible = "nxp,imx8mq-vpu-g1", },
-+ { .compatible = "nxp,imx8mq-vpu-g2", },
-+ { /* sentinel */ }
-+};
-+
- const struct hantro_variant imx8mq_vpu_g1_variant = {
- .dec_fmts = imx8m_vpu_dec_fmts,
- .num_dec_fmts = ARRAY_SIZE(imx8m_vpu_dec_fmts),
-@@ -372,6 +378,7 @@ const struct hantro_variant imx8mq_vpu_g1_variant = {
- .num_irqs = ARRAY_SIZE(imx8mq_irqs),
- .clk_names = imx8mq_g1_clk_names,
- .num_clocks = ARRAY_SIZE(imx8mq_g1_clk_names),
-+ .shared_devices = imx8mq_vpu_shared_resources,
- };
-
- const struct hantro_variant imx8mq_vpu_g2_variant = {
-@@ -387,6 +394,7 @@ const struct hantro_variant imx8mq_vpu_g2_variant = {
- .num_irqs = ARRAY_SIZE(imx8mq_g2_irqs),
- .clk_names = imx8mq_g2_clk_names,
- .num_clocks = ARRAY_SIZE(imx8mq_g2_clk_names),
-+ .shared_devices = imx8mq_vpu_shared_resources,
- };
-
- const struct hantro_variant imx8mm_vpu_g1_variant = {
---
-2.51.0
-
pci-use-resource-names-in-pci-log-messages.patch
resource-add-resource-set-range-and-size-helpers.patch
pci-use-resource_set_range-that-correctly-sets-end.patch
-media-hantro-disable-multicore-support.patch
-media-v4l2-mem2mem-add-a-kref-to-the-v4l2_m2m_dev-st.patch
-media-verisilicon-avoid-g2-bus-error-while-decoding-.patch
kvm-x86-pmu-provide-error-semantics-for-unsupported-.patch
kvm-x86-fix-kvm_get_msrs-stack-info-leak.patch
kvm-x86-rename-kvm_msr_ret_invalid-to-kvm_msr_ret_un.patch
+++ /dev/null
-From 9aa31597e28063994b6f3f0f0d06a4927231609d Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 5 Dec 2025 09:54:24 +0800
-Subject: media: v4l2-mem2mem: Add a kref to the v4l2_m2m_dev structure
-
-From: Nicolas Dufresne <nicolas.dufresne@collabora.com>
-
-[ Upstream commit db6b97a4f8041e479be9ef4b8b07022636c96f50 ]
-
-Adding a reference count to the v4l2_m2m_dev structure allow safely
-sharing it across multiple hardware nodes. This can be used to prevent
-running jobs concurrently on m2m cores that have some internal resource
-sharing.
-
-Signed-off-by: Ming Qian <ming.qian@oss.nxp.com>
-Reviewed-by: Frank Li <Frank.Li@nxp.com>
-Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
-Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
-[hverkuil: fix typos in v4l2_m2m_put documentation]
-Stable-dep-of: e0203ddf9af7 ("media: verisilicon: Avoid G2 bus error while decoding H.264 and HEVC")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/media/v4l2-core/v4l2-mem2mem.c | 23 +++++++++++++++++++++++
- include/media/v4l2-mem2mem.h | 21 +++++++++++++++++++++
- 2 files changed, 44 insertions(+)
-
-diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-core/v4l2-mem2mem.c
-index eb22d6172462d..85006fb18f720 100644
---- a/drivers/media/v4l2-core/v4l2-mem2mem.c
-+++ b/drivers/media/v4l2-core/v4l2-mem2mem.c
-@@ -90,6 +90,7 @@ static const char * const m2m_entity_name[] = {
- * @job_work: worker to run queued jobs.
- * @job_queue_flags: flags of the queue status, %QUEUE_PAUSED.
- * @m2m_ops: driver callbacks
-+ * @kref: device reference count
- */
- struct v4l2_m2m_dev {
- struct v4l2_m2m_ctx *curr_ctx;
-@@ -109,6 +110,8 @@ struct v4l2_m2m_dev {
- unsigned long job_queue_flags;
-
- const struct v4l2_m2m_ops *m2m_ops;
-+
-+ struct kref kref;
- };
-
- static struct v4l2_m2m_queue_ctx *get_queue_ctx(struct v4l2_m2m_ctx *m2m_ctx,
-@@ -1210,6 +1213,7 @@ struct v4l2_m2m_dev *v4l2_m2m_init(const struct v4l2_m2m_ops *m2m_ops)
- INIT_LIST_HEAD(&m2m_dev->job_queue);
- spin_lock_init(&m2m_dev->job_spinlock);
- INIT_WORK(&m2m_dev->job_work, v4l2_m2m_device_run_work);
-+ kref_init(&m2m_dev->kref);
-
- return m2m_dev;
- }
-@@ -1221,6 +1225,25 @@ void v4l2_m2m_release(struct v4l2_m2m_dev *m2m_dev)
- }
- EXPORT_SYMBOL_GPL(v4l2_m2m_release);
-
-+void v4l2_m2m_get(struct v4l2_m2m_dev *m2m_dev)
-+{
-+ kref_get(&m2m_dev->kref);
-+}
-+EXPORT_SYMBOL_GPL(v4l2_m2m_get);
-+
-+static void v4l2_m2m_release_from_kref(struct kref *kref)
-+{
-+ struct v4l2_m2m_dev *m2m_dev = container_of(kref, struct v4l2_m2m_dev, kref);
-+
-+ v4l2_m2m_release(m2m_dev);
-+}
-+
-+void v4l2_m2m_put(struct v4l2_m2m_dev *m2m_dev)
-+{
-+ kref_put(&m2m_dev->kref, v4l2_m2m_release_from_kref);
-+}
-+EXPORT_SYMBOL_GPL(v4l2_m2m_put);
-+
- struct v4l2_m2m_ctx *v4l2_m2m_ctx_init(struct v4l2_m2m_dev *m2m_dev,
- void *drv_priv,
- int (*queue_init)(void *priv, struct vb2_queue *src_vq, struct vb2_queue *dst_vq))
-diff --git a/include/media/v4l2-mem2mem.h b/include/media/v4l2-mem2mem.h
-index 2e55a13ed3bb8..1f10f63ef3803 100644
---- a/include/media/v4l2-mem2mem.h
-+++ b/include/media/v4l2-mem2mem.h
-@@ -544,6 +544,27 @@ v4l2_m2m_register_media_controller(struct v4l2_m2m_dev *m2m_dev,
- */
- void v4l2_m2m_release(struct v4l2_m2m_dev *m2m_dev);
-
-+/**
-+ * v4l2_m2m_get() - take a reference to the m2m_dev structure
-+ *
-+ * @m2m_dev: opaque pointer to the internal data to handle M2M context
-+ *
-+ * This is used to share the M2M device across multiple devices. This
-+ * can be used to avoid scheduling two hardware nodes concurrently.
-+ */
-+void v4l2_m2m_get(struct v4l2_m2m_dev *m2m_dev);
-+
-+/**
-+ * v4l2_m2m_put() - remove a reference to the m2m_dev structure
-+ *
-+ * @m2m_dev: opaque pointer to the internal data to handle M2M context
-+ *
-+ * Once the M2M device has no more references, v4l2_m2m_release() will be
-+ * called automatically. Users of this method should never call
-+ * v4l2_m2m_release() directly. See v4l2_m2m_get() for more details.
-+ */
-+void v4l2_m2m_put(struct v4l2_m2m_dev *m2m_dev);
-+
- /**
- * v4l2_m2m_ctx_init() - allocate and initialize a m2m context
- *
---
-2.51.0
-
+++ /dev/null
-From 66025d48611fb6b74640a347733a72df72fb8794 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 5 Dec 2025 09:54:26 +0800
-Subject: media: verisilicon: Avoid G2 bus error while decoding H.264 and HEVC
-
-From: Ming Qian <ming.qian@oss.nxp.com>
-
-[ Upstream commit e0203ddf9af7c8e170e1e99ce83b4dc07f0cd765 ]
-
-For the i.MX8MQ platform, there is a hardware limitation: the g1 VPU and
-g2 VPU cannot decode simultaneously; otherwise, it will cause below bus
-error and produce corrupted pictures, even potentially lead to system hang.
-
-[ 110.527986] hantro-vpu 38310000.video-codec: frame decode timed out.
-[ 110.583517] hantro-vpu 38310000.video-codec: bus error detected.
-
-Therefore, it is necessary to ensure that g1 and g2 operate alternately.
-This allows for successful multi-instance decoding of H.264 and HEVC.
-
-To achieve this, g1 and g2 share the same v4l2_m2m_dev, and then the
-v4l2_m2m_dev can handle the scheduling.
-
-Fixes: cb5dd5a0fa518 ("media: hantro: Introduce G2/HEVC decoder")
-Cc: stable@vger.kernel.org
-Signed-off-by: Ming Qian <ming.qian@oss.nxp.com>
-Reviewed-by: Frank Li <Frank.Li@nxp.com>
-Co-developed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
-Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
-Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/media/platform/verisilicon/hantro.h | 2 +
- .../media/platform/verisilicon/hantro_drv.c | 42 +++++++++++++++++--
- .../media/platform/verisilicon/imx8m_vpu_hw.c | 8 ++++
- 3 files changed, 49 insertions(+), 3 deletions(-)
-
-diff --git a/drivers/media/platform/verisilicon/hantro.h b/drivers/media/platform/verisilicon/hantro.h
-index 811260dc3c777..439f0adb4e816 100644
---- a/drivers/media/platform/verisilicon/hantro.h
-+++ b/drivers/media/platform/verisilicon/hantro.h
-@@ -77,6 +77,7 @@ struct hantro_irq {
- * @double_buffer: core needs double buffering
- * @legacy_regs: core uses legacy register set
- * @late_postproc: postproc must be set up at the end of the job
-+ * @shared_devices: an array of device ids that cannot run concurrently
- */
- struct hantro_variant {
- unsigned int enc_offset;
-@@ -101,6 +102,7 @@ struct hantro_variant {
- unsigned int double_buffer : 1;
- unsigned int legacy_regs : 1;
- unsigned int late_postproc : 1;
-+ const struct of_device_id *shared_devices;
- };
-
- /**
-diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
-index 137ca13eeed7c..01d6ab67a8bf3 100644
---- a/drivers/media/platform/verisilicon/hantro_drv.c
-+++ b/drivers/media/platform/verisilicon/hantro_drv.c
-@@ -13,6 +13,7 @@
- #include <linux/clk.h>
- #include <linux/module.h>
- #include <linux/of.h>
-+#include <linux/of_platform.h>
- #include <linux/platform_device.h>
- #include <linux/pm.h>
- #include <linux/pm_runtime.h>
-@@ -1038,6 +1039,41 @@ static int hantro_disable_multicore(struct hantro_dev *vpu)
- return 0;
- }
-
-+static struct v4l2_m2m_dev *hantro_get_v4l2_m2m_dev(struct hantro_dev *vpu)
-+{
-+ struct device_node *node;
-+ struct hantro_dev *shared_vpu;
-+
-+ if (!vpu->variant || !vpu->variant->shared_devices)
-+ goto init_new_m2m_dev;
-+
-+ for_each_matching_node(node, vpu->variant->shared_devices) {
-+ struct platform_device *pdev;
-+ struct v4l2_m2m_dev *m2m_dev;
-+
-+ pdev = of_find_device_by_node(node);
-+ if (!pdev)
-+ continue;
-+
-+ shared_vpu = platform_get_drvdata(pdev);
-+ if (IS_ERR_OR_NULL(shared_vpu) || shared_vpu == vpu) {
-+ platform_device_put(pdev);
-+ continue;
-+ }
-+
-+ v4l2_m2m_get(shared_vpu->m2m_dev);
-+ m2m_dev = shared_vpu->m2m_dev;
-+ platform_device_put(pdev);
-+
-+ of_node_put(node);
-+
-+ return m2m_dev;
-+ }
-+
-+init_new_m2m_dev:
-+ return v4l2_m2m_init(&vpu_m2m_ops);
-+}
-+
- static int hantro_probe(struct platform_device *pdev)
- {
- const struct of_device_id *match;
-@@ -1189,7 +1225,7 @@ static int hantro_probe(struct platform_device *pdev)
- }
- platform_set_drvdata(pdev, vpu);
-
-- vpu->m2m_dev = v4l2_m2m_init(&vpu_m2m_ops);
-+ vpu->m2m_dev = hantro_get_v4l2_m2m_dev(vpu);
- if (IS_ERR(vpu->m2m_dev)) {
- v4l2_err(&vpu->v4l2_dev, "Failed to init mem2mem device\n");
- ret = PTR_ERR(vpu->m2m_dev);
-@@ -1228,7 +1264,7 @@ static int hantro_probe(struct platform_device *pdev)
- hantro_remove_enc_func(vpu);
- err_m2m_rel:
- media_device_cleanup(&vpu->mdev);
-- v4l2_m2m_release(vpu->m2m_dev);
-+ v4l2_m2m_put(vpu->m2m_dev);
- err_v4l2_unreg:
- v4l2_device_unregister(&vpu->v4l2_dev);
- err_clk_unprepare:
-@@ -1251,7 +1287,7 @@ static void hantro_remove(struct platform_device *pdev)
- hantro_remove_dec_func(vpu);
- hantro_remove_enc_func(vpu);
- media_device_cleanup(&vpu->mdev);
-- v4l2_m2m_release(vpu->m2m_dev);
-+ v4l2_m2m_put(vpu->m2m_dev);
- v4l2_device_unregister(&vpu->v4l2_dev);
- clk_bulk_unprepare(vpu->variant->num_clocks, vpu->clocks);
- reset_control_assert(vpu->resets);
-diff --git a/drivers/media/platform/verisilicon/imx8m_vpu_hw.c b/drivers/media/platform/verisilicon/imx8m_vpu_hw.c
-index 74fd985a8aad1..cdaac2f18fb54 100644
---- a/drivers/media/platform/verisilicon/imx8m_vpu_hw.c
-+++ b/drivers/media/platform/verisilicon/imx8m_vpu_hw.c
-@@ -361,6 +361,12 @@ const struct hantro_variant imx8mq_vpu_variant = {
- .num_regs = ARRAY_SIZE(imx8mq_reg_names)
- };
-
-+static const struct of_device_id imx8mq_vpu_shared_resources[] __initconst = {
-+ { .compatible = "nxp,imx8mq-vpu-g1", },
-+ { .compatible = "nxp,imx8mq-vpu-g2", },
-+ { /* sentinel */ }
-+};
-+
- const struct hantro_variant imx8mq_vpu_g1_variant = {
- .dec_fmts = imx8m_vpu_dec_fmts,
- .num_dec_fmts = ARRAY_SIZE(imx8m_vpu_dec_fmts),
-@@ -374,6 +380,7 @@ const struct hantro_variant imx8mq_vpu_g1_variant = {
- .num_irqs = ARRAY_SIZE(imx8mq_irqs),
- .clk_names = imx8mq_g1_clk_names,
- .num_clocks = ARRAY_SIZE(imx8mq_g1_clk_names),
-+ .shared_devices = imx8mq_vpu_shared_resources,
- };
-
- const struct hantro_variant imx8mq_vpu_g2_variant = {
-@@ -389,6 +396,7 @@ const struct hantro_variant imx8mq_vpu_g2_variant = {
- .num_irqs = ARRAY_SIZE(imx8mq_g2_irqs),
- .clk_names = imx8mq_g2_clk_names,
- .num_clocks = ARRAY_SIZE(imx8mq_g2_clk_names),
-+ .shared_devices = imx8mq_vpu_shared_resources,
- };
-
- const struct hantro_variant imx8mm_vpu_g1_variant = {
---
-2.51.0
-
revert-pci-qcom-don-t-wait-for-link-if-we-can-detect.patch
resource-add-resource-set-range-and-size-helpers.patch
pci-use-resource_set_range-that-correctly-sets-end.patch
-media-v4l2-mem2mem-add-a-kref-to-the-v4l2_m2m_dev-st.patch
-media-verisilicon-avoid-g2-bus-error-while-decoding-.patch
media-tegra-video-fix-memory-leak-in-__tegra_channel.patch
media-dw9714-move-power-sequences-to-dedicated-funct.patch
media-dw9714-add-support-for-powerdown-pin.patch
+++ /dev/null
-From 1ebef733ac0afb8a72d3eedeb422767be5fa452d Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 5 Dec 2025 09:54:24 +0800
-Subject: media: v4l2-mem2mem: Add a kref to the v4l2_m2m_dev structure
-
-From: Nicolas Dufresne <nicolas.dufresne@collabora.com>
-
-[ Upstream commit db6b97a4f8041e479be9ef4b8b07022636c96f50 ]
-
-Adding a reference count to the v4l2_m2m_dev structure allow safely
-sharing it across multiple hardware nodes. This can be used to prevent
-running jobs concurrently on m2m cores that have some internal resource
-sharing.
-
-Signed-off-by: Ming Qian <ming.qian@oss.nxp.com>
-Reviewed-by: Frank Li <Frank.Li@nxp.com>
-Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
-Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
-[hverkuil: fix typos in v4l2_m2m_put documentation]
-Stable-dep-of: e0203ddf9af7 ("media: verisilicon: Avoid G2 bus error while decoding H.264 and HEVC")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/media/v4l2-core/v4l2-mem2mem.c | 23 +++++++++++++++++++++++
- include/media/v4l2-mem2mem.h | 21 +++++++++++++++++++++
- 2 files changed, 44 insertions(+)
-
-diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-core/v4l2-mem2mem.c
-index 21acd9bc86071..bc8218d1cab9f 100644
---- a/drivers/media/v4l2-core/v4l2-mem2mem.c
-+++ b/drivers/media/v4l2-core/v4l2-mem2mem.c
-@@ -90,6 +90,7 @@ static const char * const m2m_entity_name[] = {
- * @job_work: worker to run queued jobs.
- * @job_queue_flags: flags of the queue status, %QUEUE_PAUSED.
- * @m2m_ops: driver callbacks
-+ * @kref: device reference count
- */
- struct v4l2_m2m_dev {
- struct v4l2_m2m_ctx *curr_ctx;
-@@ -109,6 +110,8 @@ struct v4l2_m2m_dev {
- unsigned long job_queue_flags;
-
- const struct v4l2_m2m_ops *m2m_ops;
-+
-+ struct kref kref;
- };
-
- static struct v4l2_m2m_queue_ctx *get_queue_ctx(struct v4l2_m2m_ctx *m2m_ctx,
-@@ -1206,6 +1209,7 @@ struct v4l2_m2m_dev *v4l2_m2m_init(const struct v4l2_m2m_ops *m2m_ops)
- INIT_LIST_HEAD(&m2m_dev->job_queue);
- spin_lock_init(&m2m_dev->job_spinlock);
- INIT_WORK(&m2m_dev->job_work, v4l2_m2m_device_run_work);
-+ kref_init(&m2m_dev->kref);
-
- return m2m_dev;
- }
-@@ -1217,6 +1221,25 @@ void v4l2_m2m_release(struct v4l2_m2m_dev *m2m_dev)
- }
- EXPORT_SYMBOL_GPL(v4l2_m2m_release);
-
-+void v4l2_m2m_get(struct v4l2_m2m_dev *m2m_dev)
-+{
-+ kref_get(&m2m_dev->kref);
-+}
-+EXPORT_SYMBOL_GPL(v4l2_m2m_get);
-+
-+static void v4l2_m2m_release_from_kref(struct kref *kref)
-+{
-+ struct v4l2_m2m_dev *m2m_dev = container_of(kref, struct v4l2_m2m_dev, kref);
-+
-+ v4l2_m2m_release(m2m_dev);
-+}
-+
-+void v4l2_m2m_put(struct v4l2_m2m_dev *m2m_dev)
-+{
-+ kref_put(&m2m_dev->kref, v4l2_m2m_release_from_kref);
-+}
-+EXPORT_SYMBOL_GPL(v4l2_m2m_put);
-+
- struct v4l2_m2m_ctx *v4l2_m2m_ctx_init(struct v4l2_m2m_dev *m2m_dev,
- void *drv_priv,
- int (*queue_init)(void *priv, struct vb2_queue *src_vq, struct vb2_queue *dst_vq))
-diff --git a/include/media/v4l2-mem2mem.h b/include/media/v4l2-mem2mem.h
-index 500f81f399dfa..08e3c9c4f1e9d 100644
---- a/include/media/v4l2-mem2mem.h
-+++ b/include/media/v4l2-mem2mem.h
-@@ -544,6 +544,27 @@ v4l2_m2m_register_media_controller(struct v4l2_m2m_dev *m2m_dev,
- */
- void v4l2_m2m_release(struct v4l2_m2m_dev *m2m_dev);
-
-+/**
-+ * v4l2_m2m_get() - take a reference to the m2m_dev structure
-+ *
-+ * @m2m_dev: opaque pointer to the internal data to handle M2M context
-+ *
-+ * This is used to share the M2M device across multiple devices. This
-+ * can be used to avoid scheduling two hardware nodes concurrently.
-+ */
-+void v4l2_m2m_get(struct v4l2_m2m_dev *m2m_dev);
-+
-+/**
-+ * v4l2_m2m_put() - remove a reference to the m2m_dev structure
-+ *
-+ * @m2m_dev: opaque pointer to the internal data to handle M2M context
-+ *
-+ * Once the M2M device has no more references, v4l2_m2m_release() will be
-+ * called automatically. Users of this method should never call
-+ * v4l2_m2m_release() directly. See v4l2_m2m_get() for more details.
-+ */
-+void v4l2_m2m_put(struct v4l2_m2m_dev *m2m_dev);
-+
- /**
- * v4l2_m2m_ctx_init() - allocate and initialize a m2m context
- *
---
-2.51.0
-
+++ /dev/null
-From a5c324444d578d055bcc015e6efe420c204a374d Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 5 Dec 2025 09:54:26 +0800
-Subject: media: verisilicon: Avoid G2 bus error while decoding H.264 and HEVC
-
-From: Ming Qian <ming.qian@oss.nxp.com>
-
-[ Upstream commit e0203ddf9af7c8e170e1e99ce83b4dc07f0cd765 ]
-
-For the i.MX8MQ platform, there is a hardware limitation: the g1 VPU and
-g2 VPU cannot decode simultaneously; otherwise, it will cause below bus
-error and produce corrupted pictures, even potentially lead to system hang.
-
-[ 110.527986] hantro-vpu 38310000.video-codec: frame decode timed out.
-[ 110.583517] hantro-vpu 38310000.video-codec: bus error detected.
-
-Therefore, it is necessary to ensure that g1 and g2 operate alternately.
-This allows for successful multi-instance decoding of H.264 and HEVC.
-
-To achieve this, g1 and g2 share the same v4l2_m2m_dev, and then the
-v4l2_m2m_dev can handle the scheduling.
-
-Fixes: cb5dd5a0fa518 ("media: hantro: Introduce G2/HEVC decoder")
-Cc: stable@vger.kernel.org
-Signed-off-by: Ming Qian <ming.qian@oss.nxp.com>
-Reviewed-by: Frank Li <Frank.Li@nxp.com>
-Co-developed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
-Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
-Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/media/platform/verisilicon/hantro.h | 2 +
- .../media/platform/verisilicon/hantro_drv.c | 42 +++++++++++++++++--
- .../media/platform/verisilicon/imx8m_vpu_hw.c | 8 ++++
- 3 files changed, 49 insertions(+), 3 deletions(-)
-
-diff --git a/drivers/media/platform/verisilicon/hantro.h b/drivers/media/platform/verisilicon/hantro.h
-index e0fdc4535b2d7..0353de154a1ec 100644
---- a/drivers/media/platform/verisilicon/hantro.h
-+++ b/drivers/media/platform/verisilicon/hantro.h
-@@ -77,6 +77,7 @@ struct hantro_irq {
- * @double_buffer: core needs double buffering
- * @legacy_regs: core uses legacy register set
- * @late_postproc: postproc must be set up at the end of the job
-+ * @shared_devices: an array of device ids that cannot run concurrently
- */
- struct hantro_variant {
- unsigned int enc_offset;
-@@ -101,6 +102,7 @@ struct hantro_variant {
- unsigned int double_buffer : 1;
- unsigned int legacy_regs : 1;
- unsigned int late_postproc : 1;
-+ const struct of_device_id *shared_devices;
- };
-
- /**
-diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
-index e0c11fe8b55ca..418cfe3a14146 100644
---- a/drivers/media/platform/verisilicon/hantro_drv.c
-+++ b/drivers/media/platform/verisilicon/hantro_drv.c
-@@ -13,6 +13,7 @@
- #include <linux/clk.h>
- #include <linux/module.h>
- #include <linux/of.h>
-+#include <linux/of_platform.h>
- #include <linux/platform_device.h>
- #include <linux/pm.h>
- #include <linux/pm_runtime.h>
-@@ -1035,6 +1036,41 @@ static int hantro_disable_multicore(struct hantro_dev *vpu)
- return 0;
- }
-
-+static struct v4l2_m2m_dev *hantro_get_v4l2_m2m_dev(struct hantro_dev *vpu)
-+{
-+ struct device_node *node;
-+ struct hantro_dev *shared_vpu;
-+
-+ if (!vpu->variant || !vpu->variant->shared_devices)
-+ goto init_new_m2m_dev;
-+
-+ for_each_matching_node(node, vpu->variant->shared_devices) {
-+ struct platform_device *pdev;
-+ struct v4l2_m2m_dev *m2m_dev;
-+
-+ pdev = of_find_device_by_node(node);
-+ if (!pdev)
-+ continue;
-+
-+ shared_vpu = platform_get_drvdata(pdev);
-+ if (IS_ERR_OR_NULL(shared_vpu) || shared_vpu == vpu) {
-+ platform_device_put(pdev);
-+ continue;
-+ }
-+
-+ v4l2_m2m_get(shared_vpu->m2m_dev);
-+ m2m_dev = shared_vpu->m2m_dev;
-+ platform_device_put(pdev);
-+
-+ of_node_put(node);
-+
-+ return m2m_dev;
-+ }
-+
-+init_new_m2m_dev:
-+ return v4l2_m2m_init(&vpu_m2m_ops);
-+}
-+
- static int hantro_probe(struct platform_device *pdev)
- {
- const struct of_device_id *match;
-@@ -1186,7 +1222,7 @@ static int hantro_probe(struct platform_device *pdev)
- }
- platform_set_drvdata(pdev, vpu);
-
-- vpu->m2m_dev = v4l2_m2m_init(&vpu_m2m_ops);
-+ vpu->m2m_dev = hantro_get_v4l2_m2m_dev(vpu);
- if (IS_ERR(vpu->m2m_dev)) {
- v4l2_err(&vpu->v4l2_dev, "Failed to init mem2mem device\n");
- ret = PTR_ERR(vpu->m2m_dev);
-@@ -1225,7 +1261,7 @@ static int hantro_probe(struct platform_device *pdev)
- hantro_remove_enc_func(vpu);
- err_m2m_rel:
- media_device_cleanup(&vpu->mdev);
-- v4l2_m2m_release(vpu->m2m_dev);
-+ v4l2_m2m_put(vpu->m2m_dev);
- err_v4l2_unreg:
- v4l2_device_unregister(&vpu->v4l2_dev);
- err_clk_unprepare:
-@@ -1248,7 +1284,7 @@ static void hantro_remove(struct platform_device *pdev)
- hantro_remove_dec_func(vpu);
- hantro_remove_enc_func(vpu);
- media_device_cleanup(&vpu->mdev);
-- v4l2_m2m_release(vpu->m2m_dev);
-+ v4l2_m2m_put(vpu->m2m_dev);
- v4l2_device_unregister(&vpu->v4l2_dev);
- clk_bulk_unprepare(vpu->variant->num_clocks, vpu->clocks);
- reset_control_assert(vpu->resets);
-diff --git a/drivers/media/platform/verisilicon/imx8m_vpu_hw.c b/drivers/media/platform/verisilicon/imx8m_vpu_hw.c
-index 5be0e2e76882f..6f8e43b7f1575 100644
---- a/drivers/media/platform/verisilicon/imx8m_vpu_hw.c
-+++ b/drivers/media/platform/verisilicon/imx8m_vpu_hw.c
-@@ -343,6 +343,12 @@ const struct hantro_variant imx8mq_vpu_variant = {
- .num_regs = ARRAY_SIZE(imx8mq_reg_names)
- };
-
-+static const struct of_device_id imx8mq_vpu_shared_resources[] __initconst = {
-+ { .compatible = "nxp,imx8mq-vpu-g1", },
-+ { .compatible = "nxp,imx8mq-vpu-g2", },
-+ { /* sentinel */ }
-+};
-+
- const struct hantro_variant imx8mq_vpu_g1_variant = {
- .dec_fmts = imx8m_vpu_dec_fmts,
- .num_dec_fmts = ARRAY_SIZE(imx8m_vpu_dec_fmts),
-@@ -356,6 +362,7 @@ const struct hantro_variant imx8mq_vpu_g1_variant = {
- .num_irqs = ARRAY_SIZE(imx8mq_irqs),
- .clk_names = imx8mq_g1_clk_names,
- .num_clocks = ARRAY_SIZE(imx8mq_g1_clk_names),
-+ .shared_devices = imx8mq_vpu_shared_resources,
- };
-
- const struct hantro_variant imx8mq_vpu_g2_variant = {
-@@ -371,6 +378,7 @@ const struct hantro_variant imx8mq_vpu_g2_variant = {
- .num_irqs = ARRAY_SIZE(imx8mq_g2_irqs),
- .clk_names = imx8mq_g2_clk_names,
- .num_clocks = ARRAY_SIZE(imx8mq_g2_clk_names),
-+ .shared_devices = imx8mq_vpu_shared_resources,
- };
-
- const struct hantro_variant imx8mm_vpu_g1_variant = {
---
-2.51.0
-
pci-dw-rockchip-change-get_ltssm-to-provide-l1-subst.patch
revert-pci-dw-rockchip-enumerate-endpoints-based-on-.patch
net-qrtr-drop-the-mhi-auto_queue-feature-for-ipcr-dl.patch
-media-v4l2-mem2mem-add-a-kref-to-the-v4l2_m2m_dev-st.patch
-media-verisilicon-avoid-g2-bus-error-while-decoding-.patch
usb-gadget-u_ether-add-gether_opts-for-config-cachin.patch
usb-gadget-u_ether-add-auto-cleanup-helper-for-freei.patch
usb-gadget-f_ncm-align-net_device-lifecycle-with-bin.patch
+++ /dev/null
-From 640169aba8c4313195e25a1ba6a339fce5544ecc Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 18 Jun 2024 20:18:34 +0200
-Subject: media: hantro: Disable multicore support
-
-From: Sebastian Reichel <sebastian.reichel@collabora.com>
-
-[ Upstream commit ccdeb8d57f7fb3e5c05d72cb7dfb9bc78f09f542 ]
-
-Avoid exposing equal Hantro video codecs to userspace. Equal video
-codecs allow scheduling work between the cores. For that kernel support
-is required, which does not yet exist. Until that is implemented avoid
-exposing each core separately to userspace so that multicore can be
-added in the future without breaking userspace ABI.
-
-This was written with Rockchip RK3588 in mind (which has 4 Hantro H1
-cores), but applies to all SoCs.
-
-Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
-Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
-Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-Stable-dep-of: e0203ddf9af7 ("media: verisilicon: Avoid G2 bus error while decoding H.264 and HEVC")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- .../media/platform/verisilicon/hantro_drv.c | 47 +++++++++++++++++++
- 1 file changed, 47 insertions(+)
-
-diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
-index 35833ee8beb51..7892b9f34599a 100644
---- a/drivers/media/platform/verisilicon/hantro_drv.c
-+++ b/drivers/media/platform/verisilicon/hantro_drv.c
-@@ -987,6 +987,49 @@ static const struct media_device_ops hantro_m2m_media_ops = {
- .req_queue = v4l2_m2m_request_queue,
- };
-
-+/*
-+ * Some SoCs, like RK3588 have multiple identical Hantro cores, but the
-+ * kernel is currently missing support for multi-core handling. Exposing
-+ * separate devices for each core to userspace is bad, since that does
-+ * not allow scheduling tasks properly (and creates ABI). With this workaround
-+ * the driver will only probe for the first core and early exit for the other
-+ * cores. Once the driver gains multi-core support, the same technique
-+ * for detecting the main core can be used to cluster all cores together.
-+ */
-+static int hantro_disable_multicore(struct hantro_dev *vpu)
-+{
-+ struct device_node *node = NULL;
-+ const char *compatible;
-+ bool is_main_core;
-+ int ret;
-+
-+ /* Intentionally ignores the fallback strings */
-+ ret = of_property_read_string(vpu->dev->of_node, "compatible", &compatible);
-+ if (ret)
-+ return ret;
-+
-+ /* The first compatible and available node found is considered the main core */
-+ do {
-+ node = of_find_compatible_node(node, NULL, compatible);
-+ if (of_device_is_available(node))
-+ break;
-+ } while (node);
-+
-+ if (!node)
-+ return -EINVAL;
-+
-+ is_main_core = (vpu->dev->of_node == node);
-+
-+ of_node_put(node);
-+
-+ if (!is_main_core) {
-+ dev_info(vpu->dev, "missing multi-core support, ignoring this instance\n");
-+ return -ENODEV;
-+ }
-+
-+ return 0;
-+}
-+
- static int hantro_probe(struct platform_device *pdev)
- {
- const struct of_device_id *match;
-@@ -1006,6 +1049,10 @@ static int hantro_probe(struct platform_device *pdev)
- match = of_match_node(of_hantro_match, pdev->dev.of_node);
- vpu->variant = match->data;
-
-+ ret = hantro_disable_multicore(vpu);
-+ if (ret)
-+ return ret;
-+
- /*
- * Support for nxp,imx8mq-vpu is kept for backwards compatibility
- * but it's deprecated. Please update your DTS file to use
---
-2.51.0
-
+++ /dev/null
-From 43ecdabd71969b9b9c6eb7f96a0a89c8c4108c5e Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 5 Dec 2025 09:54:24 +0800
-Subject: media: v4l2-mem2mem: Add a kref to the v4l2_m2m_dev structure
-
-From: Nicolas Dufresne <nicolas.dufresne@collabora.com>
-
-[ Upstream commit db6b97a4f8041e479be9ef4b8b07022636c96f50 ]
-
-Adding a reference count to the v4l2_m2m_dev structure allow safely
-sharing it across multiple hardware nodes. This can be used to prevent
-running jobs concurrently on m2m cores that have some internal resource
-sharing.
-
-Signed-off-by: Ming Qian <ming.qian@oss.nxp.com>
-Reviewed-by: Frank Li <Frank.Li@nxp.com>
-Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
-Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
-[hverkuil: fix typos in v4l2_m2m_put documentation]
-Stable-dep-of: e0203ddf9af7 ("media: verisilicon: Avoid G2 bus error while decoding H.264 and HEVC")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/media/v4l2-core/v4l2-mem2mem.c | 23 +++++++++++++++++++++++
- include/media/v4l2-mem2mem.h | 21 +++++++++++++++++++++
- 2 files changed, 44 insertions(+)
-
-diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-core/v4l2-mem2mem.c
-index 8db9ac9c1433f..494ddd7e142cc 100644
---- a/drivers/media/v4l2-core/v4l2-mem2mem.c
-+++ b/drivers/media/v4l2-core/v4l2-mem2mem.c
-@@ -90,6 +90,7 @@ static const char * const m2m_entity_name[] = {
- * @job_work: worker to run queued jobs.
- * @job_queue_flags: flags of the queue status, %QUEUE_PAUSED.
- * @m2m_ops: driver callbacks
-+ * @kref: device reference count
- */
- struct v4l2_m2m_dev {
- struct v4l2_m2m_ctx *curr_ctx;
-@@ -109,6 +110,8 @@ struct v4l2_m2m_dev {
- unsigned long job_queue_flags;
-
- const struct v4l2_m2m_ops *m2m_ops;
-+
-+ struct kref kref;
- };
-
- static struct v4l2_m2m_queue_ctx *get_queue_ctx(struct v4l2_m2m_ctx *m2m_ctx,
-@@ -1207,6 +1210,7 @@ struct v4l2_m2m_dev *v4l2_m2m_init(const struct v4l2_m2m_ops *m2m_ops)
- INIT_LIST_HEAD(&m2m_dev->job_queue);
- spin_lock_init(&m2m_dev->job_spinlock);
- INIT_WORK(&m2m_dev->job_work, v4l2_m2m_device_run_work);
-+ kref_init(&m2m_dev->kref);
-
- return m2m_dev;
- }
-@@ -1218,6 +1222,25 @@ void v4l2_m2m_release(struct v4l2_m2m_dev *m2m_dev)
- }
- EXPORT_SYMBOL_GPL(v4l2_m2m_release);
-
-+void v4l2_m2m_get(struct v4l2_m2m_dev *m2m_dev)
-+{
-+ kref_get(&m2m_dev->kref);
-+}
-+EXPORT_SYMBOL_GPL(v4l2_m2m_get);
-+
-+static void v4l2_m2m_release_from_kref(struct kref *kref)
-+{
-+ struct v4l2_m2m_dev *m2m_dev = container_of(kref, struct v4l2_m2m_dev, kref);
-+
-+ v4l2_m2m_release(m2m_dev);
-+}
-+
-+void v4l2_m2m_put(struct v4l2_m2m_dev *m2m_dev)
-+{
-+ kref_put(&m2m_dev->kref, v4l2_m2m_release_from_kref);
-+}
-+EXPORT_SYMBOL_GPL(v4l2_m2m_put);
-+
- struct v4l2_m2m_ctx *v4l2_m2m_ctx_init(struct v4l2_m2m_dev *m2m_dev,
- void *drv_priv,
- int (*queue_init)(void *priv, struct vb2_queue *src_vq, struct vb2_queue *dst_vq))
-diff --git a/include/media/v4l2-mem2mem.h b/include/media/v4l2-mem2mem.h
-index 370c230ad3bea..4a2649a4562ae 100644
---- a/include/media/v4l2-mem2mem.h
-+++ b/include/media/v4l2-mem2mem.h
-@@ -537,6 +537,27 @@ v4l2_m2m_register_media_controller(struct v4l2_m2m_dev *m2m_dev,
- */
- void v4l2_m2m_release(struct v4l2_m2m_dev *m2m_dev);
-
-+/**
-+ * v4l2_m2m_get() - take a reference to the m2m_dev structure
-+ *
-+ * @m2m_dev: opaque pointer to the internal data to handle M2M context
-+ *
-+ * This is used to share the M2M device across multiple devices. This
-+ * can be used to avoid scheduling two hardware nodes concurrently.
-+ */
-+void v4l2_m2m_get(struct v4l2_m2m_dev *m2m_dev);
-+
-+/**
-+ * v4l2_m2m_put() - remove a reference to the m2m_dev structure
-+ *
-+ * @m2m_dev: opaque pointer to the internal data to handle M2M context
-+ *
-+ * Once the M2M device has no more references, v4l2_m2m_release() will be
-+ * called automatically. Users of this method should never call
-+ * v4l2_m2m_release() directly. See v4l2_m2m_get() for more details.
-+ */
-+void v4l2_m2m_put(struct v4l2_m2m_dev *m2m_dev);
-+
- /**
- * v4l2_m2m_ctx_init() - allocate and initialize a m2m context
- *
---
-2.51.0
-
+++ /dev/null
-From 2739f07120ee5f578827b8561177517b582a2b7d Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 5 Dec 2025 09:54:26 +0800
-Subject: media: verisilicon: Avoid G2 bus error while decoding H.264 and HEVC
-
-From: Ming Qian <ming.qian@oss.nxp.com>
-
-[ Upstream commit e0203ddf9af7c8e170e1e99ce83b4dc07f0cd765 ]
-
-For the i.MX8MQ platform, there is a hardware limitation: the g1 VPU and
-g2 VPU cannot decode simultaneously; otherwise, it will cause below bus
-error and produce corrupted pictures, even potentially lead to system hang.
-
-[ 110.527986] hantro-vpu 38310000.video-codec: frame decode timed out.
-[ 110.583517] hantro-vpu 38310000.video-codec: bus error detected.
-
-Therefore, it is necessary to ensure that g1 and g2 operate alternately.
-This allows for successful multi-instance decoding of H.264 and HEVC.
-
-To achieve this, g1 and g2 share the same v4l2_m2m_dev, and then the
-v4l2_m2m_dev can handle the scheduling.
-
-Fixes: cb5dd5a0fa518 ("media: hantro: Introduce G2/HEVC decoder")
-Cc: stable@vger.kernel.org
-Signed-off-by: Ming Qian <ming.qian@oss.nxp.com>
-Reviewed-by: Frank Li <Frank.Li@nxp.com>
-Co-developed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
-Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
-Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/media/platform/verisilicon/hantro.h | 2 +
- .../media/platform/verisilicon/hantro_drv.c | 42 +++++++++++++++++--
- .../media/platform/verisilicon/imx8m_vpu_hw.c | 8 ++++
- 3 files changed, 49 insertions(+), 3 deletions(-)
-
-diff --git a/drivers/media/platform/verisilicon/hantro.h b/drivers/media/platform/verisilicon/hantro.h
-index e9e15746f0aa1..ce13812a94001 100644
---- a/drivers/media/platform/verisilicon/hantro.h
-+++ b/drivers/media/platform/verisilicon/hantro.h
-@@ -77,6 +77,7 @@ struct hantro_irq {
- * @double_buffer: core needs double buffering
- * @legacy_regs: core uses legacy register set
- * @late_postproc: postproc must be set up at the end of the job
-+ * @shared_devices: an array of device ids that cannot run concurrently
- */
- struct hantro_variant {
- unsigned int enc_offset;
-@@ -101,6 +102,7 @@ struct hantro_variant {
- unsigned int double_buffer : 1;
- unsigned int legacy_regs : 1;
- unsigned int late_postproc : 1;
-+ const struct of_device_id *shared_devices;
- };
-
- /**
-diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
-index 7892b9f34599a..6ebab13712af3 100644
---- a/drivers/media/platform/verisilicon/hantro_drv.c
-+++ b/drivers/media/platform/verisilicon/hantro_drv.c
-@@ -13,6 +13,7 @@
- #include <linux/clk.h>
- #include <linux/module.h>
- #include <linux/of.h>
-+#include <linux/of_platform.h>
- #include <linux/platform_device.h>
- #include <linux/pm.h>
- #include <linux/pm_runtime.h>
-@@ -1030,6 +1031,41 @@ static int hantro_disable_multicore(struct hantro_dev *vpu)
- return 0;
- }
-
-+static struct v4l2_m2m_dev *hantro_get_v4l2_m2m_dev(struct hantro_dev *vpu)
-+{
-+ struct device_node *node;
-+ struct hantro_dev *shared_vpu;
-+
-+ if (!vpu->variant || !vpu->variant->shared_devices)
-+ goto init_new_m2m_dev;
-+
-+ for_each_matching_node(node, vpu->variant->shared_devices) {
-+ struct platform_device *pdev;
-+ struct v4l2_m2m_dev *m2m_dev;
-+
-+ pdev = of_find_device_by_node(node);
-+ if (!pdev)
-+ continue;
-+
-+ shared_vpu = platform_get_drvdata(pdev);
-+ if (IS_ERR_OR_NULL(shared_vpu) || shared_vpu == vpu) {
-+ platform_device_put(pdev);
-+ continue;
-+ }
-+
-+ v4l2_m2m_get(shared_vpu->m2m_dev);
-+ m2m_dev = shared_vpu->m2m_dev;
-+ platform_device_put(pdev);
-+
-+ of_node_put(node);
-+
-+ return m2m_dev;
-+ }
-+
-+init_new_m2m_dev:
-+ return v4l2_m2m_init(&vpu_m2m_ops);
-+}
-+
- static int hantro_probe(struct platform_device *pdev)
- {
- const struct of_device_id *match;
-@@ -1181,7 +1217,7 @@ static int hantro_probe(struct platform_device *pdev)
- }
- platform_set_drvdata(pdev, vpu);
-
-- vpu->m2m_dev = v4l2_m2m_init(&vpu_m2m_ops);
-+ vpu->m2m_dev = hantro_get_v4l2_m2m_dev(vpu);
- if (IS_ERR(vpu->m2m_dev)) {
- v4l2_err(&vpu->v4l2_dev, "Failed to init mem2mem device\n");
- ret = PTR_ERR(vpu->m2m_dev);
-@@ -1220,7 +1256,7 @@ static int hantro_probe(struct platform_device *pdev)
- hantro_remove_enc_func(vpu);
- err_m2m_rel:
- media_device_cleanup(&vpu->mdev);
-- v4l2_m2m_release(vpu->m2m_dev);
-+ v4l2_m2m_put(vpu->m2m_dev);
- err_v4l2_unreg:
- v4l2_device_unregister(&vpu->v4l2_dev);
- err_clk_unprepare:
-@@ -1243,7 +1279,7 @@ static void hantro_remove(struct platform_device *pdev)
- hantro_remove_dec_func(vpu);
- hantro_remove_enc_func(vpu);
- media_device_cleanup(&vpu->mdev);
-- v4l2_m2m_release(vpu->m2m_dev);
-+ v4l2_m2m_put(vpu->m2m_dev);
- v4l2_device_unregister(&vpu->v4l2_dev);
- clk_bulk_unprepare(vpu->variant->num_clocks, vpu->clocks);
- reset_control_assert(vpu->resets);
-diff --git a/drivers/media/platform/verisilicon/imx8m_vpu_hw.c b/drivers/media/platform/verisilicon/imx8m_vpu_hw.c
-index 74fd985a8aad1..cdaac2f18fb54 100644
---- a/drivers/media/platform/verisilicon/imx8m_vpu_hw.c
-+++ b/drivers/media/platform/verisilicon/imx8m_vpu_hw.c
-@@ -361,6 +361,12 @@ const struct hantro_variant imx8mq_vpu_variant = {
- .num_regs = ARRAY_SIZE(imx8mq_reg_names)
- };
-
-+static const struct of_device_id imx8mq_vpu_shared_resources[] __initconst = {
-+ { .compatible = "nxp,imx8mq-vpu-g1", },
-+ { .compatible = "nxp,imx8mq-vpu-g2", },
-+ { /* sentinel */ }
-+};
-+
- const struct hantro_variant imx8mq_vpu_g1_variant = {
- .dec_fmts = imx8m_vpu_dec_fmts,
- .num_dec_fmts = ARRAY_SIZE(imx8m_vpu_dec_fmts),
-@@ -374,6 +380,7 @@ const struct hantro_variant imx8mq_vpu_g1_variant = {
- .num_irqs = ARRAY_SIZE(imx8mq_irqs),
- .clk_names = imx8mq_g1_clk_names,
- .num_clocks = ARRAY_SIZE(imx8mq_g1_clk_names),
-+ .shared_devices = imx8mq_vpu_shared_resources,
- };
-
- const struct hantro_variant imx8mq_vpu_g2_variant = {
-@@ -389,6 +396,7 @@ const struct hantro_variant imx8mq_vpu_g2_variant = {
- .num_irqs = ARRAY_SIZE(imx8mq_g2_irqs),
- .clk_names = imx8mq_g2_clk_names,
- .num_clocks = ARRAY_SIZE(imx8mq_g2_clk_names),
-+ .shared_devices = imx8mq_vpu_shared_resources,
- };
-
- const struct hantro_variant imx8mm_vpu_g1_variant = {
---
-2.51.0
-
pci-use-resource-names-in-pci-log-messages.patch
resource-add-resource-set-range-and-size-helpers.patch
pci-use-resource_set_range-that-correctly-sets-end.patch
-media-hantro-disable-multicore-support.patch
-media-v4l2-mem2mem-add-a-kref-to-the-v4l2_m2m_dev-st.patch
-media-verisilicon-avoid-g2-bus-error-while-decoding-.patch
kvm-x86-fix-kvm_get_msrs-stack-info-leak.patch
kvm-x86-rename-kvm_msr_ret_invalid-to-kvm_msr_ret_un.patch
kvm-x86-return-unsupported-instead-of-invalid-on-acc.patch