drm/i915: give stolen system memory its own class
authorMatthew Auld <matthew.auld@intel.com>
Fri, 5 Feb 2021 10:20:26 +0000 (10:20 +0000)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 24 Mar 2021 18:31:59 +0000 (19:31 +0100)
In some future patches we will need to also support a stolen region
carved from device local memory, on platforms like DG1. To handle this
we can simply describe each in terms of its own memory class.

Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20210205102026.806699-2-matthew.auld@intel.com
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/gem/i915_gem_stolen.c
drivers/gpu/drm/i915/i915_drv.c
drivers/gpu/drm/i915/i915_pci.c
drivers/gpu/drm/i915/intel_memory_region.c
drivers/gpu/drm/i915/intel_memory_region.h

index a1e197a..c5f8529 100644 (file)
@@ -686,7 +686,7 @@ struct drm_i915_gem_object *
 i915_gem_object_create_stolen(struct drm_i915_private *i915,
                              resource_size_t size)
 {
-       return i915_gem_object_create_region(i915->mm.regions[INTEL_REGION_STOLEN],
+       return i915_gem_object_create_region(i915->mm.regions[INTEL_REGION_STOLEN_SMEM],
                                             size, I915_BO_ALLOC_CONTIGUOUS);
 }
 
@@ -726,7 +726,7 @@ i915_gem_object_create_stolen_for_preallocated(struct drm_i915_private *i915,
                                               resource_size_t stolen_offset,
                                               resource_size_t size)
 {
-       struct intel_memory_region *mem = i915->mm.regions[INTEL_REGION_STOLEN];
+       struct intel_memory_region *mem = i915->mm.regions[INTEL_REGION_STOLEN_SMEM];
        struct drm_i915_gem_object *obj;
        struct drm_mm_node *stolen;
        int ret;
index a32d847..2a780ee 100644 (file)
@@ -807,7 +807,7 @@ int i915_driver_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
                if (INTEL_GEN(i915) >= 9 && i915_selftest.live < 0 &&
                    i915->params.fake_lmem_start) {
                        mkwrite_device_info(i915)->memory_regions =
-                               REGION_SMEM | REGION_LMEM | REGION_STOLEN;
+                               REGION_SMEM | REGION_LMEM | REGION_STOLEN_SMEM;
                        GEM_BUG_ON(!HAS_LMEM(i915));
                }
        }
index 9a481ad..a9f24f2 100644 (file)
        .page_sizes = I915_GTT_PAGE_SIZE_4K
 
 #define GEN_DEFAULT_REGIONS \
-       .memory_regions = REGION_SMEM | REGION_STOLEN
+       .memory_regions = REGION_SMEM | REGION_STOLEN_SMEM
 
 #define I830_FEATURES \
        GEN(2), \
index 048b6d6..bf837b6 100644 (file)
@@ -18,8 +18,8 @@ static const struct {
                .class = INTEL_MEMORY_LOCAL,
                .instance = 0,
        },
-       [INTEL_REGION_STOLEN] = {
-               .class = INTEL_MEMORY_STOLEN,
+       [INTEL_REGION_STOLEN_SMEM] = {
+               .class = INTEL_MEMORY_STOLEN_SYSTEM,
                .instance = 0,
        },
 };
@@ -278,7 +278,7 @@ int intel_memory_regions_hw_probe(struct drm_i915_private *i915)
                case INTEL_MEMORY_SYSTEM:
                        mem = i915_gem_shmem_setup(i915);
                        break;
-               case INTEL_MEMORY_STOLEN:
+               case INTEL_MEMORY_STOLEN_SYSTEM:
                        mem = i915_gem_stolen_setup(i915);
                        break;
                default:
index 8baf253..edd4906 100644 (file)
@@ -25,19 +25,19 @@ struct sg_table;
 enum intel_memory_type {
        INTEL_MEMORY_SYSTEM = 0,
        INTEL_MEMORY_LOCAL,
-       INTEL_MEMORY_STOLEN,
+       INTEL_MEMORY_STOLEN_SYSTEM,
 };
 
 enum intel_region_id {
        INTEL_REGION_SMEM = 0,
        INTEL_REGION_LMEM,
-       INTEL_REGION_STOLEN,
+       INTEL_REGION_STOLEN_SMEM,
        INTEL_REGION_UNKNOWN, /* Should be last */
 };
 
 #define REGION_SMEM     BIT(INTEL_REGION_SMEM)
 #define REGION_LMEM     BIT(INTEL_REGION_LMEM)
-#define REGION_STOLEN   BIT(INTEL_REGION_STOLEN)
+#define REGION_STOLEN_SMEM   BIT(INTEL_REGION_STOLEN_SMEM)
 
 #define I915_ALLOC_MIN_PAGE_SIZE  BIT(0)
 #define I915_ALLOC_CONTIGUOUS     BIT(1)