Change vring space from nomal memory to dma coherent memory
Subsystems (2)
v5 cover Change vring space from nomal memory to dma coherent memory
Changes in V5:
1. Reorganize the vop_mmap function code in patch 1, which is done by Christoph.
2. Completely remove the unnecessary code related to reassign the used ring for card in patch 2.
The original vop driver only supports dma coherent device, as it allocates and maps vring by _get_free_pages and dma_map_single, but not use dma_sync_single_for_cpu/device to sync the updates of device_page/vring between EP and RC, which will cause memory synchronization problem for device don't support hardware dma coherent.
And allocate vrings use dma_alloc_coherent is a common way in kernel, as the memory interacted between two systems should use consistent memory to avoid caching effects. So here add noncoherent platform support for vop driver. Also add some related dma changes to make sure noncoherent platform works well.
Sherry Sun (2):
misc: vop: change the way of allocating vrings and device page
misc: vop: do not allocate and reassign the used ring
drivers/misc/mic/bus/vop_bus.h | 2 + drivers/misc/mic/host/mic_boot.c | 9 ++ drivers/misc/mic/host/mic_main.c | 43 ++------ drivers/misc/mic/vop/vop_debugfs.c | 4 - drivers/misc/mic/vop/vop_main.c | 70 +----------- drivers/misc/mic/vop/vop_vringh.c | 166 ++++++++++------------------- include/uapi/linux/mic_common.h | 9 +- 7 files changed, 85 insertions(+), 218 deletions(-)
Signature · 1 line
2.17.1
Greg KH
maintainerQuoted 21 lines · Sherry Sun
Changes in V5:
1. Reorganize thevop_mmapfunction code in patch 1, which is done by Christoph.
2. Completely remove the unnecessary code related to reassign the used ring for card in patch 2.The original vop driver only supports dma coherent device, as it allocates and maps vring by
_get_free_pagesanddma_map_single, but not use dma_sync_single_for_cpu/device to sync the updates of device_page/vring between EP and RC, which will cause memory synchronization problem for device don't support hardware dma coherent.And allocate vrings use
dma_alloc_coherentis a common way in kernel, as the memory interacted between two systems should use consistent memory to avoid caching effects. So here add noncoherent platform support for vop driver. Also add some related dma changes to make sure noncoherent platform works well.Sherry Sun (2):
misc: vop: change the way of allocating vrings and device page
misc: vop: do not allocate and reassign the used ring
Quoted 8 lines
drivers/misc/mic/bus/vop_bus.h | 2 + drivers/misc/mic/host/mic_boot.c | 9 ++ drivers/misc/mic/host/mic_main.c | 43 ++------ drivers/misc/mic/vop/vop_debugfs.c | 4 - drivers/misc/mic/vop/vop_main.c | 70 +----------- drivers/misc/mic/vop/vop_vringh.c | 166 ++++++++++------------------- include/uapi/linux/mic_common.h | 9 +- 7 files changed, 85 insertions(+), 218 deletions(-)
Have you all seen:
https://lore.kernel.org/r/8c1443136563de34699d2c084df478181c205db4.1603854416.git.sudeep.dutt@intel.com
Looks like this code is asking to just be deleted, is that ok with you?
thanks,
greg k-h
Hi Greg,
Quoted 46 lines
Subject: Re: [PATCH V5 0/2] Change vring space from nomal memory to dma coherent memory
Quoted 2 lines · Sherry Sun
Changes in V5:
1. Reorganize thevop_mmapfunction code in patch 1, which is done byChristoph.
Quoted 9 lines
2. Completely remove the unnecessary code related to reassign the used ring for card in patch 2.
The original vop driver only supports dma coherent device, as it allocates and maps vring by
_get_free_pagesanddma_map_single, but not use dma_sync_single_for_cpu/device to sync the updates of device_page/vring between EP and RC, which will cause memory synchronization problem for device don't support hardware dma coherent.Quoted 3 lines
And allocate vrings use
dma_alloc_coherentis a common way in kernel, as the memory interacted between two systems should use consistent memory to avoid caching effects. So here add noncoherent platformsupport for vop driver.
Quoted 7 lines
Also add some related dma changes to make sure noncoherent platform works well.
Sherry Sun (2):
misc: vop: change the way of allocating vrings and device page
misc: vop: do not allocate and reassign the used ringQuoted 8 lines
drivers/misc/mic/bus/vop_bus.h | 2 + drivers/misc/mic/host/mic_boot.c | 9 ++ drivers/misc/mic/host/mic_main.c | 43 ++------ drivers/misc/mic/vop/vop_debugfs.c | 4 - drivers/misc/mic/vop/vop_main.c | 70 +----------- drivers/misc/mic/vop/vop_vringh.c | 166 ++++++++++------------------- include/uapi/linux/mic_common.h | 9 +- 7 files changed, 85 insertions(+), 218 deletions(-)Have you all seen:
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.kernel.org%2Fr%2F8c1443136563de34699d2c084df478181c205db4.16 03854416.git.sudeep.dutt%40intel.com&data=04%7C01%7Csherry.sun% 40nxp.com%7Cc19c987667434969847e08d87b0685e8%7C686ea1d3bc2b4c6f a92cd99c5c301635%7C0%7C0%7C637394615238940323%7CUnknown%7CTW FpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJX VCI6Mn0%3D%7C1000&sdata=Zq%2FtHWTq%2BuIVBYXFGoeBmq0JJzYd 9zDyv4NVN4TpC%2FU%3D&reserved=0
Quoted 1 line
Looks like this code is asking to just be deleted, is that ok with you?
Yes, I saw that patch. I'm ok with it.
Best regards
Sherry
Quoted 4 lines
thanks,
greg k-h
Greg KH
maintainerQuoted 48 lines · Sherry Sun
Hi Greg,
Quoted 46 lines
Subject: Re: [PATCH V5 0/2] Change vring space from nomal memory to dma coherent memory
Quoted 2 lines · Sherry Sun
Changes in V5:
1. Reorganize thevop_mmapfunction code in patch 1, which is done byChristoph.
Quoted 9 lines
2. Completely remove the unnecessary code related to reassign the used ring for card in patch 2.
The original vop driver only supports dma coherent device, as it allocates and maps vring by
_get_free_pagesanddma_map_single, but not use dma_sync_single_for_cpu/device to sync the updates of device_page/vring between EP and RC, which will cause memory synchronization problem for device don't support hardware dma coherent.Quoted 3 lines
And allocate vrings use
dma_alloc_coherentis a common way in kernel, as the memory interacted between two systems should use consistent memory to avoid caching effects. So here add noncoherent platformsupport for vop driver.
Quoted 7 lines
Also add some related dma changes to make sure noncoherent platform works well.
Sherry Sun (2):
misc: vop: change the way of allocating vrings and device page
misc: vop: do not allocate and reassign the used ringQuoted 8 lines
drivers/misc/mic/bus/vop_bus.h | 2 + drivers/misc/mic/host/mic_boot.c | 9 ++ drivers/misc/mic/host/mic_main.c | 43 ++------ drivers/misc/mic/vop/vop_debugfs.c | 4 - drivers/misc/mic/vop/vop_main.c | 70 +----------- drivers/misc/mic/vop/vop_vringh.c | 166 ++++++++++------------------- include/uapi/linux/mic_common.h | 9 +- 7 files changed, 85 insertions(+), 218 deletions(-)Have you all seen:
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.kernel.org%2Fr%2F8c1443136563de34699d2c084df478181c205db4.16 03854416.git.sudeep.dutt%40intel.com&data=04%7C01%7Csherry.sun% 40nxp.com%7Cc19c987667434969847e08d87b0685e8%7C686ea1d3bc2b4c6f a92cd99c5c301635%7C0%7C0%7C637394615238940323%7CUnknown%7CTW FpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJX VCI6Mn0%3D%7C1000&sdata=Zq%2FtHWTq%2BuIVBYXFGoeBmq0JJzYd 9zDyv4NVN4TpC%2FU%3D&reserved=0
Quoted 3 lines
Quoted 1 line
Looks like this code is asking to just be deleted, is that ok with you?
Yes, I saw that patch. I'm ok with it.
Great, can you please provide a "Reviewed-by:" or "Acked-by:" for it?
thanks,
greg k-h
Quoted 61 lines
Subject: Re: [PATCH V5 0/2] Change vring space from nomal memory to dma coherent memory
Quoted 18 lines · Sherry Sun
Hi Greg,
Quoted 16 lines
Subject: Re: [PATCH V5 0/2] Change vring space from nomal memory to dma coherent memory
Quoted 3 lines · Sherry Sun
Changes in V5:
1. Reorganize thevop_mmapfunction code in patch 1, which is done byChristoph.
Quoted 8 lines
2. Completely remove the unnecessary code related to reassign the used ring for card in patch 2.
The original vop driver only supports dma coherent device, as it allocates and maps vring by
_get_free_pagesanddma_map_single, but not use dma_sync_single_for_cpu/device to sync the updates of device_page/vring between EP and RC, which will cause memory synchronization problem for device don't support hardware dmacoherent.
Quoted 22 lines
Quoted 22 lines
Quoted 5 lines
And allocate vrings use
dma_alloc_coherentis a common way in kernel, as the memory interacted between two systems should use consistent memory to avoid caching effects. So here add noncoherent platformsupport for vop driver.
Quoted 15 lines
Also add some related dma changes to make sure noncoherent platform works well.
Sherry Sun (2):
misc: vop: change the way of allocating vrings and device page
misc: vop: do not allocate and reassign the used ringdrivers/misc/mic/bus/vop_bus.h | 2 + drivers/misc/mic/host/mic_boot.c | 9 ++ drivers/misc/mic/host/mic_main.c | 43 ++------ drivers/misc/mic/vop/vop_debugfs.c | 4 - drivers/misc/mic/vop/vop_main.c | 70 +----------- drivers/misc/mic/vop/vop_vringh.c | 166 ++++++++++------------------- include/uapi/linux/mic_common.h | 9 +- 7 files changed, 85 insertions(+), 218 deletions(-)Quoted 2 lines
Quoted 2 lines
Have you all seen:
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%25
Quoted 1 line
Quoted 1 line
2Flore.kernel.org%2Fr%2F8c1443136563de34699d2c084df478181c205db4.16
Quoted 1 line
Quoted 1 line
03854416.git.sudeep.dutt%40intel.com&data=04%7C01%7Csherry.sun%
Quoted 1 line
Quoted 1 line
40nxp.com%7Cc19c987667434969847e08d87b0685e8%7C686ea1d3bc2b4c6f
Quoted 1 line
Quoted 1 line
a92cd99c5c301635%7C0%7C0%7C637394615238940323%7CUnknown%7CTW
Quoted 1 line
Quoted 1 line
FpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJX
Quoted 1 line
Quoted 1 line
Quoted 9 lines
VCI6Mn0%3D%7C1000&sdata=Zq%2FtHWTq%2BuIVBYXFGoeBmq0JJzYd
Quoted 5 lines
Quoted 3 lines
9zDyv4NVN4TpC%2FU%3D&reserved=0
Looks like this code is asking to just be deleted, is that ok with you?
Yes, I saw that patch. I'm ok with it.
Great, can you please provide a "Reviewed-by:" or "Acked-by:" for it?
Sure.
Best regards
Sherry
Quoted 3 lines
thanks,
greg k-h
From: Greg KH <[email protected]> Sent: Wednesday, October 28, 2020 3:07 PM
Quoted 60 lines · Sherry Sun
Quoted 44 lines
Hi Greg,
Quoted 42 lines
Subject: Re: [PATCH V5 0/2] Change vring space from nomal memory to dma coherent memory
Quoted 3 lines · Sherry Sun
Changes in V5:
1. Reorganize thevop_mmapfunction code in patch 1, which is done byChristoph.
Quoted 9 lines
2. Completely remove the unnecessary code related to reassign the used ring for card in patch 2.
The original vop driver only supports dma coherent device, as it allocates and maps vring by
_get_free_pagesanddma_map_single, but not use dma_sync_single_for_cpu/device to sync the updates of device_page/vring between EP and RC, which will cause memory synchronization problem for device don't support hardware dma coherent.Quoted 4 lines
And allocate vrings use
dma_alloc_coherentis a common way in kernel, as the memory interacted between two systems should use consistent memory to avoid caching effects. So here add noncoherent platformsupport for vop driver.
Quoted 7 lines
Also add some related dma changes to make sure noncoherent platform works well.
Sherry Sun (2):
misc: vop: change the way of allocating vrings and device page
misc: vop: do not allocate and reassign the used ringQuoted 8 lines
drivers/misc/mic/bus/vop_bus.h | 2 + drivers/misc/mic/host/mic_boot.c | 9 ++ drivers/misc/mic/host/mic_main.c | 43 ++------ drivers/misc/mic/vop/vop_debugfs.c | 4 - drivers/misc/mic/vop/vop_main.c | 70 +----------- drivers/misc/mic/vop/vop_vringh.c | 166 ++++++++++------------------- include/uapi/linux/mic_common.h | 9 +- 7 files changed, 85 insertions(+), 218 deletions(-)Have you all seen:
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%25
2Flore.kernel.org%2Fr%2F8c1443136563de34699d2c084df478181c205db4.16
Quoted 1 line
Quoted 1 line
03854416.git.sudeep.dutt%40intel.com&data=04%7C01%7Csherry.sun%
Quoted 1 line
Quoted 1 line
40nxp.com%7Cc19c987667434969847e08d87b0685e8%7C686ea1d3bc2b4c6f
Quoted 1 line
Quoted 1 line
a92cd99c5c301635%7C0%7C0%7C637394615238940323%7CUnknown%7CTW
Quoted 1 line
Quoted 1 line
FpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJX
Quoted 1 line
Quoted 1 line
VCI6Mn0%3D%7C1000&sdata=Zq%2FtHWTq%2BuIVBYXFGoeBmq0JJzYd
Quoted 4 lines
Quoted 3 lines
9zDyv4NVN4TpC%2FU%3D&reserved=0
Looks like this code is asking to just be deleted, is that ok with you?
Quoted 7 lines
Quoted 1 line
Yes, I saw that patch. I'm ok with it.
Great, can you please provide a "Reviewed-by:" or "Acked-by:" for it?
thanks,
greg k-h
Sherry took much effort on the features support on i.MX series like i.MX8QM/i.MX8QXP/i.MX8MM.
Now it is a pity to delete the vop code.
One question,
can we resubmit vop code by clean up, now only for i.MX series as Dutt's suggestion ? Or we have to drop the design and switch to select other solutions ?
Thanks,
Andy
Greg KH
maintainerQuoted 69 lines · Andy Duan
From: Greg KH <[email protected]> Sent: Wednesday, October 28, 2020 3:07 PM
Quoted 60 lines · Sherry Sun
Quoted 44 lines
Hi Greg,
Quoted 42 lines
Subject: Re: [PATCH V5 0/2] Change vring space from nomal memory to dma coherent memory
Quoted 3 lines · Sherry Sun
Changes in V5:
1. Reorganize thevop_mmapfunction code in patch 1, which is done byChristoph.
Quoted 9 lines
2. Completely remove the unnecessary code related to reassign the used ring for card in patch 2.
The original vop driver only supports dma coherent device, as it allocates and maps vring by
_get_free_pagesanddma_map_single, but not use dma_sync_single_for_cpu/device to sync the updates of device_page/vring between EP and RC, which will cause memory synchronization problem for device don't support hardware dma coherent.Quoted 4 lines
And allocate vrings use
dma_alloc_coherentis a common way in kernel, as the memory interacted between two systems should use consistent memory to avoid caching effects. So here add noncoherent platformsupport for vop driver.
Quoted 7 lines
Also add some related dma changes to make sure noncoherent platform works well.
Sherry Sun (2):
misc: vop: change the way of allocating vrings and device page
misc: vop: do not allocate and reassign the used ringQuoted 8 lines
drivers/misc/mic/bus/vop_bus.h | 2 + drivers/misc/mic/host/mic_boot.c | 9 ++ drivers/misc/mic/host/mic_main.c | 43 ++------ drivers/misc/mic/vop/vop_debugfs.c | 4 - drivers/misc/mic/vop/vop_main.c | 70 +----------- drivers/misc/mic/vop/vop_vringh.c | 166 ++++++++++------------------- include/uapi/linux/mic_common.h | 9 +- 7 files changed, 85 insertions(+), 218 deletions(-)Have you all seen:
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%25
2Flore.kernel.org%2Fr%2F8c1443136563de34699d2c084df478181c205db4.16
Quoted 1 line
Quoted 1 line
03854416.git.sudeep.dutt%40intel.com&data=04%7C01%7Csherry.sun%
Quoted 1 line
Quoted 1 line
40nxp.com%7Cc19c987667434969847e08d87b0685e8%7C686ea1d3bc2b4c6f
Quoted 1 line
Quoted 1 line
a92cd99c5c301635%7C0%7C0%7C637394615238940323%7CUnknown%7CTW
Quoted 1 line
Quoted 1 line
FpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJX
Quoted 1 line
Quoted 1 line
VCI6Mn0%3D%7C1000&sdata=Zq%2FtHWTq%2BuIVBYXFGoeBmq0JJzYd
Quoted 4 lines
Quoted 3 lines
9zDyv4NVN4TpC%2FU%3D&reserved=0
Looks like this code is asking to just be deleted, is that ok with you?
Quoted 7 lines
Quoted 1 line
Yes, I saw that patch. I'm ok with it.
Great, can you please provide a "Reviewed-by:" or "Acked-by:" for it?
thanks,
greg k-h
Quoted 7 lines
Sherry took much effort on the features support on i.MX series like i.MX8QM/i.MX8QXP/i.MX8MM.
Now it is a pity to delete the vop code.
One question,
can we resubmit vop code by clean up, now only for i.MX series as Dutt's suggestion ? Or we have to drop the design and switch to select other solutions ?
If this whole subsystem is being deleted because it is not used and never shipped, yes, please use a different solution.
I don't understand why you were trying to piggy-back on this codebase if the hardware was totally different, for some reason I thought this was the same hardware. What exactly is this?
thanks,
greg k-h
From: Greg KH <[email protected]> Sent: Wednesday, October 28, 2020 7:14 PM
Quoted 79 lines · Andy Duan
Quoted 21 lines
From: Greg KH <[email protected]> Sent: Wednesday, October 28, 2020 3:07 PM
Quoted 19 lines · Sherry Sun
Quoted 18 lines
Hi Greg,
Quoted 16 lines
Subject: Re: [PATCH V5 0/2] Change vring space from nomal memory to dma coherent memory
Quoted 3 lines · Sherry Sun
Changes in V5:
1. Reorganize thevop_mmapfunction code in patch 1, which is done byChristoph.
Quoted 8 lines
2. Completely remove the unnecessary code related to reassign the used ring for card in patch 2.
The original vop driver only supports dma coherent device, as it allocates and maps vring by
_get_free_pagesanddma_map_single, but not use dma_sync_single_for_cpu/device to sync the updates of device_page/vring between EP and RC, which will cause memory synchronization problem for device don't supporthardware dma coherent.
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 5 lines
And allocate vrings use
dma_alloc_coherentis a common way in kernel, as the memory interacted between two systems should use consistent memory to avoid caching effects. So here add noncoherent platformsupport for vop driver.
Quoted 15 lines
Also add some related dma changes to make sure noncoherent platform works well.
Sherry Sun (2):
misc: vop: change the way of allocating vrings and device page
misc: vop: do not allocate and reassign the used ringdrivers/misc/mic/bus/vop_bus.h | 2 + drivers/misc/mic/host/mic_boot.c | 9 ++ drivers/misc/mic/host/mic_main.c | 43 ++------ drivers/misc/mic/vop/vop_debugfs.c | 4 - drivers/misc/mic/vop/vop_main.c | 70 +----------- drivers/misc/mic/vop/vop_vringh.c | 166 ++++++++++------------------- include/uapi/linux/mic_common.h | 9 +- 7 files changed, 85 insertions(+), 218 deletions(-)Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 5 lines
Have you all seen:
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%
252Flore.kernel.org%2Fr%2F8c1443136563de34699d2c084df478181c205db4.16
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line
03854416.git.sudeep.dutt%40intel.com&data=04%7C01%7Csherry.sun%
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line
40nxp.com%7Cc19c987667434969847e08d87b0685e8%7C686ea1d3bc2b4c6f
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line
a92cd99c5c301635%7C0%7C0%7C637394615238940323%7CUnknown%7CTW
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line
FpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJX
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line
VCI6Mn0%3D%7C1000&sdata=Zq%2FtHWTq%2BuIVBYXFGoeBmq0JJzYd
Quoted 12 lines
Quoted 11 lines
Quoted 5 lines
Quoted 3 lines
9zDyv4NVN4TpC%2FU%3D&reserved=0
Looks like this code is asking to just be deleted, is that ok with you?
Yes, I saw that patch. I'm ok with it.
Great, can you please provide a "Reviewed-by:" or "Acked-by:" for it?
thanks,
greg k-h
Quoted 10 lines
Quoted 1 line
Sherry took much effort on the features support on i.MX series like
i.MX8QM/i.MX8QXP/i.MX8MM.
Quoted 5 lines
Now it is a pity to delete the vop code.
One question,
can we resubmit vop code by clean up, now only for i.MX series as Dutt'ssuggestion ?
Quoted 1 line
Or we have to drop the design and switch to select other solutions ?
Okay, we plan to switch to NTB solution.
Quoted 6 lines
If this whole subsystem is being deleted because it is not used and never shipped, yes, please use a different solution.
I don't understand why you were trying to piggy-back on this codebase if the hardware was totally different, for some reason I thought this was the same hardware. What exactly is this?
Not the whole codebase, just the vop framework.
Quoted 4 lines
thanks,
greg k-h
Greg KH
maintainerQuoted 85 lines · Andy Duan
From: Greg KH <[email protected]> Sent: Wednesday, October 28, 2020 7:14 PM
Quoted 84 lines · Andy Duan
Quoted 21 lines
From: Greg KH <[email protected]> Sent: Wednesday, October 28, 2020 3:07 PM
Quoted 19 lines · Sherry Sun
Quoted 18 lines
Hi Greg,
Quoted 16 lines
Subject: Re: [PATCH V5 0/2] Change vring space from nomal memory to dma coherent memory
Quoted 3 lines · Sherry Sun
Changes in V5:
1. Reorganize thevop_mmapfunction code in patch 1, which is done byChristoph.
Quoted 8 lines
2. Completely remove the unnecessary code related to reassign the used ring for card in patch 2.
The original vop driver only supports dma coherent device, as it allocates and maps vring by
_get_free_pagesanddma_map_single, but not use dma_sync_single_for_cpu/device to sync the updates of device_page/vring between EP and RC, which will cause memory synchronization problem for device don't supporthardware dma coherent.
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 5 lines
And allocate vrings use
dma_alloc_coherentis a common way in kernel, as the memory interacted between two systems should use consistent memory to avoid caching effects. So here add noncoherent platformsupport for vop driver.
Quoted 15 lines
Also add some related dma changes to make sure noncoherent platform works well.
Sherry Sun (2):
misc: vop: change the way of allocating vrings and device page
misc: vop: do not allocate and reassign the used ringdrivers/misc/mic/bus/vop_bus.h | 2 + drivers/misc/mic/host/mic_boot.c | 9 ++ drivers/misc/mic/host/mic_main.c | 43 ++------ drivers/misc/mic/vop/vop_debugfs.c | 4 - drivers/misc/mic/vop/vop_main.c | 70 +----------- drivers/misc/mic/vop/vop_vringh.c | 166 ++++++++++------------------- include/uapi/linux/mic_common.h | 9 +- 7 files changed, 85 insertions(+), 218 deletions(-)Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 5 lines
Have you all seen:
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%
252Flore.kernel.org%2Fr%2F8c1443136563de34699d2c084df478181c205db4.16
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line
03854416.git.sudeep.dutt%40intel.com&data=04%7C01%7Csherry.sun%
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line
40nxp.com%7Cc19c987667434969847e08d87b0685e8%7C686ea1d3bc2b4c6f
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line
a92cd99c5c301635%7C0%7C0%7C637394615238940323%7CUnknown%7CTW
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line
FpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJX
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line
VCI6Mn0%3D%7C1000&sdata=Zq%2FtHWTq%2BuIVBYXFGoeBmq0JJzYd
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines
9zDyv4NVN4TpC%2FU%3D&reserved=0
Looks like this code is asking to just be deleted, is that ok with you?
Yes, I saw that patch. I'm ok with it.
Quoted 7 lines
Quoted 5 lines
Great, can you please provide a "Reviewed-by:" or "Acked-by:" for it?
thanks,
greg k-h
Sherry took much effort on the features support on i.MX series like
i.MX8QM/i.MX8QXP/i.MX8MM.
Quoted 3 lines
Now it is a pity to delete the vop code.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
One question,
can we resubmit vop code by clean up, now only for i.MX series as Dutt'ssuggestion ?
Quoted 1 line
Or we have to drop the design and switch to select other solutions ?
Okay, we plan to switch to NTB solution.
What is a "NTB solution" exactly?
Quoted 9 lines
Quoted 7 lines
If this whole subsystem is being deleted because it is not used and never shipped, yes, please use a different solution.
I don't understand why you were trying to piggy-back on this codebase if the hardware was totally different, for some reason I thought this was the same hardware. What exactly is this?
Not the whole codebase, just the vop framework.
That didn't answer the question at all, what are you all trying to do here, with what hardware, that the VOP code seemed like a good fit?
thanks,
greg k-h
Hi Greg,
Quoted 103 lines
Subject: Re: [EXT] Re: [PATCH V5 0/2] Change vring space from nomal memory to dma coherent memory
Quoted 45 lines · Andy Duan
From: Greg KH <[email protected]> Sent: Wednesday, October 28, 2020 7:14 PM
Quoted 43 lines · Andy Duan
Quoted 22 lines
From: Greg KH <[email protected]> Sent: Wednesday, October 28, 2020 3:07 PM
Quoted 20 lines · Sherry Sun
Quoted 19 lines
Hi Greg,
Quoted 17 lines
Subject: Re: [PATCH V5 0/2] Change vring space from nomal memory to dma coherent memory
Quoted 3 lines · Sherry Sun
Changes in V5:
1. Reorganize thevop_mmapfunction code in patch 1, which is done byChristoph.
Quoted 9 lines
2. Completely remove the unnecessary code related to reassign the used ring for card in patch 2.
The original vop driver only supports dma coherent device, as it allocates and maps vring by
_get_free_pagesanddma_map_single, but not use dma_sync_single_for_cpu/device to sync the updates of device_page/vring between EP and RC, which will cause memory synchronization problem for device don't supporthardware dma coherent.
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 5 lines
And allocate vrings use
dma_alloc_coherentis a common way in kernel, as the memory interacted between two systems should use consistent memory to avoid caching effects. So here add noncoherent platformsupport for vop driver.
Quoted 13 lines
Also add some related dma changes to make sure noncoherent platform works well.
Sherry Sun (2):
misc: vop: change the way of allocating vrings and device page
misc: vop: do not allocate and reassign the used ringdrivers/misc/mic/bus/vop_bus.h | 2 + drivers/misc/mic/host/mic_boot.c | 9 ++ drivers/misc/mic/host/mic_main.c | 43 ++------ drivers/misc/mic/vop/vop_debugfs.c | 4 - drivers/misc/mic/vop/vop_main.c | 70 +----------- drivers/misc/mic/vop/vop_vringh.c | 166 ++++++++++-------------------
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Quoted 9 lines
Quoted 2 lines
include/uapi/linux/mic_common.h | 9 +- 7 files changed, 85 insertions(+), 218 deletions(-)Have you all seen:
https://eur01.safelinks.protection.outlook.com/?url=https%3A
%2F%25
252Flore.kernel.org%2Fr%2F8c1443136563de34699d2c084df478181c205db4.16
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line
03854416.git.sudeep.dutt%40intel.com&data=04%7C01%7Csherry.sun%
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line
40nxp.com%7Cc19c987667434969847e08d87b0685e8%7C686ea1d3bc2b4c6f
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line
a92cd99c5c301635%7C0%7C0%7C637394615238940323%7CUnknown%7CTW
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line
FpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJX
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line
VCI6Mn0%3D%7C1000&sdata=Zq%2FtHWTq%2BuIVBYXFGoeBmq0JJzYd
Quoted 21 lines
Quoted 21 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines
9zDyv4NVN4TpC%2FU%3D&reserved=0
Looks like this code is asking to just be deleted, is that ok with you?
Yes, I saw that patch. I'm ok with it.
Quoted 8 lines
Quoted 5 lines
Great, can you please provide a "Reviewed-by:" or "Acked-by:" for it?
thanks,
greg k-h
Sherry took much effort on the features support on i.MX series like
i.MX8QM/i.MX8QXP/i.MX8MM.
Quoted 6 lines
Now it is a pity to delete the vop code.
One question,
can we resubmit vop code by clean up, now only for i.MX series as Dutt's
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
suggestion ?
Quoted 1 line
Or we have to drop the design and switch to select other solutions ?
Okay, we plan to switch to NTB solution.
What is a "NTB solution" exactly?
The driver located at drivers/ntb/, it also can setup a point-to-point PCI-E bus connecting between two systems. But we haven't got a deep look of this driver yet, so we are not sure whether it can replace the vop framework.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
If this whole subsystem is being deleted because it is not used and never shipped, yes, please use a different solution.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
I don't understand why you were trying to piggy-back on this codebase if the hardware was totally different, for some reason I thought this was the same hardware. What exactly is this?
Not the whole codebase, just the vop framework.
That didn't answer the question at all, what are you all trying to do here, with what hardware, that the VOP code seemed like a good fit?
Vop is a common framework which is independent of the Intel MIC hardware.
We planed to reuse vop framework on two arm64 architecture devices, to setup the connection between two systems based on virtio over PCIE.
Best regards
Sherry
Quoted 4 lines
thanks,
greg k-h
Quoted 78 lines · Sherry Sun
Hi Greg,
Quoted 76 lines
Subject: Re: [EXT] Re: [PATCH V5 0/2] Change vring space from nomal memory to dma coherent memory
Quoted 64 lines · Andy Duan
From: Greg KH <[email protected]> Sent: Wednesday, October
28, 2020 7:14 PMQuoted 61 lines · Andy Duan
Quoted 30 lines
From: Greg KH <[email protected]> Sent: Wednesday, October 28, 2020 3:07 PM
Quoted 28 lines · Sherry Sun
Quoted 27 lines
Hi Greg,
Quoted 25 lines
Subject: Re: [PATCH V5 0/2] Change vring space from nomal
memory to dma coherent memoryQuoted 4 lines · Sherry Sun
Changes in V5:
1. Reorganize thevop_mmapfunction code in patch 1, which
is done byChristoph.
Quoted 13 lines
2. Completely remove the unnecessary code related to reassign the used ring for card in patch 2.
The original vop driver only supports dma coherent device,
as it allocates and maps vring by_get_free_pagesanddma_map_single, but not use dma_sync_single_for_cpu/device
to sync the updates of device_page/vring between EP and
RC, which will cause memory synchronization problem for
device don't supporthardware dma coherent.
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 8 lines
And allocate vrings use
dma_alloc_coherentis a
common way
in kernel, as the memory interacted between two
systems
should use consistent memory to avoid caching
effects. So
here add noncoherent platformsupport for vop driver.
Quoted 18 lines
Also add some related dma changes to make sure
noncoherent
platform works well.Sherry Sun (2):
misc: vop: change the way of allocating vrings and
device page
misc: vop: do not allocate and reassign the used
ringdrivers/misc/mic/bus/vop_bus.h | 2 + drivers/misc/mic/host/mic_boot.c | 9 ++ drivers/misc/mic/host/mic_main.c | 43 ++------ drivers/misc/mic/vop/vop_debugfs.c | 4 - drivers/misc/mic/vop/vop_main.c | 70 +-------- --- drivers/misc/mic/vop/vop_vringh.c | 166 ++++++++++-------------
------
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
include/uapi/linux/mic_common.h | 9 +- 7 files changed, 85 insertions(+), 218 deletions(-)Have you all seen:
https://eur01.safelinks.protection.outlook.com/?url=https%3A
Quoted 40 lines
Quoted 40 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
%2F%25
252Flore.kernel.org%2Fr%2F8c1443136563de34699d2c084df478181c205db4.16
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
03854416.git.sudeep.dutt%40intel.com&data=04%7C01%7Csherry.sun%
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
40nxp.com%7Cc19c987667434969847e08d87b0685e8%7C686ea1d3bc2b4c6f
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
a92cd99c5c301635%7C0%7C0%7C637394615238940323%7CUnknown%7CTW
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
FpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJX
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
VCI6Mn0%3D%7C1000&sdata=Zq%2FtHWTq%2BuIVBYXFGoeBmq0JJzYd
Quoted 20 lines
Quoted 20 lines
Quoted 10 lines
Quoted 10 lines
Quoted 6 lines
Quoted 4 lines
9zDyv4NVN4TpC%2FU%3D&reserved=0
Looks like this code is asking to just be deleted, is that ok with you?
Yes, I saw that patch. I'm ok with it.
Great, can you please provide a "Reviewed-by:" or "Acked- by:" for it?
Quoted 7 lines
Quoted 3 lines
thanks,
greg k-h
Sherry took much effort on the features support on i.MX series
likei.MX8QM/i.MX8QXP/i.MX8MM.
Quoted 1 line
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Now it is a pity to delete the vop code.
One question,
can we resubmit vop code by clean up, now only for i.MX series as
Dutt'ssuggestion ?
Resubmitting the VOP code with cleanups tailored for i.MX makes sense to me.
Quoted 29 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
Or we have to drop the design and switch to select other solutions ?
Okay, we plan to switch to NTB solution.
What is a "NTB solution" exactly?
The driver located at
drivers/ntb/, it also can setup a point-to- point PCI-E bus connecting between two systems.
But we haven't got a deep look of this driver yet, so we are not sure whether it can replace the vop framework.Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
If this whole subsystem is being deleted because it is not used and
never shipped, yes, please use a different solution.I don't understand why you were trying to piggy-back on this codebase if the hardware was totally different, for some reason I
thought this was the same hardware. What exactly is this?Quoted 5 lines
Quoted 1 line
Not the whole codebase, just the vop framework.
That didn't answer the question at all, what are you all trying to do here, with
what hardware, that the VOP code seemed like a good fit?
Quoted 5 lines
Vop is a common framework which is independent of the Intel MIC hardware.
We planed to reuse vop framework on two arm64 architecture devices, to setup the connection between two systems based on virtio over PCIE.
Yes, we wanted Virtio Over PCIe (VOP) to be independent of the hardware as much as possible. It did end up under the mic/ driver subsystem though so it would be good to attempt placing it in a generic folder which is not tied to a specific hardware layer this time around.
Regards,
Sudeep Dutt
Quoted 2 lines · Greg KH
Have you all seen:
https://lore.kernel.org/r/8c1443136563de34699d2c084df478181c205db4.1603854416.git.sudeep.dutt@intel.com
No, that link doesn't work and I can't find that email from Sudeep in any of the archives:
https://lore.kernel.org/lkml/?q=f%3Asudeep.dutt%40intel.com
Sudeep, perhaps you could try to resend the patch? Thank you.
PATCH v5 1/2 misc: vop: change the way of allocating vrings and device page
In reply to Sherry SunAllocate vrings use dma_alloc_coherent is a common way in kernel. As the memory interacted between two systems should use consistent memory to avoid caching effects, same as device page memory.
The orginal way use __get_free_pages and dma_map_single to allocate and map vring, but not use dma_sync_single_for_cpu/device api to sync the changes of vring between EP and RC, which will cause memory synchronization problem for those devices which don't support hardware dma coherent.
Also change to use dma_mmap_coherent for mmap callback to map the device page and vring memory to userspace.
--- drivers/misc/mic/bus/vop_bus.h | 2 + drivers/misc/mic/host/mic_boot.c | 9 ++ drivers/misc/mic/host/mic_main.c | 43 +++------- drivers/misc/mic/vop/vop_vringh.c | 135 ++++++++++++------------------ 4 files changed, 77 insertions(+), 112 deletions(-)
drivers/misc/mic/bus/vop_bus.h +2 -0
@@ -75,6 +75,7 @@ struct vop_driver {* node to add/remove/configure virtio devices. * @get_dp: Get access to the virtio device page used by the self * node to add/remove/configure virtio devices. +* @dp_mmap: Map the virtio device page to userspace. * @send_intr: Send an interrupt to the peer node on a specified doorbell. * @remap: Map a buffer with the specified DMA address and length. * @unmap: Unmap a buffer previously mapped.
@@ -92,6 +93,7 @@ struct vop_hw_ops {void (*ack_interrupt)(struct vop_device *vpdev,int num);void __iomem * (*get_remote_dp)(struct vop_device *vpdev);void * (*get_dp)(struct vop_device *vpdev); +int (*dp_mmap)(struct vop_device *vpdev,struct vm_area_struct *vma);void (*send_intr)(struct vop_device *vpdev,int db);void __iomem * (*remap)(struct vop_device *vpdev,dma_addr_t pa,size_t len);
drivers/misc/mic/host/mic_boot.c +9 -0
@@ -89,6 +89,14 @@ static void *__mic_get_dp(struct vop_device *vpdev)return mdev->dp; } +static int __mic_dp_mmap (struct vop_device *vpdev,struct vm_area_struct *vma) +{ +struct mic_device *mdev =vpdev_to_mdev (&vpdev->dev); + +return dma_mmap_coherent (&mdev->pdev->dev, vma, mdev->dp, + mdev->dp_dma_addr,MIC_DP_SIZE ); +} +static void __iomem *__mic_get_remote_dp (struct vop_device *vpdev) {return NULL ;
@@ -120,6 +128,7 @@ static struct vop_hw_ops vop_hw_ops = { .ack_interrupt = __mic_ack_interrupt, .next_db = __mic_next_db, .get_dp = __mic_get_dp, + .dp_mmap = __mic_dp_mmap, .get_remote_dp = __mic_get_remote_dp, .send_intr = __mic_send_intr, .remap = __mic_ioremap,
drivers/misc/mic/host/mic_main.c +11 -32
75 lines not on this page · raw message
drivers/misc/mic/vop/vop_vringh.c +55 -80
188 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v5 2/2 misc: vop: do not allocate and reassign the used ring
In reply to Sherry SunWe don't need to allocate and reassign the used ring here and remove the used_address_updated flag. Since RC has allocated the entire vring, including the used ring. Simply add the corresponding offset can get the used ring address.
If following the orginal way to reassign the used ring, will encounter a problem. When host finished with descriptor, it will update the used ring with putused_kern api, if reassign used ring at EP side, used ring will be io device memory for RC, use memcpy in putused_kern will cause kernel panic.
--- drivers/misc/mic/vop/vop_debugfs.c | 4 -- drivers/misc/mic/vop/vop_main.c | 70 ++---------------------------- drivers/misc/mic/vop/vop_vringh.c | 31 ------------- include/uapi/linux/mic_common.h | 9 ++-- 4 files changed, 8 insertions(+), 106 deletions(-)
drivers/misc/mic/vop/vop_debugfs.c +0 -4
@@ -62,8 +62,6 @@ static int vop_dp_show(struct seq_file *s, void *pos)seq_printf (s,"address 0x%llx " , vqconfig->address);seq_printf (s,"num %d " , vqconfig->num); -seq_printf (s,"used address 0x%llx\n" , - vqconfig->used_address); } features = (__u32 *)mic_vq_features (d);
@@ -79,8 +77,6 @@ static int vop_dp_show(struct seq_file *s, void *pos)seq_printf (s,"Vdev reset %d\n" , dc->vdev_reset);seq_printf (s,"Guest Ack %d " , dc->guest_ack);seq_printf (s,"Host ack %d\n" , dc->host_ack); -seq_printf (s,"Used address updated %d " , - dc->used_address_updated);seq_printf (s,"Vdev 0x%llx\n" , dc->vdev);seq_printf (s,"c2h doorbell %d " , dc->c2h_vdev_db);seq_printf (s,"h2c doorbell %d\n" , dc->h2c_vdev_db);
drivers/misc/mic/vop/vop_main.c +4 -66
131 lines not on this page · raw message
drivers/misc/mic/vop/vop_vringh.c +0 -31
@@ -53,33 +53,6 @@ static void _vop_notify(struct vringh *vrh) vpdev->hw_ops->send_intr (vpdev, db); } -static void vop_virtio_init_post (struct vop_vdev *vdev) -{ -struct mic_vqconfig *vqconfig =mic_vq_config (vdev->dd); -struct vop_device *vpdev = vdev->vpdev; -int i, used_size; - -for (i =0 ; i < vdev->dd->num_vq; i++) { - used_size =PAGE_ALIGN (sizeof (u16) *3 + -sizeof (struct vring_used_elem ) * -le16_to_cpu (vqconfig->num)); -if (!le64_to_cpu (vqconfig[i].used_address)) { -dev_warn (vop_dev (vdev),"used_address zero??\n" ); -continue ; - } - vdev->vvr[i].vrh.vring.used = - (void __force *)vpdev->hw_ops->remap ( - vpdev, -le64_to_cpu (vqconfig[i].used_address), - used_size); - } - - vdev->dc->used_address_updated =0 ; - -dev_info (vop_dev (vdev),"%s: device type %d LINKUP\n" , - __func__, vdev->virtio_id); -} -static inline void vop_virtio_device_reset (struct vop_vdev *vdev) {int i;
@@ -130,9 +103,6 @@ static void vop_bh_handler(struct work_struct *work) struct vop_vdev *vdev = container_of(work, struct vop_vdev, virtio_bh_work); -if (vdev->dc->used_address_updated) -vop_virtio_init_post (vdev); -if (vdev->dc->vdev_reset)vop_virtio_device_reset (vdev);
@@ -250,7 +220,6 @@ static void vop_init_device_ctrl(struct vop_vdev *vdev, dc->guest_ack =0 ; dc->vdev_reset =0 ; dc->host_ack =0 ; - dc->used_address_updated =0 ; dc->c2h_vdev_db =-1 ; dc->h2c_vdev_db =-1 ; vdev->dc = dc;
include/uapi/linux/mic_common.h +4 -5
@@ -56,8 +56,7 @@ struct mic_device_desc {* @vdev_reset: Set to 1 by guest to indicate virtio device has been reset. * @guest_ack: Set to 1 by guest to ack a command. * @host_ack: Set to 1 by host to ack a command. -* @used_address_updated: Set to 1 by guest when the used address should be -* updated. +* @must_be_zero: Reserved because this bit is no longer needed. * @c2h_vdev_db: The doorbell number to be used by guest. Set by host. * @h2c_vdev_db: The doorbell number to be used by host. Set by guest. */
@@ -67,7 +66,7 @@ struct mic_device_ctrl {__u8 vdev_reset;__u8 guest_ack;__u8 host_ack; -__u8 used_address_updated; +__u8 must_be_zero;__s8 c2h_vdev_db;__s8 h2c_vdev_db; } __attribute__ ((aligned(8)));
@@ -110,12 +109,12 @@ struct mic_device_page {* * @address: Guest/MIC physical address of the virtio ring * (avail and desc rings) -* @used_address: Guest/MIC physical address of the used ring +* @must_be_zero: Reserved because this bit is no longer needed. * @num: The number of entries in the virtio_ring */ struct mic_vqconfig {__le64 address; -__le64 used_address; +__le64 must_be_zero;__le16 num; } __attribute__ ((aligned (8 )));
Signature · 1 line
2.17.1