drm/amdgpu: expand the emit tmz interface with trusted flag
This patch expands the emit_tmz function to support trusted flag while we want to set command buffer in trusted mode. Signed-off-by: Huang Rui <ray.huang@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Acked-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
eda982a672
commit
155748c912
@ -233,7 +233,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
|
||||
}
|
||||
|
||||
if (ring->funcs->emit_tmz)
|
||||
amdgpu_ring_emit_tmz(ring, false);
|
||||
amdgpu_ring_emit_tmz(ring, false, false);
|
||||
|
||||
#ifdef CONFIG_X86_64
|
||||
if (!(adev->flags & AMD_IS_APU))
|
||||
|
@ -177,7 +177,7 @@ struct amdgpu_ring_funcs {
|
||||
void (*emit_reg_write_reg_wait)(struct amdgpu_ring *ring,
|
||||
uint32_t reg0, uint32_t reg1,
|
||||
uint32_t ref, uint32_t mask);
|
||||
void (*emit_tmz)(struct amdgpu_ring *ring, bool start);
|
||||
void (*emit_tmz)(struct amdgpu_ring *ring, bool start, bool trusted);
|
||||
/* Try to soft recover the ring to make the fence signal */
|
||||
void (*soft_recovery)(struct amdgpu_ring *ring, unsigned vmid);
|
||||
int (*preempt_ib)(struct amdgpu_ring *ring);
|
||||
@ -256,7 +256,7 @@ struct amdgpu_ring {
|
||||
#define amdgpu_ring_emit_wreg(r, d, v) (r)->funcs->emit_wreg((r), (d), (v))
|
||||
#define amdgpu_ring_emit_reg_wait(r, d, v, m) (r)->funcs->emit_reg_wait((r), (d), (v), (m))
|
||||
#define amdgpu_ring_emit_reg_write_reg_wait(r, d0, d1, v, m) (r)->funcs->emit_reg_write_reg_wait((r), (d0), (d1), (v), (m))
|
||||
#define amdgpu_ring_emit_tmz(r, b) (r)->funcs->emit_tmz((r), (b))
|
||||
#define amdgpu_ring_emit_tmz(r, b, s) (r)->funcs->emit_tmz((r), (b), (s))
|
||||
#define amdgpu_ring_pad_ib(r, ib) ((r)->funcs->pad_ib((r), (ib)))
|
||||
#define amdgpu_ring_init_cond_exec(r) (r)->funcs->init_cond_exec((r))
|
||||
#define amdgpu_ring_patch_cond_exec(r,o) (r)->funcs->patch_cond_exec((r),(o))
|
||||
|
@ -3037,7 +3037,8 @@ static int gfx_v10_0_rlc_backdoor_autoload_enable(struct amdgpu_device *adev);
|
||||
static int gfx_v10_0_wait_for_rlc_autoload_complete(struct amdgpu_device *adev);
|
||||
static void gfx_v10_0_ring_emit_ce_meta(struct amdgpu_ring *ring, bool resume);
|
||||
static void gfx_v10_0_ring_emit_de_meta(struct amdgpu_ring *ring, bool resume);
|
||||
static void gfx_v10_0_ring_emit_tmz(struct amdgpu_ring *ring, bool start);
|
||||
static void gfx_v10_0_ring_emit_tmz(struct amdgpu_ring *ring, bool start,
|
||||
bool trusted);
|
||||
|
||||
static void gfx10_kiq_set_resources(struct amdgpu_ring *kiq_ring, uint64_t queue_mask)
|
||||
{
|
||||
@ -7442,7 +7443,7 @@ static void gfx_v10_0_ring_emit_cntxcntl(struct amdgpu_ring *ring, uint32_t flag
|
||||
gfx_v10_0_ring_emit_ce_meta(ring,
|
||||
(!amdgpu_sriov_vf(ring->adev) && flags & AMDGPU_IB_PREEMPTED) ? true : false);
|
||||
|
||||
gfx_v10_0_ring_emit_tmz(ring, true);
|
||||
gfx_v10_0_ring_emit_tmz(ring, true, false);
|
||||
|
||||
dw2 |= 0x80000000; /* set load_enable otherwise this package is just NOPs */
|
||||
if (flags & AMDGPU_HAVE_CTX_SWITCH) {
|
||||
@ -7600,10 +7601,17 @@ static void gfx_v10_0_ring_emit_de_meta(struct amdgpu_ring *ring, bool resume)
|
||||
sizeof(de_payload) >> 2);
|
||||
}
|
||||
|
||||
static void gfx_v10_0_ring_emit_tmz(struct amdgpu_ring *ring, bool start)
|
||||
static void gfx_v10_0_ring_emit_tmz(struct amdgpu_ring *ring, bool start,
|
||||
bool trusted)
|
||||
{
|
||||
amdgpu_ring_write(ring, PACKET3(PACKET3_FRAME_CONTROL, 0));
|
||||
amdgpu_ring_write(ring, FRAME_CMD(start ? 0 : 1)); /* frame_end */
|
||||
/*
|
||||
* cmd = 0: frame begin
|
||||
* cmd = 1: frame end
|
||||
*/
|
||||
amdgpu_ring_write(ring,
|
||||
((ring->adev->tmz.enabled && trusted) ? FRAME_TMZ : 0)
|
||||
| FRAME_CMD(start ? 0 : 1));
|
||||
}
|
||||
|
||||
static void gfx_v10_0_ring_emit_rreg(struct amdgpu_ring *ring, uint32_t reg,
|
||||
|
@ -5442,10 +5442,17 @@ static void gfx_v9_0_ring_emit_de_meta(struct amdgpu_ring *ring)
|
||||
amdgpu_ring_write_multiple(ring, (void *)&de_payload, sizeof(de_payload) >> 2);
|
||||
}
|
||||
|
||||
static void gfx_v9_0_ring_emit_tmz(struct amdgpu_ring *ring, bool start)
|
||||
static void gfx_v9_0_ring_emit_tmz(struct amdgpu_ring *ring, bool start,
|
||||
bool trusted)
|
||||
{
|
||||
amdgpu_ring_write(ring, PACKET3(PACKET3_FRAME_CONTROL, 0));
|
||||
amdgpu_ring_write(ring, FRAME_CMD(start ? 0 : 1)); /* frame_end */
|
||||
/*
|
||||
* cmd = 0: frame begin
|
||||
* cmd = 1: frame end
|
||||
*/
|
||||
amdgpu_ring_write(ring,
|
||||
((ring->adev->tmz.enabled && trusted) ? FRAME_TMZ : 0)
|
||||
| FRAME_CMD(start ? 0 : 1));
|
||||
}
|
||||
|
||||
static void gfx_v9_ring_emit_cntxcntl(struct amdgpu_ring *ring, uint32_t flags)
|
||||
@ -5455,7 +5462,7 @@ static void gfx_v9_ring_emit_cntxcntl(struct amdgpu_ring *ring, uint32_t flags)
|
||||
if (amdgpu_sriov_vf(ring->adev))
|
||||
gfx_v9_0_ring_emit_ce_meta(ring);
|
||||
|
||||
gfx_v9_0_ring_emit_tmz(ring, true);
|
||||
gfx_v9_0_ring_emit_tmz(ring, true, false);
|
||||
|
||||
dw2 |= 0x80000000; /* set load_enable otherwise this package is just NOPs */
|
||||
if (flags & AMDGPU_HAVE_CTX_SWITCH) {
|
||||
|
Loading…
Reference in New Issue
Block a user