drm/radeon: update comments to clarify VM setup
Subsystems (2)
PATCH 1/1 drm/radeon: update comments to clarify VM setup
From: Alex Deucher <[email protected]>
The actual set up and assignment of VM page tables is done on the fly in radeon_gart.c.
--- drivers/gpu/drm/radeon/ni.c | 4 ++++ drivers/gpu/drm/radeon/radeon_device.c | 3 +++ drivers/gpu/drm/radeon/si.c | 7 ++++--- 3 files changed, 11 insertions(+), 3 deletions(-)
drivers/gpu/drm/radeon/ni.c +4 -0
@@ -770,6 +770,10 @@ static int cayman_pcie_gart_enable(struct radeon_device *rdev)WREG32 (0x15DC ,0 );/* empty context1-7 */ +/* Assign the pt base to something valid for now; the pts used for +* the VMs are determined by the application and setup and assigned +* on the fly in the vm part of radeon_gart.c +*/ for (i =1 ; i <8 ; i++) {WREG32 (VM_CONTEXT0_PAGE_TABLE_START_ADDR + (i <<2 ),0 );WREG32 (VM_CONTEXT0_PAGE_TABLE_END_ADDR + (i <<2 ),0 );
drivers/gpu/drm/radeon/radeon_device.c +3 -0
@@ -1018,6 +1018,9 @@ int radeon_device_init(struct radeon_device *rdev,return r;/* initialize vm here */ mutex_init (&rdev->vm_manager.lock); +/* FIXME start with 4G, once using 2 level pt switch to full +* vm size space +*/ rdev->vm_manager.max_pfn =1 <<20 ;INIT_LIST_HEAD (&rdev->vm_manager.lru_vm);
drivers/gpu/drm/radeon/si.c +4 -3
@@ -2407,12 +2407,13 @@ static int si_pcie_gart_enable(struct radeon_device *rdev)WREG32 (0x15DC ,0 );/* empty context1-15 */ -/* FIXME start with 4G, once using 2 level pt switch to full -* vm size space -*/ /* set vm size, must be a multiple of 4 */ WREG32 (VM_CONTEXT1_PAGE_TABLE_START_ADDR ,0 );WREG32 (VM_CONTEXT1_PAGE_TABLE_END_ADDR , rdev->vm_manager.max_pfn); +/* Assign the pt base to something valid for now; the pts used for +* the VMs are determined by the application and setup and assigned +* on the fly in the vm part of radeon_gart.c +*/ for (i =1 ; i <16 ; i++) {if (i <8 ) WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (i << 2),
Signature · 1 line
1.7.7.5
Quoted 6 lines · On 08.10.2012 15:50, [email protected] wrote:
From: Alex Deucher <[email protected]>
The actual set up and assignment of VM page tables is done on the fly in
radeon_gart.c.Signed-off-by Alex Deucher <[email protected]>
One comment below, apart from that it's:
Quoted 26 lines
--- drivers/gpu/drm/radeon/ni.c | 4 ++++ drivers/gpu/drm/radeon/radeon_device.c | 3 +++ drivers/gpu/drm/radeon/si.c | 7 ++++--- 3 files changed, 11 insertions(+), 3 deletions(-)drivers/gpu/drm/radeon/ni.c +4
-0@@ -770,6 +770,10 @@ static int cayman_pcie_gart_enable(struct radeon_device *rdev)WREG32 (0x15DC ,0 );/* empty context1-7 */ +/* Assign the pt base to something valid for now; the pts used for +* the VMs are determined by the application and setup and assigned +* on the fly in the vm part of radeon_gart.c +*/ for (i =1 ; i <8 ; i++) {WREG32 (VM_CONTEXT0_PAGE_TABLE_START_ADDR + (i <<2 ),0 );WREG32 (VM_CONTEXT0_PAGE_TABLE_END_ADDR + (i <<2 ),0 );drivers/gpu/drm/radeon/radeon_device.c +0
-0
drivers/gpu/drm/radeon/radeon_device.c int radeon_device_init(struct radeon_device *rdev, · line 1023
Quoted 6 lines
drivers/gpu/drm/radeon/radeon_device.c +3
-0@@ -1018,6 +1018,9 @@ int radeon_device_init(struct radeon_device *rdev,return r;/* initialize vm here */ mutex_init (&rdev->vm_manager.lock); +/* FIXME start with 4G, once using 2 level pt switch to full +* vm size space +*/
Even with 2 level pt I don't think we want to switch to the full vm size space.
Having 40bits address space minus 12bits offsets gives us 28bits for the page directory/page table, assuming a 50/50 split between them we would get 2 ^ 14 * 8 = 128kb for each page, which in my eyes is a bit much (and that gets even worth when we get 48bits address space.....)
I would rather say to make max_pfn depend on the available memory, so that a single application can at least map all VRAM + GART memory.
Quoted 24 lines
drivers/gpu/drm/radeon/radeon_device.c +0
-0rdev->vm_manager.max_pfn =1 <<20 ;INIT_LIST_HEAD (&rdev->vm_manager.lru_vm);drivers/gpu/drm/radeon/si.c +4
-3@@ -2407,12 +2407,13 @@ static int si_pcie_gart_enable(struct radeon_device *rdev)WREG32 (0x15DC ,0 );/* empty context1-15 */ -/* FIXME start with 4G, once using 2 level pt switch to full -* vm size space -*/ /* set vm size, must be a multiple of 4 */ WREG32 (VM_CONTEXT1_PAGE_TABLE_START_ADDR ,0 );WREG32 (VM_CONTEXT1_PAGE_TABLE_END_ADDR , rdev->vm_manager.max_pfn); +/* Assign the pt base to something valid for now; the pts used for +* the VMs are determined by the application and setup and assigned +* on the fly in the vm part of radeon_gart.c +*/ for (i =1 ; i <16 ; i++) {if (i <8 ) WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (i << 2),
Quoted 52 lines · Christian König
Quoted 7 lines · On 08.10.2012 15:50, [email protected] wrote:
From: Alex Deucher <[email protected]>
The actual set up and assignment of VM page tables is done on the fly in
radeon_gart.c.Signed-off-by Alex Deucher <[email protected]>One comment below, apart from that it's:
Reviewed-by Christian König <[email protected]>Quoted 28 lines
--- drivers/gpu/drm/radeon/ni.c | 4 ++++ drivers/gpu/drm/radeon/radeon_device.c | 3 +++ drivers/gpu/drm/radeon/si.c | 7 ++++--- 3 files changed, 11 insertions(+), 3 deletions(-)drivers/gpu/drm/radeon/ni.c +2
-0@@ -770,6 +770,10 @@ static int cayman_pcie_gart_enable(struct radeon_device *rdev) WREG32(0x15DC, 0);/* empty context1-7 */ +/* Assign the pt base to something valid for now; the pts used for +* the VMs are determined by the application and setup and assigned
drivers/gpu/drm/radeon/ni.c +2
-0+* on the fly in the vm part of radeon_gart.c +*/ for (i =1 ; i <8 ; i++) {WREG32 (VM_CONTEXT0_PAGE_TABLE_START_ADDR + (i <<2 ),0 );WREG32 (VM_CONTEXT0_PAGE_TABLE_END_ADDR + (i <<2 ),0 );drivers/gpu/drm/radeon/radeon_device.c +0
-0drivers/gpu/drm/radeon/radeon_device.c int radeon_device_init(struct radeon_device *rdev, · line 1023
Quoted 6 lines
drivers/gpu/drm/radeon/radeon_device.c +3
-0@@ -1018,6 +1018,9 @@ int radeon_device_init(struct radeon_device *rdev,return r;/* initialize vm here */ mutex_init (&rdev->vm_manager.lock); +/* FIXME start with 4G, once using 2 level pt switch to full +* vm size space +*/ Even with 2 level pt I don't think we want to switch to the full vm size space.
Quoted 7 lines
Having 40bits address space minus 12bits offsets gives us 28bits for the page directory/page table, assuming a 50/50 split between them we would get 2 ^ 14 * 8 = 128kb for each page, which in my eyes is a bit much (and that gets even worth when we get 48bits address space.....)
I would rather say to make
max_pfndepend on the available memory, so that a single application can at least map all VRAM + GART memory.
I'll make the comment a bit clearer. I was mostly just moving the comment to be near the code that sets that value.
Alex
Quoted 29 lines
Quoted 27 lines
drivers/gpu/drm/radeon/radeon_device.c +0
-0rdev->vm_manager.max_pfn =1 <<20 ;INIT_LIST_HEAD (&rdev->vm_manager.lru_vm); diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.cindex c76825f..f272ead 100644
drivers/gpu/drm/radeon/si.c +2
-3@@ -2407,12 +2407,13 @@ static int si_pcie_gart_enable(struct radeon_device *rdev) WREG32(0x15DC, 0);/* empty context1-15 */ -/* FIXME start with 4G, once using 2 level pt switch to full -* vm size space -*/ /* set vm size, must be a multiple of 4 */ WREG32 (VM_CONTEXT1_PAGE_TABLE_START_ADDR ,0 );WREG32 (VM_CONTEXT1_PAGE_TABLE_END_ADDR , rdev->vm_manager.max_pfn); +/* Assign the pt base to something valid for now; the pts used for +* the VMs are determined by the application and setup and assigned
drivers/gpu/drm/radeon/si.c +2
-0+* on the fly in the vm part of radeon_gart.c +*/ for (i =1 ; i <16 ; i++) {if (i <8 ) WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (i <<2),
PATCH 1/2 drm/radeon: update comments to clarify VM setup (v2)
From: Alex Deucher <[email protected]>
The actual set up and assignment of VM page tables is done on the fly in radeon_gart.c.
v2: update vm size comments
--- drivers/gpu/drm/radeon/ni.c | 4 ++++ drivers/gpu/drm/radeon/radeon_device.c | 4 ++++ drivers/gpu/drm/radeon/si.c | 7 ++++--- 3 files changed, 12 insertions(+), 3 deletions(-)
drivers/gpu/drm/radeon/ni.c +4 -0
@@ -770,6 +770,10 @@ static int cayman_pcie_gart_enable(struct radeon_device *rdev)WREG32 (0x15DC ,0 );/* empty context1-7 */ +/* Assign the pt base to something valid for now; the pts used for +* the VMs are determined by the application and setup and assigned +* on the fly in the vm part of radeon_gart.c +*/ for (i =1 ; i <8 ; i++) {WREG32 (VM_CONTEXT0_PAGE_TABLE_START_ADDR + (i <<2 ),0 );WREG32 (VM_CONTEXT0_PAGE_TABLE_END_ADDR + (i <<2 ),0 );
drivers/gpu/drm/radeon/radeon_device.c +4 -0
@@ -1018,6 +1018,10 @@ int radeon_device_init(struct radeon_device *rdev,return r;/* initialize vm here */ mutex_init (&rdev->vm_manager.lock); +/* Adjust VM size here. +* Currently set to 4GB ((1 << 20) 4k pages). +* Max GPUVM size for cayman and SI is 40 bits. +*/ rdev->vm_manager.max_pfn =1 <<20 ;INIT_LIST_HEAD (&rdev->vm_manager.lru_vm);
drivers/gpu/drm/radeon/si.c +4 -3
@@ -2407,12 +2407,13 @@ static int si_pcie_gart_enable(struct radeon_device *rdev)WREG32 (0x15DC ,0 );/* empty context1-15 */ -/* FIXME start with 4G, once using 2 level pt switch to full -* vm size space -*/ /* set vm size, must be a multiple of 4 */ WREG32 (VM_CONTEXT1_PAGE_TABLE_START_ADDR ,0 );WREG32 (VM_CONTEXT1_PAGE_TABLE_END_ADDR , rdev->vm_manager.max_pfn); +/* Assign the pt base to something valid for now; the pts used for +* the VMs are determined by the application and setup and assigned +* on the fly in the vm part of radeon_gart.c +*/ for (i =1 ; i <16 ; i++) {if (i <8 ) WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (i << 2),
Signature · 6 lines
1.7.7.5 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel