From patchwork Thu Jul 4 07:35:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 809933 Delivered-To: patch@linaro.org Received: by 2002:adf:a199:0:b0:367:895a:4699 with SMTP id u25csp1043315wru; Thu, 4 Jul 2024 00:41:04 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWBPkbApTfiQbt5/XaPhCSmUoqd3BQ2zWb0X3lXXm7xTJPUSRNuXVOUzJ6LHNNmShQQ1mMGcPoPkO7BHBzg26Yt X-Google-Smtp-Source: AGHT+IE43TyGVdFy3s3upeeFnGA8kagJLpY/IYVtdIwkYyIPXX2DeNP5cRo12Z7K2rUQ6XgP2S76 X-Received: by 2002:a05:6402:5192:b0:57d:3df:f882 with SMTP id 4fb4d7f45d1cf-58e5a6f265fmr567012a12.7.1720078864573; Thu, 04 Jul 2024 00:41:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720078864; cv=none; d=google.com; s=arc-20160816; b=JaRTVAGZEdi8JquLRG6ujXtfkkirbeG6Q3K1UWBcyyOjyBiwoKhsJoRCe8cXDmlFja dj59Mv8tGO9T4MSLj+NcKSGPmXw7yPFXS/9QVE0otyKDiBx99EySDn/wlgic6aIUV75E nfLfCp+YP+DZ8Q42D4wsj8KIzxiWx1HEER/VW9ixLYbyyKuLuFVbPLjZ50bNyCxxDxot sdcq2DA4lhzDvnVaHzcUOLtm3gKzDttMxKsRxZyAqk3KFlK+fJ51PgdBvGwkCL8mkDtG rx1vzSqmcTDbQSXSmFER8RCo87k7Z5MmitAbiMlVxD7Z//CoCpE3H2r451Dcu2wprBSY 1Eig== 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=IaWOUr6wHFvBLkw5IP+WAqZOG2aR96wq8tpStFEoj0M=; fh=ez1zzjhC0XWyqTp7tWutqrA/nFdALDnQKrnQnXYhk5Q=; b=lUCz9pDoNymA4ggzcQIfuY6zlMYtN3ChKUy7kXKhHj56jgjRYx88+FGPFkc6ECq9SJ t6DwMaPW1fWrEzcaxUDSN262AJBtwH3F5jocdHN5tCpvXjT7HD8FlEZe18IRJi87gFpp f7eS0MzlygLwJSVX8tE7Bds4/iYkyfi6gjRmN7okkj+1nWmMh2Z6g3cXFQhRUGbjob/f r5GozzDbQcfP5ibaFxtxbEhAjsjrxgysl1qn+kdpDlwjMF4PPdPtjWUGQ3NKHF1fsYue u3K8F/9amjBd/TqK1vtbaGX/axrAxlywBdVSynRhxt/aAnSlTj79KLNKm+aksS1PtTo0 7sgA==; 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-58d408dfbdesi1268789a12.227.2024.07.04.00.41.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jul 2024 00:41:04 -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 32B9488927; Thu, 4 Jul 2024 09:37:45 +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 4991D8889D; Thu, 4 Jul 2024 09:37:43 +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 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 624C288933 for ; Thu, 4 Jul 2024 09:37:40 +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 E2546DA7; Thu, 4 Jul 2024 00:38:04 -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 B76993F762; Thu, 4 Jul 2024 00:37:36 -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 , Michal Simek , Sughosh Ganu Subject: [RFC PATCH v2 26/48] sandbox: iommu: remove lmb allocation in the driver Date: Thu, 4 Jul 2024 13:05:22 +0530 Message-Id: <20240704073544.670249-27-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240704073544.670249-1-sughosh.ganu@linaro.org> References: <20240704073544.670249-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 V1: None 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 5b4a6a8982..81f10e8433 100644 --- a/drivers/iommu/sandbox_iommu.c +++ b/drivers/iommu/sandbox_iommu.c @@ -9,6 +9,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, @@ -21,7 +22,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; } @@ -35,8 +36,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 = { @@ -46,8 +45,6 @@ static struct iommu_ops sandbox_iommu_ops = { static int sandbox_iommu_probe(struct udevice *dev) { - lmb_add(0x89abc000, SZ_16K); - return 0; }