On Fri, May 4, 2018 at 1:33 PM Paulo Zanoni <paulo.r.zanoni@xxxxxxxxx> wrote: > > Now that our stolen memory is already reserved by the x86 subsystem > (since commit "x86/gpu: reserve ICL's graphics stolen memory"), make > use of it. > > Cc: Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx> > Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@xxxxxxxxx> > Cc: x86@xxxxxxxxxx > Signed-off-by: Paulo Zanoni <paulo.r.zanoni@xxxxxxxxx> > --- > drivers/gpu/drm/i915/i915_gem_stolen.c | 38 +++++++++++++++++++++++++++++++++- > drivers/gpu/drm/i915/i915_reg.h | 1 + > 2 files changed, 38 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c > index ad949cc30928..99556f0dbedc 100644 > --- a/drivers/gpu/drm/i915/i915_gem_stolen.c > +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c > @@ -343,6 +343,35 @@ static void bdw_get_stolen_reserved(struct drm_i915_private *dev_priv, > *size = stolen_top - *base; > } > > +static void icl_get_stolen_reserved(struct drm_i915_private *dev_priv, > + resource_size_t *base, > + resource_size_t *size) > +{ > + u64 reg_val = I915_READ64(GEN6_STOLEN_RESERVED); are you sure it's still the same address? Either I'm looking to the wrong place or this needs to be changed. Lucas De Marchi > + > + DRM_DEBUG_DRIVER("GEN6_STOLEN_RESERVED = 0x%016llx\n", reg_val); > + > + *base = reg_val & GEN11_STOLEN_RESERVED_ADDR_MASK; > + > + switch (reg_val & GEN8_STOLEN_RESERVED_SIZE_MASK) { > + case GEN8_STOLEN_RESERVED_1M: > + *size = 1024 * 1024; > + break; > + case GEN8_STOLEN_RESERVED_2M: > + *size = 2 * 1024 * 1024; > + break; > + case GEN8_STOLEN_RESERVED_4M: > + *size = 4 * 1024 * 1024; > + break; > + case GEN8_STOLEN_RESERVED_8M: > + *size = 8 * 1024 * 1024; > + break; > + default: > + *size = 8 * 1024 * 1024; > + MISSING_CASE(reg_val & GEN8_STOLEN_RESERVED_SIZE_MASK); > + } > +} > + > int i915_gem_init_stolen(struct drm_i915_private *dev_priv) > { > resource_size_t reserved_base, stolen_top; > @@ -399,7 +428,9 @@ int i915_gem_init_stolen(struct drm_i915_private *dev_priv) > gen7_get_stolen_reserved(dev_priv, > &reserved_base, &reserved_size); > break; > - default: > + case 8: > + case 9: > + case 10: > if (IS_LP(dev_priv)) > chv_get_stolen_reserved(dev_priv, > &reserved_base, &reserved_size); > @@ -407,6 +438,11 @@ int i915_gem_init_stolen(struct drm_i915_private *dev_priv) > bdw_get_stolen_reserved(dev_priv, > &reserved_base, &reserved_size); > break; > + case 11: > + default: > + icl_get_stolen_reserved(dev_priv, &reserved_base, > + &reserved_size); > + break; > } > > /* > diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h > index 15daf3553d40..c5bc7c808e31 100644 > --- a/drivers/gpu/drm/i915/i915_reg.h > +++ b/drivers/gpu/drm/i915/i915_reg.h > @@ -398,6 +398,7 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg) > #define GEN8_STOLEN_RESERVED_4M (2 << 7) > #define GEN8_STOLEN_RESERVED_8M (3 << 7) > #define GEN6_STOLEN_RESERVED_ENABLE (1 << 0) > +#define GEN11_STOLEN_RESERVED_ADDR_MASK (0xFFFFFFFFFFFULL << 20) > > /* VGA stuff */ > > -- > 2.14.3 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@xxxxxxxxxxxxxxxxxxxxx > https://lists.freedesktop.org/mailman/listinfo/intel-gfx -- Lucas De Marchi _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx