Skip to content

Commit 1d42871

Browse files
committed
Merge tag 'drm-fixes-2020-07-03' of git://anongit.freedesktop.org/drm/drm
Pull drm fixes from Dave Airlie: "Pretty usual rc4 pull: two usual amdgpu, i915 pulls, and some misc arm driver fixes. The bigger bit is including the asm sources for some GPU shaders that were contained in the i915 driver, otherwise it's pretty much business as usual. dma-buf: - fix a use-after-free bug amdgpu: - Fix for vega20 boards without RAS support - DC bandwidth revalidation fix - Fix Renoir vram info fetching - Fix hwmon freq printing i915: - GVT fixes - Two missed MMIO handler fixes for SKL/CFL - Fix mask register bits check - Fix one lockdep error for debugfs entry access - Include asm sources for render cache clear batches msm: - memleak fix - display block fix - address space fixes exynos: - error value and reference count fix - error print removal sun4i: - remove HPD polling" * tag 'drm-fixes-2020-07-03' of git://anongit.freedesktop.org/drm/drm: (22 commits) drm/amdgpu: use %u rather than %d for sclk/mclk drm/amdgpu/atomfirmware: fix vram_info fetching for renoir drm/amd/display: Only revalidate bandwidth on medium and fast updates drm: sun4i: hdmi: Remove extra HPD polling drm/i915: Include asm sources for {ivb, hsw}_clear_kernel.c drm/exynos: fix ref count leak in mic_pre_enable drm/exynos: Properly propagate return value in drm_iommu_attach_device() drm/exynos: Remove dev_err() on platform_get_irq() failure drm/amd/powerplay: Fix NULL dereference in lock_bus() on Vega20 w/o RAS dma-buf: Move dma_buf_release() from fops to dentry_ops drm/msm: Fix up the rest of the messed up address sizes drm/msm: Fix setup of a6xx create_address_space. drm/msm: Fix address space size after refactor. drm/i915/gvt: Use GFP_ATOMIC instead of GFP_KERNEL in atomic context drm/i915/gvt: Fix incorrect check of enabled bits in mask registers drm/i915/gvt: Fix two CFL MMIO handling caused by regression. drm/i915/gvt: Add one missing MMIO handler for D_SKL_PLUS drm/msm: Fix 0xfffflub in "Refactor address space initialization" drm/msm/dpu: allow initialization of encoder locks during encoder init drm/msm/dpu: fix error return code in dpu_encoder_init ...
2 parents cdd3bb5 + 1298a54 commit 1d42871

File tree

25 files changed

+373
-76
lines changed

25 files changed

+373
-76
lines changed

drivers/dma-buf/dma-buf.c

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -54,37 +54,11 @@ static char *dmabuffs_dname(struct dentry *dentry, char *buffer, int buflen)
5454
dentry->d_name.name, ret > 0 ? name : "");
5555
}
5656

57-
static const struct dentry_operations dma_buf_dentry_ops = {
58-
.d_dname = dmabuffs_dname,
59-
};
60-
61-
static struct vfsmount *dma_buf_mnt;
62-
63-
static int dma_buf_fs_init_context(struct fs_context *fc)
64-
{
65-
struct pseudo_fs_context *ctx;
66-
67-
ctx = init_pseudo(fc, DMA_BUF_MAGIC);
68-
if (!ctx)
69-
return -ENOMEM;
70-
ctx->dops = &dma_buf_dentry_ops;
71-
return 0;
72-
}
73-
74-
static struct file_system_type dma_buf_fs_type = {
75-
.name = "dmabuf",
76-
.init_fs_context = dma_buf_fs_init_context,
77-
.kill_sb = kill_anon_super,
78-
};
79-
80-
static int dma_buf_release(struct inode *inode, struct file *file)
57+
static void dma_buf_release(struct dentry *dentry)
8158
{
8259
struct dma_buf *dmabuf;
8360

84-
if (!is_dma_buf_file(file))
85-
return -EINVAL;
86-
87-
dmabuf = file->private_data;
61+
dmabuf = dentry->d_fsdata;
8862

8963
BUG_ON(dmabuf->vmapping_counter);
9064

@@ -110,9 +84,32 @@ static int dma_buf_release(struct inode *inode, struct file *file)
11084
module_put(dmabuf->owner);
11185
kfree(dmabuf->name);
11286
kfree(dmabuf);
87+
}
88+
89+
static const struct dentry_operations dma_buf_dentry_ops = {
90+
.d_dname = dmabuffs_dname,
91+
.d_release = dma_buf_release,
92+
};
93+
94+
static struct vfsmount *dma_buf_mnt;
95+
96+
static int dma_buf_fs_init_context(struct fs_context *fc)
97+
{
98+
struct pseudo_fs_context *ctx;
99+
100+
ctx = init_pseudo(fc, DMA_BUF_MAGIC);
101+
if (!ctx)
102+
return -ENOMEM;
103+
ctx->dops = &dma_buf_dentry_ops;
113104
return 0;
114105
}
115106

