Skip to content

Commit 3b1c3fa

Browse files
committed
amdgpu: uses memset_io where applicable
1 parent 720694e commit 3b1c3fa

26 files changed

+96
-96
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1056,7 +1056,7 @@ static int amdgpu_cs_patch_ibs(struct amdgpu_cs_parser *p,
10561056
kptr += va_start - (m->start * AMDGPU_GPU_PAGE_SIZE);
10571057

10581058
if (ring->funcs->parse_cs) {
1059-
memcpy(ib->ptr, kptr, ib->length_dw * 4);
1059+
memcpy_fromio(ib->ptr, kptr, ib->length_dw * 4);
10601060
amdgpu_bo_kunmap(aobj);
10611061

10621062
r = amdgpu_ring_parse_cs(ring, p, job, ib);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1486,7 +1486,7 @@ static int amdgpu_device_wb_init(struct amdgpu_device *adev)
14861486
memset(&adev->wb.used, 0, sizeof(adev->wb.used));
14871487

14881488
/* clear wb memory */
1489-
memset((char *)adev->wb.wb, 0, AMDGPU_MAX_WB * sizeof(uint32_t) * 8);
1489+
memset_io((char *)adev->wb.wb, 0, AMDGPU_MAX_WB * sizeof(uint32_t) * 8);
14901490
}
14911491

14921492
return 0;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ int amdgpu_gfx_kiq_init(struct amdgpu_device *adev,
370370
return r;
371371
}
372372

373-
memset(hpd, 0, hpd_size);
373+
memset_io(hpd, 0, hpd_size);
374374

375375
r = amdgpu_bo_reserve(kiq->eop_obj, true);
376376
if (unlikely(r != 0))

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ int amdgpu_mes_create_process(struct amdgpu_device *adev, int pasid,
291291
DRM_ERROR("failed to allocate process context bo\n");
292292
goto clean_up_memory;
293293
}
294-
memset(process->proc_ctx_cpu_ptr, 0, AMDGPU_MES_PROC_CTX_SIZE);
294+
memset_io(process->proc_ctx_cpu_ptr, 0, AMDGPU_MES_PROC_CTX_SIZE);
295295

296296
/*
297297
* Avoid taking any other locks under MES lock to avoid circular
@@ -415,7 +415,7 @@ int amdgpu_mes_add_gang(struct amdgpu_device *adev, int pasid,
415415
DRM_ERROR("failed to allocate process context bo\n");
416416
goto clean_up_mem;
417417
}
418-
memset(gang->gang_ctx_cpu_ptr, 0, AMDGPU_MES_GANG_CTX_SIZE);
418+
memset_io(gang->gang_ctx_cpu_ptr, 0, AMDGPU_MES_GANG_CTX_SIZE);
419419

420420
/*
421421
* Avoid taking any other locks under MES lock to avoid circular
@@ -563,7 +563,7 @@ static int amdgpu_mes_queue_alloc_mqd(struct amdgpu_device *adev,
563563
dev_warn(adev->dev, "failed to create queue mqd bo (%d)", r);
564564
return r;
565565
}
566-
memset(q->mqd_cpu_ptr, 0, mqd_size);
566+
memset_io(q->mqd_cpu_ptr, 0, mqd_size);
567567

568568
r = amdgpu_bo_reserve(q->mqd_obj, false);
569569
if (unlikely(r != 0))
@@ -1279,7 +1279,7 @@ int amdgpu_mes_ctx_alloc_meta_data(struct amdgpu_device *adev,
12791279
if (!ctx_data->meta_data_obj)
12801280
return -ENOMEM;
12811281

1282-
memset(ctx_data->meta_data_ptr, 0,
1282+
memset_io(ctx_data->meta_data_ptr, 0,
12831283
sizeof(struct amdgpu_mes_ctx_meta_data));
12841284

12851285
return 0;

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -671,9 +671,9 @@ psp_cmd_submit_buf(struct psp_context *psp,
671671
if (psp->adev->no_hw_access)
672672
return 0;
673673

674-
memset(psp->cmd_buf_mem, 0, PSP_CMD_BUFFER_SIZE);
674+
memset_io(psp->cmd_buf_mem, 0, PSP_CMD_BUFFER_SIZE);
675675

676-
memcpy(psp->cmd_buf_mem, cmd, sizeof(struct psp_gfx_cmd_resp));
676+
memcpy_toio(psp->cmd_buf_mem, cmd, sizeof(struct psp_gfx_cmd_resp));
677677

678678
index = atomic_inc_return(&psp->fence_value);
679679
ret = psp_ring_cmd_submit(psp, psp->cmd_buf_mc_addr, fence_mc_addr, index);
@@ -702,7 +702,7 @@ psp_cmd_submit_buf(struct psp_context *psp,
702702
skip_unsupport = (psp->cmd_buf_mem->resp.status == TEE_ERROR_NOT_SUPPORTED ||
703703
psp->cmd_buf_mem->resp.status == PSP_ERR_UNKNOWN_COMMAND) && amdgpu_sriov_vf(psp->adev);
704704

705-
memcpy(&cmd->resp, &psp->cmd_buf_mem->resp, sizeof(struct psp_gfx_resp));
705+
memcpy_fromio(&cmd->resp, &psp->cmd_buf_mem->resp, sizeof(struct psp_gfx_resp));
706706

707707
/* In some cases, psp response status is not 0 even there is no
708708
* problem while the command is submitted. Some version of PSP FW
@@ -1026,8 +1026,8 @@ static int psp_rl_load(struct amdgpu_device *adev)
10261026

10271027
cmd = acquire_psp_cmd_buf(psp);
10281028

1029-
memset(psp->fw_pri_buf, 0, PSP_1_MEG);
1030-
memcpy(psp->fw_pri_buf, psp->rl.start_addr, psp->rl.size_bytes);
1029+
memset_io(psp->fw_pri_buf, 0, PSP_1_MEG);
1030+
memcpy_toio(psp->fw_pri_buf, psp->rl.start_addr, psp->rl.size_bytes);
10311031

10321032
cmd->cmd_id = GFX_CMD_ID_LOAD_IP_FW;
10331033
cmd->cmd.cmd_load_ip_fw.fw_phy_addr_lo = lower_32_bits(psp->fw_pri_mc_addr);
@@ -2875,7 +2875,7 @@ static int psp_load_fw(struct amdgpu_device *adev)
28752875
/* should not destroy ring, only stop */
28762876
psp_ring_stop(psp, PSP_RING_TYPE__KM);
28772877
} else {
2878-
memset(psp->fence_buf, 0, PSP_FENCE_BUFFER_SIZE);
2878+
memset_io(psp->fence_buf, 0, PSP_FENCE_BUFFER_SIZE);
28792879

28802880
ret = psp_ring_init(psp, PSP_RING_TYPE__KM);
28812881
if (ret) {
@@ -3223,7 +3223,7 @@ int psp_ring_cmd_submit(struct psp_context *psp,
32233223
}
32243224

32253225
/* Initialize KM RB frame */
3226-
memset(write_frame, 0, sizeof(struct psp_gfx_rb_frame));
3226+
memset_io(write_frame, 0, sizeof(struct psp_gfx_rb_frame));
32273227

32283228
/* Update KM RB frame */
32293229
write_frame->cmd_buf_addr_hi = upper_32_bits(cmd_buf_mc_addr);
@@ -3835,8 +3835,8 @@ void psp_copy_fw(struct psp_context *psp, uint8_t *start_addr, uint32_t bin_size
38353835
if (!drm_dev_enter(adev_to_drm(psp->adev), &idx))
38363836
return;
38373837

3838-
memset(psp->fw_pri_buf, 0, PSP_1_MEG);
3839-
memcpy(psp->fw_pri_buf, start_addr, bin_size);
3838+
memset_io(psp->fw_pri_buf, 0, PSP_1_MEG);
3839+
memcpy_toio(psp->fw_pri_buf, start_addr, bin_size);
38403840

38413841
drm_dev_exit(idx);
38423842
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ int amdgpu_sa_bo_manager_init(struct amdgpu_device *adev,
5858
return r;
5959
}
6060

61-
memset(sa_manager->cpu_ptr, 0, size);
61+
memset_io(sa_manager->cpu_ptr, 0, size);
6262
drm_suballoc_manager_init(&sa_manager->base, size, suballoc_align);
6363
return r;
6464
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ int amdgpu_seq64_init(struct amdgpu_device *adev)
240240
return r;
241241
}
242242

243-
memset(adev->seq64.cpu_base_addr, 0, AMDGPU_VA_RESERVED_SEQ64_SIZE);
243+
memset_io(adev->seq64.cpu_base_addr, 0, AMDGPU_VA_RESERVED_SEQ64_SIZE);
244244

245245
adev->seq64.num_sem = AMDGPU_MAX_SEQ64_SLOTS;
246246
memset(&adev->seq64.used, 0, sizeof(adev->seq64.used));

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,7 +1078,7 @@ static int amdgpu_ucode_init_single_fw(struct amdgpu_device *adev,
10781078
le32_to_cpu(header->ucode_array_offset_bytes);
10791079
}
10801080

1081-
memcpy(ucode->kaddr, ucode_addr, ucode->ucode_size);
1081+
memcpy_toio(ucode->kaddr, ucode_addr, ucode->ucode_size);
10821082

10831083
return 0;
10841084
}
@@ -1102,7 +1102,7 @@ static int amdgpu_ucode_patch_jt(struct amdgpu_firmware_info *ucode,
11021102
src_addr = (uint8_t *)ucode->fw->data +
11031103
le32_to_cpu(comm_hdr->ucode_array_offset_bytes) +
11041104
(le32_to_cpu(header->jt_offset) * 4);
1105-
memcpy(dst_addr, src_addr, le32_to_cpu(header->jt_size) * 4);
1105+
memcpy_toio(dst_addr, src_addr, le32_to_cpu(header->jt_size) * 4);
11061106

11071107
return 0;
11081108
}
@@ -1121,7 +1121,7 @@ int amdgpu_ucode_create_bo(struct amdgpu_device *adev)
11211121
dev_err(adev->dev, "failed to create kernel buffer for firmware.fw_buf\n");
11221122
return -ENOMEM;
11231123
} else if (amdgpu_sriov_vf(adev)) {
1124-
memset(adev->firmware.fw_buf_ptr, 0, adev->firmware.fw_size);
1124+
memset_io(adev->firmware.fw_buf_ptr, 0, adev->firmware.fw_size);
11251125
}
11261126
}
11271127
return 0;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ static int amdgpu_vcn_dec_sw_send_msg(struct amdgpu_ring *ring,
751751
ib->ptr[ib->length_dw++] = cpu_to_le32(AMDGPU_VCN_IB_FLAG_DECODE_BUFFER);
752752
decode_buffer = (struct amdgpu_vcn_decode_buffer *)&(ib->ptr[ib->length_dw]);
753753
ib->length_dw += sizeof(struct amdgpu_vcn_decode_buffer) / 4;
754-
memset(decode_buffer, 0, sizeof(struct amdgpu_vcn_decode_buffer));
754+
memset_io(decode_buffer, 0, sizeof(struct amdgpu_vcn_decode_buffer));
755755

756756
decode_buffer->valid_buf_flag |= cpu_to_le32(AMDGPU_VCN_CMD_FLAG_MSG_BUFFER);
757757
decode_buffer->msg_buffer_address_hi = cpu_to_le32(addr >> 32);

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4375,7 +4375,7 @@ static int gfx_v10_0_mec_init(struct amdgpu_device *adev)
43754375
return r;
43764376
}
43774377

