lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <b45a73845e66355080cfad0f0040b6e7a9d78241.camel@ndufresne.ca>
Date: Thu, 04 Dec 2025 19:05:01 -0500
From: Nicolas Dufresne <nicolas@...fresne.ca>
To: Frank Li <Frank.li@....com>
Cc: ming.qian@....nxp.com, linux-media@...r.kernel.org, mchehab@...nel.org, 
	hverkuil-cisco@...all.nl, benjamin.gaignard@...labora.com, 
	p.zabel@...gutronix.de, sebastian.fricke@...labora.com,
 shawnguo@...nel.org, 	ulf.hansson@...aro.org, s.hauer@...gutronix.de,
 kernel@...gutronix.de, 	festevam@...il.com, linux-imx@....com,
 l.stach@...gutronix.de, peng.fan@....com, 	eagle.zhou@....com,
 imx@...ts.linux.dev, linux-pm@...r.kernel.org, 
	linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH v3 3/3] media: verisilicon: Avoid G2 bus error while
 decoding H.264 and HEVC

Le jeudi 04 décembre 2025 à 17:57 -0500, Frank Li a écrit :
> On Thu, Dec 04, 2025 at 01:15:35PM -0500, Nicolas Dufresne wrote:
> > Hi Frank,
> > 
> > Le jeudi 04 décembre 2025 à 12:34 -0500, Frank Li a écrit :
> > > > +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;
> > > 
> > > I found only use shared_devices here, how to  ensure that g1 and g2 operate
> > > alternately by using shared_devices?
> > 
> > shared_devices is an array of of_device_id we match against. All the matching
> > devices will share the same v4l2_m2m_dev (aka m2m scheduler). Typically, both
> > cores will be schedule as one. This achieve what alternate operations without
> > active polling or blocking locks/mutex.
> 
> Okay, but this code require shared_devices==NULL's device probe firstly.
> generally not order guaranteed, if there are not depentance at DT.

shared_devices is a constant array that is set inside the variant. It is
normally NULL, except for the imx8mq SoC, for which its always set.

> 
> Does VPU always probe before g1/g2?
> 
> and if there are two VPU instances, what's happen?

Since there is two VPU, g1 and g2, we will enter this loop:

> +	for_each_matching_node(node, vpu->variant->shared_devices) {

On imx8mq, this will match twice.

> +		struct platform_device *pdev;
> +		struct v4l2_m2m_dev *m2m_dev;
> +
> +		pdev = of_find_device_by_node(node);
> +		of_node_put(node);
> +
> +		if (!pdev)
> +			continue;

If the match does not have a device yet (not probe yet), we skip.

> +
> +		shared_vpu = platform_get_drvdata(pdev);
> +		if (IS_ERR_OR_NULL(shared_vpu) || shared_vpu == vpu) {
> +			platform_device_put(pdev);
> +			continue;
> +		}

If its the current VPU, we also skip.

> +
> +		v4l2_m2m_get(shared_vpu->m2m_dev);
> +		m2m_dev = shared_vpu->m2m_dev;
> +		platform_device_put(pdev);

Finally, if the other VPU was initialized, we ref the v4l2_m2m_dev. We will then
create m2m_ctx from it which will cause the two VPU to be scheduled one after
the other.

> +
> +		return m2m_dev;
> +	}

> +
> +init_new_m2m_dev:
> +	return v4l2_m2m_init(&vpu_m2m_ops);

Otherwhise we create a fresh one.

Does it make sense now ?

Nicolas

Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