mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 14:11:52 +00:00
drm/i915: Use fixed-sized types for stolen
Stolen memory is a hardware resource of known size, so use an accurate fixed integer type rather than the ambiguous variable size_t. This was motivated by the next patch spotting inconsistencies in our types. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/20170106152013.24684-3-chris@chris-wilson.co.uk
This commit is contained in:
parent
46fad808b1
commit
edd1f2fe11
@ -1420,8 +1420,10 @@ int intel_gmch_probe(struct pci_dev *bridge_pdev, struct pci_dev *gpu_pdev,
|
||||
}
|
||||
EXPORT_SYMBOL(intel_gmch_probe);
|
||||
|
||||
void intel_gtt_get(u64 *gtt_total, size_t *stolen_size,
|
||||
phys_addr_t *mappable_base, u64 *mappable_end)
|
||||
void intel_gtt_get(u64 *gtt_total,
|
||||
u32 *stolen_size,
|
||||
phys_addr_t *mappable_base,
|
||||
u64 *mappable_end)
|
||||
{
|
||||
*gtt_total = intel_private.gtt_total_entries << PAGE_SHIFT;
|
||||
*stolen_size = intel_private.stolen_size;
|
||||
|
@ -3139,8 +3139,10 @@ static int i915_gmch_probe(struct i915_ggtt *ggtt)
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
intel_gtt_get(&ggtt->base.total, &ggtt->stolen_size,
|
||||
&ggtt->mappable_base, &ggtt->mappable_end);
|
||||
intel_gtt_get(&ggtt->base.total,
|
||||
&ggtt->stolen_size,
|
||||
&ggtt->mappable_base,
|
||||
&ggtt->mappable_end);
|
||||
|
||||
ggtt->do_idle_maps = needs_idle_maps(dev_priv);
|
||||
ggtt->base.insert_page = i915_ggtt_insert_page;
|
||||
@ -3205,7 +3207,7 @@ int i915_ggtt_probe_hw(struct drm_i915_private *dev_priv)
|
||||
DRM_INFO("Memory usable by graphics device = %lluM\n",
|
||||
ggtt->base.total >> 20);
|
||||
DRM_DEBUG_DRIVER("GMADR size = %lldM\n", ggtt->mappable_end >> 20);
|
||||
DRM_DEBUG_DRIVER("GTT stolen size = %zdM\n", ggtt->stolen_size >> 20);
|
||||
DRM_DEBUG_DRIVER("GTT stolen size = %uM\n", ggtt->stolen_size >> 20);
|
||||
#ifdef CONFIG_INTEL_IOMMU
|
||||
if (intel_iommu_gfx_mapped)
|
||||
DRM_INFO("VT-d active for gfx access\n");
|
||||
|
@ -315,6 +315,9 @@ struct i915_ggtt {
|
||||
struct i915_address_space base;
|
||||
struct io_mapping mappable; /* Mapping to our CPU mappable region */
|
||||
|
||||
phys_addr_t mappable_base; /* PA of our GMADR */
|
||||
u64 mappable_end; /* End offset that we can CPU map */
|
||||
|
||||
/* Stolen memory is segmented in hardware with different portions
|
||||
* offlimits to certain functions.
|
||||
*
|
||||
@ -323,12 +326,10 @@ struct i915_ggtt {
|
||||
* avoid the first page! The upper end of stolen memory is reserved for
|
||||
* hardware functions and similarly removed from the accessible range.
|
||||
*/
|
||||
size_t stolen_size; /* Total size of stolen memory */
|
||||
size_t stolen_usable_size; /* Total size minus reserved ranges */
|
||||
size_t stolen_reserved_base;
|
||||
size_t stolen_reserved_size;
|
||||
u64 mappable_end; /* End offset that we can CPU map */
|
||||
phys_addr_t mappable_base; /* PA of our GMADR */
|
||||
u32 stolen_size; /* Total size of stolen memory */
|
||||
u32 stolen_usable_size; /* Total size minus reserved ranges */
|
||||
u32 stolen_reserved_base;
|
||||
u32 stolen_reserved_size;
|
||||
|
||||
/** "Graphics Stolen Memory" holds the global PTEs */
|
||||
void __iomem *gsm;
|
||||
|
@ -281,7 +281,7 @@ void i915_gem_cleanup_stolen(struct drm_device *dev)
|
||||
}
|
||||
|
||||
static void g4x_get_stolen_reserved(struct drm_i915_private *dev_priv,
|
||||
phys_addr_t *base, unsigned long *size)
|
||||
phys_addr_t *base, u32 *size)
|
||||
{
|
||||
struct i915_ggtt *ggtt = &dev_priv->ggtt;
|
||||
uint32_t reg_val = I915_READ(IS_GM45(dev_priv) ?
|
||||
@ -304,7 +304,7 @@ static void g4x_get_stolen_reserved(struct drm_i915_private *dev_priv,
|
||||
}
|
||||
|
||||
static void gen6_get_stolen_reserved(struct drm_i915_private *dev_priv,
|
||||
phys_addr_t *base, unsigned long *size)
|
||||
phys_addr_t *base, u32 *size)
|
||||
{
|
||||
uint32_t reg_val = I915_READ(GEN6_STOLEN_RESERVED);
|
||||
|
||||
@ -330,7 +330,7 @@ static void gen6_get_stolen_reserved(struct drm_i915_private *dev_priv,
|
||||
}
|
||||
|
||||
static void gen7_get_stolen_reserved(struct drm_i915_private *dev_priv,
|
||||
phys_addr_t *base, unsigned long *size)
|
||||
phys_addr_t *base, u32 *size)
|
||||
{
|
||||
uint32_t reg_val = I915_READ(GEN6_STOLEN_RESERVED);
|
||||
|
||||
@ -350,7 +350,7 @@ static void gen7_get_stolen_reserved(struct drm_i915_private *dev_priv,
|
||||
}
|
||||
|
||||
static void chv_get_stolen_reserved(struct drm_i915_private *dev_priv,
|
||||
phys_addr_t *base, unsigned long *size)
|
||||
phys_addr_t *base, u32 *size)
|
||||
{
|
||||
uint32_t reg_val = I915_READ(GEN6_STOLEN_RESERVED);
|
||||
|
||||
@ -376,7 +376,7 @@ static void chv_get_stolen_reserved(struct drm_i915_private *dev_priv,
|
||||
}
|
||||
|
||||
static void bdw_get_stolen_reserved(struct drm_i915_private *dev_priv,
|
||||
phys_addr_t *base, unsigned long *size)
|
||||
phys_addr_t *base, u32 *size)
|
||||
{
|
||||
struct i915_ggtt *ggtt = &dev_priv->ggtt;
|
||||
uint32_t reg_val = I915_READ(GEN6_STOLEN_RESERVED);
|
||||
@ -400,8 +400,8 @@ int i915_gem_init_stolen(struct drm_i915_private *dev_priv)
|
||||
{
|
||||
struct i915_ggtt *ggtt = &dev_priv->ggtt;
|
||||
phys_addr_t reserved_base, stolen_top;
|
||||
unsigned long reserved_total, reserved_size;
|
||||
unsigned long stolen_usable_start;
|
||||
u32 reserved_total, reserved_size;
|
||||
u32 stolen_usable_start;
|
||||
|
||||
mutex_init(&dev_priv->mm.stolen_lock);
|
||||
|
||||
@ -478,7 +478,7 @@ int i915_gem_init_stolen(struct drm_i915_private *dev_priv)
|
||||
* memory, so just consider the start. */
|
||||
reserved_total = stolen_top - reserved_base;
|
||||
|
||||
DRM_DEBUG_KMS("Memory reserved for graphics device: %zuK, usable: %luK\n",
|
||||
DRM_DEBUG_KMS("Memory reserved for graphics device: %uK, usable: %uK\n",
|
||||
ggtt->stolen_size >> 10,
|
||||
(ggtt->stolen_size - reserved_total) >> 10);
|
||||
|
||||
@ -487,8 +487,8 @@ int i915_gem_init_stolen(struct drm_i915_private *dev_priv)
|
||||
if (INTEL_GEN(dev_priv) >= 8)
|
||||
stolen_usable_start = 4096;
|
||||
|
||||
ggtt->stolen_usable_size = ggtt->stolen_size - reserved_total -
|
||||
stolen_usable_start;
|
||||
ggtt->stolen_usable_size =
|
||||
ggtt->stolen_size - reserved_total - stolen_usable_start;
|
||||
|
||||
/* Basic memrange allocator for stolen space. */
|
||||
drm_mm_init(&dev_priv->mm.stolen, stolen_usable_start,
|
||||
|
@ -3,8 +3,10 @@
|
||||
#ifndef _DRM_INTEL_GTT_H
|
||||
#define _DRM_INTEL_GTT_H
|
||||
|
||||
void intel_gtt_get(u64 *gtt_total, size_t *stolen_size,
|
||||
phys_addr_t *mappable_base, u64 *mappable_end);
|
||||
void intel_gtt_get(u64 *gtt_total,
|
||||
u32 *stolen_size,
|
||||
phys_addr_t *mappable_base,
|
||||
u64 *mappable_end);
|
||||
|
||||
int intel_gmch_probe(struct pci_dev *bridge_pdev, struct pci_dev *gpu_pdev,
|
||||
struct agp_bridge_data *bridge);
|
||||
|
Loading…
Reference in New Issue
Block a user