Loading sound/usb/usb_audio_qmi_svc.c +12 −4 Original line number Original line Diff line number Diff line Loading @@ -297,6 +297,7 @@ static unsigned long uaudio_iommu_map(enum mem_type mtype, phys_addr_t pa, size_t sg_len, total_len = 0; size_t sg_len, total_len = 0; struct scatterlist *sg; struct scatterlist *sg; phys_addr_t pa_sg; phys_addr_t pa_sg; int prot = IOMMU_READ | IOMMU_WRITE; switch (mtype) { switch (mtype) { case MEM_EVENT_RING: case MEM_EVENT_RING: Loading Loading @@ -330,7 +331,7 @@ static unsigned long uaudio_iommu_map(enum mem_type mtype, phys_addr_t pa, sg_len = PAGE_ALIGN(sg->offset + sg->length); sg_len = PAGE_ALIGN(sg->offset + sg->length); pa_sg = page_to_phys(sg_page(sg)); pa_sg = page_to_phys(sg_page(sg)); ret = iommu_map(uaudio_qdev->domain, va_sg, pa_sg, sg_len, ret = iommu_map(uaudio_qdev->domain, va_sg, pa_sg, sg_len, IOMMU_READ | IOMMU_WRITE | IOMMU_MMIO); prot); if (ret) { if (ret) { uaudio_err("mapping failed ret%d\n", ret); uaudio_err("mapping failed ret%d\n", ret); uaudio_err("memtype:%d, pa:%pK iova:%lu sg_len:%zu\n", uaudio_err("memtype:%d, pa:%pK iova:%lu sg_len:%zu\n", Loading @@ -341,6 +342,9 @@ static unsigned long uaudio_iommu_map(enum mem_type mtype, phys_addr_t pa, } } uaudio_dbg("memtype %d:map pa:%pK to iova:%lu len:%zu\n", mtype, uaudio_dbg("memtype %d:map pa:%pK to iova:%lu len:%zu\n", mtype, &pa_sg, va_sg, sg_len); &pa_sg, va_sg, sg_len); /* Invalidate cpu cache for device to access shared memory */ dma_sync_single_for_device(uaudio_qdev->dev, va_sg, sg_len, DMA_TO_DEVICE); va_sg += sg_len; va_sg += sg_len; total_len += sg_len; total_len += sg_len; } } Loading @@ -357,11 +361,15 @@ static unsigned long uaudio_iommu_map(enum mem_type mtype, phys_addr_t pa, uaudio_dbg("memtype:%d map pa:%pK to iova %lu size:%zu\n", mtype, &pa, uaudio_dbg("memtype:%d map pa:%pK to iova %lu size:%zu\n", mtype, &pa, va, size); va, size); ret = iommu_map(uaudio_qdev->domain, va, pa, size, ret = iommu_map(uaudio_qdev->domain, va, pa, size, prot); IOMMU_READ | IOMMU_WRITE | IOMMU_MMIO); if (ret) { if (ret) uaudio_err("failed to map pa:%pK iova:%lu memtype:%d ret:%d\n", uaudio_err("failed to map pa:%pK iova:%lu memtype:%d ret:%d\n", &pa, va, mtype, ret); &pa, va, mtype, ret); goto done; } /* Invalidate cpu cache for device to access shared memory */ dma_sync_single_for_device(uaudio_qdev->dev, va, size, DMA_TO_DEVICE); done: done: return va; return va; } } Loading Loading
sound/usb/usb_audio_qmi_svc.c +12 −4 Original line number Original line Diff line number Diff line Loading @@ -297,6 +297,7 @@ static unsigned long uaudio_iommu_map(enum mem_type mtype, phys_addr_t pa, size_t sg_len, total_len = 0; size_t sg_len, total_len = 0; struct scatterlist *sg; struct scatterlist *sg; phys_addr_t pa_sg; phys_addr_t pa_sg; int prot = IOMMU_READ | IOMMU_WRITE; switch (mtype) { switch (mtype) { case MEM_EVENT_RING: case MEM_EVENT_RING: Loading Loading @@ -330,7 +331,7 @@ static unsigned long uaudio_iommu_map(enum mem_type mtype, phys_addr_t pa, sg_len = PAGE_ALIGN(sg->offset + sg->length); sg_len = PAGE_ALIGN(sg->offset + sg->length); pa_sg = page_to_phys(sg_page(sg)); pa_sg = page_to_phys(sg_page(sg)); ret = iommu_map(uaudio_qdev->domain, va_sg, pa_sg, sg_len, ret = iommu_map(uaudio_qdev->domain, va_sg, pa_sg, sg_len, IOMMU_READ | IOMMU_WRITE | IOMMU_MMIO); prot); if (ret) { if (ret) { uaudio_err("mapping failed ret%d\n", ret); uaudio_err("mapping failed ret%d\n", ret); uaudio_err("memtype:%d, pa:%pK iova:%lu sg_len:%zu\n", uaudio_err("memtype:%d, pa:%pK iova:%lu sg_len:%zu\n", Loading @@ -341,6 +342,9 @@ static unsigned long uaudio_iommu_map(enum mem_type mtype, phys_addr_t pa, } } uaudio_dbg("memtype %d:map pa:%pK to iova:%lu len:%zu\n", mtype, uaudio_dbg("memtype %d:map pa:%pK to iova:%lu len:%zu\n", mtype, &pa_sg, va_sg, sg_len); &pa_sg, va_sg, sg_len); /* Invalidate cpu cache for device to access shared memory */ dma_sync_single_for_device(uaudio_qdev->dev, va_sg, sg_len, DMA_TO_DEVICE); va_sg += sg_len; va_sg += sg_len; total_len += sg_len; total_len += sg_len; } } Loading @@ -357,11 +361,15 @@ static unsigned long uaudio_iommu_map(enum mem_type mtype, phys_addr_t pa, uaudio_dbg("memtype:%d map pa:%pK to iova %lu size:%zu\n", mtype, &pa, uaudio_dbg("memtype:%d map pa:%pK to iova %lu size:%zu\n", mtype, &pa, va, size); va, size); ret = iommu_map(uaudio_qdev->domain, va, pa, size, ret = iommu_map(uaudio_qdev->domain, va, pa, size, prot); IOMMU_READ | IOMMU_WRITE | IOMMU_MMIO); if (ret) { if (ret) uaudio_err("failed to map pa:%pK iova:%lu memtype:%d ret:%d\n", uaudio_err("failed to map pa:%pK iova:%lu memtype:%d ret:%d\n", &pa, va, mtype, ret); &pa, va, mtype, ret); goto done; } /* Invalidate cpu cache for device to access shared memory */ dma_sync_single_for_device(uaudio_qdev->dev, va, size, DMA_TO_DEVICE); done: done: return va; return va; } } Loading