From patchwork Wed Dec 27 15:04:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baruch Siach X-Patchwork-Id: 18552 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp1489649dyb; Wed, 27 Dec 2023 07:13:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IGQFFRZFqucCMicpa62fdI0NQnlBnQlACC91t1v0ivLlkgX9jW6S9vVEj0fOjKQfHYK5lP9 X-Received: by 2002:a17:90b:f0c:b0:28b:9246:8076 with SMTP id br12-20020a17090b0f0c00b0028b92468076mr4240200pjb.75.1703690000831; Wed, 27 Dec 2023 07:13:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703690000; cv=none; d=google.com; s=arc-20160816; b=zYPbK+0CBPLRWbwBNmUdkTJOJjUiiGJ2H6h9r8EQubQQS2pK8DgukhAbrQxYYlJJM9 hJSRRUrbWP2pom0zcH4C2Oxkv08KZGRXtpV3KTidYdnnLq8VJSSTuPWev1o/LATwWX1k 5wZstyrXitKfi3hU9G+KfpHFVVAa99Y7dHgxBtJy+zmR7LvAbvJmnuof/6n+5MIqyASI FxAAod7RXGX+Ogi2tssl/l3A3w9YjsMgCeO6I77BGU9aQw/ecKV8qxumAXFI/ljlxiWT piCuRcmvgA9sLoJiHgreVvPwZ6Q7KPag/3ahXKF4HsA0moAH4jgNYFMBR95QepEHTlHE MiIw== 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-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12076-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=tkos.co.il Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id om8-20020a17090b3a8800b0028beb0665absi11357494pjb.133.2023.12.27.07.13.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Dec 2023 07:13:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-12076-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; 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-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12076-ouuuleilei=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id D61A928384F for ; Wed, 27 Dec 2023 15:13:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3EFA44654B; Wed, 27 Dec 2023 15:12:21 +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?b?UGV0ciBUZXNhxZnDrWs=?= , 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1786448445971595823 X-GMAIL-MSGID: 1786448445971595823 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(-)