Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu: Add secure display TA interface

Add interface to load, unload, invoke command for
secure display TA.

v2: Add debugfs interface for secure display TA
v3: fix warning in copy_from_user (Alex)

Signed-off-by: Jinzhou.Su <Jinzhou.Su@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Jinzhou Su and committed by
Alex Deucher
ecaafb7b a944c127

+438 -3
+1 -1
drivers/gpu/drm/amd/amdgpu/Makefile
··· 56 56 amdgpu_gmc.o amdgpu_mmhub.o amdgpu_xgmi.o amdgpu_csa.o amdgpu_ras.o amdgpu_vm_cpu.o \ 57 57 amdgpu_vm_sdma.o amdgpu_discovery.o amdgpu_ras_eeprom.o amdgpu_nbio.o \ 58 58 amdgpu_umc.o smu_v11_0_i2c.o amdgpu_fru_eeprom.o amdgpu_rap.o \ 59 - amdgpu_fw_attestation.o 59 + amdgpu_fw_attestation.o amdgpu_securedisplay.o 60 60 61 61 amdgpu-$(CONFIG_PERF_EVENTS) += amdgpu_pmu.o 62 62
+3
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
··· 35 35 #include "amdgpu_dm_debugfs.h" 36 36 #include "amdgpu_ras.h" 37 37 #include "amdgpu_rap.h" 38 + #include "amdgpu_securedisplay.h" 38 39 #include "amdgpu_fw_attestation.h" 39 40 40 41 /** ··· 1669 1668 amdgpu_debugfs_autodump_init(adev); 1670 1669 1671 1670 amdgpu_rap_debugfs_init(adev); 1671 + 1672 + amdgpu_securedisplay_debugfs_init(adev); 1672 1673 1673 1674 amdgpu_fw_attestation_debugfs_init(adev); 1674 1675
+191
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
··· 36 36 #include "psp_v12_0.h" 37 37 38 38 #include "amdgpu_ras.h" 39 + #include "amdgpu_securedisplay.h" 39 40 40 41 static int psp_sysfs_init(struct amdgpu_device *adev); 41 42 static void psp_sysfs_fini(struct amdgpu_device *adev); ··· 1653 1652 } 1654 1653 // RAP end 1655 1654 1655 + /* securedisplay start */ 1656 + static int psp_securedisplay_init_shared_buf(struct psp_context *psp) 1657 + { 1658 + int ret; 1659 + 1660 + /* 1661 + * Allocate 16k memory aligned to 4k from Frame Buffer (local 1662 + * physical) for sa ta <-> Driver 1663 + */ 1664 + ret = amdgpu_bo_create_kernel(psp->adev, PSP_SECUREDISPLAY_SHARED_MEM_SIZE, 1665 + PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM, 1666 + &psp->securedisplay_context.securedisplay_shared_bo, 1667 + &psp->securedisplay_context.securedisplay_shared_mc_addr, 1668 + &psp->securedisplay_context.securedisplay_shared_buf); 1669 + 1670 + return ret; 1671 + } 1672 + 1673 + static int psp_securedisplay_load(struct psp_context *psp) 1674 + { 1675 + int ret; 1676 + struct psp_gfx_cmd_resp *cmd; 1677 + 1678 + cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL); 1679 + if (!cmd) 1680 + return -ENOMEM; 1681 + 1682 + memset(psp->fw_pri_buf, 0, PSP_1_MEG); 1683 + memcpy(psp->fw_pri_buf, psp->ta_securedisplay_start_addr, psp->ta_securedisplay_ucode_size); 1684 + 1685 + psp_prep_ta_load_cmd_buf(cmd, 1686 + psp->fw_pri_mc_addr, 1687 + psp->ta_securedisplay_ucode_size, 1688 + psp->securedisplay_context.securedisplay_shared_mc_addr, 1689 + PSP_SECUREDISPLAY_SHARED_MEM_SIZE); 1690 + 1691 + ret = psp_cmd_submit_buf(psp, NULL, cmd, psp->fence_buf_mc_addr); 1692 + 1693 + if (ret) 1694 + goto failed; 1695 + 1696 + psp->securedisplay_context.securedisplay_initialized = true; 1697 + psp->securedisplay_context.session_id = cmd->resp.session_id; 1698 + mutex_init(&psp->securedisplay_context.mutex); 1699 + 1700 + failed: 1701 + kfree(cmd); 1702 + return ret; 1703 + } 1704 + 1705 + static int psp_securedisplay_unload(struct psp_context *psp) 1706 + { 1707 + int ret; 1708 + struct psp_gfx_cmd_resp *cmd; 1709 + 1710 + cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL); 1711 + if (!cmd) 1712 + return -ENOMEM; 1713 + 1714 + psp_prep_ta_unload_cmd_buf(cmd, psp->securedisplay_context.session_id); 1715 + 1716 + ret = psp_cmd_submit_buf(psp, NULL, cmd, psp->fence_buf_mc_addr); 1717 + 1718 + kfree(cmd); 1719 + 1720 + return ret; 1721 + } 1722 + 1723 + static int psp_securedisplay_initialize(struct psp_context *psp) 1724 + { 1725 + int ret; 1726 + struct securedisplay_cmd *securedisplay_cmd; 1727 + 1728 + /* 1729 + * TODO: bypass the initialize in sriov for now 1730 + */ 1731 + if (amdgpu_sriov_vf(psp->adev)) 1732 + return 0; 1733 + 1734 + if (!psp->adev->psp.ta_securedisplay_ucode_size || 1735 + !psp->adev->psp.ta_securedisplay_start_addr) { 1736 + dev_info(psp->adev->dev, "SECUREDISPLAY: securedisplay ta ucode is not available\n"); 1737 + return 0; 1738 + } 1739 + 1740 + if (!psp->securedisplay_context.securedisplay_initialized) { 1741 + ret = psp_securedisplay_init_shared_buf(psp); 1742 + if (ret) 1743 + return ret; 1744 + } 1745 + 1746 + ret = psp_securedisplay_load(psp); 1747 + if (ret) 1748 + return ret; 1749 + 1750 + psp_prep_securedisplay_cmd_buf(psp, &securedisplay_cmd, 1751 + TA_SECUREDISPLAY_COMMAND__QUERY_TA); 1752 + 1753 + ret = psp_securedisplay_invoke(psp, TA_SECUREDISPLAY_COMMAND__QUERY_TA); 1754 + if (ret) { 1755 + psp_securedisplay_unload(psp); 1756 + 1757 + amdgpu_bo_free_kernel(&psp->securedisplay_context.securedisplay_shared_bo, 1758 + &psp->securedisplay_context.securedisplay_shared_mc_addr, 1759 + &psp->securedisplay_context.securedisplay_shared_buf); 1760 + 1761 + psp->securedisplay_context.securedisplay_initialized = false; 1762 + 1763 + dev_err(psp->adev->dev, "SECUREDISPLAY TA initialize fail.\n"); 1764 + return -EINVAL; 1765 + } 1766 + 1767 + if (securedisplay_cmd->status != TA_SECUREDISPLAY_STATUS__SUCCESS) { 1768 + psp_securedisplay_parse_resp_status(psp, securedisplay_cmd->status); 1769 + dev_err(psp->adev->dev, "SECUREDISPLAY: query securedisplay TA failed. ret 0x%x\n", 1770 + securedisplay_cmd->securedisplay_out_message.query_ta.query_cmd_ret); 1771 + } 1772 + 1773 + return 0; 1774 + } 1775 + 1776 + static int psp_securedisplay_terminate(struct psp_context *psp) 1777 + { 1778 + int ret; 1779 + 1780 + /* 1781 + * TODO:bypass the terminate in sriov for now 1782 + */ 1783 + if (amdgpu_sriov_vf(psp->adev)) 1784 + return 0; 1785 + 1786 + if (!psp->securedisplay_context.securedisplay_initialized) 1787 + return 0; 1788 + 1789 + ret = psp_securedisplay_unload(psp); 1790 + if (ret) 1791 + return ret; 1792 + 1793 + psp->securedisplay_context.securedisplay_initialized = false; 1794 + 1795 + /* free securedisplay shared memory */ 1796 + amdgpu_bo_free_kernel(&psp->securedisplay_context.securedisplay_shared_bo, 1797 + &psp->securedisplay_context.securedisplay_shared_mc_addr, 1798 + &psp->securedisplay_context.securedisplay_shared_buf); 1799 + 1800 + return ret; 1801 + } 1802 + 1803 + int psp_securedisplay_invoke(struct psp_context *psp, uint32_t ta_cmd_id) 1804 + { 1805 + int ret; 1806 + 1807 + if (!psp->securedisplay_context.securedisplay_initialized) 1808 + return -EINVAL; 1809 + 1810 + if (ta_cmd_id != TA_SECUREDISPLAY_COMMAND__QUERY_TA && 1811 + ta_cmd_id != TA_SECUREDISPLAY_COMMAND__SEND_ROI_CRC) 1812 + return -EINVAL; 1813 + 1814 + mutex_lock(&psp->securedisplay_context.mutex); 1815 + 1816 + ret = psp_ta_invoke(psp, ta_cmd_id, psp->securedisplay_context.session_id); 1817 + 1818 + mutex_unlock(&psp->securedisplay_context.mutex); 1819 + 1820 + return ret; 1821 + } 1822 + /* SECUREDISPLAY end */ 1823 + 1656 1824 static int psp_hw_start(struct psp_context *psp) 1657 1825 { 1658 1826 struct amdgpu_device *adev = psp->adev; ··· 2296 2126 if (ret) 2297 2127 dev_err(psp->adev->dev, 2298 2128 "RAP: Failed to initialize RAP\n"); 2129 + 2130 + ret = psp_securedisplay_initialize(psp); 2131 + if (ret) 2132 + dev_err(psp->adev->dev, 2133 + "SECUREDISPLAY: Failed to initialize SECUREDISPLAY\n"); 2299 2134 } 2300 2135 2301 2136 return 0; ··· 2351 2176 2352 2177 if (psp->adev->psp.ta_fw) { 2353 2178 psp_ras_terminate(psp); 2179 + psp_securedisplay_terminate(psp); 2354 2180 psp_rap_terminate(psp); 2355 2181 psp_dtm_terminate(psp); 2356 2182 psp_hdcp_terminate(psp); ··· 2414 2238 ret = psp_rap_terminate(psp); 2415 2239 if (ret) { 2416 2240 DRM_ERROR("Failed to terminate rap ta\n"); 2241 + return ret; 2242 + } 2243 + ret = psp_securedisplay_terminate(psp); 2244 + if (ret) { 2245 + DRM_ERROR("Failed to terminate securedisplay ta\n"); 2417 2246 return ret; 2418 2247 } 2419 2248 } ··· 2504 2323 if (ret) 2505 2324 dev_err(psp->adev->dev, 2506 2325 "RAP: Failed to initialize RAP\n"); 2326 + 2327 + ret = psp_securedisplay_initialize(psp); 2328 + if (ret) 2329 + dev_err(psp->adev->dev, 2330 + "SECUREDISPLAY: Failed to initialize SECUREDISPLAY\n"); 2507 2331 } 2508 2332 2509 2333 mutex_unlock(&adev->firmware.mutex); ··· 2814 2628 psp->ta_rap_ucode_version = le32_to_cpu(desc->fw_version); 2815 2629 psp->ta_rap_ucode_size = le32_to_cpu(desc->size_bytes); 2816 2630 psp->ta_rap_start_addr = ucode_start_addr; 2631 + break; 2632 + case TA_FW_TYPE_PSP_SECUREDISPLAY: 2633 + psp->ta_securedisplay_ucode_version = le32_to_cpu(desc->fw_version); 2634 + psp->ta_securedisplay_ucode_size = le32_to_cpu(desc->size_bytes); 2635 + psp->ta_securedisplay_start_addr = ucode_start_addr; 2817 2636 break; 2818 2637 default: 2819 2638 dev_warn(psp->adev->dev, "Unsupported TA type: %d\n", desc->fw_type);
+17
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
··· 30 30 #include "ta_xgmi_if.h" 31 31 #include "ta_ras_if.h" 32 32 #include "ta_rap_if.h" 33 + #include "ta_secureDisplay_if.h" 33 34 34 35 #define PSP_FENCE_BUFFER_SIZE 0x1000 35 36 #define PSP_CMD_BUFFER_SIZE 0x1000 ··· 41 40 #define PSP_HDCP_SHARED_MEM_SIZE 0x4000 42 41 #define PSP_DTM_SHARED_MEM_SIZE 0x4000 43 42 #define PSP_RAP_SHARED_MEM_SIZE 0x4000 43 + #define PSP_SECUREDISPLAY_SHARED_MEM_SIZE 0x4000 44 44 #define PSP_SHARED_MEM_SIZE 0x4000 45 45 #define PSP_FW_NAME_LEN 0x24 46 46 ··· 173 171 struct mutex mutex; 174 172 }; 175 173 174 + struct psp_securedisplay_context { 175 + bool securedisplay_initialized; 176 + uint32_t session_id; 177 + struct amdgpu_bo *securedisplay_shared_bo; 178 + uint64_t securedisplay_shared_mc_addr; 179 + void *securedisplay_shared_buf; 180 + struct mutex mutex; 181 + }; 182 + 176 183 #define MEM_TRAIN_SYSTEM_SIGNATURE 0x54534942 177 184 #define GDDR6_MEM_TRAINING_DATA_SIZE_IN_BYTES 0x1000 178 185 #define GDDR6_MEM_TRAINING_OFFSET 0x8000 ··· 309 298 uint32_t ta_rap_ucode_size; 310 299 uint8_t *ta_rap_start_addr; 311 300 301 + uint32_t ta_securedisplay_ucode_version; 302 + uint32_t ta_securedisplay_ucode_size; 303 + uint8_t *ta_securedisplay_start_addr; 304 + 312 305 struct psp_asd_context asd_context; 313 306 struct psp_xgmi_context xgmi_context; 314 307 struct psp_ras_context ras; 315 308 struct psp_hdcp_context hdcp_context; 316 309 struct psp_dtm_context dtm_context; 317 310 struct psp_rap_context rap_context; 311 + struct psp_securedisplay_context securedisplay_context; 318 312 struct mutex mutex; 319 313 struct psp_memory_training_context mem_train_ctx; 320 314 }; ··· 396 380 int psp_hdcp_invoke(struct psp_context *psp, uint32_t ta_cmd_id); 397 381 int psp_dtm_invoke(struct psp_context *psp, uint32_t ta_cmd_id); 398 382 int psp_rap_invoke(struct psp_context *psp, uint32_t ta_cmd_id); 383 + int psp_securedisplay_invoke(struct psp_context *psp, uint32_t ta_cmd_id); 399 384 400 385 int psp_rlc_autoload_start(struct psp_context *psp); 401 386
+176
drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c
··· 1 + /* 2 + * Copyright 2021 Advanced Micro Devices, Inc. 3 + * 4 + * Permission is hereby granted, free of charge, to any person obtaining a 5 + * copy of this software and associated documentation files (the "Software"), 6 + * to deal in the Software without restriction, including without limitation 7 + * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 + * and/or sell copies of the Software, and to permit persons to whom the 9 + * Software is furnished to do so, subject to the following conditions: 10 + * 11 + * The above copyright notice and this permission notice shall be included in 12 + * all copies or substantial portions of the Software. 13 + * 14 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 + * OTHER DEALINGS IN THE SOFTWARE. 21 + * 22 + * 23 + */ 24 + #include <linux/debugfs.h> 25 + #include <linux/pm_runtime.h> 26 + 27 + #include "amdgpu.h" 28 + #include "amdgpu_securedisplay.h" 29 + 30 + /** 31 + * DOC: AMDGPU SECUREDISPLAY debugfs test interface 32 + * 33 + * how to use? 34 + * echo opcode <value> > <debugfs_dir>/dri/xxx/securedisplay_test 35 + * eg. echo 1 > <debugfs_dir>/dri/xxx/securedisplay_test 36 + * eg. echo 2 phy_id > <debugfs_dir>/dri/xxx/securedisplay_test 37 + * 38 + * opcode: 39 + * 1:Query whether TA is responding used only for validation pupose 40 + * 2: Send region of Interest and CRC value to I2C. (uint32)phy_id is 41 + * send to determine which DIO scratch register should be used to get 42 + * ROI and receive i2c_buf as the output. 43 + * 44 + * You can refer more detail from header file ta_securedisplay_if.h 45 + * 46 + */ 47 + 48 + void psp_securedisplay_parse_resp_status(struct psp_context *psp, 49 + enum ta_securedisplay_status status) 50 + { 51 + switch (status) { 52 + case TA_SECUREDISPLAY_STATUS__SUCCESS: 53 + break; 54 + case TA_SECUREDISPLAY_STATUS__GENERIC_FAILURE: 55 + dev_err(psp->adev->dev, "Secure display: Generic Failure."); 56 + break; 57 + case TA_SECUREDISPLAY_STATUS__INVALID_PARAMETER: 58 + dev_err(psp->adev->dev, "Secure display: Invalid Parameter."); 59 + break; 60 + case TA_SECUREDISPLAY_STATUS__NULL_POINTER: 61 + dev_err(psp->adev->dev, "Secure display: Null Pointer."); 62 + break; 63 + case TA_SECUREDISPLAY_STATUS__I2C_WRITE_ERROR: 64 + dev_err(psp->adev->dev, "Secure display: Failed to write to I2C."); 65 + break; 66 + case TA_SECUREDISPLAY_STATUS__READ_DIO_SCRATCH_ERROR: 67 + dev_err(psp->adev->dev, "Secure display: Failed to Read DIO Scratch Register."); 68 + break; 69 + case TA_SECUREDISPLAY_STATUS__READ_CRC_ERROR: 70 + dev_err(psp->adev->dev, "Secure display: Failed to Read CRC"); 71 + break; 72 + default: 73 + dev_err(psp->adev->dev, "Secure display: Failed to parse status: %d\n", status); 74 + } 75 + } 76 + 77 + void psp_prep_securedisplay_cmd_buf(struct psp_context *psp, struct securedisplay_cmd **cmd, 78 + enum ta_securedisplay_command command_id) 79 + { 80 + *cmd = (struct securedisplay_cmd *)psp->securedisplay_context.securedisplay_shared_buf; 81 + memset(*cmd, 0, sizeof(struct securedisplay_cmd)); 82 + (*cmd)->status = TA_SECUREDISPLAY_STATUS__GENERIC_FAILURE; 83 + (*cmd)->cmd_id = command_id; 84 + } 85 + 86 + static ssize_t amdgpu_securedisplay_debugfs_write(struct file *f, const char __user *buf, 87 + size_t size, loff_t *pos) 88 + { 89 + struct amdgpu_device *adev = (struct amdgpu_device *)file_inode(f)->i_private; 90 + struct psp_context *psp = &adev->psp; 91 + struct securedisplay_cmd *securedisplay_cmd; 92 + struct drm_device *dev = adev_to_drm(adev); 93 + uint32_t phy_id; 94 + uint32_t op; 95 + int i; 96 + char str[64]; 97 + char i2c_output[256]; 98 + int ret; 99 + 100 + if (*pos || size > sizeof(str) - 1) 101 + return -EINVAL; 102 + 103 + memset(str, 0, sizeof(str)); 104 + ret = copy_from_user(str, buf, size); 105 + if (ret) 106 + return -EFAULT; 107 + 108 + ret = pm_runtime_get_sync(dev->dev); 109 + if (ret < 0) { 110 + pm_runtime_put_autosuspend(dev->dev); 111 + return ret; 112 + } 113 + 114 + if (size < 3) 115 + sscanf(str, "%u ", &op); 116 + else 117 + sscanf(str, "%u %u", &op, &phy_id); 118 + 119 + switch (op) { 120 + case 1: 121 + psp_prep_securedisplay_cmd_buf(psp, &securedisplay_cmd, 122 + TA_SECUREDISPLAY_COMMAND__QUERY_TA); 123 + ret = psp_securedisplay_invoke(psp, TA_SECUREDISPLAY_COMMAND__QUERY_TA); 124 + if (!ret) { 125 + if (securedisplay_cmd->status == TA_SECUREDISPLAY_STATUS__SUCCESS) 126 + dev_info(adev->dev, "SECUREDISPLAY: query securedisplay TA ret is 0x%X\n", 127 + securedisplay_cmd->securedisplay_out_message.query_ta.query_cmd_ret); 128 + else 129 + psp_securedisplay_parse_resp_status(psp, securedisplay_cmd->status); 130 + } 131 + break; 132 + case 2: 133 + psp_prep_securedisplay_cmd_buf(psp, &securedisplay_cmd, 134 + TA_SECUREDISPLAY_COMMAND__SEND_ROI_CRC); 135 + securedisplay_cmd->securedisplay_in_message.send_roi_crc.phy_id = phy_id; 136 + ret = psp_securedisplay_invoke(psp, TA_SECUREDISPLAY_COMMAND__SEND_ROI_CRC); 137 + if (!ret) { 138 + if (securedisplay_cmd->status == TA_SECUREDISPLAY_STATUS__SUCCESS) { 139 + memset(i2c_output, 0, sizeof(i2c_output)); 140 + for (i = 0; i < TA_SECUREDISPLAY_I2C_BUFFER_SIZE; i++) 141 + sprintf(i2c_output, "%s 0x%X", i2c_output, 142 + securedisplay_cmd->securedisplay_out_message.send_roi_crc.i2c_buf[i]); 143 + dev_info(adev->dev, "SECUREDISPLAY: I2C buffer out put is :%s\n", i2c_output); 144 + } else { 145 + psp_securedisplay_parse_resp_status(psp, securedisplay_cmd->status); 146 + } 147 + } 148 + break; 149 + default: 150 + dev_err(adev->dev, "Invalid input: %s\n", str); 151 + } 152 + 153 + pm_runtime_mark_last_busy(dev->dev); 154 + pm_runtime_put_autosuspend(dev->dev); 155 + 156 + return size; 157 + } 158 + 159 + static const struct file_operations amdgpu_securedisplay_debugfs_ops = { 160 + .owner = THIS_MODULE, 161 + .read = NULL, 162 + .write = amdgpu_securedisplay_debugfs_write, 163 + .llseek = default_llseek 164 + }; 165 + 166 + void amdgpu_securedisplay_debugfs_init(struct amdgpu_device *adev) 167 + { 168 + #if defined(CONFIG_DEBUG_FS) 169 + 170 + if (!adev->psp.securedisplay_context.securedisplay_initialized) 171 + return; 172 + 173 + debugfs_create_file("securedisplay_test", S_IWUSR, adev_to_drm(adev)->primary->debugfs_root, 174 + adev, &amdgpu_securedisplay_debugfs_ops); 175 + #endif 176 + }
+36
drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.h
··· 1 + /* 2 + * Copyright 2021 Advanced Micro Devices, Inc. 3 + * 4 + * Permission is hereby granted, free of charge, to any person obtaining a 5 + * copy of this software and associated documentation files (the "Software"), 6 + * to deal in the Software without restriction, including without limitation 7 + * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 + * and/or sell copies of the Software, and to permit persons to whom the 9 + * Software is furnished to do so, subject to the following conditions: 10 + * 11 + * The above copyright notice and this permission notice shall be included in 12 + * all copies or substantial portions of the Software. 13 + * 14 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 + * OTHER DEALINGS IN THE SOFTWARE. 21 + * 22 + * 23 + */ 24 + #ifndef _AMDGPU_SECUREDISPLAY_H 25 + #define _AMDGPU_SECUREDISPLAY_H 26 + 27 + #include "amdgpu.h" 28 + #include "ta_secureDisplay_if.h" 29 + 30 + void amdgpu_securedisplay_debugfs_init(struct amdgpu_device *adev); 31 + void psp_securedisplay_parse_resp_status(struct psp_context *psp, 32 + enum ta_securedisplay_status status); 33 + void psp_prep_securedisplay_cmd_buf(struct psp_context *psp, struct securedisplay_cmd **cmd, 34 + enum ta_securedisplay_command command_id); 35 + 36 + #endif
+4
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h
··· 122 122 uint32_t ta_dtm_ucode_version; 123 123 uint32_t ta_dtm_offset_bytes; 124 124 uint32_t ta_dtm_size_bytes; 125 + uint32_t ta_securedisplay_ucode_version; 126 + uint32_t ta_securedisplay_offset_bytes; 127 + uint32_t ta_securedisplay_size_bytes; 125 128 }; 126 129 127 130 enum ta_fw_type { ··· 135 132 TA_FW_TYPE_PSP_HDCP, 136 133 TA_FW_TYPE_PSP_DTM, 137 134 TA_FW_TYPE_PSP_RAP, 135 + TA_FW_TYPE_PSP_SECUREDISPLAY, 138 136 }; 139 137 140 138 struct ta_fw_bin_desc {
+10 -2
drivers/gpu/drm/amd/amdgpu/psp_v10_0.c
··· 92 92 (uint8_t *)ta_hdr + 93 93 le32_to_cpu(ta_hdr->header.ucode_array_offset_bytes); 94 94 95 - adev->psp.ta_fw_version = le32_to_cpu(ta_hdr->header.ucode_version); 96 - 97 95 adev->psp.ta_dtm_ucode_version = 98 96 le32_to_cpu(ta_hdr->ta_dtm_ucode_version); 99 97 adev->psp.ta_dtm_ucode_size = ··· 99 101 adev->psp.ta_dtm_start_addr = 100 102 (uint8_t *)adev->psp.ta_hdcp_start_addr + 101 103 le32_to_cpu(ta_hdr->ta_dtm_offset_bytes); 104 + 105 + adev->psp.ta_securedisplay_ucode_version = 106 + le32_to_cpu(ta_hdr->ta_securedisplay_ucode_version); 107 + adev->psp.ta_securedisplay_ucode_size = 108 + le32_to_cpu(ta_hdr->ta_securedisplay_size_bytes); 109 + adev->psp.ta_securedisplay_start_addr = 110 + (uint8_t *)adev->psp.ta_hdcp_start_addr + 111 + le32_to_cpu(ta_hdr->ta_securedisplay_offset_bytes); 112 + 113 + adev->psp.ta_fw_version = le32_to_cpu(ta_hdr->header.ucode_version); 102 114 } 103 115 104 116 return 0;