Hi Sughosh, On Wed, 24 Jul 2024 at 00:05, Sughosh Ganu <sughosh.g...@linaro.org> wrote: > > The sandbox iommu driver uses the LMB module to allocate a particular > range of memory for the device virtual address(DVA). This used to work > earlier since the LMB memory map was caller specific and not > global. But with the change to make the LMB allocations global and > persistent, adding this memory range has other side effects. On the > other hand, the sandbox iommu test expects to see this particular > value of the DVA. Use the DVA address directly, instead of mapping it > in the LMB memory map, and then have it allocated. > > Signed-off-by: Sughosh Ganu <sughosh.g...@linaro.org> > --- > Changes since rfc: None > > drivers/iommu/sandbox_iommu.c | 9 ++------- > 1 file changed, 2 insertions(+), 7 deletions(-) > > diff --git a/drivers/iommu/sandbox_iommu.c b/drivers/iommu/sandbox_iommu.c > index 505f2c3250..15ecaacbb3 100644 > --- a/drivers/iommu/sandbox_iommu.c > +++ b/drivers/iommu/sandbox_iommu.c > @@ -5,10 +5,10 @@ > > #include <dm.h> > #include <iommu.h> > -#include <lmb.h> > #include <asm/io.h> > #include <linux/sizes.h> > > +#define DVA_ADDR 0x89abc000
This is a very strange address. You can put this in arch/sandbox/include/asm/test.h and check it in the test. I suggest using something like 0x12345678 so it is obviously meaningless. > #define IOMMU_PAGE_SIZE SZ_4K > > static dma_addr_t sandbox_iommu_map(struct udevice *dev, void *addr, > @@ -20,8 +20,7 @@ static dma_addr_t sandbox_iommu_map(struct udevice *dev, > void *addr, > paddr = ALIGN_DOWN(virt_to_phys(addr), IOMMU_PAGE_SIZE); > off = virt_to_phys(addr) - paddr; > psize = ALIGN(size + off, IOMMU_PAGE_SIZE); > - > - dva = lmb_alloc(psize, IOMMU_PAGE_SIZE, LMB_NONE); > + dva = (phys_addr_t)DVA_ADDR; > > return dva + off; > } > @@ -35,8 +34,6 @@ static void sandbox_iommu_unmap(struct udevice *dev, > dma_addr_t addr, > dva = ALIGN_DOWN(addr, IOMMU_PAGE_SIZE); > psize = size + (addr - dva); > psize = ALIGN(psize, IOMMU_PAGE_SIZE); > - > - lmb_free(dva, psize, LMB_NONE); > } > > static struct iommu_ops sandbox_iommu_ops = { > @@ -46,8 +43,6 @@ static struct iommu_ops sandbox_iommu_ops = { > > static int sandbox_iommu_probe(struct udevice *dev) > { > - lmb_add(0x89abc000, SZ_16K, LMB_NONE); > - > return 0; > } If this function is empty, you should remove it. > > -- > 2.34.1 > Regards, Simon