media: ipu6: Enable snooping on ipu7 isys buffers
Subsystems (2)
PATCH 1/1 media: ipu6: Enable snooping on ipu7 isys buffers
The capture buffers are not cache coherent by default, and CPU may read stale cache lines. Make buffers cache coherent by enabling snooping.
--- drivers/media/pci/intel/ipu6/ipu7-fw-isys.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/pci/intel/ipu6/ipu7-fw-isys.c +1 -0
@@ -214,6 +214,7 @@ static int ipu7_isys_fw_pin_cfg(struct ipu6_isys_video *av, output_pin->link.pbk_slot_id =IPU7_MSG_LINK_PBK_SLOT_ID_DONT_CARE ; output_pin->link.dest =0 ;/* IPU_INSYS_OUTPUT_LINK_DEST_MEM */ output_pin->link.use_sw_managed =1 ; + output_pin->link.is_snoop =1 ; output_pin->crop.line_top =0 ; output_pin->crop.line_bottom =0 ; output_pin->dpcm.enable =0 ;
Signature · 1 line
2.56.0
Sakari Ailus
maintainerHi Antti,
Thanks for the patch.
Quoted 6 lines · Antti Laakso
The capture buffers are not cache coherent by default, and CPU may read stale cache lines. Make buffers cache coherent by enabling snooping.
Reported-by Sergey Lebedev <[email protected]>Signed-off-by Antti Laakso <[email protected]>
Can you provide the Fixes: tag?
I think this should go to v7.4.
Quoted 16 lines
--- drivers/media/pci/intel/ipu6/ipu7-fw-isys.c | 1 + 1 file changed, 1 insertion(+)drivers/media/pci/intel/ipu6/ipu7-fw-isys.c +1
-0@@ -214,6 +214,7 @@ static int ipu7_isys_fw_pin_cfg(struct ipu6_isys_video *av, output_pin->link.pbk_slot_id =IPU7_MSG_LINK_PBK_SLOT_ID_DONT_CARE ; output_pin->link.dest =0 ;/* IPU_INSYS_OUTPUT_LINK_DEST_MEM */ output_pin->link.use_sw_managed =1 ; + output_pin->link.is_snoop =1 ; output_pin->crop.line_top =0 ; output_pin->crop.line_bottom =0 ; output_pin->dpcm.enable =0 ;
Signature · 3 lines
Regards, Sakari Ailus
Hi Antti,
Thanks for picking this up. I tested it on a Surface Pro 11 (Lunar Lake, IPU7 driven by intel-ipu6, v7.4-rc1). The sensor was the VD55G0 in raw R8 at 644x604, and the CPU read every buffer for 20 s per run. A row equal to what the same buffer held one fill earlier is stale. The control compares each frame with the previous capture, in another buffer, and stays at 0 because the sensor is noisy.
intel-ipu6-isys captures with stale rows without the patch 344 of 1158 with it 0 of 1157 without, again 690 of 1156
There were no frame gaps, and the stream config dump showed is_snoop 0 and 1 as expected.
The staging ipu7 driver still sets is_snoop = 0 in ipu7-isys-video.c, and my patch for that one is still open:
https://lore.kernel.org/linux-media/[email protected]/
Sergey