From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2EC7FC77B7F for ; Thu, 26 Jun 2025 08:25:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C7BE76B00A1; Thu, 26 Jun 2025 04:25:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C525F6B00A2; Thu, 26 Jun 2025 04:25:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B8FC06B00A3; Thu, 26 Jun 2025 04:25:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id A2C4F6B00A1 for ; Thu, 26 Jun 2025 04:25:32 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 4DB6E1401BF for ; Thu, 26 Jun 2025 08:25:32 +0000 (UTC) X-FDA: 83596867704.26.FE25779 Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) by imf04.hostedemail.com (Postfix) with ESMTP id 2671240009 for ; Thu, 26 Jun 2025 08:25:29 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=suse.com header.s=google header.b=NNurLOX0; spf=pass (imf04.hostedemail.com: domain of ptesarik@suse.com designates 209.85.221.50 as permitted sender) smtp.mailfrom=ptesarik@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1750926330; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=cCmPWaL2JK+cBGwDex8PVmJ2qL8B4VvzgJkSQY0fv8Q=; b=lOTPRrQqI9fGMYDUZzg10F4QVrHk+K/flEtaU6Pv/p8dsYh6to/CIeGc1UfoUsrxEuI1m7 HgQYFGzOuk/vWP71PUUPy0WqvrGsUh4q1JqP1gD3hcneKhJK0wM37x6p5RZihApI8+FA2d lOn4GsjlGwzi0z00VTatFvv3l12gfDI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1750926330; a=rsa-sha256; cv=none; b=tvi1QF2Jk2qmTK7xF7YECoCzD7elH0aCAl/3OTPDyv2UrSgf302lG9ZZ7c4OdyYIbu2Y3c A4fIwhS1Hr1MbiSzrFz2THGRPTjy2duJtDbu5v5EEIT2bjtgvDYFakUxJcDvzio5MTXW6o W+qSDG/SAXPCDSCF8zos+/V1YFgjkqU= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=suse.com header.s=google header.b=NNurLOX0; spf=pass (imf04.hostedemail.com: domain of ptesarik@suse.com designates 209.85.221.50 as permitted sender) smtp.mailfrom=ptesarik@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-3a577ab8c34so106928f8f.3 for ; Thu, 26 Jun 2025 01:25:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1750926328; x=1751531128; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=cCmPWaL2JK+cBGwDex8PVmJ2qL8B4VvzgJkSQY0fv8Q=; b=NNurLOX0m/gzrFAC15i3b7dI8//0iXUANsSCykpSYvNvlGfB30ru5pGZlZWamLm4ML r+LgxpCCKMg3VlymRa6gtq7X7cQC8DCGxa15F1mPbI41+iiEqOCfGjtnWBKE0VLu1A7M lG4uva2vN1onPROM45T38D/zuoXgoAaZpbY4uQv1bBVKMjhASTN2xNPF/B6GRp0oWZBm IXLraMC4JhHHIBcrvJPxGh7FRlJQBlBAlzuM05Vx3jdWj7dRD0VxZ8cjnf6OiRczqtj+ z8oaDZ5vJGxNJJwGfXhvd6vfQY7a3egqLMceAzNeVPOV12Pd7qwEswzEzUa6eHdgVtiO DvHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750926328; x=1751531128; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cCmPWaL2JK+cBGwDex8PVmJ2qL8B4VvzgJkSQY0fv8Q=; b=AcI4d0Zo7vy77+vu8JbdI2Bngd7X93yb/Jc4gwYEDO75Fqd3l8gKj8CYKhDK9CQ27j XDy57+6+nlL/GgM2otuOkghNQFLSe7ZRVYQwMOFQkJEovfPgTF3OSBA/IrwPThj/qpwj hwUwAgn7QsG8GL+c/lRR9MAikl1OXsMMU9ATo0bI7OsAvYDARFAFGFxG5yqRLib123TJ pa3rOdFgrfvbQxAKLT0A6eBiYAp7xpmSR+GsQRZxBDKrJ8ZwngHezLOQHXAhgRV6I1ef esr9m2RmtArH2Rcb+5zUbPRNDxhbLY3jq8HJppnq0BFrxAbCB5MJ9xoyX/xt3x9Vxijz uozw== X-Forwarded-Encrypted: i=1; AJvYcCURy76T9MBYJ8ONg5w+3QU/MQvFfvaFSact45/3+NC/z2XaeIJjj4Qi0jS7Ag1/p6U71p0TPy9dNw==@kvack.org X-Gm-Message-State: AOJu0YxVcaDRCxAgjWjOqxOZhUpUCRNlFRvZSJnItE82USmZkcmUwa8n qe2KYiOCo5xr2+aYZFMzH2MWxeGWK7TcIAXDT+/w2e0FdOxwnWfW7F0RwP3mPvEzhzM= X-Gm-Gg: ASbGncsMi3chkrlsRjVC9vP8izqQKwky5ZI4E+2/QwjbnjRn8UPUP/T9ECVstbjQx4c fouZouhMEU6Zjm7o5Jz+LPFeJNHQ/yCfsUrZn18AJ2ZMZitfrm7Vt0uO4SpDJ/MLNbZyyl18tc7 JNTf7DNFQKy2jQRd9OF43OqjGBaOCS4SDpkBCV1M1nO1d8+ItjN1JebnJGajvbX+4DOaLpmTnPt WjeEj/hdytiE3ZpSKGrw3HQ4Wq6Q44VzW5KhHZKztPf/WoJ0pC04FJovPdx8JiCKZZ/V3gW0ze4 7dPF+BXt0To1Lbcd1JW9aB5opuASxUYtIT4t2eCDIX61oOKMaWqtNHSLYiOQB9br/YC3p+4Cfum IcHL0 X-Google-Smtp-Source: AGHT+IEAZclUIfVDj/VGqSj8bLrUwvlFXbhpUIBVmE+AmsJhrhTCCer2N8+5GHrDmt4Q6t7t8SSboQ== X-Received: by 2002:adf:9d8b:0:b0:3a5:781c:6956 with SMTP id ffacd0b85a97d-3a6ed6206eamr1852279f8f.6.1750926328320; Thu, 26 Jun 2025 01:25:28 -0700 (PDT) Received: from mordecai.tesarici.cz ([193.86.92.181]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-b34c429b3f1sm1005625a12.15.2025.06.26.01.25.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Jun 2025 01:25:27 -0700 (PDT) Date: Thu, 26 Jun 2025 10:25:12 +0200 From: Petr Tesarik To: Marek Szyprowski Cc: Robin Murphy , Bagas Sanjaya , Jonathan Corbet , Andrew Morton , Leon Romanovsky , Keith Busch , Caleb Sander Mateos , Sagi Grimberg , Jens Axboe , John Garry , "open list:DOCUMENTATION" , open list , "open list:MEMORY MANAGEMENT" , iommu@lists.linux.dev Subject: Re: [PATCH 7/8] docs: dma-api: update streaming DMA API physical address constraints Message-ID: <20250626102512.57ac20e5@mordecai.tesarici.cz> In-Reply-To: <1312ef41-1f7c-4b6a-9d04-aa49faaf9b17@samsung.com> References: <20250624133923.1140421-1-ptesarik@suse.com> <20250624133923.1140421-8-ptesarik@suse.com> <20250626070602.3d42b607@mordecai.tesarici.cz> <1312ef41-1f7c-4b6a-9d04-aa49faaf9b17@samsung.com> X-Mailer: Claws Mail 4.3.1 (GTK 3.24.50; x86_64-suse-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 2671240009 X-Stat-Signature: 14c93x3j1gp6si1i8aw99zjo48orktsr X-Rspam-User: X-HE-Tag: 1750926329-974454 X-HE-Meta: U2FsdGVkX1/gsLTAiET1Hn+0u2IUYk7M6zAQCh+PZOrqQKCHodnFpIavrN9u/2O/7BFgfvmvHtCngC4ltCcHAN0tT5QxadNYqCc2pTNPs2rCO/JxCHE9fkA+YX1Wva+cawsSK7suzjZY6NciQ4HQ4cBKVxt95ZtmgkPDiT/LDeRovSKj154cHtV7/zPK2iwR/0Mi7Jhk6fMWGl7apPsPeNkVkby42EIPCNPlOZW+XuzyVN6iPqGT6HCK9hdbmIxkHhJuBZ2u00Fn+sQr8uorTBCgLbA6iS7yKVJWcbO3gnvvV9b1gF9uYl9i6jZxK4r4eygj1nDBt8AGtcTiPPKJYCRE9lPsZzEdwXCjBMyC5yzTCfRZaSP2Kb2tzJUGmRvL3gS2dx3ZAGYuzl4WKcLZDV82EFXGi6lBlEkGNSHci9yMVhNDnTYePMt3tuJQEJDEdP8LTVxM4zmKPbVP1LvsV4h73xaI3sQwZQNVeBqzgTGon9nrC89ma0Wt4BlSJvA8lZ/o5m+uQmU1WyF8zuXWFBtZsK7pKLL7V1/kmxWuO/8m2exfQAVR4fFU08g8qs+gHHeU+r/+rboTmjC9UMeT0Qm8wsiRCZecCxCJcB5UyQ6tvciLhBqHH9XhGtwCf+dAfrEvnCW7QjIvc+EXZWo0o0NnmoATY+DUDQ2RsDp7uCPMZAWhyk/GwbxLCH+GBnk6+MmiT0Otu7ySitIy2iDGIsylXtRRip3NY3GkkRJ6W65/3OFRqJ3J3r4vPr8cMhWEa2mEW1HJbjjvLSg4xXACSNnmtB/wX2UbOBIEAq2F8iuC0X1ETr7E9V4GOkTnxbMqzrnkAaJBIvLsh30YhADjgFiA515GiB3ZECfkQGkJ4tCldGMNsoVnffoj+O0LpsGwiNjfPHY/55YauSsA0ksEPL+LgrN1fQjEsp/zgOjPeocU0sdMZLY7cbpi9i25P/Kmkf0UUGgQW0vQuVSD9c7 ghWobeGe XpR5xL5sFRrIGza9pOBO5r5L9qOZUislz5wBWSVd3QKUeWp7jrNahFUHVpzJySADnaeGH+24hXKefnRoDQkoiqNcHD8Z46qa2Dr1Vdx9ao2CdEHdHuCVwtCSW1Jx5L5gV3WddAFKceYKMNGqfcdDtMcll1WDr2e/e1IO6MJLybOd4Wdzdgpry596hn+CgLeqyWflz/X5D2wLE4mjSnEiGnPVjg4X4YzO6TLRArDm7TmUlZI85aDvB197vLg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Thu, 26 Jun 2025 09:09:34 +0200 Marek Szyprowski wrote: > On 26.06.2025 07:06, Petr Tesarik wrote: > > On Thu, 26 Jun 2025 08:49:17 +0700 > > Bagas Sanjaya wrote: > > > >> On Tue, Jun 24, 2025 at 03:39:22PM +0200, Petr Tesarik wrote: > >>> diff --git a/Documentation/core-api/dma-api.rst b/Documentation/core-api/dma-api.rst > >>> index cd432996949c..65132ec88104 100644 > >>> --- a/Documentation/core-api/dma-api.rst > >>> +++ b/Documentation/core-api/dma-api.rst > >>> @@ -210,18 +210,12 @@ DMA_BIDIRECTIONAL direction isn't known > >>> this API should be obtained from sources which guarantee it to be > >>> physically contiguous (like kmalloc). > >>> > >>> - Further, the DMA address of the memory must be within the dma_mask of > >>> - the device. To ensure that the memory allocated by kmalloc is within > >>> - the dma_mask, the driver may specify various platform-dependent flags > >>> - to restrict the DMA address range of the allocation (e.g., on x86, > >>> - GFP_DMA guarantees to be within the first 16MB of available DMA > >>> - addresses, as required by ISA devices). > >>> - > >>> - Note also that the above constraints on physical contiguity and > >>> - dma_mask may not apply if the platform has an IOMMU (a device which > >>> - maps an I/O DMA address to a physical memory address). However, to be > >>> - portable, device driver writers may *not* assume that such an IOMMU > >>> - exists. > >>> + Mapping may also fail if the memory is not within the DMA mask of the > >>> + device. However, this constraint does not apply if the platform has > >>> + an IOMMU (a device which maps an I/O DMA address to a physical memory > >>> + address), or the kernel is configured with SWIOTLB (bounce buffers). > >>> + It is reasonable to assume that at least one of these mechanisms > >>> + allows streaming DMA to any physical address. > > Now I realize this last sentence may be contentious... > > > > @Marek, @Robin Do you agree that device drivers should not be concerned > > about the physical address of a buffer passed to the streaming DMA API? > > > > I mean, are there any real-world systems with: > > * some RAM that is not DMA-addressable, > > * no IOMMU, > > * CONFIG_SWIOTLB is not set? > > > > FWIW if _I_ received a bug report that a device driver fails to submit > > I/O on such a system, I would politely explain the reporter that their > > kernel is misconfigured, and they should enable CONFIG_SWIOTLB. > > What about the systems with legacy 16/24bit ZONE_DMA (i.e. ISA bus)? > AFAIR they don't use SWIOTLB and probably they won't be able to use > streaming DMA API for all system RAM. ISA is probably dead, but yeah, there may still be some systems with LPC, which inherits the same addressing limitations. I haven't really tested, but I believe these systems should be able to enable SWIOTLB. Is there a specific reason they can't use SWIOTLB? But if there is doubt, I can probably test such configuration. Petr T