drm/drivers: add support for using the arch wc mapping API.
authorjsg <jsg@openbsd.org>
Thu, 13 Sep 2018 03:55:17 +0000 (03:55 +0000)
committerjsg <jsg@openbsd.org>
Thu, 13 Sep 2018 03:55:17 +0000 (03:55 +0000)
From Dave Airlie
c59fdc4cfbda52ce081c59540762185d765c3369 in linux 4.4.y/4.4.155
7cf321d118a825c1541b43ca45294126fd474efa in mainline linux

sys/dev/pci/drm/radeon/radeon_object.c

index 9b45d53..d8006d6 100644 (file)
@@ -447,6 +447,12 @@ int radeon_bo_init(struct radeon_device *rdev)
 {
        paddr_t start, end;
 
+#ifdef __linux__
+       /* reserve PAT memory space to WC for VRAM */
+       arch_io_reserve_memtype_wc(rdev->mc.aper_base,
+                                  rdev->mc.aper_size);
+#endif
+
        /* Add an MTRR for the VRAM */
        if (!rdev->fastfb_working) {
 #ifdef __linux__
@@ -476,6 +482,7 @@ void radeon_bo_fini(struct radeon_device *rdev)
        radeon_ttm_fini(rdev);
 #ifdef __linux__
        arch_phys_wc_del(rdev->mc.vram_mtrr);
+       arch_io_free_memtype_wc(rdev->mc.aper_base, rdev->mc.aper_size);
 #else
        drm_mtrr_del(0, rdev->mc.aper_base, rdev->mc.aper_size, DRM_MTRR_WC);
 #endif