+ Ohad On 07/22/2013 03:47 AM, Rusty Russell wrote: > Michal Simek <mon...@monstr.eu> writes: >> Hi Rusty and Jens, >> >> I am getting problem with your patch which you have added to the kernel. >> The problem is with my arm zynq remoteproc driver where >> I use dma_declare_coherent_memory() to specify memory for remoteproc >> which is ioremap to the vmalloc area. >> >> Based on that buf addr is not inside ram even this coherent memory is in ram. >> That's why virt_addr_valid(buf) is failing. > > But sg_set_buf() calls virt_to_page(buf). So does that work? > > I would think calling sg_set_page() directly would be what you want > here...
Let me take some code from virtio_rpmsg_bus.c to show that problematic part. bufs_va = dma_alloc_coherent(vdev->dev.parent->parent, RPMSG_TOTAL_BUF_SPACE, &vrp->bufs_dma, GFP_KERNEL); vrp->rbufs = bufs_va; for (i = 0; i < RPMSG_NUM_BUFS / 2; i++) { struct scatterlist sg; void *cpu_addr = vrp->rbufs + i * RPMSG_BUF_SIZE; sg_init_one(&sg, cpu_addr, RPMSG_BUF_SIZE); } dma_alloc_coherent returns ioremaped ram address and sg_init_one() is checking if addr is valid. It is no problem to call instead of sg_init_one() sg_init_table(sg, 1); sg_set_page(sg, virt_to_page(cpu_addr), RPMSG_BUF_SIZE, offset_in_page(cpu_addr)); But my question is if SG lists have to be used just for memory which is not remapped. Ohad: Can you see similar problem with your remoteproc drivers when DEBUG_SG is enabled? Thanks, Michal -- Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/ Maintainer of Linux kernel - Xilinx Zynq ARM architecture Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform
signature.asc
Description: OpenPGP digital signature