]> git.karo-electronics.de Git - linux-beck.git/commitdiff
drm/i915: Use fixed-sized types for stolen
authorChris Wilson <chris@chris-wilson.co.uk>
Fri, 6 Jan 2017 15:20:11 +0000 (15:20 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Fri, 6 Jan 2017 16:02:09 +0000 (16:02 +0000)
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
drivers/char/agp/intel-gtt.c
drivers/gpu/drm/i915/i915_gem_gtt.c
drivers/gpu/drm/i915/i915_gem_gtt.h
drivers/gpu/drm/i915/i915_gem_stolen.c
include/drm/intel-gtt.h

index 0f7d28a98b9a0ad926a99d82221b5cff4b031508..9702c78f458debc919beaffbef5f6ab9bba1b25d 100644 (file)
@@ -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;
index bc2b4421cbd6645a91f342ba6857d1d7153196c5..00520f27bea611b41d078f0060f968d6583b2f9d 100644 (file)
@@ -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");
index 0055b8567a437e89f29186f0bbb9ac5b6815d346..9e91d7e6149c7874898ed70b16e272b8a0149487 100644 (file)
@@ -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;
index 38ae6b228ca93eb9ca2378adad3e707338929823..0e9b99941946696ebe604caa3a86332f6937d991 100644 (file)
@@ -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,
index f49edecd66a37926308397145d1dccf7403caeb8..b3bf717cfc456dd4e84897d3ffcafcaffd504927 100644 (file)
@@ -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);