[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v1 01/16] dma-mapping: introduce new DMA attribute to indicate MMIO memory
On Mon, Aug 04, 2025 at 03:42:35PM +0300, Leon Romanovsky wrote: > From: Leon Romanovsky <leonro@xxxxxxxxxx> > > This patch introduces the DMA_ATTR_MMIO attribute to mark DMA buffers > that reside in memory-mapped I/O (MMIO) regions, such as device BARs > exposed through the host bridge, which are accessible for peer-to-peer > (P2P) DMA. > > This attribute is especially useful for exporting device memory to other > devices for DMA without CPU involvement, and avoids unnecessary or > potentially detrimental CPU cache maintenance calls. It is worth mentioning here that dma_map_resource() and DMA_ATTR_MMIO are intended to be the same thing. > --- a/Documentation/core-api/dma-attributes.rst > +++ b/Documentation/core-api/dma-attributes.rst > @@ -130,3 +130,10 @@ accesses to DMA buffers in both privileged "supervisor" > and unprivileged > subsystem that the buffer is fully accessible at the elevated privilege > level (and ideally inaccessible or at least read-only at the > lesser-privileged levels). > + > +DMA_ATTR_MMIO > +------------- > + > +This attribute is especially useful for exporting device memory to other > +devices for DMA without CPU involvement, and avoids unnecessary or > +potentially detrimental CPU cache maintenance calls. How about This attribute indicates the physical address is not normal system memory. It may not be used with kmap*()/phys_to_virt()/phys_to_page() functions, it may not be cachable, and access using CPU load/store instructions may not be allowed. Usually this will be used to describe MMIO addresses, or other non cachable register addresses. When DMA mapping this sort of address we call the operation Peer to Peer as a one device is DMA'ing to another device. For PCI devices the p2pdma APIs must be used to determine if DMA_ATTR_MMIO is appropriate. For architectures that require cache flushing for DMA coherence DMA_ATTR_MMIO will not perform any cache flushing. The address provided must never be mapped cachable into the CPU. > +/* > + * DMA_ATTR_MMIO - Indicates memory-mapped I/O (MMIO) region for DMA mapping > + * > + * This attribute is used for MMIO memory regions that are exposed through > + * the host bridge and are accessible for peer-to-peer (P2P) DMA. Memory > + * marked with this attribute is not system RAM and may represent device > + * BAR windows or peer-exposed memory. > + * > + * Typical usage is for mapping hardware memory BARs or exporting device > + * memory to other devices for DMA without involving main system RAM. > + * The attribute guarantees no CPU cache maintenance calls will be made. > + */ I'd copy the Documentation/ text Jason
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |