]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
drm/pagemap: DMA map folios when possible
authorFrancois Dugast <francois.dugast@intel.com>
Tue, 5 Aug 2025 13:59:04 +0000 (15:59 +0200)
committerFrancois Dugast <francois.dugast@intel.com>
Wed, 6 Aug 2025 11:34:50 +0000 (13:34 +0200)
commitd755ff6063852cbd43c666726b69333d33d0d379
tree8e9810bd4fbd08bedb96f1bf67175a71394c4491
parentf35a6cdf8a6d69f2fb35ece202a09f13fe7c87b2
drm/pagemap: DMA map folios when possible

If the page is part of a folio, DMA map the whole folio at once instead of
mapping individual pages one after the other. For example if 2MB folios
are used instead of 4KB pages, this reduces the number of DMA mappings by
512.

The folio order (and consequently, the size) is persisted in the struct
drm_pagemap_device_addr to be available at the time of unmapping.

v2:
- Initialize order variable (Matthew Brost)
- Set proto and dir for completeness (Matthew Brost)
- Do not populate drm_pagemap_addr, document it (Matthew Brost)
- Add and use macro NR_PAGES(order) (Matthew Brost)

Cc: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Acked-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://lore.kernel.org/r/20250805140028.599361-4-francois.dugast@intel.com
Signed-off-by: Francois Dugast <francois.dugast@intel.com>
drivers/gpu/drm/drm_pagemap.c
include/drm/drm_pagemap.h