mirror of
https://github.com/torvalds/linux.git
synced 2026-05-31 18:43:33 +02:00
drm/amdkfd: Add support for more per-process flag
Add support for more per-process flags starting with option to configure
MFMA precision for gfx 9.5
v2: Change flag name to KFD_PROC_FLAG_MFMA_HIGH_PRECISION
Remove unused else condition
v3: Bump the KFD API version
v4: Missed SH_MEM_CONFIG__PRECISION_MODE__SHIFT define. Added it.
Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Reviewed-by: Amber Lin <Amber.Lin@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
61972cd93a
commit
cf6d949a40
|
|
@ -606,7 +606,8 @@ static int kfd_ioctl_set_memory_policy(struct file *filep,
|
|||
default_policy,
|
||||
alternate_policy,
|
||||
(void __user *)args->alternate_aperture_base,
|
||||
args->alternate_aperture_size))
|
||||
args->alternate_aperture_size,
|
||||
args->misc_process_flag))
|
||||
err = -EINVAL;
|
||||
|
||||
out:
|
||||
|
|
|
|||
|
|
@ -2596,7 +2596,8 @@ static bool set_cache_memory_policy(struct device_queue_manager *dqm,
|
|||
enum cache_policy default_policy,
|
||||
enum cache_policy alternate_policy,
|
||||
void __user *alternate_aperture_base,
|
||||
uint64_t alternate_aperture_size)
|
||||
uint64_t alternate_aperture_size,
|
||||
u32 misc_process_properties)
|
||||
{
|
||||
bool retval = true;
|
||||
|
||||
|
|
@ -2611,7 +2612,8 @@ static bool set_cache_memory_policy(struct device_queue_manager *dqm,
|
|||
default_policy,
|
||||
alternate_policy,
|
||||
alternate_aperture_base,
|
||||
alternate_aperture_size);
|
||||
alternate_aperture_size,
|
||||
misc_process_properties);
|
||||
|
||||
if (retval)
|
||||
goto out;
|
||||
|
|
|
|||
|
|
@ -174,7 +174,8 @@ struct device_queue_manager_ops {
|
|||
enum cache_policy default_policy,
|
||||
enum cache_policy alternate_policy,
|
||||
void __user *alternate_aperture_base,
|
||||
uint64_t alternate_aperture_size);
|
||||
uint64_t alternate_aperture_size,
|
||||
u32 misc_process_properties);
|
||||
|
||||
int (*process_termination)(struct device_queue_manager *dqm,
|
||||
struct qcm_process_device *qpd);
|
||||
|
|
@ -210,7 +211,8 @@ struct device_queue_manager_asic_ops {
|
|||
enum cache_policy default_policy,
|
||||
enum cache_policy alternate_policy,
|
||||
void __user *alternate_aperture_base,
|
||||
uint64_t alternate_aperture_size);
|
||||
uint64_t alternate_aperture_size,
|
||||
u32 misc_process_properties);
|
||||
void (*init_sdma_vm)(struct device_queue_manager *dqm,
|
||||
struct queue *q,
|
||||
struct qcm_process_device *qpd);
|
||||
|
|
|
|||
|
|
@ -40,7 +40,8 @@ static bool set_cache_memory_policy_cik(struct device_queue_manager *dqm,
|
|||
enum cache_policy default_policy,
|
||||
enum cache_policy alternate_policy,
|
||||
void __user *alternate_aperture_base,
|
||||
uint64_t alternate_aperture_size);
|
||||
uint64_t alternate_aperture_size,
|
||||
u32 misc_process_properties);
|
||||
static int update_qpd_cik(struct device_queue_manager *dqm,
|
||||
struct qcm_process_device *qpd);
|
||||
static void init_sdma_vm(struct device_queue_manager *dqm,
|
||||
|
|
@ -88,7 +89,8 @@ static bool set_cache_memory_policy_cik(struct device_queue_manager *dqm,
|
|||
enum cache_policy default_policy,
|
||||
enum cache_policy alternate_policy,
|
||||
void __user *alternate_aperture_base,
|
||||
uint64_t alternate_aperture_size)
|
||||
uint64_t alternate_aperture_size,
|
||||
u32 misc_process_properties)
|
||||
{
|
||||
uint32_t default_mtype;
|
||||
uint32_t ape1_mtype;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,8 @@ static bool set_cache_memory_policy_v10(struct device_queue_manager *dqm,
|
|||
enum cache_policy default_policy,
|
||||
enum cache_policy alternate_policy,
|
||||
void __user *alternate_aperture_base,
|
||||
uint64_t alternate_aperture_size);
|
||||
uint64_t alternate_aperture_size,
|
||||
u32 misc_process_properties);
|
||||
|
||||
void device_queue_manager_init_v10(
|
||||
struct device_queue_manager_asic_ops *asic_ops)
|
||||
|
|
@ -61,7 +62,8 @@ static bool set_cache_memory_policy_v10(struct device_queue_manager *dqm,
|
|||
enum cache_policy default_policy,
|
||||
enum cache_policy alternate_policy,
|
||||
void __user *alternate_aperture_base,
|
||||
uint64_t alternate_aperture_size)
|
||||
uint64_t alternate_aperture_size,
|
||||
u32 misc_process_properties)
|
||||
{
|
||||
qpd->sh_mem_config = (SH_MEM_ALIGNMENT_MODE_UNALIGNED <<
|
||||
SH_MEM_CONFIG__ALIGNMENT_MODE__SHIFT) |
|
||||
|
|
|
|||
|
|
@ -35,7 +35,8 @@ static bool set_cache_memory_policy_v11(struct device_queue_manager *dqm,
|
|||
enum cache_policy default_policy,
|
||||
enum cache_policy alternate_policy,
|
||||
void __user *alternate_aperture_base,
|
||||
uint64_t alternate_aperture_size);
|
||||
uint64_t alternate_aperture_size,
|
||||
u32 misc_process_properties);
|
||||
|
||||
void device_queue_manager_init_v11(
|
||||
struct device_queue_manager_asic_ops *asic_ops)
|
||||
|
|
@ -60,7 +61,8 @@ static bool set_cache_memory_policy_v11(struct device_queue_manager *dqm,
|
|||
enum cache_policy default_policy,
|
||||
enum cache_policy alternate_policy,
|
||||
void __user *alternate_aperture_base,
|
||||
uint64_t alternate_aperture_size)
|
||||
uint64_t alternate_aperture_size,
|
||||
u32 misc_process_properties)
|
||||
{
|
||||
qpd->sh_mem_config = (SH_MEM_ALIGNMENT_MODE_UNALIGNED <<
|
||||
SH_MEM_CONFIG__ALIGNMENT_MODE__SHIFT) |
|
||||
|
|
|
|||
|
|
@ -35,7 +35,8 @@ static bool set_cache_memory_policy_v12(struct device_queue_manager *dqm,
|
|||
enum cache_policy default_policy,
|
||||
enum cache_policy alternate_policy,
|
||||
void __user *alternate_aperture_base,
|
||||
uint64_t alternate_aperture_size);
|
||||
uint64_t alternate_aperture_size,
|
||||
u32 misc_process_properties);
|
||||
|
||||
void device_queue_manager_init_v12(
|
||||
struct device_queue_manager_asic_ops *asic_ops)
|
||||
|
|
@ -60,7 +61,8 @@ static bool set_cache_memory_policy_v12(struct device_queue_manager *dqm,
|
|||
enum cache_policy default_policy,
|
||||
enum cache_policy alternate_policy,
|
||||
void __user *alternate_aperture_base,
|
||||
uint64_t alternate_aperture_size)
|
||||
uint64_t alternate_aperture_size,
|
||||
u32 misc_process_properties)
|
||||
{
|
||||
qpd->sh_mem_config = (SH_MEM_ALIGNMENT_MODE_UNALIGNED <<
|
||||
SH_MEM_CONFIG__ALIGNMENT_MODE__SHIFT) |
|
||||
|
|
|
|||
|
|
@ -35,7 +35,8 @@ static bool set_cache_memory_policy_v9(struct device_queue_manager *dqm,
|
|||
enum cache_policy default_policy,
|
||||
enum cache_policy alternate_policy,
|
||||
void __user *alternate_aperture_base,
|
||||
uint64_t alternate_aperture_size);
|
||||
uint64_t alternate_aperture_size,
|
||||
u32 misc_process_properties);
|
||||
|
||||
void device_queue_manager_init_v9(
|
||||
struct device_queue_manager_asic_ops *asic_ops)
|
||||
|
|
@ -60,7 +61,8 @@ static bool set_cache_memory_policy_v9(struct device_queue_manager *dqm,
|
|||
enum cache_policy default_policy,
|
||||
enum cache_policy alternate_policy,
|
||||
void __user *alternate_aperture_base,
|
||||
uint64_t alternate_aperture_size)
|
||||
uint64_t alternate_aperture_size,
|
||||
u32 misc_process_properties)
|
||||
{
|
||||
qpd->sh_mem_config = SH_MEM_ALIGNMENT_MODE_UNALIGNED <<
|
||||
SH_MEM_CONFIG__ALIGNMENT_MODE__SHIFT;
|
||||
|
|
@ -73,6 +75,11 @@ static bool set_cache_memory_policy_v9(struct device_queue_manager *dqm,
|
|||
KFD_GC_VERSION(dqm->dev->kfd) == IP_VERSION(9, 5, 0))
|
||||
qpd->sh_mem_config |= (1 << SH_MEM_CONFIG__F8_MODE__SHIFT);
|
||||
|
||||
if (KFD_GC_VERSION(dqm->dev->kfd) == IP_VERSION(9, 5, 0)) {
|
||||
if (misc_process_properties & KFD_PROC_FLAG_MFMA_HIGH_PRECISION)
|
||||
qpd->sh_mem_config |= 1 << SH_MEM_CONFIG__PRECISION_MODE__SHIFT;
|
||||
}
|
||||
|
||||
qpd->sh_mem_ape1_limit = 0;
|
||||
qpd->sh_mem_ape1_base = 0;
|
||||
qpd->sh_mem_bases = compute_sh_mem_bases_64bit(qpd_to_pdd(qpd));
|
||||
|
|
|
|||
|
|
@ -40,7 +40,8 @@ static bool set_cache_memory_policy_vi(struct device_queue_manager *dqm,
|
|||
enum cache_policy default_policy,
|
||||
enum cache_policy alternate_policy,
|
||||
void __user *alternate_aperture_base,
|
||||
uint64_t alternate_aperture_size);
|
||||
uint64_t alternate_aperture_size,
|
||||
u32 misc_process_properties);
|
||||
static int update_qpd_vi(struct device_queue_manager *dqm,
|
||||
struct qcm_process_device *qpd);
|
||||
static void init_sdma_vm(struct device_queue_manager *dqm,
|
||||
|
|
@ -89,7 +90,8 @@ static bool set_cache_memory_policy_vi(struct device_queue_manager *dqm,
|
|||
enum cache_policy default_policy,
|
||||
enum cache_policy alternate_policy,
|
||||
void __user *alternate_aperture_base,
|
||||
uint64_t alternate_aperture_size)
|
||||
uint64_t alternate_aperture_size,
|
||||
u32 misc_process_properties)
|
||||
{
|
||||
uint32_t default_mtype;
|
||||
uint32_t ape1_mtype;
|
||||
|
|
|
|||
|
|
@ -2261,11 +2261,13 @@
|
|||
#define SH_MEM_CONFIG__ADDRESS_MODE__SHIFT 0x0
|
||||
#define SH_MEM_CONFIG__ALIGNMENT_MODE__SHIFT 0x3
|
||||
#define SH_MEM_CONFIG__F8_MODE__SHIFT 0x8
|
||||
#define SH_MEM_CONFIG__PRECISION_MODE__SHIFT 0x9
|
||||
#define SH_MEM_CONFIG__RETRY_DISABLE__SHIFT 0xc
|
||||
#define SH_MEM_CONFIG__PRIVATE_NV__SHIFT 0xd
|
||||
#define SH_MEM_CONFIG__ADDRESS_MODE_MASK 0x00000001L
|
||||
#define SH_MEM_CONFIG__ALIGNMENT_MODE_MASK 0x00000018L
|
||||
#define SH_MEM_CONFIG__F8_MODE_MASK 0x00000100L
|
||||
#define SH_MEM_CONFIG__PRECISION_MODE_MASK 0x00000200L
|
||||
#define SH_MEM_CONFIG__RETRY_DISABLE_MASK 0x00001000L
|
||||
#define SH_MEM_CONFIG__PRIVATE_NV_MASK 0x00002000L
|
||||
//SP_MFMA_PORTD_RD_CONFIG
|
||||
|
|
|
|||
|
|
@ -43,9 +43,10 @@
|
|||
* - 1.15 - Enable managing mappings in compute VMs with GEM_VA ioctl
|
||||
* - 1.16 - Add contiguous VRAM allocation flag
|
||||
* - 1.17 - Add SDMA queue creation with target SDMA engine ID
|
||||
* - 1.18 - Rename pad in set_memory_policy_args to misc_process_flag
|
||||
*/
|
||||
#define KFD_IOCTL_MAJOR_VERSION 1
|
||||
#define KFD_IOCTL_MINOR_VERSION 17
|
||||
#define KFD_IOCTL_MINOR_VERSION 18
|
||||
|
||||
struct kfd_ioctl_get_version_args {
|
||||
__u32 major_version; /* from KFD */
|
||||
|
|
@ -150,6 +151,9 @@ struct kfd_dbg_device_info_entry {
|
|||
#define KFD_IOC_CACHE_POLICY_COHERENT 0
|
||||
#define KFD_IOC_CACHE_POLICY_NONCOHERENT 1
|
||||
|
||||
/* Misc. per process flags */
|
||||
#define KFD_PROC_FLAG_MFMA_HIGH_PRECISION (1 << 0)
|
||||
|
||||
struct kfd_ioctl_set_memory_policy_args {
|
||||
__u64 alternate_aperture_base; /* to KFD */
|
||||
__u64 alternate_aperture_size; /* to KFD */
|
||||
|
|
@ -157,7 +161,7 @@ struct kfd_ioctl_set_memory_policy_args {
|
|||
__u32 gpu_id; /* to KFD */
|
||||
__u32 default_policy; /* to KFD */
|
||||
__u32 alternate_policy; /* to KFD */
|
||||
__u32 pad;
|
||||
__u32 misc_process_flag; /* to KFD */
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user