4378-
memset(hpd, 0, mec_hpd_size);
4378+
memset_io(hpd, 0, mec_hpd_size);
43794379

43804380
amdgpu_bo_kunmap(adev->gfx.mec.hpd_eop_obj);
43814381
amdgpu_bo_unreserve(adev->gfx.mec.hpd_eop_obj);
@@ -5577,10 +5577,10 @@ static void gfx_v10_0_rlc_backdoor_autoload_copy_ucode(struct amdgpu_device *ade
55775577
if (fw_size > toc_fw_size)
55785578
fw_size = toc_fw_size;
55795579

5580-
memcpy(ptr + toc_offset, fw_data, fw_size);
5580+
memcpy_toio(ptr + toc_offset, fw_data, fw_size);
55815581

55825582
if (fw_size < toc_fw_size)
5583-
memset(ptr + toc_offset + fw_size, 0, toc_fw_size - fw_size);
5583+
memset_io(ptr + toc_offset + fw_size, 0, toc_fw_size - fw_size);
55845584
}
55855585

55865586
static void gfx_v10_0_rlc_backdoor_autoload_copy_toc_ucode(struct amdgpu_device *adev)
@@ -6699,7 +6699,7 @@ static int gfx_v10_0_kgq_init_queue(struct amdgpu_ring *ring, bool reset)
66996699
int mqd_idx = ring - &adev->gfx.gfx_ring[0];
67006700

67016701
if (!reset && !amdgpu_in_reset(adev) && !adev->in_suspend) {
6702-
memset((void *)mqd, 0, sizeof(*mqd));
6702+
memset_io((void *)mqd, 0, sizeof(*mqd));
67036703
mutex_lock(&adev->srbm_mutex);
67046704
nv_grbm_select(adev, ring->me, ring->pipe, ring->queue, 0);
67056705
amdgpu_ring_init_mqd(ring);
@@ -7013,7 +7013,7 @@ static int gfx_v10_0_kiq_init_queue(struct amdgpu_ring *ring)
70137013
nv_grbm_select(adev, 0, 0, 0, 0);
70147014
mutex_unlock(&adev->srbm_mutex);
70157015
} else {
7016-
memset((void *)mqd, 0, sizeof(*mqd));
7016+
memset_io((void *)mqd, 0, sizeof(*mqd));
70177017
if (amdgpu_sriov_vf(adev) && adev->in_suspend)
70187018
amdgpu_ring_clear_ring(ring);
70197019
mutex_lock(&adev->srbm_mutex);
@@ -7037,7 +7037,7 @@ static int gfx_v10_0_kcq_init_queue(struct amdgpu_ring *ring, bool restore)
70377037
int mqd_idx = ring - &adev->gfx.compute_ring[0];
70387038

70397039
if (!restore && !amdgpu_in_reset(adev) && !adev->in_suspend) {
7040-
memset((void *)mqd, 0, sizeof(*mqd));
7040+
memset_io((void *)mqd, 0, sizeof(*mqd));
70417041
mutex_lock(&adev->srbm_mutex);
70427042
nv_grbm_select(adev, ring->me, ring->pipe, ring->queue, 0);
70437043
amdgpu_ring_init_mqd(ring);

0 commit comments

Comments
 (0)