From: Felix Kuehling <Felix.Kuehling@amd.com>
To: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Cc: Philip Yang <Philip.Yang@amd.com>
Subject: [PATCH 16/34] drm/amdkfd: support xgmi same hive mapping
Date: Thu, 1 Apr 2021 00:22:10 -0400 [thread overview]
Message-ID: <20210401042228.1423-17-Felix.Kuehling@amd.com> (raw)
In-Reply-To: <20210401042228.1423-1-Felix.Kuehling@amd.com>
From: Philip Yang <Philip.Yang@amd.com>
amdgpu_gmc_get_vm_pte use bo_va->is_xgmi same hive information to set
pte flags to update GPU mapping. Add local structure variable bo_va, and
update bo_va.is_xgmi, pass it to mapping->bo_va while mapping to GPU.
Assuming xgmi pstate is hi after boot.
Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
---
drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 27 ++++++++++++++++++++++++---
1 file changed, 24 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
index f01bc3b4010d..f557f67b9d2d 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
@@ -26,6 +26,8 @@
#include "amdgpu_object.h"
#include "amdgpu_vm.h"
#include "amdgpu_mn.h"
+#include "amdgpu.h"
+#include "amdgpu_xgmi.h"
#include "kfd_priv.h"
#include "kfd_svm.h"
@@ -953,21 +955,27 @@ svm_range_unmap_from_gpus(struct svm_range *prange, unsigned long start,
static int
svm_range_map_to_gpu(struct amdgpu_device *adev, struct amdgpu_vm *vm,
struct svm_range *prange, dma_addr_t *dma_addr,
- struct dma_fence **fence)
+ struct amdgpu_device *bo_adev, struct dma_fence **fence)
{
+ struct amdgpu_bo_va bo_va;
uint64_t pte_flags;
int r = 0;
pr_debug("svms 0x%p [0x%lx 0x%lx]\n", prange->svms, prange->start,
prange->last);
+ if (prange->svm_bo && prange->ttm_res) {
+ bo_va.is_xgmi = amdgpu_xgmi_same_hive(adev, bo_adev);
+ prange->mapping.bo_va = &bo_va;
+ }
+
prange->mapping.start = prange->start;
prange->mapping.last = prange->last;
prange->mapping.offset = prange->offset;
pte_flags = svm_range_get_pte_flags(adev, prange);
prange->mapping.flags = pte_flags;
- r = amdgpu_vm_bo_update_mapping(adev, adev, vm, false, false, NULL,
+ r = amdgpu_vm_bo_update_mapping(adev, bo_adev, vm, false, false, NULL,
prange->mapping.start,
prange->mapping.last, pte_flags,
prange->mapping.offset,
@@ -990,6 +998,7 @@ svm_range_map_to_gpu(struct amdgpu_device *adev, struct amdgpu_vm *vm,
*fence = dma_fence_get(vm->last_update);
out:
+ prange->mapping.bo_va = NULL;
return r;
}
@@ -997,12 +1006,18 @@ static int svm_range_map_to_gpus(struct svm_range *prange,
unsigned long *bitmap, bool wait)
{
struct kfd_process_device *pdd;
+ struct amdgpu_device *bo_adev;
struct amdgpu_device *adev;
struct kfd_process *p;
struct dma_fence *fence = NULL;
uint32_t gpuidx;
int r = 0;
+ if (prange->svm_bo && prange->ttm_res)
+ bo_adev = amdgpu_ttm_adev(prange->svm_bo->bo->tbo.bdev);
+ else
+ bo_adev = NULL;
+
p = container_of(prange->svms, struct kfd_process, svms);
for_each_set_bit(gpuidx, bitmap, MAX_GPU_INSTANCE) {
pdd = kfd_process_device_from_gpuidx(p, gpuidx);
@@ -1016,8 +1031,14 @@ static int svm_range_map_to_gpus(struct svm_range *prange,
if (IS_ERR(pdd))
return -EINVAL;
+ if (bo_adev && adev != bo_adev &&
+ !amdgpu_xgmi_same_hive(adev, bo_adev)) {
+ pr_debug("cannot map to device idx %d\n", gpuidx);
+ continue;
+ }
+
r = svm_range_map_to_gpu(adev, pdd->vm, prange,
- prange->dma_addr[gpuidx],
+ prange->dma_addr[gpuidx], bo_adev,
wait ? &fence : NULL);
if (r)
break;
--
2.31.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2021-04-01 4:23 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-01 4:21 [PATCH 00/34] Add HMM-based SVM memory manager to KFD v3 Felix Kuehling
2021-04-01 4:21 ` [PATCH 01/34] drm/amdkfd: helper to convert gpu id and idx Felix Kuehling
2021-04-01 4:21 ` [PATCH 02/34] drm/amdkfd: add svm ioctl API Felix Kuehling
2021-04-01 4:21 ` [PATCH 03/34] drm/amdkfd: register svm range Felix Kuehling
2021-04-01 10:04 ` kernel test robot
2021-04-01 4:21 ` [PATCH 04/34] drm/amdkfd: add svm ioctl GET_ATTR op Felix Kuehling
2021-04-01 4:21 ` [PATCH 05/34] drm/amdgpu: add common HMM get pages function Felix Kuehling
2021-04-01 4:22 ` [PATCH 06/34] drm/amdkfd: validate svm range system memory Felix Kuehling
2021-04-01 4:22 ` [PATCH 07/34] drm/amdkfd: deregister svm range Felix Kuehling
2021-04-01 11:48 ` kernel test robot
2021-04-01 4:22 ` [PATCH 08/34] drm/amdgpu: export vm update mapping interface Felix Kuehling
2021-04-01 4:22 ` [PATCH 09/34] drm/amdkfd: map svm range to GPUs Felix Kuehling
2021-04-01 13:28 ` kernel test robot
2021-04-01 4:22 ` [PATCH 10/34] drm/amdkfd: svm range eviction and restore Felix Kuehling
2021-04-01 15:19 ` kernel test robot
2021-04-01 4:22 ` [PATCH 11/34] drm/amdgpu: Enable retry faults unconditionally on Aldebaran Felix Kuehling
2021-04-01 4:22 ` [PATCH 12/34] drm/amdkfd: add xnack enabled flag to kfd_process Felix Kuehling
2021-04-01 4:22 ` [PATCH 13/34] drm/amdkfd: add ioctl to configure and query xnack retries Felix Kuehling
2021-04-01 4:22 ` [PATCH 14/34] drm/amdkfd: register HMM device private zone Felix Kuehling
2021-04-01 19:38 ` kernel test robot
2021-04-01 4:22 ` [PATCH 15/34] drm/amdkfd: validate vram svm range from TTM Felix Kuehling
2021-04-01 4:22 ` Felix Kuehling [this message]
2021-04-01 4:22 ` [PATCH 17/34] drm/amdkfd: copy memory through gart table Felix Kuehling
2021-04-01 4:22 ` [PATCH 18/34] drm/amdkfd: HMM migrate ram to vram Felix Kuehling
2021-04-01 4:22 ` [PATCH 19/34] drm/amdkfd: HMM migrate vram to ram Felix Kuehling
2021-04-01 22:37 ` kernel test robot
2021-04-01 4:22 ` [PATCH 20/34] drm/amdkfd: invalidate tables on page retry fault Felix Kuehling
2021-04-01 4:22 ` [PATCH 21/34] drm/amdgpu: enable 48-bit IH timestamp counter Felix Kuehling
2021-04-01 4:22 ` [PATCH 22/34] drm/amdkfd: page table restore through svm API Felix Kuehling
2021-04-01 4:22 ` [PATCH 23/34] drm/amdkfd: SVM API call to restore page tables Felix Kuehling
2021-04-01 4:22 ` [PATCH 24/34] drm/amdkfd: add svm_bo reference for eviction fence Felix Kuehling
2021-04-01 4:22 ` [PATCH 25/34] drm/amdgpu: add param bit flag to create SVM BOs Felix Kuehling
2021-04-01 4:22 ` [PATCH 26/34] drm/amdkfd: add svm_bo eviction mechanism support Felix Kuehling
2021-04-01 4:22 ` [PATCH 27/34] drm/amdgpu: svm bo enable_signal call condition Felix Kuehling
2021-04-01 4:22 ` [PATCH 28/34] drm/amdgpu: add svm_bo eviction to enable_signal cb Felix Kuehling
2021-04-01 4:22 ` [PATCH 29/34] drm/amdgpu: reserve fence slot to update page table Felix Kuehling
2021-04-01 4:22 ` [PATCH 30/34] drm/amdkfd: refine migration policy with xnack on Felix Kuehling
2021-04-01 4:22 ` [PATCH 31/34] drm/amdkfd: add svm range validate timestamp Felix Kuehling
2021-04-01 4:22 ` [PATCH 32/34] drm/amdkfd: multiple gpu migrate vram to vram Felix Kuehling
2021-04-01 4:22 ` [PATCH 33/34] drm/amdkfd: Add SVM API support capability bits Felix Kuehling
2021-04-01 4:22 ` [PATCH 34/34] drm/amdkfd: Add CONFIG_HSA_AMD_SVM Felix Kuehling
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210401042228.1423-17-Felix.Kuehling@amd.com \
--to=felix.kuehling@amd.com \
--cc=Philip.Yang@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=dri-devel@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).