mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 03:15:31 +09:00
media: rockchip: isp: replace iommu detach/attach
fix NULL Pointer when isp to reset [ 4486.719609] __iommu_dma_unmap+0x14/0x7c [ 4486.719968] iommu_dma_unmap_sg+0x64/0x90 [ 4486.720348] __iommu_unmap_sg_attrs+0x48/0x5c [ 4486.720745] vb2_dma_sg_dmabuf_ops_detach+0x60/0x80 [ 4486.721192] dma_buf_detach+0x88/0x9c iommu_detach_device will set domain to null, and __iommu_dma_unmap using domain but no check. Change-Id: I3c679565c6a7e67783e1750fc4d028191a9c9fcf Signed-off-by: Cai YiWei <cyw@rock-chips.com>
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
#include <linux/reset.h>
|
||||
#include <media/videobuf2-dma-contig.h>
|
||||
#include <media/videobuf2-dma-sg.h>
|
||||
#include <soc/rockchip/rockchip_iommu.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "dev.h"
|
||||
@@ -523,10 +524,6 @@ static inline bool is_iommu_enable(struct device *dev)
|
||||
void rkisp_soft_reset(struct rkisp_hw_dev *dev, bool is_secure)
|
||||
{
|
||||
void __iomem *base = dev->base_addr;
|
||||
struct iommu_domain *domain = iommu_get_domain_for_dev(dev->dev);
|
||||
|
||||
if (domain)
|
||||
iommu_detach_device(domain, dev->dev);
|
||||
|
||||
if (is_secure) {
|
||||
/* if isp working, cru reset isn't secure.
|
||||
@@ -549,8 +546,11 @@ void rkisp_soft_reset(struct rkisp_hw_dev *dev, bool is_secure)
|
||||
writel(0xffff, base + CIF_IRCL);
|
||||
udelay(10);
|
||||
|
||||
if (domain)
|
||||
iommu_attach_device(domain, dev->dev);
|
||||
/* refresh iommu after reset */
|
||||
if (dev->is_mmu) {
|
||||
rockchip_iommu_disable(dev->dev);
|
||||
rockchip_iommu_enable(dev->dev);
|
||||
}
|
||||
}
|
||||
|
||||
static void isp_config_clk(struct rkisp_hw_dev *dev, int on)
|
||||
|
||||
Reference in New Issue
Block a user