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 30E01C77B7F for ; Thu, 26 Jun 2025 05:06:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C8EFA6B0095; Thu, 26 Jun 2025 01:06:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C3ED26B009F; Thu, 26 Jun 2025 01:06:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B2DD46B009B; Thu, 26 Jun 2025 01:06:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id A033D6B0089 for ; Thu, 26 Jun 2025 01:06:10 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 54550C0411 for ; Thu, 26 Jun 2025 05:06:10 +0000 (UTC) X-FDA: 83596365300.07.C49235A Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) by imf25.hostedemail.com (Postfix) with ESMTP id 3ED63A0007 for ; Thu, 26 Jun 2025 05:06:08 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=suse.com header.s=google header.b=VGKdhEsN; spf=pass (imf25.hostedemail.com: domain of ptesarik@suse.com designates 209.85.208.43 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=1750914368; 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=UtVCqJAeH13XxyBvl5sUjNns6ovF/jyU+YftL8Si5vI=; b=AHATUDUy9Y/2nldnD12ZsWTWFJX3phOmOphqt4ldo+/bhZ9ErlzoBjuS/bc8csG/C29QKk ZFmZUpHkqVWEpfzfE+00qDyN4SEGGm2Pqq74CNMy5GJJjdZNUE3DMVhhq97kDJN+Mc/vQ1 pAeE0oOABGITk4kdgYXb9D5gN70tNsw= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1750914368; a=rsa-sha256; cv=none; b=5zK6Adj0xCfnnj9lL3RHr1ebh4M0WmHU8p10LaIipS8y/U6kZt+JGhkQr9429xIUSyp+jQ vZ+j8Xp4T5yRRnxCWpt2aSTAvePixI+EVW4STCrL1qRwI4zSOVzS+ZRTfKgwCy/NTYlGlQ bHfRJm6taszOlmpoXqvL95gUVIUfGgw= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=suse.com header.s=google header.b=VGKdhEsN; spf=pass (imf25.hostedemail.com: domain of ptesarik@suse.com designates 209.85.208.43 as permitted sender) smtp.mailfrom=ptesarik@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com Received: by mail-ed1-f43.google.com with SMTP id 4fb4d7f45d1cf-607780f0793so92640a12.2 for ; Wed, 25 Jun 2025 22:06:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1750914366; x=1751519166; 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=UtVCqJAeH13XxyBvl5sUjNns6ovF/jyU+YftL8Si5vI=; b=VGKdhEsNe9HVj/zNYXxDu4ZIKUe+7U2H+ZYliHBlBmgR+BJFDCyZRYgk5rnNyAmfGj nchGdLuDRANFhWrOgTDPIQA1ITDGA7PVO6VU8x84MFZDKj38xqj0JJ+8kPNDA3gxM6J0 UCJf/qAmszmVIPy4ylpVEDxmJpDUABR+AjQ9xYFZDbIrJBSNh4nVy7eaCqFgdLItkD3M Niv3cru0n1cxCtlGVpSJ/6z7MBS6281r/47vJjWvpBbJYfTYH2OnvyL2YE+JoSYTib4L fJD8AJx040hmJLT6coJphqhu1xrNwjEsdp78qO8QVdEgM/dzkc4Y421EJmGfFE/K4w/Y p6ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750914366; x=1751519166; 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=UtVCqJAeH13XxyBvl5sUjNns6ovF/jyU+YftL8Si5vI=; b=BLaZZ9MLX4Du+Ficia3gxg39nXlM532t6VE+bGF/TxowMgOZ1abShNExfYcTTei1lz oDzV7SFEN3dRpf9Kbc5kWBKVFncEtLx7SC2hxnHZkxjo9yyKHaPYuLB8ZlmoFPicutbO Ix9DrD05pHbjxLLQSvVXT95DMQphzl6NGkusSKLA+uj0UWJKhKCTnSN1DAYtUhBD85dq yYMe3bvMTSkUGRNFib0GX4LHTMRemLyec9/u5q/KJxWWA6xRBP5KLp99HAccYoUqZVop h/fOAbDFwIywmkY6L6uVvlrzf7xfjK0JGhK94uNJ2ohYwUGR5t1XYDBb7fRpcQdBW4Xc wKyg== X-Forwarded-Encrypted: i=1; AJvYcCW7CVAbQHnCe5qJXNoHBeoZc7GQ2gTyzHfgfCxxxCe4JZLW1jvcUQT4W5eIVnsIHjOO7MdlnpV8tg==@kvack.org X-Gm-Message-State: AOJu0Yx6dSI8wTjD/G6MqLufW208eoV6bgUDfO23j459gS85Fpu71X1w 51m+ZPeRH/tyRLgwatnFWJTW6NtFprNH0BFCC6E8z9l4ug90yqgtFEeXA2Ae/0nndMY= X-Gm-Gg: ASbGncsixWdP//Y8H8dVJ3Q5A+4L1okb4K+I6LngtTI9pVj7L8er26olV1679fl78PS M6YJfWNk54klDTaCkewkVkVRV5+iplp2KGFjdAJzJLoYDQoAF0q/eyoozze6j86Qi9eSlTZ/0ly SXHwZN5uA6k9zppCyd6p/IFaW7SRFwRhhLrRBqfkuu7we9NjvyUzbBDKdueRRR/ly/5LqFJgDpG NBW24tSY4od9cQXTy+iiMBWTNExx3gD7WSbpuPQEgs0XtL40TEtje/nchs+M52EAwJBDD/JDr3M DzVXBpj+pPHrdU0Yh6QHKNNqU36cN3duKaCJ+st7cjyAvw== X-Google-Smtp-Source: AGHT+IGL+2QsRWwulNb9W8gpCcvsfj+qYhvE5q/YlnOTjKxvi2e+r0wusCertjz9fW8rlZ/Gl3vWfw== X-Received: by 2002:a05:6402:5114:b0:60c:3cca:6515 with SMTP id 4fb4d7f45d1cf-60c4dbc656dmr1619383a12.4.1750914366035; Wed, 25 Jun 2025 22:06:06 -0700 (PDT) Received: from mordecai.tesarici.cz ([213.235.133.108]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-60c2f196fa7sm3318565a12.2.2025.06.25.22.06.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jun 2025 22:06:05 -0700 (PDT) Date: Thu, 26 Jun 2025 07:06:02 +0200 From: Petr Tesarik To: Marek Szyprowski , Robin@kvack.org, "Murphy , 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: <20250626070602.3d42b607@mordecai.tesarici.cz> In-Reply-To: References: <20250624133923.1140421-1-ptesarik@suse.com> <20250624133923.1140421-8-ptesarik@suse.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-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hUbSqJxCB6eZ 5y27ASYe qMgLnFQ/XwyiVCaCYI0/t2pOI8etfldrIgqkzfbpbsDn1rgyN/ua1HlZ1XaYhzrexzHBrc2v7S+AbLXmK2HlX0Uk7SGEaeNtxxSNPO3+JgXf36+RdOv6sP/i/gIYhtC2+xTa7IWwTdjPc0/Z74kdNiiMvqWcB8sthAbc9dQtOGSghe/R3aW0X+4U3wll4iWaq7hcB46qaYAF8nrNzbL8oEf43xMuQ1z6UPtwa 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 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. Just my two cents, Petr T > > .. warning:: > > > > LGTM, thanks! > > Reviewed-by: Bagas Sanjaya Thank you for the review, Bagas.