aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/4421-drm-amdkfd-Avoid-using-doorbell_off-as-offset-in-pro.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/4421-drm-amdkfd-Avoid-using-doorbell_off-as-offset-in-pro.patch')
-rw-r--r--meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/4421-drm-amdkfd-Avoid-using-doorbell_off-as-offset-in-pro.patch120
1 files changed, 120 insertions, 0 deletions
diff --git a/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/4421-drm-amdkfd-Avoid-using-doorbell_off-as-offset-in-pro.patch b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/4421-drm-amdkfd-Avoid-using-doorbell_off-as-offset-in-pro.patch
new file mode 100644
index 00000000..c3440c11
--- /dev/null
+++ b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/4421-drm-amdkfd-Avoid-using-doorbell_off-as-offset-in-pro.patch
@@ -0,0 +1,120 @@
+From b1ccb6a03bc794d974bb99fda908e3bc23c36a8e Mon Sep 17 00:00:00 2001
+From: Yong Zhao <Yong.Zhao@amd.com>
+Date: Tue, 15 Jan 2019 13:58:57 -0500
+Subject: [PATCH 4421/4736] drm/amdkfd: Avoid using doorbell_off as offset in
+ process doorbell pages
+
+dorbell_off in the queue properties is mainly used for the doorbell dw
+offset in pci bar. We should not set it to the doorbell byte offset in
+process doorbell pages. This makes the code much easier to read.
+
+Change-Id: I553045ff9fcb3676900c92d10426f2ceb3660005
+Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
+Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
+---
+ drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 12 ++++++------
+ drivers/gpu/drm/amd/amdkfd/kfd_dbgdev.c | 2 +-
+ drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 3 ++-
+ .../gpu/drm/amd/amdkfd/kfd_process_queue_manager.c | 10 +++++++---
+ 4 files changed, 16 insertions(+), 11 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+index 59bfbed3c000..d9cdb25974f9 100644
+--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
++++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+@@ -282,6 +282,7 @@ static int kfd_ioctl_create_queue(struct file *filep, struct kfd_process *p,
+ unsigned int queue_id;
+ struct kfd_process_device *pdd;
+ struct queue_properties q_properties;
++ uint32_t doorbell_offset_in_process = 0;
+
+ memset(&q_properties, 0, sizeof(struct queue_properties));
+
+@@ -310,7 +311,8 @@ static int kfd_ioctl_create_queue(struct file *filep, struct kfd_process *p,
+ p->pasid,
+ dev->id);
+
+- err = pqm_create_queue(&p->pqm, dev, filep, &q_properties, &queue_id);
++ err = pqm_create_queue(&p->pqm, dev, filep, &q_properties, &queue_id,
++ &doorbell_offset_in_process);
+ if (err != 0)
+ goto err_create_queue;
+
+@@ -321,12 +323,10 @@ static int kfd_ioctl_create_queue(struct file *filep, struct kfd_process *p,
+ args->doorbell_offset = KFD_MMAP_TYPE_DOORBELL;
+ args->doorbell_offset |= KFD_MMAP_GPU_ID(args->gpu_id);
+ if (KFD_IS_SOC15(dev->device_info->asic_family))
+- /* On SOC15 ASICs, doorbell allocation must be
+- * per-device, and independent from the per-process
+- * queue_id. Return the doorbell offset within the
+- * doorbell aperture to user mode.
++ /* On SOC15 ASICs, include the doorbell offset within the
++ * process doorbell frame, which is 2 pages.
+ */
+- args->doorbell_offset |= q_properties.doorbell_off;
++ args->doorbell_offset |= doorbell_offset_in_process;
+
+ mutex_unlock(&p->mutex);
+
+diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_dbgdev.c b/drivers/gpu/drm/amd/amdkfd/kfd_dbgdev.c
+index 1eb0c2bedcd9..142ac7954032 100644
+--- a/drivers/gpu/drm/amd/amdkfd/kfd_dbgdev.c
++++ b/drivers/gpu/drm/amd/amdkfd/kfd_dbgdev.c
+@@ -192,7 +192,7 @@ static int dbgdev_register_diq(struct kfd_dbgdev *dbgdev)
+ properties.type = KFD_QUEUE_TYPE_DIQ;
+
+ status = pqm_create_queue(dbgdev->pqm, dbgdev->dev, NULL,
+- &properties, &qid);
++ &properties, &qid, NULL);
+
+ if (status) {
+ pr_err("Failed to create DIQ\n");
+diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
+index ff60fb75f224..e937679f8ca1 100644
+--- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
++++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
+@@ -1045,7 +1045,8 @@ int pqm_create_queue(struct process_queue_manager *pqm,
+ struct kfd_dev *dev,
+ struct file *f,
+ struct queue_properties *properties,
+- unsigned int *qid);
++ unsigned int *qid,
++ uint32_t *p_doorbell_offset_in_process);
+ int pqm_destroy_queue(struct process_queue_manager *pqm, unsigned int qid);
+ int pqm_update_queue(struct process_queue_manager *pqm, unsigned int qid,
+ struct queue_properties *p);
+diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
+index 227fb0ec8115..591b5d05ab53 100644
+--- a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
++++ b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
+@@ -192,7 +192,8 @@ int pqm_create_queue(struct process_queue_manager *pqm,
+ struct kfd_dev *dev,
+ struct file *f,
+ struct queue_properties *properties,
+- unsigned int *qid)
++ unsigned int *qid,
++ uint32_t *p_doorbell_offset_in_process)
+ {
+ int retval;
+ struct kfd_process_device *pdd;
+@@ -303,12 +304,15 @@ int pqm_create_queue(struct process_queue_manager *pqm,
+ goto err_create_queue;
+ }
+
+- if (q)
++ if (q && p_doorbell_offset_in_process)
+ /* Return the doorbell offset within the doorbell page
+ * to the caller so it can be passed up to user mode
+ * (in bytes).
++ * There are always 1024 doorbells per process, so in case
++ * of 8-byte doorbells, there are two doorbell pages per
++ * process.
+ */
+- properties->doorbell_off =
++ *p_doorbell_offset_in_process =
+ (q->properties.doorbell_off * sizeof(uint32_t)) &
+ (kfd_doorbell_process_slice(dev) - 1);
+
+--
+2.17.1
+