drm/i915: give stolen system memory its own class

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>
This commit is contained in:
Matthew Auld 2021-02-05 10:20:26 +00:00 committed by Daniel Vetter
parent 8ec8ad0f2f
commit dc43040012
5 changed files with 10 additions and 10 deletions

View File

@ -686,7 +686,7 @@ struct drm_i915_gem_object *
i915_gem_object_create_stolen(struct drm_i915_private *i915, i915_gem_object_create_stolen(struct drm_i915_private *i915,
resource_size_t size) 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); 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 stolen_offset,
resource_size_t size) 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_i915_gem_object *obj;
struct drm_mm_node *stolen; struct drm_mm_node *stolen;
int ret; int ret;

View 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 && if (INTEL_GEN(i915) >= 9 && i915_selftest.live < 0 &&
i915->params.fake_lmem_start) { i915->params.fake_lmem_start) {
mkwrite_device_info(i915)->memory_regions = 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)); GEM_BUG_ON(!HAS_LMEM(i915));
} }
} }

View File

@ -154,7 +154,7 @@
.page_sizes = I915_GTT_PAGE_SIZE_4K .page_sizes = I915_GTT_PAGE_SIZE_4K
#define GEN_DEFAULT_REGIONS \ #define GEN_DEFAULT_REGIONS \
.memory_regions = REGION_SMEM | REGION_STOLEN .memory_regions = REGION_SMEM | REGION_STOLEN_SMEM
#define I830_FEATURES \ #define I830_FEATURES \
GEN(2), \ GEN(2), \

View File

@ -18,8 +18,8 @@ static const struct {
.class = INTEL_MEMORY_LOCAL, .class = INTEL_MEMORY_LOCAL,
.instance = 0, .instance = 0,
}, },
[INTEL_REGION_STOLEN] = { [INTEL_REGION_STOLEN_SMEM] = {
.class = INTEL_MEMORY_STOLEN, .class = INTEL_MEMORY_STOLEN_SYSTEM,
.instance = 0, .instance = 0,
}, },
}; };
@ -278,7 +278,7 @@ int intel_memory_regions_hw_probe(struct drm_i915_private *i915)
case INTEL_MEMORY_SYSTEM: case INTEL_MEMORY_SYSTEM:
mem = i915_gem_shmem_setup(i915); mem = i915_gem_shmem_setup(i915);
break; break;
case INTEL_MEMORY_STOLEN: case INTEL_MEMORY_STOLEN_SYSTEM:
mem = i915_gem_stolen_setup(i915); mem = i915_gem_stolen_setup(i915);
break; break;
default: default:

View File

@ -25,19 +25,19 @@ struct sg_table;
enum intel_memory_type { enum intel_memory_type {
INTEL_MEMORY_SYSTEM = 0, INTEL_MEMORY_SYSTEM = 0,
INTEL_MEMORY_LOCAL, INTEL_MEMORY_LOCAL,
INTEL_MEMORY_STOLEN, INTEL_MEMORY_STOLEN_SYSTEM,
}; };
enum intel_region_id { enum intel_region_id {
INTEL_REGION_SMEM = 0, INTEL_REGION_SMEM = 0,
INTEL_REGION_LMEM, INTEL_REGION_LMEM,
INTEL_REGION_STOLEN, INTEL_REGION_STOLEN_SMEM,
INTEL_REGION_UNKNOWN, /* Should be last */ INTEL_REGION_UNKNOWN, /* Should be last */
}; };
#define REGION_SMEM BIT(INTEL_REGION_SMEM) #define REGION_SMEM BIT(INTEL_REGION_SMEM)
#define REGION_LMEM BIT(INTEL_REGION_LMEM) #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_MIN_PAGE_SIZE BIT(0)
#define I915_ALLOC_CONTIGUOUS BIT(1) #define I915_ALLOC_CONTIGUOUS BIT(1)