mirror of
https://github.com/torvalds/linux.git
synced 2026-09-28 03:52:02 +02:00
drm/xe/mmio_gem: use write-back mapping for dummy page
Currently vmf_insert_pfn() maps the dummy page as UC, inheriting the
VMA's page protection which was set for the real MMIO region. This
conflicts with the direct map's WB mapping of the same page, creating a
cache type alias which is architecturally undefined on some platforms.
Use vmf_insert_pfn_prot() with a WB pgprot instead. Also simplify to
fault in the requested page instead of the whole VMA.
Fixes: 1ffcf8b8ae ("drm/xe: Support for mmap-ing mmio regions")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/patchset/20260525125801.975038-6-ilia.levi%40intel.com
Assisted-by: GitHub-Copilot:claude-opus-4.6
Signed-off-by: Ilia Levi <ilia.levi@intel.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Link: https://patch.msgid.link/20260908165046.1393557-12-matthew.auld@intel.com
(cherry picked from commit 1e8e28e35df0e77ae1b22fc091c1f422f62fa5e9)
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
This commit is contained in:
parent
247a82da6f
commit
819f189265
|
|
@ -172,14 +172,13 @@ static void xe_mmio_gem_release_dummy_page(struct drm_device *dev, void *res)
|
|||
__free_page((struct page *)res);
|
||||
}
|
||||
|
||||
static vm_fault_t xe_mmio_gem_vm_fault_dummy_page(struct vm_area_struct *vma)
|
||||
static vm_fault_t xe_mmio_gem_vm_fault_dummy_page(struct vm_fault *vmf)
|
||||
{
|
||||
struct vm_area_struct *vma = vmf->vma;
|
||||
struct drm_gem_object *base = vma->vm_private_data;
|
||||
struct drm_device *dev = base->dev;
|
||||
vm_fault_t ret = VM_FAULT_NOPAGE;
|
||||
struct page *page;
|
||||
unsigned long pfn;
|
||||
unsigned long i;
|
||||
|
||||
page = alloc_page(GFP_KERNEL | __GFP_ZERO);
|
||||
if (!page)
|
||||
|
|
@ -190,16 +189,8 @@ static vm_fault_t xe_mmio_gem_vm_fault_dummy_page(struct vm_area_struct *vma)
|
|||
|
||||
pfn = page_to_pfn(page);
|
||||
|
||||
/* Map the entire VMA to the same dummy page */
|
||||
for (i = 0; i < base->size; i += PAGE_SIZE) {
|
||||
unsigned long addr = vma->vm_start + i;
|
||||
|
||||
ret = vmf_insert_pfn(vma, addr, pfn);
|
||||
if (ret & VM_FAULT_ERROR)
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
return vmf_insert_pfn_prot(vma, vmf->address, pfn,
|
||||
vm_get_page_prot(vma->vm_flags));
|
||||
}
|
||||
|
||||
static vm_fault_t xe_mmio_gem_vm_fault(struct vm_fault *vmf)
|
||||
|
|
@ -219,7 +210,7 @@ static vm_fault_t xe_mmio_gem_vm_fault(struct vm_fault *vmf)
|
|||
* It is assumed the userspace will receive the notification via some
|
||||
* other channel (e.g. drm uevent).
|
||||
*/
|
||||
return xe_mmio_gem_vm_fault_dummy_page(vma);
|
||||
return xe_mmio_gem_vm_fault_dummy_page(vmf);
|
||||
}
|
||||
|
||||
for (i = 0; i < base->size; i += PAGE_SIZE) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user