UIO: Let uio_pdrv_genirq support cached memory
Subsystems (2)
PATCH 1/1 UIO: Let uio_pdrv_genirq support cached memory
If 'cacheable' DT property exists, the memory mapping will be done with UIO_MEM_IOVA instead of the default UIO_MEM_PHYS.
--- Documentation/driver-api/uio-howto.rst | 3 ++- drivers/uio/uio_pdrv_genirq.c | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-)
Documentation/driver-api/uio-howto.rst +2 -1
@@ -413,7 +413,8 @@ probed with the ``"of_id"`` module parameter set to the ``"compatible"`` string of the node the driver is supposed to handle. By default, the node's name (without the unit address) is exposed as name for the UIO device in userspace. To set a custom name, a property named -``"linux,uio-name"`` may be specified in the DT node. +``"linux,uio-name"`` may be specified in the DT node. If a property +named ``cacheable`` exists, the memory will be mapped cacheable. Using uio_dmem_genirq for platform devices ------------------------------------------
drivers/uio/uio_pdrv_genirq.c +6 -2
@@ -115,6 +115,7 @@ static int uio_pdrv_genirq_probe(struct platform_device *pdev)struct uio_mem *uiomem;int ret = -EINVAL ;int i; +int memtype =UIO_MEM_PHYS ;if (node) {const char *name;
@@ -132,7 +133,10 @@ static int uio_pdrv_genirq_probe(struct platform_device *pdev)else uioinfo->name =devm_kasprintf (&pdev->dev,GFP_KERNEL ,"%pOFn" , node); - +if (of_get_property (node,"cacheable" ,NULL )) { +dev_info (&pdev->dev,"%s cacheable\n" , uioinfo->name); + memtype =UIO_MEM_IOVA ; + } uioinfo->version ="devicetree" ;/* Multiple IRQs are not supported */ }
@@ -204,7 +208,7 @@ static int uio_pdrv_genirq_probe(struct platform_device *pdev)break ; } - uiomem->memtype =UIO_MEM_PHYS ; + uiomem->memtype = memtype; uiomem->addr = r->start &PAGE_MASK ; uiomem->offs = r->start & ~PAGE_MASK ; uiomem->size = (uiomem->offs + resource_size(r)
Greg KH
maintainerQuoted 58 lines · Indan Zupancic
If 'cacheable' DT property exists, the memory mapping will be done with
UIO_MEM_IOVAinstead of the defaultUIO_MEM_PHYS.--- Documentation/driver-api/uio-howto.rst | 3 ++- drivers/uio/uio_pdrv_genirq.c | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-)Documentation/driver-api/uio-howto.rst +0
-0@@ -413,7 +413,8 @@ probed with the ``"of_id"`` module parameter set to the``"compatible"``
string of the node the driver is supposed to handle. By default, the node's name (without the unit address) is exposed as name for the UIO device in userspace. To set a custom name, a property named
-``"linux,uio-name"`` may be specified in the DT node. +``"linux,uio-name"`` may be specified in the DT node. If a propertyDocumentation/driver-api/uio-howto.rst +1
-0+named ``cacheable`` exists, the memory will be mapped cacheable. Using uio_dmem_genirq for platform devices ------------------------------------------drivers/uio/uio_pdrv_genirq.c +1
-0@@ -115,6 +115,7 @@ static int uio_pdrv_genirq_probe(struct platform_device *pdev)struct uio_mem *uiomem;int ret = -EINVAL ;int i; +int memtype =UIO_MEM_PHYS ;if (node) {drivers/uio/uio_pdrv_genirq.c +4
-1const char *name;@@ -132,7 +133,10 @@ static int uio_pdrv_genirq_probe(struct platform_device *pdev) else uioinfo->name =devm_kasprintf (&pdev->dev,GFP_KERNEL ,"%pOFn" , node); - +if (of_get_property (node,"cacheable" ,NULL )) { +dev_info (&pdev->dev,"%s cacheable\n" , uioinfo->name); + memtype =UIO_MEM_IOVA ; + } uioinfo->version ="devicetree" ;/* Multiple IRQs are not supported */ drivers/uio/uio_pdrv_genirq.c +1
-1}@@ -204,7 +208,7 @@ static int uio_pdrv_genirq_probe(struct platform_device *pdev)break ; } - uiomem->memtype =UIO_MEM_PHYS ; + uiomem->memtype = memtype; uiomem->addr = r->start &PAGE_MASK ; uiomem->offs = r->start & ~PAGE_MASK ;
Quoted 2 lines
uiomem->size= (uiomem->offs+resource_size(r)
Hi,
This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree.
You are receiving this message because of the following common error(s) as indicated below:
- Your patch is malformed (tabs converted to spaces, linewrapped, etc.) and can not be applied. Please read the file, Documentation/email-clients.txt in order to fix this.
- Your patch does not have a Signed-off-by: line. Please read the kernel file, Documentation/SubmittingPatches and resend it after adding that line. Note, the line needs to be in the body of the email, before the patch, not at the bottom of the patch or in the email signature.
- You did not specify a description of why the patch is needed, or possibly, any description at all, in the email body. Please read the section entitled "The canonical patch format" in the kernel file, Documentation/SubmittingPatches for what is needed in order to properly describe the change.
- You did not write a descriptive Subject: for the patch, allowing Greg, and everyone else, to know what this patch is all about. Please read the section entitled "The canonical patch format" in the kernel file, Documentation/SubmittingPatches for what a proper Subject: line should look like.
If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers.
thanks,
greg k-h's patch email bot
PATCH v2 1/1 UIO: Let uio_pdrv_genirq support cached memory
In reply to Indan ZupancicIf 'cacheable' DT property exists, the memory mapping will be done with UIO_MEM_IOVA instead of the default UIO_MEM_PHYS.
--- Documentation/driver-api/uio-howto.rst | 3 ++- drivers/uio/uio_pdrv_genirq.c | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-)
Documentation/driver-api/uio-howto.rst +2 -1
@@ -413,7 +413,8 @@ probed with the ``"of_id"`` module parameter set to the ``"compatible"`` string of the node the driver is supposed to handle. By default, the node's name (without the unit address) is exposed as name for the UIO device in userspace. To set a custom name, a property named -``"linux,uio-name"`` may be specified in the DT node. +``"linux,uio-name"`` may be specified in the DT node. If a property +named ``cacheable`` exists, the memory will be mapped cacheable. Using uio_dmem_genirq for platform devices ------------------------------------------
drivers/uio/uio_pdrv_genirq.c +6 -2
@@ -115,6 +115,7 @@ static int uio_pdrv_genirq_probe(struct platform_device *pdev)struct uio_mem *uiomem;int ret = -EINVAL ;int i; +int memtype =UIO_MEM_PHYS ;if (node) {const char *name;
@@ -132,7 +133,10 @@ static int uio_pdrv_genirq_probe(struct platform_device *pdev)else uioinfo->name =devm_kasprintf (&pdev->dev,GFP_KERNEL ,"%pOFn" , node); - +if (of_get_property (node,"cacheable" ,NULL )) { +dev_info (&pdev->dev,"%s cacheable\n" , uioinfo->name); + memtype =UIO_MEM_IOVA ; + } uioinfo->version ="devicetree" ;/* Multiple IRQs are not supported */ }
@@ -204,7 +208,7 @@ static int uio_pdrv_genirq_probe(struct platform_device *pdev)break ; } - uiomem->memtype =UIO_MEM_PHYS ; + uiomem->memtype = memtype; uiomem->addr = r->start &PAGE_MASK ; uiomem->offs = r->start & ~PAGE_MASK ; uiomem->size = (uiomem->offs + resource_size(r)
Signature · 1 line
2.30.2
Quoted 8 lines · Indan Zupancic
If 'cacheable' DT property exists, the memory mapping will be done with
UIO_MEM_IOVAinstead of the defaultUIO_MEM_PHYS.Signed-off-by Indan Zupancic <[email protected]>--- Documentation/driver-api/uio-howto.rst | 3 ++- drivers/uio/uio_pdrv_genirq.c | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-)
I assume this is fundamentally OK? What else should be done to get this merged?
I plan to add similar functionality for uio_pci_generic, especially for the RedHat IVSHMEM pcie device where bar2 is just normal memory and should be marked as UIO_MEM_IOVA as this has performance implication, is that acceptable?
Cc'ed uio_pci_generic maintainer here.
Quoted 52 lines
Documentation/driver-api/uio-howto.rst +2
-1@@ -413,7 +413,8 @@ probed with the ``"of_id"`` module parameter set to the ``"compatible"`` string of the node the driver is supposed to handle. By default, the node's name (without the unit address) is exposed as name for the UIO device in userspace. To set a custom name, a property named -``"linux,uio-name"`` may be specified in the DT node. +``"linux,uio-name"`` may be specified in the DT node. If a property +named ``cacheable`` exists, the memory will be mapped cacheable. Using uio_dmem_genirq for platform devices ------------------------------------------drivers/uio/uio_pdrv_genirq.c +6
-2@@ -115,6 +115,7 @@ static int uio_pdrv_genirq_probe(struct platform_device *pdev)struct uio_mem *uiomem;int ret = -EINVAL ;int i; +int memtype =UIO_MEM_PHYS ;if (node) {const char *name;@@ -132,7 +133,10 @@ static int uio_pdrv_genirq_probe(struct platform_device *pdev)else uioinfo->name =devm_kasprintf (&pdev->dev,GFP_KERNEL ,"%pOFn" , node); - +if (of_get_property (node,"cacheable" ,NULL )) { +dev_info (&pdev->dev,"%s cacheable\n" , uioinfo->name); + memtype =UIO_MEM_IOVA ; + } uioinfo->version ="devicetree" ;/* Multiple IRQs are not supported */ }@@ -204,7 +208,7 @@ static int uio_pdrv_genirq_probe(struct platform_device *pdev)break ; } - uiomem->memtype =UIO_MEM_PHYS ; + uiomem->memtype = memtype; uiomem->addr = r->start &PAGE_MASK ; uiomem->offs = r->start & ~PAGE_MASK ; uiomem->size = (uiomem->offs + resource_size(r)Signature · 1 line
2.30.2