Commit 76f92201 authored by Thomas Zimmermann's avatar Thomas Zimmermann
Browse files

fbdev: Push pgprot_decrypted() into mmap implementations



If a driver sets struct fb_ops.fb_mmap, the fbdev core automatically
calls pgprot_decrypted(). But the default fb_mmap code doesn't handle
pgprot_decrypted().

Move the call to pgprot_decrypted() into each drivers' fb_mmap function.
This only concerns fb_mmap functions for system and DMA memory. For
I/O memory, which is the default case, nothing changes. The fb_mmap
for I/O-memory can later be moved into a helper as well.

DRM's fbdev emulation handles pgprot_decrypted() internally via the
Prime helpers. Fbdev doesn't have to do anything in this case. In
cases where DRM uses deferred I/O, this patch updates fb_mmap correctly.

Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231127131655.4020-30-tzimmermann@suse.de
parent 23dad7b9
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -51,6 +51,8 @@ static int cfag12864bfb_mmap(struct fb_info *info, struct vm_area_struct *vma)
{
	struct page *pages = virt_to_page(cfag12864b_buffer);

	vma->vm_page_prot = pgprot_decrypted(vma->vm_page_prot);

	return vm_map_pages_zero(vma, &pages, 1);
}

+2 −0
Original line number Diff line number Diff line
@@ -351,6 +351,8 @@ static int ht16k33_mmap(struct fb_info *info, struct vm_area_struct *vma)
	struct ht16k33_priv *priv = info->par;
	struct page *pages = virt_to_page(priv->fbdev.buffer);

	vma->vm_page_prot = pgprot_decrypted(vma->vm_page_prot);

	return vm_map_pages_zero(vma, &pages, 1);
}

+2 −0
Original line number Diff line number Diff line
@@ -829,6 +829,8 @@ static int clcdfb_of_dma_setup(struct clcd_fb *fb)

static int clcdfb_of_dma_mmap(struct clcd_fb *fb, struct vm_area_struct *vma)
{
	vma->vm_page_prot = pgprot_decrypted(vma->vm_page_prot);

	return dma_mmap_wc(&fb->dev->dev, vma, fb->fb.screen_base,
			   fb->fb.fix.smem_start, fb->fb.fix.smem_len);
}
+2 −0
Original line number Diff line number Diff line
@@ -342,6 +342,8 @@ int au1100fb_fb_mmap(struct fb_info *fbi, struct vm_area_struct *vma)
{
	struct au1100fb_device *fbdev = to_au1100fb_device(fbi);

	vma->vm_page_prot = pgprot_decrypted(vma->vm_page_prot);

	pgprot_val(vma->vm_page_prot) |= (6 << 9); //CCA=6

	return dma_mmap_coherent(fbdev->dev, vma, fbdev->fb_mem, fbdev->fb_phys,
+2 −0
Original line number Diff line number Diff line
@@ -1236,6 +1236,8 @@ static int au1200fb_fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
{
	struct au1200fb_device *fbdev = info->par;

	vma->vm_page_prot = pgprot_decrypted(vma->vm_page_prot);

	return dma_mmap_coherent(fbdev->dev, vma,
				 fbdev->fb_mem, fbdev->fb_phys, fbdev->fb_len);
}
Loading