drm/amdgpu: reduce reserved VA size
Subsystems (2)
PATCH 1/3 drm/amdgpu: reduce reserved VA size
1MB should be more than enough, currently we use about 8K.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +1 -1
@@ -99,7 +99,7 @@ struct amdgpu_bo_list_entry;#define AMDGPU_MMHUB 1/* hardcode that limit for now */ -#define AMDGPU_VA_RESERVED_SIZE (8ULL << 20) +#define AMDGPU_VA_RESERVED_SIZE (1ULL << 20)/* VA hole for 48bit addresses on Vega10 */ #define AMDGPU_VA_HOLE_START 0x0000800000000000ULL
Signature · 6 lines
2.14.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20180122104404.1239-1-christian.koenig-5C7GfCeVMHo@public.gmane.org
PATCH 2/3 drm/amdgpu: apply top reserved VA space to pre Vega10 as well
Reserve VA space at the top for older generations as well.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 +- drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 3 ++- drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 3 ++- drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 3 ++- 4 files changed, 7 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +1 -1
@@ -580,11 +580,11 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file dev_info.ids_flags |=AMDGPU_IDS_FLAGS_PREEMPTION ; vm_size = adev->vm_manager.max_pfn *AMDGPU_GPU_PAGE_SIZE ; + vm_size -=AMDGPU_VA_RESERVED_SIZE ; dev_info.virtual_address_offset =AMDGPU_VA_RESERVED_SIZE ; dev_info.virtual_address_max =min (vm_size,AMDGPU_VA_HOLE_START ); - vm_size -=AMDGPU_VA_RESERVED_SIZE ;if (vm_size >AMDGPU_VA_HOLE_START ) { dev_info.high_va_offset =AMDGPU_VA_HOLE_END ; dev_info.high_va_max =AMDGPU_VA_HOLE_END | vm_size;
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +2 -1
@@ -468,7 +468,8 @@ static void gmc_v6_0_set_prt(struct amdgpu_device *adev, bool enable)if (enable) {uint32_t low =AMDGPU_VA_RESERVED_SIZE >>AMDGPU_GPU_PAGE_SHIFT ; -uint32_t high = adev->vm_manager.max_pfn; +uint32_t high = adev->vm_manager.max_pfn - + (AMDGPU_VA_RESERVED_SIZE >>AMDGPU_GPU_PAGE_SHIFT );WREG32 (mmVM_PRT_APERTURE0_LOW_ADDR, low);WREG32 (mmVM_PRT_APERTURE1_LOW_ADDR, low);
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +2 -1
@@ -561,7 +561,8 @@ static void gmc_v7_0_set_prt(struct amdgpu_device *adev, bool enable)if (enable) {uint32_t low =AMDGPU_VA_RESERVED_SIZE >>AMDGPU_GPU_PAGE_SHIFT ; -uint32_t high = adev->vm_manager.max_pfn; +uint32_t high = adev->vm_manager.max_pfn - + (AMDGPU_VA_RESERVED_SIZE >>AMDGPU_GPU_PAGE_SHIFT );WREG32 (mmVM_PRT_APERTURE0_LOW_ADDR, low);WREG32 (mmVM_PRT_APERTURE1_LOW_ADDR, low);
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +2 -1
@@ -761,7 +761,8 @@ static void gmc_v8_0_set_prt(struct amdgpu_device *adev, bool enable)if (enable) {uint32_t low =AMDGPU_VA_RESERVED_SIZE >>AMDGPU_GPU_PAGE_SHIFT ; -uint32_t high = adev->vm_manager.max_pfn; +uint32_t high = adev->vm_manager.max_pfn - + (AMDGPU_VA_RESERVED_SIZE >>AMDGPU_GPU_PAGE_SHIFT );WREG32 (mmVM_PRT_APERTURE0_LOW_ADDR, low);WREG32 (mmVM_PRT_APERTURE1_LOW_ADDR, low);
Signature · 6 lines
2.14.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/3 drm/amdgpu: move static CSA address to top of address space
In reply to a message not in the archiveThere seems to be a design flaw with this since the address of the static CSA is never exported anywhere.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 15 +++++++-------- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h | 6 ++++-- 2 files changed, 11 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +7 -8
@@ -55,11 +55,10 @@ void amdgpu_free_static_csa(struct amdgpu_device *adev) {/* * amdgpu_map_static_csa should be called during amdgpu_vm_init -* it maps virtual address "AMDGPU_VA_RESERVED_SIZE - AMDGPU_CSA_SIZE" -* to this VM, and each command submission of GFX should use this virtual -* address within META_DATA init package to support SRIOV gfx preemption. +* it maps virtual address "AMDGPU_CSA_VADDR" to this VM, and each command +* submission of GFX should use this virtual address within META_DATA init +* package to support SRIOV gfx preemption. */ -int amdgpu_map_static_csa (struct amdgpu_device *adev,struct amdgpu_vm *vm,struct amdgpu_bo_va **bo_va) {
@@ -90,7 +89,7 @@ int amdgpu_map_static_csa(struct amdgpu_device *adev, struct amdgpu_vm *vm,return -ENOMEM ; } - r =amdgpu_vm_alloc_pts (adev, (*bo_va)->base.vm,AMDGPU_CSA_VADDR , + r =amdgpu_vm_alloc_pts (adev, (*bo_va)->base.vm,AMDGPU_CSA_VADDR (adev),AMDGPU_CSA_SIZE );if (r) {DRM_ERROR ("failed to allocate pts for static CSA, err=%d\n" , r);
@@ -99,9 +98,9 @@ int amdgpu_map_static_csa(struct amdgpu_device *adev, struct amdgpu_vm *vm,return r; } - r =amdgpu_vm_bo_map (adev, *bo_va,AMDGPU_CSA_VADDR ,0 ,AMDGPU_CSA_SIZE , -AMDGPU_PTE_READABLE |AMDGPU_PTE_WRITEABLE | -AMDGPU_PTE_EXECUTABLE ); + r =amdgpu_vm_bo_map (adev, *bo_va,AMDGPU_CSA_VADDR (adev),0 , +AMDGPU_CSA_SIZE ,AMDGPU_PTE_READABLE | +AMDGPU_PTE_WRITEABLE |AMDGPU_PTE_EXECUTABLE );if (r) {DRM_ERROR ("failed to do bo_map on static CSA, err=%d\n" , r);
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h +4 -2
@@ -251,8 +251,10 @@ struct amdgpu_virt {uint32_t gim_feature; }; -#define AMDGPU_CSA_SIZE (8 * 1024) -#define AMDGPU_CSA_VADDR (AMDGPU_VA_RESERVED_SIZE - AMDGPU_CSA_SIZE) +#define AMDGPU_CSA_SIZE (8 * 1024) +#define AMDGPU_CSA_VADDR (adev) \ + (((adev)->vm_manager.max_pfn << AMDGPU_GPU_PAGE_SHIFT) + \ + AMDGPU_VA_RESERVED_SIZE)#define amdgpu_sriov_enabled (adev) \ ((adev)->virt.caps & AMDGPU_SRIOV_CAPS_ENABLE_IOV)
Signature · 6 lines
2.14.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20180122104404.1239-3-christian.koenig-5C7GfCeVMHo@public.gmane.org
RE: [PATCH 3/3] drm/amdgpu: move static CSA address to top of address space
-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian K?nig
Sent: Monday, January 22, 2018 6:44 PM
To: Liu, Monk <[email protected]>; [email protected]
Subject: [PATCH 3/3] drm/amdgpu: move static CSA address to top of address space
There seems to be a design flaw with this since the address of the static CSA is never exported anywhere.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 15 +++++++-------- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h | 6 ++++-- 2 files changed, 11 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +5 -4
@@ -55,11 +55,10 @@ void amdgpu_free_static_csa(struct amdgpu_device *adev) {/* * amdgpu_map_static_csa should be called during amdgpu_vm_init -* it maps virtual address "AMDGPU_VA_RESERVED_SIZE - AMDGPU_CSA_SIZE" -* to this VM, and each command submission of GFX should use this virtual -* address within META_DATA init package to support SRIOV gfx preemption. +* it maps virtual address "AMDGPU_CSA_VADDR" to this VM, and each +command +* submission of GFX should use this virtual address within META_DATA +init +* package to support SRIOV gfx preemption. */ - int amdgpu_map_static_csa(struct amdgpu_device *adev, struct amdgpu_vm *vm,
struct amdgpu_bo_va **bo_va)
{
@@ -90,7 +89,7 @@ int amdgpu_map_static_csa(struct amdgpu_device *adev, struct amdgpu_vm *vm,
return -ENOMEM;
}
- r = amdgpu_vm_alloc_pts(adev, (*bo_va)->base.vm, AMDGPU_CSA_VADDR,
+ r = amdgpu_vm_alloc_pts(adev, (*bo_va)->base.vm,
+AMDGPU_CSA_VADDR(adev),
AMDGPU_CSA_SIZE);
if (r) {
DRM_ERROR("failed to allocate pts for static CSA, err=%d\n", r); @@ -99,9 +98,9 @@ int amdgpu_map_static_csa(struct amdgpu_device *adev, struct amdgpu_vm *vm, return r;
}
- r = amdgpu_vm_bo_map(adev, *bo_va, AMDGPU_CSA_VADDR, 0, AMDGPU_CSA_SIZE,
- AMDGPU_PTE_READABLE | AMDGPU_PTE_WRITEABLE |
- AMDGPU_PTE_EXECUTABLE);
+ r = amdgpu_vm_bo_map(adev, *bo_va, AMDGPU_CSA_VADDR(adev), 0,
+ AMDGPU_CSA_SIZE, AMDGPU_PTE_READABLE |
+ AMDGPU_PTE_WRITEABLE | AMDGPU_PTE_EXECUTABLE);
if (r) {
DRM_ERROR("failed to do bo_map on static CSA, err=%d\n", r); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h
index 6a83425aa9ed..499362b55e45 100644
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h +2 -2
@@ -251,8 +251,10 @@ struct amdgpu_virt {uint32_t gim_feature; }; -#define AMDGPU_CSA_SIZE (8 * 1024) -#define AMDGPU_CSA_VADDR (AMDGPU_VA_RESERVED_SIZE - AMDGPU_CSA_SIZE) +#define AMDGPU_CSA_SIZE (8 * 1024) +#define AMDGPU_CSA_VADDR (adev) \
+ (((adev)->vm_manager.max_pfn << AMDGPU_GPU_PAGE_SHIFT) + \ + AMDGPU_VA_RESERVED_SIZE)
If I understand your intention correctly, it should be that:
+ (((adev)->vm_manager.max_pfn << AMDGPU_GPU_PAGE_SHIFT) - \
+ AMDGPU_VA_RESERVED_SIZE)
Thanks
Roger(Hongbo.He)
#define amdgpu_sriov_enabled(adev) \
((adev)->virt.caps & AMDGPU_SRIOV_CAPS_ENABLE_IOV)
--
2.14.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): MWHPR1201MB0127D1F3C71A0C2D99A64603FDE30-3iK1xFAIwjq9imrIu4W8xGrFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/[email protected]
Re: [PATCH 3/3] drm/amdgpu: move static CSA address to top of address space
Any bug introduced by original design ? I don't see why 8MB- 8KB as the start vm address of CSA has any trouble compared with top range ? Besides, please note that you also need modify gfx8/9 source to align emit_cs/de_meta with your change
________________________________
From: He, Roger
Sent: Tuesday, January 23, 2018 10:36:31 AM
To: Christian König; Liu, Monk; [email protected]
Subject: RE: [PATCH 3/3] drm/amdgpu: move static CSA address to top of address space
-----Original Message-----
From: amd-gfx [mailto:amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org] On Behalf Of Christian K?nig
Sent: Monday, January 22, 2018 6:44 PM
To: Liu, Monk <[email protected]>; [email protected]
Subject: [PATCH 3/3] drm/amdgpu: move static CSA address to top of address space
There seems to be a design flaw with this since the address of the static CSA is never exported anywhere.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 15 +++++++-------- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h | 6 ++++-- 2 files changed, 11 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +5 -4
@@ -55,11 +55,10 @@ void amdgpu_free_static_csa(struct amdgpu_device *adev) {/* * amdgpu_map_static_csa should be called during amdgpu_vm_init -* it maps virtual address "AMDGPU_VA_RESERVED_SIZE - AMDGPU_CSA_SIZE" -* to this VM, and each command submission of GFX should use this virtual -* address within META_DATA init package to support SRIOV gfx preemption. +* it maps virtual address "AMDGPU_CSA_VADDR" to this VM, and each +command +* submission of GFX should use this virtual address within META_DATA +init +* package to support SRIOV gfx preemption. */ - int amdgpu_map_static_csa(struct amdgpu_device *adev, struct amdgpu_vm *vm,
struct amdgpu_bo_va **bo_va)
{
@@ -90,7 +89,7 @@ int amdgpu_map_static_csa(struct amdgpu_device *adev, struct amdgpu_vm *vm,
return -ENOMEM;
}- r = amdgpu_vm_alloc_pts(adev, (*bo_va)->base.vm, AMDGPU_CSA_VADDR,
+ r = amdgpu_vm_alloc_pts(adev, (*bo_va)->base.vm,
+AMDGPU_CSA_VADDR(adev),
AMDGPU_CSA_SIZE);
if (r) {
DRM_ERROR("failed to allocate pts for static CSA, err=%d\n", r); @@ -99,9 +98,9 @@ int amdgpu_map_static_csa(struct amdgpu_device *adev, struct amdgpu_vm *vm,
return r;
}- r = amdgpu_vm_bo_map(adev, *bo_va, AMDGPU_CSA_VADDR, 0, AMDGPU_CSA_SIZE,
- AMDGPU_PTE_READABLE | AMDGPU_PTE_WRITEABLE |
- AMDGPU_PTE_EXECUTABLE);
+ r = amdgpu_vm_bo_map(adev, *bo_va, AMDGPU_CSA_VADDR(adev), 0,
+ AMDGPU_CSA_SIZE, AMDGPU_PTE_READABLE |
+ AMDGPU_PTE_WRITEABLE | AMDGPU_PTE_EXECUTABLE);
if (r) {
DRM_ERROR("failed to do bo_map on static CSA, err=%d\n", r); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.hindex 6a83425aa9ed..499362b55e45 100644
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h +2 -2
@@ -251,8 +251,10 @@ struct amdgpu_virt {uint32_t gim_feature; }; -#define AMDGPU_CSA_SIZE (8 * 1024) -#define AMDGPU_CSA_VADDR (AMDGPU_VA_RESERVED_SIZE - AMDGPU_CSA_SIZE) +#define AMDGPU_CSA_SIZE (8 * 1024) +#define AMDGPU_CSA_VADDR (adev) \ + (((adev)->vm_manager.max_pfn << AMDGPU_GPU_PAGE_SHIFT) + \ + AMDGPU_VA_RESERVED_SIZE)
If I understand your intention correctly, it should be that:
+ (((adev)->vm_manager.max_pfn << AMDGPU_GPU_PAGE_SHIFT) - \
+ AMDGPU_VA_RESERVED_SIZE)
Thanks
Roger(Hongbo.He)
#define amdgpu_sriov_enabled(adev) \
((adev)->virt.caps & AMDGPU_SRIOV_CAPS_ENABLE_IOV)
--
2.14.1
_______________________________________________
amd-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): BLUPR12MB04494E357187195CC3C90B0584E30-7LeqcoF/[email protected]
Re: [PATCH 3/3] drm/amdgpu: move static CSA address to top of address space
anyway I prefer no change on that part unless there issues or bug need to fix by the change.
the CSA address is for use by CPG h/w not s/w, and since 8MB is a reserved range for each VM I don't see
it's a design flaw with it
________________________________
From: Liu, Monk
Sent: Tuesday, January 23, 2018 11:20:35 AM
To: He, Roger; Christian König; [email protected]
Subject: Re: [PATCH 3/3] drm/amdgpu: move static CSA address to top of address space
Any bug introduced by original design ? I don't see why 8MB- 8KB as the start vm address of CSA has any trouble compared with top range ? Besides, please note that you also need modify gfx8/9 source to align emit_cs/de_meta with your change
________________________________
From: He, Roger
Sent: Tuesday, January 23, 2018 10:36:31 AM
To: Christian König; Liu, Monk; [email protected]
Subject: RE: [PATCH 3/3] drm/amdgpu: move static CSA address to top of address space
-----Original Message-----
From: amd-gfx [mailto:amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org] On Behalf Of Christian K?nig
Sent: Monday, January 22, 2018 6:44 PM
To: Liu, Monk <[email protected]>; [email protected]
Subject: [PATCH 3/3] drm/amdgpu: move static CSA address to top of address space
There seems to be a design flaw with this since the address of the static CSA is never exported anywhere.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 15 +++++++-------- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h | 6 ++++-- 2 files changed, 11 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +5 -4
@@ -55,11 +55,10 @@ void amdgpu_free_static_csa(struct amdgpu_device *adev) {/* * amdgpu_map_static_csa should be called during amdgpu_vm_init -* it maps virtual address "AMDGPU_VA_RESERVED_SIZE - AMDGPU_CSA_SIZE" -* to this VM, and each command submission of GFX should use this virtual -* address within META_DATA init package to support SRIOV gfx preemption. +* it maps virtual address "AMDGPU_CSA_VADDR" to this VM, and each +command +* submission of GFX should use this virtual address within META_DATA +init +* package to support SRIOV gfx preemption. */ - int amdgpu_map_static_csa(struct amdgpu_device *adev, struct amdgpu_vm *vm,
struct amdgpu_bo_va **bo_va)
{
@@ -90,7 +89,7 @@ int amdgpu_map_static_csa(struct amdgpu_device *adev, struct amdgpu_vm *vm,
return -ENOMEM;
}- r = amdgpu_vm_alloc_pts(adev, (*bo_va)->base.vm, AMDGPU_CSA_VADDR,
+ r = amdgpu_vm_alloc_pts(adev, (*bo_va)->base.vm,
+AMDGPU_CSA_VADDR(adev),
AMDGPU_CSA_SIZE);
if (r) {
DRM_ERROR("failed to allocate pts for static CSA, err=%d\n", r); @@ -99,9 +98,9 @@ int amdgpu_map_static_csa(struct amdgpu_device *adev, struct amdgpu_vm *vm,
return r;
}- r = amdgpu_vm_bo_map(adev, *bo_va, AMDGPU_CSA_VADDR, 0, AMDGPU_CSA_SIZE,
- AMDGPU_PTE_READABLE | AMDGPU_PTE_WRITEABLE |
- AMDGPU_PTE_EXECUTABLE);
+ r = amdgpu_vm_bo_map(adev, *bo_va, AMDGPU_CSA_VADDR(adev), 0,
+ AMDGPU_CSA_SIZE, AMDGPU_PTE_READABLE |
+ AMDGPU_PTE_WRITEABLE | AMDGPU_PTE_EXECUTABLE);
if (r) {
DRM_ERROR("failed to do bo_map on static CSA, err=%d\n", r); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.hindex 6a83425aa9ed..499362b55e45 100644
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h +2 -2
@@ -251,8 +251,10 @@ struct amdgpu_virt {uint32_t gim_feature; }; -#define AMDGPU_CSA_SIZE (8 * 1024) -#define AMDGPU_CSA_VADDR (AMDGPU_VA_RESERVED_SIZE - AMDGPU_CSA_SIZE) +#define AMDGPU_CSA_SIZE (8 * 1024) +#define AMDGPU_CSA_VADDR (adev) \ + (((adev)->vm_manager.max_pfn << AMDGPU_GPU_PAGE_SHIFT) + \ + AMDGPU_VA_RESERVED_SIZE)
If I understand your intention correctly, it should be that:
+ (((adev)->vm_manager.max_pfn << AMDGPU_GPU_PAGE_SHIFT) - \
+ AMDGPU_VA_RESERVED_SIZE)
Thanks
Roger(Hongbo.He)
#define amdgpu_sriov_enabled(adev) \
((adev)->virt.caps & AMDGPU_SRIOV_CAPS_ENABLE_IOV)
--
2.14.1
_______________________________________________
amd-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): BLUPR12MB0449A76D5FB31F4C46AD8BB384E30-7LeqcoF/[email protected]
Re: [PATCH 3/3] drm/amdgpu: move static CSA address to top of address space
Quoted 1 line
Any bug introduced by original design ? I don't see why 8MB- 8KB as the start vm address of CSA has any trouble compared with top range ?
On gfx9 we need the lower address range (0x0-0x7fffffffffff) for HMM/ATC/SVM. If we map the 8k CSA in there and hit it by accident then the GPU will not do what it is supposed to do :)
I could limit the change to only gfx9, but I think the code will be simpler if we change both gfx8 and gfx9.
Quoted 1 line
Besides, please note that you also need modify gfx8/9 source to align emit_cs/de_meta with your change
That was the design flaw I was talking about. In other words I couldn't find the code where that address was actually used.
We should use the macro define in those functions as well. Going to send fixed for this in a minute.
Thanks,
Christian.
Am 23.01.2018 um 04:23 schrieb Liu, Monk:
Quoted 110 lines
anyway I prefer no change on that part unless there issues or bug need to fix by the change.
the CSA address is for use by CPG h/w not s/w, and since 8MB is a reserved range for each VM I don't see
it's a design flaw with it
------------------------------------------------------------------------
*From:* Liu, Monk
*Sent:* Tuesday, January 23, 2018 11:20:35 AM
*To:* He, Roger; Christian König; [email protected] *Subject:* Re: [PATCH 3/3] drm/amdgpu: move static CSA address to top of address spaceAny bug introduced by original design ? I don't see why 8MB- 8KB as the start vm address of CSA has any trouble compared with top range ? Besides, please note that you also need modify gfx8/9 source to align emit_cs/de_meta with your change
------------------------------------------------------------------------
*From:* He, Roger
*Sent:* Tuesday, January 23, 2018 10:36:31 AM
*To:* Christian König; Liu, Monk; [email protected] *Subject:* RE: [PATCH 3/3] drm/amdgpu: move static CSA address to top of address space-----Original Message-----
From: amd-gfx [mailto:amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org] On Behalf Of Christian K?nig
Sent: Monday, January 22, 2018 6:44 PM
To: Liu, Monk <[email protected]>; [email protected]
Subject: [PATCH 3/3] drm/amdgpu: move static CSA address to top of address spaceThere seems to be a design flaw with this since the address of the static CSA is never exported anywhere.
Signed-off-by Christian König <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 15 +++++++--------drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h| 6 ++++--2 files changed, 11 insertions(+), 10 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +5
-4@@ -55,11 +55,10 @@ void amdgpu_free_static_csa(struct amdgpu_device *adev) { /** amdgpu_map_static_csa should be called during amdgpu_vm_init -* it maps virtual address "AMDGPU_VA_RESERVED_SIZE - AMDGPU_CSA_SIZE" -* to this VM, and each command submission of GFX should use this virtual -* address within META_DATA init package to support SRIOV gfx preemption. +* it maps virtual address "AMDGPU_CSA_VADDR" to this VM, and each +command +* submission of GFX should use this virtual address within META_DATA +init +* package to support SRIOV gfx preemption. */ -int
amdgpu_map_static_csa(struct amdgpu_device *adev, struct amdgpu_vm *vm, struct amdgpu_bo_va **bo_va)
{drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +2
-1@@ -90,7 +89,7 @@ int amdgpu_map_static_csa(struct amdgpu_device *adev, struct amdgpu_vm *vm, return -ENOMEM; } - r = amdgpu_vm_alloc_pts(adev, (*bo_va)->base.vm, AMDGPU_CSA_VADDR, + r = amdgpu_vm_alloc_pts(adev, (*bo_va)->base.vm, +AMDGPU_CSA_VADDR (adev), AMDGPU_CSA_SIZE);if (r) {
DRM_ERROR("failed to allocate pts for static CSA, err=%d\n", r); @@ -99,9 +98,9 @@ int amdgpu_map_static_csa(structamdgpu_device*adev, structamdgpu_vm*vm, return r;
}- r = amdgpu_vm_bo_map(adev,
*bo_va,AMDGPU_CSA_VADDR, 0,AMDGPU_CSA_SIZE,
-AMDGPU_PTE_READABLE|AMDGPU_PTE_WRITEABLE| -AMDGPU_PTE_EXECUTABLE);
+ r = amdgpu_vm_bo_map(adev,*bo_va,AMDGPU_CSA_VADDR(adev), 0, +AMDGPU_CSA_SIZE,AMDGPU_PTE_READABLE| +AMDGPU_PTE_WRITEABLE|AMDGPU_PTE_EXECUTABLE);if (r) {
DRM_ERROR("failed to do bo_map on static CSA, err=%d\n", r); diff --gita/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.hb/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.hindex6a83425aa9ed..499362b55e45100644drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h +2
-2@@ -251,8 +251,10 @@ struct amdgpu_virt { uint32_t gim_feature; }; -#define AMDGPU_CSA_SIZE (8 * 1024) -#define AMDGPU_CSA_VADDR (AMDGPU_VA_RESERVED_SIZE - AMDGPU_CSA_SIZE) +#define AMDGPU_CSA_SIZE (8 * 1024) +#define AMDGPU_CSA_VADDR (adev) \ + (((adev)->vm_manager.max_pfn << AMDGPU_GPU_PAGE_SHIFT) + \ + AMDGPU_VA_RESERVED_SIZE)If I understand your intention correctly, it should be that:
+ (((adev)->vm_manager.max_pfn << AMDGPU_GPU_PAGE_SHIFT) - \
+AMDGPU_VA_RESERVED_SIZE)Thanks
Roger(Hongbo.He)#define
amdgpu_sriov_enabled(adev)\
((adev)->virt.caps &AMDGPU_SRIOV_CAPS_ENABLE_IOV) --
2.14.1
Quoted 4 lines
_______________________________________________
amd-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 99bd1b34-e10e-800d-fd35-8166a452fd3e-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Re: [PATCH 3/3] drm/amdgpu: move static CSA address to top of address space
OK I see, but why HMM/ATC/SVN want low 8MB range ? why they cannot use high range address ?
________________________________
From: Christian König <[email protected]>
Sent: Tuesday, January 23, 2018 4:26:21 PM
To: Liu, Monk; He, Roger; [email protected]
Subject: Re: [PATCH 3/3] drm/amdgpu: move static CSA address to top of address space
Any bug introduced by original design ? I don't see why 8MB- 8KB as the start vm address of CSA has any trouble compared with top range ?
On gfx9 we need the lower address range (0x0-0x7fffffffffff) for HMM/ATC/SVM. If we map the 8k CSA in there and hit it by accident then the GPU will not do what it is supposed to do :)
I could limit the change to only gfx9, but I think the code will be simpler if we change both gfx8 and gfx9.
Besides, please note that you also need modify gfx8/9 source to align emit_cs/de_meta with your change That was the design flaw I was talking about. In other words I couldn't find the code where that address was actually used.
We should use the macro define in those functions as well. Going to send fixed for this in a minute.
Thanks,
Christian.
Am 23.01.2018 um 04:23 schrieb Liu, Monk:
anyway I prefer no change on that part unless there issues or bug need to fix by the change.
the CSA address is for use by CPG h/w not s/w, and since 8MB is a reserved range for each VM I don't see
it's a design flaw with it
________________________________
From: Liu, Monk
Sent: Tuesday, January 23, 2018 11:20:35 AM
To: He, Roger; Christian König; [email protected]<mailto:[email protected]>
Subject: Re: [PATCH 3/3] drm/amdgpu: move static CSA address to top of address space
Any bug introduced by original design ? I don't see why 8MB- 8KB as the start vm address of CSA has any trouble compared with top range ? Besides, please note that you also need modify gfx8/9 source to align emit_cs/de_meta with your change
________________________________
From: He, Roger
Sent: Tuesday, January 23, 2018 10:36:31 AM
To: Christian König; Liu, Monk; [email protected]<mailto:[email protected]>
Subject: RE: [PATCH 3/3] drm/amdgpu: move static CSA address to top of address space
-----Original Message-----
From: amd-gfx [mailto:amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org] On Behalf Of Christian K?nig
Sent: Monday, January 22, 2018 6:44 PM
To: Liu, Monk <[email protected]><mailto:[email protected]>; [email protected]<mailto:[email protected]>
Subject: [PATCH 3/3] drm/amdgpu: move static CSA address to top of address space
There seems to be a design flaw with this since the address of the static CSA is never exported anywhere.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 15 +++++++-------- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h | 6 ++++-- 2 files changed, 11 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +5 -4
@@ -55,11 +55,10 @@ void amdgpu_free_static_csa(struct amdgpu_device *adev) {/* * amdgpu_map_static_csa should be called during amdgpu_vm_init -* it maps virtual address "AMDGPU_VA_RESERVED_SIZE - AMDGPU_CSA_SIZE" -* to this VM, and each command submission of GFX should use this virtual -* address within META_DATA init package to support SRIOV gfx preemption. +* it maps virtual address "AMDGPU_CSA_VADDR" to this VM, and each +command +* submission of GFX should use this virtual address within META_DATA +init +* package to support SRIOV gfx preemption. */ - int amdgpu_map_static_csa(struct amdgpu_device *adev, struct amdgpu_vm *vm,
struct amdgpu_bo_va **bo_va)
{
@@ -90,7 +89,7 @@ int amdgpu_map_static_csa(struct amdgpu_device *adev, struct amdgpu_vm *vm,
return -ENOMEM;
}- r = amdgpu_vm_alloc_pts(adev, (*bo_va)->base.vm, AMDGPU_CSA_VADDR,
+ r = amdgpu_vm_alloc_pts(adev, (*bo_va)->base.vm,
+AMDGPU_CSA_VADDR(adev),
AMDGPU_CSA_SIZE);
if (r) {
DRM_ERROR("failed to allocate pts for static CSA, err=%d\n", r); @@ -99,9 +98,9 @@ int amdgpu_map_static_csa(struct amdgpu_device *adev, struct amdgpu_vm *vm,
return r;
}- r = amdgpu_vm_bo_map(adev, *bo_va, AMDGPU_CSA_VADDR, 0, AMDGPU_CSA_SIZE,
- AMDGPU_PTE_READABLE | AMDGPU_PTE_WRITEABLE |
- AMDGPU_PTE_EXECUTABLE);
+ r = amdgpu_vm_bo_map(adev, *bo_va, AMDGPU_CSA_VADDR(adev), 0,
+ AMDGPU_CSA_SIZE, AMDGPU_PTE_READABLE |
+ AMDGPU_PTE_WRITEABLE | AMDGPU_PTE_EXECUTABLE);
if (r) {
DRM_ERROR("failed to do bo_map on static CSA, err=%d\n", r); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.hindex 6a83425aa9ed..499362b55e45 100644
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h +2 -2
@@ -251,8 +251,10 @@ struct amdgpu_virt {uint32_t gim_feature; }; -#define AMDGPU_CSA_SIZE (8 * 1024) -#define AMDGPU_CSA_VADDR (AMDGPU_VA_RESERVED_SIZE - AMDGPU_CSA_SIZE) +#define AMDGPU_CSA_SIZE (8 * 1024) +#define AMDGPU_CSA_VADDR (adev) \ + (((adev)->vm_manager.max_pfn << AMDGPU_GPU_PAGE_SHIFT) + \ + AMDGPU_VA_RESERVED_SIZE)
If I understand your intention correctly, it should be that:
+ (((adev)->vm_manager.max_pfn << AMDGPU_GPU_PAGE_SHIFT) - \
+ AMDGPU_VA_RESERVED_SIZE)
Thanks
Roger(Hongbo.He)
#define amdgpu_sriov_enabled(adev) \
((adev)->virt.caps & AMDGPU_SRIOV_CAPS_ENABLE_IOV)
--
2.14.1
_______________________________________________
amd-gfx mailing list [email protected]<mailto:[email protected]>
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): BLUPR12MB044956D60F5A8551D1CE427784E30-7LeqcoF/[email protected]
Re: [PATCH 3/3] drm/amdgpu: move static CSA address to top of address space
The ATC (or alternatively HMM) maps the CPU addresses into the GPU address space.
Now on Linux the lower range (0x0-0x7fffffffffff) is used for the userspace address space on the CPU, so when we want to use that on the GPU it must be free of other mappings.
GFX8 and GFX7 hardware had a separate flag which address space to use in the memory instructions, but on GFX9 it's all one big shared address space and we need to make sure that we don't kick each others feet.
Had to move the addresses Mesa use as well because of this and older VCE firmware unfortunately was buggy regarding this as well.
Regards,
Christian.
Am 23.01.2018 um 13:43 schrieb Liu, Monk:
Quoted 136 lines
OK I see, but why HMM/ATC/SVN want low 8MB range ? why they cannot use high range address ?
------------------------------------------------------------------------
*From:* Christian König <[email protected]> *Sent:* Tuesday, January 23, 2018 4:26:21 PM
*To:* Liu, Monk; He, Roger; [email protected] *Subject:* Re: [PATCH 3/3] drm/amdgpu: move static CSA address to top of address spaceQuoted 1 line
Any bug introduced by original design ? I don't see why 8MB- 8KB as the start vm address of CSA has any trouble compared with top range ?
On gfx9 we need the lower address range (0x0-0x7fffffffffff) for HMM/ATC/SVM. If we map the 8k CSA in there and hit it by accident then the GPU will not do what it is supposed to do :)
I could limit the change to only gfx9, but I think the code will be simpler if we change both gfx8 and gfx9.
Quoted 1 line
Besides, please note that you also need modify gfx8/9 source to align emit_cs/de_meta with your change
That was the design flaw I was talking about. In other words I couldn't find the code where that address was actually used.
We should use the macro define in those functions as well. Going to send fixed for this in a minute.
Thanks,
Christian.Am 23.01.2018 um 04:23 schrieb Liu, Monk:
Quoted 113 lines
anyway I prefer no change on that part unless there issues or bug need to fix by the change.
the CSA address is for use by CPG h/w not s/w, and since 8MB is a reserved range for each VM I don't see
it's a design flaw with it
------------------------------------------------------------------------
*From:* Liu, Monk
*Sent:* Tuesday, January 23, 2018 11:20:35 AM
*To:* He, Roger; Christian König; [email protected] <mailto:[email protected]> *Subject:* Re: [PATCH 3/3] drm/amdgpu: move static CSA address to top of address spaceAny bug introduced by original design ? I don't see why 8MB- 8KB as the start vm address of CSA has any trouble compared with top range ? Besides, please note that you also need modify gfx8/9 source to align emit_cs/de_meta with your change
------------------------------------------------------------------------
*From:* He, Roger
*Sent:* Tuesday, January 23, 2018 10:36:31 AM
*To:* Christian König; Liu, Monk; [email protected] <mailto:[email protected]> *Subject:* RE: [PATCH 3/3] drm/amdgpu: move static CSA address to top of address space-----Original Message-----
From: amd-gfx [mailto:amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org] On Behalf Of Christian K?nig
Sent: Monday, January 22, 2018 6:44 PM
To: Liu, Monk <[email protected]> <mailto:[email protected]>; [email protected] <mailto:[email protected]>
Subject: [PATCH 3/3] drm/amdgpu: move static CSA address to top of address spaceThere seems to be a design flaw with this since the address of the static CSA is never exported anywhere.
---
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 15 +++++++--------drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h| 6 ++++--2 files changed, 11 insertions(+), 10 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +0
-2@@ -55,11 +55,10 @@ void amdgpu_free_static_csa(struct amdgpu_device *adev) { /** amdgpu_map_static_csa should be called during amdgpu_vm_init -* it maps virtual address "AMDGPU_VA_RESERVED_SIZE - AMDGPU_CSA_SIZE" -* to this VM, and each command submission of GFX should use this virtual
- * address withinMETA_DATAinit package to support SRIOV gfx preemption.
+ * it maps virtual address "AMDGPU_CSA_VADDR" to this VM, and each
+ command
+ * submission of GFX should use this virtual address withinMETA_DATA
+ init
+ * package to support SRIOV gfx preemption.
*/
-
intamdgpu_map_static_csa(struct amdgpu_device *adev, struct amdgpu_vm *vm, struct amdgpu_bo_va **bo_va)
{drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +2
-1@@ -90,7 +89,7 @@ int amdgpu_map_static_csa(struct amdgpu_device *adev, struct amdgpu_vm *vm, return -ENOMEM; } - r = amdgpu_vm_alloc_pts(adev, (*bo_va)->base.vm,AMDGPU_CSA_VADDR , + r = amdgpu_vm_alloc_pts(adev, (*bo_va)->base.vm, +AMDGPU_CSA_VADDR(adev),
AMDGPU_CSA_SIZE);
if (r) {
DRM_ERROR("failed to allocate pts for static CSA, err=%d\n", r); @@ -99,9 +98,9 @@ int amdgpu_map_static_csa(structamdgpu_device*adev, structamdgpu_vm*vm, return r;
}- r = amdgpu_vm_bo_map(adev,
*bo_va,AMDGPU_CSA_VADDR, 0,AMDGPU_CSA_SIZE,
-AMDGPU_PTE_READABLE|AMDGPU_PTE_WRITEABLE| -AMDGPU_PTE_EXECUTABLE);
+ r = amdgpu_vm_bo_map(adev,*bo_va,AMDGPU_CSA_VADDR(adev), 0, +AMDGPU_CSA_SIZE,AMDGPU_PTE_READABLE| +AMDGPU_PTE_WRITEABLE|AMDGPU_PTE_EXECUTABLE);if (r) {
DRM_ERROR("failed to do bo_map on static CSA, err=%d\n", r); diff --gita/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.hb/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.hindex6a83425aa9ed..499362b55e45100644drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h +2
-2@@ -251,8 +251,10 @@ struct amdgpu_virt { uint32_t gim_feature; }; -#define AMDGPU_CSA_SIZE (8 * 1024) -#define AMDGPU_CSA_VADDR (AMDGPU_VA_RESERVED_SIZE - AMDGPU_CSA_SIZE) +#define AMDGPU_CSA_SIZE (8 * 1024) +#define AMDGPU_CSA_VADDR (adev) \ + (((adev)->vm_manager.max_pfn << AMDGPU_GPU_PAGE_SHIFT) + \ + AMDGPU_VA_RESERVED_SIZE)If I understand your intention correctly, it should be that:
+ (((adev)->vm_manager.max_pfn << AMDGPU_GPU_PAGE_SHIFT) - \
+AMDGPU_VA_RESERVED_SIZE)Thanks
Roger(Hongbo.He)#define
amdgpu_sriov_enabled(adev)\
((adev)->virt.caps &AMDGPU_SRIOV_CAPS_ENABLE_IOV) --
2.14.1
Quoted 5 lines
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected] <mailto:[email protected]>
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 5b3ef38e-eb44-75a8-3300-4e892de11dab-5C7GfCeVMHo@public.gmane.org
Re: [PATCH 3/3] drm/amdgpu: move static CSA address to top of address space
looks this is HSA feature to me that CPU and GPU share the same virtual address ....
________________________________
From: Koenig, Christian
Sent: Tuesday, January 23, 2018 8:51:21 PM
To: Liu, Monk; He, Roger; [email protected]
Subject: Re: [PATCH 3/3] drm/amdgpu: move static CSA address to top of address space
The ATC (or alternatively HMM) maps the CPU addresses into the GPU address space.
Now on Linux the lower range (0x0-0x7fffffffffff) is used for the userspace address space on the CPU, so when we want to use that on the GPU it must be free of other mappings.
GFX8 and GFX7 hardware had a separate flag which address space to use in the memory instructions, but on GFX9 it's all one big shared address space and we need to make sure that we don't kick each others feet.
Had to move the addresses Mesa use as well because of this and older VCE firmware unfortunately was buggy regarding this as well.
Regards,
Christian.
Am 23.01.2018 um 13:43 schrieb Liu, Monk:
OK I see, but why HMM/ATC/SVN want low 8MB range ? why they cannot use high range address ?
________________________________
From: Christian König <[email protected]><mailto:[email protected]>
Sent: Tuesday, January 23, 2018 4:26:21 PM
To: Liu, Monk; He, Roger; [email protected]<mailto:[email protected]>
Subject: Re: [PATCH 3/3] drm/amdgpu: move static CSA address to top of address space
Any bug introduced by original design ? I don't see why 8MB- 8KB as the start vm address of CSA has any trouble compared with top range ?
On gfx9 we need the lower address range (0x0-0x7fffffffffff) for HMM/ATC/SVM. If we map the 8k CSA in there and hit it by accident then the GPU will not do what it is supposed to do :)
I could limit the change to only gfx9, but I think the code will be simpler if we change both gfx8 and gfx9.
Besides, please note that you also need modify gfx8/9 source to align emit_cs/de_meta with your change That was the design flaw I was talking about. In other words I couldn't find the code where that address was actually used.
We should use the macro define in those functions as well. Going to send fixed for this in a minute.
Thanks,
Christian.
Am 23.01.2018 um 04:23 schrieb Liu, Monk:
anyway I prefer no change on that part unless there issues or bug need to fix by the change.
the CSA address is for use by CPG h/w not s/w, and since 8MB is a reserved range for each VM I don't see
it's a design flaw with it
________________________________
From: Liu, Monk
Sent: Tuesday, January 23, 2018 11:20:35 AM
To: He, Roger; Christian König; [email protected]<mailto:[email protected]>
Subject: Re: [PATCH 3/3] drm/amdgpu: move static CSA address to top of address space
Any bug introduced by original design ? I don't see why 8MB- 8KB as the start vm address of CSA has any trouble compared with top range ? Besides, please note that you also need modify gfx8/9 source to align emit_cs/de_meta with your change
________________________________
From: He, Roger
Sent: Tuesday, January 23, 2018 10:36:31 AM
To: Christian König; Liu, Monk; [email protected]<mailto:[email protected]>
Subject: RE: [PATCH 3/3] drm/amdgpu: move static CSA address to top of address space
-----Original Message-----
From: amd-gfx [mailto:amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org] On Behalf Of Christian K?nig
Sent: Monday, January 22, 2018 6:44 PM
To: Liu, Monk <[email protected]><mailto:[email protected]>; [email protected]<mailto:[email protected]>
Subject: [PATCH 3/3] drm/amdgpu: move static CSA address to top of address space
There seems to be a design flaw with this since the address of the static CSA is never exported anywhere.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 15 +++++++-------- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h | 6 ++++-- 2 files changed, 11 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +5 -4
@@ -55,11 +55,10 @@ void amdgpu_free_static_csa(struct amdgpu_device *adev) {/* * amdgpu_map_static_csa should be called during amdgpu_vm_init -* it maps virtual address "AMDGPU_VA_RESERVED_SIZE - AMDGPU_CSA_SIZE" -* to this VM, and each command submission of GFX should use this virtual -* address within META_DATA init package to support SRIOV gfx preemption. +* it maps virtual address "AMDGPU_CSA_VADDR" to this VM, and each +command +* submission of GFX should use this virtual address within META_DATA +init +* package to support SRIOV gfx preemption. */ - int amdgpu_map_static_csa(struct amdgpu_device *adev, struct amdgpu_vm *vm,
struct amdgpu_bo_va **bo_va)
{
@@ -90,7 +89,7 @@ int amdgpu_map_static_csa(struct amdgpu_device *adev, struct amdgpu_vm *vm,
return -ENOMEM;
}- r = amdgpu_vm_alloc_pts(adev, (*bo_va)->base.vm, AMDGPU_CSA_VADDR,
+ r = amdgpu_vm_alloc_pts(adev, (*bo_va)->base.vm,
+AMDGPU_CSA_VADDR(adev),
AMDGPU_CSA_SIZE);
if (r) {
DRM_ERROR("failed to allocate pts for static CSA, err=%d\n", r); @@ -99,9 +98,9 @@ int amdgpu_map_static_csa(struct amdgpu_device *adev, struct amdgpu_vm *vm,
return r;
}- r = amdgpu_vm_bo_map(adev, *bo_va, AMDGPU_CSA_VADDR, 0, AMDGPU_CSA_SIZE,
- AMDGPU_PTE_READABLE | AMDGPU_PTE_WRITEABLE |
- AMDGPU_PTE_EXECUTABLE);
+ r = amdgpu_vm_bo_map(adev, *bo_va, AMDGPU_CSA_VADDR(adev), 0,
+ AMDGPU_CSA_SIZE, AMDGPU_PTE_READABLE |
+ AMDGPU_PTE_WRITEABLE | AMDGPU_PTE_EXECUTABLE);
if (r) {
DRM_ERROR("failed to do bo_map on static CSA, err=%d\n", r); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.hindex 6a83425aa9ed..499362b55e45 100644
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h +2 -2
@@ -251,8 +251,10 @@ struct amdgpu_virt {uint32_t gim_feature; }; -#define AMDGPU_CSA_SIZE (8 * 1024) -#define AMDGPU_CSA_VADDR (AMDGPU_VA_RESERVED_SIZE - AMDGPU_CSA_SIZE) +#define AMDGPU_CSA_SIZE (8 * 1024) +#define AMDGPU_CSA_VADDR (adev) \ + (((adev)->vm_manager.max_pfn << AMDGPU_GPU_PAGE_SHIFT) + \ + AMDGPU_VA_RESERVED_SIZE)
If I understand your intention correctly, it should be that:
+ (((adev)->vm_manager.max_pfn << AMDGPU_GPU_PAGE_SHIFT) - \
+ AMDGPU_VA_RESERVED_SIZE)
Thanks
Roger(Hongbo.He)
#define amdgpu_sriov_enabled(adev) \
((adev)->virt.caps & AMDGPU_SRIOV_CAPS_ENABLE_IOV)
--
2.14.1
_______________________________________________
amd-gfx mailing list [email protected]<mailto:[email protected]>
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): BLUPR12MB044994791174D013A88B302284E30-7LeqcoF/[email protected]
Re: [PATCH 3/3] drm/amdgpu: move static CSA address to top of address space
Thanks, can you give the patches a try as well?
I don't have access to SRIOV hardware to test them.
Christian.
Am 23.01.2018 um 14:44 schrieb Liu, Monk:
Quoted 15 lines
looks this is HSA feature to me that CPU and GPU share the same virtual address ....
Ack-by Monk Liu <[email protected]>------------------------------------------------------------------------
*From:* Koenig, Christian
*Sent:* Tuesday, January 23, 2018 8:51:21 PM
*To:* Liu, Monk; He, Roger; [email protected] *Subject:* Re: [PATCH 3/3] drm/amdgpu: move static CSA address to top of address space The ATC (or alternatively HMM) maps the CPU addresses into the GPU address space.Now on Linux the lower range (0x0-0x7fffffffffff) is used for the userspace address space on the CPU, so when we want to use that on the GPU it must be free of other mappings.
Quoted 150 lines
GFX8 and GFX7 hardware had a separate flag which address space to use in the memory instructions, but on GFX9 it's all one big shared address space and we need to make sure that we don't kick each others feet.
Had to move the addresses Mesa use as well because of this and older VCE firmware unfortunately was buggy regarding this as well.
Regards,
Christian.Am 23.01.2018 um 13:43 schrieb Liu, Monk:
Quoted 141 lines
OK I see, but why HMM/ATC/SVN want low 8MB range ? why they cannot use high range address ?
------------------------------------------------------------------------
*From:* Christian König <[email protected]> <mailto:[email protected]> *Sent:* Tuesday, January 23, 2018 4:26:21 PM
*To:* Liu, Monk; He, Roger; [email protected] <mailto:[email protected]> *Subject:* Re: [PATCH 3/3] drm/amdgpu: move static CSA address to top of address spaceQuoted 1 line
Any bug introduced by original design ? I don't see why 8MB- 8KB as the start vm address of CSA has any trouble compared with top range ?
On gfx9 we need the lower address range (0x0-0x7fffffffffff) for HMM/ATC/SVM. If we map the 8k CSA in there and hit it by accident then the GPU will not do what it is supposed to do :)
I could limit the change to only gfx9, but I think the code will be simpler if we change both gfx8 and gfx9.
Quoted 1 line
Besides, please note that you also need modify gfx8/9 source to align emit_cs/de_meta with your change
That was the design flaw I was talking about. In other words I couldn't find the code where that address was actually used.
We should use the macro define in those functions as well. Going to send fixed for this in a minute.
Thanks,
Christian.Am 23.01.2018 um 04:23 schrieb Liu, Monk:
Quoted 117 lines
anyway I prefer no change on that part unless there issues or bug need to fix by the change.
the CSA address is for use by CPG h/w not s/w, and since 8MB is a reserved range for each VM I don't see
it's a design flaw with it
------------------------------------------------------------------------
*From:* Liu, Monk
*Sent:* Tuesday, January 23, 2018 11:20:35 AM
*To:* He, Roger; Christian König; [email protected] <mailto:[email protected]> *Subject:* Re: [PATCH 3/3] drm/amdgpu: move static CSA address to top of address spaceAny bug introduced by original design ? I don't see why 8MB- 8KB as the start vm address of CSA has any trouble compared with top range ? Besides, please note that you also need modify gfx8/9 source to align emit_cs/de_meta with your change
------------------------------------------------------------------------
*From:* He, Roger
*Sent:* Tuesday, January 23, 2018 10:36:31 AM
*To:* Christian König; Liu, Monk; [email protected] <mailto:[email protected]> *Subject:* RE: [PATCH 3/3] drm/amdgpu: move static CSA address to top of address space-----Original Message-----
From: amd-gfx [mailto:amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org] On Behalf Of Christian K?nig
Sent: Monday, January 22, 2018 6:44 PM
To: Liu, Monk <[email protected]> <mailto:[email protected]>; [email protected] <mailto:[email protected]>
Subject: [PATCH 3/3] drm/amdgpu: move static CSA address to top of address spaceThere seems to be a design flaw with this since the address of the static CSA is never exported anywhere.
---
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 15 +++++++--------drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h| 6 ++++--2 files changed, 11 insertions(+), 10 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +0
-2@@ -55,11 +55,10 @@ void amdgpu_free_static_csa(struct amdgpu_device *adev) { /** amdgpu_map_static_csa should be called during amdgpu_vm_init -* it maps virtual address "AMDGPU_VA_RESERVED_SIZE - AMDGPU_CSA_SIZE" -* to this VM, and each command submission of GFX should use this virtual
- * address withinMETA_DATAinit package to support SRIOV gfx preemption.
+ * it maps virtual address "AMDGPU_CSA_VADDR" to this VM, and each
+ command
+ * submission of GFX should use this virtual address withinMETA_DATA
+ init
+ * package to support SRIOV gfx preemption.
*/
-
intamdgpu_map_static_csa(struct amdgpu_device *adev, struct amdgpu_vm *vm, struct amdgpu_bo_va **bo_va)
{drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +2
-1@@ -90,7 +89,7 @@ int amdgpu_map_static_csa(struct amdgpu_device *adev, struct amdgpu_vm *vm, return -ENOMEM; } - r = amdgpu_vm_alloc_pts(adev, (*bo_va)->base.vm,AMDGPU_CSA_VADDR , + r = amdgpu_vm_alloc_pts(adev, (*bo_va)->base.vm, +AMDGPU_CSA_VADDR(adev),
AMDGPU_CSA_SIZE);
if (r) {
DRM_ERROR("failed to allocate pts for static CSA, err=%d\n", r); @@ -99,9 +98,9 @@ int amdgpu_map_static_csa(structamdgpu_device*adev, structamdgpu_vm*vm, return r;
}- r = amdgpu_vm_bo_map(adev,
*bo_va,AMDGPU_CSA_VADDR, 0,AMDGPU_CSA_SIZE,
-AMDGPU_PTE_READABLE|AMDGPU_PTE_WRITEABLE|
-AMDGPU_PTE_EXECUTABLE);
+ r = amdgpu_vm_bo_map(adev,*bo_va,AMDGPU_CSA_VADDR(adev), 0, +AMDGPU_CSA_SIZE,AMDGPU_PTE_READABLE|
+AMDGPU_PTE_WRITEABLE|AMDGPU_PTE_EXECUTABLE);if (r) {
DRM_ERROR("failed to do bo_map on static CSA, err=%d\n", r); diff --gita/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.hb/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.hindex6a83425aa9ed..499362b55e45100644drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h +2
-2@@ -251,8 +251,10 @@ struct amdgpu_virt { uint32_t gim_feature; }; -#define AMDGPU_CSA_SIZE (8 * 1024) -#define AMDGPU_CSA_VADDR (AMDGPU_VA_RESERVED_SIZE - AMDGPU_CSA_SIZE) +#define AMDGPU_CSA_SIZE (8 * 1024) +#define AMDGPU_CSA_VADDR (adev) \ + (((adev)->vm_manager.max_pfn << AMDGPU_GPU_PAGE_SHIFT) + \ + AMDGPU_VA_RESERVED_SIZE)If I understand your intention correctly, it should be that:
+ (((adev)->vm_manager.max_pfn << AMDGPU_GPU_PAGE_SHIFT) - \
+AMDGPU_VA_RESERVED_SIZE)Thanks
Roger(Hongbo.He)#define
amdgpu_sriov_enabled(adev)\
((adev)->virt.caps &AMDGPU_SRIOV_CAPS_ENABLE_IOV) --
2.14.1_______________________________________________
amd-gfx mailing list
[email protected] <mailto:[email protected]>
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): ff5350e0-227b-95d2-2efe-f02e6989e870-5C7GfCeVMHo@public.gmane.org
Re: [PATCH 3/3] drm/amdgpu: move static CSA address to top of address space
sorry, I don't have time running DRM-NEXT kernel currently, we are doing new release and bug fixing for custome, theoretically it's ok ay to move CSA address to another place.
I'll try it in next SRIOV branch rebase
BR Monk
________________________________
From: Koenig, Christian
Sent: Tuesday, January 23, 2018 10:45:40 PM
To: Liu, Monk; He, Roger; [email protected]
Subject: Re: [PATCH 3/3] drm/amdgpu: move static CSA address to top of address space
Thanks, can you give the patches a try as well?
I don't have access to SRIOV hardware to test them.
Christian.
Am 23.01.2018 um 14:44 schrieb Liu, Monk:
looks this is HSA feature to me that CPU and GPU share the same virtual address ....
________________________________
From: Koenig, Christian
Sent: Tuesday, January 23, 2018 8:51:21 PM
To: Liu, Monk; He, Roger; [email protected]<mailto:[email protected]>
Subject: Re: [PATCH 3/3] drm/amdgpu: move static CSA address to top of address space
The ATC (or alternatively HMM) maps the CPU addresses into the GPU address space.
Now on Linux the lower range (0x0-0x7fffffffffff) is used for the userspace address space on the CPU, so when we want to use that on the GPU it must be free of other mappings.
GFX8 and GFX7 hardware had a separate flag which address space to use in the memory instructions, but on GFX9 it's all one big shared address space and we need to make sure that we don't kick each others feet.
Had to move the addresses Mesa use as well because of this and older VCE firmware unfortunately was buggy regarding this as well.
Regards,
Christian.
Am 23.01.2018 um 13:43 schrieb Liu, Monk:
OK I see, but why HMM/ATC/SVN want low 8MB range ? why they cannot use high range address ?
________________________________
From: Christian König <[email protected]><mailto:[email protected]>
Sent: Tuesday, January 23, 2018 4:26:21 PM
To: Liu, Monk; He, Roger; [email protected]<mailto:[email protected]>
Subject: Re: [PATCH 3/3] drm/amdgpu: move static CSA address to top of address space
Any bug introduced by original design ? I don't see why 8MB- 8KB as the start vm address of CSA has any trouble compared with top range ?
On gfx9 we need the lower address range (0x0-0x7fffffffffff) for HMM/ATC/SVM. If we map the 8k CSA in there and hit it by accident then the GPU will not do what it is supposed to do :)
I could limit the change to only gfx9, but I think the code will be simpler if we change both gfx8 and gfx9.
Besides, please note that you also need modify gfx8/9 source to align emit_cs/de_meta with your change That was the design flaw I was talking about. In other words I couldn't find the code where that address was actually used.
We should use the macro define in those functions as well. Going to send fixed for this in a minute.
Thanks,
Christian.
Am 23.01.2018 um 04:23 schrieb Liu, Monk:
anyway I prefer no change on that part unless there issues or bug need to fix by the change.
the CSA address is for use by CPG h/w not s/w, and since 8MB is a reserved range for each VM I don't see
it's a design flaw with it
________________________________
From: Liu, Monk
Sent: Tuesday, January 23, 2018 11:20:35 AM
To: He, Roger; Christian König; [email protected]<mailto:[email protected]>
Subject: Re: [PATCH 3/3] drm/amdgpu: move static CSA address to top of address space
Any bug introduced by original design ? I don't see why 8MB- 8KB as the start vm address of CSA has any trouble compared with top range ? Besides, please note that you also need modify gfx8/9 source to align emit_cs/de_meta with your change
________________________________
From: He, Roger
Sent: Tuesday, January 23, 2018 10:36:31 AM
To: Christian König; Liu, Monk; [email protected]<mailto:[email protected]>
Subject: RE: [PATCH 3/3] drm/amdgpu: move static CSA address to top of address space
-----Original Message-----
From: amd-gfx [mailto:amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org] On Behalf Of Christian K?nig
Sent: Monday, January 22, 2018 6:44 PM
To: Liu, Monk <[email protected]><mailto:[email protected]>; [email protected]<mailto:[email protected]>
Subject: [PATCH 3/3] drm/amdgpu: move static CSA address to top of address space
There seems to be a design flaw with this since the address of the static CSA is never exported anywhere.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 15 +++++++-------- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h | 6 ++++-- 2 files changed, 11 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +5 -4
@@ -55,11 +55,10 @@ void amdgpu_free_static_csa(struct amdgpu_device *adev) {/* * amdgpu_map_static_csa should be called during amdgpu_vm_init -* it maps virtual address "AMDGPU_VA_RESERVED_SIZE - AMDGPU_CSA_SIZE" -* to this VM, and each command submission of GFX should use this virtual -* address within META_DATA init package to support SRIOV gfx preemption. +* it maps virtual address "AMDGPU_CSA_VADDR" to this VM, and each +command +* submission of GFX should use this virtual address within META_DATA +init +* package to support SRIOV gfx preemption. */ - int amdgpu_map_static_csa(struct amdgpu_device *adev, struct amdgpu_vm *vm,
struct amdgpu_bo_va **bo_va)
{
@@ -90,7 +89,7 @@ int amdgpu_map_static_csa(struct amdgpu_device *adev, struct amdgpu_vm *vm,
return -ENOMEM;
}- r = amdgpu_vm_alloc_pts(adev, (*bo_va)->base.vm, AMDGPU_CSA_VADDR,
+ r = amdgpu_vm_alloc_pts(adev, (*bo_va)->base.vm,
+AMDGPU_CSA_VADDR(adev),
AMDGPU_CSA_SIZE);
if (r) {
DRM_ERROR("failed to allocate pts for static CSA, err=%d\n", r); @@ -99,9 +98,9 @@ int amdgpu_map_static_csa(struct amdgpu_device *adev, struct amdgpu_vm *vm,
return r;
}- r = amdgpu_vm_bo_map(adev, *bo_va, AMDGPU_CSA_VADDR, 0, AMDGPU_CSA_SIZE,
- AMDGPU_PTE_READABLE | AMDGPU_PTE_WRITEABLE |
- AMDGPU_PTE_EXECUTABLE);
+ r = amdgpu_vm_bo_map(adev, *bo_va, AMDGPU_CSA_VADDR(adev), 0,
+ AMDGPU_CSA_SIZE, AMDGPU_PTE_READABLE |
+ AMDGPU_PTE_WRITEABLE | AMDGPU_PTE_EXECUTABLE);
if (r) {
DRM_ERROR("failed to do bo_map on static CSA, err=%d\n", r); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.hindex 6a83425aa9ed..499362b55e45 100644
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h +2 -2
@@ -251,8 +251,10 @@ struct amdgpu_virt {uint32_t gim_feature; }; -#define AMDGPU_CSA_SIZE (8 * 1024) -#define AMDGPU_CSA_VADDR (AMDGPU_VA_RESERVED_SIZE - AMDGPU_CSA_SIZE) +#define AMDGPU_CSA_SIZE (8 * 1024) +#define AMDGPU_CSA_VADDR (adev) \ + (((adev)->vm_manager.max_pfn << AMDGPU_GPU_PAGE_SHIFT) + \ + AMDGPU_VA_RESERVED_SIZE)
If I understand your intention correctly, it should be that:
+ (((adev)->vm_manager.max_pfn << AMDGPU_GPU_PAGE_SHIFT) - \
+ AMDGPU_VA_RESERVED_SIZE)
Thanks
Roger(Hongbo.He)
#define amdgpu_sriov_enabled(adev) \
((adev)->virt.caps & AMDGPU_SRIOV_CAPS_ENABLE_IOV)
--
2.14.1
_______________________________________________
amd-gfx mailing list [email protected]<mailto:[email protected]>
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx