Commit ba08e9cb authored by Lijo Lazar's avatar Lijo Lazar Committed by Alex Deucher
Browse files

drm/amdgpu: Add PSP spatial parition interface



Add PSP ring command interface for spatial partitioning.

Signed-off-by: default avatarLijo Lazar <lijo.lazar@amd.com>
Reviewed-by: default avatarHawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent b6b85c8b
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -991,6 +991,27 @@ static int psp_rl_load(struct amdgpu_device *adev)
	return ret;
}

int psp_spatial_partition(struct psp_context *psp, int mode)
{
	struct psp_gfx_cmd_resp *cmd;
	int ret;

	if (amdgpu_sriov_vf(psp->adev))
		return 0;

	cmd = acquire_psp_cmd_buf(psp);

	cmd->cmd_id = GFX_CMD_ID_SRIOV_SPATIAL_PART;
	cmd->cmd.cmd_spatial_part.mode = mode;

	dev_info(psp->adev->dev, "Requesting %d paritions through PSP", mode);
	ret = psp_cmd_submit_buf(psp, NULL, cmd, psp->fence_buf_mc_addr);

	release_psp_cmd_buf(psp);

	return ret;
}

static int psp_asd_initialize(struct psp_context *psp)
{
	int ret;
+2 −0
Original line number Diff line number Diff line
@@ -519,6 +519,8 @@ int psp_load_fw_list(struct psp_context *psp,
		     struct amdgpu_firmware_info **ucode_list, int ucode_count);
void psp_copy_fw(struct psp_context *psp, uint8_t *start_addr, uint32_t bin_size);

int psp_spatial_partition(struct psp_context *psp, int mode);

int is_psp_fw_valid(struct psp_bin_desc bin);

int amdgpu_psp_sysfs_init(struct amdgpu_device *adev);
+9 −0
Original line number Diff line number Diff line
@@ -102,6 +102,7 @@ enum psp_gfx_cmd_id
    GFX_CMD_ID_LOAD_TOC           = 0x00000020,   /* Load TOC and obtain TMR size */
    GFX_CMD_ID_AUTOLOAD_RLC       = 0x00000021,   /* Indicates all graphics fw loaded, start RLC autoload */
    GFX_CMD_ID_BOOT_CFG           = 0x00000022,   /* Boot Config */
    GFX_CMD_ID_SRIOV_SPATIAL_PART = 0x00000027,   /* Configure spatial partitioning mode */
};

/* PSP boot config sub-commands */
@@ -338,6 +339,13 @@ struct psp_gfx_cmd_boot_cfg
    uint32_t                        boot_config_valid;    /* dynamic boot configuration valid bits bitmask */
};

struct psp_gfx_cmd_sriov_spatial_part {
	uint32_t mode;
	uint32_t override_ips;
	uint32_t override_xcds_avail;
	uint32_t override_this_aid;
};

/* All GFX ring buffer commands. */
union psp_gfx_commands
{
@@ -351,6 +359,7 @@ union psp_gfx_commands
    struct psp_gfx_cmd_setup_tmr        cmd_setup_vmr;
    struct psp_gfx_cmd_load_toc         cmd_load_toc;
    struct psp_gfx_cmd_boot_cfg         boot_cfg;
    struct psp_gfx_cmd_sriov_spatial_part cmd_spatial_part;
};

struct psp_gfx_uresp_reserved