AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Zeng, Oak" <Oak.Zeng-5C7GfCeVMHo@public.gmane.org>
To: "amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
	<amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Cc: "Kuehling, Felix" <Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>,
	"Zeng, Oak" <Oak.Zeng-5C7GfCeVMHo@public.gmane.org>,
	"Koenig,
	Christian" <Christian.Koenig-5C7GfCeVMHo@public.gmane.org>,
	"Keely, Sean" <Sean.Keely-5C7GfCeVMHo@public.gmane.org>
Subject: [PATCH 5/5] amd/amdgpu: Introduce new page mapping scheme for arcturus
Date: Wed, 7 Aug 2019 02:31:14 +0000	[thread overview]
Message-ID: <1565145062-16674-5-git-send-email-Oak.Zeng@amd.com> (raw)
In-Reply-To: <1565145062-16674-1-git-send-email-Oak.Zeng-5C7GfCeVMHo@public.gmane.org>

The new memory mapping scheme is:
Fine-grain coherency: local CC and remote UC, with snoop.
Coarse-grain coherency: local RW and remote UC, with snoop.

Change-Id: I6a071249f953cbed813bfd953b6a2e0826f54f86
Signed-off-by: Oak Zeng <Oak.Zeng@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c |  1 +
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 23 ++++++++++++++++++++++-
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
index 2b2af6a..51dae7f 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
@@ -420,6 +420,7 @@ static uint32_t gmc_v6_0_get_vm_mapping_flags(struct amdgpu_device *adev,
 
 	return mapping_flags;
 }
+
 static void gmc_v6_0_set_fault_enable_default(struct amdgpu_device *adev,
 					      bool value)
 {
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
index 8beefaf..718b388 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
@@ -687,6 +687,27 @@ static uint32_t gmc_v9_0_get_vm_mapping_flags(struct amdgpu_device *adev,
 	return mapping_flags;
 }
 
+static uint32_t gmc_v9_0_arcturus_get_vm_mapping_flags(struct amdgpu_device *adev,
+				uint32_t alloc_flags, bool remote_mapping)
+{
+	uint32_t mapping_flags = AMDGPU_VM_PAGE_READABLE;
+
+	if (alloc_flags & ALLOC_MEM_FLAGS_WRITABLE)
+		mapping_flags |= AMDGPU_VM_PAGE_WRITEABLE;
+	if (alloc_flags & ALLOC_MEM_FLAGS_EXECUTABLE)
+		mapping_flags |= AMDGPU_VM_PAGE_EXECUTABLE;
+	if ((alloc_flags & ALLOC_MEM_FLAGS_VRAM) && !remote_mapping) {
+		if (alloc_flags & ALLOC_MEM_FLAGS_COHERENT)
+			mapping_flags |= AMDGPU_VM_MTYPE_CC;
+		else
+			mapping_flags |= AMDGPU_VM_MTYPE_RW;
+	} else {
+		mapping_flags |= AMDGPU_VM_MTYPE_UC;
+		mapping_flags |= AMDGPU_VM_PAGE_SNOOPED;
+	}
+
+	return mapping_flags;
+}
 
 static const struct amdgpu_gmc_funcs gmc_v9_0_gmc_funcs = {
 	.flush_gpu_tlb = gmc_v9_0_flush_gpu_tlb,
@@ -703,7 +724,7 @@ static const struct amdgpu_gmc_funcs gmc_v9_0_arcturus_gmc_funcs = {
 	.emit_pasid_mapping = gmc_v9_0_emit_pasid_mapping,
 	.get_vm_pte_flags = gmc_v9_0_arcturus_get_vm_pte_flags,
 	.get_vm_pde = gmc_v9_0_get_vm_pde,
-	.get_vm_mapping_flags = gmc_v9_0_get_vm_mapping_flags
+	.get_vm_mapping_flags = gmc_v9_0_arcturus_get_vm_mapping_flags
 };
 
 static void gmc_v9_0_set_gmc_funcs(struct amdgpu_device *adev)
-- 
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2019-08-07  2:31 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-07  2:31 [PATCH 1/5] drm/amdgpu: Extends amdgpu vm definitions Zeng, Oak
     [not found] ` <1565145062-16674-1-git-send-email-Oak.Zeng-5C7GfCeVMHo@public.gmane.org>
2019-08-07  2:31   ` [PATCH 2/5] drm/amdgpu: Support new arcturus mtype Zeng, Oak
     [not found]     ` <1565145062-16674-2-git-send-email-Oak.Zeng-5C7GfCeVMHo@public.gmane.org>
2019-08-07  3:59       ` Kuehling, Felix
2019-08-07  2:31   ` [PATCH 3/5] drm/amdkfd: Postpone memory mapping flags calculation to mapping time Zeng, Oak
     [not found]     ` <1565145062-16674-3-git-send-email-Oak.Zeng-5C7GfCeVMHo@public.gmane.org>
2019-08-07  4:05       ` Kuehling, Felix
     [not found]         ` <ad0aa642-f275-a239-288f-6d83ed60f936-5C7GfCeVMHo@public.gmane.org>
2019-08-09  1:41           ` Zeng, Oak
2019-08-07  2:31   ` [PATCH 4/5] drm/amdgpu: Support snooped PTE flag Zeng, Oak
2019-08-07  2:31   ` Zeng, Oak [this message]
     [not found]     ` <1565145062-16674-5-git-send-email-Oak.Zeng-5C7GfCeVMHo@public.gmane.org>
2019-08-07  4:10       ` [PATCH 5/5] amd/amdgpu: Introduce new page mapping scheme for arcturus Kuehling, Felix
2019-08-07  8:41   ` [PATCH 1/5] drm/amdgpu: Extends amdgpu vm definitions Christian König
     [not found]     ` <3e4f2f68-8840-d85c-052e-fc54dbf45fd4-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-08-08 16:02       ` Zeng, Oak
     [not found]         ` <BL0PR12MB2580601F44DB50051768070080D70-b4cIHhjg/p/XzH18dTCKOgdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2019-08-08 16:09           ` Deucher, Alexander
     [not found]             ` <BN6PR12MB1809D2F0A97155733CA3FC6EF7D70-/b2+HYfkarSEx6ez0IUAagdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2019-08-08 16:23               ` Zeng, Oak
2019-08-08 16:28               ` Koenig, Christian
  -- strict thread matches above, loose matches on Subject: below --
2019-08-09  2:15 Zeng, Oak
     [not found] ` <1565316926-19516-1-git-send-email-Oak.Zeng-5C7GfCeVMHo@public.gmane.org>
2019-08-09  2:15   ` [PATCH 5/5] amd/amdgpu: Introduce new page mapping scheme for arcturus Zeng, Oak

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=1565145062-16674-5-git-send-email-Oak.Zeng@amd.com \
    --to=oak.zeng-5c7gfcevmho@public.gmane.org \
    --cc=Christian.Koenig-5C7GfCeVMHo@public.gmane.org \
    --cc=Felix.Kuehling-5C7GfCeVMHo@public.gmane.org \
    --cc=Sean.Keely-5C7GfCeVMHo@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.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