Commit 4f5fd91f authored by Tvrtko Ursulin's avatar Tvrtko Ursulin

drm/i915: Remove I915_READ16 and I915_WRITE16

Remove call sites in favour of uncore mmio accessors and remove the old
macros.
Signed-off-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190611104548.30545-6-tvrtko.ursulin@linux.intel.com
parent 5a31d30b
...@@ -986,10 +986,10 @@ i8xx_irq_enable(struct intel_engine_cs *engine) ...@@ -986,10 +986,10 @@ i8xx_irq_enable(struct intel_engine_cs *engine)
static void static void
i8xx_irq_disable(struct intel_engine_cs *engine) i8xx_irq_disable(struct intel_engine_cs *engine)
{ {
struct drm_i915_private *dev_priv = engine->i915; struct drm_i915_private *i915 = engine->i915;
dev_priv->irq_mask |= engine->irq_enable_mask; i915->irq_mask |= engine->irq_enable_mask;
I915_WRITE16(GEN2_IMR, dev_priv->irq_mask); intel_uncore_write16(&i915->uncore, GEN2_IMR, i915->irq_mask);
} }
static int static int
......
...@@ -826,6 +826,7 @@ static const struct file_operations i915_error_state_fops = { ...@@ -826,6 +826,7 @@ static const struct file_operations i915_error_state_fops = {
static int i915_frequency_info(struct seq_file *m, void *unused) static int i915_frequency_info(struct seq_file *m, void *unused)
{ {
struct drm_i915_private *dev_priv = node_to_i915(m->private); struct drm_i915_private *dev_priv = node_to_i915(m->private);
struct intel_uncore *uncore = &dev_priv->uncore;
struct intel_rps *rps = &dev_priv->gt_pm.rps; struct intel_rps *rps = &dev_priv->gt_pm.rps;
intel_wakeref_t wakeref; intel_wakeref_t wakeref;
int ret = 0; int ret = 0;
...@@ -833,8 +834,8 @@ static int i915_frequency_info(struct seq_file *m, void *unused) ...@@ -833,8 +834,8 @@ static int i915_frequency_info(struct seq_file *m, void *unused)
wakeref = intel_runtime_pm_get(dev_priv); wakeref = intel_runtime_pm_get(dev_priv);
if (IS_GEN(dev_priv, 5)) { if (IS_GEN(dev_priv, 5)) {
u16 rgvswctl = I915_READ16(MEMSWCTL); u16 rgvswctl = intel_uncore_read16(uncore, MEMSWCTL);
u16 rgvstat = I915_READ16(MEMSTAT_ILK); u16 rgvstat = intel_uncore_read16(uncore, MEMSTAT_ILK);
seq_printf(m, "Requested P-state: %d\n", (rgvswctl >> 8) & 0xf); seq_printf(m, "Requested P-state: %d\n", (rgvswctl >> 8) & 0xf);
seq_printf(m, "Requested VID: %d\n", rgvswctl & 0x3f); seq_printf(m, "Requested VID: %d\n", rgvswctl & 0x3f);
...@@ -1156,13 +1157,14 @@ static int i915_reset_info(struct seq_file *m, void *unused) ...@@ -1156,13 +1157,14 @@ static int i915_reset_info(struct seq_file *m, void *unused)
static int ironlake_drpc_info(struct seq_file *m) static int ironlake_drpc_info(struct seq_file *m)
{ {
struct drm_i915_private *dev_priv = node_to_i915(m->private); struct drm_i915_private *i915 = node_to_i915(m->private);
struct intel_uncore *uncore = &i915->uncore;
u32 rgvmodectl, rstdbyctl; u32 rgvmodectl, rstdbyctl;
u16 crstandvid; u16 crstandvid;
rgvmodectl = I915_READ(MEMMODECTL); rgvmodectl = intel_uncore_read(uncore, MEMMODECTL);
rstdbyctl = I915_READ(RSTDBYCTL); rstdbyctl = intel_uncore_read(uncore, RSTDBYCTL);
crstandvid = I915_READ16(CRSTANDVID); crstandvid = intel_uncore_read16(uncore, CRSTANDVID);
seq_printf(m, "HD boost: %s\n", yesno(rgvmodectl & MEMMODE_BOOST_EN)); seq_printf(m, "HD boost: %s\n", yesno(rgvmodectl & MEMMODE_BOOST_EN));
seq_printf(m, "Boost freq: %d\n", seq_printf(m, "Boost freq: %d\n",
...@@ -1745,6 +1747,7 @@ static const char *swizzle_string(unsigned swizzle) ...@@ -1745,6 +1747,7 @@ static const char *swizzle_string(unsigned swizzle)
static int i915_swizzle_info(struct seq_file *m, void *data) static int i915_swizzle_info(struct seq_file *m, void *data)
{ {
struct drm_i915_private *dev_priv = node_to_i915(m->private); struct drm_i915_private *dev_priv = node_to_i915(m->private);
struct intel_uncore *uncore = &dev_priv->uncore;
intel_wakeref_t wakeref; intel_wakeref_t wakeref;
wakeref = intel_runtime_pm_get(dev_priv); wakeref = intel_runtime_pm_get(dev_priv);
...@@ -1756,30 +1759,30 @@ static int i915_swizzle_info(struct seq_file *m, void *data) ...@@ -1756,30 +1759,30 @@ static int i915_swizzle_info(struct seq_file *m, void *data)
if (IS_GEN_RANGE(dev_priv, 3, 4)) { if (IS_GEN_RANGE(dev_priv, 3, 4)) {
seq_printf(m, "DDC = 0x%08x\n", seq_printf(m, "DDC = 0x%08x\n",
I915_READ(DCC)); intel_uncore_read(uncore, DCC));
seq_printf(m, "DDC2 = 0x%08x\n", seq_printf(m, "DDC2 = 0x%08x\n",
I915_READ(DCC2)); intel_uncore_read(uncore, DCC2));
seq_printf(m, "C0DRB3 = 0x%04x\n", seq_printf(m, "C0DRB3 = 0x%04x\n",
I915_READ16(C0DRB3)); intel_uncore_read16(uncore, C0DRB3));
seq_printf(m, "C1DRB3 = 0x%04x\n", seq_printf(m, "C1DRB3 = 0x%04x\n",
I915_READ16(C1DRB3)); intel_uncore_read16(uncore, C1DRB3));
} else if (INTEL_GEN(dev_priv) >= 6) { } else if (INTEL_GEN(dev_priv) >= 6) {
seq_printf(m, "MAD_DIMM_C0 = 0x%08x\n", seq_printf(m, "MAD_DIMM_C0 = 0x%08x\n",
I915_READ(MAD_DIMM_C0)); intel_uncore_read(uncore, MAD_DIMM_C0));
seq_printf(m, "MAD_DIMM_C1 = 0x%08x\n", seq_printf(m, "MAD_DIMM_C1 = 0x%08x\n",
I915_READ(MAD_DIMM_C1)); intel_uncore_read(uncore, MAD_DIMM_C1));
seq_printf(m, "MAD_DIMM_C2 = 0x%08x\n", seq_printf(m, "MAD_DIMM_C2 = 0x%08x\n",
I915_READ(MAD_DIMM_C2)); intel_uncore_read(uncore, MAD_DIMM_C2));
seq_printf(m, "TILECTL = 0x%08x\n", seq_printf(m, "TILECTL = 0x%08x\n",
I915_READ(TILECTL)); intel_uncore_read(uncore, TILECTL));
if (INTEL_GEN(dev_priv) >= 8) if (INTEL_GEN(dev_priv) >= 8)
seq_printf(m, "GAMTARBMODE = 0x%08x\n", seq_printf(m, "GAMTARBMODE = 0x%08x\n",
I915_READ(GAMTARBMODE)); intel_uncore_read(uncore, GAMTARBMODE));
else else
seq_printf(m, "ARB_MODE = 0x%08x\n", seq_printf(m, "ARB_MODE = 0x%08x\n",
I915_READ(ARB_MODE)); intel_uncore_read(uncore, ARB_MODE));
seq_printf(m, "DISP_ARB_CTL = 0x%08x\n", seq_printf(m, "DISP_ARB_CTL = 0x%08x\n",
I915_READ(DISP_ARB_CTL)); intel_uncore_read(uncore, DISP_ARB_CTL));
} }
if (dev_priv->quirks & QUIRK_PIN_SWIZZLED_PAGES) if (dev_priv->quirks & QUIRK_PIN_SWIZZLED_PAGES)
......
...@@ -2838,9 +2838,6 @@ extern void intel_display_print_error_state(struct drm_i915_error_state_buf *e, ...@@ -2838,9 +2838,6 @@ extern void intel_display_print_error_state(struct drm_i915_error_state_buf *e,
#define __I915_REG_OP(op__, dev_priv__, ...) \ #define __I915_REG_OP(op__, dev_priv__, ...) \
intel_uncore_##op__(&(dev_priv__)->uncore, __VA_ARGS__) intel_uncore_##op__(&(dev_priv__)->uncore, __VA_ARGS__)
#define I915_READ16(reg__) __I915_REG_OP(read16, dev_priv, (reg__))
#define I915_WRITE16(reg__, val__) __I915_REG_OP(write16, dev_priv, (reg__), (val__))
#define I915_READ(reg__) __I915_REG_OP(read, dev_priv, (reg__)) #define I915_READ(reg__) __I915_REG_OP(read, dev_priv, (reg__))
#define I915_WRITE(reg__, val__) __I915_REG_OP(write, dev_priv, (reg__), (val__)) #define I915_WRITE(reg__, val__) __I915_REG_OP(write, dev_priv, (reg__), (val__))
......
...@@ -1576,7 +1576,8 @@ static void capture_uc_state(struct i915_gpu_state *error) ...@@ -1576,7 +1576,8 @@ static void capture_uc_state(struct i915_gpu_state *error)
/* Capture all registers which don't fit into another category. */ /* Capture all registers which don't fit into another category. */
static void capture_reg_state(struct i915_gpu_state *error) static void capture_reg_state(struct i915_gpu_state *error)
{ {
struct drm_i915_private *dev_priv = error->i915; struct drm_i915_private *i915 = error->i915;
struct intel_uncore *uncore = &i915->uncore;
int i; int i;
/* General organization /* General organization
...@@ -1588,71 +1589,84 @@ static void capture_reg_state(struct i915_gpu_state *error) ...@@ -1588,71 +1589,84 @@ static void capture_reg_state(struct i915_gpu_state *error)
*/ */
/* 1: Registers specific to a single generation */ /* 1: Registers specific to a single generation */
if (IS_VALLEYVIEW(dev_priv)) { if (IS_VALLEYVIEW(i915)) {
error->gtier[0] = I915_READ(GTIER); error->gtier[0] = intel_uncore_read(uncore, GTIER);
error->ier = I915_READ(VLV_IER); error->ier = intel_uncore_read(uncore, VLV_IER);
error->forcewake = I915_READ_FW(FORCEWAKE_VLV); error->forcewake = intel_uncore_read_fw(uncore, FORCEWAKE_VLV);
} }
if (IS_GEN(dev_priv, 7)) if (IS_GEN(i915, 7))
error->err_int = I915_READ(GEN7_ERR_INT); error->err_int = intel_uncore_read(uncore, GEN7_ERR_INT);
if (INTEL_GEN(dev_priv) >= 8) { if (INTEL_GEN(i915) >= 8) {
error->fault_data0 = I915_READ(GEN8_FAULT_TLB_DATA0); error->fault_data0 = intel_uncore_read(uncore,
error->fault_data1 = I915_READ(GEN8_FAULT_TLB_DATA1); GEN8_FAULT_TLB_DATA0);
error->fault_data1 = intel_uncore_read(uncore,
GEN8_FAULT_TLB_DATA1);
} }
if (IS_GEN(dev_priv, 6)) { if (IS_GEN(i915, 6)) {
error->forcewake = I915_READ_FW(FORCEWAKE); error->forcewake = intel_uncore_read_fw(uncore, FORCEWAKE);
error->gab_ctl = I915_READ(GAB_CTL); error->gab_ctl = intel_uncore_read(uncore, GAB_CTL);
error->gfx_mode = I915_READ(GFX_MODE); error->gfx_mode = intel_uncore_read(uncore, GFX_MODE);
} }
/* 2: Registers which belong to multiple generations */ /* 2: Registers which belong to multiple generations */
if (INTEL_GEN(dev_priv) >= 7) if (INTEL_GEN(i915) >= 7)
error->forcewake = I915_READ_FW(FORCEWAKE_MT); error->forcewake = intel_uncore_read_fw(uncore, FORCEWAKE_MT);
if (INTEL_GEN(dev_priv) >= 6) { if (INTEL_GEN(i915) >= 6) {
error->derrmr = I915_READ(DERRMR); error->derrmr = intel_uncore_read(uncore, DERRMR);
error->error = I915_READ(ERROR_GEN6); error->error = intel_uncore_read(uncore, ERROR_GEN6);
error->done_reg = I915_READ(DONE_REG); error->done_reg = intel_uncore_read(uncore, DONE_REG);
} }
if (INTEL_GEN(dev_priv) >= 5) if (INTEL_GEN(i915) >= 5)
error->ccid = I915_READ(CCID(RENDER_RING_BASE)); error->ccid = intel_uncore_read(uncore, CCID(RENDER_RING_BASE));
/* 3: Feature specific registers */ /* 3: Feature specific registers */
if (IS_GEN_RANGE(dev_priv, 6, 7)) { if (IS_GEN_RANGE(i915, 6, 7)) {
error->gam_ecochk = I915_READ(GAM_ECOCHK); error->gam_ecochk = intel_uncore_read(uncore, GAM_ECOCHK);
error->gac_eco = I915_READ(GAC_ECO_BITS); error->gac_eco = intel_uncore_read(uncore, GAC_ECO_BITS);
} }
/* 4: Everything else */ /* 4: Everything else */
if (INTEL_GEN(dev_priv) >= 11) { if (INTEL_GEN(i915) >= 11) {
error->ier = I915_READ(GEN8_DE_MISC_IER); error->ier = intel_uncore_read(uncore, GEN8_DE_MISC_IER);
error->gtier[0] = I915_READ(GEN11_RENDER_COPY_INTR_ENABLE); error->gtier[0] =
error->gtier[1] = I915_READ(GEN11_VCS_VECS_INTR_ENABLE); intel_uncore_read(uncore,
error->gtier[2] = I915_READ(GEN11_GUC_SG_INTR_ENABLE); GEN11_RENDER_COPY_INTR_ENABLE);
error->gtier[3] = I915_READ(GEN11_GPM_WGBOXPERF_INTR_ENABLE); error->gtier[1] =
error->gtier[4] = I915_READ(GEN11_CRYPTO_RSVD_INTR_ENABLE); intel_uncore_read(uncore, GEN11_VCS_VECS_INTR_ENABLE);
error->gtier[5] = I915_READ(GEN11_GUNIT_CSME_INTR_ENABLE); error->gtier[2] =
intel_uncore_read(uncore, GEN11_GUC_SG_INTR_ENABLE);
error->gtier[3] =
intel_uncore_read(uncore,
GEN11_GPM_WGBOXPERF_INTR_ENABLE);
error->gtier[4] =
intel_uncore_read(uncore,
GEN11_CRYPTO_RSVD_INTR_ENABLE);
error->gtier[5] =
intel_uncore_read(uncore,
GEN11_GUNIT_CSME_INTR_ENABLE);
error->ngtier = 6; error->ngtier = 6;
} else if (INTEL_GEN(dev_priv) >= 8) { } else if (INTEL_GEN(i915) >= 8) {
error->ier = I915_READ(GEN8_DE_MISC_IER); error->ier = intel_uncore_read(uncore, GEN8_DE_MISC_IER);
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
error->gtier[i] = I915_READ(GEN8_GT_IER(i)); error->gtier[i] = intel_uncore_read(uncore,
GEN8_GT_IER(i));
error->ngtier = 4; error->ngtier = 4;
} else if (HAS_PCH_SPLIT(dev_priv)) { } else if (HAS_PCH_SPLIT(i915)) {
error->ier = I915_READ(DEIER); error->ier = intel_uncore_read(uncore, DEIER);
error->gtier[0] = I915_READ(GTIER); error->gtier[0] = intel_uncore_read(uncore, GTIER);
error->ngtier = 1; error->ngtier = 1;
} else if (IS_GEN(dev_priv, 2)) { } else if (IS_GEN(i915, 2)) {
error->ier = I915_READ16(GEN2_IER); error->ier = intel_uncore_read16(uncore, GEN2_IER);
} else if (!IS_VALLEYVIEW(dev_priv)) { } else if (!IS_VALLEYVIEW(i915)) {
error->ier = I915_READ(GEN2_IER); error->ier = intel_uncore_read(uncore, GEN2_IER);
} }
error->eir = I915_READ(EIR); error->eir = intel_uncore_read(uncore, EIR);
error->pgtbl_er = I915_READ(PGTBL_ER); error->pgtbl_er = intel_uncore_read(uncore, PGTBL_ER);
} }
static const char * static const char *
......
...@@ -1232,20 +1232,23 @@ int intel_get_crtc_scanline(struct intel_crtc *crtc) ...@@ -1232,20 +1232,23 @@ int intel_get_crtc_scanline(struct intel_crtc *crtc)
static void ironlake_rps_change_irq_handler(struct drm_i915_private *dev_priv) static void ironlake_rps_change_irq_handler(struct drm_i915_private *dev_priv)
{ {
struct intel_uncore *uncore = &dev_priv->uncore;
u32 busy_up, busy_down, max_avg, min_avg; u32 busy_up, busy_down, max_avg, min_avg;
u8 new_delay; u8 new_delay;
spin_lock(&mchdev_lock); spin_lock(&mchdev_lock);
I915_WRITE16(MEMINTRSTS, I915_READ(MEMINTRSTS)); intel_uncore_write16(uncore,
MEMINTRSTS,
intel_uncore_read(uncore, MEMINTRSTS));
new_delay = dev_priv->ips.cur_delay; new_delay = dev_priv->ips.cur_delay;
I915_WRITE16(MEMINTRSTS, MEMINT_EVAL_CHG); intel_uncore_write16(uncore, MEMINTRSTS, MEMINT_EVAL_CHG);
busy_up = I915_READ(RCPREVBSYTUPAVG); busy_up = intel_uncore_read(uncore, RCPREVBSYTUPAVG);
busy_down = I915_READ(RCPREVBSYTDNAVG); busy_down = intel_uncore_read(uncore, RCPREVBSYTDNAVG);
max_avg = I915_READ(RCBMAXAVG); max_avg = intel_uncore_read(uncore, RCBMAXAVG);
min_avg = I915_READ(RCBMINAVG); min_avg = intel_uncore_read(uncore, RCBMINAVG);
/* Handle RCS change request from hw */ /* Handle RCS change request from hw */
if (busy_up > max_avg) { if (busy_up > max_avg) {
...@@ -4324,7 +4327,9 @@ static int i8xx_irq_postinstall(struct drm_device *dev) ...@@ -4324,7 +4327,9 @@ static int i8xx_irq_postinstall(struct drm_device *dev)
struct intel_uncore *uncore = &dev_priv->uncore; struct intel_uncore *uncore = &dev_priv->uncore;
u16 enable_mask; u16 enable_mask;
I915_WRITE16(EMR, ~(I915_ERROR_PAGE_TABLE | intel_uncore_write16(uncore,
EMR,
~(I915_ERROR_PAGE_TABLE |
I915_ERROR_MEMORY_REFRESH)); I915_ERROR_MEMORY_REFRESH));
/* Unmask the interrupts that we always want on. */ /* Unmask the interrupts that we always want on. */
...@@ -4351,17 +4356,18 @@ static int i8xx_irq_postinstall(struct drm_device *dev) ...@@ -4351,17 +4356,18 @@ static int i8xx_irq_postinstall(struct drm_device *dev)
return 0; return 0;
} }
static void i8xx_error_irq_ack(struct drm_i915_private *dev_priv, static void i8xx_error_irq_ack(struct drm_i915_private *i915,
u16 *eir, u16 *eir_stuck) u16 *eir, u16 *eir_stuck)
{ {
struct intel_uncore *uncore = &i915->uncore;
u16 emr; u16 emr;
*eir = I915_READ16(EIR); *eir = intel_uncore_read16(uncore, EIR);
if (*eir) if (*eir)
I915_WRITE16(EIR, *eir); intel_uncore_write16(uncore, EIR, *eir);
*eir_stuck = I915_READ16(EIR); *eir_stuck = intel_uncore_read16(uncore, EIR);
if (*eir_stuck == 0) if (*eir_stuck == 0)
return; return;
...@@ -4375,9 +4381,9 @@ static void i8xx_error_irq_ack(struct drm_i915_private *dev_priv, ...@@ -4375,9 +4381,9 @@ static void i8xx_error_irq_ack(struct drm_i915_private *dev_priv,
* (or by a GPU reset) so we mask any bit that * (or by a GPU reset) so we mask any bit that
* remains set. * remains set.
*/ */
emr = I915_READ16(EMR); emr = intel_uncore_read16(uncore, EMR);
I915_WRITE16(EMR, 0xffff); intel_uncore_write16(uncore, EMR, 0xffff);
I915_WRITE16(EMR, emr | *eir_stuck); intel_uncore_write16(uncore, EMR, emr | *eir_stuck);
} }
static void i8xx_error_irq_handler(struct drm_i915_private *dev_priv, static void i8xx_error_irq_handler(struct drm_i915_private *dev_priv,
...@@ -4443,7 +4449,7 @@ static irqreturn_t i8xx_irq_handler(int irq, void *arg) ...@@ -4443,7 +4449,7 @@ static irqreturn_t i8xx_irq_handler(int irq, void *arg)
u16 eir = 0, eir_stuck = 0; u16 eir = 0, eir_stuck = 0;
u16 iir; u16 iir;
iir = I915_READ16(GEN2_IIR); iir = intel_uncore_read16(&dev_priv->uncore, GEN2_IIR);
if (iir == 0) if (iir == 0)
break; break;
...@@ -4456,7 +4462,7 @@ static irqreturn_t i8xx_irq_handler(int irq, void *arg) ...@@ -4456,7 +4462,7 @@ static irqreturn_t i8xx_irq_handler(int irq, void *arg)
if (iir & I915_MASTER_ERROR_INTERRUPT) if (iir & I915_MASTER_ERROR_INTERRUPT)
i8xx_error_irq_ack(dev_priv, &eir, &eir_stuck); i8xx_error_irq_ack(dev_priv, &eir, &eir_stuck);
I915_WRITE16(GEN2_IIR, iir); intel_uncore_write16(&dev_priv->uncore, GEN2_IIR, iir);
if (iir & I915_USER_INTERRUPT) if (iir & I915_USER_INTERRUPT)
intel_engine_breadcrumbs_irq(dev_priv->engine[RCS0]); intel_engine_breadcrumbs_irq(dev_priv->engine[RCS0]);
......
...@@ -191,8 +191,8 @@ static void i915_ironlake_get_mem_freq(struct drm_i915_private *dev_priv) ...@@ -191,8 +191,8 @@ static void i915_ironlake_get_mem_freq(struct drm_i915_private *dev_priv)
{ {
u16 ddrpll, csipll; u16 ddrpll, csipll;
ddrpll = I915_READ16(DDRMPLL1); ddrpll = intel_uncore_read16(&dev_priv->uncore, DDRMPLL1);
csipll = I915_READ16(CSIPLL0); csipll = intel_uncore_read16(&dev_priv->uncore, CSIPLL0);
switch (ddrpll & 0xff) { switch (ddrpll & 0xff) {
case 0xc: case 0xc:
...@@ -6432,26 +6432,27 @@ bool ironlake_set_drps(struct drm_i915_private *i915, u8 val) ...@@ -6432,26 +6432,27 @@ bool ironlake_set_drps(struct drm_i915_private *i915, u8 val)
static void ironlake_enable_drps(struct drm_i915_private *dev_priv) static void ironlake_enable_drps(struct drm_i915_private *dev_priv)
{ {
struct intel_uncore *uncore = &dev_priv->uncore;
u32 rgvmodectl; u32 rgvmodectl;
u8 fmax, fmin, fstart, vstart; u8 fmax, fmin, fstart, vstart;
spin_lock_irq(&mchdev_lock); spin_lock_irq(&mchdev_lock);
rgvmodectl = I915_READ(MEMMODECTL); rgvmodectl = intel_uncore_read(uncore, MEMMODECTL);
/* Enable temp reporting */ /* Enable temp reporting */
I915_WRITE16(PMMISC, I915_READ(PMMISC) | MCPPCE_EN); intel_uncore_write16(uncore, PMMISC, I915_READ(PMMISC) | MCPPCE_EN);
I915_WRITE16(TSC1, I915_READ(TSC1) | TSE); intel_uncore_write16(uncore, TSC1, I915_READ(TSC1) | TSE);
/* 100ms RC evaluation intervals */ /* 100ms RC evaluation intervals */
I915_WRITE(RCUPEI, 100000); intel_uncore_write(uncore, RCUPEI, 100000);
I915_WRITE(RCDNEI, 100000); intel_uncore_write(uncore, RCDNEI, 100000);
/* Set max/min thresholds to 90ms and 80ms respectively */ /* Set max/min thresholds to 90ms and 80ms respectively */
I915_WRITE(RCBMAXAVG, 90000); intel_uncore_write(uncore, RCBMAXAVG, 90000);
I915_WRITE(RCBMINAVG, 80000); intel_uncore_write(uncore, RCBMINAVG, 80000);
I915_WRITE(MEMIHYST, 1); intel_uncore_write(uncore, MEMIHYST, 1);
/* Set up min, max, and cur for interrupt handling */ /* Set up min, max, and cur for interrupt handling */
fmax = (rgvmodectl & MEMMODE_FMAX_MASK) >> MEMMODE_FMAX_SHIFT; fmax = (rgvmodectl & MEMMODE_FMAX_MASK) >> MEMMODE_FMAX_SHIFT;
...@@ -6459,8 +6460,8 @@ static void ironlake_enable_drps(struct drm_i915_private *dev_priv) ...@@ -6459,8 +6460,8 @@ static void ironlake_enable_drps(struct drm_i915_private *dev_priv)
fstart = (rgvmodectl & MEMMODE_FSTART_MASK) >> fstart = (rgvmodectl & MEMMODE_FSTART_MASK) >>
MEMMODE_FSTART_SHIFT; MEMMODE_FSTART_SHIFT;
vstart = (I915_READ(PXVFREQ(fstart)) & PXVFREQ_PX_MASK) >> vstart = (intel_uncore_read(uncore, PXVFREQ(fstart)) &
PXVFREQ_PX_SHIFT; PXVFREQ_PX_MASK) >> PXVFREQ_PX_SHIFT;
dev_priv->ips.fmax = fmax; /* IPS callback will increase this */ dev_priv->ips.fmax = fmax; /* IPS callback will increase this */
dev_priv->ips.fstart = fstart; dev_priv->ips.fstart = fstart;
...@@ -6472,53 +6473,66 @@ static void ironlake_enable_drps(struct drm_i915_private *dev_priv) ...@@ -6472,53 +6473,66 @@ static void ironlake_enable_drps(struct drm_i915_private *dev_priv)
DRM_DEBUG_DRIVER("fmax: %d, fmin: %d, fstart: %d\n", DRM_DEBUG_DRIVER("fmax: %d, fmin: %d, fstart: %d\n",
fmax, fmin, fstart); fmax, fmin, fstart);
I915_WRITE(MEMINTREN, MEMINT_CX_SUPR_EN | MEMINT_EVAL_CHG_EN); intel_uncore_write(uncore,
MEMINTREN,
MEMINT_CX_SUPR_EN | MEMINT_EVAL_CHG_EN);
/* /*
* Interrupts will be enabled in ironlake_irq_postinstall * Interrupts will be enabled in ironlake_irq_postinstall
*/ */
I915_WRITE(VIDSTART, vstart); intel_uncore_write(uncore, VIDSTART, vstart);
POSTING_READ(VIDSTART); intel_uncore_posting_read(uncore, VIDSTART);
rgvmodectl |= MEMMODE_SWMODE_EN; rgvmodectl |= MEMMODE_SWMODE_EN;
I915_WRITE(MEMMODECTL, rgvmodectl); intel_uncore_write(uncore, MEMMODECTL, rgvmodectl);
if (wait_for_atomic((I915_READ(MEMSWCTL) & MEMCTL_CMD_STS) == 0, 10)) if (wait_for_atomic((intel_uncore_read(uncore, MEMSWCTL) &
MEMCTL_CMD_STS) == 0, 10))
DRM_ERROR("stuck trying to change perf mode\n"); DRM_ERROR("stuck trying to change perf mode\n");
mdelay(1); mdelay(1);
ironlake_set_drps(dev_priv, fstart); ironlake_set_drps(dev_priv, fstart);
dev_priv->ips.last_count1 = I915_READ(DMIEC) + dev_priv->ips.last_count1 =
I915_READ(DDREC) + I915_READ(CSIEC); intel_uncore_read(uncore, DMIEC) +
intel_uncore_read(uncore, DDREC) +
intel_uncore_read(uncore, CSIEC);
dev_priv->ips.last_time1 = jiffies_to_msecs(jiffies); dev_priv->ips.last_time1 = jiffies_to_msecs(jiffies);
dev_priv->ips.last_count2 = I915_READ(GFXEC); dev_priv->ips.last_count2 = intel_uncore_read(uncore, GFXEC);
dev_priv->ips.last_time2 = ktime_get_raw_ns(); dev_priv->ips.last_time2 = ktime_get_raw_ns();
spin_unlock_irq(&mchdev_lock); spin_unlock_irq(&mchdev_lock);
} }
static void ironlake_disable_drps(struct drm_i915_private *dev_priv) static void ironlake_disable_drps(struct drm_i915_private *i915)
{ {
struct intel_uncore *uncore = &i915->uncore;
u16 rgvswctl; u16 rgvswctl;
spin_lock_irq(&mchdev_lock); spin_lock_irq(&mchdev_lock);
rgvswctl = I915_READ16(MEMSWCTL); rgvswctl = intel_uncore_read16(uncore, MEMSWCTL);
/* Ack interrupts, disable EFC interrupt */ /* Ack interrupts, disable EFC interrupt */
I915_WRITE(MEMINTREN, I915_READ(MEMINTREN) & ~MEMINT_EVAL_CHG_EN); intel_uncore_write(uncore,
I915_WRITE(MEMINTRSTS, MEMINT_EVAL_CHG); MEMINTREN,
I915_WRITE(DEIER, I915_READ(DEIER) & ~DE_PCU_EVENT); intel_uncore_read(uncore, MEMINTREN) &
I915_WRITE(DEIIR, DE_PCU_EVENT); ~MEMINT_EVAL_CHG_EN);
I915_WRITE(DEIMR, I915_READ(DEIMR) | DE_PCU_EVENT); intel_uncore_write(uncore, MEMINTRSTS, MEMINT_EVAL_CHG);
intel_uncore_write(uncore,
DEIER,
intel_uncore_read(uncore, DEIER) & ~DE_PCU_EVENT);
intel_uncore_write(uncore, DEIIR, DE_PCU_EVENT);
intel_uncore_write(uncore,
DEIMR,
intel_uncore_read(uncore, DEIMR) | DE_PCU_EVENT);
/* Go back to the starting frequency */ /* Go back to the starting frequency */
ironlake_set_drps(dev_priv, dev_priv->ips.fstart); ironlake_set_drps(i915, i915->ips.fstart);
mdelay(1); mdelay(1);
rgvswctl |= MEMCTL_CMD_STS; rgvswctl |= MEMCTL_CMD_STS;
I915_WRITE(MEMSWCTL, rgvswctl); intel_uncore_write(uncore, MEMSWCTL, rgvswctl);
mdelay(1); mdelay(1);
spin_unlock_irq(&mchdev_lock); spin_unlock_irq(&mchdev_lock);
...@@ -9504,16 +9518,21 @@ static void g4x_init_clock_gating(struct drm_i915_private *dev_priv) ...@@ -9504,16 +9518,21 @@ static void g4x_init_clock_gating(struct drm_i915_private *dev_priv)
static void i965gm_init_clock_gating(struct drm_i915_private *dev_priv) static void i965gm_init_clock_gating(struct drm_i915_private *dev_priv)
{ {
I915_WRITE(RENCLK_GATE_D1, I965_RCC_CLOCK_GATE_DISABLE); struct intel_uncore *uncore = &dev_priv->uncore;
I915_WRITE(RENCLK_GATE_D2, 0);
I915_WRITE(DSPCLK_GATE_D, 0); intel_uncore_write(uncore, RENCLK_GATE_D1, I965_RCC_CLOCK_GATE_DISABLE);
I915_WRITE(RAMCLK_GATE_D, 0); intel_uncore_write(uncore, RENCLK_GATE_D2, 0);
I915_WRITE16(DEUC, 0); intel_uncore_write(uncore, DSPCLK_GATE_D, 0);
I915_WRITE(MI_ARB_STATE, intel_uncore_write(uncore, RAMCLK_GATE_D, 0);
intel_uncore_write16(uncore, DEUC, 0);
intel_uncore_write(uncore,
MI_ARB_STATE,
_MASKED_BIT_ENABLE(MI_ARB_DISPLAY_TRICKLE_FEED_DISABLE)); _MASKED_BIT_ENABLE(MI_ARB_DISPLAY_TRICKLE_FEED_DISABLE));
/* WaDisable_RenderCache_OperationalFlush:gen4 */ /* WaDisable_RenderCache_OperationalFlush:gen4 */
I915_WRITE(CACHE_MODE_0, _MASKED_BIT_DISABLE(RC_OP_FLUSH_ENABLE)); intel_uncore_write(uncore,
CACHE_MODE_0,
_MASKED_BIT_DISABLE(RC_OP_FLUSH_ENABLE));
} }
static void i965g_init_clock_gating(struct drm_i915_private *dev_priv) static void i965g_init_clock_gating(struct drm_i915_private *dev_priv)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment