aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/2983-drm-amdgpu-move-dummy-page-functions-to-amdgpu_gart..patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/2983-drm-amdgpu-move-dummy-page-functions-to-amdgpu_gart..patch')
-rw-r--r--meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/2983-drm-amdgpu-move-dummy-page-functions-to-amdgpu_gart..patch164
1 files changed, 164 insertions, 0 deletions
diff --git a/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/2983-drm-amdgpu-move-dummy-page-functions-to-amdgpu_gart..patch b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/2983-drm-amdgpu-move-dummy-page-functions-to-amdgpu_gart..patch
new file mode 100644
index 00000000..cd81fee5
--- /dev/null
+++ b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/2983-drm-amdgpu-move-dummy-page-functions-to-amdgpu_gart..patch
@@ -0,0 +1,164 @@
+From fac3080eb7d88430978d73d7f5ab6b0e18cba056 Mon Sep 17 00:00:00 2001
+From: Alex Deucher <alexander.deucher@amd.com>
+Date: Fri, 15 Dec 2017 16:28:33 -0500
+Subject: [PATCH 2983/4131] drm/amdgpu: move dummy page functions to
+ amdgpu_gart.c
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+It's the only place they are used.
+
+Acked-by: Christian König <christian.koenig@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+---
+ drivers/gpu/drm/amd/amdgpu/amdgpu.h | 3 --
+ drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 45 ---------------------------
+ drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c | 49 ++++++++++++++++++++++++++++--
+ 3 files changed, 47 insertions(+), 50 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+index db9fd0f..ebd0407 100755
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+@@ -380,9 +380,6 @@ struct amdgpu_dummy_page {
+ struct page *page;
+ dma_addr_t addr;
+ };
+-int amdgpu_dummy_page_init(struct amdgpu_device *adev);
+-void amdgpu_dummy_page_fini(struct amdgpu_device *adev);
+-
+
+ /*
+ * Clocks
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+index 4b39dc8..0795b89 100644
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+@@ -725,51 +725,6 @@ bool amdgpu_device_need_post(struct amdgpu_device *adev)
+ return true;
+ }
+
+-/**
+- * amdgpu_dummy_page_init - init dummy page used by the driver
+- *
+- * @adev: amdgpu_device pointer
+- *
+- * Allocate the dummy page used by the driver (all asics).
+- * This dummy page is used by the driver as a filler for gart entries
+- * when pages are taken out of the GART
+- * Returns 0 on sucess, -ENOMEM on failure.
+- */
+-int amdgpu_dummy_page_init(struct amdgpu_device *adev)
+-{
+- if (adev->dummy_page.page)
+- return 0;
+- adev->dummy_page.page = alloc_page(GFP_DMA32 | GFP_KERNEL | __GFP_ZERO);
+- if (adev->dummy_page.page == NULL)
+- return -ENOMEM;
+- adev->dummy_page.addr = pci_map_page(adev->pdev, adev->dummy_page.page,
+- 0, PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
+- if (pci_dma_mapping_error(adev->pdev, adev->dummy_page.addr)) {
+- dev_err(&adev->pdev->dev, "Failed to DMA MAP the dummy page\n");
+- __free_page(adev->dummy_page.page);
+- adev->dummy_page.page = NULL;
+- return -ENOMEM;
+- }
+- return 0;
+-}
+-
+-/**
+- * amdgpu_dummy_page_fini - free dummy page used by the driver
+- *
+- * @adev: amdgpu_device pointer
+- *
+- * Frees the dummy page used by the driver (all asics).
+- */
+-void amdgpu_dummy_page_fini(struct amdgpu_device *adev)
+-{
+- if (adev->dummy_page.page == NULL)
+- return;
+- pci_unmap_page(adev->pdev, adev->dummy_page.addr,
+- PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
+- __free_page(adev->dummy_page.page);
+- adev->dummy_page.page = NULL;
+-}
+-
+ /* if we get transitioned to only one device, take VGA back */
+ /**
+ * amdgpu_device_vga_set_decode - enable/disable vga decode
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c
+index 1f51897..0a4f34a 100644
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c
+@@ -57,6 +57,51 @@
+ */
+
+ /**
++ * amdgpu_dummy_page_init - init dummy page used by the driver
++ *
++ * @adev: amdgpu_device pointer
++ *
++ * Allocate the dummy page used by the driver (all asics).
++ * This dummy page is used by the driver as a filler for gart entries
++ * when pages are taken out of the GART
++ * Returns 0 on sucess, -ENOMEM on failure.
++ */
++static int amdgpu_gart_dummy_page_init(struct amdgpu_device *adev)
++{
++ if (adev->dummy_page.page)
++ return 0;
++ adev->dummy_page.page = alloc_page(GFP_DMA32 | GFP_KERNEL | __GFP_ZERO);
++ if (adev->dummy_page.page == NULL)
++ return -ENOMEM;
++ adev->dummy_page.addr = pci_map_page(adev->pdev, adev->dummy_page.page,
++ 0, PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
++ if (pci_dma_mapping_error(adev->pdev, adev->dummy_page.addr)) {
++ dev_err(&adev->pdev->dev, "Failed to DMA MAP the dummy page\n");
++ __free_page(adev->dummy_page.page);
++ adev->dummy_page.page = NULL;
++ return -ENOMEM;
++ }
++ return 0;
++}
++
++/**
++ * amdgpu_dummy_page_fini - free dummy page used by the driver
++ *
++ * @adev: amdgpu_device pointer
++ *
++ * Frees the dummy page used by the driver (all asics).
++ */
++static void amdgpu_gart_dummy_page_fini(struct amdgpu_device *adev)
++{
++ if (adev->dummy_page.page == NULL)
++ return;
++ pci_unmap_page(adev->pdev, adev->dummy_page.addr,
++ PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
++ __free_page(adev->dummy_page.page);
++ adev->dummy_page.page = NULL;
++}
++
++/**
+ * amdgpu_gart_table_vram_alloc - allocate vram for gart page table
+ *
+ * @adev: amdgpu_device pointer
+@@ -308,7 +353,7 @@ int amdgpu_gart_init(struct amdgpu_device *adev)
+ DRM_ERROR("Page size is smaller than GPU page size!\n");
+ return -EINVAL;
+ }
+- r = amdgpu_dummy_page_init(adev);
++ r = amdgpu_gart_dummy_page_init(adev);
+ if (r)
+ return r;
+ /* Compute table size */
+@@ -340,5 +385,5 @@ void amdgpu_gart_fini(struct amdgpu_device *adev)
+ vfree(adev->gart.pages);
+ adev->gart.pages = NULL;
+ #endif
+- amdgpu_dummy_page_fini(adev);
++ amdgpu_gart_dummy_page_fini(adev);
+ }
+--
+2.7.4
+