Skip to content

Commit 62afef2

Browse files
committed
drm/i915/rkl: RKL uses ABOX0 for pixel transfers
Rocket Lake uses the same 'abox0' mechanism to handle pixel data transfers from memory that gen11 platforms used, rather than the abox1/abox2 interfaces used by TGL/DG1. For the most part this is a hardware implementation detail that's transparent to driver software, but we do have to program a couple of tuning registers (MBUS_ABOX_CTL and BW_BUDDY registers) according to which ABOX instances are used by a platform. Let's track the platform's ABOX usage in the device info structure and use that to determine which instances of these registers to program. As an exception to this rule is that even though TGL/DG1 use ABOX1+ABOX2 for data transfers, we're still directed to program the ABOX_CTL register for ABOX0; so we'll handle that as a special case. v2: - Store the mask of platform-specific abox registers in the device info structure. - Add a TLB_REQ_TIMER() helper macro. (Aditya) v3: - Squash ABOX and BW_BUDDY patches together and use a single mask for both of them, plus a special-case for programming the ABOX0 instance on all gen12. (Ville) Bspec: 50096 Bspec: 49218 Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Cc: Aditya Swarup <aditya.swarup@intel.com> Signed-off-by: Matt Roper <matthew.d.roper@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200606025740.3308880-2-matthew.d.roper@intel.com Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
1 parent 94ed475 commit 62afef2

File tree

4 files changed

+52
-32
lines changed

4 files changed

+52
-32
lines changed

drivers/gpu/drm/i915/display/intel_display_power.c

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4760,7 +4760,8 @@ static void gen9_dbuf_disable(struct drm_i915_private *dev_priv)
47604760

47614761
static void icl_mbus_init(struct drm_i915_private *dev_priv)
47624762
{
4763-
u32 mask, val;
4763+
unsigned long abox_regs = INTEL_INFO(dev_priv)->abox_mask;
4764+
u32 mask, val, i;
47644765

47654766
mask = MBUS_ABOX_BT_CREDIT_POOL1_MASK |
47664767
MBUS_ABOX_BT_CREDIT_POOL2_MASK |
@@ -4771,11 +4772,16 @@ static void icl_mbus_init(struct drm_i915_private *dev_priv)
47714772
MBUS_ABOX_B_CREDIT(1) |
47724773
MBUS_ABOX_BW_CREDIT(1);
47734774

4774-
intel_de_rmw(dev_priv, MBUS_ABOX_CTL, mask, val);
4775-
if (INTEL_GEN(dev_priv) >= 12) {
4776-
intel_de_rmw(dev_priv, MBUS_ABOX1_CTL, mask, val);
4777-
intel_de_rmw(dev_priv, MBUS_ABOX2_CTL, mask, val);
4778-
}
4775+
/*
4776+
* gen12 platforms that use abox1 and abox2 for pixel data reads still
4777+
* expect us to program the abox_ctl0 register as well, even though
4778+
* we don't have to program other instance-0 registers like BW_BUDDY.
4779+
*/
4780+
if (IS_GEN(dev_priv, 12))
4781+
abox_regs |= BIT(0);
4782+
4783+
for_each_set_bit(i, &abox_regs, sizeof(abox_regs))
4784+
intel_de_rmw(dev_priv, MBUS_ABOX_CTL(i), mask, val);
47794785
}
47804786

47814787
static void hsw_assert_cdclk(struct drm_i915_private *dev_priv)
@@ -5254,37 +5260,36 @@ static void tgl_bw_buddy_init(struct drm_i915_private *dev_priv)
52545260
enum intel_dram_type type = dev_priv->dram_info.type;
52555261
u8 num_channels = dev_priv->dram_info.num_channels;
52565262
const struct buddy_page_mask *table;
5257-
int i;
5263+
unsigned long abox_mask = INTEL_INFO(dev_priv)->abox_mask;
5264+
int config, i;
52585265

