drm: Remove PageReserved manipulation from drm_pci_alloc
commit5.4-rM2-2.2.x-imx-squashedea36ec8623
upstream. drm_pci_alloc/drm_pci_free are very thin wrappers around the core dma facilities, and we have no special reason within the drm layer to behave differently. In particular, since commitde09d31dd3
Author: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Date: Fri Jan 15 16:51:42 2016 -0800 page-flags: define PG_reserved behavior on compound pages As far as I can see there's no users of PG_reserved on compound pages. Let's use PF_NO_COMPOUND here. it has been illegal to combine GFP_COMP with SetPageReserved, so lets stop doing both and leave the dma layer to its own devices. Reported-by: Taketo Kabe Bug: https://gitlab.freedesktop.org/drm/intel/issues/1027 Fixes:de09d31dd3
("page-flags: define PG_reserved behavior on compound pages") Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: <stable@vger.kernel.org> # v4.5+ Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200202171635.4039044-1-chris@chris-wilson.co.uk Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
parent
b716a5f5ec
commit
fe0ec6f90e
|
@ -51,8 +51,6 @@
|
||||||
drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t align)
|
drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t align)
|
||||||
{
|
{
|
||||||
drm_dma_handle_t *dmah;
|
drm_dma_handle_t *dmah;
|
||||||
unsigned long addr;
|
|
||||||
size_t sz;
|
|
||||||
|
|
||||||
/* pci_alloc_consistent only guarantees alignment to the smallest
|
/* pci_alloc_consistent only guarantees alignment to the smallest
|
||||||
* PAGE_SIZE order which is greater than or equal to the requested size.
|
* PAGE_SIZE order which is greater than or equal to the requested size.
|
||||||
|
@ -68,20 +66,13 @@ drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t ali
|
||||||
dmah->size = size;
|
dmah->size = size;
|
||||||
dmah->vaddr = dma_alloc_coherent(&dev->pdev->dev, size,
|
dmah->vaddr = dma_alloc_coherent(&dev->pdev->dev, size,
|
||||||
&dmah->busaddr,
|
&dmah->busaddr,
|
||||||
GFP_KERNEL | __GFP_COMP);
|
GFP_KERNEL);
|
||||||
|
|
||||||
if (dmah->vaddr == NULL) {
|
if (dmah->vaddr == NULL) {
|
||||||
kfree(dmah);
|
kfree(dmah);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX - Is virt_to_page() legal for consistent mem? */
|
|
||||||
/* Reserve */
|
|
||||||
for (addr = (unsigned long)dmah->vaddr, sz = size;
|
|
||||||
sz > 0; addr += PAGE_SIZE, sz -= PAGE_SIZE) {
|
|
||||||
SetPageReserved(virt_to_page((void *)addr));
|
|
||||||
}
|
|
||||||
|
|
||||||
return dmah;
|
return dmah;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,19 +85,9 @@ EXPORT_SYMBOL(drm_pci_alloc);
|
||||||
*/
|
*/
|
||||||
void __drm_legacy_pci_free(struct drm_device * dev, drm_dma_handle_t * dmah)
|
void __drm_legacy_pci_free(struct drm_device * dev, drm_dma_handle_t * dmah)
|
||||||
{
|
{
|
||||||
unsigned long addr;
|
if (dmah->vaddr)
|
||||||
size_t sz;
|
|
||||||
|
|
||||||
if (dmah->vaddr) {
|
|
||||||
/* XXX - Is virt_to_page() legal for consistent mem? */
|
|
||||||
/* Unreserve */
|
|
||||||
for (addr = (unsigned long)dmah->vaddr, sz = dmah->size;
|
|
||||||
sz > 0; addr += PAGE_SIZE, sz -= PAGE_SIZE) {
|
|
||||||
ClearPageReserved(virt_to_page((void *)addr));
|
|
||||||
}
|
|
||||||
dma_free_coherent(&dev->pdev->dev, dmah->size, dmah->vaddr,
|
dma_free_coherent(&dev->pdev->dev, dmah->size, dmah->vaddr,
|
||||||
dmah->busaddr);
|
dmah->busaddr);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue