Skip to content

Commit 59d4145

Browse files
committed
Merge tag 'drm-next-2022-01-14' of git://anongit.freedesktop.org/drm/drm
Pull drm fixes from Daniel Vetter: "drivers fixes: - i915 fixes for ttm backend + one pm wakelock fix - amdgpu fixes, fairly big pile of small things all over. Note this doesn't yet containe the fixed version of the otg sync patch that blew up - small driver fixes: meson, sun4i, vga16fb probe fix drm core fixes: - cma-buf heap locking - ttm compilation - self refresh helper state check - wrong error message in atomic helpers - mipi-dbi buffer mapping" * tag 'drm-next-2022-01-14' of git://anongit.freedesktop.org/drm/drm: (49 commits) drm/mipi-dbi: Fix source-buffer address in mipi_dbi_buf_copy drm: fix error found in some cases after the patch d1af5cd drm/ttm: fix compilation on ARCH=um dma-buf: cma_heap: Fix mutex locking section video: vga16fb: Only probe for EGA and VGA 16 color graphic cards drm/amdkfd: Fix ASIC name typos drm/amdkfd: Fix DQM asserts on Hawaii drm/amdgpu: Use correct VIEWPORT_DIMENSION for DCN2 drm/amd/pm: only send GmiPwrDnControl msg on master die (v3) drm/amdgpu: use spin_lock_irqsave to avoid deadlock by local interrupt drm/amdgpu: not return error on the init_apu_flags drm/amdkfd: Use prange->update_list head for remove_list drm/amdkfd: Use prange->list head for insert_list drm/amdkfd: make SPDX License expression more sound drm/amdkfd: Check for null pointer after calling kmemdup drm/amd/display: invalid parameter check in dmub_hpd_callback Revert "drm/amdgpu: Don't inherit GEM object VMAs in child process" drm/amd/display: reset dcn31 SMU mailbox on failures drm/amdkfd: use default_groups in kobj_type drm/amdgpu: use default_groups in kobj_type ...
2 parents 2aab34f + 4efdddb commit 59d4145

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+507
-358
lines changed

Documentation/devicetree/bindings/display/amlogic,meson-dw-hdmi.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ title: Amlogic specific extensions to the Synopsys Designware HDMI Controller
1010
maintainers:
1111
- Neil Armstrong <[email protected]>
1212

13+
allOf:
14+
- $ref: /schemas/sound/name-prefix.yaml#
15+
1316
description: |
1417
The Amlogic Meson Synopsys Designware Integration is composed of
1518
- A Synopsys DesignWare HDMI Controller IP
@@ -99,6 +102,8 @@ properties:
99102
"#sound-dai-cells":
100103
const: 0
101104

105+
sound-name-prefix: true
106+
102107
required:
103108
- compatible
104109
- reg

Documentation/devicetree/bindings/display/amlogic,meson-vpu.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ properties:
7878
interrupts:
7979
maxItems: 1
8080

81+
amlogic,canvas:
82+
description: should point to a canvas provider node
83+
$ref: /schemas/types.yaml#/definitions/phandle
84+
8185
power-domains:
8286
maxItems: 1
8387
description: phandle to the associated power domain
@@ -106,6 +110,7 @@ required:
106110
- port@1
107111
- "#address-cells"
108112
- "#size-cells"
113+
- amlogic,canvas
109114

110115
additionalProperties: false
111116

