From patchwork Wed Jul 24 06:02:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 814154 Delivered-To: patch@linaro.org Received: by 2002:adf:f288:0:b0:367:895a:4699 with SMTP id k8csp2619621wro; Tue, 23 Jul 2024 23:11:06 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU9v04hyyQXocyyNZ1xcLYaqTvx7nnZLXsWdPMBFQzm+pP4i+oH4P7cdczWiUxzaSiA4M0Bq3hGUP1roHGE8LEi X-Google-Smtp-Source: AGHT+IEvFf4OE6AP7unc9tQF2/suPQHzzuiw8p0AZrMMzdfGxpNai2ANriv/QGbxoE75p4YxPeZe X-Received: by 2002:a05:6000:d41:b0:368:87ca:3d85 with SMTP id ffacd0b85a97d-369f5a8fc4cmr604271f8f.29.1721801466121; Tue, 23 Jul 2024 23:11:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721801466; cv=none; d=google.com; s=arc-20160816; b=D3g3nSj79D2NNKkKgXA+bVzYYaIyPAZHBu8o+8UAjSoZnhuOjcogx1lJUjOgRv/kJQ 2UlS3CF/V+g5G/MG0BNX7s+xGApl1ix+ckDhwfKmN2pCnbSiikm2Gz9X9x8MMDWhwgAQ QuP2LYkgx/egNzXzL2ru+XS7RMMP+/5iIcmVYHaqmFqa7aMFtKMKjtgl292WpBS+U1cN Y4TBEfqZWEolT6ba6oLesIvxRwrryVG+sGoeePJ1UCE7tCo/mPUPQ8jNWaV0TEzL4WYX BF8Q47LsjGdyn3924iVxgfYqGJRxOggriatJk3Wy4KpbWAgeVV3kUXm3AudnBJK0+t42 T0gA== 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=57Iy90UBsSNoAeCN1/mPI3L7ocpxr1CcXSp8YbhnbdI=; fh=eimiGswTlodK8yi2DcDfSicmKwvq5bxKQKpD+SkkTNY=; b=wHHcbeA9Iu7SMyIhsUicfDiETKh2iTC6ydfCqsNEgv549HhGtL/8KXAbgJX+Mn/yr4 WxaKIfaG1n2WHFNF9ic4VDmOF36+R3/EiSwBdmWHmyUS0Buvuu2TQJSjrgUOTZC1w4j1 KszvG7PT7hzYTu7qmw7q6B3I2wrtuXNhnexbgUjR7G2Q0WAQR0NkifV4qFNjzPdRAn+d RyxgDklfjARCyQaJFSVKvD0+MlmWZF8lLZAL8dIk7DNXDrU9+kAezVvbu5yOguqlsqq8 WIwU4s8GPKZa5GrkveDYFbfqTzQ5f1h9ztApf9iThVWor1Lat/+csyWoQdLa4BSftwlA yF1w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id ffacd0b85a97d-369e366f75asi1392129f8f.264.2024.07.23.23.11.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jul 2024 23:11:06 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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 B94838892F; Wed, 24 Jul 2024 08:05:39 +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 D09118891B; Wed, 24 Jul 2024 08:05:32 +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,SPF_HELO_NONE,SPF_SOFTFAIL 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 4A36588966 for ; Wed, 24 Jul 2024 08:05:19 +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 208341476; Tue, 23 Jul 2024 23:05:44 -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 0DFF53F766; Tue, 23 Jul 2024 23:05:13 -0700 (PDT) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Heinrich Schuchardt , Simon Glass , Marek Vasut , Mark Kettenis , Michal Simek , Patrick DELAUNAY , Patrice CHOTARD , Huan Wang , Angelo Dureghello , Daniel Schwierzeck , Thomas Chou , Rick Chen , Max Filippov , Sughosh Ganu Subject: [PATCH 30/40] sandbox: iommu: remove lmb allocation in the driver Date: Wed, 24 Jul 2024 11:32:14 +0530 Message-Id: <20240724060224.3071065-31-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240724060224.3071065-1-sughosh.ganu@linaro.org> References: <20240724060224.3071065-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 --- 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 #include -#include #include #include +#define DVA_ADDR 0x89abc000 #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; }