From patchwork Fri Jun 7 18:52:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 802329 Delivered-To: patch@linaro.org Received: by 2002:adf:f147:0:b0:35b:5a80:51b4 with SMTP id y7csp949477wro; Fri, 7 Jun 2024 11:56:42 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVlR1NG7VvwePBGD/jnX8gsBUZNrMHWUKceErdqBLybd5i0CpZVjWoZtK+oHD6xwU1ImyIfhESCVHmG2BxQwaci X-Google-Smtp-Source: AGHT+IEIJNOTup0Xq4AMBK1AFcxF8UXKEOYN3tSxqCRDY6iOxnSurHBCH499+iCn0IsyPAPWI+Io X-Received: by 2002:a50:8d54:0:b0:57c:5eed:4ebf with SMTP id 4fb4d7f45d1cf-57c5eed4ed9mr1681240a12.19.1717786602249; Fri, 07 Jun 2024 11:56:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717786602; cv=none; d=google.com; s=arc-20160816; b=VFXPFd7HHVljodadHKOZsMpGFEMQf4rVUeDYksUy9X8yh8uNrq6VXzr6Jspnxr+abH 9Qds3tMhrZBF/RG+218tMbMpYg+e0d1S5r4EhNaVAqQ3IJ5CMS2XzAl+C8RA0zVLUmhr Bf2ewKI503RAfJwtamVhzIMZKXSlE2YY5kGThfUxCeKczEy7snXHZm97l88hAJBTwbOR yNXF9+aOkWAlE7pokcCbE9ieLzIxo7MwFWkaL/LlvAK2zRTA9grcVyOOYk4rc42mGjO7 1BXVT7IEl8Yn2joUXBMzotELIZW7cFlmDOfPSxRzWLYbJwVNfKtVcANTrsaC5msYo7Nc A6dQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=KkkXhD9zEy1ml4aglD9byGtVe3h1lBfjnpyaJfngDIs=; fh=xLSOOz5Q0Mrmzd+lwBRTYS7D/8TpUWM8TEHgIjpMzow=; b=ElZAccRJHPYb3ZJwZbKoiCeyYXQfS/cJ2RE91fnhJ16OJ9tzyE+10krsK9WgMRT6kP sDx46v0hZjQeN0Kvy53fYwaz4yxs5jdInfqrH+NnmtJlyx1+ixyq2EQ5IpfoksstDziR N/bj+hfKf72JIS0OEC3KvTDPcNL1haSUyVahhDGP5UYJRAxGXNHmaSURxVx/EGZlgm4j MeQnCOkGoTivQPua1rNtsExUGsvDbpAmtFcLFC6wzEMmfagFqpNfC+6RqTH/H6VA8u+U oStTbj3DF4U6mVDOCcmD2VWkkVcUgUSG3HZ9QHnBu6zpBfjlgzecqLH2cxaWMrrdvDhD mcnw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57aae25f7bfsi2040208a12.500.2024.06.07.11.56.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 11:56:42 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B96BC8852A; Fri, 7 Jun 2024 20:54:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 4955588528; Fri, 7 Jun 2024 20:54:33 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, SPF_HELO_NONE,SPF_SOFTFAIL,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id 565B888506 for ; Fri, 7 Jun 2024 20:54:31 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sughosh.ganu@linaro.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4346F15A1; Fri, 7 Jun 2024 11:54:55 -0700 (PDT) Received: from a079122.blr.arm.com (a079122.arm.com [10.162.17.48]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1A0193F792; Fri, 7 Jun 2024 11:54:27 -0700 (PDT) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Tom Rini , Ilias Apalodimas , Heinrich Schuchardt , Simon Glass , Marek Vasut , Mark Kettenis , Fabio Estevam , Sughosh Ganu Subject: [RFC PATCH 18/31] sandbox: iommu: remove lmb allocation in the driver Date: Sat, 8 Jun 2024 00:22:27 +0530 Message-Id: <20240607185240.1892031-19-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240607185240.1892031-1-sughosh.ganu@linaro.org> References: <20240607185240.1892031-1-sughosh.ganu@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean 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 --- drivers/iommu/sandbox_iommu.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/iommu/sandbox_iommu.c b/drivers/iommu/sandbox_iommu.c index c5bb88d299..67293e20f4 100644 --- a/drivers/iommu/sandbox_iommu.c +++ b/drivers/iommu/sandbox_iommu.c @@ -10,6 +10,7 @@ #include #include +#define DVA_ADDR 0x89abc000 #define IOMMU_PAGE_SIZE SZ_4K static dma_addr_t sandbox_iommu_map(struct udevice *dev, void *addr, @@ -22,7 +23,7 @@ static dma_addr_t sandbox_iommu_map(struct udevice *dev, void *addr, off = virt_to_phys(addr) - paddr; psize = ALIGN(size + off, IOMMU_PAGE_SIZE); - dva = lmb_alloc(psize, IOMMU_PAGE_SIZE); + dva = (phys_addr_t)DVA_ADDR; return dva + off; } @@ -36,8 +37,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); } static struct iommu_ops sandbox_iommu_ops = { @@ -47,8 +46,6 @@ static struct iommu_ops sandbox_iommu_ops = { static int sandbox_iommu_probe(struct udevice *dev) { - lmb_add(0x89abc000, SZ_16K); - return 0; }