drm/i915: Make PAT macros more robust
authorMichal Wajdeczko <michal.wajdeczko@intel.com>
Fri, 8 Sep 2017 16:11:30 +0000 (16:11 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Fri, 8 Sep 2017 20:12:17 +0000 (21:12 +0100)
Macro params shall be wrapped into () to avoid unexpected results.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20170908161130.22424-1-michal.wajdeczko@intel.com
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
drivers/gpu/drm/i915/i915_gem_gtt.h
drivers/gpu/drm/i915/i915_reg.h

index b4e3aa7c0ce197f5ae7cfb7ed79c08e73609ee08..d9a076a2673ac13deda7c20e7f4ec6694fb8802e 100644 (file)
@@ -132,7 +132,7 @@ typedef u64 gen8_ppgtt_pml4e_t;
 #define PPAT_DISPLAY_ELLC_INDEX                _PAGE_PCD /* WT eLLC */
 
 #define CHV_PPAT_SNOOP                 (1<<6)
-#define GEN8_PPAT_AGE(x)               (x<<4)
+#define GEN8_PPAT_AGE(x)               ((x)<<4)
 #define GEN8_PPAT_LLCeLLC              (3<<2)
 #define GEN8_PPAT_LLCELLC              (2<<2)
 #define GEN8_PPAT_LLC                  (1<<2)
index 9a73ea0a32937d2fe9a82bf1a71b8d51d98e70c6..0b03260a3967d4c69d3d661303a291ad500460c9 100644 (file)
@@ -2336,7 +2336,7 @@ enum i915_power_well_id {
 #define DONE_REG               _MMIO(0x40b0)
 #define GEN8_PRIVATE_PAT_LO    _MMIO(0x40e0)
 #define GEN8_PRIVATE_PAT_HI    _MMIO(0x40e0 + 4)
-#define GEN10_PAT_INDEX(index) _MMIO(0x40e0 + index*4)
+#define GEN10_PAT_INDEX(index) _MMIO(0x40e0 + (index)*4)
 #define BSD_HWS_PGA_GEN7       _MMIO(0x04180)
 #define BLT_HWS_PGA_GEN7       _MMIO(0x04280)
 #define VEBOX_HWS_PGA_GEN7     _MMIO(0x04380)