Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp245992rdd; Tue, 9 Jan 2024 02:55:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IGkIGCmvDLShe9WXTwI72gdkCk9eCTGXX6EzUOr8D16bUFXsgHsKEESeeJmjtncOLTVhvPZ X-Received: by 2002:ac8:7dc5:0:b0:429:a8d0:61ed with SMTP id c5-20020ac87dc5000000b00429a8d061edmr577657qte.15.1704797721479; Tue, 09 Jan 2024 02:55:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704797721; cv=none; d=google.com; s=arc-20160816; b=DeYZE6KY9+DCTsVICLPKRTsdTNViN/k/M2muWYjcz7dw7O9Ak1Vel4vnqgel4FJ/YJ cZzpEJFOYgcMGcuuXvJhk25aTwY48CtAcuNg15Z+ErpXjObKwBUTA7V7Kf3vpIFcGg1D B0op+dcSXDZZZNifCyrDB6Pz4pL0C5S3wJbRWZ5jcv5ogGsbijT/WT3KrzB78mDt3ZQs IQkF+1NTkjffQ8Q21sj5pB5/q9eeKSYEzdi2CrCqU3xu4HBAEfyhOejVqk0jaqiRp4YD AKfH/ItEaLjKbEMxlBU5iJwqqksiqTv40OwMxH/H76Wuw+1R+LbWH3anyCNHt+Zm3HKR hpxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=sNycQVMXnuYE4cadflUDaIASpMN9q2KOVvbUOgui4iE=; fh=FUIwp2QkiO96NqQkYoAFQE35HuvULwccMj+uwqEh8AA=; b=QJycNbOfxyxyFdSKFq5SlSALanX2vwP50zVsxfi+Sz8rIzO/yXejVqqhSKol9e2fVD /CrrHxaqTjW3EgVzrXWXPf8+l4GZeYdwKKx1+TaW7TdgCx2otxKGp/+YXEaI3bfalDHn ktOPrNcnRR32TG/oOPwL+MYv/lEkLpdYzRiC8Jmu23EcrTSUl2BULi8+negQ6zcUBAbE wwBzDcSv0k53rCe24AnOsrv0YR1Lda1DJ8AyuJd0guiD0jF98IAIuZiiPkCLU/IzZxvn VFxMl7GNBGm+pMjXthXyir1tloUG9gDgAWtpHKxFy4myh7+uase8mGKuffi4/dmkNBUS F7mA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-20734-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20734-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id bv26-20020a05622a0a1a00b004299fd588fesi2034800qtb.655.2024.01.09.02.55.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 02:55:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-20734-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-20734-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20734-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 406D01C23EF3 for ; Tue, 9 Jan 2024 10:55:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3D52736B16; Tue, 9 Jan 2024 10:55:06 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BD6D036B02; Tue, 9 Jan 2024 10:55:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A2E5C43394; Tue, 9 Jan 2024 10:55:02 +0000 (UTC) Date: Tue, 9 Jan 2024 10:54:59 +0000 From: Catalin Marinas To: Baruch Siach Cc: Christoph Hellwig , Marek Szyprowski , Rob Herring , Frank Rowand , Will Deacon , Robin Murphy , iommu@lists.linux.dev, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Petr =?utf-8?B?VGVzYcWZw61r?= , Ramon Fried , Elad Nachman Subject: Re: [PATCH RFC 3/4] dma-direct: add offset to zone_dma_bits Message-ID: References: <87msterf7b.fsf@tarshish> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87msterf7b.fsf@tarshish> On Tue, Jan 09, 2024 at 12:03:43PM +0200, Baruch Siach wrote: > On Mon, Jan 08 2024, Catalin Marinas wrote: > > On Wed, Dec 27, 2023 at 05:04:27PM +0200, Baruch Siach wrote: > >> Current code using zone_dma_bits assume that all addresses range in the > >> bits mask are suitable for DMA. For some existing platforms this > >> assumption is not correct. DMA range might have non zero lower limit. > >> > >> Add 'zone_dma_off' for platform code to set base address for DMA zone. > >> > >> Rename the dma_direct_supported() local 'min_mask' variable to better > >> describe its use as limit. > >> > >> Suggested-by: Catalin Marinas > > > > When I suggested taking the DMA offsets into account, that's not exactly > > what I meant. Based on patch 4, it looks like zone_dma_off is equivalent > > to the lower CPU address. Let's say a system has DRAM starting at 2GB > > and all 32-bit DMA-capable devices has a DMA offset of 0. We want > > ZONE_DMA32 to end at 4GB rather than 6GB. > > Patch 4 sets zone_dma_off to the lower limit from 'dma-ranges' property > that determines zone_dma_bits. This is not necessarily equivalent to > start of DRAM, though it happens to be that way on my platform. A bit better but it still assumes that all devices have the same DMA offset which may not be the case. -- Catalin