All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Deucher <alexdeucher@gmail.com>
To: amd-gfx@lists.freedesktop.org
Cc: "Alex Deucher" <alexander.deucher@amd.com>,
	"Christian König" <christian.koenig@amd.com>
Subject: [PATCH 15/17] drm/amdgpu: move stolen memory from gmc to mman
Date: Thu, 30 Jul 2020 16:04:12 -0400	[thread overview]
Message-ID: <20200730200414.40485-16-alexander.deucher@amd.com> (raw)
In-Reply-To: <20200730200414.40485-1-alexander.deucher@amd.com>

It's more related to memory management than memory
controller.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 12 ++++++------
 drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h |  5 -----
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 20 ++++++++++----------
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h |  6 ++++++
 4 files changed, 22 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
index 0bd7b3797534..213ef090bb0e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
@@ -449,10 +449,10 @@ void amdgpu_gmc_get_vbios_allocations(struct amdgpu_device *adev)
 	case CHIP_VEGA10:
 	case CHIP_RAVEN:
 	case CHIP_RENOIR:
-		adev->gmc.keep_stolen_vga_memory = true;
+		adev->mman.keep_stolen_vga_memory = true;
 		break;
 	default:
-		adev->gmc.keep_stolen_vga_memory = false;
+		adev->mman.keep_stolen_vga_memory = false;
 		break;
 	}
 