@@ -118,6 +123,7 @@ examples:
118123
interrupts = <3>;
119124
#address-cells = <1>;
120125
#size-cells = <0>;
126+
amlogic,canvas = <&canvas>;
121127
122128
/* CVBS VDAC output port */
123129
port@0 {

drivers/dma-buf/heaps/cma_heap.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,11 @@ static int cma_heap_dma_buf_begin_cpu_access(struct dma_buf *dmabuf,
124124
struct cma_heap_buffer *buffer = dmabuf->priv;
125125
struct dma_heap_attachment *a;
126126

127+
mutex_lock(&buffer->lock);
128+
127129
if (buffer->vmap_cnt)
128130
invalidate_kernel_vmap_range(buffer->vaddr, buffer->len);
129131

130-
mutex_lock(&buffer->lock);
131132
list_for_each_entry(a, &buffer->attachments, list) {
132133
if (!a->mapped)
133134
continue;
@@ -144,10 +145,11 @@ static int cma_heap_dma_buf_end_cpu_access(struct dma_buf *dmabuf,
144145
struct cma_heap_buffer *buffer = dmabuf->priv;
145146
struct dma_heap_attachment *a;
146147

148+
mutex_lock(&buffer->lock);
149+
147150
if (buffer->vmap_cnt)
148151
flush_kernel_vmap_range(buffer->vaddr, buffer->len);
149152

150-
mutex_lock(&buffer->lock);
151153
list_for_each_entry(a, &buffer->attachments, list) {
152154
if (!a->mapped)
153155
continue;

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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -514,13 +514,6 @@ int amdgpu_amdkfd_get_dmabuf_info(struct amdgpu_device *adev, int dma_buf_fd,
514514
return r;
515515
}
516516

517-
uint64_t amdgpu_amdkfd_get_vram_usage(struct amdgpu_device *adev)
518-
{
519-
struct ttm_resource_manager *vram_man = ttm_manager_type(&adev->mman.bdev, TTM_PL_VRAM);
520-
521-
return amdgpu_vram_mgr_usage(vram_man);
522-
}
523-
524517
uint8_t amdgpu_amdkfd_get_xgmi_hops_count(struct amdgpu_device *dst,
525518
struct amdgpu_device *src)
526519
{

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,6 @@ int amdgpu_amdkfd_get_dmabuf_info(struct amdgpu_device *adev, int dma_buf_fd,
223223
uint64_t *bo_size, void *metadata_buffer,
224224
size_t buffer_size, uint32_t *metadata_size,
225225
uint32_t *flags);
226-
uint64_t amdgpu_amdkfd_get_vram_usage(struct amdgpu_device *adev);
227226
uint8_t amdgpu_amdkfd_get_xgmi_hops_count(struct amdgpu_device *dst,
228227
struct amdgpu_device *src);
229228
int amdgpu_amdkfd_get_xgmi_bandwidth_mbytes(struct amdgpu_device *dst,

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,6 @@ static void amdgpu_cs_get_threshold_for_moves(struct amdgpu_device *adev,
298298
{
299299
s64 time_us, increment_us;
300300
u64 free_vram, total_vram, used_vram;
301-
struct ttm_resource_manager *vram_man = ttm_manager_type(&adev->mman.bdev, TTM_PL_VRAM);
302301
/* Allow a maximum of 200 accumulated ms. This is basically per-IB
303302
* throttling.
304303
*
@@ -315,7 +314,7 @@ static void amdgpu_cs_get_threshold_for_moves(struct amdgpu_device *adev,
315314
}
316315

317316
total_vram = adev->gmc.real_vram_size - atomic64_read(&adev->vram_pin_size);
318-
used_vram = amdgpu_vram_mgr_usage(vram_man);
317+
used_vram = amdgpu_vram_mgr_usage(&adev->mman.vram_mgr);
319318
free_vram = used_vram >= total_vram ? 0 : total_vram - used_vram;
320319

321320
spin_lock(&adev->mm_stats.lock);
@@ -362,7 +361,7 @@ static void amdgpu_cs_get_threshold_for_moves(struct amdgpu_device *adev,
362361
if (!amdgpu_gmc_vram_full_visible(&adev->gmc)) {
363362
u64 total_vis_vram = adev->gmc.visible_vram_size;
364363
u64 used_vis_vram =
365-
amdgpu_vram_mgr_vis_usage(vram_man);
364+
amdgpu_vram_mgr_vis_usage(&adev->mman.vram_mgr);
366365

367366
if (used_vis_vram < total_vis_vram) {
368367
u64 free_vis_vram = total_vis_vram - used_vis_vram;

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

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ void amdgpu_device_wreg(struct amdgpu_device *adev,
552552
}
553553

554554
/**
555-
* amdgpu_mm_wreg_mmio_rlc - write register either with mmio or with RLC path if in range
555+
* amdgpu_mm_wreg_mmio_rlc - write register either with direct/indirect mmio or with RLC path if in range
556556
*
557557
* this function is invoked only the debugfs register access
558558
*/
@@ -567,6 +567,8 @@ void amdgpu_mm_wreg_mmio_rlc(struct amdgpu_device *adev,
567567
adev->gfx.rlc.funcs->is_rlcg_access_range) {
568568
if (adev->gfx.rlc.funcs->is_rlcg_access_range(adev, reg))
569569
return adev->gfx.rlc.funcs->sriov_wreg(adev, reg, v, 0, 0);
570+
} else if ((reg * 4) >= adev->rmmio_size) {
571+
adev->pcie_wreg(adev, reg * 4, v);
570572
} else {
571573
writel(v, ((void __iomem *)adev->rmmio) + (reg * 4));
572574
}
@@ -1448,7 +1450,7 @@ static int amdgpu_device_init_apu_flags(struct amdgpu_device *adev)
14481450
adev->apu_flags |= AMD_APU_IS_CYAN_SKILLFISH2;
14491451
break;
14501452
default:
1451-
return -EINVAL;
1453+
break;
14521454
}
14531455

14541456
return 0;
@@ -3496,9 +3498,7 @@ int amdgpu_device_init(struct amdgpu_device *adev,
34963498
mutex_init(&adev->psp.mutex);
34973499
mutex_init(&adev->notifier_lock);
34983500

3499-
r = amdgpu_device_init_apu_flags(adev);
3500-
if (r)
3501-
return r;
3501+
amdgpu_device_init_apu_flags(adev);
35023502

35033503
r = amdgpu_device_check_arguments(adev);
35043504
if (r)
@@ -3833,6 +3833,7 @@ int amdgpu_device_init(struct amdgpu_device *adev,
38333833

38343834
static void amdgpu_device_unmap_mmio(struct amdgpu_device *adev)
38353835
{
3836+
38363837
/* Clear all CPU mappings pointing to this device */
38373838
unmap_mapping_range(adev->ddev.anon_inode->i_mapping, 0, 0, 1);
38383839

@@ -3913,6 +3914,8 @@ void amdgpu_device_fini_hw(struct amdgpu_device *adev)
39133914

39143915
void amdgpu_device_fini_sw(struct amdgpu_device *adev)
39153916
{
3917+
int idx;
3918+
39163919
amdgpu_fence_driver_sw_fini(adev);
39173920
amdgpu_device_ip_fini(adev);
39183921
release_firmware(adev->firmware.gpu_info_fw);
@@ -3937,6 +3940,14 @@ void amdgpu_device_fini_sw(struct amdgpu_device *adev)
39373940
if ((adev->pdev->class >> 8) == PCI_CLASS_DISPLAY_VGA)
39383941
vga_client_unregister(adev->pdev);
39393942

3943+
if (drm_dev_enter(adev_to_drm(adev), &idx)) {
3944+
3945+
iounmap(adev->rmmio);
3946+
adev->rmmio = NULL;
3947+
amdgpu_device_doorbell_fini(adev);
3948+
drm_dev_exit(idx);
3949+
}
3950+
39403951
if (IS_ENABLED(CONFIG_PERF_EVENTS))
39413952
amdgpu_pmu_fini(adev);
39423953
if (adev->mman.discovery_bin)
@@ -3957,8 +3968,8 @@ void amdgpu_device_fini_sw(struct amdgpu_device *adev)
39573968
*/
39583969
static void amdgpu_device_evict_resources(struct amdgpu_device *adev)
39593970
{
3960-
/* No need to evict vram on APUs for suspend to ram */
3961-
if (adev->in_s3 && (adev->flags & AMD_IS_APU))
3971+
/* No need to evict vram on APUs for suspend to ram or s2idle */
3972+
if ((adev->in_s3 || adev->in_s0ix) && (adev->flags & AMD_IS_APU))
39623973
return;
39633974

39643975
if (amdgpu_ttm_evict_resources(adev, TTM_PL_VRAM))
@@ -4005,16 +4016,11 @@ int amdgpu_device_suspend(struct drm_device *dev, bool fbcon)
40054016
if (!adev->in_s0ix)
40064017
amdgpu_amdkfd_suspend(adev, adev->in_runpm);
40074018

4008-
/* First evict vram memory */
40094019
amdgpu_device_evict_resources(adev);
40104020

40114021
amdgpu_fence_driver_hw_fini(adev);
40124022

40134023
amdgpu_device_ip_suspend_phase2(adev);
4014-
/* This second call to evict device resources is to evict
4015-
* the gart page table using the CPU.
4016-
*/
4017-
amdgpu_device_evict_resources(adev);
40184024

40194025
return 0;
40204026
}
@@ -4359,8 +4365,6 @@ static int amdgpu_device_reset_sriov(struct amdgpu_device *adev,
43594365
goto error;
43604366

43614367
amdgpu_virt_init_data_exchange(adev);
4362-
/* we need recover gart prior to run SMC/CP/SDMA resume */
4363-
amdgpu_gtt_mgr_recover(ttm_manager_type(&adev->mman.bdev, TTM_PL_TT));
43644368

43654369
r = amdgpu_device_fw_loading(adev);
43664370
if (r)
@@ -4680,10 +4684,6 @@ int amdgpu_do_asic_reset(struct list_head *device_list_handle,
46804684
amdgpu_inc_vram_lost(tmp_adev);
46814685
}
46824686

4683-
r = amdgpu_gtt_mgr_recover(ttm_manager_type(&tmp_adev->mman.bdev, TTM_PL_TT));
4684-
if (r)
4685-
goto out;
4686-
46874687
r = amdgpu_device_fw_loading(tmp_adev);
46884688
if (r)
46894689
return r;

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,8 @@ void amdgpu_discovery_harvest_ip(struct amdgpu_device *adev)
550550
}
551551
/* some IP discovery tables on Navy Flounder don't have this set correctly */
552552
if ((adev->ip_versions[UVD_HWIP][1] == IP_VERSION(3, 0, 1)) &&
553-
(adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 3, 2)))
553+
(adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 3, 2)) &&
554+
(adev->pdev->revision != 0xFF))
554555
adev->vcn.harvest_config |= AMDGPU_VCN_HARVEST_VCN1;
555556
if (vcn_harvest_count == adev->vcn.num_vcn_inst) {
556557
adev->harvest_ip_mask |= AMD_HARVEST_IP_VCN_MASK;

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2194,9 +2194,9 @@ static int amdgpu_pmops_suspend(struct device *dev)
21942194

21952195
if (amdgpu_acpi_is_s0ix_active(adev))
21962196
adev->in_s0ix = true;
2197-
adev->in_s3 = true;
2197+
else
2198+
adev->in_s3 = true;
21982199
r = amdgpu_device_suspend(drm_dev, true);
2199-
adev->in_s3 = false;
22002200
if (r)
22012201
return r;
22022202
if (!adev->in_s0ix)
@@ -2217,6 +2217,8 @@ static int amdgpu_pmops_resume(struct device *dev)
22172217
r = amdgpu_device_resume(drm_dev, true);
22182218
if (amdgpu_acpi_is_s0ix_active(adev))
22192219
adev->in_s0ix = false;
2220+
else
2221+
adev->in_s3 = false;
22202222
return r;
22212223
}
22222224

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

Lines changed: 6 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -114,80 +114,12 @@ void amdgpu_gart_dummy_page_fini(struct amdgpu_device *adev)
114114
*/
115115
int amdgpu_gart_table_vram_alloc(struct amdgpu_device *adev)
116116
{
117-
int r;
118-
119-
if (adev->gart.bo == NULL) {
120-
struct amdgpu_bo_param bp;
121-
122-
memset(&bp, 0, sizeof(bp));
123-
bp.size = adev->gart.table_size;
124-
bp.byte_align = PAGE_SIZE;
125-
bp.domain = AMDGPU_GEM_DOMAIN_VRAM;
126-
bp.flags = AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED |
127-
AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS;
128-
bp.type = ttm_bo_type_kernel;
129-
bp.resv = NULL;
130-
bp.bo_ptr_size = sizeof(struct amdgpu_bo);
131-
132-
r = amdgpu_bo_create(adev, &bp, &adev->gart.bo);
133-
if (r) {
134-
return r;
135-
}
136-
}
137-
return 0;
138-
}
139-
140-
/**
141-
* amdgpu_gart_table_vram_pin - pin gart page table in vram
142-
*
143-
* @adev: amdgpu_device pointer
144-
*
145-
* Pin the GART page table in vram so it will not be moved
146-
* by the memory manager (pcie r4xx, r5xx+). These asics require the
147-
* gart table to be in video memory.
148-
* Returns 0 for success, error for failure.
149-
*/
150-
int amdgpu_gart_table_vram_pin(struct amdgpu_device *adev)
151-
{
152-
int r;
153-
154-
r = amdgpu_bo_reserve(adev->gart.bo, false);
155-
if (unlikely(r != 0))
156-
return r;
157-
r = amdgpu_bo_pin(adev->gart.bo, AMDGPU_GEM_DOMAIN_VRAM);
158-
if (r) {
159-
amdgpu_bo_unreserve(adev->gart.bo);
160-
return r;
161-
}
162-
r = amdgpu_bo_kmap(adev->gart.bo, &adev->gart.ptr);
163-
if (r)
164-
amdgpu_bo_unpin(adev->gart.bo);
165-
amdgpu_bo_unreserve(adev->gart.bo);
166-
return r;
167-
}
168-
169-
/**
170-
* amdgpu_gart_table_vram_unpin - unpin gart page table in vram
171-
*
172-
* @adev: amdgpu_device pointer
173-
*
174-
* Unpin the GART page table in vram (pcie r4xx, r5xx+).
175-
* These asics require the gart table to be in video memory.
176-
*/
177-
void amdgpu_gart_table_vram_unpin(struct amdgpu_device *adev)
178-
{
179-
int r;
117+
if (adev->gart.bo != NULL)
118+
return 0;
180119

181-
if (adev->gart.bo == NULL) {
182-
return;
183-
}
184-
r = amdgpu_bo_reserve(adev->gart.bo, true);
185-
if (likely(r == 0)) {
186-
amdgpu_bo_kunmap(adev->gart.bo);
187-
amdgpu_bo_unpin(adev->gart.bo);
188-
amdgpu_bo_unreserve(adev->gart.bo);
189-
adev->gart.ptr = NULL;
190-
}
120+
return amdgpu_bo_create_kernel(adev, adev->gart.table_size, PAGE_SIZE,
121+
AMDGPU_GEM_DOMAIN_VRAM, &adev->gart.bo,
122+
NULL, (void *)&adev->gart.ptr);
191123
}
192124

193125
/**
@@ -201,11 +133,7 @@ void amdgpu_gart_table_vram_unpin(struct amdgpu_device *adev)
201133
*/
202134
void amdgpu_gart_table_vram_free(struct amdgpu_device *adev)
203135
{
204-
if (adev->gart.bo == NULL) {
205-
return;
206-
}
207-
amdgpu_bo_unref(&adev->gart.bo);
208-
adev->gart.ptr = NULL;
136+
amdgpu_bo_free_kernel(&adev->gart.bo, NULL, (void *)&adev->gart.ptr);
209137
}
210138

211139
/*

0 commit comments

Comments
 (0)