drivers: hv: dxgkrnl: Allow user to specify CPU VA for device allocation
Subsystems (2)
PATCH 1/1 drivers: hv: dxgkrnl: Allow user to specify CPU VA for device allocation
The movtivation is we want to unify CPU VA and GPU VA.
--- drivers/hv/dxgkrnl/dxgvmbus.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-)
drivers/hv/dxgkrnl/dxgvmbus.c +14 -10
@@ -580,7 +580,7 @@ int dxg_unmap_iospace(void *va, u32 size)return 0 ; } -static u8 *dxg_map_iospace (u64 iospace_address,u32 size, +static u8 *dxg_map_iospace (u64 iospace_address,u64 user_va,u32 size,unsigned long protection,bool cached) {struct vm_area_struct *vma;
@@ -594,7 +594,12 @@ static u8 *dxg_map_iospace(u64 iospace_address, u32 size,return NULL ; } - va =vm_mmap (NULL ,0 , size, protection,MAP_SHARED |MAP_ANONYMOUS ,0 ); +if (user_va) + va =vm_mmap (untagged_addr (user_va),0 , size, protection, +MAP_SHARED |MAP_ANONYMOUS |MAP_FIXED ,0 ); +else + va =vm_mmap (NULL ,0 , size, protection, +MAP_SHARED |MAP_ANONYMOUS ,0 );if ((long )va <=0 ) {DXG_ERR ("vm_mmap failed %lx %d" , va, size);return NULL ;
@@ -789,9 +794,8 @@ int dxgvmb_send_open_sync_object_nt(struct dxgprocess *process, args->sync_object = result.sync_object;if (syncobj->monitored_fence) { -void *va =dxg_map_iospace (result.guest_cpu_physical_address, -PAGE_SIZE ,PROT_READ |PROT_WRITE , - true); +void *va =dxg_map_iospace (result.guest_cpu_physical_address,0 , +PAGE_SIZE ,PROT_READ |PROT_WRITE , true);if (va ==NULL ) { ret = -ENOMEM ; goto cleanup;
@@ -1315,8 +1319,8 @@ int dxgvmb_send_create_paging_queue(struct dxgprocess *process, args->paging_queue = result.paging_queue; args->sync_object = result.sync_object; args->fence_cpu_virtual_address = -dxg_map_iospace (result.fence_storage_physical_address,PAGE_SIZE , -PROT_READ |PROT_WRITE , true); +dxg_map_iospace (result.fence_storage_physical_address,0 , +PAGE_SIZE ,PROT_READ |PROT_WRITE , true);if (args->fence_cpu_virtual_address ==NULL ) { ret = -ENOMEM ; goto cleanup;
@@ -2867,7 +2871,7 @@ dxgvmb_send_create_sync_object(struct dxgprocess *process, }if (syncobj->monitored_fence) { - va =dxg_map_iospace (result.fence_storage_address,PAGE_SIZE , + va =dxg_map_iospace (result.fence_storage_address,0 ,PAGE_SIZE ,PROT_READ |PROT_WRITE , true);if (va ==NULL ) { ret = -ENOMEM ;
@@ -3156,7 +3160,7 @@ int dxgvmb_send_lock2(struct dxgprocess *process, }else {u64 offset = (u64 )result.cpu_visible_buffer_offset; - args->data =dxg_map_iospace (offset, + args->data =dxg_map_iospace (offset, args->data, alloc->num_pages <<PAGE_SHIFT ,PROT_READ |PROT_WRITE , alloc->cached);if (args->data) {
@@ -3712,7 +3716,7 @@ int dxgvmb_send_create_hwqueue(struct dxgprocess *process, } hwqueue->progress_fence_mapped_address = -dxg_map_iospace ((u64 )command->hwqueue_progress_fence_cpuva, +dxg_map_iospace ((u64 )command->hwqueue_progress_fence_cpuva,0 ,PAGE_SIZE ,PROT_READ |PROT_WRITE , true);if (hwqueue->progress_fence_mapped_address ==NULL ) { ret = -ENOMEM ;
Signature · 1 line
2.25.1
[Public]
ping
Quoted 106 lines
-----Original Message-----
From: Yu, Lang <[email protected]>
Sent: Wednesday, December 27, 2023 11:50 AM
To: Iouri Tarassov <[email protected]>
Cc: [email protected]; Yu, Lang <[email protected]>
Subject: [PATCH] drivers: hv: dxgkrnl: Allow user to specify CPU VA for device allocationThe movtivation is we want to unify CPU VA and GPU VA.
Signed-off-by Lang Yu <[email protected]>---
drivers/hv/dxgkrnl/dxgvmbus.c| 24 ++++++++++++++----------1 file changed, 14 insertions(+), 10 deletions(-)drivers/hv/dxgkrnl/dxgvmbus.c index renamed from drivers/hv/dxgkrnl/dxgvmbus.c +0
-0
9320bede3a0a..a4bca27a7cc8100644drivers/hv/dxgkrnl/dxgvmbus.c +7
-2@@ -580,7 +580,7 @@ int dxg_unmap_iospace(void *va, u32 size)return 0 ; } -static u8 *dxg_map_iospace (u64 iospace_address,u32 size, +static u8 *dxg_map_iospace (u64 iospace_address,u64 user_va,u32 size,unsigned long protection,bool cached) {struct vm_area_struct *vma;@@ -594,7 +594,12 @@ static u8 *dxg_map_iospace(u64 iospace_address, u32 size, return NULL; } - va =vm_mmap (NULL ,0 , size, protection,MAP_SHARED | MAP_ANONYMOUS, 0); +if (user_va) + va =vm_mmap (untagged_addr (user_va),0 , size, protection, +MAP_SHARED |MAP_ANONYMOUS |MAP_FIXED ,0 ); +else + va =vm_mmap (NULL ,0 , size, protection, +MAP_SHARED |MAP_ANONYMOUS ,0 );if ((long )va <=0 ) {DXG_ERR("vm_mmap failed %lx %d", va, size); return NULL;drivers/hv/dxgkrnl/dxgvmbus.c +2
-3@@ -789,9 +794,8 @@ int dxgvmb_send_open_sync_object_nt(struct dxgprocess *process, args->sync_object = result.sync_object;if (syncobj->monitored_fence) { -void *va =dxg_map_iospace (result.guest_cpu_physical_address, -PAGE_SIZE ,PROT_READ |PROT_WRITE , - true); + void *va = dxg_map_iospace(result.guest_cpu_physical_address, 0, + PAGE_SIZE, PROT_READ |PROT_WRITE, true); if (va == NULL) { ret = -ENOMEM; goto cleanup;drivers/hv/dxgkrnl/dxgvmbus.c +2
-2@@ -1315,8 +1319,8 @@ int dxgvmb_send_create_paging_queue(struct dxgprocess *process, args->paging_queue = result.paging_queue; args->sync_object = result.sync_object; args->fence_cpu_virtual_address = -dxg_map_iospace (result.fence_storage_physical_address,PAGE_SIZE , -PROT_READ |PROT_WRITE , true); +dxg_map_iospace (result.fence_storage_physical_address,0 , +PAGE_SIZE ,PROT_READ |PROT_WRITE , true);if (args->fence_cpu_virtual_address ==NULL ) { ret = -ENOMEM ;goto cleanup;drivers/hv/dxgkrnl/dxgvmbus.c +1
-1@@ -2867,7 +2871,7 @@ dxgvmb_send_create_sync_object(struct dxgprocess *process, }if (syncobj->monitored_fence) { - va =dxg_map_iospace (result.fence_storage_address,PAGE_SIZE , + va =dxg_map_iospace (result.fence_storage_address,0 ,PAGE_SIZE ,PROT_READ |PROT_WRITE , true);if (va == NULL) { ret = -ENOMEM;drivers/hv/dxgkrnl/dxgvmbus.c +1
-1@@ -3156,7 +3160,7 @@ int dxgvmb_send_lock2(struct dxgprocess *process, }else {u64 offset = (u64 )result.cpu_visible_buffer_offset; - args->data =dxg_map_iospace (offset, + args->data =dxg_map_iospace (offset, args->data, alloc->num_pages <<PAGE_SHIFT ,PROT_READ |PROT_WRITE , alloc- >cached);if (args->data) {drivers/hv/dxgkrnl/dxgvmbus.c +1
-1@@ -3712,7 +3716,7 @@ int dxgvmb_send_create_hwqueue(struct dxgprocess *process, } hwqueue->progress_fence_mapped_address = - dxg_map_iospace((u64)command- >hwqueue_progress_fence_cpuva, + dxg_map_iospace((u64)command- >hwqueue_progress_fence_cpuva, 0,PAGE_SIZE, PROT_READ | PROT_WRITE, true); if (hwqueue->progress_fence_mapped_address == NULL) { ret = -ENOMEM;--
2.25.1
Wei Liu
maintainerQuoted 15 lines · Lang
[Public]
ping
Quoted 11 lines
-----Original Message-----
From: Yu, Lang <[email protected]>
Sent: Wednesday, December 27, 2023 11:50 AM
To: Iouri Tarassov <[email protected]>
Cc: [email protected]; Yu, Lang <[email protected]>
Subject: [PATCH] drivers: hv: dxgkrnl: Allow user to specify CPU VA for device allocationThe movtivation is we want to unify CPU VA and GPU VA.
Signed-off-by Lang Yu <[email protected]>
Hi Lang,
The driver is not merged upstream. I won't take any further action here because there is nothing I can do. Perhaps you can work directly with Iouri to merge the change to the driver he maintains.
Thanks,
Wei.
[Public]
Quoted 24 lines
-----Original Message-----
From: Wei Liu <[email protected]>
Sent: Wednesday, January 17, 2024 10:53 AM
To: Yu, Lang <[email protected]>
Cc: Iouri Tarassov <[email protected]>; [email protected]; Wei Liu <[email protected]>
Subject: Re: [PATCH] drivers: hv: dxgkrnl: Allow user to specify CPU VA for device allocationQuoted 14 lines · Lang
[Public]
ping
Quoted 10 lines
-----Original Message-----
From: Yu, Lang <[email protected]>
Sent: Wednesday, December 27, 2023 11:50 AM
To: Iouri Tarassov <[email protected]>
Cc: [email protected]; Yu, Lang <[email protected]>
Subject: [PATCH] drivers: hv: dxgkrnl: Allow user to specify CPU VA for device allocationThe movtivation is we want to unify CPU VA and GPU VA.
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Signed-off-by Lang Yu <[email protected]>Hi Lang,
The driver is not merged upstream. I won't take any further action here because there is nothing I can do. Perhaps you can work directly with Iouri to merge the change to the driver he maintains.
Thanks. Got it.
https://github.com/microsoft/WSL2-Linux-Kernel?tab=readme-ov-file#feature-requests tells me submitting the change upstream.
Regards,
Lang
Quoted 2 lines
Thanks,
Wei.
Wei Liu
maintainerQuoted 28 lines · Lang
[Public]
Quoted 26 lines
-----Original Message-----
From: Wei Liu <[email protected]>
Sent: Wednesday, January 17, 2024 10:53 AM
To: Yu, Lang <[email protected]>
Cc: Iouri Tarassov <[email protected]>; [email protected]; Wei Liu <[email protected]>
Subject: Re: [PATCH] drivers: hv: dxgkrnl: Allow user to specify CPU VA for device allocationQuoted 15 lines · Lang
[Public]
ping
Quoted 11 lines
-----Original Message-----
From: Yu, Lang <[email protected]>
Sent: Wednesday, December 27, 2023 11:50 AM
To: Iouri Tarassov <[email protected]>
Cc: [email protected]; Yu, Lang <[email protected]>
Subject: [PATCH] drivers: hv: dxgkrnl: Allow user to specify CPU VA for device allocationThe movtivation is we want to unify CPU VA and GPU VA.
Signed-off-by Lang Yu <[email protected]>
Quoted 8 lines
Quoted 5 lines
Hi Lang,
The driver is not merged upstream. I won't take any further action here because there is nothing I can do. Perhaps you can work directly with Iouri to merge the change to the driver he maintains.
Thanks. Got it.
https://github.com/microsoft/WSL2-Linux-Kernel?tab=readme-ov-file#feature-requests tells me submitting the change upstream.
That's true in general,but in this case because the driver itself is not upstreamed yet so it cannot be applied.
Don't let this discourage you. If you author changes to code that is already upstreamed, do submit them to the respective mailing lists.
Thanks,
Wei.
Quoted 6 lines
Regards,
LangQuoted 2 lines
Thanks,
Wei.