Re: [PATCH v2 07/12] media: iris: Create pixel and non-pixel context banks on VPU3x

Vikash Garodia <[email protected]> Thu, 6 Aug 2026 15:36:14 +0530
Newsgroups org.kernel.vger.linux-media,org.kernel.vger.linux-arm-msm,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel,org.kernel.vger.stable
Message-ID <[email protected]>
On 8/6/2026 2:37 PM, Dmitry Baryshkov wrote:
> On Fri, Jul 31, 2026 at 11:52:22PM +0530, Vikash Garodia wrote:
>> The VPU issues DMA through several SMMU streams, and the hardware does
>> not give every stream the same addressable range. The non-pixel stream
>> is restricted to use 0-600MB of IOVA space, while the pixel stream can
>> address the full range.
>>
>> Implement the context bank hooks for VPU3x. iris_vpu3x_init_cb_devs()
>> creates the "non-pixel" and "pixel" devices from the matching device tree
>> subnodes, and iris_vpu3x_deinit_cb_devs() unregisters them. If creating
>> the pixel device fails, the non-pixel device is unregistered and its
>> pointer cleared before the error is returned.
>>
>> Wire the hooks into iris_vpu3_ops and iris_vpu33_ops, which cover the
>> platforms whose device trees are converted to context bank subnodes.
>> iris_vpu35_ops is left unchanged, as sm8750 still describes its streams
>> with "iommus" on the parent node, and the fallback in iris_get_cb_dev()
>> keeps it working until its device tree is converted.
>>
>> Backports are intended since the first DTS of 8550 binding schema.
>>
>> Fixes: 41661853ae8e ("arm64: dts: qcom: sm8550: add iris DT node")
> 
> Drop

how do we backport these to the prior kernels ?

> 
>> Cc: [email protected]
>> Co-developed-by: Vishnu Reddy <[email protected]>
>> Signed-off-by: Vishnu Reddy <[email protected]>
>> Tested-by: Daniel J Blueman <[email protected]>
>> Signed-off-by: Vikash Garodia <[email protected]>
>> ---
>>   drivers/media/platform/qcom/iris/iris_vpu3x.c | 38 +++++++++++++++++++++++++++
>>   1 file changed, 38 insertions(+)
>>
>> diff --git a/drivers/media/platform/qcom/iris/iris_vpu3x.c b/drivers/media/platform/qcom/iris/iris_vpu3x.c
>> index 3dad47be78b58f6cd5ed6f333b3376571a04dbf0..623a0f8a7982c0b5c2e3741a34c1367e9aaf4e27 100644
>> --- a/drivers/media/platform/qcom/iris/iris_vpu3x.c
>> +++ b/drivers/media/platform/qcom/iris/iris_vpu3x.c
>> @@ -254,6 +254,40 @@ static void iris_vpu35_power_off_hw(struct iris_core *core)
>>   	iris_disable_unprepare_clock(core, IRIS_AXI_CLK);
>>   }
>>   
>> +static int iris_vpu3x_init_cb_devs(struct iris_core *core)
> 
> What is 3x-specific in these functions? Can they go to vpu_common
> instead, as they seem to be applicable to all generations. And also, if
> they are common, do we really need callbacks? Can we just call these two
> functions directly?
> 

I think we can even do a direct call, thank you for the input.

>> +{
>> +	struct device *dev;
>> +
>> +	dev = iris_create_cb_dev(core, "non-pixel");
>> +	if (IS_ERR(dev))
>> +		return PTR_ERR(dev);
>> +
>> +	core->np_dev = dev;
>> +
>> +	dev = iris_create_cb_dev(core, "pixel");
>> +	if (IS_ERR(dev))
>> +		goto unreg_np_dev;
>> +
>> +	core->p_dev = dev;
>> +
>> +	return 0;
>> +
>> +unreg_np_dev:
>> +	if (core->np_dev)
>> +		platform_device_unregister(to_platform_device(core->np_dev));
>> +	core->np_dev = NULL;
>> +
>> +	return PTR_ERR(dev);
>> +}
>> +
>> +static void iris_vpu3x_deinit_cb_devs(struct iris_core *core)
>> +{
>> +	if (core->p_dev)
>> +		platform_device_unregister(to_platform_device(core->p_dev));
>> +	if (core->np_dev)
>> +		platform_device_unregister(to_platform_device(core->np_dev));
>> +}
>> +
>>   const struct vpu_ops iris_vpu3_ops = {
>>   	.power_off_hw = iris_vpu3_power_off_hardware,
>>   	.power_on_hw = iris_vpu_power_on_hw,
>> @@ -261,6 +295,8 @@ const struct vpu_ops iris_vpu3_ops = {
>>   	.power_on_controller = iris_vpu_power_on_controller,
>>   	.calc_freq = iris_vpu3x_vpu4x_calculate_frequency,
>>   	.set_hwmode = iris_vpu_set_hwmode,
>> +	.init_cb_devs = iris_vpu3x_init_cb_devs,
>> +	.deinit_cb_devs = iris_vpu3x_deinit_cb_devs,
>>   };
>>   
>>   const struct vpu_ops iris_vpu33_ops = {
>> @@ -270,6 +306,8 @@ const struct vpu_ops iris_vpu33_ops = {
>>   	.power_on_controller = iris_vpu_power_on_controller,
>>   	.calc_freq = iris_vpu3x_vpu4x_calculate_frequency,
>>   	.set_hwmode = iris_vpu_set_hwmode,
>> +	.init_cb_devs = iris_vpu3x_init_cb_devs,
>> +	.deinit_cb_devs = iris_vpu3x_deinit_cb_devs,
>>   };
>>   
>>   const struct vpu_ops iris_vpu35_ops = {
>>
>> -- 
>> 2.34.1
>>
>