@@ -466,10 +466,10 @@ void amdgpu_gmc_get_vbios_allocations(struct amdgpu_device *adev)
 		size = 0;
 
 	if (size > AMDGPU_VBIOS_VGA_ALLOCATION) {
-		adev->gmc.stolen_vga_size = AMDGPU_VBIOS_VGA_ALLOCATION;
-		adev->gmc.stolen_extended_size = size - adev->gmc.stolen_vga_size;
+		adev->mman.stolen_vga_size = AMDGPU_VBIOS_VGA_ALLOCATION;
+		adev->mman.stolen_extended_size = size - adev->mman.stolen_vga_size;
 	} else {
-		adev->gmc.stolen_vga_size = size;
-		adev->gmc.stolen_extended_size = 0;
+		adev->mman.stolen_vga_size = size;
+		adev->mman.stolen_extended_size = 0;
 	}
 }
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h
index c2a85d0b1546..d61bbde4c7d2 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h
@@ -215,11 +215,6 @@ struct amdgpu_gmc {
 	uint8_t			vram_vendor;
 	uint32_t                srbm_soft_reset;
 	bool			prt_warning;
-	uint64_t		stolen_vga_size;
-	struct amdgpu_bo	*stolen_vga_memory;
-	uint64_t		stolen_extended_size;
-	struct amdgpu_bo	*stolen_extended_memory;
-	bool			keep_stolen_vga_memory;
 	uint32_t		sdpif_register;
 	/* apertures */
 	u64			shared_aperture_start;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 3df9d5a53741..cc1a5b2876b6 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -1978,16 +1978,16 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
 	 * This is used for VGA emulation and pre-OS scanout buffers to
 	 * avoid display artifacts while transitioning between pre-OS
 	 * and driver.  */
-	r = amdgpu_bo_create_kernel_at(adev, 0, adev->gmc.stolen_vga_size,
+	r = amdgpu_bo_create_kernel_at(adev, 0, adev->mman.stolen_vga_size,
 				       AMDGPU_GEM_DOMAIN_VRAM,
-				       &adev->gmc.stolen_vga_memory,
+				       &adev->mman.stolen_vga_memory,
 				       NULL);
 	if (r)
 		return r;
-	r = amdgpu_bo_create_kernel_at(adev, adev->gmc.stolen_vga_size,
-				       adev->gmc.stolen_extended_size,
+	r = amdgpu_bo_create_kernel_at(adev, adev->mman.stolen_vga_size,
+				       adev->mman.stolen_extended_size,
 				       AMDGPU_GEM_DOMAIN_VRAM,
-				       &adev->gmc.stolen_extended_memory,
+				       &adev->mman.stolen_extended_memory,
 				       NULL);
 	if (r)
 		return r;
@@ -2048,9 +2048,9 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
 void amdgpu_ttm_late_init(struct amdgpu_device *adev)
 {
 	/* return the VGA stolen memory (if any) back to VRAM */
-	if (!adev->gmc.keep_stolen_vga_memory)
-		amdgpu_bo_free_kernel(&adev->gmc.stolen_vga_memory, NULL, NULL);
-	amdgpu_bo_free_kernel(&adev->gmc.stolen_extended_memory, NULL, NULL);
+	if (!adev->mman.keep_stolen_vga_memory)
+		amdgpu_bo_free_kernel(&adev->mman.stolen_vga_memory, NULL, NULL);
+	amdgpu_bo_free_kernel(&adev->mman.stolen_extended_memory, NULL, NULL);
 }
 
 /**
@@ -2063,8 +2063,8 @@ void amdgpu_ttm_fini(struct amdgpu_device *adev)
 
 	amdgpu_ttm_training_reserve_vram_fini(adev);
 	/* return the stolen vga memory back to VRAM */
-	if (adev->gmc.keep_stolen_vga_memory)
-		amdgpu_bo_free_kernel(&adev->gmc.stolen_vga_memory, NULL, NULL);
+	if (adev->mman.keep_stolen_vga_memory)
+		amdgpu_bo_free_kernel(&adev->mman.stolen_vga_memory, NULL, NULL);
 	/* return the IP Discovery TMR memory back to VRAM */
 	amdgpu_bo_free_kernel(&adev->discovery_memory, NULL, NULL);
 	amdgpu_ttm_fw_reserve_vram_fini(adev);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
index 17c8d0d7bcc3..98af87f38f3e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
@@ -59,6 +59,12 @@ struct amdgpu_mman {
 	struct mutex				gtt_window_lock;
 	/* Scheduler entity for buffer moves */
 	struct drm_sched_entity			entity;
+
+	uint64_t		stolen_vga_size;
+	struct amdgpu_bo	*stolen_vga_memory;
+	uint64_t		stolen_extended_size;
+	struct amdgpu_bo	*stolen_extended_memory;
+	bool			keep_stolen_vga_memory;
 };
 
 struct amdgpu_copy_mem {
-- 
2.25.4

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

  parent reply	other threads:[~2020-07-30 20:04 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-30 20:03 [PATCH 00/17] rework stolen pre-OS fb allocation handling (v3) Alex Deucher
2020-07-30 20:03 ` [PATCH 01/17] drm/amdgpu: handle bo size 0 in amdgpu_bo_create_kernel_at (v2) Alex Deucher
2020-07-30 20:03 ` [PATCH 02/17] drm/amdgpu: use create_at for the stolen pre-OS buffer Alex Deucher
2020-07-30 20:04 ` [PATCH 03/17] drm/amdgpu: use a define for the memory size of the vga emulator Alex Deucher
2020-07-30 20:04 ` [PATCH 04/17] drm/amdgpu: move stolen vga bo from amdgpu to amdgpu.gmc Alex Deucher
2020-07-30 20:04 ` [PATCH 05/17] drm/amdgpu: move keep stolen memory check into gmc core Alex Deucher
2020-07-30 20:04 ` [PATCH 06/17] drm/amdgpu: add support for extended stolen vga memory Alex Deucher
2020-07-30 20:04 ` [PATCH 07/17] drm/amdgpu/gmc: add new helper to get the FB size used by pre-OS console Alex Deucher
2020-07-30 20:04 ` [PATCH 08/17] drm/amdgpu/gmc6: switch to using amdgpu_gmc_get_vbios_allocations Alex Deucher
2020-07-30 20:04 ` [PATCH 09/17] drm/amdgpu/gmc7: " Alex Deucher
2020-07-30 20:04 ` [PATCH 10/17] drm/amdgpu/gmc8: " Alex Deucher
2020-07-30 20:04 ` [PATCH 11/17] drm/amdgpu/gmc9: " Alex Deucher
2020-07-30 20:04 ` [PATCH 12/17] drm/amdgpu/gmc10: " Alex Deucher
2020-07-30 20:04 ` [PATCH 13/17] drm/amdgpu: drop the CPU pointers for the stolen vga bos Alex Deucher
2020-07-30 20:04 ` [PATCH 14/17] drm/amdgpu/gmc: disable keep_stolen_vga_memory on arcturus Alex Deucher
2020-07-30 20:04 ` Alex Deucher [this message]
2020-07-30 20:04 ` [PATCH 16/17] drm/amdgpu: move IP discovery data to mman Alex Deucher
2020-07-30 20:04 ` [PATCH 17/17] drm/amdgpu: move vram usage by vbios to mman (v2) Alex Deucher
2020-07-31  6:45   ` Christian König
  -- strict thread matches above, loose matches on Subject: below --
2020-07-29 17:34 [PATCH 00/17] rework stolen pre-OS fb allocation handling (v2) Alex Deucher
2020-07-29 17:34 ` [PATCH 15/17] drm/amdgpu: move stolen memory from gmc to mman Alex Deucher

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=20200730200414.40485-16-alexander.deucher@amd.com \
    --to=alexdeucher@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    /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.