Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp3428741rdb; Wed, 27 Dec 2023 07:12:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IFKcpvBAGFeBincUhtzGuyXC+5P6qTYiVQvk3AhGORqyHo4MeBkr1l25CqIEoYcZjIGcw76 X-Received: by 2002:a05:6402:c6:b0:553:2f6b:c23f with SMTP id i6-20020a05640200c600b005532f6bc23fmr5031874edu.22.1703689961124; Wed, 27 Dec 2023 07:12:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703689961; cv=none; d=google.com; s=arc-20160816; b=lI84Xo+cAUbdrA/fAJT/gpoEMN9X16WmMHD0vC4Tb8J/MDTj646s3dsFl0NdU0j1YR rdh0AnABio81tx/D9IqSkrE9FWWcKObTB/9Et7QS1okHLtFHssPyPKrKqyZxLIjsTDv9 NihjOAFyYpDaGQtF/bZA2SmHqWeFkV2CjUhabEpyopA+rrz0IBP7TV3MaZ5qy5mFjAco BwoDSA+ymQHgNuneIio+VK5xHXdy+7JoNg/sxnJIUvA7d1HbG7KsWt2cf04snJ19iYxP Smyn7SkfIIJCaoAQZ9GFbVjesdYo000TADlYRo4xROYVQi7F6S2xoKA30R5u1D1bmlJp sESw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=mzEMkNH8MSFBWJ/y6rLY8I+UbaI1d8vmEeGObtfhYC4=; fh=4ESZ1c62iMGhYlhC2pjn9wB4qPFQ2ZNstb13IlN3w/8=; b=ey8tlFWKa5mT1uNy77s9MDcfFyzugw86/arYfLJjA2SLLwrnGfmcrP+8+o2aPCDhDQ Np6Bf25TYNlyo0MGJRoVKkXv0VryT9ZYKgJ+YdKhWfydfgH55D9aw6mDJVf5JWemAdHu muFD+SOLSXa850e288AbGVAClQ3wCdO+nGp2tLea+3bzKgZiKf7PYqypkw7G8jb87f6J QmzfZAF2fRijN7xkXaqTHUIaV9KenUYP7O7MWrCFfJmeKmkfK/QDCj4FUopMf4uPe9wi /eAWPIinpt1toyyvn0+ok8o3JKGze7Accr2/mL2lUne/G1AX1w/jYS1Y0EzbQpS7uCAV wJ/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tkos.co.il header.s=default header.b=hnJQS6E5; spf=pass (google.com: domain of linux-kernel+bounces-12076-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12076-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=tkos.co.il Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id dm3-20020a05640222c300b005555a467311si596207edb.27.2023.12.27.07.12.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Dec 2023 07:12:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-12076-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@tkos.co.il header.s=default header.b=hnJQS6E5; spf=pass (google.com: domain of linux-kernel+bounces-12076-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12076-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=tkos.co.il 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 am.mirrors.kernel.org (Postfix) with ESMTPS id DB8101F22195 for ; Wed, 27 Dec 2023 15:12:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 613E745C04; Wed, 27 Dec 2023 15:12:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tkos.co.il header.i=@tkos.co.il header.b="hnJQS6E5" X-Original-To: linux-kernel@vger.kernel.org Received: from mail.tkos.co.il (hours.tkos.co.il [84.110.109.230]) (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 3EC2A45959; Wed, 27 Dec 2023 15:12:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=tkos.co.il Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tkos.co.il Received: from tarshish.tkos.co.il (unknown [10.0.8.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.tkos.co.il (Postfix) with ESMTPS id D227F440EEA; Wed, 27 Dec 2023 17:02:42 +0200 (IST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tkos.co.il; s=default; t=1703689363; bh=y8Nqn3nQCHk0ZkaLekGkm1wv2WHjXjHEQwYVdlqYNw4=; h=From:To:Cc:Subject:Date:From; b=hnJQS6E5gkFfPmVbn1G49jTHXsTmr28HHzApegH3Nh9uekRNg9Nbx84gIjPyM3meI B8aDIqGf/Cr0ZojHC7jU8qFTXNPe1NRx/vx/d9LhZ3tWMp5ciEu2nvUHwI6e7bhxza xO5ybfJWayCkTVkJEUz7SGOFZ13gv3Hq/0ZSAJl/oEJ9L5n5lcsdhrhAZr4Vb04R6Z Ho0ve/unVDMr1V8ygeQNTlk1OsaVmZse2wMAEBJBfWzOh7D/3p6mJCX8cqvXFRKrF0 hOKP8FT6xS/ukTmxy1iYpucdb2Cus5fLrSV3LUfP9lILR0YnojWWhRtCNqttY+Ez7K Ut+N1A26VCJhQ== From: Baruch Siach To: Christoph Hellwig , Marek Szyprowski , Rob Herring , Frank Rowand , Catalin Marinas , Will Deacon Cc: Baruch Siach , Robin Murphy , iommu@lists.linux.dev, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Petr=20Tesa=C5=99=C3=ADk?= , Ramon Fried Subject: [PATCH RFC 0/4] arm64: support DMA zone starting above 4GB Date: Wed, 27 Dec 2023 17:04:24 +0200 Message-ID: X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit DMA zones code assumes that DMA lower limit is zero. When there is no RAM below 4GB, arm64 platform code sets DMA/DMA32 zone limits to cover the entire RAM[0]. The platform I have has RAM starting at 32GB. Devices with 30-bit DMA mask are mapped to 1GB at the bottom of RAM, between 32GB - 33GB. A DMA zone over the entire RAM breaks DMA allocation for these devices. In response to a previous RFC hack[1] Catalin Marinas suggested to add a separate offset value as base address for the DMA zone. This RFC series attempts to implement that suggestion. With this series applied, the DMA zone covers the right RAM range for my platform. [0] See commit 791ab8b2e3db ("arm64: Ignore any DMA offsets in the max_zone_phys() calculation") [1] https://lore.kernel.org/all/9af8a19c3398e7dc09cfc1fbafed98d795d9f83e.1699464622.git.baruch@tkos.co.il/ Baruch Siach (4): of: get dma area lower limit of: unittest: add test for of_dma_get_cpu_limits() 'min' param dma-direct: add offset to zone_dma_bits arm64: mm: take DMA zone offset into account arch/arm64/mm/init.c | 18 +++++++++++++----- drivers/of/address.c | 38 +++++++++++++++++++++++++++----------- drivers/of/unittest.c | 17 ++++++++++------- include/linux/dma-direct.h | 1 + include/linux/of.h | 11 ++++++++--- kernel/dma/direct.c | 10 ++++++---- kernel/dma/pool.c | 2 +- kernel/dma/swiotlb.c | 5 +++-- 8 files changed, 69 insertions(+), 33 deletions(-) -- 2.43.0