52595266
if (IS_TGL_REVID(dev_priv, TGL_REVID_A0, TGL_REVID_B0))
52605267
/* Wa_1409767108: tgl */
52615268
table = wa_1409767108_buddy_page_masks;
52625269
else
52635270
table = tgl_buddy_page_masks;
52645271

5265-
for (i = 0; table[i].page_mask != 0; i++)
5266-
if (table[i].num_channels == num_channels &&
5267-
table[i].type == type)
5272+
for (config = 0; table[config].page_mask != 0; config++)
5273+
if (table[config].num_channels == num_channels &&
5274+
table[config].type == type)
52685275
break;
52695276

5270-
if (table[i].page_mask == 0) {
5277+
if (table[config].page_mask == 0) {
52715278
drm_dbg(&dev_priv->drm,
52725279
"Unknown memory configuration; disabling address buddy logic.\n");
5273-
intel_de_write(dev_priv, BW_BUDDY1_CTL, BW_BUDDY_DISABLE);
5274-
intel_de_write(dev_priv, BW_BUDDY2_CTL, BW_BUDDY_DISABLE);
5280+
for_each_set_bit(i, &abox_mask, sizeof(abox_mask))
5281+
intel_de_write(dev_priv, BW_BUDDY_CTL(i),
5282+
BW_BUDDY_DISABLE);
52755283
} else {
5276-
intel_de_write(dev_priv, BW_BUDDY1_PAGE_MASK,
5277-
table[i].page_mask);
5278-
intel_de_write(dev_priv, BW_BUDDY2_PAGE_MASK,
5279-
table[i].page_mask);
5280-
5281-
/* Wa_22010178259:tgl */
5282-
intel_de_rmw(dev_priv, BW_BUDDY1_CTL,
5283-
BW_BUDDY_TLB_REQ_TIMER_MASK,
5284-
REG_FIELD_PREP(BW_BUDDY_TLB_REQ_TIMER_MASK, 0x8));
5285-
intel_de_rmw(dev_priv, BW_BUDDY2_CTL,
5286-
BW_BUDDY_TLB_REQ_TIMER_MASK,
5287-
REG_FIELD_PREP(BW_BUDDY_TLB_REQ_TIMER_MASK, 0x8));
5284+
for_each_set_bit(i, &abox_mask, sizeof(abox_mask)) {
5285+
intel_de_write(dev_priv, BW_BUDDY_PAGE_MASK(i),
5286+
table[config].page_mask);
5287+
5288+
/* Wa_22010178259:tgl,rkl */
5289+
intel_de_rmw(dev_priv, BW_BUDDY_CTL(i),
5290+
BW_BUDDY_TLB_REQ_TIMER_MASK,
5291+
BW_BUDDY_TLB_REQ_TIMER(0x8));
5292+
}
52885293
}
52895294
}
52905295