107+
static struct file_system_type dma_buf_fs_type = {
108+
.name = "dmabuf",
109+
.init_fs_context = dma_buf_fs_init_context,
110+
.kill_sb = kill_anon_super,
111+
};
112+
116113
static int dma_buf_mmap_internal(struct file *file, struct vm_area_struct *vma)
117114
{
118115
struct dma_buf *dmabuf;
@@ -412,7 +409,6 @@ static void dma_buf_show_fdinfo(struct seq_file *m, struct file *file)
412409
}
413410

414411
static const struct file_operations dma_buf_fops = {
415-
.release = dma_buf_release,
416412
.mmap = dma_buf_mmap_internal,
417413
.llseek = dma_buf_llseek,
418414
.poll = dma_buf_poll,

drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ amdgpu_atomfirmware_get_vram_info(struct amdgpu_device *adev,
204204
(mode_info->atom_context->bios + data_offset);
205205
switch (crev) {
206206
case 11:
207+
case 12:
207208
mem_channel_number = igp_info->v11.umachannelnumber;
208209
/* channel width is 64 */
209210
if (vram_width)

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2784,7 +2784,7 @@ static ssize_t amdgpu_hwmon_show_sclk(struct device *dev,
27842784
if (r)
27852785
return r;
27862786

2787-
return snprintf(buf, PAGE_SIZE, "%d\n", sclk * 10 * 1000);
2787+
return snprintf(buf, PAGE_SIZE, "%u\n", sclk * 10 * 1000);
27882788
}
27892789

27902790
static ssize_t amdgpu_hwmon_show_sclk_label(struct device *dev,
@@ -2819,7 +2819,7 @@ static ssize_t amdgpu_hwmon_show_mclk(struct device *dev,
28192819
if (r)
28202820
return r;
28212821

2822-
return snprintf(buf, PAGE_SIZE, "%d\n", mclk * 10 * 1000);
2822+
return snprintf(buf, PAGE_SIZE, "%u\n", mclk * 10 * 1000);
28232823
}
28242824

28252825
static ssize_t amdgpu_hwmon_show_mclk_label(struct device *dev,

drivers/gpu/drm/amd/display/dc/core/dc.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2538,10 +2538,12 @@ void dc_commit_updates_for_stream(struct dc *dc,
25382538

25392539
copy_stream_update_to_stream(dc, context, stream, stream_update);
25402540

2541-
if (!dc->res_pool->funcs->validate_bandwidth(dc, context, false)) {
2542-
DC_ERROR("Mode validation failed for stream update!\n");
2543-
dc_release_state(context);
2544-
return;
2541+
if (update_type > UPDATE_TYPE_FAST) {
2542+
if (!dc->res_pool->funcs->validate_bandwidth(dc, context, false)) {
2543+
DC_ERROR("Mode validation failed for stream update!\n");
2544+
dc_release_state(context);
2545+
return;
2546+
}
25452547
}
25462548

25472549
commit_planes_for_stream(

drivers/gpu/drm/amd/powerplay/smumgr/vega20_smumgr.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -522,9 +522,11 @@ static int vega20_smu_init(struct pp_hwmgr *hwmgr)
522522
priv->smu_tables.entry[TABLE_ACTIVITY_MONITOR_COEFF].version = 0x01;
523523
priv->smu_tables.entry[TABLE_ACTIVITY_MONITOR_COEFF].size = sizeof(DpmActivityMonitorCoeffInt_t);
524524

525-
ret = smu_v11_0_i2c_eeprom_control_init(&adev->pm.smu_i2c);
526-
if (ret)
527-
goto err4;
525+
if (adev->psp.ras.ras) {
526+
ret = smu_v11_0_i2c_eeprom_control_init(&adev->pm.smu_i2c);
527+
if (ret)
528+
goto err4;
529+
}
528530

529531
return 0;
530532

@@ -560,7 +562,8 @@ static int vega20_smu_fini(struct pp_hwmgr *hwmgr)
560562
(struct vega20_smumgr *)(hwmgr->smu_backend);
561563
struct amdgpu_device *adev = hwmgr->adev;
562564

563-
smu_v11_0_i2c_eeprom_control_fini(&adev->pm.smu_i2c);
565+
if (adev->psp.ras.ras)
566+
smu_v11_0_i2c_eeprom_control_fini(&adev->pm.smu_i2c);
564567

565568
if (priv) {
566569
amdgpu_bo_free_kernel(&priv->smu_tables.entry[TABLE_PPTABLE].handle,

drivers/gpu/drm/exynos/exynos_drm_dma.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ static int drm_iommu_attach_device(struct drm_device *drm_dev,
6161
struct device *subdrv_dev, void **dma_priv)
6262
{
6363
struct exynos_drm_private *priv = drm_dev->dev_private;
64-
int ret;
64+
int ret = 0;
6565

6666
if (get_dma_ops(priv->dma_dev) != get_dma_ops(subdrv_dev)) {
6767
DRM_DEV_ERROR(subdrv_dev, "Device %s lacks support for IOMMU\n",
@@ -92,7 +92,7 @@ static int drm_iommu_attach_device(struct drm_device *drm_dev,
9292
if (ret)
9393
clear_dma_max_seg_size(subdrv_dev);
9494

95-
return 0;
95+
return ret;
9696
}
9797

9898
/*

drivers/gpu/drm/exynos/exynos_drm_g2d.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1498,7 +1498,6 @@ static int g2d_probe(struct platform_device *pdev)
14981498

14991499
g2d->irq = platform_get_irq(pdev, 0);
15001500
if (g2d->irq < 0) {
1501-
dev_err(dev, "failed to get irq\n");
15021501
ret = g2d->irq;
15031502
goto err_put_clk;
15041503
}

drivers/gpu/drm/exynos/exynos_drm_mic.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,10 @@ static void mic_pre_enable(struct drm_bridge *bridge)
269269
goto unlock;
270270

271271
ret = pm_runtime_get_sync(mic->dev);
272-
if (ret < 0)
272+
if (ret < 0) {
273+
pm_runtime_put_noidle(mic->dev);
273274
goto unlock;
275+
}
274276

275277
mic_set_path(mic, 1);
276278

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
ASM sources for auto generated shaders
2+
======================================
3+
4+
The i915/gt/hsw_clear_kernel.c and i915/gt/ivb_clear_kernel.c files contain
5+
pre-compiled batch chunks that will clear any residual render cache during
6+
context switch.
7+
8+
They are generated from their respective platform ASM files present on
9+
i915/gt/shaders/clear_kernel directory.
10+
11+
The generated .c files should never be modified directly. Instead, any modification
12+
needs to be done on the on their respective ASM files and build instructions below
13+
needes to be followed.
14+
15+
Building
16+
========
17+
18+
Environment
19+
-----------
20+
21+
IGT GPU tool scripts and the Mesa's i965 instruction assembler tool are used
22+
on building.
23+
24+
Please make sure your Mesa tool is compiled with "-Dtools=intel" and
25+
"-Ddri-drivers=i965", and run this script from IGT source root directory"
26+
27+
The instructions bellow assume:
28+
* IGT gpu tools source code is located on your home directory (~) as ~/igt
29+
* Mesa source code is located on your home directory (~) as ~/mesa
30+
and built under the ~/mesa/build directory
31+
* Linux kernel source code is under your home directory (~) as ~/linux
32+
33+
Instructions
34+
------------
35+
36+
~ $ cp ~/linux/drivers/gpu/drm/i915/gt/shaders/clear_kernel/ivb.asm \
37+
~/igt/lib/i915/shaders/clear_kernel/ivb.asm
38+
~ $ cd ~/igt
39+
igt $ ./scripts/generate_clear_kernel.sh -g ivb \
40+
-m ~/mesa/build/src/intel/tools/i965_asm
41+
42+
~ $ cp ~/linux/drivers/gpu/drm/i915/gt/shaders/clear_kernel/hsw.asm \
43+
~/igt/lib/i915/shaders/clear_kernel/hsw.asm
44+
~ $ cd ~/igt
45+
igt $ ./scripts/generate_clear_kernel.sh -g hsw \
46+
-m ~/mesa/build/src/intel/tools/i965_asm
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
// SPDX-License-Identifier: MIT
2+
/*
3+
* Copyright © 2020 Intel Corporation
4+
*/
5+
6+
/*
7+
* Kernel for PAVP buffer clear.
8+
*
9+
* 1. Clear all 64 GRF registers assigned to the kernel with designated value;
10+
* 2. Write 32x16 block of all "0" to render target buffer which indirectly clears
11+
* 512 bytes of Render Cache.
12+
*/
13+
14+
/* Store designated "clear GRF" value */
15+
mov(1) f0.1<1>UW g1.2<0,1,0>UW { align1 1N };
16+
17+
/**
18+
* Curbe Format
19+
*
20+
* DW 1.0 - Block Offset to write Render Cache
21+
* DW 1.1 [15:0] - Clear Word
22+
* DW 1.2 - Delay iterations
23+
* DW 1.3 - Enable Instrumentation (only for debug)
24+
* DW 1.4 - Rsvd (intended for context ID)
25+
* DW 1.5 - [31:16]:SliceCount, [15:0]:SubSlicePerSliceCount
26+
* DW 1.6 - Rsvd MBZ (intended for Enable Wait on Total Thread Count)
27+
* DW 1.7 - Rsvd MBZ (inteded for Total Thread Count)
28+
*
29+
* Binding Table
30+
*
31+
* BTI 0: 2D Surface to help clear L3 (Render/Data Cache)
32+
* BTI 1: Wait/Instrumentation Buffer
33+
* Size : (SliceCount * SubSliceCount * 16 EUs/SubSlice) rows * (16 threads/EU) cols (Format R32_UINT)
34+
* Expected to be initialized to 0 by driver/another kernel
35+
* Layout:
36+
* RowN: Histogram for EU-N: (SliceID*SubSlicePerSliceCount + SSID)*16 + EUID [assume max 16 EUs / SS]
37+
* Col-k[DW-k]: Threads Executed on ThreadID-k for EU-N
38+
*/
39+
add(1) g1.2<1>UD g1.2<0,1,0>UD 0x00000001UD { align1 1N }; /* Loop count to delay kernel: Init to (g1.2 + 1) */
40+
cmp.z.f0.0(1) null<1>UD g1.3<0,1,0>UD 0x00000000UD { align1 1N };
41+
(+f0.0) jmpi(1) 352D { align1 WE_all 1N };
42+
43+
/**
44+
* State Register has info on where this thread is running
45+
* IVB: sr0.0 :: [15:13]: MBZ, 12: HSID (Half-Slice ID), [11:8]EUID, [2:0] ThreadSlotID
46+
* HSW: sr0.0 :: 15: MBZ, [14:13]: SliceID, 12: HSID (Half-Slice ID), [11:8]EUID, [2:0] ThreadSlotID
47+
*/
48+
mov(8) g3<1>UD 0x00000000UD { align1 1Q };
49+
shr(1) g3<1>D sr0<0,1,0>D 12D { align1 1N };
50+
and(1) g3<1>D g3<0,1,0>D 1D { align1 1N }; /* g3 has HSID */
51+
shr(1) g3.1<1>D sr0<0,1,0>D 13D { align1 1N };
52+
and(1) g3.1<1>D g3.1<0,1,0>D 3D { align1 1N }; /* g3.1 has sliceID */
53+
mul(1) g3.5<1>D g3.1<0,1,0>D g1.10<0,1,0>UW { align1 1N };
54+
add(1) g3<1>D g3<0,1,0>D g3.5<0,1,0>D { align1 1N }; /* g3 = sliceID * SubSlicePerSliceCount + HSID */
55+
shr(1) g3.2<1>D sr0<0,1,0>D 8D { align1 1N };
56+
and(1) g3.2<1>D g3.2<0,1,0>D 15D { align1 1N }; /* g3.2 = EUID */
57+
mul(1) g3.4<1>D g3<0,1,0>D 16D { align1 1N };
58+
add(1) g3.2<1>D g3.2<0,1,0>D g3.4<0,1,0>D { align1 1N }; /* g3.2 now points to EU row number (Y-pixel = V address ) in instrumentation surf */
59+
60+
mov(8) g5<1>UD 0x00000000UD { align1 1Q };
61+
and(1) g3.3<1>D sr0<0,1,0>D 7D { align1 1N };
62+
mul(1) g3.3<1>D g3.3<0,1,0>D 4D { align1 1N };
63+
64+
mov(8) g4<1>UD g0<8,8,1>UD { align1 1Q }; /* Initialize message header with g0 */
65+
mov(1) g4<1>UD g3.3<0,1,0>UD { align1 1N }; /* Block offset */
66+
mov(1) g4.1<1>UD g3.2<0,1,0>UD { align1 1N }; /* Block offset */
67+
mov(1) g4.2<1>UD 0x00000003UD { align1 1N }; /* Block size (1 row x 4 bytes) */
68+
and(1) g4.3<1>UD g4.3<0,1,0>UW 0xffffffffUD { align1 1N };
69+
70+
/* Media block read to fetch current value at specified location in instrumentation buffer */
71+
sendc(8) g5<1>UD g4<8,8,1>F 0x02190001
72+
73+
render MsgDesc: media block read MsgCtrl = 0x0 Surface = 1 mlen 1 rlen 1 { align1 1Q };
74+
add(1) g5<1>D g5<0,1,0>D 1D { align1 1N };
75+
76+
/* Media block write for updated value at specified location in instrumentation buffer */
77+
sendc(8) g5<1>UD g4<8,8,1>F 0x040a8001
78+
render MsgDesc: media block write MsgCtrl = 0x0 Surface = 1 mlen 2 rlen 0 { align1 1Q };
79+
80+
/* Delay thread for specified parameter */
81+
add.nz.f0.0(1) g1.2<1>UD g1.2<0,1,0>UD -1D { align1 1N };
82+
(+f0.0) jmpi(1) -32D { align1 WE_all 1N };
83+
84+
/* Store designated "clear GRF" value */
85+
mov(1) f0.1<1>UW g1.2<0,1,0>UW { align1 1N };
86+
87+
/* Initialize looping parameters */
88+
mov(1) a0<1>D 0D { align1 1N }; /* Initialize a0.0:w=0 */
89+
mov(1) a0.4<1>W 127W { align1 1N }; /* Loop count. Each loop contains 16 GRF's */
90+
91+
/* Write 32x16 all "0" block */
92+
mov(8) g2<1>UD g0<8,8,1>UD { align1 1Q };
93+
mov(8) g127<1>UD g0<8,8,1>UD { align1 1Q };
94+
mov(2) g2<1>UD g1<2,2,1>UW { align1 1N };
95+
mov(1) g2.2<1>UD 0x000f000fUD { align1 1N }; /* Block size (16x16) */
96+
and(1) g2.3<1>UD g2.3<0,1,0>UW 0xffffffefUD { align1 1N };
97+
mov(16) g3<1>UD 0x00000000UD { align1 1H };
98+
mov(16) g4<1>UD 0x00000000UD { align1 1H };
99+
mov(16) g5<1>UD 0x00000000UD { align1 1H };
100+
mov(16) g6<1>UD 0x00000000UD { align1 1H };
101+
mov(16) g7<1>UD 0x00000000UD { align1 1H };
102+
mov(16) g8<1>UD 0x00000000UD { align1 1H };
103+
mov(16) g9<1>UD 0x00000000UD { align1 1H };
104+
mov(16) g10<1>UD 0x00000000UD { align1 1H };
105+
sendc(8) null<1>UD g2<8,8,1>F 0x120a8000
106+
render MsgDesc: media block write MsgCtrl = 0x0 Surface = 0 mlen 9 rlen 0 { align1 1Q };
107+
add(1) g2<1>UD g1<0,1,0>UW 0x0010UW { align1 1N };
108+
sendc(8) null<1>UD g2<8,8,1>F 0x120a8000
109+
render MsgDesc: media block write MsgCtrl = 0x0 Surface = 0 mlen 9 rlen 0 { align1 1Q };
110+
111+
/* Now, clear all GRF registers */
112+
add.nz.f0.0(1) a0.4<1>W a0.4<0,1,0>W -1W { align1 1N };
113+
mov(16) g[a0]<1>UW f0.1<0,1,0>UW { align1 1H };
114+
add(1) a0<1>D a0<0,1,0>D 32D { align1 1N };
115+
(+f0.0) jmpi(1) -64D { align1 WE_all 1N };
116+
117+
/* Terminante the thread */
118+
sendc(8) null<1>UD g127<8,8,1>F 0x82000010
119+
thread_spawner MsgDesc: mlen 1 rlen 0 { align1 1Q EOT };

0 commit comments

Comments
 (0)