summaryrefslogtreecommitdiff
path: root/drivers/media/pci/intel
AgeCommit message (Collapse)Author
2018-01-23media: intel-ipu3: cio2: fixup off-by-one bug in cio2_vb2_buf_initYong Zhi
With "pages" initialized to vb length + 1 pages, the condition check if(!pages--) will break at one more page than intended, this can result in out-of-bound access to b->lop[i][j] when setting the last dummy page. Fixes: c7cbef1fdb54 ("media: intel-ipu3: cio2: fix a crash with out-of-bounds access") Signed-off-by: Yong Zhi <yong.zhi@intel.com> Signed-off-by: Cao Bing Bu <bingbu.cao@intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2018-01-23media: intel-ipu3: cio2: mark more PM functions as __maybe_unusedArnd Bergmann
My earlier patch missed two functions, these must be __maybe_unused as well: drivers/media/pci/intel/ipu3/ipu3-cio2.c:1867:12: error: 'cio2_runtime_resume' defined but not used [-Werror=unused-function] drivers/media/pci/intel/ipu3/ipu3-cio2.c:1849:12: error: 'cio2_runtime_suspend' defined but not used [-Werror=unused-function] Fixes: 2086dd35705f ("media: intel-ipu3: cio2: mark PM functions as __maybe_unused") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2018-01-05media: intel-ipu3: cio2: fix for wrong vb2buf state warningsYong Zhi
cio2 driver should release buffer with QUEUED state when start_stream op failed, wrong buffer state will cause vb2 core throw a warning. Signed-off-by: Yong Zhi <yong.zhi@intel.com> Signed-off-by: Cao Bing Bu <bingbu.cao@intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2018-01-05media: intel-ipu3: cio2: fix a crash with out-of-bounds accessYong Zhi
When dmabuf is used for BLOB type frame, the frame buffers allocated by gralloc will hold more pages than the valid frame data due to height alignment. In this case, the page numbers in sg list could exceed the FBPT upper limit value - max_lops(8)*1024 to cause crash. Limit the LOP access to the valid data length to avoid FBPT sub-entries overflow. Signed-off-by: Yong Zhi <yong.zhi@intel.com> Signed-off-by: Cao Bing Bu <bingbu.cao@intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2018-01-05media: intel-ipu3: cio2: fix building with large PAGE_SIZEArnd Bergmann
The driver apparently assumes that the device uses the same page size as the CPU, but also assumes that this is 4096 bytes. On architectures with a larger page size like 65536 bytes, we get a warning about an integer overflow: drivers/media/pci/intel/ipu3/ipu3-cio2.c: In function 'cio2_fbpt_entry_init_dummy': arch/arm64/include/asm/page-def.h:28:20: error: large integer implicitly truncated to unsigned type [-Werror=overflow] #define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) ^ drivers/media/pci/intel/ipu3/ipu3-cio2.h:404:26: note: in expansion of macro 'PAGE_SIZE' #define CIO2_PAGE_SIZE PAGE_SIZE ^~~~~~~~~ drivers/media/pci/intel/ipu3/ipu3-cio2.c:172:3: note: in expansion of macro 'CIO2_PAGE_SIZE' CIO2_PAGE_SIZE / sizeof(u32) * CIO2_MAX_LOPS; Obviously this won't work, but the driver is also unlikely to ever be used on such an architecture, so the easiest workaround is to define the CIO2_PAGE_SIZE macro to the size that the hardware actually uses. Fixes: c2a6a07afe4a ("media: intel-ipu3: cio2: add new MIPI-CSI2 driver") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2018-01-05media: intel-ipu3: cio2: mark PM functions as __maybe_unusedArnd Bergmann
When CONFIG_PM is disabled, we get harmless warnings about the suspend/resume callbacks being unused: drivers/media/pci/intel/ipu3/ipu3-cio2.c:1993:12: error: 'cio2_resume' defined but not used [-Werror=unused-function] drivers/media/pci/intel/ipu3/ipu3-cio2.c:1967:12: error: 'cio2_suspend' defined but not used [-Werror=unused-function] This marks them as __maybe_unused to shut up the warnings. Fixes: c2a6a07afe4a ("media: intel-ipu3: cio2: add new MIPI-CSI2 driver") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2018-01-05media: intel-ipu3: Rename arr_size macro, use minSakari Ailus
The arr_size() macro which is used to calculate the size of the chunk in the array to be arranged resembles ARRAY_SIZE naming-wise. Avoid confusion by renaming it to CHUNK_SIZE instead. Also use min() macro to calculate the minimum of two numbers. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-29media: intel-ipu3: cio2: add new MIPI-CSI2 driverYong Zhi
This patch adds CIO2 CSI-2 device driver for Intel's IPU3 camera sub-system support. Signed-off-by: Yong Zhi <yong.zhi@intel.com> Signed-off-by: Hyungwoo Yang <hyungwoo.yang@intel.com> Signed-off-by: Rajmohan Mani <rajmohan.mani@intel.com> Signed-off-by: Vijaykumar Ramya <ramya.vijaykumar@intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>