drivers/gpu/drm/i915/i915_pci.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,7 @@ static const struct intel_device_info cnl_info = {
804804
#define GEN11_FEATURES \
805805
GEN10_FEATURES, \
806806
GEN11_DEFAULT_PAGE_SIZES, \
807+
.abox_mask = BIT(0), \
807808
.cpu_transcoder_mask = BIT(TRANSCODER_A) | BIT(TRANSCODER_B) | \
808809
BIT(TRANSCODER_C) | BIT(TRANSCODER_EDP) | \
809810
BIT(TRANSCODER_DSI_0) | BIT(TRANSCODER_DSI_1), \
@@ -847,6 +848,7 @@ static const struct intel_device_info ehl_info = {
847848
#define GEN12_FEATURES \
848849
GEN11_FEATURES, \
849850
GEN(12), \
851+
.abox_mask = GENMASK(2, 1), \
850852
.pipe_mask = BIT(PIPE_A) | BIT(PIPE_B) | BIT(PIPE_C) | BIT(PIPE_D), \
851853
.cpu_transcoder_mask = BIT(TRANSCODER_A) | BIT(TRANSCODER_B) | \
852854
BIT(TRANSCODER_C) | BIT(TRANSCODER_D) | \
@@ -882,6 +884,7 @@ static const struct intel_device_info tgl_info = {
882884
static const struct intel_device_info rkl_info = {
883885
GEN12_FEATURES,
884886
PLATFORM(INTEL_ROCKETLAKE),
887+
.abox_mask = BIT(0),
885888
.pipe_mask = BIT(PIPE_A) | BIT(PIPE_B) | BIT(PIPE_C),
886889
.cpu_transcoder_mask = BIT(TRANSCODER_A) | BIT(TRANSCODER_B) |
887890
BIT(TRANSCODER_C),

drivers/gpu/drm/i915/i915_reg.h

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2879,9 +2879,12 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
28792879
#define LM_FIFO_WATERMARK 0x0000001F
28802880
#define MI_ARB_STATE _MMIO(0x20e4) /* 915+ only */
28812881

2882-
#define MBUS_ABOX_CTL _MMIO(0x45038)
2883-
#define MBUS_ABOX1_CTL _MMIO(0x45048)
2884-
#define MBUS_ABOX2_CTL _MMIO(0x4504C)
2882+
#define _MBUS_ABOX0_CTL 0x45038
2883+
#define _MBUS_ABOX1_CTL 0x45048
2884+
#define _MBUS_ABOX2_CTL 0x4504C
2885+
#define MBUS_ABOX_CTL(x) _MMIO(_PICK(x, _MBUS_ABOX0_CTL, \
2886+
_MBUS_ABOX1_CTL, \
2887+
_MBUS_ABOX2_CTL))
28852888
#define MBUS_ABOX_BW_CREDIT_MASK (3 << 20)
28862889
#define MBUS_ABOX_BW_CREDIT(x) ((x) << 20)
28872890
#define MBUS_ABOX_B_CREDIT_MASK (0xF << 16)
@@ -7853,13 +7856,20 @@ enum {
78537856
#define WAIT_FOR_PCH_RESET_ACK (1 << 1)
78547857
#define WAIT_FOR_PCH_FLR_ACK (1 << 0)
78557858

7856-
#define BW_BUDDY1_CTL _MMIO(0x45140)
7857-
#define BW_BUDDY2_CTL _MMIO(0x45150)
7859+
#define _BW_BUDDY0_CTL 0x45130
7860+
#define _BW_BUDDY1_CTL 0x45140
7861+
#define BW_BUDDY_CTL(x) _MMIO(_PICK_EVEN(x, \
7862+
_BW_BUDDY0_CTL, \
7863+
_BW_BUDDY1_CTL))
78587864
#define BW_BUDDY_DISABLE REG_BIT(31)
78597865
#define BW_BUDDY_TLB_REQ_TIMER_MASK REG_GENMASK(21, 16)
7866+
#define BW_BUDDY_TLB_REQ_TIMER(x) REG_FIELD_PREP(BW_BUDDY_TLB_REQ_TIMER_MASK, x)
78607867

7861-
#define BW_BUDDY1_PAGE_MASK _MMIO(0x45144)
7862-
#define BW_BUDDY2_PAGE_MASK _MMIO(0x45154)
7868+
#define _BW_BUDDY0_PAGE_MASK 0x45134
7869+
#define _BW_BUDDY1_PAGE_MASK 0x45144
7870+
#define BW_BUDDY_PAGE_MASK(x) _MMIO(_PICK_EVEN(x, \
7871+
_BW_BUDDY0_PAGE_MASK, \
7872+
_BW_BUDDY1_PAGE_MASK))
78637873

78647874
#define HSW_NDE_RSTWRN_OPT _MMIO(0x46408)
78657875
#define RESET_PCH_HANDSHAKE_ENABLE (1 << 4)

drivers/gpu/drm/i915/intel_device_info.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ struct intel_device_info {
175175
u8 pipe_mask;
176176
u8 cpu_transcoder_mask;
177177

178+
u8 abox_mask;
179+
178180
#define DEFINE_FLAG(name) u8 name:1
179181
DEV_INFO_FOR_EACH_FLAG(DEFINE_FLAG);
180182
#undef DEFINE_FLAG

0 commit comments

Comments
 (0)