* [PATCH 1/3] drm/amdgpu: free the pre-OS console framebuffer after the first modeset
@ 2020-12-08 16:05 Alex Deucher
2020-12-08 16:05 ` [PATCH 2/3] drm/amdgpu: remove amdgpu_ttm_late_init and amdgpu_bo_late_init Alex Deucher
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Alex Deucher @ 2020-12-08 16:05 UTC (permalink / raw)
To: amd-gfx; +Cc: Alex Deucher
Rather than in late_init to avoid race conditions between freeing the
buffers and the initial modeset.
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 8 ++------
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 5 +++++
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index e49b519aab80..6be131df21f5 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -2026,10 +2026,6 @@ 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->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);
}
/*
@@ -2042,8 +2038,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->mman.keep_stolen_vga_memory)
- amdgpu_bo_free_kernel(&adev->mman.stolen_vga_memory, NULL, NULL);
+ amdgpu_bo_free_kernel(&adev->mman.stolen_vga_memory, NULL, NULL);
+ amdgpu_bo_free_kernel(&adev->mman.stolen_extended_memory, NULL, NULL);
/* return the IP Discovery TMR memory back to VRAM */
amdgpu_bo_free_kernel(&adev->mman.discovery_memory, NULL, NULL);
amdgpu_ttm_fw_reserve_vram_fini(adev);
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 255171b8c434..e64b365d07af 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -8440,6 +8440,11 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
drm_atomic_helper_cleanup_planes(dev, state);
+ /* return the stolen vga memory back to VRAM */
+ 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);
+
/*
* Finally, drop a runtime PM reference for each newly disabled CRTC,
* so we can put the GPU into runtime suspend if we're not driving any
--
2.25.4
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/3] drm/amdgpu: remove amdgpu_ttm_late_init and amdgpu_bo_late_init
2020-12-08 16:05 [PATCH 1/3] drm/amdgpu: free the pre-OS console framebuffer after the first modeset Alex Deucher
@ 2020-12-08 16:05 ` Alex Deucher
2020-12-08 16:05 ` [PATCH 3/3] drm/amdgpu: fix size calculation with stolen vga memory Alex Deucher
2020-12-08 17:41 ` [PATCH 1/3] drm/amdgpu: free the pre-OS console framebuffer after the first modeset Christian König
2 siblings, 0 replies; 4+ messages in thread
From: Alex Deucher @ 2020-12-08 16:05 UTC (permalink / raw)
To: amd-gfx; +Cc: Alex Deucher
No longer used.
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 17 -----------------
drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 1 -
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 7 -------
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h | 1 -
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 2 --
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 2 --
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 2 --
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 2 --
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 2 --
9 files changed, 36 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index fd7a93c32235..25ec4d57333f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -1074,23 +1074,6 @@ int amdgpu_bo_init(struct amdgpu_device *adev)
return amdgpu_ttm_init(adev);
}
-/**
- * amdgpu_bo_late_init - late init
- * @adev: amdgpu device object
- *
- * Calls amdgpu_ttm_late_init() to free resources used earlier during
- * initialization.
- *
- * Returns:
- * 0 for success or a negative error code on failure.
- */
-int amdgpu_bo_late_init(struct amdgpu_device *adev)
-{
- amdgpu_ttm_late_init(adev);
-
- return 0;
-}
-
/**
* amdgpu_bo_fini - tear down memory manager
* @adev: amdgpu device object
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
index a5a7992b5773..2bfef286fda4 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
@@ -269,7 +269,6 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
void amdgpu_bo_unpin(struct amdgpu_bo *bo);
int amdgpu_bo_evict_vram(struct amdgpu_device *adev);
int amdgpu_bo_init(struct amdgpu_device *adev);
-int amdgpu_bo_late_init(struct amdgpu_device *adev);
void amdgpu_bo_fini(struct amdgpu_device *adev);
int amdgpu_bo_fbdev_mmap(struct amdgpu_bo *bo,
struct vm_area_struct *vma);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 6be131df21f5..b719b4281cc9 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -2021,13 +2021,6 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
return 0;
}
-/*
- * amdgpu_ttm_late_init - Handle any late initialization for amdgpu_ttm
- */
-void amdgpu_ttm_late_init(struct amdgpu_device *adev)
-{
-}
-
/*
* amdgpu_ttm_fini - De-initialize the TTM memory pools
*/
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
index bdca2970173e..d2987536d7cd 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
@@ -131,7 +131,6 @@ int amdgpu_vram_mgr_query_page_status(struct ttm_resource_manager *man,
uint64_t start);
int amdgpu_ttm_init(struct amdgpu_device *adev);
-void amdgpu_ttm_late_init(struct amdgpu_device *adev);
void amdgpu_ttm_fini(struct amdgpu_device *adev);
void amdgpu_ttm_set_buffer_funcs_status(struct amdgpu_device *adev,
bool enable);
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
index 5317efc942a4..f12c2224cdbf 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
@@ -717,8 +717,6 @@ static int gmc_v10_0_late_init(void *handle)
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
int r;
- amdgpu_bo_late_init(adev);
-
r = amdgpu_gmc_allocate_vm_inv_eng(adev);
if (r)
return r;
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
index 95a9117e9564..b6f95dfdec69 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
@@ -791,8 +791,6 @@ static int gmc_v6_0_late_init(void *handle)
{
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
- amdgpu_bo_late_init(adev);
-
if (amdgpu_vm_fault_stop != AMDGPU_VM_FAULT_STOP_ALWAYS)
return amdgpu_irq_get(adev, &adev->gmc.vm_fault, 0);
else
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
index d9cb887b3a91..959b61af4251 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
@@ -961,8 +961,6 @@ static int gmc_v7_0_late_init(void *handle)
{
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
- amdgpu_bo_late_init(adev);
-
if (amdgpu_vm_fault_stop != AMDGPU_VM_FAULT_STOP_ALWAYS)
return amdgpu_irq_get(adev, &adev->gmc.vm_fault, 0);
else
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
index 65d7bc108151..319f99015976 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
@@ -1062,8 +1062,6 @@ static int gmc_v8_0_late_init(void *handle)
{
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
- amdgpu_bo_late_init(adev);
-
if (amdgpu_vm_fault_stop != AMDGPU_VM_FAULT_STOP_ALWAYS)
return amdgpu_irq_get(adev, &adev->gmc.vm_fault, 0);
else
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
index 07126b2b46c2..e1531d97f486 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
@@ -1177,8 +1177,6 @@ static int gmc_v9_0_late_init(void *handle)
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
int r;
- amdgpu_bo_late_init(adev);
-
r = amdgpu_gmc_allocate_vm_inv_eng(adev);
if (r)
return r;
--
2.25.4
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] drm/amdgpu: fix size calculation with stolen vga memory
2020-12-08 16:05 [PATCH 1/3] drm/amdgpu: free the pre-OS console framebuffer after the first modeset Alex Deucher
2020-12-08 16:05 ` [PATCH 2/3] drm/amdgpu: remove amdgpu_ttm_late_init and amdgpu_bo_late_init Alex Deucher
@ 2020-12-08 16:05 ` Alex Deucher
2020-12-08 17:41 ` [PATCH 1/3] drm/amdgpu: free the pre-OS console framebuffer after the first modeset Christian König
2 siblings, 0 replies; 4+ messages in thread
From: Alex Deucher @ 2020-12-08 16:05 UTC (permalink / raw)
To: amd-gfx; +Cc: Alex Deucher
If we need to keep the stolen vga memory, make sure it is
at least as big as the legacy vga size.
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
index ff3afc82e73a..02c2a0d5b36e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
@@ -501,6 +501,9 @@ void amdgpu_gmc_get_vbios_allocations(struct amdgpu_device *adev)
else
size = amdgpu_gmc_get_vbios_fb_size(adev);
+ if (adev->mman.keep_stolen_vga_memory)
+ size = max(size, AMDGPU_VBIOS_VGA_ALLOCATION);
+
/* set to 0 if the pre-OS buffer uses up most of vram */
if ((adev->gmc.real_vram_size - size) < (8 * 1024 * 1024))
size = 0;
--
2.25.4
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/3] drm/amdgpu: free the pre-OS console framebuffer after the first modeset
2020-12-08 16:05 [PATCH 1/3] drm/amdgpu: free the pre-OS console framebuffer after the first modeset Alex Deucher
2020-12-08 16:05 ` [PATCH 2/3] drm/amdgpu: remove amdgpu_ttm_late_init and amdgpu_bo_late_init Alex Deucher
2020-12-08 16:05 ` [PATCH 3/3] drm/amdgpu: fix size calculation with stolen vga memory Alex Deucher
@ 2020-12-08 17:41 ` Christian König
2 siblings, 0 replies; 4+ messages in thread
From: Christian König @ 2020-12-08 17:41 UTC (permalink / raw)
To: Alex Deucher, amd-gfx; +Cc: Alex Deucher
Am 08.12.20 um 17:05 schrieb Alex Deucher:
> Rather than in late_init to avoid race conditions between freeing the
> buffers and the initial modeset.
>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com> for patches #1
and #2, acked-by for #3.
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 8 ++------
> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 5 +++++
> 2 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> index e49b519aab80..6be131df21f5 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> @@ -2026,10 +2026,6 @@ 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->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);
> }
>
> /*
> @@ -2042,8 +2038,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->mman.keep_stolen_vga_memory)
> - amdgpu_bo_free_kernel(&adev->mman.stolen_vga_memory, NULL, NULL);
> + amdgpu_bo_free_kernel(&adev->mman.stolen_vga_memory, NULL, NULL);
> + amdgpu_bo_free_kernel(&adev->mman.stolen_extended_memory, NULL, NULL);
> /* return the IP Discovery TMR memory back to VRAM */
> amdgpu_bo_free_kernel(&adev->mman.discovery_memory, NULL, NULL);
> amdgpu_ttm_fw_reserve_vram_fini(adev);
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 255171b8c434..e64b365d07af 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -8440,6 +8440,11 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
>
> drm_atomic_helper_cleanup_planes(dev, state);
>
> + /* return the stolen vga memory back to VRAM */
> + 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);
> +
> /*
> * Finally, drop a runtime PM reference for each newly disabled CRTC,
> * so we can put the GPU into runtime suspend if we're not driving any
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-12-08 17:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-08 16:05 [PATCH 1/3] drm/amdgpu: free the pre-OS console framebuffer after the first modeset Alex Deucher
2020-12-08 16:05 ` [PATCH 2/3] drm/amdgpu: remove amdgpu_ttm_late_init and amdgpu_bo_late_init Alex Deucher
2020-12-08 16:05 ` [PATCH 3/3] drm/amdgpu: fix size calculation with stolen vga memory Alex Deucher
2020-12-08 17:41 ` [PATCH 1/3] drm/amdgpu: free the pre-OS console framebuffer after the first modeset Christian König
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox