All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felix Kuehling <Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	oded.gabbay-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Cc: Felix Kuehling <Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
Subject: [PATCH 25/25] drm/amdkfd: Add module option for testing large-BAR functionality
Date: Tue,  6 Feb 2018 20:32:54 -0500	[thread overview]
Message-ID: <1517967174-21709-26-git-send-email-Felix.Kuehling@amd.com> (raw)
In-Reply-To: <1517967174-21709-1-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>

Simulate large-BAR system by exporting only visible memory. This
limits the amount of available VRAM to the size of the BAR, but
enables CPU access to VRAM.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 5 +++++
 drivers/gpu/drm/amd/amdkfd/kfd_crat.c    | 3 +++
 drivers/gpu/drm/amd/amdkfd/kfd_module.c  | 5 +++++
 drivers/gpu/drm/amd/amdkfd/kfd_priv.h    | 6 ++++++
 4 files changed, 19 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
index ec48010..7c79144 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
@@ -1106,6 +1106,11 @@ bool kfd_dev_is_large_bar(struct kfd_dev *dev)
 {
 	struct kfd_local_mem_info mem_info;
 
+	if (debug_largebar) {
+		pr_debug("Simulate large-bar allocation on non large-bar machine\n");
+		return true;
+	}
+
 	if (dev->device_info->needs_iommu_device)
 		return false;
 
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
index 7493f47..3c6c4cdd 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
@@ -1117,6 +1117,9 @@ static int kfd_create_vcrat_image_gpu(void *pcrat_image,
 	sub_type_hdr = (typeof(sub_type_hdr))((char *)sub_type_hdr +
 			sub_type_hdr->length);
 
+	if (debug_largebar)
+		local_mem_info.local_mem_size_private = 0;
+
 	if (local_mem_info.local_mem_size_private == 0)
 		ret = kfd_fill_gpu_memory_affinity(&avail_size,
 				kdev, HSA_MEM_HEAP_TYPE_FB_PUBLIC,
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_module.c b/drivers/gpu/drm/amd/amdkfd/kfd_module.c
index 65574c6..b0acb06 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_module.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_module.c
@@ -71,6 +71,11 @@ module_param(send_sigterm, int, 0444);
 MODULE_PARM_DESC(send_sigterm,
 	"Send sigterm to HSA process on unhandled exception (0 = disable, 1 = enable)");
 
+int debug_largebar;
+module_param(debug_largebar, int, 0444);
+MODULE_PARM_DESC(debug_largebar,
+	"Debug large-bar flag used to simulate large-bar capability on non-large bar machine (0 = disable, 1 = enable)");
+
 int ignore_crat;
 module_param(ignore_crat, int, 0444);
 MODULE_PARM_DESC(ignore_crat,
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
index afe381f..63e86926 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
@@ -105,6 +105,12 @@ extern int cwsr_enable;
 extern int send_sigterm;
 
 /*
+ * This kernel module is used to simulate large bar machine on non-large bar
+ * enabled machines.
+ */
+extern int debug_largebar;
+
+/*
  * Ignore CRAT table during KFD initialization, can be used to work around
  * broken CRAT tables on some AMD systems
  */
-- 
2.7.4

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

  parent reply	other threads:[~2018-02-07  1:32 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-07  1:32 [PATCH 00/25] Add KFD GPUVM support for dGPUs v2 Felix Kuehling
     [not found] ` <1517967174-21709-1-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2018-02-07  1:32   ` [PATCH 01/25] drm/amdgpu: remove useless BUG_ONs Felix Kuehling
2018-02-07  1:32   ` [PATCH 02/25] drm/amdgpu: Replace kgd_mem with amdgpu_bo for kernel pinned gtt mem Felix Kuehling
2018-02-07  1:32   ` [PATCH 03/25] drm/amdgpu: Fix header file dependencies Felix Kuehling
2018-02-07  1:32   ` [PATCH 04/25] drm/amdgpu: Fix wrong mask in get_atc_vmid_pasid_mapping_pasid Felix Kuehling
2018-02-07  1:32   ` [PATCH 05/25] drm/amdgpu: Remove unused kfd2kgd interface Felix Kuehling
     [not found]     ` <1517967174-21709-6-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2018-02-11 12:44       ` Oded Gabbay
2018-02-07  1:32   ` [PATCH 06/25] drm/amdgpu: Add KFD eviction fence Felix Kuehling
     [not found]     ` <1517967174-21709-7-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2018-02-11 12:42       ` Oded Gabbay
2018-02-12 19:19         ` Felix Kuehling
2018-02-07  1:32   ` [PATCH 07/25] drm/amdgpu: Update kgd2kfd_shared_resources for dGPU support Felix Kuehling
     [not found]     ` <1517967174-21709-8-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2018-02-11 12:54       ` Oded Gabbay
2018-02-07  1:32   ` [PATCH 08/25] drm/amdgpu: add amdgpu_sync_clone Felix Kuehling
     [not found]     ` <1517967174-21709-9-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2018-02-11 12:54       ` Oded Gabbay
2018-02-07  1:32   ` [PATCH 09/25] drm/amdgpu: Add GPUVM memory management functions for KFD Felix Kuehling
     [not found]     ` <1517967174-21709-10-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2018-02-12  8:42       ` Oded Gabbay
     [not found]         ` <CAFCwf10ThSfo8zphxPRH549LoyJ1H+XM89rpwpSNeJeuWYayAA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-02-12 19:20           ` Felix Kuehling
2018-02-07  1:32   ` [PATCH 10/25] drm/amdgpu: Add submit IB function " Felix Kuehling
2018-02-07  1:32   ` [PATCH 11/25] drm/amdkfd: Centralize IOMMUv2 code and make it conditional Felix Kuehling
     [not found]     ` <1517967174-21709-12-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2018-02-07 11:20       ` Christian König
     [not found]         ` <281bede7-0ae6-c7d1-3d3a-a3e0497244c1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-02-07 20:51           ` Felix Kuehling
     [not found]             ` <bfe03de8-63fb-efb4-94e5-5eaf4628bfc1-5C7GfCeVMHo@public.gmane.org>
2018-02-08  8:16               ` Christian König
     [not found]                 ` <50866577-97a4-2786-18af-ddb60a435aea-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-02-12  9:06                   ` Oded Gabbay
2018-02-07  1:32   ` [PATCH 12/25] drm/amdkfd: Use per-device sched_policy Felix Kuehling
     [not found]     ` <1517967174-21709-13-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2018-02-12  9:07       ` Oded Gabbay
2018-02-07  1:32   ` [PATCH 13/25] drm/amdkfd: Remove unaligned memory access Felix Kuehling
     [not found]     ` <1517967174-21709-14-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2018-02-12  9:11       ` Oded Gabbay
2018-02-07  1:32   ` [PATCH 14/25] drm/amdkfd: Populate DRM render device minor Felix Kuehling
     [not found]     ` <1517967174-21709-15-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2018-02-09 12:34       ` Christian König
     [not found]         ` <16aa5300-7ddc-518a-2080-70cb31b6ad56-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-02-09 20:31           ` Felix Kuehling
     [not found]             ` <5f1c33b3-b3ed-f627-9b5c-347b2399d90f-5C7GfCeVMHo@public.gmane.org>
2018-02-11  9:55               ` Christian König
     [not found]                 ` <dd476550-9a48-3adc-30e6-8a94bd04833b-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-02-12 16:57                   ` Felix Kuehling
     [not found]                     ` <d11c598a-b51f-b957-7dae-485025a1ad34-5C7GfCeVMHo@public.gmane.org>
2018-02-12 23:23                       ` Felix Kuehling
     [not found]                         ` <ce14b4cd-2bb7-8f19-b464-ddf9f68f45ad-5C7GfCeVMHo@public.gmane.org>
2018-02-13 10:25                           ` Christian König
     [not found]                             ` <cbd18308-c464-125e-ef9f-180c12a9926a-5C7GfCeVMHo@public.gmane.org>
2018-02-13 16:42                               ` Felix Kuehling
     [not found]                                 ` <a2e39184-8db8-407d-6608-6ae211563459-5C7GfCeVMHo@public.gmane.org>
2018-02-13 17:06                                   ` Christian König
     [not found]                                     ` <8424282f-d196-3cb6-9a6e-a26f8be7d198-5C7GfCeVMHo@public.gmane.org>
2018-02-13 17:18                                       ` Felix Kuehling
     [not found]                                         ` <ebf4d6d7-2424-764f-0bc0-615240c82483-5C7GfCeVMHo@public.gmane.org>
2018-02-13 18:15                                           ` Christian König
     [not found]                                             ` <9f078a60-0cca-ba43-3e1c-c67c2b758988-5C7GfCeVMHo@public.gmane.org>
2018-02-13 19:18                                               ` Felix Kuehling
     [not found]                                                 ` <c991529e-2489-169c-cc34-96ed5bb94a12-5C7GfCeVMHo@public.gmane.org>
2018-02-13 23:17                                                   ` Felix Kuehling
     [not found]                                                     ` <b28b0e4c-f16b-0751-7957-45196c26da82-5C7GfCeVMHo@public.gmane.org>
2018-02-14  7:42                                                       ` Christian König
     [not found]                                                         ` <ca973468-f1af-b510-a6db-af29e279f5ca-5C7GfCeVMHo@public.gmane.org>
2018-02-14 16:35                                                           ` Felix Kuehling
     [not found]                                                             ` <50befcd2-6a1a-534e-1699-8556c4977b76-5C7GfCeVMHo@public.gmane.org>
2018-02-14 16:50                                                               ` Michel Dänzer
     [not found]                                                                 ` <ef95f1a4-7b30-47c8-8f33-4e6379d0694b-otUistvHUpPR7s880joybQ@public.gmane.org>
2018-02-14 18:12                                                                   ` Felix Kuehling
2018-02-14 18:15                                                               ` Christian König
     [not found]                                                                 ` <df9f32ce-7cfe-8684-1090-48f37863a3c7-5C7GfCeVMHo@public.gmane.org>
2018-02-14 18:24                                                                   ` Felix Kuehling
     [not found]                                                                     ` <78274290-eaf9-0f79-eb2b-ec7866a4cb70-5C7GfCeVMHo@public.gmane.org>
2018-02-14 18:33                                                                       ` Christian König
     [not found]                                                                         ` <e236e458-5114-49ec-9266-945d11f29035-5C7GfCeVMHo@public.gmane.org>
2018-02-14 19:01                                                                           ` Felix Kuehling
     [not found]                                                                             ` <2421ca47-773e-d9c7-0fec-d573812df2c4-5C7GfCeVMHo@public.gmane.org>
2018-02-14 19:04                                                                               ` Felix Kuehling
2018-02-14  8:50                                                   ` Michel Dänzer
     [not found]                                                     ` <255915a6-f101-554a-9087-1fd792ee1de3-otUistvHUpPR7s880joybQ@public.gmane.org>
2018-02-14 16:39                                                       ` Felix Kuehling
2018-02-13 10:46                       ` Christian König
     [not found]                         ` <d5499f91-6ebf-94ae-f933-d57cd953e01d-5C7GfCeVMHo@public.gmane.org>
2018-02-13 16:56                           ` Felix Kuehling
     [not found]                             ` <a776f882-2612-35a1-431b-2e939cd36f29-5C7GfCeVMHo@public.gmane.org>
2018-02-13 18:45                               ` Christian König
     [not found]                                 ` <6c9d2b9e-7ae9-099a-9d02-bc2a4985a95a-5C7GfCeVMHo@public.gmane.org>
2018-02-13 19:22                                   ` Felix Kuehling
     [not found]                                     ` <b6af300e-be33-b802-385a-20980d95545d-5C7GfCeVMHo@public.gmane.org>
2018-02-14  7:49                                       ` Christian König
2018-02-07  1:32   ` [PATCH 15/25] drm/amdkfd: Add GPUVM virtual address space to PDD Felix Kuehling
     [not found]     ` <1517967174-21709-16-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2018-02-12  9:16       ` Oded Gabbay
2018-02-07  1:32   ` [PATCH 16/25] drm/amdkfd: Implement KFD process eviction/restore Felix Kuehling
     [not found]     ` <1517967174-21709-17-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2018-02-12  9:36       ` Oded Gabbay
2018-02-07  1:32   ` [PATCH 17/25] uapi: Fix type used in ioctl parameter structures Felix Kuehling
     [not found]     ` <1517967174-21709-18-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2018-02-12  9:41       ` Oded Gabbay
2018-02-07  1:32   ` [PATCH 18/25] drm/amdkfd: Remove limit on number of GPUs Felix Kuehling
2018-02-07  1:32   ` [PATCH 19/25] drm/amdkfd: Aperture setup for dGPUs Felix Kuehling
2018-02-07  1:32   ` [PATCH 20/25] drm/amdkfd: Add per-process IDR for buffer handles Felix Kuehling
2018-02-07  1:32   ` [PATCH 21/25] drm/amdkfd: Allocate CWSR trap handler memory for dGPUs Felix Kuehling
2018-02-07  1:32   ` [PATCH 22/25] drm/amdkfd: Add TC flush on VMID deallocation for Hawaii Felix Kuehling
2018-02-07  1:32   ` [PATCH 23/25] drm/amdkfd: Add ioctls for GPUVM memory management Felix Kuehling
2018-02-07  1:32   ` [PATCH 24/25] drm/amdkfd: Kmap event page for dGPUs Felix Kuehling
2018-02-07  1:32   ` Felix Kuehling [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-01-27  1:09 [PATCH 00/25] Add KFD GPUVM support " Felix Kuehling
     [not found] ` <1517015381-1080-1-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2018-01-27  1:09   ` [PATCH 25/25] drm/amdkfd: Add module option for testing large-BAR functionality 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=1517967174-21709-26-git-send-email-Felix.Kuehling@amd.com \
    --to=felix.kuehling-5c7gfcevmho@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=oded.gabbay-Re5JQEeQqe8AvxtiuMwx3w@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.