drm/amdgpu/discovery: add harvest info data table
Subsystems (4)
PATCH 100/459 drm/amdgpu/discovery: add harvest info data table
From: Xiaojie Yuan <[email protected]>
--- drivers/gpu/drm/amd/include/discovery.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/include/discovery.h +17 -1
@@ -33,7 +33,7 @@ typedef enum {IP_DISCOVERY =0 ,GC , -TABLE_3 , +HARVEST_INFO ,TABLE_4 ,RESERVED_1 , RESERVED_2,
@@ -144,6 +144,22 @@ struct gc_info_v1_0 { uint32_t gc_num_gl2a; }; +typedef struct harvest_info_header { +uint32_t signature;/* Table Signature */ +uint32_t version;/* Table Version */ +}harvest_info_header ; + +typedef struct harvest_info { +uint16_t hw_id;/* Hardware ID */ +uint8_t number_instance;/* Instance of the IP */ +uint8_t reserved;/* Reserved for alignment */ +}harvest_info ; + +typedef struct harvest_table { +harvest_info_header header; +harvest_info list[32 ]; +}harvest_table ; +#pragma pack()#endif
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20190617192704.18038-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org
PATCH 101/459 drm/amdgpu/discovery: use hardcoded mmRCC_CONFIG_MEMSIZE
From: Xiaojie Yuan <[email protected]>
register base offset of nbio is not known before IP Discovery table is parsed, so hardcode this value.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +6 -6
@@ -28,10 +28,11 @@#include "nbio/nbio_2_3_offset.h" #include "discovery.h" -#define mmMM_INDEX 0x0 -#define mmMM_INDEX_HI 0x6 -#define mmMM_DATA 0x1 -#define HW_ID_MAX 300 +#define mmRCC_CONFIG_MEMSIZE 0xde3 +#define mmMM_INDEX 0x0 +#define mmMM_INDEX_HI 0x6 +#define mmMM_DATA 0x1 +#define HW_ID_MAX 300const char *hw_id_names[HW_ID_MAX ] = { [MP1_HWID ] ="MP1" ,
@@ -134,8 +135,7 @@ static int hw_id_map[MAX_HWIP] = {static int amdgpu_discovery_read_binary (struct amdgpu_device *adev,uint8_t *binary) {uint32_t *p = (uint32_t *)binary; -uint64_t vram_size =RREG32_SOC15 (NBIO ,0 , - mmRCC_DEV0_EPF0_RCC_CONFIG_MEMSIZE) *1024 *1024 ; +uint64_t vram_size = (uint64_t )RREG32 (mmRCC_CONFIG_MEMSIZE) <<20 ;uint64_t pos = vram_size -BINARY_MAX_SIZE ;unsigned long flags;
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 102/459 drm/amdgpu/discovery: fix hwid for nbio
In reply to a message not in the archiveFrom: Xiaojie Yuan <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +1 -1
@@ -117,7 +117,7 @@ static int hw_id_map[MAX_HWIP] = { [SDMA1_HWIP] = SDMA1_HWID, [MMHUB_HWIP] = MMHUB_HWID, [ATHUB_HWIP] = ATHUB_HWID, - [NBIO_HWIP] = DBGU_NBIO_HWID, + [NBIO_HWIP] = NBIF_HWID, [MP0_HWIP] = MP0_HWID, [MP1_HWIP] = MP1_HWID, [UVD_HWIP] = UVD_HWID,
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 103/459 drm/amdgpu/discovery: stop taking psp header into account
In reply to a message not in the archiveFrom: Xiaojie Yuan <[email protected]>
psp will write a header to vram, but the value exposed in RCC_CONFIG_MEMSIZE does not include the memory that this header is written to. Therefore, the interpretation of the table does not need to take the psp header into account.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +5 -6
@@ -189,7 +189,7 @@ int amdgpu_discovery_init(struct amdgpu_device *adev) goto out; } - bhdr = (struct binary_header *)(adev->discovery +PSP_HEADER_SIZE ); + bhdr = (struct binary_header *)adev->discovery;if (le32_to_cpu (bhdr->binary_signature) !=BINARY_SIGNATURE ) {DRM_ERROR ("invalid ip discovery binary signature\n" );
@@ -197,8 +197,7 @@ int amdgpu_discovery_init(struct amdgpu_device *adev) goto out; } - offset =PSP_HEADER_SIZE + - offsetof(struct binary_header , binary_checksum) + + offset = offsetof(struct binary_header , binary_checksum) +sizeof (bhdr->binary_checksum); size = bhdr->binary_size - offset; checksum = bhdr->binary_checksum;
@@ -275,7 +274,7 @@ int amdgpu_discovery_reg_base_init(struct amdgpu_device *adev)return -EINVAL ; } - bhdr = (struct binary_header *)(adev->discovery +PSP_HEADER_SIZE ); + bhdr = (struct binary_header *)adev->discovery; ihdr = (struct ip_discovery_header *)(adev->discovery +le16_to_cpu (bhdr->table_list[IP_DISCOVERY ].offset)); num_dies =le16_to_cpu (ihdr->num_dies);
@@ -338,7 +337,7 @@ int amdgpu_discovery_get_ip_version(struct amdgpu_device *adev, int hw_id,return -EINVAL ; } - bhdr = (struct binary_header *)(adev->discovery +PSP_HEADER_SIZE ); + bhdr = (struct binary_header *)adev->discovery; ihdr = (struct ip_discovery_header *)(adev->discovery +le16_to_cpu (bhdr->table_list[IP_DISCOVERY ].offset)); num_dies =le16_to_cpu (ihdr->num_dies);
@@ -376,7 +375,7 @@ int amdgpu_discovery_get_gfx_info(struct amdgpu_device *adev)return -EINVAL ; } - bhdr = (struct binary_header *)(adev->discovery +PSP_HEADER_SIZE ); + bhdr = (struct binary_header *)adev->discovery; gc_info = (struct gc_info_v1_0 *)(adev->discovery +le16_to_cpu (bhdr->table_list[GC ].offset));
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 104/459 drm/amdgpu/discovery: update definition for struct die_header
In reply to a message not in the archiveFrom: Xiaojie Yuan <[email protected]>
--- drivers/gpu/drm/amd/include/discovery.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/include/discovery.h +2 -2
@@ -99,8 +99,8 @@ typedef struct iptypedef struct die_header { -uint32_t die_id; -uint32_t num_ips; +uint16_t die_id; +uint16_t num_ips; }die_header ; typedef struct ip_structure
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 105/459 drm/amdgpu/discovery: stop converting the units of base addresses
In reply to a message not in the archiveFrom: Xiaojie Yuan <[email protected]>
the unit is already in dword
--- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +3 -3
@@ -300,11 +300,11 @@ int amdgpu_discovery_reg_base_init(struct amdgpu_device *adev)for (k =0 ; k < num_base_address; k++) {/* -* convert the endianness and unit (in dword) of base addresses in place, +* convert the endianness of base addresses in place, * so that we don't need to convert them when accessing adev->reg_offset. */ - ip->base_address[k] =le32_to_cpu (ip->base_address[k]) >>2 ; -DRM_DEBUG ("\t0x%08x\n" , ip->base_address[k] <<2 ); + ip->base_address[k] =le32_to_cpu (ip->base_address[k]); +DRM_DEBUG ("\t0x%08x\n" , ip->base_address[k]); } adev->reg_offset[hw_ip][ip->number_instance] =
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 106/459 drm/amdgpu/discovery: add module param for ip discovery enablement
In reply to a message not in the archiveFrom: Xiaojie Yuan <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 10 ++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 5 +++++ 3 files changed, 16 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
@@ -161,6 +161,7 @@ extern int amdgpu_ras_enable;extern uint amdgpu_ras_mask;extern int amdgpu_async_gfx_ring;extern int amdgpu_mcbp; +extern int amdgpu_discovery;#ifdef CONFIG_DRM_AMDGPU_SI extern int amdgpu_si_support;
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +10 -0
@@ -2577,6 +2577,14 @@ int amdgpu_device_init(struct amdgpu_device *adev,if (amdgpu_mcbp)DRM_INFO ("MCBP is enabled\n" ); +if (amdgpu_discovery) { + r =amdgpu_discovery_init (adev); +if (r) { +dev_err (adev->dev,"amdgpu_discovery_init failed\n" ); +return r; + } + } +/* early init functions */ r =amdgpu_device_ip_early_init (adev);if (r)
@@ -2832,6 +2840,8 @@ void amdgpu_device_fini(struct amdgpu_device *adev)device_remove_file (adev->dev, &dev_attr_pcie_replay_count);amdgpu_ucode_sysfs_fini (adev);amdgpu_debugfs_preempt_cleanup (adev); +if (amdgpu_discovery) +amdgpu_discovery_fini (adev); }
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +5 -0
@@ -138,6 +138,7 @@ uint amdgpu_smu_memory_pool_size = 0;uint amdgpu_dc_feature_mask =0 ;int amdgpu_async_gfx_ring =1 ;int amdgpu_mcbp =0 ; +int amdgpu_discovery =0 ;struct amdgpu_mgpu_info mgpu_info = { .mutex =__MUTEX_INITIALIZER (mgpu_info.mutex),
@@ -579,6 +580,10 @@ MODULE_PARM_DESC(mcbp, "Enable Mid-command buffer preemption (0 = disabled (default), 1 = enabled)");module_param_named (mcbp, amdgpu_mcbp, int,0444 ); +MODULE_PARM_DESC (discovery, +"Allow driver to discover hardware IPs from IP Discovery table at the top of VRAM" ); +module_param_named (discovery, amdgpu_discovery, int,0444 ); +#ifdef CONFIG_HSA_AMD /** * DOC: sched_policy (int)
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 107/459 drm/amdgpu/discovery: refactor ip list traversal
In reply to a message not in the archiveFrom: Xiaojie Yuan <[email protected]>
for each ip, check whether it is needed by amdgpu driver, if yes, record its base addresses
v2: change some DRM_INFO to DRM_DEBUG
v3: remove unused variable (Alex)
--- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 71 +++++++++++-------- 1 file changed, 42 insertions(+), 29 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +42 -29
@@ -266,7 +266,6 @@ int amdgpu_discovery_reg_base_init(struct amdgpu_device *adev)uint16_t num_ips;uint8_t num_base_address;int hw_ip; -int hw_id;int i, j, k;if (!adev->discovery) {
@@ -279,40 +278,54 @@ int amdgpu_discovery_reg_base_init(struct amdgpu_device *adev) le16_to_cpu(bhdr->table_list[IP_DISCOVERY].offset)); num_dies =le16_to_cpu (ihdr->num_dies); -for (hw_ip =0 ; hw_ip <MAX_HWIP ; hw_ip++) { - hw_id = hw_id_map[hw_ip]; - -for (i =0 ; i < num_dies; i++) { - die_offset =le16_to_cpu (ihdr->die_info[i].die_offset); - dhdr = (struct die_header *)(adev->discovery + die_offset); - num_ips =le16_to_cpu (dhdr->num_ips); - ip_offset = die_offset +sizeof (*dhdr); - -for (j =0 ; j < num_ips; j++) { - ip = (struct ip *)(adev->discovery + ip_offset); - num_base_address = ip->num_base_address; - -if (le16_to_cpu (ip->hw_id) == hw_id) { -DRM_DEBUG ("%s(%d) v%d.%d.%d:\n" , - hw_id_names[hw_id], hw_id, - ip->major, ip->minor, - ip->revision); - -for (k =0 ; k < num_base_address; k++) { -/* -* convert the endianness of base addresses in place, -* so that we don't need to convert them when accessing adev->reg_offset. -*/ - ip->base_address[k] =le32_to_cpu (ip->base_address[k]); -DRM_DEBUG ("\t0x%08x\n" , ip->base_address[k]); - } +DRM_DEBUG ("number of dies: %d\n" , num_dies); +for (i =0 ; i < num_dies; i++) { + die_offset =le16_to_cpu (ihdr->die_info[i].die_offset); + dhdr = (struct die_header *)(adev->discovery + die_offset); + num_ips =le16_to_cpu (dhdr->num_ips); + ip_offset = die_offset +sizeof (*dhdr); + +if (le16_to_cpu (dhdr->die_id) != i) { +DRM_ERROR ("invalid die id %d, expected %d\n" , +le16_to_cpu (dhdr->die_id), i); +return -EINVAL ; + } + +DRM_DEBUG ("number of hardware IPs on die%d: %d\n" , +le16_to_cpu (dhdr->die_id), num_ips); + +for (j =0 ; j < num_ips; j++) { + ip = (struct ip *)(adev->discovery + ip_offset); + num_base_address = ip->num_base_address; + +DRM_DEBUG ("%s(%d) #%d v%d.%d.%d:\n" , + hw_id_names[le16_to_cpu (ip->hw_id)], +le16_to_cpu (ip->hw_id), + ip->number_instance, + ip->major, ip->minor, + ip->revision); + +for (k =0 ; k < num_base_address; k++) { +/* +* convert the endianness of base addresses in place, +* so that we don't need to convert them when accessing adev->reg_offset. +*/ + ip->base_address[k] =le32_to_cpu (ip->base_address[k]); +DRM_DEBUG ("\t0x%08x\n" , ip->base_address[k]); + } + +for (hw_ip =0 ; hw_ip <MAX_HWIP ; hw_ip++) { +if (hw_id_map[hw_ip] ==le16_to_cpu (ip->hw_id)) { +DRM_INFO ("set register base offset for %s\n" , + hw_id_names[le16_to_cpu (ip->hw_id)]); adev->reg_offset[hw_ip][ip->number_instance] = ip->base_address; } - ip_offset +=sizeof (*ip) +4 * (ip->num_base_address -1 ); } + + ip_offset +=sizeof (*ip) +4 * (ip->num_base_address -1 ); } }
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 108/459 drm/amdgpu: disable concurrent flushes for Navi10 v2
In reply to a message not in the archiveFrom: Christian König <[email protected]>
Navi10 have a bug in the SDMA which can theoretically cause memory corruption with concurrent VMID flushes
v2: explicitely check Navi10
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c +5 -2
@@ -364,8 +364,11 @@ static int amdgpu_vmid_grab_used(struct amdgpu_vm *vm,if (updates && (!flushed ||dma_fence_is_later (updates, flushed))) needs_flush = true; -/* Concurrent flushes are only possible starting with Vega10 */ -if (adev->asic_type <CHIP_VEGA10 && needs_flush) +/* Concurrent flushes are only possible starting with Vega10 and +* are broken on Navi10 and Navi14. +*/ +if (needs_flush && (adev->asic_type <CHIP_VEGA10 || + adev->asic_type ==CHIP_NAVI10 ))continue ;/* Good, we can use this VMID. Remember this submission as
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 109/459 drm/amdgpu: add pa_sc_tile_steering_override to drm_amdgpu_info_device
In reply to a message not in the archiveFrom: Hawking Zhang <[email protected]>
the initial/default value of pa_sc_tile_steering_override need to be exposed to user mode driver
--- include/uapi/drm/amdgpu_drm.h | 2 ++ 1 file changed, 2 insertions(+)
include/uapi/drm/amdgpu_drm.h +2 -0
@@ -995,6 +995,8 @@ struct drm_amdgpu_info_device {__u64 high_va_offset;/** The maximum high virtual address */ __u64 high_va_max; +/* gfx10 pa_sc_tile_steering_override */ +__u32 pa_sc_tile_steering_override; };struct drm_amdgpu_info_hw_ip {
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 110/459 drm/amdgpu: set the default value of pa_sc_tile_steering_override
In reply to a message not in the archiveFrom: Hawking Zhang <[email protected]>
So userspace can access it.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +4 -0
@@ -762,6 +762,10 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file dev_info.gs_prim_buffer_depth = adev->gfx.config.gs_prim_buffer_depth; dev_info.max_gs_waves_per_vgt = adev->gfx.config.max_gs_threads; +if (adev->family >=AMDGPU_FAMILY_NV ) + dev_info.pa_sc_tile_steering_override = + adev->gfx.config.pa_sc_tile_steering_override; +return copy_to_user (out, &dev_info,min ((size_t )size,sizeof (dev_info))) ? -EFAULT :0 ; }
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 111/459 drm/amdgpu: add initial support for sdma v5.0 (v6)
In reply to a message not in the archiveFrom: Hawking Zhang <[email protected]>
SDMA (System DMA) is a general purpose DMA engine usable by UMDs for transfers or the kernel for paging or GPUVM updates.
v1: support basic funcitonalites includes rb, ib, vm,
copy buffer and trap irq
v2: convert to use new get_vm_pde in emit_vm_flush
v3: retire amdgpu_ttm_set_active_vram_size from sdma v5
v4: retire the redundant hdp_invalidate implementation
v5: squash in updates
v6: some golden regs moved to vbios
--- drivers/gpu/drm/amd/amdgpu/Makefile | 3 +- drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 1685 ++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/sdma_v5_0.h | 45 + 3 files changed, 1732 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c create mode 100644 drivers/gpu/drm/amd/amdgpu/sdma_v5_0.h
drivers/gpu/drm/amd/amdgpu/Makefile +2 -1
@@ -117,7 +117,8 @@ amdgpu-y += \ amdgpu_sdma.o \ sdma_v2_4.o \ sdma_v3_0.o \ - sdma_v4_0.o + sdma_v4_0.o \ + sdma_v5_0.o # add UVD block amdgpu-y += \
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c new file +1685 -0
1,685 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.h new file +45 -0
45 lines not on this page · raw message
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 112/459 drm/amdgpu: add Navi10 VCN firmware support
In reply to a message not in the archiveFrom: Leo Liu <[email protected]>
Add Navi10 to VCN family
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +5 -0
@@ -45,10 +45,12 @@#define FIRMWARE_RAVEN "amdgpu/raven_vcn.bin"#define FIRMWARE_PICASSO "amdgpu/picasso_vcn.bin"#define FIRMWARE_RAVEN2 "amdgpu/raven2_vcn.bin" +#define FIRMWARE_NAVI10 "amdgpu/navi10_vcn.bin"MODULE_FIRMWARE (FIRMWARE_RAVEN );MODULE_FIRMWARE (FIRMWARE_PICASSO );MODULE_FIRMWARE (FIRMWARE_RAVEN2 ); +MODULE_FIRMWARE (FIRMWARE_NAVI10 );static void amdgpu_vcn_idle_work_handler (struct work_struct *work);
@@ -71,6 +73,9 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev)else fw_name =FIRMWARE_RAVEN ;break ; +case CHIP_NAVI10 : + fw_name =FIRMWARE_NAVI10 ; +break ;default :return -EINVAL ; }
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 113/459 drm/amdgpu: add VCN2.0 decode ring test
In reply to a message not in the archiveFrom: Leo Liu <[email protected]>
Add internal register offset for registers involving in ring tests
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 8 +++----- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h | 5 +++++ drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c | 3 +++ 3 files changed, 11 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +3 -5
@@ -312,17 +312,15 @@ int amdgpu_vcn_dec_ring_test_ring(struct amdgpu_ring *ring)unsigned i;int r; -WREG32 (SOC15_REG_OFFSET (UVD ,0 , mmUVD_SCRATCH9),0xCAFEDEAD ); +WREG32 (adev->vcn.external.scratch9,0xCAFEDEAD ); r =amdgpu_ring_alloc (ring,3 );if (r)return r; - -amdgpu_ring_write (ring, -PACKET0 (SOC15_REG_OFFSET (UVD ,0 , mmUVD_SCRATCH9),0 )); +amdgpu_ring_write (ring,PACKET0 (adev->vcn.internal.scratch9,0 ));amdgpu_ring_write (ring,0xDEADBEEF );amdgpu_ring_commit (ring);for (i =0 ; i < adev->usec_timeout; i++) { - tmp =RREG32 (SOC15_REG_OFFSET (UVD ,0 , mmUVD_SCRATCH9)); + tmp =RREG32 (adev->vcn.external.scratch9);if (tmp ==0xDEADBEEF )break ;DRM_UDELAY (1 );
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +5 -0
@@ -87,6 +87,10 @@ struct dpg_pause_state {enum internal_dpg_state jpeg; }; +struct amdgpu_vcn_reg { +unsigned scratch9; +}; +struct amdgpu_vcn {struct amdgpu_bo *vcpu_bo;void *cpu_addr;
@@ -102,6 +106,7 @@ struct amdgpu_vcn {unsigned num_enc_rings;enum amd_powergating_state cur_state;struct dpg_pause_state pause_state; +struct amdgpu_vcn_reg internal, external;int (*pause_dpg_mode)(struct amdgpu_device *adev,struct dpg_pause_state *new_state); };
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +3 -0
@@ -128,6 +128,9 @@ static int vcn_v1_0_sw_init(void *handle)if (r)return r; + adev->vcn.internal.scratch9 = adev->vcn.external.scratch9 = +SOC15_REG_OFFSET (UVD ,0 , mmUVD_SCRATCH9); +for (i =0 ; i < adev->vcn.num_enc_rings; ++i) { ring = &adev->vcn.ring_enc[i];sprintf (ring->name,"vcn_enc%d" , i);
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 114/459 drm/amdgpu: add VCN2.0 decode ib test
In reply to a message not in the archiveFrom: Leo Liu <[email protected]>
Add internal register offset for registers involving in ib tests
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 8 ++++---- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h | 6 +++++- drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c | 8 ++++++++ 3 files changed, 17 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +4 -4
@@ -349,14 +349,14 @@ static int amdgpu_vcn_dec_send_msg(struct amdgpu_ring *ring, ib = &job->ibs[0 ]; addr =amdgpu_bo_gpu_offset (bo); - ib->ptr[0 ] =PACKET0 (SOC15_REG_OFFSET (UVD ,0 , mmUVD_GPCOM_VCPU_DATA0),0 ); + ib->ptr[0 ] =PACKET0 (adev->vcn.internal.data0,0 ); ib->ptr[1 ] = addr; - ib->ptr[2 ] =PACKET0 (SOC15_REG_OFFSET (UVD ,0 , mmUVD_GPCOM_VCPU_DATA1),0 ); + ib->ptr[2 ] =PACKET0 (adev->vcn.internal.data1,0 ); ib->ptr[3 ] = addr >>32 ; - ib->ptr[4 ] =PACKET0 (SOC15_REG_OFFSET (UVD ,0 , mmUVD_GPCOM_VCPU_CMD),0 ); + ib->ptr[4 ] =PACKET0 (adev->vcn.internal.cmd,0 ); ib->ptr[5 ] =0 ;for (i =6 ; i <16 ; i +=2 ) { - ib->ptr[i] =PACKET0 (SOC15_REG_OFFSET (UVD ,0 , mmUVD_NO_OP),0 ); + ib->ptr[i] =PACKET0 (adev->vcn.internal.nop,0 ); ib->ptr[i+1 ] =0 ; } ib->length_dw =16 ;
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +5 -1
@@ -25,7 +25,7 @@#define __AMDGPU_VCN_H__#define AMDGPU_VCN_STACK_SIZE (128*1024) -#define AMDGPU_VCN_CONTEXT_SIZE (512*1024) +#define AMDGPU_VCN_CONTEXT_SIZE (512*1024)#define AMDGPU_VCN_FIRMWARE_OFFSET 256#define AMDGPU_VCN_MAX_ENC_RINGS 3
@@ -88,6 +88,10 @@ struct dpg_pause_state { };struct amdgpu_vcn_reg { +unsigned data0; +unsigned data1; +unsigned cmd; +unsigned nop;unsigned scratch9; };
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +8 -0
@@ -130,6 +130,14 @@ static int vcn_v1_0_sw_init(void *handle) adev->vcn.internal.scratch9 = adev->vcn.external.scratch9 =SOC15_REG_OFFSET (UVD ,0 , mmUVD_SCRATCH9); + adev->vcn.internal.data0 = adev->vcn.external.data0 = +SOC15_REG_OFFSET (UVD ,0 , mmUVD_GPCOM_VCPU_DATA0); + adev->vcn.internal.data1 = adev->vcn.external.data1 = +SOC15_REG_OFFSET (UVD ,0 , mmUVD_GPCOM_VCPU_DATA1); + adev->vcn.internal.cmd = adev->vcn.external.cmd = +SOC15_REG_OFFSET (UVD ,0 , mmUVD_GPCOM_VCPU_CMD); + adev->vcn.internal.nop = adev->vcn.external.nop = +SOC15_REG_OFFSET (UVD ,0 , mmUVD_NO_OP);for (i =0 ; i < adev->vcn.num_enc_rings; ++i) { ring = &adev->vcn.ring_enc[i];
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 115/459 drm/amdgpu: add JPEG2.0 decode ring test
In reply to a message not in the archiveFrom: Leo Liu <[email protected]>
Use register from JPEG tile, the UVD tile reg won't work for JPEG
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 8 +++----- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h | 1 + drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c | 2 ++ 3 files changed, 6 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +3 -5
@@ -631,19 +631,17 @@ int amdgpu_vcn_jpeg_ring_test_ring(struct amdgpu_ring *ring)unsigned i;int r; -WREG32 (SOC15_REG_OFFSET (UVD ,0 , mmUVD_SCRATCH9),0xCAFEDEAD ); +WREG32 (adev->vcn.external.jpeg_pitch,0xCAFEDEAD ); r =amdgpu_ring_alloc (ring,3 ); -if (r)return r; -amdgpu_ring_write (ring, -PACKETJ (SOC15_REG_OFFSET (UVD ,0 , mmUVD_SCRATCH9),0 ,0 ,0 )); +amdgpu_ring_write (ring,PACKET0 (adev->vcn.internal.jpeg_pitch,0 ));amdgpu_ring_write (ring,0xDEADBEEF );amdgpu_ring_commit (ring);for (i =0 ; i < adev->usec_timeout; i++) { - tmp =RREG32 (SOC15_REG_OFFSET (UVD ,0 , mmUVD_SCRATCH9)); + tmp =RREG32 (adev->vcn.external.jpeg_pitch);if (tmp ==0xDEADBEEF )break ;DRM_UDELAY (1 );
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +1 -0
@@ -93,6 +93,7 @@ struct amdgpu_vcn_reg{unsigned cmd;unsigned nop;unsigned scratch9; +unsigned jpeg_pitch; };struct amdgpu_vcn {
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +2 -0
@@ -154,6 +154,8 @@ static int vcn_v1_0_sw_init(void *handle)return r; adev->vcn.pause_dpg_mode = vcn_v1_0_pause_dpg_mode; + adev->vcn.internal.jpeg_pitch = adev->vcn.external.jpeg_pitch = +SOC15_REG_OFFSET (UVD ,0 , mmUVD_JPEG_PITCH);return 0 ; }
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 116/459 drm/amdgpu: add JPEG2.0 decode ring ib test
In reply to a message not in the archiveFrom: Leo Liu <[email protected]>
Add internal register offset for registers involving in ib tests
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +2 -2
@@ -669,7 +669,7 @@ static int amdgpu_vcn_jpeg_set_reg(struct amdgpu_ring *ring, uint32_t handle, ib = &job->ibs[0 ]; - ib->ptr[0 ] =PACKETJ (SOC15_REG_OFFSET (UVD ,0 , mmUVD_SCRATCH9),0 ,0 ,PACKETJ_TYPE0 ); + ib->ptr[0 ] =PACKETJ (adev->vcn.internal.jpeg_pitch,0 ,0 ,PACKETJ_TYPE0 ); ib->ptr[1 ] =0xDEADBEEF ;for (i =2 ; i <16 ; i +=2 ) { ib->ptr[i] =PACKETJ (0 ,0 ,0 ,PACKETJ_TYPE6 );
@@ -715,7 +715,7 @@ int amdgpu_vcn_jpeg_ring_test_ib(struct amdgpu_ring *ring, long timeout) }for (i =0 ; i < adev->usec_timeout; i++) { - tmp =RREG32 (SOC15_REG_OFFSET (UVD ,0 , mmUVD_SCRATCH9)); + tmp =RREG32 (adev->vcn.external.jpeg_pitch);if (tmp ==0xDEADBEEF )break ;DRM_UDELAY (1 );
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 117/459 drm/amdgpu: add initial VCN2.0 support (v2)
In reply to a message not in the archiveFrom: Leo Liu <[email protected]>
VCN (Video Core Next) is the video encode/decode block.
Porting over the same functions from VCN1.0
v2: squash in updates (Alex)
--- drivers/gpu/drm/amd/amdgpu/Makefile | 3 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h | 1 + drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c | 1865 +++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/vcn_v2_0.h | 29 + 4 files changed, 1897 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c create mode 100644 drivers/gpu/drm/amd/amdgpu/vcn_v2_0.h
drivers/gpu/drm/amd/amdgpu/Makefile +2 -1
@@ -136,7 +136,8 @@ amdgpu-y += \ # add VCN block amdgpu-y += \ amdgpu_vcn.o \ - vcn_v1_0.o + vcn_v1_0.o \ + vcn_v2_0.o # add ATHUB block amdgpu-y += \
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +1 -0
@@ -75,6 +75,7 @@ enum engine_status_constants {UVD_STATUS__BUSY =0x5 ,UVD_POWER_STATUS__UVD_POWER_STATUS_TILES_OFF =0x1 ,UVD_STATUS__RBC_BUSY =0x1 , + UVD_PGFSM_STATUS_UVDJ_PWR_ON = 0, }; enum internal_dpg_state {
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c new file +1865 -0
1,865 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.h new file +29 -0
@@ -0,0 +1,29 @@ +/* +* Copyright 2018 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +* +*/ + +#ifndef __VCN_V2_0_H__ +#define __VCN_V2_0_H__ + +extern const struct amdgpu_ip_block_version vcn_v2_0_ip_block; + +#endif /* __VCN_V2_0_H__ */
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 118/459 drm/amdgpu/mes: add amdgpu_mes driver parameter
In reply to a message not in the archiveFrom: Jack Xiao <[email protected]>
amdgpu_mes, which is a driver scope parameter, is used to whether enable mes or not.
MES (Micro Engine Scheduler) is the new on chip hw scheduling microcontroller. It can be used to handle queue scheduling and preemption and priorities.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 5 +++++ 2 files changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
@@ -162,6 +162,7 @@ extern uint amdgpu_ras_mask;extern int amdgpu_async_gfx_ring;extern int amdgpu_mcbp;extern int amdgpu_discovery; +extern int amdgpu_mes;#ifdef CONFIG_DRM_AMDGPU_SI extern int amdgpu_si_support;
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +5 -0
@@ -139,6 +139,7 @@ uint amdgpu_dc_feature_mask = 0;int amdgpu_async_gfx_ring =1 ;int amdgpu_mcbp =0 ;int amdgpu_discovery =0 ; +int amdgpu_mes =0 ;struct amdgpu_mgpu_info mgpu_info = { .mutex =__MUTEX_INITIALIZER (mgpu_info.mutex),
@@ -584,6 +585,10 @@ MODULE_PARM_DESC(discovery, "Allow driver to discover hardware IPs from IP Discovery table at the top of VRAM");module_param_named (discovery, amdgpu_discovery, int,0444 ); +MODULE_PARM_DESC (mes, +"Enable Micro Engine Scheduler (0 = disabled (default), 1 = enabled)" ); +module_param_named (mes, amdgpu_mes, int,0444 ); +#ifdef CONFIG_HSA_AMD /** * DOC: sched_policy (int)
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 119/459 drm/amdgpu/mes: add mes header file and definition
In reply to a message not in the archiveFrom: Jack Xiao <[email protected]>
Add dummy header file and definitions of mes.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 5 ++++ drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h | 31 +++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h
drivers/gpu/drm/amd/amdgpu/amdgpu.h +5 -0
@@ -85,6 +85,7 @@#include "amdgpu_amdkfd.h" #include "amdgpu_smu.h" #include "amdgpu_discovery.h" +#include "amdgpu_mes.h" #define MAX_GPU_INSTANCE 16
@@ -920,6 +921,10 @@ struct amdgpu_device {/* discovery */ uint8_t *discovery; +/* mes */ +bool enable_mes; +struct amdgpu_mes mes; +struct amdgpu_ip_block ip_blocks[AMDGPU_MAX_IP_NUM ];int num_ip_blocks;struct mutex mn_lock;
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h new file +31 -0
@@ -0,0 +1,31 @@ +/* +* Copyright 2019 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +* +*/ + +#ifndef __AMDGPU_MES_H__ +#define __AMDGPU_MES_H__ + +struct amdgpu_mes { + +}; + +#endif /* __AMDGPU_MES_H__ */
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 120/459 drm/amdgpu/mes: add definitions of ip callback function
In reply to a message not in the archiveFrom: Jack Xiao <[email protected]>
Abstract mes ip independent function layer.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h | 54 +++++++++++++++++++++++++ 1 file changed, 54 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h +54 -0
@@ -24,8 +24,62 @@#ifndef __AMDGPU_MES_H__#define __AMDGPU_MES_H__ +struct amdgpu_mes_funcs ; +struct amdgpu_mes { +struct amdgpu_adev *adev; + +/* ip specific functions */ +struct amdgpu_mes_funcs *funcs; +}; + +struct mes_add_queue_input { +uint32_t process_id; +uint64_t page_table_base_addr; +uint64_t process_va_start; +uint64_t process_va_end; +uint64_t process_quantum; +uint64_t process_context_addr; +uint64_t gang_quantum; +uint64_t gang_context_addr; +uint32_t inprocess_gang_priority; +uint32_t gang_global_priority_level; +uint32_t doorbell_offset; +uint64_t mqd_addr; +uint64_t wptr_addr; +uint32_t queue_type; +uint32_t paging; +}; + +struct mes_remove_queue_input { +uint32_t doorbell_offset; +uint64_t gang_context_addr; +}; + +struct mes_suspend_gang_input { +bool suspend_all_gangs; +uint64_t gang_context_addr; +uint64_t suspend_fence_addr; +uint32_t suspend_fence_value; +}; + +struct mes_resume_gang_input { +bool resume_all_gangs; +uint64_t gang_context_addr; +}; + +struct amdgpu_mes_funcs { +int (*add_hw_queue)(struct amdgpu_mes *mes, +struct mes_add_queue_input *input); + +int (*remove_hw_queue)(struct amdgpu_mes *mes, +struct mes_remove_queue_input *input); + +int (*suspend_gang)(struct amdgpu_mes *mes, +struct mes_suspend_gang_input *input); +int (*resume_gang)(struct amdgpu_mes *mes, +struct mes_resume_gang_input *input); };#endif /* __AMDGPU_MES_H__ */
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 121/459 drm/amdgpu/mes: enable mes on navi10 and later asic
In reply to a message not in the archiveFrom: Jack Xiao <[email protected]>
When amdgpu_mes is enabled and asic family is navi10 and later asic, enable mes per device.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3 -0
@@ -2577,6 +2577,9 @@ int amdgpu_device_init(struct amdgpu_device *adev,if (amdgpu_mcbp)DRM_INFO ("MCBP is enabled\n" ); +if (amdgpu_mes && adev->asic_type >=CHIP_NAVI10 ) + adev->enable_mes = true; +if (amdgpu_discovery) { r =amdgpu_discovery_init (adev);if (r) {
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 122/459 drm/amdgpu/mes10.1: add ip block mes10.1 (v2)
In reply to a message not in the archiveFrom: Jack Xiao <[email protected]>
MES takes over the scheduling capability of GFX and SDMA, add MES as a standalone ip.
v2: squash in updates (Alex)
--- drivers/gpu/drm/amd/amdgpu/Makefile | 4 + drivers/gpu/drm/amd/amdgpu/mes_v10_1.c | 103 +++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/mes_v10_1.h | 29 +++++++ drivers/gpu/drm/amd/include/amd_shared.h | 3 +- 4 files changed, 138 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/amd/amdgpu/mes_v10_1.c create mode 100644 drivers/gpu/drm/amd/amdgpu/mes_v10_1.h
drivers/gpu/drm/amd/amdgpu/Makefile +4 -0
@@ -120,6 +120,10 @@ amdgpu-y += \ sdma_v4_0.o \ sdma_v5_0.o +# add MES block +amdgpu-y += \ + mes_v10_1.o + # add UVD block amdgpu-y += \ amdgpu_uvd.o \
drivers/gpu/drm/amd/amdgpu/mes_v10_1.c new file +103 -0
103 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/mes_v10_1.h new file +29 -0
@@ -0,0 +1,29 @@ +/* +* Copyright 2019 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +* +*/ + +#ifndef __MES_V10_1_H__ +#define __MES_v10_1_H__ + +extern const struct amdgpu_ip_block_version mes_v10_1_ip_block; + +#endif
drivers/gpu/drm/amd/include/amd_shared.h +2 -1
@@ -52,7 +52,8 @@ enum amd_ip_block_type {AMD_IP_BLOCK_TYPE_UVD ,AMD_IP_BLOCK_TYPE_VCE ,AMD_IP_BLOCK_TYPE_ACP , -AMD_IP_BLOCK_TYPE_VCN +AMD_IP_BLOCK_TYPE_VCN , +AMD_IP_BLOCK_TYPE_MES }; enum amd_clockgating_state {
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 123/459 drm/amdgpu: add gfx v10 implementation (v8)
In reply to a message not in the archiveFrom: Hawking Zhang <[email protected]>
GFX is the graphics and compute block on the GPU.
v1: add initial gfx v10 implementation (Ray)
v2: convert to new get_vm_pde function in emit_vm_flush (Hawking)
v3: switch to new emit ib interfaces (Hawking)
v4: squash in updates (Alex)
v5: remove unused variables (Alex)
v6: v6: some golden regs moved to vbios (Alex)
v7: squash in some cleanups (Alex)
v8: squash in golden settings update (Alex)
--- drivers/gpu/drm/amd/amdgpu/Makefile | 3 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 4 +- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 5205 ++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/gfx_v10_0.h | 29 + 4 files changed, 5238 insertions(+), 3 deletions(-) create mode 100644 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c create mode 100644 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.h
drivers/gpu/drm/amd/amdgpu/Makefile +2 -1
@@ -110,7 +110,8 @@ amdgpu-y += \ amdgpu_gfx.o \ amdgpu_rlc.o \ gfx_v8_0.o \ - gfx_v9_0.o + gfx_v9_0.o \ + gfx_v10_0.o # add async DMA block amdgpu-y += \
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +2 -2
@@ -29,8 +29,8 @@#include <drm/drm_print.h> /* max number of rings */ -#define AMDGPU_MAX_RINGS 23 -#define AMDGPU_MAX_GFX_RINGS 1 +#define AMDGPU_MAX_RINGS 24 +#define AMDGPU_MAX_GFX_RINGS 2#define AMDGPU_MAX_COMPUTE_RINGS 8#define AMDGPU_MAX_VCE_RINGS 3#define AMDGPU_MAX_UVD_ENC_RINGS 2
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c new file +5205 -0
2,981 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.h new file +29 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Part of the diff is not shown here. View the raw message.
PATCH 124/459 drm/amdgpu: avoid to use SOC15_REG_OFFSET in static array for navi10
In reply to a message not in the archiveFrom: Hawking Zhang <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/soc15.c | 9 --------- drivers/gpu/drm/amd/amdgpu/soc15.h | 8 ++++++++ 2 files changed, 8 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/soc15.c +0 -9
@@ -274,15 +274,6 @@ static bool soc15_read_bios_from_rom(struct amdgpu_device *adev,return true; } -struct soc15_allowed_register_entry { -uint32_t hwip; -uint32_t inst; -uint32_t seg; -uint32_t reg_offset; -bool grbm_indexed; -}; - -static struct soc15_allowed_register_entry soc15_allowed_read_registers[] = { {SOC15_REG_ENTRY (GC ,0 , mmGRBM_STATUS)}, {SOC15_REG_ENTRY (GC ,0 , mmGRBM_STATUS2)},
drivers/gpu/drm/amd/amdgpu/soc15.h +8 -0
@@ -52,6 +52,14 @@ struct soc15_reg_entry {uint32_t instance; }; +struct soc15_allowed_register_entry { +uint32_t hwip; +uint32_t inst; +uint32_t seg; +uint32_t reg_offset; +bool grbm_indexed; +}; +#define SOC15_REG_ENTRY (ip, inst, reg) ip##_HWIP, inst, reg##_BASE_IDX, reg#define SOC15_REG_ENTRY_OFFSET (entry) (adev->reg_offset[entry.hwip][entry.inst][entry.seg] + entry.reg_offset)
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 125/459 drm/amdgpu: add navi10 common ip block (v3)
In reply to a message not in the archiveFrom: Hawking Zhang <[email protected]>
This adds the core SOC code for navi asics.
v1: add place holder and initial basic function (Ray)
v2: add new introduced functions to avoid reference
NULL pointer (Hawking)
v3L squash in updates (Alex)
--- drivers/gpu/drm/amd/amdgpu/Makefile | 2 +- drivers/gpu/drm/amd/amdgpu/navi10_reg_init.c | 66 ++ drivers/gpu/drm/amd/amdgpu/nv.c | 777 +++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/nv.h | 33 + 4 files changed, 877 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/amd/amdgpu/navi10_reg_init.c create mode 100644 drivers/gpu/drm/amd/amdgpu/nv.c create mode 100644 drivers/gpu/drm/amd/amdgpu/nv.h
drivers/gpu/drm/amd/amdgpu/Makefile +1 -1
@@ -64,7 +64,7 @@ amdgpu-$(CONFIG_DRM_AMDGPU_SI)+= si.o gmc_v6_0.o gfx_v6_0.o si_ih.o si_dma.o dce amdgpu-y += \ vi.o mxgpu_vi.o nbio_v6_1.o soc15.o emu_soc.o mxgpu_ai.o nbio_v7_0.o vega10_reg_init.o \ - vega20_reg_init.o nbio_v7_4.o nbio_v2_3.o + vega20_reg_init.o nbio_v7_4.o nbio_v2_3.o nv.o navi10_reg_init.o # add DF block amdgpu-y += \
drivers/gpu/drm/amd/amdgpu/navi10_reg_init.c new file +66 -0
66 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/nv.c new file +777 -0
777 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/nv.h new file +33 -0
@@ -0,0 +1,33 @@ +/* +* Copyright 2019 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +* +*/ + +#ifndef __NV_H__ +#define __NV_H__ + +#include "nbio_v2_3.h" + +void nv_grbm_select (struct amdgpu_device *adev, +u32 me,u32 pipe,u32 queue,u32 vmid); +int nv_set_ip_blocks (struct amdgpu_device *adev); +int navi10_reg_base_init (struct amdgpu_device *adev); +#endif
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 126/459 drm/amdgpu: Add navi10 kfd support for amdgpu (v3)
In reply to a message not in the archiveFrom: Hawking Zhang <[email protected]>
KFD (Kernel Fusion Driver) is the compute backend driver for AMD GPUs.
v2: squash in updates (Alex)
v3: fix warnings (Alex)
--- drivers/gpu/drm/amd/amdgpu/Makefile | 3 +- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 17 +- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h | 1 + .../drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c | 975 ++++++++++++++++++ 4 files changed, 992 insertions(+), 4 deletions(-) create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c
drivers/gpu/drm/amd/amdgpu/Makefile +2 -1
@@ -159,7 +159,8 @@ amdgpu-y += \ amdgpu_amdkfd_fence.o \ amdgpu_amdkfd_gpuvm.o \ amdgpu_amdkfd_gfx_v8.o \ - amdgpu_amdkfd_gfx_v9.o + amdgpu_amdkfd_gfx_v9.o \ + amdgpu_amdkfd_gfx_v10.o ifneq ($(CONFIG_DRM_AMDGPU_CIK),) amdgpu-y += amdgpu_amdkfd_gfx_v7.o
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +14 -3
@@ -87,6 +87,9 @@ void amdgpu_amdkfd_device_probe(struct amdgpu_device *adev)case CHIP_RAVEN : kfd2kgd =amdgpu_amdkfd_gfx_9_0_get_functions ();break ; +case CHIP_NAVI10 : + kfd2kgd =amdgpu_amdkfd_gfx_10_0_get_functions (); +break ;default :dev_info (adev->dev,"kfd not supported on this ASIC\n" );return ;
@@ -437,9 +440,12 @@ void amdgpu_amdkfd_get_local_mem_info(struct kgd_dev *kgd,if (amdgpu_sriov_vf (adev)) mem_info->mem_clk_max = adev->clock.default_mclk /100 ; -else if (adev->powerplay.pp_funcs) - mem_info->mem_clk_max =amdgpu_dpm_get_mclk (adev, false) /100 ; -else +else if (adev->powerplay.pp_funcs) { +if (amdgpu_emu_mode ==1 ) + mem_info->mem_clk_max =0 ; +else + mem_info->mem_clk_max =amdgpu_dpm_get_mclk (adev, false) /100 ; + }else mem_info->mem_clk_max =100 ; }
@@ -702,6 +708,11 @@ struct kfd2kgd_calls *amdgpu_amdkfd_gfx_9_0_get_functions(void)return NULL ; } +struct kfd2kgd_calls *amdgpu_amdkfd_gfx_10_0_get_functions (void ) +{ +return NULL ; +} +struct kfd_dev *kgd2kfd_probe (struct kgd_dev *kgd,struct pci_dev *pdev,const struct kfd2kgd_calls *f2g) {
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h +1 -0
@@ -139,6 +139,7 @@ void amdgpu_amdkfd_set_compute_idle(struct kgd_dev *kgd, bool idle);struct kfd2kgd_calls *amdgpu_amdkfd_gfx_7_get_functions (void );struct kfd2kgd_calls *amdgpu_amdkfd_gfx_8_0_get_functions (void );struct kfd2kgd_calls *amdgpu_amdkfd_gfx_9_0_get_functions (void ); +struct kfd2kgd_calls *amdgpu_amdkfd_gfx_10_0_get_functions (void );bool amdgpu_amdkfd_is_kfd_vmid (struct amdgpu_device *adev,u32 vmid);
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c new file +975 -0
975 lines not on this page · raw message
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 127/459 drm/amdgpu: update golden setting programming logic
In reply to a message not in the archiveFrom: Hawking Zhang <[email protected]>
Since from soc15, make sure only AndMasked bit get changed when applied or_mask
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 ++++- drivers/gpu/drm/amd/amdgpu/soc15.c | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4 -1
@@ -508,7 +508,10 @@ void amdgpu_device_program_register_sequence(struct amdgpu_device *adev, }else { tmp =RREG32 (reg); tmp &= ~and_mask; - tmp |= or_mask; +if (adev->family >=AMDGPU_FAMILY_AI ) + tmp |= (or_mask & and_mask); +else + tmp |= or_mask; }WREG32 (reg, tmp); }
drivers/gpu/drm/amd/amdgpu/soc15.c +1 -1
@@ -378,7 +378,7 @@ void soc15_program_register_sequence(struct amdgpu_device *adev, }else { tmp =RREG32 (reg); tmp &= ~(entry->and_mask); - tmp |= entry->or_mask; + tmp |= (entry->or_mask & entry->and_mask); } if (reg == SOC15_REG_OFFSET(GC, 0, mmPA_SC_BINNER_EVENT_CNTL_3) ||
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 128/459 drm/amdkfd: Add navi10 support to amdkfd. (v2)
In reply to a message not in the archiveFrom: Philip Cox <[email protected]>
KFD (kernel fusion driver) is the kernel driver
for the compute backend for usermode compute
stack.
v2: squash in updates (Alex)
--- drivers/gpu/drm/amd/amdkfd/Makefile | 3 + drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 5 + drivers/gpu/drm/amd/amdkfd/kfd_device.c | 21 +- .../drm/amd/amdkfd/kfd_device_queue_manager.c | 26 +- .../drm/amd/amdkfd/kfd_device_queue_manager.h | 2 + .../amd/amdkfd/kfd_device_queue_manager_v10.c | 87 +++ drivers/gpu/drm/amd/amdkfd/kfd_flat_memory.c | 1 + drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c | 3 + drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.h | 1 + .../gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c | 348 ++++++++++++ .../gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c | 519 ++++++++++++++++++ .../gpu/drm/amd/amdkfd/kfd_packet_manager.c | 3 + drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 11 +- drivers/gpu/drm/amd/amdkfd/kfd_process.c | 1 + drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 1 + 15 files changed, 1019 insertions(+), 13 deletions(-) create mode 100644 drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_v10.c create mode 100644 drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c create mode 100644 drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c
drivers/gpu/drm/amd/amdkfd/Makefile +3 -0
@@ -36,16 +36,19 @@ AMDKFD_FILES := $(AMDKFD_PATH)/kfd_module.o \ $(AMDKFD_PATH)/kfd_mqd_manager_cik.o \ $(AMDKFD_PATH)/kfd_mqd_manager_vi.o \ $(AMDKFD_PATH)/kfd_mqd_manager_v9.o \ + $(AMDKFD_PATH)/kfd_mqd_manager_v10.o \ $(AMDKFD_PATH)/kfd_kernel_queue.o \ $(AMDKFD_PATH)/kfd_kernel_queue_cik.o \ $(AMDKFD_PATH)/kfd_kernel_queue_vi.o \ $(AMDKFD_PATH)/kfd_kernel_queue_v9.o \ + $(AMDKFD_PATH)/kfd_kernel_queue_v10.o \ $(AMDKFD_PATH)/kfd_packet_manager.o \ $(AMDKFD_PATH)/kfd_process_queue_manager.o \ $(AMDKFD_PATH)/kfd_device_queue_manager.o \ $(AMDKFD_PATH)/kfd_device_queue_manager_cik.o \ $(AMDKFD_PATH)/kfd_device_queue_manager_vi.o \ $(AMDKFD_PATH)/kfd_device_queue_manager_v9.o \ + $(AMDKFD_PATH)/kfd_device_queue_manager_v10.o \ $(AMDKFD_PATH)/kfd_interrupt.o \ $(AMDKFD_PATH)/kfd_events.o \ $(AMDKFD_PATH)/cik_event_interrupt.o \
drivers/gpu/drm/amd/amdkfd/kfd_crat.c +5 -0
@@ -138,6 +138,8 @@ static struct kfd_gpu_cache_info carrizo_cache_info[] = {/* TODO - check & update Vega10 cache details */ #define vega10_cache_info carrizo_cache_info#define raven_cache_info carrizo_cache_info +/* TODO - check & update Navi10 cache details */ +#define navi10_cache_info carrizo_cache_infostatic void kfd_populated_cu_info_cpu (struct kfd_topology_device *dev,struct crat_subtype_computeunit *cu)
@@ -666,6 +668,9 @@ static int kfd_fill_gpu_cache_info(struct kfd_dev *kdev,case CHIP_RAVEN : pcache_info = raven_cache_info; num_of_cache_types =ARRAY_SIZE (raven_cache_info); +case CHIP_NAVI10 : + pcache_info = navi10_cache_info; + num_of_cache_types =ARRAY_SIZE (navi10_cache_info);break ;default :return -EINVAL ;
drivers/gpu/drm/amd/amdkfd/kfd_device.c +20 -1
@@ -317,6 +317,22 @@ static const struct kfd_device_info vega20_device_info = { .num_sdma_queues_per_engine = 8, }; +static const struct kfd_device_info navi10_device_info = { + .asic_family =CHIP_NAVI10 , + .max_pasid_bits =16 , + .max_no_of_hqd =24 , + .doorbell_size =8 , + .ih_ring_entry_size =8 *sizeof (uint32_t ), + .event_interrupt_class = &event_interrupt_class_v9, + .num_of_watch_points =4 , + .mqd_size_aligned =MQD_SIZE_ALIGNED , + .needs_iommu_device = false, + .supports_cwsr = false, + .needs_pci_atomics = false, + .num_sdma_engines =2 , + .num_sdma_queues_per_engine =8 , +}; +struct kfd_deviceid {unsigned short did;const struct kfd_device_info *device_info;
@@ -434,7 +450,9 @@ static const struct kfd_deviceid supported_devices[] = { { 0x66a3, &vega20_device_info }, /* Vega20 */ { 0x66a4, &vega20_device_info }, /* Vega20 */ { 0x66a7, &vega20_device_info }, /* Vega20 */ - { 0x66af, &vega20_device_info } /* Vega20 */ + { 0x66af, &vega20_device_info }, /* Vega20 */ +/* Navi10 */ + { 0x7310, &navi10_device_info }, /* Navi10 */ }; static int kfd_gtt_sa_init(struct kfd_dev *kfd, unsigned int buf_size,
@@ -517,6 +535,7 @@ static void kfd_cwsr_init(struct kfd_dev *kfd) kfd->cwsr_isa = cwsr_trap_gfx8_hex; kfd->cwsr_isa_size =sizeof (cwsr_trap_gfx8_hex); }else { +/* TODO: Do we need another trap handler for navi10? */ BUILD_BUG_ON (sizeof (cwsr_trap_gfx9_hex) >PAGE_SIZE ); kfd->cwsr_isa = cwsr_trap_gfx9_hex; kfd->cwsr_isa_size =sizeof (cwsr_trap_gfx9_hex);
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +15 -11
@@ -1264,6 +1264,7 @@ static int map_queues_cpsch(struct device_queue_manager *dqm)return 0 ; retval =pm_send_runlist (&dqm->packets, &dqm->queues); +pr_debug ("%s sent runlist\n" , __func__);if (retval) {pr_err ("failed to execute runlist\n" );return retval;
@@ -1785,6 +1786,9 @@ struct device_queue_manager *device_queue_manager_init(struct kfd_dev *dev)case CHIP_RAVEN :device_queue_manager_init_v9 (&dqm->asic_ops);break ; +case CHIP_NAVI10 : +device_queue_manager_init_v10_navi10 (&dqm->asic_ops); +break ;default :WARN (1 ,"Unexpected ASIC family %u" , dev->device_info->asic_family);
@@ -1875,17 +1879,17 @@ int dqm_debugfs_hqds(struct seq_file *m, void *data)int pipe, queue;int r =0 ; - r = dqm->dev->kfd2kgd->hqd_dump (dqm->dev->kgd, -KFD_CIK_HIQ_PIPE ,KFD_CIK_HIQ_QUEUE , &dump, &n_regs); -if (!r) { -seq_printf (m," HIQ on MEC %d Pipe %d Queue %d\n" , -KFD_CIK_HIQ_PIPE /get_pipes_per_mec (dqm)+1 , -KFD_CIK_HIQ_PIPE %get_pipes_per_mec (dqm), -KFD_CIK_HIQ_QUEUE ); -seq_reg_dump (m, dump, n_regs); - -kfree (dump); - } + r = dqm->dev->kfd2kgd->hqd_dump (dqm->dev->kgd, +KFD_CIK_HIQ_PIPE ,KFD_CIK_HIQ_QUEUE , &dump, &n_regs); +if (!r) { +seq_printf (m," HIQ on MEC %d Pipe %d Queue %d\n" , +KFD_CIK_HIQ_PIPE /get_pipes_per_mec (dqm)+1 , +KFD_CIK_HIQ_PIPE %get_pipes_per_mec (dqm), +KFD_CIK_HIQ_QUEUE ); +seq_reg_dump (m, dump, n_regs); + +kfree (dump); + }for (pipe =0 ; pipe <get_pipes_per_mec (dqm); pipe++) {int pipe_offset = pipe *get_queues_per_pipe (dqm);
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h +2 -0
@@ -212,6 +212,8 @@ void device_queue_manager_init_vi_tonga( struct device_queue_manager_asic_ops *asic_ops);void device_queue_manager_init_v9 (struct device_queue_manager_asic_ops *asic_ops); +void device_queue_manager_init_v10_navi10 ( +struct device_queue_manager_asic_ops *asic_ops);void program_sh_mem_settings (struct device_queue_manager *dqm,struct qcm_process_device *qpd);unsigned int get_queues_num (struct device_queue_manager *dqm);
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_v10.c new file +87 -0
87 lines not on this page · raw message
drivers/gpu/drm/amd/amdkfd/kfd_flat_memory.c +1 -0
@@ -405,6 +405,7 @@ int kfd_init_apertures(struct kfd_process *process)case CHIP_VEGA12 :case CHIP_VEGA20 :case CHIP_RAVEN : +case CHIP_NAVI10 :kfd_init_apertures_v9 (pdd, id);break ;default :
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c +3 -0
@@ -332,6 +332,9 @@ struct kernel_queue *kernel_queue_init(struct kfd_dev *dev,case CHIP_RAVEN :kernel_queue_init_v9 (&kq->ops_asic_specific);break ; +case CHIP_NAVI10 : +kernel_queue_init_v10 (&kq->ops_asic_specific); +break ;default :WARN (1 ,"Unexpected ASIC family %u" , dev->device_info->asic_family);
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.h +1 -0
@@ -102,5 +102,6 @@ struct kernel_queue {void kernel_queue_init_cik (struct kernel_queue_ops *ops);void kernel_queue_init_vi (struct kernel_queue_ops *ops);void kernel_queue_init_v9 (struct kernel_queue_ops *ops); +void kernel_queue_init_v10 (struct kernel_queue_ops *ops);#endif /* KFD_KERNEL_QUEUE_H_ */
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c new file +348 -0
348 lines not on this page · raw message
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c new file +519 -0
519 lines not on this page · raw message
drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c +3 -0
@@ -237,6 +237,9 @@ int pm_init(struct packet_manager *pm, struct device_queue_manager *dqm)case CHIP_RAVEN : pm->pmf = &kfd_v9_pm_funcs;break ; +case CHIP_NAVI10 : + pm->pmf = &kfd_v10_pm_funcs; +break ;default :WARN (1 ,"Unexpected ASIC family %u" , dqm->dev->device_info->asic_family);
drivers/gpu/drm/amd/amdkfd/kfd_priv.h +10 -1
@@ -171,6 +171,10 @@ enum cache_policy {cache_policy_noncoherent }; +#define KFD_IS_VI (chip) ((chip) >= CHIP_CARRIZO && (chip) <= CHIP_POLARIS11) +#define KFD_IS_DGPU (chip) (((chip) >= CHIP_TONGA && \ + (chip) <= CHIP_NAVI10) || \ + (chip) == CHIP_HAWAII)#define KFD_IS_SOC15 (chip) ((chip) >= CHIP_VEGA10)struct kfd_event_interrupt_class {
@@ -861,6 +865,8 @@ struct mqd_manager *mqd_manager_init_vi_tonga(enum KFD_MQD_TYPE type, struct kfd_dev *dev);struct mqd_manager *mqd_manager_init_v9 (enum KFD_MQD_TYPE type,struct kfd_dev *dev); +struct mqd_manager *mqd_manager_init_v10 (enum KFD_MQD_TYPE type, +struct kfd_dev *dev);struct device_queue_manager *device_queue_manager_init (struct kfd_dev *dev);void device_queue_manager_uninit (struct device_queue_manager *dqm); struct kernel_queue *kernel_queue_init(struct kfd_dev *dev,
@@ -950,6 +956,7 @@ struct packet_manager_funcs {extern const struct packet_manager_funcs kfd_vi_pm_funcs;extern const struct packet_manager_funcs kfd_v9_pm_funcs; +extern const struct packet_manager_funcs kfd_v10_pm_funcs;int pm_init (struct packet_manager *pm,struct device_queue_manager *dqm);void pm_uninit (struct packet_manager *pm);
@@ -969,7 +976,9 @@ void pm_release_ib(struct packet_manager *pm);/* Following PM funcs can be shared among VI and AI */ unsigned int pm_build_pm4_header (unsigned int opcode,size_t packet_size);int pm_set_resources_vi (struct packet_manager *pm,uint32_t *buffer, -struct scheduling_resources *res); +struct scheduling_resources *res); +void kfd_pm_func_init_v10 (struct packet_manager *pm,uint16_t fw_ver); +uint64_t kfd_get_number_elems (struct kfd_dev *kfd);
drivers/gpu/drm/amd/amdkfd/kfd_process.c +1 -0
@@ -1107,3 +1107,4 @@ int kfd_debugfs_mqds_by_process(struct seq_file *m, void *data) }#endif +
drivers/gpu/drm/amd/amdkfd/kfd_topology.c +1 -0
@@ -1321,6 +1321,7 @@ int kfd_topology_add_device(struct kfd_dev *gpu)case CHIP_VEGA12 :case CHIP_VEGA20 :case CHIP_RAVEN : +case CHIP_NAVI10 : dev->node_props.capability |= ((HSA_CAP_DOORBELL_TYPE_2_0 <<HSA_CAP_DOORBELL_TYPE_TOTALBITS_SHIFT ) &HSA_CAP_DOORBELL_TYPE_TOTALBITS_MASK );
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 129/459 drm/amdkfd: Added cwsr trap handler for gfx10
In reply to a message not in the archiveFrom: Oak Zeng <[email protected]>
CWSR (compute wave save restore) is used for preempting compute queues.
--- .../amd/amdkfd/cwsr_trap_handler_gfx10.asm | 1424 +++++++++++++++++ drivers/gpu/drm/amd/amdkfd/kfd_device.c | 10 +- 2 files changed, 1431 insertions(+), 3 deletions(-) create mode 100644 drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm
drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm new file +1424 -0
@@ -0,0 +1,1424 @@ +/* + * Copyright 2018 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + + +#if 0 +shader main + +asic(DEFAULT) + +type(CS) + +wave_size(32) +/*************************************************************************/ +/* control on how to run the shader */ +/*************************************************************************/ +//any hack that needs to be made to run this code in EMU (either becasue various EMU code are not ready or no compute save & restore in EMU run) +var EMU_RUN_HACK = 0 +var EMU_RUN_HACK_RESTORE_NORMAL = 0 +var EMU_RUN_HACK_SAVE_NORMAL_EXIT = 0 +var EMU_RUN_HACK_SAVE_SINGLE_WAVE = 0 +var EMU_RUN_HACK_SAVE_FIRST_TIME = 0 //for interrupted restore in which the first save is through EMU_RUN_HACK +var SAVE_LDS = 0 +var WG_BASE_ADDR_LO = 0x9000a000 +var WG_BASE_ADDR_HI = 0x0 +var WAVE_SPACE = 0x9000 //memory size that each wave occupies in workgroup state mem, increase from 5000 to 9000 for more SGPR need to be saved +var CTX_SAVE_CONTROL = 0x0 +var CTX_RESTORE_CONTROL = CTX_SAVE_CONTROL +var SIM_RUN_HACK = 0 //any hack that needs to be made to run this code in SIM (either becasue various RTL code are not ready or no compute save & restore in RTL run) +var SGPR_SAVE_USE_SQC = 0 //use SQC D$ to do the write +var USE_MTBUF_INSTEAD_OF_MUBUF = 0 //need to change BUF_DATA_FORMAT in S_SAVE_BUF_RSRC_WORD3_MISC from 0 to BUF_DATA_FORMAT_32 if set to 1 (i.e. 0x00827FAC) +var SWIZZLE_EN = 0 //whether we use swizzled buffer addressing +var SAVE_RESTORE_HWID_DDID = 0 +var RESTORE_DDID_IN_SGPR18 = 0 +/**************************************************************************/ +/* variables */ +/**************************************************************************/ +var SQ_WAVE_STATUS_INST_ATC_SHIFT = 23 +var SQ_WAVE_STATUS_INST_ATC_MASK = 0x00800000 +var SQ_WAVE_STATUS_SPI_PRIO_MASK = 0x00000006 + +var SQ_WAVE_LDS_ALLOC_LDS_SIZE_SHIFT = 12 +var SQ_WAVE_LDS_ALLOC_LDS_SIZE_SIZE = 9 +var SQ_WAVE_GPR_ALLOC_VGPR_SIZE_SHIFT = 8 +var SQ_WAVE_GPR_ALLOC_VGPR_SIZE_SIZE = 6 +var SQ_WAVE_GPR_ALLOC_SGPR_SIZE_SHIFT = 24 +var SQ_WAVE_GPR_ALLOC_SGPR_SIZE_SIZE = 4 //FIXME sq.blk still has 4 bits at this time while SQ programming guide has 3 bits +var SQ_WAVE_LDS_ALLOC_VGPR_SHARED_SIZE_SHIFT = 24 +var SQ_WAVE_LDS_ALLOC_VGPR_SHARED_SIZE_SIZE = 4 +var SQ_WAVE_IB_STS2_WAVE64_SHIFT = 11 +var SQ_WAVE_IB_STS2_WAVE64_SIZE = 1 + +var SQ_WAVE_TRAPSTS_SAVECTX_MASK = 0x400 +var SQ_WAVE_TRAPSTS_EXCE_MASK = 0x1FF // Exception mask +var SQ_WAVE_TRAPSTS_SAVECTX_SHIFT = 10 +var SQ_WAVE_TRAPSTS_MEM_VIOL_MASK = 0x100 +var SQ_WAVE_TRAPSTS_MEM_VIOL_SHIFT = 8 +var SQ_WAVE_TRAPSTS_PRE_SAVECTX_MASK = 0x3FF +var SQ_WAVE_TRAPSTS_PRE_SAVECTX_SHIFT = 0x0 +var SQ_WAVE_TRAPSTS_PRE_SAVECTX_SIZE = 10 +var SQ_WAVE_TRAPSTS_POST_SAVECTX_MASK = 0xFFFFF800 +var SQ_WAVE_TRAPSTS_POST_SAVECTX_SHIFT = 11 +var SQ_WAVE_TRAPSTS_POST_SAVECTX_SIZE = 21 + +var SQ_WAVE_IB_STS_RCNT_SHIFT = 16 //FIXME +var SQ_WAVE_IB_STS_FIRST_REPLAY_SHIFT = 15 //FIXME +var SQ_WAVE_IB_STS_FIRST_REPLAY_SIZE = 1 //FIXME +var SQ_WAVE_IB_STS_RCNT_SIZE = 6 //FIXME +var SQ_WAVE_IB_STS_RCNT_FIRST_REPLAY_MASK_NEG = 0x00007FFF //FIXME + +var SQ_BUF_RSRC_WORD1_ATC_SHIFT = 24 +var SQ_BUF_RSRC_WORD3_MTYPE_SHIFT = 27 + + +/* Save */ +var S_SAVE_BUF_RSRC_WORD1_STRIDE = 0x00040000 //stride is 4 bytes +var S_SAVE_BUF_RSRC_WORD3_MISC = 0x00807FAC //SQ_SEL_X/Y/Z/W, BUF_NUM_FORMAT_FLOAT, (0 for MUBUF stride[17:14] when ADD_TID_ENABLE and BUF_DATA_FORMAT_32 for MTBUF), ADD_TID_ENABLE + +var S_SAVE_SPI_INIT_ATC_MASK = 0x08000000 //bit[27]: ATC bit +var S_SAVE_SPI_INIT_ATC_SHIFT = 27 +var S_SAVE_SPI_INIT_MTYPE_MASK = 0x70000000 //bit[30:28]: Mtype +var S_SAVE_SPI_INIT_MTYPE_SHIFT = 28 +var S_SAVE_SPI_INIT_FIRST_WAVE_MASK = 0x04000000 //bit[26]: FirstWaveInTG +var S_SAVE_SPI_INIT_FIRST_WAVE_SHIFT = 26 + +var S_SAVE_PC_HI_RCNT_SHIFT = 28 //FIXME check with Brian to ensure all fields other than PC[47:0] can be used +var S_SAVE_PC_HI_RCNT_MASK = 0xF0000000 //FIXME +var S_SAVE_PC_HI_FIRST_REPLAY_SHIFT = 27 //FIXME +var S_SAVE_PC_HI_FIRST_REPLAY_MASK = 0x08000000 //FIXME + +var s_save_spi_init_lo = exec_lo +var s_save_spi_init_hi = exec_hi + +var s_save_pc_lo = ttmp0 //{TTMP1, TTMP0} = {3��h0,pc_rewind[3:0], HT[0],trapID[7:0], PC[47:0]} +var s_save_pc_hi = ttmp1 +var s_save_exec_lo = ttmp2 +var s_save_exec_hi = ttmp3 +var s_save_status = ttmp4 +var s_save_trapsts = ttmp5 //not really used until the end of the SAVE routine +var s_wave_size = ttmp6 //ttmp6 is not needed now, since it's only 32bit xnack mask, now use it to determine wave32 or wave64 in EMU_HACK +var s_save_xnack_mask = ttmp7 +var s_save_buf_rsrc0 = ttmp8 +var s_save_buf_rsrc1 = ttmp9 +var s_save_buf_rsrc2 = ttmp10 +var s_save_buf_rsrc3 = ttmp11 + +var s_save_mem_offset = ttmp14 +var s_sgpr_save_num = 106 //in gfx10, all sgpr must be saved +var s_save_alloc_size = s_save_trapsts //conflict +var s_save_tmp = s_save_buf_rsrc2 //shared with s_save_buf_rsrc2 (conflict: should not use mem access with s_save_tmp at the same time) +var s_save_m0 = ttmp15 + +/* Restore */ +var S_RESTORE_BUF_RSRC_WORD1_STRIDE = S_SAVE_BUF_RSRC_WORD1_STRIDE +var S_RESTORE_BUF_RSRC_WORD3_MISC = S_SAVE_BUF_RSRC_WORD3_MISC + +var S_RESTORE_SPI_INIT_ATC_MASK = 0x08000000 //bit[27]: ATC bit +var S_RESTORE_SPI_INIT_ATC_SHIFT = 27 +var S_RESTORE_SPI_INIT_MTYPE_MASK = 0x70000000 //bit[30:28]: Mtype +var S_RESTORE_SPI_INIT_MTYPE_SHIFT = 28 +var S_RESTORE_SPI_INIT_FIRST_WAVE_MASK = 0x04000000 //bit[26]: FirstWaveInTG +var S_RESTORE_SPI_INIT_FIRST_WAVE_SHIFT = 26 + +var S_RESTORE_PC_HI_RCNT_SHIFT = S_SAVE_PC_HI_RCNT_SHIFT +var S_RESTORE_PC_HI_RCNT_MASK = S_SAVE_PC_HI_RCNT_MASK +var S_RESTORE_PC_HI_FIRST_REPLAY_SHIFT = S_SAVE_PC_HI_FIRST_REPLAY_SHIFT +var S_RESTORE_PC_HI_FIRST_REPLAY_MASK = S_SAVE_PC_HI_FIRST_REPLAY_MASK + +var s_restore_spi_init_lo = exec_lo +var s_restore_spi_init_hi = exec_hi + +var s_restore_mem_offset = ttmp12 +var s_restore_alloc_size = ttmp3 +var s_restore_tmp = ttmp6 +var s_restore_mem_offset_save = s_restore_tmp //no conflict + +var s_restore_m0 = s_restore_alloc_size //no conflict + +var s_restore_mode = ttmp13 +var s_restore_hwid1 = ttmp2 +var s_restore_ddid = s_restore_hwid1 +var s_restore_pc_lo = ttmp0 +var s_restore_pc_hi = ttmp1 +var s_restore_exec_lo = ttmp14 +var s_restore_exec_hi = ttmp15 +var s_restore_status = ttmp4 +var s_restore_trapsts = ttmp5 +//var s_restore_xnack_mask_lo = xnack_mask_lo +//var s_restore_xnack_mask_hi = xnack_mask_hi +var s_restore_xnack_mask = ttmp7 +var s_restore_buf_rsrc0 = ttmp8 +var s_restore_buf_rsrc1 = ttmp9 +var s_restore_buf_rsrc2 = ttmp10 +var s_restore_buf_rsrc3 = ttmp11 +var s_restore_size = ttmp13 //ttmp13 has no conflict + +/**************************************************************************/ +/* trap handler entry points */ +/**************************************************************************/ + if ((EMU_RUN_HACK) && (!EMU_RUN_HACK_RESTORE_NORMAL)) //hack to use trap_id for determining save/restore + //FIXME VCCZ un-init assertion s_getreg_b32 s_save_status, hwreg(HW_REG_STATUS) //save STATUS since we will change SCC + s_and_b32 s_save_tmp, s_save_pc_hi, 0xffff0000 //change SCC + s_cmp_eq_u32 s_save_tmp, 0x007e0000 //Save: trap_id = 0x7e. Restore: trap_id = 0x7f. + s_cbranch_scc0 L_JUMP_TO_RESTORE //do not need to recover STATUS here since we are going to RESTORE + //FIXME s_setreg_b32 hwreg(HW_REG_STATUS), s_save_status //need to recover STATUS since we are going to SAVE + s_branch L_SKIP_RESTORE //NOT restore, SAVE actually + else + s_branch L_SKIP_RESTORE //NOT restore. might be a regular trap or save + end + +L_JUMP_TO_RESTORE: + s_branch L_RESTORE //restore + +L_SKIP_RESTORE: + + s_getreg_b32 s_save_status, hwreg(HW_REG_STATUS) //save STATUS since we will change SCC + s_andn2_b32 s_save_status, s_save_status, SQ_WAVE_STATUS_SPI_PRIO_MASK //check whether this is for save + s_getreg_b32 s_save_trapsts, hwreg(HW_REG_TRAPSTS) + s_and_b32 s_save_trapsts, s_save_trapsts, SQ_WAVE_TRAPSTS_SAVECTX_MASK //check whether this is for save + s_cbranch_scc1 L_SAVE //this is the operation for save + + // ********* Handle non-CWSR traps ******************* + if (!EMU_RUN_HACK) + s_getreg_b32 s_save_trapsts, hwreg(HW_REG_TRAPSTS) + s_and_b32 s_save_trapsts, s_save_trapsts, SQ_WAVE_TRAPSTS_EXCE_MASK // Check whether it is an exception + s_cbranch_scc1 L_EXCP_CASE // Exception, jump back to the shader program directly. + s_add_u32 ttmp0, ttmp0, 4 // S_TRAP case, add 4 to ttmp0 + + L_EXCP_CASE: + s_and_b32 ttmp1, ttmp1, 0xFFFF + s_rfe_b64 [ttmp0, ttmp1] + end + // ********* End handling of non-CWSR traps ******************* + +/**************************************************************************/ +/* save routine */ +/**************************************************************************/ + +L_SAVE: + + //check whether there is mem_viol + s_getreg_b32 s_save_trapsts, hwreg(HW_REG_TRAPSTS) + s_and_b32 s_save_trapsts, s_save_trapsts, SQ_WAVE_TRAPSTS_MEM_VIOL_MASK + s_cbranch_scc0 L_NO_PC_REWIND + + //if so, need rewind PC assuming GDS operation gets NACKed + s_mov_b32 s_save_tmp, 0 //clear mem_viol bit + s_setreg_b32 hwreg(HW_REG_TRAPSTS, SQ_WAVE_TRAPSTS_MEM_VIOL_SHIFT, 1), s_save_tmp //clear mem_viol bit + s_and_b32 s_save_pc_hi, s_save_pc_hi, 0x0000ffff //pc[47:32] + s_sub_u32 s_save_pc_lo, s_save_pc_lo, 8 //pc[31:0]-8 + s_subb_u32 s_save_pc_hi, s_save_pc_hi, 0x0 // -scc + +L_NO_PC_REWIND: + s_mov_b32 s_save_tmp, 0 //clear saveCtx bit + s_setreg_b32 hwreg(HW_REG_TRAPSTS, SQ_WAVE_TRAPSTS_SAVECTX_SHIFT, 1), s_save_tmp //clear saveCtx bit + + //s_mov_b32 s_save_xnack_mask_lo, xnack_mask_lo //save XNACK_MASK + //s_mov_b32 s_save_xnack_mask_hi, xnack_mask_hi + s_getreg_b32 s_save_xnack_mask, hwreg(HW_REG_SHADER_XNACK_MASK) + s_getreg_b32 s_save_tmp, hwreg(HW_REG_IB_STS, SQ_WAVE_IB_STS_RCNT_SHIFT, SQ_WAVE_IB_STS_RCNT_SIZE) //save RCNT + s_lshl_b32 s_save_tmp, s_save_tmp, S_SAVE_PC_HI_RCNT_SHIFT + s_or_b32 s_save_pc_hi, s_save_pc_hi, s_save_tmp + s_getreg_b32 s_save_tmp, hwreg(HW_REG_IB_STS, SQ_WAVE_IB_STS_FIRST_REPLAY_SHIFT, SQ_WAVE_IB_STS_FIRST_REPLAY_SIZE) //save FIRST_REPLAY + s_lshl_b32 s_save_tmp, s_save_tmp, S_SAVE_PC_HI_FIRST_REPLAY_SHIFT + s_or_b32 s_save_pc_hi, s_save_pc_hi, s_save_tmp + s_getreg_b32 s_save_tmp, hwreg(HW_REG_IB_STS) //clear RCNT and FIRST_REPLAY in IB_STS + s_and_b32 s_save_tmp, s_save_tmp, SQ_WAVE_IB_STS_RCNT_FIRST_REPLAY_MASK_NEG + + s_setreg_b32 hwreg(HW_REG_IB_STS), s_save_tmp + + /* inform SPI the readiness and wait for SPI's go signal */ + s_mov_b32 s_save_exec_lo, exec_lo //save EXEC and use EXEC for the go signal from SPI + s_mov_b32 s_save_exec_hi, exec_hi + s_mov_b64 exec, 0x0 //clear EXEC to get ready to receive + if (EMU_RUN_HACK) + + else + s_sendmsg sendmsg(MSG_SAVEWAVE) //send SPI a message and wait for SPI's write to EXEC + end + + L_SLEEP: + s_sleep 0x2 + + if (EMU_RUN_HACK) + + else + s_cbranch_execz L_SLEEP + end + + + /* setup Resource Contants */ + if ((EMU_RUN_HACK) && (!EMU_RUN_HACK_SAVE_SINGLE_WAVE)) + //calculate wd_addr using absolute thread id + v_readlane_b32 s_save_tmp, v9, 0 + //determine it is wave32 or wave64 + s_getreg_b32 s_wave_size, hwreg(HW_REG_IB_STS2,SQ_WAVE_IB_STS2_WAVE64_SHIFT,SQ_WAVE_IB_STS2_WAVE64_SIZE) + s_cmp_eq_u32 s_wave_size, 0 + s_cbranch_scc1 L_SAVE_WAVE32 + s_lshr_b32 s_save_tmp, s_save_tmp, 6 //SAVE WAVE64 + s_branch L_SAVE_CON + L_SAVE_WAVE32: + s_lshr_b32 s_save_tmp, s_save_tmp, 5 //SAVE WAVE32 + L_SAVE_CON: + s_mul_i32 s_save_tmp, s_save_tmp, WAVE_SPACE + s_add_i32 s_save_spi_init_lo, s_save_tmp, WG_BASE_ADDR_LO + s_mov_b32 s_save_spi_init_hi, WG_BASE_ADDR_HI + s_and_b32 s_save_spi_init_hi, s_save_spi_init_hi, CTX_SAVE_CONTROL + else + end + if ((EMU_RUN_HACK) && (EMU_RUN_HACK_SAVE_SINGLE_WAVE)) + s_add_i32 s_save_spi_init_lo, s_save_tmp, WG_BASE_ADDR_LO + s_mov_b32 s_save_spi_init_hi, WG_BASE_ADDR_HI + s_and_b32 s_save_spi_init_hi, s_save_spi_init_hi, CTX_SAVE_CONTROL + else + end + + + s_mov_b32 s_save_buf_rsrc0, s_save_spi_init_lo //base_addr_lo + s_and_b32 s_save_buf_rsrc1, s_save_spi_init_hi, 0x0000FFFF //base_addr_hi + s_or_b32 s_save_buf_rsrc1, s_save_buf_rsrc1, S_SAVE_BUF_RSRC_WORD1_STRIDE + s_mov_b32 s_save_buf_rsrc2, 0 //NUM_RECORDS initial value = 0 (in bytes) although not neccessarily inited + s_mov_b32 s_save_buf_rsrc3, S_SAVE_BUF_RSRC_WORD3_MISC + s_and_b32 s_save_tmp, s_save_spi_init_hi, S_SAVE_SPI_INIT_ATC_MASK + s_lshr_b32 s_save_tmp, s_save_tmp, (S_SAVE_SPI_INIT_ATC_SHIFT-SQ_BUF_RSRC_WORD1_ATC_SHIFT) //get ATC bit into position + s_or_b32 s_save_buf_rsrc3, s_save_buf_rsrc3, s_save_tmp //or ATC + s_and_b32 s_save_tmp, s_save_spi_init_hi, S_SAVE_SPI_INIT_MTYPE_MASK + s_lshr_b32 s_save_tmp, s_save_tmp, (S_SAVE_SPI_INIT_MTYPE_SHIFT-SQ_BUF_RSRC_WORD3_MTYPE_SHIFT) //get MTYPE bits into position + s_or_b32 s_save_buf_rsrc3, s_save_buf_rsrc3, s_save_tmp //or MTYPE + + s_mov_b32 s_save_m0, m0 //save M0 + + /* global mem offset */ + s_mov_b32 s_save_mem_offset, 0x0 //mem offset initial value = 0 + s_getreg_b32 s_wave_size, hwreg(HW_REG_IB_STS2,SQ_WAVE_IB_STS2_WAVE64_SHIFT,SQ_WAVE_IB_STS2_WAVE64_SIZE) //get wave_save_size + s_or_b32 s_wave_size, s_save_spi_init_hi, s_wave_size //share s_wave_size with exec_hi + + /* save VGPRs */ + ////////////////////////////// + L_SAVE_VGPR: + + s_mov_b32 exec_lo, 0xFFFFFFFF //need every thread from now on + s_and_b32 m0, s_wave_size, 1 + s_cmp_eq_u32 m0, 1 + s_cbranch_scc1 L_ENABLE_SAVE_VGPR_EXEC_HI + s_mov_b32 exec_hi, 0x00000000 + s_branch L_SAVE_VGPR_NORMAL + L_ENABLE_SAVE_VGPR_EXEC_HI: + s_mov_b32 exec_hi, 0xFFFFFFFF + L_SAVE_VGPR_NORMAL: + s_getreg_b32 s_save_alloc_size, hwreg(HW_REG_GPR_ALLOC,SQ_WAVE_GPR_ALLOC_VGPR_SIZE_SHIFT,SQ_WAVE_GPR_ALLOC_VGPR_SIZE_SIZE) //vpgr_size + //for wave32 and wave64, the num of vgpr function is the same? + s_add_u32 s_save_alloc_size, s_save_alloc_size, 1 + s_lshl_b32 s_save_alloc_size, s_save_alloc_size, 2 //Number of VGPRs = (vgpr_size + 1) * 4 (non-zero value) //FIXME for GFX, zero is possible + //determine it is wave32 or wave64 + s_and_b32 m0, s_wave_size, 1 + s_cmp_eq_u32 m0, 1 + s_cbranch_scc1 L_SAVE_VGPR_WAVE64 + + //zhenxu added it for save vgpr for wave32 + s_lshl_b32 s_save_buf_rsrc2, s_save_alloc_size, 7 //NUM_RECORDS in bytes (32 threads*4) + if (SWIZZLE_EN) + s_add_u32 s_save_buf_rsrc2, s_save_buf_rsrc2, 0x0 //FIXME need to use swizzle to enable bounds checking? + else + s_mov_b32 s_save_buf_rsrc2, 0x1000000 //NUM_RECORDS in bytes + end + + s_mov_b32 m0, 0x0 //VGPR initial index value =0 + //s_set_gpr_idx_on m0, 0x1 //M0[7:0] = M0[7:0] and M0[15:12] = 0x1 + //s_add_u32 s_save_alloc_size, s_save_alloc_size, 0x1000 //add 0x1000 since we compare m0 against it later, doesn't need this in gfx10 + + L_SAVE_VGPR_WAVE32_LOOP: + v_movrels_b32 v0, v0 //v0 = v[0+m0] + + if(USE_MTBUF_INSTEAD_OF_MUBUF) + tbuffer_store_format_x v0, v0, s_save_buf_rsrc0, s_save_mem_offset format:BUF_NUM_FORMAT_FLOAT format: BUF_DATA_FORMAT_32 slc:1 glc:1 + else + buffer_store_dword v0, v0, s_save_buf_rsrc0, s_save_mem_offset slc:1 glc:1 + end + + s_add_u32 m0, m0, 1 //next vgpr index + s_add_u32 s_save_mem_offset, s_save_mem_offset, 128 //every buffer_store_dword does 128 bytes + s_cmp_lt_u32 m0, s_save_alloc_size //scc = (m0 < s_save_alloc_size) ? 1 : 0 + s_cbranch_scc1 L_SAVE_VGPR_WAVE32_LOOP //VGPR save is complete? + s_branch L_SAVE_LDS + //save vgpr for wave32 ends + + L_SAVE_VGPR_WAVE64: + s_lshl_b32 s_save_buf_rsrc2, s_save_alloc_size, 8 //NUM_RECORDS in bytes (64 threads*4) + if (SWIZZLE_EN) + s_add_u32 s_save_buf_rsrc2, s_save_buf_rsrc2, 0x0 //FIXME need to use swizzle to enable bounds checking? + else + s_mov_b32 s_save_buf_rsrc2, 0x1000000 //NUM_RECORDS in bytes + end + + s_mov_b32 m0, 0x0 //VGPR initial index value =0 + //s_set_gpr_idx_on m0, 0x1 //M0[7:0] = M0[7:0] and M0[15:12] = 0x1 + //s_add_u32 s_save_alloc_size, s_save_alloc_size, 0x1000 //add 0x1000 since we compare m0 against it later, doesn't need this in gfx10 + + L_SAVE_VGPR_WAVE64_LOOP: + v_movrels_b32 v0, v0 //v0 = v[0+m0] + + if(USE_MTBUF_INSTEAD_OF_MUBUF) + tbuffer_store_format_x v0, v0, s_save_buf_rsrc0, s_save_mem_offset format:BUF_NUM_FORMAT_FLOAT format: BUF_DATA_FORMAT_32 slc:1 glc:1 + else + buffer_store_dword v0, v0, s_save_buf_rsrc0, s_save_mem_offset slc:1 glc:1 + end + + s_add_u32 m0, m0, 1 //next vgpr index + s_add_u32 s_save_mem_offset, s_save_mem_offset, 256 //every buffer_store_dword does 256 bytes + s_cmp_lt_u32 m0, s_save_alloc_size //scc = (m0 < s_save_alloc_size) ? 1 : 0 + s_cbranch_scc1 L_SAVE_VGPR_WAVE64_LOOP //VGPR save is complete? + //s_set_gpr_idx_off + // + //Below part will be the save shared vgpr part (new for gfx10) + s_getreg_b32 s_save_alloc_size, hwreg(HW_REG_LDS_ALLOC,SQ_WAVE_LDS_ALLOC_VGPR_SHARED_SIZE_SHIFT,SQ_WAVE_LDS_ALLOC_VGPR_SHARED_SIZE_SIZE) //shared_vgpr_size + s_and_b32 s_save_alloc_size, s_save_alloc_size, 0xFFFFFFFF //shared_vgpr_size is zero? + s_cbranch_scc0 L_SAVE_LDS //no shared_vgpr used? jump to L_SAVE_LDS + s_lshl_b32 s_save_alloc_size, s_save_alloc_size, 3 //Number of SHARED_VGPRs = shared_vgpr_size * 8 (non-zero value) + //m0 now has the value of normal vgpr count, just add the m0 with shared_vgpr count to get the total count. + //save shared_vgpr will start from the index of m0 + s_add_u32 s_save_alloc_size, s_save_alloc_size, m0 + s_mov_b32 exec_lo, 0xFFFFFFFF + s_mov_b32 exec_hi, 0x00000000 + L_SAVE_SHARED_VGPR_WAVE64_LOOP: + v_movrels_b32 v0, v0 //v0 = v[0+m0] + buffer_store_dword v0, v0, s_save_buf_rsrc0, s_save_mem_offset slc:1 glc:1 + s_add_u32 m0, m0, 1 //next vgpr index + s_add_u32 s_save_mem_offset, s_save_mem_offset, 128 //every buffer_store_dword does 256 bytes + s_cmp_lt_u32 m0, s_save_alloc_size //scc = (m0 < s_save_alloc_size) ? 1 : 0 + s_cbranch_scc1 L_SAVE_SHARED_VGPR_WAVE64_LOOP //SHARED_VGPR save is complete? + + /* save LDS */ + ////////////////////////////// + L_SAVE_LDS: + + //Only check the first wave need LDS + /* the first wave in the threadgroup */ + s_barrier //FIXME not performance-optimal "LDS is used? wait for other waves in the same TG" + s_and_b32 s_save_tmp, s_wave_size, S_SAVE_SPI_INIT_FIRST_WAVE_MASK //exec is still used here + s_cbranch_scc0 L_SAVE_SGPR + + s_mov_b32 exec_lo, 0xFFFFFFFF //need every thread from now on + s_and_b32 m0, s_wave_size, 1 + s_cmp_eq_u32 m0, 1 + s_cbranch_scc1 L_ENABLE_SAVE_LDS_EXEC_HI + s_mov_b32 exec_hi, 0x00000000 + s_branch L_SAVE_LDS_NORMAL + L_ENABLE_SAVE_LDS_EXEC_HI: + s_mov_b32 exec_hi, 0xFFFFFFFF + L_SAVE_LDS_NORMAL: + s_getreg_b32 s_save_alloc_size, hwreg(HW_REG_LDS_ALLOC,SQ_WAVE_LDS_ALLOC_LDS_SIZE_SHIFT,SQ_WAVE_LDS_ALLOC_LDS_SIZE_SIZE) //lds_size + s_and_b32 s_save_alloc_size, s_save_alloc_size, 0xFFFFFFFF //lds_size is zero? + s_cbranch_scc0 L_SAVE_SGPR //no lds used? jump to L_SAVE_VGPR + s_lshl_b32 s_save_alloc_size, s_save_alloc_size, 6 //LDS size in dwords = lds_size * 64dw + s_lshl_b32 s_save_alloc_size, s_save_alloc_size, 2 //LDS size in bytes + s_mov_b32 s_save_buf_rsrc2, s_save_alloc_size //NUM_RECORDS in bytes + if (SWIZZLE_EN) + s_add_u32 s_save_buf_rsrc2, s_save_buf_rsrc2, 0x0 //FIXME need to use swizzle to enable bounds checking? + else + s_mov_b32 s_save_buf_rsrc2, 0x1000000 //NUM_RECORDS in bytes + end + + //load 0~63*4(byte address) to vgpr v15 + v_mbcnt_lo_u32_b32 v0, -1, 0 + v_mbcnt_hi_u32_b32 v0, -1, v0 + v_mul_u32_u24 v0, 4, v0 + + s_and_b32 m0, s_wave_size, 1 + s_cmp_eq_u32 m0, 1 + s_mov_b32 m0, 0x0 + s_cbranch_scc1 L_SAVE_LDS_LOOP_W64 + + L_SAVE_LDS_LOOP_W32: + if (SAVE_LDS) + ds_read_b32 v1, v0 + s_waitcnt 0 //ensure data ready + buffer_store_dword v1, v0, s_save_buf_rsrc0, s_save_mem_offset slc:1 glc:1 + //buffer_store_lds_dword s_save_buf_rsrc0, s_save_mem_offset lds:1 //save lds to memory doesn't exist in 10 + end + s_add_u32 m0, m0, 128 //every buffer_store_lds does 128 bytes + s_add_u32 s_save_mem_offset, s_save_mem_offset, 128 //mem offset increased by 128 bytes + v_add_nc_u32 v0, v0, 128 + s_cmp_lt_u32 m0, s_save_alloc_size //scc=(m0 < s_save_alloc_size) ? 1 : 0 + s_cbranch_scc1 L_SAVE_LDS_LOOP_W32 //LDS save is complete? + s_branch L_SAVE_SGPR + + L_SAVE_LDS_LOOP_W64: + if (SAVE_LDS) + ds_read_b32 v1, v0 + s_waitcnt 0 //ensure data ready + buffer_store_dword v1, v0, s_save_buf_rsrc0, s_save_mem_offset slc:1 glc:1 + //buffer_store_lds_dword s_save_buf_rsrc0, s_save_mem_offset lds:1 //save lds to memory doesn't exist in 10 + end + s_add_u32 m0, m0, 256 //every buffer_store_lds does 256 bytes + s_add_u32 s_save_mem_offset, s_save_mem_offset, 256 //mem offset increased by 256 bytes + v_add_nc_u32 v0, v0, 256 + s_cmp_lt_u32 m0, s_save_alloc_size //scc=(m0 < s_save_alloc_size) ? 1 : 0 + s_cbranch_scc1 L_SAVE_LDS_LOOP_W64 //LDS save is complete? + + + /* save SGPRs */ + ////////////////////////////// + //s_getreg_b32 s_save_alloc_size, hwreg(HW_REG_GPR_ALLOC,SQ_WAVE_GPR_ALLOC_SGPR_SIZE_SHIFT,SQ_WAVE_GPR_ALLOC_SGPR_SIZE_SIZE) //spgr_size + //s_add_u32 s_save_alloc_size, s_save_alloc_size, 1 + //s_lshl_b32 s_save_alloc_size, s_save_alloc_size, 4 //Number of SGPRs = (sgpr_size + 1) * 16 (non-zero value) + //s_lshl_b32 s_save_alloc_size, s_save_alloc_size, 3 //In gfx10, Number of SGPRs = (sgpr_size + 1) * 8 (non-zero value) + L_SAVE_SGPR: + //need to look at it is wave32 or wave64 + s_and_b32 m0, s_wave_size, 1 + s_cmp_eq_u32 m0, 1 + s_cbranch_scc1 L_SAVE_SGPR_VMEM_WAVE64 + if (SGPR_SAVE_USE_SQC) + s_lshl_b32 s_save_buf_rsrc2, s_sgpr_save_num, 2 //NUM_RECORDS in bytes + else + s_lshl_b32 s_save_buf_rsrc2, s_sgpr_save_num, 7 //NUM_RECORDS in bytes (32 threads) + end + s_branch L_SAVE_SGPR_CONT + L_SAVE_SGPR_VMEM_WAVE64: + if (SGPR_SAVE_USE_SQC) + s_lshl_b32 s_save_buf_rsrc2, s_sgpr_save_num, 2 //NUM_RECORDS in bytes + else + s_lshl_b32 s_save_buf_rsrc2, s_sgpr_save_num, 8 //NUM_RECORDS in bytes (64 threads) + end + L_SAVE_SGPR_CONT: + if (SWIZZLE_EN) + s_add_u32 s_save_buf_rsrc2, s_save_buf_rsrc2, 0x0 //FIXME need to use swizzle to enable bounds checking? + else + s_mov_b32 s_save_buf_rsrc2, 0x1000000 //NUM_RECORDS in bytes + end + + //s_mov_b32 m0, 0x0 //SGPR initial index value =0 + //s_nop 0x0 //Manually inserted wait states + + s_and_b32 m0, s_wave_size, 1 + s_cmp_eq_u32 m0, 1 + + s_mov_b32 m0, 0x0 //SGPR initial index value =0 + s_nop 0x0 //Manually inserted wait states + + s_cbranch_scc1 L_SAVE_SGPR_LOOP_WAVE64 + + L_SAVE_SGPR_LOOP_WAVE32: + s_movrels_b32 s0, s0 //s0 = s[0+m0] + //zhenxu, adding one more argument to save sgpr function, this is only for vmem, using sqc is not change + write_sgpr_to_mem_wave32(s0, s_save_buf_rsrc0, s_save_mem_offset, SGPR_SAVE_USE_SQC, USE_MTBUF_INSTEAD_OF_MUBUF) //PV: the best performance should be using s_buffer_store_dwordx4 + s_add_u32 m0, m0, 1 //next sgpr index + s_cmp_lt_u32 m0, s_sgpr_save_num //scc = (m0 < s_sgpr_save_num) ? 1 : 0 + s_cbranch_scc1 L_SAVE_SGPR_LOOP_WAVE32 //SGPR save is complete? + s_branch L_SAVE_HWREG + + L_SAVE_SGPR_LOOP_WAVE64: + s_movrels_b32 s0, s0 //s0 = s[0+m0] + //zhenxu, adding one more argument to save sgpr function, this is only for vmem, using sqc is not change + write_sgpr_to_mem_wave64(s0, s_save_buf_rsrc0, s_save_mem_offset, SGPR_SAVE_USE_SQC, USE_MTBUF_INSTEAD_OF_MUBUF) //PV: the best performance should be using s_buffer_store_dwordx4 + s_add_u32 m0, m0, 1 //next sgpr index + s_cmp_lt_u32 m0, s_sgpr_save_num //scc = (m0 < s_sgpr_save_num) ? 1 : 0 + s_cbranch_scc1 L_SAVE_SGPR_LOOP_WAVE64 //SGPR save is complete? + + + /* save HW registers */ + ////////////////////////////// + L_SAVE_HWREG: + s_mov_b32 s_save_buf_rsrc2, 0x4 //NUM_RECORDS in bytes + if (SWIZZLE_EN) + s_add_u32 s_save_buf_rsrc2, s_save_buf_rsrc2, 0x0 //FIXME need to use swizzle to enable bounds checking? + else + s_mov_b32 s_save_buf_rsrc2, 0x1000000 //NUM_RECORDS in bytes + end + + s_and_b32 m0, s_wave_size, 1 + s_cmp_eq_u32 m0, 1 + s_cbranch_scc1 L_SAVE_HWREG_WAVE64 + + write_sgpr_to_mem_wave32(s_save_m0, s_save_buf_rsrc0, s_save_mem_offset, SGPR_SAVE_USE_SQC, USE_MTBUF_INSTEAD_OF_MUBUF) //M0 + + if ((EMU_RUN_HACK) && (EMU_RUN_HACK_SAVE_FIRST_TIME)) + s_add_u32 s_save_pc_lo, s_save_pc_lo, 4 //pc[31:0]+4 + s_addc_u32 s_save_pc_hi, s_save_pc_hi, 0x0 //carry bit over + end + + write_sgpr_to_mem_wave32(s_save_pc_lo, s_save_buf_rsrc0, s_save_mem_offset, SGPR_SAVE_USE_SQC, USE_MTBUF_INSTEAD_OF_MUBUF) //PC + write_sgpr_to_mem_wave32(s_save_pc_hi, s_save_buf_rsrc0, s_save_mem_offset, SGPR_SAVE_USE_SQC, USE_MTBUF_INSTEAD_OF_MUBUF) + write_sgpr_to_mem_wave32(s_save_exec_lo, s_save_buf_rsrc0, s_save_mem_offset, SGPR_SAVE_USE_SQC, USE_MTBUF_INSTEAD_OF_MUBUF) //EXEC + write_sgpr_to_mem_wave32(s_save_exec_hi, s_save_buf_rsrc0, s_save_mem_offset, SGPR_SAVE_USE_SQC, USE_MTBUF_INSTEAD_OF_MUBUF) + write_sgpr_to_mem_wave32(s_save_status, s_save_buf_rsrc0, s_save_mem_offset, SGPR_SAVE_USE_SQC, USE_MTBUF_INSTEAD_OF_MUBUF) //STATUS + + //s_save_trapsts conflicts with s_save_alloc_size + s_getreg_b32 s_save_trapsts, hwreg(HW_REG_TRAPSTS) + write_sgpr_to_mem_wave32(s_save_trapsts, s_save_buf_rsrc0, s_save_mem_offset, SGPR_SAVE_USE_SQC, USE_MTBUF_INSTEAD_OF_MUBUF) //TRAPSTS + + //write_sgpr_to_mem_wave32(s_save_xnack_mask_lo, s_save_buf_rsrc0, s_save_mem_offset, SGPR_SAVE_USE_SQC, USE_MTBUF_INSTEAD_OF_MUBUF) //XNACK_MASK_LO + write_sgpr_to_mem_wave32(s_save_xnack_mask, s_save_buf_rsrc0, s_save_mem_offset, SGPR_SAVE_USE_SQC, USE_MTBUF_INSTEAD_OF_MUBUF) //XNACK_MASK_HI + + //use s_save_tmp would introduce conflict here between s_save_tmp and s_save_buf_rsrc2 + s_getreg_b32 s_save_m0, hwreg(HW_REG_MODE) //MODE + write_sgpr_to_mem_wave32(s_save_m0, s_save_buf_rsrc0, s_save_mem_offset, SGPR_SAVE_USE_SQC, USE_MTBUF_INSTEAD_OF_MUBUF) + if(SAVE_RESTORE_HWID_DDID) + s_getreg_b32 s_save_m0, hwreg(HW_REG_HW_ID1) //HW_ID1, handler records the SE/SA/WGP/SIMD/wave of the original wave + write_sgpr_to_mem_wave32(s_save_m0, s_save_buf_rsrc0, s_save_mem_offset, SGPR_SAVE_USE_SQC, USE_MTBUF_INSTEAD_OF_MUBUF) + end + s_branch L_S_PGM_END_SAVED + + L_SAVE_HWREG_WAVE64: + write_sgpr_to_mem_wave64(s_save_m0, s_save_buf_rsrc0, s_save_mem_offset, SGPR_SAVE_USE_SQC, USE_MTBUF_INSTEAD_OF_MUBUF) //M0 + + if ((EMU_RUN_HACK) && (EMU_RUN_HACK_SAVE_FIRST_TIME)) + s_add_u32 s_save_pc_lo, s_save_pc_lo, 4 //pc[31:0]+4 + s_addc_u32 s_save_pc_hi, s_save_pc_hi, 0x0 //carry bit over + end + + write_sgpr_to_mem_wave64(s_save_pc_lo, s_save_buf_rsrc0, s_save_mem_offset, SGPR_SAVE_USE_SQC, USE_MTBUF_INSTEAD_OF_MUBUF) //PC + write_sgpr_to_mem_wave64(s_save_pc_hi, s_save_buf_rsrc0, s_save_mem_offset, SGPR_SAVE_USE_SQC, USE_MTBUF_INSTEAD_OF_MUBUF) + write_sgpr_to_mem_wave64(s_save_exec_lo, s_save_buf_rsrc0, s_save_mem_offset, SGPR_SAVE_USE_SQC, USE_MTBUF_INSTEAD_OF_MUBUF) //EXEC + write_sgpr_to_mem_wave64(s_save_exec_hi, s_save_buf_rsrc0, s_save_mem_offset, SGPR_SAVE_USE_SQC, USE_MTBUF_INSTEAD_OF_MUBUF) + write_sgpr_to_mem_wave64(s_save_status, s_save_buf_rsrc0, s_save_mem_offset, SGPR_SAVE_USE_SQC, USE_MTBUF_INSTEAD_OF_MUBUF) //STATUS + + //s_save_trapsts conflicts with s_save_alloc_size + s_getreg_b32 s_save_trapsts, hwreg(HW_REG_TRAPSTS) + write_sgpr_to_mem_wave64(s_save_trapsts, s_save_buf_rsrc0, s_save_mem_offset, SGPR_SAVE_USE_SQC, USE_MTBUF_INSTEAD_OF_MUBUF) //TRAPSTS + + //write_sgpr_to_mem_wave64(s_save_xnack_mask_lo, s_save_buf_rsrc0, s_save_mem_offset, SGPR_SAVE_USE_SQC, USE_MTBUF_INSTEAD_OF_MUBUF) //XNACK_MASK_LO + write_sgpr_to_mem_wave64(s_save_xnack_mask, s_save_buf_rsrc0, s_save_mem_offset, SGPR_SAVE_USE_SQC, USE_MTBUF_INSTEAD_OF_MUBUF) //XNACK_MASK_HI + + //use s_save_tmp would introduce conflict here between s_save_tmp and s_save_buf_rsrc2 + s_getreg_b32 s_save_m0, hwreg(HW_REG_MODE) //MODE + write_sgpr_to_mem_wave64(s_save_m0, s_save_buf_rsrc0, s_save_mem_offset, SGPR_SAVE_USE_SQC, USE_MTBUF_INSTEAD_OF_MUBUF) + + + if(SAVE_RESTORE_HWID_DDID) + s_getreg_b32 s_save_m0, hwreg(HW_REG_HW_ID1) //HW_ID1, handler records the SE/SA/WGP/SIMD/wave of the original wave + write_sgpr_to_mem_wave64(s_save_m0, s_save_buf_rsrc0, s_save_mem_offset, SGPR_SAVE_USE_SQC, USE_MTBUF_INSTEAD_OF_MUBUF) + + /* save DDID */ + ////////////////////////////// + L_SAVE_DDID: + //EXEC has been saved, no vector inst following + s_mov_b32 exec_lo, 0x80000000 //Set MSB to 1. Cleared when draw index is returned + s_sendmsg sendmsg(MSG_GET_DDID) + + L_WAIT_DDID_LOOP: + s_nop 7 // sleep a bit + s_bitcmp0_b32 exec_lo, 31 // test to see if MSB is cleared, meaning done + s_cbranch_scc0 L_WAIT_DDID_LOOP + + s_mov_b32 s_save_m0, exec_lo + + + s_mov_b32 s_save_buf_rsrc2, 0x4 //NUM_RECORDS in bytes + if (SWIZZLE_EN) + s_add_u32 s_save_buf_rsrc2, s_save_buf_rsrc2, 0x0 //FIXME need to use swizzle to enable bounds checking? + else + s_mov_b32 s_save_buf_rsrc2, 0x1000000 //NUM_RECORDS in bytes + end + s_and_b32 m0, s_wave_size, 1 + s_cmp_eq_u32 m0, 1 + s_cbranch_scc1 L_SAVE_DDID_WAVE64 + + write_sgpr_to_mem_wave32(s_save_m0, s_save_buf_rsrc0, s_save_mem_offset, SGPR_SAVE_USE_SQC, USE_MTBUF_INSTEAD_OF_MUBUF) + + L_SAVE_DDID_WAVE64: + write_sgpr_to_mem_wave64(s_save_m0, s_save_buf_rsrc0, s_save_mem_offset, SGPR_SAVE_USE_SQC, USE_MTBUF_INSTEAD_OF_MUBUF) + + end + + L_S_PGM_END_SAVED: + /* S_PGM_END_SAVED */ //FIXME graphics ONLY + if ((EMU_RUN_HACK) && (!EMU_RUN_HACK_SAVE_NORMAL_EXIT)) + s_and_b32 s_save_pc_hi, s_save_pc_hi, 0x0000ffff //pc[47:32] + s_add_u32 s_save_pc_lo, s_save_pc_lo, 4 //pc[31:0]+4 + s_addc_u32 s_save_pc_hi, s_save_pc_hi, 0x0 //carry bit over + s_rfe_b64 s_save_pc_lo //Return to the main shader program + else + end + + + s_branch L_END_PGM + + + +/**************************************************************************/ +/* restore routine */ +/**************************************************************************/ + +L_RESTORE: + /* Setup Resource Contants */ + if ((EMU_RUN_HACK) && (!EMU_RUN_HACK_RESTORE_NORMAL)) + //calculate wd_addr using absolute thread id + v_readlane_b32 s_restore_tmp, v9, 0 + //determine it is wave32 or wave64 + s_getreg_b32 s_restore_size, hwreg(HW_REG_IB_STS2,SQ_WAVE_IB_STS2_WAVE64_SHIFT,SQ_WAVE_IB_STS2_WAVE64_SIZE) //change to ttmp13 + s_cmp_eq_u32 s_restore_size, 0 + s_cbranch_scc1 L_RESTORE_WAVE32 + s_lshr_b32 s_restore_tmp, s_restore_tmp, 6 //SAVE WAVE64 + s_branch L_RESTORE_CON + L_RESTORE_WAVE32: + s_lshr_b32 s_restore_tmp, s_restore_tmp, 5 //SAVE WAVE32 + L_RESTORE_CON: + s_mul_i32 s_restore_tmp, s_restore_tmp, WAVE_SPACE + s_add_i32 s_restore_spi_init_lo, s_restore_tmp, WG_BASE_ADDR_LO + s_mov_b32 s_restore_spi_init_hi, WG_BASE_ADDR_HI + s_and_b32 s_restore_spi_init_hi, s_restore_spi_init_hi, CTX_RESTORE_CONTROL + else + end + + s_mov_b32 s_restore_buf_rsrc0, s_restore_spi_init_lo //base_addr_lo + s_and_b32 s_restore_buf_rsrc1, s_restore_spi_init_hi, 0x0000FFFF //base_addr_hi + s_or_b32 s_restore_buf_rsrc1, s_restore_buf_rsrc1, S_RESTORE_BUF_RSRC_WORD1_STRIDE + s_mov_b32 s_restore_buf_rsrc2, 0 //NUM_RECORDS initial value = 0 (in bytes) + s_mov_b32 s_restore_buf_rsrc3, S_RESTORE_BUF_RSRC_WORD3_MISC + s_and_b32 s_restore_tmp, s_restore_spi_init_hi, S_RESTORE_SPI_INIT_ATC_MASK + s_lshr_b32 s_restore_tmp, s_restore_tmp, (S_RESTORE_SPI_INIT_ATC_SHIFT-SQ_BUF_RSRC_WORD1_ATC_SHIFT) //get ATC bit into position + s_or_b32 s_restore_buf_rsrc3, s_restore_buf_rsrc3, s_restore_tmp //or ATC + s_and_b32 s_restore_tmp, s_restore_spi_init_hi, S_RESTORE_SPI_INIT_MTYPE_MASK + s_lshr_b32 s_restore_tmp, s_restore_tmp, (S_RESTORE_SPI_INIT_MTYPE_SHIFT-SQ_BUF_RSRC_WORD3_MTYPE_SHIFT) //get MTYPE bits into position + s_or_b32 s_restore_buf_rsrc3, s_restore_buf_rsrc3, s_restore_tmp //or MTYPE + //determine it is wave32 or wave64 + s_getreg_b32 s_restore_size, hwreg(HW_REG_IB_STS2,SQ_WAVE_IB_STS2_WAVE64_SHIFT,SQ_WAVE_IB_STS2_WAVE64_SIZE) + s_or_b32 s_restore_size, s_restore_spi_init_hi, s_restore_size //share s_wave_size with exec_hi + + /* global mem offset */ + s_mov_b32 s_restore_mem_offset, 0x0 //mem offset initial value = 0 + + /* restore VGPRs */ + ////////////////////////////// + L_RESTORE_VGPR: + + s_mov_b32 exec_lo, 0xFFFFFFFF //need every thread from now on //be consistent with SAVE although can be moved ahead + s_and_b32 m0, s_restore_size, 1 + s_cmp_eq_u32 m0, 1 + s_cbranch_scc1 L_ENABLE_RESTORE_VGPR_EXEC_HI + s_mov_b32 exec_hi, 0x00000000 + s_branch L_RESTORE_VGPR_NORMAL + L_ENABLE_RESTORE_VGPR_EXEC_HI: + s_mov_b32 exec_hi, 0xFFFFFFFF + L_RESTORE_VGPR_NORMAL: + s_getreg_b32 s_restore_alloc_size, hwreg(HW_REG_GPR_ALLOC,SQ_WAVE_GPR_ALLOC_VGPR_SIZE_SHIFT,SQ_WAVE_GPR_ALLOC_VGPR_SIZE_SIZE) //vpgr_size + s_add_u32 s_restore_alloc_size, s_restore_alloc_size, 1 + s_lshl_b32 s_restore_alloc_size, s_restore_alloc_size, 2 //Number of VGPRs = (vgpr_size + 1) * 4 (non-zero value) + //determine it is wave32 or wave64 + s_and_b32 m0, s_restore_size, 1 + s_cmp_eq_u32 m0, 1 + s_cbranch_scc1 L_RESTORE_VGPR_WAVE64 + + s_lshl_b32 s_restore_buf_rsrc2, s_restore_alloc_size, 7 //NUM_RECORDS in bytes (32 threads*4) + if (SWIZZLE_EN) + s_add_u32 s_restore_buf_rsrc2, s_restore_buf_rsrc2, 0x0 //FIXME need to use swizzle to enable bounds checking? + else + s_mov_b32 s_restore_buf_rsrc2, 0x1000000 //NUM_RECORDS in bytes + end + + s_mov_b32 s_restore_mem_offset_save, s_restore_mem_offset // restore start with v1, v0 will be the last + s_add_u32 s_restore_mem_offset, s_restore_mem_offset, 128 + s_mov_b32 m0, 1 //VGPR initial index value = 1 + //s_set_gpr_idx_on m0, 0x8 //M0[7:0] = M0[7:0] and M0[15:12] = 0x8 + //s_add_u32 s_restore_alloc_size, s_restore_alloc_size, 0x8000 //add 0x8000 since we compare m0 against it later, might not need this in gfx10 + + L_RESTORE_VGPR_WAVE32_LOOP: + if(USE_MTBUF_INSTEAD_OF_MUBUF) + tbuffer_load_format_x v0, v0, s_restore_buf_rsrc0, s_restore_mem_offset format:BUF_NUM_FORMAT_FLOAT format: BUF_DATA_FORMAT_32 slc:1 glc:1 + else + buffer_load_dword v0, v0, s_restore_buf_rsrc0, s_restore_mem_offset slc:1 glc:1 + end + s_waitcnt vmcnt(0) //ensure data ready + v_movreld_b32 v0, v0 //v[0+m0] = v0 + s_add_u32 m0, m0, 1 //next vgpr index + s_add_u32 s_restore_mem_offset, s_restore_mem_offset, 128 //every buffer_load_dword does 128 bytes + s_cmp_lt_u32 m0, s_restore_alloc_size //scc = (m0 < s_restore_alloc_size) ? 1 : 0 + s_cbranch_scc1 L_RESTORE_VGPR_WAVE32_LOOP //VGPR restore (except v0) is complete? + //s_set_gpr_idx_off + /* VGPR restore on v0 */ + if(USE_MTBUF_INSTEAD_OF_MUBUF) + tbuffer_load_format_x v0, v0, s_restore_buf_rsrc0, s_restore_mem_offset_save format:BUF_NUM_FORMAT_FLOAT format: BUF_DATA_FORMAT_32 slc:1 glc:1 + else + buffer_load_dword v0, v0, s_restore_buf_rsrc0, s_restore_mem_offset_save slc:1 glc:1 + end + + s_branch L_RESTORE_LDS + + L_RESTORE_VGPR_WAVE64: + s_lshl_b32 s_restore_buf_rsrc2, s_restore_alloc_size, 8 //NUM_RECORDS in bytes (64 threads*4) + if (SWIZZLE_EN) + s_add_u32 s_restore_buf_rsrc2, s_restore_buf_rsrc2, 0x0 //FIXME need to use swizzle to enable bounds checking? + else + s_mov_b32 s_restore_buf_rsrc2, 0x1000000 //NUM_RECORDS in bytes + end + + s_mov_b32 s_restore_mem_offset_save, s_restore_mem_offset // restore start with v1, v0 will be the last + s_add_u32 s_restore_mem_offset, s_restore_mem_offset, 256 + s_mov_b32 m0, 1 //VGPR initial index value = 1 + L_RESTORE_VGPR_WAVE64_LOOP: + if(USE_MTBUF_INSTEAD_OF_MUBUF) + tbuffer_load_format_x v0, v0, s_restore_buf_rsrc0, s_restore_mem_offset format:BUF_NUM_FORMAT_FLOAT format: BUF_DATA_FORMAT_32 slc:1 glc:1 + else + buffer_load_dword v0, v0, s_restore_buf_rsrc0, s_restore_mem_offset slc:1 glc:1 + end + s_waitcnt vmcnt(0) //ensure data ready + v_movreld_b32 v0, v0 //v[0+m0] = v0 + s_add_u32 m0, m0, 1 //next vgpr index + s_add_u32 s_restore_mem_offset, s_restore_mem_offset, 256 //every buffer_load_dword does 256 bytes + s_cmp_lt_u32 m0, s_restore_alloc_size //scc = (m0 < s_restore_alloc_size) ? 1 : 0 + s_cbranch_scc1 L_RESTORE_VGPR_WAVE64_LOOP //VGPR restore (except v0) is complete? + //s_set_gpr_idx_off + // + //Below part will be the restore shared vgpr part (new for gfx10) + s_getreg_b32 s_restore_alloc_size, hwreg(HW_REG_LDS_ALLOC,SQ_WAVE_LDS_ALLOC_VGPR_SHARED_SIZE_SHIFT,SQ_WAVE_LDS_ALLOC_VGPR_SHARED_SIZE_SIZE) //shared_vgpr_size + s_and_b32 s_restore_alloc_size, s_restore_alloc_size, 0xFFFFFFFF //shared_vgpr_size is zero? + s_cbranch_scc0 L_RESTORE_V0 //no shared_vgpr used? jump to L_SAVE_LDS + s_lshl_b32 s_restore_alloc_size, s_restore_alloc_size, 3 //Number of SHARED_VGPRs = shared_vgpr_size * 8 (non-zero value) + //m0 now has the value of normal vgpr count, just add the m0 with shared_vgpr count to get the total count. + //restore shared_vgpr will start from the index of m0 + s_add_u32 s_restore_alloc_size, s_restore_alloc_size, m0 + s_mov_b32 exec_lo, 0xFFFFFFFF + s_mov_b32 exec_hi, 0x00000000 + L_RESTORE_SHARED_VGPR_WAVE64_LOOP: + buffer_load_dword v0, v0, s_restore_buf_rsrc0, s_restore_mem_offset slc:1 glc:1 + s_waitcnt vmcnt(0) //ensure data ready + v_movreld_b32 v0, v0 //v[0+m0] = v0 + s_add_u32 m0, m0, 1 //next vgpr index + s_add_u32 s_restore_mem_offset, s_restore_mem_offset, 128 //every buffer_load_dword does 256 bytes + s_cmp_lt_u32 m0, s_restore_alloc_size //scc = (m0 < s_restore_alloc_size) ? 1 : 0 + s_cbranch_scc1 L_RESTORE_SHARED_VGPR_WAVE64_LOOP //VGPR restore (except v0) is complete? + + s_mov_b32 exec_hi, 0xFFFFFFFF //restore back exec_hi before restoring V0!! + + /* VGPR restore on v0 */ + L_RESTORE_V0: + if(USE_MTBUF_INSTEAD_OF_MUBUF) + tbuffer_load_format_x v0, v0, s_restore_buf_rsrc0, s_restore_mem_offset_save format:BUF_NUM_FORMAT_FLOAT format: BUF_DATA_FORMAT_32 slc:1 glc:1 + else + buffer_load_dword v0, v0, s_restore_buf_rsrc0, s_restore_mem_offset_save slc:1 glc:1 + end + + + /* restore LDS */ + ////////////////////////////// + L_RESTORE_LDS: + + //Only need to check the first wave + /* the first wave in the threadgroup */ + s_and_b32 s_restore_tmp, s_restore_size, S_RESTORE_SPI_INIT_FIRST_WAVE_MASK + s_cbranch_scc0 L_RESTORE_SGPR + + s_mov_b32 exec_lo, 0xFFFFFFFF //need every thread from now on //be consistent with SAVE although can be moved ahead + s_and_b32 m0, s_restore_size, 1 + s_cmp_eq_u32 m0, 1 + s_cbranch_scc1 L_ENABLE_RESTORE_LDS_EXEC_HI + s_mov_b32 exec_hi, 0x00000000 + s_branch L_RESTORE_LDS_NORMAL + L_ENABLE_RESTORE_LDS_EXEC_HI: + s_mov_b32 exec_hi, 0xFFFFFFFF + L_RESTORE_LDS_NORMAL: + s_getreg_b32 s_restore_alloc_size, hwreg(HW_REG_LDS_ALLOC,SQ_WAVE_LDS_ALLOC_LDS_SIZE_SHIFT,SQ_WAVE_LDS_ALLOC_LDS_SIZE_SIZE) //lds_size + s_and_b32 s_restore_alloc_size, s_restore_alloc_size, 0xFFFFFFFF //lds_size is zero? + s_cbranch_scc0 L_RESTORE_SGPR //no lds used? jump to L_RESTORE_VGPR + s_lshl_b32 s_restore_alloc_size, s_restore_alloc_size, 6 //LDS size in dwords = lds_size * 64dw + s_lshl_b32 s_restore_alloc_size, s_restore_alloc_size, 2 //LDS size in bytes + s_mov_b32 s_restore_buf_rsrc2, s_restore_alloc_size //NUM_RECORDS in bytes + if (SWIZZLE_EN) + s_add_u32 s_restore_buf_rsrc2, s_restore_buf_rsrc2, 0x0 //FIXME need to use swizzle to enable bounds checking? + else + s_mov_b32 s_restore_buf_rsrc2, 0x1000000 //NUM_RECORDS in bytes + end + + s_and_b32 m0, s_wave_size, 1 + s_cmp_eq_u32 m0, 1 + s_mov_b32 m0, 0x0 + s_cbranch_scc1 L_RESTORE_LDS_LOOP_W64 + + L_RESTORE_LDS_LOOP_W32: + if (SAVE_LDS) + buffer_load_dword v0, v0, s_restore_buf_rsrc0, s_restore_mem_offset lds:1 + s_waitcnt 0 + end + s_add_u32 m0, m0, 128 //every buffer_load_dword does 256 bytes + s_add_u32 s_restore_mem_offset, s_restore_mem_offset, 128 //mem offset increased by 256 bytes + s_cmp_lt_u32 m0, s_restore_alloc_size //scc=(m0 < s_restore_alloc_size) ? 1 : 0 + s_cbranch_scc1 L_RESTORE_LDS_LOOP_W32 //LDS restore is complete? + s_branch L_RESTORE_SGPR + + L_RESTORE_LDS_LOOP_W64: + if (SAVE_LDS) + buffer_load_dword v0, v0, s_restore_buf_rsrc0, s_restore_mem_offset lds:1 + s_waitcnt 0 + end + s_add_u32 m0, m0, 256 //every buffer_load_dword does 256 bytes + s_add_u32 s_restore_mem_offset, s_restore_mem_offset, 256 //mem offset increased by 256 bytes + s_cmp_lt_u32 m0, s_restore_alloc_size //scc=(m0 < s_restore_alloc_size) ? 1 : 0 + s_cbranch_scc1 L_RESTORE_LDS_LOOP_W64 //LDS restore is complete? + + + /* restore SGPRs */ + ////////////////////////////// + //s_getreg_b32 s_restore_alloc_size, hwreg(HW_REG_GPR_ALLOC,SQ_WAVE_GPR_ALLOC_SGPR_SIZE_SHIFT,SQ_WAVE_GPR_ALLOC_SGPR_SIZE_SIZE) //spgr_size + //s_add_u32 s_restore_alloc_size, s_restore_alloc_size, 1 + //s_lshl_b32 s_restore_alloc_size, s_restore_alloc_size, 4 //Number of SGPRs = (sgpr_size + 1) * 16 (non-zero value) + //s_lshl_b32 s_restore_alloc_size, s_restore_alloc_size, 3 //Number of SGPRs = (sgpr_size + 1) * 8 (non-zero value) + L_RESTORE_SGPR: + //need to look at it is wave32 or wave64 + s_and_b32 m0, s_restore_size, 1 + s_cmp_eq_u32 m0, 1 + s_cbranch_scc1 L_RESTORE_SGPR_VMEM_WAVE64 + if (SGPR_SAVE_USE_SQC) + s_lshl_b32 s_restore_buf_rsrc2, s_sgpr_save_num, 2 //NUM_RECORDS in bytes + else + s_lshl_b32 s_restore_buf_rsrc2, s_sgpr_save_num, 7 //NUM_RECORDS in bytes (32 threads) + end + s_branch L_RESTORE_SGPR_CONT + L_RESTORE_SGPR_VMEM_WAVE64: + if (SGPR_SAVE_USE_SQC) + s_lshl_b32 s_restore_buf_rsrc2, s_sgpr_save_num, 2 //NUM_RECORDS in bytes + else + s_lshl_b32 s_restore_buf_rsrc2, s_sgpr_save_num, 8 //NUM_RECORDS in bytes (64 threads) + end + + L_RESTORE_SGPR_CONT: + if (SWIZZLE_EN) + s_add_u32 s_restore_buf_rsrc2, s_restore_buf_rsrc2, 0x0 //FIXME need to use swizzle to enable bounds checking? + else + s_mov_b32 s_restore_buf_rsrc2, 0x1000000 //NUM_RECORDS in bytes + end + + s_and_b32 m0, s_restore_size, 1 + s_cmp_eq_u32 m0, 1 + s_cbranch_scc1 L_RESTORE_SGPR_WAVE64 + + read_sgpr_from_mem_wave32(s_restore_tmp, s_restore_buf_rsrc0, s_restore_mem_offset, SGPR_SAVE_USE_SQC) //save s0 to s_restore_tmp + s_mov_b32 m0, 0x1 + + L_RESTORE_SGPR_LOOP_WAVE32: + read_sgpr_from_mem_wave32(s0, s_restore_buf_rsrc0, s_restore_mem_offset, SGPR_SAVE_USE_SQC) //PV: further performance improvement can be made + s_waitcnt lgkmcnt(0) //ensure data ready + s_movreld_b32 s0, s0 //s[0+m0] = s0 + s_nop 0 // hazard SALU M0=> S_MOVREL + s_add_u32 m0, m0, 1 //next sgpr index + s_cmp_lt_u32 m0, s_sgpr_save_num //scc = (m0 < s_restore_alloc_size) ? 1 : 0 + s_cbranch_scc1 L_RESTORE_SGPR_LOOP_WAVE32 //SGPR restore (except s0) is complete? + s_mov_b32 s0, s_restore_tmp /* SGPR restore on s0 */ + s_branch L_RESTORE_HWREG + + L_RESTORE_SGPR_WAVE64: + read_sgpr_from_mem_wave64(s_restore_tmp, s_restore_buf_rsrc0, s_restore_mem_offset, SGPR_SAVE_USE_SQC) //save s0 to s_restore_tmp + s_mov_b32 m0, 0x1 //SGPR initial index value =1 //go on with with s1 + + L_RESTORE_SGPR_LOOP_WAVE64: + read_sgpr_from_mem_wave64(s0, s_restore_buf_rsrc0, s_restore_mem_offset, SGPR_SAVE_USE_SQC) //PV: further performance improvement can be made + s_waitcnt lgkmcnt(0) //ensure data ready + s_movreld_b32 s0, s0 //s[0+m0] = s0 + s_nop 0 // hazard SALU M0=> S_MOVREL + s_add_u32 m0, m0, 1 //next sgpr index + s_cmp_lt_u32 m0, s_sgpr_save_num //scc = (m0 < s_restore_alloc_size) ? 1 : 0 + s_cbranch_scc1 L_RESTORE_SGPR_LOOP_WAVE64 //SGPR restore (except s0) is complete? + s_mov_b32 s0, s_restore_tmp /* SGPR restore on s0 */ + + + /* restore HW registers */ + ////////////////////////////// + L_RESTORE_HWREG: + s_mov_b32 s_restore_buf_rsrc2, 0x4 //NUM_RECORDS in bytes + if (SWIZZLE_EN) + s_add_u32 s_restore_buf_rsrc2, s_restore_buf_rsrc2, 0x0 //FIXME need to use swizzle to enable bounds checking? + else + s_mov_b32 s_restore_buf_rsrc2, 0x1000000 //NUM_RECORDS in bytes + end + + s_and_b32 m0, s_restore_size, 1 + s_cmp_eq_u32 m0, 1 + s_cbranch_scc1 L_RESTORE_HWREG_WAVE64 + + read_sgpr_from_mem_wave32(s_restore_m0, s_restore_buf_rsrc0, s_restore_mem_offset, SGPR_SAVE_USE_SQC) //M0 + read_sgpr_from_mem_wave32(s_restore_pc_lo, s_restore_buf_rsrc0, s_restore_mem_offset, SGPR_SAVE_USE_SQC) //PC + read_sgpr_from_mem_wave32(s_restore_pc_hi, s_restore_buf_rsrc0, s_restore_mem_offset, SGPR_SAVE_USE_SQC) + read_sgpr_from_mem_wave32(s_restore_exec_lo, s_restore_buf_rsrc0, s_restore_mem_offset, SGPR_SAVE_USE_SQC) //EXEC + read_sgpr_from_mem_wave32(s_restore_exec_hi, s_restore_buf_rsrc0, s_restore_mem_offset, SGPR_SAVE_USE_SQC) + read_sgpr_from_mem_wave32(s_restore_status, s_restore_buf_rsrc0, s_restore_mem_offset, SGPR_SAVE_USE_SQC) //STATUS + read_sgpr_from_mem_wave32(s_restore_trapsts, s_restore_buf_rsrc0, s_restore_mem_offset, SGPR_SAVE_USE_SQC) //TRAPSTS + //read_sgpr_from_mem_wave32(xnack_mask_lo, s_restore_buf_rsrc0, s_restore_mem_offset, SGPR_SAVE_USE_SQC) //XNACK_MASK_LO + //read_sgpr_from_mem_wave32(xnack_mask_hi, s_restore_buf_rsrc0, s_restore_mem_offset, SGPR_SAVE_USE_SQC) //XNACK_MASK_HI + read_sgpr_from_mem_wave32(s_restore_xnack_mask, s_restore_buf_rsrc0, s_restore_mem_offset, SGPR_SAVE_USE_SQC) //XNACK_MASK + read_sgpr_from_mem_wave32(s_restore_mode, s_restore_buf_rsrc0, s_restore_mem_offset, SGPR_SAVE_USE_SQC) //MODE + if(SAVE_RESTORE_HWID_DDID) + read_sgpr_from_mem_wave32(s_restore_hwid1, s_restore_buf_rsrc0, s_restore_mem_offset, SGPR_SAVE_USE_SQC) //HW_ID1 + end + s_branch L_RESTORE_HWREG_FINISH + + L_RESTORE_HWREG_WAVE64: + read_sgpr_from_mem_wave64(s_restore_m0, s_restore_buf_rsrc0, s_restore_mem_offset, SGPR_SAVE_USE_SQC) //M0 + read_sgpr_from_mem_wave64(s_restore_pc_lo, s_restore_buf_rsrc0, s_restore_mem_offset, SGPR_SAVE_USE_SQC) //PC + read_sgpr_from_mem_wave64(s_restore_pc_hi, s_restore_buf_rsrc0, s_restore_mem_offset, SGPR_SAVE_USE_SQC) + read_sgpr_from_mem_wave64(s_restore_exec_lo, s_restore_buf_rsrc0, s_restore_mem_offset, SGPR_SAVE_USE_SQC) //EXEC + read_sgpr_from_mem_wave64(s_restore_exec_hi, s_restore_buf_rsrc0, s_restore_mem_offset, SGPR_SAVE_USE_SQC) + read_sgpr_from_mem_wave64(s_restore_status, s_restore_buf_rsrc0, s_restore_mem_offset, SGPR_SAVE_USE_SQC) //STATUS + read_sgpr_from_mem_wave64(s_restore_trapsts, s_restore_buf_rsrc0, s_restore_mem_offset, SGPR_SAVE_USE_SQC) //TRAPSTS + //read_sgpr_from_mem_wave64(xnack_mask_lo, s_restore_buf_rsrc0, s_restore_mem_offset, SGPR_SAVE_USE_SQC) //XNACK_MASK_LO + //read_sgpr_from_mem_wave64(xnack_mask_hi, s_restore_buf_rsrc0, s_restore_mem_offset, SGPR_SAVE_USE_SQC) //XNACK_MASK_HI + read_sgpr_from_mem_wave64(s_restore_xnack_mask, s_restore_buf_rsrc0, s_restore_mem_offset, SGPR_SAVE_USE_SQC) //XNACK_MASK + read_sgpr_from_mem_wave64(s_restore_mode, s_restore_buf_rsrc0, s_restore_mem_offset, SGPR_SAVE_USE_SQC) //MODE + if(SAVE_RESTORE_HWID_DDID) + read_sgpr_from_mem_wave64(s_restore_hwid1, s_restore_buf_rsrc0, s_restore_mem_offset, SGPR_SAVE_USE_SQC) //HW_ID1 + end + L_RESTORE_HWREG_FINISH: + s_waitcnt lgkmcnt(0) //from now on, it is safe to restore STATUS and IB_STS + + + + if(SAVE_RESTORE_HWID_DDID) + L_RESTORE_DDID: + s_mov_b32 m0, s_restore_hwid1 //virture ttrace support: The save-context handler records the SE/SA/WGP/SIMD/wave of the original wave + s_ttracedata //and then can output it as SHADER_DATA to ttrace on restore to provide a correlation across the save-restore + + s_mov_b32 s_restore_buf_rsrc2, 0x4 //NUM_RECORDS in bytes + if (SWIZZLE_EN) + s_add_u32 s_restore_buf_rsrc2, s_restore_buf_rsrc2, 0x0 //FIXME need to use swizzle to enable bounds checking? + else + s_mov_b32 s_restore_buf_rsrc2, 0x1000000 //NUM_RECORDS in bytes + end + + s_and_b32 m0, s_restore_size, 1 + s_cmp_eq_u32 m0, 1 + s_cbranch_scc1 L_RESTORE_DDID_WAVE64 + + read_sgpr_from_mem_wave32(s_restore_ddid, s_restore_buf_rsrc0, s_restore_mem_offset, SGPR_SAVE_USE_SQC) + s_branch L_RESTORE_DDID_FINISH + L_RESTORE_DDID_WAVE64: + read_sgpr_from_mem_wave64(s_restore_ddid, s_restore_buf_rsrc0, s_restore_mem_offset, SGPR_SAVE_USE_SQC) + + L_RESTORE_DDID_FINISH: + s_waitcnt lgkmcnt(0) + //s_mov_b32 m0, s_restore_ddid + //s_ttracedata + if (RESTORE_DDID_IN_SGPR18) + s_mov_b32 s18, s_restore_ddid + end + + end + + s_and_b32 s_restore_pc_hi, s_restore_pc_hi, 0x0000ffff //pc[47:32] //Do it here in order not to affect STATUS + + //for normal save & restore, the saved PC points to the next inst to execute, no adjustment needs to be made, otherwise: + if ((EMU_RUN_HACK) && (!EMU_RUN_HACK_RESTORE_NORMAL)) + s_add_u32 s_restore_pc_lo, s_restore_pc_lo, 8 //pc[31:0]+8 //two back-to-back s_trap are used (first for save and second for restore) + s_addc_u32 s_restore_pc_hi, s_restore_pc_hi, 0x0 //carry bit over + end + if ((EMU_RUN_HACK) && (EMU_RUN_HACK_RESTORE_NORMAL)) + s_add_u32 s_restore_pc_lo, s_restore_pc_lo, 4 //pc[31:0]+4 // save is hack through s_trap but restore is normal + s_addc_u32 s_restore_pc_hi, s_restore_pc_hi, 0x0 //carry bit over + end + + s_mov_b32 m0, s_restore_m0 + s_mov_b32 exec_lo, s_restore_exec_lo + s_mov_b32 exec_hi, s_restore_exec_hi + + s_and_b32 s_restore_m0, SQ_WAVE_TRAPSTS_PRE_SAVECTX_MASK, s_restore_trapsts + s_setreg_b32 hwreg(HW_REG_TRAPSTS, SQ_WAVE_TRAPSTS_PRE_SAVECTX_SHIFT, SQ_WAVE_TRAPSTS_PRE_SAVECTX_SIZE), s_restore_m0 + s_setreg_b32 hwreg(HW_REG_SHADER_XNACK_MASK), s_restore_xnack_mask //restore xnack_mask + s_and_b32 s_restore_m0, SQ_WAVE_TRAPSTS_POST_SAVECTX_MASK, s_restore_trapsts + s_lshr_b32 s_restore_m0, s_restore_m0, SQ_WAVE_TRAPSTS_POST_SAVECTX_SHIFT + s_setreg_b32 hwreg(HW_REG_TRAPSTS, SQ_WAVE_TRAPSTS_POST_SAVECTX_SHIFT, SQ_WAVE_TRAPSTS_POST_SAVECTX_SIZE), s_restore_m0 + //s_setreg_b32 hwreg(HW_REG_TRAPSTS), s_restore_trapsts //don't overwrite SAVECTX bit as it may be set through external SAVECTX during restore + s_setreg_b32 hwreg(HW_REG_MODE), s_restore_mode + //reuse s_restore_m0 as a temp register + s_and_b32 s_restore_m0, s_restore_pc_hi, S_SAVE_PC_HI_RCNT_MASK + s_lshr_b32 s_restore_m0, s_restore_m0, S_SAVE_PC_HI_RCNT_SHIFT + s_lshl_b32 s_restore_m0, s_restore_m0, SQ_WAVE_IB_STS_RCNT_SHIFT + s_mov_b32 s_restore_tmp, 0x0 //IB_STS is zero + s_or_b32 s_restore_tmp, s_restore_tmp, s_restore_m0 + s_and_b32 s_restore_m0, s_restore_pc_hi, S_SAVE_PC_HI_FIRST_REPLAY_MASK + s_lshr_b32 s_restore_m0, s_restore_m0, S_SAVE_PC_HI_FIRST_REPLAY_SHIFT + s_lshl_b32 s_restore_m0, s_restore_m0, SQ_WAVE_IB_STS_FIRST_REPLAY_SHIFT + s_or_b32 s_restore_tmp, s_restore_tmp, s_restore_m0 + s_and_b32 s_restore_m0, s_restore_status, SQ_WAVE_STATUS_INST_ATC_MASK + s_lshr_b32 s_restore_m0, s_restore_m0, SQ_WAVE_STATUS_INST_ATC_SHIFT + s_setreg_b32 hwreg(HW_REG_IB_STS), s_restore_tmp + s_setreg_b32 hwreg(HW_REG_STATUS), s_restore_status + + s_barrier //barrier to ensure the readiness of LDS before access attemps from any other wave in the same TG //FIXME not performance-optimal at this time + + +// s_rfe_b64 s_restore_pc_lo //Return to the main shader program and resume execution + s_rfe_b64 s_restore_pc_lo // s_restore_m0[0] is used to set STATUS.inst_atc + + +/**************************************************************************/ +/* the END */ +/**************************************************************************/ +L_END_PGM: + s_endpgm + +end + + +/**************************************************************************/ +/* the helper functions */ +/**************************************************************************/ +function write_sgpr_to_mem_wave32(s, s_rsrc, s_mem_offset, use_sqc, use_mtbuf) + if (use_sqc) + s_mov_b32 exec_lo, m0 //assuming exec_lo is not needed anymore from this point on + s_mov_b32 m0, s_mem_offset + s_buffer_store_dword s, s_rsrc, m0 glc:1 + s_add_u32 s_mem_offset, s_mem_offset, 4 + s_mov_b32 m0, exec_lo + elsif (use_mtbuf) + v_mov_b32 v0, s + tbuffer_store_format_x v0, v0, s_rsrc, s_mem_offset format:BUF_NUM_FORMAT_FLOAT format: BUF_DATA_FORMAT_32 slc:1 glc:1 + s_add_u32 s_mem_offset, s_mem_offset, 128 + else + v_mov_b32 v0, s + buffer_store_dword v0, v0, s_rsrc, s_mem_offset slc:1 glc:1 + s_add_u32 s_mem_offset, s_mem_offset, 128 + end +end + +function write_sgpr_to_mem_wave64(s, s_rsrc, s_mem_offset, use_sqc, use_mtbuf) + if (use_sqc) + s_mov_b32 exec_lo, m0 //assuming exec_lo is not needed anymore from this point on + s_mov_b32 m0, s_mem_offset + s_buffer_store_dword s, s_rsrc, m0 glc:1 + s_add_u32 s_mem_offset, s_mem_offset, 4 + s_mov_b32 m0, exec_lo + elsif (use_mtbuf) + v_mov_b32 v0, s + tbuffer_store_format_x v0, v0, s_rsrc, s_mem_offset format:BUF_NUM_FORMAT_FLOAT format: BUF_DATA_FORMAT_32 slc:1 glc:1 + s_add_u32 s_mem_offset, s_mem_offset, 256 + else + v_mov_b32 v0, s + buffer_store_dword v0, v0, s_rsrc, s_mem_offset slc:1 glc:1 + s_add_u32 s_mem_offset, s_mem_offset, 256 + end +end + +function read_sgpr_from_mem_wave32(s, s_rsrc, s_mem_offset, use_sqc) + s_buffer_load_dword s, s_rsrc, s_mem_offset glc:1 + if (use_sqc) + s_add_u32 s_mem_offset, s_mem_offset, 4 + else + s_add_u32 s_mem_offset, s_mem_offset, 128 + end +end + +function read_sgpr_from_mem_wave64(s, s_rsrc, s_mem_offset, use_sqc) + s_buffer_load_dword s, s_rsrc, s_mem_offset glc:1 + if (use_sqc) + s_add_u32 s_mem_offset, s_mem_offset, 4 + else + s_add_u32 s_mem_offset, s_mem_offset, 256 + end +end +#endif + +static const uint32_t cwsr_trap_gfx10_hex[] = { + 0xbf820001, 0xbf82012e, + 0xb0804004, 0xb970f802, + 0x8a708670, 0xb971f803, + 0x8771ff71, 0x00000400, + 0xbf850008, 0xb971f803, + 0x8771ff71, 0x000001ff, + 0xbf850001, 0x806c846c, + 0x876dff6d, 0x0000ffff, + 0xbe80226c, 0xb971f803, + 0x8771ff71, 0x00000100, + 0xbf840006, 0xbef60380, + 0xb9f60203, 0x876dff6d, + 0x0000ffff, 0x80ec886c, + 0x82ed806d, 0xbef60380, + 0xb9f60283, 0xb973f816, + 0xb9762c07, 0x8f769c76, + 0x886d766d, 0xb97603c7, + 0x8f769b76, 0x886d766d, + 0xb976f807, 0x8776ff76, + 0x00007fff, 0xb9f6f807, + 0xbeee037e, 0xbeef037f, + 0xbefe0480, 0xbf900004, + 0xbf8e0002, 0xbf88fffe, + 0xbef4037e, 0x8775ff7f, + 0x0000ffff, 0x8875ff75, + 0x00040000, 0xbef60380, + 0xbef703ff, 0x00807fac, + 0x8776ff7f, 0x08000000, + 0x90768376, 0x88777677, + 0x8776ff7f, 0x70000000, + 0x90768176, 0x88777677, + 0xbefb037c, 0xbefa0380, + 0xb97202dc, 0x8872727f, + 0xbefe03c1, 0x877c8172, + 0xbf06817c, 0xbf850002, + 0xbeff0380, 0xbf820001, + 0xbeff03c1, 0xb9712a05, + 0x80718171, 0x8f718271, + 0x877c8172, 0xbf06817c, + 0xbf85000d, 0x8f768771, + 0xbef603ff, 0x01000000, + 0xbefc0380, 0x7e008700, + 0xe0704000, 0x7a5d0000, + 0x807c817c, 0x807aff7a, + 0x00000080, 0xbf0a717c, + 0xbf85fff8, 0xbf82001b, + 0x8f768871, 0xbef603ff, + 0x01000000, 0xbefc0380, + 0x7e008700, 0xe0704000, + 0x7a5d0000, 0x807c817c, + 0x807aff7a, 0x00000100, + 0xbf0a717c, 0xbf85fff8, + 0xb9711e06, 0x8771c171, + 0xbf84000c, 0x8f718371, + 0x80717c71, 0xbefe03c1, + 0xbeff0380, 0x7e008700, + 0xe0704000, 0x7a5d0000, + 0x807c817c, 0x807aff7a, + 0x00000080, 0xbf0a717c, + 0xbf85fff8, 0xbf8a0000, + 0x8776ff72, 0x04000000, + 0xbf84002b, 0xbefe03c1, + 0x877c8172, 0xbf06817c, + 0xbf850002, 0xbeff0380, + 0xbf820001, 0xbeff03c1, + 0xb9714306, 0x8771c171, + 0xbf840021, 0x8f718671, + 0x8f718271, 0xbef60371, + 0xbef603ff, 0x01000000, + 0xd7650000, 0x000100c1, + 0xd7660000, 0x000200c1, + 0x16000084, 0x877c8172, + 0xbf06817c, 0xbefc0380, + 0xbf85000a, 0x807cff7c, + 0x00000080, 0x807aff7a, + 0x00000080, 0xd5250000, + 0x0001ff00, 0x00000080, + 0xbf0a717c, 0xbf85fff7, + 0xbf820009, 0x807cff7c, + 0x00000100, 0x807aff7a, + 0x00000100, 0xd5250000, + 0x0001ff00, 0x00000100, + 0xbf0a717c, 0xbf85fff7, + 0x877c8172, 0xbf06817c, + 0xbf850003, 0x8f7687ff, + 0x0000006a, 0xbf820002, + 0x8f7688ff, 0x0000006a, + 0xbef603ff, 0x01000000, + 0x877c8172, 0xbf06817c, + 0xbefc0380, 0xbf800000, + 0xbf85000b, 0xbe802e00, + 0x7e000200, 0xe0704000, + 0x7a5d0000, 0x807aff7a, + 0x00000080, 0x807c817c, + 0xbf0aff7c, 0x0000006a, + 0xbf85fff6, 0xbf82000a, + 0xbe802e00, 0x7e000200, + 0xe0704000, 0x7a5d0000, + 0x807aff7a, 0x00000100, + 0x807c817c, 0xbf0aff7c, + 0x0000006a, 0xbf85fff6, + 0xbef60384, 0xbef603ff, + 0x01000000, 0x877c8172, + 0xbf06817c, 0xbf850030, + 0x7e00027b, 0xe0704000, + 0x7a5d0000, 0x807aff7a, + 0x00000080, 0x7e00026c, + 0xe0704000, 0x7a5d0000, + 0x807aff7a, 0x00000080, + 0x7e00026d, 0xe0704000, + 0x7a5d0000, 0x807aff7a, + 0x00000080, 0x7e00026e, + 0xe0704000, 0x7a5d0000, + 0x807aff7a, 0x00000080, + 0x7e00026f, 0xe0704000, + 0x7a5d0000, 0x807aff7a, + 0x00000080, 0x7e000270, + 0xe0704000, 0x7a5d0000, + 0x807aff7a, 0x00000080, + 0xb971f803, 0x7e000271, + 0xe0704000, 0x7a5d0000, + 0x807aff7a, 0x00000080, + 0x7e000273, 0xe0704000, + 0x7a5d0000, 0x807aff7a, + 0x00000080, 0xb97bf801, + 0x7e00027b, 0xe0704000, + 0x7a5d0000, 0x807aff7a, + 0x00000080, 0xbf82002f, + 0x7e00027b, 0xe0704000, + 0x7a5d0000, 0x807aff7a, + 0x00000100, 0x7e00026c, + 0xe0704000, 0x7a5d0000, + 0x807aff7a, 0x00000100, + 0x7e00026d, 0xe0704000, + 0x7a5d0000, 0x807aff7a, + 0x00000100, 0x7e00026e, + 0xe0704000, 0x7a5d0000, + 0x807aff7a, 0x00000100, + 0x7e00026f, 0xe0704000, + 0x7a5d0000, 0x807aff7a, + 0x00000100, 0x7e000270, + 0xe0704000, 0x7a5d0000, + 0x807aff7a, 0x00000100, + 0xb971f803, 0x7e000271, + 0xe0704000, 0x7a5d0000, + 0x807aff7a, 0x00000100, + 0x7e000273, 0xe0704000, + 0x7a5d0000, 0x807aff7a, + 0x00000100, 0xb97bf801, + 0x7e00027b, 0xe0704000, + 0x7a5d0000, 0x807aff7a, + 0x00000100, 0xbf820119, + 0xbef4037e, 0x8775ff7f, + 0x0000ffff, 0x8875ff75, + 0x00040000, 0xbef60380, + 0xbef703ff, 0x00807fac, + 0x8772ff7f, 0x08000000, + 0x90728372, 0x88777277, + 0x8772ff7f, 0x70000000, + 0x90728172, 0x88777277, + 0xb97902dc, 0x8879797f, + 0xbef80380, 0xbefe03c1, + 0x877c8179, 0xbf06817c, + 0xbf850002, 0xbeff0380, + 0xbf820001, 0xbeff03c1, + 0xb96f2a05, 0x806f816f, + 0x8f6f826f, 0x877c8179, + 0xbf06817c, 0xbf850013, + 0x8f76876f, 0xbef603ff, + 0x01000000, 0xbef20378, + 0x8078ff78, 0x00000080, + 0xbefc0381, 0xe0304000, + 0x785d0000, 0xbf8c3f70, + 0x7e008500, 0x807c817c, + 0x8078ff78, 0x00000080, + 0xbf0a6f7c, 0xbf85fff7, + 0xe0304000, 0x725d0000, + 0xbf820023, 0x8f76886f, + 0xbef603ff, 0x01000000, + 0xbef20378, 0x8078ff78, + 0x00000100, 0xbefc0381, + 0xe0304000, 0x785d0000, + 0xbf8c3f70, 0x7e008500, + 0x807c817c, 0x8078ff78, + 0x00000100, 0xbf0a6f7c, + 0xbf85fff7, 0xb96f1e06, + 0x876fc16f, 0xbf84000e, + 0x8f6f836f, 0x806f7c6f, + 0xbefe03c1, 0xbeff0380, + 0xe0304000, 0x785d0000, + 0xbf8c3f70, 0x7e008500, + 0x807c817c, 0x8078ff78, + 0x00000080, 0xbf0a6f7c, + 0xbf85fff7, 0xbeff03c1, + 0xe0304000, 0x725d0000, + 0x8772ff79, 0x04000000, + 0xbf840020, 0xbefe03c1, + 0x877c8179, 0xbf06817c, + 0xbf850002, 0xbeff0380, + 0xbf820001, 0xbeff03c1, + 0xb96f4306, 0x876fc16f, + 0xbf840016, 0x8f6f866f, + 0x8f6f826f, 0xbef6036f, + 0xbef603ff, 0x01000000, + 0x877c8172, 0xbf06817c, + 0xbefc0380, 0xbf850007, + 0x807cff7c, 0x00000080, + 0x8078ff78, 0x00000080, + 0xbf0a6f7c, 0xbf85fffa, + 0xbf820006, 0x807cff7c, + 0x00000100, 0x8078ff78, + 0x00000100, 0xbf0a6f7c, + 0xbf85fffa, 0x877c8179, + 0xbf06817c, 0xbf850003, + 0x8f7687ff, 0x0000006a, + 0xbf820002, 0x8f7688ff, + 0x0000006a, 0xbef603ff, + 0x01000000, 0x877c8179, + 0xbf06817c, 0xbf850012, + 0xf4211cba, 0xf0000000, + 0x8078ff78, 0x00000080, + 0xbefc0381, 0xf421003a, + 0xf0000000, 0x8078ff78, + 0x00000080, 0xbf8cc07f, + 0xbe803000, 0xbf800000, + 0x807c817c, 0xbf0aff7c, + 0x0000006a, 0xbf85fff5, + 0xbe800372, 0xbf820011, + 0xf4211cba, 0xf0000000, + 0x8078ff78, 0x00000100, + 0xbefc0381, 0xf421003a, + 0xf0000000, 0x8078ff78, + 0x00000100, 0xbf8cc07f, + 0xbe803000, 0xbf800000, + 0x807c817c, 0xbf0aff7c, + 0x0000006a, 0xbf85fff5, + 0xbe800372, 0xbef60384, + 0xbef603ff, 0x01000000, + 0x877c8179, 0xbf06817c, + 0xbf850025, 0xf4211bfa, + 0xf0000000, 0x8078ff78, + 0x00000080, 0xf4211b3a, + 0xf0000000, 0x8078ff78, + 0x00000080, 0xf4211b7a, + 0xf0000000, 0x8078ff78, + 0x00000080, 0xf4211eba, + 0xf0000000, 0x8078ff78, + 0x00000080, 0xf4211efa, + 0xf0000000, 0x8078ff78, + 0x00000080, 0xf4211c3a, + 0xf0000000, 0x8078ff78, + 0x00000080, 0xf4211c7a, + 0xf0000000, 0x8078ff78, + 0x00000080, 0xf4211cfa, + 0xf0000000, 0x8078ff78, + 0x00000080, 0xf4211e7a, + 0xf0000000, 0x8078ff78, + 0x00000080, 0xbf820024, + 0xf4211bfa, 0xf0000000, + 0x8078ff78, 0x00000100, + 0xf4211b3a, 0xf0000000, + 0x8078ff78, 0x00000100, + 0xf4211b7a, 0xf0000000, + 0x8078ff78, 0x00000100, + 0xf4211eba, 0xf0000000, + 0x8078ff78, 0x00000100, + 0xf4211efa, 0xf0000000, + 0x8078ff78, 0x00000100, + 0xf4211c3a, 0xf0000000, + 0x8078ff78, 0x00000100, + 0xf4211c7a, 0xf0000000, + 0x8078ff78, 0x00000100, + 0xf4211cfa, 0xf0000000, + 0x8078ff78, 0x00000100, + 0xf4211e7a, 0xf0000000, + 0x8078ff78, 0x00000100, + 0xbf8cc07f, 0x876dff6d, + 0x0000ffff, 0xbefc036f, + 0xbefe037a, 0xbeff037b, + 0x876f71ff, 0x000003ff, + 0xb9ef4803, 0xb9f3f816, + 0x876f71ff, 0xfffff800, + 0x906f8b6f, 0xb9efa2c3, + 0xb9f9f801, 0x876fff6d, + 0xf0000000, 0x906f9c6f, + 0x8f6f906f, 0xbef20380, + 0x88726f72, 0x876fff6d, + 0x08000000, 0x906f9b6f, + 0x8f6f8f6f, 0x88726f72, + 0x876fff70, 0x00800000, + 0x906f976f, 0xb9f2f807, + 0xb9f0f802, 0xbf8a0000, + 0xbe80226c, 0xbf810000, + 0xbf9f0000, 0xbf9f0000, + 0xbf9f0000, 0xbf9f0000, + 0xbf9f0000, 0x00000000, +};
drivers/gpu/drm/amd/amdkfd/kfd_device.c +7 -3
@@ -29,6 +29,7 @@#include "cwsr_trap_handler.h" #include "kfd_iommu.h" #include "amdgpu_amdkfd.h" +#include "cwsr_trap_handler_gfx10.asm" #define MQD_SIZE_ALIGNED 768
@@ -327,7 +328,7 @@ static const struct kfd_device_info navi10_device_info = { .num_of_watch_points = 4, .mqd_size_aligned = MQD_SIZE_ALIGNED, .needs_iommu_device = false, - .supports_cwsr = false, + .supports_cwsr = true, .needs_pci_atomics = false, .num_sdma_engines = 2, .num_sdma_queues_per_engine = 8,
@@ -534,11 +535,14 @@ static void kfd_cwsr_init(struct kfd_dev *kfd)BUILD_BUG_ON (sizeof (cwsr_trap_gfx8_hex) >PAGE_SIZE ); kfd->cwsr_isa = cwsr_trap_gfx8_hex; kfd->cwsr_isa_size =sizeof (cwsr_trap_gfx8_hex); - }else { -/* TODO: Do we need another trap handler for navi10? */ + }else if (kfd->device_info->asic_family <CHIP_NAVI10 ) {BUILD_BUG_ON (sizeof (cwsr_trap_gfx9_hex) >PAGE_SIZE ); kfd->cwsr_isa = cwsr_trap_gfx9_hex; kfd->cwsr_isa_size =sizeof (cwsr_trap_gfx9_hex); + }else { +BUILD_BUG_ON (sizeof (cwsr_trap_gfx10_hex) >PAGE_SIZE ); + kfd->cwsr_isa = cwsr_trap_gfx10_hex; + kfd->cwsr_isa_size =sizeof (cwsr_trap_gfx10_hex); } kfd->cwsr_enabled = true;
Signature · 1 line
2.20.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 130/459 drm/amdkfd: Moved gfx10 cwsr binary to cwsr_trap_handler.h
In reply to a message not in the archiveFrom: Oak Zeng <[email protected]>
Same thing was done for previous HW generations. Do the same thing for gfx10 to make codes consistent.
--- .../gpu/drm/amd/amdkfd/cwsr_trap_handler.h | 299 +++++++++++++++++ .../amd/amdkfd/cwsr_trap_handler_gfx10.asm | 302 +----------------- drivers/gpu/drm/amd/amdkfd/kfd_device.c | 1 - 3 files changed, 300 insertions(+), 302 deletions(-)
drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h +299 -0
@@ -561,3 +561,302 @@ static const uint32_t cwsr_trap_gfx9_hex[] = {0xbf8a0000 ,0x95806f6c , 0xbf810000, 0x00000000, }; + +static const uint32_t cwsr_trap_gfx10_hex[] = { +0xbf820001 ,0xbf82012e , +0xb0804004 ,0xb970f802 , +0x8a708670 ,0xb971f803 , +0x8771ff71 ,0x00000400 , +0xbf850008 ,0xb971f803 , +0x8771ff71 ,0x000001ff , +0xbf850001 ,0x806c846c , +0x876dff6d ,0x0000ffff , +0xbe80226c ,0xb971f803 , +0x8771ff71 ,0x00000100 , +0xbf840006 ,0xbef60380 , +0xb9f60203 ,0x876dff6d , +0x0000ffff ,0x80ec886c , +0x82ed806d ,0xbef60380 , +0xb9f60283 ,0xb973f816 , +0xb9762c07 ,0x8f769c76 , +0x886d766d ,0xb97603c7 , +0x8f769b76 ,0x886d766d , +0xb976f807 ,0x8776ff76 , +0x00007fff ,0xb9f6f807 , +0xbeee037e ,0xbeef037f , +0xbefe0480 ,0xbf900004 , +0xbf8e0002 ,0xbf88fffe , +0xbef4037e ,0x8775ff7f , +0x0000ffff ,0x8875ff75 , +0x00040000 ,0xbef60380 , +0xbef703ff ,0x00807fac , +0x8776ff7f ,0x08000000 , +0x90768376 ,0x88777677 , +0x8776ff7f ,0x70000000 , +0x90768176 ,0x88777677 , +0xbefb037c ,0xbefa0380 , +0xb97202dc ,0x8872727f , +0xbefe03c1 ,0x877c8172 , +0xbf06817c ,0xbf850002 , +0xbeff0380 ,0xbf820001 , +0xbeff03c1 ,0xb9712a05 , +0x80718171 ,0x8f718271 , +0x877c8172 ,0xbf06817c , +0xbf85000d ,0x8f768771 , +0xbef603ff ,0x01000000 , +0xbefc0380 ,0x7e008700 , +0xe0704000 ,0x7a5d0000 , +0x807c817c ,0x807aff7a , +0x00000080 ,0xbf0a717c , +0xbf85fff8 ,0xbf82001b , +0x8f768871 ,0xbef603ff , +0x01000000 ,0xbefc0380 , +0x7e008700 ,0xe0704000 , +0x7a5d0000 ,0x807c817c , +0x807aff7a ,0x00000100 , +0xbf0a717c ,0xbf85fff8 , +0xb9711e06 ,0x8771c171 , +0xbf84000c ,0x8f718371 , +0x80717c71 ,0xbefe03c1 , +0xbeff0380 ,0x7e008700 , +0xe0704000 ,0x7a5d0000 , +0x807c817c ,0x807aff7a , +0x00000080 ,0xbf0a717c , +0xbf85fff8 ,0xbf8a0000 , +0x8776ff72 ,0x04000000 , +0xbf84002b ,0xbefe03c1 , +0x877c8172 ,0xbf06817c , +0xbf850002 ,0xbeff0380 , +0xbf820001 ,0xbeff03c1 , +0xb9714306 ,0x8771c171 , +0xbf840021 ,0x8f718671 , +0x8f718271 ,0xbef60371 , +0xbef603ff ,0x01000000 , +0xd7650000 ,0x000100c1 , +0xd7660000 ,0x000200c1 , +0x16000084 ,0x877c8172 , +0xbf06817c ,0xbefc0380 , +0xbf85000a ,0x807cff7c , +0x00000080 ,0x807aff7a , +0x00000080 ,0xd5250000 , +0x0001ff00 ,0x00000080 , +0xbf0a717c ,0xbf85fff7 , +0xbf820009 ,0x807cff7c , +0x00000100 ,0x807aff7a , +0x00000100 ,0xd5250000 , +0x0001ff00 ,0x00000100 , +0xbf0a717c ,0xbf85fff7 , +0x877c8172 ,0xbf06817c , +0xbf850003 ,0x8f7687ff , +0x0000006a ,0xbf820002 , +0x8f7688ff ,0x0000006a , +0xbef603ff ,0x01000000 , +0x877c8172 ,0xbf06817c , +0xbefc0380 ,0xbf800000 , +0xbf85000b ,0xbe802e00 , +0x7e000200 ,0xe0704000 , +0x7a5d0000 ,0x807aff7a , +0x00000080 ,0x807c817c , +0xbf0aff7c ,0x0000006a , +0xbf85fff6 ,0xbf82000a , +0xbe802e00 ,0x7e000200 , +0xe0704000 ,0x7a5d0000 , +0x807aff7a ,0x00000100 , +0x807c817c ,0xbf0aff7c , +0x0000006a ,0xbf85fff6 , +0xbef60384 ,0xbef603ff , +0x01000000 ,0x877c8172 , +0xbf06817c ,0xbf850030 , +0x7e00027b ,0xe0704000 , +0x7a5d0000 ,0x807aff7a , +0x00000080 ,0x7e00026c , +0xe0704000 ,0x7a5d0000 , +0x807aff7a ,0x00000080 , +0x7e00026d ,0xe0704000 , +0x7a5d0000 ,0x807aff7a , +0x00000080 ,0x7e00026e , +0xe0704000 ,0x7a5d0000 , +0x807aff7a ,0x00000080 , +0x7e00026f ,0xe0704000 , +0x7a5d0000 ,0x807aff7a , +0x00000080 ,0x7e000270 , +0xe0704000 ,0x7a5d0000 , +0x807aff7a ,0x00000080 , +0xb971f803 ,0x7e000271 , +0xe0704000 ,0x7a5d0000 , +0x807aff7a ,0x00000080 , +0x7e000273 ,0xe0704000 , +0x7a5d0000 ,0x807aff7a , +0x00000080 ,0xb97bf801 , +0x7e00027b ,0xe0704000 , +0x7a5d0000 ,0x807aff7a , +0x00000080 ,0xbf82002f , +0x7e00027b ,0xe0704000 , +0x7a5d0000 ,0x807aff7a , +0x00000100 ,0x7e00026c , +0xe0704000 ,0x7a5d0000 , +0x807aff7a ,0x00000100 , +0x7e00026d ,0xe0704000 , +0x7a5d0000 ,0x807aff7a , +0x00000100 ,0x7e00026e , +0xe0704000 ,0x7a5d0000 , +0x807aff7a ,0x00000100 , +0x7e00026f ,0xe0704000 , +0x7a5d0000 ,0x807aff7a , +0x00000100 ,0x7e000270 , +0xe0704000 ,0x7a5d0000 , +0x807aff7a ,0x00000100 , +0xb971f803 ,0x7e000271 , +0xe0704000 ,0x7a5d0000 , +0x807aff7a ,0x00000100 , +0x7e000273 ,0xe0704000 , +0x7a5d0000 ,0x807aff7a , +0x00000100 ,0xb97bf801 , +0x7e00027b ,0xe0704000 , +0x7a5d0000 ,0x807aff7a , +0x00000100 ,0xbf820119 , +0xbef4037e ,0x8775ff7f , +0x0000ffff ,0x8875ff75 , +0x00040000 ,0xbef60380 , +0xbef703ff ,0x00807fac , +0x8772ff7f ,0x08000000 , +0x90728372 ,0x88777277 , +0x8772ff7f ,0x70000000 , +0x90728172 ,0x88777277 , +0xb97902dc ,0x8879797f , +0xbef80380 ,0xbefe03c1 , +0x877c8179 ,0xbf06817c , +0xbf850002 ,0xbeff0380 , +0xbf820001 ,0xbeff03c1 , +0xb96f2a05 ,0x806f816f , +0x8f6f826f ,0x877c8179 , +0xbf06817c ,0xbf850013 , +0x8f76876f ,0xbef603ff , +0x01000000 ,0xbef20378 , +0x8078ff78 ,0x00000080 , +0xbefc0381 ,0xe0304000 , +0x785d0000 ,0xbf8c3f70 , +0x7e008500 ,0x807c817c , +0x8078ff78 ,0x00000080 , +0xbf0a6f7c ,0xbf85fff7 , +0xe0304000 ,0x725d0000 , +0xbf820023 ,0x8f76886f , +0xbef603ff ,0x01000000 , +0xbef20378 ,0x8078ff78 , +0x00000100 ,0xbefc0381 , +0xe0304000 ,0x785d0000 , +0xbf8c3f70 ,0x7e008500 , +0x807c817c ,0x8078ff78 , +0x00000100 ,0xbf0a6f7c , +0xbf85fff7 ,0xb96f1e06 , +0x876fc16f ,0xbf84000e , +0x8f6f836f ,0x806f7c6f , +0xbefe03c1 ,0xbeff0380 , +0xe0304000 ,0x785d0000 , +0xbf8c3f70 ,0x7e008500 , +0x807c817c ,0x8078ff78 , +0x00000080 ,0xbf0a6f7c , +0xbf85fff7 ,0xbeff03c1 , +0xe0304000 ,0x725d0000 , +0x8772ff79 ,0x04000000 , +0xbf840020 ,0xbefe03c1 , +0x877c8179 ,0xbf06817c , +0xbf850002 ,0xbeff0380 , +0xbf820001 ,0xbeff03c1 , +0xb96f4306 ,0x876fc16f , +0xbf840016 ,0x8f6f866f , +0x8f6f826f ,0xbef6036f , +0xbef603ff ,0x01000000 , +0x877c8172 ,0xbf06817c , +0xbefc0380 ,0xbf850007 , +0x807cff7c ,0x00000080 , +0x8078ff78 ,0x00000080 , +0xbf0a6f7c ,0xbf85fffa , +0xbf820006 ,0x807cff7c , +0x00000100 ,0x8078ff78 , +0x00000100 ,0xbf0a6f7c , +0xbf85fffa ,0x877c8179 , +0xbf06817c ,0xbf850003 , +0x8f7687ff ,0x0000006a , +0xbf820002 ,0x8f7688ff , +0x0000006a ,0xbef603ff , +0x01000000 ,0x877c8179 , +0xbf06817c ,0xbf850012 , +0xf4211cba ,0xf0000000 , +0x8078ff78 ,0x00000080 , +0xbefc0381 ,0xf421003a , +0xf0000000 ,0x8078ff78 , +0x00000080 ,0xbf8cc07f , +0xbe803000 ,0xbf800000 , +0x807c817c ,0xbf0aff7c , +0x0000006a ,0xbf85fff5 , +0xbe800372 ,0xbf820011 , +0xf4211cba ,0xf0000000 , +0x8078ff78 ,0x00000100 , +0xbefc0381 ,0xf421003a , +0xf0000000 ,0x8078ff78 , +0x00000100 ,0xbf8cc07f , +0xbe803000 ,0xbf800000 , +0x807c817c ,0xbf0aff7c , +0x0000006a ,0xbf85fff5 , +0xbe800372 ,0xbef60384 , +0xbef603ff ,0x01000000 , +0x877c8179 ,0xbf06817c , +0xbf850025 ,0xf4211bfa , +0xf0000000 ,0x8078ff78 , +0x00000080 ,0xf4211b3a , +0xf0000000 ,0x8078ff78 , +0x00000080 ,0xf4211b7a , +0xf0000000 ,0x8078ff78 , +0x00000080 ,0xf4211eba , +0xf0000000 ,0x8078ff78 , +0x00000080 ,0xf4211efa , +0xf0000000 ,0x8078ff78 , +0x00000080 ,0xf4211c3a , +0xf0000000 ,0x8078ff78 , +0x00000080 ,0xf4211c7a , +0xf0000000 ,0x8078ff78 , +0x00000080 ,0xf4211cfa , +0xf0000000 ,0x8078ff78 , +0x00000080 ,0xf4211e7a , +0xf0000000 ,0x8078ff78 , +0x00000080 ,0xbf820024 , +0xf4211bfa ,0xf0000000 , +0x8078ff78 ,0x00000100 , +0xf4211b3a ,0xf0000000 , +0x8078ff78 ,0x00000100 , +0xf4211b7a ,0xf0000000 , +0x8078ff78 ,0x00000100 , +0xf4211eba ,0xf0000000 , +0x8078ff78 ,0x00000100 , +0xf4211efa ,0xf0000000 , +0x8078ff78 ,0x00000100 , +0xf4211c3a ,0xf0000000 , +0x8078ff78 ,0x00000100 , +0xf4211c7a ,0xf0000000 , +0x8078ff78 ,0x00000100 , +0xf4211cfa ,0xf0000000 , +0x8078ff78 ,0x00000100 , +0xf4211e7a ,0xf0000000 , +0x8078ff78 ,0x00000100 , +0xbf8cc07f ,0x876dff6d , +0x0000ffff ,0xbefc036f , +0xbefe037a ,0xbeff037b , +0x876f71ff ,0x000003ff , +0xb9ef4803 ,0xb9f3f816 , +0x876f71ff ,0xfffff800 , +0x906f8b6f ,0xb9efa2c3 , +0xb9f9f801 ,0x876fff6d , +0xf0000000 ,0x906f9c6f , +0x8f6f906f ,0xbef20380 , +0x88726f72 ,0x876fff6d , +0x08000000 ,0x906f9b6f , +0x8f6f8f6f ,0x88726f72 , +0x876fff70 ,0x00800000 , +0x906f976f ,0xb9f2f807 , +0xb9f0f802 ,0xbf8a0000 , +0xbe80226c ,0xbf810000 , +0xbf9f0000 ,0xbf9f0000 , +0xbf9f0000 ,0xbf9f0000 , +0xbf9f0000 ,0x00000000 , +};
drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm +1 -301
311 lines not on this page · raw message
drivers/gpu/drm/amd/amdkfd/kfd_device.c +0 -1
@@ -29,7 +29,6 @@#include "cwsr_trap_handler.h" #include "kfd_iommu.h" #include "amdgpu_amdkfd.h" -#include "cwsr_trap_handler_gfx10.asm" #define MQD_SIZE_ALIGNED 768
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 131/459 drm/amdkfd: Parameterize queue_preemption_timeout_ms
In reply to a message not in the archiveFrom: Oak Zeng <[email protected]>
Added a module parameter queue_preemption_timeout_ms. This is helpful for debugging kfd on emulator environment which is much slower than a real chip so the fence wait timeout value should be much bigger.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 8 ++++++++ drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 2 +- drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h | 2 -- drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 7 +++++++ 4 files changed, 16 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +8 -0
@@ -693,6 +693,14 @@ MODULE_PARM_DESC(halt_if_hws_hang, "Halt if HWS hang is detected (0 = off (defaubool hws_gws_support;module_param (hws_gws_support, bool,0444 );MODULE_PARM_DESC (hws_gws_support,"MEC FW support gws barriers (false = not supported (Default), true = supported)" ); + +/** +* DOC: queue_preemption_timeout_ms (int) +* queue preemption timeout in ms (1 = Minimum, 9000 = default) +*/ +int queue_preemption_timeout_ms; +module_param (queue_preemption_timeout_ms, int,0644 ); +MODULE_PARM_DESC (queue_preemption_timeout_ms,"queue preemption timeout in ms (1 = Minimum, 9000 = default)" );#endif /**
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +1 -1
@@ -1302,7 +1302,7 @@ static int unmap_queues_cpsch(struct device_queue_manager *dqm, KFD_FENCE_COMPLETED);/* should be timed out */ retval =amdkfd_fence_wait_timeout (dqm->fence_addr,KFD_FENCE_COMPLETED , -QUEUE_PREEMPT_DEFAULT_TIMEOUT_MS ); + queue_preemption_timeout_ms);if (retval)return retval;
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h +0 -2
@@ -31,8 +31,6 @@#include "kfd_priv.h" #include "kfd_mqd_manager.h" -#define KFD_UNMAP_LATENCY_MS (4000) -#define QUEUE_PREEMPT_DEFAULT_TIMEOUT_MS (2 * KFD_UNMAP_LATENCY_MS + 1000)struct device_process_node {struct qcm_process_device *qpd;
drivers/gpu/drm/amd/amdkfd/kfd_priv.h +7 -0
@@ -104,6 +104,8 @@#define KFD_KERNEL_QUEUE_SIZE 2048 +#define KFD_UNMAP_LATENCY_MS (4000) +/* * 512 = 0x200 * The doorbell index distance between SDMA RLC (2*i) and (2*i+1) in the
@@ -166,6 +168,11 @@ extern int halt_if_hws_hang;*/ extern bool hws_gws_support; +/* +* Queue preemption timeout in ms +*/ +extern int queue_preemption_timeout_ms; +enum cache_policy { cache_policy_coherent, cache_policy_noncoherent
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 132/459 drm/amdkfd: Introduce DIQ type mqd manager for gfx10
In reply to a message not in the archiveWith introduction of new mqd allocation scheme for HIQ, DIQ and HIQ use different mqd allocation scheme, DIQ can't reuse HIQ mqd manager
--- drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c +12 -0
@@ -497,6 +497,18 @@ struct mqd_manager *mqd_manager_init_v10(enum KFD_MQD_TYPE type,#endif pr_debug ("%s@%i\n" , __func__, __LINE__);break ; +case KFD_MQD_TYPE_DIQ : + mqd->init_mqd = init_mqd_hiq; + mqd->uninit_mqd = uninit_mqd; + mqd->load_mqd = load_mqd; + mqd->update_mqd = update_mqd_hiq; + mqd->destroy_mqd = destroy_mqd; + mqd->is_occupied = is_occupied; + mqd->mqd_size =sizeof (struct v10_compute_mqd ); +#if defined(CONFIG_DEBUG_FS ) + mqd->debugfs_show_mqd = debugfs_show_mqd; +#endif +break ;case KFD_MQD_TYPE_SDMA :pr_debug ("%s@%i\n" , __func__, __LINE__); mqd->init_mqd = init_mqd_sdma;
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 133/459 drm/amdkfd: Add mqd size in mqd manager struct for gfx10
In reply to a message not in the archiveAlso initialize mqd size on mqd manager initialization
--- drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c +3 -0
@@ -478,6 +478,7 @@ struct mqd_manager *mqd_manager_init_v10(enum KFD_MQD_TYPE type, mqd->update_mqd = update_mqd; mqd->destroy_mqd = destroy_mqd; mqd->is_occupied = is_occupied; + mqd->mqd_size =sizeof (struct v10_compute_mqd ); mqd->get_wave_state = get_wave_state;#if defined(CONFIG_DEBUG_FS ) mqd->debugfs_show_mqd = debugfs_show_mqd;
@@ -492,6 +493,7 @@ struct mqd_manager *mqd_manager_init_v10(enum KFD_MQD_TYPE type, mqd->update_mqd = update_mqd_hiq; mqd->destroy_mqd = destroy_mqd; mqd->is_occupied = is_occupied; + mqd->mqd_size =sizeof (struct v10_compute_mqd );#if defined(CONFIG_DEBUG_FS ) mqd->debugfs_show_mqd = debugfs_show_mqd;#endif
@@ -517,6 +519,7 @@ struct mqd_manager *mqd_manager_init_v10(enum KFD_MQD_TYPE type, mqd->update_mqd = update_mqd_sdma; mqd->destroy_mqd = destroy_mqd_sdma; mqd->is_occupied = is_occupied_sdma; + mqd->mqd_size =sizeof (struct v10_sdma_mqd );#if defined(CONFIG_DEBUG_FS ) mqd->debugfs_show_mqd = debugfs_show_mqd_sdma;#endif
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 134/459 drm/amdkfd: Allocate hiq and sdma mqd from mqd trunk for gfx10
In reply to a message not in the archiveInstead of allocat hiq and sdma mqd from sub-allocator, allocate them from a mqd trunk pool. This is done for all asics
--- .../gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c +8 -14
@@ -72,6 +72,9 @@ static struct kfd_mem_obj *allocate_mqd(struct kfd_dev *kfd,int retval;struct kfd_mem_obj *mqd_mem_obj =NULL ; +if (q->type ==KFD_QUEUE_TYPE_HIQ ) +return allocate_hiq_mqd (kfd); +/* From V9, for CWSR, the control stack is located on the next page * boundary after the mqd, we will use the gtt allocation function * instead of sub-allocation function.
@@ -346,13 +349,10 @@ static int init_mqd_sdma(struct mqd_manager *mm, void **mqd, {int retval;struct v10_sdma_mqd *m; +struct kfd_dev *dev = mm->dev; - - retval =kfd_gtt_sa_allocate (mm->dev, -sizeof (struct v10_sdma_mqd ), - mqd_mem_obj); - -if (retval !=0 ) + *mqd_mem_obj =allocate_sdma_mqd (dev, q); +if (!*mqd_mem_obj)return -ENOMEM ; m = (struct v10_sdma_mqd *) (*mqd_mem_obj)->cpu_ptr;
@@ -368,12 +368,6 @@ static int init_mqd_sdma(struct mqd_manager *mm, void **mqd,return retval; } -static void uninit_mqd_sdma (struct mqd_manager *mm,void *mqd, -struct kfd_mem_obj *mqd_mem_obj) -{ -kfd_gtt_sa_free (mm->dev, mqd_mem_obj); -} -static int load_mqd_sdma (struct mqd_manager *mm,void *mqd,uint32_t pipe_id,uint32_t queue_id,struct queue_properties *p,struct mm_struct *mms)
@@ -488,7 +482,7 @@ struct mqd_manager *mqd_manager_init_v10(enum KFD_MQD_TYPE type,case KFD_MQD_TYPE_HIQ :pr_debug ("%s@%i\n" , __func__, __LINE__); mqd->init_mqd = init_mqd_hiq; - mqd->uninit_mqd = uninit_mqd; + mqd->uninit_mqd = uninit_mqd_hiq_sdma; mqd->load_mqd = load_mqd; mqd->update_mqd = update_mqd_hiq; mqd->destroy_mqd = destroy_mqd;
@@ -514,7 +508,7 @@ struct mqd_manager *mqd_manager_init_v10(enum KFD_MQD_TYPE type,case KFD_MQD_TYPE_SDMA :pr_debug ("%s@%i\n" , __func__, __LINE__); mqd->init_mqd = init_mqd_sdma; - mqd->uninit_mqd = uninit_mqd_sdma; + mqd->uninit_mqd = uninit_mqd_hiq_sdma; mqd->load_mqd = load_mqd_sdma; mqd->update_mqd = update_mqd_sdma; mqd->destroy_mqd = destroy_mqd_sdma;
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 135/459 drm/amdkfd: Introduce XGMI SDMA queue type for gfx10
In reply to a message not in the archiveExisting QUEUE_TYPE_SDMA means PCIe optimized SDMA queues. Introduce a new QUEUE_TYPE_SDMA_XGMI, which is optimized for non-PCIe transfer such as XGMI.
--- drivers/gpu/drm/amd/amdkfd/kfd_device.c | 1 + drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c | 2 ++ 2 files changed, 3 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_device.c +1 -0
@@ -330,6 +330,7 @@ static const struct kfd_device_info navi10_device_info = { .supports_cwsr = true, .needs_pci_atomics = false, .num_sdma_engines = 2, + .num_xgmi_sdma_engines = 0, .num_sdma_queues_per_engine = 8, };
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c +2 -0
@@ -181,6 +181,7 @@ static int pm_map_queues_v10(struct packet_manager *pm, uint32_t *buffer, queue_type__mes_map_queues__debug_interface_queue_vi;break ;case KFD_QUEUE_TYPE_SDMA : +case KFD_QUEUE_TYPE_SDMA_XGMI : packet->bitfields2.engine_sel = q->properties.sdma_engine_id + engine_sel__mes_map_queues__sdma0_vi; use_static = false;/* no static queues under SDMA */
@@ -227,6 +228,7 @@ static int pm_unmap_queues_v10(struct packet_manager *pm, uint32_t *buffer, engine_sel__mes_unmap_queues__compute;break ;case KFD_QUEUE_TYPE_SDMA : +case KFD_QUEUE_TYPE_SDMA_XGMI : packet->bitfields2.engine_sel = engine_sel__mes_unmap_queues__sdma0 + sdma_engine;break ;
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 136/459 drm/amdkfd: Delete alloc_format field from map_queue struct for gfx10
In reply to a message not in the archiveAlloc format was never really supported by MEC FW. FW always does one per pipe allocation.
--- drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c +0 -2
@@ -159,8 +159,6 @@ static int pm_map_queues_v10(struct packet_manager *pm, uint32_t *buffer, packet->header.u32All =pm_build_pm4_header (IT_MAP_QUEUES ,sizeof (struct pm4_mes_map_queues )); - packet->bitfields2.alloc_format = - alloc_format__mes_map_queues__one_per_pipe_vi; packet->bitfields2.num_queues =1 ; packet->bitfields2.queue_sel = queue_sel__mes_map_queues__map_to_hws_determined_queue_slots_vi;
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 137/459 drm/amdkfd: update gfx10 support for latest kfd changes
In reply to a message not in the archiveSeparate mqd allocation and initialization
--- .../gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c | 82 ++++++------------- 1 file changed, 26 insertions(+), 56 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c +26 -56
@@ -72,9 +72,6 @@ static struct kfd_mem_obj *allocate_mqd(struct kfd_dev *kfd,int retval;struct kfd_mem_obj *mqd_mem_obj =NULL ; -if (q->type ==KFD_QUEUE_TYPE_HIQ ) -return allocate_hiq_mqd (kfd); -/* From V9, for CWSR, the control stack is located on the next page * boundary after the mqd, we will use the gtt allocation function * instead of sub-allocation function.
@@ -103,21 +100,15 @@ static struct kfd_mem_obj *allocate_mqd(struct kfd_dev *kfd, } -static int init_mqd (struct mqd_manager *mm,void **mqd, -struct kfd_mem_obj **mqd_mem_obj,uint64_t *gart_addr, +static void init_mqd (struct mqd_manager *mm,void **mqd, +struct kfd_mem_obj *mqd_mem_obj,uint64_t *gart_addr,struct queue_properties *q) { -int retval;uint64_t addr;struct v10_compute_mqd *m; -struct kfd_dev *kfd = mm->dev; - *mqd_mem_obj =allocate_mqd (kfd, q); -if (!*mqd_mem_obj) -return -ENOMEM ; - - m = (struct v10_compute_mqd *) (*mqd_mem_obj)->cpu_ptr; - addr = (*mqd_mem_obj)->gpu_addr; + m = (struct v10_compute_mqd *) mqd_mem_obj->cpu_ptr; + addr = mqd_mem_obj->gpu_addr;memset (m,0 ,sizeof (struct v10_compute_mqd ));
@@ -164,9 +155,7 @@ static int init_mqd(struct mqd_manager *mm, void **mqd, *mqd = m;if (gart_addr) *gart_addr = addr; - retval = mm->update_mqd (mm, m, q); - -return retval; + mm->update_mqd (mm, m, q); } static int load_mqd(struct mqd_manager *mm, void *mqd,
@@ -183,7 +172,7 @@ static int load_mqd(struct mqd_manager *mm, void *mqd,return r; } -static int update_mqd (struct mqd_manager *mm,void *mqd, +static void update_mqd (struct mqd_manager *mm,void *mqd,struct queue_properties *q) {struct v10_compute_mqd *m;
@@ -246,8 +235,6 @@ static int update_mqd(struct mqd_manager *mm, void *mqd, q->queue_address !=0 && q->queue_percent >0 && !q->is_evicted); - -return 0 ; } static int destroy_mqd(struct mqd_manager *mm, void *mqd,
@@ -260,7 +247,7 @@ static int destroy_mqd(struct mqd_manager *mm, void *mqd, pipe_id, queue_id); } -static void uninit_mqd (struct mqd_manager *mm,void *mqd, +static void free_mqd (struct mqd_manager *mm,void *mqd,struct kfd_mem_obj *mqd_mem_obj) {struct kfd_dev *kfd = mm->dev;
@@ -305,67 +292,47 @@ static int get_wave_state(struct mqd_manager *mm, void *mqd,return 0 ; } -static int init_mqd_hiq (struct mqd_manager *mm,void **mqd, -struct kfd_mem_obj **mqd_mem_obj,uint64_t *gart_addr, +static void init_mqd_hiq (struct mqd_manager *mm,void **mqd, +struct kfd_mem_obj *mqd_mem_obj,uint64_t *gart_addr,struct queue_properties *q) {struct v10_compute_mqd *m; -int retval; - - retval =init_mqd (mm, mqd, mqd_mem_obj, gart_addr, q); - -if (retval !=0 ) -return retval; +init_mqd (mm, mqd, mqd_mem_obj, gart_addr, q); m =get_mqd (*mqd); m->cp_hqd_pq_control |=1 <<CP_HQD_PQ_CONTROL__PRIV_STATE__SHIFT |1 <<CP_HQD_PQ_CONTROL__KMD_QUEUE__SHIFT ; - -return retval; } -static int update_mqd_hiq (struct mqd_manager *mm,void *mqd, +static void update_mqd_hiq (struct mqd_manager *mm,void *mqd,struct queue_properties *q) {struct v10_compute_mqd *m; -int retval; - - retval =update_mqd (mm, mqd, q); -if (retval !=0 ) -return retval; +update_mqd (mm, mqd, q);/* TODO: what's the point? update_mqd already does this. */ m =get_mqd (mqd); m->cp_hqd_vmid = q->vmid; -return retval; } -static int init_mqd_sdma (struct mqd_manager *mm,void **mqd, -struct kfd_mem_obj **mqd_mem_obj,uint64_t *gart_addr, +static void init_mqd_sdma (struct mqd_manager *mm,void **mqd, +struct kfd_mem_obj *mqd_mem_obj,uint64_t *gart_addr,struct queue_properties *q) { -int retval;struct v10_sdma_mqd *m; -struct kfd_dev *dev = mm->dev; - - *mqd_mem_obj =allocate_sdma_mqd (dev, q); -if (!*mqd_mem_obj) -return -ENOMEM ; - m = (struct v10_sdma_mqd *) (*mqd_mem_obj)->cpu_ptr; + m = (struct v10_sdma_mqd *) mqd_mem_obj->cpu_ptr;memset (m,0 ,sizeof (struct v10_sdma_mqd )); *mqd = m;if (gart_addr) - *gart_addr = (*mqd_mem_obj)->gpu_addr; + *gart_addr = mqd_mem_obj->gpu_addr; - retval = mm->update_mqd (mm, m, q); - -return retval; + mm->update_mqd (mm, m, q); } static int load_mqd_sdma(struct mqd_manager *mm, void *mqd,
@@ -379,7 +346,7 @@ static int load_mqd_sdma(struct mqd_manager *mm, void *mqd,#define SDMA_RLC_DUMMY_DEFAULT 0xf -static int update_mqd_sdma (struct mqd_manager *mm,void *mqd, +static void update_mqd_sdma (struct mqd_manager *mm,void *mqd,struct queue_properties *q) {struct v10_sdma_mqd *m;
@@ -407,7 +374,6 @@ static int update_mqd_sdma(struct mqd_manager *mm, void *mqd, q->queue_address !=0 && q->queue_percent >0 && !q->is_evicted); -return 0 ; }/*
@@ -466,8 +432,9 @@ struct mqd_manager *mqd_manager_init_v10(enum KFD_MQD_TYPE type,pr_debug ("%s@%i\n" , __func__, __LINE__);case KFD_MQD_TYPE_COMPUTE :pr_debug ("%s@%i\n" , __func__, __LINE__); + mqd->allocate_mqd = allocate_mqd; mqd->init_mqd = init_mqd; - mqd->uninit_mqd = uninit_mqd; + mqd->free_mqd = free_mqd; mqd->load_mqd = load_mqd; mqd->update_mqd = update_mqd; mqd->destroy_mqd = destroy_mqd;
@@ -481,8 +448,9 @@ struct mqd_manager *mqd_manager_init_v10(enum KFD_MQD_TYPE type,break ;case KFD_MQD_TYPE_HIQ :pr_debug ("%s@%i\n" , __func__, __LINE__); + mqd->allocate_mqd = allocate_hiq_mqd; mqd->init_mqd = init_mqd_hiq; - mqd->uninit_mqd = uninit_mqd_hiq_sdma; + mqd->free_mqd = free_mqd_hiq_sdma; mqd->load_mqd = load_mqd; mqd->update_mqd = update_mqd_hiq; mqd->destroy_mqd = destroy_mqd;
@@ -494,8 +462,9 @@ struct mqd_manager *mqd_manager_init_v10(enum KFD_MQD_TYPE type,pr_debug ("%s@%i\n" , __func__, __LINE__);break ;case KFD_MQD_TYPE_DIQ : + mqd->allocate_mqd = allocate_hiq_mqd; mqd->init_mqd = init_mqd_hiq; - mqd->uninit_mqd = uninit_mqd; + mqd->free_mqd = free_mqd; mqd->load_mqd = load_mqd; mqd->update_mqd = update_mqd_hiq; mqd->destroy_mqd = destroy_mqd;
@@ -507,8 +476,9 @@ struct mqd_manager *mqd_manager_init_v10(enum KFD_MQD_TYPE type,break ;case KFD_MQD_TYPE_SDMA :pr_debug ("%s@%i\n" , __func__, __LINE__); + mqd->allocate_mqd = allocate_sdma_mqd; mqd->init_mqd = init_mqd_sdma; - mqd->uninit_mqd = uninit_mqd_hiq_sdma; + mqd->free_mqd = free_mqd_hiq_sdma; mqd->load_mqd = load_mqd_sdma; mqd->update_mqd = update_mqd_sdma; mqd->destroy_mqd = destroy_mqd_sdma;
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 138/459 drm/amdkfd: add more navi10 pci ids
In reply to a message not in the archive--- drivers/gpu/drm/amd/amdkfd/kfd_device.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_device.c +4 -0
@@ -454,6 +454,10 @@ static const struct kfd_deviceid supported_devices[] = { { 0x66af, &vega20_device_info }, /* Vega20 *//* Navi10 */ { 0x7310, &navi10_device_info }, /* Navi10 */ + { 0x7312, &navi10_device_info }, /* Navi10 */ + { 0x7318, &navi10_device_info }, /* Navi10 */ + { 0x731a, &navi10_device_info }, /* Navi10 */ + { 0x731f, &navi10_device_info }, /* Navi10 */ }; static int kfd_gtt_sa_init(struct kfd_dev *kfd, unsigned int buf_size,
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 139/459 drm/amdgpu: add Navi10 pci ids
In reply to a message not in the archive--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +6 -0
@@ -983,6 +983,12 @@ static const struct pci_device_id pciidlist[] = {/* Raven */ {0x1002, 0x15dd, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RAVEN|AMD_IS_APU}, {0x1002, 0x15d8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RAVEN|AMD_IS_APU}, +/* Navi10 */ + {0x1002, 0x7310, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI10}, + {0x1002, 0x7312, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI10}, + {0x1002, 0x7318, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI10}, + {0x1002, 0x731A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI10}, + {0x1002, 0x731F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI10}, {0, 0, 0} };
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 140/459 drm/amdgpu: add to set navi ip blocks
In reply to a message not in the archiveFrom: Huang Rui <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +8 -0
@@ -51,6 +51,7 @@#endif #include "vi.h" #include "soc15.h" +#include "nv.h" #include "bif/bif_4_1_d.h" #include <linux/pci.h> #include <linux/firmware.h>
@@ -1527,6 +1528,13 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev)if (r)return r;break ; +case CHIP_NAVI10 : + adev->family =AMDGPU_FAMILY_NV ; + + r =nv_set_ip_blocks (adev); +if (r) +return r; +break ;default :/* FIXME: not supported yet */ return -EINVAL ;
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 141/459 drm/amd/powerplay: update smu v11 ppsmc header
In reply to a message not in the archiveFrom: Huang Rui <[email protected]>
This patch updates smu v11 ppsmc header for navi10.
--- .../drm/amd/powerplay/inc/smu_v11_0_ppsmc.h | 38 ++++++++++--------- 1 file changed, 20 insertions(+), 18 deletions(-)
drivers/gpu/drm/amd/powerplay/inc/smu_v11_0_ppsmc.h +20 -18
@@ -60,6 +60,7 @@//BACO/BAMACO/BOMACO #define PPSMC_MSG_EnterBaco 0x18#define PPSMC_MSG_ExitBaco 0x19 +#define PPSMC_MSG_ArmD3 0x46//DPM #define PPSMC_MSG_SetSoftMinByFreq 0x1A
@@ -71,26 +72,23 @@#define PPSMC_MSG_GetDpmFreqByIndex 0x20#define PPSMC_MSG_OverridePcieParameters 0x21#define PPSMC_MSG_SetMinDeepSleepDcefclk 0x22 -#define PPSMC_MSG_SetWorkloadMask 0x23 -#define PPSMC_MSG_SetUclkFastSwitch 0x24 -#define PPSMC_MSG_GetAvfsVoltageByDpm 0x25 -#define PPSMC_MSG_SetVideoFps 0x26 -#define PPSMC_MSG_GetDcModeMaxDpmFreq 0x27 -//Power Gating -#define PPSMC_MSG_AllowGfxOff 0x28 -#define PPSMC_MSG_DisallowGfxOff 0x29 -#define PPSMC_MSG_PowerUpVcn 0x2A -#define PPSMC_MSG_PowerDownVcn 0x2B -#define PPSMC_MSG_PowerUpJpeg 0x2C -#define PPSMC_MSG_PowerDownJpeg 0x2D -//reserve 0x2A to 0x2F for PG harvesting TBD +#define PPSMC_MSG_SetWorkloadMask 0x24 +#define PPSMC_MSG_SetUclkFastSwitch 0x25 +#define PPSMC_MSG_GetVoltageByDpm 0x26 +#define PPSMC_MSG_SetVideoFps 0x27 +#define PPSMC_MSG_GetDcModeMaxDpmFreq 0x28 -//I2C Interface -#define PPSMC_RequestI2cTransaction 0x30 +//Power Gating +#define PPSMC_MSG_AllowGfxOff 0x29 +#define PPSMC_MSG_DisallowGfxOff 0x2A +#define PPSMC_MSG_PowerUpVcn 0x2B +#define PPSMC_MSG_PowerDownVcn 0x2C +#define PPSMC_MSG_PowerUpJpeg 0x2D +#define PPSMC_MSG_PowerDownJpeg 0x2E +//reserve 0x29 to 0x30 for PG harvesting TBD //Resets -#define PPSMC_MSG_SoftReset 0x31 //FIXME Need confirmation from driver#define PPSMC_MSG_PrepareMp1ForUnload 0x32#define PPSMC_MSG_PrepareMp1ForReset 0x33#define PPSMC_MSG_PrepareMp1ForShutdown 0x34
@@ -100,7 +98,6 @@#define PPSMC_MSG_GetPptLimit 0x36#define PPSMC_MSG_ReenableAcDcInterrupt 0x37#define PPSMC_MSG_NotifyPowerSource 0x38 -//#define PPSMC_MSG_GfxDeviceDriverReset 0x39 //FIXME mode1 and 2 resets will go directly go PSP //BTC #define PPSMC_MSG_RunBtc 0x3A
@@ -120,9 +117,14 @@#define PPSMC_MSG_SetGeminiApertureHigh 0x43#define PPSMC_MSG_SetGeminiApertureLow 0x44 -#define PPSMC_Message_Count 0x45 +#define PPSMC_MSG_GetVoltageByDpmOverdrive 0x45 + +#define PPSMC_Message_Count 0x47typedef uint32_t PPSMC_Result ;typedef uint32_t PPSMC_Msg ; +//for use with PPSMC_MSG_GetVoltageByDpmOverdrive +#define PPSMC_GET_AVFS_CURVE 0 +#define PPSMC_GET_OVERDRIVE_CURVE 1#endif
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 142/459 drm/amd/powerplay: update smu 11 driver if header for navi10
In reply to a message not in the archiveFrom: Huang Rui <[email protected]>
This patch updates smu 11 driver if header for navi10.
UVD/VCE won't be used for navi10. Here, reverve them for vega20.
--- .../amd/powerplay/inc/smu_11_0_driver_if.h | 1039 +++++++++++++++++ drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 2 +- 2 files changed, 1040 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/amd/powerplay/inc/smu_11_0_driver_if.h
drivers/gpu/drm/amd/powerplay/inc/smu_11_0_driver_if.h new file +1039 -0
@@ -0,0 +1,1039 @@ +#ifndef __SMU11_DRIVER_IF_H__ +#define __SMU11_DRIVER_IF_H__ + +// *** IMPORTANT *** +// SMU TEAM: Always increment the interface version if +// any structure is changed in this file +#define SMU11_DRIVER_IF_VERSION 0x2D + +#define PPTABLE_NV10_SMU_VERSION 8 + +#define NUM_GFXCLK_DPM_LEVELS 16 +#define NUM_SMNCLK_DPM_LEVELS 2 +#define NUM_SOCCLK_DPM_LEVELS 8 +#define NUM_MP0CLK_DPM_LEVELS 2 +#define NUM_DCLK_DPM_LEVELS 8 +#define NUM_VCLK_DPM_LEVELS 8 +#define NUM_DCEFCLK_DPM_LEVELS 8 +#define NUM_PHYCLK_DPM_LEVELS 8 +#define NUM_DISPCLK_DPM_LEVELS 8 +#define NUM_PIXCLK_DPM_LEVELS 8 +#define NUM_UCLK_DPM_LEVELS 4 +#define NUM_MP1CLK_DPM_LEVELS 2 +#define NUM_LINK_LEVELS 2 + + +#define MAX_GFXCLK_DPM_LEVEL (NUM_GFXCLK_DPM_LEVELS - 1) +#define MAX_SMNCLK_DPM_LEVEL (NUM_SMNCLK_DPM_LEVELS - 1) +#define MAX_SOCCLK_DPM_LEVEL (NUM_SOCCLK_DPM_LEVELS - 1) +#define MAX_MP0CLK_DPM_LEVEL (NUM_MP0CLK_DPM_LEVELS - 1) +#define MAX_DCLK_DPM_LEVEL (NUM_DCLK_DPM_LEVELS - 1) +#define MAX_VCLK_DPM_LEVEL (NUM_VCLK_DPM_LEVELS - 1) +#define MAX_DCEFCLK_DPM_LEVEL (NUM_DCEFCLK_DPM_LEVELS - 1) +#define MAX_DISPCLK_DPM_LEVEL (NUM_DISPCLK_DPM_LEVELS - 1) +#define MAX_PIXCLK_DPM_LEVEL (NUM_PIXCLK_DPM_LEVELS - 1) +#define MAX_PHYCLK_DPM_LEVEL (NUM_PHYCLK_DPM_LEVELS - 1) +#define MAX_UCLK_DPM_LEVEL (NUM_UCLK_DPM_LEVELS - 1) +#define MAX_MP1CLK_DPM_LEVEL (NUM_MP1CLK_DPM_LEVELS - 1) +#define MAX_LINK_LEVEL (NUM_LINK_LEVELS - 1) + +//Gemini Modes +#define PPSMC_GeminiModeNone 0 //Single GPU board +#define PPSMC_GeminiModeMaster 1 //Master GPU on a Gemini board +#define PPSMC_GeminiModeSlave 2 //Slave GPU on a Gemini board + +// Feature Control Defines +// DPM +#define FEATURE_DPM_PREFETCHER_BIT 0 +#define FEATURE_DPM_GFXCLK_BIT 1 +#define FEATURE_DPM_GFX_PACE_BIT 2 +#define FEATURE_DPM_UCLK_BIT 3 +#define FEATURE_DPM_SOCCLK_BIT 4 +#define FEATURE_DPM_MP0CLK_BIT 5 +#define FEATURE_DPM_LINK_BIT 6 +#define FEATURE_DPM_DCEFCLK_BIT 7 +#define FEATURE_MEM_VDDCI_SCALING_BIT 8 +#define FEATURE_MEM_MVDD_SCALING_BIT 9 + +//Idle +#define FEATURE_DS_GFXCLK_BIT 10 +#define FEATURE_DS_SOCCLK_BIT 11 +#define FEATURE_DS_LCLK_BIT 12 +#define FEATURE_DS_DCEFCLK_BIT 13 +#define FEATURE_DS_UCLK_BIT 14 +#define FEATURE_GFX_ULV_BIT 15 +#define FEATURE_FW_DSTATE_BIT 16 +#define FEATURE_GFXOFF_BIT 17 +#define FEATURE_BACO_BIT 18 +#define FEATURE_VCN_PG_BIT 19 +#define FEATURE_JPEG_PG_BIT 20 +#define FEATURE_USB_PG_BIT 21 +#define FEATURE_RSMU_SMN_CG_BIT 22 +//Throttler/Response +#define FEATURE_PPT_BIT 23 +#define FEATURE_TDC_BIT 24 +#define FEATURE_GFX_EDC_BIT 25 +#define FEATURE_APCC_PLUS_BIT 26 +#define FEATURE_GTHR_BIT 27 +#define FEATURE_ACDC_BIT 28 +#define FEATURE_VR0HOT_BIT 29 +#define FEATURE_VR1HOT_BIT 30 +#define FEATURE_FW_CTF_BIT 31 +#define FEATURE_FAN_CONTROL_BIT 32 +#define FEATURE_THERMAL_BIT 33 +#define FEATURE_GFX_DCS_BIT 34 +//VF +#define FEATURE_RM_BIT 35 +#define FEATURE_LED_DISPLAY_BIT 36 +//Other +#define FEATURE_GFX_SS_BIT 37 +#define FEATURE_OUT_OF_BAND_MONITOR_BIT 38 +#define FEATURE_TEMP_DEPENDENT_VMIN_BIT 39 + +#define FEATURE_MMHUB_PG 40 +#define FEATURE_ATHUB_PG 41 +#define FEATURE_SPARE_42_BIT 42 +#define FEATURE_SPARE_43_BIT 43 +#define FEATURE_SPARE_44_BIT 44 +#define FEATURE_SPARE_45_BIT 45 +#define FEATURE_SPARE_46_BIT 46 +#define FEATURE_SPARE_47_BIT 47 +#define FEATURE_SPARE_48_BIT 48 +#define FEATURE_SPARE_49_BIT 49 +#define FEATURE_SPARE_50_BIT 50 +#define FEATURE_SPARE_51_BIT 51 +#define FEATURE_SPARE_52_BIT 52 +#define FEATURE_SPARE_53_BIT 53 +#define FEATURE_SPARE_54_BIT 54 +#define FEATURE_SPARE_55_BIT 55 +#define FEATURE_SPARE_56_BIT 56 +#define FEATURE_SPARE_57_BIT 57 +#define FEATURE_SPARE_58_BIT 58 +#define FEATURE_SPARE_59_BIT 59 +#define FEATURE_SPARE_60_BIT 60 +#define FEATURE_SPARE_61_BIT 61 +#define FEATURE_SPARE_62_BIT 62 +#define FEATURE_SPARE_63_BIT 63 +#define NUM_FEATURES 64 + +// Debug Overrides Bitmask +#define DPM_OVERRIDE_DISABLE_SOCCLK_PID 0x00000001 +#define DPM_OVERRIDE_DISABLE_UCLK_PID 0x00000002 +#define DPM_OVERRIDE_DISABLE_VOLT_LINK_VCN_SOCCLK 0x00000004 +#define DPM_OVERRIDE_ENABLE_FREQ_LINK_VCLK_SOCCLK 0x00000008 +#define DPM_OVERRIDE_ENABLE_FREQ_LINK_DCLK_SOCCLK 0x00000010 +#define DPM_OVERRIDE_ENABLE_FREQ_LINK_GFXCLK_SOCCLK 0x00000020 +#define DPM_OVERRIDE_ENABLE_FREQ_LINK_GFXCLK_UCLK 0x00000040 +#define DPM_OVERRIDE_DISABLE_VOLT_LINK_DCE_SOCCLK 0x00000080 +#define DPM_OVERRIDE_DISABLE_VOLT_LINK_MP0_SOCCLK 0x00000100 +#define DPM_OVERRIDE_DISABLE_DFLL_PLL_SHUTDOWN 0x00000200 +#define DPM_OVERRIDE_DISABLE_MEMORY_TEMPERATURE_READ 0x00000400 + +// VR Mapping Bit Defines +#define VR_MAPPING_VR_SELECT_MASK 0x01 +#define VR_MAPPING_VR_SELECT_SHIFT 0x00 + +#define VR_MAPPING_PLANE_SELECT_MASK 0x02 +#define VR_MAPPING_PLANE_SELECT_SHIFT 0x01 + +// PSI Bit Defines +#define PSI_SEL_VR0_PLANE0_PSI0 0x01 +#define PSI_SEL_VR0_PLANE0_PSI1 0x02 +#define PSI_SEL_VR0_PLANE1_PSI0 0x04 +#define PSI_SEL_VR0_PLANE1_PSI1 0x08 +#define PSI_SEL_VR1_PLANE0_PSI0 0x10 +#define PSI_SEL_VR1_PLANE0_PSI1 0x20 +#define PSI_SEL_VR1_PLANE1_PSI0 0x40 +#define PSI_SEL_VR1_PLANE1_PSI1 0x80 + +// Throttler Control/Status Bits +#define THROTTLER_PADDING_BIT 0 +#define THROTTLER_TEMP_EDGE_BIT 1 +#define THROTTLER_TEMP_HOTSPOT_BIT 2 +#define THROTTLER_TEMP_MEM_BIT 3 +#define THROTTLER_TEMP_VR_GFX_BIT 4 +#define THROTTLER_TEMP_VR_MEM0_BIT 5 +#define THROTTLER_TEMP_VR_MEM1_BIT 6 +#define THROTTLER_TEMP_VR_SOC_BIT 7 +#define THROTTLER_TEMP_LIQUID0_BIT 8 +#define THROTTLER_TEMP_LIQUID1_BIT 9 +#define THROTTLER_TEMP_PLX_BIT 10 +#define THROTTLER_TEMP_SKIN_BIT 11 +#define THROTTLER_TDC_GFX_BIT 12 +#define THROTTLER_TDC_SOC_BIT 13 +#define THROTTLER_PPT0_BIT 14 +#define THROTTLER_PPT1_BIT 15 +#define THROTTLER_PPT2_BIT 16 +#define THROTTLER_PPT3_BIT 17 +#define THROTTLER_FIT_BIT 18 +#define THROTTLER_PPM_BIT 19 +#define THROTTLER_APCC_BIT 20 + +// FW DState Features Control Bits +#define FW_DSTATE_SOC_ULV_BIT 0 +#define FW_DSTATE_G6_HSR_BIT 1 +#define FW_DSTATE_G6_PHY_VDDCI_OFF_BIT 2 +#define FW_DSTATE_MP0_DS_BIT 3 +#define FW_DSTATE_SMN_DS_BIT 4 +#define FW_DSTATE_MP1_DS_BIT 5 +#define FW_DSTATE_MP1_WHISPER_MODE_BIT 6 +#define FW_DSTATE_LIV_MIN_BIT 7 +#define FW_DSTATE_SOC_PLL_PWRDN_BIT 8 + +#define FW_DSTATE_SOC_ULV_MASK (1 << FW_DSTATE_SOC_ULV_BIT ) +#define FW_DSTATE_G6_HSR_MASK (1 << FW_DSTATE_G6_HSR_BIT ) +#define FW_DSTATE_G6_PHY_VDDCI_OFF_MASK (1 << FW_DSTATE_G6_PHY_VDDCI_OFF_BIT ) +#define FW_DSTATE_MP1_DS_MASK (1 << FW_DSTATE_MP1_DS_BIT ) +#define FW_DSTATE_MP0_DS_MASK (1 << FW_DSTATE_MP0_DS_BIT ) +#define FW_DSTATE_SMN_DS_MASK (1 << FW_DSTATE_SMN_DS_BIT ) +#define FW_DSTATE_MP1_WHISPER_MODE_MASK (1 << FW_DSTATE_MP1_WHISPER_MODE_BIT ) +#define FW_DSTATE_LIV_MIN_MASK (1 << FW_DSTATE_LIV_MIN_BIT ) +#define FW_DSTATE_SOC_PLL_PWRDN_MASK (1 << FW_DSTATE_SOC_PLL_PWRDN_BIT ) + +//I2C Interface + +#define NUM_I2C_CONTROLLERS 8 + +#define I2C_CONTROLLER_ENABLED 1 +#define I2C_CONTROLLER_DISABLED 0 + +#define MAX_SW_I2C_COMMANDS 8 + +typedef enum { +I2C_CONTROLLER_PORT_0 =0 ,//CKSVII2C0 +I2C_CONTROLLER_PORT_1 =1 ,//CKSVII2C1 +I2C_CONTROLLER_PORT_COUNT , +}I2cControllerPort_e ; + +typedef enum { +I2C_CONTROLLER_NAME_VR_GFX =0 , +I2C_CONTROLLER_NAME_VR_SOC , +I2C_CONTROLLER_NAME_VR_VDDCI , +I2C_CONTROLLER_NAME_VR_MVDD , +I2C_CONTROLLER_NAME_LIQUID0 , +I2C_CONTROLLER_NAME_LIQUID1 , +I2C_CONTROLLER_NAME_PLX , +I2C_CONTROLLER_NAME_SPARE , +I2C_CONTROLLER_NAME_COUNT , +}I2cControllerName_e ; + +typedef enum { +I2C_CONTROLLER_THROTTLER_TYPE_NONE =0 , +I2C_CONTROLLER_THROTTLER_VR_GFX , +I2C_CONTROLLER_THROTTLER_VR_SOC , +I2C_CONTROLLER_THROTTLER_VR_VDDCI , +I2C_CONTROLLER_THROTTLER_VR_MVDD , +I2C_CONTROLLER_THROTTLER_LIQUID0 , +I2C_CONTROLLER_THROTTLER_LIQUID1 , +I2C_CONTROLLER_THROTTLER_PLX , +I2C_CONTROLLER_THROTTLER_COUNT , +}I2cControllerThrottler_e ; + +typedef enum { +I2C_CONTROLLER_PROTOCOL_VR_0 , +I2C_CONTROLLER_PROTOCOL_VR_1 , +I2C_CONTROLLER_PROTOCOL_TMP_0 , +I2C_CONTROLLER_PROTOCOL_TMP_1 , +I2C_CONTROLLER_PROTOCOL_SPARE_0 , +I2C_CONTROLLER_PROTOCOL_SPARE_1 , +I2C_CONTROLLER_PROTOCOL_COUNT , +}I2cControllerProtocol_e ; + +typedef struct { +uint8_t Enabled; +uint8_t Speed; +uint8_t Padding[2 ]; +uint32_t SlaveAddress; +uint8_t ControllerPort; +uint8_t ControllerName; +uint8_t ThermalThrotter; +uint8_t I2cProtocol; +}I2cControllerConfig_t ; + +typedef enum { +I2C_PORT_SVD_SCL =0 , +I2C_PORT_GPIO , +}I2cPort_e ; + +typedef enum { +I2C_SPEED_FAST_50K =0 ,//50 Kbits/s +I2C_SPEED_FAST_100K ,//100 Kbits/s +I2C_SPEED_FAST_400K ,//400 Kbits/s +I2C_SPEED_FAST_PLUS_1M ,//1 Mbits/s (in fast mode) +I2C_SPEED_HIGH_1M ,//1 Mbits/s (in high speed mode) +I2C_SPEED_HIGH_2M ,//2.3 Mbits/s +I2C_SPEED_COUNT , +}I2cSpeed_e ; + +typedef enum { +I2C_CMD_READ =0 , +I2C_CMD_WRITE , +I2C_CMD_COUNT , +}I2cCmdType_e ; + +#define CMDCONFIG_STOP_BIT 0 +#define CMDCONFIG_RESTART_BIT 1 + +#define CMDCONFIG_STOP_MASK (1 << CMDCONFIG_STOP_BIT) +#define CMDCONFIG_RESTART_MASK (1 << CMDCONFIG_RESTART_BIT) + +typedef struct { +uint8_t RegisterAddr;////only valid for write, ignored for read +uint8_t Cmd;//Read(0) or Write(1) +uint8_t Data;//Return data for read. Data to send for write +uint8_t CmdConfig;//Includes whether associated command should have a stop or restart command +}SwI2cCmd_t ;//SW I2C Command Table + +typedef struct { +uint8_t I2CcontrollerPort;//CKSVII2C0(0) or //CKSVII2C1(1) +uint8_t I2CSpeed;//Slow(0) or Fast(1) +uint16_t SlaveAddress; +uint8_t NumCmds;//Number of commands +uint8_t Padding[3 ]; + +SwI2cCmd_t SwI2cCmds[MAX_SW_I2C_COMMANDS ]; + +uint32_t MmHubPadding[8 ];// SMU internal use + +}SwI2cRequest_t ;// SW I2C Request Table + +//THis is aligned with RSMU PGFSM Register Mapping +typedef enum { +PG_DYNAMIC_MODE =0 , +PG_STATIC_MODE , +}PowerGatingMode_e ; + +//This is aligned with RSMU PGFSM Register Mapping +typedef enum { +PG_POWER_DOWN =0 , +PG_POWER_UP , +}PowerGatingSettings_e ; + +typedef struct { +uint32_t a;// store in IEEE float format in this variable +uint32_t b;// store in IEEE float format in this variable +uint32_t c;// store in IEEE float format in this variable +}QuadraticInt_t ; + +typedef struct { +uint32_t m;// store in IEEE float format in this variable +uint32_t b;// store in IEEE float format in this variable +}LinearInt_t ; + +typedef struct { +uint32_t a;// store in IEEE float format in this variable +uint32_t b;// store in IEEE float format in this variable +uint32_t c;// store in IEEE float format in this variable +}DroopInt_t ; + +typedef enum { +GFXCLK_SOURCE_PLL =0 , +GFXCLK_SOURCE_DFLL , +GFXCLK_SOURCE_COUNT , +}GfxclkSrc_e ; + +//Only Clks that have DPM descriptors are listed here +typedef enum { +PPCLK_GFXCLK =0 , +PPCLK_SOCCLK , +PPCLK_UCLK , +PPCLK_DCLK , +PPCLK_VCLK , +PPCLK_DCEFCLK , +PPCLK_DISPCLK , +PPCLK_PIXCLK , +PPCLK_PHYCLK , +PPCLK_COUNT , +}PPCLK_e ; + +typedef enum { +POWER_SOURCE_AC , +POWER_SOURCE_DC , +POWER_SOURCE_COUNT , +}POWER_SOURCE_e ; + +typedef enum { +PPT_THROTTLER_PPT0 , +PPT_THROTTLER_PPT1 , +PPT_THROTTLER_PPT2 , +PPT_THROTTLER_PPT3 , +PPT_THROTTLER_COUNT +}PPT_THROTTLER_e ; + +typedef enum { +VOLTAGE_MODE_AVFS =0 , +VOLTAGE_MODE_AVFS_SS , +VOLTAGE_MODE_SS , +VOLTAGE_MODE_COUNT , +}VOLTAGE_MODE_e ; + + +typedef enum { +AVFS_VOLTAGE_GFX =0 , +AVFS_VOLTAGE_SOC , +AVFS_VOLTAGE_COUNT , +}AVFS_VOLTAGE_TYPE_e ; + +typedef enum { +UCLK_DIV_BY_1 =0 , +UCLK_DIV_BY_2 , +UCLK_DIV_BY_4 , +UCLK_DIV_BY_8 , +}UCLK_DIV_e ; + +typedef enum { +GPIO_INT_POLARITY_ACTIVE_LOW =0 , +GPIO_INT_POLARITY_ACTIVE_HIGH , +}GpioIntPolarity_e ; + +typedef enum { +MEMORY_TYPE_GDDR6 =0 , +MEMORY_TYPE_HBM , +}MemoryType_e ; + +typedef enum { +PWR_CONFIG_TDP =0 , +PWR_CONFIG_TGP , +PWR_CONFIG_TCP_ESTIMATED , +PWR_CONFIG_TCP_MEASURED , +}PwrConfig_e ; + +typedef struct { +uint8_t VoltageMode;// 0 - AVFS only, 1- min(AVFS,SS), 2-SS only +uint8_t SnapToDiscrete;// 0 - Fine grained DPM, 1 - Discrete DPM +uint8_t NumDiscreteLevels;// Set to 2 (Fmin, Fmax) when using fine grained DPM, otherwise set to # discrete levels used +uint8_t Padding; +LinearInt_t ConversionToAvfsClk;// Transfer function to AVFS Clock (GHz->GHz) +QuadraticInt_t SsCurve;// Slow-slow curve (GHz->V) +}DpmDescriptor_t ; + +typedef enum { +TEMP_EDGE , +TEMP_HOTSPOT , +TEMP_MEM , +TEMP_VR_GFX , +TEMP_VR_MEM0 , +TEMP_VR_MEM1 , +TEMP_VR_SOC , +TEMP_LIQUID0 , +TEMP_LIQUID1 , +TEMP_PLX , +TEMP_COUNT +}TEMP_e ; + +//Out of band monitor status defines +//see SPEC //gpu/doc/soc_arch/spec/feature/SMBUS/SMBUS.xlsx +#define POWER_MANAGER_CONTROLLER_NOT_RUNNING 0 +#define POWER_MANAGER_CONTROLLER_RUNNING 1 + +#define POWER_MANAGER_CONTROLLER_BIT 0 +#define MAXIMUM_DPM_STATE_GFX_ENGINE_RESTRICTED_BIT 8 +#define GPU_DIE_TEMPERATURE_THROTTLING_BIT 9 +#define HBM_DIE_TEMPERATURE_THROTTLING_BIT 10 +#define TGP_THROTTLING_BIT 11 +#define PCC_THROTTLING_BIT 12 +#define HBM_TEMPERATURE_EXCEEDING_TEMPERATURE_LIMIT_BIT 13 +#define HBM_TEMPERATURE_EXCEEDING_MAX_MEMORY_TEMPERATURE_BIT 14 + +#define POWER_MANAGER_CONTROLLER_MASK (1 << POWER_MANAGER_CONTROLLER_BIT ) +#define MAXIMUM_DPM_STATE_GFX_ENGINE_RESTRICTED_MASK (1 << MAXIMUM_DPM_STATE_GFX_ENGINE_RESTRICTED_BIT ) +#define GPU_DIE_TEMPERATURE_THROTTLING_MASK (1 << GPU_DIE_TEMPERATURE_THROTTLING_BIT ) +#define HBM_DIE_TEMPERATURE_THROTTLING_MASK (1 << HBM_DIE_TEMPERATURE_THROTTLING_BIT ) +#define TGP_THROTTLING_MASK (1 << TGP_THROTTLING_BIT ) +#define PCC_THROTTLING_MASK (1 << PCC_THROTTLING_BIT ) +#define HBM_TEMPERATURE_EXCEEDING_TEMPERATURE_LIMIT_MASK (1 << HBM_TEMPERATURE_EXCEEDING_TEMPERATURE_LIMIT_BIT ) +#define HBM_TEMPERATURE_EXCEEDING_MAX_MEMORY_TEMPERATURE_MASK (1 << HBM_TEMPERATURE_EXCEEDING_MAX_MEMORY_TEMPERATURE_BIT) + +//This structure to be DMA to SMBUS Config register space +typedef struct { +uint8_t MinorInfoVersion; +uint8_t MajorInfoVersion; +uint8_t TableSize; +uint8_t Reserved; + +uint8_t Reserved1; +uint8_t RevID; +uint16_t DeviceID; + +uint16_t DieTemperatureLimit; +uint16_t FanTargetTemperature; + +uint16_t MemoryTemperatureLimit; +uint16_t Reserved2; + +uint16_t TGP; +uint16_t Reserved3; + +uint32_t DieTemperatureRegisterOffset; + +uint32_t Reserved4; + +uint32_t Reserved5; + +uint32_t Status; + +uint16_t DieTemperature; +uint16_t MemoryTemperature; + +uint32_t MmHubPadding[8 ];// SMU internal use +}OutOfBandMonitor_t ; + +typedef struct { +uint32_t Version; + +// SECTION: Feature Enablement +uint32_t FeaturesToRun[2 ]; + +// SECTION: Infrastructure Limits +uint16_t SocketPowerLimitAc[PPT_THROTTLER_COUNT ]; +uint16_t SocketPowerLimitAcTau[PPT_THROTTLER_COUNT ]; +uint16_t SocketPowerLimitDc[PPT_THROTTLER_COUNT ]; +uint16_t SocketPowerLimitDcTau[PPT_THROTTLER_COUNT ]; + +uint16_t TdcLimitSoc;// Amps +uint16_t TdcLimitSocTau;// Time constant of LPF in ms +uint16_t TdcLimitGfx;// Amps +uint16_t TdcLimitGfxTau;// Time constant of LPF in ms + +uint16_t TedgeLimit;// Celcius +uint16_t ThotspotLimit;// Celcius +uint16_t TmemLimit;// Celcius +uint16_t Tvr_gfxLimit;// Celcius +uint16_t Tvr_mem0Limit;// Celcius +uint16_t Tvr_mem1Limit;// Celcius +uint16_t Tvr_socLimit;// Celcius +uint16_t Tliquid0Limit;// Celcius +uint16_t Tliquid1Limit;// Celcius +uint16_t TplxLimit;// Celcius +uint32_t FitLimit;// Failures in time (failures per million parts over the defined lifetime) + +uint16_t PpmPowerLimit;// Switch this this power limit when temperature is above PpmTempThreshold +uint16_t PpmTemperatureThreshold; + +// SECTION: Throttler settings +uint32_t ThrottlerControlMask;// See Throtter masks defines + +// SECTION: FW DSTATE Settings +uint32_t FwDStateMask;// See FW DState masks defines + +// SECTION: ULV Settings +uint16_t UlvVoltageOffsetSoc;// In mV(Q2) +uint16_t UlvVoltageOffsetGfx;// In mV(Q2) + +uint8_t GceaLinkMgrIdleThreshold;//Set by SMU FW during enablment of SOC_ULV. Controls delay for GFX SDP port disconnection during idle events +uint8_t paddingRlcUlvParams[3 ]; + +uint8_t UlvSmnclkDid;//DID for ULV mode. 0 means CLK will not be modified in ULV. +uint8_t UlvMp1clkDid;//DID for ULV mode. 0 means CLK will not be modified in ULV. +uint8_t UlvGfxclkBypass;// 1 to turn off/bypass Gfxclk during ULV, 0 to leave Gfxclk on during ULV +uint8_t Padding234; + +uint16_t MinVoltageUlvGfx;// In mV(Q2) Minimum Voltage ("Vmin") of VDD_GFX in ULV mode +uint16_t MinVoltageUlvSoc;// In mV(Q2) Minimum Voltage ("Vmin") of VDD_SOC in ULV mode + + +// SECTION: Voltage Control Parameters +uint16_t MinVoltageGfx;// In mV(Q2) Minimum Voltage ("Vmin") of VDD_GFX +uint16_t MinVoltageSoc;// In mV(Q2) Minimum Voltage ("Vmin") of VDD_SOC +uint16_t MaxVoltageGfx;// In mV(Q2) Maximum Voltage allowable of VDD_GFX +uint16_t MaxVoltageSoc;// In mV(Q2) Maximum Voltage allowable of VDD_SOC + +uint16_t LoadLineResistanceGfx;// In mOhms with 8 fractional bits +uint16_t LoadLineResistanceSoc;// In mOhms with 8 fractional bits + +//SECTION: DPM Config 1 +DpmDescriptor_t DpmDescriptor[PPCLK_COUNT ]; + +uint16_t FreqTableGfx [NUM_GFXCLK_DPM_LEVELS ];// In MHz +uint16_t FreqTableVclk [NUM_VCLK_DPM_LEVELS ];// In MHz +uint16_t FreqTableDclk [NUM_DCLK_DPM_LEVELS ];// In MHz +uint16_t FreqTableSocclk [NUM_SOCCLK_DPM_LEVELS ];// In MHz +uint16_t FreqTableUclk [NUM_UCLK_DPM_LEVELS ];// In MHz +uint16_t FreqTableDcefclk [NUM_DCEFCLK_DPM_LEVELS ];// In MHz +uint16_t FreqTableDispclk [NUM_DISPCLK_DPM_LEVELS ];// In MHz +uint16_t FreqTablePixclk [NUM_PIXCLK_DPM_LEVELS ];// In MHz +uint16_t FreqTablePhyclk [NUM_PHYCLK_DPM_LEVELS ];// In MHz +uint32_t Paddingclks[16 ]; + +uint16_t DcModeMaxFreq [PPCLK_COUNT ];// In MHz +uint16_t Padding8_Clks; + +uint8_t FreqTableUclkDiv [NUM_UCLK_DPM_LEVELS ];// 0:Div-1, 1:Div-1/2, 2:Div-1/4, 3:Div-1/8 + +// SECTION: DPM Config 2 +uint16_t Mp0clkFreq [NUM_MP0CLK_DPM_LEVELS ];// in MHz +uint16_t Mp0DpmVoltage [NUM_MP0CLK_DPM_LEVELS ];// mV(Q2) +uint16_t MemVddciVoltage [NUM_UCLK_DPM_LEVELS ];// mV(Q2) +uint16_t MemMvddVoltage [NUM_UCLK_DPM_LEVELS ];// mV(Q2) +// GFXCLK DPM +uint16_t GfxclkFgfxoffEntry;// in Mhz +uint16_t GfxclkFinit;// in Mhz +uint16_t GfxclkFidle;// in MHz +uint16_t GfxclkSlewRate;// for PLL babystepping??? +uint16_t GfxclkFopt;// in Mhz +uint8_t Padding567[2 ]; +uint16_t GfxclkDsMaxFreq;// in MHz +uint8_t GfxclkSource;// 0 = PLL, 1 = DFLL +uint8_t Padding456; + +// UCLK section +uint8_t LowestUclkReservedForUlv;// Set this to 1 if UCLK DPM0 is reserved for ULV-mode only +uint8_t paddingUclk[3 ]; + +uint8_t MemoryType;// 0-GDDR6, 1-HBM +uint8_t MemoryChannels; +uint8_t PaddingMem[2 ]; + +// Link DPM Settings +uint8_t PcieGenSpeed[NUM_LINK_LEVELS ];///< 0:PciE-gen1 1:PciE-gen2 2:PciE-gen3 3:PciE-gen4 +uint8_t PcieLaneCount[NUM_LINK_LEVELS ];///< 1=x1, 2=x2, 3=x4, 4=x8, 5=x12, 6=x16 +uint16_t LclkFreq[NUM_LINK_LEVELS ]; + +// GFXCLK Thermal DPM (formerly 'Boost' Settings) +uint16_t EnableTdpm; +uint16_t TdpmHighHystTemperature; +uint16_t TdpmLowHystTemperature; +uint16_t GfxclkFreqHighTempLimit;// High limit on GFXCLK when temperature is high, for reliability. + +// SECTION: Fan Control +uint16_t FanStopTemp;//Celcius +uint16_t FanStartTemp;//Celcius + +uint16_t FanGainEdge; +uint16_t FanGainHotspot; +uint16_t FanGainLiquid0; +uint16_t FanGainLiquid1; +uint16_t FanGainVrGfx; +uint16_t FanGainVrSoc; +uint16_t FanGainVrMem0; +uint16_t FanGainVrMem1; +uint16_t FanGainPlx; +uint16_t FanGainMem; +uint16_t FanPwmMin; +uint16_t FanAcousticLimitRpm; +uint16_t FanThrottlingRpm; +uint16_t FanMaximumRpm; +uint16_t FanTargetTemperature; +uint16_t FanTargetGfxclk; +uint8_t FanTempInputSelect; +uint8_t FanPadding; +uint8_t FanZeroRpmEnable; +uint8_t FanTachEdgePerRev; +//uint8_t padding8_Fan[2]; + +// The following are AFC override parameters. Leave at 0 to use FW defaults. +int16_t FuzzyFan_ErrorSetDelta; +int16_t FuzzyFan_ErrorRateSetDelta; +int16_t FuzzyFan_PwmSetDelta; +uint16_t FuzzyFan_Reserved; + + +// SECTION: AVFS +// Overrides +uint8_t OverrideAvfsGb[AVFS_VOLTAGE_COUNT ]; +uint8_t Padding8_Avfs[2 ]; + +QuadraticInt_t qAvfsGb[AVFS_VOLTAGE_COUNT ];// GHz->V Override of fused curve +DroopInt_t dBtcGbGfxPll;// GHz->V BtcGb +DroopInt_t dBtcGbGfxDfll;// GHz->V BtcGb +DroopInt_t dBtcGbSoc;// GHz->V BtcGb +LinearInt_t qAgingGb[AVFS_VOLTAGE_COUNT ];// GHz->V + +QuadraticInt_t qStaticVoltageOffset[AVFS_VOLTAGE_COUNT ];// GHz->V + +uint16_t DcTol[AVFS_VOLTAGE_COUNT ];// mV Q2 + +uint8_t DcBtcEnabled[AVFS_VOLTAGE_COUNT ]; +uint8_t Padding8_GfxBtc[2 ]; + +uint16_t DcBtcMin[AVFS_VOLTAGE_COUNT ];// mV Q2 +uint16_t DcBtcMax[AVFS_VOLTAGE_COUNT ];// mV Q2 + +// SECTION: Advanced Options +uint32_t DebugOverrides; +QuadraticInt_t ReservedEquation0; +QuadraticInt_t ReservedEquation1; +QuadraticInt_t ReservedEquation2; +QuadraticInt_t ReservedEquation3; + +// Total Power configuration, use defines from PwrConfig_e +uint8_t TotalPowerConfig;//0-TDP, 1-TGP, 2-TCP Estimated, 3-TCP Measured +uint8_t TotalPowerSpare1; +uint16_t TotalPowerSpare2; + +// APCC Settings +uint16_t PccThresholdLow; +uint16_t PccThresholdHigh; +uint32_t PaddingAPCC[6 ];//FIXME pending SPEC + +// Temperature Dependent Vmin +uint16_t VDDGFX_TVmin;//Celcius +uint16_t VDDSOC_TVmin;//Celcius +uint16_t VDDGFX_Vmin_HiTemp;// mV Q2 +uint16_t VDDGFX_Vmin_LoTemp;// mV Q2 +uint16_t VDDSOC_Vmin_HiTemp;// mV Q2 +uint16_t VDDSOC_Vmin_LoTemp;// mV Q2 + +uint16_t VDDGFX_TVminHystersis;// Celcius +uint16_t VDDSOC_TVminHystersis;// Celcius + +// BTC Setting +uint32_t BtcConfig; + +// SECTION: Board Reserved +uint32_t Reserved[14 ]; + +// SECTION: BOARD PARAMETERS +// I2C Control +I2cControllerConfig_t I2cControllers[NUM_I2C_CONTROLLERS ]; + +// SVI2 Board Parameters +uint16_t MaxVoltageStepGfx;// In mV(Q2) Max voltage step that SMU will request. Multiple steps are taken if voltage change exceeds this value. +uint16_t MaxVoltageStepSoc;// In mV(Q2) Max voltage step that SMU will request. Multiple steps are taken if voltage change exceeds this value. + +uint8_t VddGfxVrMapping;// Use VR_MAPPING* bitfields +uint8_t VddSocVrMapping;// Use VR_MAPPING* bitfields +uint8_t VddMem0VrMapping;// Use VR_MAPPING* bitfields +uint8_t VddMem1VrMapping;// Use VR_MAPPING* bitfields + +uint8_t GfxUlvPhaseSheddingMask;// set this to 1 to set PSI0/1 to 1 in ULV mode +uint8_t SocUlvPhaseSheddingMask;// set this to 1 to set PSI0/1 to 1 in ULV mode +uint8_t ExternalSensorPresent;// External RDI connected to TMON (aka TEMP IN) +uint8_t Padding8_V; + +// Telemetry Settings +uint16_t GfxMaxCurrent;// in Amps +int8_t GfxOffset;// in Amps +uint8_t Padding_TelemetryGfx; + +uint16_t SocMaxCurrent;// in Amps +int8_t SocOffset;// in Amps +uint8_t Padding_TelemetrySoc; + +uint16_t Mem0MaxCurrent;// in Amps +int8_t Mem0Offset;// in Amps +uint8_t Padding_TelemetryMem0; + +uint16_t Mem1MaxCurrent;// in Amps +int8_t Mem1Offset;// in Amps +uint8_t Padding_TelemetryMem1; + +// GPIO Settings +uint8_t AcDcGpio;// GPIO pin configured for AC/DC switching +uint8_t AcDcPolarity;// GPIO polarity for AC/DC switching +uint8_t VR0HotGpio;// GPIO pin configured for VR0 HOT event +uint8_t VR0HotPolarity;// GPIO polarity for VR0 HOT event + +uint8_t VR1HotGpio;// GPIO pin configured for VR1 HOT event +uint8_t VR1HotPolarity;// GPIO polarity for VR1 HOT event +uint8_t GthrGpio;// GPIO pin configured for GTHR Event +uint8_t GthrPolarity;// replace GPIO polarity for GTHR + +// LED Display Settings +uint8_t LedPin0;// GPIO number for LedPin[0] +uint8_t LedPin1;// GPIO number for LedPin[1] +uint8_t LedPin2;// GPIO number for LedPin[2] +uint8_t padding8_4; + +// GFXCLK PLL Spread Spectrum +uint8_t PllGfxclkSpreadEnabled;// on or off +uint8_t PllGfxclkSpreadPercent;// Q4.4 +uint16_t PllGfxclkSpreadFreq;// kHz + +// GFXCLK DFLL Spread Spectrum +uint8_t DfllGfxclkSpreadEnabled;// on or off +uint8_t DfllGfxclkSpreadPercent;// Q4.4 +uint16_t DfllGfxclkSpreadFreq;// kHz + +// UCLK Spread Spectrum +uint8_t UclkSpreadEnabled;// on or off +uint8_t UclkSpreadPercent;// Q4.4 +uint16_t UclkSpreadFreq;// kHz + +// SOCCLK Spread Spectrum +uint8_t SoclkSpreadEnabled;// on or off +uint8_t SocclkSpreadPercent;// Q4.4 +uint16_t SocclkSpreadFreq;// kHz + +// Total board power +uint16_t TotalBoardPower;//Only needed for TCP Estimated case, where TCP = TGP+Total Board Power +uint16_t BoardPadding; + +// Mvdd Svi2 Div Ratio Setting +uint32_t MvddRatio;// This is used for MVDD Vid workaround. It has 16 fractional bits (Q16.16) + +uint32_t BoardReserved[9 ]; + +// Padding for MMHUB - do not modify this +uint32_t MmHubPadding[8 ];// SMU internal use + +}PPTable_t ; + +typedef struct { +// Time constant parameters for clock averages in ms +uint16_t GfxclkAverageLpfTau; +uint16_t SocclkAverageLpfTau; +uint16_t UclkAverageLpfTau; +uint16_t GfxActivityLpfTau; +uint16_t UclkActivityLpfTau; + +uint16_t Padding; +// Padding - ignore +uint32_t MmHubPadding[8 ];// SMU internal use +}DriverSmuConfig_t ; + +typedef struct { + +uint16_t GfxclkFmin;// MHz +uint16_t GfxclkFmax;// MHz +uint16_t GfxclkFreq1;// MHz +uint16_t GfxclkVolt1;// mV (Q2) +uint16_t GfxclkFreq2;// MHz +uint16_t GfxclkVolt2;// mV (Q2) +uint16_t GfxclkFreq3;// MHz +uint16_t GfxclkVolt3;// mV (Q2) +uint16_t UclkFmax;// MHz +int16_t OverDrivePct;// % +uint16_t FanMaximumRpm; +uint16_t FanMinimumPwm; +uint16_t FanTargetTemperature;// Degree Celcius +uint16_t MaxOpTemp;// Degree Celcius +uint16_t FanZeroRpmEnable; +uint16_t Padding; + +uint32_t MmHubPadding[8 ];// SMU internal use + +}OverDriveTable_t ; + +typedef struct { +uint16_t CurrClock[PPCLK_COUNT ]; +uint16_t AverageGfxclkFrequency; +uint16_t AverageSocclkFrequency; +uint16_t AverageUclkFrequency ; +uint16_t AverageGfxActivity ; +uint16_t AverageUclkActivity ; +uint8_t CurrSocVoltageOffset ; +uint8_t CurrGfxVoltageOffset ; +uint8_t CurrMemVidOffset ; +uint8_t Padding8 ; +uint16_t CurrSocketPower ; +uint16_t TemperatureEdge ; +uint16_t TemperatureHotspot ; +uint16_t TemperatureMem ; +uint16_t TemperatureVrGfx ; +uint16_t TemperatureVrMem0 ; +uint16_t TemperatureVrMem1 ; +uint16_t TemperatureVrSoc ; +uint16_t TemperatureLiquid0 ; +uint16_t TemperatureLiquid1 ; +uint16_t TemperaturePlx ; +uint16_t Padding16 ; +uint32_t ThrottlerStatus ; + +uint8_t LinkDpmLevel; +uint8_t Padding[3 ]; + +// Padding - ignore +uint32_t MmHubPadding[8 ];// SMU internal use +}SmuMetrics_t ; + +typedef struct { +uint16_t MinClock;// This is either DCEFCLK or SOCCLK (in MHz) +uint16_t MaxClock;// This is either DCEFCLK or SOCCLK (in MHz) +uint16_t MinUclk; +uint16_t MaxUclk; + +uint8_t WmSetting; +uint8_t Padding[3 ]; + +uint32_t MmHubPadding[8 ];// SMU internal use +}WatermarkRowGeneric_t ; + +#define NUM_WM_RANGES 4 + +typedef enum { +WM_SOCCLK =0 , +WM_DCEFCLK , +WM_COUNT , +}WM_CLOCK_e ; + +typedef struct { +// Watermarks +WatermarkRowGeneric_t WatermarkRow[WM_COUNT ][NUM_WM_RANGES ]; + +uint32_t MmHubPadding[8 ];// SMU internal use +}Watermarks_t ; + +typedef struct { +uint16_t avgPsmCount[36 ]; +uint16_t minPsmCount[36 ]; +float avgPsmVoltage[36 ]; +float minPsmVoltage[36 ]; + +uint32_t MmHubPadding[8 ];// SMU internal use +}AvfsDebugTable_t ; + +typedef struct { +uint8_t AvfsVersion; +uint8_t Padding; + +uint8_t AvfsEn[AVFS_VOLTAGE_COUNT ]; + +uint8_t OverrideVFT[AVFS_VOLTAGE_COUNT ]; +uint8_t OverrideAvfsGb[AVFS_VOLTAGE_COUNT ]; + +uint8_t OverrideTemperatures[AVFS_VOLTAGE_COUNT ]; +uint8_t OverrideVInversion[AVFS_VOLTAGE_COUNT ]; +uint8_t OverrideP2V[AVFS_VOLTAGE_COUNT ]; +uint8_t OverrideP2VCharzFreq[AVFS_VOLTAGE_COUNT ]; + +int32_t VFT0_m1[AVFS_VOLTAGE_COUNT ];// Q8.24 +int32_t VFT0_m2[AVFS_VOLTAGE_COUNT ];// Q12.12 +int32_t VFT0_b[AVFS_VOLTAGE_COUNT ];// Q32 + +int32_t VFT1_m1[AVFS_VOLTAGE_COUNT ];// Q8.16 +int32_t VFT1_m2[AVFS_VOLTAGE_COUNT ];// Q12.12 +int32_t VFT1_b[AVFS_VOLTAGE_COUNT ];// Q32 + +int32_t VFT2_m1[AVFS_VOLTAGE_COUNT ];// Q8.16 +int32_t VFT2_m2[AVFS_VOLTAGE_COUNT ];// Q12.12 +int32_t VFT2_b[AVFS_VOLTAGE_COUNT ];// Q32 + +int32_t AvfsGb0_m1[AVFS_VOLTAGE_COUNT ];// Q8.24 +int32_t AvfsGb0_m2[AVFS_VOLTAGE_COUNT ];// Q12.12 +int32_t AvfsGb0_b[AVFS_VOLTAGE_COUNT ];// Q32 + +int32_t AcBtcGb_m1[AVFS_VOLTAGE_COUNT ];// Q8.24 +int32_t AcBtcGb_m2[AVFS_VOLTAGE_COUNT ];// Q12.12 +int32_t AcBtcGb_b[AVFS_VOLTAGE_COUNT ];// Q32 + +uint32_t AvfsTempCold[AVFS_VOLTAGE_COUNT ]; +uint32_t AvfsTempMid[AVFS_VOLTAGE_COUNT ]; +uint32_t AvfsTempHot[AVFS_VOLTAGE_COUNT ]; + +uint32_t VInversion[AVFS_VOLTAGE_COUNT ];// in mV with 2 fractional bits + + +int32_t P2V_m1[AVFS_VOLTAGE_COUNT ];// Q8.24 +int32_t P2V_m2[AVFS_VOLTAGE_COUNT ];// Q12.12 +int32_t P2V_b[AVFS_VOLTAGE_COUNT ];// Q32 + +uint32_t P2VCharzFreq[AVFS_VOLTAGE_COUNT ];// in 10KHz units + +uint32_t EnabledAvfsModules[2 ];//NV10 - 36 AVFS modules + +uint32_t MmHubPadding[8 ];// SMU internal use +}AvfsFuseOverride_t ; + +typedef struct { + +uint8_t Gfx_ActiveHystLimit; +uint8_t Gfx_IdleHystLimit; +uint8_t Gfx_FPS; +uint8_t Gfx_MinActiveFreqType; +uint8_t Gfx_BoosterFreqType; +uint8_t Gfx_MinFreqStep;// Minimum delta between current and target frequeny in order for FW to change clock. +uint16_t Gfx_MinActiveFreq;// MHz +uint16_t Gfx_BoosterFreq;// MHz +uint16_t Gfx_PD_Data_time_constant;// Time constant of PD controller in ms +uint32_t Gfx_PD_Data_limit_a;// Q16 +uint32_t Gfx_PD_Data_limit_b;// Q16 +uint32_t Gfx_PD_Data_limit_c;// Q16 +uint32_t Gfx_PD_Data_error_coeff;// Q16 +uint32_t Gfx_PD_Data_error_rate_coeff;// Q16 + +uint8_t Soc_ActiveHystLimit; +uint8_t Soc_IdleHystLimit; +uint8_t Soc_FPS; +uint8_t Soc_MinActiveFreqType; +uint8_t Soc_BoosterFreqType; +uint8_t Soc_MinFreqStep;// Minimum delta between current and target frequeny in order for FW to change clock. +uint16_t Soc_MinActiveFreq;// MHz +uint16_t Soc_BoosterFreq;// MHz +uint16_t Soc_PD_Data_time_constant;// Time constant of PD controller in ms +uint32_t Soc_PD_Data_limit_a;// Q16 +uint32_t Soc_PD_Data_limit_b;// Q16 +uint32_t Soc_PD_Data_limit_c;// Q16 +uint32_t Soc_PD_Data_error_coeff;// Q16 +uint32_t Soc_PD_Data_error_rate_coeff;// Q16 + +uint8_t Mem_ActiveHystLimit; +uint8_t Mem_IdleHystLimit; +uint8_t Mem_FPS; +uint8_t Mem_MinActiveFreqType; +uint8_t Mem_BoosterFreqType; +uint8_t Mem_MinFreqStep;// Minimum delta between current and target frequeny in order for FW to change clock. +uint16_t Mem_MinActiveFreq;// MHz +uint16_t Mem_BoosterFreq;// MHz +uint16_t Mem_PD_Data_time_constant;// Time constant of PD controller in ms +uint32_t Mem_PD_Data_limit_a;// Q16 +uint32_t Mem_PD_Data_limit_b;// Q16 +uint32_t Mem_PD_Data_limit_c;// Q16 +uint32_t Mem_PD_Data_error_coeff;// Q16 +uint32_t Mem_PD_Data_error_rate_coeff;// Q16 + +uint32_t Mem_UpThreshold_Limit;// Q16 +uint8_t Mem_UpHystLimit; +uint8_t Mem_DownHystLimit; +uint16_t Mem_Fps; + +uint32_t MmHubPadding[8 ];// SMU internal use + +}DpmActivityMonitorCoeffInt_t ; + + +// Workload bits +#define WORKLOAD_PPLIB_DEFAULT_BIT 0 +#define WORKLOAD_PPLIB_FULL_SCREEN_3D_BIT 1 +#define WORKLOAD_PPLIB_POWER_SAVING_BIT 2 +#define WORKLOAD_PPLIB_VIDEO_BIT 3 +#define WORKLOAD_PPLIB_VR_BIT 4 +#define WORKLOAD_PPLIB_COMPUTE_BIT 5 +#define WORKLOAD_PPLIB_CUSTOM_BIT 6 +#define WORKLOAD_PPLIB_COUNT 7 + + +// These defines are used with the following messages: +// SMC_MSG_TransferTableDram2Smu +// SMC_MSG_TransferTableSmu2Dram + +// Table transfer status +#define TABLE_TRANSFER_OK 0x0 +#define TABLE_TRANSFER_FAILED 0xFF + +// Table types +#define TABLE_PPTABLE 0 +#define TABLE_WATERMARKS 1 +#define TABLE_AVFS 2 +#define TABLE_AVFS_PSM_DEBUG 3 +#define TABLE_AVFS_FUSE_OVERRIDE 4 +#define TABLE_PMSTATUSLOG 5 +#define TABLE_SMU_METRICS 6 +#define TABLE_DRIVER_SMU_CONFIG 7 +#define TABLE_ACTIVITY_MONITOR_COEFF 8 +#define TABLE_OVERDRIVE 9 +#define TABLE_I2C_COMMANDS 10 +#define TABLE_PACE 11 +#define TABLE_COUNT 12 + +//RLC Pace Table total number of levels +#define RLC_PACE_TABLE_NUM_LEVELS 16 +#define RLC_PACE_RATIO_NUM_LEVELS 8 + +typedef struct { +uint8_t ByteRatioLow; +uint8_t FlopsRatioLow; +uint8_t ByteRatioHigh; +uint8_t FlopsRatioHigh; +}RlcPaceFlopsPerByte_t ; + +typedef struct { +RlcPaceFlopsPerByte_t FlopsPerByteTable[RLC_PACE_RATIO_NUM_LEVELS ]; + +uint32_t MmHubPadding[8 ];// SMU internal use +}RlcPaceFlopsPerByteOverride_t ; + +// These defines are used with the SMC_MSG_SetUclkFastSwitch message. +#define UCLK_SWITCH_SLOW 0 +#define UCLK_SWITCH_FAST 1 +#endif
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +1 -1
@@ -27,7 +27,7 @@#include "atomfirmware.h" #include "amdgpu_atomfirmware.h" #include "smu_v11_0.h" -#include "smu11_driver_if.h" +#include "smu_11_0_driver_if.h" #include "soc15_common.h" #include "atom.h" #include "vega20_ppt.h"
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 143/459 drm/amd/powerplay: fix the mp/smuio header for navi10
In reply to a message not in the archiveFrom: Huang Rui <[email protected]>
SMU11 should use mp11 and smuio11 headers.
--- drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +4 -4
@@ -35,11 +35,11 @@#include "asic_reg/thm/thm_11_0_2_offset.h" #include "asic_reg/thm/thm_11_0_2_sh_mask.h" -#include "asic_reg/mp/mp_9_0_offset.h" -#include "asic_reg/mp/mp_9_0_sh_mask.h" +#include "asic_reg/mp/mp_11_0_offset.h" +#include "asic_reg/mp/mp_11_0_sh_mask.h" #include "asic_reg/nbio/nbio_7_4_offset.h" -#include "asic_reg/smuio/smuio_9_0_offset.h" -#include "asic_reg/smuio/smuio_9_0_sh_mask.h" +#include "asic_reg/smuio/smuio_11_0_0_offset.h" +#include "asic_reg/smuio/smuio_11_0_0_sh_mask.h" MODULE_FIRMWARE ("amdgpu/vega20_smc.bin" );
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 144/459 drm/amd/powerplay: introduce the navi10 pptable implementation
In reply to a message not in the archiveFrom: Huang Rui <[email protected]>
This patch introduces the navi10 pptable implementation, so far it is already has firmware loading, pptable side loading, writing back to smc, and feature mask enabling.
--- drivers/gpu/drm/amd/powerplay/Makefile | 2 +- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 303 +++++++++++++++++++++ drivers/gpu/drm/amd/powerplay/navi10_ppt.h | 28 ++ 3 files changed, 332 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/amd/powerplay/navi10_ppt.c create mode 100644 drivers/gpu/drm/amd/powerplay/navi10_ppt.h
drivers/gpu/drm/amd/powerplay/Makefile +1 -1
@@ -35,7 +35,7 @@ AMD_POWERPLAY = $(addsuffix /Makefile,$(addprefix $(FULL_AMD_PATH)/powerplay/,$( include $(AMD_POWERPLAY) -POWER_MGR = amd_powerplay.o amdgpu_smu.o smu_v11_0.o vega20_ppt.o +POWER_MGR = amd_powerplay.o amdgpu_smu.o smu_v11_0.o vega20_ppt.o navi10_ppt.o AMD_PP_POWER = $(addprefix $(AMD_PP_PATH)/,$(POWER_MGR))
drivers/gpu/drm/amd/powerplay/navi10_ppt.c new file +303 -0
303 lines not on this page · raw message
drivers/gpu/drm/amd/powerplay/navi10_ppt.h new file +28 -0
@@ -0,0 +1,28 @@ +/* +* Copyright 2019 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +* +*/ +#ifndef __NAVI10_PPT_H__ +#define __NAVI10_PPT_H__ + +extern void navi10_set_ppt_funcs (struct smu_context *smu); + +#endif
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 145/459 drm/amd/powerplay: set smu v11 funcs for navi10
In reply to a message not in the archiveFrom: Huang Rui <[email protected]>
Naiv10 also uses smu v11 functions.
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +1 -0
@@ -330,6 +330,7 @@ static int smu_set_funcs(struct amdgpu_device *adev)switch (adev->asic_type) {case CHIP_VEGA20 : +case CHIP_NAVI10 : adev->pm.pp_feature &= ~PP_GFXOFF_MASK ;if (adev->pm.pp_feature &PP_OVERDRIVE_MASK ) smu->od_enabled = true;
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 146/459 drm/amd/powerplay: add navi10 smc ucode init and navi10 ppt functions setting
In reply to a message not in the archiveFrom: Huang Rui <[email protected]>
This patch adds navi10 smc ucode init and ppt functions setting.
--- drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +7 -0
@@ -31,6 +31,7 @@#include "soc15_common.h" #include "atom.h" #include "vega20_ppt.h" +#include "navi10_ppt.h" #include "pp_thermal.h" #include "asic_reg/thm/thm_11_0_2_offset.h"
@@ -165,6 +166,9 @@ static int smu_v11_0_init_microcode(struct smu_context *smu)case CHIP_VEGA20 : chip_name ="vega20" ;break ; +case CHIP_NAVI10 : + chip_name ="navi10" ; +break ;default :BUG (); }
@@ -2096,6 +2100,9 @@ void smu_v11_0_set_smu_funcs(struct smu_context *smu)case CHIP_VEGA20 :vega20_set_ppt_funcs (smu);break ; +case CHIP_NAVI10 : +navi10_set_ppt_funcs (smu); +break ;default :pr_warn ("Unknown asic for smu11\n" ); }
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 147/459 drm/amd/powerplay: move bootup value before read pptable from vbios
In reply to a message not in the archiveFrom: Huang Rui <[email protected]>
In navi10, we need read the pp_table_id from bootup value, then decide whether use load the soft pptable.
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +3 -3
@@ -628,12 +628,12 @@ static int smu_smc_table_hw_init(struct smu_context *smu,return ret;if (initialize) { - ret =smu_read_pptable_from_vbios (smu); +/* get boot_values from vbios to set revision, gfxclk, and etc. */ + ret =smu_get_vbios_bootup_values (smu);if (ret)return ret; -/* get boot_values from vbios to set revision, gfxclk, and etc. */ - ret =smu_get_vbios_bootup_values (smu); + ret =smu_read_pptable_from_vbios (smu);if (ret)return ret;
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 148/459 drm/amd/powerplay: enable backdoor smu fw loading (v2)
In reply to a message not in the archiveFrom: Kenneth Feng <[email protected]>
enable backdoor smu fw loading on navi10
v2: squash in define fix (Alex)
--- drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h | 1 + drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 33 +++++++++++++++++++ 2 files changed, 34 insertions(+)
drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h +1 -0
@@ -30,6 +30,7 @@#define MP0_SRAM 0x03900000#define MP1_Public 0x03b00000#define MP1_SRAM 0x03c00004 +#define MP1_SMC_SIZE 0x40000/* address block */ #define smnMP1_FIRMWARE_FLAGS 0x3010024
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +33 -0
@@ -207,6 +207,39 @@ static int smu_v11_0_init_microcode(struct smu_context *smu)static int smu_v11_0_load_microcode (struct smu_context *smu) { +struct amdgpu_device *adev = smu->adev; +const uint32_t *src; +const struct smc_firmware_header_v1_0 *hdr; +uint32_t addr_start =MP1_SRAM ; +uint32_t i; +uint32_t mp1_fw_flags; + + hdr = (const struct smc_firmware_header_v1_0 *) adev->pm.fw->data; + src = (const uint32_t *)(adev->pm.fw->data + +le32_to_cpu (hdr->header.ucode_array_offset_bytes)); + +for (i =1 ; i <MP1_SMC_SIZE /4 -1 ; i++) { +WREG32_PCIE (addr_start, src[i]); + addr_start +=4 ; + } + +WREG32_PCIE (MP1_Public | (smnMP1_PUB_CTRL &0xffffffff ), +1 &MP1_SMN_PUB_CTRL__RESET_MASK ); +WREG32_PCIE (MP1_Public | (smnMP1_PUB_CTRL &0xffffffff ), +1 & ~MP1_SMN_PUB_CTRL__RESET_MASK ); + +for (i =0 ; i < adev->usec_timeout; i++) { + mp1_fw_flags =RREG32_PCIE (MP1_Public | + (smnMP1_FIRMWARE_FLAGS &0xffffffff )); +if ((mp1_fw_flags &MP1_FIRMWARE_FLAGS__INTERRUPTS_ENABLED_MASK ) >> +MP1_FIRMWARE_FLAGS__INTERRUPTS_ENABLED__SHIFT ) +break ; +udelay (1 ); + } + +if (i == adev->usec_timeout) +return -ETIME ; +return 0 ; }
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 149/459 drm/amd/powerplay: update smu11 driver if header for navi10 (v2)
In reply to a message not in the archiveFrom: Huang Rui <[email protected]>
This patch updates smu11 driver if header for navi10 to match 42.09.00 smu firmware.
v2: clean up comments
--- .../gpu/drm/amd/powerplay/inc/smu_11_0_driver_if.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/inc/smu_11_0_driver_if.h +10 -1
@@ -4,7 +4,7 @@// *** IMPORTANT *** // SMU TEAM: Always increment the interface version if // any structure is changed in this file -#define SMU11_DRIVER_IF_VERSION 0x2D +#define SMU11_DRIVER_IF_VERSION 0x2E#define PPTABLE_NV10_SMU_VERSION 8
@@ -297,6 +297,15 @@ typedef struct { } SwI2cRequest_t;// SW I2C Request Table +//D3HOT sequences +typedef enum { +BACO_SEQUENCE , +MSR_SEQUENCE , +BAMACO_SEQUENCE , +ULPS_SEQUENCE , +D3HOT_SEQUENCE_COUNT , +}D3HOTSequence_e ; +//THis is aligned with RSMU PGFSM Register Mapping typedef enum { PG_DYNAMIC_MODE = 0,
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 150/459 drm/amdgpu: bump smc firmware header version to v2 (v2)
In reply to a message not in the archiveFrom: Huang Rui <[email protected]>
This patch bumps smc firmware header version to v2 for storing soft pptable.
v2: fix the typo, and add prints for v2 header
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 8 ++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h | 8 ++++++++ 2 files changed, 16 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +8 -0
@@ -77,6 +77,14 @@ void amdgpu_ucode_print_smc_hdr(const struct common_firmware_header *hdr) container_of(hdr, struct smc_firmware_header_v1_0, header);DRM_DEBUG ("ucode_start_addr: %u\n" ,le32_to_cpu (smc_hdr->ucode_start_addr)); + }else if (version_major ==2 ) { +const struct smc_firmware_header_v1_0 *v1_hdr = + container_of(hdr, struct smc_firmware_header_v1_0, header); +const struct smc_firmware_header_v2_0 *v2_hdr = + container_of(v1_hdr, struct smc_firmware_header_v2_0, v1_0); + +DRM_INFO ("ppt_offset_bytes: %u\n" ,le32_to_cpu (v2_hdr->ppt_offset_bytes)); +DRM_INFO ("ppt_size_bytes: %u\n" ,le32_to_cpu (v2_hdr->ppt_size_bytes)); }else {DRM_ERROR ("Unknown SMC ucode version: %u.%u\n" , version_major, version_minor); }
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +8 -0
@@ -49,6 +49,13 @@ struct smc_firmware_header_v1_0 {uint32_t ucode_start_addr; }; +/* version_major=2, version_minor=0 */ +struct smc_firmware_header_v2_0 { +struct smc_firmware_header_v1_0 v1_0; +uint32_t ppt_offset_bytes;/* soft pptable offset */ +uint32_t ppt_size_bytes;/* soft pptable size */ +}; +/* version_major=1, version_minor=0 */ struct psp_firmware_header_v1_0 {struct common_firmware_header header;
@@ -194,6 +201,7 @@ union amdgpu_firmware_header {struct common_firmware_header common;struct mc_firmware_header_v1_0 mc;struct smc_firmware_header_v1_0 smc; +struct smc_firmware_header_v2_0 smc_v2_0;struct psp_firmware_header_v1_0 psp;struct psp_firmware_header_v1_1 psp_v1_1;struct ta_firmware_header_v1_0 ta;
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 151/459 drm/amdgpu: fix the issue of checking on message mapping
In reply to a message not in the archiveFrom: Huang Rui <[email protected]>
The navi10_message_map[index] scope should be in PPSMC_Message_Count not in SMU_MSG_MAX_COUNT.
--- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +7 -2
@@ -101,10 +101,15 @@ static int navi10_message_map[SMU_MSG_MAX_COUNT] = {static int navi10_get_smu_msg_index (struct smu_context *smc,uint32_t index) { -if (index >SMU_MSG_MAX_COUNT || index > PPSMC_Message_Count) +int val; +if (index >SMU_MSG_MAX_COUNT )return -EINVAL ; -return navi10_message_map[index]; + val = navi10_message_map[index]; +if (val > PPSMC_Message_Count) +return -EINVAL ; + +return val; } static int
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 152/459 drm/amd/powerplay: smu needs to be initialized after rlc in direct mode
In reply to a message not in the archiveFrom: Huang Rui <[email protected]>
For gfx 10, rlc firmware loading relies on smu firmware is loaded firstly, so in direct type, it has to load smc ucode here before rlc. And meanwhile, the smu initialization has to move after rlc, otherwise, smu message will get failure during the handshake with rlc and smu.
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +5 -9
@@ -820,16 +820,12 @@ static int smu_hw_init(void *handle)struct amdgpu_device *adev = (struct amdgpu_device *)handle;struct smu_context *smu = &adev->smu; -if (adev->firmware.load_type !=AMDGPU_FW_LOAD_PSP ) { - ret =smu_load_microcode (smu); -if (ret) +if (adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) { + ret =smu_check_fw_status (smu); +if (ret) { +pr_err ("SMC firmware status is not correct\n" );return ret; - } - - ret =smu_check_fw_status (smu); -if (ret) { -pr_err ("SMC firmware status is not correct\n" ); -return ret; + } }mutex_lock (&smu->mutex);
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 153/459 drm/amd/powerplay: introduce the function to load the soft pptable for navi10 (v2)
In reply to a message not in the archiveFrom: Huang Rui <[email protected]>
Driver is able to load soft pptable from smc bin file with this function. We stored the soft pptable in the bottom of smc.bin that the version is v2.
v2: remove is_fw_v2_0 flag.
--- .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 5 +++ drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 37 ++++++++++++++++--- 2 files changed, 36 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +5 -0
@@ -389,6 +389,11 @@ struct smu_contextuint32_t power_limit;uint32_t default_power_limit; +/* soft pptable */ +uint32_t ppt_offset_bytes; +uint32_t ppt_size_bytes; +uint8_t *ppt_start_addr; +bool support_power_containment;bool disable_watermark;
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +31 -6
@@ -43,6 +43,7 @@#include "asic_reg/smuio/smuio_11_0_0_sh_mask.h" MODULE_FIRMWARE ("amdgpu/vega20_smc.bin" ); +MODULE_FIRMWARE ("amdgpu/navi10_smc.bin" );#define SMU11_TOOL_SIZE 0x19000#define SMU11_THERMAL_MINIMUM_ALERT_TEMP 0
@@ -152,6 +153,18 @@ smu_v11_0_send_msg_with_param(struct smu_context *smu, uint16_t msg,return ret; } +static void smu_v11_0_init_smu_ext_microcode (struct smu_context *smu) +{ +struct amdgpu_device *adev = smu->adev; +const struct smc_firmware_header_v2_0 *v2; + + v2 = (const struct smc_firmware_header_v2_0 *) adev->pm.fw->data; + + smu->ppt_offset_bytes =le32_to_cpu (v2->ppt_offset_bytes); + smu->ppt_size_bytes =le32_to_cpu (v2->ppt_size_bytes); + smu->ppt_start_addr = (uint8_t *)v2 + smu->ppt_offset_bytes; +} +static int smu_v11_0_init_microcode (struct smu_context *smu) {struct amdgpu_device *adev = smu->adev;
@@ -161,6 +174,7 @@ static int smu_v11_0_init_microcode(struct smu_context *smu)const struct smc_firmware_header_v1_0 *hdr;const struct common_firmware_header *header;struct amdgpu_firmware_info *ucode =NULL ; +uint32_t version_major, version_minor;switch (adev->asic_type) {case CHIP_VEGA20 :
@@ -186,6 +200,11 @@ static int smu_v11_0_init_microcode(struct smu_context *smu)amdgpu_ucode_print_smc_hdr (&hdr->header); adev->pm.fw_version =le32_to_cpu (hdr->header.ucode_version); + version_major =le16_to_cpu (hdr->header.header_version_major); + version_minor =le16_to_cpu (hdr->header.header_version_minor); +if (version_major ==2 && version_minor ==0 ) +smu_v11_0_init_smu_ext_microcode (smu);/* with soft pptable */ +if (adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) { ucode = &adev->firmware.ucode[AMDGPU_UCODE_ID_SMC ]; ucode->ucode_id =AMDGPU_UCODE_ID_SMC ;
@@ -291,13 +310,19 @@ static int smu_v11_0_read_pptable_from_vbios(struct smu_context *smu)uint8_t frev, crev;void *table; - index =get_index_into_master_table (atom_master_list_of_data_tables_v2_1, - powerplayinfo); +if (smu->smu_table.boot_values.pp_table_id >0 && smu->ppt_start_addr) { +/* load soft pptable */ + table = (void *)smu->ppt_start_addr; + size= smu->ppt_size_bytes; + }else { + index =get_index_into_master_table (atom_master_list_of_data_tables_v2_1, + powerplayinfo); - ret =smu_get_atom_data_table (smu, index, &size, &frev, &crev, - (uint8_t **)&table); -if (ret) -return ret; + ret =smu_get_atom_data_table (smu, index, &size, &frev, &crev, + (uint8_t **)&table); +if (ret) +return ret; + }if (!smu->smu_table.power_play_table) smu->smu_table.power_play_table = table;
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 154/459 drm/amd/powerplay: modify the feature mask to enable gfx/soc dpm
In reply to a message not in the archiveFrom: Huang Rui <[email protected]>
So far, the gfx/soc dpm is enabled with feature mask set.
--- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +2 -2
@@ -119,8 +119,8 @@ navi10_get_unallowed_feature_mask(struct smu_context *smu,if (num >2 )return -EINVAL ; - feature_mask[0 ] =0x0C677844 ; - feature_mask[1 ] =0xFFFFFF28 ;/* bit32~bit63 is Unsupported */ + feature_mask[0 ] =0xffffffe4 ; + feature_mask[1 ] =0xffffffff ;/* bit32~bit63 is Unsupported */ return 0 ; }
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 155/459 drm/amd/powerplay: skip od feature on navi10 for the moment
In reply to a message not in the archiveFrom: Huang Rui <[email protected]>
OD feature isn't enabled on navi10 so skip it for the moment.
--- drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +7 -0
@@ -1618,6 +1618,13 @@ static int smu_v11_0_set_od8_default_settings(struct smu_context *smu,struct smu_table_context *table_context = &smu->smu_table;int ret; +/** +* TODO: Enable overdrive for navi10, that replies on smc/pptable +* support. +*/ +if (smu->adev->asic_type ==CHIP_NAVI10 ) +return 0 ; +if (initialize) {if (table_context->overdrive_table)return -EINVAL ;
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 156/459 drm/amd/powerplay: enable power features
In reply to a message not in the archiveFrom: Kenneth Feng <[email protected]>
the below smu related power features can be enabled now. 1.Prefetcher
2.GFX DPM
3.SOCCLK DPM
4.MP0CLK DPM
5.LCLK DPM
6.GFX ULV
7.CG
8.PPT
9.TDC
10.GFX EDC
11.VR0HOT
12.Fan Control
13.Thermal Control
14.LED Display
15.MMHub PG
16.ATHub PG
--- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +2 -2
@@ -119,8 +119,8 @@ navi10_get_unallowed_feature_mask(struct smu_context *smu,if (num >2 )return -EINVAL ; - feature_mask[0 ] =0xffffffe4 ; - feature_mask[1 ] =0xffffffff ;/* bit32~bit63 is Unsupported */ + feature_mask[0 ] =0xdc3f7f8c ; + feature_mask[1 ] =0xfffffcec ;/* bit32~bit63 is Unsupported */ return 0 ; }
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 157/459 drm/amd/powerplay: move the funciton of conv_profile_to_workload to asic file
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
the function of conv_profile_to_workload is asic related function, so move them into vega20_ppt file
--- .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 3 ++ drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 37 +------------------ drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 32 ++++++++++++++++ 3 files changed, 37 insertions(+), 35 deletions(-)
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +3 -0
@@ -451,6 +451,7 @@ struct pptable_funcs { *clocks);int (*get_power_profile_mode)(struct smu_context *smu,char *buf);int (*set_power_profile_mode)(struct smu_context *smu,long *input,uint32_t size); +int (*conv_profile_to_workload )(struct smu_context *smu,int power_profile);enum amd_dpm_forced_level (*get_performance_level)(struct smu_context *smu);int (*force_performance_level)(struct smu_context *smu,enum amd_dpm_forced_level level);int (*pre_display_config_changed)(struct smu_context *smu);
@@ -728,6 +729,8 @@ struct smu_funcs ((smu)->funcs->notify_smu_enable_pwe ? (smu)->funcs->notify_smu_enable_pwe((smu)) : 0)#define smu_set_watermarks_for_clock_ranges (smu, clock_ranges) \ ((smu)->funcs->set_watermarks_for_clock_ranges ? (smu)->funcs->set_watermarks_for_clock_ranges((smu), (clock_ranges)) : 0) +#define smu_conv_profile_to_workload (smu, type) \ + ((smu)->ppt_funcs->conv_profile_to_workload ? (smu)->ppt_funcs->conv_profile_to_workload((smu), (type)) : 0)#define smu_dpm_set_uvd_enable (smu, enable) \ ((smu)->funcs->dpm_set_uvd_enable ? (smu)->funcs->dpm_set_uvd_enable((smu), (enable)) : 0)#define smu_dpm_set_vce_enable (smu, enable) \
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +2 -35
@@ -1652,37 +1652,6 @@ static int smu_v11_0_set_od8_default_settings(struct smu_context *smu,return 0 ; } -static int smu_v11_0_conv_power_profile_to_pplib_workload (int power_profile) -{ -int pplib_workload =0 ; - -switch (power_profile) { -case PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT : - pplib_workload =WORKLOAD_DEFAULT_BIT ; -break ; -case PP_SMC_POWER_PROFILE_FULLSCREEN3D : - pplib_workload =WORKLOAD_PPLIB_FULL_SCREEN_3D_BIT ; -break ; -case PP_SMC_POWER_PROFILE_POWERSAVING : - pplib_workload =WORKLOAD_PPLIB_POWER_SAVING_BIT ; -break ; -case PP_SMC_POWER_PROFILE_VIDEO : - pplib_workload =WORKLOAD_PPLIB_VIDEO_BIT ; -break ; -case PP_SMC_POWER_PROFILE_VR : - pplib_workload =WORKLOAD_PPLIB_VR_BIT ; -break ; -case PP_SMC_POWER_PROFILE_COMPUTE : - pplib_workload =WORKLOAD_PPLIB_COMPUTE_BIT ; -break ; -case PP_SMC_POWER_PROFILE_CUSTOM : - pplib_workload =WORKLOAD_PPLIB_CUSTOM_BIT ; -break ; - } - -return pplib_workload; -} -static int smu_v11_0_get_power_profile_mode (struct smu_context *smu,char *buf) {DpmActivityMonitorCoeffInt_t activity_monitor;
@@ -1719,7 +1688,7 @@ static int smu_v11_0_get_power_profile_mode(struct smu_context *smu, char *buf)for (i =0 ; i <=PP_SMC_POWER_PROFILE_CUSTOM ; i++) {/* conv PP_SMC_POWER_PROFILE* to WORKLOAD_PPLIB_*_BIT */ - workload_type =smu_v11_0_conv_power_profile_to_pplib_workload (i); + workload_type =smu_conv_profile_to_workload (smu, i); result =smu_update_table_with_arg (smu,TABLE_ACTIVITY_MONITOR_COEFF , workload_type, &activity_monitor, false);if (result) {
@@ -1868,8 +1837,7 @@ static int smu_v11_0_set_power_profile_mode(struct smu_context *smu, long *input }/* conv PP_SMC_POWER_PROFILE* to WORKLOAD_PPLIB_*_BIT */ - workload_type = -smu_v11_0_conv_power_profile_to_pplib_workload (smu->power_profile_mode); + workload_type =smu_conv_profile_to_workload (smu, smu->power_profile_mode);smu_send_smc_msg_with_param (smu, SMU_MSG_SetWorkloadMask,1 << workload_type);
@@ -2141,7 +2109,6 @@ static const struct smu_funcs smu_v11_0_funcs = { .get_sclk = smu_v11_0_dpm_get_sclk, .get_mclk = smu_v11_0_dpm_get_mclk, .set_od8_default_settings = smu_v11_0_set_od8_default_settings, - .conv_power_profile_to_pplib_workload = smu_v11_0_conv_power_profile_to_pplib_workload, .get_power_profile_mode = smu_v11_0_get_power_profile_mode, .set_power_profile_mode = smu_v11_0_set_power_profile_mode, .update_od8_settings = smu_v11_0_update_od8_settings,
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +32 -0
@@ -1496,6 +1496,37 @@ static int vega20_get_od_percentage(struct smu_context *smu,return value; } +static int vega20_conv_profile_to_workload (struct smu_context *smu,int power_profile) +{ +int pplib_workload =0 ; + +switch (power_profile) { +case PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT : + pplib_workload =WORKLOAD_DEFAULT_BIT ; +break ; +case PP_SMC_POWER_PROFILE_FULLSCREEN3D : + pplib_workload =WORKLOAD_PPLIB_FULL_SCREEN_3D_BIT ; +break ; +case PP_SMC_POWER_PROFILE_POWERSAVING : + pplib_workload =WORKLOAD_PPLIB_POWER_SAVING_BIT ; +break ; +case PP_SMC_POWER_PROFILE_VIDEO : + pplib_workload =WORKLOAD_PPLIB_VIDEO_BIT ; +break ; +case PP_SMC_POWER_PROFILE_VR : + pplib_workload =WORKLOAD_PPLIB_VR_BIT ; +break ; +case PP_SMC_POWER_PROFILE_COMPUTE : + pplib_workload =WORKLOAD_PPLIB_COMPUTE_BIT ; +break ; +case PP_SMC_POWER_PROFILE_CUSTOM : + pplib_workload =WORKLOAD_PPLIB_CUSTOM_BIT ; +break ; + } + +return pplib_workload; +} + static int vega20_get_profiling_clk_mask(struct smu_context *smu, enum amd_dpm_forced_level level,
@@ -2541,6 +2572,7 @@ static const struct pptable_funcs vega20_ppt_funcs = { .get_clock_by_type_with_latency = vega20_get_clock_by_type_with_latency, .set_default_od8_settings = vega20_set_default_od8_setttings, .get_od_percentage = vega20_get_od_percentage, + .conv_profile_to_workload = vega20_conv_profile_to_workload, .get_performance_level = vega20_get_performance_level, .force_performance_level = vega20_force_performance_level, .update_specified_od8_value = vega20_update_specified_od8_value,
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 158/459 drm/amd/powerplay: move the function of get[set]_power_profile to asic file
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
The callback of get[set]_power_profile is asic related function, so move theme into vega20_ppt file.
--- .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 6 +- drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 194 ----------------- drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 197 ++++++++++++++++++ 3 files changed, 199 insertions(+), 198 deletions(-)
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +2 -4
@@ -537,8 +537,6 @@ struct smu_funcsint (*set_od8_default_settings)(struct smu_context *smu,bool initialize);int (*conv_power_profile_to_pplib_workload)(int power_profile); -int (*get_power_profile_mode)(struct smu_context *smu,char *buf); -int (*set_power_profile_mode)(struct smu_context *smu,long *input,uint32_t size);int (*update_od8_settings)(struct smu_context *smu,uint32_t index,uint32_t value);
@@ -663,9 +661,9 @@ struct smu_funcs#define smu_read_sensor (smu, sensor, data, size) \ ((smu)->funcs->read_sensor? (smu)->funcs->read_sensor((smu), (sensor), (data), (size)) : 0)#define smu_get_power_profile_mode (smu, buf) \ - ((smu)->funcs->get_power_profile_mode ? (smu)->funcs->get_power_profile_mode((smu), buf) : 0) + ((smu)->ppt_funcs->get_power_profile_mode ? (smu)->ppt_funcs->get_power_profile_mode((smu), buf) : 0)#define smu_set_power_profile_mode (smu, param, param_size) \ - ((smu)->funcs->set_power_profile_mode ? (smu)->funcs->set_power_profile_mode((smu), (param), (param_size)) : 0) + ((smu)->ppt_funcs->set_power_profile_mode ? (smu)->ppt_funcs->set_power_profile_mode((smu), (param), (param_size)) : 0)#define smu_get_performance_level (smu) \ ((smu)->ppt_funcs->get_performance_level ? (smu)->ppt_funcs->get_performance_level((smu)) : 0)#define smu_force_performance_level (smu, level) \
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0 -194
206 lines not on this page · raw message
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +197 -0
209 lines not on this page · raw message
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 159/459 drm/amd/powerplay: move the function of uvd&vce dpm to asic file
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
--- .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 8 +++---- drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 24 ------------------- drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 24 +++++++++++++++++++ 3 files changed, 28 insertions(+), 28 deletions(-)
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +4 -4
@@ -454,6 +454,8 @@ struct pptable_funcs {int (*conv_profile_to_workload )(struct smu_context *smu,int power_profile);enum amd_dpm_forced_level (*get_performance_level)(struct smu_context *smu);int (*force_performance_level)(struct smu_context *smu,enum amd_dpm_forced_level level); +int (*dpm_set_uvd_enable)(struct smu_context *smu,bool enable); +int (*dpm_set_vce_enable)(struct smu_context *smu,bool enable);int (*pre_display_config_changed)(struct smu_context *smu);int (*display_config_changed)(struct smu_context *smu);int (*apply_clocks_adjust_rules)(struct smu_context *smu);
@@ -540,8 +542,6 @@ struct smu_funcsint (*update_od8_settings)(struct smu_context *smu,uint32_t index,uint32_t value); -int (*dpm_set_uvd_enable)(struct smu_context *smu,bool enable); -int (*dpm_set_vce_enable)(struct smu_context *smu,bool enable);uint32_t (*get_sclk)(struct smu_context *smu,bool low);uint32_t (*get_mclk)(struct smu_context *smu,bool low);int (*get_current_rpm)(struct smu_context *smu,uint32_t *speed);
@@ -730,9 +730,9 @@ struct smu_funcs#define smu_conv_profile_to_workload (smu, type) \ ((smu)->ppt_funcs->conv_profile_to_workload ? (smu)->ppt_funcs->conv_profile_to_workload((smu), (type)) : 0)#define smu_dpm_set_uvd_enable (smu, enable) \ - ((smu)->funcs->dpm_set_uvd_enable ? (smu)->funcs->dpm_set_uvd_enable((smu), (enable)) : 0) + ((smu)->ppt_funcs->dpm_set_uvd_enable ? (smu)->ppt_funcs->dpm_set_uvd_enable((smu), (enable)) : 0)#define smu_dpm_set_vce_enable (smu, enable) \ - ((smu)->funcs->dpm_set_vce_enable ? (smu)->funcs->dpm_set_vce_enable((smu), (enable)) : 0) + ((smu)->ppt_funcs->dpm_set_vce_enable ? (smu)->ppt_funcs->dpm_set_vce_enable((smu), (enable)) : 0)#define smu_get_sclk (smu, low) \ ((smu)->funcs->get_sclk ? (smu)->funcs->get_sclk((smu), (low)) : 0)#define smu_get_mclk (smu, low) \
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0 -24
@@ -1678,28 +1678,6 @@ static int smu_v11_0_update_od8_settings(struct smu_context *smu,return 0 ; } -static int smu_v11_0_dpm_set_uvd_enable (struct smu_context *smu,bool enable) -{ -if (!smu_feature_is_supported (smu,FEATURE_DPM_UVD_BIT )) -return 0 ; - -if (enable ==smu_feature_is_enabled (smu,FEATURE_DPM_UVD_BIT )) -return 0 ; - -return smu_feature_set_enabled (smu,FEATURE_DPM_UVD_BIT , enable); -} - -static int smu_v11_0_dpm_set_vce_enable (struct smu_context *smu,bool enable) -{ -if (!smu_feature_is_supported (smu,FEATURE_DPM_VCE_BIT )) -return 0 ; - -if (enable ==smu_feature_is_enabled (smu,FEATURE_DPM_VCE_BIT )) -return 0 ; - -return smu_feature_set_enabled (smu,FEATURE_DPM_VCE_BIT , enable); -} -static int smu_v11_0_get_current_rpm (struct smu_context *smu,uint32_t *current_rpm) {
@@ -1918,8 +1896,6 @@ static const struct smu_funcs smu_v11_0_funcs = { .get_mclk = smu_v11_0_dpm_get_mclk, .set_od8_default_settings = smu_v11_0_set_od8_default_settings, .update_od8_settings = smu_v11_0_update_od8_settings, - .dpm_set_uvd_enable = smu_v11_0_dpm_set_uvd_enable, - .dpm_set_vce_enable = smu_v11_0_dpm_set_vce_enable, .get_current_rpm = smu_v11_0_get_current_rpm, .get_fan_control_mode = smu_v11_0_get_fan_control_mode, .set_fan_control_mode = smu_v11_0_set_fan_control_mode,
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +24 -0
@@ -2599,6 +2599,28 @@ static int vega20_odn_edit_dpm_table(struct smu_context *smu,return ret; } +static int vega20_dpm_set_uvd_enable (struct smu_context *smu,bool enable) +{ +if (!smu_feature_is_supported (smu,FEATURE_DPM_UVD_BIT )) +return 0 ; + +if (enable ==smu_feature_is_enabled (smu,FEATURE_DPM_UVD_BIT )) +return 0 ; + +return smu_feature_set_enabled (smu,FEATURE_DPM_UVD_BIT , enable); +} + +static int vega20_dpm_set_vce_enable (struct smu_context *smu,bool enable) +{ +if (!smu_feature_is_supported (smu,FEATURE_DPM_VCE_BIT )) +return 0 ; + +if (enable ==smu_feature_is_enabled (smu,FEATURE_DPM_VCE_BIT )) +return 0 ; + +return smu_feature_set_enabled (smu,FEATURE_DPM_VCE_BIT , enable); +} +static int vega20_get_enabled_smc_features (struct smu_context *smu,uint64_t *features_enabled) {
@@ -2775,6 +2797,8 @@ static const struct pptable_funcs vega20_ppt_funcs = { .update_specified_od8_value = vega20_update_specified_od8_value, .set_od_percentage = vega20_set_od_percentage, .od_edit_dpm_table = vega20_odn_edit_dpm_table, + .dpm_set_uvd_enable = vega20_dpm_set_uvd_enable, + .dpm_set_vce_enable = vega20_dpm_set_vce_enable, .pre_display_config_changed = vega20_pre_display_config_changed, .display_config_changed = vega20_display_config_changed, .apply_clocks_adjust_rules = vega20_apply_clocks_adjust_rules,
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 160/459 drm/amd/powerplay: move the function of read_sensor to asic file
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
The read_sensor functions has asic related parts code, so move them to asic file to implement.
--- .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 4 ++++ drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 12 ++++------ drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 23 +++++++++++++++++++ 3 files changed, 31 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +4 -0
@@ -456,6 +456,8 @@ struct pptable_funcs {int (*force_performance_level)(struct smu_context *smu,enum amd_dpm_forced_level level);int (*dpm_set_uvd_enable)(struct smu_context *smu,bool enable);int (*dpm_set_vce_enable)(struct smu_context *smu,bool enable); +int (*read_sensor)(struct smu_context *smu,enum amd_pp_sensors sensor, +void *data,uint32_t *size);int (*pre_display_config_changed)(struct smu_context *smu);int (*display_config_changed)(struct smu_context *smu);int (*apply_clocks_adjust_rules)(struct smu_context *smu);
@@ -660,6 +662,8 @@ struct smu_funcs ((smu)->funcs->start_thermal_control? (smu)->funcs->start_thermal_control((smu)) : 0)#define smu_read_sensor (smu, sensor, data, size) \ ((smu)->funcs->read_sensor? (smu)->funcs->read_sensor((smu), (sensor), (data), (size)) : 0) +#define smu_asic_read_sensor (smu, sensor, data, size) \ + ((smu)->ppt_funcs->read_sensor? (smu)->ppt_funcs->read_sensor((smu), (sensor), (data), (size)) : 0)#define smu_get_power_profile_mode (smu, buf) \ ((smu)->ppt_funcs->get_power_profile_mode ? (smu)->ppt_funcs->get_power_profile_mode((smu), buf) : 0)#define smu_set_power_profile_mode (smu, param, param_size) \
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +4 -8
@@ -1381,14 +1381,6 @@ static int smu_v11_0_read_sensor(struct smu_context *smu, ret =smu_v11_0_get_gfx_vdd (smu, (uint32_t *)data); *size =4 ;break ; -case AMDGPU_PP_SENSOR_UVD_POWER : - *(uint32_t *)data =smu_feature_is_enabled (smu,FEATURE_DPM_UVD_BIT ) ?1 :0 ; - *size =4 ; -break ; -case AMDGPU_PP_SENSOR_VCE_POWER : - *(uint32_t *)data =smu_feature_is_enabled (smu,FEATURE_DPM_VCE_BIT ) ?1 :0 ; - *size =4 ; -break ;case AMDGPU_PP_SENSOR_MIN_FAN_RPM : *(uint32_t *)data =0 ; *size =4 ;
@@ -1402,6 +1394,10 @@ static int smu_v11_0_read_sensor(struct smu_context *smu,break ; } +/* try get sensor data by asic */ +if (ret) + ret =smu_asic_read_sensor (smu, sensor, data, size); +if (ret) *size =0 ;
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +23 -0
@@ -2772,6 +2772,28 @@ static int vega20_set_ppfeature_status(struct smu_context *smu, uint64_t new_ppfreturn 0 ; } +static int vega20_read_sensor (struct smu_context *smu, +enum amd_pp_sensors sensor, +void *data,uint32_t *size) +{ +int ret =0 ; + +switch (sensor) { +case AMDGPU_PP_SENSOR_UVD_POWER : + *(uint32_t *)data =smu_feature_is_enabled (smu,FEATURE_DPM_UVD_BIT ) ?1 :0 ; + *size =4 ; +break ; +case AMDGPU_PP_SENSOR_VCE_POWER : + *(uint32_t *)data =smu_feature_is_enabled (smu,FEATURE_DPM_VCE_BIT ) ?1 :0 ; + *size =4 ; +break ; +default : +return -EINVAL ; + } + +return ret; +} +static const struct pptable_funcs vega20_ppt_funcs = { .alloc_dpm_context = vega20_allocate_dpm_context, .store_powerplay_table = vega20_store_powerplay_table,
@@ -2799,6 +2821,7 @@ static const struct pptable_funcs vega20_ppt_funcs = { .od_edit_dpm_table = vega20_odn_edit_dpm_table, .dpm_set_uvd_enable = vega20_dpm_set_uvd_enable, .dpm_set_vce_enable = vega20_dpm_set_vce_enable, + .read_sensor = vega20_read_sensor, .pre_display_config_changed = vega20_pre_display_config_changed, .display_config_changed = vega20_display_config_changed, .apply_clocks_adjust_rules = vega20_apply_clocks_adjust_rules,
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 161/459 drm/amd/powerplay: move the function of is_dpm_running to asic file
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
the function os is_dpm_running is aisc related function, so move them to asic file.
--- .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 4 ++-- drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 22 ------------------- drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 22 +++++++++++++++++++ 3 files changed, 24 insertions(+), 24 deletions(-)
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +2 -2
@@ -474,6 +474,7 @@ struct pptable_funcs {int (*set_cpu_power_state)(struct smu_context *smu);int (*set_ppfeature_status)(struct smu_context *smu,uint64_t ppfeatures);int (*get_ppfeature_status)(struct smu_context *smu,char *buf); +bool (*is_dpm_running)(struct smu_context *smu); };struct smu_funcs
@@ -505,7 +506,6 @@ struct smu_funcsint (*init_display)(struct smu_context *smu);int (*set_allowed_mask)(struct smu_context *smu);int (*get_enabled_mask)(struct smu_context *smu,uint32_t *feature_mask,uint32_t num); -bool (*is_dpm_running)(struct smu_context *smu);int (*update_feature_enable_state)(struct smu_context *smu,uint32_t feature_id,bool enabled);int (*notify_display_change)(struct smu_context *smu);int (*get_power_limit)(struct smu_context *smu,uint32_t *limit,bool def);
@@ -623,7 +623,7 @@ struct smu_funcs#define smu_feature_get_enabled_mask (smu, mask, num) \ ((smu)->funcs->get_enabled_mask? (smu)->funcs->get_enabled_mask((smu), (mask), (num)) : 0)#define smu_is_dpm_running (smu) \ - ((smu)->funcs->is_dpm_running ? (smu)->funcs->is_dpm_running((smu)) : 0) + ((smu)->ppt_funcs->is_dpm_running ? (smu)->ppt_funcs->is_dpm_running((smu)) : 0)#define smu_feature_update_enable_state (smu, feature_id, enabled) \ ((smu)->funcs->update_feature_enable_state? (smu)->funcs->update_feature_enable_state((smu), (feature_id), (enabled)) : 0)#define smu_notify_display_change (smu) \
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0 -22
@@ -52,16 +52,6 @@ MODULE_FIRMWARE("amdgpu/navi10_smc.bin");#define SMU11_TEMPERATURE_UNITS_PER_CENTIGRADES 1000#define SMU11_VOLTAGE_SCALE 4 -#define SMC_DPM_FEATURE (FEATURE_DPM_PREFETCHER_MASK | \ - FEATURE_DPM_GFXCLK_MASK | \ - FEATURE_DPM_UCLK_MASK | \ - FEATURE_DPM_SOCCLK_MASK | \ - FEATURE_DPM_UVD_MASK | \ - FEATURE_DPM_VCE_MASK | \ - FEATURE_DPM_MP0CLK_MASK | \ - FEATURE_DPM_LINK_MASK | \ - FEATURE_DPM_DCEFCLK_MASK) -static int smu_v11_0_send_msg_without_waiting (struct smu_context *smu,uint16_t msg) {
@@ -848,17 +838,6 @@ static int smu_v11_0_get_enabled_mask(struct smu_context *smu,return ret; } -static bool smu_v11_0_is_dpm_running (struct smu_context *smu) -{ -int ret =0 ; -uint32_t feature_mask[2 ]; -unsigned long feature_enabled; - ret =smu_v11_0_get_enabled_mask (smu, feature_mask,2 ); - feature_enabled = (unsigned long )((uint64_t )feature_mask[0 ] | - ((uint64_t )feature_mask[1 ] <<32 )); -return !!(feature_enabled &SMC_DPM_FEATURE ); -} -static int smu_v11_0_system_features_control (struct smu_context *smu,bool en) {
@@ -1875,7 +1854,6 @@ static const struct smu_funcs smu_v11_0_funcs = { .init_display = smu_v11_0_init_display, .set_allowed_mask = smu_v11_0_set_allowed_mask, .get_enabled_mask = smu_v11_0_get_enabled_mask, - .is_dpm_running = smu_v11_0_is_dpm_running, .system_features_control = smu_v11_0_system_features_control, .update_feature_enable_state = smu_v11_0_update_feature_enable_state, .notify_display_change = smu_v11_0_notify_display_change,
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +22 -0
@@ -43,6 +43,16 @@#define MSG_MAP (msg) \ [SMU_MSG_##msg] = PPSMC_MSG_##msg +#define SMC_DPM_FEATURE (FEATURE_DPM_PREFETCHER_MASK | \ + FEATURE_DPM_GFXCLK_MASK | \ + FEATURE_DPM_UCLK_MASK | \ + FEATURE_DPM_SOCCLK_MASK | \ + FEATURE_DPM_UVD_MASK | \ + FEATURE_DPM_VCE_MASK | \ + FEATURE_DPM_MP0CLK_MASK | \ + FEATURE_DPM_LINK_MASK | \ + FEATURE_DPM_DCEFCLK_MASK) +static int vega20_message_map[SMU_MSG_MAX_COUNT ] = {MSG_MAP (TestMessage),MSG_MAP (GetSmuVersion),
@@ -2794,6 +2804,17 @@ static int vega20_read_sensor(struct smu_context *smu,return ret; } +static bool vega20_is_dpm_running (struct smu_context *smu) +{ +int ret =0 ; +uint32_t feature_mask[2 ]; +unsigned long feature_enabled; + ret =smu_feature_get_enabled_mask (smu, feature_mask,2 ); + feature_enabled = (unsigned long )((uint64_t )feature_mask[0 ] | + ((uint64_t )feature_mask[1 ] <<32 )); +return !!(feature_enabled &SMC_DPM_FEATURE ); +} +static const struct pptable_funcs vega20_ppt_funcs = { .alloc_dpm_context = vega20_allocate_dpm_context, .store_powerplay_table = vega20_store_powerplay_table,
@@ -2832,6 +2853,7 @@ static const struct pptable_funcs vega20_ppt_funcs = { .get_profiling_clk_mask = vega20_get_profiling_clk_mask, .set_ppfeature_status = vega20_set_ppfeature_status, .get_ppfeature_status = vega20_get_ppfeature_status, + .is_dpm_running = vega20_is_dpm_running, };void vega20_set_ppt_funcs (struct smu_context *smu)
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 162/459 drm/amd/powerplay: add smu11 smu_if_version check for navi10
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
add smu11 fw version check for navi10
--- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +1 -0
@@ -305,4 +305,5 @@ static const struct pptable_funcs navi10_ppt_funcs = {void navi10_set_ppt_funcs (struct smu_context *smu) { smu->ppt_funcs = &navi10_ppt_funcs; + smu->smc_if_version =SMU11_DRIVER_IF_VERSION ; }
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 163/459 drm/amd/powerplay: implement smc firmware v2.1 for smu11
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
1.add smc_firmware_header_v2_1 hfirmware support, support more pptable in smc firmware. 2.optimization current pptable load framework.
3.rename read_pptable_from_vbios with setup_pptable.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h | 13 +++ drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 2 +- .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 6 +- drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 94 ++++++++++++++----- 4 files changed, 85 insertions(+), 30 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +13 -0
@@ -56,6 +56,19 @@ struct smc_firmware_header_v2_0 {uint32_t ppt_size_bytes;/* soft pptable size */ }; +struct smc_soft_pptable_entry { +uint32_t id; +uint32_t ppt_offset_bytes; +uint32_t ppt_size_bytes; +}; + +/* version_major=2, version_minor=1 */ +struct smc_firmware_header_v2_1 { +struct smc_firmware_header_v1_0 v1_0; +uint32_t pptable_count; +uint32_t pptable_entry_offset; +}; +/* version_major=1, version_minor=0 */ struct psp_firmware_header_v1_0 {struct common_firmware_header header;
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +1 -1
@@ -633,7 +633,7 @@ static int smu_smc_table_hw_init(struct smu_context *smu,if (ret)return ret; - ret =smu_read_pptable_from_vbios (smu); + ret =smu_setup_pptable (smu);if (ret)return ret;
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +3 -3
@@ -486,7 +486,7 @@ struct smu_funcsint (*fini_power)(struct smu_context *smu);int (*load_microcode)(struct smu_context *smu);int (*check_fw_status)(struct smu_context *smu); -int (*read_pptable_from_vbios)(struct smu_context *smu); +int (*setup_pptable)(struct smu_context *smu);int (*get_vbios_bootup_values)(struct smu_context *smu);int (*get_clk_info_from_vbios)(struct smu_context *smu);int (*check_pptable)(struct smu_context *smu);
@@ -570,8 +570,8 @@ struct smu_funcs ((smu)->funcs->load_microcode ? (smu)->funcs->load_microcode((smu)) : 0)#define smu_check_fw_status (smu) \ ((smu)->funcs->check_fw_status ? (smu)->funcs->check_fw_status((smu)) : 0) -#define smu_read_pptable_from_vbios (smu) \ - ((smu)->funcs->read_pptable_from_vbios ? (smu)->funcs->read_pptable_from_vbios((smu)) : 0) +#define smu_setup_pptable (smu) \ + ((smu)->funcs->setup_pptable ? (smu)->funcs->setup_pptable((smu)) : 0)#define smu_get_vbios_bootup_values (smu) \ ((smu)->funcs->get_vbios_bootup_values ? (smu)->funcs->get_vbios_bootup_values((smu)) : 0)#define smu_get_clk_info_from_vbios (smu) \
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +68 -26
133 lines not on this page · raw message
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 164/459 drm/amd/powerplay: remove duplicate code from smu hw init
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
remove duplicate code (un-used) in smu
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +0 -4
@@ -637,10 +637,6 @@ static int smu_smc_table_hw_init(struct smu_context *smu,if (ret)return ret; - ret =smu_get_clk_info_from_vbios (smu); -if (ret) -return ret; -/* * check if the format_revision in vbios is up to pptable header * version, and the structure size is not 0.
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 165/459 drm/amd/powerplay: optimization feature mask function for asic
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
1.change function return value type: from "unallowed" to "allowed" 2.replace feature mask number with feature macro, the code will clear.
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 10 +++--- .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 6 ++-- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 22 +++++++++--- drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 36 ++++++++++++++++--- 4 files changed, 57 insertions(+), 17 deletions(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +5 -5
@@ -233,22 +233,22 @@ int smu_feature_init_dpm(struct smu_context *smu) {struct smu_feature *feature = &smu->smu_feature;int ret =0 ; -uint32_t unallowed_feature_mask[SMU_FEATURE_MAX /32 ]; +uint32_t allowed_feature_mask[SMU_FEATURE_MAX /32 ];if (!smu->pm_enabled)return ret;mutex_lock (&feature->mutex); -bitmap_fill (feature->allowed,SMU_FEATURE_MAX ); +bitmap_zero (feature->allowed,SMU_FEATURE_MAX );mutex_unlock (&feature->mutex); - ret =smu_get_unallowed_feature_mask (smu, unallowed_feature_mask, + ret =smu_get_allowed_feature_mask (smu, allowed_feature_mask,SMU_FEATURE_MAX /32 );if (ret)return ret;mutex_lock (&feature->mutex); -bitmap_andnot (feature->allowed, feature->allowed, - (unsigned long *)unallowed_feature_mask, +bitmap_or (feature->allowed, feature->allowed, + (unsigned long *)allowed_feature_mask, feature->feature_num);mutex_unlock (&feature->mutex);
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +3 -3
@@ -421,7 +421,7 @@ struct pptable_funcs {int (*append_powerplay_table)(struct smu_context *smu);int (*get_smu_msg_index)(struct smu_context *smu,uint32_t index);int (*run_afll_btc)(struct smu_context *smu); -int (*get_unallowed_feature_mask)(struct smu_context *smu,uint32_t *feature_mask,uint32_t num); +int (*get_allowed_feature_mask)(struct smu_context *smu,uint32_t *feature_mask,uint32_t num);enum amd_pm_state_type (*get_current_power_state)(struct smu_context *smu);int (*set_default_dpm_table)(struct smu_context *smu);int (*set_power_state)(struct smu_context *smu);
@@ -703,8 +703,8 @@ struct smu_funcs ((smu)->ppt_funcs? ((smu)->ppt_funcs->get_smu_msg_index? (smu)->ppt_funcs->get_smu_msg_index((smu), (msg)) : -EINVAL) : -EINVAL)#define smu_run_afll_btc (smu) \ ((smu)->ppt_funcs? ((smu)->ppt_funcs->run_afll_btc? (smu)->ppt_funcs->run_afll_btc((smu)) : 0) : 0) -#define smu_get_unallowed_feature_mask (smu, feature_mask, num) \ - ((smu)->ppt_funcs? ((smu)->ppt_funcs->get_unallowed_feature_mask? (smu)->ppt_funcs->get_unallowed_feature_mask((smu), (feature_mask), (num)) : 0) : 0) +#define smu_get_allowed_feature_mask (smu, feature_mask, num) \ + ((smu)->ppt_funcs? ((smu)->ppt_funcs->get_allowed_feature_mask? (smu)->ppt_funcs->get_allowed_feature_mask((smu), (feature_mask), (num)) : 0) : 0)#define smu_set_deep_sleep_dcefclk (smu, clk) \ ((smu)->funcs->set_deep_sleep_dcefclk ? (smu)->funcs->set_deep_sleep_dcefclk((smu), (clk)) : 0)#define smu_set_active_display_count (smu, count) \
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +18 -4
@@ -112,15 +112,29 @@ static int navi10_get_smu_msg_index(struct smu_context *smc, uint32_t index)return val; } +#define FEATURE_MASK (feature) (1UL << feature)static int -navi10_get_unallowed_feature_mask (struct smu_context *smu, +navi10_get_allowed_feature_mask (struct smu_context *smu,uint32_t *feature_mask,uint32_t num) {if (num >2 )return -EINVAL ; - feature_mask[0 ] =0xdc3f7f8c ; - feature_mask[1 ] =0xfffffcec ;/* bit32~bit63 is Unsupported */ +memset (feature_mask,0 ,sizeof (uint32_t ) * num); + + *(uint64_t *)feature_mask |=FEATURE_MASK (FEATURE_DPM_SOCCLK_BIT ) + |FEATURE_MASK (FEATURE_DPM_MP0CLK_BIT ) + |FEATURE_MASK (FEATURE_DPM_LINK_BIT ) + |FEATURE_MASK (FEATURE_GFX_ULV_BIT ) + |FEATURE_MASK (FEATURE_RSMU_SMN_CG_BIT ) + |FEATURE_MASK (FEATURE_PPT_BIT ) + |FEATURE_MASK (FEATURE_TDC_BIT ) + |FEATURE_MASK (FEATURE_GFX_EDC_BIT ) + |FEATURE_MASK (FEATURE_VR0HOT_BIT ) + |FEATURE_MASK (FEATURE_FAN_CONTROL_BIT ) + |FEATURE_MASK (FEATURE_THERMAL_BIT ) + |FEATURE_MASK (FEATURE_LED_DISPLAY_BIT ) + |FEATURE_MASK (FEATURE_MMHUB_PG );return 0 ; }
@@ -298,7 +312,7 @@ static const struct pptable_funcs navi10_ppt_funcs = { .check_powerplay_table = navi10_check_powerplay_table, .append_powerplay_table = navi10_append_powerplay_table, .get_smu_msg_index = navi10_get_smu_msg_index, - .get_unallowed_feature_mask = navi10_get_unallowed_feature_mask, + .get_allowed_feature_mask = navi10_get_allowed_feature_mask, .set_default_dpm_table = navi10_set_default_dpm_table, };
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +31 -5
@@ -402,16 +402,42 @@ static int vega20_run_btc_afll(struct smu_context *smu)return smu_send_smc_msg (smu, SMU_MSG_RunAfllBtc); } +#define FEATURE_MASK (feature) (1UL << feature)static int -vega20_get_unallowed_feature_mask (struct smu_context *smu, +vega20_get_allowed_feature_mask (struct smu_context *smu,uint32_t *feature_mask,uint32_t num) {if (num >2 )return -EINVAL ; - feature_mask[0 ] =0xE0041C00 ; - feature_mask[1 ] =0xFFFFFFFE ;/* bit32~bit63 is Unsupported */ - +memset (feature_mask,0 ,sizeof (uint32_t ) * num); + + *(uint64_t *)feature_mask |=FEATURE_MASK (FEATURE_DPM_PREFETCHER_BIT ) + |FEATURE_MASK (FEATURE_DPM_GFXCLK_BIT ) + |FEATURE_MASK (FEATURE_DPM_UCLK_BIT ) + |FEATURE_MASK (FEATURE_DPM_SOCCLK_BIT ) + |FEATURE_MASK (FEATURE_DPM_UVD_BIT ) + |FEATURE_MASK (FEATURE_DPM_VCE_BIT ) + |FEATURE_MASK (FEATURE_ULV_BIT ) + |FEATURE_MASK (FEATURE_DPM_MP0CLK_BIT ) + |FEATURE_MASK (FEATURE_DPM_LINK_BIT ) + |FEATURE_MASK (FEATURE_DPM_DCEFCLK_BIT ) + |FEATURE_MASK (FEATURE_PPT_BIT ) + |FEATURE_MASK (FEATURE_TDC_BIT ) + |FEATURE_MASK (FEATURE_THERMAL_BIT ) + |FEATURE_MASK (FEATURE_GFX_PER_CU_CG_BIT ) + |FEATURE_MASK (FEATURE_RM_BIT ) + |FEATURE_MASK (FEATURE_ACDC_BIT ) + |FEATURE_MASK (FEATURE_VR0HOT_BIT ) + |FEATURE_MASK (FEATURE_VR1HOT_BIT ) + |FEATURE_MASK (FEATURE_FW_CTF_BIT ) + |FEATURE_MASK (FEATURE_LED_DISPLAY_BIT ) + |FEATURE_MASK (FEATURE_FAN_CONTROL_BIT ) + |FEATURE_MASK (FEATURE_GFX_EDC_BIT ) + |FEATURE_MASK (FEATURE_GFXOFF_BIT ) + |FEATURE_MASK (FEATURE_CG_BIT ) + |FEATURE_MASK (FEATURE_DPM_FCLK_BIT ) + |FEATURE_MASK (FEATURE_XGMI_BIT );return 0 ; }
@@ -2822,7 +2848,7 @@ static const struct pptable_funcs vega20_ppt_funcs = { .append_powerplay_table = vega20_append_powerplay_table, .get_smu_msg_index = vega20_get_smu_msg_index, .run_afll_btc = vega20_run_btc_afll, - .get_unallowed_feature_mask = vega20_get_unallowed_feature_mask, + .get_allowed_feature_mask = vega20_get_allowed_feature_mask, .get_current_power_state = vega20_get_current_power_state, .set_default_dpm_table = vega20_set_default_dpm_table, .set_power_state = NULL,
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 166/459 drm/amd/powerplay: add allowed feature mask for navi10
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
add smu feature mask:
1.FEATURE_DPM_PREFETCHER_BIT
2.FEATURE_DPM_PREFETCHER_BIT
3.FEATURE_ATHUB_PG
--- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +5 -2
@@ -122,7 +122,9 @@ navi10_get_allowed_feature_mask(struct smu_context *smu,memset (feature_mask,0 ,sizeof (uint32_t ) * num); - *(uint64_t *)feature_mask |=FEATURE_MASK (FEATURE_DPM_SOCCLK_BIT ) + *(uint64_t *)feature_mask |=FEATURE_MASK (FEATURE_DPM_PREFETCHER_BIT ) + |FEATURE_MASK (FEATURE_DPM_GFXCLK_BIT ) + |FEATURE_MASK (FEATURE_DPM_SOCCLK_BIT ) |FEATURE_MASK (FEATURE_DPM_MP0CLK_BIT ) |FEATURE_MASK (FEATURE_DPM_LINK_BIT ) |FEATURE_MASK (FEATURE_GFX_ULV_BIT )
@@ -134,7 +136,8 @@ navi10_get_allowed_feature_mask(struct smu_context *smu, | FEATURE_MASK(FEATURE_FAN_CONTROL_BIT) |FEATURE_MASK (FEATURE_THERMAL_BIT ) |FEATURE_MASK (FEATURE_LED_DISPLAY_BIT ) - |FEATURE_MASK (FEATURE_MMHUB_PG ); + |FEATURE_MASK (FEATURE_MMHUB_PG ) + |FEATURE_MASK (FEATURE_ATHUB_PG );return 0 ; }
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 167/459 drm/amd: add gfxoff support on navi10
In reply to a message not in the archiveFrom: Kenneth Feng <[email protected]>
add the gfxoff interface to navi10,it's disabled by default.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c | 20 +++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h | 7 +++---- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 4 +++- .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 5 ++++- drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 16 +++++++++++++++ 5 files changed, 46 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c +20 -0
@@ -920,3 +920,23 @@ int amdgpu_dpm_get_mclk(struct amdgpu_device *adev, bool low)else return (adev)->powerplay.pp_funcs->get_mclk ((adev)->powerplay.pp_handle, (low)); } + +int amdgpu_dpm_set_powergating_by_smu (struct amdgpu_device *adev,uint32_t block_type,bool gate) +{ +int ret =0 ; +bool swsmu =is_support_sw_smu (adev); + +switch (block_type) { +case AMD_IP_BLOCK_TYPE_GFX : +if (swsmu) + ret =smu_gfx_off_control (&adev->smu, gate); +else + ret = ((adev)->powerplay.pp_funcs->set_powergating_by_smu ( + (adev)->powerplay.pp_handle, block_type, gate)); +break ; +default : +break ; + } + +return ret; +}
drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h +3 -4
@@ -355,10 +355,6 @@ enum amdgpu_pcie_gen { ((adev)->powerplay.pp_funcs->set_clockgating_by_smu (\ (adev)->powerplay.pp_handle, msg_id)) -#define amdgpu_dpm_set_powergating_by_smu (adev, block_type, gate) \ - ((adev)->powerplay.pp_funcs->set_powergating_by_smu(\ - (adev)->powerplay.pp_handle, block_type, gate)) -#define amdgpu_dpm_get_power_profile_mode (adev, buf) \ ((adev)->powerplay.pp_funcs->get_power_profile_mode(\ (adev)->powerplay.pp_handle, buf))
@@ -520,6 +516,9 @@ enum amdgpu_pcie_gen amdgpu_get_pcie_gen_support(struct amdgpu_device *adev,struct amd_vce_state *amdgpu_get_vce_clock_state (void *handle,u32 idx); +int amdgpu_dpm_set_powergating_by_smu (struct amdgpu_device *adev, +uint32_t block_type,bool gate); +extern int amdgpu_dpm_get_sclk (struct amdgpu_device *adev,bool low);extern int amdgpu_dpm_get_mclk (struct amdgpu_device *adev,bool low);
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +3 -1
@@ -547,7 +547,9 @@ void amdgpu_gfx_off_ctrl(struct amdgpu_device *adev, bool enable)if (!(adev->pm.pp_feature &PP_GFXOFF_MASK ))return ; -if (!adev->powerplay.pp_funcs || !adev->powerplay.pp_funcs->set_powergating_by_smu) +if (!is_support_sw_smu (adev) && + (!adev->powerplay.pp_funcs || + !adev->powerplay.pp_funcs->set_powergating_by_smu))return ;
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +4 -1
@@ -553,7 +553,7 @@ struct smu_funcsint (*set_fan_speed_percent)(struct smu_context *smu,uint32_t speed);int (*set_fan_speed_rpm)(struct smu_context *smu,uint32_t speed);int (*set_xgmi_pstate)(struct smu_context *smu,uint32_t pstate); - +int (*gfx_off_control)(struct smu_context *smu,bool enable); };#define smu_init_microcode (smu) \
@@ -592,6 +592,9 @@ struct smu_funcs ((smu)->funcs->set_tool_table_location ? (smu)->funcs->set_tool_table_location((smu)) : 0)#define smu_notify_memory_pool_location (smu) \ ((smu)->funcs->notify_memory_pool_location ? (smu)->funcs->notify_memory_pool_location((smu)) : 0) +#define smu_gfx_off_control (smu, enable) \ + ((smu)->funcs->gfx_off_control ? (smu)->funcs->gfx_off_control((smu), (enable)) : 0) +#define smu_write_watermarks_table (smu) \ ((smu)->funcs->write_watermarks_table ? (smu)->funcs->write_watermarks_table((smu)) : 0)#define smu_set_last_dcef_min_deep_sleep_clk (smu) \
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +16 -0
@@ -1547,6 +1547,21 @@ smu_v11_0_set_watermarks_for_clock_ranges(struct smu_context *smu, structreturn ret; } +static int smu_v11_0_gfx_off_control (struct smu_context *smu,bool enable) +{ +int ret =0 ; + +mutex_lock (&smu->mutex); +if (enable) + ret =smu_send_smc_msg (smu, SMU_MSG_AllowGfxOff); +else + ret =smu_send_smc_msg (smu, SMU_MSG_DisallowGfxOff); +mutex_unlock (&smu->mutex); + +return ret; +} + + static int smu_v11_0_get_clock_ranges(struct smu_context *smu, uint32_t *clock, PPCLK_e clock_select,
@@ -1919,6 +1934,7 @@ static const struct smu_funcs smu_v11_0_funcs = { .set_fan_speed_percent = smu_v11_0_set_fan_speed_percent, .set_fan_speed_rpm = smu_v11_0_set_fan_speed_rpm, .set_xgmi_pstate = smu_v11_0_set_xgmi_pstate, + .gfx_off_control = smu_v11_0_gfx_off_control, };void smu_v11_0_set_smu_funcs (struct smu_context *smu)
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 168/459 drm/amd/amdgpu: fw version check with gfxoff
In reply to a message not in the archiveFrom: Kenneth Feng <[email protected]>
1. check the firmware version when enabling gfxoff
2. overwrite the pptable to make sure gfxoff is really enabled on navi10
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 1 - drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 11 +++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +0 -1
@@ -331,7 +331,6 @@ static int smu_set_funcs(struct amdgpu_device *adev)switch (adev->asic_type) {case CHIP_VEGA20 :case CHIP_NAVI10 : - adev->pm.pp_feature &= ~PP_GFXOFF_MASK ;if (adev->pm.pp_feature &PP_OVERDRIVE_MASK ) smu->od_enabled = true;smu_v11_0_set_smu_funcs (smu);
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +11 -0
@@ -117,6 +117,8 @@ static int navi10_get_allowed_feature_mask(struct smu_context *smu, uint32_t *feature_mask, uint32_t num) { + struct amdgpu_device *adev = smu->adev; +if (num >2 )return -EINVAL ;
@@ -139,6 +141,10 @@ navi10_get_allowed_feature_mask(struct smu_context *smu, | FEATURE_MASK(FEATURE_MMHUB_PG) |FEATURE_MASK (FEATURE_ATHUB_PG ); +if (adev->pm.pp_feature &PP_GFXOFF_MASK ) + *(uint64_t *)feature_mask |=FEATURE_MASK (FEATURE_GFX_SS_BIT ) + |FEATURE_MASK (FEATURE_GFXOFF_BIT ); +return 0 ; }
@@ -149,6 +155,7 @@ static int navi10_check_powerplay_table(struct smu_context *smu)static int navi10_append_powerplay_table (struct smu_context *smu) { +struct amdgpu_device *adev = smu->adev;struct smu_table_context *table_context = &smu->smu_table;PPTable_t *smc_pptable = table_context->driver_pptable;struct atom_smc_dpm_info_v4_5 *smc_dpm_table;
@@ -234,6 +241,10 @@ static int navi10_append_powerplay_table(struct smu_context *smu)/* Mvdd Svi2 Div Ratio Setting */ smc_pptable->MvddRatio = smc_dpm_table->MvddRatio; +if (adev->pm.pp_feature &PP_GFXOFF_MASK ) + *(uint64_t *)smc_pptable->FeaturesToRun |=FEATURE_MASK (FEATURE_GFX_SS_BIT ) + |FEATURE_MASK (FEATURE_GFXOFF_BIT ); +return 0 ; }
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 169/459 drm/amd/powerplay: gfxoff-seperate the Vega20 case
In reply to a message not in the archiveFrom: Kenneth Feng <[email protected]>
seperate the Vega20 case from navi10 for gfxoff so that gfxoff won't be allowed on Vega20
--- drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +17 -6
@@ -1550,13 +1550,24 @@ smu_v11_0_set_watermarks_for_clock_ranges(struct smu_context *smu, structstatic int smu_v11_0_gfx_off_control (struct smu_context *smu,bool enable) {int ret =0 ; +struct amdgpu_device *adev = smu->adev; -mutex_lock (&smu->mutex); -if (enable) - ret =smu_send_smc_msg (smu, SMU_MSG_AllowGfxOff); -else - ret =smu_send_smc_msg (smu, SMU_MSG_DisallowGfxOff); -mutex_unlock (&smu->mutex); +switch (adev->asic_type) { +case CHIP_VEGA20 : +break ; +case CHIP_NAVI10 : +if (!(adev->pm.pp_feature &PP_GFXOFF_MASK )) +return 0 ; +mutex_lock (&smu->mutex); +if (enable) + ret =smu_send_smc_msg (smu, SMU_MSG_AllowGfxOff); +else + ret =smu_send_smc_msg (smu, SMU_MSG_DisallowGfxOff); +mutex_unlock (&smu->mutex); +break ; +default : +break ; + }return ret; }
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 170/459 drm/amd/powerplay: enable DCEFCLK dpm support
In reply to a message not in the archiveFrom: Kenneth Feng <[email protected]>
Enabale DCEFCLK dpm on navi10
--- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +2 -1
@@ -139,7 +139,8 @@ navi10_get_allowed_feature_mask(struct smu_context *smu, | FEATURE_MASK(FEATURE_THERMAL_BIT) |FEATURE_MASK (FEATURE_LED_DISPLAY_BIT ) |FEATURE_MASK (FEATURE_MMHUB_PG ) - |FEATURE_MASK (FEATURE_ATHUB_PG ); + |FEATURE_MASK (FEATURE_ATHUB_PG ) + |FEATURE_MASK (FEATURE_DPM_DCEFCLK_BIT );if (adev->pm.pp_feature &PP_GFXOFF_MASK ) *(uint64_t *)feature_mask |=FEATURE_MASK (FEATURE_GFX_SS_BIT )
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 171/459 drm/amdgpu: enable sw smu driver for navi10 by default
In reply to a message not in the archiveFrom: Hawking Zhang <[email protected]>
Navi10 will use sw smu driver for dynamic power managment, while vega20 could also use sw smu driver when amdgpu_dpm is set to 2
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 +++- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 11 +++++------ 2 files changed, 8 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +3 -1
@@ -251,7 +251,9 @@ module_param_string(lockup_timeout, amdgpu_lockup_timeout, sizeof(amdgpu_lockup_/** * DOC: dpm (int) -* Override for dynamic power management setting (1 = enable, 0 = disable). The default is -1 (auto). +* Override for dynamic power management setting +* (0 = disable, 1 = enable, 2 = enable sw smu driver for vega20) +* The default is -1 (auto). */ MODULE_PARM_DESC (dpm,"DPM support (1 = enable, 0 = disable, -1 = auto)" );module_param_named (dpm, amdgpu_dpm, int,0444 );
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +5 -6
@@ -168,13 +168,12 @@ int smu_update_table_with_arg(struct smu_context *smu, uint16_t table_id, uint16bool is_support_sw_smu (struct amdgpu_device *adev) { -if (amdgpu_dpm !=1 ) -return false; - -if (adev->asic_type >=CHIP_VEGA20 && adev->asic_type !=CHIP_RAVEN ) +if (adev->asic_type ==CHIP_VEGA20 ) +return (amdgpu_dpm ==2 ) ? true: false; +else if (adev->asic_type >=CHIP_NAVI10 )return true; - -return false; +else +return false; }int smu_sys_get_pp_table (struct smu_context *smu,void **table)
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 172/459 drm/amd/powerplay: introduce smu clk type to handle ppclk for each asic
In reply to a message not in the archiveFrom: Huang Rui <[email protected]>
This patch introduces new smu clk type, it's to handle the different ppclk defines for each asic with the same smu ip.
--- .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 21 +++++- drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h | 3 + drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 26 ++++++++ drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 66 ++++++++++--------- drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 32 ++++++++- 5 files changed, 113 insertions(+), 35 deletions(-)
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +20 -1
@@ -227,6 +227,22 @@ enum smu_message_type SMU_MSG_MAX_COUNT, }; +enum smu_clk_type +{ +SMU_GFXCLK , +SMU_VCLK , +SMU_DCLK , +SMU_ECLK , +SMU_SOCCLK , +SMU_UCLK , +SMU_DCEFCLK , +SMU_DISPCLK , +SMU_PIXCLK , +SMU_PHYCLK , +SMU_FCLK , +SMU_CLK_COUNT , +}; +enum smu_memory_pool_size {SMU_MEMORY_POOL_SIZE_ZERO =0 ,
@@ -420,6 +436,7 @@ struct pptable_funcs {int (*check_powerplay_table)(struct smu_context *smu);int (*append_powerplay_table)(struct smu_context *smu);int (*get_smu_msg_index)(struct smu_context *smu,uint32_t index); +int (*get_smu_clk_index)(struct smu_context *smu,uint32_t index);int (*run_afll_btc)(struct smu_context *smu);int (*get_allowed_feature_mask)(struct smu_context *smu,uint32_t *feature_mask,uint32_t num);enum amd_pm_state_type (*get_current_power_state)(struct smu_context *smu);
@@ -510,7 +527,7 @@ struct smu_funcsint (*notify_display_change)(struct smu_context *smu);int (*get_power_limit)(struct smu_context *smu,uint32_t *limit,bool def);int (*set_power_limit)(struct smu_context *smu,uint32_t n); -int (*get_current_clk_freq)(struct smu_context *smu,uint32_t clk_id,uint32_t *value); +int (*get_current_clk_freq)(struct smu_context *smu,enum smu_clk_type clk_id,uint32_t *value);int (*init_max_sustainable_clocks)(struct smu_context *smu);int (*start_thermal_control)(struct smu_context *smu); int (*read_sensor)(struct smu_context *smu, enum amd_pp_sensors sensor,
@@ -704,6 +721,8 @@ struct smu_funcs#define smu_msg_get_index (smu, msg) \ ((smu)->ppt_funcs? ((smu)->ppt_funcs->get_smu_msg_index? (smu)->ppt_funcs->get_smu_msg_index((smu), (msg)) : -EINVAL) : -EINVAL) +#define smu_clk_get_index (smu, msg) \ + ((smu)->ppt_funcs? ((smu)->ppt_funcs->get_smu_clk_index? (smu)->ppt_funcs->get_smu_clk_index((smu), (msg)) : -EINVAL) : -EINVAL)#define smu_run_afll_btc (smu) \ ((smu)->ppt_funcs? ((smu)->ppt_funcs->run_afll_btc? (smu)->ppt_funcs->run_afll_btc((smu)) : 0) : 0)#define smu_get_allowed_feature_mask (smu, feature_mask, num) \
drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h +3 -0
@@ -40,6 +40,9 @@#define TEMP_RANGE_MIN (0)#define TEMP_RANGE_MAX (80 * 1000) +#define CLK_MAP (clk, index) \ + [SMU_##clk] = index +struct smu_11_0_max_sustainable_clocks {uint32_t display_clock;uint32_t phy_clock;
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +26 -0
@@ -99,6 +99,18 @@ static int navi10_message_map[SMU_MSG_MAX_COUNT] = { MSG_MAP(PrepareMp1ForShutdown, PPSMC_MSG_PrepareMp1ForShutdown), }; +static int navi10_clk_map[SMU_CLK_COUNT ] = { +CLK_MAP (GFXCLK ,PPCLK_GFXCLK ), +CLK_MAP (SOCCLK ,PPCLK_SOCCLK ), +CLK_MAP (UCLK ,PPCLK_UCLK ), +CLK_MAP (DCLK ,PPCLK_DCLK ), +CLK_MAP (VCLK ,PPCLK_VCLK ), +CLK_MAP (DCEFCLK ,PPCLK_DCEFCLK ), +CLK_MAP (DISPCLK ,PPCLK_DISPCLK ), +CLK_MAP (PIXCLK ,PPCLK_PIXCLK ), +CLK_MAP (PHYCLK ,PPCLK_PHYCLK ), +}; +static int navi10_get_smu_msg_index (struct smu_context *smc,uint32_t index) {int val;
@@ -112,6 +124,19 @@ static int navi10_get_smu_msg_index(struct smu_context *smc, uint32_t index)return val; } +static int navi10_get_smu_clk_index (struct smu_context *smc,uint32_t index) +{ +int val; +if (index >=SMU_CLK_COUNT ) +return -EINVAL ; + + val = navi10_clk_map[index]; +if (val >=PPCLK_COUNT ) +return -EINVAL ; + +return val; +} +#define FEATURE_MASK (feature) (1UL << feature) static int navi10_get_allowed_feature_mask(struct smu_context *smu,
@@ -327,6 +352,7 @@ static const struct pptable_funcs navi10_ppt_funcs = { .check_powerplay_table = navi10_check_powerplay_table, .append_powerplay_table = navi10_append_powerplay_table, .get_smu_msg_index = navi10_get_smu_msg_index, + .get_smu_clk_index = navi10_get_smu_clk_index, .get_allowed_feature_mask = navi10_get_allowed_feature_mask, .set_default_dpm_table = navi10_set_default_dpm_table, };
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +34 -32
205 lines not on this page · raw message
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +30 -2
@@ -139,6 +139,33 @@ static int vega20_message_map[SMU_MSG_MAX_COUNT] = { MSG_MAP(GetAVFSVoltageByDpm), }; +static int vega20_clk_map[SMU_CLK_COUNT ] = { +CLK_MAP (GFXCLK ,PPCLK_GFXCLK ), +CLK_MAP (VCLK ,PPCLK_VCLK ), +CLK_MAP (DCLK ,PPCLK_DCLK ), +CLK_MAP (ECLK ,PPCLK_ECLK ), +CLK_MAP (SOCCLK ,PPCLK_SOCCLK ), +CLK_MAP (UCLK ,PPCLK_UCLK ), +CLK_MAP (DCEFCLK ,PPCLK_DCEFCLK ), +CLK_MAP (DISPCLK ,PPCLK_DISPCLK ), +CLK_MAP (PIXCLK ,PPCLK_PIXCLK ), +CLK_MAP (PHYCLK ,PPCLK_PHYCLK ), +CLK_MAP (FCLK ,PPCLK_FCLK ), +}; + +static int vega20_get_smu_clk_index (struct smu_context *smc,uint32_t index) +{ +int val; +if (index >=SMU_CLK_COUNT ) +return -EINVAL ; + + val = vega20_clk_map[index]; +if (val >=PPCLK_COUNT ) +return -EINVAL ; + +return val; +} +static int vega20_get_smu_msg_index (struct smu_context *smc,uint32_t index) {int val;
@@ -776,7 +803,7 @@ static int vega20_print_clk_levels(struct smu_context *smu,switch (type) {case PP_SCLK : - ret =smu_get_current_clk_freq (smu,PPCLK_GFXCLK , &now); + ret =smu_get_current_clk_freq (smu,SMU_GFXCLK , &now);if (ret) {pr_err ("Attempt to get current gfx clk Failed!" );return ret;
@@ -797,7 +824,7 @@ static int vega20_print_clk_levels(struct smu_context *smu,break ;case PP_MCLK : - ret =smu_get_current_clk_freq (smu,PPCLK_UCLK , &now); + ret =smu_get_current_clk_freq (smu,SMU_UCLK , &now);if (ret) {pr_err ("Attempt to get current mclk Failed!" );return ret;
@@ -2847,6 +2874,7 @@ static const struct pptable_funcs vega20_ppt_funcs = { .check_powerplay_table = vega20_check_powerplay_table, .append_powerplay_table = vega20_append_powerplay_table, .get_smu_msg_index = vega20_get_smu_msg_index, + .get_smu_clk_index = vega20_get_smu_clk_index, .run_afll_btc = vega20_run_btc_afll, .get_allowed_feature_mask = vega20_get_allowed_feature_mask, .get_current_power_state = vega20_get_current_power_state,
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 173/459 drm/amd/powerplay: introduce smu feature type to handle feature mask for each asic
In reply to a message not in the archiveFrom: Huang Rui <[email protected]>
This patch introduces new smu feature type, it's to handle the different feature mask defines for each asic with the same smu ip.
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 22 +++- .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 72 ++++++++++- .../amd/powerplay/inc/smu_11_0_driver_if.h | 4 +- drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h | 3 + drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 63 ++++++++- drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 26 ++-- drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 122 ++++++++++++------ 7 files changed, 251 insertions(+), 61 deletions(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +18 -4
@@ -254,11 +254,14 @@ int smu_feature_init_dpm(struct smu_context *smu)return ret; } -int smu_feature_is_enabled (struct smu_context *smu,int feature_id) +int smu_feature_is_enabled (struct smu_context *smu,enum smu_feature_mask mask) {struct smu_feature *feature = &smu->smu_feature; +uint32_t feature_id;int ret =0 ; + feature_id =smu_feature_get_index (smu, mask); +WARN_ON (feature_id > feature->feature_num);mutex_lock (&feature->mutex);
@@ -268,11 +271,15 @@ int smu_feature_is_enabled(struct smu_context *smu, int feature_id)return ret; } -int smu_feature_set_enabled (struct smu_context *smu,int feature_id,bool enable) +int smu_feature_set_enabled (struct smu_context *smu,enum smu_feature_mask mask, +bool enable) {struct smu_feature *feature = &smu->smu_feature; +uint32_t feature_id;int ret =0 ; + feature_id =smu_feature_get_index (smu, mask); +WARN_ON (feature_id > feature->feature_num);mutex_lock (&feature->mutex);
@@ -291,11 +298,14 @@ int smu_feature_set_enabled(struct smu_context *smu, int feature_id, bool enablereturn ret; } -int smu_feature_is_supported (struct smu_context *smu,int feature_id) +int smu_feature_is_supported (struct smu_context *smu,enum smu_feature_mask mask) {struct smu_feature *feature = &smu->smu_feature; +uint32_t feature_id;int ret =0 ; + feature_id =smu_feature_get_index (smu, mask); +WARN_ON (feature_id > feature->feature_num);mutex_lock (&feature->mutex);
@@ -305,12 +315,16 @@ int smu_feature_is_supported(struct smu_context *smu, int feature_id)return ret; } -int smu_feature_set_supported (struct smu_context *smu,int feature_id, +int smu_feature_set_supported (struct smu_context *smu, +enum smu_feature_mask mask,bool enable) {struct smu_feature *feature = &smu->smu_feature; +uint32_t feature_id;int ret =0 ; + feature_id =smu_feature_get_index (smu, mask); +WARN_ON (feature_id > feature->feature_num);mutex_lock (&feature->mutex);
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +68 -4
96 lines not on this page · raw message
drivers/gpu/drm/amd/powerplay/inc/smu_11_0_driver_if.h +2 -2
@@ -90,8 +90,8 @@#define FEATURE_OUT_OF_BAND_MONITOR_BIT 38#define FEATURE_TEMP_DEPENDENT_VMIN_BIT 39 -#define FEATURE_MMHUB_PG 40 -#define FEATURE_ATHUB_PG 41 +#define FEATURE_MMHUB_PG_BIT 40 +#define FEATURE_ATHUB_PG_BIT 41#define FEATURE_SPARE_42_BIT 42#define FEATURE_SPARE_43_BIT 43#define FEATURE_SPARE_44_BIT 44
drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h +3 -0
@@ -43,6 +43,9 @@#define CLK_MAP (clk, index) \ [SMU_##clk] = index +#define FEA_MAP (fea) \ + [SMU_FEATURE_##fea##_BIT] = FEATURE_##fea##_BIT +struct smu_11_0_max_sustainable_clocks {uint32_t display_clock;uint32_t phy_clock;
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +61 -2
87 lines not on this page · raw message
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +13 -13
@@ -912,7 +912,7 @@ static int smu_v11_0_notify_display_change(struct smu_context *smu)if (!smu->pm_enabled)return ret; -if (smu_feature_is_enabled (smu,FEATURE_DPM_UCLK_BIT )) +if (smu_feature_is_enabled (smu,SMU_FEATURE_DPM_UCLK_BIT )) ret =smu_send_smc_msg_with_param (smu, SMU_MSG_SetUclkFastSwitch,1 );return ret;
@@ -969,7 +969,7 @@ static int smu_v11_0_init_max_sustainable_clocks(struct smu_context *smu) max_sustainable_clocks->phy_clock =0xFFFFFFFF ; max_sustainable_clocks->pixel_clock =0xFFFFFFFF ; -if (smu_feature_is_enabled (smu,FEATURE_DPM_UCLK_BIT )) { +if (smu_feature_is_enabled (smu,SMU_FEATURE_DPM_UCLK_BIT )) { ret =smu_v11_0_get_max_sustainable_clock (smu, &(max_sustainable_clocks->uclock),SMU_UCLK );
@@ -980,7 +980,7 @@ static int smu_v11_0_init_max_sustainable_clocks(struct smu_context *smu) } } -if (smu_feature_is_enabled (smu,FEATURE_DPM_SOCCLK_BIT )) { +if (smu_feature_is_enabled (smu,SMU_FEATURE_DPM_SOCCLK_BIT )) { ret =smu_v11_0_get_max_sustainable_clock (smu, &(max_sustainable_clocks->soc_clock),SMU_SOCCLK );
@@ -991,7 +991,7 @@ static int smu_v11_0_init_max_sustainable_clocks(struct smu_context *smu) } } -if (smu_feature_is_enabled (smu,FEATURE_DPM_DCEFCLK_BIT )) { +if (smu_feature_is_enabled (smu,SMU_FEATURE_DPM_DCEFCLK_BIT )) { ret =smu_v11_0_get_max_sustainable_clock (smu, &(max_sustainable_clocks->dcef_clock),SMU_DCEFCLK );
@@ -1076,7 +1076,7 @@ static int smu_v11_0_set_power_limit(struct smu_context *smu, uint32_t n) max_power_limit /=100 ; } -if (smu_feature_is_enabled (smu,FEATURE_PPT_BIT )) +if (smu_feature_is_enabled (smu,SMU_FEATURE_PPT_BIT )) ret =smu_send_smc_msg_with_param (smu, SMU_MSG_SetPptLimit, n);if (ret) {pr_err ("[%s] Set power limit Failed!" , __func__);
@@ -1439,7 +1439,7 @@ smu_v11_0_display_clock_voltage_request(struct smu_context *smu,if (!smu->pm_enabled)return -EINVAL ; -if (smu_feature_is_enabled (smu,FEATURE_DPM_DCEFCLK_BIT )) { +if (smu_feature_is_enabled (smu,SMU_FEATURE_DPM_DCEFCLK_BIT )) {switch (clk_type) {case amd_pp_dcef_clock: clk_select =SMU_DCEFCLK ;
@@ -1539,8 +1539,8 @@ smu_v11_0_set_watermarks_for_clock_ranges(struct smu_context *smu, structWatermarks_t *table = watermarks->cpu_addr;if (!smu->disable_watermark && -smu_feature_is_enabled (smu,FEATURE_DPM_DCEFCLK_BIT ) && -smu_feature_is_enabled (smu,FEATURE_DPM_SOCCLK_BIT )) { +smu_feature_is_enabled (smu,SMU_FEATURE_DPM_DCEFCLK_BIT ) && +smu_feature_is_enabled (smu,SMU_FEATURE_DPM_SOCCLK_BIT )) {smu_v11_0_set_watermarks_table (smu, table, clock_ranges); smu->watermarks_bitmap |=WATERMARKS_EXIST ; smu->watermarks_bitmap &= ~WATERMARKS_LOADED ;
@@ -1608,7 +1608,7 @@ static uint32_t smu_v11_0_dpm_get_sclk(struct smu_context *smu, bool low)uint32_t gfx_clk;int ret; -if (!smu_feature_is_enabled (smu,FEATURE_DPM_GFXCLK_BIT )) { +if (!smu_feature_is_enabled (smu,SMU_FEATURE_DPM_GFXCLK_BIT )) {pr_err ("[GetSclks]: gfxclk dpm not enabled!\n" );return -EPERM ; }
@@ -1635,7 +1635,7 @@ static uint32_t smu_v11_0_dpm_get_mclk(struct smu_context *smu, bool low)uint32_t mem_clk;int ret; -if (!smu_feature_is_enabled (smu,FEATURE_DPM_UCLK_BIT )) { +if (!smu_feature_is_enabled (smu,SMU_FEATURE_DPM_UCLK_BIT )) {pr_err ("[GetMclks]: memclk dpm not enabled!\n" );return -EPERM ; }
@@ -1743,7 +1743,7 @@ static int smu_v11_0_get_current_rpm(struct smu_context *smu,static uint32_t smu_v11_0_get_fan_control_mode (struct smu_context *smu) { -if (!smu_feature_is_enabled (smu,FEATURE_FAN_CONTROL_BIT )) +if (!smu_feature_is_enabled (smu,SMU_FEATURE_FAN_CONTROL_BIT ))return AMD_FAN_CTRL_MANUAL ;else return AMD_FAN_CTRL_AUTO ;
@@ -1770,10 +1770,10 @@ smu_v11_0_smc_fan_control(struct smu_context *smu, bool start) {int ret =0 ; -if (smu_feature_is_supported (smu,FEATURE_FAN_CONTROL_BIT )) +if (smu_feature_is_supported (smu,SMU_FEATURE_FAN_CONTROL_BIT ))return 0 ; - ret =smu_feature_set_enabled (smu,FEATURE_FAN_CONTROL_BIT , start); + ret =smu_feature_set_enabled (smu,SMU_FEATURE_FAN_CONTROL_BIT , start);if (ret)pr_err ("[%s]%s smc FAN CONTROL feature failed!" , __func__, (start ?"Start" :"Stop" ));
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +86 -36
320 lines not on this page · raw message
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 174/459 drm/amd/powerplay: introduce smu table id type to handle the smu table for each asic
In reply to a message not in the archiveFrom: Huang Rui <[email protected]>
This patch introduces new smu table type, it's to handle the different smu table defines for each asic with the same smu ip.
--- .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 20 +++++++++++++ drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h | 3 ++ drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 29 +++++++++++++++++++ drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 27 +++++++++++++++++ 4 files changed, 79 insertions(+)
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +20 -0
@@ -366,6 +366,23 @@ struct smu_bios_boot_up_valuesuint32_t pp_table_id; }; +enum smu_table_id +{ +SMU_TABLE_PPTABLE =0 , +SMU_TABLE_WATERMARKS , +SMU_TABLE_AVFS , +SMU_TABLE_AVFS_PSM_DEBUG , +SMU_TABLE_AVFS_FUSE_OVERRIDE , +SMU_TABLE_PMSTATUSLOG , +SMU_TABLE_SMU_METRICS , +SMU_TABLE_DRIVER_SMU_CONFIG , +SMU_TABLE_ACTIVITY_MONITOR_COEFF , +SMU_TABLE_OVERDRIVE , +SMU_TABLE_I2C_COMMANDS , +SMU_TABLE_PACE , +SMU_TABLE_COUNT , +}; +struct smu_table_context {void *power_play_table;
@@ -495,6 +512,7 @@ struct pptable_funcs {int (*get_smu_msg_index)(struct smu_context *smu,uint32_t index);int (*get_smu_clk_index)(struct smu_context *smu,uint32_t index);int (*get_smu_feature_index)(struct smu_context *smu,uint32_t index); +int (*get_smu_table_index)(struct smu_context *smu,uint32_t index);int (*run_afll_btc)(struct smu_context *smu);int (*get_allowed_feature_mask)(struct smu_context *smu,uint32_t *feature_mask,uint32_t num);enum amd_pm_state_type (*get_current_power_state)(struct smu_context *smu);
@@ -783,6 +801,8 @@ struct smu_funcs ((smu)->ppt_funcs? ((smu)->ppt_funcs->get_smu_clk_index? (smu)->ppt_funcs->get_smu_clk_index((smu), (msg)) : -EINVAL) : -EINVAL)#define smu_feature_get_index (smu, msg) \ ((smu)->ppt_funcs? ((smu)->ppt_funcs->get_smu_feature_index? (smu)->ppt_funcs->get_smu_feature_index((smu), (msg)) : -EINVAL) : -EINVAL) +#define smu_table_get_index (smu, tab) \ + ((smu)->ppt_funcs? ((smu)->ppt_funcs->get_smu_table_index? (smu)->ppt_funcs->get_smu_table_index((smu), (tab)) : -EINVAL) : -EINVAL)#define smu_run_afll_btc (smu) \ ((smu)->ppt_funcs? ((smu)->ppt_funcs->run_afll_btc? (smu)->ppt_funcs->run_afll_btc((smu)) : 0) : 0)#define smu_get_allowed_feature_mask (smu, feature_mask, num) \
drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h +3 -0
@@ -46,6 +46,9 @@#define FEA_MAP (fea) \ [SMU_FEATURE_##fea##_BIT] = FEATURE_##fea##_BIT +#define TAB_MAP (tab) \ + [SMU_TABLE_##tab] = TABLE_##tab +struct smu_11_0_max_sustainable_clocks {uint32_t display_clock;uint32_t phy_clock;
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +29 -0
@@ -156,6 +156,21 @@ static int navi10_feature_mask_map[SMU_FEATURE_COUNT] = { FEA_MAP(ATHUB_PG), }; +static int navi10_table_map[SMU_TABLE_COUNT ] = { +TAB_MAP (PPTABLE ), +TAB_MAP (WATERMARKS ), +TAB_MAP (AVFS ), +TAB_MAP (AVFS_PSM_DEBUG ), +TAB_MAP (AVFS_FUSE_OVERRIDE ), +TAB_MAP (PMSTATUSLOG ), +TAB_MAP (SMU_METRICS ), +TAB_MAP (DRIVER_SMU_CONFIG ), +TAB_MAP (ACTIVITY_MONITOR_COEFF ), +TAB_MAP (OVERDRIVE ), +TAB_MAP (I2C_COMMANDS ), +TAB_MAP (PACE ), +}; +static int navi10_get_smu_msg_index (struct smu_context *smc,uint32_t index) {int val;
@@ -195,6 +210,19 @@ static int navi10_get_smu_feature_index(struct smu_context *smc, uint32_t index)return val; } +static int navi10_get_smu_table_index (struct smu_context *smc,uint32_t index) +{ +int val; +if (index >=SMU_TABLE_COUNT ) +return -EINVAL ; + + val = navi10_table_map[index]; +if (val >=TABLE_COUNT ) +return -EINVAL ; + +return val; +} +#define FEATURE_MASK (feature) (1UL << feature) static int navi10_get_allowed_feature_mask(struct smu_context *smu,
@@ -412,6 +440,7 @@ static const struct pptable_funcs navi10_ppt_funcs = { .get_smu_msg_index = navi10_get_smu_msg_index, .get_smu_clk_index = navi10_get_smu_clk_index, .get_smu_feature_index = navi10_get_smu_feature_index, + .get_smu_table_index = navi10_get_smu_table_index, .get_allowed_feature_mask = navi10_get_allowed_feature_mask, .set_default_dpm_table = navi10_set_default_dpm_table, };
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +27 -0
@@ -189,6 +189,32 @@ static int vega20_feature_mask_map[SMU_FEATURE_COUNT] = { FEA_MAP(XGMI), }; +static int vega20_table_map[SMU_TABLE_COUNT ] = { +TAB_MAP (PPTABLE ), +TAB_MAP (WATERMARKS ), +TAB_MAP (AVFS ), +TAB_MAP (AVFS_PSM_DEBUG ), +TAB_MAP (AVFS_FUSE_OVERRIDE ), +TAB_MAP (PMSTATUSLOG ), +TAB_MAP (SMU_METRICS ), +TAB_MAP (DRIVER_SMU_CONFIG ), +TAB_MAP (ACTIVITY_MONITOR_COEFF ), +TAB_MAP (OVERDRIVE ), +}; + +static int vega20_get_smu_table_index (struct smu_context *smc,uint32_t index) +{ +int val; +if (index >=SMU_TABLE_COUNT ) +return -EINVAL ; + + val = vega20_table_map[index]; +if (val >=TABLE_COUNT ) +return -EINVAL ; + +return val; +} +static int vega20_get_smu_feature_index (struct smu_context *smc,uint32_t index) {int val;
@@ -2925,6 +2951,7 @@ static const struct pptable_funcs vega20_ppt_funcs = { .get_smu_msg_index = vega20_get_smu_msg_index, .get_smu_clk_index = vega20_get_smu_clk_index, .get_smu_feature_index = vega20_get_smu_feature_index, + .get_smu_table_index = vega20_get_smu_table_index, .run_afll_btc = vega20_run_btc_afll, .get_allowed_feature_mask = vega20_get_allowed_feature_mask, .get_current_power_state = vega20_get_current_power_state,
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 175/459 drm/amd/powerplay: init table_count for smu tables on asic level
In reply to a message not in the archiveFrom: Huang Rui <[email protected]>
TABLE_COUNT should be inited in asic level. Because the value may be different on each asic even on the same ip.
--- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 3 +++ drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 6 +++--- drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 3 +++ 3 files changed, 9 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +3 -0
@@ -447,6 +447,9 @@ static const struct pptable_funcs navi10_ppt_funcs = {void navi10_set_ppt_funcs (struct smu_context *smu) { +struct smu_table_context *smu_table = &smu->smu_table; + smu->ppt_funcs = &navi10_ppt_funcs; smu->smc_if_version =SMU11_DRIVER_IF_VERSION ; + smu_table->table_count =TABLE_COUNT ; }
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +3 -3
@@ -400,15 +400,15 @@ static int smu_v11_0_init_smc_tables(struct smu_context *smu)struct smu_table *tables =NULL ;int ret =0 ; -if (smu_table->tables || smu_table->table_count !=0 ) +if (smu_table->tables || smu_table->table_count ==0 )return -EINVAL ; - tables =kcalloc (TABLE_COUNT ,sizeof (struct smu_table ),GFP_KERNEL ); + tables =kcalloc (SMU_TABLE_COUNT ,sizeof (struct smu_table ), +GFP_KERNEL );if (!tables)return -ENOMEM ; smu_table->tables = tables; - smu_table->table_count =TABLE_COUNT ;SMU_TABLE_INIT (tables,TABLE_PPTABLE ,sizeof (PPTable_t),PAGE_SIZE ,AMDGPU_GEM_DOMAIN_VRAM );
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +3 -0
@@ -2989,6 +2989,9 @@ static const struct pptable_funcs vega20_ppt_funcs = {void vega20_set_ppt_funcs (struct smu_context *smu) { +struct smu_table_context *smu_table = &smu->smu_table; + smu->ppt_funcs = &vega20_ppt_funcs; smu->smc_if_version =SMU11_DRIVER_IF_VERSION ; + smu_table->table_count =TABLE_COUNT ; }
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 176/459 drm/amd/powerplay: add tables_init interface for each asic
In reply to a message not in the archiveFrom: Huang Rui <[email protected]>
The smc tables defines should be in the asic level.
--- drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 3 +++ drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h | 2 ++ drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 18 ++++++++++++++++++ drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 16 +--------------- drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 18 ++++++++++++++++++ 5 files changed, 42 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +3 -0
@@ -568,6 +568,7 @@ struct pptable_funcs {int (*set_ppfeature_status)(struct smu_context *smu,uint64_t ppfeatures);int (*get_ppfeature_status)(struct smu_context *smu,char *buf);bool (*is_dpm_running)(struct smu_context *smu); +void (*tables_init)(struct smu_context *smu,struct smu_table *tables); };struct smu_funcs
@@ -754,6 +755,8 @@ struct smu_funcs ((smu)->ppt_funcs->set_od_percentage ? (smu)->ppt_funcs->set_od_percentage((smu), (type), (value)) : 0)#define smu_od_edit_dpm_table (smu, type, input, size) \ ((smu)->ppt_funcs->od_edit_dpm_table ? (smu)->ppt_funcs->od_edit_dpm_table((smu), (type), (input), (size)) : 0) +#define smu_tables_init (smu, tab) \ + ((smu)->ppt_funcs->tables_init ? (smu)->ppt_funcs->tables_init((smu), (tab)) : 0)#define smu_start_thermal_control (smu) \ ((smu)->funcs->start_thermal_control? (smu)->funcs->start_thermal_control((smu)) : 0)#define smu_read_sensor (smu, sensor, data, size) \
drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h +2 -0
@@ -40,6 +40,8 @@#define TEMP_RANGE_MIN (0)#define TEMP_RANGE_MAX (80 * 1000) +#define SMU11_TOOL_SIZE 0x19000 +#define CLK_MAP (clk, index) \ [SMU_##clk] = index
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +18 -0
@@ -376,6 +376,23 @@ static int navi10_store_powerplay_table(struct smu_context *smu)return 0 ; } +static void navi10_tables_init (struct smu_context *smu,struct smu_table *tables) +{ +SMU_TABLE_INIT (tables,SMU_TABLE_PPTABLE ,sizeof (PPTable_t), +PAGE_SIZE ,AMDGPU_GEM_DOMAIN_VRAM ); +SMU_TABLE_INIT (tables,SMU_TABLE_WATERMARKS ,sizeof (Watermarks_t), +PAGE_SIZE ,AMDGPU_GEM_DOMAIN_VRAM ); +SMU_TABLE_INIT (tables,SMU_TABLE_SMU_METRICS ,sizeof (SmuMetrics_t), +PAGE_SIZE ,AMDGPU_GEM_DOMAIN_VRAM ); +SMU_TABLE_INIT (tables,SMU_TABLE_OVERDRIVE ,sizeof (OverDriveTable_t), +PAGE_SIZE ,AMDGPU_GEM_DOMAIN_VRAM ); +SMU_TABLE_INIT (tables,SMU_TABLE_PMSTATUSLOG ,SMU11_TOOL_SIZE , +PAGE_SIZE ,AMDGPU_GEM_DOMAIN_VRAM ); +SMU_TABLE_INIT (tables,SMU_TABLE_ACTIVITY_MONITOR_COEFF , +sizeof (DpmActivityMonitorCoeffInt_t),PAGE_SIZE , +AMDGPU_GEM_DOMAIN_VRAM ); +} +static int navi10_allocate_dpm_context (struct smu_context *smu) {struct smu_dpm_context *smu_dpm = &smu->smu_dpm;
@@ -433,6 +450,7 @@ static int navi10_set_default_dpm_table(struct smu_context *smu) }static const struct pptable_funcs navi10_ppt_funcs = { + .tables_init = navi10_tables_init, .alloc_dpm_context = navi10_allocate_dpm_context, .store_powerplay_table = navi10_store_powerplay_table, .check_powerplay_table = navi10_check_powerplay_table,
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +1 -15
@@ -45,7 +45,6 @@MODULE_FIRMWARE ("amdgpu/vega20_smc.bin" );MODULE_FIRMWARE ("amdgpu/navi10_smc.bin" ); -#define SMU11_TOOL_SIZE 0x19000#define SMU11_THERMAL_MINIMUM_ALERT_TEMP 0#define SMU11_THERMAL_MAXIMUM_ALERT_TEMP 255
@@ -410,20 +409,7 @@ static int smu_v11_0_init_smc_tables(struct smu_context *smu) smu_table->tables = tables; -SMU_TABLE_INIT (tables,TABLE_PPTABLE ,sizeof (PPTable_t), -PAGE_SIZE ,AMDGPU_GEM_DOMAIN_VRAM ); -SMU_TABLE_INIT (tables,TABLE_WATERMARKS ,sizeof (Watermarks_t), -PAGE_SIZE ,AMDGPU_GEM_DOMAIN_VRAM ); -SMU_TABLE_INIT (tables,TABLE_SMU_METRICS ,sizeof (SmuMetrics_t), -PAGE_SIZE ,AMDGPU_GEM_DOMAIN_VRAM ); -SMU_TABLE_INIT (tables,TABLE_OVERDRIVE ,sizeof (OverDriveTable_t), -PAGE_SIZE ,AMDGPU_GEM_DOMAIN_VRAM ); -SMU_TABLE_INIT (tables,TABLE_PMSTATUSLOG ,SMU11_TOOL_SIZE ,PAGE_SIZE , -AMDGPU_GEM_DOMAIN_VRAM ); -SMU_TABLE_INIT (tables,TABLE_ACTIVITY_MONITOR_COEFF , -sizeof (DpmActivityMonitorCoeffInt_t), -PAGE_SIZE , -AMDGPU_GEM_DOMAIN_VRAM ); +smu_tables_init (smu, tables); ret =smu_v11_0_init_dpm_context (smu);if (ret)
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +18 -0
@@ -255,6 +255,23 @@ static int vega20_get_smu_msg_index(struct smu_context *smc, uint32_t index)return val; } +static void vega20_tables_init (struct smu_context *smu,struct smu_table *tables) +{ +SMU_TABLE_INIT (tables,SMU_TABLE_PPTABLE ,sizeof (PPTable_t), +PAGE_SIZE ,AMDGPU_GEM_DOMAIN_VRAM ); +SMU_TABLE_INIT (tables,SMU_TABLE_WATERMARKS ,sizeof (Watermarks_t), +PAGE_SIZE ,AMDGPU_GEM_DOMAIN_VRAM ); +SMU_TABLE_INIT (tables,SMU_TABLE_SMU_METRICS ,sizeof (SmuMetrics_t), +PAGE_SIZE ,AMDGPU_GEM_DOMAIN_VRAM ); +SMU_TABLE_INIT (tables,SMU_TABLE_OVERDRIVE ,sizeof (OverDriveTable_t), +PAGE_SIZE ,AMDGPU_GEM_DOMAIN_VRAM ); +SMU_TABLE_INIT (tables,SMU_TABLE_PMSTATUSLOG ,SMU11_TOOL_SIZE , +PAGE_SIZE ,AMDGPU_GEM_DOMAIN_VRAM ); +SMU_TABLE_INIT (tables,SMU_TABLE_ACTIVITY_MONITOR_COEFF , +sizeof (DpmActivityMonitorCoeffInt_t),PAGE_SIZE , +AMDGPU_GEM_DOMAIN_VRAM ); +} +static int vega20_allocate_dpm_context (struct smu_context *smu) {struct smu_dpm_context *smu_dpm = &smu->smu_dpm;
@@ -2944,6 +2961,7 @@ static bool vega20_is_dpm_running(struct smu_context *smu) }static const struct pptable_funcs vega20_ppt_funcs = { + .tables_init = vega20_tables_init, .alloc_dpm_context = vega20_allocate_dpm_context, .store_powerplay_table = vega20_store_powerplay_table, .check_powerplay_table = vega20_check_powerplay_table,
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 177/459 drm/amd/powerplay/smu11: remove smu_update_table_with_arg
In reply to a message not in the archiveNothing was using it. Just replace with smu_update_table which is what everything was using via a wrapper anyway.
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 6 ++---- drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 4 +--- 2 files changed, 3 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +2 -4
@@ -127,19 +127,17 @@ int smu_common_read_sensor(struct smu_context *smu, enum amd_pp_sensors sensor,return ret; } -int smu_update_table_with_arg (struct smu_context *smu,uint16_t table_id,uint16_t exarg, +int smu_update_table (struct smu_context *smu,uint32_t table_index,void *table_data,bool drv2smu) {struct smu_table_context *smu_table = &smu->smu_table;struct smu_table *table =NULL ;int ret =0 ; -uint32_t table_index; +int table_id = table_index &0xffff ;if (!table_data || table_id >= smu_table->table_count)return -EINVAL ; - table_index = (exarg <<16 ) | table_id; - table = &smu_table->tables[table_id];if (drv2smu)
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +1 -3
@@ -871,10 +871,8 @@ extern int smu_feature_is_supported(struct smu_context *smu,extern int smu_feature_set_supported (struct smu_context *smu,enum smu_feature_mask mask,bool enable); -int smu_update_table_with_arg (struct smu_context *smu,uint16_t table_id,uint16_t exarg, +int smu_update_table (struct smu_context *smu,uint32_t table_index,void *table_data,bool drv2smu); -#define smu_update_table (smu, table_id, table_data, drv2smu) \ - smu_update_table_with_arg((smu), (table_id), 0, (table_data), (drv2smu))bool is_support_sw_smu (struct amdgpu_device *adev);int smu_reset (struct smu_context *smu);
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 178/459 drm/amd/powerplay: modify smu_update_table to use SMU_TABLE_xxx as the input
In reply to a message not in the archiveFrom: Huang Rui <[email protected]>
Table id may be different for each asic, so it's good to use this as the input for common interface.
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 8 ++++---- drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 24 +++++++++++++--------- 2 files changed, 18 insertions(+), 14 deletions(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +4 -4
@@ -127,18 +127,18 @@ int smu_common_read_sensor(struct smu_context *smu, enum amd_pp_sensors sensor,return ret; } -int smu_update_table (struct smu_context *smu,uint32_t table_index, +int smu_update_table (struct smu_context *smu,enum smu_table_id table_index,void *table_data,bool drv2smu) {struct smu_table_context *smu_table = &smu->smu_table;struct smu_table *table =NULL ;int ret =0 ; -int table_id = table_index &0xffff ; +int table_id =smu_table_get_index (smu, table_index);if (!table_data || table_id >= smu_table->table_count)return -EINVAL ; - table = &smu_table->tables[table_id]; + table = &smu_table->tables[table_index];if (drv2smu)memcpy (table->cpu_addr, table_data, table->size);
@@ -154,7 +154,7 @@ int smu_update_table(struct smu_context *smu, uint32_t table_index, ret =smu_send_smc_msg_with_param (smu, drv2smu ? SMU_MSG_TransferTableDram2Smu : SMU_MSG_TransferTableSmu2Dram, - table_index); + table_id);if (ret)return ret;
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +14 -10
@@ -707,15 +707,17 @@ static int smu_v11_0_write_pptable(struct smu_context *smu)struct smu_table_context *table_context = &smu->smu_table;int ret =0 ; - ret =smu_update_table (smu,TABLE_PPTABLE , table_context->driver_pptable, true); + ret =smu_update_table (smu,SMU_TABLE_PPTABLE , + table_context->driver_pptable, true);return ret; }static int smu_v11_0_write_watermarks_table (struct smu_context *smu) { -return smu_update_table (smu,TABLE_WATERMARKS , - smu->smu_table.tables[TABLE_WATERMARKS ].cpu_addr, true); +return smu_update_table (smu,SMU_TABLE_WATERMARKS , + smu->smu_table.tables[SMU_TABLE_WATERMARKS ].cpu_addr, + true); }static int smu_v11_0_set_deep_sleep_dcefclk (struct smu_context *smu,uint32_t clk)
@@ -746,7 +748,7 @@ static int smu_v11_0_set_min_dcef_deep_sleep(struct smu_context *smu)static int smu_v11_0_set_tool_table_location (struct smu_context *smu) {int ret =0 ; -struct smu_table *tool_table = &smu->smu_table.tables[TABLE_PMSTATUSLOG ]; +struct smu_table *tool_table = &smu->smu_table.tables[SMU_TABLE_PMSTATUSLOG ];if (tool_table->mc_address) { ret = smu_send_smc_msg_with_param(smu,
@@ -1226,7 +1228,7 @@ static int smu_v11_0_get_metrics_table(struct smu_context *smu,int ret =0 ;if (!smu->metrics_time ||time_after (jiffies, smu->metrics_time +HZ /1000 )) { - ret =smu_update_table (smu,TABLE_SMU_METRICS , + ret =smu_update_table (smu,SMU_TABLE_SMU_METRICS , (void *)metrics_table, false);if (ret) {pr_info ("Failed to export SMU metrics table!\n" );
@@ -1521,7 +1523,7 @@ smu_v11_0_set_watermarks_for_clock_ranges(struct smu_context *smu, struct *clock_ranges) {int ret =0 ; -struct smu_table *watermarks = &smu->smu_table.tables[TABLE_WATERMARKS ]; +struct smu_table *watermarks = &smu->smu_table.tables[SMU_TABLE_WATERMARKS ];Watermarks_t *table = watermarks->cpu_addr; if (!smu->disable_watermark &&
@@ -1665,7 +1667,8 @@ static int smu_v11_0_set_od8_default_settings(struct smu_context *smu,if (!table_context->overdrive_table)return -ENOMEM ; - ret =smu_update_table (smu,TABLE_OVERDRIVE , table_context->overdrive_table, false); + ret =smu_update_table (smu,SMU_TABLE_OVERDRIVE , + table_context->overdrive_table, false);if (ret) {pr_err ("Failed to export over drive table!\n" );return ret;
@@ -1674,7 +1677,8 @@ static int smu_v11_0_set_od8_default_settings(struct smu_context *smu,smu_set_default_od8_settings (smu); } - ret =smu_update_table (smu,TABLE_OVERDRIVE , table_context->overdrive_table, true); + ret =smu_update_table (smu,SMU_TABLE_OVERDRIVE , + table_context->overdrive_table, true);if (ret) {pr_err ("Failed to import over drive table!\n" );return ret;
@@ -1690,7 +1694,7 @@ static int smu_v11_0_update_od8_settings(struct smu_context *smu,struct smu_table_context *table_context = &smu->smu_table;int ret; - ret =smu_update_table (smu,TABLE_OVERDRIVE , + ret =smu_update_table (smu,SMU_TABLE_OVERDRIVE , table_context->overdrive_table, false);if (ret) {pr_err ("Failed to export over drive table!\n" );
@@ -1699,7 +1703,7 @@ static int smu_v11_0_update_od8_settings(struct smu_context *smu,smu_update_specified_od8_value (smu, index, value); - ret =smu_update_table (smu,TABLE_OVERDRIVE , + ret =smu_update_table (smu,SMU_TABLE_OVERDRIVE , table_context->overdrive_table, true);if (ret) {pr_err ("Failed to import over drive table!\n" );
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 179/459 drm/amd/powerplay: use the table size member in the structure instead of getting directly
In reply to a message not in the archiveFrom: Huang Rui <[email protected]>
This patch uses the table size member in the structure instead of getting directly, because the table is different in each asic.
--- drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +4 -2
@@ -675,11 +675,12 @@ static int smu_v11_0_parse_pptable(struct smu_context *smu)int ret;struct smu_table_context *table_context = &smu->smu_table; +struct smu_table *table = &table_context->tables[SMU_TABLE_PPTABLE ];if (table_context->driver_pptable)return -EINVAL ; - table_context->driver_pptable =kzalloc (sizeof (PPTable_t),GFP_KERNEL ); + table_context->driver_pptable =kzalloc (table->size,GFP_KERNEL );if (!table_context->driver_pptable)return -ENOMEM ;
@@ -1649,6 +1650,7 @@ static int smu_v11_0_set_od8_default_settings(struct smu_context *smu, bool initialize) {struct smu_table_context *table_context = &smu->smu_table; +struct smu_table *table = &table_context->tables[SMU_TABLE_OVERDRIVE ];int ret;/**
@@ -1662,7 +1664,7 @@ static int smu_v11_0_set_od8_default_settings(struct smu_context *smu,if (table_context->overdrive_table)return -EINVAL ; - table_context->overdrive_table =kzalloc (sizeof (OverDriveTable_t),GFP_KERNEL ); + table_context->overdrive_table =kzalloc (table->size,GFP_KERNEL );if (!table_context->overdrive_table)return -ENOMEM ;
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 180/459 drm/amd/powerplay: move PPTable_t uses into asic level
In reply to a message not in the archiveFrom: Huang Rui <[email protected]>
This patch moves the rest of PPTable_t uses into asic level. It's to avoid the conflicts with different asic.
--- .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 7 +++-- drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 31 +------------------ drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 29 +++++++++++++++++ 3 files changed, 35 insertions(+), 32 deletions(-)
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +5 -2
@@ -569,6 +569,8 @@ struct pptable_funcs {int (*get_ppfeature_status)(struct smu_context *smu,char *buf);bool (*is_dpm_running)(struct smu_context *smu);void (*tables_init)(struct smu_context *smu,struct smu_table *tables); +int (*set_thermal_fan_table)(struct smu_context *smu); +int (*get_fan_speed_percent)(struct smu_context *smu,uint32_t *speed); };struct smu_funcs
@@ -643,7 +645,6 @@ struct smu_funcsint (*get_current_rpm)(struct smu_context *smu,uint32_t *speed);uint32_t (*get_fan_control_mode)(struct smu_context *smu);int (*set_fan_control_mode)(struct smu_context *smu,uint32_t mode); -int (*get_fan_speed_percent)(struct smu_context *smu,uint32_t *speed);int (*set_fan_speed_percent)(struct smu_context *smu,uint32_t speed);int (*set_fan_speed_rpm)(struct smu_context *smu,uint32_t speed);int (*set_xgmi_pstate)(struct smu_context *smu,uint32_t pstate);
@@ -757,6 +758,8 @@ struct smu_funcs ((smu)->ppt_funcs->od_edit_dpm_table ? (smu)->ppt_funcs->od_edit_dpm_table((smu), (type), (input), (size)) : 0)#define smu_tables_init (smu, tab) \ ((smu)->ppt_funcs->tables_init ? (smu)->ppt_funcs->tables_init((smu), (tab)) : 0) +#define smu_set_thermal_fan_table (smu) \ + ((smu)->ppt_funcs->set_thermal_fan_table ? (smu)->ppt_funcs->set_thermal_fan_table((smu)) : 0)#define smu_start_thermal_control (smu) \ ((smu)->funcs->start_thermal_control? (smu)->funcs->start_thermal_control((smu)) : 0)#define smu_read_sensor (smu, sensor, data, size) \
@@ -794,7 +797,7 @@ struct smu_funcs#define smu_set_fan_control_mode (smu, value) \ ((smu)->funcs->set_fan_control_mode ? (smu)->funcs->set_fan_control_mode((smu), (value)) : 0)#define smu_get_fan_speed_percent (smu, speed) \ - ((smu)->funcs->get_fan_speed_percent ? (smu)->funcs->get_fan_speed_percent((smu), (speed)) : 0) + ((smu)->ppt_funcs->get_fan_speed_percent ? (smu)->ppt_funcs->get_fan_speed_percent((smu), (speed)) : 0)#define smu_set_fan_speed_percent (smu, speed) \ ((smu)->funcs->set_fan_speed_percent ? (smu)->funcs->set_fan_speed_percent((smu), (speed)) : 0)
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +1 -30
@@ -1166,18 +1166,6 @@ static int smu_v11_0_enable_thermal_alert(struct smu_context *smu)return 0 ; } -static int smu_v11_0_set_thermal_fan_table (struct smu_context *smu) -{ -int ret; -struct smu_table_context *table_context = &smu->smu_table; -PPTable_t *pptable = table_context->driver_pptable; - - ret =smu_send_smc_msg_with_param (smu, SMU_MSG_SetFanTemperatureTarget, - (uint32_t )pptable->FanTargetTemperature); - -return ret; -} -static int smu_v11_0_start_thermal_control (struct smu_context *smu) {int ret =0 ;
@@ -1205,7 +1193,7 @@ static int smu_v11_0_start_thermal_control(struct smu_context *smu) ret =smu_v11_0_enable_thermal_alert (smu);if (ret)return ret; - ret =smu_v11_0_set_thermal_fan_table (smu); + ret =smu_set_thermal_fan_table (smu);if (ret)return ret; }
@@ -1741,22 +1729,6 @@ smu_v11_0_get_fan_control_mode(struct smu_context *smu)return AMD_FAN_CTRL_AUTO ; } -static int -smu_v11_0_get_fan_speed_percent (struct smu_context *smu, -uint32_t *speed) -{ -int ret =0 ; -uint32_t percent =0 ; -uint32_t current_rpm; -PPTable_t *pptable = smu->smu_table.driver_pptable; - - ret =smu_v11_0_get_current_rpm (smu, ¤t_rpm); - percent = current_rpm *100 / pptable->FanMaximumRpm; - *speed = percent >100 ?100 : percent; - -return ret; -} -static int smu_v11_0_smc_fan_control (struct smu_context *smu,bool start) {
@@ -1935,7 +1907,6 @@ static const struct smu_funcs smu_v11_0_funcs = { .get_current_rpm = smu_v11_0_get_current_rpm, .get_fan_control_mode = smu_v11_0_get_fan_control_mode, .set_fan_control_mode = smu_v11_0_set_fan_control_mode, - .get_fan_speed_percent = smu_v11_0_get_fan_speed_percent, .set_fan_speed_percent = smu_v11_0_set_fan_speed_percent, .set_fan_speed_rpm = smu_v11_0_set_fan_speed_rpm, .set_xgmi_pstate = smu_v11_0_set_xgmi_pstate,
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +29 -0
@@ -2960,6 +2960,33 @@ static bool vega20_is_dpm_running(struct smu_context *smu)return !!(feature_enabled &SMC_DPM_FEATURE ); } +static int vega20_set_thermal_fan_table (struct smu_context *smu) +{ +int ret; +struct smu_table_context *table_context = &smu->smu_table; +PPTable_t *pptable = table_context->driver_pptable; + + ret =smu_send_smc_msg_with_param (smu, SMU_MSG_SetFanTemperatureTarget, + (uint32_t )pptable->FanTargetTemperature); + +return ret; +} + +static int vega20_get_fan_speed_percent (struct smu_context *smu, +uint32_t *speed) +{ +int ret =0 ; +uint32_t percent =0 ; +uint32_t current_rpm; +PPTable_t *pptable = smu->smu_table.driver_pptable; + + ret =smu_get_current_rpm (smu, ¤t_rpm); + percent = current_rpm *100 / pptable->FanMaximumRpm; + *speed = percent >100 ?100 : percent; + +return ret; +} +static const struct pptable_funcs vega20_ppt_funcs = { .tables_init = vega20_tables_init, .alloc_dpm_context = vega20_allocate_dpm_context,
@@ -3003,6 +3030,8 @@ static const struct pptable_funcs vega20_ppt_funcs = { .set_ppfeature_status = vega20_set_ppfeature_status, .get_ppfeature_status = vega20_get_ppfeature_status, .is_dpm_running = vega20_is_dpm_running, + .set_thermal_fan_table = vega20_set_thermal_fan_table, + .get_fan_speed_percent = vega20_get_fan_speed_percent, };void vega20_set_ppt_funcs (struct smu_context *smu)
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 181/459 drm/amd/powerplay: move SmuMetrics_t uses into asic level
In reply to a message not in the archiveFrom: Huang Rui <[email protected]>
This patch moves the rest of SmuMetrics_t uses into asic level. It's to avoid the conflicts with different asic.
--- .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 8 +++ drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 54 ++----------------- drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 50 +++++++++++++++++ 3 files changed, 62 insertions(+), 50 deletions(-)
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +8 -0
@@ -571,6 +571,10 @@ struct pptable_funcs {void (*tables_init)(struct smu_context *smu,struct smu_table *tables);int (*set_thermal_fan_table)(struct smu_context *smu);int (*get_fan_speed_percent)(struct smu_context *smu,uint32_t *speed); +int (*get_gpu_power)(struct smu_context *smu,uint32_t *value); +int (*get_current_activity_percent)(struct smu_context *smu, +enum amd_pp_sensors sensor, +uint32_t *value); };struct smu_funcs
@@ -798,6 +802,10 @@ struct smu_funcs ((smu)->funcs->set_fan_control_mode ? (smu)->funcs->set_fan_control_mode((smu), (value)) : 0)#define smu_get_fan_speed_percent (smu, speed) \ ((smu)->ppt_funcs->get_fan_speed_percent ? (smu)->ppt_funcs->get_fan_speed_percent((smu), (speed)) : 0) +#define smu_get_gpu_power (smu, val) \ + ((smu)->ppt_funcs->get_gpu_power ? (smu)->ppt_funcs->get_gpu_power((smu), (val)) : 0) +#define smu_get_current_activity_percent (smu, val) \ + ((smu)->ppt_funcs->get_current_activity_percent ? (smu)->ppt_funcs->get_current_activity_percent((smu), (sensor), (val)) : 0)#define smu_set_fan_speed_percent (smu, speed) \ ((smu)->funcs->set_fan_speed_percent ? (smu)->funcs->set_fan_speed_percent((smu), (speed)) : 0)
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +4 -50
78 lines not on this page · raw message
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +50 -0
62 lines not on this page · raw message
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 182/459 drm/amd/powerplay: move Watermarks_t uses into asic level
In reply to a message not in the archiveFrom: Huang Rui <[email protected]>
This patch moves the rest of Watermarks_t uses into asic level. It's to avoid the conflicts with different asic.
--- .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 4 ++ drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 63 +------------------ drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 61 ++++++++++++++++++ 3 files changed, 67 insertions(+), 61 deletions(-)
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +4 -0
@@ -575,6 +575,8 @@ struct pptable_funcs {int (*get_current_activity_percent)(struct smu_context *smu,enum amd_pp_sensors sensor,uint32_t *value); +int (*set_watermarks_table)(struct smu_context *smu,void *watermarks, +struct dm_pp_wm_sets_with_clock_ranges_soc15 *clock_ranges); };struct smu_funcs
@@ -863,6 +865,8 @@ struct smu_funcs ((smu)->ppt_funcs->set_ppfeature_status ? (smu)->ppt_funcs->set_ppfeature_status((smu), (ppfeatures)) : -EINVAL)#define smu_get_ppfeature_status (smu, buf) \ ((smu)->ppt_funcs->get_ppfeature_status ? (smu)->ppt_funcs->get_ppfeature_status((smu), (buf)) : -EINVAL) +#define smu_set_watermarks_table (smu, tab, clock_ranges) \ + ((smu)->ppt_funcs->set_watermarks_table ? (smu)->ppt_funcs->set_watermarks_table((smu), (tab), (clock_ranges)) : 0) extern int smu_get_atom_data_table(struct smu_context *smu, uint32_t table, uint16_t *size, uint8_t *frev, uint8_t *crev,
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +2 -61
79 lines not on this page · raw message
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +61 -0
73 lines not on this page · raw message
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 183/459 drm/amd/powerplay: introduce smu power source type to handle AC/DC source for each asic
In reply to a message not in the archiveFrom: Huang Rui <[email protected]>
This patch introduces new smu power source type, it's to handle the different AC/DC source defines for each asic with the same smu ip.
--- .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 10 ++++++++++ drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h | 3 +++ drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 19 +++++++++++++++++++ drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 2 +- drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 19 +++++++++++++++++++ 5 files changed, 52 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +10 -0
@@ -243,6 +243,13 @@ enum smu_clk_type SMU_CLK_COUNT, }; +enum smu_power_src_type +{ +SMU_POWER_SOURCE_AC , +SMU_POWER_SOURCE_DC , +SMU_POWER_SOURCE_COUNT , +}; +enum smu_feature_mask {SMU_FEATURE_DPM_PREFETCHER_BIT ,
@@ -513,6 +520,7 @@ struct pptable_funcs {int (*get_smu_clk_index)(struct smu_context *smu,uint32_t index);int (*get_smu_feature_index)(struct smu_context *smu,uint32_t index);int (*get_smu_table_index)(struct smu_context *smu,uint32_t index); +int (*get_smu_power_index)(struct smu_context *smu,uint32_t index);int (*run_afll_btc)(struct smu_context *smu);int (*get_allowed_feature_mask)(struct smu_context *smu,uint32_t *feature_mask,uint32_t num);enum amd_pm_state_type (*get_current_power_state)(struct smu_context *smu);
@@ -819,6 +827,8 @@ struct smu_funcs ((smu)->ppt_funcs? ((smu)->ppt_funcs->get_smu_feature_index? (smu)->ppt_funcs->get_smu_feature_index((smu), (msg)) : -EINVAL) : -EINVAL)#define smu_table_get_index (smu, tab) \ ((smu)->ppt_funcs? ((smu)->ppt_funcs->get_smu_table_index? (smu)->ppt_funcs->get_smu_table_index((smu), (tab)) : -EINVAL) : -EINVAL) +#define smu_power_get_index (smu, src) \ + ((smu)->ppt_funcs? ((smu)->ppt_funcs->get_smu_power_index? (smu)->ppt_funcs->get_smu_power_index((smu), (src)) : -EINVAL) : -EINVAL)#define smu_run_afll_btc (smu) \ ((smu)->ppt_funcs? ((smu)->ppt_funcs->run_afll_btc? (smu)->ppt_funcs->run_afll_btc((smu)) : 0) : 0)#define smu_get_allowed_feature_mask (smu, feature_mask, num) \
drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h +3 -0
@@ -51,6 +51,9 @@#define TAB_MAP (tab) \ [SMU_TABLE_##tab] = TABLE_##tab +#define PWR_MAP (tab) \ + [SMU_POWER_SOURCE_##tab] = POWER_SOURCE_##tab +struct smu_11_0_max_sustainable_clocks {uint32_t display_clock;uint32_t phy_clock;
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +19 -0
@@ -171,6 +171,11 @@ static int navi10_table_map[SMU_TABLE_COUNT] = { TAB_MAP(PACE), }; +static int navi10_pwr_src_map[SMU_POWER_SOURCE_COUNT ] = { +PWR_MAP (AC ), +PWR_MAP (DC ), +}; +static int navi10_get_smu_msg_index (struct smu_context *smc,uint32_t index) {int val;
@@ -223,6 +228,19 @@ static int navi10_get_smu_table_index(struct smu_context *smc, uint32_t index)return val; } +static int navi10_get_pwr_src_index (struct smu_context *smc,uint32_t index) +{ +int val; +if (index >=SMU_POWER_SOURCE_COUNT ) +return -EINVAL ; + + val = navi10_pwr_src_map[index]; +if (val >=POWER_SOURCE_COUNT ) +return -EINVAL ; + +return val; +} +#define FEATURE_MASK (feature) (1UL << feature) static int navi10_get_allowed_feature_mask(struct smu_context *smu,
@@ -459,6 +477,7 @@ static const struct pptable_funcs navi10_ppt_funcs = { .get_smu_clk_index = navi10_get_smu_clk_index, .get_smu_feature_index = navi10_get_smu_feature_index, .get_smu_table_index = navi10_get_smu_table_index, + .get_smu_power_index= navi10_get_pwr_src_index, .get_allowed_feature_mask = navi10_get_allowed_feature_mask, .set_default_dpm_table = navi10_set_default_dpm_table, };
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +1 -1
@@ -1038,7 +1038,7 @@ static int smu_v11_0_get_power_limit(struct smu_context *smu,mutex_unlock (&smu->mutex); }else { ret =smu_send_smc_msg_with_param (smu, SMU_MSG_GetPptLimit, -POWER_SOURCE_AC <<16 ); +smu_power_get_index (smu,SMU_POWER_SOURCE_AC ) <<16 );if (ret) {pr_err ("[%s] get PPT limit failed!" , __func__);return ret;
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +19 -0
@@ -202,6 +202,11 @@ static int vega20_table_map[SMU_TABLE_COUNT] = { TAB_MAP(OVERDRIVE), }; +static int vega20_pwr_src_map[SMU_POWER_SOURCE_COUNT ] = { +PWR_MAP (AC ), +PWR_MAP (DC ), +}; +static int vega20_get_smu_table_index (struct smu_context *smc,uint32_t index) {int val;
@@ -215,6 +220,19 @@ static int vega20_get_smu_table_index(struct smu_context *smc, uint32_t index)return val; } +static int vega20_get_pwr_src_index (struct smu_context *smc,uint32_t index) +{ +int val; +if (index >=SMU_POWER_SOURCE_COUNT ) +return -EINVAL ; + + val = vega20_pwr_src_map[index]; +if (val >=POWER_SOURCE_COUNT ) +return -EINVAL ; + +return val; +} +static int vega20_get_smu_feature_index (struct smu_context *smc,uint32_t index) {int val;
@@ -3105,6 +3123,7 @@ static const struct pptable_funcs vega20_ppt_funcs = { .get_smu_clk_index = vega20_get_smu_clk_index, .get_smu_feature_index = vega20_get_smu_feature_index, .get_smu_table_index = vega20_get_smu_table_index, + .get_smu_power_index = vega20_get_pwr_src_index, .run_afll_btc = vega20_run_btc_afll, .get_allowed_feature_mask = vega20_get_allowed_feature_mask, .get_current_power_state = vega20_get_current_power_state,
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 184/459 drm/amd/powerplay: move getting MAX_FAN_RPM value to asic level
In reply to a message not in the archiveFrom: Huang Rui <[email protected]>
Getting MAX_FAN_RPM value needs to be read by pptable, so it should be moved to asic level.
--- drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 6 ------ drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 6 ++++++ 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0 -6
@@ -1302,8 +1302,6 @@ static int smu_v11_0_read_sensor(struct smu_context *smu,enum amd_pp_sensors sensor, void *data, uint32_t *size) { - struct smu_table_context *table_context = &smu->smu_table; -PPTable_t *pptable = table_context->driver_pptable; int ret = 0;switch (sensor) {case AMDGPU_PP_SENSOR_GPU_LOAD :
@@ -1339,10 +1337,6 @@ static int smu_v11_0_read_sensor(struct smu_context *smu, *(uint32_t *)data =0 ; *size =4 ;break ; -case AMDGPU_PP_SENSOR_MAX_FAN_RPM : - *(uint32_t *)data = pptable->FanMaximumRpm; - *size =4 ; -break ;default : ret =smu_common_read_sensor (smu, sensor, data, size);break ;
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +6 -0
@@ -2950,6 +2950,8 @@ static int vega20_read_sensor(struct smu_context *smu, void *data, uint32_t *size) { int ret = 0; +struct smu_table_context *table_context = &smu->smu_table; +PPTable_t *pptable = table_context->driver_pptable;switch (sensor) {case AMDGPU_PP_SENSOR_UVD_POWER :
@@ -2960,6 +2962,10 @@ static int vega20_read_sensor(struct smu_context *smu, *(uint32_t *)data =smu_feature_is_enabled (smu,SMU_FEATURE_DPM_VCE_BIT ) ?1 :0 ; *size =4 ;break ; +case AMDGPU_PP_SENSOR_MAX_FAN_RPM : + *(uint32_t *)data = pptable->FanMaximumRpm; + *size =4 ; +break ;default :return -EINVAL ; }
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 185/459 drm/amd/powerplay: don't include the smu11 driver if header in smu v11 (v2)
In reply to a message not in the archiveFrom: Huang Rui <[email protected]>
This header is actually for each asic, so we should not include in smu_v11_0.c. And rename the one for navi10.
v2: add hack for XGMI (Alex)
---
.../inc/{smu_11_0_driver_if.h => smu11_driver_if_navi10.h} | 4 ++--
drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 2 +-
drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 4 +++-
3 files changed, 6 insertions(+), 4 deletions(-)
rename drivers/gpu/drm/amd/powerplay/inc/{smu_11_0_driver_if.h => smu11_driver_if_navi10.h} (99%)drivers/gpu/drm/amd/powerplay/inc/smu11_driver_if_navi10.h renamed from drivers/gpu/drm/amd/powerplay/inc/smu_11_0_driver_if.h +2 -2
@@ -1,5 +1,5 @@ -#ifndef __SMU11_DRIVER_IF_H__ -#define __SMU11_DRIVER_IF_H__ +#ifndef __SMU11_DRIVER_IF_NAVI10_H__ +#define __SMU11_DRIVER_IF_NAVI10_H__// *** IMPORTANT *** // SMU TEAM: Always increment the interface version if
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +1 -1
@@ -28,7 +28,7 @@#include "atomfirmware.h" #include "amdgpu_atomfirmware.h" #include "smu_v11_0.h" -#include "smu_11_0_driver_if.h" +#include "smu11_driver_if_navi10.h" #include "soc15_common.h" #include "atom.h" #include "navi10_ppt.h"
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +3 -1
@@ -27,7 +27,6 @@#include "atomfirmware.h" #include "amdgpu_atomfirmware.h" #include "smu_v11_0.h" -#include "smu_11_0_driver_if.h" #include "soc15_common.h" #include "atom.h" #include "vega20_ppt.h"
@@ -1739,6 +1738,9 @@ static int smu_v11_0_set_fan_speed_rpm(struct smu_context *smu,return ret; } +#define XGMI_STATE_D0 1 +#define XGMI_STATE_D3 0 +static int smu_v11_0_set_xgmi_pstate (struct smu_context *smu,uint32_t pstate) {
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 186/459 drm/amd/powerplay: fix the incorrect type of pptable
In reply to a message not in the archiveFrom: Kenneth Feng <[email protected]>
This patch is to fix the incorrect type of pptable, otherwise, the data will be totally wrong in parsing phase.
--- drivers/gpu/drm/amd/powerplay/inc/smu_v11_0_pptable.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/inc/smu_v11_0_pptable.h +1 -1
@@ -121,7 +121,7 @@ struct smu_11_0_powerplay_table {struct atom_common_table_header header;uint8_t table_revision; -uint32_t table_size;//Driver portion table size. The offset to smc_pptable including header size +uint16_t table_size;//Driver portion table size. The offset to smc_pptable including header size uint32_t golden_pp_id;uint32_t golden_revision;uint16_t format_id;
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 187/459 drm/amd/powerplay: do not set dpm_enabled flag before VCN/DCN DPM is workable
In reply to a message not in the archiveFrom: Huang Rui <[email protected]>
This dpm_enabled flag will be recognized as the VCN DPM enabled as well. In fact VCN/DCN DPM on Navi10 is not good so far, so we cannot enable it for now.
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +3 -0
@@ -866,6 +866,9 @@ static int smu_hw_init(void *handle) adev->pm.dpm_enabled = false; else adev->pm.dpm_enabled = true; +/* TODO: will set dpm_enabled flag while VCN and DAL DPM is workable */ +if (adev->asic_type !=CHIP_NAVI10 ) + adev->pm.dpm_enabled = true;pr_info ("SMU is initialized successfully!\n" );
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 188/459 drm/amdgpu/gfx10: update gfx golden settings
In reply to a message not in the archiveFrom: tiancyin <[email protected]>
add new registers: mmCGTT_SPI_CLK_CTRL, mmDB_DEBUG3 and mmGL2C_CGTT_SCLK_CTRL.
--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +3 -0
@@ -67,6 +67,7 @@ static const struct soc15_reg_golden golden_settings_gc_10_1[] = {SOC15_REG_GOLDEN_VALUE (GC ,0 , mmCB_HW_CONTROL_4,0xffffffff ,0x00400014 ),SOC15_REG_GOLDEN_VALUE (GC ,0 , mmCGTT_CPF_CLK_CTRL,0xfcff8fff ,0xf8000100 ), +SOC15_REG_GOLDEN_VALUE (GC ,0 , mmCGTT_SPI_CLK_CTRL,0xc0000000 ,0xc0000100 ),SOC15_REG_GOLDEN_VALUE (GC ,0 , mmCGTT_SQ_CLK_CTRL,0x60000ff0 ,0x60000100 ),SOC15_REG_GOLDEN_VALUE (GC ,0 , mmCGTT_SQG_CLK_CTRL,0x40000000 ,0x40000100 ), SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_VGT_CLK_CTRL, 0xffff8fff, 0xffff8100),
@@ -76,6 +77,7 @@ static const struct soc15_reg_golden golden_settings_gc_10_1[] =SOC15_REG_GOLDEN_VALUE (GC ,0 , mmCP_SD_CNTL,0x000007ff ,0x000005ff ),SOC15_REG_GOLDEN_VALUE (GC ,0 , mmDB_DEBUG,0x20000000 ,0x20000000 ),SOC15_REG_GOLDEN_VALUE (GC ,0 , mmDB_DEBUG2,0xffffffff ,0x00000420 ), +SOC15_REG_GOLDEN_VALUE (GC ,0 , mmDB_DEBUG3,0x00000200 ,0x00000200 ),SOC15_REG_GOLDEN_VALUE (GC ,0 , mmDB_DEBUG4,0x07800000 ,0x04800000 ),SOC15_REG_GOLDEN_VALUE (GC ,0 , mmDB_DFSM_TILES_IN_FLIGHT,0x0000ffff ,0x0000003f ), SOC15_REG_GOLDEN_VALUE(GC, 0, mmDB_LAST_OF_BURST_CONFIG, 0xffffffff, 0x03860204),
@@ -86,6 +88,7 @@ static const struct soc15_reg_golden golden_settings_gc_10_1[] =SOC15_REG_GOLDEN_VALUE (GC ,0 , mmGL2_PIPE_STEER_1,0x77777777 ,0x02310231 ),SOC15_REG_GOLDEN_VALUE (GC ,0 , mmGL2A_ADDR_MATCH_MASK,0xffffffff ,0xffffffcf ),SOC15_REG_GOLDEN_VALUE (GC ,0 , mmGL2C_ADDR_MATCH_MASK,0xffffffff ,0xffffffcf ), +SOC15_REG_GOLDEN_VALUE (GC ,0 , mmGL2C_CGTT_SCLK_CTRL,0x10000000 ,0x10000100 ),SOC15_REG_GOLDEN_VALUE (GC ,0 , mmGL2C_CTRL2,0xffffffff ,0x1402002f ),SOC15_REG_GOLDEN_VALUE (GC ,0 , mmGL2C_CTRL3,0xffff9fff ,0x00001188 ), SOC15_REG_GOLDEN_VALUE(GC, 0, mmPA_SC_ENHANCE, 0x3fffffff, 0x08000009),
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 189/459 drm/amdgpu: disable some gfx light sleep
In reply to a message not in the archiveFrom: tiancyin <[email protected]>
temporarily disable to avoid s3 test failure.
s3 test failure log:
"[drm:amdgpu_job_timedout [amdgpu]] *ERROR* ring sdma0 timeout, signaled seq=8278, emitted seq=8281"
--- drivers/gpu/drm/amd/amdgpu/nv.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/nv.c +0 -4
@@ -492,10 +492,6 @@ static int nv_common_early_init(void *handle)switch (adev->asic_type) {case CHIP_NAVI10 : adev->cg_flags =AMD_CG_SUPPORT_GFX_MGCG | -AMD_CG_SUPPORT_GFX_MGLS | -AMD_CG_SUPPORT_GFX_RLC_LS | -AMD_CG_SUPPORT_GFX_CP_LS | -AMD_CG_SUPPORT_GFX_CGLS |AMD_CG_SUPPORT_GFX_CGCG |AMD_CG_SUPPORT_IH_CG | AMD_CG_SUPPORT_HDP_MGCG |
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 190/459 drm/amdgpu/gfx10: fix resume failure when enabling async gfx ring
In reply to a message not in the archiveFrom: Xiaojie Yuan <[email protected]>
'adev->in_suspend' code path is missing in gfx_v10_0_gfx_init_queue()
--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +14 -12
@@ -2903,7 +2903,19 @@ static int gfx_v10_0_gfx_init_queue(struct amdgpu_ring *ring)struct amdgpu_device *adev = ring->adev;struct v10_gfx_mqd *mqd = ring->mqd_ptr; -if (adev->in_gpu_reset) { +if (!adev->in_gpu_reset && !adev->in_suspend) { +memset ((void *)mqd,0 ,sizeof (*mqd)); +mutex_lock (&adev->srbm_mutex); +nv_grbm_select (adev, ring->me, ring->pipe, ring->queue,0 ); +gfx_v10_0_gfx_mqd_init (ring); +#ifdef BRING_UP_DEBUG +gfx_v10_0_gfx_queue_init_register (ring); +#endif +nv_grbm_select (adev,0 ,0 ,0 ,0 ); +mutex_unlock (&adev->srbm_mutex); +if (adev->gfx.me.mqd_backup[AMDGPU_MAX_GFX_RINGS ]) +memcpy (adev->gfx.me.mqd_backup[AMDGPU_MAX_GFX_RINGS ], mqd,sizeof (*mqd)); + }else if (adev->in_gpu_reset) {/* reset mqd with the backup copy */ if (adev->gfx.me.mqd_backup[AMDGPU_MAX_GFX_RINGS ])memcpy (mqd, adev->gfx.me.mqd_backup[AMDGPU_MAX_GFX_RINGS ],sizeof (*mqd));
@@ -2918,17 +2930,7 @@ static int gfx_v10_0_gfx_init_queue(struct amdgpu_ring *ring)mutex_unlock (&adev->srbm_mutex);#endif }else { -memset ((void *)mqd,0 ,sizeof (*mqd)); -mutex_lock (&adev->srbm_mutex); -nv_grbm_select (adev, ring->me, ring->pipe, ring->queue,0 ); -gfx_v10_0_gfx_mqd_init (ring); -#ifdef BRING_UP_DEBUG -gfx_v10_0_gfx_queue_init_register (ring); -#endif -nv_grbm_select (adev,0 ,0 ,0 ,0 ); -mutex_unlock (&adev->srbm_mutex); -if (adev->gfx.me.mqd_backup[AMDGPU_MAX_GFX_RINGS ]) -memcpy (adev->gfx.me.mqd_backup[AMDGPU_MAX_GFX_RINGS ], mqd,sizeof (*mqd)); +amdgpu_ring_clear_ring (ring); }return 0 ;
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 191/459 drm/amd/powerplay: update smu11_driver_if_navi10.h
In reply to a message not in the archiveFrom: Kenneth Feng <[email protected]>
update the smu11_driver_if_navi10.h since navi10 smu fw update to 42.15.0
--- .../amd/powerplay/inc/smu11_driver_if_navi10.h | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/powerplay/inc/smu11_driver_if_navi10.h +6 -11
@@ -4,7 +4,7 @@// *** IMPORTANT *** // SMU TEAM: Always increment the interface version if // any structure is changed in this file -#define SMU11_DRIVER_IF_VERSION 0x2E +#define SMU11_DRIVER_IF_VERSION 0x2F#define PPTABLE_NV10_SMU_VERSION 8
@@ -689,8 +689,11 @@ typedef struct {// BTC Setting uint32_t BtcConfig; +uint16_t SsFmin[10 ];// PPtable value to function similar to VFTFmin for SS Curve; Size is PPCLK_COUNT rounded to nearest multiple of 2 +uint16_t DcBtcGb[AVFS_VOLTAGE_COUNT ]; +// SECTION: Board Reserved -uint32_t Reserved[14 ]; +uint32_t Reserved[8 ];// SECTION: BOARD PARAMETERS // I2C Control
@@ -1027,17 +1030,9 @@ typedef struct {//RLC Pace Table total number of levels #define RLC_PACE_TABLE_NUM_LEVELS 16 -#define RLC_PACE_RATIO_NUM_LEVELS 8 - -typedef struct { -uint8_t ByteRatioLow; -uint8_t FlopsRatioLow; -uint8_t ByteRatioHigh; -uint8_t FlopsRatioHigh; -}RlcPaceFlopsPerByte_t ;typedef struct { -RlcPaceFlopsPerByte_t FlopsPerByteTable[RLC_PACE_RATIO_NUM_LEVELS ]; +float FlopsPerByteTable[RLC_PACE_TABLE_NUM_LEVELS ];uint32_t MmHubPadding[8 ];// SMU internal use }RlcPaceFlopsPerByteOverride_t ;
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 192/459 drm/amdgpu: mask some pm interfaces for navi10 because they are changed or not workable so far
In reply to a message not in the archiveFrom: Huang Rui <[email protected]>
Some interfaces are changed in the navi series, E.X. PPSMC_MSG_GetDpmClockFreq is not implemented by SMC ucode so far. So it is unable to get current clock values with the sysfs interface. We have to mask them for the momment.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 156 +++++++++++++----------- 2 files changed, 85 insertions(+), 73 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +1 -1
@@ -690,7 +690,7 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file dev_info.num_shader_arrays_per_engine = adev->gfx.config.max_sh_per_se;/* return all clocks in KHz */ dev_info.gpu_counter_freq =amdgpu_asic_get_xclk (adev) *10 ; -if (adev->pm.dpm_enabled) { +if (adev->pm.dpm_enabled && adev->asic_type !=CHIP_NAVI10 ) { dev_info.max_engine_clock =amdgpu_dpm_get_sclk (adev, false) *10 ; dev_info.max_memory_clock =amdgpu_dpm_get_mclk (adev, false) *10 ; } else if (amdgpu_sriov_vf(adev) && amdgim_is_hwperf(adev) &&
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +84 -72
194 lines not on this page · raw message
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 193/459 drm/amd/powerplay: set dpm_enabled flag but don't enable vcn dpm
In reply to a message not in the archiveFrom: Huang Rui <[email protected]>
This patch sets dpm_enabled flag but don't enable vcn dpm, because vcn dpm doesn't work so far and we needs to enable the sysfs interfaces.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 4 ++-- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +2 -2
@@ -249,7 +249,7 @@ static void amdgpu_vcn_idle_work_handler(struct work_struct *work)if (fences ==0 ) {amdgpu_gfx_off_ctrl (adev, true); -if (adev->pm.dpm_enabled) +if (adev->asic_type !=CHIP_NAVI10 && adev->pm.dpm_enabled)amdgpu_dpm_enable_uvd (adev, false);else amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_VCN,
@@ -266,7 +266,7 @@ void amdgpu_vcn_ring_begin_use(struct amdgpu_ring *ring)if (set_clocks) {amdgpu_gfx_off_ctrl (adev, false); -if (adev->pm.dpm_enabled) +if (adev->asic_type !=CHIP_NAVI10 && adev->pm.dpm_enabled)amdgpu_dpm_enable_uvd (adev, true);else amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_VCN,
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +1 -4
@@ -865,10 +865,7 @@ static int smu_hw_init(void *handle)if (!smu->pm_enabled) adev->pm.dpm_enabled = false;else - adev->pm.dpm_enabled = true; -/* TODO: will set dpm_enabled flag while VCN and DAL DPM is workable */ -if (adev->asic_type !=CHIP_NAVI10 ) - adev->pm.dpm_enabled = true; + adev->pm.dpm_enabled = true;/* TODO: will set dpm_enabled flag while VCN and DAL DPM is workable */ pr_info ("SMU is initialized successfully!\n" );
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx